| 1 |
<!DOCTYPE html> |
| 2 |
<meta charset="utf-8"> |
| 3 |
<meta name="color-scheme" content="light dark"> |
| 4 |
<meta name="viewport" content="width=device-width, initial-scale=1"> |
| 5 |
<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';"> |
| 6 |
<title>E-Book Reader</title> |
| 7 |
<style> |
| 8 |
:root { |
| 9 |
--active-bg: rgba(0, 0, 0, .05); |
| 10 |
} |
| 11 |
@supports (color-scheme: light dark) { |
| 12 |
@media (prefers-color-scheme: dark) { |
| 13 |
:root { |
| 14 |
--active-bg: rgba(255, 255, 255, .1); |
| 15 |
} |
| 16 |
} |
| 17 |
} |
| 18 |
html { |
| 19 |
height: 100%; |
| 20 |
} |
| 21 |
body { |
| 22 |
margin: 0 auto; |
| 23 |
height: 100%; |
| 24 |
font: menu; |
| 25 |
font-family: system-ui, sans-serif; |
| 26 |
} |
| 27 |
#drop-target { |
| 28 |
height: 100vh; |
| 29 |
display: flex; |
| 30 |
align-items: center; |
| 31 |
justify-content: center; |
| 32 |
text-align: center; |
| 33 |
visibility: hidden; |
| 34 |
} |
| 35 |
#drop-target h1 { |
| 36 |
font-weight: 900; |
| 37 |
} |
| 38 |
#file-button { |
| 39 |
font: inherit; |
| 40 |
background: none; |
| 41 |
border: 0; |
| 42 |
padding: 0; |
| 43 |
text-decoration: underline; |
| 44 |
cursor: pointer; |
| 45 |
} |
| 46 |
.icon { |
| 47 |
display: block; |
| 48 |
fill: none; |
| 49 |
stroke: currentcolor; |
| 50 |
stroke-width: 2px; |
| 51 |
} |
| 52 |
.empty-state-icon { |
| 53 |
margin: auto; |
| 54 |
} |
| 55 |
.toolbar { |
| 56 |
box-sizing: border-box; |
| 57 |
position: absolute; |
| 58 |
z-index: 1; |
| 59 |
display: flex; |
| 60 |
align-items: center; |
| 61 |
justify-content: space-between; |
| 62 |
width: 100%; |
| 63 |
height: 48px; |
| 64 |
padding: 6px; |
| 65 |
transition: opacity 250ms ease; |
| 66 |
visibility: hidden; |
| 67 |
} |
| 68 |
.toolbar button { |
| 69 |
padding: 3px; |
| 70 |
border-radius: 6px; |
| 71 |
background: none; |
| 72 |
border: 0; |
| 73 |
color: GrayText; |
| 74 |
} |
| 75 |
.toolbar button:hover { |
| 76 |
background: rgba(0, 0, 0, .1); |
| 77 |
color: currentcolor; |
| 78 |
} |
| 79 |
#header-bar { |
| 80 |
top: 0; |
| 81 |
} |
| 82 |
#nav-bar { |
| 83 |
bottom: 0; |
| 84 |
} |
| 85 |
#progress-slider { |
| 86 |
flex-grow: 1; |
| 87 |
margin: 0 12px; |
| 88 |
visibility: hidden; |
| 89 |
} |
| 90 |
#side-bar { |
| 91 |
visibility: hidden; |
| 92 |
box-sizing: border-box; |
| 93 |
position: absolute; |
| 94 |
z-index: 2; |
| 95 |
top: 0; |
| 96 |
left: 0; |
| 97 |
height: 100%; |
| 98 |
width: 320px; |
| 99 |
transform: translateX(-320px); |
| 100 |
display: flex; |
| 101 |
flex-direction: column; |
| 102 |
background: Canvas; |
| 103 |
color: CanvasText; |
| 104 |
box-shadow: 0 0 0 1px rgba(0, 0, 0, .2), 0 0 40px rgba(0, 0, 0, .2); |
| 105 |
transition: visibility 0s linear 300ms, transform 300ms ease; |
| 106 |
} |
| 107 |
#side-bar.show { |
| 108 |
visibility: visible; |
| 109 |
transform: translateX(0); |
| 110 |
transition-delay: 0s; |
| 111 |
} |
| 112 |
#dimming-overlay { |
| 113 |
visibility: hidden; |
| 114 |
position: fixed; |
| 115 |
z-index: 2; |
| 116 |
top: 0; |
| 117 |
left: 0; |
| 118 |
width: 100%; |
| 119 |
height: 100%; |
| 120 |
background: rgba(0, 0, 0, .2); |
| 121 |
opacity: 0; |
| 122 |
transition: visibility 0s linear 300ms, opacity 300ms ease; |
| 123 |
} |
| 124 |
#dimming-overlay.show { |
| 125 |
visibility: visible; |
| 126 |
opacity: 1; |
| 127 |
transition-delay: 0s; |
| 128 |
} |
| 129 |
#side-bar-header { |
| 130 |
padding: 1rem; |
| 131 |
display: flex; |
| 132 |
border-bottom: 1px solid rgba(0, 0, 0, .1); |
| 133 |
align-items: center; |
| 134 |
} |
| 135 |
#side-bar-cover { |
| 136 |
height: 10vh; |
| 137 |
min-height: 60px; |
| 138 |
max-height: 180px; |
| 139 |
border-radius: 3px; |
| 140 |
border: 0; |
| 141 |
background: lightgray; |
| 142 |
box-shadow: 0 0 1px rgba(0, 0, 0, .1), 0 0 16px rgba(0, 0, 0, .1); |
| 143 |
margin-inline-end: 1rem; |
| 144 |
} |
| 145 |
#side-bar-cover:not([src]) { |
| 146 |
display: none; |
| 147 |
} |
| 148 |
#side-bar-title { |
| 149 |
margin: .5rem 0; |
| 150 |
font-size: inherit; |
| 151 |
} |
| 152 |
#side-bar-author { |
| 153 |
margin: .5rem 0; |
| 154 |
font-size: small; |
| 155 |
color: GrayText; |
| 156 |
} |
| 157 |
#toc-view { |
| 158 |
padding: .5rem; |
| 159 |
overflow-y: scroll; |
| 160 |
} |
| 161 |
#toc-view li, #toc-view ol { |
| 162 |
margin: 0; |
| 163 |
padding: 0; |
| 164 |
list-style: none; |
| 165 |
} |
| 166 |
#toc-view a, #toc-view span { |
| 167 |
display: block; |
| 168 |
border-radius: 6px; |
| 169 |
padding: 8px; |
| 170 |
margin: 2px 0; |
| 171 |
} |
| 172 |
#toc-view a { |
| 173 |
color: CanvasText; |
| 174 |
text-decoration: none; |
| 175 |
} |
| 176 |
#toc-view a:hover { |
| 177 |
background: var(--active-bg); |
| 178 |
} |
| 179 |
#toc-view span { |
| 180 |
color: GrayText; |
| 181 |
} |
| 182 |
#toc-view svg { |
| 183 |
margin-inline-start: -24px; |
| 184 |
padding-inline-start: 5px; |
| 185 |
padding-inline-end: 6px; |
| 186 |
fill: CanvasText; |
| 187 |
cursor: default; |
| 188 |
transition: transform .2s ease; |
| 189 |
opacity: .5; |
| 190 |
} |
| 191 |
#toc-view svg:hover { |
| 192 |
opacity: 1; |
| 193 |
} |
| 194 |
#toc-view [aria-current] { |
| 195 |
font-weight: bold; |
| 196 |
background: var(--active-bg); |
| 197 |
} |
| 198 |
#toc-view [aria-expanded="false"] svg { |
| 199 |
transform: rotate(-90deg); |
| 200 |
} |
| 201 |
#toc-view [aria-expanded="false"] + [role="group"] { |
| 202 |
display: none; |
| 203 |
} |
| 204 |
.menu-container { |
| 205 |
position: relative; |
| 206 |
} |
| 207 |
.menu, .menu ul { |
| 208 |
list-style: none; |
| 209 |
padding: 0; |
| 210 |
margin: 0; |
| 211 |
} |
| 212 |
.menu { |
| 213 |
visibility: hidden; |
| 214 |
position: absolute; |
| 215 |
right: 0; |
| 216 |
background: Canvas; |
| 217 |
color: CanvasText; |
| 218 |
border-radius: 6px; |
| 219 |
box-shadow: 0 0 0 1px rgba(0, 0, 0, .2), 0 0 16px rgba(0, 0, 0, .1); |
| 220 |
padding: 6px; |
| 221 |
cursor: default; |
| 222 |
} |
| 223 |
.menu.show { |
| 224 |
visibility: visible; |
| 225 |
} |
| 226 |
.menu li { |
| 227 |
padding: 6px 12px; |
| 228 |
padding-left: 24px; |
| 229 |
border-radius: 6px; |
| 230 |
} |
| 231 |
.menu li:hover { |
| 232 |
background: var(--active-bg); |
| 233 |
} |
| 234 |
.menu li[aria-checked="true"] { |
| 235 |
background-position: center left; |
| 236 |
background-repeat: no-repeat; |
| 237 |
background-image: url('data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%3E%3Ccircle%20cx%3D%2212%22%20cy%3D%2212%22%20r%3D%223%22%2F%3E%3C%2Fsvg%3E'); |
| 238 |
} |
| 239 |
.popover { |
| 240 |
background: Canvas; |
| 241 |
color: CanvasText; |
| 242 |
border-radius: 6px; |
| 243 |
box-shadow: 0 0 0 1px rgba(0, 0, 0, .2), 0 0 16px rgba(0, 0, 0, .1), 0 0 32px rgba(0, 0, 0, .1); |
| 244 |
} |
| 245 |
.popover-arrow-down { |
| 246 |
fill: Canvas; |
| 247 |
filter: drop-shadow(0 -1px 0 rgba(0, 0, 0, .2)); |
| 248 |
} |
| 249 |
.popover-arrow-up { |
| 250 |
fill: Canvas; |
| 251 |
filter: drop-shadow(0 1px 0 rgba(0, 0, 0, .2)); |
| 252 |
} |
| 253 |
</style> |
| 254 |
<input type="file" id="file-input" hidden> |
| 255 |
<div id="drop-target" class="filter"> |
| 256 |
<div> |
| 257 |
<svg class="icon empty-state-icon" width="72" height="72" aria-hidden="true"> |
| 258 |
<path d="M36 18s-6-6-12-6-15 6-15 6v42s9-6 15-6 12 6 12 6c4-4 8-6 12-6s12 2 15 6V18c-6-4-12-6-15-6-4 0-8 2-12 6m0 0v42"/> |
| 259 |
</svg> |
| 260 |
<h1>Drop a book here!</h1> |
| 261 |
<p>Or <button id="file-button">choose a file</button> to open it.</p> |
| 262 |
</div> |
| 263 |
</div> |
| 264 |
<div id="dimming-overlay" aria-hidden="true"></div> |
| 265 |
<div id="side-bar"> |
| 266 |
<div id="side-bar-header"> |
| 267 |
<img id="side-bar-cover"> |
| 268 |
<div> |
| 269 |
<h1 id="side-bar-title"></h1> |
| 270 |
<p id="side-bar-author"></p> |
| 271 |
</div> |
| 272 |
</div> |
| 273 |
<div id="toc-view"></div> |
| 274 |
</div> |
| 275 |
<div id="header-bar" class="toolbar"> |
| 276 |
<button id="side-bar-button" aria-label="Show sidebar"> |
| 277 |
<svg class="icon" width="24" height="24" aria-hidden="true"> |
| 278 |
<path d="M 4 6 h 16 M 4 12 h 16 M 4 18 h 16"/> |
| 279 |
</svg> |
| 280 |
</button> |
| 281 |
<div id="menu-button" class="menu-container"> |
| 282 |
<button aria-label="Show settings" aria-haspopup="true"> |
| 283 |
<svg class="icon" width="24" height="24" aria-hidden="true"> |
| 284 |
<path d="M5 12.7a7 7 0 0 1 0-1.4l-1.8-2 2-3.5 2.7.5a7 7 0 0 1 1.2-.7L10 3h4l.9 2.6 1.2.7 2.7-.5 2 3.4-1.8 2a7 7 0 0 1 0 1.5l1.8 2-2 3.5-2.7-.5a7 7 0 0 1-1.2.7L14 21h-4l-.9-2.6a7 7 0 0 1-1.2-.7l-2.7.5-2-3.4 1.8-2Z"/> |
| 285 |
<circle cx="12" cy="12" r="3"/> |
| 286 |
</svg> |
| 287 |
</button> |
| 288 |
</div> |
| 289 |
</div> |
| 290 |
<div id="nav-bar" class="toolbar"> |
| 291 |
<button id="left-button" aria-label="Go left"> |
| 292 |
<svg class="icon" width="24" height="24" aria-hidden="true"> |
| 293 |
<path d="M 15 6 L 9 12 L 15 18"/> |
| 294 |
</svg> |
| 295 |
</button> |
| 296 |
<input id="progress-slider" type="range" min="0" max="1" step="any" list="tick-marks"> |
| 297 |
<datalist id="tick-marks"></datalist> |
| 298 |
<button id="right-button" aria-label="Go right"> |
| 299 |
<svg class="icon" width="24" height="24" aria-hidden="true"> |
| 300 |
<path d="M 9 6 L 15 12 L 9 18"/> |
| 301 |
</svg> |
| 302 |
</button> |
| 303 |
</div> |
| 304 |
<script src="reader.js" type="module"></script> |