From 8774c783f6cb3e72e837ad335f78df0ca08f24e5 Mon Sep 17 00:00:00 2001 From: Alex Yatskov Date: Mon, 4 Apr 2016 22:07:57 -0700 Subject: Cleanup --- ext/bg/js/options-form.js | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) (limited to 'ext') 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({})); + } }); -- cgit v1.2.3