mirror of
git://git.tartarus.org/simon/puzzles.git
synced 2025-04-20 23:51:29 -07:00
js: Allow status bar to be present in the HTML
I'm generally in favour of putting HTML in HTML rather the constructing it in JavaScript, and this will allow for simplifying the code eventually. This only changes the JavaScript to make sure that's in people's caches before I change the HTML itself.
This commit is contained in:
27
emcclib.js
27
emcclib.js
@ -518,11 +518,24 @@ mergeInto(LibraryManager.library, {
|
||||
* back end turns out to want one.
|
||||
*/
|
||||
js_canvas_make_statusbar: function() {
|
||||
var statusholder = document.getElementById("statusbarholder");
|
||||
statusbar = document.createElement("div");
|
||||
statusbar.id = "statusbar";
|
||||
statusbar.appendChild(document.createTextNode(" "));
|
||||
statusholder.appendChild(statusbar);
|
||||
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
|
||||
* puzzle back end turns out not to want one.
|
||||
*/
|
||||
js_canvas_remove_statusbar: function() {
|
||||
if (statusbar !== null)
|
||||
statusbar.parentNode.removeChild(statusbar);
|
||||
},
|
||||
|
||||
/*
|
||||
@ -531,9 +544,7 @@ mergeInto(LibraryManager.library, {
|
||||
* Set the text in the status bar.
|
||||
*/
|
||||
js_canvas_set_statusbar: function(ptr) {
|
||||
var text = UTF8ToString(ptr);
|
||||
statusbar.replaceChild(document.createTextNode(text),
|
||||
statusbar.lastChild);
|
||||
statusbar.textContent = UTF8ToString(ptr);
|
||||
},
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user