mirror of
https://github.com/twbs/bootstrap.git
synced 2025-03-01 01:54:24 +01:00
Clean up classes and lint JS.
This commit is contained in:
parent
9f72bbae7c
commit
9febb30c19
@ -38,103 +38,114 @@ Through donations and sponsorships we are able to maintain & improve Bootstrap.
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function displaySponsors(sponsorList) {
|
||||
var sponsorListEl = document.getElementById('sponsorList')
|
||||
var output = []
|
||||
|
||||
sponsorList.forEach(function (sponsor) {
|
||||
output.push(
|
||||
'<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 class="w-100">',
|
||||
' <img src="' + sponsor.avatar + '" alt="' + sponsor.name + '" class="mh-100 mw-100">',
|
||||
' </div>',
|
||||
' </div>',
|
||||
' <h3 class="h6 pt-2">',
|
||||
)
|
||||
|
||||
if (sponsor.website) {
|
||||
output.push('<a href="' + sponsor.website + '" class="stretched-link text-reset">' + sponsor.name + '</a>')
|
||||
} else {
|
||||
output.push(sponsor.name)
|
||||
}
|
||||
|
||||
output.push(
|
||||
' </h3>',
|
||||
'</div>'
|
||||
)
|
||||
})
|
||||
|
||||
sponsorListEl.innerHTML = output.join('')
|
||||
}
|
||||
|
||||
function displayBackers(backerList) {
|
||||
var backerListEl = document.getElementById('backerList')
|
||||
var output = []
|
||||
|
||||
backerList.forEach(function (backer) {
|
||||
output.push(
|
||||
'<div class="m-1 position-relative">',
|
||||
' <div style="width:50px; height: 50px;" class="img-thumbnail d-flex align-items-center justify-content-center overflow-hidden">'
|
||||
)
|
||||
|
||||
if (backer.website) {
|
||||
output.push(
|
||||
'<a href="' + backer.website + '" class="stretched-link text-reset" title="' + backer.name + '">'
|
||||
)
|
||||
}
|
||||
|
||||
output.push('<img src="' + backer.avatar + '" alt="' + backer.name + '" class="mh-100 mw-100">')
|
||||
|
||||
if (backer.website) {
|
||||
output.push('</a>')
|
||||
}
|
||||
|
||||
output.push(
|
||||
' </div>',
|
||||
'</div>',
|
||||
)
|
||||
})
|
||||
|
||||
backerListEl.innerHTML = output.join('')
|
||||
}
|
||||
|
||||
function requestOC(cb) {
|
||||
var ocURL = 'https://opencollective.com/api/groups/bootstrap/backers'
|
||||
var xhr = new XMLHttpRequest()
|
||||
|
||||
xhr.open('GET', ocURL, true)
|
||||
xhr.onload = function () {
|
||||
if (xhr.readyState !== 4) {
|
||||
return
|
||||
}
|
||||
|
||||
if (xhr.status === 200) {
|
||||
cb(JSON.parse(xhr.responseText), null)
|
||||
} else {
|
||||
cb(null, xhr.statusText)
|
||||
}
|
||||
}
|
||||
xhr.send()
|
||||
}
|
||||
|
||||
(function () {
|
||||
requestOC(function (allBackerList, error) {
|
||||
var backerList = allBackerList.filter(function (backer) { return backer.tier === 'backer' })
|
||||
var sponsorList = allBackerList.filter(function (backer) { return backer.tier === 'sponsor' })
|
||||
'use strict'
|
||||
|
||||
// Sort by total amount donated
|
||||
sponsorList.sort(function (sponsor1, sponsor2) { return sponsor2.directDonations - sponsor1.directDonations })
|
||||
sponsorList = sponsorList.slice(0, 10)
|
||||
function displaySponsors(sponsorList) {
|
||||
var sponsorListEl = document.getElementById('sponsorList')
|
||||
var output = []
|
||||
|
||||
displaySponsors(sponsorList)
|
||||
sponsorList.forEach(function (sponsor) {
|
||||
output.push(
|
||||
'<div class="m-2 position-relative">',
|
||||
' <div class="img-thumbnail mx-auto d-flex align-items-center justify-content-center overflow-hidden" style="width:100px; height: 100px;">',
|
||||
' <img class="img-fluid d-block" src="' + sponsor.avatar + '" alt="' + sponsor.name + '">',
|
||||
' </div>',
|
||||
' <h3 class="h6 pt-2">',
|
||||
)
|
||||
|
||||
// Sort by total amount donated
|
||||
backerList.sort(function (backer1, backer2) { return backer2.directDonations - backer1.directDonations })
|
||||
backerList = backerList.slice(0, 10)
|
||||
if (sponsor.website) {
|
||||
output.push('<a href="' + sponsor.website + '" class="stretched-link text-reset">' + sponsor.name + '</a>')
|
||||
} else {
|
||||
output.push(sponsor.name)
|
||||
}
|
||||
|
||||
displayBackers(backerList)
|
||||
})
|
||||
output.push(
|
||||
' </h3>',
|
||||
'</div>'
|
||||
)
|
||||
})
|
||||
|
||||
sponsorListEl.innerHTML = output.join('')
|
||||
}
|
||||
|
||||
function displayBackers(backerList) {
|
||||
var backerListEl = document.getElementById('backerList')
|
||||
var output = []
|
||||
|
||||
backerList.forEach(function (backer) {
|
||||
output.push(
|
||||
'<div class="m-1 position-relative">',
|
||||
' <div class="img-thumbnail d-flex align-items-center justify-content-center overflow-hidden" style="width:50px; height: 50px;">'
|
||||
)
|
||||
|
||||
if (backer.website) {
|
||||
output.push(
|
||||
'<a href="' + backer.website + '" class="stretched-link text-reset" title="' + backer.name + '">'
|
||||
)
|
||||
}
|
||||
|
||||
output.push('<img src="' + backer.avatar + '" alt="' + backer.name + '" class=""img-fluid d-block>')
|
||||
|
||||
if (backer.website) {
|
||||
output.push('</a>')
|
||||
}
|
||||
|
||||
output.push(
|
||||
' </div>',
|
||||
'</div>',
|
||||
)
|
||||
})
|
||||
|
||||
backerListEl.innerHTML = output.join('')
|
||||
}
|
||||
|
||||
function requestOC(cb) {
|
||||
var ocURL = 'https://opencollective.com/api/groups/bootstrap/backers'
|
||||
var xhr = new XMLHttpRequest()
|
||||
|
||||
xhr.open('GET', ocURL, true)
|
||||
xhr.addEventListener('load', function () {
|
||||
if (xhr.readyState !== 4) {
|
||||
return
|
||||
}
|
||||
|
||||
if (xhr.status === 200) {
|
||||
cb(JSON.parse(xhr.responseText), null)
|
||||
} else {
|
||||
cb(null, xhr.statusText)
|
||||
}
|
||||
})
|
||||
|
||||
xhr.send()
|
||||
}
|
||||
|
||||
(function () {
|
||||
requestOC(function (allBackerList) {
|
||||
var backerList = allBackerList.filter(function (backer) {
|
||||
return backer.tier === 'backer'
|
||||
})
|
||||
var sponsorList = allBackerList.filter(function (backer) {
|
||||
return backer.tier === 'sponsor'
|
||||
})
|
||||
|
||||
// Sort by total amount donated
|
||||
sponsorList.sort(function (sponsor1, sponsor2) {
|
||||
return sponsor2.directDonations - sponsor1.directDonations
|
||||
})
|
||||
sponsorList = sponsorList.slice(0, 10)
|
||||
|
||||
displaySponsors(sponsorList)
|
||||
|
||||
// Sort by total amount donated
|
||||
backerList.sort(function (backer1, backer2) {
|
||||
return backer2.directDonations - backer1.directDonations
|
||||
})
|
||||
backerList = backerList.slice(0, 10)
|
||||
|
||||
displayBackers(backerList)
|
||||
})
|
||||
})()
|
||||
})()
|
||||
</script>
|
||||
{{< /services.inline >}}
|
||||
|
Loading…
x
Reference in New Issue
Block a user