diff --git a/public/custom/transitions.js b/public/custom/transitions.js index 45cebc0..fd7e9f0 100644 --- a/public/custom/transitions.js +++ b/public/custom/transitions.js @@ -66,6 +66,12 @@ setTimeout(function () { window.location.href = ziel; }, 320); }); + /* Zurück-Navigation: der Back-Forward-Cache stellt die Seite im + ausgeblendeten Zustand (seite-ausgang) wieder her → wieder einblenden */ + window.addEventListener("pageshow", function (e) { + if (e.persisted) document.body.classList.remove("seite-ausgang"); + }); + /* ---------- 3) Scroll-Einblenden ---------- */ var elemente = document.querySelectorAll(".einblenden"); if (elemente.length && "IntersectionObserver" in window && !reduce) { @@ -83,14 +89,18 @@ } /* ---------- 4a) Dock-Active-State ---------- */ - /* decodeURIComponent: Umlaut-URLs (über-mich) kommen prozent-kodiert an */ - var pfad = decodeURIComponent(window.location.pathname).replace(/\/index\.html$/, "/"); + /* decodeURIComponent: Umlaut-URLs (über-mich) kommen prozent-kodiert an. + Vergleich nur über das letzte Pfadsegment – ein Teilstring-Vergleich + würde z. B. am GitLab-Projektpfad /portfolio-photo/ fälschlich matchen. */ + var pfad = decodeURIComponent(window.location.pathname); + var seite = pfad.replace(/\/$/, "").split("/").pop() + .replace(/\.html$/, "").replace(/^index$/, ""); var dockLinks = document.querySelectorAll(".dock-links a"); dockLinks.forEach(function (a) { var hp = a.getAttribute("href") || ""; - var norm = hp.replace(/^\.\//, "/").replace(/\/$/, ""); - var aktuell = pfad.replace(/\/$/, ""); - if (norm && aktuell.indexOf(norm) !== -1 && norm !== "/") { + if (/^(mailto:|tel:|https?:|#)/i.test(hp)) return; + var ziel = hp.replace(/\/$/, "").split("/").pop().replace(/\.html$/, ""); + if (ziel && seite === ziel) { a.setAttribute("aria-current", "page"); } });