User:Penguin-Pal/global.js

(function(date) {	console.log("%c" + new Array(97).join("=") + "\n@@ [" + "%cglobal.js" + "%c] :: [" + date.split("/")[0] + " V %c " + date.split("/")[1] + " %c] :: w:c:ucp:Special:MyPage/global.js loaded\n" + new Array(97).join("="), "", "color: #c00; font-weight: bold; background: #ff0;", "", "color: #000; background: #0c0", ""); }("2020-01-21/1")); // yyyy-mm-dd/daily_version

/* imports */ importArticles({	type: 'script',	articles: [		'u:dev:MediaWiki:WikiActivity/code.js'	] }); importArticles({   type: 'script',    articles: [        'u:dev:MediaWiki:MultiUpload.js'    ] });

/* quick go-to-wiki field. for people who don't type text into the browser's url field like apes like me */ (function {   var toolbar = document.querySelector("body > #WikiaBar .toolbar .tools"),        nodes = {},		c = document.createElement("style"); // mw.util.addCSS seems to not preload    // initiate nodes    nodes.li = document.createElement("li");    nodes.nav = document.createElement("nav");    nodes.button = document.createElement("div");    nodes.link = document.createElement("a");    nodes.input = document.createElement("input");    nodes.nav.id = "goto-wiki";    // attributes    nodes.link.setAttribute("target", "_blank");    nodes.input.type = "text";    nodes.input.placeholder = "Go to wiki";    // hierarchy    nodes.link.appendChild(nodes.input);    nodes.nav.appendChild(nodes.button);    nodes.nav.appendChild(nodes.link);    nodes.li.appendChild(nodes.nav);    // events    nodes.button.addEventListener("click", function { nodes.input.select; });   nodes.input.addEventListener("keydown", function(e) { var a = this.value; if (e.which == 13 && /[a-z0-9]+(?:\.[a-z0-9]+)?/i.test(a)) { nodes.link.setAttribute("href", "/wiki/w:c:" + a + ":Special:WikiActivity"); }   });    // insert    toolbar.appendChild(nodes.li);    // css	c.type = "text/css";	c.textContent = ('nav#goto-wiki {\n' + '\tposition: relative;\n' + '\tmargin-top: -2px;\n' + '}\n' + 'nav#goto-wiki div {\n' + '\tposition: absolute;\n' + '\ttop: 0;\n' + '\tleft: 0;\n' + '\twidth: 200px;\n' + '\theight: 18px;\n' + '\tcursor: pointer;\n' + '}\n' + 'nav#goto-wiki input {\n' + '\twidth: 196px;\n' + '\theight: 14px;\n' + '\tmargin: 0;\n' + '\tpadding: 1px;\n' + '\tline-height: 18px;\n' + '\tbackground: #ffffff !important;\n' + '\tborder: 1px solid #ccc;\n' + '\tfont-size: 12px;\n' + '}');	document.head.appendChild(c); });