From 5b80e9dacfd920c22ccc82fd0c7f64401d413c0c Mon Sep 17 00:00:00 2001 From: magnolia1234 <7676006-magnolia1234@users.noreply.gitlab.com> Date: Mon, 21 Oct 2019 21:32:09 +0200 Subject: [PATCH] Add Le Monde (lemonde.fr) Removing Le Monde paywall while keeping article recommendations in paywall-container. Also removes persistent cookie-banner which links to google.com (only visible with extension). --- README.md | 1 + background.js | 3 ++- contentScript.js | 23 +++++++++++++++++++++-- options.js | 1 + 4 files changed, 25 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index a91d332..05eca40 100644 --- a/README.md +++ b/README.md @@ -50,6 +50,7 @@ [LA Business Journal](labusinessjournal.com)\ [La Repubblica](https://www.repubblica.it)\ [La Tercera](latercera.com)\ +[Le Monde](https://www.lemonde.fr)\ [Les Échos](https://lesechos.fr)\ [Libération](https://liberation.fr)\ [Loeb Classical Library](https://www.loebclassics.com)\ diff --git a/background.js b/background.js index 3bfd0e7..accea15 100644 --- a/background.js +++ b/background.js @@ -38,6 +38,7 @@ var defaultSites = { 'LA Business Journal': 'labusinessjournal.com', 'La Repubblica': 'repubblica.it', 'La Tercera': 'latercera.com', + 'Le Monde': 'lemonde.fr', 'Liberation': 'liberation.fr', 'Loeb Classical Library': 'loebclassics.com', 'Los Angeles Times': 'latimes.com', @@ -112,6 +113,7 @@ const allow_cookies = [ 'examiner.com.au', 'ft.com', 'hbr.org', +'lemonde.fr', 'medium.com', 'mercurynews.com', 'mexiconewsdaily.com', @@ -164,7 +166,6 @@ const use_google_bot = [ 'zeit.de', 'nytimes.com', 'mexiconewsdaily.com', -'nytimes.com', 'thetimes.co.uk', ] diff --git a/contentScript.js b/contentScript.js index 067a9f9..906b703 100644 --- a/contentScript.js +++ b/contentScript.js @@ -135,9 +135,28 @@ if (window.location.href.indexOf("bloombergquint.com") !== -1) { removeDOMElement(articlesLeftModal, paywall); } +if (window.location.href.indexOf('lemonde.fr') !== -1) { + document.addEventListener('DOMContentLoaded', () => { + const hidden_section = document.getElementsByClassName('article__content--restricted-media')[0]; + if (hidden_section) + hidden_section.classList.remove('article__content--restricted-media'); + const longform_article_restricted = document.getElementsByClassName('article__content--restricted')[0]; + if (longform_article_restricted) + longform_article_restricted.classList.remove('article__content--restricted'); + const longform_paywall = document.getElementsByClassName('paywall--longform')[0]; + if (longform_paywall) + longform_paywall.classList.remove('paywall--longform'); + const paywall = document.getElementById('js-paywall-content'); + const friend_paywall = document.getElementsByClassName('friend--paywall')[0]; + const cookie_banner = document.getElementById('cookie-banner'); + removeDOMElement(paywall, friend_paywall, cookie_banner); + }); +} + + function removeDOMElement(...elements) { - for (var element of elements) { + for (let element of elements) { if (element) element.remove(); } -} +} \ No newline at end of file diff --git a/options.js b/options.js index 2b7b621..e11bab6 100644 --- a/options.js +++ b/options.js @@ -35,6 +35,7 @@ var defaultSites = { 'LA Business Journal': 'labusinessjournal.com', 'La Repubblica': 'repubblica.it', 'La Tercera': 'latercera.com', + 'Le Monde': 'lemonde.fr', 'Les Echos': 'lesechos.fr', 'Liberation': 'liberation.fr', 'Loeb Classical Library': 'loebclassics.com',