Merge pull request #187 from leibovic/classnames

Fixes #184 - Don't strip class names from article content
pull/189/head
Gijs 9 years ago
commit 62f5d43c70

@ -844,10 +844,6 @@ Readability.prototype = {
sibling = this._setNodeTag(sibling, "DIV");
}
// To ensure a node does not interfere with readability styles,
// remove its classnames.
sibling.removeAttribute("class");
articleContent.appendChild(sibling);
// siblings is a reference to the children array, and
// sibling is removed from the array when we call appendChild().

@ -1,5 +1,5 @@
<div id="readability-page-1" class="page">
<article role="article">
<article class="post" role="article">
<p>For more than a decade the Web has used XMLHttpRequest (XHR) to achieve asynchronous requests in JavaScript. While very useful, XHR is not a very nice API. It suffers from lack of separation of concerns. The input, output and state are all managed by interacting with one object, and state is tracked using events. Also, the event-based model doesnt play well with JavaScripts recent focus on Promise- and generator-based asynchronous programming.</p>
<p>The <a href="https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API">Fetch API</a> intends to fix most of these problems. It does this by introducing the same primitives to JS that are used in the HTTP protocol. In addition, it introduces a utility function <code>fetch()</code> that succinctly captures the intention of retrieving a resource from the network.</p>
<p>The <a href="https://fetch.spec.whatwg.org">Fetch specification</a>, which defines the API, nails down the semantics of a user agent fetching a resource. This, combined with ServiceWorkers, is an attempt to:</p>

@ -1,5 +1,5 @@
<div id="readability-page-1" class="page">
<div>
<div class="meldung_wrapper">
<figure class="aufmacherbild"> <img src="http://3.f.ix.de/scale/geometry/600/q75/imgs/18/1/4/6/2/3/5/1/Barcode-Scanner-With-Border-fc08c913da5cea5d.jpeg">
<figcaption>
<p class="caption">1Password scannt auch QR-Codes.</p>

@ -1,5 +1,5 @@
<div id="readability-page-1" class="page">
<div>
<div class="story-body ">
<div class="article-media article-media-main">
<div class="image">
<div class="image-frame"><img data-src="http://api.news.com.au/content/1.0/heraldsun/images/1227261885862?format=jpg&amp;group=iphone&amp;size=medium" alt="A new Bill would require telecommunications service providers to store so-called metadat"></div>

@ -1,5 +1,5 @@
<div id="readability-page-1" class="page">
<div>
<div class="postField postField--body">
<section name="ef8c" class=" section--first section--last">
<div class="section-content">
<div class="section-inner u-sizeFullWidth">

@ -1,5 +1,5 @@
<div id="readability-page-1" class="page">
<div>
<div class="post-content entry-content new-annotation">
<p data-textannotation-id="58a492029dca5e6a6e481d21b6b2933a" class="has-media media-640"><span class="img-border"><img width="636" height="358" data-format="jpg" data-asset-url="http://i.kinja-img.com/gawker-media/image/upload/s--hqqO9fze--/n1s6c2m6kc07iqdyllj6.jpg" data-chomp-id="n1s6c2m6kc07iqdyllj6" alt="How to Program Your Mind to Stop Buying Crap You Dont Need" src="http://i.kinja-img.com/gawker-media/image/upload/s--hqqO9fze--/n1s6c2m6kc07iqdyllj6.jpg" class="js_annotatable-image cursor-crosshair"></span></p>
<p data-textannotation-id="a043044f9b3e31fd85568b17e3b1b5f3" class="first-text"><span>We all buy things from time to time that we don't really need. It's okay to appeal to your wants every once in a while, as long as you're in control. If you struggle with clutter, impulse buys, and buyer's remorse, here's how to put your mind in the right place before you even set foot in a store.</span></p>
<h3 data-textannotation-id="e51cbbc52eb8c3b33571908351076cf7"><strong>Understand How Your Own Brain Works Against You</strong></h3>

