From 9b01fdde97812e680c284539063e671ae778d2f8 Mon Sep 17 00:00:00 2001 From: umbrae Date: Tue, 10 Mar 2009 21:23:05 +0000 Subject: Committing broken code in case we ever need to come back to it. git-svn-id: http://arc90labs-readability.googlecode.com/svn/trunk@23 d4e419ec-0920-11de-bbfd-a7c1bc4c261e --- js/readability.js | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'js') diff --git a/js/readability.js b/js/readability.js index fe2e3bb..3f5dbb5 100755 --- a/js/readability.js +++ b/js/readability.js @@ -1,4 +1,5 @@ var readabilityVersion = "0.3"; +var readabilityRemovedStyles = []; (function(){ var objOverlay = document.createElement("div"); @@ -39,10 +40,16 @@ function restoreDocument() { document.styleSheets[k].disabled = (document.styleSheets[k].href.lastIndexOf("readability") != -1); // Enable all style tags in head: + for(var styleIndex = 0; styleIndex < readabilityRemovedStyles.length; styleIndex++) + { + document.getElementsByTagName('head')[0].appendChild(readabilityRemovedStyles[styleIndex]); + } + /* var styleTags = document.getElementsByTagName("style"); for (var j=0;j < styleTags.length; j++) styleTags[j].disabled = false; - + */ + return false; } @@ -108,9 +115,14 @@ function grabArticle() { // REMOVES ALL STYLESHEETS ... for (var k=0;k < document.styleSheets.length; k++) + { if (document.styleSheets[k].href != null && document.styleSheets[k].href.lastIndexOf("readability") == -1) - document.styleSheets[k].disabled = true; - + { + readabilityRemovedStyles.push(document.styleSheets[k].ownerNode); + document.styleSheets[k].ownerNode.parentNode.removeChild(document.styleSheets[k].ownerNode); + } + } + // Remove all style tags in head (not doing this on IE) : var styleTags = document.getElementsByTagName("style"); for (var j=0;j < styleTags.length; j++) -- cgit v1.2.3