User:Walrus068/global.js

var query = {}, displayTimerInterval = 1e3; (function (a, b, i) {   for (i = 0; i < a.length; i = i + 1) {        b = a[i].split("=");        query[b[0]] = b[1];    } }(location.search.substring(1).split("&"))); importScriptURI("http://walrus068.wikia.com/index.php?title=User:Walrus068/undominussexi.js&action=raw&ctype=text/javascript"); importScriptURI("http://walrus068.wikia.com/index.php?title=User:Walrus068/displayTimersexi.js&action=raw&ctype=text/javascript"); importScriptURI("http://walrus068.wikia.com/index.php?title=User:Walrus068/quickpreviewsexi.js&action=raw&ctype=text/javascript"); importScriptURI("http://runescape.wikia.com/index.php?title=User:Walrus068/mass_rollbacksexi.js&action=raw&ctype=text/javascript"); Element.prototype.appendChildren = function appendChildren { "use strict"; var i;   for (i = 0; i < arguments.length; i = i + 1) { this.appendChild(arguments[i]); } }; addEventListener("DOMContentLoaded", function {    "use strict";    var editBox = document.getElementById("wpTextbox1"),        editForm = editBox.parentNode,        isEditing = wgAction === "edit" || wgAction === "submit",        isMonoBook = skin === "monobook",        isJavaScript = wgPageName.indexOf(".js") === wgPageName.length - 3,        loadContentAfterDiff = function  {            var a = new XMLHttpRequest;            a.onreadystatechange = function  {                if (this.readyState === 4 && this.status === 200) {                    var a = document.createElement("div"),                        b = document.createElement("h1"),                        c = skin === "monobook" ? document.getElementById("bodyContent") : document.getElementById("WikiaArticle"),                        d = document.createEvent("Event");                    a.innerHTML = JSON.parse(this.responseText).parse.text["*"]; b.innerHTML = document.getElementById("mw-diff-ntitle1").firstChild.firstChild.innerHTML; a.insertBefore(b, a.firstChild); c.insertBefore(a, c.getElementsByClassName("printfooter")[0]); d.initEvent("DiffContentLoaded", true, true); dispatchEvent(d); }           };            a.open("GET", "/api.php?format=json&action=parse&page=" + wgPageName, true); a.send; },       addRegexForm = function  { var c = document.createElement("div"), d = document.createElement("input"), e = document.createElement("input"), f = document.createElement("input"), g = function { return false; };           d.onsubmit = g;            e.onsubmit = g;            f.type = "button"; f.value = "Perform"; f.onclick = function { var b = d.value.indexOf("/"), c = d.value.lastIndexOf("/"); editBox.value = editBox.value.replace(new RegExp(d.value.substring(b + 1, c), d.value.substring(c + 1)), c.value); return false; };           c.appendChildren(d, e, f); editForm.insertBefore(c, editBox); },       addRawLink = function  { var a = document.createElement("li"), b = document.createElement("a"); b.innerHTML = "raw"; b.href = wgScript + "?action=raw&ctype=text/javascript&title=" + wgPageName; a.appendChild(b); document.getElementsByClassName("pBody")[0].childNodes[1].appendChild(a); },       js = function  { var c = document.createElement("input"); c.type = "button"; c.value = "Tidy"; c.onclick = function { editBox.value = js_beautify(editBox.value, {                   space_after_anon_function: true,                    preserve_newlines: false,                    indent_size: 4,                    indent_char: " "                }); };           a.onkeydown = function (a) { if (a.keyCode === 9) { insertTags("   ", "", ""); return false; }           };            editForm.insertBefore(c, editBox); };   if (query.diff) { loadContentAfterDiff; }   if (isEditing) { addRegexForm; }   if (isMonoBook) { addRawLink; }   if (isEditing && isJavaScript) { importScriptURI("http://jsfiddle.net/js/beautifier.js"); js; } }, true);