Checkbox für Playliste hinzugefügt

This commit is contained in:
Erik Thiele
2026-05-10 13:49:05 +02:00
parent 296e59e709
commit a1b48e35d6
8 changed files with 152 additions and 61 deletions

View File

@@ -131,6 +131,9 @@ function normalizeItem(item) {
if (item.kind === "url" && !("zoom" in item)) {
item.zoom = 1.0;
}
if (!("enabled" in item)) {
item.enabled = true;
}
return item;
}
@@ -149,29 +152,31 @@ function isHtml(item) {
function getNextItem() {
const normalizedNormal = normalFiles.map(normalizeItem);
const normalizedPrio = prioFiles.map(normalizeItem);
const activeNormal = normalizedNormal.filter(item => item.enabled !== false);
const activePrio = normalizedPrio.filter(item => item.enabled !== false);
// ✅ Sonderfall: nur Priority vorhanden
if (normalizedNormal.length === 0 && normalizedPrio.length > 0) {
if (activeNormal.length === 0 && activePrio.length > 0) {
return {
item: normalizedPrio[prioIndex++ % normalizedPrio.length],
item: activePrio[prioIndex++ % activePrio.length],
isPrio: true
};
}
// ✅ Sonderfall: nur normale Playlist vorhanden
if (normalizedPrio.length === 0 && normalizedNormal.length > 0) {
if (activePrio.length === 0 && activeNormal.length > 0) {
return {
item: normalizedNormal[normalIndex++ % normalizedNormal.length],
item: activeNormal[normalIndex++ % activeNormal.length],
isPrio: false
};
}
// ✅ Normal-Phase
if (mode === "normal") {
const item = normalizedNormal[normalIndex++];
if (normalIndex >= normalizedNormal.length) {
const item = activeNormal[normalIndex++];
if (normalIndex >= activeNormal.length) {
normalIndex = 0;
if (normalizedPrio.length > 0) {
if (activePrio.length > 0) {
mode = "prio"; // ➜ nach kompletter Normal-Playlist wechseln
}
}
@@ -180,8 +185,8 @@ function getNextItem() {
// ✅ Priority-Phase
if (mode === "prio") {
const item = normalizedPrio[prioIndex++];
if (prioIndex >= normalizedPrio.length) {
const item = activePrio[prioIndex++];
if (prioIndex >= activePrio.length) {
prioIndex = 0;
mode = "normal"; // ➜ nach kompletter Priority zurück
}
@@ -280,4 +285,3 @@ setInterval(checkForUpdates, 5000);
</body>
</html>