Created
July 2, 2011 19:03
-
-
Save elijahmanor/1061534 to your computer and use it in GitHub Desktop.
Toggle JS Bin & Gist
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
//http://userjs.up.seesaa.net/js/bookmarklet.html | |
(function() { | |
var location = document.location.href, | |
newLocation = null; | |
if ( ~location.indexOf( "gist.github.com" ) ) { | |
console.log( "Switching from gist to jsbin..." ); | |
newLocation = location.replace( /https:\/\/gist.github.com\/(\d+)/, function( str, group1 ) { | |
return "http://jsbin.com/gist/" + group1; | |
}); | |
} else if ( ~location.indexOf( "jsbin.com" ) ) { | |
console.log( "Switching from jsbin to gist..." ); | |
newLocation = location.replace( /http:\/\/jsbin.com\/gist\/(\d+)/, function( str, group1 ) { | |
return "https://gist.github.com/" + group1; | |
}); | |
} else { | |
console.log( "Nothing to do..." ); | |
} | |
if ( newLocation ) { | |
document.location.href = newLocation; | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment