Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions www/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,14 @@ <h2>Technologie</h2>
<h2>Vyberte instalátor pro svůj systém</h2>
<p class="download-lead">Nainstalujte mdedit jako běžnou desktopovou aplikaci. Bez účtu, bez cloudu, bez další malé daně za existenci.</p>

<div class="download-stats">
<div class="download-stat-badge">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="7 10 12 15 17 10"/><line x1="12" y1="15" x2="12" y2="3"/></svg>
<span id="total-downloads" class="download-stat-value" aria-live="polite">…</span>
<span class="download-stat-label">celkových stažení</span>
</div>
</div>

<div class="download-grid" aria-label="Instalátory mdedit">
<article class="download-card download-card-primary">
<div class="download-card-top">
Expand Down Expand Up @@ -207,5 +215,37 @@ <h3>Zkompilovat svépomocí</h3>
</div>
</footer>

<script>
(async () => {
try {
let total = 0;
let page = 1;
let hasMore = true;
while (hasMore) {
const res = await fetch(
`https://api.github.com/repos/MartinDejmal/mdedit/releases?per_page=100&page=${page}`
);
if (!res.ok) {
console.error('download counter: GitHub API responded with', res.status);
break;
}
const releases = await res.json();
for (const release of releases) {
for (const asset of release.assets) {
total += asset.download_count;
}
}
hasMore = releases.length === 100;
page++;
}
const el = document.getElementById('total-downloads');
if (el) {
el.textContent = total.toLocaleString('cs-CZ');
}
} catch (err) {
console.error('download counter: failed to fetch release stats', err);
}
})();
</script>
</body>
</html>
34 changes: 33 additions & 1 deletion www/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,39 @@ kbd {
.download-lead {
color: #b7c0d4;
max-width: 640px;
margin: 0 auto 32px;
margin: 0 auto 24px;
}

.download-stats {
display: flex;
justify-content: center;
margin-bottom: 32px;
}

.download-stat-badge {
display: inline-flex;
align-items: center;
gap: 8px;
padding: 8px 18px;
background: rgba(59,124,244,.15);
border: 1px solid rgba(120,154,255,.30);
border-radius: 999px;
color: #a9c2ff;
font-size: .88rem;
font-weight: 500;
}

.download-stat-value {
font-size: 1.1rem;
font-weight: 700;
color: #fff;
min-width: 1.5ch;
display: inline-block;
text-align: center;
}

.download-stat-label {
color: #8fa5d0;
}

.download-grid {
Expand Down