From ffa1b482cefb543abaee3a4412ea8e556b9edb0b Mon Sep 17 00:00:00 2001 From: magnolia1234 <7676006-magnolia1234@users.noreply.gitlab.com> Date: Mon, 4 Jul 2022 20:35:30 +0200 Subject: [PATCH] Fix Knack.be & LeVif.be (Trends-text) --- README.md | 2 +- changelog.txt | 1 + contentScript.js | 20 ++++++++++++-------- manifest.json | 2 +- sites.js | 6 +++--- sites_updated.json | 36 ++++++++++++++++++++++++++++++++++++ 6 files changed, 54 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 2c269c3..50f75e8 100644 --- a/README.md +++ b/README.md @@ -102,7 +102,7 @@ _* free/cached articles only._ [S&P Global](https://www.spglobal.com) - [Seeking Alpha](https://seekingalpha.com) - [Stock News](https://stocknews.com) - -[The Business Journals](https://www.bizjournals.com) - +[The Business Journals](https://www.bizjournals.com)* - [The Business of Fashion](https://www.businessoffashion.com) - [The Wall Street Journal](https://www.wsj.com) - [Vogue Business](https://www.voguebusiness.com) diff --git a/changelog.txt b/changelog.txt index 21d9761..38d25a7 100644 --- a/changelog.txt +++ b/changelog.txt @@ -2,6 +2,7 @@ Changelog Bypass Paywalls Clean - Firefox Post-release +Fix Knack.be & LeVif.be (subdomains-text) * v2.7.4.0 (2022-07-03) Add Beobachter.ch diff --git a/contentScript.js b/contentScript.js index 20df39f..40a2cd8 100644 --- a/contentScript.js +++ b/contentScript.js @@ -82,13 +82,15 @@ if ((bg2csData !== undefined) && bg2csData.ld_json && dompurify_loaded) { var div_bpc_done = document.querySelector('div#bpc_done'); if (!div_bpc_done) { -ext_api.runtime.onMessage.addListener( - function(request, sender) { - if (request.msg === 'showExtSrc') { - replaceDomElementExtSrc(request.data.url, request.data.html, true, false, request.data.selector, request.data.text_fail, request.data.selector_source); - } - } -); +if (ext_api.runtime) { + ext_api.runtime.onMessage.addListener( + function(request, sender) { + if (request.msg === 'showExtSrc') { + replaceDomElementExtSrc(request.data.url, request.data.html, true, false, request.data.selector, request.data.text_fail, request.data.selector_source); + } + } + ) +} // check for opt-in confirmation (from background.js) if ((bg2csData !== undefined) && bg2csData.optin_setcookie) { @@ -1928,7 +1930,7 @@ else if (matchDomain(['gva.be', 'hbvl.be', 'nieuwsblad.be'])) { } else if (matchDomain(['knack.be', 'levif.be'])) { - let paywall = document.querySelector('#paywall-modal, #datawall-modal'); + let paywall = document.querySelector('div[id*="wall-modal"]'); if (paywall) { removeDOMElement(paywall); function knack_noscroll(node) { @@ -1936,6 +1938,8 @@ else if (matchDomain(['knack.be', 'levif.be'])) { node.removeAttribute('class'); } waitDOMAttribute('html', 'html', 'style', knack_noscroll, true); + let intro = document.querySelectorAll('div.article-body > p, div.article-body > style'); + removeDOMElement(...intro); } } diff --git a/manifest.json b/manifest.json index 3126739..9cbbfb5 100644 --- a/manifest.json +++ b/manifest.json @@ -688,5 +688,5 @@ "*://*.wsj.net/*", "*://webcache.googleusercontent.com/*" ], - "version": "2.7.4.0" + "version": "2.7.4.1" } diff --git a/sites.js b/sites.js index ad7c12e..ec78259 100644 --- a/sites.js +++ b/sites.js @@ -876,7 +876,7 @@ var defaultSites = { "Knack.be": { domain: "knack.be", allow_cookies: 1, - block_regex: /\.blueconic\.net\// + block_regex: /(\.knack\.be\/js\/responsive\/rmg(Modal|Paywall)\.js|\.blueconic\.net\/)/ }, "Kölner Stadt-Anzeiger": { domain: "ksta.de", @@ -1034,7 +1034,7 @@ var defaultSites = { "Le Vif.be": { domain: "levif.be", allow_cookies: 1, - block_regex: /\.blueconic\.net\// + block_regex: /(\.levif\.be\/js\/responsive\/rmg(Modal|Paywall)\.js|\.blueconic\.net\/)/ }, "Lee Enterprises Group": { domain: "###_usa_lee_ent", @@ -1632,7 +1632,7 @@ var defaultSites = { allow_cookies: 1, block_regex: /(\.blueconic\.net\/|meter\.bostonglobe\.com\/js\/|cdn\.ampproject\.org\/v\d\/amp-subscriptions-.+\.js)/ }, - "The Business Journals": { + "The Business Journals (free articles only)": { domain: "bizjournals.com", block_regex: /(assets\.bizjournals\.com\/static\/js\/app\/cxense\.js|cdn\.cxense\.com\/)/ }, diff --git a/sites_updated.json b/sites_updated.json index 27d3529..c3fedb9 100644 --- a/sites_updated.json +++ b/sites_updated.json @@ -77,6 +77,24 @@ "useragent": "googlebot", "new_site": 1 }, + "Knack.be": { + "domain": "knack.be", + "allow_cookies": 1, + "block_regex": "(\\.knack\\.be\\/js\\/responsive\\/rmg(Modal|Paywall)\\.js|\\.blueconic\\.net\\/)", + "cs_code": [{ + "cond": "div[id*=\"wall-modal\"]", + "rm_elem": 1, + "elems": [{ + "cond": "div.article-body > p", + "rm_elem": 1 + }, { + "cond": "div.article-body > style", + "rm_elem": 1 + } + ] + } + ] + }, "L'Avenir": { "domain": "lavenir.net", "allow_cookies": 1, @@ -92,6 +110,24 @@ ], "new_site": 1 }, + "Le Vif.be": { + "domain": "levif.be", + "allow_cookies": 1, + "block_regex": "(\\.levif\\.be\\/js\\/responsive\\/rmg(Modal|Paywall)\\.js|\\.blueconic\\.net\\/)", + "cs_code": [{ + "cond": "div[id*=\"wall-modal\"]", + "rm_elem": 1, + "elems": [{ + "cond": "div.article-body > p", + "rm_elem": 1 + }, { + "cond": "div.article-body > style", + "rm_elem": 1 + } + ] + } + ] + }, "The Banker": { "allow_cookies": 1, "domain": "thebanker.com",