adding some comments

This commit is contained in:
Juicysteak117
2025-10-12 23:51:05 -07:00
parent e39680024f
commit dbc2d207ae

View File

@@ -1,3 +1,7 @@
// this function adds the + and functionality to the toc so that it is less scary
// it's still pretty scary ngl it's a giant toc but at least it starts hidden
// also this was super cobbled togethered from searches based on the limitations at hand
// i don't know if this should be in like a main() or whatever. idk i don't code
var coll = document.querySelectorAll(".ltx_tocentry.ltx_tocentry_section > .ltx_ref"); var coll = document.querySelectorAll(".ltx_tocentry.ltx_tocentry_section > .ltx_ref");
var i; var i;
@@ -13,21 +17,22 @@ for (i = 0; i < coll.length; i++) {
} }
} else {} } else {}
}); });
// don't add the + if there's nothing to expand
if (coll[i].nextElementSibling) {} else { if (coll[i].nextElementSibling) {} else {
coll[i].classList.add("del"); coll[i].classList.add("del");
} }
} }
/* copy on click for section permalinks */ // copy on click for section permalinks
function copyURI(evt) { function copyURI(evt) {
evt.preventDefault(); evt.preventDefault();
/* ensures url is without hash, then add on correct hash */ // ensures url is without hash, then add on correct hash
navigator.clipboard.writeText(window.location.href.replace(window.location.hash,'') + evt.target.getAttribute('href')).then(() => { navigator.clipboard.writeText(window.location.href.replace(window.location.hash,'') + evt.target.getAttribute('href')).then(() => {
/* clipboard successfully set */ // clipboard successfully set
}, () => { }, () => {
/* clipboard write failed */ // clipboard write failed
}); });
/* toast that i ripped from w3schools. does not nicely handle being spam clicked. w/e*/ // toast that i ripped from w3schools. does not nicely handle being spam clicked. w/e
var x = document.getElementById("snackbar"); var x = document.getElementById("snackbar");
x.className = "show"; x.className = "show";
setTimeout(function(){ x.className = x.className.replace("show", ""); }, 2000); setTimeout(function(){ x.className = x.className.replace("show", ""); }, 2000);