Created
November 26, 2024 07:51
-
-
Save simonsan/59e4b46f69b3b9f5d3cfcb166d937bad to your computer and use it in GitHub Desktop.
Github Repository Transfer Bookmarklet
This file contains 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
javascript:(function(){const currentUrl=window.location.href;const match=currentUrl.match(/^https:\/\/github\.com\/([^\/]+)\/([^\/]+)(\/|$)/);if(match&&match.length>=3){const username=match[1];const repository=match[2];const userRepo=`${username}/${repository}`;navigator.clipboard.writeText(userRepo).then(function(){if(!currentUrl.endsWith('/transfer')){window.location.href=currentUrl.replace(/\/$/,'')+'/transfer';}}).catch(function(err){alert('Failed to copy to clipboard');});}else{alert('This bookmarklet only works on GitHub repository pages.');}})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment