MediaWiki:Common.js

From SgWiki
Revision as of 20:01, 19 December 2018 by Supernutorcrazy (talk | contribs)
Jump to navigation Jump to search

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 <= 4) { d.setTime(d.getTime() - 7200000); }

var x = ('00' + d.getDate()).substr(-2) + ('00' + (d.getMonth() + 1)).substr(-2) + ('00' + d.getFullYear()).substr(-2);

$('span.Advisory').each(function () {
	if (!$(this).hasClass(x)) {
		if ($(this).hasClass('train') || $(this).hasClass('event')) $(this).remove();
	};
})
$('span.Advisory:last-of-type').find('hr').remove();
if ($('span.Advisory').length == 0) $('table#TravelAdvisory').remove();