Created
March 13, 2019 18:25
-
-
Save clebersonfalk/192caf2d90d3a90e0a56d16f34ed9cfa to your computer and use it in GitHub Desktop.
Chrome Extension - Show Trello cards ids and cards by lists
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
(function () { | |
showCardId(); | |
countCardsByList(); | |
})(); | |
function showCardId() { | |
var cards_id = document.querySelectorAll('.card-short-id'); | |
for (var i=0; i < cards_id.length; i++) { | |
id = cards_id[i].textContent; | |
id = id.replace(/(\N\º|\s+\-)/, ''); | |
cards_id[i].textContent = id + " - "; | |
removeClass(cards_id[i]); | |
} | |
} | |
function countCardsByList() { | |
var list = document.querySelectorAll('.list-wrapper'); | |
if (list.length > 0) { | |
for (var i = 0; i < list.length; i++) { | |
var header_title = list[i].querySelector('.list-header-name'); | |
var list_cards = list[i].querySelectorAll('.list-card'); | |
header_title.value = header_title.value + ' (' + list_cards.length + ')'; | |
} | |
} | |
} | |
function removeClass(el) { | |
var className = 'hide'; | |
if (el.classList) | |
el.classList.remove(className); | |
else | |
el.className = el.className.replace(new RegExp('(^|\\b)' + className.split(' ').join('|') + '(\\b|$)', 'gi'), ' '); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment