Updated the concepts cloud

This commit is contained in:
2026-01-04 17:13:33 +00:00
parent d841a6d615
commit 3c2e04f941
7 changed files with 53 additions and 16 deletions

View File

@@ -252,22 +252,21 @@ function initStackedNavigation() {
if (!url.pathname.endsWith(".html")) return;
e.preventDefault();
pushPane(url.pathname + url.hash);
pushPane(url.pathname, url.hash);
});
}
async function pushPane(urlWithHash) {
async function pushPane(pathname, hash = "") {
const track = document.querySelector(".stack-track");
if (!track) return;
const existing = [...track.children].find(p => p.dataset.url === urlWithHash);
const existing = [...track.children].find(p => p.dataset.url === pathname);
if (existing) {
existing.scrollIntoView({ behavior: "smooth", inline: "end" });
return;
}
const [url, hash] = urlWithHash.split("#");
const res = await fetch(url);
const res = await fetch(pathname);
const doc = new DOMParser().parseFromString(await res.text(), "text/html");
const content = doc.querySelector("#content");
@@ -275,7 +274,7 @@ async function pushPane(urlWithHash) {
const pane = document.createElement("article");
pane.className = "stack-pane";
pane.dataset.url = urlWithHash;
pane.dataset.url = pathname;
pane.appendChild(content);
track.appendChild(pane);