Skip to content

Commit 136b43a

Browse files
author
=
committed
Due to the nosniff header, replace scripts in all browsers.
1 parent 3e04ce9 commit 136b43a

3 files changed

Lines changed: 22 additions & 9 deletions

File tree

htmlpreview.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,12 @@ var HTMLPreview = {
2929
}
3030
}
3131
}
32-
if(/*@cc_on!@*/0) { //Replace scripts only in IE
33-
script = document.getElementsByTagName('script');
34-
for(i = 0; i < script.length; ++i) {
35-
if(script[i].src) {
36-
src = script[i].src; //Get absolute URL
37-
if(src.indexOf('//raw.github.com') > 0 || src.indexOf('//bitbucket.org') > 0) { //Check if it's from raw.github.com or bitbucket.org
38-
this.send(src, 'loadJS'); //Then load it using YQL
39-
}
32+
script = document.getElementsByTagName('script');
33+
for(i = 0; i < script.length; ++i) {
34+
if(script[i].src) {
35+
src = script[i].src; //Get absolute URL
36+
if(src.indexOf('//raw.github.com') > 0 || src.indexOf('//bitbucket.org') > 0) { //Check if it's from raw.github.com or bitbucket.org
37+
this.send(src, 'loadJS'); //Then load it using YQL
4038
}
4139
}
4240
}

htmlpreview.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

index.html

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,21 @@
3333
<body>
3434
<form id="previewform" action="">
3535
<h1>GitHub &amp; BitBucket HTML Preview</h1>
36+
<p><script type="text/javascript"><!--
37+
google_ad_client="pub-4887626881270770";
38+
google_ad_host="pub-6693688277674466";
39+
google_ad_width=728;
40+
google_ad_height=90;
41+
google_ad_format="728x90_as";
42+
google_ad_type="text_image";
43+
google_color_border="FFFFFF";
44+
google_color_bg="FFFFFF";
45+
google_color_link="3366CC";
46+
google_color_url="3366CC";
47+
google_color_text="333333";
48+
google_font_face="arial";
49+
//--></script>
50+
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script></p>
3651
<p>Enter the HTML file to preview: <input type="url" id="file" value="" placeholder="e.g. https://github.com/user/repo/blob/master/index.html" size="70"> <input type="submit" value="&raquo;"></p>
3752
<p>or prepend to the URL: <strong>http://htmlpreview.github.io/?</strong>https://github.com/twitter/bootstrap/blob/master/docs/index.html</p>
3853
<p>or use this bookmarklet while browsing GitHub or BitBucket: <a href="javascript:void('http://htmlpreview.github.io/'==window.location?alert('Drag me to your bookmarks bar!'):window.location='http://htmlpreview.github.io/?'+window.location)"><strong>HTMLPreview</strong></a></p>

0 commit comments

Comments
 (0)