shithub: puzzles

Download patch

ref: b967a3ea86d6285457abc2a89e455c8f62d2c22a
parent: e8cdac58e551f5c4444a6ff293eaad8e4923856e
author: Ben Harris <bjh21@bjh21.me.uk>
date: Sun Nov 20 14:04:53 EST 2022

js: Remove support for creating the status bar in JavaScript

Now we depend on its being in the HTML.

--- a/emcc.c
+++ b/emcc.c
@@ -79,7 +79,6 @@
 extern void js_canvas_free_blitter(int id);
 extern void js_canvas_copy_to_blitter(int id, int x, int y, int w, int h);
 extern void js_canvas_copy_from_blitter(int id, int x, int y, int w, int h);
-extern void js_canvas_make_statusbar(void);
 extern void js_canvas_remove_statusbar(void);
 extern void js_canvas_set_statusbar(const char *text);
 extern void js_canvas_set_size(int w, int h);
@@ -955,11 +954,9 @@
     resize();
 
     /*
-     * Create a status bar, if needed.
+     * Remove the status bar, if not needed.
      */
-    if (midend_wants_statusbar(me))
-        js_canvas_make_statusbar();
-    else
+    if (!midend_wants_statusbar(me))
         js_canvas_remove_statusbar();
 
     /*
--- a/emcclib.js
+++ b/emcclib.js
@@ -514,22 +514,6 @@
     },
 
     /*
-     * void js_canvas_make_statusbar(void);
-     * 
-     * Cause a status bar to exist. Called at setup time if the puzzle
-     * back end turns out to want one.
-     */
-    js_canvas_make_statusbar: function() {
-        if (statusbar === null) {
-            var statusholder = document.getElementById("statusbarholder");
-            statusbar = document.createElement("div");
-            statusbar.id = "statusbar";
-            statusbar.appendChild(document.createTextNode(" "));
-            statusholder.appendChild(statusbar);
-        }
-    },
-
-    /*
      * void js_canvas_remove_statusbar(void);
      *
      * Cause a status bar not to exist. Called at setup time if the