mirror of
https://codeberg.org/metamuffin/abrechenbarkeit.git
synced 2024-12-29 16:14:36 +00:00
21 lines
950 B
JavaScript
21 lines
950 B
JavaScript
/// <reference lib="dom" />
|
|
|
|
document.addEventListener("keydown", ev => {
|
|
if (!(document.activeElement instanceof HTMLInputElement)) {
|
|
if (ev.code.startsWith("Digit")) {
|
|
if (document.forms.buy_product.pcode)
|
|
return document.forms.buy_product.pcode.value += ev.code.substring(5)
|
|
} else if (ev.code == "Enter") {
|
|
if (document.forms.buy_product)
|
|
return document.forms.buy_product.submit()
|
|
if (document.forms.user_creation)
|
|
return document.forms.user_creation.submit()
|
|
} else if (ev.code.startsWith("Key") || ev.code == "Space") {
|
|
if (document.forms.user_creation)
|
|
return document.forms.user_creation.create_user.value += ev.key
|
|
} else if (ev.code == "Backspace") {
|
|
if (document.forms.user_creation)
|
|
return document.forms.user_creation.create_user.value = ""
|
|
}
|
|
}
|
|
})
|