Spaces:
Running
Running
Download index.html from Intimafit/app-clon-web: direct link, hf CLI and curl.
- Browser
- Download file 19.7 kB
-
https://huggingface.co/spaces/Intimafit/app-clon-web/resolve/main/index.html
- Command line
-
hf download hf://spaces/Intimafit/app-clon-web/index.html
-
curl -L -o index.html https://huggingface.co/spaces/Intimafit/app-clon-web/resolve/main/index.html
19.7 kB
| <html lang="es"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Web Cloner - Generador de Plantillas WordPress</title> | |
| <script src="https://cdn.tailwindcss.com"></script> | |
| <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"> | |
| <style> | |
| .iframe-container { | |
| position: relative; | |
| width: 100%; | |
| height: 0; | |
| padding-bottom: 60%; | |
| background-color: #f3f4f6; | |
| border-radius: 0.5rem; | |
| overflow: hidden; | |
| } | |
| .iframe-container iframe { | |
| position: absolute; | |
| top: 0; | |
| left: 0; | |
| width: 100%; | |
| height: 100%; | |
| border: none; | |
| } | |
| .loading-spinner { | |
| display: inline-block; | |
| width: 20px; | |
| height: 20px; | |
| border: 3px solid rgba(255,255,255,.3); | |
| border-radius: 50%; | |
| border-top-color: #fff; | |
| animation: spin 1s ease-in-out infinite; | |
| } | |
| @keyframes spin { | |
| to { transform: rotate(360deg); } | |
| } | |
| .progress-bar { | |
| height: 6px; | |
| background-color: #e5e7eb; | |
| border-radius: 3px; | |
| overflow: hidden; | |
| margin: 10px 0; | |
| } | |
| .progress-bar-fill { | |
| height: 100%; | |
| background-color: #3b82f6; | |
| transition: width 0.3s ease; | |
| } | |
| .json-viewer { | |
| font-family: 'Courier New', monospace; | |
| white-space: pre-wrap; | |
| background-color: #1e293b; | |
| color: #f8fafc; | |
| padding: 1rem; | |
| border-radius: 0.5rem; | |
| max-height: 300px; | |
| overflow-y: auto; | |
| font-size: 0.875rem; | |
| line-height: 1.5; | |
| } | |
| .toast { | |
| position: fixed; | |
| bottom: 20px; | |
| right: 20px; | |
| padding: 12px 20px; | |
| border-radius: 8px; | |
| color: white; | |
| font-weight: 500; | |
| box-shadow: 0 4px 12px rgba(0,0,0,0.15); | |
| z-index: 1000; | |
| opacity: 0; | |
| transition: opacity 0.3s ease; | |
| } | |
| .toast.show { | |
| opacity: 1; | |
| } | |
| .toast.success { | |
| background-color: #10b981; | |
| } | |
| .toast.error { | |
| background-color: #ef4444; | |
| } | |
| </style> | |
| </head> | |
| <body class="bg-gray-100 min-h-screen"> | |
| <div class="container mx-auto px-4 py-8 max-w-6xl"> | |
| <header class="mb-8 text-center"> | |
| <h1 class="text-3xl font-bold text-gray-800 mb-2"> | |
| <i class="fas fa-clone text-blue-500 mr-2"></i> Web Cloner | |
| </h1> | |
| <p class="text-gray-600">Clona cualquier página web y genera una plantilla WordPress funcional</p> | |
| </header> | |
| <div class="bg-white rounded-xl shadow-lg overflow-hidden mb-8"> | |
| <div class="p-6"> | |
| <div class="mb-6"> | |
| <label for="url-input" class="block text-sm font-medium text-gray-700 mb-2"> | |
| <i class="fas fa-link mr-2"></i> URL de la página a clonar | |
| </label> | |
| <div class="flex shadow-sm"> | |
| <input type="url" id="url-input" class="flex-1 min-w-0 block w-full px-4 py-3 rounded-l-lg border border-gray-300 focus:ring-blue-500 focus:border-blue-500" placeholder="https://ejemplo.com"> | |
| <button id="clone-button" class="inline-flex items-center px-6 py-3 border border-transparent text-base font-medium rounded-r-lg text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500"> | |
| <i class="fas fa-copy mr-2"></i> Clonar Página | |
| </button> | |
| </div> | |
| </div> | |
| <div id="preview-section" class="hidden"> | |
| <div class="flex justify-between items-center mb-4"> | |
| <h3 class="text-lg font-medium text-gray-900"> | |
| <i class="fas fa-eye mr-2 text-blue-500"></i> Vista previa | |
| </h3> | |
| <div class="flex space-x-2"> | |
| <button id="refresh-preview" class="inline-flex items-center px-3 py-1.5 border border-gray-300 shadow-sm text-sm font-medium rounded-md text-gray-700 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500"> | |
| <i class="fas fa-sync-alt mr-1.5"></i> Actualizar | |
| </button> | |
| </div> | |
| </div> | |
| <div class="progress-bar"> | |
| <div id="clone-progress" class="progress-bar-fill" style="width: 0%"></div> | |
| </div> | |
| <div class="iframe-container"> | |
| <iframe id="preview-iframe" sandbox="allow-same-origin allow-scripts allow-popups allow-forms"></iframe> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| <div id="output-section" class="bg-white rounded-xl shadow-lg overflow-hidden mb-8 hidden"> | |
| <div class="p-6"> | |
| <div class="flex justify-between items-center mb-4"> | |
| <h3 class="text-lg font-medium text-gray-900"> | |
| <i class="fas fa-file-code mr-2 text-blue-500"></i> Plantilla WordPress | |
| </h3> | |
| <div class="flex space-x-3"> | |
| <button id="copy-json" class="inline-flex items-center px-4 py-2 border border-gray-300 shadow-sm text-sm font-medium rounded-md text-gray-700 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500"> | |
| <i class="fas fa-copy mr-2"></i> Copiar JSON | |
| </button> | |
| <button id="download-json" class="inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500"> | |
| <i class="fas fa-download mr-2"></i> Descargar Plantilla | |
| </button> | |
| </div> | |
| </div> | |
| <div class="mb-4"> | |
| <label for="template-name" class="block text-sm font-medium text-gray-700 mb-2"> | |
| <i class="fas fa-tag mr-2"></i> Nombre de la plantilla | |
| </label> | |
| <input type="text" id="template-name" class="block w-full px-4 py-2 border border-gray-300 rounded-md shadow-sm focus:ring-blue-500 focus:border-blue-500" placeholder="Mi Plantilla Personalizada"> | |
| </div> | |
| <div class="json-viewer" id="json-output">El contenido JSON de la plantilla aparecerá aquí...</div> | |
| <div class="mt-6 bg-blue-50 p-4 rounded-lg"> | |
| <h4 class="text-sm font-medium text-blue-800 mb-2"> | |
| <i class="fas fa-info-circle mr-2"></i> Cómo usar esta plantilla en WordPress: | |
| </h4> | |
| <ol class="list-decimal list-inside text-sm text-blue-700 space-y-1.5 pl-4"> | |
| <li>Descarga el archivo JSON haciendo clic en "Descargar Plantilla"</li> | |
| <li>En WordPress, ve a <span class="font-semibold">Apariencia → Editor de archivos de tema</span></li> | |
| <li>Crea un nuevo archivo de plantilla (o edita uno existente)</li> | |
| <li>Pega el contenido JSON y guarda los cambios</li> | |
| <li>Asigna la plantilla a tus páginas o publicaciones</li> | |
| </ol> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- Toast notifications --> | |
| <div id="toast" class="toast"></div> | |
| <script> | |
| document.addEventListener('DOMContentLoaded', function() { | |
| // Elementos del DOM | |
| const cloneButton = document.getElementById('clone-button'); | |
| const urlInput = document.getElementById('url-input'); | |
| const previewSection = document.getElementById('preview-section'); | |
| const previewIframe = document.getElementById('preview-iframe'); | |
| const cloneProgress = document.getElementById('clone-progress'); | |
| const refreshPreview = document.getElementById('refresh-preview'); | |
| const outputSection = document.getElementById('output-section'); | |
| const jsonOutput = document.getElementById('json-output'); | |
| const copyJsonButton = document.getElementById('copy-json'); | |
| const downloadJsonButton = document.getElementById('download-json'); | |
| const templateNameInput = document.getElementById('template-name'); | |
| const toast = document.getElementById('toast'); | |
| // Función para mostrar notificaciones | |
| function showToast(message, type) { | |
| toast.textContent = message; | |
| toast.className = `toast ${type} show`; | |
| setTimeout(() => { | |
| toast.classList.remove('show'); | |
| }, 3000); | |
| } | |
| // Función para clonar la página web usando un proxy CORS | |
| cloneButton.addEventListener('click', async () => { | |
| const url = urlInput.value.trim(); | |
| if (!url) { | |
| showToast('Por favor ingresa una URL válida', 'error'); | |
| return; | |
| } | |
| try { | |
| // Mostrar estado de carga | |
| cloneButton.disabled = true; | |
| cloneButton.innerHTML = '<span class="loading-spinner mr-2"></span> Clonando...'; | |
| // Simular progreso | |
| simulateProgress(); | |
| // Usamos un proxy CORS para evitar problemas | |
| const proxyUrl = `https://api.allorigins.win/get?url=${encodeURIComponent(url)}`; | |
| // Obtener el HTML de la página | |
| const response = await fetch(proxyUrl); | |
| const data = await response.json(); | |
| if (!data.contents) { | |
| throw new Error('No se pudo obtener el contenido de la página'); | |
| } | |
| let htmlContent = data.contents; | |
| // Procesar el HTML | |
| const processedHtml = processHtmlContent(htmlContent); | |
| // Mostrar vista previa | |
| previewIframe.srcdoc = processedHtml; | |
| previewSection.classList.remove('hidden'); | |
| // Generar la plantilla WordPress | |
| generateWordPressTemplate(processedHtml, url); | |
| // Restaurar estado del botón | |
| cloneButton.disabled = false; | |
| cloneButton.innerHTML = '<i class="fas fa-copy mr-2"></i> Clonar Página'; | |
| showToast('Página clonada con éxito!', 'success'); | |
| } catch (error) { | |
| console.error('Error al clonar la página:', error); | |
| showToast('Error al clonar la página. Verifica la URL e intenta nuevamente.', 'error'); | |
| cloneButton.disabled = false; | |
| cloneButton.innerHTML = '<i class="fas fa-copy mr-2"></i> Clonar Página'; | |
| } | |
| }); | |
| // Función para procesar el HTML | |
| function processHtmlContent(html) { | |
| const parser = new DOMParser(); | |
| const doc = parser.parseFromString(html, 'text/html'); | |
| // Eliminar elementos no deseados | |
| const elementsToRemove = [ | |
| 'script[src*="ads"]', | |
| 'iframe', | |
| 'link[rel*="ads"]', | |
| 'meta[name*="ads"]', | |
| 'noscript' | |
| ]; | |
| elementsToRemove.forEach(selector => { | |
| doc.querySelectorAll(selector).forEach(el => el.remove()); | |
| }); | |
| // Convertir URLs relativas a absolutas | |
| const baseUrl = urlInput.value; | |
| doc.querySelectorAll('[href]').forEach(el => { | |
| const href = el.getAttribute('href'); | |
| if (href && !href.startsWith('http') && !href.startsWith('#')) { | |
| el.setAttribute('href', new URL(href, baseUrl).href); | |
| } | |
| }); | |
| doc.querySelectorAll('[src]').forEach(el => { | |
| const src = el.getAttribute('src'); | |
| if (src && !src.startsWith('http') && !src.startsWith('data:')) { | |
| el.setAttribute('src', new URL(src, baseUrl).href); | |
| } | |
| }); | |
| // Serializar el documento de nuevo a HTML | |
| const serializer = new XMLSerializer(); | |
| let processedHtml = serializer.serializeToString(doc); | |
| // Limpiar el HTML | |
| processedHtml = cleanHtml(processedHtml); | |
| return processedHtml; | |
| } | |
| // Función para simular progreso de clonación | |
| function simulateProgress() { | |
| let progress = 0; | |
| const progressInterval = setInterval(() => { | |
| progress += Math.floor(Math.random() * 10) + 1; | |
| if (progress >= 100) { | |
| progress = 100; | |
| clearInterval(progressInterval); | |
| } | |
| cloneProgress.style.width = `${progress}%`; | |
| }, 200); | |
| } | |
| // Función para generar la plantilla WordPress | |
| function generateWordPressTemplate(htmlContent, originalUrl) { | |
| const templateName = originalUrl ? new URL(originalUrl).hostname.replace('www.', '') + ' Clone' : 'Custom Template'; | |
| templateNameInput.value = templateName; | |
| // Crear el objeto JSON para la plantilla WordPress | |
| const wordpressTemplate = { | |
| "templateName": templateName, | |
| "templateType": "page", | |
| "templateDescription": `Plantilla clonada de ${originalUrl}`, | |
| "templateVersion": "1.0", | |
| "templateAuthor": "Web Cloner", | |
| "templateContent": htmlContent, | |
| "templateCSS": extractCssFromHtml(htmlContent), | |
| "templateJS": extractJsFromHtml(htmlContent), | |
| "createdAt": new Date().toISOString(), | |
| "compatibleWith": ["WordPress 5.0+"] | |
| }; | |
| // Mostrar el JSON formateado | |
| jsonOutput.textContent = JSON.stringify(wordpressTemplate, null, 2); | |
| // Mostrar la sección de salida | |
| outputSection.classList.remove('hidden'); | |
| // Configurar eventos para los botones de copiar y descargar | |
| setupDownloadButtons(wordpressTemplate); | |
| } | |
| // Función para extraer CSS del HTML | |
| function extractCssFromHtml(html) { | |
| const styleRegex = /<style[^>]*>([\s\S]*?)<\/style>/gi; | |
| const matches = html.match(styleRegex); | |
| return matches ? matches.join('\n') : ''; | |
| } | |
| // Función para extraer JS del HTML | |
| function extractJsFromHtml(html) { | |
| const scriptRegex = /<script[^>]*>([\s\S]*?)<\/script>/gi; | |
| const matches = html.match(scriptRegex); | |
| return matches ? matches.join('\n') : ''; | |
| } | |
| // Función para configurar los botones de copiar y descargar | |
| function setupDownloadButtons(templateData) { | |
| copyJsonButton.addEventListener('click', () => { | |
| navigator.clipboard.writeText(JSON.stringify(templateData, null, 2)) | |
| .then(() => showToast('JSON copiado al portapapeles!', 'success')) | |
| .catch(err => showToast('Error al copiar: ' + err, 'error')); | |
| }); | |
| downloadJsonButton.addEventListener('click', () => { | |
| const templateName = templateNameInput.value || 'wordpress-template'; | |
| const fileName = templateName.toLowerCase().replace(/\s+/g, '-') + '.json'; | |
| const jsonStr = JSON.stringify(templateData, null, 2); | |
| const blob = new Blob([jsonStr], { type: 'application/json' }); | |
| const url = URL.createObjectURL(blob); | |
| const a = document.createElement('a'); | |
| a.href = url; | |
| a.download = fileName; | |
| document.body.appendChild(a); | |
| a.click(); | |
| document.body.removeChild(a); | |
| URL.revokeObjectURL(url); | |
| showToast('Plantilla descargada correctamente!', 'success'); | |
| }); | |
| } | |
| // Función para limpiar HTML | |
| function cleanHtml(html) { | |
| // Eliminar espacios en blanco múltiples | |
| html = html.replace(/\s+/g, ' '); | |
| // Eliminar comentarios HTML | |
| html = html.replace(/<!--[\s\S]*?-->/g, ''); | |
| return html.trim(); | |
| } | |
| // Evento para actualizar la vista previa | |
| refreshPreview.addEventListener('click', () => { | |
| if (previewIframe.srcdoc) { | |
| previewIframe.srcdoc = previewIframe.srcdoc; | |
| showToast('Vista previa actualizada', 'success'); | |
| } | |
| }); | |
| }); | |
| </script> | |
| <p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=Intimafit/app-clon-web" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body> | |
| </html> |