Difference between revisions of "MediaWiki:Common.js"
Jump to navigation
Jump to search
m |
m |
||
Line 20: | Line 20: | ||
/* Custom Auto Redirect */ | /* Custom Auto Redirect */ | ||
if ($('#mw-content-text span.redirect').length == 1 && $('table.diff').length == 0) location.href = $('#mw-content-text span.redirect a').attr('href'); | if ($('#mw-content-text span.redirect').length == 1 && $('table.diff').length == 0) location.href = $('#mw-content-text span.redirect a').attr('href'); | ||
/* Infobox */ | |||
if ($('.infobox tr:first-of-type img').length == 0) $('.infobox .img-alt').remove(); | |||
/*Partial Hide*/ | /*Partial Hide*/ |
Revision as of 10:28, 26 February 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(); }; }) $('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) location.href = $('#mw-content-text span.redirect a').attr('href'); /* 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(); /* Customised sgWiki Theme */ /*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>');*/