Respect configuration

This commit is contained in:
saberzero1 2025-03-01 15:08:54 +01:00
parent ac9db622ff
commit 8020bda9fc
No known key found for this signature in database

View File

@ -103,6 +103,12 @@ function setupExplorer() {
}
}
const currentPath = document.getElementsByTagName("body")[0].getAttribute("data-slug") ?? ""
const currentPathInExplorer = document.querySelector(`a[data-for="${currentPath}"]`)
if (currentPathInExplorer && explorer.dataset.highlightpath === "true") {
currentPathInExplorer.classList.add("highlight-path")
}
// Add click handler to main explorer
window.addCleanup(() => explorer.removeEventListener("click", toggleExplorer))
explorer.addEventListener("click", toggleExplorer)
@ -169,7 +175,6 @@ window.addEventListener("resize", setupExplorer)
document.addEventListener("nav", () => {
const explorer = document.querySelector("#mobile-explorer")
const currentPath = document.getElementsByTagName("body")[0].getAttribute("data-slug") ?? ""
if (explorer) {
explorer.classList.add("collapsed")
const content = explorer.nextElementSibling?.nextElementSibling as HTMLElement
@ -177,10 +182,6 @@ document.addEventListener("nav", () => {
content.classList.add("collapsed")
content.classList.toggle("explorer-viewmode")
}
const currentPathInExplorer = document.querySelector(`a[data-for="${currentPath}"]`)
if (currentPathInExplorer) {
currentPathInExplorer.classList.add("highlight-path")
}
}
setupExplorer()