home.js 2.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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. // Au cas ou firefox garde la valeur step 2:
  8. $('input#form_add_step').val('1');
  9. return false;
  10. });
  11. // Fermeture de la zone "ajouter un element""
  12. $('#element_add_close_link').click(function(){
  13. $('#element_add_box').slideUp("slow");
  14. $('#element_add_link').show();
  15. $('form[name="search"]').slideDown();
  16. //form_add_reinit();
  17. // copie du contenu de la fonction ci dessus, arrive pas a l'appeler ... huh
  18. $('div#element_add_box').slideUp();
  19. $('div#form_add_first_part').show();
  20. $('div#form_add_second_part').hide();
  21. $('ul#form_add_prop_tags').hide();
  22. $('ul#form_add_prop_tags_text').hide();
  23. $('input#element_add_url').val('');
  24. $('input#element_add_name').val('');
  25. return false;
  26. });
  27. // Bouton suivre
  28. $('div.show_options a.following').live({
  29. mouseenter:
  30. function()
  31. {
  32. $(this).html(string_follow_stop);
  33. },
  34. mouseleave:
  35. function()
  36. {
  37. $(this).html(string_follow_following);
  38. }
  39. }
  40. );
  41. $('div.show_options a.follow_link').live('click', function(){
  42. link = $(this);
  43. $.getJSON(link.attr('href'), function(response) {
  44. if (response.status == 'mustbeconnected')
  45. {
  46. $(location).attr('href', url_index);
  47. }
  48. if (response.status == 'success')
  49. {
  50. if (response.following)
  51. {
  52. link.html(string_follow_following);
  53. link.removeClass('notfollowing');
  54. link.addClass('following');
  55. }
  56. else
  57. {
  58. link.html(string_follow_follow);
  59. link.addClass('notfollowing');
  60. link.removeClass('following');
  61. }
  62. }
  63. });
  64. return false;
  65. });
  66. });