mirror of
https://github.com/jackyzha0/quartz.git
synced 2025-12-24 21:34:06 -06:00
Respect configuration
This commit is contained in:
parent
ac9db622ff
commit
8020bda9fc
@ -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
|
// Add click handler to main explorer
|
||||||
window.addCleanup(() => explorer.removeEventListener("click", toggleExplorer))
|
window.addCleanup(() => explorer.removeEventListener("click", toggleExplorer))
|
||||||
explorer.addEventListener("click", toggleExplorer)
|
explorer.addEventListener("click", toggleExplorer)
|
||||||
@ -169,7 +175,6 @@ window.addEventListener("resize", setupExplorer)
|
|||||||
|
|
||||||
document.addEventListener("nav", () => {
|
document.addEventListener("nav", () => {
|
||||||
const explorer = document.querySelector("#mobile-explorer")
|
const explorer = document.querySelector("#mobile-explorer")
|
||||||
const currentPath = document.getElementsByTagName("body")[0].getAttribute("data-slug") ?? ""
|
|
||||||
if (explorer) {
|
if (explorer) {
|
||||||
explorer.classList.add("collapsed")
|
explorer.classList.add("collapsed")
|
||||||
const content = explorer.nextElementSibling?.nextElementSibling as HTMLElement
|
const content = explorer.nextElementSibling?.nextElementSibling as HTMLElement
|
||||||
@ -177,10 +182,6 @@ document.addEventListener("nav", () => {
|
|||||||
content.classList.add("collapsed")
|
content.classList.add("collapsed")
|
||||||
content.classList.toggle("explorer-viewmode")
|
content.classList.toggle("explorer-viewmode")
|
||||||
}
|
}
|
||||||
const currentPathInExplorer = document.querySelector(`a[data-for="${currentPath}"]`)
|
|
||||||
if (currentPathInExplorer) {
|
|
||||||
currentPathInExplorer.classList.add("highlight-path")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
setupExplorer()
|
setupExplorer()
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user