// ==UserScript== // @name Comic Earthstar Advanced Manga Downloader // @namespace shadows // @version 1.4.0 // @description Descarga imágenes de mangas de Comic Earthstar, incluyendo contenido renderizado en canvas y blobs. // @author shadows // @license MIT // @match https://comic-earthstar.com/episode/* // @grant GM_download // @downloadURL none // ==/UserScript== "use strict"; (function () { // Crear botón de descarga const downloadButton = document.createElement("button"); downloadButton.textContent = "Descargar Manga"; downloadButton.style = ` position: fixed; top: 10px; right: 10px; z-index: 10000; background-color: #28a745; color: white; border: none; padding: 10px 20px; font-size: 14px; border-radius: 5px; cursor: pointer; `; document.body.appendChild(downloadButton); // Evento de clic en el botón downloadButton.addEventListener("click", async () => { // Buscar imágenes renderizadas como blob const images = Array.from(document.querySelectorAll("img")).map(img => img.src); if (images.length === 0) { alert("No se encontraron imágenes."); return; } let downloadedCount = 0; for (const [index, imgSrc] of images.entries()) { try { // Descarga cada imagen individualmente await downloadBlobImage(imgSrc, `pagina_${String(index + 1).padStart(2, "0")}.png`); downloadedCount++; } catch (err) { console.error(`Error al descargar la imagen ${index + 1}:`, err); } } alert(`Se descargaron ${downloadedCount} imágenes.`); }); // Función para descargar imágenes de tipo blob async function downloadBlobImage(blobUrl, fileName) { const response = await fetch(blobUrl); const blob = await response.blob(); const url = URL.createObjectURL(blob); GM_download({ url: url, name: fileName, onload: () => { URL.revokeObjectURL(url); }, onerror: (err) => { URL.revokeObjectURL(url); throw err; }, }); } })();