-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoptions.html
More file actions
555 lines (525 loc) · 19.9 KB
/
options.html
File metadata and controls
555 lines (525 loc) · 19.9 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
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>VibeReader Settings</title>
<style>
:root {
--bg: #FAFAF7;
--bg-2: #F5F4F0;
--card: #FAFAF7;
--border: #E8E7E2;
--tx: #343331;
--tx-2: #6F6E69;
--tx-3: #B7B5AC;
--tx-4: #CECDC3;
--accent: #403E3C;
--blue: #205EA6;
--red: #AF3029;
--green: #66800B;
--radius: 10px;
--shadow: 0 1px 3px rgba(16,15,15,0.08), 0 1px 2px rgba(16,15,15,0.05);
--font: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
--mono: 'SF Mono', Menlo, Consolas, monospace;
--fl-paper: var(--bg); --fl-100: var(--bg-2); --fl-150: #DDDCD8;
--fl-200: var(--border); --fl-300: #D0CFC9; --fl-green: var(--green);
--fl-blue: var(--blue); --fl-red: var(--red); --fl-black: #100F0F;
--fl-700: #403E3C; --fl-800: #343331;
--header-bg: rgba(250,250,247,0.85);
}
[data-theme="dark"] {
--bg: #1C1B1A;
--bg-2: #282726;
--card: #282726;
--border: #403E3C;
--tx: #CECDC3;
--tx-2: #878580;
--tx-3: #575653;
--tx-4: #403E3C;
--accent: #CECDC3;
--blue: #4385BE;
--red: #D14D41;
--green: #879A39;
--shadow: 0 1px 3px rgba(0,0,0,0.30), 0 1px 2px rgba(0,0,0,0.20);
--fl-paper: var(--bg); --fl-100: var(--bg-2); --fl-150: #343331;
--fl-200: var(--border); --fl-300: #575653; --fl-green: var(--green);
--fl-blue: var(--blue); --fl-red: var(--red); --fl-black: #FFFCF0;
--fl-700: #DAD8CE; --fl-800: #E6E4D9;
--header-bg: rgba(28,27,26,0.85);
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
font-family: var(--font);
background: var(--bg);
color: var(--tx);
overflow-y: auto;
-webkit-font-smoothing: antialiased;
}
/* ── page shell ──────────────────────── */
.page-header {
position: sticky;
top: 0;
z-index: 10;
display: flex;
align-items: center;
justify-content: space-between;
padding: 14px 24px;
background: var(--header-bg);
backdrop-filter: blur(12px);
-webkit-backdrop-filter: blur(12px);
border-bottom: 1px solid var(--border);
}
.page-title {
font-size: 15px;
font-weight: 700;
letter-spacing: -0.01em;
}
.page-title span { color: var(--tx-3); font-weight: 400; font-size: 12px; margin-left: 6px; }
.header-right { display: flex; align-items: center; gap: 10px; }
.lang-select {
background: var(--card);
border: 1px solid var(--border);
border-radius: 6px;
padding: 5px 10px;
font-family: var(--font);
font-size: 11px;
color: var(--tx-2);
cursor: pointer;
outline: none;
}
.lang-select:focus { border-color: var(--tx-3); }
.content {
max-width: 840px;
margin: 0 auto;
padding: 20px 24px 48px;
display: flex;
flex-direction: column;
gap: 16px;
}
/* ── card ─────────────────────────────── */
.card {
background: var(--card);
border: 1px solid var(--border);
border-radius: var(--radius);
box-shadow: var(--shadow);
overflow: hidden;
}
.card-header {
padding: 16px 20px 14px;
border-bottom: 1px solid var(--border);
display: flex;
align-items: center;
gap: 10px;
}
.card-dot {
width: 6px;
height: 6px;
border-radius: 50%;
flex-shrink: 0;
}
.card-dot-green { background: var(--green); }
.card-dot-blue { background: var(--blue); }
.card-dot-purple { background: #5E409D; }
.card-dot-orange { background: #BC5215; }
.card-title {
font-size: 13px;
font-weight: 600;
color: var(--tx);
flex: 1;
}
.card-badge {
font-size: 10px;
font-weight: 500;
padding: 2px 8px;
border-radius: 9999px;
background: var(--bg-2);
color: var(--tx-3);
}
.card-body { padding: 18px 20px; }
.card-footer {
padding: 12px 20px;
border-top: 1px solid var(--border);
background: var(--bg-2);
display: flex;
gap: 8px;
align-items: center;
}
/* ── featured toggle ──────────────────── */
.toggle-row {
display: flex;
align-items: center;
justify-content: space-between;
gap: 16px;
}
.toggle-info { flex: 1; }
.toggle-title { font-size: 13px; font-weight: 600; color: var(--tx); margin-bottom: 2px; }
.toggle-desc { font-size: 11px; color: var(--tx-3); line-height: 1.5; }
.switch-label { display: flex; align-items: center; cursor: pointer; user-select: none; }
.switch-label input { display: none; }
.slider-toggle {
width: 36px; height: 20px;
background: var(--tx-4);
border-radius: 10px;
position: relative;
transition: background 0.2s;
flex-shrink: 0;
}
.slider-toggle::after {
content: '';
position: absolute;
width: 16px; height: 16px;
background: var(--card);
border-radius: 50%;
top: 2px; left: 2px;
transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}
.switch-label input:checked + .slider-toggle { background: var(--green); }
.switch-label input:checked + .slider-toggle::after { transform: translateX(16px); }
/* ── form elements ────────────────────── */
.field { margin-bottom: 12px; }
.field:last-child { margin-bottom: 0; }
.field-label {
display: block;
margin-bottom: 4px;
font-weight: 500;
color: var(--tx-2);
font-size: 11px;
letter-spacing: 0.02em;
}
/* keep generic label for JS compat */
label { display: block; margin-bottom: 4px; font-weight: 500; color: var(--tx-2); font-size: 11px; letter-spacing: 0.02em; }
input[type="text"], input[type="password"], select {
width: 100%;
padding: 8px 11px;
border: 1px solid var(--border);
border-radius: 6px;
background: var(--bg);
color: var(--tx);
font-family: var(--font);
font-size: 12px;
transition: border-color 0.15s;
}
input:focus, select:focus, textarea:focus {
outline: none;
border-color: var(--tx-3);
box-shadow: 0 0 0 2px rgba(168,162,158,0.15);
}
textarea {
width: 100%;
height: 150px;
padding: 10px 11px;
border: 1px solid var(--border);
border-radius: 6px;
resize: vertical;
font-family: var(--mono);
font-size: 11px;
background: var(--bg);
color: var(--tx);
line-height: 1.6;
}
.hint { color: var(--tx-3); font-size: 10px; margin-top: 3px; margin-bottom: 0; line-height: 1.5; }
/* ── buttons ──────────────────────────── */
button {
background: var(--accent);
color: #fff;
padding: 8px 16px;
border: none;
border-radius: 6px;
cursor: pointer;
font-family: var(--font);
font-size: 11px;
font-weight: 500;
transition: opacity 0.12s, transform 0.1s;
}
button:hover { opacity: 0.85; }
button:active { transform: scale(0.97); }
button.secondary {
background: var(--card);
color: var(--tx-2);
border: 1px solid var(--border);
}
button.secondary:hover { border-color: var(--tx-3); color: var(--tx); }
button.danger { background: var(--red); }
.btn-full { width: 100%; }
.btn-row { display: flex; gap: 8px; margin-top: 8px; }
.status { margin-top: 6px; color: var(--green); text-align: center; display: none; font-size: 10px; }
/* ── template list ────────────────────── */
.tpl-list {
border: 1px solid var(--border);
border-radius: 6px;
max-height: 180px;
overflow-y: auto;
margin-bottom: 10px;
}
.template-item {
padding: 8px 12px;
border-bottom: 1px solid var(--border);
cursor: pointer;
font-size: 11px;
transition: background 0.1s;
}
.template-item:last-child { border-bottom: none; }
.template-item:hover { background: var(--bg-2); }
.template-item.active { background: var(--bg-2); font-weight: 600; }
/* ── two column ───────────────────────── */
.two-col { display: flex; gap: 16px; }
.two-col > :first-child { flex: 2; min-width: 0; }
.two-col > :last-child { flex: 3; min-width: 0; }
/* ── responsive ───────────────────────── */
@media (max-width: 540px) {
.two-col { flex-direction: column; }
.content { padding: 16px; gap: 12px; }
.page-header { padding: 12px 16px; }
.card-body { padding: 14px 16px; }
}
/* ── scrollbar ────────────────────────── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--tx-4); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: var(--tx-3); }
/* ── theme transition ── */
.theme-transition,
.theme-transition *,
.theme-transition *::before,
.theme-transition *::after {
transition: background-color 0.3s, color 0.3s, border-color 0.3s, box-shadow 0.3s !important;
}
/* ── status fade animation ── */
@keyframes status-fade-in {
from { opacity: 0; transform: translateY(-4px); }
to { opacity: 1; transform: translateY(0); }
}
@keyframes status-fade-out {
from { opacity: 1; }
to { opacity: 0; }
}
.status-animate {
animation: status-fade-in 0.2s ease-out;
}
.status-fade-out {
animation: status-fade-out 0.3s ease-out forwards;
}
/* ── button flash feedback ── */
@keyframes btn-flash-success {
0% { background-color: var(--green); }
100% { background-color: var(--accent); }
}
@keyframes btn-flash-error {
0% { background-color: var(--red); }
100% { background-color: var(--accent); }
}
.btn-flash-success { animation: btn-flash-success 0.6s ease-out; }
.btn-flash-error { animation: btn-flash-error 0.6s ease-out; }
/* ── theme toggle ── */
.theme-toggle {
background: var(--card);
border: 1px solid var(--border);
border-radius: 6px;
padding: 5px 8px;
cursor: pointer;
font-size: 14px;
line-height: 1;
color: var(--tx-2);
transition: border-color 0.15s, color 0.15s;
}
.theme-toggle:hover { border-color: var(--tx-3); color: var(--tx); }
</style>
</head>
<body>
<!-- ── sticky header ──────────────────────────────── -->
<div class="page-header">
<div class="page-title">VibeReader <span>settings</span></div>
<div class="header-right">
<button id="theme-toggle" class="theme-toggle" title="Toggle theme">☼</button>
<select id="lang" class="lang-select">
<option value="en">EN</option>
<option value="ja">JA</option>
<option value="zh">ZH</option>
</select>
</div>
</div>
<div class="content">
<!-- ── auto summary ─────────────────────────────── -->
<div class="card">
<div class="card-header">
<span class="card-dot card-dot-green"></span>
<span class="card-title" id="lbl-autoSummary">Auto Summary</span>
</div>
<div class="card-body">
<div class="toggle-row">
<div class="toggle-info">
<div class="toggle-title" id="lbl-enableAutoSum">Enable Auto Summary</div>
<div class="toggle-desc" id="autoSumHintText">Summarize every new page automatically.</div>
</div>
<label class="switch-label">
<input type="checkbox" id="autoSumEnabled">
<span class="slider-toggle"></span>
</label>
</div>
</div>
</div>
<!-- ── AI provider ──────────────────────────────── -->
<div class="card">
<div class="card-header">
<span class="card-dot card-dot-blue"></span>
<span class="card-title" id="lbl-aiProvider">AI Provider</span>
<span class="card-badge">31 providers</span>
</div>
<div class="card-body">
<p class="hint" id="localFirstHint" style="margin-bottom: 12px; font-size: 11px;">
Local-first: Ollama keeps data on your machine. Cloud providers send content to external APIs.
</p>
<div class="field">
<label for="provider">Provider</label>
<select id="provider">
<optgroup label="Local">
<option value="ollama">Ollama</option>
<option value="lmstudio">LM Studio</option>
<option value="jan">Jan</option>
<option value="gpt4all">GPT4All</option>
<option value="localai">LocalAI</option>
<option value="vllm">vLLM</option>
<option value="textgenwebui">text-generation-webui</option>
</optgroup>
<optgroup label="China Cloud">
<option value="deepseek">DeepSeek</option>
<option value="siliconflow">SiliconFlow</option>
<option value="moonshot">Moonshot / Kimi</option>
<option value="zhipu">Zhipu AI</option>
<option value="dashscope">Alibaba Tongyi</option>
<option value="doubao">Doubao / Volcengine</option>
</optgroup>
<optgroup label="International">
<option value="openai">OpenAI</option>
<option value="anthropic">Anthropic Claude</option>
<option value="gemini">Google Gemini</option>
<option value="groq">Groq</option>
<option value="mistral">Mistral AI</option>
<option value="xai">xAI Grok</option>
<option value="cohere">Cohere</option>
<option value="perplexity">Perplexity</option>
<option value="ai21">AI21 Labs</option>
<option value="fireworks">Fireworks AI</option>
<option value="cerebras">Cerebras</option>
<option value="lambda">Lambda</option>
<option value="replicate">Replicate</option>
</optgroup>
<optgroup label="Router">
<option value="openrouter">OpenRouter</option>
<option value="together">Together AI</option>
</optgroup>
<optgroup label="Enterprise">
<option value="azure_openai">Azure OpenAI</option>
</optgroup>
<optgroup label="NVIDIA">
<option value="nvidia_nim">NVIDIA NIM</option>
</optgroup>
<optgroup label="Other">
<option value="custom">Custom Endpoint</option>
</optgroup>
</select>
<p class="hint" id="providerHint"></p>
</div>
<div class="field">
<label for="baseUrl">Base URL</label>
<input type="text" id="baseUrl" placeholder="http://localhost:11434/v1">
<p class="hint" id="baseUrlHint"></p>
</div>
<div class="field" id="apiKeyGroup">
<label for="apiKey">API Key</label>
<input type="password" id="apiKey" placeholder="sk-...">
<p class="hint" id="apiKeyHint"></p>
<p class="hint" id="apiKeyLocalHint" style="color: #4D7C0F; font-size: 10px; margin-top: 2px;">Your API key is stored locally on this device only — never synced to cloud.</p>
</div>
<div class="field" id="apiFormatGroup" style="display:none;">
<label for="apiFormat">API Format</label>
<select id="apiFormat">
<option value="openai">OpenAI (/chat/completions)</option>
<option value="anthropic">Anthropic (/messages)</option>
<option value="responses">Responses (/responses)</option>
<option value="azure-openai">Azure OpenAI (/chat/completions?api-version=...)</option>
</select>
</div>
<div class="field">
<label for="modelSelect">Model</label>
<select id="modelSelect">
<option value="__custom__">-- Custom --</option>
</select>
<input type="text" id="modelCustom" placeholder="model name" style="display:none; margin-top: 5px;">
<p class="hint" id="modelHint"></p>
</div>
<div class="field" id="reasoningGroup" style="display:none;">
<label for="reasoningEffort">Reasoning</label>
<select id="reasoningEffort">
<option value="low">Low</option>
<option value="medium">Medium</option>
<option value="high" selected>High</option>
</select>
</div>
</div>
<div class="card-footer">
<button id="testConnection" class="secondary" style="flex:1;">Test Connection</button>
<button id="save" style="flex:1;">Save</button>
</div>
<div id="testStatus" class="status" style="padding: 0 20px 10px;"></div>
<div id="status" class="status" style="padding: 0 20px 10px;"></div>
</div>
<!-- ── prompt templates ──────────────────────────── -->
<div class="card">
<div class="card-header">
<span class="card-dot card-dot-purple"></span>
<span class="card-title">Prompt Templates</span>
<span class="card-badge">15 built-in</span>
</div>
<div class="card-body">
<div class="two-col">
<div>
<label>Templates</label>
<div class="tpl-list" id="templateList"></div>
<button id="newTemplateBtn" class="secondary btn-full">+ New</button>
</div>
<div>
<div class="field">
<label for="templateName">Name</label>
<input type="text" id="templateName" placeholder="e.g., Code Review">
</div>
<div class="field">
<label for="templateContent">Content</label>
<textarea id="templateContent" placeholder="Enter prompt..." style="height:130px;"></textarea>
</div>
<div class="btn-row">
<button id="saveTemplateBtn" style="flex:1;">Save</button>
<button id="deleteTemplateBtn" class="danger">Delete</button>
</div>
<div id="templateStatus" class="status"></div>
</div>
</div>
</div>
</div>
<!-- ── system prompt ─────────────────────────────── -->
<div class="card">
<div class="card-header">
<span class="card-dot card-dot-orange"></span>
<span class="card-title">System Prompt</span>
</div>
<div class="card-body">
<p class="hint" style="margin-bottom: 10px;">Prepended to every request. Placeholders auto-fill at runtime.</p>
<textarea id="systemPrompt" style="height: 240px;"></textarea>
</div>
<div class="card-footer">
<button id="saveSystemPromptBtn" style="flex:1;">Save</button>
<button id="resetSystemPromptBtn" class="secondary">Reset</button>
</div>
<div id="systemPromptStatus" class="status" style="padding: 0 20px 8px;"></div>
</div>
</div>
<div style="text-align:center; padding: 16px 0 8px;">
<a id="privacyLink" href="privacy.html" target="_blank" style="color: #2563EB; font-size: 12px; text-decoration: none;">Privacy Policy</a>
</div>
<script src="api-utils.js"></script>
<script src="i18n.js"></script>
<script src="options.js"></script>
</body>
</html>