mirror of
https://github.com/iamadamdev/bypass-paywalls-chrome
synced 2025-05-17 20:27:06 +02:00
Add exception for economist.com graphics rendering script (#631)
This commit is contained in:
parent
6e50680a93
commit
3692cb8bee
@ -173,6 +173,11 @@ const blockedRegexes = {
|
|||||||
'thewrap.com': /thewrap\.com\/.+\/wallkit\.js/
|
'thewrap.com': /thewrap\.com\/.+\/wallkit\.js/
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Allowed external scripts
|
||||||
|
const allowedRegexes = {
|
||||||
|
'economist.com': /infographics.economist.com\/utils\/ai2html-resizer.*\.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)';
|
||||||
|
|
||||||
@ -231,6 +236,12 @@ extensionApi.webRequest.onBeforeRequest.addListener(function (details) {
|
|||||||
if (!isSiteEnabled(details) && !enabledSites.includes('generalpaywallbypass')) {
|
if (!isSiteEnabled(details) && !enabledSites.includes('generalpaywallbypass')) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// Don't block allowed scripts
|
||||||
|
for (const domain in allowedRegexes) {
|
||||||
|
if (isSameDomain(details.url, domain) && details.url.match(allowedRegexes[domain])) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
return { cancel: true };
|
return { cancel: true };
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user