aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoelHMikael <joel.h.kronqvist@gmail.com>2021-12-07 20:28:14 +0200
committerJoelHMikael <joel.h.kronqvist@gmail.com>2021-12-07 20:28:14 +0200
commit7a02701c6963cddeceb894aec373e4866cfdaa2d (patch)
treed394c082c7ed62fc87dd3c6fdaa0c2040c202e61
parent278d57ab2f06b246e2c671ba7f453408c0468318 (diff)
downloadLYLLRuoka-7a02701c6963cddeceb894aec373e4866cfdaa2d.tar.gz
LYLLRuoka-7a02701c6963cddeceb894aec373e4866cfdaa2d.zip
Minor changes to the server and UI
-rw-r--r--index.html2
-rw-r--r--server.js17
2 files changed, 7 insertions, 12 deletions
diff --git a/index.html b/index.html
index 4c3a491..08d35b6 100644
--- a/index.html
+++ b/index.html
@@ -37,7 +37,7 @@
<br>
- <div id="result" class="float-block">
+ <div id="shift-result" class="float-block">
<h2>\(foodshift-header\)</h2>
<p>\(result\)</p>
</div>
diff --git a/server.js b/server.js
index 86e107d..d15d04d 100644
--- a/server.js
+++ b/server.js
@@ -8,15 +8,6 @@ async function init()
{
const weekdays = [undefined, "MAANANTAI", "TIISTAI", "KESKIVIIKKO", "TORSTAI", "PERJANTAI", undefined];
- const shifts = [
- //1:
- "Ruokailuvuoro 1",
- //2:
- "Ruokailuvuoro 2",
- //3:
- "Ruokailuvuoro 3"
- ];
-
const build = {
"./index.html": buildMain,
"./index.css": buildDefault,
@@ -39,7 +30,6 @@ async function init()
const args = {
"path": path,
"query": q.query,
- "shifts": shifts,
"db": DB
};
if (typeof build[path] === "function")
@@ -78,7 +68,6 @@ async function buildMain(args)
let index;
if (typeof query.index === "string")
index = query.index.toUpperCase().replaceAll(".", "").replaceAll(" ", "");
- const shifts = args["shifts"];
const DB = args["db"];
const data = await openFile(path);
@@ -101,6 +90,12 @@ async function buildMain(args)
res = "Kyseiselle kurssille/opettajalle ei löydy ruokailua päivältä!"; // it's the frickin \r in the database!
data_string = data_string.replace("\\(result\\)", res);
data_string = data_string.replace(`<option value=\"${day}\">`, `<option value=\"${day}\" selected>`);
+
+ day = ["su", "ma", "ti", "ke", "to", "pe", "la"][day];
+ if (res !== "")
+ data_string = data_string.replace("\\(foodshift-header\\)", `Kurssin (???)/(???) ruokailuvuoro ${day}:`);
+ else
+ data_string = data_string.replace('<div id="shift-result" class="float-block">', '<div id="shift-result" class="float-block" style="display: none;">');
return data_string;
}