Hugo Dark Theme Site Generator https://after-dark.habd.as
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

toc-maybe.html 857B

12345678910111213141516171819202122
  1. {{ if and (isset .Params "toc") .Params.toc }}
  2. <details>
  3. <summary>Table of Contents</summary>
  4. {{ .TableOfContents }}
  5. </details>
  6. <script>
  7. (function (window, document, undefined) {
  8. const el = document.querySelector('details summary');
  9. el.onclick = () => {
  10. (function(l,o,a,d,e,r){e=o.createElement(a),r=o.getElementsByTagName(a)[0];e.async=1;e.src=d;r.parentNode.insertBefore(e,r)})(window,document,'script','{{ "/js/smoothscroll.js" | relURL | safeJS }}');
  11. el.onclick = null;
  12. };
  13. document.querySelectorAll('#TableOfContents a').forEach(link => {
  14. link.addEventListener('click', () => {
  15. document.querySelector(
  16. link.href.slice(link.href.indexOf('#'))
  17. ).scrollIntoView({ behavior: 'smooth' });
  18. });
  19. });
  20. })(window, document);
  21. </script>
  22. {{ end }}