@ -1,5 +1,5 @@
<div id="readability-page-1" class="page">
<div>
<div class="post-content entry-content ">
<p data-textannotation-id="58a492029dca5e6a6e481d21b6b2933a" class="has-media media-640"><span class="img-border"><img width="636" height="358" data-format="jpg" data-asset-url="http://i.kinja-img.com/gawker-media/image/upload/s--hqqO9fze--/n1s6c2m6kc07iqdyllj6.jpg" data-chomp-id="n1s6c2m6kc07iqdyllj6" alt="How to Program Your Mind to Stop Buying Crap You Dont Need" src="http://i.kinja-img.com/gawker-media/image/upload/s--hqqO9fze--/n1s6c2m6kc07iqdyllj6.jpg"></span></p>
<p data-textannotation-id="a043044f9b3e31fd85568b17e3b1b5f3" class="first-text"><span>We all buy things from time to time that we don't really need. It's okay to appeal to your wants every once in a while, as long as you're in control. If you struggle with clutter, impulse buys, and buyer's remorse, here's how to put your mind in the right place before you even set foot in a store.</span></p>
<h3 data-textannotation-id="e51cbbc52eb8c3b33571908351076cf7"><strong>Understand How Your Own Brain Works Against You</strong></h3>

@ -1,5 +1,5 @@
<div id="readability-page-1" class="page">
<div>
<div class="section-inner layoutSingleColumn">
<h4 name="425a" id="425a" data-align="center" class="graf--h4"><em class="markup--em markup--h4-em">Better Student Journalism</em></h4>
<h4 name="08db" id="08db" class="graf--h4 graf--empty"><br></h4>
<p name="d178" id="d178" class="graf--p">We pushed out the first version of the <a href="http://pippinlee.github.io/open-journalism-project/" data-href="http://pippinlee.github.io/open-journalism-project/" class="markup--anchor markup--p-anchor" rel="nofollow">Open Journalism site</a> in January. Our goal is for the site to be a place to teach students what they should know about journalism on the web. It should be fun too.</p>
@ -93,7 +93,7 @@
<br>We dont know what journalism or the web will be like in 10 years, but we can start encouraging students to keep an open mind about the skills theyll need. Were less interested in preparing students for the current newsroom climate, than we are in teaching students to have the ability to learn new tools quickly as they come and go.</li>
</ul>
</div>
<div>
<div class="section-inner layoutSingleColumn">
<h3 name="009a" id="009a" class="graf--h3">What were trying to share with others</h3>
<ul class="postList">
<li name="8bfa" id="8bfa" class="graf--li"><strong class="markup--strong markup--li-strong">A concise guide to building stories for the web</strong>

@ -1,5 +1,5 @@
<div id="readability-page-1" class="page">
<div>
<div class="section-inner layoutSingleColumn">
<figure name="4924" id="4924" class="graf--figure graf--first">
<div class="aspectRatioPlaceholder is-locked"><img class="graf-image" data-image-id="1*eR_J8DurqygbhrwDg-WPnQ.png" data-width="1891" data-height="1280" data-action="zoom" data-action-value="1*eR_J8DurqygbhrwDg-WPnQ.png" src="https://d262ilb51hltx0.cloudfront.net/max/1600/1*eR_J8DurqygbhrwDg-WPnQ.png"></div>
<figcaption class="imageCaption">Words need defenders.</figcaption>

@ -1,5 +1,5 @@
<div id="readability-page-1" class="page">
<div role="main">
<div role="main" class="sync-reminder">
<section class="intro container">
<header>
<p>Get to know the features that make it the most complete browser for building the Web.</p>

