Placeholder for stats

This commit is contained in:
Thomas Smith 2023-01-27 14:08:57 -05:00
parent f5f14d5823
commit e5f1c229c5

View file

@ -1,24 +1,38 @@
<script>
try { <script>
fetch('https://app.tea.xyz/api/signups') // Add a 400px tall placeholder
.then(res => res.json()) $('#count').html('<div style="height: 400px"></div>');
.then(res => { $('#count1').html('<div style="height: 400px"></div>');
const signups = res.signups ? res.signups.toLocaleString() : "" $('#count2').html('<div style="height: 400px"></div>');
if (!(localStorage['signup'] || '').match(/:::/)) { $('#count3').html('<div style="height: 400px"></div>');
$('#count').html(signups) $('#count4').html('<div style="height: 400px"></div>');
} $('#count5').html('<div style="height: 400px"></div>');
$('#count1').html(signups) $('#count6').html('<div style="height: 400px"></div>');
$('#count2').html(signups) $('#count7').html('<div style="height: 400px"></div>');
$('#count3').html(signups) $('#stat-one').html('<div style="height: 400px"></div>');
$('#count4').html(signups) $('#stat-one-small').html('<div style="height: 400px"></div>');
$('#count5').html(signups) $('#stat-two').html('<div style="height: 400px"></div>');
$('#count6').html(signups)
$('#count7').html(signups) try {
$('#stat-one').html(res.repos ? res.repos.toLocaleString() : "") fetch('https://app.tea.xyz/api/signups')
$('#stat-one-small').html(res.repos ? res.repos.toLocaleString() : "") .then(res => res.json())
$('#stat-two').html(res.maintainers ? res.maintainers.toLocaleString() : "") .then(res => {
}) const signups = res.signups ? res.signups.toLocaleString() : ""
} catch (e) { if (!(localStorage['signup'] || '').match(/:::/)) {
console.error(e) $('#count').html(signups)
} }
</script> $('#count1').html(signups)
$('#count2').html(signups)
$('#count3').html(signups)
$('#count4').html(signups)
$('#count5').html(signups)
$('#count6').html(signups)
$('#count7').html(signups)
$('#stat-one').html(res.repos ? res.repos.toLocaleString() : "")
$('#stat-one-small').html(res.repos ? res.repos.toLocaleString() : "")
$('#stat-two').html(res.maintainers ? res.maintainers.toLocaleString() : "")
})
} catch (e) {
console.error(e)
}
</script>