User:Penguin-Pal/global.js

console.log("%cload%c :: loaded using global.js", "color: red;", "color: #999;");

/* 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 > .WikiaSiteWrapper > #WikiaBar .toolbar .tools"),		nodes = {};	// 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	mw.util.addCSS('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' + '\tborder: 1px solid #ccc;\n' + '\tfont-size: 12px;\n' + '}'); });

console.log("@@ potato @@")