Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $(document).ready(function() {
- addTargetClasses();
- checkReceived();
- });
- (function($) {
- $(function() {
- var orgDates = $('.targetTable span.ms-noWrap');
- var message = '';
- orgDates.each(function(i, elem) {
- parts = $(this).text().split('/');
- dt = new Date(parts[2], parts[0] - 1, parts[1]).getTime();
- var diffdate = Math.floor((dt - new Date().getTime()) / (86400 * 1000));
- if (diffdate === 0 || diffdate === -1) {
- return;
- }
- if (diffdate > 0 || $(this).parents('tr.targetRow').find('td.ms-vb-lastCell').hasClass('crossout')) {
- return;
- }
- if ((diffdate + 2) < 1) {
- if ((diffdate + 2) == 0) {
- diffdate = (diffdate + 1) + ' day ago';
- }
- else {
- diffdate = (diffdate + 1) + ' days ago';
- }
- }
- diffdate = diffdate.toString().slice(1);
- console.log(diffdate);
- wpTitle = $('span[title*="Bulk Tracking"]');
- finalTitle = wpTitle.attr('title');
- message += $(elem).parents('.targetTable tr.targetRow').find("td:nth-child(2)").text()
- + ' ' + $(elem).parents('.targetTable tr.targetRow').find(" td:nth-child(4)").text() + ' was due ' + diffdate + '<br/>';
- });
- //working popup with cookie exp (use for sp)
- //--------------
- jQuery(document).ready(function() {
- var visited = readCookie('emma');
- if (!visited || visited !== "true") {
- createCookie('emma', "true", 1);
- $.alert({
- theme: "my-theme",
- title: "<span style='font-size:25px;'>" + finalTitle + "</span>",
- content: "The following bulk is past the expected received date:"+ "<br/>" + "<br/>" + message,
- draggable: true,
- animationBounce: 1.5,
- buttons: {
- Dismiss: function() {
- }
- }
- });
- }
- });
- //-----------
- //use for popup testing removes cookie
- // $.alert({
- // theme: "my-theme",
- //
- // title: "<span style='font-size:25px;'>" + finalTitle + "</span>",
- // content: "The following bulk is past the expected received date:"+ "<br/>" + "<br/>" + message,
- // draggable: true,
- // animationBounce: 1.5,
- // buttons: {
- // Dismiss: function() {
- // }
- // }
- // });
- // eraseCookie('emma');
- //-------------------
- $('td.ms-list-addnew .ms-soften').after("<button id='alert_btn' type='button'>See Alerts</button>");
- $('#alert_btn').after('<div id="emmacontainer" class="emmacontainer"><div class="container__inner"><div class="subDiv"></div> </div></div>');
- $('.subDiv').append(message);
- $('#emmacontainer').hide();
- $('#alert_btn').click(function(){
- $('#emmacontainer').slideToggle(400);
- });
- })
- })
- (jQuery);
Add Comment
Please, Sign In to add comment