summaryrefslogtreecommitdiff
path: root/ext/mixed/js/display.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2021-01-23 21:13:01 -0500
committerGitHub <noreply@github.com>2021-01-23 21:13:01 -0500
commitef577b88754523abeab3844115506a0b6e914874 (patch)
tree78f181897afc89904f2df7c3370030a955219c5b /ext/mixed/js/display.js
parent9fbdb9757b22c2bb9afe5061137bfe4b3b755e91 (diff)
Audio button menu (#1302)
* Fix popup menus not stoping events * Ensure non-stale use of buttons * Enable popup menus on the popup/search pages * Add audio menu
Diffstat (limited to 'ext/mixed/js/display.js')
-rw-r--r--ext/mixed/js/display.js23
1 files changed, 22 insertions, 1 deletions
diff --git a/ext/mixed/js/display.js b/ext/mixed/js/display.js
index 6af35074..eb8b2900 100644
--- a/ext/mixed/js/display.js
+++ b/ext/mixed/js/display.js
@@ -27,6 +27,7 @@
* HotkeyHelpController
* MediaLoader
* PopupFactory
+ * PopupMenu
* QueryParser
* TextScanner
* WindowScroll
@@ -113,7 +114,7 @@ class Display extends EventDispatcher {
this._displayAudio = new DisplayAudio(this);
this._hotkeyHandler.registerActions([
- ['close', () => { this.close(); }],
+ ['close', () => { this._onHotkeyClose(); }],
['nextEntry', () => { this._focusEntry(this._index + 1, true); }],
['nextEntry3', () => { this._focusEntry(this._index + 3, true); }],
['previousEntry', () => { this._focusEntry(this._index - 1, true); }],
@@ -517,6 +518,7 @@ class Display extends EventDispatcher {
try {
// Clear
this._closePopups();
+ this._closeAllPopupMenus();
this._eventListeners.removeAllEventListeners();
this._mediaLoader.unloadAll();
this._displayAudio.cleanupEntries();
@@ -1806,4 +1808,23 @@ class Display extends EventDispatcher {
});
});
}
+
+ _onHotkeyClose() {
+ if (this._closeSinglePopupMenu()) { return; }
+ this.close();
+ }
+
+ _closeAllPopupMenus() {
+ for (const popupMenu of PopupMenu.openMenus) {
+ popupMenu.close();
+ }
+ }
+
+ _closeSinglePopupMenu() {
+ for (const popupMenu of PopupMenu.openMenus) {
+ popupMenu.close();
+ return true;
+ }
+ return false;
+ }
}