Permalink
Browse files

oops, forgot to include proxy into build

  • Loading branch information...
arty-name committed Feb 16, 2012
1 parent 867d3e6 commit e84bf1420a474ecde39b7cb58c7c1007ced360b6
Showing with 114 additions and 0 deletions.
  1. +56 −0 build/open-google-reader.js
  2. +56 −0 build/open-google-reader.user.js
  3. +1 −0 release.bash
  4. +1 −0 src/45proxy.js
@@ -1900,6 +1900,62 @@ function lib() {
}
}
+function proxyContent(settings) {
+ var urlPart = settings.contentProxyDomains.filter(function(urlPart) {
+ return (location.href.indexOf(urlPart) > -1);
+ })[0];
+ if (!settings.contentProxyDomains.length || !urlPart) return;
+
+ var selector = settings.contentProxySelectors[urlPart];
+
+ function forEach(nodes, callback) {
+ [].forEach.call(nodes, callback);
+ }
+
+ function getContent() {
+ var match = document.querySelectorAll(selector);
+ if (!match || !match.length) return;
+
+ var html = '';
+ forEach(match, function(node) {
+
+ forEach(node.querySelectorAll('script'), function(script) {
+ script.parentNode.removeChild(script);
+ });
+
+ node.src && node.setAttribute('src', node.src);
+ forEach(node.querySelectorAll('*[src]'), function(node) {
+ node.setAttribute('src', node.src);
+ });
+
+ node.href && node.setAttribute('href', node.href);
+ forEach(node.querySelectorAll('*[href]'), function(node) {
+ node.setAttribute('href', node.href);
+ });
+
+ node.hasAttribute('style') && node.setAttribute('style', '');
+ forEach(node.querySelectorAll('*[style]'), function(node) {
+ node.setAttribute('style', '');
+ });
+
+ // TODO: check for 'onload' etc attributes
+
+ html += node.outerHTML;
+ });
+
+ window.name = html;
+ }
+
+ if (window.opera && opera.version) {
+ opera.addEventListener('BeforeEvent.DOMContentLoaded', getContent, false);
+ opera.addEventListener('BeforeScript', function(event) {
+ event.preventDefault();
+ }, false);
+
+ } else {
+ document.addEventListener('DOMContentLoaded', getContent, false);
+ }
+}
function onload() {
lib();
@@ -1900,6 +1900,62 @@ function lib() {
}
}
+function proxyContent(settings) {
+ var urlPart = settings.contentProxyDomains.filter(function(urlPart) {
+ return (location.href.indexOf(urlPart) > -1);
+ })[0];
+ if (!settings.contentProxyDomains.length || !urlPart) return;
+
+ var selector = settings.contentProxySelectors[urlPart];
+
+ function forEach(nodes, callback) {
+ [].forEach.call(nodes, callback);
+ }
+
+ function getContent() {
+ var match = document.querySelectorAll(selector);
+ if (!match || !match.length) return;
+
+ var html = '';
+ forEach(match, function(node) {
+
+ forEach(node.querySelectorAll('script'), function(script) {
+ script.parentNode.removeChild(script);
+ });
+
+ node.src && node.setAttribute('src', node.src);
+ forEach(node.querySelectorAll('*[src]'), function(node) {
+ node.setAttribute('src', node.src);
+ });
+
+ node.href && node.setAttribute('href', node.href);
+ forEach(node.querySelectorAll('*[href]'), function(node) {
+ node.setAttribute('href', node.href);
+ });
+
+ node.hasAttribute('style') && node.setAttribute('style', '');
+ forEach(node.querySelectorAll('*[style]'), function(node) {
+ node.setAttribute('style', '');
+ });
+
+ // TODO: check for 'onload' etc attributes
+
+ html += node.outerHTML;
+ });
+
+ window.name = html;
+ }
+
+ if (window.opera && opera.version) {
+ opera.addEventListener('BeforeEvent.DOMContentLoaded', getContent, false);
+ opera.addEventListener('BeforeScript', function(event) {
+ event.preventDefault();
+ }, false);
+
+ } else {
+ document.addEventListener('DOMContentLoaded', getContent, false);
+ }
+}
function onload() {
lib();
View
@@ -15,6 +15,7 @@ cat \
27styles \
src/30ui.js \
src/40lib.js \
+ src/45proxy.js \
src/50onload.js \
src/60killDefault.js \
70postfix \
View
@@ -31,6 +31,7 @@ function proxyContent(settings) {
node.setAttribute('href', node.href);
});
+ node.hasAttribute('style') && node.setAttribute('style', '');
forEach(node.querySelectorAll('*[style]'), function(node) {
node.setAttribute('style', '');
});

0 comments on commit e84bf14

Please sign in to comment.