-
Notifications
You must be signed in to change notification settings - Fork 0
/
options.js
28 lines (25 loc) · 870 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
// Save this script as `options.js`
var storage = chrome.storage.local;
restore_options();
// Restores select box state to saved value from localStorage.
function restore_options() {
storage.get('urls', function(items) {
// To avoid checking items.css we could specify storage.get({css: ''}) to
// return a default value of '' if there is no css value yet.
//console.log(items);
if (items.urls) {
document.getElementById("urls").value = items.urls;
loadUrls(items.urls);
}
});
}
document.getElementById('save').addEventListener('click', function(){
storage.set({'urls': document.getElementById("urls").value}, function() {
// Notify that we saved.
var status = document.getElementById("status");
status.innerHTML = "Options Saved.";
setTimeout(function() {
status.innerHTML = "";
}, 750);
});
});