This commit is contained in:
Alex Yatskov 2016-04-04 22:07:57 -07:00
parent 37ffcbf3ee
commit 8774c783f6

View File

@ -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({}));
}
});