Created
September 9, 2024 18:55
-
-
Save plurch/5097c1e0cd3936f2fa87cecbcfbfaea6 to your computer and use it in GitHub Desktop.
related_repos_bookmarklet.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const url = window.location.href; | |
const GITHUB_REGEX = new RegExp("(?:http|https):\\/\\/github.com\\/([A-Za-z0-9-]+)\\/([A-Za-z0-9-_\\.]+)"); | |
const res = GITHUB_REGEX.exec(url); | |
if(!res) { | |
alert('Please first visit a repo on GitHub.\nFor example: github.com/airbnb/javascript'); | |
} else { | |
window.open(`https://relatedrepos.com/gh/${res[1]}/${res[2]}`, '_blank'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment