Last active
August 29, 2015 14:26
-
-
Save kvendrik/f9391989c25c289d0129 to your computer and use it in GitHub Desktop.
Gets first <count> card titles of a Trello list (<listName>) and puts them into a string you can then use to paste them onto another board.
This file contains hidden or 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
| console.log( | |
| getTrelloListItemsStr('Ready for Dev', 9) | |
| ); |
This file contains hidden or 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
| /** | |
| * Gets first <count> card titles of a Trello list (<listName>) and | |
| * puts them into a string you can then use to paste them onto | |
| * another board. | |
| * | |
| * @param {listName} name of the list to get the cards from | |
| * @param {count} number of cards to get | |
| */ | |
| var getTrelloListItemsStr = function(listName, count){ | |
| var listHeads = document.getElementsByClassName('list-header-name'), | |
| resultStr = ''; | |
| for(var i = listHeads.length-1; i >= 0; i--){ | |
| var currList = listHeads[i]; | |
| if(currList.innerText === listName){ | |
| var cardTitles = currList.parentNode.parentNode.getElementsByClassName('list-card-title'); | |
| for(var j = 0; j < cardTitles.length && j < count; j++){ | |
| resultStr += '- '+cardTitles[j].innerText+'\n'; | |
| } | |
| } | |
| } | |
| return resultStr; | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment