User:Walrus068/global.js

// var query = {}, displayTimerInterval = 1e3; (function (a, b, i) {   "use strict";    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 ? editBox.parentNode : null,        isEditing = wgAction === "edit" || wgAction === "submit",        isMonoBook = skin === "monobook",        isJavaScript = wgPageName.indexOf(".js") === wgPageName.length - 3,        isSpecialPage = wgNamespaceNumber === -1,        loadContentAfterDiff = function  {            var a = new XMLHttpRequest,                b = document.getElementById("mw-diff-ntitle1").firstChild.firstChild;            a.onreadystatechange = function  {                if (this.readyState === 4 && this.status === 200) {                    var a = document.createElement("div"),                        c = document.createElement("h2"),                        d = document.getElementsByClassName("diff")[0],                        e = document.createEvent("Event"); a.innerHTML = JSON.parse(this.responseText).parse.text["*"]; c.innerHTML = b.innerHTML; a.insertBefore(c, a.firstChild); d.parentNode.insertBefore(a, d.nextSibling); e.initEvent("DiffContentLoaded", true, true); dispatchEvent(e); }           };            a.open("GET", "/api.php?format=json&action=parse&oldid=" + b.search.match(/[?&]oldid=(\d+)/)[1], true); a.send; },       addRegexForm = function  { var a = document.createElement("div"), b = document.createElement("input"), c = document.createElement("input"), d = document.createElement("input"), e = function { return false; };           b.onsubmit = e;            c.onsubmit = e;            d.type = "button"; d.value = "Perform"; d.onclick = function { var a = b.value.indexOf("/"), d = b.value.lastIndexOf("/"); editBox.value = editBox.value.replace(new RegExp(b.value.substring(a + 1, d), b.value.substring(d + 1)), c.value); return false; };           a.appendChildren(b, c, d); editForm.insertBefore(a, 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 a = document.createElement("input"); a.type = "button"; a.value = "Tidy"; a.onclick = function { editBox.value = js_beautify(editBox.value, {                   space_after_anon_function: true,                    preserve_newlines: false,                    indent_size: 4,                    indent_char: " "                }); };           editBox.onkeydown = function (e) { if (e.keyCode === 9) { insertTags("   ", "", ""); return false; }           };            editForm.insertBefore(a, editBox); };   if (query.diff) { loadContentAfterDiff; }   if (isEditing) { addRegexForm; }   if (!isSpecialPage && isMonoBook) { addRawLink; }   if (isEditing && isJavaScript) { importScriptURI("http://jsfiddle.net/js/beautifier.js"); js; } }, true);