From af56443bc662b12839957670b3afed6bdcc28d6f Mon Sep 17 00:00:00 2001 From: umbrae Date: Tue, 10 Mar 2009 21:25:24 +0000 Subject: Stop being a smartass about window content. git-svn-id: http://arc90labs-readability.googlecode.com/svn/trunk@24 d4e419ec-0920-11de-bbfd-a7c1bc4c261e --- js/readability.js | 43 +++---------------------------------------- 1 file changed, 3 insertions(+), 40 deletions(-) diff --git a/js/readability.js b/js/readability.js index 3f5dbb5..4d62385 100755 --- a/js/readability.js +++ b/js/readability.js @@ -1,5 +1,4 @@ var readabilityVersion = "0.3"; -var readabilityRemovedStyles = []; (function(){ var objOverlay = document.createElement("div"); @@ -7,10 +6,6 @@ var readabilityRemovedStyles = []; objOverlay.id = "readOverlay"; objinnerDiv.id = "readInner"; - - // If we've already called readability once, leave the original content there. - if(typeof document.body.readability == 'undefined') - document.body.readability = {"contentScore": 0, originalHTML: document.body.innerHTML.toString()}; // Apply user-selected styling: document.body.className = readStyle; @@ -33,26 +28,6 @@ var readabilityRemovedStyles = []; document.body.insertBefore(objOverlay, document.body.firstChild); })() -function restoreDocument() { - document.body.innerHTML = document.body.readability.originalHTML; - for (var k=0;k < document.styleSheets.length; k++) - if (document.styleSheets[k].href != null) - 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; -} - function grabArticle() { var allParagraphs = document.getElementsByTagName("p"); var topDivCount = 0; @@ -113,23 +88,11 @@ function grabArticle() { topDiv.innerHTML = 'Sorry, readability was unable to parse this page for content. If you feel like it should have been able to, please let us know by submitting an issue.'; } - // 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) - { - 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++) - styleTags[j].disabled = true; -// if (navigator.appName != "Microsoft Internet Explorer") -// styleTags[j].textContent = ""; - + if (navigator.appName != "Microsoft Internet Explorer") + styleTags[j].textContent = ""; cleanStyles(topDiv); // Removes all style attributes topDiv = killDivs(topDiv); // Goes in and removes DIV's that have more non

stuff than

stuff @@ -148,7 +111,7 @@ function grabArticle() { articleFooter.innerHTML = "\ \

\ "; -- cgit v1.2.3