Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save Berny23/f0f8a2dff4ab94cb765636ce22a83597 to your computer and use it in GitHub Desktop.

Select an option

Save Berny23/f0f8a2dff4ab94cb765636ce22a83597 to your computer and use it in GitHub Desktop.
JS Snippet - Automatisch Karten verschieben (Zauberhogwarts)
/*
Zauberhogwarts: Neue Karten automatisch nach Tauschen verschieben (nur mit Markierung "Behalten" oder "Tauschen")
Copyright © 2025 Berny23
This file is released under the "MIT" license.
Go to "https://choosealicense.com/licenses/mit" for full license details.
*/
// Automatisch verwalten (in Tauschen verschieben)
async function run() {
const maxPage = document.querySelector("#pagination > ul > li:last-child").getAttribute("data-page");
for(let page = 1; page <= maxPage; page++) {
const response = await fetch(`https://www.zauberhogwarts.de/schokofroesche/sammelalbum/load-category.php?category=&page=${page}`, { method: "GET" });
const text = await response.text();
const parser = new DOMParser();
const html = parser.parseFromString(text, "text/html");
html.querySelectorAll(".sort-hint-b > img, .sort-hint-t > img").forEach(async (item) => {
const method = 't';
await fetch(`https://www.zauberhogwarts.de/schokofroesche/sammelalbum/sort.php?${method}=${item.id}`, { method: "POST" });
console.log(`Nach Tauschen verschoben: ${item.id}`);
await new Promise(r => setTimeout(r, 500));
});
}
}
run();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment