|// Instructions. Save as a bookmark. Click when on a repo or github.io (gh-pages branch) site.|
|location = /io$/.test(h) ?|
|'https://github.com/' + h.split('.') + p:|
|'http://'+ p.split('/')+'.github.io'+ '/' + p.split('/').slice(2).join('/')|
That would be even cooler to check to see if the github pages even exists before navigating there, but there is the Access-Control-Allow-Origin issue. I figured since it was github.com and github.io, they would allow such requests
var xhr = new XMLHttpRequest(); undefined xhr.open("GET", "https://jlord.github.io/sheetsee.js/", false); undefined xhr.status; 0 xhr.send(); XMLHttpRequest cannot load https://jlord.github.io/sheetsee.js/. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://gist.github.com' is therefore not allowed access. VM1046:2 NetworkError: Failed to execute 'send' on 'XMLHttpRequest': Failed to load 'https://jlord.github.io/sheetsee.js/'.
Interesting thought. You could circumvent the cross-origin issue by assuming that index.html exists on github.io if it exists on the github.com domain in a gh-pages branch. Have your xhr check that the gh-pages branch exists, search it for index.html, and render the appropriate path prefixed with ____.github.io.