Year of the Dragon: Through May 28th, claim free Expansion Pack (excluding Vecna Unleashed) or a Greater Elixir of Discovery! Speak to Xatheral in the Hall of Heroes. edit

Thank you for your patience while we continue to upgrade DDOwiki to the latest MediaWiki LTS version. If you find any errors on the site, please visit the Discord chat server and let us know.

Game mechanicsNewbie guideIn developmentDDO StoreSocial Media


ChallengesClassesCollectablesCraftingEnhancementsEpic DestiniesFavorFeats

GlossaryItemsMapsMonstersPlacesQuestsRacesReincarnationSkillsSpells


Please create an account or log in to remove ads, build a reputation, and unlock more editing privileges and then visit DDO wiki's IRC Chat/Discord if you need any help!

User:Joenuts/Watchlist.js

From DDO wiki
Jump to navigation Jump to search

Note: After saving, you may have to bypass your browser's cache to see the changes, you can click here or try one of the methods below..

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl+F5 or Ctrl+r ( Command+r on a Mac)
  • Google Chrome: Press Ctrl+ Shift+R ( Command+ Shift+R on a Mac)
  • Internet Explorer: Hold Ctrl while clicking Refresh, or press Ctrl+F5
  • Konqueror: Click Reload or press F5
  • Opera: Clear the cache in Tools ‣ Preferences
/* <nowiki> */
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"});
        }
      } );
    }
  } );
} );
/* </nowiki> */