|
|
|
@ -28,6 +28,7 @@ var defaultSites = {
|
|
|
|
|
'Haaretz': 'haaretz.co.il',
|
|
|
|
|
'Haaretz English': 'haaretz.com',
|
|
|
|
|
'Handelsblatt': 'handelsblatt.com',
|
|
|
|
|
'Harper\'s Magazine': 'harpers.org',
|
|
|
|
|
'Hartford Courant': 'courant.com',
|
|
|
|
|
'Harvard Business Review': 'hbr.org',
|
|
|
|
|
'Inc.com': 'inc.com',
|
|
|
|
@ -35,6 +36,7 @@ var defaultSites = {
|
|
|
|
|
'La Repubblica': 'repubblica.it',
|
|
|
|
|
'Le Monde': 'lemonde.fr',
|
|
|
|
|
'Le Temps': 'letemps.ch',
|
|
|
|
|
'London Review of Books': 'lrb.co.uk',
|
|
|
|
|
'Los Angeles Times': 'latimes.com',
|
|
|
|
|
'Medium': 'medium.com',
|
|
|
|
|
'Medscape': 'medscape.com',
|
|
|
|
@ -85,6 +87,7 @@ var defaultSites = {
|
|
|
|
|
'The Toronto Star': 'thestar.com',
|
|
|
|
|
'The Washington Post': 'washingtonpost.com',
|
|
|
|
|
'The Wall Street Journal': 'wsj.com',
|
|
|
|
|
'Times Literary Supplement': 'the-tls.co.uk',
|
|
|
|
|
'Towards Data Science': 'towardsdatascience.com',
|
|
|
|
|
'Trouw': 'trouw.nl',
|
|
|
|
|
'Vanity Fair': 'vanityfair.com',
|
|
|
|
@ -110,6 +113,7 @@ const allow_cookies = [
|
|
|
|
|
'examiner.com.au',
|
|
|
|
|
'ft.com',
|
|
|
|
|
'hacked.com',
|
|
|
|
|
'harpers.org',
|
|
|
|
|
'hbr.org',
|
|
|
|
|
'lemonde.fr',
|
|
|
|
|
'letemps.ch',
|
|
|
|
@ -153,6 +157,7 @@ const remove_cookies = [
|
|
|
|
|
'examiner.com.au',
|
|
|
|
|
'ft.com',
|
|
|
|
|
'hacked.com',
|
|
|
|
|
'harpers.org',
|
|
|
|
|
'hbr.org',
|
|
|
|
|
'letemps.ch',
|
|
|
|
|
'medium.com',
|
|
|
|
@ -179,7 +184,6 @@ const remove_cookies = [
|
|
|
|
|
|
|
|
|
|
// select specific cookie(s) to hold from remove_cookies domains
|
|
|
|
|
const remove_cookies_select_hold = {
|
|
|
|
|
'nrc.nl': ['nmt_closed_cookiebar'],
|
|
|
|
|
'washingtonpost.com': ['wp_gdpr'],
|
|
|
|
|
'wsj.com': ['wsjregion']
|
|
|
|
|
}
|
|
|
|
@ -187,7 +191,9 @@ const remove_cookies_select_hold = {
|
|
|
|
|
// select only specific cookie(s) to drop from remove_cookies domains
|
|
|
|
|
const remove_cookies_select_drop = {
|
|
|
|
|
'ad.nl': ['temptationTrackingId'],
|
|
|
|
|
'bostonglobe.com': ['FMPaywall'],
|
|
|
|
|
'demorgen.be': ['TID_ID'],
|
|
|
|
|
'economist.com': ['rvuuid'],
|
|
|
|
|
'ed.nl': ['temptationTrackingId'],
|
|
|
|
|
'nrc.nl': ['counter']
|
|
|
|
|
}
|
|
|
|
@ -216,12 +222,16 @@ function setDefaultOptions() {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const blockedRegexes = [
|
|
|
|
|
/.+:\/\/.+\.tribdss\.com\//,
|
|
|
|
|
/thenation\.com\/.+\/paywall-script\.php/,
|
|
|
|
|
/haaretz\.co\.il\/htz\/js\/inter\.js/,
|
|
|
|
|
/nzherald\.co\.nz\/.+\/headjs\/.+\.js/
|
|
|
|
|
];
|
|
|
|
|
// to block external script also add domain to manifest.json (permissions)
|
|
|
|
|
const blockedRegexes = {
|
|
|
|
|
'chicagotribune.com': /.+:\/\/.+\.tribdss\.com\//,
|
|
|
|
|
'thenation.com': /thenation\.com\/.+\/paywall-script\.php/,
|
|
|
|
|
'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 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
|
|
|
|
|
chrome.webRequest.onBeforeRequest.addListener(function(details) {
|
|
|
|
|
if (!isSiteEnabled(details) || details.url.indexOf("mod=rsswn") !== -1) {
|
|
|
|
@ -294,22 +279,36 @@ chrome.webRequest.onBeforeRequest.addListener(function(details) {
|
|
|
|
|
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"]
|
|
|
|
|
},
|
|
|
|
|
["blocking"]
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
browser.webRequest.onBeforeSendHeaders.addListener(function(details) {
|
|
|
|
|
if (!isSiteEnabled(details)) {
|
|
|
|
|
return;
|
|
|
|
|
var requestHeaders = details.requestHeaders;
|
|
|
|
|
|
|
|
|
|
var header_referer = '';
|
|
|
|
|
for (var n in requestHeaders) {
|
|
|
|
|
if (requestHeaders[n].name.toLowerCase() == 'referer') {
|
|
|
|
|
header_referer = requestHeaders[n].value;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (blockedRegexes.some(function(regex) { return regex.test(details.url); })) {
|
|
|
|
|
return { cancel: true };
|
|
|
|
|
// 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 (!isSiteEnabled(details)) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var requestHeaders = details.requestHeaders;
|
|
|
|
|
var tabId = details.tabId;
|
|
|
|
|
|
|
|
|
|
var useUserAgentMobile = 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))){
|
|
|
|
|
continue; // only remove specific cookie
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
browser.cookies.remove(cookie);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|