diff --git a/script.js b/script.js index 920b639..6cf375a 100644 --- a/script.js +++ b/script.js @@ -4,8 +4,8 @@ let idle_timer function reset_idle() { if (idle_timer) clearTimeout(idle_timer) idle_timer = setTimeout(() => { - if (window.location.pathname != "/" || window.location.search != "") - window.location.href = "/" + if (globalThis.location.pathname != "/" || globalThis.location.search != "") + globalThis.location.href = "/" idle_timer = undefined }, 30 * 1000) } @@ -17,7 +17,7 @@ document.addEventListener("keydown", ev => { reset_idle() if (ev.ctrlKey || ev.altKey) return if (ev.code == "F5" || (ev.ctrlKey && ev.code == "KeyR")) - return window.location.reload() // reimplement reload for electron usage + return globalThis.location.reload() // reimplement reload for electron usage if (!(document.activeElement instanceof HTMLInputElement)) { if (ev.code.startsWith("Digit")) { if (document.forms.buy_product) @@ -30,11 +30,13 @@ document.addEventListener("keydown", ev => { } else if (ev.code.startsWith("Key") || ev.code == "Space") { if (document.forms.user_creation) return document.forms.user_creation.create_user.value += ev.key + if (document.forms.buy_product) + return document.forms.buy_product.pcode.value += ev.key } else if (ev.code == "Backspace") { if (document.forms.user_creation) return document.forms.user_creation.create_user.value = "" } else if (ev.code == "Escape") { - window.location.href = "/" + globalThis.location.href = "/" ev.preventDefault() } }