Moved auth data script to a partial; placed partial in <head>

This commit is contained in:
Thomas Smith 2022-12-16 14:15:47 -05:00
parent df3f1fd4fa
commit 94bd1c97dc
3 changed files with 26 additions and 25 deletions

View file

@ -0,0 +1,24 @@
<script>
try {
fetch('https://app.tea.xyz/api/signups')
.then(res => res.json())
.then(res => {
const signups = res.signups ? res.signups.toLocaleString() : ""
if (!(localStorage['signup'] || '').match(/:::/)) {
$('#count').html(signups)
}
$('#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>

View file

@ -73,31 +73,6 @@ integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+
} }
</script> </script>
<script>
try {
fetch('https://app.tea.xyz/api/signups')
.then(res => res.json())
.then(res => {
const signups = res.signups ? res.signups.toLocaleString() : ""
if (!(localStorage['signup'] || '').match(/:::/)) {
$('#count').html(signups)
}
$('#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>
<script type="text/javascript"> <script type="text/javascript">
(function(c,l,a,r,i,t,y){ (function(c,l,a,r,i,t,y){
c[a]=c[a]||function(){(c[a].q=c[a].q||[]).push(arguments)}; c[a]=c[a]||function(){(c[a].q=c[a].q||[]).push(arguments)};

View file

@ -105,6 +105,8 @@
} }
</script> </script>
{{- partial "auth-data-snippet.html" -}}
{{- partial "floating-join-btn.html" . -}} {{- partial "floating-join-btn.html" . -}}
{{- partial "toast.html" -}} {{- partial "toast.html" -}}