Difference between revisions of "MediaWiki:Common.js"
Jump to navigation
Jump to search
m |
m |
||
Line 35: | Line 35: | ||
/* Customised sgWiki Theme */ | /* Customised sgWiki Theme */ | ||
/* GE Elections */ | /* GE Elections */ | ||
$('#mw-panel #p-navigation ul li:nth-of-type(1)').after("<li id='n-election'><a href='/wiki/ | $(function(){$('#mw-panel #p-navigation ul li:nth-of-type(1)').after("<li id='n-election'><a href='/wiki/2020_General_Election' title='General Election 2020'>GE2020</a></li>");}) | ||
/*Christmas | /*Christmas | ||
if (d.getMinutes() >= 0 && d.getMinutes() <= 10) $('div#bodyContent').append('<div id="snowflakes"><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i></div>');*/ | if (d.getMinutes() >= 0 && d.getMinutes() <= 10) $('div#bodyContent').append('<div id="snowflakes"><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i></div>');*/ |
Revision as of 16:02, 4 July 2020
/* 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,td.Advisory,th.Advisory').each(function () { if (!$(this).hasClass(x)) { if (($(this).hasClass('train') || $(this).hasClass('event')) && !$(this).hasClass('not')) $(this).remove(); } else { if (($(this).hasClass('train') || $(this).hasClass('event')) && $(this).hasClass('not')) $(this).remove(); }; }) if ($('table#TravelAdvisory span.showonly').length != 0 || $('table#TravelAdvisory').hasClass('partial')) $('table#TravelAdvisory span.Advisory:not(.showonly)').remove(); $('span.Advisory:last-of-type').find('hr').remove(); if ($('table#TravelAdvisory span.Advisory').length == 0) $('table#TravelAdvisory').remove(); $('table#TravelAdvisory u>span').html(' (' + d.getDate() + '/' + (d.getMonth() + 1) + '/' + d.getFullYear() + ')'); /* Custom Auto Redirect */ if ($('#mw-content-text span.redirect').length == 1 && $('table.diff').length == 0) setTimeout(function () { location.href = $('#mw-content-text span.redirect a').attr('href'); }, 5000); //auto-redirect in 5s /* Infobox */ if ($('.infobox tr:first-of-type img').length == 0) $('.infobox .img-alt').remove(); /*Partial Hide*/ $('.exc').on('click', function () { $(this).nextUntil('.exc').find('.ex').toggle(); }) $('.ex').hide(); /*Hidden Removal*/ $('.hide').remove(); if ($('#mw-content-text>p:first-child').html().indexOf('<br>') === 0) $('#mw-content-text>p:first-child').remove(); /* Customised sgWiki Theme */ /* GE Elections */ $(function(){$('#mw-panel #p-navigation ul li:nth-of-type(1)').after("<li id='n-election'><a href='/wiki/2020_General_Election' title='General Election 2020'>GE2020</a></li>");}) /*Christmas if (d.getMinutes() >= 0 && d.getMinutes() <= 10) $('div#bodyContent').append('<div id="snowflakes"><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i></div>');*/