Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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