User:Joenuts/Watchlist.js

/* */ jQuery( document ).ready( function( $ ) {

// store Now in object var obNow = new Date; // store Now in YYYY-M-DD format var szCurrentDate = obNow.getFullYear + "-" + (obNow.getMonth+1) + "-" + obNow.getDate; console.log( 'szCurrentDate = ' + szCurrentDate);

// scan all h4 elements inside mw-content-text div $("#mw-content-text").find("h4").each( function {

// store h4 date in object var h4Date = new Date( $(this).text ); // store h4 date in YYYY-M-DD format var mydateString = h4Date.getFullYear + "-" + (h4Date.getMonth+1) + "-" + h4Date.getDate; console.log( 'h4DateString = ' + mydateString);

// only parse through div following h4 element if h4 date matches current date if( mydateString == szCurrentDate ) {

// retrieve the div following h4 element var div = $(this).next;

// scan all elements inside the div following h4 tag identified as current date $(div).find("td.mw-enhanced-rc").each( function {

console.log( 'this.text.trim = ' + $(this).text.trim); // store table row date and timestamp in object var myRowTimeStamp = new Date( szCurrentDate + " " + $(this).text.trim + ":00");

console.log( 'obNow.getTime = ' + obNow.getTime); console.log( 'myRowTimeStamp.getTime = ' + myRowTimeStamp.getTime); // time difference to be manipulated 1000 milliseconds * 60 seconds * 60 minutes * 6 hours if( ( obNow.getTime - myRowTimeStamp.getTime ) < ( 1000 * 60 * 60 * 6) ) { console.log( 'element found // updating font weight for timestamp = ' + myRowTimeStamp); $(this).css({"font-weight":"bold", "font-size":"14px"}); }     } );    }  } ); } ); /* */