1
0
mirror of https://github.com/kalmarek/SmallHyperbolic synced 2024-11-27 08:30:27 +01:00

separate lib/execution of math rendering in js

This commit is contained in:
Marek Kaluba 2022-02-22 14:22:45 +01:00
parent bc6792e9c2
commit bf3163f6bd
No known key found for this signature in database
GPG Key ID: 8BF1A3855328FC15
2 changed files with 14 additions and 14 deletions

View File

@ -14,3 +14,16 @@ let table = fetch_json(groups_url)
.then(setup_table)
.then(setup_filter)
;
let math_objects = document.getElementsByClassName("math");
let katex_switch = document.getElementById("renderWithKatex");
katex_switch.checked = true;
katex_switch.addEventListener(
"change",
function () {
let toggle = this.checked;
for (let element of math_objects) {
toggleKaTeX(element, toggle);
}
}
);

View File

@ -18,8 +18,8 @@ function createMathSpan(content) {
math_tex.className = "math-tex";
katex.render(prepareTextForKatex(math_text.innerText), math_tex);
item.appendChild(math_text);
item.appendChild(math_tex);
item.appendChild(math_text);
return item;
}
@ -40,16 +40,3 @@ function toggleKaTeX(elt, toggle) {
}
}
}
let math_objects = document.getElementsByClassName("math");
let katex_switch = document.getElementById("renderWithKatex");
katex_switch.checked = true;
katex_switch.addEventListener(
"change",
function () {
let toggle = this.checked;
for (let element of math_objects) {
toggleKaTeX(element, toggle);
}
}
);