Compare commits
8 Commits
2e1fc97f6f
...
v1.0.8
Author | SHA1 | Date | |
---|---|---|---|
704ecb4249 | |||
5398817a1e | |||
1fc16fdc14 | |||
b04a376b1d | |||
0bf867daf6 | |||
1423f51104 | |||
389d9a9b13 | |||
7dd2438881 |
@ -21,8 +21,6 @@ We've introduced a new packaging system. It is based on [electron-builder](https
|
|||||||
chmod +x ./build.sh
|
chmod +x ./build.sh
|
||||||
./build.sh
|
./build.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
> Binary Builds may be faulty or non-working. They are not officially supported.
|
|
||||||
*Small disclaimer: Please do not use openCountdown for military or life-depending applications. Please also refrain from using openCountdown for launching rockets.*
|
*Small disclaimer: Please do not use openCountdown for military or life-depending applications. Please also refrain from using openCountdown for launching rockets.*
|
||||||
|
|
||||||
|
|
||||||
|
18
index.js
18
index.js
@ -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),
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -156,6 +157,11 @@ app.get("/", function (req, res) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
app.get("/timer", function (req, res) {
|
app.get("/timer", function (req, res) {
|
||||||
|
const data = fs.readFileSync("templates/ng-timerview.html", "utf8");
|
||||||
|
res.send(data);
|
||||||
|
});
|
||||||
|
|
||||||
|
app.get("/timer-old", function (req, res) {
|
||||||
const data = fs.readFileSync("templates/timerPage.html", "utf8");
|
const data = fs.readFileSync("templates/timerPage.html", "utf8");
|
||||||
res.send(data);
|
res.send(data);
|
||||||
});
|
});
|
||||||
@ -264,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') {
|
||||||
|
@ -30,8 +30,9 @@
|
|||||||
{
|
{
|
||||||
"timer": "Timer",
|
"timer": "Timer",
|
||||||
"clock": "Uhr",
|
"clock": "Uhr",
|
||||||
"black": "Schwarz",
|
"black": "Leer",
|
||||||
"test": "Testbild"
|
"test": "Testbild",
|
||||||
|
"screensaver": "Bildschirmschoner"
|
||||||
},
|
},
|
||||||
"labels":
|
"labels":
|
||||||
{
|
{
|
||||||
@ -45,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":
|
||||||
{
|
{
|
||||||
|
@ -32,7 +32,8 @@
|
|||||||
"timer": "Timer",
|
"timer": "Timer",
|
||||||
"clock": "Clock",
|
"clock": "Clock",
|
||||||
"black": "Black",
|
"black": "Black",
|
||||||
"test": "Testimage"
|
"test": "Testimage",
|
||||||
|
"screensaver": "Screensaver"
|
||||||
},
|
},
|
||||||
"labels":
|
"labels":
|
||||||
{
|
{
|
||||||
@ -48,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":
|
||||||
{
|
{
|
||||||
|
@ -31,7 +31,8 @@
|
|||||||
"timer": "████",
|
"timer": "████",
|
||||||
"clock": "█████",
|
"clock": "█████",
|
||||||
"black": "████",
|
"black": "████",
|
||||||
"test": "███████"
|
"test": "███████",
|
||||||
|
"screensaver": "████████"
|
||||||
},
|
},
|
||||||
"labels":
|
"labels":
|
||||||
{
|
{
|
||||||
@ -45,7 +46,8 @@
|
|||||||
"enableTextClrs": "██████ ████ ███████:",
|
"enableTextClrs": "██████ ████ ███████:",
|
||||||
"textClrs": "████ ██████",
|
"textClrs": "████ ██████",
|
||||||
"addRow": "███ ███",
|
"addRow": "███ ███",
|
||||||
"timeVar": "██████ ████ ███████ ███████:"
|
"timeVar": "██████ ████ ███████ ███████:",
|
||||||
|
"allowOverrun": "██████ ████████:"
|
||||||
},
|
},
|
||||||
"untis":
|
"untis":
|
||||||
{
|
{
|
||||||
|
@ -1 +0,0 @@
|
|||||||
[{"timestamp":"2022-08-18 16:19:06.649","level":"info","module":"Logging","message":"2022-08-18 16:19:06.649 [info] [Logging] Logging initialized"},{"timestamp":"2022-08-18 16:19:06.651","level":"info","module":"Server","message":"2022-08-18 16:19:06.651 [info] [Server] Preparing server"},{"timestamp":"2022-08-18 16:19:06.652","level":"info","module":"Server","message":"2022-08-18 16:19:06.652 [info] [Server] Preparing static routes"},{"timestamp":"2022-08-18 16:19:06.654","level":"info","module":"Server","message":"2022-08-18 16:19:06.654 [info] [Server] Preparing middlewares"},{"timestamp":"2022-08-18 16:19:06.655","level":"info","module":"Config","message":"2022-08-18 16:19:06.655 [info] [Config] Loading config"},{"timestamp":"2022-08-18 16:19:06.658","level":"info","module":"Language","message":"2022-08-18 16:19:06.658 [info] [Language] Searching for languages"},{"timestamp":"2022-08-18 16:19:06.659","level":"info","module":"Language","message":"2022-08-18 16:19:06.659 [info] [Language] Found 3 languages"},{"timestamp":"2022-08-18 16:19:06.659","level":"info","module":"Language","message":"2022-08-18 16:19:06.659 [info] [Language] Reading language file"},{"timestamp":"2022-08-18 16:19:06.675","level":"info","module":"Websocket","message":"2022-08-18 16:19:06.675 [info] [Websocket] Preparing websocket"},{"timestamp":"2022-08-18 16:19:06.675","level":"info","module":"Server","message":"2022-08-18 16:19:06.675 [info] [Server] Preparing routes"},{"timestamp":"2022-08-18 16:19:06.678","level":"info","module":"Server","message":"2022-08-18 16:19:06.678 [info] [Server] Starting server"},{"timestamp":"2022-08-18 16:22:57.338","level":"info","module":"Shutdown","message":"2022-08-18 16:22:57.338 [info] [Shutdown] Caught interrupt signal and shutting down gracefully"}]
|
|
4
package-lock.json
generated
4
package-lock.json
generated
@ -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",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "opencountdown",
|
"name": "opencountdown",
|
||||||
"version": "1.0.5",
|
"version": "1.0.7",
|
||||||
"description": "An opensource countdown",
|
"description": "An opensource countdown",
|
||||||
"main": "startHandler.js",
|
"main": "startHandler.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
@ -1,3 +1,7 @@
|
|||||||
body {
|
body {
|
||||||
font-size:0.3em;
|
font-size:0.3em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.moverLogo {
|
||||||
|
height: 80px !important;
|
||||||
|
}
|
@ -111,3 +111,47 @@ animation:fade 1000ms infinite;
|
|||||||
font-size: x-large;
|
font-size: x-large;
|
||||||
font-family: sans-serif;
|
font-family: sans-serif;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
:root {
|
||||||
|
--my-end-left: 99%;
|
||||||
|
--my-end-top: 99%;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#moveClock {
|
||||||
|
font-size: 6em;
|
||||||
|
font-family: sans-serif;
|
||||||
|
position: absolute;
|
||||||
|
-webkit-animation: moveX 40s linear 0s infinite alternate, moveY 45s linear 0s infinite alternate;
|
||||||
|
-moz-animation: moveX 40s linear 0s infinite alternate, moveY 45s linear 0s infinite alternate;
|
||||||
|
-o-animation: moveX 40s linear 0s infinite alternate, moveY 45s linear 0s infinite alternate;
|
||||||
|
animation: moveX 40s linear 0s infinite alternate, moveY 45s linear 0s infinite alternate;
|
||||||
|
transition: all 0.8s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@-webkit-keyframes moveX {
|
||||||
|
from { left: 0; } to { left: var(--my-end-left) }
|
||||||
|
}
|
||||||
|
@-moz-keyframes moveX {
|
||||||
|
from { left: 0; } to { left: var(--my-end-left); }
|
||||||
|
}
|
||||||
|
@-o-keyframes moveX {
|
||||||
|
from { left: 0; } to { left: var(--my-end-left); }
|
||||||
|
}
|
||||||
|
@keyframes moveX {
|
||||||
|
from { left: 0; } to { left: var(--my-end-left); }
|
||||||
|
}
|
||||||
|
|
||||||
|
@-webkit-keyframes moveY {
|
||||||
|
from { top: 0; } to { top: var(--my-end-top); }
|
||||||
|
}
|
||||||
|
@-moz-keyframes moveY {
|
||||||
|
from { top: 0; } to { top: var(--my-end-top); }
|
||||||
|
}
|
||||||
|
@-o-keyframes moveY {
|
||||||
|
from { top: 0; } to { top: var(--my-end-top); }
|
||||||
|
}
|
||||||
|
@keyframes moveY {
|
||||||
|
from { top: 0; } to { top: var(--my-end-top); }
|
||||||
|
}
|
@ -25,7 +25,7 @@ function convertColorSegments(elementId) {
|
|||||||
$(function () {
|
$(function () {
|
||||||
// $(".numVal").bind("DOMSubtreeModified", alert);
|
// $(".numVal").bind("DOMSubtreeModified", alert);
|
||||||
|
|
||||||
const modes = ["timer", "clock", "black", "test"]
|
const modes = ["timer", "clock", "black", "test", "screensaver"]
|
||||||
let selectPresetTime = 0;
|
let selectPresetTime = 0;
|
||||||
|
|
||||||
if (Cookies.get("interfaceColor") != undefined) {
|
if (Cookies.get("interfaceColor") != undefined) {
|
||||||
@ -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];
|
||||||
|
284
static/js/timer/timerview.js
Normal file
284
static/js/timer/timerview.js
Normal file
@ -0,0 +1,284 @@
|
|||||||
|
|
||||||
|
|
||||||
|
// References to the HTML elements
|
||||||
|
let warningBox = document.getElementById("warningBanner");
|
||||||
|
let timer = document.getElementById("timer");
|
||||||
|
let testImage = document.getElementById("testImg");
|
||||||
|
let clockSec = document.getElementById("clockSec");
|
||||||
|
let timeDiffContainer = document.getElementById("timediff");
|
||||||
|
let wholeProgressBar = document.getElementById("wholeProgBar");
|
||||||
|
let progressBar = document.getElementById("progBar");
|
||||||
|
let overlay = document.getElementById("overlay");
|
||||||
|
let overlayText = document.getElementById("text");
|
||||||
|
let screensaverText = document.getElementById("moveClock");
|
||||||
|
let screensaverClock = document.getElementById("screensaverClock");
|
||||||
|
|
||||||
|
// Prepare connection to backend
|
||||||
|
let socket = new ReconnectingWebSocket("ws://" + location.hostname + ":" + location.port);
|
||||||
|
|
||||||
|
// State variables
|
||||||
|
let ackSessionTokenChange = false; // Wether the user has acknowledged the session token mismatch
|
||||||
|
let dataFrame = {};
|
||||||
|
let timeDiffToServer = 0;
|
||||||
|
let sessionToken = ""; // Our current session token
|
||||||
|
let defaultToFullscreen = false;
|
||||||
|
let allowFullscreen = true; // If the system is allowed to go fullscreen
|
||||||
|
|
||||||
|
// Scale down the interface if the smaller parameter is set
|
||||||
|
let smallerFlag = new URLSearchParams(window.location.search).get("smaller");
|
||||||
|
if (smallerFlag == "true") {
|
||||||
|
var cssURL = '/css/smallerTextMod.css';
|
||||||
|
document.head.innerHTML += '<link rel="stylesheet" href="' + cssURL + '"/>';
|
||||||
|
allowFullscreen = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle the screensaver to fit the screen
|
||||||
|
setTimeout(handleDVD, 200);
|
||||||
|
setTimeout(handleDVD, 400);
|
||||||
|
document.body.onresize = handleDVD;
|
||||||
|
|
||||||
|
// Handle connection event
|
||||||
|
socket.onopen = function (e) {
|
||||||
|
socket.send("new client");
|
||||||
|
};
|
||||||
|
|
||||||
|
// Handle connection close event
|
||||||
|
socket.onclose = function (event) {
|
||||||
|
warningBox.style.display = "block"; // Show warning banner
|
||||||
|
if (event.wasClean) {
|
||||||
|
console.log(`[close] Connection closed cleanly, code=${event.code} reason=${event.reason}`);
|
||||||
|
} else {
|
||||||
|
// e.g. server process killed or network down
|
||||||
|
// event.code is usually 1006 in this case
|
||||||
|
console.error('[close] Connection died');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Handle incoming data
|
||||||
|
socket.onmessage = function (event) {
|
||||||
|
// Parse the incoming data as JSON
|
||||||
|
const inData = JSON.parse(event.data);
|
||||||
|
// Check if the backend has restarted in the background
|
||||||
|
if (inData.sessionToken == sessionToken || sessionToken == "") {
|
||||||
|
dataFrame = JSON.parse(event.data);
|
||||||
|
// Time difference between the client and the server
|
||||||
|
timeDiffToServer = new Date().getTime() - dataFrame.srvTime;
|
||||||
|
|
||||||
|
if(dataFrame.debug) {
|
||||||
|
console.log(dataFrame)
|
||||||
|
timeDiffContainer.innerHTML = timeDiffToServer
|
||||||
|
timeDiffContainer.style.display = "block"
|
||||||
|
} else {
|
||||||
|
timeDiffContainer.style.display = "none"
|
||||||
|
}
|
||||||
|
|
||||||
|
// Process the data
|
||||||
|
handleUpdate();
|
||||||
|
} else {
|
||||||
|
// If the user has not acknowledged the session token mismatch, show a warning
|
||||||
|
if (!ackSessionTokenChange) {
|
||||||
|
ackSessionTokenChange = true;
|
||||||
|
if (confirm("Session token mismatch, reload the page?")) {
|
||||||
|
location.reload();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Update timer data regularly (every 20ms)
|
||||||
|
let updateIntervalReference = setInterval(handleUpdate, 20);
|
||||||
|
|
||||||
|
// Helper functions
|
||||||
|
|
||||||
|
// Get the current time in a HH:MM:SS format
|
||||||
|
function getTime() {
|
||||||
|
var date = new Date();
|
||||||
|
var h = date.getHours(); // 0 - 23
|
||||||
|
var m = date.getMinutes(); // 0 - 59
|
||||||
|
var s = date.getSeconds(); // 0 - 59
|
||||||
|
|
||||||
|
h = h < 10 ? "0" + h : h;
|
||||||
|
m = m < 10 ? "0" + m : m;
|
||||||
|
s = s < 10 ? "0" + s : s;
|
||||||
|
|
||||||
|
var time = h + ":" + m + ":" + s;
|
||||||
|
return time;
|
||||||
|
}
|
||||||
|
|
||||||
|
function percentage(partialValue, totalValue) {
|
||||||
|
return (100 * partialValue) / totalValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
function msToTime(s, data) {
|
||||||
|
isSmallerThenZero = false
|
||||||
|
if (s < 0) {
|
||||||
|
isSmallerThenZero = true
|
||||||
|
}
|
||||||
|
|
||||||
|
var ms = s % 1000;
|
||||||
|
s = (s - ms) / 1000;
|
||||||
|
var secs = s % 60;
|
||||||
|
s = (s - secs) / 60;
|
||||||
|
var mins = s % 60;
|
||||||
|
var hrs = (s - mins) / 60;
|
||||||
|
let out = ""
|
||||||
|
|
||||||
|
if (!data.showMilliSeconds) {
|
||||||
|
out = ('00' + Math.abs(hrs)).slice(-2) + ':' + ('00' + Math.abs(mins)).slice(-2) + ':' + ('00' + Math.abs(secs)).slice(-2)
|
||||||
|
} else {
|
||||||
|
out = ('00' + Math.abs(hrs)).slice(-2) + ':' + ('00' + Math.abs(mins)).slice(-2) + ':' + ('00' + Math.abs(secs)).slice(-2) + '.' + ('000' + Math.abs(ms)).slice(-3)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isSmallerThenZero) {
|
||||||
|
out = "-" + out
|
||||||
|
}
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
function findProgessColor(colors, value) {
|
||||||
|
const allColors = Object.keys(colors);
|
||||||
|
let resColor = colors["START"]
|
||||||
|
for (let color in allColors) {
|
||||||
|
const currColor = allColors[color]
|
||||||
|
if (value <= parseInt(currColor)) {
|
||||||
|
resColor = colors[String(currColor)]
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return (resColor)
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleUpdate() {
|
||||||
|
defaultToFullscreen = dataFrame.defaultFullScreen;
|
||||||
|
switch (dataFrame.mode) {
|
||||||
|
case "timer":
|
||||||
|
// Timer mode
|
||||||
|
timer.style.display = "block";
|
||||||
|
testImage.style.display = "none";
|
||||||
|
screensaverText.style.display = "none";
|
||||||
|
|
||||||
|
if(dataFrame.showTimeOnCountdown) {
|
||||||
|
// Show time on countdown
|
||||||
|
clockSec.innerHTML = getTime();
|
||||||
|
clockSec.style.display = "block";
|
||||||
|
} else {
|
||||||
|
clockSec.style.display = "none";
|
||||||
|
}
|
||||||
|
if(dataFrame.showProgressbar) {
|
||||||
|
// Show progressbar
|
||||||
|
wholeProgressBar.style.display = "block";
|
||||||
|
} else {
|
||||||
|
wholeProgressBar.style.display = "none";
|
||||||
|
}
|
||||||
|
// Calculate the time difference between the goal and the current time
|
||||||
|
const now = new Date();
|
||||||
|
let diff = 0;
|
||||||
|
if(dataFrame.timerRunState) {
|
||||||
|
diff = dataFrame.countdownGoal - now.getTime()
|
||||||
|
} else {
|
||||||
|
diff = (now.getTime() - dataFrame.pauseMoment) + dataFrame.countdownGoal - now.getTime()
|
||||||
|
}
|
||||||
|
|
||||||
|
timer.innerHTML = msToTime(diff, dataFrame);
|
||||||
|
|
||||||
|
// Handle the progressbar
|
||||||
|
if (diff >= 0) {
|
||||||
|
progressBar.style.width = percentage(diff, dataFrame.timeAmountInital) + "%";
|
||||||
|
} else {
|
||||||
|
progressBar.style.width = "0%";
|
||||||
|
if(!dataFrame.enableOverrun) {
|
||||||
|
timer.innerHTML = "00:00:00";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
progressBar.style.backgroundColor = findProgessColor(dataFrame.colorSegments, diff)
|
||||||
|
|
||||||
|
// Handle the text color
|
||||||
|
if (dataFrame.enableColoredText) {
|
||||||
|
timer.style.color = findProgessColor(dataFrame.textColors, diff)
|
||||||
|
} else {
|
||||||
|
timer.style.color = "white"
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "clock":
|
||||||
|
// Clock mode
|
||||||
|
timer.innerHTML = getTime();
|
||||||
|
testImage.style.display = "none";
|
||||||
|
clockSec.style.display = "none";
|
||||||
|
wholeProgressBar.style.display = "none";
|
||||||
|
timer.style.display = "block";
|
||||||
|
screensaverText.style.display = "none";
|
||||||
|
timer.style.color = "white";
|
||||||
|
break;
|
||||||
|
case "black":
|
||||||
|
// Black screen mode
|
||||||
|
testImage.style.display = "none";
|
||||||
|
clockSec.style.display = "none";
|
||||||
|
wholeProgressBar.style.display = "none";
|
||||||
|
timer.style.display = "none";
|
||||||
|
screensaverText.style.display = "none";
|
||||||
|
timer.style.color = "white";
|
||||||
|
break;
|
||||||
|
case "test":
|
||||||
|
// Test image mode
|
||||||
|
testImage.style.display = "block";
|
||||||
|
clockSec.style.display = "none";
|
||||||
|
wholeProgressBar.style.display = "none";
|
||||||
|
timer.style.display = "none";
|
||||||
|
screensaverText.style.display = "none";
|
||||||
|
timer.style.color = "white";
|
||||||
|
break;
|
||||||
|
case "screensaver":
|
||||||
|
// Screensaver mode
|
||||||
|
testImage.style.display = "none";
|
||||||
|
clockSec.style.display = "none";
|
||||||
|
wholeProgressBar.style.display = "none";
|
||||||
|
timer.style.display = "none";
|
||||||
|
timer.style.color = "white";
|
||||||
|
screensaverText.style.display = "block";
|
||||||
|
screensaverClock.innerHTML = getTime();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle the message overlay
|
||||||
|
if (dataFrame.showMessage) {
|
||||||
|
overlay.style.display = "block";
|
||||||
|
overlayText.innerHTML = dataFrame.message
|
||||||
|
} else {
|
||||||
|
overlay.style.display = "none";
|
||||||
|
}
|
||||||
|
|
||||||
|
// This will result in the text fading in and out when the message changes
|
||||||
|
if (new Date().getTime() - dataFrame.messageAppearTime < 5000) {
|
||||||
|
if (!overlayText.classList.contains('blink')) {
|
||||||
|
overlayText.classList.add("blink")
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (overlayText.classList.contains('blink')) {
|
||||||
|
overlayText.classList.remove("blink")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleDVD() {
|
||||||
|
console.info("Recalculating screensaver size")
|
||||||
|
const objHeight = document.body.offsetHeight - screensaverText.offsetHeight;
|
||||||
|
const objWidth = document.body.offsetWidth - screensaverText.offsetWidth;
|
||||||
|
document.documentElement.style.setProperty('--my-end-left', objWidth + "px");
|
||||||
|
document.documentElement.style.setProperty('--my-end-top', objHeight + "px");
|
||||||
|
}
|
||||||
|
|
||||||
|
function enterFullscreen(element) {
|
||||||
|
if (element.requestFullscreen) {
|
||||||
|
element.requestFullscreen();
|
||||||
|
} else if (element.msRequestFullscreen) {
|
||||||
|
element.msRequestFullscreen();
|
||||||
|
} else if (element.webkitRequestFullscreen) {
|
||||||
|
element.webkitRequestFullscreen();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateFullscreen() {
|
||||||
|
if (defaultToFullscreen && allowFullscreen) {
|
||||||
|
enterFullscreen(document.documentElement)
|
||||||
|
}
|
||||||
|
}
|
4631
static/logo/logoProposal-invert.svg
Normal file
4631
static/logo/logoProposal-invert.svg
Normal file
File diff suppressed because it is too large
Load Diff
After Width: | Height: | Size: 145 KiB |
@ -156,6 +156,9 @@
|
|||||||
|
|
||||||
<input type="radio" class="btn-check" name="btnradio" id="btnradio4" autocomplete="off">
|
<input type="radio" class="btn-check" name="btnradio" id="btnradio4" autocomplete="off">
|
||||||
<label class="btn btn-outline-primary" for="btnradio4"><%= it.lang.others.test %></label>
|
<label class="btn btn-outline-primary" for="btnradio4"><%= it.lang.others.test %></label>
|
||||||
|
|
||||||
|
<input type="radio" class="btn-check" name="btnradio" id="btnradio5" autocomplete="off">
|
||||||
|
<label class="btn btn-outline-primary" for="btnradio5"><%= it.lang.others.screensaver %></label>
|
||||||
</div>
|
</div>
|
||||||
<br>
|
<br>
|
||||||
<br>
|
<br>
|
||||||
@ -259,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>
|
||||||
|
64
templates/ng-timerview.html
Normal file
64
templates/ng-timerview.html
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
<!doctype html>
|
||||||
|
|
||||||
|
<html lang="en">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
|
||||||
|
<title>openCountdown - Timerpage</title>
|
||||||
|
<meta name="description" content="openCountdown">
|
||||||
|
<meta name="author" content="TheGreydiamond">
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="css/styles.css?v=1.1">
|
||||||
|
|
||||||
|
<link rel="icon" href="/logo/faviconLogo.svg" type="image/svg+xml">
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body onclick="updateFullscreen()" onresize="handleDVD()">
|
||||||
|
<div id="overlay">
|
||||||
|
<div id="text">Message here</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Collection of warning and errors -->
|
||||||
|
<noscript>
|
||||||
|
<div class="connectionWarning">
|
||||||
|
Javascript is disabled. Please enable it to use openCountdown.
|
||||||
|
</div>
|
||||||
|
</noscript>
|
||||||
|
|
||||||
|
<div class="connectionWarning" id="warningBanner" style="display: none;">
|
||||||
|
Connection lost. Trying to reconnect...
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Color Bar Image -->
|
||||||
|
<img src='SMPTE_Color_Bars.svg' class='testImg' id="testImg" style="display: none;">
|
||||||
|
</img>
|
||||||
|
|
||||||
|
<div class="container">
|
||||||
|
<div class="progWrapper" id="wholeProgBar">
|
||||||
|
<div class="progBar" id="progBar"></div>
|
||||||
|
</div>
|
||||||
|
<div class="timer" id="timer">
|
||||||
|
00:00:00
|
||||||
|
</div>
|
||||||
|
<div class="clockSec" id="clockSec">
|
||||||
|
</div>
|
||||||
|
<div class="clockSec" id="timediff">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div id="moveClock" style="display: none;">
|
||||||
|
<img src="logo/logoProposal-invert.svg" alt="openCountdown" height="180px" class="moverLogo" >
|
||||||
|
<center><div id="screensaverClock">
|
||||||
|
00:00:00
|
||||||
|
</div>
|
||||||
|
</center>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<!-- Load scripts -->
|
||||||
|
<script src="js/reconnecting-websocket.min.js"></script>
|
||||||
|
<script src="js/timer/timerview.js"></script>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
@ -6,12 +6,13 @@
|
|||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
|
||||||
<title>openCountdown</title>
|
<title>openCountdown - Timerpage</title>
|
||||||
<meta name="description" content="openCountdown">
|
<meta name="description" content="openCountdown">
|
||||||
<meta name="author" content="TheGreydiamond">
|
<meta name="author" content="TheGreydiamond">
|
||||||
|
|
||||||
<link rel="stylesheet" href="css/styles.css?v=1.1">
|
<link rel="stylesheet" href="css/styles.css?v=1.1">
|
||||||
|
|
||||||
|
<link rel="icon" href="/logo/faviconLogo.svg" type="image/svg+xml">
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body onclick="updateFullscreen()">
|
<body onclick="updateFullscreen()">
|
||||||
|
Reference in New Issue
Block a user