unignore script

This commit is contained in:
metamuffin 2024-11-03 18:38:21 +01:00
parent 4c6601a232
commit d69402120b
No known key found for this signature in database
GPG key ID: 718F9749DCDBD654
3 changed files with 14 additions and 22 deletions

1
.gitignore vendored
View file

@ -2,5 +2,6 @@
!/gnix.yaml !/gnix.yaml
!/readme.md !/readme.md
!/abrechenbarkeit.lua !/abrechenbarkeit.lua
!/script.js
!/.gitignore !/.gitignore
!/collapse_log.lua !/collapse_log.lua

View file

@ -51,30 +51,11 @@ local path = os.getenv("PATH_INFO")
local method = os.getenv("REQUEST_METHOD") local method = os.getenv("REQUEST_METHOD")
local query = parse_query(os.getenv("QUERY_STRING")) local query = parse_query(os.getenv("QUERY_STRING"))
local stylesheet = io.open("a.css"):read("a") local stylesheet = io.open("style.css"):read("a")
-- local stylesheet = [[ local script = io.open("script.js"):read("a")
-- /* 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 script = [[ 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) local function respond(status, title, body)

10
script.js Normal file
View file

@ -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()
}
})