Jump to content

MediaWiki:Common.js: Difference between revisions

From Electron: Chat App Wiki
Johnball589 (talk | contribs)
No edit summary
rmv accidental redirection happening every day
 
(6 intermediate revisions by one other user not shown)
Line 1: Line 1:
mw.loader.using('mediawiki.util', function() {
    $(function() {


        // ----- CONFIG -----
        var today = new Date();
        var month = today.getMonth() + 1; // 1–12
        var day = today.getDate();
        var prankMonth = 10;
        var prankDay = 12;
        var forceAF = true;
        // -------------------
        var pageName = mw.config.get('wgPageName');
        if (!pageName.startsWith('AF:') && pageName !== 'MediaWiki:Common.js') {
            if ((month === prankMonth && day === prankDay) || forceAF) {
                var afPage;
                if (pageName === 'Main_Page') {
                    afPage = '/wiki/AF:Main_Page';
                } else {
                    afPage = '/wiki/AF:' + pageName;
                }
                window.location.href = afPage;
            }
        }
        if (!localStorage.getItem('noAF')) {
            mw.notify("April Fools Mode Activated!");
            $('#p-personal ul').append('<li><a href="#" id="disable-af">Turn off April Fools</a></li>');
            $('#disable-af').on('click', function(e) {
                e.preventDefault();
                localStorage.setItem('noAF', '1');
                location.reload();
            });
        }
    });
});

Latest revision as of 17:59, 12 October 2025

Cookies help us deliver our services. By using our services, you agree to our use of cookies.