summaryrefslogtreecommitdiff
path: root/ext/bg/js/settings/dictionary-controller.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2021-01-19 20:52:57 -0500
committerGitHub <noreply@github.com>2021-01-19 20:52:57 -0500
commitccf28ed055f08d38d28b19025d10cb4e7424464b (patch)
tree32c40a92149415c54ffd51b7868ae24d468cbaaa /ext/bg/js/settings/dictionary-controller.js
parent3c51bf2a0be7c35f86d2da8c381453b95e6414bf (diff)
Menu refactor (#1277)
* Rename menuOpened event to menuOpen * Rename menuClosed event to menuClose * Rename close event * Assign _isClosed * Reuse event detail * Expose PopupMenu.openMenus * Rename and expose properties * Add cancelable argument to close * Update menuOpen detail * Update menuClose detail
Diffstat (limited to 'ext/bg/js/settings/dictionary-controller.js')
-rw-r--r--ext/bg/js/settings/dictionary-controller.js17
1 files changed, 8 insertions, 9 deletions
diff --git a/ext/bg/js/settings/dictionary-controller.js b/ext/bg/js/settings/dictionary-controller.js
index e32e4d6f..941b2039 100644
--- a/ext/bg/js/settings/dictionary-controller.js
+++ b/ext/bg/js/settings/dictionary-controller.js
@@ -86,8 +86,8 @@ class DictionaryEntry {
this._eventListeners.addEventListener(deleteButton, 'click', this._onDeleteButtonClicked.bind(this), false);
}
if (menuButton !== null) {
- 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);
}
if (detailsToggleLink !== null && this._detailsContainer !== null) {
this._eventListeners.addEventListener(detailsToggleLink, 'click', this._onDetailsToggleLinkClicked.bind(this), false);
@@ -116,10 +116,10 @@ class DictionaryEntry {
this._delete();
}
- _onMenuOpened(e) {
- const {detail: {menu}} = e;
- const showDetails = menu.querySelector('.popup-menu-item[data-menu-action="showDetails"]');
- const hideDetails = menu.querySelector('.popup-menu-item[data-menu-action="hideDetails"]');
+ _onMenuOpen(e) {
+ const node = e.detail.menu.node;
+ const showDetails = node.querySelector('.popup-menu-item[data-menu-action="showDetails"]');
+ const hideDetails = node.querySelector('.popup-menu-item[data-menu-action="hideDetails"]');
const hasDetails = (this._detailsContainer !== null);
const detailsVisible = (hasDetails && !this._detailsContainer.hidden);
if (showDetails !== null) {
@@ -132,9 +132,8 @@ class DictionaryEntry {
}
}
- _onMenuClosed(e) {
- const {detail: {action}} = e;
- switch (action) {
+ _onMenuClose(e) {
+ switch (e.detail.action) {
case 'delete':
this._delete();
break;