From 875aefdbec7806fe15e458828aadcd1b1c29ebcb Mon Sep 17 00:00:00 2001 From: magnolia1234 <7676006-magnolia1234@users.noreply.gitlab.com> Date: Thu, 21 Sep 2023 20:55:33 +0200 Subject: [PATCH] Add Incisive Media --- README.md | 1 + changelog.txt | 1 + contentScript.js | 27 ++++++++++++++++++++++++--- contentScript_once.js | 4 ++++ custom/manifest.json | 2 +- custom/sites_custom.json | 5 ----- manifest.json | 2 +- sites.js | 6 ++++++ 8 files changed, 38 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 5cb4c692..a649b4f3 100644 --- a/README.md +++ b/README.md @@ -455,6 +455,7 @@ Grouped in options:\ [International Tax Review](https://www.internationaltaxreview.com) - [Managing Intellectual Property](https://www.managingip.com) - [Trading Risk](https://www.trading-risk.com)\ +*[Incisive Media](https://www.incisivemedia.com/brands)* sites (opt-in to custom sites)\ *National World Publishing* sites like (opt-in to custom sites for unlisted)\ [The Scotsman](https://www.scotsman.com) - [Yorkshire Post](https://www.yorkshirepost.co.uk) diff --git a/changelog.txt b/changelog.txt index 48bca1cf..923056b8 100644 --- a/changelog.txt +++ b/changelog.txt @@ -3,6 +3,7 @@ Changelog Bypass Paywalls Clean - Firefox Updates (install signed xpi-file): https://gitlab.com/magnolia1234/bypass-paywalls-firefox-clean/-/releases Post-release +Add Incisive Media (opt-in to custom sites) Remove HBR China (fix obsolete) Remove VentureBeat (no paywall) Fix The Week (css) diff --git a/contentScript.js b/contentScript.js index 2a27f327..93b6b94e 100644 --- a/contentScript.js +++ b/contentScript.js @@ -36,6 +36,7 @@ var nl_dpg_media_domains = ['demorgen.be', 'flair.nl', 'humo.be', 'libelle.nl', var no_nhst_media_domains = ['europower-energi.no', 'fiskeribladet.no', 'intrafish.com', 'intrafish.no', 'rechargenews.com', 'tradewindsnews.com', 'upstreamonline.com']; var pe_grupo_elcomercio_domains = ['diariocorreo.pe', 'elcomercio.pe', 'gestion.pe']; var timesofindia_domains = ['timesofindia.com', 'timesofindia.indiatimes.com']; +var uk_incisive_media_domains = ['businessgreen.com', 'internationalinvestment.net', 'investmentweek.co.uk', 'professionaladviser.com', 'professionalpensions.com']; var uk_nat_world_domains = ['scotsman.com', 'yorkshirepost.co.uk']; var usa_adv_local_domains = ['al.com', 'cleveland.com', 'lehighvalleylive.com', 'masslive.com', 'mlive.com', 'nj.com', 'oregonlive.com', 'pennlive.com', 'silive.com', 'syracuse.com']; var usa_arizent_custom_domains = ['accountingtoday.com', 'benefitnews.com', 'bondbuyer.com', 'dig-in.com', 'financial-planning.com', 'nationalmortgagenews.com']; @@ -349,7 +350,7 @@ if (ext_api.runtime) { // Content workarounds/domain if (matchDomain('medium.com') || matchDomain(medium_custom_domains) || (!matchDomain('webcache.googleusercontent.com') && document.querySelector('script[src*=".medium.com/"]'))) { - let url = window.location.href; + let url = window.location.href.split('?')[0]; let paywall = document.querySelector('article.meteredContent'); if (paywall) { paywall.removeAttribute('class'); @@ -2708,7 +2709,7 @@ else if (matchDomain('vn.nl')) { else csDone = true; -} else if (window.location.hostname.match(/\.(ie|uk)$/) || matchDomain(['citywire.com', 'ft.com', 'scotsman.com', 'tes.com'])) {//united kingdom/ireland +} else if ((window.location.hostname.match(/\.(ie|uk)$/) && !matchDomain(['investmentweek.co.uk'])) || matchDomain(['citywire.com', 'ft.com', 'scotsman.com', 'tes.com'])) {//united kingdom/ireland if (matchDomain('autocar.co.uk')) { let url = window.location.href; @@ -5322,6 +5323,26 @@ else if (matchDomain(no_nhst_media_domains)) { } } +else if (matchDomain(uk_incisive_media_domains)) { + let url = window.location.href; + let paywall = document.querySelector('div#d-wrapper'); + if (paywall) { + removeDOMElement(paywall); + csDoneOnce = true; + let live_blog = document.querySelector('meta[name="description"][content^="In this live blog"]'); + let article_sel = 'div.article-content'; + let article = document.querySelector('div.article-content'); + if (article) { + if (live_blog) { + article.firstChild.before(googleWebcacheLink(url)); + } else { + let url_cache = 'https://webcache.googleusercontent.com/search?q=cache:' + url.split('?')[0]; + replaceDomElementExt(url_cache, true, false, article_sel); + } + } + } +} + else if (matchDomain(usa_conde_nast_domains)) { if (window.location.pathname.endsWith('/amp')) { amp_unhide_subscr_section('amp-ad, amp-embed, .ad'); @@ -5840,7 +5861,7 @@ function ext_12ftLink(url, text_fail = 'BPC > Try for full article text:\r\n') { function externalLink(domains, ext_url_templ, url, text_fail = 'BPC > Full article text:\r\n') { let text_fail_div = document.createElement('div'); text_fail_div.id = 'bpc_archive'; - text_fail_div.setAttribute('style', 'margin: 20px; font-weight: bold; color: red;'); + text_fail_div.setAttribute('style', 'margin: 20px; font-size: 15px; font-weight: bold; color: red;'); let parser = new DOMParser(); text_fail = text_fail.replace(/\[([^\]]+)\]/g, "$1"); let doc = parser.parseFromString('' + text_fail + '', 'text/html'); diff --git a/contentScript_once.js b/contentScript_once.js index e496feb6..ca731f94 100644 --- a/contentScript_once.js +++ b/contentScript_once.js @@ -102,6 +102,8 @@ window.setTimeout(function () { } else if (hostname.endsWith('.co.uk')) { if (document.querySelector('footer > div a[href^="https://www.nationalworldplc.com"]')) group = '###_uk_nat_world'; + else if (matchDomain(['investmentweek.co.uk'])) + group = '###_uk_incisive_media'; } else if (hostname.match(/\.(ca|com|net|news|org)$/)) { if (document.querySelector('picture > source[srcset*="%2Fgcm.omerlocdn.com%2F"]')) group = '###_ca_gcm'; @@ -109,6 +111,8 @@ window.setTimeout(function () { group = '###_ca_postmedia'; else if (document.querySelector('script[src*=".axate.io/"], script[src*=".agate.io/"]')) group = '###_uk_axate.io'; + else if (matchDomain(['businessgreen.com', 'internationalinvestment.net', 'professionaladviser.com', 'professionalpensions.com'])) + group = '###_uk_incisive_media'; else if (document.querySelector('script[src="https://cdn.blueconic.net/bridgetowermedia.js"], header.site-header > div.btm-header')) group = '###_usa_bridge_tower'; else if (document.querySelector('img[srcset^="https://www.gannett-cdn.com/"], link[href*=".gannett-cdn.com/"]')) diff --git a/custom/manifest.json b/custom/manifest.json index 178bd617..5da264dd 100644 --- a/custom/manifest.json +++ b/custom/manifest.json @@ -51,5 +51,5 @@ "webRequestBlocking", "*://*/*" ], - "version": "3.3.4.3" + "version": "3.3.4.4" } diff --git a/custom/sites_custom.json b/custom/sites_custom.json index 8d0918d6..b6372080 100644 --- a/custom/sites_custom.json +++ b/custom/sites_custom.json @@ -280,11 +280,6 @@ "allow_cookies": 1, "domain": "internationalepolitik.de" }, - "Investmentweek.co.uk": { - "allow_cookies": 1, - "domain": "investmentweek.co.uk", - "ld_google_webcache": "div#d-wrapper|div.article-content" - }, "Irishexaminer.com": { "allow_cookies": 1, "block_regex": "\\.irishexaminer\\.com\\/pu_examiner\\/scripts\\/engage", diff --git a/manifest.json b/manifest.json index 362b17ec..e256aef2 100644 --- a/manifest.json +++ b/manifest.json @@ -791,5 +791,5 @@ "*://*.wyleex.com/*", "*://webcache.googleusercontent.com/*" ], - "version": "3.3.4.3" + "version": "3.3.4.4" } diff --git a/sites.js b/sites.js index 4d9681c1..4e498c3b 100644 --- a/sites.js +++ b/sites.js @@ -1097,6 +1097,12 @@ var defaultSites = { allow_cookies: 1, block_regex: /(\.inc42\.com\/wp-content\/plugins\/leaky-paywall\/js\/leaky-paywall-cookie\.js|cdn\.ampproject\.org\/v\d\/amp-access-.+\.js)/ }, + "Incisive Media (opt-in to custom sites)": { + domain: "###_uk_incisive_media", + group: [], + allow_cookies: 1, + cs_dompurify: 1 + }, "India Today": { domain: "indiatoday.in", allow_cookies: 1,