From 6b4a4d39f1564780e1a3f78fbd672fecd3fcc3cf Mon Sep 17 00:00:00 2001 From: wixette Date: Sun, 8 Mar 2020 20:39:13 +0800 Subject: [PATCH] handle all other helper switchers --- index.html | 16 ++++++++-------- js/panel.js | 22 +++++++++++++++++++++- 2 files changed, 29 insertions(+), 9 deletions(-) diff --git a/index.html b/index.html index fb5eb76..8e42783 100644 --- a/index.html +++ b/index.html @@ -590,14 +590,14 @@
OFF/ON
-
STOP
-
RUN
-
SINGLE STEP
-
EXAMINE
-
EXAMINE-NEXT
-
DEPOSIT
-
DEPOSIT-NEXT
-
RESET
+
STOP
+
RUN
+
SINGLE STEP
+
EXAMINE
+
EXAMINE-NEXT
+
DEPOSIT
+
DEPOSIT-NEXT
+
RESET
diff --git a/js/panel.js b/js/panel.js index 46fb072..b011e1d 100644 --- a/js/panel.js +++ b/js/panel.js @@ -716,7 +716,7 @@ panel.createSwitch = function(id, type, x, y, upperCmd, lowerCmd) { panel.onToggle(sourceId); }, false); - // Also installs soft switch handlers. + // Also installs helper switch handlers. let softSwitchId = 'S-' + id; let elem = document.getElementById(softSwitchId); elem.addEventListener( @@ -738,6 +738,16 @@ panel.createSwitch = function(id, type, x, y, upperCmd, lowerCmd) { upperCmd.callback(); }, false); + // Also installs helper switch handlers. + cmdElem = document.getElementById('S' + upperCmd.textId); + cmdElem.addEventListener( + 'click', + function() { + panel.switchUpThenBack(id); + panel.playSwitch(); + upperCmd.callback(); + }, + false); } if (lowerCmd) { let cmdElem = document.getElementById(lowerCmd.textId); @@ -750,6 +760,16 @@ panel.createSwitch = function(id, type, x, y, upperCmd, lowerCmd) { lowerCmd.callback(); }, false); + // Also installs helper switch handlers. + cmdElem = document.getElementById('S' + lowerCmd.textId); + cmdElem.addEventListener( + 'click', + function() { + panel.switchDownThenBack(id); + panel.playSwitch(); + lowerCmd.callback(); + }, + false); } }