home.js 2.1KB

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