Add Le Monde & maintenance background.js

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).

Maintenance: sites only in remove_cookies settings are obsolete because cookies are erased by default (when not in allow_cookies).
This commit is contained in:
magnolia1234 2019-10-23 13:06:43 +02:00 committed by GitHub
parent 861b8fa554
commit 9164c4eacf
5 changed files with 75 additions and 65 deletions

View file

@ -34,6 +34,7 @@
[Inc.com](https://www.inc.com)\ [Inc.com](https://www.inc.com)\
[Investors Chronicle](https://www.investorschronicle.co.uk)\ [Investors Chronicle](https://www.investorschronicle.co.uk)\
[La Repubblica](https://www.repubblica.it)\ [La Repubblica](https://www.repubblica.it)\
[Le Monde](https://www.lemonde.fr)\
[Le Temps](https://www.letemps.ch)\ [Le Temps](https://www.letemps.ch)\
[Los Angeles Times](https://www.latimes.com)\ [Los Angeles Times](https://www.latimes.com)\
[Medium](https://www.medium.com)\ [Medium](https://www.medium.com)\

View file

@ -31,6 +31,7 @@ var defaultSites = {
'Inc.com': 'inc.com', 'Inc.com': 'inc.com',
'Investors Chronicle': 'investorschronicle.co.uk', 'Investors Chronicle': 'investorschronicle.co.uk',
'La Repubblica': 'repubblica.it', 'La Repubblica': 'repubblica.it',
'Le Monde': 'lemonde.fr',
'Le Temps': 'letemps.ch', 'Le Temps': 'letemps.ch',
'Los Angeles Times': 'latimes.com', 'Los Angeles Times': 'latimes.com',
'Medium': 'medium.com', 'Medium': 'medium.com',
@ -74,7 +75,7 @@ var defaultSites = {
'The Spectator': 'spectator.co.uk', 'The Spectator': 'spectator.co.uk',
'The Seattle Times': 'seattletimes.com', 'The Seattle Times': 'seattletimes.com',
'The Sydney Morning Herald': 'smh.com.au', 'The Sydney Morning Herald': 'smh.com.au',
'The Telegraph': 'telegraph.co.uk', 'The Telegraph': 'telegraph.co.uk',
'The Times': 'thetimes.co.uk', 'The Times': 'thetimes.co.uk',
'The Toronto Star': 'thestar.com', 'The Toronto Star': 'thestar.com',
'The Washington Post': 'washingtonpost.com', 'The Washington Post': 'washingtonpost.com',
@ -92,78 +93,65 @@ const restrictions = {
// Don't remove cookies before page load // Don't remove cookies before page load
const allow_cookies = [ const allow_cookies = [
'ad.nl',
'asia.nikkei.com', 'asia.nikkei.com',
'nytimes.com',
'wsj.com',
'ft.com',
'letemps.ch',
'mercurynews.com',
'economist.com',
'bostonglobe.com', 'bostonglobe.com',
'denverpost.com', 'denverpost.com',
'hacked.com', 'economist.com',
'ocregister.com',
'newstatesman.com',
'spectator.co.uk',
'towardsdatascience.com',
'medium.com',
'theadvocate.com.au',
'examiner.com.au',
'thestar.com',
'washingtonpost.com',
'hbr.org',
'nymag.com',
'theaustralian.com.au',
'ad.nl',
'ed.nl', 'ed.nl',
'examiner.com.au',
'ft.com',
'hacked.com',
'hbr.org',
'lemonde.fr',
'letemps.ch',
'medium.com',
'mercurynews.com',
'newstatesman.com',
'nymag.com',
'nytimes.com',
'ocregister.com',
'parool.nl', 'parool.nl',
'spectator.co.uk',
'telegraaf.nl', 'telegraaf.nl',
'theadvocate.com.au',
'theaustralian.com.au',
'thestar.com',
'towardsdatascience.com',
'trouw.nl', 'trouw.nl',
'vn.nl', 'vn.nl',
'volkskrant.nl' 'volkskrant.nl',
'washingtonpost.com',
'wsj.com',
] ]
// Removes cookies after page load // Removes cookies after page load
const remove_cookies = [ const remove_cookies = [
'ad.nl',
'asia.nikkei.com', 'asia.nikkei.com',
'nytimes.com',
'ft.com',
'letemps.ch',
'mercurynews.com',
'theage.com.au',
'economist.com',
'bostonglobe.com', 'bostonglobe.com',
'denverpost.com', 'denverpost.com',
'hacked.com', 'economist.com',
'ocregister.com',
'newstatesman.com',
'spectator.co.uk',
'towardsdatascience.com',
'medium.com',
'theadvocate.com.au',
'examiner.com.au',
'thestar.com',
'centralwesterndaily.com.au',
'theherald.com.au',
'foreignpolicy.com',
'wsj.com',
'glassdoor.com',
'cen.acs.org',
'hbr.org',
'thenewsrep.com',
'washingtonpost.com',
'nymag.com',
'nationalpost.com',
'handelsblatt.com',
'thediplomat.com',
'latimes.com',
'theatlantic.com',
'chicagobusiness.com',
'qz.com',
'ad.nl',
'ed.nl', 'ed.nl',
'examiner.com.au',
'ft.com',
'hacked.com',
'hbr.org',
'letemps.ch',
'medium.com',
'mercurynews.com',
'newstatesman.com',
'nymag.com',
'nytimes.com',
'ocregister.com',
'spectator.co.uk',
'telegraaf.nl', 'telegraaf.nl',
'vn.nl' 'theadvocate.com.au',
'thestar.com',
'towardsdatascience.com',
'vn.nl',
'washingtonpost.com',
'wsj.com',
] ]
// Override User-Agent with Googlebot // Override User-Agent with Googlebot

View file

@ -127,7 +127,25 @@ if (window.location.href.indexOf("parool.nl") !== -1 || window.location.href.ind
}); });
} }
function removeDOMElement(elements) { 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 (let element of elements) { for (let element of elements) {
if (element) element.remove(); if (element) element.remove();
} }

View file

@ -5,18 +5,19 @@
"content_scripts": [ "content_scripts": [
{ {
"matches": [ "matches": [
"*://*.bizjournals.com/*", "*://*.bizjournals.com/*",
"*://*.businessinsider.com/*", "*://*.bloomberg.com/*",
"*://*.haaretz.co.il/*", "*://*.businessinsider.com/*",
"*://*.nzherald.co.nz/*",
"*://*.repubblica.it/*",
"*://*.washingtonpost.com/*",
"*://*.ed.nl/*", "*://*.ed.nl/*",
"*://*.haaretz.co.il/*",
"*://*.lemonde.fr/*",
"*://*.nzherald.co.nz/*",
"*://*.parool.nl/*", "*://*.parool.nl/*",
"*://*.repubblica.it/*",
"*://*.telegraaf.nl/*", "*://*.telegraaf.nl/*",
"*://*.trouw.nl/*", "*://*.trouw.nl/*",
"*://*.volkskrant.nl/*", "*://*.volkskrant.nl/*",
"*://*.bloomberg.com/*" "*://*.washingtonpost.com/*"
], ],
"js": ["contentScript.js"] "js": ["contentScript.js"]
} }
@ -136,7 +137,8 @@
"*://*.parool.nl/*", "*://*.parool.nl/*",
"*://*.telegraaf.nl/*", "*://*.telegraaf.nl/*",
"*://*.trouw.nl/*", "*://*.trouw.nl/*",
"*://*.vn.nl/*" "*://*.vn.nl/*",
"*://*.lemonde.fr/*"
], ],
"version": "1.5.9" "version": "1.5.9"
} }

View file

@ -29,6 +29,7 @@ var defaultSites = {
'Inc.com': 'inc.com', 'Inc.com': 'inc.com',
'Investors Chronicle': 'investorschronicle.co.uk', 'Investors Chronicle': 'investorschronicle.co.uk',
'La Repubblica': 'repubblica.it', 'La Repubblica': 'repubblica.it',
'Le Monde': 'lemonde.fr',
'Le Temps': 'letemps.ch', 'Le Temps': 'letemps.ch',
'Los Angeles Times': 'latimes.com', 'Los Angeles Times': 'latimes.com',
'Medium': 'medium.com', 'Medium': 'medium.com',