| 1 | <!DOCTYPE html> |
| 2 | <meta charset="utf-8"> |
| 3 | <meta name="color-scheme" content="light dark"> |
| 4 | <meta http-equiv="Content-Security-Policy" content="default-src 'self' blob:; script-src 'self'; style-src 'self' blob: 'unsafe-inline'; img-src 'self' blob: data:; connect-src 'self' blob: data:; frame-src blob: data:; object-src blob: data:; form-action 'none';"> |
| 5 | <style> |
| 6 | html { |
| 7 | /* TODO: high contrast mode */ |
| 8 | --hover: rgba(0, 0, 0, .03); |
| 9 | --active: rgba(0, 0, 0, .05); |
| 10 | --border: rgba(0, 0, 0, .15); |
| 11 | --bg: var(--light-bg); |
| 12 | --fg: var(--light-fg); |
| 13 | height: 100%; |
| 14 | } |
| 15 | body { |
| 16 | margin: 0 auto; |
| 17 | height: 100%; |
| 18 | background: var(--bg); |
| 19 | color: var(--fg); |
| 20 | } |
| 21 | @media (prefers-color-scheme: dark) { |
| 22 | html { |
| 23 | --hover: rgba(255, 255, 255, .03); |
| 24 | --active: rgba(255, 255, 255, .05); |
| 25 | --border: rgba(255, 255, 255, .15); |
| 26 | --bg: var(--dark-bg); |
| 27 | --fg: var(--dark-fg); |
| 28 | } |
| 29 | .invert foliate-view::part(filter) { |
| 30 | color-scheme: light; /* required to make the iframe bg transparent */ |
| 31 | filter: invert(1) hue-rotate(180deg); |
| 32 | } |
| 33 | } |
| 34 | foliate-view::part(head), foliate-view::part(foot) { |
| 35 | font: menu; |
| 36 | font-size: 9pt; |
| 37 | } |
| 38 | foliate-view { |
| 39 | --overlayer-highlight-blend-mode: multiply; |
| 40 | } |
| 41 | @media (prefers-color-scheme: dark) { |
| 42 | foliate-view { |
| 43 | --overlayer-highlight-blend-mode: screen; |
| 44 | } |
| 45 | } |
| 46 | #ribbon { |
| 47 | visibility: hidden; |
| 48 | display: inline-block; |
| 49 | position: absolute; |
| 50 | left: 48px; |
| 51 | z-index: 1; |
| 52 | } |
| 53 | #ribbon:before, |
| 54 | #ribbon:after { |
| 55 | content: ""; |
| 56 | display: block; |
| 57 | position: absolute; |
| 58 | height: 10px; |
| 59 | border: 9px solid red; |
| 60 | } |
| 61 | #ribbon:before { |
| 62 | border-bottom-color: transparent; |
| 63 | bottom: -40px; |
| 64 | } |
| 65 | |
| 66 | #footnote-dialog { |
| 67 | font: menu; |
| 68 | padding: 0; |
| 69 | width: 400px; |
| 70 | height: 400px; |
| 71 | border-radius: 12px; |
| 72 | border: 0; |
| 73 | box-shadow: 0 0 0 1px var(--border), 0 0 12px rgba(0, 0, 0, .2); |
| 74 | -webkit-user-select: none; |
| 75 | background: var(--bg); |
| 76 | color: var(--fg); |
| 77 | } |
| 78 | #footnote-dialog div { |
| 79 | display: flex; |
| 80 | flex-direction: column; |
| 81 | height: 100%; |
| 82 | } |
| 83 | #footnote-dialog header { |
| 84 | text-align: center; |
| 85 | font-weight: bold; |
| 86 | padding: 9px; |
| 87 | border-bottom: 1px solid var(--border); |
| 88 | cursor: default; |
| 89 | } |
| 90 | #footnote-dialog form { |
| 91 | display: flex; |
| 92 | border-top: 1px solid var(--border); |
| 93 | } |
| 94 | #footnote-dialog form button + button { |
| 95 | border-inline-start: 1px solid var(--border); |
| 96 | } |
| 97 | #footnote-dialog button { |
| 98 | flex: 1; |
| 99 | border: 0; |
| 100 | margin: 0; |
| 101 | padding: 12px; |
| 102 | font-weight: bold; |
| 103 | color: inherit; |
| 104 | background: none; |
| 105 | } |
| 106 | #footnote-dialog button:hover { |
| 107 | background: var(--hover); |
| 108 | } |
| 109 | #footnote-dialog button:active { |
| 110 | background: var(--active); |
| 111 | } |
| 112 | #footnote-dialog main { |
| 113 | min-height: 0; |
| 114 | flex: 1 |
| 115 | } |
| 116 | @media (max-width: 500px) { |
| 117 | #footnote-dialog { |
| 118 | margin: 0; |
| 119 | margin-top: auto; |
| 120 | width: 100%; |
| 121 | max-width: 100%; |
| 122 | border-bottom-left-radius: 0; |
| 123 | border-bottom-right-radius: 0; |
| 124 | } |
| 125 | } |
| 126 | </style> |
| 127 | <input type="file" id="file-input" hidden> |
| 128 | <div id="ribbon"></div> |
| 129 | <dialog id="footnote-dialog"> |
| 130 | <div> |
| 131 | <header></header> |
| 132 | <main></main> |
| 133 | <form method="dialog"> |
| 134 | <input name="href" type="hidden"> |
| 135 | <button value="close"></button> |
| 136 | <button value="go"></button> |
| 137 | </form> |
| 138 | </div> |
| 139 | </dialog> |
| 140 | <script src="reader.js" type="module"></script> |