From 290f6b78ccc532f673dc3671ac5487c99f940a64 Mon Sep 17 00:00:00 2001 From: magnolia1234 <7676006-magnolia1234@users.noreply.gitlab.com> Date: Fri, 14 May 2021 17:40:51 +0200 Subject: [PATCH] Fix-update Knack.be --- changelog.txt | 1 + contentScript.js | 20 +++++++++++--------- manifest.json | 2 +- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/changelog.txt b/changelog.txt index 6c3eaea..f2e9ed0 100644 --- a/changelog.txt +++ b/changelog.txt @@ -5,6 +5,7 @@ Post-release Add Las Provincias (Spain) Add Times of India Fix-update Crain's Chicago Business +Fix-update Knack.be Fix-update LeScienze.it Fix-update South China Morning Post (amp) diff --git a/contentScript.js b/contentScript.js index e8aa125..143d938 100644 --- a/contentScript.js +++ b/contentScript.js @@ -1215,15 +1215,17 @@ else if (matchDomain('gva.be')) { else if (matchDomain('knack.be')) { let paywall = document.querySelector('.rmgPaywall'); - removeDOMElement(paywall); - let hidden_body = document.querySelector('div.rmgDetail-body div'); - if (hidden_body) { - hidden_body.removeAttribute('class'); - let body_text = hidden_body.innerText.replace(/(?:^|[\w\"\'])(\.|\?|!)(?=[A-Za-zÀ-ÿ\"\']{2,})/gm, "$&\n\n"); - hidden_body.innerText = body_text; - let intro_par = document.querySelector('div.rmgDetail-body p'); - if (intro_par && intro_par.innerText.length > 200) - removeDOMElement(intro_par); + if (paywall) { + removeDOMElement(paywall); + let hidden_body = document.querySelector('div.rmgDetail-body div'); + if (hidden_body) { + hidden_body.removeAttribute('class'); + let body_text = hidden_body.innerText.replace(/(?:^|[\w\"\'])(\.|\?|!)(?=[A-Za-zÀ-ÿ\"\']{2,})/gm, "$&\n\n"); + hidden_body.innerText = body_text; + let intro_par = document.querySelector('div.rmgDetail-body p'); + if (intro_par && intro_par.innerText.length > 200) + removeDOMElement(intro_par); + } } } diff --git a/manifest.json b/manifest.json index 3673ad9..0668cd9 100644 --- a/manifest.json +++ b/manifest.json @@ -515,5 +515,5 @@ "*://*.wallkit.net/*", "*://*.wsj.net/*" ], - "version": "2.2.0.5" + "version": "2.2.0.6" } \ No newline at end of file