User:Ultimate Dark Carnage/global.js

cacheSkip = []; cacheSkipLimit = 1000;

importScriptPage('User:Monchoman45/ChatHacks.js', 'c'); importScriptPage('MessageBlocker/code.js', 'dev');

importArticles({   type: 'script',    articles: [        'u:dev:NullEditButton/code.js',        'u:dev:AntiUnicruft/code.js',        'u:dev:BackToTopButton/code.js',        'u:dev:PortableCSSPad/code.js',        'u:dev:WHAM/code.js',        'u:dev:QuickModTools/loader.js',        'u:dev:CacheCheck/code.js',        'u:dev:MassNullEdit/code.js'    ] });

var skin = mw.config.get('skin', skin); if (['oasis', 'wikia'].indexOf(skin) === -1) return; var $WikiaRail = $('#WikiaRail'); if ($WikiaRail.hasClass('loaded')){ $WikiaRail.find(['section', 'div'].join(', ')).filter(function{           var cname = 'module',                isModule = $(this).hasClass(cname);            return isModule;        }).removeClass('module').addClass('rail-module'); } else { $WikiaRail.on('DOMNodeInserted', function(event){           if ($(event.target).hasClass('module')){                $(event.target).removeClass('module');                $(event.target).addClass('rail-module');            }        }); } })(this.mediaWiki, this.jQuery);
 * (function(mw, $){

var darkTheme = false;

function ReaderMode{ this.isDarkTheme = mw.config.get('wgIsDarkTheme', wgIsDarkTheme); this.defaultTheme = darkTheme ? 'dark' : 'light'; this.loaded = false; this.pageName = mw.config.get('wgPageName', wgPageName); this.title = this.pageName.replace(/_/g, ' '); this.init; }

ReaderMode.prototype.lightTheme = function{ var $body = $(document.body).hasClass('mediawiki') ? $(document.body) : $('body.mediawiki'), $title = $('h1.reader-title'); if (!$body.hasClass('reader-light')){ var dark = 'reader-dark', light = 'reader-light'; if ($body.hasClass(dark)) $body.removeClass(dark); $body.addClass(light); }   if (!$title.length) this.createTitle; };

ReaderMode.prototype.darkTheme = function{ var $body = $(document.body).hasClass('mediawiki') ? $(document.body) : $('body.mediawiki'), $title = $('h1.reader-title'); if (!$body.hasClass('reader-dark')){ var dark = 'reader-dark', light = 'reader-light'; if ($body.hasClass(light)) $body.removeClass(light); $body.addClass(dark); }   if (!$title.length) this.createTitle; };

ReaderMode.prototype.getURLVar = function(name){ var rel_regex = '[?&]'; rel_regex = rel_regex.concat(name); rel_regex = rel_regex.concat('=([^&#]*)'); var rel = new RegExp(rel_regex).exec(window.location.href); if (rel === null){ return null; } else { return results[1] || 0; } };

ReaderMode.prototype.getURLMode = function{ var mode = this.getURLVar('reader-mode'); mode = decodeURIComponent(mode); if (mode !== null){ switch (mode){ case 'light': return 'light'; case 'dark': return 'dark'; case 'default': return this.defaultTheme; default: return ''; }   } else { return ''; } };

ReaderMode.prototype.prepare = function(mode){ switch (mode){ case 'light': this.lightTheme; break; case 'dark': this.darkTheme; break; default: return; } };

ReaderMode.prototype.createControls = function{ var $PageHeader = $('#WikiaPageHeader, .pph-article-header'), $controls = [               $(' ')                    .html(['light', 'dark'].map(function(theme){ var page = mw.config.get('wgPageName', wgPageName), $trigger = $(''                                           .replace(' ', page)                                            .replace(' ', theme)                                        ); $trigger.text(theme.toUpperCase); return $trigger; })),               $(' ')                    .html($('" class="rm-trigger rm-button" />'.replace(' ', mw.config.get('wgPageName', wgPageName)).replace(' ', this.defaultTheme)).text('Quick Reader Mode')) ];   $PageHeader.append($controls); };

ReaderMode.prototype.init = function{ var mode = this.getURLMode; if (mode !== ''){ this.prepare(mode); } else { this.createControls; } };

$(document).ready(function{   new ReaderMode; });