aboutsummaryrefslogtreecommitdiff
path: root/ext/bg/js
diff options
context:
space:
mode:
Diffstat (limited to 'ext/bg/js')
-rw-r--r--ext/bg/js/options-form.js23
1 files changed, 9 insertions, 14 deletions
diff --git a/ext/bg/js/options-form.js b/ext/bg/js/options-form.js
index cde0ea62..af9c743d 100644
--- a/ext/bg/js/options-form.js
+++ b/ext/bg/js/options-form.js
@@ -17,26 +17,21 @@
*/
-$('#saveOptions').click(() => {
- saveOptions(sanitizeOptions(formToOptions()))
-});
-
-$('#resetOptions').click(() => {
- if (confirm('Reset options to defaults?')) {
- optionsToForm(sanitizeOptions({}));
- }
-});
-
function optionsToForm(opts) {
$('#scanLength').val(opts.scanLength);
}
function formToOptions() {
- return {
+ return sanitizeOptions({
scanLength: $('#scanLength').val()
- };
+ });
}
-$(document).ready(() => {
- loadOptions((opts) => optionsToForm(sanitizeOptions(opts)));
+$(document).ready(() => loadOptions((opts) => optionsToForm(opts)));
+
+$('#saveOptions').click(() => saveOptions(formToOptions()));
+$('#resetOptions').click(() => {
+ if (confirm('Reset options to defaults?')) {
+ optionsToForm(sanitizeOptions({}));
+ }
});