Last active
September 19, 2016 01:59
-
-
Save yulanggong/886cba8ac057f012f78c7e8ee41470ce to your computer and use it in GitHub Desktop.
π Switch between github.io and github.com
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
//Bookmarklet: | |
//javascript:!function(){var o=location.host.slice(-9);"github.io"==o?location.href.replace(/\/\/([^\.]+)\.github\.io\/([^\/]+)/,function(o,t,i){location.href="https://github.com/"+t+"/"+i}):"ithub.com"==o&&location.href.replace(/github\.com\/([^\/]+)\/([^\/]+)/,function(o,t,i){location.href="https://"+t.toLowerCase()+".github.io/"+i})}(); | |
(function(){ | |
var host = location.host.slice(-9); | |
if(host == 'github.io'){ | |
location.href.replace(/\/\/([^\.]+)\.github\.io\/([^\/]+)/, function(a, name, project){ | |
location.href = 'https://github.com/' + name + '/' + project; | |
}) | |
} else if (host == 'ithub.com') { | |
location.href.replace(/github\.com\/([^\/]+)\/([^\/]+)/, function(a, name, project){ | |
location.href = 'https://'+ name.toLowerCase() +'.github.io/' + project; | |
}) | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment