update hash change thing

This commit is contained in:
Zane Hannan 2019-07-26 11:48:04 +10:00
parent 235dba9f01
commit 64524f76e4

View File

@ -110,12 +110,12 @@
<script src="assets/bootstrap-toc.min.js"></script>
<!-- convenence script -->
<script>
addEventListener("hashchange", e => {
addEventListener("hashchange", () => {
var q = document.querySelector(location.hash)
if (q instanceof HTMLHeadingElement && q.parentElement.parentElement instanceof HTMLDetailsElement) {
if (q instanceof HTMLHeadingElement && q.parentElement.parentElement instanceof HTMLDetailsElement)
q.parentElement.parentElement.open = true;
}
})
if (location.hash) requestAnimationFrame(() => dispatchEvent(new HashChangeEvent("hashchange")));
if ('IntersectionObserver' in self) {
const mo = new IntersectionObserver(i => {
for (const s of i) {