From 89de32ee250fbda06b70a32d9b64d334554e1aaa Mon Sep 17 00:00:00 2001 From: thrhymes Date: Wed, 24 Dec 2025 21:44:53 +0100 Subject: [PATCH] new file - close check --- zuss/app.js | 20 +++----------------- zuss/close.html | 47 +++++++++++++++++++++++++++++++++++++++++++++++ zuss/index.html | 3 ++- zuss/sw.js | 5 +++-- zuss/version.json | 2 +- 5 files changed, 56 insertions(+), 21 deletions(-) create mode 100644 zuss/close.html diff --git a/zuss/app.js b/zuss/app.js index 965dc2f..cc4601c 100644 --- a/zuss/app.js +++ b/zuss/app.js @@ -4,7 +4,7 @@ * - Install/Update Overlay mit beforeinstallprompt.prompt() */ -const APP_VERSION = "2025.12.24.8"; +const APP_VERSION = "2025.12.24.9"; const TOKEN = "T9e7WESBXxy6rSD"; const BASE = "https://home.x-s.at"; const SHARE_DAV = `${BASE}/public.php/dav/files/${TOKEN}`; @@ -327,22 +327,8 @@ 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); + const ret = encodeURIComponent(location.pathname + location.search); + window.location.href = `./close.html?return=${ret}`; } function applyTheme(t){ diff --git a/zuss/close.html b/zuss/close.html new file mode 100644 index 0000000..ce2064d --- /dev/null +++ b/zuss/close.html @@ -0,0 +1,47 @@ + + + + + + + + + + Schließen? + + + +
+

Wirklich schließen?

+

Bestätige, ob der Aushang beendet werden soll.

+
+ + +
+
+ + + diff --git a/zuss/index.html b/zuss/index.html index 1c896b7..feecd67 100644 --- a/zuss/index.html +++ b/zuss/index.html @@ -6,6 +6,7 @@ + @@ -168,6 +169,6 @@ - + diff --git a/zuss/sw.js b/zuss/sw.js index d859588..d7da71d 100644 --- a/zuss/sw.js +++ b/zuss/sw.js @@ -1,8 +1,9 @@ -const CACHE = "wfw-aushang-2025.12.24.8"; +const CACHE = "wfw-aushang-2025.12.24.9"; const ASSETS = [ "/zuss/", "/zuss/index.html", + "/zuss/close.html", "/zuss/app.js", "/zuss/manifest.webmanifest", "/zuss/version.json", @@ -40,7 +41,7 @@ self.addEventListener("fetch", (event) => { return fresh; } catch { const cached = await caches.match(req); - return cached || new Response('{"version":"2025.12.24.8"}', { headers: { "Content-Type": "application/json" } }); + return cached || new Response('{"version":"2025.12.24.9"}', { headers: { "Content-Type": "application/json" } }); } })()); return; diff --git a/zuss/version.json b/zuss/version.json index ae47802..f425f0c 100644 --- a/zuss/version.json +++ b/zuss/version.json @@ -1 +1 @@ -{ "version": "2025.12.24.8" } +{ "version": "2025.12.24.9" }