blob: f8495d66216250f29880037b56b3eafdf86ecac4 [file] [log] [blame]
avm99963cbea3142019-03-28 00:48:15 +01001function isEmpty(obj) {
2 return Object.keys(obj).length === 0;
3}
4
avm99963122dc9b2019-03-30 18:44:18 +01005var defaultOptions = {
6 "list": true,
7 "thread": true,
8 "fixedtoolbar": false,
9 "redirect": false,
10 "history": false
11};
12
13function cleanUpOptions() {
14 chrome.storage.sync.get(null, function(options) {
15 var ok = true;
16 for (const [opt, value] of Object.entries(defaultOptions)) {
17 if (!opt in options) {
18 ok = false;
19 options[opt] = value;
20 }
21 }
22
23 if (!ok) {
24 chrome.storage.sync.set(options);
avm99963cbea3142019-03-28 00:48:15 +010025 }
26 });
avm99963122dc9b2019-03-30 18:44:18 +010027}
28
29chrome.runtime.onInstalled.addListener(function(details) {
30 if (details == "install" || details == "update") {
31 cleanUpOptions();
32 }
avm99963cbea3142019-03-28 00:48:15 +010033});