Repository navigation
Expand file tree
/
Copy pathsidepanel.html
More file actions
70 lines (70 loc) · 4.75 KB
/
Copy pathsidepanel.html
File metadata and controls
70 lines (70 loc) · 4.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<!doctype html>
<html lang="zh-Hant">
<head>
<meta charset="utf-8" />
<title>Kindle 翻譯</title>
<style>
:root { --bg:#fbfaf7; --fg:#222; --muted:#777; --accent:#146e78; --card:#fff; --border:#e4e0d8; --err:#b3261e; }
@media (prefers-color-scheme: dark) {
:root { --bg:#1d1f21; --fg:#e8e6e3; --muted:#9a9a9a; --accent:#5cc3cc; --card:#26292c; --border:#3a3d40; --err:#ff8a80; }
}
* { box-sizing: border-box; }
body { margin:0; height:100vh; display:flex; flex-direction:column; background:var(--bg); color:var(--fg); font:15px/1.8 "Noto Serif TC","PingFang TC","Microsoft JhengHei",serif; }
header { background:var(--bg); border-bottom:1px solid var(--border); padding:10px 12px; display:flex; gap:8px; align-items:center; flex-wrap:wrap; font-family:system-ui,sans-serif; font-size:13px; }
button { background:var(--accent); color:#fff; border:0; border-radius:6px; padding:6px 12px; cursor:pointer; font-size:13px; }
button.ghost { background:transparent; color:var(--accent); border:1px solid var(--border); }
label { display:flex; align-items:center; gap:4px; color:var(--muted); }
.seg { width:100%; display:flex; align-items:center; gap:0; color:var(--muted); }
.seg span { margin-right:8px; }
.seg button { flex:1; background:transparent; color:var(--accent); border:1px solid var(--accent); border-radius:0; padding:7px 0; font-size:14px; font-weight:600; }
.seg button:first-of-type { border-radius:6px 0 0 6px; }
.seg button:last-of-type { border-radius:0 6px 6px 0; border-left:0; }
.seg button[aria-checked="true"] { background:var(--accent); color:#fff; }
#overlayHint { width:100%; margin-top:-4px; color:var(--muted); font-size:12px; }
#overlayHint[hidden] { display:none; }
#status { width:100%; color:var(--muted); font-size:12px; min-height:1em; white-space:pre-wrap; }
#status.err { color:var(--err); }
/* While translating: a tinted pill with a pulsing dot, so it's visible at a glance. */
#status.busy { color:var(--accent); background:color-mix(in srgb, var(--accent) 14%, transparent); font-weight:600; font-size:13px; padding:4px 10px; border-radius:6px; }
#status.busy::before { content:""; display:inline-block; width:8px; height:8px; margin-right:8px; border-radius:50%; background:currentColor; vertical-align:1px; animation:pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity:.25; transform:scale(.7); } }
main { padding:12px; flex:1; overflow:auto; }
footer { border-top:1px solid var(--border); background:var(--bg); font:11px/1.5 ui-monospace,Menlo,monospace; color:var(--muted); }
footer summary { padding:4px 12px; cursor:pointer; font-family:system-ui,sans-serif; display:flex; justify-content:space-between; }
footer summary a { cursor:pointer; color:var(--accent); }
#log { max-height:35vh; overflow:auto; margin:0; padding:0 12px 8px; white-space:pre-wrap; word-break:break-all; }
#log .err { color:var(--err); }
#log img { display:block; max-width:100%; max-height:120px; margin:4px 0; border:1px solid var(--border); cursor:zoom-in; }
#log img.big { max-height:none; cursor:zoom-out; }
.page { background:var(--card); border:1px solid var(--border); border-radius:8px; padding:14px 16px; margin-bottom:12px; white-space:pre-wrap; }
.page .meta { font:11px system-ui,sans-serif; color:var(--muted); margin-bottom:6px; display:flex; justify-content:space-between; }
.page .meta a { color:var(--muted); cursor:pointer; }
.empty { color:var(--muted); font-family:system-ui,sans-serif; font-size:13px; }
</style>
</head>
<body>
<header>
<button id="translate">翻譯這一頁</button>
<label><input type="checkbox" id="auto" /> 翻頁自動翻譯</label>
<div class="seg" id="overlay" role="radiogroup" title="書頁上要顯示譯文還是原文;選原文時譯文只顯示在側邊欄">
<span>書頁顯示</span>
<button role="radio" data-on="true">譯文</button>
<button role="radio" data-on="false">原文</button>
</div>
<div id="overlayHint">本頁尚未翻譯,翻好後選「譯文」才會蓋上去</div>
<button class="ghost" id="clear">清空</button>
<button class="ghost" id="options">設定</button>
<div id="status"></div>
</header>
<main id="list">
<p class="empty">打開 Kindle Cloud Reader 的書,按「翻譯這一頁」或直接翻頁。快捷鍵 Alt+T。</p>
</main>
<footer>
<details open>
<summary><span>執行紀錄</span><span><a id="saveShot" title="存下閱讀器目前這一頁的頁面資料(JSON),給除錯用;裡面有書的字型輪廓,只留在這台電腦">存下頁面資料</a> · <a id="clearLog">清除</a></span></summary>
<div id="log"></div>
</details>
</footer>
<script src="sidepanel.js"></script>
</body>
</html>