1
0

MangaDex Cover Mass-Downloader: Fix für fehlenden Button

This commit is contained in:
Akamaru
2025-11-11 20:52:20 +01:00
parent 7347cdd134
commit 4c7e7f40b5

View File

@@ -1,7 +1,7 @@
// ==UserScript==
// @name MangaDex Cover Mass-Downloader
// @namespace https://git.ponywave.de/Akamaru/Userscripts
// @version 1.2
// @version 1.3
// @description Lädt Cover von MangaDex im Bulk als ZIP-Datei herunter
// @author Akamaru
// @match https://mangadex.org/title/*
@@ -50,20 +50,47 @@
childList: true,
subtree: true
});
// Überwache URL-Änderungen für SPA-Navigation
// 1. History API überwachen (pushState/replaceState)
const originalPushState = history.pushState;
const originalReplaceState = history.replaceState;
history.pushState = function() {
originalPushState.apply(this, arguments);
// Prüfe ob wir auf einer /title/* Seite sind
if (window.location.pathname.startsWith('/title/')) {
setTimeout(checkAndAddButton, 100);
}
};
history.replaceState = function() {
originalReplaceState.apply(this, arguments);
if (window.location.pathname.startsWith('/title/')) {
setTimeout(checkAndAddButton, 100);
}
};
// 2. popstate Event für Browser-Navigation (Zurück/Vorwärts)
window.addEventListener('popstate', () => {
if (window.location.pathname.startsWith('/title/')) {
setTimeout(checkAndAddButton, 100);
}
});
}
function addDownloadButton() {
// Prüfe ob Button bereits existiert
if (document.getElementById('cover-download-btn')) {
return;
}
// Finde den Button-Container
const buttonContainer = document.querySelector('.flex.gap-2.sm\\:mb-0.mb-2.flex-wrap');
if (!buttonContainer) {
return;
}
// Prüfe ob Button bereits im Container existiert (nicht nur global)
if (buttonContainer.querySelector('#cover-download-btn')) {
return;
}
// Erstelle Download-Button im Stil von "Start Reading"
const downloadBtn = document.createElement('button');
downloadBtn.id = 'cover-download-btn';