Update ui-helper.js

This commit is contained in:
simonpipe 2025-12-18 22:19:35 +01:00
parent bb7069f23a
commit c90e2481a4

View file

@ -1,6 +1,21 @@
// ui-helper.js - Verwaltet allgemeine UI-Elemente und Modals // ui-helper.js - Zentrale Steuerung für Modals und allgemeine UI-Elemente
window.UI = { window.UI = {
// Zeigt ein einfaches Informations-Fenster openModal(modalId) {
const modal = document.getElementById(modalId);
if (modal) {
modal.classList.remove('hidden');
modal.style.display = 'block';
}
},
closeModal(modalId) {
const modal = document.getElementById(modalId);
if (modal) {
modal.classList.add('hidden');
modal.style.display = 'none';
}
},
showAlert(title, message) { showAlert(title, message) {
const modal = document.getElementById("custom-modal"); const modal = document.getElementById("custom-modal");
document.getElementById("custom-modal-title").textContent = title; document.getElementById("custom-modal-title").textContent = title;
@ -10,7 +25,6 @@ window.UI = {
document.getElementById("custom-modal-ok").onclick = () => modal.classList.add("hidden"); document.getElementById("custom-modal-ok").onclick = () => modal.classList.add("hidden");
}, },
// Zeigt ein Bestätigungs-Fenster mit Ja/Nein
showConfirm(title, message, callback) { showConfirm(title, message, callback) {
const modal = document.getElementById("custom-modal"); const modal = document.getElementById("custom-modal");
document.getElementById("custom-modal-title").textContent = title; document.getElementById("custom-modal-title").textContent = title;
@ -29,12 +43,10 @@ window.UI = {
}; };
}, },
// Aktualisiert den Titel im Browser-Tab
updateDocumentTitle(stationName) { updateDocumentTitle(stationName) {
document.title = stationName ? `${stationName} - Radioplayer` : "Radioplayer"; document.title = stationName ? `${stationName} - Radioplayer` : "Radioplayer";
}, },
// Füllt die Informationen im Footer aus
initializeFooter() { initializeFooter() {
const yearEl = document.getElementById('current-year'); const yearEl = document.getElementById('current-year');
const serverEl = document.getElementById('server-name'); const serverEl = document.getElementById('server-name');