MediaWiki:Common.js: Difference between revisions

Jump to navigation Jump to search
no edit summary
imported>Hb1290
(removing script that seems to be causing an issue with EmbedVideo)
imported>Hb1290
No edit summary
Line 321: Line 321:
} );
} );
//<nowiki>
//<nowiki>
$(function() {
    var nighttime = 'on' === mw.storage.get('nightpedia'),
        cssLoaded = nighttime ? lightsOff() : false;
    mw.util.addPortletLink('p-personal', '#', nighttime ? 'Light Mode' : 'Dark Mode', 'pt-nightpedia', '', 'np', '#pt-watchlist');
    $('#pt-nightpedia').on('click', function(e) {
        e.preventDefault();
        nighttime = !nighttime;
        if (nighttime) {
            lightsOff();
        } else {
            lightsOn();
        }
    });
    function lightsOn() {
        $('html').removeClass('nighttime');
        $('#pt-nightpedia a').text('Dark Mode');
        mw.storage.set('nightpedia', 'off');
    }
    function lightsOff() {
        if(!cssLoaded) {
            $('head').append(mw.loader.load('https://en.wikipedia.org/w/index.php?title=User:MusikAnimal/nightpedia.css&action=raw&ctype=text/css', 'text/css'));
        }
        $('html').addClass('nighttime');
        $('#pt-nightpedia a').text('Light Mode');
        mw.storage.set('nightpedia', 'on');
        return true;
    }
});
//</nowiki>
/*Discord widget*/
/*Discord widget*/
$( "#discord-widget" ).html('<iframe src="https://discord.com/widget?id=333345832059273216&theme=dark" width="100%" height="255px" allowtransparency="true" frameborder="0" sandbox="allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-scripts"></iframe>');
$( "#discord-widget" ).html('<iframe src="https://discord.com/widget?id=333345832059273216&theme=dark" width="100%" height="255px" allowtransparency="true" frameborder="0" sandbox="allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-scripts"></iframe>');
Anonymous user

Navigation menu