Version 3.6 mit URL Zoom Funktion

Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
Erik Thiele
2026-04-27 13:03:45 +02:00
parent 4cd170c9df
commit 0fa3c00319
5 changed files with 162 additions and 69 deletions

View File

@@ -22,8 +22,9 @@
background: black;
display: none;
position: fixed;
top: 0;
left: 0;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
z-index: 1;
}
@@ -122,10 +123,14 @@ function normalizeItem(item) {
if (typeof item === "string") {
const lower = item.toLowerCase();
if (lower.startsWith("http://") || lower.startsWith("https://")) {
return { kind: "url", url: item };
return { kind: "url", url: item, zoom: 1.0 };
}
return { kind: "file", name: item };
}
// Item is already an object (from backend) - ensure zoom is set
if (item.kind === "url" && !("zoom" in item)) {
item.zoom = 1.0;
}
return item;
}
@@ -198,10 +203,27 @@ function playNext() {
vid.pause();
vid.src = "";
iframe.src = "";
iframe.style.transform = "scale(1)"; // Reset zoom
if (item.kind === "url") {
iframe.style.display = "block";
iframe.src = item.url;
// Apply zoom factor with browser-like behavior
// Zoom < 1.0: mehr Inhalt sichtbar (wie Browser herauszoomen)
// Zoom > 1.0: weniger Inhalt sichtbar (wie Browser reinzoomen)
const zoom = item.zoom || 1.0;
if (zoom !== 1.0) {
// Adjust iframe size and scale to simulate real browser zoom
const scale = 1 / zoom; // Inverted for proper zoom behavior
iframe.style.width = `${100 * scale}vw`;
iframe.style.height = `${100 * scale}vh`;
iframe.style.transform = `translate(-50%, -50%) scale(${zoom})`;
} else {
iframe.style.width = `100vw`;
iframe.style.height = `100vh`;
iframe.style.transform = `translate(-50%, -50%)`;
}
setTimeout(playNext, interval);
return;
}