Difference between revisions of "MediaWiki:Common.js"
Jump to navigation
Jump to search
m (Automatic Travel Advisory Display) |
m |
||
Line 20: | Line 20: | ||
if (!$(this).hasClass(x)) $(this).remove(); | if (!$(this).hasClass(x)) $(this).remove(); | ||
}) | }) | ||
$('span.Advisory:last-of-type').find('hr').remove(); |
Revision as of 08:56, 12 May 2018
/* 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(); }) $('span.Advisory:last-of-type').find('hr').remove();