Last active
May 19, 2022 17:37
-
-
Save mpcowan/2b3068fbaff7033ad1cfebaad5d35c8e to your computer and use it in GitHub Desktop.
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
// The script at https://p.trellocdn.com/card.min.js | |
// must already be loaded at this point | |
const idCard = 'CjBy4OpQ'; | |
const api = 'https://api.trello.com/1/card'; | |
const opts = { | |
fields: 'name,closed,cover,url,badges,labels', | |
customFields: true, | |
customFieldItems: true, | |
members: true, | |
stickers: true, | |
}; | |
const qs = Object.keys(opts) | |
.map((param) => `${param}=${opts[param]}`) | |
.join('&'); | |
const resp = await fetch(`${api}/${idCard}?${qs}`); | |
const cardData = await resp.json(); | |
// create the card element | |
const cardEl = document.createElement('trello-card'); | |
// pass in the data about the card | |
cardEl.card = cardData; | |
cardEl.labeltext = true; | |
cardEl.colorblind = true; | |
// insert our card element into the DOM | |
document.getElementById('card-container').appendChild(cardEl); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment