Skip to content

Commit

Permalink
Fix mozilla#585 - remove nodes with role=complementary
Browse files Browse the repository at this point in the history
  • Loading branch information
gijsk authored and johannhof committed Apr 7, 2020
1 parent 668a3a1 commit d5621f8
Show file tree
Hide file tree
Showing 4 changed files with 1,151 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Readability.js
Original file line number Diff line number Diff line change
Expand Up @@ -840,6 +840,12 @@ Readability.prototype = {
node = this._removeAndGetNext(node);
continue;
}

if (node.getAttribute("role") == "complementary") {
this.log("Removing complementary content - " + matchString);
node = this._removeAndGetNext(node);
continue;
}
}

// Remove DIV, SECTION, and HEADER nodes without any content(e.g. text, image, video, or iframe).
Expand Down
8 changes: 8 additions & 0 deletions test/test-pages/archive-of-our-own/expected-metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"title": "Conversations with a Cryptid - Chapter 1 - AMournfulHowlInTheNight - 僕のヒーローアカデミア | Boku no Hero Academia",
"byline": "Organization for Transformative Works",
"dir": null,
"excerpt": "An Archive of Our Own, a project of the Organization for Transformative Works",
"siteName": null,
"readerable": true
}
Loading

0 comments on commit d5621f8

Please sign in to comment.