Skip to content

Commit 331556f

Browse files
committed
Fixed framesets
1 parent a52d563 commit 331556f

4 files changed

Lines changed: 6 additions & 6 deletions

File tree

htmlpreview.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ var HTMLPreview = {
6464
&& data.query.results.resources
6565
&& data.query.results.resources.content
6666
&& data.query.results.resources.status == 200) {
67-
HTMLPreview.content = data.query.results.resources.content.replace(/<head>/i, '<head><base href="' + HTMLPreview.raw() + '">').replace(/<\/body>/i, '<script src="http://' + location.hostname + '/htmlpreview.min.js"></script><script>HTMLPreview.replaceAssets();</script></body>').replace(/<\/head>\s*<frameset/gi, '<script src="http://' + location.hostname + '/htmlpreview.min.js"></script><script>document.write("<scr"+"ipt>HTMLPreview.replaceAssets();</scr"+"ipt>");</script></head><frameset'); //Add <base> just after <head> and inject <script> just before </body> or </head> if <frameset>
67+
HTMLPreview.content = data.query.results.resources.content.replace(/<head>/i, '<head><base href="' + HTMLPreview.raw() + '">').replace(/<\/body>/i, '<script src="http://' + location.hostname + '/htmlpreview.min.js"></script><script>HTMLPreview.replaceAssets();</script></body>').replace(/<\/head>\s*<frameset/gi, '<script src="http://' + location.hostname + '/htmlpreview.min.js"></script><script>document.addEventListener("DOMContentLoaded",HTMLPreview.replaceAssets,false);</script></head><frameset'); //Add <base> just after <head> and inject <script> just before </body> or </head> if <frameset>
6868
setTimeout(function() {
6969
document.open();
7070
document.write(HTMLPreview.content);

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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ <h1>GitHub &amp; BitBucket HTML Preview</h1>
4949
//--></script>
5050
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script></p>
5151
<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>
52-
<p>or prepend to the URL: <strong>http://htmlpreview.github.io/?</strong>https://github.com/twitter/bootstrap/blob/master/docs/index.html</p>
52+
<p>or prepend to the URL: <strong>http://htmlpreview.github.io/?</strong>https://raw.github.com/twbs/bootstrap/gh-pages/2.3.2/index.html</p>
5353
<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>
5454
<p id="footer">Developed by <a href="https://github.com/niutech">niu tech</a> | Contribute on <a href="https://github.com/htmlpreview/htmlpreview.github.com">GitHub</a></p>
5555
</form>

readme.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ If you try to open raw versions of any HTML, CSS or JS files in a web browser di
44

55
**Now it works with BitBucket too!**
66

7-
To use it, just prepend this to the URL of any HTML file: **http://htmlpreview.github.com/?**
7+
To use it, just prepend this to the URL of any HTML file: **http://htmlpreview.github.io/?**
88

99
E.g.:
10-
http://htmlpreview.github.com/?https://github.com/twitter/bootstrap/blob/master/docs/index.html
11-
http://htmlpreview.github.com/?https://github.com/documentcloud/backbone/blob/master/examples/todos/index.html
10+
http://htmlpreview.github.io/?https://raw.github.com/twbs/bootstrap/gh-pages/2.3.2/index.html
11+
http://htmlpreview.github.io/?https://github.com/documentcloud/backbone/blob/master/examples/todos/index.html
1212

1313
GitHub HTML Preview is tested under Google Chrome, Apple Safari and Mozilla Firefox, and it should work with any websites, not only GitHub.

0 commit comments

Comments
 (0)