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.
 
 
 
 
 

32 lines
1.5 KiB

  1. window.addEventListener('scroll', function(e) {
  2. if (document.querySelector('body').clientWidth > 1024) {
  3. let rightcolumn = document.querySelector('.rightcolumn');
  4. let mantletitle = document.querySelector('.mantletitle') || document.querySelector('.crusttitle');
  5. let mantlebar = document.querySelector('.mantlebar')
  6. let grid = document.querySelector('.grid')
  7. let gridrect = mantletitle.getBoundingClientRect();
  8. if (gridrect.top < 20 && !grid.classList.contains('moved')) {
  9. grid.classList.add('moved');
  10. mantlebar.style.display = "inline";
  11. mantletitle.style.visibility = "hidden";
  12. grid.style.display = "none";
  13. window.scrollBy({top: grid.clientHeight + mantletitle.clientHeight, behavior: 'smooth'})
  14. } else if (gridrect.top > 21 && grid.classList.contains('moved')) {
  15. grid.classList.remove('moved');
  16. mantletitle.style.visibility = "visible";
  17. mantlebar.style.display = "none";
  18. grid.style.display = "grid";
  19. window.scroll({top: 0, behavior: 'smooth'})
  20. }
  21. }
  22. })
  23. window.addEventListener('DOMContentLoaded', (e) => {
  24. let par = document.querySelector("#TableOfContents > ol:first-child > li:first-child");
  25. let s = document.createElement("span");
  26. s.appendChild(par.cloneNode(true))
  27. par.remove()
  28. document.querySelector("#TableOfContents > ol:first-child").insertBefore(s, document.querySelector("#TableOfContents > ol:first-child").firstChild)
  29. })