Bug 1057667 - Expand selection of articles available for viewing in ReaderMode, r=lucasr
--- 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