From d9b9bcbcc6a9e31eaeadce99016318869bc63264 Mon Sep 17 00:00:00 2001
From: Miguel Casas-Sanchez
Date: Tue, 15 Jul 2014 13:56:17 +0200
Subject: [PATCH 01/35] Update redirections
Redirection to raw.github.com seem to have stopped working, instead raw.githubusercontent.com is in use now.
---
htmlpreview.js | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/htmlpreview.js b/htmlpreview.js
index 6f95205..10c1887 100644
--- a/htmlpreview.js
+++ b/htmlpreview.js
@@ -9,7 +9,7 @@ var HTMLPreview = {
},
raw: function() {
- return HTMLPreview.file().replace(/\/\/github\.com/, '//raw.github.com').replace(/\/blob\//, '/'); //Get URL of the raw file
+ return HTMLPreview.file().replace(/\/\/github\.com/, '//raw.githubusercontent.com').replace(/\/blob\//, '/'); //Get URL of the raw file
},
replaceAssets: function() {
@@ -17,7 +17,7 @@ var HTMLPreview = {
frame = document.querySelectorAll('iframe[src],frame[src]');
for(i = 0; i < frame.length; ++i) {
src = frame[i].src; //Get absolute URL
- if(src.indexOf('//raw.github.com') > 0 || src.indexOf('//bitbucket.org') > 0) { //Check if it's from raw.github.com or bitbucket.org
+ if(src.indexOf('//raw.githubusercontent.com') > 0 || src.indexOf('//bitbucket.org') > 0) { //Check if it's from raw.github.com or bitbucket.org
frame[i].src = 'http://' + location.hostname + location.pathname + '?' + src; //Then rewrite URL so it can be loaded using YQL
}
}
@@ -27,7 +27,7 @@ var HTMLPreview = {
if(href.indexOf('#') > 0) { //Check if it's an anchor
a[i].href = 'http://' + location.hostname + location.pathname + location.search + '#' + a[i].hash.substring(1); //Then rewrite URL with support for empty anchor
}
- else if(href.indexOf('//raw.github.com') > 0 || href.indexOf('//bitbucket.org') > 0) { //Check if it's from raw.github.com or bitbucket.org
+ else if(href.indexOf('//raw.githubusercontent.com') > 0 || href.indexOf('//bitbucket.org') > 0) { //Check if it's from raw.github.com or bitbucket.org
a[i].href = 'http://' + location.hostname + location.pathname + '?' + href; //Then rewrite URL so it can be loaded using YQL
}
}
@@ -36,14 +36,14 @@ var HTMLPreview = {
link = document.querySelectorAll('link[rel=stylesheet]');
for(i = 0; i < link.length; ++i) {
href = link[i].href; //Get absolute URL
- if(href.indexOf('//raw.github.com') > 0 || href.indexOf('//bitbucket.org') > 0) { //Check if it's from raw.github.com or bitbucket.org
+ if(href.indexOf('//raw.githubusercontent.com') > 0 || href.indexOf('//bitbucket.org') > 0) { //Check if it's from raw.github.com or bitbucket.org
HTMLPreview.send(href, 'loadCSS'); //Then load it using YQL
}
}
script = document.querySelectorAll('script');
for(i = 0; i < script.length; ++i) {
src = script[i].src; //Get absolute URL
- if(src.indexOf('//raw.github.com') > 0 || src.indexOf('//bitbucket.org') > 0) { //Check if it's from raw.github.com or bitbucket.org
+ if(src.indexOf('//raw.githubusercontent.com') > 0 || src.indexOf('//bitbucket.org') > 0) { //Check if it's from raw.github.com or bitbucket.org
HTMLPreview.send(src, 'loadJS'); //Then load it using YQL
}
else if(!src && script[i].innerHTML.indexOf('HTMLPreview') < 0) { //Move all inline scripts except HTMLPreview.replaceAssets()
From e6ac25a07ff61d34eee99bbe694316cb6fc712c6 Mon Sep 17 00:00:00 2001
From: niu tech
Date: Wed, 16 Jul 2014 03:14:22 +0200
Subject: [PATCH 02/35] Change raw.github.com to raw.githubusercontent.com
---
htmlpreview.min.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/htmlpreview.min.js b/htmlpreview.min.js
index 16b3f23..f7ad7da 100644
--- a/htmlpreview.min.js
+++ b/htmlpreview.min.js
@@ -1 +1 @@
-var HTMLPreview={content:"",previewform:document.getElementById("previewform"),file:function(){return location.search.substring(1)},raw:function(){return HTMLPreview.file().replace(/\/\/github\.com/,"//raw.github.com").replace(/\/blob\//,"/")},replaceAssets:function(){var a,b,c;a=document.querySelectorAll("iframe[src],frame[src]");for(b=0;ba[b].innerHTML.indexOf("HTMLPreview")&&document.write(a[b].outerHTML)}},loadHTML:function(a){a&&a.query&&a.query.results&&a.query.results.resources&&a.query.results.resources.content&&200==a.query.results.resources.status?(HTMLPreview.content=a.query.results.resources.content.replace(//i,'').replace(/<\/body>/i,'').replace(/<\/head>\s*
+
Enter the HTML file to preview:
or prepend to the URL: http://htmlpreview.github.io/?https://raw.github.com/twbs/bootstrap/gh-pages/2.3.2/index.html
or use this bookmarklet while browsing GitHub or BitBucket: HTMLPreview
@@ -56,4 +56,4 @@
GitHub & BitBucket HTML Preview
-
\ No newline at end of file
+
From 2b7e5b7e6ed18e5c9be66021af5ed0922989b763 Mon Sep 17 00:00:00 2001
From: niu tech
Date: Sat, 3 Oct 2015 01:35:06 +0200
Subject: [PATCH 14/35] Update readme.md
---
readme.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/readme.md b/readme.md
index ec66bed..148ba69 100644
--- a/readme.md
+++ b/readme.md
@@ -8,7 +8,7 @@ If you try to open raw versions of any HTML, CSS or JS files in a web browser di
In order to use it, just prepend this fragment to the URL of any HTML file: **[http://htmlpreview.github.io/?](http://htmlpreview.github.io/?)**
E.g.:
-http://htmlpreview.github.io/?https://raw.github.com/twbs/bootstrap/gh-pages/2.3.2/index.html
+http://htmlpreview.github.io/?https://github.com/twbs/bootstrap/gh-pages/2.3.2/index.html
http://htmlpreview.github.io/?https://github.com/documentcloud/backbone/blob/master/examples/todos/index.html
What it does is load HTML using YQL, then process all links, frames, scripts and styles, and load each of them using YQL, so they can be evaluted in the browser. Here is the workflow:
@@ -16,4 +16,4 @@ What it does is load HTML using YQL, then process all links, frames, scripts and
HTMLPreview.init() -> HTMLPreview.send(HTML) -> YQL fetch HTML -> HTMLPreview.loadHTML(data) -> HTMLPreview.replaceAssets() -> HTMLPreview.send(CSS) -> YQL fetch CSS -> HTMLPreview.loadCSS(data) -> HTMLPreview.send(JS) -> YQL fetch JS -> HTMLPreview.loadJS(data)
```
-**GitHub & BitBucket HTML Preview** was tested under Google Chrome, Apple Safari and Mozilla Firefox, and it should work with majority of websites, not only GitHub & BitBucket.
\ No newline at end of file
+**GitHub & BitBucket HTML Preview** was tested under Google Chrome, Apple Safari and Mozilla Firefox, and it should work with majority of websites, not only GitHub & BitBucket.
From 94a5a0b5ea80a5bdf6cc042ed2558010552f71c8 Mon Sep 17 00:00:00 2001
From: niu tech
Date: Sat, 3 Oct 2015 01:36:28 +0200
Subject: [PATCH 15/35] Update readme.md
---
readme.md | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/readme.md b/readme.md
index 148ba69..3270148 100644
--- a/readme.md
+++ b/readme.md
@@ -5,11 +5,10 @@ Many GitHub repositories don't use GitHub Pages to host their HTML files. **GitH
If you try to open raw versions of any HTML, CSS or JS files in a web browser directly from GitHub, all you will see are sources. GitHub forces them to use the "text/plain" content-type, so they cannot be interpreted. This script overrides it by using Yahoo! Query Language.
-In order to use it, just prepend this fragment to the URL of any HTML file: **[http://htmlpreview.github.io/?](http://htmlpreview.github.io/?)**
+In order to use it, just prepend this fragment to the URL of any HTML file: **[http://htmlpreview.github.io/?](http://htmlpreview.github.io/?)** e.g.:
-E.g.:
-http://htmlpreview.github.io/?https://github.com/twbs/bootstrap/gh-pages/2.3.2/index.html
-http://htmlpreview.github.io/?https://github.com/documentcloud/backbone/blob/master/examples/todos/index.html
+ - http://htmlpreview.github.io/?https://github.com/twbs/bootstrap/gh-pages/2.3.2/index.html
+ - http://htmlpreview.github.io/?https://github.com/documentcloud/backbone/blob/master/examples/todos/index.html
What it does is load HTML using YQL, then process all links, frames, scripts and styles, and load each of them using YQL, so they can be evaluted in the browser. Here is the workflow:
```
From ae77e41345d496746e2865e4d70310cec9320e79 Mon Sep 17 00:00:00 2001
From: niu tech
Date: Wed, 20 Jan 2016 20:37:28 +0100
Subject: [PATCH 16/35] Remove Google AdSense
---
index.html | 19 ++-----------------
1 file changed, 2 insertions(+), 17 deletions(-)
diff --git a/index.html b/index.html
index 8ea0662..c84a719 100644
--- a/index.html
+++ b/index.html
@@ -9,7 +9,7 @@
color: #333;
}
h1 {
- font-size: 24px;
+ font-size: 26px;
}
a {
color: #666;
@@ -33,22 +33,7 @@