Skip to content

Commit d9b9bcb

Browse files
committed
Update redirections
Redirection to raw.github.com seem to have stopped working, instead raw.githubusercontent.com is in use now.
1 parent 52a8aef commit d9b9bcb

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

htmlpreview.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ var HTMLPreview = {
99
},
1010

1111
raw: function() {
12-
return HTMLPreview.file().replace(/\/\/github\.com/, '//raw.github.com').replace(/\/blob\//, '/'); //Get URL of the raw file
12+
return HTMLPreview.file().replace(/\/\/github\.com/, '//raw.githubusercontent.com').replace(/\/blob\//, '/'); //Get URL of the raw file
1313
},
1414

1515
replaceAssets: function() {
1616
var frame, a, link, script, i, href, src;
1717
frame = document.querySelectorAll('iframe[src],frame[src]');
1818
for(i = 0; i < frame.length; ++i) {
1919
src = frame[i].src; //Get absolute URL
20-
if(src.indexOf('//raw.github.com') > 0 || src.indexOf('//bitbucket.org') > 0) { //Check if it's from raw.github.com or bitbucket.org
20+
if(src.indexOf('//raw.githubusercontent.com') > 0 || src.indexOf('//bitbucket.org') > 0) { //Check if it's from raw.github.com or bitbucket.org
2121
frame[i].src = 'http://' + location.hostname + location.pathname + '?' + src; //Then rewrite URL so it can be loaded using YQL
2222
}
2323
}
@@ -27,7 +27,7 @@ var HTMLPreview = {
2727
if(href.indexOf('#') > 0) { //Check if it's an anchor
2828
a[i].href = 'http://' + location.hostname + location.pathname + location.search + '#' + a[i].hash.substring(1); //Then rewrite URL with support for empty anchor
2929
}
30-
else if(href.indexOf('//raw.github.com') > 0 || href.indexOf('//bitbucket.org') > 0) { //Check if it's from raw.github.com or bitbucket.org
30+
else if(href.indexOf('//raw.githubusercontent.com') > 0 || href.indexOf('//bitbucket.org') > 0) { //Check if it's from raw.github.com or bitbucket.org
3131
a[i].href = 'http://' + location.hostname + location.pathname + '?' + href; //Then rewrite URL so it can be loaded using YQL
3232
}
3333
}
@@ -36,14 +36,14 @@ var HTMLPreview = {
3636
link = document.querySelectorAll('link[rel=stylesheet]');
3737
for(i = 0; i < link.length; ++i) {
3838
href = link[i].href; //Get absolute URL
39-
if(href.indexOf('//raw.github.com') > 0 || href.indexOf('//bitbucket.org') > 0) { //Check if it's from raw.github.com or bitbucket.org
39+
if(href.indexOf('//raw.githubusercontent.com') > 0 || href.indexOf('//bitbucket.org') > 0) { //Check if it's from raw.github.com or bitbucket.org
4040
HTMLPreview.send(href, 'loadCSS'); //Then load it using YQL
4141
}
4242
}
4343
script = document.querySelectorAll('script');
4444
for(i = 0; i < script.length; ++i) {
4545
src = script[i].src; //Get absolute URL
46-
if(src.indexOf('//raw.github.com') > 0 || src.indexOf('//bitbucket.org') > 0) { //Check if it's from raw.github.com or bitbucket.org
46+
if(src.indexOf('//raw.githubusercontent.com') > 0 || src.indexOf('//bitbucket.org') > 0) { //Check if it's from raw.github.com or bitbucket.org
4747
HTMLPreview.send(src, 'loadJS'); //Then load it using YQL
4848
}
4949
else if(!src && script[i].innerHTML.indexOf('HTMLPreview') < 0) { //Move all inline scripts except HTMLPreview.replaceAssets()

0 commit comments

Comments
 (0)