User:Karasuneth/global.js

importArticles({   type: 'script',    articles: [        'u:dev:MediaWiki:PortableCSSPad/code.js',        'u:dev:MediaWiki:WHAM/code.2.js',        'u:dev:MediaWiki:AjaxCommentDelete/code.js',        'u:dev:MediaWiki:AjaxBatchDelete.js',        'u:dev:MediaWiki:Discussions Delete All/code.js'    ] });a

$(function {   if (mw.config.get('skin') !== 'fandomdesktop') return;    var cityId = mw.config.get('wgCityId');    var theme = $('body').hasClass('theme-fandomdesktop-light') ? 'light' : 'dark';    var cssCache = {};    function applyTheme(data, cached) {        if (!cached) cssCache[theme] = data;        var $s = $('#pcjThemeSwitch')[0] || $(' ').attr('id','pcjThemeSwitch').appendTo('body');        $($s).text(data);        $('body').removeClass('theme-fandomdesktop-light theme-fandomdesktop-dark').addClass('theme-fandomdesktop-'+theme);    }    function switchTheme {        theme = theme === 'light' ? 'dark' : 'light';        if (cssCache[theme]) {            applyTheme(cssCache[theme], true);        } else {            $.get(mw.util.wikiScript('wikia')+'?controller=ThemeApi&method=themeVariables&variant='+theme+'&cityId='+cityId).done(applyTheme);        }    }    $('.tools').append($(' Toggle theme').click(switchTheme)); });