]> git.sesse.net Git - ultimatescore/blobdiff - score.js
Reinstate the Exo hack.
[ultimatescore] / score.js
index 273a311896ee3712ef8c87bc48d7971b4ab01f80..ab07189d53b872513e2b9ccf3f3184ba572b3cae 100644 (file)
--- a/score.js
+++ b/score.js
@@ -213,6 +213,13 @@ function time_elapsed_raw()
                clock_elapsed = clock_limit;
                clock_origin = Date.now();
                clock_running = false;
+
+               if (state['autocomment_on_clock_limit'] == '1' && !comment_visible) {
+                       state['comment'] = state['autocomment'];
+                       setcomment();
+                       showcomment();
+               }
+
                return clock_limit;
        }
        return clock_elapsed + elapsed;
@@ -247,7 +254,7 @@ function update_clock()
        if (sec < 10) sec = "0" + sec;
        let text = min + ":" + sec;
 
-       if (false) {
+       if (ultimateconfig['exohack']) {
                // 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.
@@ -274,7 +281,22 @@ function update_clock2()
        if (sec < 10) sec = "0" + sec;
        let text = min + ":" + sec;
 
-       document.getElementById('clock2').innerHTML = text;
+       if (ultimateconfig['exohack']) {
+               // 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 += "<div style='display: inline-block; width: 15px'>" + text.charAt(i) + "</div>";
+                       }
+               }
+               document.getElementById('clock2').innerHTML = html;
+       } else {
+               document.getElementById('clock2').innerHTML = text;
+       }
 }
 
 function goalA()