Skip to content

Commit bcd5add

Browse files
committed
'4.0.16'
1 parent d1156f6 commit bcd5add

51 files changed

Lines changed: 18939 additions & 39693 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

index.html

Lines changed: 6600 additions & 9666 deletions
Large diffs are not rendered by default.

js/styles/theme.css

Lines changed: 1070 additions & 0 deletions
Large diffs are not rendered by default.

js/toc.js

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
document.addEventListener('DOMContentLoaded', () => {
2+
const toc = document.getElementById('toc');
3+
if (!toc) return;
4+
5+
// 1. Check the path once on load
6+
const isModulesPage = window.location.pathname.includes('/modules');
7+
8+
const links = Array.from(toc.querySelectorAll('a'));
9+
const sections = [];
10+
11+
links.forEach(link => {
12+
const href = link.getAttribute('href');
13+
if (href && href.startsWith('#')) {
14+
const id = href.substring(1);
15+
const target = document.getElementById(id);
16+
if (target) {
17+
sections.push({ link, target });
18+
}
19+
}
20+
});
21+
22+
if (sections.length === 0) return;
23+
24+
function updateToc() {
25+
const offset = 95;
26+
let activeIndex = -1;
27+
28+
for (let i = 0; i < sections.length; i++) {
29+
const bounds = sections[i].target.getBoundingClientRect();
30+
if (bounds.top <= offset) {
31+
activeIndex = i;
32+
} else {
33+
break;
34+
}
35+
}
36+
37+
const scrollY = window.scrollY || window.pageYOffset;
38+
39+
if ((window.innerHeight + scrollY) >= document.documentElement.scrollHeight - 10) {
40+
activeIndex = sections.length - 1;
41+
}
42+
43+
if (scrollY < 50) {
44+
activeIndex = -1;
45+
}
46+
47+
// 1. Reset all states completely
48+
links.forEach(l => {
49+
l.classList.remove('active');
50+
let p = l.parentElement;
51+
while (p && p !== toc) {
52+
if (p.tagName === 'LI') p.classList.remove('expanded');
53+
p = p.parentElement;
54+
}
55+
});
56+
57+
// 2. Apply the active path based on scroll position
58+
if (activeIndex !== -1) {
59+
const activeLink = sections[activeIndex].link;
60+
activeLink.classList.add('active');
61+
let p = activeLink.parentElement;
62+
while (p && p !== toc) {
63+
if (p.tagName === 'LI') p.classList.add('expanded');
64+
p = p.parentElement;
65+
}
66+
}
67+
68+
// If we are on the modules page, ensure the first layer is ALWAYS expanded,
69+
// regardless of where we are scrolled.
70+
if (isModulesPage) {
71+
const topLevelLis = toc.querySelectorAll('.sectlevel1 > li');
72+
topLevelLis.forEach(li => li.classList.add('expanded'));
73+
}
74+
}
75+
76+
window.addEventListener('scroll', updateToc, { passive: true });
77+
setTimeout(updateToc, 100);
78+
});

js/tocbot.min.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)