Skip to content

Commit

Permalink
Merge pull request #161 from DexerBR/auto_fetch_stars
Browse files Browse the repository at this point in the history
Auto fetch Kivy repository stars
  • Loading branch information
akshayaurora authored Oct 8, 2024
2 parents 5c65ecf + 6201ff1 commit f0c220d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
11 changes: 11 additions & 0 deletions content/static/js/fetch_stars.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const updateStarsCount = () => {

fetch("https://api.github.com/repos/kivy/kivy")
.then(res => res.json())
.then(data => {
document.getElementById("stars-count").innerHTML = `${(data.stargazers_count / 1000).toFixed(1)}K Stars`;
});

};

updateStarsCount();
3 changes: 2 additions & 1 deletion templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ <h2 class="text-lg font-bold mt-2">
<img class="h-5" src="./static/images/icons/scale-balanced.svg" />
<p class="px-3">MIT License</p>
<img class="h-5" src="./static/images/icons/star.svg" />
<p class="px-3">14.8K Stars</p>
<p id="stars-count" class="px-3">17.0K Stars</p>
</div>
</div>
<div class="hidden lg:flex lg:w-1/2">
Expand Down Expand Up @@ -148,6 +148,7 @@ <h2 class="text-lg font-bold mt-2">
<script src="https://unpkg.com/vue@3"></script>
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
<script src="./static/js/opencollective_app.js"></script>
<script src="./static/js/fetch_stars.js"></script>
<script>

</script>
Expand Down

0 comments on commit f0c220d

Please sign in to comment.