Update fix Boston Globe & block scripts while site restrictions

Only enable Boston Globe paywall-script to set cookies at homepage/sections (no text in articles while no cookies).
+ Option to block scripts while site restrictions.
This commit is contained in:
magnolia1234 2019-12-10 19:02:16 +01:00 committed by GitHub
parent da627b579d
commit a82d812c83

View file

@ -303,8 +303,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 };
}
}