aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2024-11-03 18:38:21 +0100
committermetamuffin <metamuffin@disroot.org>2024-11-03 18:38:21 +0100
commitd69402120b4e8489ad222d63d01d08d62d1e49ef (patch)
treea016e8f4a4ed7e30aaa671cbde48cc3639cefdc5
parent4c6601a232f7b375591f9469385146d08b0b1754 (diff)
downloadabrechenbarkeit-d69402120b4e8489ad222d63d01d08d62d1e49ef.tar
abrechenbarkeit-d69402120b4e8489ad222d63d01d08d62d1e49ef.tar.bz2
abrechenbarkeit-d69402120b4e8489ad222d63d01d08d62d1e49ef.tar.zst
unignore script
-rw-r--r--.gitignore1
-rwxr-xr-xabrechenbarkeit.lua25
-rw-r--r--script.js10
3 files changed, 14 insertions, 22 deletions
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 @@
+/// <reference lib="dom" />
+
+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()
+ }
+})