Skip to content

A JS bookmarklet that determines which branches are ahead or behind the original branch.

Notifications You must be signed in to change notification settings

halogod35/github-fork-bookmarklet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 

Repository files navigation

github-fork-bookmarklet

A JS bookmarklet that determines which branches are ahead or behind the original branch.

Code

javascript:(async () => {
  const aTags = [...document.querySelectorAll('div.repo a:last-of-type')].slice(1);
  for (const aTag of aTags) {
    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>')}`)
      .catch(console.error);
  }
})();

Usage

After clicking "Insights" on top and then "Forks" on the left, the following bookmarklet prints the info directly onto the web page like this:

About

A JS bookmarklet that determines which branches are ahead or behind the original branch.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published