aboutsummaryrefslogtreecommitdiff
path: root/ext/bg/js/settings2
diff options
context:
space:
mode:
Diffstat (limited to 'ext/bg/js/settings2')
-rw-r--r--ext/bg/js/settings2/keyboard-shortcuts-controller.js7
-rw-r--r--ext/bg/js/settings2/sentence-termination-characters-controller.js7
-rw-r--r--ext/bg/js/settings2/settings-display-controller.js14
-rw-r--r--ext/bg/js/settings2/translation-text-replacements-controller.js15
4 files changed, 15 insertions, 28 deletions
diff --git a/ext/bg/js/settings2/keyboard-shortcuts-controller.js b/ext/bg/js/settings2/keyboard-shortcuts-controller.js
index ea6bd81c..30846a62 100644
--- a/ext/bg/js/settings2/keyboard-shortcuts-controller.js
+++ b/ext/bg/js/settings2/keyboard-shortcuts-controller.js
@@ -199,7 +199,7 @@ class KeyboardShortcutHotkeyEntry {
for (const scopeCheckbox of scopeCheckboxes) {
this._eventListeners.addEventListener(scopeCheckbox, 'change', this._onScopeCheckboxChange.bind(this), false);
}
- this._eventListeners.addEventListener(menuButton, 'menuClosed', this._onMenuClosed.bind(this), false);
+ this._eventListeners.addEventListener(menuButton, 'menuClose', this._onMenuClose.bind(this), false);
this._eventListeners.addEventListener(this._actionSelect, 'change', this._onActionSelectChange.bind(this), false);
this._eventListeners.on(this._inputField, 'change', this._onInputFieldChange.bind(this));
}
@@ -214,9 +214,8 @@ class KeyboardShortcutHotkeyEntry {
// Private
- _onMenuClosed(e) {
- const {detail: {action}} = e;
- switch (action) {
+ _onMenuClose(e) {
+ switch (e.detail.action) {
case 'delete':
this._delete();
break;
diff --git a/ext/bg/js/settings2/sentence-termination-characters-controller.js b/ext/bg/js/settings2/sentence-termination-characters-controller.js
index 1e055f40..d62771ec 100644
--- a/ext/bg/js/settings2/sentence-termination-characters-controller.js
+++ b/ext/bg/js/settings2/sentence-termination-characters-controller.js
@@ -182,7 +182,7 @@ class SentenceTerminationCharacterEntry {
this._eventListeners.addEventListener(typeSelect, 'change', this._onTypeSelectChange.bind(this), false);
this._eventListeners.addEventListener(character1Input, 'change', this._onCharacterChange.bind(this, 1), false);
this._eventListeners.addEventListener(character2Input, 'change', this._onCharacterChange.bind(this, 2), false);
- this._eventListeners.addEventListener(menuButton, 'menuClosed', this._onMenuClosed.bind(this), false);
+ this._eventListeners.addEventListener(menuButton, 'menuClose', this._onMenuClose.bind(this), false);
}
cleanup() {
@@ -208,9 +208,8 @@ class SentenceTerminationCharacterEntry {
this._setCharacterValue(node, characterNumber, value);
}
- _onMenuClosed(e) {
- const {detail: {action}} = e;
- switch (action) {
+ _onMenuClose(e) {
+ switch (e.detail.action) {
case 'delete':
this._delete();
break;
diff --git a/ext/bg/js/settings2/settings-display-controller.js b/ext/bg/js/settings2/settings-display-controller.js
index c5661b13..6f0a8276 100644
--- a/ext/bg/js/settings2/settings-display-controller.js
+++ b/ext/bg/js/settings2/settings-display-controller.js
@@ -26,7 +26,6 @@ class SettingsDisplayController {
this._modalController = modalController;
this._contentNode = null;
this._menuContainer = null;
- this._openPopupMenus = new Set();
this._onMoreToggleClickBind = null;
this._onMenuButtonClickBind = null;
}
@@ -198,11 +197,6 @@ class SettingsDisplayController {
return false;
}
- _onClosePopupMenu({popupMenu, onClose}) {
- this._openPopupMenus.delete(popupMenu);
- popupMenu.off('closed', onClose);
- }
-
_onInputTabActionKeyDown(e) {
if (e.key !== 'Tab' || e.ctrlKey) { return; }
@@ -248,7 +242,7 @@ class SettingsDisplayController {
}
_closeTopMenuOrModal() {
- for (const popupMenu of this._openPopupMenus) {
+ for (const popupMenu of PopupMenu.openMenus) {
popupMenu.close();
return;
}
@@ -266,12 +260,6 @@ class SettingsDisplayController {
this._menuContainer.appendChild(menu);
const popupMenu = new PopupMenu(element, menu);
- this._openPopupMenus.add(popupMenu);
-
- const data = {popupMenu, onClose: null};
- data.onClose = this._onClosePopupMenu.bind(this, data);
-
- popupMenu.on('closed', data.onClose);
popupMenu.prepare();
}
diff --git a/ext/bg/js/settings2/translation-text-replacements-controller.js b/ext/bg/js/settings2/translation-text-replacements-controller.js
index 41ee8e3f..864b279e 100644
--- a/ext/bg/js/settings2/translation-text-replacements-controller.js
+++ b/ext/bg/js/settings2/translation-text-replacements-controller.js
@@ -158,8 +158,8 @@ class TranslationTextReplacementsEntry {
replacementInput.dataset.setting = `${pathBase}.replacement`;
ignoreCaseToggle.dataset.setting = `${pathBase}.ignoreCase`;
- this._eventListeners.addEventListener(menuButton, 'menuOpened', this._onMenuOpened.bind(this), false);
- this._eventListeners.addEventListener(menuButton, 'menuClosed', this._onMenuClosed.bind(this), false);
+ this._eventListeners.addEventListener(menuButton, 'menuOpen', this._onMenuOpen.bind(this), false);
+ this._eventListeners.addEventListener(menuButton, 'menuClose', this._onMenuClose.bind(this), false);
this._eventListeners.addEventListener(patternInput, 'settingChanged', this._onPatternChanged.bind(this), false);
this._eventListeners.addEventListener(ignoreCaseToggle, 'settingChanged', this._updateTestInput.bind(this), false);
this._eventListeners.addEventListener(replacementInput, 'settingChanged', this._updateTestInput.bind(this), false);
@@ -175,14 +175,15 @@ class TranslationTextReplacementsEntry {
// Private
- _onMenuOpened({detail: {menu}}) {
+ _onMenuOpen(e) {
+ const node = e.detail.menu.node;
const testVisible = this._isTestVisible();
- menu.querySelector('[data-menu-action=showTest]').hidden = testVisible;
- menu.querySelector('[data-menu-action=hideTest]').hidden = !testVisible;
+ node.querySelector('[data-menu-action=showTest]').hidden = testVisible;
+ node.querySelector('[data-menu-action=hideTest]').hidden = !testVisible;
}
- _onMenuClosed({detail: {action}}) {
- switch (action) {
+ _onMenuClose(e) {
+ switch (e.detail.action) {
case 'remove':
this._parent.deleteGroup(this._index);
break;