2016-03-29 03:09:30 +00:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html lang="en">
|
2016-04-03 17:46:36 +00:00
|
|
|
<head>
|
|
|
|
<meta charset="UTF-8">
|
|
|
|
<title>Here go options</title>
|
2016-04-03 17:48:59 +00:00
|
|
|
<link rel="stylesheet" type="text/css" href="lib/bootstrap-3.3.6-dist/css/bootstrap.min.css">
|
|
|
|
<link rel="stylesheet" type="text/css" href="lib/bootstrap-3.3.6-dist/css/bootstrap-theme.min.css">
|
2016-04-03 17:46:36 +00:00
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<div class="container">
|
2016-04-03 17:48:59 +00:00
|
|
|
<div class="page-header">
|
2016-04-03 17:46:36 +00:00
|
|
|
<h1>Options</h1>
|
|
|
|
</div>
|
|
|
|
|
2016-04-04 05:42:21 +00:00
|
|
|
<form class="form-horizontal">
|
|
|
|
<div class="form-group">
|
|
|
|
<label for="scanLength" class="control-label col-sm-2">Scan length</label>
|
2016-04-04 05:42:44 +00:00
|
|
|
<div class="col-sm-10"><input type="number" value="1" min="1" id="scanLength" class="form-control"></div>
|
2016-04-04 05:42:21 +00:00
|
|
|
</div>
|
2016-04-05 03:52:07 +00:00
|
|
|
|
|
|
|
<div class="text-right">
|
|
|
|
<button type="button" id="saveOptions" class="btn btn-default">Save</button>
|
|
|
|
<button type="button" id="resetOptions" class="btn btn-danger">Reset</button>
|
|
|
|
</div>
|
2016-04-04 05:42:21 +00:00
|
|
|
</form>
|
|
|
|
|
2016-04-03 17:46:36 +00:00
|
|
|
<script src="lib/jquery-2.2.2.min.js"></script>
|
|
|
|
<script src="lib/bootstrap-3.3.6-dist/js/bootstrap.min.js"></script>
|
2016-04-04 03:05:22 +00:00
|
|
|
<script src="options.js"></script>
|
2016-04-05 03:52:07 +00:00
|
|
|
|
|
|
|
<script>
|
|
|
|
$('#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 {
|
|
|
|
scanLength: $('#scanLength').val()
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
loadOptions((opts) => optionsToForm(sanitizeOptions(opts)));
|
|
|
|
</script>
|
2016-04-03 17:46:36 +00:00
|
|
|
</div>
|
|
|
|
</body>
|
2016-03-29 03:09:30 +00:00
|
|
|
</html>
|