aboutsummaryrefslogtreecommitdiff
path: root/ext/bg/js/settings
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2019-12-14 23:06:44 -0500
committertoasted-nutbread <toasted-nutbread@users.noreply.github.com>2019-12-29 12:33:28 -0500
commite2a4a46e6006b9a85a3b6e5e26f55076afb16919 (patch)
tree18de87301b03c7d3164dcf7af820af64e19998d4 /ext/bg/js/settings
parentf17b55239e941394908fad4a6b1676a171342dac (diff)
Implement settings reset
Diffstat (limited to 'ext/bg/js/settings')
-rw-r--r--ext/bg/js/settings/backup.js22
1 files changed, 22 insertions, 0 deletions
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);