Merge pull request #400 from magnolia1234/master

Fix Economist/Boston Globe & add London Review of Books/Times Literary Supplement/Harper's Magazine
merge-requests/1/head
ghost 5 years ago committed by GitHub
commit 807e5b9441

@ -31,6 +31,7 @@
[Haaretz.co.il](https://www.haaretz.co.il)\ [Haaretz.co.il](https://www.haaretz.co.il)\
[Haaretz.com](https://www.haaretz.com)\ [Haaretz.com](https://www.haaretz.com)\
[Handelsblatt](https://www.handelsblatt.com)\ [Handelsblatt](https://www.handelsblatt.com)\
[Harper's Magazine](https://harpers.org)\
[Hartford Courant](https://www.courant.com)\ [Hartford Courant](https://www.courant.com)\
[Harvard Business Review](https://www.hbr.org)\ [Harvard Business Review](https://www.hbr.org)\
[Inc.com](https://www.inc.com)\ [Inc.com](https://www.inc.com)\
@ -38,6 +39,7 @@
[La Repubblica](https://www.repubblica.it)\ [La Repubblica](https://www.repubblica.it)\
[Le Monde](https://www.lemonde.fr)\ [Le Monde](https://www.lemonde.fr)\
[Le Temps](https://www.letemps.ch)\ [Le Temps](https://www.letemps.ch)\
[London Review of Books] (https://lrb.co.uk)\
[Los Angeles Times](https://www.latimes.com)\ [Los Angeles Times](https://www.latimes.com)\
[Medium](https://www.medium.com)\ [Medium](https://www.medium.com)\
[Medscape](https://www.medscape.com)\ [Medscape](https://www.medscape.com)\
@ -88,6 +90,7 @@
[The Toronto Star](https://www.thestar.com)\ [The Toronto Star](https://www.thestar.com)\
[The Washington Post](https://www.washingtonpost.com)\ [The Washington Post](https://www.washingtonpost.com)\
[The Wall Street Journal](https://www.wsj.com)\ [The Wall Street Journal](https://www.wsj.com)\
[Times Literary Supplement](https://www.the-tls.co.uk)\
[Towards Data Science](https://www.towardsdatascience.com)\ [Towards Data Science](https://www.towardsdatascience.com)\
[Trouw](https://www.trouw.nl)\ [Trouw](https://www.trouw.nl)\
[Vanity Fair](https://www.vanityfair.com)\ [Vanity Fair](https://www.vanityfair.com)\

@ -28,6 +28,7 @@ var defaultSites = {
'Haaretz': 'haaretz.co.il', 'Haaretz': 'haaretz.co.il',
'Haaretz English': 'haaretz.com', 'Haaretz English': 'haaretz.com',
'Handelsblatt': 'handelsblatt.com', 'Handelsblatt': 'handelsblatt.com',
'Harper\'s Magazine': 'harpers.org',
'Hartford Courant': 'courant.com', 'Hartford Courant': 'courant.com',
'Harvard Business Review': 'hbr.org', 'Harvard Business Review': 'hbr.org',
'Inc.com': 'inc.com', 'Inc.com': 'inc.com',
@ -35,6 +36,7 @@ var defaultSites = {
'La Repubblica': 'repubblica.it', 'La Repubblica': 'repubblica.it',
'Le Monde': 'lemonde.fr', 'Le Monde': 'lemonde.fr',
'Le Temps': 'letemps.ch', 'Le Temps': 'letemps.ch',
'London Review of Books': 'lrb.co.uk',
'Los Angeles Times': 'latimes.com', 'Los Angeles Times': 'latimes.com',
'Medium': 'medium.com', 'Medium': 'medium.com',
'Medscape': 'medscape.com', 'Medscape': 'medscape.com',
@ -85,6 +87,7 @@ var defaultSites = {
'The Toronto Star': 'thestar.com', 'The Toronto Star': 'thestar.com',
'The Washington Post': 'washingtonpost.com', 'The Washington Post': 'washingtonpost.com',
'The Wall Street Journal': 'wsj.com', 'The Wall Street Journal': 'wsj.com',
'Times Literary Supplement': 'the-tls.co.uk',
'Towards Data Science': 'towardsdatascience.com', 'Towards Data Science': 'towardsdatascience.com',
'Trouw': 'trouw.nl', 'Trouw': 'trouw.nl',
'Vanity Fair': 'vanityfair.com', 'Vanity Fair': 'vanityfair.com',
@ -110,6 +113,7 @@ const allow_cookies = [
'examiner.com.au', 'examiner.com.au',
'ft.com', 'ft.com',
'hacked.com', 'hacked.com',
'harpers.org',
'hbr.org', 'hbr.org',
'lemonde.fr', 'lemonde.fr',
'letemps.ch', 'letemps.ch',
@ -153,6 +157,7 @@ const remove_cookies = [
'examiner.com.au', 'examiner.com.au',
'ft.com', 'ft.com',
'hacked.com', 'hacked.com',
'harpers.org',
'hbr.org', 'hbr.org',
'letemps.ch', 'letemps.ch',
'medium.com', 'medium.com',
@ -179,7 +184,6 @@ const remove_cookies = [
// select specific cookie(s) to hold from remove_cookies domains // select specific cookie(s) to hold from remove_cookies domains
const remove_cookies_select_hold = { const remove_cookies_select_hold = {
'nrc.nl': ['nmt_closed_cookiebar'],
'washingtonpost.com': ['wp_gdpr'], 'washingtonpost.com': ['wp_gdpr'],
'wsj.com': ['wsjregion'] 'wsj.com': ['wsjregion']
} }
@ -187,7 +191,9 @@ const remove_cookies_select_hold = {
// select only specific cookie(s) to drop from remove_cookies domains // select only specific cookie(s) to drop from remove_cookies domains
const remove_cookies_select_drop = { const remove_cookies_select_drop = {
'ad.nl': ['temptationTrackingId'], 'ad.nl': ['temptationTrackingId'],
'bostonglobe.com': ['FMPaywall'],
'demorgen.be': ['TID_ID'], 'demorgen.be': ['TID_ID'],
'economist.com': ['rvuuid'],
'ed.nl': ['temptationTrackingId'], 'ed.nl': ['temptationTrackingId'],
'nrc.nl': ['counter'] 'nrc.nl': ['counter']
} }
@ -216,12 +222,16 @@ function setDefaultOptions() {
}); });
} }
const blockedRegexes = [ // to block external script also add domain to manifest.json (permissions)
/.+:\/\/.+\.tribdss\.com\//, const blockedRegexes = {
/thenation\.com\/.+\/paywall-script\.php/, 'chicagotribune.com': /.+:\/\/.+\.tribdss\.com\//,
/haaretz\.co\.il\/htz\/js\/inter\.js/, 'thenation.com': /thenation\.com\/.+\/paywall-script\.php/,
/nzherald\.co\.nz\/.+\/headjs\/.+\.js/ 'haaretz.co.il': /haaretz\.co\.il\/htz\/js\/inter\.js/,
]; 'nzherald.co.nz': /nzherald\.co\.nz\/.+\/headjs\/.+\.js/,
'economist.com': /.+\.tinypass\.com\/.+/,
'lrb.co.uk': /.+\.tinypass\.com\/.+/,
'bostonglobe.com': /meter\.bostonglobe\.com\/js\/.+/
};
const userAgentDesktop = "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)" const userAgentDesktop = "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)"
const userAgentMobile = "Chrome/41.0.2272.96 Mobile Safari/537.36 (compatible ; Googlebot/2.1 ; +http://www.google.com/bot.html)" const userAgentMobile = "Chrome/41.0.2272.96 Mobile Safari/537.36 (compatible ; Googlebot/2.1 ; +http://www.google.com/bot.html)"
@ -261,31 +271,6 @@ browser.runtime.onInstalled.addListener(function(details) {
} }
}); });
/**
// WSJ bypass
browser.webRequest.onBeforeSendHeaders.addListener(function(details) {
if (!isSiteEnabled(details) || details.url.indexOf("mod=rsswn") !== -1 || details.url.indexOf("/print-edition/") !== -1) {
return;
}
var param;
var updatedUrl;
param = getParameterByName("mod", details.url);
if (param === null) {
updatedUrl = stripQueryStringAndHashFromPath(details.url);
updatedUrl += "?mod=rsswn";
} else {
updatedUrl = details.url.replace(param, "rsswn");
}
return { redirectUrl: updatedUrl};
},
{urls:["*://*.wsj.com/*"], types:["main_frame"]},
["blocking"]
);
**/
// Disable javascript for these sites // Disable javascript for these sites
chrome.webRequest.onBeforeRequest.addListener(function(details) { chrome.webRequest.onBeforeRequest.addListener(function(details) {
if (!isSiteEnabled(details) || details.url.indexOf("mod=rsswn") !== -1) { if (!isSiteEnabled(details) || details.url.indexOf("mod=rsswn") !== -1) {
@ -294,24 +279,38 @@ chrome.webRequest.onBeforeRequest.addListener(function(details) {
return {cancel: true}; return {cancel: true};
}, },
{ {
urls: ["*://*.theglobeandmail.com/*", "*://*.economist.com/*", "*://*.thestar.com/*", "*://*.newstatesman.com/*", "*://*.bostonglobe.com/*", "*://*.afr.com/*"], urls: ["*://*.theglobeandmail.com/*", "*://*.thestar.com/*", "*://*.newstatesman.com/*", "*://*.afr.com/*"],
types: ["script"] types: ["script"]
}, },
["blocking"] ["blocking"]
); );
browser.webRequest.onBeforeSendHeaders.addListener(function(details) { browser.webRequest.onBeforeSendHeaders.addListener(function(details) {
if (!isSiteEnabled(details)) { var requestHeaders = details.requestHeaders;
return;
var header_referer = '';
for (var n in requestHeaders) {
if (requestHeaders[n].name.toLowerCase() == 'referer') {
header_referer = requestHeaders[n].value;
continue;
}
}
// 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 (details.url.indexOf(domain) !== -1 || header_referer.indexOf(domain) !== -1) {
return { cancel: true };
}
}
} }
if (blockedRegexes.some(function(regex) { return regex.test(details.url); })) { if (!isSiteEnabled(details)) {
return { cancel: true }; return;
} }
var requestHeaders = details.requestHeaders;
var tabId = details.tabId; var tabId = details.tabId;
var useUserAgentMobile = false; var useUserAgentMobile = false;
var setReferer = false; var setReferer = false;
@ -425,7 +424,6 @@ browser.webRequest.onCompleted.addListener(function(details) {
if ((rc_domain in remove_cookies_select_drop) && !(remove_cookies_select_drop[rc_domain].includes(cookies[i].name))){ if ((rc_domain in remove_cookies_select_drop) && !(remove_cookies_select_drop[rc_domain].includes(cookies[i].name))){
continue; // only remove specific cookie continue; // only remove specific cookie
} }
browser.cookies.remove(cookie); browser.cookies.remove(cookie);
} }
}); });

@ -1,4 +1,11 @@
window.localStorage.clear(); var arr_localstorage_hold = ['economist.com'];
var localstorage_hold = arr_localstorage_hold.some(function(url) {
return window.location.href.indexOf(url) !== -1;
});
if (!localstorage_hold){
window.localStorage.clear();
}
if (window.location.href.indexOf("bizjournals.com") !== -1) { if (window.location.href.indexOf("bizjournals.com") !== -1) {
const hiddenStory = document.getElementsByClassName( const hiddenStory = document.getElementsByClassName(
"js-pre-chunks__story-body" "js-pre-chunks__story-body"
@ -171,6 +178,24 @@ if (window.location.href.indexOf("caixinglobal.com") !== -1) {
} }
} }
if (window.location.href.indexOf("economist.com") !== -1) {
document.addEventListener('DOMContentLoaded', () => {
const wrapper = document.getElementById('bottom-page-wrapper');
removeDOMElement(wrapper);
setTimeout(function () {
const paywall = document.querySelector('.layout-article-regwall');;
if (paywall) {
window.location.reload(true);
}
}, 600); // Delay (in milliseconds)
});
}
if (window.location.href.indexOf("the-tls.co.uk") !== -1) {
const paywall = document.querySelector('.tls-subscriptions-banner__closed-skin');
removeDOMElement(paywall);
}
function removeDOMElement(...elements) { function removeDOMElement(...elements) {
for (let element of elements) { for (let element of elements) {
if (element) element.remove(); if (element) element.remove();

@ -20,7 +20,9 @@
"*://*.telegraaf.nl/*", "*://*.telegraaf.nl/*",
"*://*.trouw.nl/*", "*://*.trouw.nl/*",
"*://*.volkskrant.nl/*", "*://*.volkskrant.nl/*",
"*://*.washingtonpost.com/*" "*://*.washingtonpost.com/*",
"*://*.economist.com/*",
"*://*.the-tls.co.uk/*"
], ],
"js": ["contentScript.js"] "js": ["contentScript.js"]
} }
@ -145,7 +147,11 @@
"*://*.lemonde.fr/*", "*://*.lemonde.fr/*",
"*://*.scientificamerican.com/*", "*://*.scientificamerican.com/*",
"*://*.thehindu.com/*", "*://*.thehindu.com/*",
"*://*.demorgen.be/*" "*://*.demorgen.be/*",
"*://*.tinypass.com/*",
"*://*.lrb.co.uk/*",
"*://*.the-tls.co.uk/*",
"*://*.harpers.org/*"
], ],
"version": "1.6.2" "version": "1.6.2"
} }

@ -17,7 +17,7 @@ var defaultSites = {
'De Groene Amsterdammer': 'groene.nl', 'De Groene Amsterdammer': 'groene.nl',
'De Tijd': 'tijd.be', 'De Tijd': 'tijd.be',
'de Volkskrant': 'volkskrant.nl', 'de Volkskrant': 'volkskrant.nl',
'The Economist (javascript disabled)': 'economist.com', 'The Economist': 'economist.com',
'Eindhovens Dagblad': 'ed.nl', 'Eindhovens Dagblad': 'ed.nl',
'Examiner': 'examiner.com.au', 'Examiner': 'examiner.com.au',
'Financial Times': 'ft.com', 'Financial Times': 'ft.com',
@ -26,6 +26,7 @@ var defaultSites = {
'Haaretz': 'haaretz.co.il', 'Haaretz': 'haaretz.co.il',
'Haaretz English': 'haaretz.com', 'Haaretz English': 'haaretz.com',
'Handelsblatt': 'handelsblatt.com', 'Handelsblatt': 'handelsblatt.com',
'Harper\'s Magazine': 'harpers.org',
'Hartford Courant': 'courant.com', 'Hartford Courant': 'courant.com',
'Harvard Business Review': 'hbr.org', 'Harvard Business Review': 'hbr.org',
'Inc.com': 'inc.com', 'Inc.com': 'inc.com',
@ -33,6 +34,7 @@ var defaultSites = {
'La Repubblica': 'repubblica.it', 'La Repubblica': 'repubblica.it',
'Le Monde': 'lemonde.fr', 'Le Monde': 'lemonde.fr',
'Le Temps': 'letemps.ch', 'Le Temps': 'letemps.ch',
'London Review of Books': 'lrb.co.uk',
'Los Angeles Times': 'latimes.com', 'Los Angeles Times': 'latimes.com',
'Medium': 'medium.com', 'Medium': 'medium.com',
'Medscape': 'medscape.com', 'Medscape': 'medscape.com',
@ -59,7 +61,7 @@ var defaultSites = {
'The Atlantic': 'theatlantic.com', 'The Atlantic': 'theatlantic.com',
'The Australian': 'theaustralian.com.au', 'The Australian': 'theaustralian.com.au',
'The Australian Financial Review (javascript disabled)': 'afr.com', 'The Australian Financial Review (javascript disabled)': 'afr.com',
'The Boston Globe (javascript disabled)': 'bostonglobe.com', 'The Boston Globe': 'bostonglobe.com',
'The Business Journals': 'bizjournals.com', 'The Business Journals': 'bizjournals.com',
'The Diplomat': 'thediplomat.com', 'The Diplomat': 'thediplomat.com',
'The Globe and Mail (javascript disabled)': 'theglobeandmail.com', 'The Globe and Mail (javascript disabled)': 'theglobeandmail.com',
@ -83,6 +85,7 @@ var defaultSites = {
'The Toronto Star (javascript disabled)': 'thestar.com', 'The Toronto Star (javascript disabled)': 'thestar.com',
'The Washington Post': 'washingtonpost.com', 'The Washington Post': 'washingtonpost.com',
'The Wall Street Journal': 'wsj.com', 'The Wall Street Journal': 'wsj.com',
'Times Literary Supplement': 'the-tls.co.uk',
'Towards Data Science': 'towardsdatascience.com', 'Towards Data Science': 'towardsdatascience.com',
'Trouw': 'trouw.nl', 'Trouw': 'trouw.nl',
'Vanity Fair': 'vanityfair.com', 'Vanity Fair': 'vanityfair.com',

Loading…
Cancel
Save