(() => { "use strict"; document.querySelectorAll("[data-walkthrough]").forEach(panel => { const steps = [...panel.querySelectorAll("li")]; const button = panel.querySelector("button"); const status = panel.querySelector("[role=status]"); let current = -1; button.hidden = false; button.addEventListener("click", () => { current = (current + 1) % steps.length; steps.forEach((step, index) => step.classList.toggle("is-active", index === current)); status.textContent = `Step ${current + 1} of ${steps.length}: ${steps[current].querySelector("h3").textContent}. ${steps[current].querySelector("p").textContent}`; button.textContent = current === steps.length - 1 ? "Restart walkthrough ↺" : "Next step →"; }); }); const list = document.querySelector("[data-public-source]"); if (!list) return; // The featured projects and source links are already HTML. This is optional enrichment. const sameOriginUrl = value => { try { const url = new URL(value, location.origin); return url.origin === location.origin && url.protocol === "https:" ? url.href : null; } catch { return null; } }; const controller = new AbortController(); const timeout = setTimeout(() => controller.abort(), 8000); fetch("/api/v1/users/publish-bot/repos?limit=50&sort=updated", {credentials:"omit",headers:{Accept:"application/json"},signal:controller.signal}) .then(response => { if (!response.ok) throw new Error("Public listing unavailable"); return response.json(); }) .then(repos => { if (!Array.isArray(repos)) return; const known = new Set([...list.querySelectorAll("a")].map(a => a.dataset.repo)); const featured = new Set(["portfolio", "UniClik", "WindowsVolumeSteps", "ats-native-fsd"]); for (const repo of repos) { if (repo.private !== false || repo.empty || !featured.has(repo.name) || known.has(repo.name)) continue; const url = sameOriginUrl(repo.html_url); if (!url) continue; const link = document.createElement("a"); link.href = url; link.dataset.repo = repo.name; link.append(document.createTextNode(repo.name)); const meta = document.createElement("span"); meta.textContent = repo.language || "Public repository"; link.append(meta); list.append(link); } }) .catch(() => { /* Existing source links remain useful when the API is unavailable. */ }) .finally(() => clearTimeout(timeout)); })();