READABILITY is a simple tool that makes reading on the Web more enjoyable by removing the clutter around what you’re reading. Follow the steps below to install READABILITY in your Web browser.
-
-
-
-
-
-
-
-
-
Compelling Content Worth Reading
-
-
One morning, when Gregor Samsa woke from troubled dreams, he found himself transformed in his bed into a horrible vermin. He lay on his armour-like back, and if he lifted his head a little he could see his brown belly, slightly domed and divided by arches into stiff sections.
-
The bedding was hardly able to cover it and seemed ready to slide off any moment. His many legs, pitifully thin compared with the size of the rest of him, waved about helplessly as he looked. "What's happened to me? " he thought. It wasn't a dream.
-
His room, a proper human room although a little too small, lay peacefully between its four familiar walls. A collection of textile samples lay spread out on the table - Samsa was a travelling salesman - and above it there hung a picture that he had recently cut out of an illustrated magazine and housed in a nice, gilded frame.
-
It showed a lady fitted out with a fur hat and fur boa who sat upright, raising a heavy fur muff that covered the whole of her lower arm towards the viewer. Gregor then turned to look out the window at the dull weather. Drops of rain could be heard hitting the pane, which made him feel quite sad.
-
"How about if I sleep a little bit longer and forget all this nonsense", he thought, but that was something he was unable to do because he was used to sleeping on his right, and in his present state couldn't get into that position. However hard he threw himself onto his right, he always rolled back to where he was.
-
He must have tried it a hundred times, shut his eyes so that he wouldn't have to look at the floundering legs, and only stopped when he began to feel a mild, dull pain there that he had never felt before. "Oh, God", he thought, "what a strenuous career it is that I've chosen! Travelling day in and day out. Doing business like this takes much more effort than doing your own business at home, and on top of that there's the curse of travelling, worries about making train connections, bad and irregular food, contact with different people all the time so that you can never get to know anyone or become friendly with them. It can all go to Hell! " He felt a slight itch
READABILITY is a simple tool that makes reading on the Web more enjoyable by removing the clutter around what you’re reading. Follow the steps below to install READABILITY in your Web browser.
One morning, when Gregor Samsa woke from troubled dreams, he found himself transformed in his bed into a horrible vermin. He lay on his armour-like back, and if he lifted his head a little he could see his brown belly, slightly domed and divided by arches into stiff sections.
+
The bedding was hardly able to cover it and seemed ready to slide off any moment. His many legs, pitifully thin compared with the size of the rest of him, waved about helplessly as he looked. "What's happened to me? " he thought. It wasn't a dream.
+
His room, a proper human room although a little too small, lay peacefully between its four familiar walls. A collection of textile samples lay spread out on the table - Samsa was a travelling salesman - and above it there hung a picture that he had recently cut out of an illustrated magazine and housed in a nice, gilded frame.
+
It showed a lady fitted out with a fur hat and fur boa who sat upright, raising a heavy fur muff that covered the whole of her lower arm towards the viewer. Gregor then turned to look out the window at the dull weather. Drops of rain could be heard hitting the pane, which made him feel quite sad.
+
"How about if I sleep a little bit longer and forget all this nonsense", he thought, but that was something he was unable to do because he was used to sleeping on his right, and in his present state couldn't get into that position. However hard he threw himself onto his right, he always rolled back to where he was.
+
He must have tried it a hundred times, shut his eyes so that he wouldn't have to look at the floundering legs, and only stopped when he began to feel a mild, dull pain there that he had never felt before. "Oh, God", he thought, "what a strenuous career it is that I've chosen! Travelling day in and day out. Doing business like this takes much more effort than doing your own business at home, and on top of that there's the curse of travelling, worries about making train connections, bad and irregular food, contact with different people all the time so that you can never get to know anyone or become friendly with them. It can all go to Hell! " He felt a slight itch
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/js/readability-start.js b/js/readability-start.js
index 4263ab2..3d6d654 100755
--- a/js/readability-start.js
+++ b/js/readability-start.js
@@ -1,25 +1,24 @@
-var defaultMargin = "margin-wide";
-var defaultSize = "size-large";
-var defaultStyle = "style-newspaper";
+var margin = "margin-wide";
+var size = "size-large";
+var style = "style-newspaper";
var baseHref = window.location.toString().match(/.*\//);
var linkStart = "javascript:(function(){";
-var linkEnd = "var elements=document.getElementsByTagName('HEAD');var headElement;if(elements.length>=1){headElement=elements[0];}else{headElement=document.createElement('HEAD');document.documentElement.appendChild(headElement);}_readability_script=document.createElement('SCRIPT');_readability_script.type='text/javascript';_readability_script.src='" + basehref + "js/readability.js?x='+(Math.random());headElement.insertBefore(_readability_script,headElement.firstChild);_readability_css=document.createElement('LINK');_readability_css.rel='stylesheet';_readability_css.href='" + basehref + "css/readability.css';_readability_css.type='text/css';headElement.insertBefore(_readability_css,headElement.firstChild);_readability_print_css=document.createElement('LINK');_readability_print_css.rel='stylesheet';_readability_print_css.href='" + basehref + "css/readability-print.css';_readability_print_css.media='print';_readability_print_css.type='text/css';headElement.insertBefore(_readability_print_css,headElement.firstChild);})();";
+var linkEnd = "var elements=document.getElementsByTagName('HEAD');var headElement;if(elements.length>=1){headElement=elements[0];}else{headElement=document.createElement('HEAD');document.documentElement.appendChild(headElement);}_readability_script=document.createElement('SCRIPT');_readability_script.type='text/javascript';_readability_script.src='" + baseHref + "js/readability.js?x='+Math.random();headElement.insertBefore(_readability_script,headElement.firstChild);_readability_css=document.createElement('LINK');_readability_css.rel='stylesheet';_readability_css.href='" + baseHref + "css/readability.css';_readability_css.type='text/css';headElement.insertBefore(_readability_css,headElement.firstChild);_readability_print_css=document.createElement('LINK');_readability_print_css.rel='stylesheet';_readability_print_css.href='" + baseHref + "css/readability-print.css';_readability_print_css.media='print';_readability_print_css.type='text/css';headElement.insertBefore(_readability_print_css,headElement.firstChild);})();";
$(document).ready(function()
{
- // load example with defaults
- applyChange("margin", defaultMargin);
- applyChange("size", defaultSize);
- applyChange("style", defaultStyle);
+ // load example with defaults at first
+ applyChange("margin", margin);
+ applyChange("size", size);
+ applyChange("style", style);
// helper that takes the user input and customizes the bookmarklet source
function applyChange(property, value)
{
var example = document.getElementById("example");
var article = document.getElementById("articleContent");
- var size, style, margin;
// determine the property that is being changed
switch (property)
@@ -49,10 +48,6 @@ $(document).ready(function()
applyChange(this.name, this.value);
});
- $("#settings input").bind("click", function(){
- applyChange(this.name, this.value);
- });
-
// the user needs to drag the bookmarklet link to their bookmarks bar, but
// if they don't notify them what to do (unique case for IE)
$("#bookmarkletLink").bind("click", function(){
diff --git a/js/readability.js b/js/readability.js
index 5619c38..ce8fb52 100755
--- a/js/readability.js
+++ b/js/readability.js
@@ -1,8 +1,19 @@
-var readabilityVersion = "v1.0.0.1";
+var readabilityVersion = "1.0.0.1";
var emailSrc = "http://proto1.arc90.com/readability/email.php";
var highestScore = -1;
var malformedContent = false;
+// for now we want to hold on to our debugging, but if a browser doesn't
+// support it, we'll create a console.log() method that does nothing
+if (typeof console == 'undefined')
+{
+ var console = {};
+
+ console.log = function(msg) {
+ return;
+ };
+}
+
(function(){
// some sites use plugins (jCarousel) that when Readability removes scripts
// or does something funky it causes an alert to appear every few seconds,
@@ -141,36 +152,8 @@ function determineContentScore(score, parent, element)
function parseContent() {
- // replace all doubled-up tags with
tags, and remove fonts
- //var pattern = new RegExp(" [ \r\n\s]* ", "gi");
- //document.body.innerHTML = document.body.innerHTML.replace(pattern, "
").replace(/<\/?font[^>]*>/gi, "");
-
- /*
-
- // was part of the PRE based content parsing but tweaking below
- // could resolve the bad regex above replacing double br tags
- // with an empty paragraph
-
- var html = document.body.innerHTML;
- var firstTime = true;
-
- while (html.indexOf('\n\n') >= 0)
- {
- if (firstTime)
- {
- html = html.replace('\n\n', '
'); // first item
- firstTime = false;
- }
-
- if (html.indexOf('\n\n') == html.lastIndexOf('\n\n'))
- html = html.replace('\n\n', '
'); // last item
- else
- html = html.replace('\n\n', '
'); // every item in between
- }
-
- document.body.innerHTML = html;
- */
+ // replace all doubled-up tags with
").replace(/<\/?font[^>]*>/gi, "");
var articleContent = document.createElement("DIV");
var paragraphs = document.getElementsByTagName("P");
@@ -615,7 +598,8 @@ function normalize(text)
*/
function removeBreaks(element)
{
- element.innerHTML = element.innerHTML.replace(/( ]*\/?>(\s| ?)*){1,}/gi, " ");
+ // FIXME: the regex doesn't seem to pick up consecutive br tags, need to revisit
+ element.innerHTML = element.innerHTML.replace(/(( ]*>)[\s]*( ]*>)){1,}/gi, " ");
}
/**
@@ -681,15 +665,16 @@ function removeStyles()
{
var style = styleTags[j];
- // TODO: need to verify that clearing out innerText works in IE
- // might want to consider removing from parent
if (style.textContent)
{
style.textContent = "";
}
else
{
- style.innerText = "";
+ // most browsers support textContent but IE has its own way but it
+ // seems that Firefox supports both, check link for last example
+ // http://www.phpied.com/the-star-hack-in-ie8-and-dynamic-stylesheets/
+ style.styleSheet.cssText = "";
}
}
}
@@ -701,12 +686,16 @@ function removeStylesheets()
{
// TODO: need to do more research, not sure if disabling is enough
// for cross browser compatibility, might consider removal via parent
- // just as done in the removeScripts method
+ // just as done in the removeScripts method, but will need to retrieve
+ // all LINK tags and make sure rel attr is "stylesheet" or that its
+ // type attr is "text/css"
for (var k = 0; k < document.styleSheets.length; k++)
{
- if (document.styleSheets[k].href != null && document.styleSheets[k].href.lastIndexOf("readability") == -1)
+ var styleSheet = document.styleSheets[k];
+
+ if (styleSheet.href != null && styleSheet.href.lastIndexOf("readability") == -1)
{
- document.styleSheets[k].disabled = true;
+ styleSheet.disabled = true;
}
}
}
--
cgit v1.2.3