Fix page detection and add floating progress popup
✨ Improvements: - Enhanced page detection to support 'X pages' pattern - Added comprehensive logging for debugging - Implemented floating progress popup on page - Added show/hide progress message handlers - Better error handling and logging for image extraction - Fixed popup to display real-time progress 🐛 Fixed: - Page detection now works for both 'Showing X of Y images' and 'X pages' patterns - Downloads should now work correctly with proper page iteration - Added visible feedback via floating popup 🔍 Debugging: - Added console logs for page detection - Logs show total pages found and images extracted - Each page is logged during processing
This commit is contained in:
26
popup.js
26
popup.js
@@ -70,11 +70,30 @@ document.addEventListener('DOMContentLoaded', async () => {
|
||||
|
||||
showProgress(0, selectedMangas.length, 'Iniciando descargas...');
|
||||
|
||||
// Mostrar popup flotante en la página
|
||||
chrome.tabs.sendMessage(tab.id, {
|
||||
action: 'showProgress',
|
||||
current: 0,
|
||||
total: selectedMangas.length,
|
||||
title: 'Preparando...',
|
||||
status: 'Iniciando descargas...'
|
||||
});
|
||||
|
||||
try {
|
||||
// Descargar cada manga secuencialmente
|
||||
for (let i = 0; i < selectedMangas.length; i++) {
|
||||
const manga = selectedMangas[i];
|
||||
showProgress(i + 1, selectedMangas.length, `Descargando: ${manga.title.substring(0, 30)}...`);
|
||||
const title = manga.title ? manga.title.substring(0, 50) : 'Manga sin título';
|
||||
showProgress(i + 1, selectedMangas.length, `Descargando: ${title}...`);
|
||||
|
||||
// Actualizar popup flotante
|
||||
chrome.tabs.sendMessage(tab.id, {
|
||||
action: 'showProgress',
|
||||
current: i,
|
||||
total: selectedMangas.length,
|
||||
title: title,
|
||||
status: `Descargando manga ${i + 1} de ${selectedMangas.length}...`
|
||||
});
|
||||
|
||||
try {
|
||||
// Obtener URLs de imágenes
|
||||
@@ -98,6 +117,11 @@ document.addEventListener('DOMContentLoaded', async () => {
|
||||
showProgress(selectedMangas.length, selectedMangas.length, '¡Completado!');
|
||||
statusElement.className = 'status success';
|
||||
|
||||
// Ocultar popup flotante
|
||||
chrome.tabs.sendMessage(tab.id, {
|
||||
action: 'hideProgress'
|
||||
});
|
||||
|
||||
// Limpiar selección después de 3 segundos
|
||||
setTimeout(() => {
|
||||
chrome.tabs.sendMessage(tab.id, { action: 'clearSelection' }, async () => {
|
||||
|
||||
Reference in New Issue
Block a user