Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Berny23/45fe815d637e4097686ea907e974734c to your computer and use it in GitHub Desktop.
Save Berny23/45fe815d637e4097686ea907e974734c to your computer and use it in GitHub Desktop.
JS Snippet - Alle TA annehmen + Alle Karten auswählen (Zauberhogwarts)
/*
Zauberhogwarts: Auto-TA + Card-Selector
Copyright © 2023 Berny23
This file is released under the "MIT" license.
Go to "https://choosealicense.com/licenses/mit" for full license details.
*/
// Alle TA annehmen/bestätigen:
$('input[type="checkbox"][name="delete[]"]').prop("checked", true);
var alreadySelectedCards = []
$('div#tausch').each(function (index, element) {
var ownCard = $(element).find('.ownCard > img').first().attr('src');
if (!alreadySelectedCards.includes(ownCard)) {
$(element).find('input[type="radio"][value="1"]').prop("checked", true); // Annehmen
$(element).find('textarea[placeholder="Kommentar (optional)"]').text("Liebe Grüße und frohes Sammeln! :)");
alreadySelectedCards.push(ownCard);
}
})
// Alle Karten (ohne Behalten) in Sammelalbum auswählen und Anzahl von Fehlern zeigen:
console.log(($('.alert.alert-danger').text().match(/, /g) || []).length + 1);
console.log($('.alert.alert-danger').text());
$('#sammelalbum-content .bulk-mode img').trigger( "click" );
$('#sammelalbum-content .bulk-mode .sort-hint-b > img, #sammelalbum-content .bulk-mode .sort-hint-t > img').trigger( "click" );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment