-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
326 lines (299 loc) · 19.2 KB
/
Copy pathindex.html
File metadata and controls
326 lines (299 loc) · 19.2 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
<!DOCTYPE html>
<html lang="zh" data-theme="light">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover">
<title>TextMark · 文字隐形水印 / Invisible text watermarking</title>
<meta name="description" content="给任意文字加隐形水印:变体选择符编码 + Reed-Solomon 纠错 + 可选 AES-GCM 加密,另附 AI 可读的 emoji 签名条。纯浏览器本地运行,无服务器、无网络请求。">
<meta name="color-scheme" content="light dark">
<meta name="theme-color" content="#FDF8F1" id="themeColorMeta">
<link rel="icon" href="icon.svg" type="image/svg+xml">
<link rel="apple-touch-icon" href="icon.svg">
<link rel="manifest" href="manifest.webmanifest">
<link rel="stylesheet" href="style.css">
<script>
/* Set the theme before first paint to avoid a flash. */
(function () {
var t;
try { t = localStorage.getItem('textmark.theme'); } catch (e) { /* file:// or blocked */ }
if (t !== 'light' && t !== 'dark') {
t = window.matchMedia && matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
}
document.documentElement.dataset.theme = t;
})();
</script>
</head>
<body>
<!-- icon sprite -->
<svg width="0" height="0" style="position:absolute" aria-hidden="true" focusable="false">
<defs>
<symbol id="i-embed" viewBox="0 0 24 24"><path d="M4 20h16M6 15.5 15.2 6.3a2.1 2.1 0 0 1 3 3L9 18.5l-4 1z"/></symbol>
<symbol id="i-detect" viewBox="0 0 24 24"><circle cx="11" cy="11" r="6.5"/><path d="M16 16l4.5 4.5"/></symbol>
<symbol id="i-clean" viewBox="0 0 24 24"><path d="M4 20h7M14.5 3.5l6 6M9 19 3.6 13.6 13.5 3.7l5.4 5.4z"/><path d="M7 10.5l6.5 6.5"/></symbol>
<symbol id="i-spec" viewBox="0 0 24 24"><path d="M4 5.5A2.5 2.5 0 0 1 6.5 3H18v18H6.5A2.5 2.5 0 0 1 4 18.5z"/><path d="M8 8h7M8 12h7M8 16h4"/></symbol>
<symbol id="i-sun" viewBox="0 0 24 24"><circle cx="12" cy="12" r="4.2"/><path d="M12 2.5v2M12 19.5v2M2.5 12h2M19.5 12h2M5.2 5.2l1.5 1.5M17.3 17.3l1.5 1.5M18.8 5.2l-1.5 1.5M6.7 17.3l-1.5 1.5"/></symbol>
<symbol id="i-moon" viewBox="0 0 24 24"><path d="M20 14.5A8.5 8.5 0 0 1 9.5 4a8.5 8.5 0 1 0 10.5 10.5z"/></symbol>
<symbol id="i-copy" viewBox="0 0 24 24"><rect x="9" y="9" width="11" height="11" rx="2.5"/><path d="M15 5.5A2.5 2.5 0 0 0 12.5 3h-6A3.5 3.5 0 0 0 3 6.5v6A2.5 2.5 0 0 0 5.5 15"/></symbol>
<symbol id="i-paste" viewBox="0 0 24 24"><path d="M9 4H7a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2h-2"/><rect x="9" y="2.5" width="6" height="3.5" rx="1.2"/></symbol>
<symbol id="i-file" viewBox="0 0 24 24"><path d="M14 3v5h5"/><path d="M19 8.5V20a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h8z"/></symbol>
<symbol id="i-download" viewBox="0 0 24 24"><path d="M12 3.5v11M7.5 10.5 12 15l4.5-4.5M4.5 19.5h15"/></symbol>
<symbol id="i-trash" viewBox="0 0 24 24"><path d="M4.5 6.5h15M9 6.5V4.2h6v2.3M6.5 6.5 7.5 20h9l1-13.5"/></symbol>
<symbol id="i-eye" viewBox="0 0 24 24"><path d="M2.5 12S6 5.5 12 5.5 21.5 12 21.5 12 18 18.5 12 18.5 2.5 12 2.5 12z"/><circle cx="12" cy="12" r="3"/></symbol>
<symbol id="i-eye-off" viewBox="0 0 24 24"><path d="M4 4l16 16"/><path d="M9.6 5.9A9.4 9.4 0 0 1 12 5.5c6 0 9.5 6.5 9.5 6.5a17 17 0 0 1-2.7 3.5M6.4 8.2A16.7 16.7 0 0 0 2.5 12S6 18.5 12 18.5c1 0 1.9-.2 2.7-.5"/></symbol>
<symbol id="i-check" viewBox="0 0 24 24"><path d="M5 12.5 9.5 17 19 7"/></symbol>
<symbol id="i-sample" viewBox="0 0 24 24"><path d="M12 3.5l1.9 4.6 4.6 1.9-4.6 1.9L12 16.5l-1.9-4.6L5.5 10l4.6-1.9zM18 16l.9 2.1 2.1.9-2.1.9L18 22l-.9-2.1-2.1-.9 2.1-.9z"/></symbol>
<symbol id="i-arrow-right" viewBox="0 0 24 24"><path d="M4.5 12h14M13 6.5 18.5 12 13 17.5"/></symbol>
<!-- hand-drawn underline for the active tab; stretched horizontally on purpose -->
<symbol id="i-squiggle" viewBox="0 0 56 8" preserveAspectRatio="none">
<path d="M2 5.4c6-3.9 12-3.9 18 0s12 3.9 18 0 12-3.9 16 0" vector-effect="non-scaling-stroke"/>
</symbol>
</defs>
</svg>
<header class="topbar">
<a class="brand" href="#embed">
<span class="brand-mark" aria-hidden="true">📜</span>
<span class="brand-name">TextMark</span>
<span class="brand-sub" data-i18n="brandSub">文字隐形水印</span>
</a>
<nav class="tabs" role="tablist" aria-label="TextMark">
<button class="tab" role="tab" id="tab-embed" aria-controls="page-embed" aria-selected="true" data-tab="embed">
<svg class="icon" aria-hidden="true"><use href="#i-embed"></use></svg><span data-i18n="tabEmbed">加水印</span>
<svg class="squiggle tab-line" aria-hidden="true"><use href="#i-squiggle"></use></svg>
</button>
<button class="tab" role="tab" id="tab-detect" aria-controls="page-detect" aria-selected="false" data-tab="detect">
<svg class="icon" aria-hidden="true"><use href="#i-detect"></use></svg><span data-i18n="tabDetect">检测解码</span>
<svg class="squiggle tab-line" aria-hidden="true"><use href="#i-squiggle"></use></svg>
</button>
<button class="tab" role="tab" id="tab-clean" aria-controls="page-clean" aria-selected="false" data-tab="clean">
<svg class="icon" aria-hidden="true"><use href="#i-clean"></use></svg><span data-i18n="tabClean">清除水印</span>
<svg class="squiggle tab-line" aria-hidden="true"><use href="#i-squiggle"></use></svg>
</button>
<button class="tab" role="tab" id="tab-spec" aria-controls="page-spec" aria-selected="false" data-tab="spec">
<svg class="icon" aria-hidden="true"><use href="#i-spec"></use></svg><span data-i18n="tabSpec">公开规范</span>
<svg class="squiggle tab-line" aria-hidden="true"><use href="#i-squiggle"></use></svg>
</button>
</nav>
<div class="actions">
<button id="themeToggle" class="icon-btn" type="button" title="切换深浅色" aria-label="切换深浅色">
<svg class="icon icon-sun" aria-hidden="true"><use href="#i-sun"></use></svg>
<svg class="icon icon-moon" aria-hidden="true"><use href="#i-moon"></use></svg>
</button>
<button id="langToggle" class="lang-btn" type="button" title="Switch language" aria-label="Switch language">EN</button>
</div>
</header>
<main>
<!-- ================= EMBED ================= -->
<section id="page-embed" class="page active" role="tabpanel" aria-labelledby="tab-embed" tabindex="-1">
<div class="page-head">
<span class="page-num" aria-hidden="true">01</span>
<span class="page-kicker" aria-hidden="true">Embed</span>
<h1 class="page-title" data-i18n="embedTitle">给文本加水印</h1>
<p class="page-lead" data-i18n="embedHint">在文本中嵌入隐形水印(变体选择符编码 + 纠错 + 可选加密),并可附加 AI 可读的 emoji 签名条。全部计算在浏览器本地完成。</p>
<span class="sticker" data-i18n="localOnly">全部在本地算完 · no upload</span>
</div>
<div class="panel">
<div class="field">
<div class="field-head">
<label for="embedText" data-i18n="originalText">原文</label>
<span class="counter" id="embedTextCount"></span>
<span class="field-tools">
<button class="btn btn-sm" type="button" data-paste="embedText"><svg class="icon" aria-hidden="true"><use href="#i-paste"></use></svg><span data-i18n="paste">粘贴</span></button>
<button class="btn btn-sm" type="button" data-file="embedText"><svg class="icon" aria-hidden="true"><use href="#i-file"></use></svg><span data-i18n="openFile">打开文件</span></button>
<button class="btn btn-sm" type="button" id="sampleBtn"><svg class="icon" aria-hidden="true"><use href="#i-sample"></use></svg><span data-i18n="sample">示例</span></button>
<button class="btn btn-sm" type="button" data-clear="embedText"><svg class="icon" aria-hidden="true"><use href="#i-trash"></use></svg><span data-i18n="clear">清空</span></button>
</span>
</div>
<textarea id="embedText" rows="7" spellcheck="false" data-i18n-ph="originalTextPh" placeholder="粘贴或输入要加水印的原文……"></textarea>
</div>
<div class="field">
<div class="field-head">
<label for="embedMsg" data-i18n="wmMessage">水印消息</label>
<span class="counter" id="embedMsgCount"></span>
</div>
<textarea id="embedMsg" rows="3" spellcheck="false" data-i18n-ph="wmMessagePh" placeholder="要藏进文本里的信息,例如:© 2026 张三 · 文档编号 A-17"></textarea>
<p class="note note-warn hidden" id="msgLongWarn" data-i18n="msgLongWarn">消息较长:emoji 签名条建议 ≤140 字节,长消息请依赖隐形层检测。</p>
</div>
<div class="field">
<div class="field-head">
<label for="embedPw" data-i18n="password">密码(可选)</label>
</div>
<div class="pw-wrap">
<input id="embedPw" type="password" autocomplete="new-password" data-i18n-ph="passwordPh" placeholder="留空则不加密">
<button class="pw-toggle" type="button" data-pw-toggle="embedPw" aria-label="显示密码">
<svg class="icon" aria-hidden="true"><use href="#i-eye"></use></svg>
</button>
</div>
</div>
<div class="field">
<div class="field-head">
<span id="modeLabel" class="field-label" data-i18n="insertMode">隐形层插入方式</span>
</div>
<div class="choices" role="radiogroup" aria-labelledby="modeLabel">
<label class="choice">
<input type="radio" name="embedMode" value="end" checked>
<span class="choice-title" data-i18n="modeEnd">文末追加</span>
<span class="choice-desc" data-i18n="modeEndDesc">最短:只在文本末尾插入一份,适合整段复制的场景。</span>
</label>
<label class="choice">
<input type="radio" name="embedMode" value="paragraphs">
<span class="choice-title" data-i18n="modePara">分段嵌入</span>
<span class="choice-desc" data-i18n="modeParaDesc">每段末尾各放一份副本(最多 20 份),任一段落被单独复制也能解码。</span>
</label>
</div>
</div>
<label class="switch" for="embedEmoji">
<input type="checkbox" id="embedEmoji">
<span class="switch-track" aria-hidden="true"></span>
<span class="switch-text">
<span data-i18n="emojiLayer">附加 AI 可读 emoji 签名条</span>
<small data-i18n="emojiLayerDesc">文末追加一段 📜 开头的 emoji,任何 AI 按公开规范即可读出水印消息。</small>
</span>
</label>
<p class="note note-warn hidden" id="emojiPwWarn" data-i18n="emojiPwWarn">已设置密码:为保证机密性,emoji 签名条已自动关闭。</p>
<div class="btn-row">
<button id="embedBtn" class="btn btn-primary" type="button">
<svg class="icon" aria-hidden="true"><use href="#i-embed"></use></svg><span data-i18n="embedBtn">生成带水印文本</span>
</button>
<span class="counter kbd-hint" data-i18n="shortcutHint">⌘/Ctrl + Enter</span>
</div>
</div>
<div class="panel accent hidden" id="embedOutWrap">
<div class="panel-head">
<h2 class="panel-title" style="margin:0" data-i18n="output">输出(外观与原文一致)</h2>
</div>
<textarea id="embedOut" rows="7" readonly spellcheck="false"></textarea>
<div class="chips" id="embedStats"></div>
<div class="btn-row tight">
<button id="copyBtn" class="btn btn-primary" type="button">
<svg class="icon" aria-hidden="true"><use href="#i-copy"></use></svg><span data-i18n="copy">复制结果</span>
</button>
<button id="downloadBtn" class="btn" type="button">
<svg class="icon" aria-hidden="true"><use href="#i-download"></use></svg><span data-i18n="download">下载 .txt</span>
</button>
<button id="toDetectBtn" class="btn" type="button">
<svg class="icon" aria-hidden="true"><use href="#i-arrow-right"></use></svg><span data-i18n="toDetect">去检测验证</span>
</button>
</div>
</div>
</section>
<!-- ================= DETECT ================= -->
<section id="page-detect" class="page" role="tabpanel" aria-labelledby="tab-detect" tabindex="-1">
<div class="page-head">
<span class="page-num" aria-hidden="true">02</span>
<span class="page-kicker" aria-hidden="true">Detect</span>
<h1 class="page-title" data-i18n="detectTitle">检测与解码</h1>
<p class="page-lead" data-i18n="detectHint">粘贴任意文本,自动扫描隐形水印与 emoji 签名条并解码。</p>
</div>
<div class="panel">
<div class="field">
<div class="field-head">
<label for="detectText" data-i18n="detectInput">待检测文本</label>
<span class="counter" id="detectTextCount"></span>
<span class="field-tools">
<button class="btn btn-sm" type="button" data-paste="detectText"><svg class="icon" aria-hidden="true"><use href="#i-paste"></use></svg><span data-i18n="paste">粘贴</span></button>
<button class="btn btn-sm" type="button" data-file="detectText"><svg class="icon" aria-hidden="true"><use href="#i-file"></use></svg><span data-i18n="openFile">打开文件</span></button>
<button class="btn btn-sm" type="button" data-clear="detectText"><svg class="icon" aria-hidden="true"><use href="#i-trash"></use></svg><span data-i18n="clear">清空</span></button>
</span>
</div>
<textarea id="detectText" rows="8" spellcheck="false" data-i18n-ph="detectInputPh" placeholder="粘贴文本,自动开始检测……"></textarea>
</div>
<div class="field hidden" id="detectPwWrap">
<div class="field-head">
<label for="detectPw" data-i18n="detectPw">该水印已加密,请输入密码</label>
</div>
<div class="pw-wrap">
<input id="detectPw" type="password" autocomplete="off">
<button class="pw-toggle" type="button" data-pw-toggle="detectPw" aria-label="显示密码">
<svg class="icon" aria-hidden="true"><use href="#i-eye"></use></svg>
</button>
</div>
</div>
</div>
<div id="detectResult" aria-live="polite"></div>
</section>
<!-- ================= CLEAN ================= -->
<section id="page-clean" class="page" role="tabpanel" aria-labelledby="tab-clean" tabindex="-1">
<div class="page-head">
<span class="page-num" aria-hidden="true">03</span>
<span class="page-kicker" aria-hidden="true">Clean</span>
<h1 class="page-title" data-i18n="cleanTitle">清除水印</h1>
<p class="page-lead" data-i18n="cleanHint">移除文本中的 TextMark 水印(隐形层 + emoji 签名条),其余字符逐字保留 —— 表情自带的变体选择符(如 ❤️)不会被误删。加密水印无需密码也能清除。</p>
</div>
<div class="panel">
<div class="field">
<div class="field-head">
<label for="cleanText" data-i18n="cleanInput">待清理文本</label>
<span class="counter" id="cleanTextCount"></span>
<span class="field-tools">
<button class="btn btn-sm" type="button" data-paste="cleanText"><svg class="icon" aria-hidden="true"><use href="#i-paste"></use></svg><span data-i18n="paste">粘贴</span></button>
<button class="btn btn-sm" type="button" data-file="cleanText"><svg class="icon" aria-hidden="true"><use href="#i-file"></use></svg><span data-i18n="openFile">打开文件</span></button>
<button class="btn btn-sm" type="button" data-clear="cleanText"><svg class="icon" aria-hidden="true"><use href="#i-trash"></use></svg><span data-i18n="clear">清空</span></button>
</span>
</div>
<textarea id="cleanText" rows="8" spellcheck="false" data-i18n-ph="cleanInputPh" placeholder="粘贴要清除水印的文本……"></textarea>
</div>
<div class="btn-row">
<button id="cleanBtn" class="btn btn-primary" type="button">
<svg class="icon" aria-hidden="true"><use href="#i-clean"></use></svg><span data-i18n="cleanBtn">清除水印</span>
</button>
<span class="counter kbd-hint" data-i18n="shortcutHint">⌘/Ctrl + Enter</span>
</div>
</div>
<div class="panel accent hidden" id="cleanOutWrap">
<div class="panel-head">
<h2 class="panel-title" style="margin:0" data-i18n="cleanOutput">清理结果</h2>
</div>
<textarea id="cleanOut" rows="7" readonly spellcheck="false"></textarea>
<div class="chips" id="cleanStats"></div>
<div class="btn-row tight">
<button id="cleanCopyBtn" class="btn btn-primary" type="button">
<svg class="icon" aria-hidden="true"><use href="#i-copy"></use></svg><span data-i18n="copy">复制结果</span>
</button>
<button id="cleanDownloadBtn" class="btn" type="button">
<svg class="icon" aria-hidden="true"><use href="#i-download"></use></svg><span data-i18n="download">下载 .txt</span>
</button>
</div>
</div>
</section>
<!-- ================= SPEC ================= -->
<section id="page-spec" class="page" role="tabpanel" aria-labelledby="tab-spec" tabindex="-1">
<div class="page-head">
<span class="page-num" aria-hidden="true">04</span>
<span class="page-kicker" aria-hidden="true">Spec v1</span>
<h1 class="page-title" data-i18n="specTitle">公开规范</h1>
<p class="page-lead" data-i18n="specLead">编码规则完全公开:这里没有秘密算法,任何人、任何 AI 都能照着下面的规范把水印读出来。</p>
</div>
<div class="panel prose" id="specBody"></div>
<div class="panel">
<div class="panel-head">
<h2 class="panel-title" style="margin:0" data-i18n="specTableTitle">256-emoji 字节对照表</h2>
</div>
<p class="panel-hint" data-i18n="specTableHint">字节值 = emoji 在表中的序号(0–255)。顺序:U+1F600–U+1F64F(0–79)、U+1F300–U+1F37F(80–207)、U+1F380–U+1F3AF(208–255)。</p>
<div class="field">
<input id="emojiSearch" type="text" inputmode="search" data-i18n-ph="emojiSearchPh" placeholder="按字节值或 emoji 过滤,例如 84 或 😀">
</div>
<div id="emojiGrid" class="emoji-grid"></div>
</div>
<div class="panel">
<div class="panel-head">
<h2 class="panel-title" style="margin:0" data-i18n="specPromptTitle">给 AI 的解码提示词模板</h2>
</div>
<p class="panel-hint" data-i18n="specPromptHint">把带水印文本连同下面的提示词发给任何足够强的 AI,它就能读出 emoji 签名条里的水印消息。</p>
<pre id="aiPrompt" class="prompt-box"></pre>
<div class="btn-row tight">
<button id="copyPromptBtn" class="btn btn-primary" type="button">
<svg class="icon" aria-hidden="true"><use href="#i-copy"></use></svg><span data-i18n="copyPrompt">复制提示词</span>
</button>
</div>
</div>
</section>
</main>
<footer>
<span data-i18n="footer">TextMark · 纯本地运行,无服务器,无网络请求 · 开源规范</span>
</footer>
<input type="file" id="filePicker" accept=".txt,.md,.markdown,.csv,.json,text/*" class="hidden">
<div class="toasts" id="toasts" aria-live="polite" aria-atomic="false"></div>
<script src="codec.js"></script>
<script src="app.js"></script>
</body>
</html>