mirror of
https://codeberg.org/metamuffin/abrechenbarkeit.git
synced 2024-12-29 16:14:36 +00:00
refactor and user creating input redirect
This commit is contained in:
parent
e93520702a
commit
5f8b7352cd
3 changed files with 98 additions and 84 deletions
|
@ -60,7 +60,7 @@ local function get_user_theme(username)
|
||||||
if username == "_jeb" then
|
if username == "_jeb" then
|
||||||
c = "html { animation: 2s jeb infinite; }"
|
c = "html { animation: 2s jeb infinite; }"
|
||||||
c = c .. "@keyframes jeb {\n"
|
c = c .. "@keyframes jeb {\n"
|
||||||
for i=0,100 do
|
for i = 0, 100 do
|
||||||
c = c .. string.format("%.02f%% { --hue: %.02f; } \n", i, i / 100 * 360)
|
c = c .. string.format("%.02f%% { --hue: %.02f; } \n", i, i / 100 * 360)
|
||||||
end
|
end
|
||||||
c = c .. "\n}"
|
c = c .. "\n}"
|
||||||
|
@ -403,7 +403,7 @@ end
|
||||||
local function r_index()
|
local function r_index()
|
||||||
return respond(200, "Abrechenbarkeit", function()
|
return respond(200, "Abrechenbarkeit", function()
|
||||||
print([[
|
print([[
|
||||||
<form action="/" method="GET" class="creation">
|
<form action="/" method="GET" id="user_creation">
|
||||||
<h3>User Creation</h3>
|
<h3>User Creation</h3>
|
||||||
<label for="username">Username: </label>
|
<label for="username">Username: </label>
|
||||||
<input type="text" name="create_user" id="username" />
|
<input type="text" name="create_user" id="username" />
|
||||||
|
@ -517,7 +517,13 @@ local function r_products()
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
]])
|
]])
|
||||||
print([[<table class="productlist"><tr><th>Name</th><th>Price</th><th>Barcode</th><th>Count</th><th>Owner</th></tr>]])
|
print([[<table class="productlist"><tr>
|
||||||
|
<th>Name</th>
|
||||||
|
<th>Price</th>
|
||||||
|
<th>Barcode</th>
|
||||||
|
<th>Count</th>
|
||||||
|
<th>Owner</th>
|
||||||
|
</tr>]])
|
||||||
local pbals = product_balances()
|
local pbals = product_balances()
|
||||||
for barcode, price, name, owner in read_products() do
|
for barcode, price, name, owner in read_products() do
|
||||||
print(string.format([[
|
print(string.format([[
|
||||||
|
|
21
script.js
21
script.js
|
@ -1,10 +1,21 @@
|
||||||
/// <reference lib="dom" />
|
/// <reference lib="dom" />
|
||||||
|
|
||||||
document.addEventListener("keypress", ev => {
|
document.addEventListener("keydown", ev => {
|
||||||
if (!(document.activeElement instanceof HTMLInputElement)) {
|
if (!(document.activeElement instanceof HTMLInputElement)) {
|
||||||
if (ev.code.startsWith("Digit"))
|
if (ev.code.startsWith("Digit")) {
|
||||||
document.forms.buy_product.pcode.value += ev.code.substring(5)
|
if (document.forms.buy_product.pcode)
|
||||||
if (ev.code == "Enter")
|
return document.forms.buy_product.pcode.value += ev.code.substring(5)
|
||||||
document.forms.buy_product.submit()
|
} 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 = ""
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
29
style.css
29
style.css
|
@ -8,8 +8,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.trans {
|
.trans {
|
||||||
background: linear-gradient(
|
background: linear-gradient(#60d0fa50 0%,
|
||||||
#60d0fa50 0%,
|
|
||||||
#60d0fa50 19%,
|
#60d0fa50 19%,
|
||||||
#f5acba50 20%,
|
#f5acba50 20%,
|
||||||
#f5acba50 39%,
|
#f5acba50 39%,
|
||||||
|
@ -17,8 +16,7 @@
|
||||||
#FFFFFF50 59%,
|
#FFFFFF50 59%,
|
||||||
#f5acba50 60%,
|
#f5acba50 60%,
|
||||||
#f5acba50 79%,
|
#f5acba50 79%,
|
||||||
#60d0fa50 80%
|
#60d0fa50 80%);
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
|
@ -86,10 +84,6 @@ nav> :last-child {
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.notif > * {
|
|
||||||
color: black;
|
|
||||||
}
|
|
||||||
|
|
||||||
.notif.error {
|
.notif.error {
|
||||||
background-color: rgb(118, 13, 13);
|
background-color: rgb(118, 13, 13);
|
||||||
}
|
}
|
||||||
|
@ -99,14 +93,14 @@ nav> :last-child {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* landing page */
|
/* landing page */
|
||||||
form.creation {
|
form#user_creation {
|
||||||
background-color: var(--b2);
|
background-color: var(--b2);
|
||||||
padding: 1em;
|
padding: 1em;
|
||||||
margin-top: 2em;
|
margin-top: 2em;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
form.creation>h3 {
|
form#user_creation>h3 {
|
||||||
margin: 5px;
|
margin: 5px;
|
||||||
margin-right: 2em;
|
margin-right: 2em;
|
||||||
}
|
}
|
||||||
|
@ -120,7 +114,7 @@ input[type="text"] {
|
||||||
min-width: 10em;
|
min-width: 10em;
|
||||||
}
|
}
|
||||||
|
|
||||||
form.creation>* {
|
form#user_creation>* {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
margin-right: 1.5em;
|
margin-right: 1.5em;
|
||||||
}
|
}
|
||||||
|
@ -284,11 +278,11 @@ tr:nth-child(2n) {
|
||||||
background-color: var(--b0);
|
background-color: var(--b0);
|
||||||
}
|
}
|
||||||
|
|
||||||
table.log > tbody {
|
table.log>tbody {
|
||||||
transform: rotate(180deg);
|
transform: rotate(180deg);
|
||||||
}
|
}
|
||||||
|
|
||||||
table.log > tbody > tr {
|
table.log>tbody>tr {
|
||||||
transform: rotate(180deg);
|
transform: rotate(180deg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -303,7 +297,9 @@ input:not([type=submit]) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@media print {
|
@media print {
|
||||||
nav, .container {
|
|
||||||
|
nav,
|
||||||
|
.container {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -327,12 +323,13 @@ input:not([type=submit]) {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
.userlist a, ul {
|
.userlist a,
|
||||||
|
ul {
|
||||||
display: block;
|
display: block;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.userlist > li > a {
|
.userlist>li>a {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
display: flex;
|
display: flex;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue