diff options
author | Alex Yatskov <alex@foosoft.net> | 2016-04-04 22:07:57 -0700 |
---|---|---|
committer | Alex Yatskov <alex@foosoft.net> | 2016-04-04 22:07:57 -0700 |
commit | 8774c783f6cb3e72e837ad335f78df0ca08f24e5 (patch) | |
tree | 6f3d372a631d406dd7fac5801adc5b2380e83d6c /ext/bg | |
parent | 37ffcbf3ee2d9722751e899bdf4bac91ca7c92c1 (diff) |
Cleanup
Diffstat (limited to 'ext/bg')
-rw-r--r-- | ext/bg/js/options-form.js | 23 |
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({})); + } }); |