finally introduced CNTDWN-1 (allow/disallow overrun)

This commit is contained in:
Sören Oesterwind 2023-08-07 16:59:38 +02:00
parent 5398817a1e
commit 704ecb4249
8 changed files with 33 additions and 5 deletions

View File

@ -73,6 +73,7 @@ currentState = {
srvTime: 0, srvTime: 0,
enableColoredText: true, enableColoredText: true,
debug: false, debug: false,
enableOverrun: true,
sessionToken: Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15), sessionToken: Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15),
}; };
@ -269,6 +270,18 @@ app.get("/api/v1/set/layout/showTime", function (req, res) {
updatedData() updatedData()
}); });
app.get("/api/v1/set/enableOverrun", function (req, res) {
const resy = helper.wrapBooleanConverter(req.query.enable, res)
if (resy != undefined) {
currentState.enableOverrun = resy;
if (req.query.persist === 'true') {
dataToBeWritten.enableOverrun = currentState.enableOverrun
}
res.json({ status: "ok" });
}
updatedData()
});
app.get("/api/v1/set/progressbar/show", function (req, res) { app.get("/api/v1/set/progressbar/show", function (req, res) {
currentState.showProgressbar = (req.query.show === 'true'); currentState.showProgressbar = (req.query.show === 'true');
if (req.query.persist === 'true') { if (req.query.persist === 'true') {

View File

@ -46,7 +46,8 @@
"enableTextClrs": "Text Farben aktivieren:", "enableTextClrs": "Text Farben aktivieren:",
"textClrs": "Text Farben", "textClrs": "Text Farben",
"addRow": "Neue Zeile", "addRow": "Neue Zeile",
"timeVar": "Aktiviere zeitabweichungs display:" "timeVar": "Aktiviere zeitabweichungs display:",
"allowOverrun": "Überlauf erlauben: "
}, },
"untis": "untis":
{ {

View File

@ -49,7 +49,8 @@
"addRow": "Add Row", "addRow": "Add Row",
"timeVar": "Enable time variance display:", "timeVar": "Enable time variance display:",
"language": "Select a language", "language": "Select a language",
"apply": "Apply" "apply": "Apply",
"allowOverrun": "Allow overrun:"
}, },
"untis": "untis":
{ {

View File

@ -46,7 +46,8 @@
"enableTextClrs": "██████ ████ ███████:", "enableTextClrs": "██████ ████ ███████:",
"textClrs": "████ ██████", "textClrs": "████ ██████",
"addRow": "███ ███", "addRow": "███ ███",
"timeVar": "██████ ████ ███████ ███████:" "timeVar": "██████ ████ ███████ ███████:",
"allowOverrun": "██████ ████████:"
}, },
"untis": "untis":
{ {

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{ {
"name": "opencountdown", "name": "opencountdown",
"version": "1.0.4", "version": "1.0.7",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "opencountdown", "name": "opencountdown",
"version": "1.0.4", "version": "1.0.7",
"license": "LGPL-3.0", "license": "LGPL-3.0",
"dependencies": { "dependencies": {
"body-parser": "^1.20.1", "body-parser": "^1.20.1",

View File

@ -131,6 +131,7 @@ $(function () {
$("#showMillis")[0].checked = jsonResult.showMilliSeconds; $("#showMillis")[0].checked = jsonResult.showMilliSeconds;
$("#progBarShow")[0].checked = jsonResult.showProgressbar; $("#progBarShow")[0].checked = jsonResult.showProgressbar;
$("#textColors")[0].checked = jsonResult.enableColoredText; $("#textColors")[0].checked = jsonResult.enableColoredText;
$("#allowOverrun")[0].checked = jsonResult.enableOverrun;
console.log(document.getElementById("tableCopySource")) console.log(document.getElementById("tableCopySource"))
let tableEntryDom = document.getElementById("tableCopySource").cloneNode(true) let tableEntryDom = document.getElementById("tableCopySource").cloneNode(true)
@ -266,6 +267,7 @@ $(function () {
const showMillisB = $("#showMillis")[0].checked const showMillisB = $("#showMillis")[0].checked
const progBarShowB = $("#progBarShow")[0].checked const progBarShowB = $("#progBarShow")[0].checked
const textColorsB = $("#textColors")[0].checked const textColorsB = $("#textColors")[0].checked
const allowOverrun = $("#allowOverrun")[0].checked
const colors = convertColorSegments("colors1") const colors = convertColorSegments("colors1")
const colors2 = convertColorSegments("colors2") const colors2 = convertColorSegments("colors2")
@ -276,6 +278,8 @@ $(function () {
allPathes.push("/api/v1/set/text/enableColoring?enable=" + textColorsB) allPathes.push("/api/v1/set/text/enableColoring?enable=" + textColorsB)
allPathes.push("/api/v1/set/progressbar/colors?isBase64=true&colors=" + btoa(JSON.stringify(colors))) allPathes.push("/api/v1/set/progressbar/colors?isBase64=true&colors=" + btoa(JSON.stringify(colors)))
allPathes.push("/api/v1/set/text/colors?isBase64=true&colors=" + btoa(JSON.stringify(colors2))) allPathes.push("/api/v1/set/text/colors?isBase64=true&colors=" + btoa(JSON.stringify(colors2)))
allPathes.push("/api/v1/set/enableOverrun?enable=" + allowOverrun)
for (pI in allPathes) { for (pI in allPathes) {
@ -301,11 +305,13 @@ $(function () {
const showMillisB = $("#showMillis")[0].checked const showMillisB = $("#showMillis")[0].checked
const progBarShowB = $("#progBarShow")[0].checked const progBarShowB = $("#progBarShow")[0].checked
const textColorsB = $("#textColors")[0].checked const textColorsB = $("#textColors")[0].checked
const allowOverrun = $("#allowOverrun")[0].checked
allPathes.push("/api/v1/set/layout/showTime?persist=true&show=" + showTimeB) allPathes.push("/api/v1/set/layout/showTime?persist=true&show=" + showTimeB)
allPathes.push("/api/v1/set/layout/showMillis?persist=true&show=" + showMillisB) allPathes.push("/api/v1/set/layout/showMillis?persist=true&show=" + showMillisB)
allPathes.push("/api/v1/set/progressbar/show?persist=true&show=" + progBarShowB) allPathes.push("/api/v1/set/progressbar/show?persist=true&show=" + progBarShowB)
allPathes.push("/api/v1/set/text/enableColoring?persist=true&enable=" + textColorsB) allPathes.push("/api/v1/set/text/enableColoring?persist=true&enable=" + textColorsB)
allPathes.push("/api/v1/set/enableOverrun?persist=true&enable=" + allowOverrun)
for (pI in allPathes) { for (pI in allPathes) {
const path = allPathes[pI]; const path = allPathes[pI];

View File

@ -186,6 +186,9 @@ function handleUpdate() {
progressBar.style.width = percentage(diff, dataFrame.timeAmountInital) + "%"; progressBar.style.width = percentage(diff, dataFrame.timeAmountInital) + "%";
} else { } else {
progressBar.style.width = "0%"; progressBar.style.width = "0%";
if(!dataFrame.enableOverrun) {
timer.innerHTML = "00:00:00";
}
} }
progressBar.style.backgroundColor = findProgessColor(dataFrame.colorSegments, diff) progressBar.style.backgroundColor = findProgessColor(dataFrame.colorSegments, diff)

View File

@ -262,6 +262,9 @@
<label for="progBarShow"><%= it.lang.labels.showProgress %></label> <label for="progBarShow"><%= it.lang.labels.showProgress %></label>
<input type="checkbox" name="progBarShow" id="progBarShow"><br> <input type="checkbox" name="progBarShow" id="progBarShow"><br>
<label for="allowOverrun"><%= it.lang.labels.allowOverrun %></label>
<input type="checkbox" name="allowOverrun" id="allowOverrun"><br>
<details> <details>
<summary><%= it.lang.labels.progbarColors %></summary> <summary><%= it.lang.labels.progbarColors %></summary>
<p> <p>