Skip to content

Commit f8ea733

Browse files
Yoddikkoclaude
andcommitted
Add download counter to hero button via Cloudflare Worker
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent aea6801 commit f8ea733

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

‎index.html‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ <h1>Automercatorum Tools</h1>
4848
<span class="dl-text">
4949
<span class="dl-label">Scarica per <span id="hero-download-os">macOS</span></span>
5050
<span class="dl-meta" id="hero-download-meta"></span>
51+
<span id="dl-count" style="opacity:0.65; font-size:0.8em;"></span>
5152
</span>
5253
</a>
5354
<button class="btn-download caret" id="hero-download-toggle"
@@ -204,5 +205,20 @@ <h2 style="font-size:14.5px;font-weight:600;color:#1c1917;margin-bottom:2px">Con
204205
</footer>
205206

206207
<script src="releases.js"></script>
208+
<script>
209+
const WORKER = "https://download-counter.alessioiodiceuni.workers.dev"
210+
const btn = document.getElementById("hero-download-primary")
211+
const countEl = document.getElementById("dl-count")
212+
213+
fetch(WORKER)
214+
.then(r => r.json())
215+
.then(d => { countEl.textContent = "· " + d.count + " download" })
216+
217+
btn.addEventListener("click", () => {
218+
fetch(WORKER, { method: "POST" })
219+
.then(r => r.json())
220+
.then(d => { countEl.textContent = "· " + d.count + " download" })
221+
})
222+
</script>
207223
</body>
208224
</html>

0 commit comments

Comments
 (0)