yay took not long

This commit is contained in:
thrhymes
2025-12-24 22:07:14 +01:00
parent e3c69b6188
commit b7cb257d05
5 changed files with 16 additions and 70 deletions

View File

@@ -4,7 +4,7 @@
* - Install/Update Overlay mit beforeinstallprompt.prompt()
*/
const APP_VERSION = "2025.12.24.11";
const APP_VERSION = "2025.12.24.12";
const TOKEN = "T9e7WESBXxy6rSD";
const BASE = "https://home.x-s.at";
const SHARE_DAV = `${BASE}/public.php/dav/files/${TOKEN}`;
@@ -255,24 +255,17 @@ function renderList(items, currentDir) {
for (const it of pdfs) {
const a = document.createElement("a");
a.className = "row";
a.href = "#";
a.addEventListener("click", (e) => {
e.preventDefault();
// Build relative path within share
// href includes /public.php/dav/files/<token>/...; we want path after that
const marker = `/public.php/dav/files/${TOKEN}`;
const idx = it.href.indexOf(marker);
let rel = "/";
if (idx >= 0) rel = it.href.slice(idx + marker.length);
if (!rel.startsWith("/")) rel = "/" + rel;
const targetUrl = toPdfJsUrl(rel);
// Open in new tab so closing the PDF returns to the list, not back navigation
const win = window.open(targetUrl, "_blank", "noopener,noreferrer");
if (!win) {
// fallback if blocked
window.location.href = targetUrl;
}
});
// Build relative path within share for viewer URL
const marker = `/public.php/dav/files/${TOKEN}`;
const idx = it.href.indexOf(marker);
let rel = "/";
if (idx >= 0) rel = it.href.slice(idx + marker.length);
if (!rel.startsWith("/")) rel = "/" + rel;
const targetUrl = toPdfJsUrl(rel);
a.href = targetUrl;
a.target = "_blank";
a.rel = "noopener noreferrer";
const ico = document.createElement("div");
ico.className = "ico";