// ==UserScript== // @name Yanmaga Manga Completo Captura + ZIP // @namespace yanmaga-fullpage // @version 1.5 // @description Captura las imágenes completas del manga en yanmaga.jp y permite descargarlas como ZIP. // @author // @license MIT // @match https://yanmaga.jp/viewer/* // @require https://cdn.jsdelivr.net/npm/jszip@3.10.1/dist/jszip.min.js // @require https://cdn.jsdelivr.net/npm/file-saver@2.0.5/dist/FileSaver.min.js // @grant none // @downloadURL none // ==/UserScript== (function () { 'use strict'; const imagenesCapturadas = []; function esperarCargarPagina() { const candidatas = document.querySelectorAll('img'); if (candidatas.length === 0) return setTimeout(esperarCargarPagina, 500); const btn = document.createElement('button'); btn.textContent = '📸 Capturar Páginas Manga'; Object.assign(btn.style, { position: 'fixed', top: '10px', left: '10px', zIndex: 9999, background: '#1f2937', color: 'white', padding: '10px 14px', borderRadius: '6px', border: 'none', fontSize: '14px', cursor: 'pointer' }); btn.onclick = capturarPaginasManga; document.body.appendChild(btn); } async function capturarPaginasManga() { const imagenes = [...document.querySelectorAll('img')]; const imagenesManga = imagenes.filter(img => img.naturalHeight >= 800 && img.naturalWidth >= 500 && !img.src.includes('icon')); for (let i = 0; i < imagenesManga.length; i++) { const img = imagenesManga[i]; const url = img.src; if (!url || imagenesCapturadas.find(x => x.url === url)) continue; const blob = await fetch(url).then(r => r.blob()); const bitmap = await createImageBitmap(blob); const width = bitmap.width; const height = bitmap.height; const nombre = `pagina_${String(imagenesCapturadas.length + 1).padStart(3, '0')}_${width}x${height}.jpg`; imagenesCapturadas.push({ blob, fileName: nombre, url }); mostrarMiniatura(nombre, url); } mostrarBotonDescarga(); alert(`✅ Capturadas ${imagenesCapturadas.length} páginas completas`); } function mostrarMiniatura(nombre, url) { let panel = document.getElementById('galeria-panel'); if (!panel) { panel = document.createElement('div'); panel.id = 'galeria-panel'; Object.assign(panel.style, { position: 'fixed', top: '60px', left: '10px', width: '300px', maxHeight: '80vh', overflowY: 'auto', background: '#f8fafc', border: '2px solid #111', padding: '10px', zIndex: 9998, fontSize: '12px' }); panel.innerHTML = `Galería:
`; document.body.appendChild(panel); } const contenedor = document.getElementById('lista-imagenes'); const item = document.createElement('div'); item.innerHTML = `