techgaun / active-forks

Find active github forks of a repo https://git.io/vSnrC
https://techgaun.github.io/active-forks/index.html
2.28k stars 295 forks source link

Bookmarklet in README is outdated / broken #42

Closed chrisp6825 closed 3 years ago

chrisp6825 commented 4 years ago

The javascript bookmarklet present on the README seems to be a little outdated. GitHub prepends the repo name with "GitHub - ", causing the new window to search for a repo name such as "GitHub - techgaun/active-forks". The code snippet appears to also cause the original window to overwrite all page contents with a single "[object Window]".

I adjusted the snippet to this, and find it working as intended in current versions of Firefox and Chrome:

javascript:(function(){ title=document.title;if(title){  thing=title.split(/(GitHub\s-\s)*([^:]*)/)[2];var newPage = 'https://techgaun.github.io/active-forks/index.html#'+thing;window.open(newPage)}})()

edit - some times Repo page titles do not include the "GitHub - " prefix, regex was updated to account for this

techgaun commented 3 years ago

thanks @chrisp6825 would you like to create a PR with the change?