eorzea-songbook/static/script.js

26 lines
683 B
JavaScript

function getAnchor() {
return (document.URL.split('#').length > 1) ? document.URL.split('#')[1] : null;
}
window.addEventListener('load', (event) => {
preclicked = getAnchor();
console.log(preclicked);
const radiobutton = document.getElementById(preclicked);
console.log(radiobutton);
if (radiobutton){
radiobutton.checked = true;
}
label = document.getElementById(`${preclicked}_label`)
label.scrollIntoView();
});
function collapse(clickevent){
const radiobutton = document.getElementById(clickevent.target.htmlFor);
if (radiobutton.checked){
radiobutton.checked = false;
clickevent.preventDefault();
}
}