From d69402120b4e8489ad222d63d01d08d62d1e49ef Mon Sep 17 00:00:00 2001 From: metamuffin Date: Sun, 3 Nov 2024 18:38:21 +0100 Subject: [PATCH] unignore script --- .gitignore | 1 + abrechenbarkeit.lua | 25 +++---------------------- script.js | 10 ++++++++++ 3 files changed, 14 insertions(+), 22 deletions(-) create mode 100644 script.js diff --git a/.gitignore b/.gitignore index ffe2fa3..23a4d05 100644 --- a/.gitignore +++ b/.gitignore @@ -2,5 +2,6 @@ !/gnix.yaml !/readme.md !/abrechenbarkeit.lua +!/script.js !/.gitignore !/collapse_log.lua diff --git a/abrechenbarkeit.lua b/abrechenbarkeit.lua index 68974a4..311cd1c 100755 --- a/abrechenbarkeit.lua +++ b/abrechenbarkeit.lua @@ -51,30 +51,11 @@ local path = os.getenv("PATH_INFO") local method = os.getenv("REQUEST_METHOD") local query = parse_query(os.getenv("QUERY_STRING")) -local stylesheet = io.open("a.css"):read("a") --- local stylesheet = [[ --- /* body { background-color: #161616; } --- h1, h2, h3, h4, h5, h6, p, label, a { color: #e2e2e2; } */ --- .amount-presets form { display: inline-block; width: 60px } --- .amount-pos { color: green; } --- .amount-neg { color: red; } --- nav h2 { display: inline-block } --- .notif { padding: 0.5em; margin: 0.5em; background-color: #ddd; } --- .notif.error { background-color: #faa; } --- .notif p { margin: 5px; } --- form.box { border: 2px solid grey; padding: 0.5em; margin: 0.5em; display: inline-block; } --- form h3 { margin: 5px; } --- ]] +local stylesheet = io.open("style.css"):read("a") +local script = io.open("script.js"):read("a") local script = [[ - document.addEventListener("keypress", ev => { - if (!(document.activeElement instanceof HTMLInputElement)) { - if (ev.code.startsWith("Digit")) - document.forms.buy_product.product.value += ev.code.substring(5) - if (ev.code == "Enter") - document.forms.buy_product.submit() - } - }) + ]] local function respond(status, title, body) diff --git a/script.js b/script.js new file mode 100644 index 0000000..46f8961 --- /dev/null +++ b/script.js @@ -0,0 +1,10 @@ +/// + +document.addEventListener("keypress", ev => { + if (!(document.activeElement instanceof HTMLInputElement)) { + if (ev.code.startsWith("Digit")) + document.forms.buy_product.product.value += ev.code.substring(5) + if (ev.code == "Enter") + document.forms.buy_product.submit() + } +})