You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
736 B
JavaScript
26 lines
736 B
JavaScript
9 months ago
|
|
||
|
|
||
|
window.addEventListener("DOMContentLoaded", function () {
|
||
|
var allAnnotations = this.document.querySelectorAll(".fn-annotatation");
|
||
|
let level = 0;
|
||
|
const updateShownAnnotations = () => {
|
||
|
allAnnotations.forEach((el) => {
|
||
|
const elLevel = parseInt(el.getAttribute("level"));
|
||
|
console.log(elLevel, level);
|
||
|
if (elLevel < level) {
|
||
|
el.classList.add("visible");
|
||
|
} else {
|
||
|
el.classList.remove("visible");
|
||
|
}
|
||
|
})
|
||
|
}
|
||
|
|
||
|
updateShownAnnotations();
|
||
|
document.getElementById("annotation").addEventListener("input", (e) => {
|
||
|
level = Math.round(e.currentTarget.value / 100);
|
||
|
updateShownAnnotations();
|
||
|
|
||
|
|
||
|
|
||
|
})
|
||
|
})
|