@ -8,7 +8,7 @@
<p>As <a href="http://mashable.com/2014/12/14/uber-sydney-surge-pricing/">Mashable </a>reports, the company announced that it would charge a minimum of $100 Australian to take passengers from the area immediately surrounding the ongoing crisis, and prices increased by as much as four times the standard amount. A firestorm of criticism quickly erupted <a href="https://twitter.com/Uber_Sydney">@Uber_Sydney</a> stop being assholes,” one Twitter response began and Uber soon found itself offering free rides out of the troubled area instead.</p>
<p>That opener suggests that Uber, as part of a community under siege, is preparing to respond in a civic manner.<em></em> </p>
<p><em>“… Fares have increased to encourage more drivers to come online &amp; pick up passengers in the area.”</em> </p>
<div data-toggle-group="story-13850779">
<div class="toggle-group target hideOnInit" data-toggle-group="story-13850779">
<p>But, despite the expression of shared concern, there is no sense of <em>civitas</em> to be found in the statement that follows. There is only a transaction, executed at what the corporation believes to be market value. Lesson #1 about Uber is, therefore, that in its view there is no heroism, only self-interest. This is Ayn Rands brutal, irrational and primitive philosophy in its purest form: altruism is evil, and self-interest is the only true heroism.<em></em> </p>
<p>There was once a time when we might have read of “hero cabdrivers” or “hero bus drivers” placing themselves in harms way to rescue their fellow citizens. For its part, Uber might have suggested that it would use its network of drivers and its scheduling software to recruit volunteer drivers for a rescue mission.<em></em> </p>
<p>Instead, we are told that Ubers pricing surge <em>was</em> its expression of concern. Ubers way to address a human crisis is apparently by letting the market govern human behavior, as if there were (in libertarian economist Tyler Cowens phrase) “markets in everything” including the lives of a citys beleaguered citizens (and its Uber drivers). <em></em> </p>

@ -1,5 +1,5 @@
<div id="readability-page-1" class="page">
<article>
<article class="main-content">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>

@ -1,5 +1,5 @@
<div id="readability-page-1" class="page">
<div id="post-2015_02_26_lupita-nyongo-pearl-dress-stolen-oscars">
<div class="post single-post" id="post-2015_02_26_lupita-nyongo-pearl-dress-stolen-oscars">
<p class="headline">
<h4 class="hf2">$150K Pearl Oscar Dress ... STOLEN!!!!</h4> </p>
<h5 class="article-posted-date">

@ -28,7 +28,7 @@
<p>“Now its hard to see what could persuade the Palestinians” to hold up on their ICC plans, Indyk said. “That has nothing to do with negotiations, but if both sides cant be persuaded to back down, then they will be on a trajectory that could lead to the collapse of the Palestinian Authority because it cant pay wages anymore.</p>
<p>“That could be an issue forced onto the agenda about the same time as a potential nuclear deal.”</p>
</article>
<div>
<div class="post-body-sig-line">
<a href="http://www.washingtonpost.com/people/steven-mufson"><img class="post-body-headshot-left" src="http://img.washingtonpost.com/wp-apps/imrs.php?src=http://www.washingtonpost.com/blogs/wonkblog/files/2014/07/mufson_steve.jpg&amp;h=180&amp;w=180"></a>
<p class="post-body-bio has-photo">Steven Mufson covers the White House. Since joining The Post, he has covered economics, China, foreign policy and energy.</p>
</div>

@ -1,5 +1,5 @@
<div id="readability-page-1" class="page">
<div id="textArea">
<div id="textArea" class="copyNormal">
<h3></h3>
<p>Feb. 23, 2015 -- Life-threatening peanut allergies have mysteriously been on the rise in the past decade, with little hope for a cure.</p>
<p xmlns:xalan="http://xml.apache.org/xalan">But a groundbreaking new study may offer a way to stem that rise, while another may offer some hope for those who are already allergic.</p>

@ -1,5 +1,5 @@
<div id="readability-page-1" class="page">
<div id="textArea">
<div id="textArea" class="copyNormal">
<h3></h3>
<p>April 17, 2015 -- Imagine being sick in the hospital with a <a href="http://www.webmd.com/a-to-z-guides/bacterial-and-viral-infections" onclick="return sl(this,'','embd-lnk');" class="">bacterial infection</a> and doctors can't stop it from spreading. This so-called "superbug" scenario is not science fiction. It's an urgent, worldwide worry that is prompting swift action.</p>
<p xmlns:xalan="http://xml.apache.org/xalan">Every year, about 2 million people get sick from a superbug, according to the CDC. About 23,000 die. Earlier this year, an outbreak of CRE (carbapenem-resistant enterobacteriaceae) linked to contaminated medical tools sickened 11 people at two Los-Angeles area hospitals. Two people died, and more than 200 others may have been exposed.</p>

Loading…
Cancel
Save