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:
parent
bc6792e9c2
commit
bf3163f6bd
13
docs/main.js
13
docs/main.js
@ -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);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user