shithub: puzzles

Download patch

ref: 7354790ca40aa648f8ce6a6f0e568b9971a6a42c
parent: 5fae5ca0db6a263d385c05cb6cfef5e3e3b18630
author: Ben Harris <bjh21@bjh21.me.uk>
date: Tue Oct 25 21:32:52 EDT 2022

js: Use String.replace() in place of .replaceAll()

The latter turns out to be a little too new for KaiOS 2.5, but
.replace() will do global replacements if fed a RegExp.

--- a/emcclib.js
+++ b/emcclib.js
@@ -165,13 +165,13 @@
      * the random seed permalink.
      */
     js_update_permalinks: function(desc, seed) {
-        desc = encodeURI(UTF8ToString(desc)).replaceAll("#", "%23");
+        desc = encodeURI(UTF8ToString(desc)).replace(/#/g, "%23");
         permalink_desc.href = "#" + desc;
 
         if (seed == 0) {
             permalink_seed.style.display = "none";
         } else {
-            seed = encodeURI(UTF8ToString(seed)).replaceAll("#", "%23");;
+            seed = encodeURI(UTF8ToString(seed)).replace(/#/g, "%23");;
             permalink_seed.href = "#" + seed;
             permalink_seed.style.display = "";
         }