home.js 1.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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 == 'success')
  34. {
  35. if (response.following)
  36. {
  37. link.html(string_follow_following);
  38. link.removeClass('notfollowing');
  39. link.addClass('following');
  40. }
  41. else
  42. {
  43. link.html(string_follow_follow);
  44. link.addClass('notfollowing');
  45. link.removeClass('following');
  46. }
  47. }
  48. });
  49. return false;
  50. });
  51. });