diff --git a/ext/js/pages/settings/profile-conditions-ui.js b/ext/js/pages/settings/profile-conditions-ui.js index 8e5da3d8f5..29e7460f13 100644 --- a/ext/js/pages/settings/profile-conditions-ui.js +++ b/ext/js/pages/settings/profile-conditions-ui.js @@ -600,9 +600,7 @@ class ProfileConditionGroupUI { const child = new ProfileConditionUI(this, index); child.prepare(condition); this._children.push(child); - if (this._conditionContainer !== null) { - this._conditionContainer.appendChild(child.node); - } + this._conditionContainer.appendChild(child.node); return child; } } @@ -624,8 +622,6 @@ class ProfileConditionUI { /** @type {HTMLSelectElement} */ this._operatorInput = querySelectorNotNull(this._node, '.profile-condition-operator'); /** @type {HTMLButtonElement} */ - this._removeButton = querySelectorNotNull(this._node, '.profile-condition-remove'); - /** @type {HTMLButtonElement} */ this._mouseButton = querySelectorNotNull(this._node, '.mouse-button'); /** @type {HTMLElement} */ this._mouseButtonContainer = querySelectorNotNull(this._node, '.mouse-button-container'); @@ -684,11 +680,8 @@ class ProfileConditionUI { this._eventListeners.addEventListener(this._typeInput, 'change', this._onTypeChange.bind(this), false); this._eventListeners.addEventListener(this._operatorInput, 'change', this._onOperatorChange.bind(this), false); - if (this._removeButton !== null) { this._eventListeners.addEventListener(this._removeButton, 'click', this._onRemoveButtonClick.bind(this), false); } - if (this._menuButton !== null) { - this._eventListeners.addEventListener(this._menuButton, 'menuOpen', this._onMenuOpen.bind(this), false); - this._eventListeners.addEventListener(this._menuButton, 'menuClose', this._onMenuClose.bind(this), false); - } + this._eventListeners.addEventListener(this._menuButton, 'menuOpen', this._onMenuOpen.bind(this), false); + this._eventListeners.addEventListener(this._menuButton, 'menuClose', this._onMenuClose.bind(this), false); } /** */ @@ -766,18 +759,13 @@ class ProfileConditionUI { } } - /** */ - _onRemoveButtonClick() { - this._removeSelf(); - } - /** * @param {import('popup-menu').MenuOpenEvent} e */ _onMenuOpen(e) { const bodyNode = e.detail.menu.bodyNode; /** @type {HTMLElement} */ - const deleteGroup = querySelectorNotNull(bodyNode, '.popup-menu-item[data-menu-action="deleteGroup"]'); + const deleteGroup = /** @type {HTMLElement} */ (bodyNode.querySelector('.popup-menu-item[data-menu-action="deleteGroup"]')); if (deleteGroup !== null) { deleteGroup.hidden = (this._parent.childCount <= 1); }