website: redesign part 14

This commit is contained in:
nym21
2026-06-07 01:05:04 +02:00
parent c68d1d1fda
commit 9fc45625ad
7 changed files with 34 additions and 23 deletions
+6 -5
View File
@@ -37,6 +37,7 @@ function activatePage(page) {
page.hidden = false;
page.inert = false;
currentPage = page;
page.dispatchEvent(new Event("pageactive"));
}
function renderPage() {
@@ -44,10 +45,10 @@ function renderPage() {
activatePage(getPage(pathname));
}
/** @param {string} pathname */
function navigate(pathname) {
if (pathname === window.location.pathname) return;
history.pushState(null, "", pathname);
/** @param {string} path */
function navigate(path) {
if (path === `${window.location.pathname}${window.location.hash}`) return;
history.pushState(null, "", path);
void transitionPage(renderPage);
}
@@ -64,7 +65,7 @@ document.addEventListener("click", (event) => {
if (!isRoute(url.pathname)) return;
event.preventDefault();
navigate(url.pathname);
navigate(`${url.pathname}${url.hash}`);
});
window.addEventListener("popstate", renderPage);