Cleanup
This commit is contained in:
parent
37ffcbf3ee
commit
8774c783f6
@ -17,26 +17,21 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
$('#saveOptions').click(() => {
|
|
||||||
saveOptions(sanitizeOptions(formToOptions()))
|
|
||||||
});
|
|
||||||
|
|
||||||
$('#resetOptions').click(() => {
|
|
||||||
if (confirm('Reset options to defaults?')) {
|
|
||||||
optionsToForm(sanitizeOptions({}));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
function optionsToForm(opts) {
|
function optionsToForm(opts) {
|
||||||
$('#scanLength').val(opts.scanLength);
|
$('#scanLength').val(opts.scanLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
function formToOptions() {
|
function formToOptions() {
|
||||||
return {
|
return sanitizeOptions({
|
||||||
scanLength: $('#scanLength').val()
|
scanLength: $('#scanLength').val()
|
||||||
};
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
$(document).ready(() => {
|
$(document).ready(() => loadOptions((opts) => optionsToForm(opts)));
|
||||||
loadOptions((opts) => optionsToForm(sanitizeOptions(opts)));
|
|
||||||
|
$('#saveOptions').click(() => saveOptions(formToOptions()));
|
||||||
|
$('#resetOptions').click(() => {
|
||||||
|
if (confirm('Reset options to defaults?')) {
|
||||||
|
optionsToForm(sanitizeOptions({}));
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user