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 search_active = false;

jQuery(document).ready(function($){   var targets = ['#WikiaMainContent', '#WikiaRail'],        $target = $(targets.join(', '));    $target.on('contextmenu', function(event){ if (event.key){ if (event.key == 'Control'){ search_active = true; } else { return; }       } else { if (event.ctrlKey){ search_active = true; }       }    }); });

window.onload = function(event){ var user_module_elem = document.getElementsByClassName('user-module'), wikia_rail = document.getElementById('WikiaRail'); if (user_module_elem.length) return; var user_module = document.createElement('section'); user_module.className = 'rail-module user-module'; user_module.id = 'user-module'; var module_content = document.createElement('div'); module_content.className = 'module-content content'; var fetch_profile = new XMLHttpRequest; fetch_profile.open('GET', '/wikia.php?controller=UserProfilePageController&method=renderUserIdentityBox&format=json', false); fetch_profile.send(null); fetch_profile.addEventListener('load readystatechange', function{       if (fetch_profile.readyState == XMLHttpRequest.DONE && fetch_profile.status == 200){            var result = JSON.parse(fetch_profile.responseText),                avatar_container = document.createElement('div'),                username = document.createElement('em'),                edits = document.createElement('var');            // Avatar Container            avatar_container.className = 'avatar-container';            avatar_container.innerHTML =                '';            username.className = 'username';            username.innerHTML = mw.config.get('wgUserName', wgUserName);            edits.className = 'edits';            edits.innerHTML = ' ' + result.user.edits + ' edits';            [avatar, username, edits].forEach(function(elem, index){ module_content.appendChild(elem); });       }    });    user_module.appendChild(module_content); function initialize(node){ node = node || null; if (node && node instanceof Node){ var parent = node.parentNode; parent.insertBefore(user_module, node.nextSibling); } else { return; }   }    if (typeof MutationObserver !== 'undefined'){ var obs = new MutationObserver(function(mutations){           mutations.forEach(function(mutation){ if (mutation.addedNodes.length){ var chat_module = document.getElementsByClassName('chat-module')[0]; initialize(chat_module); }           });        });        obs.observe(wikia_rail, { attributes: true, childList: true, characterData: true }); } else { wikia_rail.addEventListener('DOMNodeInserted', function{           if (document.getElementsByClassName('chat-module').length){                var chat_module = document.getElementsByClassName('chat-module')[0];                initialize(chat_module);            }        }); } }; /* 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; });*/