Guest User

Untitled

a guest
Dec 11th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.86 KB | None | 0 0
  1. $(document).ready(function() {
  2. addTargetClasses();
  3. checkReceived();
  4.  
  5.  
  6. });
  7.  
  8. (function($) {
  9. $(function() {
  10. var orgDates = $('.targetTable span.ms-noWrap');
  11.  
  12. var message = '';
  13. orgDates.each(function(i, elem) {
  14.  
  15. parts = $(this).text().split('/');
  16.  
  17.  
  18. dt = new Date(parts[2], parts[0] - 1, parts[1]).getTime();
  19.  
  20. var diffdate = Math.floor((dt - new Date().getTime()) / (86400 * 1000));
  21.  
  22.  
  23. if (diffdate === 0 || diffdate === -1) {
  24. return;
  25. }
  26.  
  27. if (diffdate > 0 || $(this).parents('tr.targetRow').find('td.ms-vb-lastCell').hasClass('crossout')) {
  28. return;
  29. }
  30.  
  31.  
  32.  
  33.  
  34. if ((diffdate + 2) < 1) {
  35. if ((diffdate + 2) == 0) {
  36. diffdate = (diffdate + 1) + ' day ago';
  37. }
  38. else {
  39. diffdate = (diffdate + 1) + ' days ago';
  40. }
  41. }
  42. diffdate = diffdate.toString().slice(1);
  43. console.log(diffdate);
  44.  
  45. wpTitle = $('span[title*="Bulk Tracking"]');
  46.  
  47.  
  48. finalTitle = wpTitle.attr('title');
  49.  
  50.  
  51. message += $(elem).parents('.targetTable tr.targetRow').find("td:nth-child(2)").text()
  52. + ' ' + $(elem).parents('.targetTable tr.targetRow').find(" td:nth-child(4)").text() + ' was due ' + diffdate + '<br/>';
  53. });
  54.  
  55. //working popup with cookie exp (use for sp)
  56. //--------------
  57. jQuery(document).ready(function() {
  58. var visited = readCookie('emma');
  59. if (!visited || visited !== "true") {
  60. createCookie('emma', "true", 1);
  61. $.alert({
  62. theme: "my-theme",
  63.  
  64. title: "<span style='font-size:25px;'>" + finalTitle + "</span>",
  65. content: "The following bulk is past the expected received date:"+ "<br/>" + "<br/>" + message,
  66. draggable: true,
  67. animationBounce: 1.5,
  68. buttons: {
  69. Dismiss: function() {
  70. }
  71. }
  72. });
  73. }
  74. });
  75. //-----------
  76. //use for popup testing removes cookie
  77. // $.alert({
  78. // theme: "my-theme",
  79. //
  80. // title: "<span style='font-size:25px;'>" + finalTitle + "</span>",
  81. // content: "The following bulk is past the expected received date:"+ "<br/>" + "<br/>" + message,
  82. // draggable: true,
  83. // animationBounce: 1.5,
  84. // buttons: {
  85. // Dismiss: function() {
  86. // }
  87. // }
  88. // });
  89. // eraseCookie('emma');
  90. //-------------------
  91. $('td.ms-list-addnew .ms-soften').after("<button id='alert_btn' type='button'>See Alerts</button>");
  92. $('#alert_btn').after('<div id="emmacontainer" class="emmacontainer"><div class="container__inner"><div class="subDiv"></div> </div></div>');
  93.  
  94. $('.subDiv').append(message);
  95.  
  96. $('#emmacontainer').hide();
  97. $('#alert_btn').click(function(){
  98. $('#emmacontainer').slideToggle(400);
  99. });
  100.  
  101.  
  102. })
  103. })
  104. (jQuery);
Add Comment
Please, Sign In to add comment