Refactor for Gamemodes

This commit is contained in:
Carsten Graf
2025-08-05 21:21:22 +02:00
parent 60d4393bd2
commit 6793a54103
7 changed files with 213 additions and 149 deletions

View File

@@ -344,6 +344,7 @@
loadCurrentTime();
updateCurrentTimeDisplay();
loadWifiSettings();
loadMode();
};
// Aktuelle Zeit anzeigen (Live-Update)
@@ -525,6 +526,23 @@
.catch(error => showMessage('Verbindungsfehler', 'error'));
});
function loadMode() {
fetch("/api/get-mode")
.then((response) => response.json())
.then((data) => {
const mode = data.mode || "individual";
document.querySelectorAll('.mode-button').forEach(button => {
button.classList.remove('active');
});
const btn = document.querySelector(`.mode-button[data-mode="${mode}"]`);
if (btn) btn.classList.add('active');
})
.catch((error) => {
showMessage("Fehler beim Laden des Modus", "error");
});
}
// Einstellungen laden
function loadSettings() {
fetch("/api/get-settings")