Squashed 'themes/codex/' content from commit da2d16a

git-subtree-dir: themes/codex
git-subtree-split: da2d16a4f95fc37e71548dfc139d51e22ebb09bd
This commit is contained in:
2020-12-11 02:43:08 +05:30
commit bfb1829a86
77 changed files with 3137 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
window.addEventListener('DOMContentLoaded', () => {
const observer = new IntersectionObserver(entries => {
entries.forEach(entry => {
const id = entry.target.getAttribute('id');
if (entry.intersectionRatio > 0) {
document.querySelector(`#TableOfContents ul li a[href="#${id}"]`).classList.add('active');
} else {
document.querySelector(`#TableOfContents ul li a[href="#${id}"]`).classList.remove('active');
}
});
});
// Track all headers that have an `id` applied
document.querySelectorAll('article h3[id], article h2[id]').forEach((section) => {
observer.observe(section);
});
});