1function save_options() {
2 var bgvalue = document.getElementById('bg').value;
3 var fgvalue = document.getElementById('fg').value;
4 console.log(bgvalue);
5
6 chrome.storage.sync.set({
7 "bgvalue": bgvalue,
8 "fgvalue": fgvalue,
9 }, function() {
10 window.close();
11
12 });
13}
14
15
16function restore_options() {
17 chrome.storage.sync.get({
18 "bgvalue": "#2E3440",
19 "fgvalue": "#D8DEE9"},
20 function(items) {
21 document.getElementById('bg').value = items["bgvalue"];
22 document.getElementById('fg').value = items["fgvalue"];
23 });
24}
25
26document.addEventListener('DOMContentLoaded', restore_options);
27document.getElementById('save').addEventListener('click', save_options);