chiark / gitweb /
webstead: enable strict mode in top-level script
authorBen Harris <bjh21@bjh21.me.uk>
Sat, 11 Oct 2025 23:53:01 +0000 (00:53 +0100)
committerBen Harris <bjh21@bjh21.me.uk>
Tue, 13 Jan 2026 21:42:18 +0000 (21:42 +0000)
Now that it's not a module, we need to do this explicitly.  Also fix
various undeclared variables that this exposed.

webstead.xhtml

index 8188f78098bd545b96cbca777a05c2f237be8c19..f0df386c099371a4d4781b0a1551153bd3e48ee0 100644 (file)
@@ -43,6 +43,7 @@
          https://issues.chromium.org/issues/40518469
          And it's not a module because Safari can't handle that. -->
     <script async="async"><![CDATA[
+    "use strict";
     var Bedstead;
     function update_glyph(c_update_needed) {
         var args = [];
         });
     }
     function from_c(c) {
-        re = /[0-7]+/g;
+        var re = /[0-7]+/g;
         document.querySelector('#inpane').reset();
-        for (row of document.querySelector('#pixels').rows) {
-            match = re.exec(c);
+        for (var row of document.querySelector('#pixels').rows) {
+            var match = re.exec(c);
             if (match == null) break;
-            rowbits = Number.parseInt(match[0], 8);
+            var rowbits = Number.parseInt(match[0], 8);
             for (var pixel
                  of Array.from(row.querySelectorAll('input')).reverse()) {
                 pixel.checked = (rowbits & 1 != 0);