Skip to content

Commit

Permalink
switch to total counting
Browse files Browse the repository at this point in the history
  • Loading branch information
KTibow committed Jan 1, 2024
1 parent 75bc631 commit 7474742
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ <h1 class="mb-8 text-6xl lg:text-8xl">Skyclient</h1>
/>
</svg>
<p>Safe. Rated 4.54/5 on Discord.</p>
<p>Latest versions downloaded <span id="template-versions">...</span> times.</p>
<p>Skyclient has been downloaded <span id="template-versions">...</span> times.</p>
</div>
</div>
<div
Expand Down Expand Up @@ -363,13 +363,15 @@ <h2 class="mb-8 flex items-start justify-between text-2xl font-bold">
),
fetch("https://api.github.com/repos/KTibow/Mart/releases").then((r) => r.json()),
]).then(async (responses) => {
const getCount = (json) => {
const artifact = json[0].assets[0];
if (!artifact) return 0;
return artifact.download_count;
};
const count = getCount(responses[0]) + getCount(responses[1]) + getCount(responses[2]);
document.getElementById("template-versions").innerText = count;
let count = 0;
for (const repo of responses) {
for (const release of repo) {
const artifact = release.assets[0];
if (!artifact) continue;
count += artifact.download_count;
}
}
document.getElementById("template-versions").innerText = count.toLocaleString();
});
</script>
</body>
Expand Down

0 comments on commit 7474742

Please sign in to comment.