From 2494afa73ec954b321a004b124346de6f2d4f5ab Mon Sep 17 00:00:00 2001 From: metamuffin Date: Mon, 4 Nov 2024 16:24:41 +0100 Subject: fix missing local --- script.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'script.js') diff --git a/script.js b/script.js index 27de46e..2c23133 100644 --- a/script.js +++ b/script.js @@ -1,9 +1,10 @@ /// document.addEventListener("keydown", ev => { + if (ev.ctrlKey || ev.altKey) return if (!(document.activeElement instanceof HTMLInputElement)) { if (ev.code.startsWith("Digit")) { - if (document.forms.buy_product.pcode) + if (document.forms.buy_product) return document.forms.buy_product.pcode.value += ev.code.substring(5) } else if (ev.code == "Enter") { if (document.forms.buy_product) @@ -16,6 +17,9 @@ document.addEventListener("keydown", ev => { } 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 = "/" + ev.preventDefault() } } }) -- cgit v1.2.3-70-g09d2