Skip to content

Instantly share code, notes, and snippets.

@wifeofvillon
Last active March 19, 2019 05:25
Show Gist options
  • Save wifeofvillon/de40c6034b4f9ef98cb58541fc35a434 to your computer and use it in GitHub Desktop.
Save wifeofvillon/de40c6034b4f9ef98cb58541fc35a434 to your computer and use it in GitHub Desktop.
JavaScript to get `${column title}: ${column card count}` strings on Trello board
{
let panes = document.querySelectorAll("div.list-wrapper");
let alertTextArray = new Array();
// console.log(panes);
for (pane of panes) {
if (!pane.classList.contains("is-idle")){
let title = pane.getElementsByClassName("list-header-name-assist")[0].innerText;
// console.log(title);
let cards = pane.getElementsByClassName("list-card-details");
// console.log(`${title}: ${cards.length}`)
let checkedCount = 0;
for (card of cards) {
if (card.getElementsByClassName("card-label").length > 0) {
checkedCount++;
}
}
alertTextArray.push(`${title}: ${cards.length} (${checkedCount} cards are checked)`);
}
}
prompt("copy and paste", alertTextArray.join(`\n`));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment