Skip to content

Commit e4f13a9

Browse files
committed
Added JS to sidebar-nav-bs
1 parent d42575f commit e4f13a9

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

doc/_templates/sidebar-nav-bs.html

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,29 @@
77
{% endif %}
88
</div>
99
</nav>
10+
11+
<script>
12+
document.addEventListener('DOMContentLoaded', function() {
13+
if (window.location.pathname.includes('/reference/')) {
14+
const navContainer = document.querySelector('#bd-docs-nav .bd-toc-item');
15+
if (navContainer) {
16+
const topLevelItems = Array.from(navContainer.children);
17+
18+
topLevelItems.forEach(section => {
19+
const subLists = section.querySelectorAll('ul');
20+
subLists.forEach(list => {
21+
const items = Array.from(list.children);
22+
23+
items.sort((a, b) => {
24+
const textA = a.textContent.trim().toLowerCase();
25+
const textB = b.textContent.trim().toLowerCase();
26+
return textA.localeCompare(textB);
27+
});
28+
29+
items.forEach(item => list.appendChild(item));
30+
});
31+
});
32+
}
33+
}
34+
});
35+
</script>

0 commit comments

Comments
 (0)