Skip to content

Commit f0a43a6

Browse files
committed
handle sidebar scrolling on state transitions
1 parent 613e287 commit f0a43a6

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

apify-docs-theme/static/js/custom.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,25 @@ function scrollOpenApiSidebarItemIntoView() {
7575
});
7676
}
7777

78+
function redirectOpenApiDocs() {
79+
const { hash, pathname } = new URL(window.location.href);
80+
81+
// TODO change to '/api/v2'
82+
if (pathname.replace(/\/$/, '') !== '/api/v2-new') {
83+
return;
84+
}
85+
86+
if (hash.startsWith('#/reference/')) {
87+
const id = hash.substring('/#reference/'.length);
88+
console.log('redirect', { id, hash });
89+
}
90+
91+
if (hash.startsWith('#tag/')) {
92+
const id = hash.substring('#tag/'.length);
93+
console.log('redirect', { id, hash });
94+
}
95+
}
96+
7897
let ticking = false;
7998

8099
document.addEventListener('scroll', () => {

0 commit comments

Comments
 (0)