Tlačítka na sbalení a rozbalení korektur

This commit is contained in:
Jonas Havelka 2025-03-05 13:51:24 +01:00
parent c125d7a62b
commit 290f11cb2e
3 changed files with 24 additions and 1 deletions

View file

@ -20,6 +20,11 @@ body {
}
}
#sbal-korektury, #rozbal-korektury {
float: right;
margin-left: 4pt;
}
img{background:white;}
/* Barvy korektur */

View file

@ -131,9 +131,12 @@
// hide or show text of correction
#toggle_visibility(){
toggle_visibility() {
this.zobrazit = !this.zobrazit;
this.htmlElement.dataset.opravazobrazit = String(this.zobrazit);
}
#toggle_visibility(){
this.toggle_visibility();
place_comments()
}

View file

@ -20,6 +20,10 @@ Zobrazit:
onchange="toggle_corrections('k_zaneseni')" checked>
<label for="k_zaneseni_checkbox">K zanesení (<span id="k_zaneseni_pocet"></span>)</label>
<button type="button" id="sbal-korektury">Sbal korektury</button>
<button type="button" id="rozbal-korektury">Rozbal korektury</button>
<hr/>
<script>
@ -65,4 +69,15 @@ Zobrazit:
}
for (let [stav, pocet] of Object.entries(pocty_stavu)) spany_s_pocty_stavu[stav].innerText = pocet;
}
document.getElementById("sbal-korektury").addEventListener("click", () => {
for (const oprava of Object.values(opravy))
if (oprava.zobrazit) oprava.toggle_visibility();
place_comments();
})
document.getElementById("rozbal-korektury").addEventListener("click", () => {
for (const oprava of Object.values(opravy))
if (!oprava.zobrazit) oprava.toggle_visibility();
place_comments();
})
</script>