aboutsummaryrefslogtreecommitdiff
path: root/ext/bg/js/settings/profile-controller.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-09-19 17:14:51 -0400
committerGitHub <noreply@github.com>2020-09-19 17:14:51 -0400
commit2ff4f830722940d2bfc35328fa913f93d04a330b (patch)
tree19eb865b31eaaa9c69f6bd913985ae5460e7340d /ext/bg/js/settings/profile-controller.js
parent613c7ebf69413723486ab49a7b2f928422de3541 (diff)
Modal refactor (#842)
* Add Modal class * Use Modal class
Diffstat (limited to 'ext/bg/js/settings/profile-controller.js')
-rw-r--r--ext/bg/js/settings/profile-controller.js17
1 files changed, 7 insertions, 10 deletions
diff --git a/ext/bg/js/settings/profile-controller.js b/ext/bg/js/settings/profile-controller.js
index fd7137be..7c6dfae5 100644
--- a/ext/bg/js/settings/profile-controller.js
+++ b/ext/bg/js/settings/profile-controller.js
@@ -16,6 +16,7 @@
*/
/* global
+ * Modal
* ProfileConditionsUI
* api
*/
@@ -51,8 +52,8 @@ class ProfileController {
this._profileCopyButton = document.querySelector('#profile-copy');
this._profileMoveUpButton = document.querySelector('#profile-move-up');
this._profileMoveDownButton = document.querySelector('#profile-move-down');
- this._profileRemoveModal = document.querySelector('#profile-remove-modal');
- this._profileCopyModal = document.querySelector('#profile-copy-modal');
+ this._profileRemoveModal = new Modal(document.querySelector('#profile-remove-modal'));
+ this._profileCopyModal = new Modal(document.querySelector('#profile-copy-modal'));
this._profileActiveSelect.addEventListener('change', this._onProfileActiveChange.bind(this), false);
this._profileTargetSelect.addEventListener('change', this._onProfileTargetChange.bind(this), false);
@@ -135,11 +136,11 @@ class ProfileController {
const profileIndex = this._settingsController.profileIndex;
const profile = this._optionsFull.profiles[profileIndex];
this._removeProfileNameElement.textContent = profile.name;
- this._setModalVisible(this._profileRemoveModal, true);
+ this._profileRemoveModal.setVisible(true);
}
_onRemoveConfirm() {
- this._setModalVisible(this._profileRemoveModal, false);
+ this._profileRemoveModal.setVisible(false);
if (this._optionsFull.profiles.length <= 1) { return; }
const profileIndex = this._settingsController.profileIndex;
this._removeProfile(profileIndex);
@@ -160,11 +161,11 @@ class ProfileController {
}
this._profileCopySourceSelect.value = `${copyFromIndex}`;
- this._setModalVisible(this._profileCopyModal, true);
+ this._profileCopyModal.setVisible(true);
}
_onCopyConfirm() {
- this._setModalVisible(this._profileCopyModal, false);
+ this._profileCopyModal.setVisible(false);
const profileIndex = this._settingsController.profileIndex;
const max = this._optionsFull.profiles.length;
@@ -265,10 +266,6 @@ class ProfileController {
return null;
}
- _setModalVisible(node, visible) {
- $(node).modal(visible ? 'show' : 'hide');
- }
-
async _addProfile() {
const profileIndex = this._settingsController.profileIndex;
const profiles = this._optionsFull.profiles;