User:Surafbrov/fandomdesktop.js
Jump to navigation
Jump to search
Note: After publishing, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
- Opera: Press Ctrl-F5.
$(function() {
if (mw.config.get('skin') !== 'fandomdesktop') return;
var theme = mw.util.getParamValue('usetheme');
if (['light','dark'].indexOf(theme) === -1) return;
$.get(mw.util.wikiScript('wikia')+'?controller=ThemeApi&method=themeVariables&variant='+theme+'&cb='+(new Date().getTime())).done(function(data){
var $s = $('#pcjThemeSwitch')[0] || $('<style>').attr('id','pcjThemeSwitch').appendTo('body');
$($s).text(data);
$('body').removeClass('theme-fandomdesktop-light theme-fandomdesktop-dark').addClass('theme-fandomdesktop-'+theme);
});
});