From ed10aa8d0e106ad025fcec2cc2166fd5c5a547af Mon Sep 17 00:00:00 2001 From: magnolia1234 <7676006-magnolia1234@users.noreply.gitlab.com> Date: Sat, 1 Jan 2022 19:01:19 +0100 Subject: [PATCH] Add The Independent (UK - archive.today for premium) --- README.md | 1 + changelog.txt | 1 + contentScript.js | 22 +++++++++++++++++++++- manifest.json | 3 ++- sites.js | 5 +++++ 5 files changed, 30 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b017d69..4a0e605 100644 --- a/README.md +++ b/README.md @@ -280,6 +280,7 @@ Grouped in options:\ [Prospect Magazine](https://www.prospectmagazine.co.uk) - [The Athletic UK](https://theathletic.co.uk) - [The Economist](https://www.economist.com) - +[The Independent](https://www.independent.co.uk) - [The New Statesman](https://www.newstatesman.com) - [The Spectator](https://www.spectator.co.uk) - [The Telegraph](https://www.telegraph.co.uk) - diff --git a/changelog.txt b/changelog.txt index cb2889e..4fc4266 100644 --- a/changelog.txt +++ b/changelog.txt @@ -5,6 +5,7 @@ Post-release Add Capital Gazette (local USA) Add Groupe Nice-Matin (France) Add Il Foglio (Italy) +Add The Independent (UK - archive.today for premium) Fix group Tribune Publishing Company (js) Fix The New Statesman (Evolok) Update popup (permission to clear cookies) diff --git a/contentScript.js b/contentScript.js index b88f2af..d098c87 100644 --- a/contentScript.js +++ b/contentScript.js @@ -1692,7 +1692,25 @@ else } else if (window.location.hostname.match(/\.(ie|uk)$/) || matchDomain(['theathletic.com'])) {//united kingdom/ireland -if (matchDomain('prospectmagazine.co.uk')) { +if (matchDomain('independent.co.uk')) { + let url = window.location.href; + if (url.includes('?amp')) { + let ads = document.querySelectorAll('amp-ad, amp-embed, [id^="ad-"]'); + removeDOMElement(...ads); + } else { + let paywall = document.querySelector('div.article-premium'); + let related = document.querySelector('div.related'); + let msg = document.querySelector('div#bpc_archive'); + if (paywall && !related && !msg) { + paywall.classList.remove('article-premium'); + let article = document.querySelector('div#main'); + if (article) + article.insertBefore(archiveLink(url), article.firstChild); + } + } +} + +else if (matchDomain('prospectmagazine.co.uk')) { let url = window.location.href; document.addEventListener('DOMContentLoaded', () => { let paywall = document.querySelector('div.paywall_overlay_blend, div.paywall'); @@ -2564,6 +2582,8 @@ else if (matchDomain('nationalgeographic.com')) { if (overlay) overlay.classList.remove('Article__Content__Overlay--gated'); } + let ads = document.querySelectorAll('div.ad-slot'); + removeDOMElement(...ads); } else if (matchDomain('nationalreview.com')) { diff --git a/manifest.json b/manifest.json index 6d6e2cf..4e7f849 100644 --- a/manifest.json +++ b/manifest.json @@ -254,6 +254,7 @@ "*://*.iltelegrafolivorno.it/*", "*://*.inc.com/*", "*://*.inc42.com/*", + "*://*.independent.co.uk/*", "*://*.independent.ie/*", "*://*.indianexpress.com/*", "*://*.indystar.com/*", @@ -603,5 +604,5 @@ "*://*.wsj.net/*", "*://*.zephr.com/*" ], - "version": "2.4.9.4" + "version": "2.4.9.5" } diff --git a/sites.js b/sites.js index d7a459e..d97b333 100644 --- a/sites.js +++ b/sites.js @@ -1484,6 +1484,11 @@ var defaultSites = { allow_cookies: 1, block_regex: /(cdn\.cxense\.com\/|\.tinypass\.com\/|cdn\.ampproject\.org\/v\d\/amp-(access|(sticky-)?ad(s)?)-.+\.js)/ }, + "The Independent": { + domain: "independent.co.uk", + allow_cookies: 1, + block_regex: /(\.tinypass\.com\/|cdn\.ampproject\.org\/v\d\/amp-(access|(sticky-)?ad)-.+\.js)/ + }, "The Indian Express": { domain: "indianexpress.com", allow_cookies: 1,