From 21310d0366c0f21e73c1f4f78d38370edfb59445 Mon Sep 17 00:00:00 2001 From: Joe Mou Date: Tue, 11 Aug 2026 17:41:01 -0400 Subject: Read the About box and latest release from JSON GitHub rebuilt the repository sidebar, so the selectors parseRepoInfo used matched nothing and the About box rendered empty. Everything but the latest release is in the page's embedded payload as sidebarAbout; the latest release is only in the _sidebar JSON already fetched for languages, so it arrives with that fragment and is moved beside the release count. --- cgithub/public/static/refs.js | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'cgithub/public/static') diff --git a/cgithub/public/static/refs.js b/cgithub/public/static/refs.js index f3e07e8..1035593 100644 --- a/cgithub/public/static/refs.js +++ b/cgithub/public/static/refs.js @@ -52,10 +52,20 @@ document.addEventListener("DOMContentLoaded", () => { .then((html) => { if (html.trim()) { placeholder.outerHTML = html; + relocate(); } else { placeholder.remove(); } }) .catch(() => placeholder.remove()); } + + // A fragment may carry a node that belongs elsewhere on the page, where an + // empty element of that id holds its spot: the sidebar's latest release + // reads as part of the release count, far from the languages it arrives with. + function relocate() { + for (const node of document.querySelectorAll("[data-target]")) { + document.getElementById(node.dataset.target)?.replaceWith(node); + } + } }); -- cgit v1.3.1