“Fork status” is a new concept for me, so I’m asking to clarify and to educate myself: is “fork status” how many commits apart it is from the current, original repo? Please let me know!
@maiki - yes, I think it is the number of commits apart from the current. I’m just reading through the post at How to determine which forks on GitHub are ahead? - Stack Overflow . Unfortunately the ‘Insights’ / “Forks” solution doesn’t work for me. Possibly the level of detail that is displayed is controlled by the source/author on Github ?
@maiki - Can you please advise how you were able to get the JS running in Firefox. I tried the Browser console, etc, tried the instructions from Firefox about having a bookmarklet, but couldn’t drag the code in ??
When I added a new bookmark, I added the javascript to the URL field. So:
javascript:(async () => {
/* while on the forks page, collect all the hrefs and pop off the first one (original repo) */
const aTags = [...document.querySelectorAll('div.repo a:last-of-type')].slice(1);
for (const aTag of aTags) {
/* fetch the forked repo as html, search for the "This branch is [n commits ahead,] [m commits behind]", print it directly onto the web page */
await fetch(aTag.href)
.then(x => x.text())
.then(html => aTag.outerHTML += `${html.match(/This branch is.*/).pop().replace('This branch is', '').replace(/([0-9]+ commits? ahead)/, '<font color="#0c0">$1</font>').replace(/([0-9]+ commits? behind)/, '<font color="red">$1</font>')}` + " <a " + `${html.match(/href="[^"]*\.zip">/).pop() + "Download ZIP</a>"}`)
.catch(console.error);
}
})();
That code goes into the URL field when adding a bookmark:
Once you’ve saved your bookmark, go to the Forks page of your choice (Forks · razonyang/hugo-theme-bootstrap · GitHub) and use the bookmarklet; in this case it will begin populating the page with those additional values showing on the page.