(function () { "use strict"; function esc(s) { return String(s == null ? "" : s) .replace(/&/g, "&") .replace(//g, ">"); } function subdomain(id) { return id.toLowerCase().replace(/[^a-z0-9-]/g, "-"); } function countExperiments(node) { let n = 0; (node.children || []).forEach((c) => { n += 1 + countExperiments(c); }); return n; } function timeAgo(iso) { if (!iso) return ""; const d = (Date.now() - new Date(iso).getTime()) / 86400000; if (d < 1) return "today"; if (d < 2) return "yesterday"; if (d < 30) return `${Math.floor(d)}d ago`; if (d < 365) return `${Math.floor(d / 30)}mo ago`; return `${Math.floor(d / 365)}y ago`; } function card(space) { const id = space.id; const owner = id.split("/")[0]; const name = id.split("/")[1] || id; const sub = subdomain(id); const title = (space.cardData && space.cardData.title) || name; const a = document.createElement("a"); a.className = "card"; a.href = `https://huggingface.co/spaces/${id}`; a.target = "_blank"; a.rel = "noopener"; a.innerHTML = `
Could not load logbooks right now.
'; return; } spaces = spaces.filter((s) => !s.sdk || s.sdk === "static"); spaces.sort( (a, b) => new Date(b.lastModified || 0) - new Date(a.lastModified || 0) ); if (!spaces.length) { grid.innerHTML = 'No logbooks published yet. Be the first!
'; document.getElementById("count").textContent = ""; return; } document.getElementById("count").textContent = `${spaces.length} logbook${spaces.length === 1 ? "" : "s"}`; grid.innerHTML = ""; spaces.forEach((s) => { const el = card(s); grid.appendChild(el); enrich(s, el); }); } main(); })();