Files

25 lines
751 B
JavaScript
Raw Permalink Normal View History

2026-07-05 14:33:03 +01:00
const COUNTER_API = "https://classic7.kier.ovh";
async function loadCount() {
const el = document.querySelector(".download-count");
try {
const res = await fetch(`${COUNTER_API}/counter`);
const data = await res.json();
el.textContent = `${data.count.toLocaleString()} downloads`;
} catch {
el.textContent = "Download count unavailable at the moment.";
}
}
function trackDownloads() {
document.querySelectorAll(".mirror-links a").forEach(link => {
link.addEventListener("click", () => {
fetch(`${COUNTER_API}/download`, { keepalive: true }).catch(() => {});
});
});
}
document.addEventListener("DOMContentLoaded", () => {
loadCount();
trackDownloads();
});