MediaWiki:Common.js
Revision as of 08:19, 6 May 2018 by Supernutorcrazy (talk | contribs) (Automatic Travel Advisory Display)
Note: After publishing, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
- Opera: Press Ctrl-F5.
/* Any JavaScript here will be loaded for all users on every page load. */ var d = new Date(); var hour = d.getHours(); if (hour <= 2) { d.setTime(d.getTime() - 7200000); } var day = d.getDate(); var month = d.getMonth() + 1; var year = d.getFullYear(); var x = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'][d.getDay()]; if ((day + ' ' + month + ' ' + year) == '29 5 2018') x = 'PH'; //Vesak Day else if ((day + ' ' + month + ' ' + year) == '15 6 2018') x = 'PH'; //Hari Raya Puasa else if ((day + ' ' + month + ' ' + year) == '9 8 2018') x = 'PH'; //National Day else if ((day + ' ' + month + ' ' + year) == '22 8 2018') x = 'PH'; //Hari Raya Haji else if ((day + ' ' + month + ' ' + year) == '6 11 2018') x = 'PH'; //Deepavali else if ((day + ' ' + month + ' ' + year) == '25 12 2018') x = 'PH'; //Christmas Day $('span.Advisory').each(function () { if (!$(this).hasClass(x)) $(this).remove(); })