Polish homepage design and mobile layout
This commit is contained in:
@@ -1,20 +1,7 @@
|
||||
// bonzi homepage — minimal, no framework
|
||||
// bonzi homepage - minimal, no framework
|
||||
(() => {
|
||||
'use strict';
|
||||
|
||||
// ── 1. Live UTC timestamp (every 60s) ──────────────────
|
||||
const stamp = (d) => {
|
||||
const p = (n) => String(n).padStart(2, '0');
|
||||
return `${d.getUTCFullYear()}-${p(d.getUTCMonth()+1)}-${p(d.getUTCDate())} ${p(d.getUTCHours())}:${p(d.getUTCMinutes())} UTC`;
|
||||
};
|
||||
const setNow = () => {
|
||||
const s = stamp(new Date());
|
||||
document.querySelectorAll('#now, #footer-now').forEach((el) => { el.textContent = s; });
|
||||
};
|
||||
setNow();
|
||||
setInterval(setNow, 60_000);
|
||||
|
||||
// ── 2. Reveal-on-scroll ────────────────────────────────
|
||||
const blocks = document.querySelectorAll('[data-reveal]');
|
||||
if ('IntersectionObserver' in window) {
|
||||
const io = new IntersectionObserver((entries) => {
|
||||
@@ -29,23 +16,4 @@
|
||||
} else {
|
||||
blocks.forEach((b) => b.classList.add('in'));
|
||||
}
|
||||
|
||||
// ── 3. Last commit timestamp from gitea ─────────────────
|
||||
// CORS-friendly public endpoint. Falls back silently if it fails.
|
||||
const lastCommitEl = document.getElementById('last-commit');
|
||||
if (lastCommitEl) {
|
||||
fetch('https://git.molberg.cloud/api/v1/repos/bonzi/bonzi-homepage/commits?limit=1')
|
||||
.then((r) => r.ok ? r.json() : null)
|
||||
.then((data) => {
|
||||
if (!data || !data[0]) return;
|
||||
const ts = data[0].commit?.committer?.timestamp
|
||||
|| data[0].commit?.author?.timestamp;
|
||||
if (!ts) return;
|
||||
const d = new Date(ts);
|
||||
const p = (n) => String(n).padStart(2, '0');
|
||||
// Show as YYYY-MM-DD
|
||||
lastCommitEl.textContent = `${d.getUTCFullYear()}-${p(d.getUTCMonth()+1)}-${p(d.getUTCDate())}`;
|
||||
})
|
||||
.catch(() => { /* silent fallback — text stays as "—" */ });
|
||||
}
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user