User:HeartCat1/modquickNavigate.js

let lastPressed = -1;

window.addEventListener("keydown", event => {	if (event.key === "\\") {		if (new Date.getTime - lastPressed < 1000) {			let input = document.createElement("input", { id: "searchInput" });			document.body.appendChild(input);

input.style.border = "solid 1px black"; input.style.outline = "none"; input.style.background = "lightpink"; input.style.position = "fixed"; input.style.top = "calc(100% - 100px)"; input.style.left = "0px"; input.style.width = "100%"; input.style.textAlign = "center"; input.style.zIndex = "5"; input.style.fontSize = "3em";

input.focus; input.onblur = function { input.remove; };

input.onkeydown = e => { if (e.key.toLowerCase === "enter") { if (input.value == "!AVR") { location.href = "https://en.wikipedia.org/wiki/Wikipedia:AntiVandal/run"; } else if(input.value == "!UP") { location.href = "https://en.wikipedia.org/wiki/Special:MyPage"; } else if(input.value == "!UTP") { location.href = "https://en.wikipedia.org/wiki/Special:MyTalk"; } else { location.href = "https://en.wikipedia.org/wiki/" + input.value; }				} else if(e.key.toLowerCase === "escape") { input.remove; }			};

input.oninput = e => { if (e.data === "\\") { input.value = ""; }			};		} else { lastPressed = new Date.getTime; }	} });