Last active
May 12, 2020 23:14
-
-
Save voiski/a06ca20c94908e7fec62f4ec532779a9 to your computer and use it in GitHub Desktop.
Extract trello cards by list
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
// How to use it: | |
// 1. Press Command + Option + J (Mac) or Control + Shift + J (Windows, Linux, Chrome OS) | |
// 2. Copy and past in the console. | |
// About the functions | |
// - for js map: trelloExport.export() | |
// - print each list with cards: trelloExport.print() | |
(function () { | |
function extract() { | |
var board = {}; | |
$(".js-list").each(function (_, list) { | |
var title = $(list).find(".js-list-name-assist").text(); | |
board[title] = $(list).find(".js-card-name").map(function (_, card) { | |
return { | |
desc: $(card).text(), | |
votes: $(card).parent().find(".badge-text").text() | |
}; | |
}); | |
}); | |
return board; | |
} | |
function print() { | |
var board = extract(); | |
for (const [key, cards] of Object.entries(board)) { | |
var line = "* " + key; | |
$.each(cards, function (_, card) { | |
line += "\n" + card.desc.replace(/^(#\d+)/, "$1 ") | |
if(card.votes != "") line += " - " + card.votes + " Votes"; | |
}) | |
console.log(line) | |
} | |
} | |
return { | |
extract: extract, | |
print: print | |
} | |
})().print() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Or, the minified version using https://javascript-minifier.com/ - trible click in the line above to select all: