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).
master
magnolia1234 2019-10-23 13:06:43 +02:00 committed by GitHub
parent 852f2f5cd9
commit 1adf9ce633
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 75 additions and 65 deletions

View File

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

View File

@ -31,6 +31,7 @@ var defaultSites = {
'Inc.com': 'inc.com',
'Investors Chronicle': 'investorschronicle.co.uk',
'La Repubblica': 'repubblica.it',
'Le Monde': 'lemonde.fr',
'Le Temps': 'letemps.ch',
'Los Angeles Times': 'latimes.com',
'Medium': 'medium.com',
@ -74,7 +75,7 @@ var defaultSites = {
'The Spectator': 'spectator.co.uk',
'The Seattle Times': 'seattletimes.com',
'The Sydney Morning Herald': 'smh.com.au',
'The Telegraph': 'telegraph.co.uk',
'The Telegraph': 'telegraph.co.uk',
'The Times': 'thetimes.co.uk',
'The Toronto Star': 'thestar.com',
'The Washington Post': 'washingtonpost.com',
@ -92,78 +93,65 @@ const restrictions = {
// Don't remove cookies before page load
const allow_cookies = [
'ad.nl',
'asia.nikkei.com',
'nytimes.com',
'wsj.com',
'ft.com',
'letemps.ch',
'mercurynews.com',
'economist.com',
'bostonglobe.com',
'denverpost.com',
'hacked.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',
'economist.com',
'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',
'spectator.co.uk',
'telegraaf.nl',
'theadvocate.com.au',
'theaustralian.com.au',
'thestar.com',
'towardsdatascience.com',
'trouw.nl',
'vn.nl',
'volkskrant.nl'
'volkskrant.nl',
'washingtonpost.com',
'wsj.com',
]
// Removes cookies after page load
const remove_cookies = [
'ad.nl',
'asia.nikkei.com',
'nytimes.com',
'ft.com',
'letemps.ch',
'mercurynews.com',
'theage.com.au',
'economist.com',
'bostonglobe.com',
'denverpost.com',
'hacked.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',
'economist.com',
'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',
'vn.nl'
'theadvocate.com.au',
'thestar.com',
'towardsdatascience.com',
'vn.nl',
'washingtonpost.com',
'wsj.com',
]
// 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) {
if (element) element.remove();
}

View File

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

View File

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