From: Ben Harris Date: Sat, 11 Oct 2025 23:48:41 +0000 (+0100) Subject: webstead: JavaScript is not Perl X-Git-Tag: bedstead-3.261~40 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~bjharris/git?a=commitdiff_plain;h=96f2490058074ca0cbebc43bf7cab63a3797d9f3;p=bedstead.git webstead: JavaScript is not Perl Remove some braces accordingly. --- diff --git a/webstead.xhtml b/webstead.xhtml index cc276ee..8188f78 100644 --- a/webstead.xhtml +++ b/webstead.xhtml @@ -51,16 +51,13 @@ var arg = 0; for (var pixel of row.querySelectorAll('input')) { arg *= 2; - if (pixel.checked) { - arg += 1 - } + if (pixel.checked) arg += 1 } args.push(arg.toString()); cstr += "\\" + arg.toString(8).padStart(2, "0"); } - if (c_update_needed) { + if (c_update_needed) document.getElementById("c").value = ` {"${cstr}", U() },`; - } Bedstead({ arguments: args, print: function(charstring) { @@ -81,9 +78,7 @@ document.querySelector('#inpane').reset(); for (row of document.querySelector('#pixels').rows) { match = re.exec(c); - if (match == null) { - break; - } + if (match == null) break; rowbits = Number.parseInt(match[0], 8); for (var pixel of Array.from(row.querySelectorAll('input')).reverse()) { @@ -94,9 +89,8 @@ update_glyph(); } function init() { - for (var e of document.querySelectorAll('#pixels input')) { + for (var e of document.querySelectorAll('#pixels input')) e.onchange = e => update_glyph(true); - } document.querySelector('#c').oninput = function(e) { from_c(this.value); update_glyph(false); @@ -107,11 +101,10 @@ Bedstead = module.default; // This script is loaded asynchronously, so make sure the DOM is // loaded before touching it. - if (document.readyState === "loading") { + if (document.readyState === "loading") document.addEventListener("DOMContentLoaded", init); - } else { + else init(); - } }); ]]>