Added splashscreen

This commit is contained in:
2024-06-06 21:51:18 +02:00
parent 469f917ada
commit c0ffac18e4
9 changed files with 107 additions and 6 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 91 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

+25 -1
View File
@@ -26,6 +26,11 @@ socket.on('score', (message) => {
// ######################################################################################################################################################
// General functions
// ######################################################################################################################################################
// Update DOM timer elements from passed values
function updateEtcFrontend(values) {
console.log(values);
document.getElementById("etcSwitchEnable").checked = values.splashscreenEnabled;// Set switch status to received score enabled value
}
// Update DOM timer elements from passed values
function updateTimerFrontend(values) {
@@ -137,7 +142,26 @@ async function openBrowser() {
}
async function killBrowser() {
const response = await fetch("/admin/killBrowser"); // Call API Endpoint /admin/killBrowser
const response = await fetch("/admin/killBrowser"); // Call API Endpoint /admin/killBrowser
}
// ######################################################################################################################################################
// Etc endpoints
// ######################################################################################################################################################
// Request important values for etc stuff
async function etcGetValues() {
const response = await fetch("/admin/etcGetValues"); // Call API Endpoint /admin/etcGetValues
const data = await response.json(); // Wait for asynchronous transfer to complete
updateEtcFrontend(data); // Update admin frontend
}
// Toggle index page to also show scoreboard
async function etcToggleSplashscreen() {
const response = await fetch("/admin/etcToggleSplashscreen");// Call API Endpoint /admin/etcToggleSplashscreen
const data = await response.json(); // Wait for asyncronous transfer to complete
updateEtcFrontend(data); // Update admin frontend
refreshMonitor(); // Refresh main monitor to display new frontend
}
// ######################################################################################################################################################
@@ -0,0 +1,14 @@
let wss = "ws://" + window.location.hostname + ":3001" // Build socketio endpoint from window.location
const socket = io(wss); // Connect to socketio server
// ######################################################################################################################################################
// Websockets event handler
// ######################################################################################################################################################
socket.on('connected', (message) => {
console.log("Connected");
});
socket.on('refresh', (message) => {
document.location.reload() // Reload page on received 'refresh' messagen
});