Skip to content

Instantly share code, notes, and snippets.

@5pecia1
Last active December 9, 2017 15:58
Show Gist options
  • Save 5pecia1/c94de10a10094c2679c60d98f8e100d0 to your computer and use it in GitHub Desktop.
Save 5pecia1/c94de10a10094c2679c60d98f8e100d0 to your computer and use it in GitHub Desktop.
delete multiple cards in list in trello
/**
* CAUTION!
* Copy board before run.
* Lists start at 0.
*/
function deleteCardsInList(listNumber) {
var list = document.getElementsByClassName("list-cards")[listNumber];
var a = list.getElementsByTagName('a');
var aLength = a.length;
for(var i = 0; i < aLength; i++) {
simulateClick(a[0]);
var shareAndMore = document.getElementsByClassName('quiet-button js-more-menu')[0]
simulateClick(shareAndMore);
var deleteButton = document.getElementsByClassName('js-delete')[0];
simulateClick(deleteButton);
var finalDeleteButton = document.getElementsByClassName('js-confirm full negate')[0];
simulateClick(finalDeleteButton);
}
console.log('finish');
function simulateClick(cb) {
var event = new MouseEvent('click', {
view: window,
bubbles: true,
cancelable: true
});
cb.dispatchEvent(event);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment