Bleibe auf Seite 1 beim Bulk-löschen
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
// ==UserScript==
|
||||
// @name Anime-Loads: Verlauf-Massenlöschung
|
||||
// @namespace https://git.ponywave.de/Akamaru/Userscripts
|
||||
// @version 1.2
|
||||
// @version 1.3
|
||||
// @description Fügt Buttons hinzu, um Verlaufseinträge auf anime-loads.org schneller zu löschen
|
||||
// @author Akamaru
|
||||
// @match https://www.anime-loads.org/history*
|
||||
@@ -286,6 +286,7 @@
|
||||
localStorage.setItem('bulkDeleteFrom', fromPage);
|
||||
localStorage.setItem('bulkDeleteTo', toPage);
|
||||
localStorage.setItem('bulkDeleteCurrent', fromPage);
|
||||
localStorage.setItem('bulkDeletePagesProcessed', '0');
|
||||
|
||||
// Starte Löschvorgang
|
||||
const url = fromPage === 1 ? 'https://www.anime-loads.org/history' : `https://www.anime-loads.org/history/page/${fromPage}`;
|
||||
@@ -293,17 +294,20 @@
|
||||
}
|
||||
|
||||
function checkAndContinueBulkDelete() {
|
||||
const current = parseInt(localStorage.getItem('bulkDeleteCurrent'));
|
||||
const from = parseInt(localStorage.getItem('bulkDeleteFrom'));
|
||||
const to = parseInt(localStorage.getItem('bulkDeleteTo'));
|
||||
const pagesProcessed = parseInt(localStorage.getItem('bulkDeletePagesProcessed')) || 0;
|
||||
|
||||
if (!current || !to) return;
|
||||
if (!from || !to) return;
|
||||
|
||||
const totalPages = to - from + 1;
|
||||
|
||||
// Zeige Fortschritt mit Abbrechen-Button
|
||||
const progress = document.createElement('div');
|
||||
progress.style.cssText = 'position: fixed; top: 20px; right: 20px; background: #f0ad4e; color: white; padding: 15px; border-radius: 5px; z-index: 10000; font-weight: bold;';
|
||||
|
||||
const progressText = document.createElement('div');
|
||||
progressText.textContent = `Lösche Seite ${current} von ${to}...`;
|
||||
progressText.textContent = `Lösche Seiten... (${pagesProcessed + 1}/${totalPages})`;
|
||||
progressText.style.marginBottom = '10px';
|
||||
|
||||
const cancelBtn = document.createElement('button');
|
||||
@@ -313,6 +317,7 @@
|
||||
localStorage.removeItem('bulkDeleteFrom');
|
||||
localStorage.removeItem('bulkDeleteTo');
|
||||
localStorage.removeItem('bulkDeleteCurrent');
|
||||
localStorage.removeItem('bulkDeletePagesProcessed');
|
||||
window.location.href = 'https://www.anime-loads.org/history';
|
||||
};
|
||||
|
||||
@@ -322,20 +327,34 @@
|
||||
|
||||
// Lösche alle Einträge auf der aktuellen Seite
|
||||
const removeButtons = Array.from(document.querySelectorAll('.remove-history'));
|
||||
|
||||
if (removeButtons.length === 0) {
|
||||
// Keine Einträge mehr - fertig
|
||||
localStorage.removeItem('bulkDeleteFrom');
|
||||
localStorage.removeItem('bulkDeleteTo');
|
||||
localStorage.removeItem('bulkDeleteCurrent');
|
||||
localStorage.removeItem('bulkDeletePagesProcessed');
|
||||
window.location.href = 'https://www.anime-loads.org/history';
|
||||
return;
|
||||
}
|
||||
|
||||
removeButtons.forEach(btn => btn.click());
|
||||
|
||||
// Warte, dann gehe zur nächsten Seite
|
||||
// Warte, dann lade die aktuelle Seite neu (Einträge rutschen nach)
|
||||
setTimeout(() => {
|
||||
if (current < to) {
|
||||
const nextPage = current + 1;
|
||||
localStorage.setItem('bulkDeleteCurrent', nextPage);
|
||||
const url = nextPage === 1 ? 'https://www.anime-loads.org/history' : `https://www.anime-loads.org/history/page/${nextPage}`;
|
||||
const newPagesProcessed = pagesProcessed + 1;
|
||||
|
||||
if (newPagesProcessed < totalPages) {
|
||||
localStorage.setItem('bulkDeletePagesProcessed', newPagesProcessed.toString());
|
||||
// Bleibe auf der gleichen Seite, da Einträge nachrutschen
|
||||
const url = from === 1 ? 'https://www.anime-loads.org/history' : `https://www.anime-loads.org/history/page/${from}`;
|
||||
window.location.href = url;
|
||||
} else {
|
||||
// Fertig - lösche Status
|
||||
localStorage.removeItem('bulkDeleteFrom');
|
||||
localStorage.removeItem('bulkDeleteTo');
|
||||
localStorage.removeItem('bulkDeleteCurrent');
|
||||
localStorage.removeItem('bulkDeletePagesProcessed');
|
||||
window.location.href = 'https://www.anime-loads.org/history';
|
||||
}
|
||||
}, 2000);
|
||||
|
||||
Reference in New Issue
Block a user