zentaobiz.js 2.1 KB

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