From: Steinar H. Gunderson Date: Sat, 7 Apr 2018 23:26:19 +0000 (+0200) Subject: Add a hack around Exo's variable-width numerals. X-Git-Url: https://git.sesse.net/?p=ultimatescore;a=commitdiff_plain;h=0983f9b96d24c07bb72469d74e80f484df720d5a Add a hack around Exo's variable-width numerals. --- diff --git a/score.js b/score.js index 17ac07c..3f0a4d0 100644 --- a/score.js +++ b/score.js @@ -164,7 +164,20 @@ function update_clock() let sec = elapsed % 60; if (sec < 10) sec = "0" + sec; - document.getElementById('clock').innerHTML = min + ":" + sec; + let text = min + ":" + sec; + + // This is a hack around the fact that Exo has variable-width numerals. + // It doesn't look fantastic, but for the clock, it's better not to have + // the text jumping around. + let html = ""; + for (let i = 0; i < text.length; ++i) { + if (text.charAt(i) === ':') { + html += ':'; + } else { + html += "
" + text.charAt(i) + "
"; + } + } + document.getElementById('clock').innerHTML = html; } function goalA()