Last active
December 9, 2017 15:58
-
-
Save 5pecia1/c94de10a10094c2679c60d98f8e100d0 to your computer and use it in GitHub Desktop.
delete multiple cards in list in trello
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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