22 lines
642 B
JavaScript

function toggleAnnotations() {
var annotationCells = document.querySelectorAll("#annotation");
if (document.getElementById("toggleAnnotations").checked === true) {
annotationCells.forEach(setVisible);
} else {
annotationCells.forEach(setInvisible);
}
}
function setVisible(item) {
item.style.display = "block";
}
function setInvisible(item) {
item.style.display = "none";
}
/* First load all other scripts and then listen for click on checkbox */
document.addEventListener('turbolinks:load', () => {
document.getElementById("toggleAnnotations").addEventListener("click", toggleAnnotations);
});