Bug 1057667 - Expand selection of articles available for viewing in ReaderMode, r=lucasr
authorMark Capella <markcapella@twcny.rr.com>
Thu, 16 Oct 2014 22:30:11 -0400
changeset 210790 7086c82a7c38050a630ac75096f1751659e68da8
parent 210789 b2a0cc22e9a62ecb55164d4b126d958671a2850e
child 210791 ae1dfa192faff860ddf7d84b50f55fbbc7d07dda
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewerslucasr
bugs1057667
milestone36.0a1
Bug 1057667 - Expand selection of articles available for viewing in ReaderMode, r=lucasr
mobile/android/chrome/content/Readability.js
--- a/mobile/android/chrome/content/Readability.js
+++ b/mobile/android/chrome/content/Readability.js
@@ -580,17 +580,16 @@ Readability.prototype = {
             if (topCandidates.length > this.N_TOP_CANDIDATES)
               topCandidates.pop();
             break;
           }
         }
       }
 
       let topCandidate = topCandidates[0] || null;
-      let lastTopCandidate = (topCandidates.length > 3 ? topCandidates[topCandidates.length - 1] : null);
 
       // If we still have no top candidate, just use the body as a last resort.
       // We also have to copy the body node so it is something we can modify.
       if (topCandidate === null || topCandidate.tagName === "BODY") {
         // Move all of the page's children into topCandidate
         topCandidate = doc.createElement("DIV");
         let children = page.childNodes;
         for (let i = 0; i < children.length; ++i) {
@@ -699,27 +698,16 @@ Readability.prototype = {
         } else if (this._flagIsActive(this.FLAG_WEIGHT_CLASSES)) {
           this._removeFlag(this.FLAG_WEIGHT_CLASSES);
         } else if (this._flagIsActive(this.FLAG_CLEAN_CONDITIONALLY)) {
           this._removeFlag(this.FLAG_CLEAN_CONDITIONALLY);
         } else {
           return null;
         }
       } else {
-        if (lastTopCandidate !== null) {
-          // EXPERIMENTAL: Contrast ratio is how we measure the level of competition between candidates in the
-          // readability algorithm. This is to avoid offering reader mode on pages that are more like
-          // a list or directory of links with summaries. It takes the score of the last top candidate
-          // (see N_TOP_CANDIDATES) and checks how it compares to the top candidate's. On pages that are not
-          // actual articles, there will likely be many candidates with similar score (i.e. higher contrast ratio).
-          let contrastRatio = lastTopCandidate.readability.contentScore / topCandidate.readability.contentScore;
-          if (contrastRatio > 0.45)
-            return null;
-        }
-
         return articleContent;
       }
     }
   },
 
   /**
    * Check whether the input string could be a byline.
    * This verifies that the input is a string, and that the length