-
Notifications
You must be signed in to change notification settings - Fork 2
/
options.js
32 lines (30 loc) · 996 Bytes
/
options.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
function save_options() {
var minSpeed = document.getElementById("min");
var maxSpeed = document.getElementById("max");
var speedInterval = document.getElementById("interval");
chrome.storage.local.set({
minSpeed: minSpeed.value,
maxSpeed: maxSpeed.value,
speedInterval: speedInterval.value
}, function updateStatus() {
var status = document.getElementById("status");
status.textContent = "Options saved.";
setTimeout(function() {
status.textContent = '';
}, 1000);
});
}
function restore_options() {
chrome.storage.local.get({
minSpeed: 0.5,
maxSpeed: 2.5,
speedInterval: 0.1
}, function(items) {
document.getElementById("min").value = items.minSpeed;
document.getElementById("max").value = items.maxSpeed;
document.getElementById("interval").value = items.speedInterval;
});
}
document.addEventListener('DOMContentLoaded', restore_options);
document.getElementById('save').addEventListener('click',
save_options);