Fehler behoben Stay on first slide
This commit is contained in:
@@ -321,11 +321,8 @@
|
||||
// Player-JavaScript
|
||||
// ═════════════════════════════════════════════════════
|
||||
|
||||
let playerTimer = null;
|
||||
|
||||
// ─── Custom-URL/Voice-Agent-Overlay (open/close mit Zurück-Button-Position-Tracking) ───
|
||||
function openOverlay(url, pos) {
|
||||
if (playerTimer) clearTimeout(playerTimer);
|
||||
document.getElementById("overlay").style.display = "block";
|
||||
document.getElementById("overlay-iframe").src = url;
|
||||
var backBtn = document.getElementById("overlay-back");
|
||||
@@ -361,6 +358,7 @@ const site = "{{ site }}";
|
||||
let normalIndex = 0;
|
||||
let prioIndex = 0;
|
||||
let mode = "normal"; // "normal" | "prio"
|
||||
|
||||
const img = document.getElementById("image");
|
||||
const vid = document.getElementById("video");
|
||||
const iframe = document.getElementById("iframe");
|
||||
@@ -462,7 +460,6 @@ function playNext() {
|
||||
iframe.style.height = `100vh`;
|
||||
iframe.style.transform = `translate(-50%, -50%)`;
|
||||
}
|
||||
if (!stayOnFirst) playerTimer = setTimeout(playNext, interval);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -479,12 +476,10 @@ function playNext() {
|
||||
iframe.style.width = `100vw`;
|
||||
iframe.style.height = `100vh`;
|
||||
iframe.style.transform = `translate(-50%, -50%)`;
|
||||
if (!stayOnFirst) playerTimer = setTimeout(playNext, interval);
|
||||
} else {
|
||||
// Bild (jpg/png)
|
||||
img.style.display = "block";
|
||||
img.src = src;
|
||||
if (!stayOnFirst) playerTimer = setTimeout(playNext, interval);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -498,18 +493,14 @@ async function checkForUpdates() {
|
||||
const hash = data.hash;
|
||||
const serverStayOnFirst = data.stay_on_first;
|
||||
|
||||
// Dynamisch stayOnFirst vom Server übernehmen
|
||||
const wasStopped = stayOnFirst === true;
|
||||
stayOnFirst = serverStayOnFirst;
|
||||
|
||||
// Wenn stayOnFirst gerade ausgeschaltet wurde → sofort weiterlaufen
|
||||
if (wasStopped && !stayOnFirst) {
|
||||
if (playerTimer) clearTimeout(playerTimer);
|
||||
playNext();
|
||||
}
|
||||
|
||||
// Hash-Änderung → Seite komplett neu laden
|
||||
if (lastHash && lastHash !== hash) {
|
||||
if (lastHash && lastHash !== hash && !wasStopped) {
|
||||
location.reload(true);
|
||||
}
|
||||
lastHash = hash;
|
||||
@@ -565,6 +556,16 @@ async function checkForUpdates() {
|
||||
|
||||
// ─── Start ───
|
||||
playNext();
|
||||
|
||||
// Zyklischer Durchlauf: alle `interval` ms vorrücken, wenn stayOnFirst aus ist
|
||||
// und kein Video aktiv läuft (Videos steuern sich via onended)
|
||||
setInterval(function() {
|
||||
if (!stayOnFirst && vid.style.display !== "block") {
|
||||
playNext();
|
||||
}
|
||||
}, interval);
|
||||
|
||||
// Config-Änderungen erkennen (stayOnFirst, Playlist)
|
||||
setInterval(checkForUpdates, 5000);
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user