|
1 | 1 | <!doctype html> |
2 | 2 | <html> |
3 | 3 | <head> |
4 | | - <style> |
5 | | - body { |
6 | | - --bg-1: hsl(0, 0%, 100%); |
7 | | - --bg-2: hsl(206, 20%, 90%); |
8 | | - --bg-3: hsl(206, 20%, 80%); |
9 | | - --fg-1: hsl(0, 0%, 13%); |
10 | | - --fg-2: hsl(0, 0%, 20%); |
11 | | - --fg-2: hsl(0, 0%, 30%); |
12 | | - --link: hsl(208, 77%, 47%); |
13 | | - --link-hover: hsl(208, 77%, 55%); |
14 | | - --link-active: hsl(208, 77%, 40%); |
15 | | - --border-radius: 4px; |
16 | | - --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, |
17 | | - 'Open Sans', 'Helvetica Neue', sans-serif; |
18 | | - --font-mono: ui-monospace, 'Cascadia Code', 'Source Code Pro', Menlo, Consolas, |
19 | | - 'DejaVu Sans Mono', monospace; |
20 | | - color-scheme: light; |
21 | | - background: var(--bg-1); |
22 | | - color: var(--fg-1); |
23 | | - font-family: var(--font); |
24 | | - line-height: 1.5; |
25 | | - margin: 1rem; |
26 | | - height: calc(100vh - 2rem); |
27 | | - accent-color: var(--hover) !important; |
28 | | - } |
29 | | - |
30 | | - a { |
31 | | - color: var(--link); |
32 | | - } |
33 | | - |
34 | | - a:hover { |
35 | | - color: var(--link-hover); |
36 | | - } |
37 | | - |
38 | | - a:active { |
39 | | - color: var(--link-active); |
40 | | - } |
41 | | - |
42 | | - code { |
43 | | - background: var(--bg-2); |
44 | | - font-family: var(--font-mono); |
45 | | - font-size: 0.9em; |
46 | | - padding: 0.15rem 0.3rem; |
47 | | - border-radius: var(--border-radius); |
48 | | - } |
49 | | - |
50 | | - ul.todos { |
51 | | - padding: 0; |
52 | | - } |
53 | | - |
54 | | - body.dark { |
55 | | - color-scheme: dark; |
56 | | - --bg-1: hsl(0, 0%, 18%); |
57 | | - --bg-2: hsl(0, 0%, 30%); |
58 | | - --bg-3: hsl(0, 0%, 40%); |
59 | | - --fg-1: hsl(0, 0%, 90%); |
60 | | - --fg-2: hsl(0, 0%, 70%); |
61 | | - --fg-3: hsl(0, 0%, 60%); |
62 | | - --link: hsl(206, 96%, 72%); |
63 | | - --link-hover: hsl(206, 96%, 78%); |
64 | | - --link-active: hsl(206, 96%, 64%); |
65 | | - } |
66 | | - </style> |
| 4 | + <style id="injected"></style> |
67 | 5 |
|
68 | 6 | <script> |
69 | 7 | (function () { |
| 8 | + const style = document.querySelector('style#injected'); |
| 9 | + let styles = ''; |
| 10 | + |
70 | 11 | function send(payload, origin = '*') { |
71 | 12 | if (payload.command === 'info' && payload.args[0] instanceof Error) { |
72 | 13 | const error = payload.args[0]; |
|
97 | 38 | } |
98 | 39 |
|
99 | 40 | if (action === 'eval') { |
| 41 | + if (data.args.style !== undefined && styles !== (styles = data.args.style)) { |
| 42 | + style.textContent = styles; |
| 43 | + } |
| 44 | + |
100 | 45 | (0, eval)(data.args.script); |
101 | 46 | } |
102 | 47 |
|
|
0 commit comments