Repository navigation
Expand file tree
/
Copy pathpopup.html
More file actions
464 lines (422 loc) · 12.8 KB
/
Copy pathpopup.html
File metadata and controls
464 lines (422 loc) · 12.8 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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>GGTranslate Settings</title>
<style>
/* Dark Mode & Modern Reset */
:root {
--bg-color: #18181b;
--card-bg: #1f1f23;
--text-color: #efeff1;
--text-muted: #adadb8;
--accent-color: #9146FF;
--accent-hover: #772ce8;
--input-bg: #0e0e10;
--input-border: #3a3a3d;
--border-radius: 6px;
--danger-color: #e91916;
--success-color: #00f593;
}
body {
font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
padding: 0;
margin: 0;
width: 100%;
height: 100%;
background-color: var(--bg-color);
color: var(--text-color);
font-size: 13px;
overflow-y: auto;
}
/* Custom Scrollbar */
::-webkit-scrollbar {
width: 8px;
}
::-webkit-scrollbar-track {
background: var(--bg-color);
}
::-webkit-scrollbar-thumb {
background: #3a3a3d;
border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
background: #5a5a5d;
}
/* Header */
.header {
position: sticky;
top: 0;
background-color: var(--card-bg);
padding: 15px 20px;
border-bottom: 1px solid #000;
display: flex;
justify-content: space-between;
align-items: center;
z-index: 100;
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}
h1 {
font-size: 16px;
font-weight: 600;
margin: 0;
color: var(--text-color);
}
.close-btn {
background: none;
border: none;
color: var(--text-muted);
font-size: 20px;
cursor: pointer;
padding: 0;
line-height: 1;
transition: color 0.2s;
}
.close-btn:hover {
color: var(--text-color);
}
/* Content */
.content {
padding: 20px;
display: grid;
grid-template-columns: 1fr 1fr;
gap: 20px;
align-items: start;
}
/* Sections */
.section {
background-color: var(--card-bg);
border-radius: var(--border-radius);
padding: 20px;
margin-bottom: 0; /* Handled by grid gap */
border: 1px solid #2d2d31;
}
.column {
display: flex;
flex-direction: column;
gap: 20px;
}
h2 {
font-size: 14px;
font-weight: 600;
margin: 0 0 15px 0;
color: var(--text-color);
border-bottom: 1px solid var(--input-border);
padding-bottom: 8px;
display: flex;
align-items: center;
gap: 8px;
}
/* Form Elements */
.setting-item {
margin-bottom: 15px;
}
.setting-item:last-child {
margin-bottom: 0;
}
label {
display: block;
margin-bottom: 6px;
font-weight: 500;
color: var(--text-muted);
font-size: 12px;
}
.row {
display: flex;
align-items: center;
justify-content: space-between;
}
input[type="text"],
input[type="number"],
input[type="password"],
select,
textarea {
width: 100%;
padding: 8px 10px;
box-sizing: border-box;
background-color: var(--input-bg);
border: 1px solid var(--input-border);
border-radius: var(--border-radius);
color: var(--text-color);
font-family: inherit;
font-size: 13px;
transition: border-color 0.2s, box-shadow 0.2s;
}
input:focus, select:focus, textarea:focus {
outline: none;
border-color: var(--accent-color);
box-shadow: 0 0 0 2px rgba(145, 70, 255, 0.2);
}
input[type="checkbox"] {
appearance: none;
width: 18px;
height: 18px;
background: var(--input-bg);
border: 1px solid var(--input-border);
border-radius: 4px;
cursor: pointer;
position: relative;
}
input[type="checkbox"]:checked {
background-color: var(--accent-color);
border-color: var(--accent-color);
}
input[type="checkbox"]:checked::after {
content: '\2714';
font-size: 12px;
color: white;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
input[type="color"] {
cursor: pointer;
height: 32px;
width: 60px;
padding: 2px;
background: var(--input-bg);
border: 1px solid var(--input-border);
border-radius: var(--border-radius);
}
textarea {
resize: vertical;
min-height: 80px;
line-height: 1.4;
}
/* Buttons */
.action-btn {
background-color: var(--accent-color);
color: white;
border: none;
padding: 10px 16px;
border-radius: var(--border-radius);
cursor: pointer;
width: 100%;
font-weight: 600;
font-size: 14px;
transition: background-color 0.2s;
}
.action-btn:hover {
background-color: var(--accent-hover);
}
/* Helper Text */
small {
color: #787880;
font-size: 11px;
display: block;
margin-top: 4px;
line-height: 1.3;
}
/* Specific Layouts */
.priority-row {
display: flex;
align-items: center;
margin-bottom: 10px;
gap: 10px;
}
.priority-label {
width: 30px;
font-weight: 600;
color: var(--text-muted);
font-size: 12px;
}
.priority-row select {
flex: 1;
}
/* Progress Bars */
.usage-container {
background-color: var(--input-bg);
border-radius: 4px;
padding: 10px;
margin-top: 10px;
}
.progress-track {
background: #3a3a3d;
height: 8px;
border-radius: 4px;
overflow: hidden;
margin-bottom: 4px;
}
.progress-bar {
height: 100%;
border-radius: 4px;
transition: width 0.3s ease;
}
.progress-text {
display: flex;
justify-content: space-between;
font-size: 10px;
color: var(--text-muted);
}
/* Status Message */
#status {
margin-top: 15px;
text-align: center;
font-size: 12px;
min-height: 18px;
font-weight: 500;
}
/* Footer */
.footer {
padding: 0 20px 20px 20px;
}
</style>
</head>
<body>
<div class="header">
<h1>GGTranslate</h1>
<button id="closeBtn" class="close-btn" title="Close">×</button>
</div>
<div class="content">
<!-- LEFT COLUMN -->
<div class="column">
<!-- General Settings -->
<div class="section">
<h2>General</h2>
<div class="setting-item row">
<label for="enabled" style="margin:0; font-size: 14px; color: var(--text-color);">Enable Translation</label>
<input type="checkbox" id="enabled">
</div>
<div class="setting-item row">
<label for="color" style="margin:0; font-size: 14px; color: var(--text-color);">Translation Color</label>
<input type="color" id="color">
</div>
</div>
<!-- Priority Section -->
<div class="section">
<h2>Engine Priority</h2>
<div class="setting-item">
<div class="priority-row">
<span class="priority-label">1st</span>
<select id="priority1">
<option value="gtx">Google Translate (Free)</option>
<option value="official">Google Cloud (Official)</option>
<option value="local">Local LLM (LM Studio)</option>
</select>
</div>
<div class="priority-row">
<span class="priority-label">2nd</span>
<select id="priority2">
<option value="gtx">Google Translate (Free)</option>
<option value="official">Google Cloud (Official)</option>
<option value="local">Local LLM (LM Studio)</option>
</select>
</div>
<div class="priority-row">
<span class="priority-label">3rd</span>
<select id="priority3">
<option value="gtx">Google Translate (Free)</option>
<option value="official">Google Cloud (Official)</option>
<option value="local">Local LLM (LM Studio)</option>
</select>
</div>
<small>Define the order of translation engines to attempt.</small>
</div>
</div>
<!-- Ignored Users Section -->
<div class="section">
<h2>Ignored Users</h2>
<div class="setting-item">
<label for="ignoredUsers">Ignored Usernames (Comma separated)</label>
<textarea id="ignoredUsers" placeholder="nightbot, streamelements, testuser"></textarea>
<small>Messages from these users will not be translated.</small>
</div>
</div>
</div>
<!-- RIGHT COLUMN -->
<div class="column">
<!-- Local LLM Section -->
<div class="section">
<h2>Local LLM (LM Studio)</h2>
<div class="setting-item">
<label for="localUrl">Server URL</label>
<input type="text" id="localUrl" placeholder="http://localhost:1234/v1/chat/completions">
</div>
<div class="setting-item">
<label for="localModel">Model Name</label>
<input type="text" id="localModel" placeholder="local-model">
</div>
<div class="setting-item">
<label for="localPrompt">System Prompt</label>
<textarea id="localPrompt" placeholder="You are a professional translator..."></textarea>
</div>
</div>
<!-- GTX Section -->
<div class="section">
<h2>Google Translate (Free)</h2>
<div class="setting-item">
<label for="gtxLimit">Daily Limit (Requests)</label>
<input type="number" id="gtxLimit" placeholder="1000" min="1">
</div>
<div class="setting-item">
<label for="gtxRpm">Max Speed (Requests/Min)</label>
<input type="number" id="gtxRpm" placeholder="12" min="1" max="120">
<small>Controls delay between translations to prevent blocking.</small>
</div>
<div id="gtx-usage-container" class="usage-container" style="display: none;">
<div style="display: flex; justify-content: space-between; margin-bottom: 4px;">
<label style="margin:0;">Daily Usage</label>
</div>
<div class="progress-track">
<div id="gtx-usage-bar" class="progress-bar" style="background: #2196F3; width: 0%;"></div>
</div>
<div class="progress-text">
<span id="gtx-usage-text">0 / 1000</span>
<span>Resets: Midnight</span>
</div>
</div>
</div>
<!-- Official API Section -->
<div class="section">
<h2>Google Cloud (Official)</h2>
<div class="setting-item">
<label for="apiKey">API Key</label>
<input type="password" id="apiKey" placeholder="Paste API Key here">
</div>
<div class="setting-item">
<label for="officialDailyLimit">Daily Character Limit</label>
<input type="number" id="officialDailyLimit" placeholder="50000" min="1">
</div>
<div class="setting-item">
<label for="officialMonthlyLimit">Monthly Free Tier Limit</label>
<input type="number" id="officialMonthlyLimit" placeholder="500000" min="1">
</div>
<div id="usage-container" class="usage-container">
<!-- Daily Bar -->
<div style="margin-bottom: 12px;">
<div style="display: flex; justify-content: space-between; margin-bottom: 4px;">
<label style="margin:0;">Daily Usage</label>
</div>
<div class="progress-track">
<div id="official-daily-bar" class="progress-bar" style="background: #9c27b0; width: 0%;"></div>
</div>
<div class="progress-text">
<span id="official-daily-text">0 / 50,000</span>
<span>Resets: Midnight</span>
</div>
</div>
<!-- Monthly Bar -->
<div>
<div style="display: flex; justify-content: space-between; margin-bottom: 4px;">
<label style="margin:0;">Monthly Usage</label>
</div>
<div class="progress-track">
<div id="usage-bar" class="progress-bar" style="background: #00f593; width: 0%;"></div>
</div>
<div class="progress-text">
<span id="usage-text">0 / 500,000</span>
<span>Reset: 1st of Month</span>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="footer">
<button id="save" class="action-btn">Save Settings</button>
<div id="status"></div>
</div>
<script src="popup.js"></script>
</body>
</html>