MediaWiki:Common.js: Difference between revisions

Johnball589 (talk | contribs)
No edit summary
Johnball589 (talk | contribs)
No edit summary
Tag: Reverted
Line 2: Line 2:


var today = new Date();
var today = new Date();
var month = today.getMonth() + 1;
var month = today.getMonth() + 1; // 1–12
var day = today.getDate();
var day = today.getDate();


var prankMonth = 10;  // October
var prankMonth = 10;  // October
var prankDay = 12;    // your test day
var prankDay = 12;    // test day


var pageName = mw.config.get('wgPageName');
var pageName = mw.config.get('wgPageName');
var namespace = mw.config.get('wgNamespaceNumber'); // MediaWiki namespace = -8


// Only redirect if it's the prank day
if (month === prankMonth && day === prankDay) {
if (month === prankMonth && day === prankDay) {
    // Skip AF pages & MediaWiki namespace (like Common.js)
    if (!pageName.startsWith('AF:') && namespace !== -8) {


    // Don’t redirect these special pages
         // Explicitly handle Main_Page
    if (
        !pageName.startsWith('AF:') &&
        pageName !== 'MediaWiki:Common.js'
    ) {
         // If it's the main page
         if (pageName === 'Main_Page') {
         if (pageName === 'Main_Page') {
             window.location.href = '/wiki/AF:Main_Page';
             window.location.href = '/wiki/AF:Main_Page';
Line 24: Line 21:
             window.location.href = '/wiki/AF:' + pageName;
             window.location.href = '/wiki/AF:' + pageName;
         }
         }
     }
     }
}
}