diff options
Diffstat (limited to 'ext/bg/js')
-rw-r--r-- | ext/bg/js/options.js | 4 | ||||
-rw-r--r-- | ext/bg/js/settings/backup.js | 22 |
2 files changed, 26 insertions, 0 deletions
diff --git a/ext/bg/js/options.js b/ext/bg/js/options.js index 1650cea9..84e74bd8 100644 --- a/ext/bg/js/options.js +++ b/ext/bg/js/options.js @@ -488,3 +488,7 @@ function optionsSave(options) { }); }); } + +function optionsGetDefault() { + return optionsUpdateVersion({}, {}); +} diff --git a/ext/bg/js/settings/backup.js b/ext/bg/js/settings/backup.js index 1e099288..d278b718 100644 --- a/ext/bg/js/settings/backup.js +++ b/ext/bg/js/settings/backup.js @@ -339,10 +339,32 @@ function _onSettingsImportFileChange(e) { } +// Resetting + +function _onSettingsResetClick() { + $('#settings-reset-modal').modal('show'); +} + +async function _onSettingsResetConfirmClick() { + $('#settings-reset-modal').modal('hide'); + + // Get default options + const optionsFull = optionsGetDefault(); + + // Assign options + await _settingsImportSetOptionsFull(optionsFull); + + // Reload settings page + window.location.reload(); +} + + // Setup window.addEventListener('DOMContentLoaded', () => { document.querySelector('#settings-export').addEventListener('click', _onSettingsExportClick, false); document.querySelector('#settings-import').addEventListener('click', _onSettingsImportClick, false); document.querySelector('#settings-import-file').addEventListener('change', _onSettingsImportFileChange, false); + document.querySelector('#settings-reset').addEventListener('click', _onSettingsResetClick, false); + document.querySelector('#settings-reset-modal-confirm').addEventListener('click', _onSettingsResetConfirmClick, false); }, false); |