Add star count to footer

This commit is contained in:
Thomas Smith 2022-12-29 11:34:36 -05:00
parent 831305866b
commit 9d019904b8
2 changed files with 24 additions and 1 deletions

View file

@ -15,7 +15,7 @@
<ul class="list-group list-group-flush"> <ul class="list-group list-group-flush">
<a class="list-group-item" role="button" href="https://twitter.com/teaxyz"><i class="icon-twitter social-icon"></i>Twitter</a> <a class="list-group-item" role="button" href="https://twitter.com/teaxyz"><i class="icon-twitter social-icon"></i>Twitter</a>
<a class="list-group-item" role="button" href="https://discord.gg/KCZsXfJphn"><i class="icon-discord social-icon"></i>Discord</a> <a class="list-group-item" role="button" href="https://discord.gg/KCZsXfJphn"><i class="icon-discord social-icon"></i>Discord</a>
<a class="list-group-item" role="button" href="https://github.com/teaxyz"><i class="icon-github social-icon"></i>GitHub</a> <a class="list-group-item" role="button" href="https://github.com/teaxyz"><i class="icon-github social-icon"></i>GitHub (<span id="starcount"></span>)</a>
<a class="list-group-item" role="button" href="https://t.me/tea_xyz"><i class="icon-telegram social-icon"></i>Telegram</a> <a class="list-group-item" role="button" href="https://t.me/tea_xyz"><i class="icon-telegram social-icon"></i>Telegram</a>
</ul> </ul>
</div> </div>
@ -169,3 +169,24 @@ integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+
} }
</script> </script>
<script>
function getStarcount(repo, resultElement) {
var url = 'https://api.github.com/repos/' + repo;
axios.get(url)
.then(function (response) {
resultElement.innerHTML = response.data.stargazers_count;
})
.catch(function (error) {
console.log(error);
});
}
function repo() {
var repo = 'teaxyz/cli';
var starcount = document.getElementById('starcount');
getStarcount(repo, starcount);
}
document.addEventListener('DOMContentLoaded', repo());
</script>

View file

@ -111,5 +111,7 @@
{{- partial "toast.html" -}} {{- partial "toast.html" -}}
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
</head> </head>
</head> </head>