0
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-03-01 01:54:24 +01:00

change opencollective endpoint to get backers

This commit is contained in:
Johann-S 2019-06-03 16:33:07 +02:00 committed by XhmikosR
parent 3b78e40962
commit b72135b4c3

View File

@ -47,7 +47,7 @@ Through donations and sponsorships we are able to maintain & improve Bootstrap.
'<div class="m-2 position-relative">', '<div class="m-2 position-relative">',
' <div style="width:100px; height: 100px;" class="img-thumbnail d-flex align-items-center justify-content-center overflow-hidden">', ' <div style="width:100px; height: 100px;" class="img-thumbnail d-flex align-items-center justify-content-center overflow-hidden">',
' <div class="w-100">', ' <div class="w-100">',
' <img src="' + sponsor.image + '" alt="' + sponsor.name + '" class="mh-100 mw-100">', ' <img src="' + sponsor.avatar + '" alt="' + sponsor.name + '" class="mh-100 mw-100">',
' </div>', ' </div>',
' </div>', ' </div>',
' <h3 class="h6 pt-2">', ' <h3 class="h6 pt-2">',
@ -84,7 +84,7 @@ Through donations and sponsorships we are able to maintain & improve Bootstrap.
) )
} }
output.push('<img src="' + backer.image + '" alt="' + backer.name + '" class="mh-100 mw-100">') output.push('<img src="' + backer.avatar + '" alt="' + backer.name + '" class="mh-100 mw-100">')
if (backer.website) { if (backer.website) {
output.push('</a>') output.push('</a>')
@ -99,11 +99,11 @@ Through donations and sponsorships we are able to maintain & improve Bootstrap.
backerListEl.innerHTML = output.join('') backerListEl.innerHTML = output.join('')
} }
function requestOC(params, cb) { function requestOC(cb) {
var ocURL = 'https://opencollective.com/bootstrap/members/all.json' var ocURL = 'https://opencollective.com/api/groups/bootstrap/backers'
var xhr = new XMLHttpRequest() var xhr = new XMLHttpRequest()
xhr.open('GET', ocURL + params, true) xhr.open('GET', ocURL, true)
xhr.onload = function () { xhr.onload = function () {
if (xhr.readyState !== 4) { if (xhr.readyState !== 4) {
return return
@ -119,26 +119,21 @@ Through donations and sponsorships we are able to maintain & improve Bootstrap.
} }
(function () { (function () {
requestOC('?TierId=7193', function (sponsorList, error) { requestOC(function (allBackerList, error) {
if (sponsorList) { var backerList = allBackerList.filter(function (backer) { return backer.tier === 'backer' })
sponsorList = sponsorList.filter(function (sponsor) { return sponsor.isActive }) var sponsorList = allBackerList.filter(function (backer) { return backer.tier === 'sponsor' })
.slice(0, 10)
// Sort by total amount donated // Sort by total amount donated
sponsorList.sort(function (sponsor1, sponsor2) { return sponsor2.totalAmountDonated - sponsor1.totalAmountDonated }) sponsorList.sort(function (sponsor1, sponsor2) { return sponsor2.directDonations - sponsor1.directDonations })
displaySponsors(sponsorList) sponsorList = sponsorList.slice(0, 10)
}
})
requestOC('?TierId=7192', function (backerList, error) { displaySponsors(sponsorList)
if (backerList) {
backerList = backerList.filter(function (backer) { return backer.isActive })
.slice(0, 10)
// Sort by total amount donated // Sort by total amount donated
backerList.sort(function (backer1, backer2) { return backer2.totalAmountDonated - backer1.totalAmountDonated }) backerList.sort(function (backer1, backer2) { return backer2.directDonations - backer1.directDonations })
displayBackers(backerList) backerList = backerList.slice(0, 10)
}
displayBackers(backerList)
}) })
})() })()
</script> </script>