This commit is contained in:
thrhymes
2025-12-24 21:38:27 +01:00
parent 354e897e55
commit e1bda360f4
5 changed files with 26 additions and 13 deletions

View File

@@ -4,7 +4,7 @@
* - Install/Update Overlay mit beforeinstallprompt.prompt() * - Install/Update Overlay mit beforeinstallprompt.prompt()
*/ */
const APP_VERSION = "2025.12.24.6"; const APP_VERSION = "2025.12.24.8";
const TOKEN = "T9e7WESBXxy6rSD"; const TOKEN = "T9e7WESBXxy6rSD";
const BASE = "https://home.x-s.at"; const BASE = "https://home.x-s.at";
const SHARE_DAV = `${BASE}/public.php/dav/files/${TOKEN}`; const SHARE_DAV = `${BASE}/public.php/dav/files/${TOKEN}`;
@@ -326,6 +326,25 @@ async function registerSW() {
} }
} }
function closeAushang(){
try { window.close(); } catch {}
// Some browsers block close() once we navigated to pdf.js and back; fallback to back/blank
setTimeout(() => {
if (document.visibilityState === "hidden") return; // tab closed or navigating
const ref = document.referrer || "";
const cameFromPdf = ref.includes("/pdfjs/");
if (ref && !cameFromPdf) {
history.back();
setTimeout(() => {
if (document.visibilityState === "hidden") return;
location.href = "about:blank";
}, 180);
} else {
location.href = "about:blank";
}
}, 140);
}
function applyTheme(t){ function applyTheme(t){
document.documentElement.setAttribute("data-theme", t); document.documentElement.setAttribute("data-theme", t);
localStorage.setItem("wfw_theme", t); localStorage.setItem("wfw_theme", t);
@@ -377,12 +396,7 @@ document.addEventListener("click", (e) => {
document.addEventListener("DOMContentLoaded", async () => { document.addEventListener("DOMContentLoaded", async () => {
$("refreshBtn").addEventListener("click", (e) => { e.preventDefault(); loadList(); }); $("refreshBtn").addEventListener("click", (e) => { e.preventDefault(); loadList(); });
$("closeBtn").addEventListener("click", (e) => { $("closeBtn").addEventListener("click", (e) => { e.preventDefault(); closeAushang(); });
e.preventDefault();
// Kiosk-ish: close tab if possible, else just go back
window.close();
setTimeout(() => { history.back(); }, 150);
});
initTheme(); initTheme();
$("themeBtn").addEventListener("click", () => { $("themeBtn").addEventListener("click", () => {
const current = document.documentElement.getAttribute("data-theme") || "dark"; const current = document.documentElement.getAttribute("data-theme") || "dark";

View File

@@ -168,6 +168,6 @@
</div> </div>
</div> </div>
<script src="./app.js?v=2025.12.24.6"></script> <script src="./app.js?v=2025.12.24.8"></script>
</body> </body>
</html> </html>

View File

@@ -3,7 +3,7 @@
"short_name": "WFW-Aushang", "short_name": "WFW-Aushang",
"start_url": "/zuss/?source=pwa", "start_url": "/zuss/?source=pwa",
"scope": "/zuss/", "scope": "/zuss/",
"display": "standalone", "display": "fullscreen",
"orientation": "portrait", "orientation": "portrait",
"background_color": "#0b1020", "background_color": "#0b1020",
"theme_color": "#0b1020", "theme_color": "#0b1020",
@@ -12,4 +12,3 @@
{ "src": "/zuss/icons/icon-512.png", "sizes": "512x512", "type": "image/png" } { "src": "/zuss/icons/icon-512.png", "sizes": "512x512", "type": "image/png" }
] ]
} }

View File

@@ -1,4 +1,4 @@
const CACHE = "wfw-aushang-2025.12.24.6"; const CACHE = "wfw-aushang-2025.12.24.8";
const ASSETS = [ const ASSETS = [
"/zuss/", "/zuss/",
@@ -40,7 +40,7 @@ self.addEventListener("fetch", (event) => {
return fresh; return fresh;
} catch { } catch {
const cached = await caches.match(req); const cached = await caches.match(req);
return cached || new Response('{"version":"2025.12.24.6"}', { headers: { "Content-Type": "application/json" } }); return cached || new Response('{"version":"2025.12.24.8"}', { headers: { "Content-Type": "application/json" } });
} }
})()); })());
return; return;

View File

@@ -1 +1 @@
{ "version": "2025.12.24.6" } { "version": "2025.12.24.8" }