Compare commits
No commits in common. "469fa5048c8901eaae4c405dce5320094aaac076" and "df3f5fdb58ac69dac3e5af1575f665d44cb45777" have entirely different histories.
469fa5048c
...
df3f5fdb58
@ -22,11 +22,12 @@ function convertStringBooleanToBoolean(stringBoolean) {
|
||||
|
||||
function wrapBooleanConverter(stringBoolean, res) {
|
||||
const temp = convertStringBooleanToBoolean(stringBoolean);
|
||||
if(temp == -1) {
|
||||
if(temp === -1) {
|
||||
res.json({ status: "error", message: "Invalid boolean value" });
|
||||
} else {
|
||||
return(temp);
|
||||
}
|
||||
}
|
||||
|
||||
// export { convertStringBooleanToBoolean, wrapBooleanConverter };
|
||||
module.exports = { convertStringBooleanToBoolean, wrapBooleanConverter };
|
10
index.js
10
index.js
@ -131,7 +131,7 @@ app.get("/api/v1/set/mode", function (req, res) {
|
||||
|
||||
app.get("/api/v1/set/layout/showMillis", function (req, res) {
|
||||
const resy = helper.wrapBooleanConverter(req.query.show, res)
|
||||
if (resy != undefined) {
|
||||
if (resy) {
|
||||
currentState.showMilliSeconds = resy;
|
||||
if (req.query.persist === 'true') {
|
||||
dataToBeWritten.showMilliSeconds = currentState.showMilliSeconds
|
||||
@ -151,7 +151,6 @@ app.get("/api/v1/set/timerGoal", function (req, res) {
|
||||
app.get("/api/v1/set/addMillisToTimer", function (req, res) {
|
||||
currentState.timeAmountInital = req.query.time;
|
||||
currentState.countdownGoal = new Date().getTime() + parseInt(req.query.time)
|
||||
currentState.pauseMoment = new Date().getTime();
|
||||
res.json({ status: "ok" });
|
||||
updatedData()
|
||||
});
|
||||
@ -181,7 +180,7 @@ app.get("/api/v1/ctrl/timer/restart", function (req, res) {
|
||||
|
||||
app.get("/api/v1/set/layout/showTime", function (req, res) {
|
||||
const resy = helper.wrapBooleanConverter(req.query.show, res)
|
||||
if (resy != undefined) {
|
||||
if (resy) {
|
||||
currentState.showTimeOnCountdown = resy;
|
||||
if (req.query.persist === 'true') {
|
||||
dataToBeWritten.showTimeOnCountdown = currentState.showTimeOnCountdown
|
||||
@ -220,10 +219,6 @@ app.get("/api/v1/set/progressbar/colors", function (req, res) {
|
||||
|
||||
app.get("/api/v1/set/text/colors", function (req, res) {
|
||||
try {
|
||||
if (req.query.copy === "true") {
|
||||
currentState.textColors = currentState.colorSegments
|
||||
res.json({ status: "ok" });
|
||||
} else {
|
||||
let data = req.query.colors
|
||||
if(req.query.isBase64 === "true"){
|
||||
data = atob(data)
|
||||
@ -233,7 +228,6 @@ app.get("/api/v1/set/text/colors", function (req, res) {
|
||||
if (req.query.persist === 'true') {
|
||||
dataToBeWritten.textColors = currentState.textColors
|
||||
}
|
||||
}
|
||||
res.json({ status: "ok" });
|
||||
} catch (error) {
|
||||
res.json({ status: "error", message: error });
|
||||
|
@ -6,24 +6,20 @@ function convertTimeOffset() {
|
||||
|
||||
function convertColorSegments(elementId) {
|
||||
const raw = document.getElementById(elementId);
|
||||
console.log(raw)
|
||||
const segmentData = {}
|
||||
for (elm in raw.children) {
|
||||
if (raw.children[elm].nodeName == "TR") {
|
||||
const child = raw.children[elm].children[1].children[0]
|
||||
let timeVal = parseInt(raw.children[elm].children[0].children[0].value * 1000);
|
||||
if(Number.isInteger(timeVal)){
|
||||
segmentData[timeVal] = child.style.color
|
||||
} else {
|
||||
segmentData["START"] = child.style.color
|
||||
}
|
||||
if (raw.children[elm].nodeName == "TBODY") {
|
||||
const child = raw.children[elm].firstChild.childNodes
|
||||
segmentData[child[0].innerText] = child[2].firstChild.value
|
||||
}
|
||||
}
|
||||
console.info(segmentData)
|
||||
return (segmentData)
|
||||
}
|
||||
|
||||
$(function () {
|
||||
// $(".numVal").bind("DOMSubtreeModified", alert);
|
||||
$(document).ready(function () {
|
||||
$(".numVal").bind("DOMSubtreeModified", alert);
|
||||
|
||||
const modes = ["timer", "clock", "black", "test"]
|
||||
let selectPresetTime = 0;
|
||||
@ -47,58 +43,28 @@ $(function () {
|
||||
const tree2 = jsonview.create(dataSystem);
|
||||
jsonview.render(tree2, document.getElementById("systemInfo"));
|
||||
jsonview.expand(tree2);
|
||||
// console.log(dataSystem)
|
||||
})
|
||||
|
||||
$("#addRow").on("click", function (event) {
|
||||
const tableEntryDom = document.getElementById("tableCopySource").cloneNode(true)
|
||||
let temp = tableEntryDom.innerHTML
|
||||
temp = temp.replace("#COLOR#", "gray");
|
||||
temp = temp.replace("#bg-COLOR#", "gray");
|
||||
temp = temp.replace("#VALUE#", 60); // BUG: Doesn't work but not too important
|
||||
temp = temp.replace("timeValue-ID", Math.floor(Math.random() * 9999999))
|
||||
tableEntryDom.innerHTML = temp;
|
||||
tableEntryDom.firstChild.nextSibling.children[0].classList.add("timeDurPicker")
|
||||
tableEntryDom.id = Math.floor(Math.random() * 9999999)
|
||||
document.getElementById("colors1").appendChild(tableEntryDom)
|
||||
$(".deleteRow1").on("click", function removeRowEntry(event) {
|
||||
$(event.target).closest("tr").remove();
|
||||
});
|
||||
$('.timeDurPicker').durationPicker({
|
||||
showSeconds: true,
|
||||
showDays: false,
|
||||
onChanged: function (newVal, test, val2) {
|
||||
// $('#duration-label2').text(newVal);
|
||||
val2.days[0].parentElement.parentElement.parentElement.parentElement.children[1].value = newVal
|
||||
//console.log(val2.days[0].parentElement.parentElement.parentElement.parentElement.children[1].value)
|
||||
//console.log(val2.days[0].parentElement.parentElement.parentElement.parentElement.children[1])
|
||||
}
|
||||
});
|
||||
$("#addRow").click(function (event) {
|
||||
$("#colors1").append(
|
||||
'<tr>' +
|
||||
'<td contenteditable="true" class="time"></td>' +
|
||||
'<td contenteditable="true" class="color full"><input id="demo-input1" "type="text" value="#COLOR#" data-coloris /></td></td>' +
|
||||
'<td><button type="button" class="btn btn-danger btn-rounded btn-sm my-0 deleteRow1">Remove</button></td>' +
|
||||
'</tr>'
|
||||
);
|
||||
|
||||
});
|
||||
|
||||
$("#addRow2").on("click", function (event) {
|
||||
const tableEntryDom = document.getElementById("tableCopySource").cloneNode(true)
|
||||
let temp = tableEntryDom.innerHTML
|
||||
temp = temp.replace("#COLOR#", "gray");
|
||||
temp = temp.replace("#bg-COLOR#", "gray");
|
||||
temp = temp.replace("#VALUE#", 60); // BUG: Doesn't work but not too important
|
||||
temp = temp.replace("timeValue-ID", Math.floor(Math.random() * 9999999))
|
||||
tableEntryDom.innerHTML = temp;
|
||||
tableEntryDom.firstChild.nextSibling.children[0].classList.add("timeDurPicker")
|
||||
tableEntryDom.id = Math.floor(Math.random() * 9999999)
|
||||
document.getElementById("colors2").appendChild(tableEntryDom)
|
||||
$(".deleteRow1").on("click", function removeRowEntry(event) {
|
||||
$(event.target).closest("tr").remove();
|
||||
});
|
||||
$('.timeDurPicker').durationPicker({
|
||||
showSeconds: true,
|
||||
showDays: false,
|
||||
onChanged: function (newVal, test, val2) {
|
||||
// $('#duration-label2').text(newVal);
|
||||
val2.days[0].parentElement.parentElement.parentElement.parentElement.children[1].value = newVal
|
||||
//console.log(val2.days[0].parentElement.parentElement.parentElement.parentElement.children[1].value)
|
||||
//console.log(val2.days[0].parentElement.parentElement.parentElement.parentElement.children[1])
|
||||
}
|
||||
});
|
||||
$("#addRow2").click(function (event) {
|
||||
$("#colors2").append(
|
||||
'<tr>' +
|
||||
'<td contenteditable="true" class="time"></td>' +
|
||||
'<td contenteditable="true" class="color full"><input id="demo-input2" type="text" value="#COLOR#" data-coloris /></td></td>' +
|
||||
'<td><button type="button" class="btn btn-danger btn-rounded btn-sm my-0 deleteRow1">Remove</button></td>' +
|
||||
'</tr>'
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
@ -127,98 +93,38 @@ $(function () {
|
||||
// Restore mode radio
|
||||
const currentModeInt = modes.indexOf(jsonResult.mode);
|
||||
$("#btnradio" + (currentModeInt + 1))[0].checked = true
|
||||
|
||||
// Restore layout settings
|
||||
$("#showTime")[0].checked = jsonResult.showTimeOnCountdown;
|
||||
$("#showMillis")[0].checked = jsonResult.showMilliSeconds;
|
||||
$("#progBarShow")[0].checked = jsonResult.showProgressbar;
|
||||
$("#textColors")[0].checked = jsonResult.enableColoredText;
|
||||
console.log(document.getElementById("tableCopySource"))
|
||||
|
||||
let tableEntryDom = document.getElementById("tableCopySource").cloneNode(true)
|
||||
let currIndex = 0
|
||||
for (item in jsonResult.colorSegments) {
|
||||
tableEntryDom = document.getElementById("tableCopySource").cloneNode(true)
|
||||
let temp = tableEntryDom.innerHTML
|
||||
let temp = tableEntry.replace("#VALUE#", item);
|
||||
temp = temp.replace("#COLOR#", jsonResult.colorSegments[item]);
|
||||
temp = temp.replace("#bg-COLOR#", jsonResult.colorSegments[item]);
|
||||
temp = temp.replace("timeValue-ID", "timeValue-1C" + currIndex)
|
||||
|
||||
if(item != "START"){
|
||||
temp = temp.replace("#VALUE#", item/1000);
|
||||
tableEntryDom.innerHTML = temp;
|
||||
tableEntryDom.firstChild.nextSibling.children[0].classList.add("timeDurPicker")
|
||||
} else {
|
||||
tableEntryDom.innerHTML = temp;
|
||||
tableEntryDom.children[2].children[0].children[0].disabled = true;
|
||||
tableEntryDom.children[2].children[0].setAttribute("data-toggle", "tooltip")
|
||||
tableEntryDom.children[2].children[0].setAttribute("data-placement", "right")// 'data-placement="right" title="Tooltip on right"'
|
||||
tableEntryDom.children[2].children[0].setAttribute("title", "You cannot delete the start time")
|
||||
|
||||
tableEntryDom.children[0].innerHTML = '<i class="bi bi-flag-fill"></i> Start'
|
||||
document.getElementById("colors1").innerHTML += temp
|
||||
//console.log(jsonResult.colorSegments[item])
|
||||
}
|
||||
tableEntryDom.id = "1C" + currIndex
|
||||
tableEntryDom.style.display = "table-row"
|
||||
document.getElementById("colors1").appendChild(tableEntryDom)
|
||||
currIndex++;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Text colors
|
||||
currIndex = 0
|
||||
for (item in jsonResult.textColors) {
|
||||
tableEntryDom = document.getElementById("tableCopySource").cloneNode(true)
|
||||
let temp = tableEntryDom.innerHTML
|
||||
let temp = tableEntry.replace("#VALUE#", item);
|
||||
temp = temp.replace("#COLOR#", jsonResult.textColors[item]);
|
||||
temp = temp.replace("#bg-COLOR#", jsonResult.textColors[item]);
|
||||
temp = temp.replace("timeValue-ID", "timeValue-1C" + currIndex)
|
||||
|
||||
if(item != "START"){
|
||||
temp = temp.replace("#VALUE#", item/1000);
|
||||
tableEntryDom.innerHTML = temp;
|
||||
tableEntryDom.firstChild.nextSibling.children[0].classList.add("timeDurPicker")
|
||||
} else {
|
||||
tableEntryDom.innerHTML = temp;
|
||||
tableEntryDom.children[2].children[0].children[0].disabled = true;
|
||||
tableEntryDom.children[2].children[0].setAttribute("data-toggle", "tooltip")
|
||||
tableEntryDom.children[2].children[0].setAttribute("data-placement", "right")// 'data-placement="right" title="Tooltip on right"'
|
||||
tableEntryDom.children[2].children[0].setAttribute("title", "You cannot delete the start time")
|
||||
|
||||
tableEntryDom.children[0].innerHTML = '<i class="bi bi-flag-fill"></i> Start'
|
||||
document.getElementById("colors2").innerHTML += temp
|
||||
//console.log(jsonResult.textColors[item])
|
||||
}
|
||||
|
||||
|
||||
// timeDurPicker
|
||||
tableEntryDom.id = "1C" + currIndex
|
||||
tableEntryDom.style.display = "table-row"
|
||||
document.getElementById("colors2").appendChild(tableEntryDom)
|
||||
currIndex++;
|
||||
}
|
||||
|
||||
|
||||
$('.timeDurPicker').durationPicker({
|
||||
showSeconds: true,
|
||||
showDays: false,
|
||||
onChanged: function (newVal, test, val2) {
|
||||
// $('#duration-label2').text(newVal);
|
||||
val2.days[0].parentElement.parentElement.parentElement.parentElement.children[1].value = newVal
|
||||
//console.log(val2.days[0].parentElement.parentElement.parentElement.parentElement.children[1].value)
|
||||
//console.log(val2.days[0].parentElement.parentElement.parentElement.parentElement.children[1])
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
//console.debug(jsonResult, currentModeInt)
|
||||
$('.colorPicky').on('colorpickerChange', function (event) {
|
||||
event.target.parentElement.style.backgroundColor = event.target.value
|
||||
});
|
||||
|
||||
$(".deleteRow1").on("click", function removeRowEntry(event) {
|
||||
$(event.target).closest("tr").remove();
|
||||
//console.warn(event.target.parentElement)
|
||||
$(event.target).closest("tbody").remove();
|
||||
});
|
||||
$('[data-toggle="tooltip"]').tooltip({container: "body"})
|
||||
})
|
||||
|
||||
$("#copyColors").click(function CopyTextColors(event) {
|
||||
@ -268,7 +174,7 @@ $(function () {
|
||||
$("#applyLayout").click(function (event) {
|
||||
$("#applyLayout")[0].innerHTML = '<div class="spinner-border-sm spinner-border"></div>'
|
||||
|
||||
// Collect all data, build all paths
|
||||
// Collect all data, build all paths3
|
||||
const allPathes = [];
|
||||
|
||||
const showTimeB = $("#showTime")[0].checked
|
||||
|
@ -261,7 +261,7 @@
|
||||
<summary>Text Colors</summary>
|
||||
<p>
|
||||
|
||||
<div id="table2" class="table-editable">
|
||||
<div id="table" class="table-editable">
|
||||
<table class="table table-bordered table-responsive-md table-striped text-center" id="colors2">
|
||||
<thead>
|
||||
<tr>
|
||||
@ -314,51 +314,24 @@
|
||||
</div>
|
||||
<br><br>
|
||||
<i class="bi-alarm"></i>
|
||||
<templateObj>
|
||||
<table class="table table-bordered table-responsive-md table-striped text-center" id="colors1">
|
||||
<thead>
|
||||
<templateObj id="tableCopySource">
|
||||
<tr>
|
||||
<th class="text-center">Time</th>
|
||||
<th class="text-center">Color</th>
|
||||
<th class="text-center">Remove</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tr id="tableCopySource">
|
||||
<td contenteditable="false" class="time">
|
||||
<input type="text" class="form-control " id="timeValue-ID" value="#VALUE#">
|
||||
<td contenteditable="true" class="time">
|
||||
<form>
|
||||
<div class="form-group">
|
||||
<label>Duration with seconds</label>
|
||||
<input type="text" class="form-control" id="duration2">
|
||||
</div>
|
||||
<value></value>
|
||||
</form>
|
||||
|
||||
</td>
|
||||
<td class="pt-3-half full" contenteditable="false">
|
||||
<div class="clr-field" style="color: #bg-COLOR#;">
|
||||
<button aria-labelledby="clr-open-label"></button>
|
||||
<input type="text" class="coloris" value="#COLOR#"></div>
|
||||
</div>
|
||||
<td contenteditable="true" class="color full"><input id="demo-input2" type="text"
|
||||
value="#COLOR#" data-coloris /></td>
|
||||
</td>
|
||||
<td>
|
||||
<span class="table-remove"><button type="button"
|
||||
class="btn btn-danger btn-rounded btn-sm my-0 deleteRow1">
|
||||
Remove
|
||||
</button></span>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
|
||||
<tr><td class="pt-3-half numVal" contenteditable="true">#VALUE#</td>
|
||||
<td class="pt-3-half full" contenteditable="false">
|
||||
<div class="clr-field" style="color: #bg-COLOR#;">
|
||||
<button aria-labelledby="clr-open-label"></button>
|
||||
<input id="demo-input1" type="text" class="coloris" value="#COLOR#"></div>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<span class="table-remove"><button type="button"
|
||||
class="btn btn-danger btn-rounded btn-sm my-0 deleteRow1">
|
||||
Remove
|
||||
</button></span>
|
||||
<button type="button"
|
||||
class="btn btn-danger btn-rounded btn-sm my-0 deleteRow1">Remove</button>
|
||||
</td>
|
||||
</tr>
|
||||
</templateObj>
|
||||
@ -404,9 +377,6 @@
|
||||
el: '.coloris',
|
||||
alpha: false,
|
||||
});
|
||||
$(function () {
|
||||
$('[data-toggle="tooltip"]').tooltip({container: "body"})
|
||||
})
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
Loading…
Reference in New Issue
Block a user