home.js 2.3KB

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