static-old/media/js/sjl.js @ 721e4d30593f lisp

Remove useless nesting that Hugo used to require
author Steve Losh <steve@stevelosh.com>
date Sun, 05 Jan 2020 18:36:56 -0500
parents f9c2bf2fa2c9
children (none)
function ready(fn) {
  if (document.attachEvent ? document.readyState === "complete" : document.readyState !== "loading"){
    fn();
  } else {
    document.addEventListener('DOMContentLoaded', fn);
  }
}

ready(function() {
    hiddenToc = document.querySelectorAll('#leaf-toc');
    actualToc = document.querySelectorAll('#toc');

    if (hiddenToc.length && actualToc.length) {
        // hugo's toc support is fucked so we need to move shit around by hand
        // computers are garbage
        actualToc[0].innerHTML = hiddenToc[0].innerHTML;
    }
});