56 lines
No EOL
2.1 KiB
JavaScript
56 lines
No EOL
2.1 KiB
JavaScript
// ui-helper.js - Zentrale Steuerung für Modals und allgemeine UI-Elemente
|
|
window.UI = {
|
|
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) {
|
|
const modal = document.getElementById("custom-modal");
|
|
document.getElementById("custom-modal-title").textContent = title;
|
|
document.getElementById("custom-modal-message").textContent = message;
|
|
document.getElementById("custom-modal-cancel").classList.add("hidden");
|
|
modal.classList.remove("hidden");
|
|
document.getElementById("custom-modal-ok").onclick = () => modal.classList.add("hidden");
|
|
},
|
|
|
|
showConfirm(title, message, callback) {
|
|
const modal = document.getElementById("custom-modal");
|
|
document.getElementById("custom-modal-title").textContent = title;
|
|
document.getElementById("custom-modal-message").textContent = message;
|
|
const cancelBtn = document.getElementById("custom-modal-cancel");
|
|
cancelBtn.classList.remove("hidden");
|
|
modal.classList.remove("hidden");
|
|
|
|
document.getElementById("custom-modal-ok").onclick = () => {
|
|
modal.classList.add("hidden");
|
|
callback(true);
|
|
};
|
|
cancelBtn.onclick = () => {
|
|
modal.classList.add("hidden");
|
|
callback(false);
|
|
};
|
|
},
|
|
|
|
updateDocumentTitle(stationName) {
|
|
document.title = stationName ? `${stationName} - Radioplayer` : "Radioplayer";
|
|
},
|
|
|
|
initializeFooter() {
|
|
const yearEl = document.getElementById('current-year');
|
|
const serverEl = document.getElementById('server-name');
|
|
if (yearEl) yearEl.textContent = new Date().getFullYear();
|
|
if (serverEl) serverEl.textContent = window.location.hostname;
|
|
}
|
|
}; |