您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Greasy Fork is available in English.
Captura imágenes completas del manga en yanmaga.jp y permite descargarlas como ZIP con dimensiones reales en el nombre del archivo.
当前为
// ==UserScript== // @name Yanmaga Manga Captura Completa + ZIP // @namespace yanmaga-captura // @version 1.4 // @description Captura imágenes completas del manga en yanmaga.jp y permite descargarlas como ZIP con dimensiones reales en el nombre del archivo. // @author // @license MIT // @match https://yanmaga.jp/viewer/* // @require https://cdn.jsdelivr.net/npm/[email protected]/dist/jszip.min.js // @require https://cdn.jsdelivr.net/npm/[email protected]/dist/FileSaver.min.js // @grant none // ==/UserScript== (function () { 'use strict'; let imagenesCapturadas = []; function esperarImagenesYAgregarUI() { const imagenes = document.querySelectorAll('img'); if (imagenes.length === 0) return setTimeout(esperarImagenesYAgregarUI, 500); if (!document.getElementById('galeria-panel')) { agregarBotonYPanelGaleria(); } } function agregarBotonYPanelGaleria() { const btn = document.createElement('button'); btn.textContent = '📸 Capturar Manga'; Object.assign(btn.style, { position: 'fixed', top: '10px', left: '10px', zIndex: 9999, background: '#111827', color: '#fff', padding: '10px', border: 'none', borderRadius: '6px', fontSize: '14px', cursor: 'pointer' }); btn.onclick = capturarImagenes; document.body.appendChild(btn); const panel = document.createElement('div'); panel.id = 'galeria-panel'; Object.assign(panel.style, { position: 'fixed', top: '60px', left: '10px', width: '300px', maxHeight: '80vh', overflowY: 'auto', backgroundColor: '#ffffffee', border: '2px solid #111', borderRadius: '6px', padding: '10px', zIndex: 9998, fontSize: '12px' }); panel.innerHTML = ` <strong>📂 Galería Capturada:</strong> <div id="lista-imagenes" style="margin-top:10px; display:flex; flex-direction:column; gap:6px;"></div> <button id="descargar-zip" style="margin-top:10px; padding:6px; background:#16a34a; color:#fff; border:none; border-radius:4px; cursor:pointer;">⬇️ Descargar ZIP</button> `; document.body.appendChild(panel); document.getElementById('descargar-zip').onclick = descargarZIP; } async function capturarImagenes() { const imagenes = [...document.querySelectorAll('img')]; // Filtra imágenes grandes tipo manga (mayores a 500px) const imagenesFiltradas = imagenes.filter(img => img.naturalWidth > 500 && img.naturalHeight > 500); for (let i = 0; i < imagenesFiltradas.length; i++) { const img = imagenesFiltradas[i]; const url = img.src; if (!url || imagenesCapturadas.some(c => c.url === url)) continue; try { const blob = await fetch(url).then(r => r.blob()); const bitmap = await createImageBitmap(blob); const width = bitmap.width; const height = bitmap.height; const fileName = `pagina_${String(imagenesCapturadas.length + 1).padStart(3, '0')}_${width}x${height}.jpg`; imagenesCapturadas.push({ blob, fileName, url }); const item = document.createElement('div'); item.textContent = `✅ ${fileName}`; document.getElementById('lista-imagenes').appendChild(item); console.log(`Capturada: ${fileName}`); } catch (e) { console.warn('Error capturando imagen:', url, e); } } alert(`✅ Capturadas ${imagenesCapturadas.length} imágenes completas del manga`); } async function descargarZIP() { if (imagenesCapturadas.length === 0) { alert('No hay imágenes capturadas aún.'); return; } const zip = new JSZip(); for (const img of imagenesCapturadas) { zip.file(img.fileName, img.blob); } const contenido = await zip.generateAsync({ type: 'blob' }); saveAs(contenido, 'yanmaga_manga_completo.zip'); alert('📦 Descarga completa'); } esperarImagenesYAgregarUI(); })();