From 89651baced403f3cc3511c4da5b97ce791d96c1b Mon Sep 17 00:00:00 2001 From: Stephen Jonany Date: Sat, 18 Jul 2020 09:47:27 -0700 Subject: [PATCH] Skip dom IDs that do not have text. For some reason readability includes these as output. --- extension/content_script.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/extension/content_script.js b/extension/content_script.js index 4b87b55..72c7386 100644 --- a/extension/content_script.js +++ b/extension/content_script.js @@ -322,7 +322,8 @@ function parseDocument() { // are re-included as-is, but otherwise are not considered readable text. // Sometimes I see ads being re-included with undefined ids, so it's probably // a good thing to skip these. - if (id !== undefined && $(`#${id}`).is(":visible")) { + let el = $(`#${id}`); + if (id !== undefined && el.is(":visible") && el.text().length > 0) { readableDomIds.push(id); } });