Spaces:
Running
Running
Download clone.html from Aichatbot12321/Transaltor: direct link, hf CLI and curl.
- Browser
- Download file 20.2 kB
-
https://huggingface.co/spaces/Aichatbot12321/Transaltor/resolve/main/clone.html
- Command line
-
hf download hf://spaces/Aichatbot12321/Transaltor/clone.html
-
curl -L -o clone.html https://huggingface.co/spaces/Aichatbot12321/Transaltor/resolve/main/clone.html
20.2 kB
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"> | |
| <title>Gemini 3.6 Flash | Autonomous UI Cloner</title> | |
| <link rel="preconnect" href="https://fonts.googleapis.com"> | |
| <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> | |
| <link href="https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap" rel="stylesheet"> | |
| <style> | |
| :root { | |
| --bg-base: #090d16; | |
| --bg-surface: rgba(17, 24, 39, 0.75); | |
| --bg-card: rgba(30, 41, 59, 0.6); | |
| --border-glass: rgba(255, 255, 255, 0.08); | |
| --border-focus: rgba(99, 102, 241, 0.5); | |
| --primary: #6366f1; | |
| --primary-glow: rgba(99, 102, 241, 0.35); | |
| --accent: #ec4899; | |
| --accent-glow: rgba(236, 72, 153, 0.35); | |
| --emerald: #10b981; | |
| --text-main: #f8fafc; | |
| --text-muted: #94a3b8; | |
| --radius-lg: 24px; | |
| --radius-md: 16px; | |
| --radius-pill: 9999px; | |
| --shadow-premium: 0 20px 40px -15px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.1); | |
| } | |
| * { box-sizing: border-box; margin: 0; padding: 0; } | |
| body { | |
| font-family: 'Plus Jakarta Sans', sans-serif; | |
| background-color: var(--bg-base); | |
| color: var(--text-main); | |
| min-height: 100vh; | |
| display: flex; | |
| flex-direction: column; | |
| overflow-x: hidden; | |
| position: relative; | |
| } | |
| .bg-glow-1 { | |
| position: fixed; top: -150px; left: 10%; width: 500px; height: 500px; | |
| background: radial-gradient(circle, var(--primary-glow) 0%, transparent 70%); | |
| filter: blur(90px); pointer-events: none; z-index: 0; | |
| } | |
| .bg-glow-2 { | |
| position: fixed; bottom: -150px; right: 10%; width: 600px; height: 600px; | |
| background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%); | |
| filter: blur(100px); pointer-events: none; z-index: 0; | |
| } | |
| /* Mobile Warning Modal */ | |
| .mobile-warning-overlay { | |
| position: fixed; inset: 0; background: rgba(9, 13, 22, 0.85); | |
| backdrop-filter: blur(16px); z-index: 9999; | |
| display: none; align-items: center; justify-content: center; padding: 20px; | |
| } | |
| .mobile-warning-card { | |
| background: var(--bg-surface); border: 1px solid var(--border-glass); | |
| border-radius: var(--radius-lg); padding: 28px 24px; max-width: 400px; width: 100%; | |
| text-align: center; box-shadow: var(--shadow-premium); | |
| } | |
| .mobile-icon-box { | |
| width: 60px; height: 60px; border-radius: var(--radius-md); | |
| background: rgba(236, 72, 153, 0.15); border: 1px solid rgba(236, 72, 153, 0.3); | |
| display: inline-flex; align-items: center; justify-content: center; margin-bottom: 16px; | |
| } | |
| .mobile-warning-card h3 { font-size: 1.25rem; font-weight: 700; margin-bottom: 8px; } | |
| .mobile-warning-card p { font-size: 0.9rem; color: var(--text-muted); line-height: 1.5; margin-bottom: 24px; } | |
| .close-warn-btn { | |
| width: 100%; padding: 14px; background: linear-gradient(135deg, var(--primary), var(--accent)); | |
| border: none; border-radius: var(--radius-pill); color: #fff; font-weight: 600; | |
| font-size: 0.95rem; cursor: pointer; transition: 0.3s; | |
| } | |
| header { | |
| position: sticky; top: 0; z-index: 50; | |
| background: rgba(9, 13, 22, 0.8); backdrop-filter: blur(20px); | |
| border-bottom: 1px solid var(--border-glass); | |
| padding: 16px 32px; display: flex; align-items: center; justify-content: space-between; gap: 20px; | |
| } | |
| .logo-title { | |
| display: flex; align-items: center; gap: 12px; font-weight: 800; font-size: 1.25rem; | |
| letter-spacing: -0.5px; | |
| } | |
| .logo-title span { | |
| background: linear-gradient(135deg, #a5b4fc, #f472b6); | |
| -webkit-background-clip: text; -webkit-text-fill-color: transparent; | |
| } | |
| .badge-model { | |
| font-size: 0.7rem; font-weight: 700; padding: 4px 10px; border-radius: var(--radius-pill); | |
| background: rgba(99, 102, 241, 0.15); border: 1px solid rgba(99, 102, 241, 0.3); color: #a5b4fc; | |
| } | |
| .control-cluster { display: flex; align-items: center; gap: 12px; flex: 1; max-width: 650px; } | |
| .input-wrapper { position: relative; flex: 1; display: flex; align-items: center; } | |
| .input-wrapper svg { position: absolute; left: 18px; color: var(--text-muted); pointer-events: none; } | |
| input[type="url"] { | |
| width: 100%; padding: 14px 18px 14px 46px; border-radius: var(--radius-pill); | |
| background: var(--bg-card); border: 1px solid var(--border-glass); | |
| color: var(--text-main); font-size: 0.95rem; outline: none; transition: 0.3s; | |
| } | |
| input[type="url"]:focus { | |
| border-color: var(--border-focus); background: rgba(30, 41, 59, 0.9); | |
| box-shadow: 0 0 0 4px var(--primary-glow); | |
| } | |
| .clone-btn { | |
| padding: 14px 28px; border-radius: var(--radius-pill); | |
| background: linear-gradient(135deg, var(--primary), #4338ca); | |
| color: #fff; font-weight: 600; font-size: 0.95rem; border: none; | |
| cursor: pointer; display: inline-flex; align-items: center; gap: 8px; | |
| box-shadow: 0 4px 20px var(--primary-glow); transition: 0.3s; white-space: nowrap; | |
| } | |
| .clone-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 24px rgba(99, 102, 241, 0.5); } | |
| .clone-btn:disabled { opacity: 0.5; transform: none; cursor: not-allowed; } | |
| .workspace { | |
| flex: 1; padding: 24px 32px; display: grid; | |
| grid-template-columns: 1fr 1fr 1fr; gap: 24px; z-index: 10; | |
| } | |
| .panel { | |
| background: var(--bg-surface); border: 1px solid var(--border-glass); | |
| border-radius: var(--radius-lg); display: flex; flex-direction: column; | |
| overflow: hidden; height: calc(100vh - 120px); box-shadow: var(--shadow-premium); | |
| backdrop-filter: blur(12px); | |
| } | |
| .panel-top { | |
| padding: 16px 20px; border-bottom: 1px solid var(--border-glass); | |
| display: flex; align-items: center; justify-content: space-between; background: rgba(255, 255, 255, 0.02); | |
| } | |
| .panel-title { font-size: 0.9rem; font-weight: 700; display: flex; align-items: center; gap: 8px; } | |
| .panel-tag { font-size: 0.7rem; font-weight: 600; padding: 4px 10px; border-radius: var(--radius-pill); } | |
| .tag-target { background: rgba(148, 163, 184, 0.1); color: var(--text-muted); } | |
| .tag-stream { background: rgba(99, 102, 241, 0.15); color: #a5b4fc; } | |
| .tag-live { background: rgba(16, 185, 129, 0.15); color: #6ee7b7; } | |
| .panel-body { flex: 1; overflow: auto; position: relative; display: flex; flex-direction: column; } | |
| .screenshot-container { padding: 16px; display: flex; justify-content: center; align-items: flex-start; } | |
| .screenshot-container img { | |
| max-width: 100%; height: auto; border-radius: var(--radius-md); | |
| border: 1px solid var(--border-glass); box-shadow: 0 10px 25px rgba(0,0,0,0.4); | |
| animation: fadeIn 0.4s ease; | |
| } | |
| .code-viewer { | |
| flex: 1; padding: 20px; font-family: 'JetBrains Mono', monospace; | |
| font-size: 0.8rem; line-height: 1.6; color: #cbd5e1; | |
| overflow-y: auto; word-break: break-all; white-space: pre-wrap; | |
| } | |
| #codeCanvas.streaming::after { content: "▋"; color: var(--accent); animation: blink 1s infinite; } | |
| .render-frame-container { flex: 1; position: relative; width: 100%; height: 100%; background: #ffffff; } | |
| #sandboxFrame { width: 100%; height: 100%; border: none; display: block; } | |
| .panel-footer { | |
| padding: 14px 20px; border-top: 1px solid var(--border-glass); | |
| background: rgba(255, 255, 255, 0.02); display: flex; flex-direction: column; gap: 12px; align-items: stretch; | |
| } | |
| .download-wrapper { display: flex; justify-content: flex-end; } | |
| .download-btn { | |
| padding: 10px 20px; border-radius: var(--radius-pill); | |
| background: linear-gradient(135deg, var(--emerald), #059669); | |
| color: #fff; font-weight: 600; font-size: 0.85rem; border: none; | |
| cursor: pointer; display: none; align-items: center; gap: 6px; | |
| box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3); transition: 0.3s; | |
| } | |
| .download-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4); } | |
| .disclaimer-box { | |
| font-size: 0.75rem; color: var(--text-muted); text-align: center; | |
| line-height: 1.4; background: rgba(0,0,0,0.2); padding: 8px; border-radius: 8px; | |
| } | |
| .empty-state { | |
| flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; | |
| gap: 12px; color: var(--text-muted); font-size: 0.85rem; padding: 20px; text-align: center; | |
| } | |
| .empty-state svg { width: 36px; height: 36px; opacity: 0.4; } | |
| .status-toast { | |
| position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%) translateY(30px); | |
| background: rgba(17, 24, 39, 0.9); border: 1px solid var(--border-glass); | |
| padding: 12px 24px; border-radius: var(--radius-pill); backdrop-filter: blur(16px); | |
| display: flex; align-items: center; gap: 12px; font-size: 0.9rem; font-weight: 600; | |
| box-shadow: 0 10px 30px rgba(0,0,0,0.5); z-index: 100; opacity: 0; | |
| pointer-events: none; transition: 0.4s cubic-bezier(0.16, 1, 0.3, 1); | |
| } | |
| .status-toast.visible { opacity: 1; transform: translateX(-50%) translateY(0); pointer-events: auto; } | |
| .spinner-glow { | |
| width: 18px; height: 18px; border: 2px solid rgba(255,255,255,0.1); | |
| border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; | |
| } | |
| /* Responsive Rules */ | |
| @media (max-width: 1024px) { | |
| .workspace { grid-template-columns: 1fr; height: auto; } | |
| .panel { height: 600px; } | |
| header { flex-direction: column; align-items: stretch; gap: 14px; padding: 16px; } | |
| .control-cluster { max-width: 100%; } | |
| .logo-title { justify-content: center; } | |
| } | |
| @keyframes spin { to { transform: rotate(360deg); } } | |
| @keyframes blink { 50% { opacity: 0; } } | |
| @keyframes fadeIn { from { opacity: 0; transform: scale(0.98); } to { opacity: 1; transform: scale(1); } } | |
| </style> | |
| </head> | |
| <body> | |
| <div class="bg-glow-1"></div> | |
| <div class="bg-glow-2"></div> | |
| <div class="mobile-warning-overlay" id="mobileWarning"> | |
| <div class="mobile-warning-card"> | |
| <div class="mobile-icon-box"> | |
| <svg width="28" height="28" viewBox="0 0 24 24" fill="none" stroke="#ec4899" stroke-width="2"><rect x="5" y="2" width="14" height="20" rx="2" ry="2"></rect><line x1="12" y1="18" x2="12.01" y2="18"></line></svg> | |
| </div> | |
| <h3>Desktop Recommended</h3> | |
| <p>This workstation features side-by-side DOM inspection, AI streaming, and interactive rendering tailored for larger displays.</p> | |
| <button class="close-warn-btn" onclick="dismissMobileWarning()">Continue Anyway</button> | |
| </div> | |
| </div> | |
| <header> | |
| <div class="logo-title"> | |
| <svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"><polygon points="12 2 2 7 12 12 22 7 12 2"></polygon><polyline points="2 17 12 22 22 17"></polyline><polyline points="2 12 12 17 22 12"></polyline></svg> | |
| <span>AUTOCLONE AI</span> | |
| <span class="badge-model">GEMINI 3.6 FLASH</span> | |
| </div> | |
| <div class="control-cluster"> | |
| <div class="input-wrapper"> | |
| <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line></svg> | |
| <input type="url" id="targetUrlInput" placeholder="Enter full URL (e.g., https://example.com)" value="https://example.com" required> | |
| </div> | |
| <button class="clone-btn" id="startBtn" onclick="initiateAutonomousClone()"> | |
| <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"><polygon points="5 3 19 12 5 21 5 3"></polygon></svg> | |
| Start Clone | |
| </button> | |
| </div> | |
| </header> | |
| <main class="workspace"> | |
| <!-- Panel 1: Original Target Screenshot --> | |
| <section class="panel"> | |
| <div class="panel-top"> | |
| <div class="panel-title">Original Target</div> | |
| <span class="panel-tag tag-target">Scraped Snapshot</span> | |
| </div> | |
| <div class="panel-body" id="targetSnapshotBody"> | |
| <div class="empty-state"> | |
| <svg fill="none" stroke="currentColor" viewBox="0 0 24 24" stroke-width="1.5"><rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect><circle cx="8.5" cy="8.5" r="1.5"></circle><polyline points="21 15 16 10 5 21"></polyline></svg> | |
| <span>Awaiting target URL execution...</span> | |
| </div> | |
| </div> | |
| </section> | |
| <!-- Panel 2: Live Code Stream --> | |
| <section class="panel"> | |
| <div class="panel-top"> | |
| <div class="panel-title">AI Engine Output</div> | |
| <span class="panel-tag tag-stream" id="streamBadge">Real-time SSE</span> | |
| </div> | |
| <div class="panel-body"> | |
| <pre class="code-viewer"><code id="codeCanvas">Click "Start Clone" to stream code...</code></pre> | |
| </div> | |
| </section> | |
| <!-- Panel 3: Live Interactive HTML Sandbox --> | |
| <section class="panel"> | |
| <div class="panel-top"> | |
| <div class="panel-title">Live Working Sandbox</div> | |
| <span class="panel-tag tag-live" id="renderBadge">Awaiting Code</span> | |
| </div> | |
| <div class="panel-body" id="liveContainerBody"> | |
| <div class="empty-state" id="iframePlaceholder"> | |
| <svg fill="none" stroke="currentColor" viewBox="0 0 24 24" stroke-width="1.5"><polyline points="16 18 22 12 16 6"></polyline><polyline points="8 6 2 12 8 18"></polyline></svg> | |
| <span>The AI's generated HTML, CSS, and JavaScript will run live here.</span> | |
| </div> | |
| <div class="render-frame-container" id="frameWrapper" style="display: none;"> | |
| <!-- IFRAME SECURITY WARNING FIXED: Removed allow-same-origin to properly sandbox untrusted code --> | |
| <iframe id="sandboxFrame" sandbox="allow-scripts allow-modals"></iframe> | |
| </div> | |
| </div> | |
| <div class="panel-footer"> | |
| <div class="download-wrapper"> | |
| <button class="download-btn" id="downloadHtmlBtn" onclick="triggerCodeDownload()"> | |
| <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path><polyline points="7 10 12 15 17 10"></polyline><line x1="12" y1="15" x2="12" y2="3"></line></svg> | |
| Download HTML Code | |
| </button> | |
| </div> | |
| <div class="disclaimer-box"> | |
| ⚠️ <strong>Disclaimer:</strong> Use this only when you have permission. Cannot copy CAPTCHA websites, Google websites, or Huggingface/Cloud network blocked websites. | |
| </div> | |
| </div> | |
| </section> | |
| </main> | |
| <div class="status-toast" id="statusPill"> | |
| <div class="spinner-glow" id="statusSpinner"></div> | |
| <span id="statusMessage">Processing pipeline...</span> | |
| </div> | |
| <script> | |
| let activeEventSource = null; | |
| let finalCompiledCode = ""; | |
| window.addEventListener('DOMContentLoaded', () => { | |
| if (window.innerWidth <= 1024) { | |
| document.getElementById('mobileWarning').style.display = 'flex'; | |
| } | |
| }); | |
| function dismissMobileWarning() { | |
| document.getElementById('mobileWarning').style.display = 'none'; | |
| } | |
| function displayToast(msg, loading = true) { | |
| const pill = document.getElementById('statusPill'); | |
| const label = document.getElementById('statusMessage'); | |
| const spinner = document.getElementById('statusSpinner'); | |
| label.innerText = msg; | |
| spinner.style.display = loading ? 'block' : 'none'; | |
| pill.classList.add('visible'); | |
| if (!loading) setTimeout(() => pill.classList.remove('visible'), 5000); | |
| } | |
| function cleanMarkdownWrapper(raw) { | |
| let text = raw.trim(); | |
| if (text.startsWith("```html")) text = text.substring(7); | |
| if (text.startsWith("```")) text = text.substring(3); | |
| if (text.endsWith("```")) text = text.slice(0, -3); | |
| return text.trim(); | |
| } | |
| function renderToSandbox(rawHtml) { | |
| const cleanHtml = cleanMarkdownWrapper(rawHtml); | |
| finalCompiledCode = cleanHtml; | |
| document.getElementById('iframePlaceholder').style.display = 'none'; | |
| const wrapper = document.getElementById('frameWrapper'); | |
| wrapper.style.display = 'block'; | |
| const iframe = document.getElementById('sandboxFrame'); | |
| iframe.srcdoc = cleanHtml; | |
| document.getElementById('renderBadge').innerText = 'Live Interactive DOM'; | |
| document.getElementById('downloadHtmlBtn').style.display = 'inline-flex'; | |
| } | |
| function initiateAutonomousClone() { | |
| let url = document.getElementById('targetUrlInput').value.trim(); | |
| if (!url) return; | |
| if (!url.startsWith('http://') && !url.startsWith('https://')) { | |
| url = 'https://' + url; | |
| document.getElementById('targetUrlInput').value = url; | |
| } | |
| const startBtn = document.getElementById('startBtn'); | |
| const codeCanvas = document.getElementById('codeCanvas'); | |
| const streamBadge = document.getElementById('streamBadge'); | |
| startBtn.disabled = true; | |
| codeCanvas.innerHTML = ''; | |
| codeCanvas.classList.add('streaming'); | |
| finalCompiledCode = ""; | |
| document.getElementById('targetSnapshotBody').innerHTML = ` | |
| <div class="empty-state"> | |
| <div class="spinner-glow"></div> | |
| <span>Running headless browser extraction (Fast Mode)...</span> | |
| </div>`; | |
| document.getElementById('frameWrapper').style.display = 'none'; | |
| document.getElementById('iframePlaceholder').style.display = 'flex'; | |
| document.getElementById('downloadHtmlBtn').style.display = 'none'; | |
| document.getElementById('renderBadge').innerText = 'Awaiting Code'; | |
| streamBadge.innerText = 'Pass 1 (Generating)'; | |
| if (activeEventSource) activeEventSource.close(); | |
| activeEventSource = new EventSource('/api/clone-website?url=' + encodeURIComponent(url)); | |
| activeEventSource.onmessage = function(e) { | |
| const data = JSON.parse(e.data); | |
| if (data.type === 'log') { | |
| displayToast(data.message, true); | |
| } | |
| else if (data.type === 'screenshot_original') { | |
| document.getElementById('targetSnapshotBody').innerHTML = ` | |
| <div class="screenshot-container"> | |
| <img src="${data.image}" alt="Scraped Target Screenshot"> | |
| </div>`; | |
| } | |
| else if (data.type === 'token') { | |
| codeCanvas.textContent += data.text; | |
| const container = codeCanvas.parentElement; | |
| container.scrollTop = container.scrollHeight; | |
| } | |
| else if (data.type === 'start_pass_2') { | |
| streamBadge.innerText = 'Pass 2 (Refining)'; | |
| renderToSandbox(codeCanvas.textContent); | |
| codeCanvas.textContent += "\n\n/* ==========================================\n PASS 2: ANALYZING DIFFERENCES & REFINING DOM\n ========================================== */\n\n"; | |
| } | |
| else if (data.type === 'done') { | |
| displayToast('Cloning Complete! Live DOM Running.', false); | |
| codeCanvas.classList.remove('streaming'); | |
| renderToSandbox(codeCanvas.textContent); | |
| streamBadge.innerText = 'Completed'; | |
| teardown(); | |
| } | |
| else if (data.type === 'error') { | |
| displayToast('Error: ' + data.message, false); | |
| teardown(); | |
| } | |
| }; | |
| activeEventSource.onerror = function() { | |
| if (activeEventSource.readyState === EventSource.CLOSED) return; | |
| displayToast('Pipeline stream disconnected.', false); | |
| teardown(); | |
| }; | |
| function teardown() { | |
| if (activeEventSource) activeEventSource.close(); | |
| startBtn.disabled = false; | |
| codeCanvas.classList.remove('streaming'); | |
| } | |
| } | |
| function triggerCodeDownload() { | |
| if (!finalCompiledCode) return; | |
| const blob = new Blob([finalCompiledCode], { type: "text/html;charset=utf-8" }); | |
| const blobUrl = URL.createObjectURL(blob); | |
| const downloadLink = document.createElement("a"); | |
| downloadLink.href = blobUrl; | |
| downloadLink.download = "cloned_page.html"; | |
| document.body.appendChild(downloadLink); | |
| downloadLink.click(); | |
| document.body.removeChild(downloadLink); | |
| URL.revokeObjectURL(blobUrl); | |
| } | |
| </script> | |
| <script src="nav-sidebar.js" data-pos="bl"></script> | |
| </body> | |
| </html> |