blob: 78a5d2e5452be641186f68a14a9ddc2201d0ede8 [file] [log] [blame]
Adrià Vilanova Martínez2b871792021-06-09 12:35:06 +02001const SMEI_SORT_DIRECTION = 8;
2const SMEI_UNIFIED_PROFILES = 9;
3
avm999636d9c5fe2019-06-04 00:35:53 +02004chrome.storage.sync.get(null, function(items) {
avm99963db412d92020-12-31 19:27:59 +01005 if (items.loaddrafts || items.smei_sortdirection) {
avm99963b69eb3d2020-08-20 02:03:44 +02006 var startup =
7 JSON.parse(document.querySelector('html').getAttribute('data-startup'));
avm99963c19497f2019-08-23 00:15:11 +02008
9 if (items.loaddrafts) {
10 startup[4][13] = true;
11 }
12
avm99963b38b7412020-12-11 17:59:02 +010013 if (items.smei_sortdirection) {
Adrià Vilanova Martínez2b871792021-06-09 12:35:06 +020014 if (!startup[1][6].includes(SMEI_SORT_DIRECTION))
15 startup[1][6].push(SMEI_SORT_DIRECTION);
16 }
17
18 if (items.disableunifiedprofiles) {
19 var index = startup[1][6].indexOf(SMEI_UNIFIED_PROFILES);
20 if (index > -1)
21 startup[1][6].splice(index, 1);
avm99963b38b7412020-12-11 17:59:02 +010022 }
23
avm99963b69eb3d2020-08-20 02:03:44 +020024 document.querySelector('html').setAttribute(
25 'data-startup', JSON.stringify(startup));
avm999636d9c5fe2019-06-04 00:35:53 +020026 }
avm999630bc113a2020-09-07 13:02:11 +020027
28 if (items.ccdarktheme) {
29 switch (items.ccdarktheme_mode) {
30 case 'switch':
31 if (items.ccdarktheme_switch_status == true)
32 injectStylesheet(chrome.runtime.getURL('injections/ccdarktheme.css'));
33 break;
34
35 case 'system':
36 injectStylesheet(chrome.runtime.getURL('injections/ccdarktheme.css'), {
37 'media': '(prefers-color-scheme: dark)',
38 });
39 break;
40 }
41 }
avm999636d9c5fe2019-06-04 00:35:53 +020042});