mirror of
https://github.com/alrayyes/wiki.git
synced 2025-06-07 22:26:40 +00:00
local and global graph
This commit is contained in:
parent
8bfee04c8c
commit
c4cf0dcb02
23 changed files with 1288 additions and 110 deletions
quartz/components/scripts
|
@ -29,8 +29,8 @@ const getOpts = ({ target }: Event): { url: URL, scroll?: boolean } | undefined
|
|||
return { url: new URL(href), scroll: 'routerNoscroll' in a.dataset ? false : undefined }
|
||||
}
|
||||
|
||||
function notifyNav(slug: string) {
|
||||
const event = new CustomEvent("nav", { detail: { slug } })
|
||||
function notifyNav(url: string) {
|
||||
const event: CustomEventMap["nav"] = new CustomEvent("nav", { detail: { url } })
|
||||
document.dispatchEvent(event)
|
||||
}
|
||||
|
||||
|
@ -73,6 +73,8 @@ async function navigate(url: URL, isBack: boolean = false) {
|
|||
delete announcer.dataset.persist
|
||||
}
|
||||
|
||||
window.spaNavigate = navigate
|
||||
|
||||
function createRouter() {
|
||||
if (typeof window !== "undefined") {
|
||||
window.addEventListener("click", async (event) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue