INNER CODE UNIT · JavaScript
pct
LeyckerS/moondownloader · web/app.js:346
const pct = (n) => (total ? (n / total) * 100 : 0);
$("#mixDn").style.width = pct(dn) + "%";
$("#mixFf").style.width = pct(ff) + "%";
$("#mixOther").style.width = pct(ot) + "%";
for (const [sel, n] of [[".lg.dn", dn], [".lg.ff", ff], [".lg.ot", ot]]) {
$(sel).classList.toggle("off", !n);
}
},
repaint() {
const lines = this.lines();
if (lines.length > 1500) { this.paint.textContent = this.ta.value; return; }
this.paint.innerHTML = lines
.map((l) => (l.trim() ? `<span class="${classify(l)}">${escapeHtml(l)}</span>` : " "))
.join("\n");
this.sync();
},