Spaces:
Running
Running
привет
Browse filesFiles changed (2)
- README.md+8-5
- index.html+172-19
12345678910---title: Ica Code Wizardemoji: 💻colorFrom: graycolorTo: yellowsdk: staticpinned: false---Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference12345678910111213---title: ICA Code Wizard 🔮colorFrom: redcolorTo: greenemoji: 🐳sdk: staticpinned: falsetags:- deepsite-v3---# Welcome to your new DeepSite project!This project was created with [DeepSite](https://huggingface.co/deepsite).
12345678910111213141516171819<!doctype html><html><head><meta charset="utf-8" /><meta name="viewport" content="width=device-width" /><title>My static Space</title><link rel="stylesheet" href="style.css" /></head><body><div class="card"><h1>Welcome to your static Space!</h1><p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p><p>Also don't forget to check the<a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.</p></div></body></html>123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172<!doctype html><html lang="ru"><head><meta charset="utf-8" /><meta name="viewport" content="width=device-width,initial-scale=1" /><title>ICA Code Wizard 🔮</title><style>body {font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial;padding: 24px;max-width: 640px;margin: 36px auto;color: #111;background: #f7f7f8;}.card {background: #fff;padding: 18px;border-radius: 12px;box-shadow: 0 6px 18px rgba(0,0,0,0.06);}label { display:block; margin-bottom:8px; font-weight:600 }input[type="text"] {width:100%;padding:10px 12px;font-size:16px;border:1px solid #ddd;border-radius:8px;box-sizing:border-box;}.row { display:flex; gap:8px; margin-top:12px; }button {padding:10px 14px;font-size:15px;border-radius:8px;border: none;cursor: pointer;background:#2563eb;color:white;}button.secondary { background:#6b7280; }pre {background:#111827;color:#f9fafb;padding:12px;border-radius:8px;overflow-x:auto;margin-top:12px;font-size:16px;}.hint { color:#6b7280; margin-top:8px; font-size:13px }</style></head><body><div class="card"><h1>ICA Code Wizard 🔮</h1><p class="hint">Введи магическую переменную (например <code>0170</code>) и нажми «Сгенерировать».</p><label for="inputVar">Магическая переменная 🔢✨</label><input id="inputVar" type="text" value="0170" /><div class="row"><button id="btnGen">✨ Сгенерировать</button><button id="btnCopy" class="secondary" title="Копировать результат">📋 Копировать</button><button id="btnAuto" class="secondary" title="Генерировать автоматически при загрузке">⚡ Авто</button></div><label style="margin-top:14px">Результат</label><pre id="result">✨ Жду твою магию...</pre><p class="hint">Магический алгоритм: <code>SHA-256("C673_ICA" + ввод + MM + DD)</code>, затем берем подстроку хэша с позиции <code>день+1</code> по <code>день+13</code> ✨</p></div><script>async function sha256Hex(message) {const data = new TextEncoder().encode(message);const hashBuffer = await crypto.subtle.digest("SHA-256", data);const bytes = new Uint8Array(hashBuffer);return Array.from(bytes, b => ("0" + b.toString(16)).slice(-2)).join("");}function getMMDD(date = new Date()) {const mm = String(date.getMonth() + 1).padStart(2, "0");const dd = String(date.getDate()).padStart(2, "0");return { mm, dd, date };}async function generateCode(inputValue) {// prepare inputconst trimmed = String(inputValue ?? "").trim();if (trimmed.length === 0) {throw new Error("Пустая строка. Введите переменную.");}const { mm, dd, date } = getMMDD();const base = "C673_ICA" + trimmed + mm + dd;const hex = await sha256Hex(base);// расчет индексов как в оригинале: substring(day+1, day+13)// substring uses indices where end is exclusive.const day = date.getDate();const start = day + 1;const end = day + 13;// защитимся от выхода за длинуconst safeStart = Math.max(0, Math.min(start, hex.length));const safeEnd = Math.max(safeStart, Math.min(end, hex.length));const res = hex.substring(safeStart, safeEnd);return { base, hex, res, mm, dd, start: safeStart, end: safeEnd };}const inputEl = document.getElementById("inputVar");const resEl = document.getElementById("result");const btnGen = document.getElementById("btnGen");const btnCopy = document.getElementById("btnCopy");const btnAuto = document.getElementById("btnAuto");let autoOn = false;async function doGenerate(showErrors = true) {try {btnGen.disabled = true;resEl.textContent = "Генерация…";const info = await generateCode(inputEl.value);resEl.textContent = info.res || "Пустой результат (проверь ввод/дату)";btnGen.disabled = false;return info;} catch (e) {btnGen.disabled = false;resEl.textContent = "Ошибка: " + (e.message || e);if (showErrors) console.error(e);}}btnGen.addEventListener("click", () => doGenerate());btnCopy.addEventListener("click", async () => {const text = resEl.textContent || "";if (!text || text.startsWith("Ошибка") || text === "Генерация…") {return;}try {await navigator.clipboard.writeText(text);btnCopy.textContent = "Скопировано!";setTimeout(() => btnCopy.textContent = "Копировать", 1400);} catch {btnCopy.textContent = "Не удалось";setTimeout(() => btnCopy.textContent = "Копировать", 1400);}});btnAuto.addEventListener("click", () => {autoOn = !autoOn;btnAuto.textContent = autoOn ? "Авто: вкл" : "Авто";if (autoOn) doGenerate(false);});// allow pressing Enter in input to generateinputEl.addEventListener("keydown", (e) => {if (e.key === "Enter") {e.preventDefault();doGenerate();}});// generate on load oncewindow.addEventListener("load", () => {// короткая задержка для красотыsetTimeout(() => doGenerate(false), 120);});</script><script src="https://huggingface.co/deepsite/deepsite-badge.js"></script></body></html>
README.md+8-5
index.html+172-19