0
0
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:
XhmikosR 2019-06-08 14:34:37 +03:00
parent 9f72bbae7c
commit 9febb30c19

View File

@ -38,6 +38,9 @@ Through donations and sponsorships we are able to maintain & improve Bootstrap.
</div> </div>
<script> <script>
(function () {
'use strict'
function displaySponsors(sponsorList) { function displaySponsors(sponsorList) {
var sponsorListEl = document.getElementById('sponsorList') var sponsorListEl = document.getElementById('sponsorList')
var output = [] var output = []
@ -45,10 +48,8 @@ Through donations and sponsorships we are able to maintain & improve Bootstrap.
sponsorList.forEach(function (sponsor) { sponsorList.forEach(function (sponsor) {
output.push( output.push(
'<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 class="img-thumbnail mx-auto d-flex align-items-center justify-content-center overflow-hidden" style="width:100px; height: 100px;">',
' <div class="w-100">', ' <img class="img-fluid d-block" src="' + sponsor.avatar + '" alt="' + sponsor.name + '">',
' <img src="' + sponsor.avatar + '" alt="' + sponsor.name + '" class="mh-100 mw-100">',
' </div>',
' </div>', ' </div>',
' <h3 class="h6 pt-2">', ' <h3 class="h6 pt-2">',
) )
@ -75,7 +76,7 @@ Through donations and sponsorships we are able to maintain & improve Bootstrap.
backerList.forEach(function (backer) { backerList.forEach(function (backer) {
output.push( output.push(
'<div class="m-1 position-relative">', '<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">' ' <div class="img-thumbnail d-flex align-items-center justify-content-center overflow-hidden" style="width:50px; height: 50px;">'
) )
if (backer.website) { if (backer.website) {
@ -84,7 +85,7 @@ Through donations and sponsorships we are able to maintain & improve Bootstrap.
) )
} }
output.push('<img src="' + backer.avatar + '" alt="' + backer.name + '" class="mh-100 mw-100">') output.push('<img src="' + backer.avatar + '" alt="' + backer.name + '" class=""img-fluid d-block>')
if (backer.website) { if (backer.website) {
output.push('</a>') output.push('</a>')
@ -104,7 +105,7 @@ Through donations and sponsorships we are able to maintain & improve Bootstrap.
var xhr = new XMLHttpRequest() var xhr = new XMLHttpRequest()
xhr.open('GET', ocURL, true) xhr.open('GET', ocURL, true)
xhr.onload = function () { xhr.addEventListener('load', function () {
if (xhr.readyState !== 4) { if (xhr.readyState !== 4) {
return return
} }
@ -114,27 +115,37 @@ Through donations and sponsorships we are able to maintain & improve Bootstrap.
} else { } else {
cb(null, xhr.statusText) cb(null, xhr.statusText)
} }
} })
xhr.send() xhr.send()
} }
(function () { (function () {
requestOC(function (allBackerList, error) { requestOC(function (allBackerList) {
var backerList = allBackerList.filter(function (backer) { return backer.tier === 'backer' }) var backerList = allBackerList.filter(function (backer) {
var sponsorList = allBackerList.filter(function (backer) { return backer.tier === 'sponsor' }) return backer.tier === 'backer'
})
var sponsorList = allBackerList.filter(function (backer) {
return backer.tier === 'sponsor'
})
// Sort by total amount donated // Sort by total amount donated
sponsorList.sort(function (sponsor1, sponsor2) { return sponsor2.directDonations - sponsor1.directDonations }) sponsorList.sort(function (sponsor1, sponsor2) {
return sponsor2.directDonations - sponsor1.directDonations
})
sponsorList = sponsorList.slice(0, 10) sponsorList = sponsorList.slice(0, 10)
displaySponsors(sponsorList) displaySponsors(sponsorList)
// Sort by total amount donated // Sort by total amount donated
backerList.sort(function (backer1, backer2) { return backer2.directDonations - backer1.directDonations }) backerList.sort(function (backer1, backer2) {
return backer2.directDonations - backer1.directDonations
})
backerList = backerList.slice(0, 10) backerList = backerList.slice(0, 10)
displayBackers(backerList) displayBackers(backerList)
}) })
})() })()
})()
</script> </script>
{{< /services.inline >}} {{< /services.inline >}}