avm99963 | 6d9c5fe | 2019-06-04 00:35:53 +0200 | [diff] [blame] | 1 | chrome.storage.sync.get(null, function(items) { |
avm99963 | 4ddca93 | 2020-08-15 18:22:34 +0200 | [diff] [blame] | 2 | if (items.loaddrafts) { |
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 | b69eb3d | 2020-08-20 02:03:44 +0200 | [diff] [blame] | 10 | document.querySelector('html').setAttribute( |
| 11 | 'data-startup', JSON.stringify(startup)); |
avm99963 | 6d9c5fe | 2019-06-04 00:35:53 +0200 | [diff] [blame] | 12 | } |
avm99963 | 0bc113a | 2020-09-07 13:02:11 +0200 | [diff] [blame] | 13 | |
| 14 | if (items.ccdarktheme) { |
| 15 | switch (items.ccdarktheme_mode) { |
| 16 | case 'switch': |
| 17 | if (items.ccdarktheme_switch_status == true) |
| 18 | injectStylesheet(chrome.runtime.getURL('injections/ccdarktheme.css')); |
| 19 | break; |
| 20 | |
| 21 | case 'system': |
| 22 | injectStylesheet(chrome.runtime.getURL('injections/ccdarktheme.css'), { |
| 23 | 'media': '(prefers-color-scheme: dark)', |
| 24 | }); |
| 25 | break; |
| 26 | } |
| 27 | } |
avm99963 | 6d9c5fe | 2019-06-04 00:35:53 +0200 | [diff] [blame] | 28 | }); |