home.js 1.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. $(document).ready(function(){
  2. // Ouverture de la zone "ajouter un element""
  3. $('#element_add_link').click(function(){
  4. $('#element_add_box').slideDown("slow");
  5. $('#element_add_link').hide();
  6. $('form[name="search"]').slideUp();
  7. return false;
  8. });
  9. // Fermeture de la zone "ajouter un element""
  10. $('#element_add_close_link').click(function(){
  11. $('#element_add_box').slideUp("slow");
  12. $('#element_add_link').show();
  13. $('form[name="search"]').slideDown();
  14. return false;
  15. });
  16. // Bouton suivre
  17. $('div.show_options a.following').live({
  18. mouseenter:
  19. function()
  20. {
  21. $(this).html(string_follow_stop);
  22. },
  23. mouseleave:
  24. function()
  25. {
  26. $(this).html(string_follow_following);
  27. }
  28. }
  29. );
  30. $('div.show_options a.follow_link').live('click', function(){
  31. link = $(this);
  32. $.getJSON(link.attr('href'), function(response) {
  33. if (response.status == 'mustbeconnected')
  34. {
  35. $(location).attr('href', url_index);
  36. }
  37. if (response.status == 'success')
  38. {
  39. if (response.following)
  40. {
  41. link.html(string_follow_following);
  42. link.removeClass('notfollowing');
  43. link.addClass('following');
  44. }
  45. else
  46. {
  47. link.html(string_follow_follow);
  48. link.addClass('notfollowing');
  49. link.removeClass('following');
  50. }
  51. }
  52. });
  53. return false;
  54. });
  55. });