diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2019-11-02 14:30:17 -0400 |
---|---|---|
committer | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2019-11-07 20:30:55 -0500 |
commit | 3d78d5400d2ed6e9d8f5147f7212ec786f4f16bd (patch) | |
tree | c6ed739ac08a6cee160f4eef5fe1bb993a3c4a3a /ext/bg/js | |
parent | 2ab871e7ee93ddc4a2f1ca41aad10e4b189b6c0f (diff) |
Add button and confirmation dialog for database purge
Diffstat (limited to 'ext/bg/js')
-rw-r--r-- | ext/bg/js/settings-dictionaries.js | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/ext/bg/js/settings-dictionaries.js b/ext/bg/js/settings-dictionaries.js index 635b95c6..72a27475 100644 --- a/ext/bg/js/settings-dictionaries.js +++ b/ext/bg/js/settings-dictionaries.js @@ -256,7 +256,8 @@ async function dictSettingsInitialize() { ); dictionaryUI.save = () => apiOptionsSave(); - document.querySelector('#dict-purge-link').addEventListener('click', (e) => onDictionaryPurge(e), false); + document.querySelector('#dict-purge-button').addEventListener('click', (e) => onDictionaryPurgeButtonClick(e), false); + document.querySelector('#dict-purge-confirm').addEventListener('click', (e) => onDictionaryPurge(e), false); document.querySelector('#dict-file-button').addEventListener('click', (e) => onDictionaryImportButtonClick(e), false); document.querySelector('#dict-file').addEventListener('change', (e) => onDictionaryImport(e), false); document.querySelector('#dict-main').addEventListener('change', (e) => onDictionaryMainChanged(e), false); @@ -398,9 +399,16 @@ function onDictionaryImportButtonClick() { dictFile.click(); } +function onDictionaryPurgeButtonClick(e) { + e.preventDefault(); + $('#dict-purge-modal').modal('show'); +} + async function onDictionaryPurge(e) { e.preventDefault(); + $('#dict-purge-modal').modal('hide'); + const dictControls = $('#dict-importer, #dict-groups, #dict-groups-extra, #dict-main-group').hide(); const dictProgress = $('#dict-purge').show(); |