diff options
| author | Joe Mou <dev@mou.fo> | 2026-08-11 17:41:01 -0400 |
|---|---|---|
| committer | Joe Mou <dev@mou.fo> | 2026-08-11 18:25:26 -0400 |
| commit | 21310d0366c0f21e73c1f4f78d38370edfb59445 (patch) | |
| tree | b65c6bb2bfea1036266e29c308bf1132277bb993 /cgithub/public/static | |
| parent | 866f99c414cb3d102483ce21c68a0e62b394baaa (diff) | |
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.
Diffstat (limited to 'cgithub/public/static')
| -rw-r--r-- | cgithub/public/static/refs.js | 10 |
1 files changed, 10 insertions, 0 deletions
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); + } + } }); |
