MediaWiki:Gadget-nightwiki.js

// $(function {   var nighttime = 'on' === mw.storage.get('nightwiki'),        cssLoaded = nighttime ? lightsOff : false;

mw.util.addPortletLink('p-personal', '#', nighttime ? '🌞Daywiki' : '🌙Nightwiki', 'pt-nightwiki', '', 'np', '#pt-watchlist');

$('#pt-nightwiki').on('click', function(e) {       e.preventDefault;        nighttime = !nighttime;        if (nighttime) {            lightsOff;        } else {            lightsOn;        }    });

function lightsOn { $('html').removeClass('nighttime'); $('#pt-nightwiki a').text('Nightwiki'); mw.storage.set('nightwiki', 'off'); }   function lightsOff { if(!cssLoaded) { $('head').append(mw.loader.load('https://publictestwiki.com/w/index.php?title=MediaWiki:Gadget-nightwiki.css&action=raw&ctype=text/css', 'text/css')); }       $('html').addClass('nighttime'); $('#pt-nightwiki a').text('Daywiki'); mw.storage.set('nightwiki', 'on'); return true; } }); //