moderate.js 2.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. $(document).ready(function(){
  2. $('ul#moderate_tags li.tag a.accept, ul#moderate_tags li.tag a.refuse').click(function(){
  3. var link = $(this);
  4. $.getJSON($(this).attr('href'), function(response) {
  5. if (response.status == 'mustbeconnected')
  6. {
  7. $(location).attr('href', url_index);
  8. }
  9. if (response.status == 'success')
  10. {
  11. link.parent('li').remove();
  12. }
  13. if (response.status == 'error')
  14. {
  15. alert(response.message);
  16. }
  17. });
  18. return false;
  19. });
  20. $('ul#moderate_tags li.tag a.replace').click(function(){
  21. var link = $(this);
  22. var newtag = link.parent('li').find('input.tagBox_tags_ids').val();
  23. $.getJSON($(this).attr('href')+'/'+newtag, function(response) {
  24. if (response.status == 'mustbeconnected')
  25. {
  26. $(location).attr('href', url_index);
  27. }
  28. if (response.status == 'error')
  29. {
  30. alert(response.message);
  31. }
  32. if (response.status == 'success')
  33. {
  34. link.parent('li').remove();
  35. }
  36. });
  37. return false;
  38. });
  39. $('ul#moderate_elements li.element div.controls a.delete').live('click', function(){
  40. var li = $(this).parent('div.controls').parent('li.element');
  41. $.getJSON($(this).attr('href'), function(response) {
  42. if (response.status == 'success')
  43. {
  44. li.slideUp(500, function(){li.remove();});
  45. }
  46. else
  47. {
  48. alert(response.status);
  49. }
  50. });
  51. return false;
  52. });
  53. $('ul#moderate_elements li.element div.controls a.clean').live('click', function(){
  54. var li = $(this).parent('div.controls').parent('li.element');
  55. $.getJSON($(this).attr('href'), function(response) {
  56. if (response.status == 'success')
  57. {
  58. li.slideUp(500, function(){li.remove();});
  59. }
  60. else
  61. {
  62. alert(response.status);
  63. }
  64. });
  65. return false;
  66. });
  67. $('ul#moderate_comments li.comment a.accept, ul#moderate_comments li.comment a.refuse').click(function(){
  68. var link = $(this);
  69. $.getJSON($(this).attr('href'), function(response) {
  70. if (response.status == 'mustbeconnected')
  71. {
  72. $(location).attr('href', url_index);
  73. }
  74. if (response.status == 'success')
  75. {
  76. link.parent('li').remove();
  77. }
  78. if (response.status == 'error')
  79. {
  80. alert(response.message);
  81. }
  82. });
  83. return false;
  84. });
  85. });