Download docs/index.html from OMNISAVALON/avalon-shifter: direct link, hf CLI and curl.
- Browser
- Download file 26.6 kB
-
https://huggingface.co/datasets/OMNISAVALON/avalon-shifter/resolve/main/docs/index.html
- Command line
-
hf download hf://datasets/OMNISAVALON/avalon-shifter/docs/index.html
-
curl -L -o index.html https://huggingface.co/datasets/OMNISAVALON/avalon-shifter/resolve/main/docs/index.html
26.6 kB
| <html lang="ru"> | |
| <head> | |
| <meta charset="utf-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <meta name="theme-color" content="#111214"> | |
| <title>Avalon.Shifter • OMNISAVALON 5 Platforms</title> | |
| <link rel="manifest" href="./manifest.webmanifest"> | |
| <link rel="icon" type="image/png" sizes="192x192" href="./icons/app-192.png"> | |
| <style> | |
| :root { | |
| color-scheme: dark light; | |
| --obsidian: #111214; | |
| --obsidian-card: #181a1f; | |
| --alabaster: #f8f6f0; | |
| --gold: #d4af37; | |
| --gold-soft: #c5a880; | |
| --ink: #16181d; | |
| --muted-dark: #9ba1ae; | |
| --muted-light: #5c606b; | |
| --brand-color: #d4af37; | |
| } | |
| * { box-sizing: border-box; } | |
| body { | |
| margin: 0; | |
| font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; | |
| background: linear-gradient(135deg, var(--obsidian) 0%, #171920 50%, var(--alabaster) 50%, #f1ede2 100%); | |
| color: #eef0f4; | |
| accent-color: var(--gold); | |
| min-height: 100vh; | |
| padding: 24px 16px; | |
| } | |
| .shell { | |
| max-width: 1080px; | |
| margin: 0 auto; | |
| background: var(--obsidian-card); | |
| border: 1px solid rgba(212, 175, 55, 0.35); | |
| border-radius: 18px; | |
| overflow: hidden; | |
| box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45); | |
| } | |
| header { | |
| display: flex; | |
| justify-content: space-between; | |
| align-items: center; | |
| flex-wrap: wrap; | |
| gap: 12px; | |
| padding: 20px 26px; | |
| border-bottom: 1px solid rgba(212, 175, 55, 0.22); | |
| background: var(--obsidian); | |
| } | |
| .hdr-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; } | |
| .brand { font-size: 1.25rem; font-weight: 700; letter-spacing: 0.04em; color: var(--gold); } | |
| .sub { font-size: 0.85rem; color: var(--muted-dark); margin-top: 4px; } | |
| .lang-btn { | |
| background: transparent; | |
| color: var(--gold); | |
| border: 1px solid var(--gold); | |
| border-radius: 999px; | |
| padding: 6px 15px; | |
| cursor: pointer; | |
| font-weight: 600; | |
| } | |
| .grid { | |
| display: grid; | |
| grid-template-columns: repeat(auto-fit, minmax(310px, 1fr)); | |
| } | |
| .pane-dark { padding: 26px; background: var(--obsidian-card); color: #f3f1ea; } | |
| .pane-light { padding: 26px; background: var(--alabaster); color: var(--ink); } | |
| h1, h2, h3 { text-wrap: balance; margin-top: 0; } | |
| h1 { margin-bottom: 12px; font-size: 1.65rem; line-height: 1.2; color: var(--gold); } | |
| h2 { margin-bottom: 10px; font-size: 1.15rem; } | |
| p, li { text-wrap: pretty; line-height: 1.55; } | |
| .cta { | |
| display: inline-block; | |
| background: var(--gold); | |
| color: #111214; | |
| text-decoration: none; | |
| font-weight: 700; | |
| padding: 12px 20px; | |
| border-radius: 10px; | |
| margin: 6px 0 8px; | |
| } | |
| .cta-outline { | |
| display: inline-block; | |
| border: 1px solid var(--ink); | |
| color: var(--ink); | |
| text-decoration: none; | |
| font-weight: 600; | |
| padding: 9px 16px; | |
| border-radius: 10px; | |
| margin-top: 6px; | |
| } | |
| .demo-box { | |
| background: #101216; | |
| border: 1px solid rgba(212, 175, 55, 0.3); | |
| border-radius: 12px; | |
| padding: 14px; | |
| margin-top: 14px; | |
| } | |
| .demo-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; } | |
| input[type="text"] { | |
| flex: 1; | |
| min-width: 180px; | |
| padding: 9px 12px; | |
| border-radius: 8px; | |
| border: 1px solid #353944; | |
| background: #1a1d24; | |
| color: #fff; | |
| font-size: 0.95rem; | |
| } | |
| .btn-gold { | |
| background: var(--gold); | |
| color: #111214; | |
| border: none; | |
| border-radius: 8px; | |
| padding: 9px 14px; | |
| font-weight: 700; | |
| cursor: pointer; | |
| } | |
| .out-row { | |
| display: flex; | |
| align-items: center; | |
| justify-content: space-between; | |
| gap: 10px; | |
| margin-top: 10px; | |
| padding: 8px 10px; | |
| background: #15181e; | |
| border-radius: 8px; | |
| } | |
| .out-txt { font-family: monospace; color: #f8f6f0; font-size: 0.95rem; word-break: break-word; } | |
| .copy { position: relative; display: inline-flex; align-items: center; gap: 6px; } | |
| .copy-button { | |
| min-inline-size: 28px; | |
| min-block-size: 28px; | |
| border: 1px solid rgba(212, 175, 55, 0.55); | |
| background: #1b1e25; | |
| color: var(--gold); | |
| border-radius: 7px; | |
| padding: 4px 10px; | |
| font-size: 0.78rem; | |
| font-weight: 600; | |
| cursor: pointer; | |
| } | |
| .tip { | |
| font-size: 0.75rem; | |
| color: var(--gold); | |
| opacity: 0; | |
| transition: opacity 0.2s ease; | |
| } | |
| .copy-button[data-copied] + .tip, | |
| .copy-button[data-failed] + .tip { opacity: 1; } | |
| @media (prefers-reduced-motion: reduce) { | |
| .tip { transition: opacity 0.05s linear; } | |
| } | |
| .chk-wrap { display: inline-flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 0.84rem; color: var(--muted-dark); cursor: pointer; } | |
| @supports not (accent-color: #d4af37) { | |
| .chk-wrap input[type="checkbox"] { | |
| position: absolute ; | |
| clip-path: inset(50%) ; | |
| overflow: hidden ; | |
| width: 1px ; | |
| height: 1px ; | |
| margin: -1px ; | |
| padding: 0 ; | |
| border: 0 ; | |
| white-space: nowrap ; | |
| } | |
| .chk-wrap span { position: relative; padding-left: 1.5rem; } | |
| .chk-wrap span::before { | |
| content: ""; position: absolute; left: 0; top: 50%; transform: translateY(-50%); | |
| width: 1rem; height: 1rem; border: 2px solid var(--gold); border-radius: 4px; background: #101216; | |
| } | |
| .chk-wrap input[type="checkbox"]:checked + span::before { background: var(--gold); } | |
| } | |
| .platforms { | |
| padding: 22px 26px; | |
| background: #14161b; | |
| border-top: 1px solid rgba(212, 175, 55, 0.2); | |
| } | |
| .plat-grid { | |
| display: grid; | |
| grid-template-columns: repeat(auto-fit, minmax(185px, 1fr)); | |
| gap: 12px; | |
| margin-top: 12px; | |
| } | |
| .plat-card { | |
| background: #1b1e25; | |
| border: 1px solid rgba(212, 175, 55, 0.25); | |
| border-radius: 12px; | |
| padding: 13px; | |
| display: flex; | |
| flex-direction: column; | |
| justify-content: space-between; | |
| gap: 8px; | |
| } | |
| .plat-title { font-weight: 700; color: var(--gold); font-size: 0.92rem; } | |
| .plat-desc { font-size: 0.8rem; color: var(--muted-dark); } | |
| .plat-links { display: flex; flex-wrap: wrap; gap: 6px; } | |
| .plat-btn { | |
| display: inline-block; | |
| font-size: 0.78rem; | |
| font-weight: 600; | |
| padding: 5px 10px; | |
| border-radius: 7px; | |
| text-decoration: none; | |
| background: rgba(212, 175, 55, 0.14); | |
| color: var(--gold); | |
| border: 1px solid rgba(212, 175, 55, 0.4); | |
| } | |
| .meta { font-size: 0.78rem; color: var(--muted-dark); font-family: monospace; word-break: break-all; } | |
| .links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; } | |
| .links a { | |
| font-size: 0.85rem; | |
| color: var(--ink); | |
| border-bottom: 1px solid var(--gold-soft); | |
| text-decoration: none; | |
| padding-bottom: 2px; | |
| } | |
| footer { | |
| padding: 14px 26px; | |
| background: #0d0e10; | |
| color: var(--muted-dark); | |
| font-size: 0.8rem; | |
| display: flex; | |
| justify-content: space-between; | |
| flex-wrap: wrap; | |
| gap: 10px; | |
| } | |
| </style> | |
| </head> | |
| <body> | |
| <div class="shell"> | |
| <header> | |
| <div> | |
| <div class="brand">AVALON.SHIFTER • OMNISAVALON</div> | |
| <div class="sub" id="hdr-sub">Волна 1 • 5 Платформ: Windows, Linux, macOS, Browser MV3 и Offline Web/Mobile PWA</div> | |
| </div> | |
| <div class="hdr-actions"> | |
| <button id="install-app" type="button" class="lang-btn" hidden>Установить PWA</button> | |
| <span id="install-status" role="status" class="meta"></span> | |
| <button class="lang-btn" id="lang-toggle" type="button">EN / RU</button> | |
| </div> | |
| </header> | |
| <div class="grid"> | |
| <section class="pane-dark"> | |
| <h1 id="hero-title">Печатай свободно на любой системе</h1> | |
| <p id="hero-desc"> | |
| Невесомая утилита без сбора данных, которая мгновенно исправляет слова и пунктуацию на стыке RU и EN, бережно защищает код и пароли и не требует внешних сервисов. | |
| </p> | |
| <a class="cta" id="dl-btn" href="https://huggingface.co/datasets/OMNISAVALON/avalon-shifter/resolve/main/dist/Avalon.Shifter-Windows-Portable.zip" download> | |
| Скачать Windows Portable (8.41 MB) | |
| </a> | |
| <div class="meta">AGLS-432-Phi: 14d11604e6fbb56a3609452a... • 2026-11-26 • 0% tracking</div> | |
| <div class="demo-box"> | |
| <div style="font-size:0.86rem;color:#c5a880;font-weight:600;" id="demo-title">Интерактивная проверка (работает оффлайн как Web/Mobile PWA):</div> | |
| <div class="demo-row"> | |
| <input id="demo-in" type="text" value="ghbdtn avalon &" aria-label="Текст с ошибкой раскладки"> | |
| <button class="btn-gold" type="button" id="demo-btn">Выровнять</button> | |
| </div> | |
| <label class="chk-wrap" for="chk-protect"> | |
| <input type="checkbox" id="chk-protect" checked> | |
| <span id="chk-protect-lbl">Защита кода и имен (avalon, camelCase, URL)</span> | |
| </label> | |
| <div class="out-row"> | |
| <div id="demo-out" class="out-txt"></div> | |
| <span class="copy"> | |
| <button type="button" class="copy-button" command="--copy" commandfor="demo-out" aria-label="Скопировать выровненный текст">Копировать</button> | |
| <span class="tip" role="status"></span> | |
| </span> | |
| </div> | |
| </div> | |
| </section> | |
| <section class="pane-light"> | |
| <h2 id="why-title">Почему Волне 1 можно доверять</h2> | |
| <ul id="why-list"> | |
| <li>100% локально и оффлайн: ноль сетевых запросов, ноль аналитики.</li> | |
| <li>Единый стандарт для 5 систем: Windows Portable (без Python), Linux, macOS, Chrome/Edge MV3 и Mobile PWA.</li> | |
| <li>Без навязанных таймеров и рамок: инструмент подстраивается под естественный ритм.</li> | |
| </ul> | |
| <h2 id="author-title">Автор и поддержка развития (EUR / CZK)</h2> | |
| <p id="author-desc" style="color:var(--muted-light);"> | |
| Создатель: <strong>Ihor Dietochevskyi (Ігор Дєточевський • OMNISAVALON)</strong>, Прага. Поддержка утилиты помогает развивать открытые локальные инструменты и авторскую музыку. | |
| </p> | |
| <a class="cta-outline" id="sup-btn" href="https://github.com/sponsors/IhorDietochevskyi" target="_blank" rel="noopener noreferrer"> | |
| Поддержать автора (EUR / CZK) | |
| </a> | |
| <div class="links"> | |
| <a href="https://huggingface.co/datasets/OMNISAVALON/avalon-shifter" target="_blank" rel="noopener noreferrer">HF Release Hub</a> | |
| <a href="https://github.com/OMNISAVALON" target="_blank" rel="noopener noreferrer">GitHub OMNISAVALON</a> | |
| <a href="https://github.com/IhorDietochevskyi" target="_blank" rel="noopener noreferrer">GitHub Author</a> | |
| <a href="https://www.youtube.com/@OMNISAVALON" target="_blank" rel="noopener noreferrer">YouTube @OMNISAVALON</a> | |
| <a href="https://www.instagram.com/omnisavalon/" target="_blank" rel="noopener noreferrer">Instagram</a> | |
| </div> | |
| </section> | |
| </div> | |
| <section class="platforms"> | |
| <h2 style="color:var(--gold);margin-bottom:4px;" id="plat-hdr">Все 5 платформ Волны 1 (Облачные зеркала и локальная установка)</h2> | |
| <div class="plat-grid"> | |
| <div class="plat-card"> | |
| <div> | |
| <div class="plat-title">Windows 10/11 Portable</div> | |
| <div class="plat-desc">AvalonShifter.exe + встроенный runtime. Python не нужен (8.41 MB).</div> | |
| </div> | |
| <div class="plat-links"> | |
| <a class="plat-btn" href="https://huggingface.co/datasets/OMNISAVALON/avalon-shifter/resolve/main/dist/Avalon.Shifter-Windows-Portable.zip" download>HF ZIP</a> | |
| <a class="plat-btn" href="https://github.com/OMNISAVALON/avalon-shifter/releases/latest/download/Avalon.Shifter-Windows-Portable.zip" target="_blank" rel="noopener noreferrer">GitHub</a> | |
| </div> | |
| </div> | |
| <div class="plat-card"> | |
| <div> | |
| <div class="plat-title">Linux X11 & Wayland</div> | |
| <div class="plat-desc">GUI + xkb-switch/Hyprland/Sway + CLI --clipboard-convert + install_linux.sh (0.095 MB).</div> | |
| </div> | |
| <div class="plat-links"> | |
| <a class="plat-btn" href="https://huggingface.co/datasets/OMNISAVALON/avalon-shifter/resolve/main/dist/Avalon.Shifter-Linux-Universal.zip" download>HF ZIP</a> | |
| <a class="plat-btn" href="https://github.com/OMNISAVALON/avalon-shifter/releases/latest/download/Avalon.Shifter-Linux-Universal.zip" target="_blank" rel="noopener noreferrer">GitHub</a> | |
| </div> | |
| </div> | |
| <div class="plat-card"> | |
| <div> | |
| <div class="plat-title">macOS Universal (.app)</div> | |
| <div class="plat-desc">Нативный бандл AvalonShifter.app + QuickAction для Shortcuts (0.095 MB).</div> | |
| </div> | |
| <div class="plat-links"> | |
| <a class="plat-btn" href="https://huggingface.co/datasets/OMNISAVALON/avalon-shifter/resolve/main/dist/Avalon.Shifter-macOS-Universal.zip" download>HF ZIP</a> | |
| <a class="plat-btn" href="https://github.com/OMNISAVALON/avalon-shifter/releases/latest/download/Avalon.Shifter-macOS-Universal.zip" target="_blank" rel="noopener noreferrer">GitHub</a> | |
| </div> | |
| </div> | |
| <div class="plat-card"> | |
| <div> | |
| <div class="plat-title">Browser Extension (MV3)</div> | |
| <div class="plat-desc">Chrome / Edge / Brave: Double-Shift, Alt+Shift+S и контекстное меню (0.025 MB).</div> | |
| </div> | |
| <div class="plat-links"> | |
| <a class="plat-btn" href="https://huggingface.co/datasets/OMNISAVALON/avalon-shifter/resolve/main/dist/Avalon.Shifter-Browser-Extension-MV3.zip" download>HF ZIP</a> | |
| <a class="plat-btn" href="https://github.com/OMNISAVALON/avalon-shifter/releases/latest/download/Avalon.Shifter-Browser-Extension-MV3.zip" target="_blank" rel="noopener noreferrer">GitHub</a> | |
| </div> | |
| </div> | |
| <div class="plat-card"> | |
| <div> | |
| <div class="plat-title">Web / iOS / Android PWA</div> | |
| <div class="plat-desc">Работает оффлайн прямо здесь. На телефоне: «Добавить на экран Домой».</div> | |
| </div> | |
| <div class="plat-links"> | |
| <a class="plat-btn" href="#demo-in">Открыть конвертер</a> | |
| </div> | |
| </div> | |
| </div> | |
| </section> | |
| <footer> | |
| <span id="ftr-left">Лицензия: LicenseRef-OMNISAVALON-Shifter-Continuum-1.0</span> | |
| <span>Волна 1 • 5 систем • Чистый оффлайн-релиз</span> | |
| </footer> | |
| </div> | |
| <script> | |
| const EN_TO_RU = { | |
| q:"й",w:"ц",e:"у",r:"к",t:"е",y:"н",u:"г",i:"ш",o:"щ",p:"з","[":"х","]":"ъ", | |
| a:"ф",s:"ы",d:"в",f:"а",g:"п",h:"р",j:"о",k:"л",l:"д",";":"ж","'":"э", | |
| z:"я",x:"ч",c:"с",v:"м",b:"и",n:"т",m:"ь",",":"б",".":"ю","&":"?" | |
| }; | |
| const I18N = { | |
| ru: { | |
| sub: "Волна 1 • 5 Платформ: Windows, Linux, macOS, Browser MV3 и Offline Web/Mobile PWA", | |
| title: "Печатай свободно на любой системе", | |
| desc: "Невесомая утилита без сбора данных, которая мгновенно исправляет слова и пунктуацию на стыке RU и EN, бережно защищает код и пароли и не требует внешних сервисов.", | |
| dl: "Скачать Windows Portable (8.41 MB)", | |
| demoTitle: "Интерактивная проверка (работает оффлайн как Web/Mobile PWA):", | |
| demoBtn: "Выровнять", | |
| protectLbl: "Защита кода и имен (avalon, camelCase, URL)", | |
| whyTitle: "Почему Волне 1 можно доверять", | |
| whyItems: [ | |
| "100% локально и оффлайн: ноль сетевых запросов, ноль аналитики.", | |
| "Единый стандарт для 5 систем: Windows Portable (без Python), Linux, macOS, Chrome/Edge MV3 и Mobile PWA.", | |
| "Без навязанных таймеров и рамок: инструмент подстраивается под естественный ритм." | |
| ], | |
| authorTitle: "Автор и поддержка развития (EUR / CZK)", | |
| authorDesc: "Создатель: <strong>Ihor Dietochevskyi (Ігор Дєточевський • OMNISAVALON)</strong>, Прага. Поддержка утилиты помогает развивать открытые локальные инструменты и авторскую музыку.", | |
| sup: "Поддержать автора (EUR / CZK)", | |
| platHdr: "Все 5 платформ Волны 1 (Облачные зеркала и локальная установка)", | |
| copied: "Скопировано", | |
| copyFailed: "Ошибка копирования" | |
| }, | |
| en: { | |
| sub: "Wave 1 • 5 Platforms: Windows, Linux, macOS, Browser MV3 and Offline Web/Mobile PWA", | |
| title: "Type freely across every platform", | |
| desc: "Featherweight zero-tracking utility that aligns mistyped RU and EN words and punctuation, protects code tokens and passwords, and runs completely offline.", | |
| dl: "Download Windows Portable (8.41 MB)", | |
| demoTitle: "Interactive offline converter (Web/Mobile PWA ready):", | |
| demoBtn: "Align", | |
| protectLbl: "Protect code tokens & links (avalon, camelCase, URL)", | |
| whyTitle: "Why Wave 1 earns trust", | |
| whyItems: [ | |
| "100% local and offline: zero network requests and zero analytics.", | |
| "Unified across 5 platforms: Windows Portable (no Python needed), Linux, macOS, Chrome/Edge MV3, and Mobile PWA.", | |
| "No artificial timers or rigid frames: adapts naturally to your workflow." | |
| ], | |
| authorTitle: "Creator & Development Support (EUR / CZK)", | |
| authorDesc: "Created by <strong>Ihor Dietochevskyi (OMNISAVALON)</strong>, Prague. Your support helps sustain open local-first utilities and independent music releases.", | |
| sup: "Support the Author (EUR / CZK)", | |
| platHdr: "All 5 Wave 1 Platforms (Cloud mirrors & offline packages)", | |
| copied: "Copied", | |
| copyFailed: "Copy failed" | |
| } | |
| }; | |
| let currentLang = "ru"; | |
| function runDemo() { | |
| const inp = document.getElementById("demo-in").value || ""; | |
| const protectCode = document.getElementById("chk-protect").checked; | |
| const out = inp.split(/(\s+)/).map((tok) => { | |
| if (!tok.trim()) return tok; | |
| if (tok === "&") return "?"; | |
| if (protectCode && (tok.toLowerCase() === "avalon" || /^(https?:\/\/|www\.|[\w.+-]+@[\w.-]+|[a-z]+[A-Z]|.*_)/.test(tok))) { | |
| return tok; | |
| } | |
| if (/^[a-z;\',.\[\]]+$/i.test(tok)) { | |
| return Array.from(tok).map((ch) => EN_TO_RU[ch.toLowerCase()] || ch).join(""); | |
| } | |
| return tok; | |
| }).join(""); | |
| document.getElementById("demo-out").textContent = out; | |
| } | |
| function toggleLang() { | |
| currentLang = currentLang === "ru" ? "en" : "ru"; | |
| const t = I18N[currentLang]; | |
| document.documentElement.lang = currentLang; | |
| document.getElementById("hdr-sub").textContent = t.sub; | |
| document.getElementById("hero-title").textContent = t.title; | |
| document.getElementById("hero-desc").textContent = t.desc; | |
| document.getElementById("dl-btn").textContent = t.dl; | |
| document.getElementById("demo-title").textContent = t.demoTitle; | |
| document.getElementById("demo-btn").textContent = t.demoBtn; | |
| document.getElementById("chk-protect-lbl").textContent = t.protectLbl; | |
| document.getElementById("why-title").textContent = t.whyTitle; | |
| document.getElementById("author-title").textContent = t.authorTitle; | |
| document.getElementById("author-desc").innerHTML = t.authorDesc; | |
| document.getElementById("sup-btn").textContent = t.sup; | |
| document.getElementById("plat-hdr").textContent = t.platHdr; | |
| const ul = document.getElementById("why-list"); | |
| ul.replaceChildren(...t.whyItems.map((txt) => { | |
| const li = document.createElement("li"); | |
| li.textContent = txt; | |
| return li; | |
| })); | |
| } | |
| const copyTimers = new WeakMap(); | |
| let lastCopiedMsg = ""; | |
| function reportCopy(button, ok) { | |
| const tip = button.nextElementSibling; | |
| clearTimeout(copyTimers.get(button)); | |
| button.removeAttribute("data-copied"); | |
| button.removeAttribute("data-failed"); | |
| let message = ok ? I18N[currentLang].copied : I18N[currentLang].copyFailed; | |
| if (message === lastCopiedMsg) message += "\u00A0"; | |
| lastCopiedMsg = message; | |
| tip.textContent = ""; | |
| void button.offsetWidth; | |
| button.setAttribute(ok ? "data-copied" : "data-failed", ""); | |
| requestAnimationFrame(() => { tip.textContent = message; }); | |
| copyTimers.set(button, setTimeout(() => { | |
| button.removeAttribute("data-copied"); | |
| button.removeAttribute("data-failed"); | |
| tip.textContent = ""; | |
| }, 2000)); | |
| } | |
| function legacyCopy(text) { | |
| const previousFocus = document.activeElement; | |
| const field = Object.assign(document.createElement("textarea"), { value: text }); | |
| field.setAttribute("readonly", ""); | |
| field.style.cssText = "position:fixed;inset-block-start:0;opacity:0"; | |
| document.body.append(field); | |
| field.select(); | |
| try { | |
| return document.execCommand("copy"); | |
| } finally { | |
| field.remove(); | |
| if (previousFocus && typeof previousFocus.focus === "function") { | |
| previousFocus.focus({ preventScroll: true }); | |
| } | |
| } | |
| } | |
| async function handleCopy(button, target) { | |
| if (!target) return; | |
| const text = target.matches("input, textarea") ? target.value : target.innerText.trim(); | |
| if (!text) return; | |
| try { | |
| await navigator.clipboard.writeText(text); | |
| reportCopy(button, true); | |
| } catch { | |
| reportCopy(button, Boolean(legacyCopy(text))); | |
| } | |
| } | |
| document.addEventListener("command", (event) => { | |
| if (event.command && event.command.startsWith("--copy")) { | |
| void handleCopy(event.source, event.target); | |
| } | |
| }, true); | |
| if (!("CommandEvent" in window)) { | |
| document.addEventListener("click", (event) => { | |
| if (event.defaultPrevented) return; | |
| const button = event.target.closest('button[command^="--copy"]'); | |
| if (!button) return; | |
| const target = document.getElementById(button.getAttribute("commandfor")); | |
| void handleCopy(button, target); | |
| }); | |
| } | |
| // Installable PWA (install-web-app) | |
| const installButton = document.getElementById("install-app"); | |
| const installStatus = document.getElementById("install-status"); | |
| const supportsWebInstall = typeof Navigator.prototype.install === "function"; | |
| let deferredInstallPrompt; | |
| if (supportsWebInstall && installButton) installButton.hidden = false; | |
| window.addEventListener("beforeinstallprompt", (event) => { | |
| event.preventDefault(); | |
| deferredInstallPrompt = event; | |
| if (!supportsWebInstall && installButton) installButton.hidden = false; | |
| }); | |
| if (installButton) { | |
| installButton.addEventListener("click", async () => { | |
| if (installButton.getAttribute("aria-disabled") === "true") return; | |
| installButton.setAttribute("aria-disabled", "true"); | |
| try { | |
| if (supportsWebInstall) { | |
| await navigator.install(); | |
| installStatus.textContent = "PWA installed."; | |
| installButton.hidden = true; | |
| } else if (deferredInstallPrompt) { | |
| const promptEvent = deferredInstallPrompt; | |
| deferredInstallPrompt = undefined; | |
| await promptEvent.prompt(); | |
| const { outcome } = await promptEvent.userChoice; | |
| installStatus.textContent = outcome === "accepted" ? "PWA installed." : "Canceled."; | |
| if (!deferredInstallPrompt) installButton.hidden = true; | |
| } | |
| } catch (err) { | |
| if (err && err.name === "AbortError") { | |
| installStatus.textContent = "Canceled."; | |
| } else { | |
| console.error(err); | |
| } | |
| } finally { | |
| installButton.removeAttribute("aria-disabled"); | |
| } | |
| }); | |
| } | |
| if ("serviceWorker" in navigator) { | |
| navigator.serviceWorker.register("./sw.js").catch(() => {}); | |
| } | |
| document.getElementById("lang-toggle").addEventListener("click", toggleLang); | |
| document.getElementById("demo-btn").addEventListener("click", runDemo); | |
| document.getElementById("chk-protect").addEventListener("change", runDemo); | |
| document.getElementById("demo-in").addEventListener("input", runDemo); | |
| runDemo(); | |
| </script> | |
| </body> | |
| </html> | |