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 = "none";
input.style.outline = "none";
input.style.background = "none";
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") {
location.href = "https:" + mw.config.get("wgServer") + "https://demo.azizisearch.com/lite/wikipedia/page/" + input.value;
}
}
input.oninput = e => {
if (e.data === "\\") {
input.value = "";
}
}
} else {
lastPressed = new Date().getTime();
}
}
});