zentaobiz.js 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. $(function()
  2. {
  3. $('.page-actions a.loadInModal').each(function()
  4. {
  5. var href = $(this).attr('href');
  6. if(href.indexOf('onlybody=yes') < 0) href = href + (href.indexOf('?') > 0 ? '&' : '?') + 'onlybody=yes';
  7. $(this).removeAttr('href').attr('data-rel', href);
  8. });
  9. $(document).off('click', '.deleteMakeup');
  10. $(document).off('click', '.reviewPass');
  11. href = $('a.deleteMakeup').attr('href');
  12. $('a.deleteMakeup').attr('href', '###').attr('data-href', href);
  13. $(document).on('click', '.deleteMakeup', function()
  14. {
  15. if(confirm(lang.confirmDelete))
  16. {
  17. $(this).text(lang.deleting);
  18. $.getJSON($(this).attr('data-href'), function(data)
  19. {
  20. if(data.result == 'success')
  21. {
  22. if(data.locate) return location.href = data.locate;
  23. return location.reload();
  24. }
  25. else
  26. {
  27. alert(data.message);
  28. if(selecter.parents('#ajaxModal').size()) return $.reloadAjaxModal(1200);
  29. return location.reload();
  30. }
  31. });
  32. }
  33. return false;
  34. });
  35. href = $('a.reviewPass').attr('href');
  36. $('a.reviewPass').attr('href', '###').attr('data-href', href);
  37. $(document).on('click', '.reviewPass', function()
  38. {
  39. if(confirm(confirmReview.pass))
  40. {
  41. var selecter = $(this);
  42. $.getJSON(selecter.attr('data-href'), function(data)
  43. {
  44. if(data.result == 'success')
  45. {
  46. if(data.locate) return location.href = data.locate;
  47. return location.reload();
  48. }
  49. else
  50. {
  51. alert(data.message);
  52. return location.reload();
  53. }
  54. });
  55. }
  56. return false;
  57. });
  58. })