diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2020-09-19 17:14:51 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-19 17:14:51 -0400 |
commit | 2ff4f830722940d2bfc35328fa913f93d04a330b (patch) | |
tree | 19eb865b31eaaa9c69f6bd913985ae5460e7340d /ext/bg/js/settings/dictionary-import-controller.js | |
parent | 613c7ebf69413723486ab49a7b2f928422de3541 (diff) |
Modal refactor (#842)
* Add Modal class
* Use Modal class
Diffstat (limited to 'ext/bg/js/settings/dictionary-import-controller.js')
-rw-r--r-- | ext/bg/js/settings/dictionary-import-controller.js | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/ext/bg/js/settings/dictionary-import-controller.js b/ext/bg/js/settings/dictionary-import-controller.js index dd4889dc..a78378e8 100644 --- a/ext/bg/js/settings/dictionary-import-controller.js +++ b/ext/bg/js/settings/dictionary-import-controller.js @@ -18,6 +18,7 @@ /* global * DictionaryDatabase * DictionaryImporter + * Modal * ObjectPropertyAccessor * api */ @@ -53,7 +54,7 @@ class DictionaryImportController { this._purgeConfirmButton = document.querySelector('#dict-purge-confirm'); this._importFileButton = document.querySelector('#dict-file-button'); this._importFileInput = document.querySelector('#dict-file'); - this._purgeConfirmModal = document.querySelector('#dict-purge-modal'); + this._purgeConfirmModal = new Modal(document.querySelector('#dict-purge-modal')); this._errorContainer = document.querySelector('#dict-error'); this._spinner = document.querySelector('#dict-spinner'); this._progressContainer = document.querySelector('#dict-import-progress'); @@ -75,12 +76,12 @@ class DictionaryImportController { _onPurgeButtonClick(e) { e.preventDefault(); - this._setPurgeModalVisible(true); + this._purgeConfirmModal.setVisible(true); } _onPurgeConfirmButtonClick(e) { e.preventDefault(); - this._setPurgeModalVisible(false); + this._purgeConfirmModal.setVisible(false); this._purgeDatabase(); } @@ -220,11 +221,6 @@ class DictionaryImportController { return await this._modifyGlobalSettings(targets); } - _setPurgeModalVisible(visible) { - const node = $(this._purgeConfirmModal); - node.modal(visible ? 'show' : 'hide'); - } - _setSpinnerVisible(visible) { this._spinner.hidden = !visible; } |