aboutsummaryrefslogtreecommitdiff
path: root/emcclib.js
diff options
context:
space:
mode:
authorBen Harris <bjh21@bjh21.me.uk>2022-12-11 12:17:54 +0000
committerBen Harris <bjh21@bjh21.me.uk>2023-01-19 20:34:48 +0000
commit5ba1bf55600443ca6cdad448aa629ffbce7c4e22 (patch)
tree4eebdfe0752f94ee88e8ce31c0cc3edd06bd7fe0 /emcclib.js
parent48ded126a9fd399cf2d9c66ee928f4d1d6d065e4 (diff)
downloadpuzzles-5ba1bf55600443ca6cdad448aa629ffbce7c4e22.zip
puzzles-5ba1bf55600443ca6cdad448aa629ffbce7c4e22.tar.gz
puzzles-5ba1bf55600443ca6cdad448aa629ffbce7c4e22.tar.bz2
puzzles-5ba1bf55600443ca6cdad448aa629ffbce7c4e22.tar.xz
js: Tolerate the absence of various UI elements from the HTML
To make things more consistent, the static buttons now all have their own variables.
Diffstat (limited to 'emcclib.js')
-rw-r--r--emcclib.js12
1 files changed, 7 insertions, 5 deletions
diff --git a/emcclib.js b/emcclib.js
index 676c429..07cbf3b 100644
--- a/emcclib.js
+++ b/emcclib.js
@@ -62,9 +62,11 @@ mergeInto(LibraryManager.library, {
* provides neither presets nor configurability.
*/
js_remove_type_dropdown: function() {
+ if (gametypelist === null) return;
var gametypeitem = gametypelist.closest("li");
if (gametypeitem === null) return;
gametypeitem.parentNode.removeChild(gametypeitem);
+ gametypelist = null;
},
/*
@@ -74,11 +76,11 @@ mergeInto(LibraryManager.library, {
* time if the game doesn't support an in-game solve function.
*/
js_remove_solve_button: function() {
- var solvebutton = document.getElementById("solve");
- if (solvebutton === null) return;
- var solveitem = solvebutton.closest("li");
- if (solveitem === null) return;
- solveitem.parentNode.removeChild(solveitem);
+ if (solve_button === null) return;
+ var solve_item = solve_button.closest("li");
+ if (solve_item === null) return;
+ solve_item.parentNode.removeChild(solve_item);
+ solve_button = null;
},
/*