diff options
author | metamuffin <metamuffin@disroot.org> | 2025-01-21 19:06:43 +0100 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2025-01-21 19:07:06 +0100 |
commit | f76fe6fa900c722608d2afbd2245a6a12e5384cc (patch) | |
tree | 2c12ec44f8fa47c53ad2643a6de8a4d1e2e46d6f | |
parent | 86fe733e31c99f9440b0438c20e51f38d29be00d (diff) | |
download | abrechenbarkeit-f76fe6fa900c722608d2afbd2245a6a12e5384cc.tar abrechenbarkeit-f76fe6fa900c722608d2afbd2245a6a12e5384cc.tar.bz2 abrechenbarkeit-f76fe6fa900c722608d2afbd2245a6a12e5384cc.tar.zst |
allow keys when redirecting barcode to buy product
-rw-r--r-- | script.js | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -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() } } |