diff --git a/README.md b/README.md index 7373187..261fbca 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,7 @@ [Investors Chronicle](https://www.investorschronicle.co.uk)\ [La Repubblica](https://www.repubblica.it)\ [Le Monde](https://www.lemonde.fr)\ +[Le Parisien](http://www.leparisien.fr)\ [Le Temps](https://www.letemps.ch)\ [London Review of Books](https://lrb.co.uk)\ [Los Angeles Times](https://www.latimes.com)\ diff --git a/background.js b/background.js index 00c8588..e8ef8dd 100644 --- a/background.js +++ b/background.js @@ -36,6 +36,7 @@ var defaultSites = { 'Investors Chronicle': 'investorschronicle.co.uk', 'La Repubblica': 'repubblica.it', 'Le Monde': 'lemonde.fr', + 'Le Parisien': 'leparisien.fr', 'Le Temps': 'letemps.ch', 'London Review of Books': 'lrb.co.uk', 'Los Angeles Times': 'latimes.com', @@ -99,7 +100,8 @@ var defaultSites = { }; const restrictions = { - 'barrons.com': 'barrons.com/articles' + 'barrons.com': 'barrons.com/articles', + 'wsj.com': 'wsj.com/articles' } // Don't remove cookies before page load @@ -186,7 +188,8 @@ const remove_cookies = [ // select specific cookie(s) to hold from remove_cookies domains const remove_cookies_select_hold = { - 'washingtonpost.com': ['wp_gdpr'] + 'washingtonpost.com': ['wp_gdpr'], + 'qz.com': ['gdpr'] } // select only specific cookie(s) to drop from remove_cookies domains @@ -235,7 +238,8 @@ const blockedRegexes = { 'lrb.co.uk': /.+\.tinypass\.com\/.+/, 'bostonglobe.com': /meter\.bostonglobe\.com\/js\/.+/, 'foreignpolicy.com': /.+\.tinypass\.com\/.+/, -'inquirer.com': /.+\.tinypass\.com\/.+/ +'inquirer.com': /.+\.tinypass\.com\/.+/, +'spectator.co.uk': /.+\.tinypass\.com\/.+/ }; const userAgentDesktop = "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)" @@ -303,8 +307,13 @@ browser.webRequest.onBeforeSendHeaders.addListener(function(details) { // check for blocked regular expression: domain enabled, match regex, block on an internal or external regex for (var domain in blockedRegexes) { - if (isSiteEnabled({url: '.'+ domain}) && details.url.match(blockedRegexes[domain])) { + if ((isSiteEnabled({url: '.'+ domain}) || isSiteEnabled({url: header_referer})) && details.url.match(blockedRegexes[domain])) { if (details.url.indexOf(domain) !== -1 || header_referer.indexOf(domain) !== -1) { + // allow BG paywall-script to set cookies in homepage/sections (else no article-text) + if (details.url.indexOf('meter.bostonglobe.com/js/') !== -1 && (header_referer === 'https://www.bostonglobe.com/' + || header_referer.indexOf('/?p1=BGHeader_') !== -1 || header_referer.indexOf('/?p1=BGMenu_') !== -1)) { + break; + } return { cancel: true }; } } @@ -439,7 +448,7 @@ browser.webRequest.onCompleted.addListener(function(details) { function isSiteEnabled(details) { var isEnabled = enabledSites.some(function(enabledSite) { - var useSite = details.url.indexOf("." + enabledSite) !== -1; + var useSite = (details.url.indexOf("." + enabledSite) !== -1 || details.url.indexOf("/" + enabledSite) !== -1); if (enabledSite in restrictions) { return useSite && details.url.indexOf(restrictions[enabledSite]) !== -1; } diff --git a/contentScript.js b/contentScript.js index a0aad28..2ac575e 100644 --- a/contentScript.js +++ b/contentScript.js @@ -6,6 +6,7 @@ var localstorage_hold = arr_localstorage_hold.some(function(url) { if (!localstorage_hold){ window.localStorage.clear(); } + if (window.location.href.indexOf("bizjournals.com") !== -1) { const hiddenStory = document.getElementsByClassName( "js-pre-chunks__story-body" @@ -196,6 +197,18 @@ if (window.location.href.indexOf("the-tls.co.uk") !== -1) { removeDOMElement(paywall); } +if (window.location.href.indexOf("leparisien.fr") !== -1) { + window.removeEventListener('scroll', this.scrollListener); + const paywall = document.querySelector('.relative.piano-paywall.below_nav.sticky'); + removeDOMElement(paywall); + setTimeout(function () { + var content = document.getElementsByClassName('content'); + for (var i = 0; i < content.length; i++) { + content[i].removeAttribute("style"); + } + }, 300); // Delay (in milliseconds) +} + function removeDOMElement(...elements) { for (let element of elements) { if (element) element.remove(); diff --git a/manifest.json b/manifest.json index 2a8cb74..ee7aab1 100644 --- a/manifest.json +++ b/manifest.json @@ -22,7 +22,8 @@ "*://*.volkskrant.nl/*", "*://*.washingtonpost.com/*", "*://*.economist.com/*", - "*://*.the-tls.co.uk/*" + "*://*.the-tls.co.uk/*", + "*://*.leparisien.fr/*" ], "js": ["contentScript.js"] } @@ -154,7 +155,8 @@ "*://*.harpers.org/*", "*://*.nknews.org/*", "*://*.inquirer.com/*", - "*://*.indiatimes.com/*" + "*://*.indiatimes.com/*", + "*://*.leparisien.fr/*" ], "version": "1.6.2" } diff --git a/options.js b/options.js index 6bc4e2d..19fbbbe 100644 --- a/options.js +++ b/options.js @@ -34,6 +34,7 @@ var defaultSites = { 'Investors Chronicle': 'investorschronicle.co.uk', 'La Repubblica': 'repubblica.it', 'Le Monde': 'lemonde.fr', + 'Le Parisien': 'leparisien.fr', 'Le Temps': 'letemps.ch', 'London Review of Books': 'lrb.co.uk', 'Los Angeles Times': 'latimes.com',