Skip to content

Instantly share code, notes, and snippets.

@bpierre
Created May 1, 2012 16:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bpierre/2569130 to your computer and use it in GitHub Desktop.
Save bpierre/2569130 to your computer and use it in GitHub Desktop.
Switch between documentup.com and github.com
// javascript:(function(){var%20w%20=%20window,h%20=%20w.location.host,p%20=%20w.location.pathname,r%20=%20p.match(/^(\/[^\/]+\/[^\/]+)/),gh%20=%20%27github.com%27,du%20=%20%27documentup.com%27;if%20(r%20&&%20h%20==%20gh)%20{w.location%20=%20%27http://%27%20+%20du%20+%20r[1];}%20else%20if%20(r%20&&%20h%20==%20du)%20{w.location%20=%20%27https://%27%20+%20gh%20+%20r[1];}})();
(function(){
var w = window,
h = w.location.host,
p = w.location.pathname,
r = p.match(/^(\/[^\/]+\/[^\/]+)/),
gh = 'github.com',
du = 'documentup.com';
if (r && h == gh) {
w.location = 'http://' + du + r[1];
} else if (r && h == du) {
w.location = 'https://' + gh + r[1];
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment