-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
index: add hack to restore docsify behaviour
This attempts to restore the old behaviour of docsify.js, where it uses hash parameters to navigate the site. Since this isn't the case in VitePress, all the old links to the guide broke, so check it on load. This works on a best-effort basis; if the corresponding page exists (such as `#/aroma/getting-started` -> `/aroma/getting-started`), it should navigate properly, but if the corresponding page doesn't exist, it will 404.
- Loading branch information
1 parent
999a2b1
commit 011480a
Showing
2 changed files
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* | ||
Copyright (C) 2024 Nintendo Homebrew | ||
SPDX-License-Identifier: MIT | ||
*/ | ||
|
||
const map = new WeakMap() | ||
|
||
function checkDocsify(callback) { | ||
if (map.has(callback)) | ||
return; | ||
map.set(callback, true); | ||
if (document.readyState === 'complete') | ||
callback(); | ||
else | ||
window.addEventListener('load', callback, false); | ||
} | ||
|
||
checkDocsify(() => { | ||
if(!window.location.hash) | ||
return; | ||
|
||
if(window.location.hash[1] == '/') { | ||
path = window.location.hash.substring(1); | ||
window.location.href = path; | ||
} | ||
}) |