44eacbca0828aca980c3a46b1dce65cea70f59fb
1function save_options() {
2 var l1name = document.getElementById('l1').value;
3 var l2name = document.getElementById('l2').value;
4 var l3name = document.getElementById('l3').value;
5
6 var bgvalue = document.getElementById('bg').value;
7 console.log(bgvalue);
8
9 chrome.storage.sync.set({
10 "l1name": l1name,
11 "l2name": l2name,
12 "l3name": l3name,
13 "bgvalue": bgvalue,
14 }, function() {
15 window.close();
16
17 });
18}
19
20
21function restore_options() {
22 chrome.storage.sync.get({
23 "l1name": "list1",
24 "l2name": "list2",
25 "l3name": "list3",
26 "bgvalue": "#222222"},
27 function(items) {
28 document.getElementById('l1').value = items["l1name"];
29 document.getElementById('l2').value = items["l2name"];
30 document.getElementById('l3').value = items["l3name"];
31 document.getElementById('bg').value = items["bgvalue"];
32 });
33}
34
35document.addEventListener('DOMContentLoaded', restore_options);
36document.getElementById('save').addEventListener('click', save_options);