Spaces:
Running
Running
Download index.html from docentedigital/app: direct link, hf CLI and curl.
- Browser
- Download file 8.72 kB
-
https://huggingface.co/spaces/docentedigital/app/resolve/main/index.html
- Command line
-
hf download hf://spaces/docentedigital/app/index.html
-
curl -L -o index.html https://huggingface.co/spaces/docentedigital/app/resolve/main/index.html
8.72 kB
| <html lang="es"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Lector de PDF con Efecto de Página</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> | |
| .book { | |
| perspective: 2000px; | |
| } | |
| .page { | |
| transform-style: preserve-3d; | |
| transform-origin: left center; | |
| transition: transform 1s ease; | |
| position: absolute; | |
| box-shadow: 0 0 10px rgba(0,0,0,0.3); | |
| background: white; | |
| backface-visibility: hidden; | |
| } | |
| .page.flipped { | |
| transform: rotateY(-180deg); | |
| } | |
| .page-content { | |
| position: absolute; | |
| width: 100%; | |
| height: 100%; | |
| display: flex; | |
| justify-content: center; | |
| align-items: center; | |
| backface-visibility: hidden; | |
| } | |
| .page-back { | |
| transform: rotateY(180deg); | |
| background: #f5f5f5; | |
| } | |
| .page-shadow { | |
| position: absolute; | |
| width: 100%; | |
| height: 100%; | |
| background: linear-gradient(to right, rgba(0,0,0,0.2), transparent); | |
| opacity: 0; | |
| transition: opacity 0.5s ease; | |
| } | |
| .flipping .page-shadow { | |
| opacity: 1; | |
| } | |
| .controls { | |
| background: rgba(255,255,255,0.9); | |
| backdrop-filter: blur(5px); | |
| } | |
| @keyframes pageTurn { | |
| 0% { transform: rotateY(0); } | |
| 100% { transform: rotateY(-180deg); } | |
| } | |
| </style> | |
| </head> | |
| <body class="bg-gray-100 min-h-screen flex flex-col items-center justify-center p-4"> | |
| <div class="w-full max-w-6xl"> | |
| <h1 class="text-3xl font-bold text-center mb-6 text-indigo-800">Lector de PDF Interactivo</h1> | |
| <div class="book relative w-full h-[600px] bg-gray-200 rounded-lg shadow-xl overflow-hidden mb-8"> | |
| <!-- Contenedor de páginas --> | |
| <div id="pages-container" class="relative w-full h-full flex items-center justify-center"> | |
| <!-- Las páginas se generarán dinámicamente con JavaScript --> | |
| </div> | |
| <!-- Controles --> | |
| <div class="controls absolute bottom-0 left-0 right-0 p-4 flex justify-between items-center"> | |
| <button id="prev-btn" class="bg-indigo-600 hover:bg-indigo-700 text-white px-4 py-2 rounded-lg shadow transition"> | |
| <i class="fas fa-arrow-left mr-2"></i> Anterior | |
| </button> | |
| <span id="page-counter" class="text-gray-700 font-medium">Página 1 de 10</span> | |
| <button id="next-btn" class="bg-indigo-600 hover:bg-indigo-700 text-white px-4 py-2 rounded-lg shadow transition"> | |
| Siguiente <i class="fas fa-arrow-right ml-2"></i> | |
| </button> | |
| </div> | |
| <!-- Cargador de archivos --> | |
| <div class="absolute top-0 left-0 right-0 p-4 flex justify-center"> | |
| <label class="cursor-pointer bg-white hover:bg-gray-50 text-indigo-600 px-4 py-2 rounded-lg shadow border border-indigo-300 transition flex items-center"> | |
| <i class="fas fa-file-pdf mr-2"></i> | |
| Seleccionar PDF | |
| <input id="pdf-input" type="file" accept=".pdf" class="hidden"> | |
| </label> | |
| </div> | |
| </div> | |
| <div class="text-center text-gray-600"> | |
| <p>Haz clic en cualquier parte de la página para voltearla o usa los botones de navegación</p> | |
| </div> | |
| </div> | |
| <script> | |
| document.addEventListener('DOMContentLoaded', function() { | |
| // Variables de estado | |
| let currentPage = 1; | |
| let totalPages = 10; // Valor inicial, se actualiza al cargar PDF | |
| let isFlipping = false; | |
| // Elementos del DOM | |
| const pagesContainer = document.getElementById('pages-container'); | |
| const prevBtn = document.getElementById('prev-btn'); | |
| const nextBtn = document.getElementById('next-btn'); | |
| const pageCounter = document.getElementById('page-counter'); | |
| const pdfInput = document.getElementById('pdf-input'); | |
| // Generar páginas de muestra (simulando PDF) | |
| function generateSamplePages() { | |
| pagesContainer.innerHTML = ''; | |
| for (let i = 1; i <= totalPages; i++) { | |
| const page = document.createElement('div'); | |
| page.className = `page ${i === 1 ? 'z-10' : 'z-0'} ${i < currentPage ? 'flipped' : ''}`; | |
| page.style.width = '80%'; | |
| page.style.height = '90%'; | |
| page.dataset.pageNumber = i; | |
| // Contenido frontal de la página | |
| const frontContent = document.createElement('div'); | |
| frontContent.className = 'page-content'; | |
| frontContent.innerHTML = ` | |
| <div class="text-center p-8"> | |
| <h2 class="text-2xl font-bold mb-4 text-indigo-700">Página ${i}</h2> | |
| <p class="text-gray-700">Contenido de muestra de la página ${i}. Haz clic para voltear.</p> | |
| ${i === 1 ? '<p class="mt-4 text-sm text-gray-500">O selecciona un archivo PDF real arriba</p>' : ''} | |
| </div> | |
| <div class="page-shadow"></div> | |
| `; | |
| // Contenido trasero de la página | |
| const backContent = document.createElement('div'); | |
| backContent.className = 'page-content page-back'; | |
| backContent.innerHTML = ` | |
| <div class="text-center p-8"> | |
| <p class="text-gray-700">Reverso de la página ${i}</p> | |
| </div> | |
| `; | |
| page.appendChild(frontContent); | |
| page.appendChild(backContent); | |
| pagesContainer.appendChild(page); | |
| // Evento de clic para voltear página | |
| frontContent.addEventListener('click', function() { | |
| if (!isFlipping && i === currentPage) { | |
| flipPage(i); | |
| } | |
| }); | |
| } | |
| updatePageCounter(); | |
| updatePageVisibility(); | |
| } | |
| // Voltear página con animación | |
| function flipPage(pageNum) { | |
| if (isFlipping || pageNum > totalPages) return; | |
| isFlipping = true; | |
| const page = document.querySelector(`.page[data-page-number="${pageNum}"]`); | |
| page.classList.add('flipping'); | |
| setTimeout(() => { | |
| page.classList.add('flipped'); | |
| currentPage = pageNum + 1; | |
| updatePageCounter(); | |
| updatePageVisibility(); | |
| setTimeout(() => { | |
| page.classList.remove('flipping'); | |
| isFlipping = false; | |
| }, 300); | |
| }, 100); | |
| } | |
| // Actualizar contador de páginas | |
| function updatePageCounter() { | |
| pageCounter.textContent = `Página ${Math.min(currentPage, totalPages)} de ${totalPages}`; | |
| } | |
| // Actualizar visibilidad de páginas (z-index) | |
| function updatePageVisibility() { | |
| document.querySelectorAll('.page').forEach(page => { | |
| const pageNum = parseInt(page.dataset.pageNumber); | |
| if (pageNum < currentPage) { | |
| page.classList.add('flipped'); | |
| page.style.zIndex = totalPages - pageNum; | |
| } else { | |
| page.classList.remove('flipped'); | |
| page.style.zIndex = totalPages - pageNum + 1; | |
| } | |
| // La página actual siempre encima | |
| if (pageNum === currentPage) { | |
| </html> |