techgaun/active-forks

Bookmarklet in README is outdated / broken

chrisp6825 opened this issue · 1 comments

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

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