Updated the concepts cloud
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user