avm99963 | 6d9c5fe | 2019-06-04 00:35:53 +0200 | [diff] [blame] | 1 | chrome.storage.sync.get(null, function(items) { |
avm99963 | db412d9 | 2020-12-31 19:27:59 +0100 | [diff] [blame] | 2 | if (items.loaddrafts || items.smei_sortdirection) { |
avm99963 | b69eb3d | 2020-08-20 02:03:44 +0200 | [diff] [blame] | 3 | var startup = |
| 4 | JSON.parse(document.querySelector('html').getAttribute('data-startup')); |
avm99963 | c19497f | 2019-08-23 00:15:11 +0200 | [diff] [blame] | 5 | |
| 6 | if (items.loaddrafts) { |
| 7 | startup[4][13] = true; |
| 8 | } |
| 9 | |
avm99963 | b38b741 | 2020-12-11 17:59:02 +0100 | [diff] [blame] | 10 | if (items.smei_sortdirection) { |
| 11 | if (!startup[1][6].includes(8)) |
| 12 | startup[1][6].push(8); |
| 13 | } |
| 14 | |
avm99963 | b69eb3d | 2020-08-20 02:03:44 +0200 | [diff] [blame] | 15 | document.querySelector('html').setAttribute( |
| 16 | 'data-startup', JSON.stringify(startup)); |
avm99963 | 6d9c5fe | 2019-06-04 00:35:53 +0200 | [diff] [blame] | 17 | } |
avm99963 | 0bc113a | 2020-09-07 13:02:11 +0200 | [diff] [blame] | 18 | |
| 19 | if (items.ccdarktheme) { |
| 20 | switch (items.ccdarktheme_mode) { |
| 21 | case 'switch': |
| 22 | if (items.ccdarktheme_switch_status == true) |
| 23 | injectStylesheet(chrome.runtime.getURL('injections/ccdarktheme.css')); |
| 24 | break; |
| 25 | |
| 26 | case 'system': |
| 27 | injectStylesheet(chrome.runtime.getURL('injections/ccdarktheme.css'), { |
| 28 | 'media': '(prefers-color-scheme: dark)', |
| 29 | }); |
| 30 | break; |
| 31 | } |
| 32 | } |
avm99963 | 6d9c5fe | 2019-06-04 00:35:53 +0200 | [diff] [blame] | 33 | }); |