Last active
October 22, 2015 20:32
-
-
Save duzun/55e2005d297bd560df4e to your computer and use it in GitHub Desktop.
Go to github.io of a github repo which has gh-pages branch.
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
<a class="btn btn-default btn-info bookmarklet" href="javascript:(function(d,b,c,a){b=d.location;a=b.pathname.split('/');c=b.hostname;return'github.com'==c&&2<a.length?(a=b.protocol+'//'+a[1]+'.'+c.replace(/\.com$/,'.io')+'/'+a[2],void d.open(a,'_blank')):alert('Go to a github repo and try again!'),!1})(this);"> | |
Go to Github.IO | |
</a> |
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
/** | |
* Go to github.io of a github repo which has gh-pages branch. | |
* | |
* @license MIT | |
* @version 1.0.0 | |
* @author Dumitru Uzun (DUzun.Me) | |
* @homepage https://duzun.me/playground#gotoGithubIO | |
*/ | |
(function (w, l, h, p) { | |
l = w.location; | |
p = l.pathname.split('/'); | |
h = l.hostname; | |
return h == 'github.com' && p.length > 2 | |
? ( p=l.protocol + '//' + p[1] + '.' + h.replace(/\.com$/, '.io') + '/' + p[2], | |
void w.open(p, '_blank') | |
// l.href=p | |
) : alert('Go to a github repo and try again!'), false | |
; | |
}(this)); |
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(d,b,c,a){b=d.location;a=b.pathname.split('/');c=b.hostname;return'github.com'==c&&2<a.length?(a=b.protocol+'//'+a[1]+'.'+c.replace(/\.com$/,'.io')+'/'+a[2],void d.open(a,'_blank')):alert('Go to a github repo and try again!'),!1})(this); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment