2ch commited on
Commit
f95e32b
·
verified ·
1 Parent(s): 7fcfdb0

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +48 -2
index.html CHANGED
@@ -171,6 +171,7 @@
171
  .actions {
172
  display: flex;
173
  justify-content: center;
 
174
  }
175
 
176
  .btn {
@@ -201,7 +202,19 @@
201
  .btn.success {
202
  background: var(--success);
203
  }
204
-
 
 
 
 
 
 
 
 
 
 
 
 
205
  .toast {
206
  position: fixed;
207
  bottom: 30px;
@@ -286,7 +299,8 @@
286
  </div>
287
 
288
  <div class="actions">
289
- <button class="btn" id="processBtn" type="button">сделать</button>
 
290
  </div>
291
 
292
  </div>
@@ -349,6 +363,36 @@
349
  const key = `${lang}${mode.charAt(0).toUpperCase() + mode.slice(1)}`; // ruLight, enFull …
350
  return maps[key] ?? {};
351
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
352
 
353
  function fixTypography(str) {
354
  return str
@@ -433,6 +477,8 @@
433
 
434
  const textEl = document.getElementById('text');
435
  const btn = document.getElementById('processBtn');
 
 
436
  const charCountEl = document.getElementById('charCount');
437
 
438
  btn.addEventListener('click', process);
 
171
  .actions {
172
  display: flex;
173
  justify-content: center;
174
+ gap: 12px;
175
  }
176
 
177
  .btn {
 
202
  .btn.success {
203
  background: var(--success);
204
  }
205
+ .btn-secondary {
206
+ background: var(--bg-tertiary);
207
+ color: var(--text-secondary);
208
+ border: 1px solid var(--border);
209
+ padding: 12px 28px;
210
+ }
211
+
212
+ .btn-secondary:hover {
213
+ background: var(--toggle-bg);
214
+ color: var(--text-primary);
215
+ box-shadow: none;
216
+ transform: translateY(-1px);
217
+ }
218
  .toast {
219
  position: fixed;
220
  bottom: 30px;
 
299
  </div>
300
 
301
  <div class="actions">
302
+ <button class="btn btn-secondary" id="revertBtn" type="button">вернуть</button>
303
+ <button class="btn" id="processBtn" type="button">сделать</button>
304
  </div>
305
 
306
  </div>
 
363
  const key = `${lang}${mode.charAt(0).toUpperCase() + mode.slice(1)}`; // ruLight, enFull …
364
  return maps[key] ?? {};
365
  }
366
+
367
+ function invertMap(map) {
368
+ const inv = {};
369
+ for (const [k, v] of Object.entries(map)) {
370
+ inv[v] = k;
371
+ }
372
+ return inv;
373
+ }
374
+
375
+ async function revert() {
376
+ const settings = getSettings();
377
+ const map = invertMap(getActiveMap(settings));
378
+
379
+ let text = textEl.value;
380
+ if (!text.trim()) {
381
+ showToast('⚠️ поле пустое');
382
+ return;
383
+ }
384
+
385
+ text = replaceByMap(text, map);
386
+ textEl.value = text;
387
+ updateCharCount();
388
+
389
+ try {
390
+ await copyToClipboard(text);
391
+ showToast('<span class="icon">↩️</span>возвращено и скопировано');
392
+ } catch {
393
+ showToast('<span class="icon">↩️</span>возвращено');
394
+ }
395
+ }
396
 
397
  function fixTypography(str) {
398
  return str
 
477
 
478
  const textEl = document.getElementById('text');
479
  const btn = document.getElementById('processBtn');
480
+ const revertBtn = document.getElementById('revertBtn');
481
+ revertBtn.addEventListener('click', revert);
482
  const charCountEl = document.getElementById('charCount');
483
 
484
  btn.addEventListener('click', process);