Skip to content

Commit

Permalink
chore: try reload
Browse files Browse the repository at this point in the history
  • Loading branch information
vladimirvolek committed Sep 19, 2024
1 parent 4970d5b commit c5dfdf3
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -308,12 +308,26 @@
"#tag/nut--link/GET/nutlink/tickers/{ticker}",
};

document.addEventListener("DOMContentLoaded", function () {
function handleHashRedirection() {
const hash = window.location.hash;

if (hash && redirectionMap[hash]) {
history.replaceState(null, null, redirectionMap[hash]);
const targetSection = document.querySelector(redirectionMap[hash]);

if (!targetSection) {
window.addEventListener("load", function () {
if (redirectionMap[hash]) {
document.querySelector(redirectionMap[hash]).scrollIntoView();
}
});
} else {
document.querySelector(redirectionMap[hash]).scrollIntoView();
}
}
}

window.addEventListener("hashchange", handleHashRedirection);
window.addEventListener("DOMContentLoaded", function () {
handleHashRedirection();
});
</script>
<script src="https://cdn.jsdelivr.net/npm/@scalar/api-reference"></script>
Expand Down

0 comments on commit c5dfdf3

Please sign in to comment.