mirror of
https://github.com/iamadamdev/bypass-paywalls-chrome
synced 2025-04-30 00:54:25 +02:00
Fix nytimes.com
This commit is contained in:
parent
747dddda71
commit
97b84f0951
@ -6,7 +6,8 @@ const restrictions = {
|
|||||||
'economist.com': /.+economist\.com\/.+\/\d{1,4}\/\d{1,2}\/\d{2}\/.+/,
|
'economist.com': /.+economist\.com\/.+\/\d{1,4}\/\d{1,2}\/\d{2}\/.+/,
|
||||||
'seekingalpha.com': /.+seekingalpha\.com\/article\/.+/,
|
'seekingalpha.com': /.+seekingalpha\.com\/article\/.+/,
|
||||||
'techinasia.com': /\.techinasia\.com\/.+/,
|
'techinasia.com': /\.techinasia\.com\/.+/,
|
||||||
'ft.com': /.+\.ft.com\/content\//
|
'ft.com': /.+\.ft.com\/content\//,
|
||||||
|
'nytimes.com': /^((?!\/timesmachine\.nytimes\.com\/).)*$/
|
||||||
};
|
};
|
||||||
|
|
||||||
// Don't remove cookies before page load
|
// Don't remove cookies before page load
|
||||||
@ -108,7 +109,8 @@ const removeCookies = [
|
|||||||
'wsj.com',
|
'wsj.com',
|
||||||
'medium.com',
|
'medium.com',
|
||||||
'washingtonpost.com',
|
'washingtonpost.com',
|
||||||
'japantimes.co.jp'
|
'japantimes.co.jp',
|
||||||
|
'nytimes.com'
|
||||||
];
|
];
|
||||||
|
|
||||||
// Contains remove cookie sites above plus any custom sites
|
// Contains remove cookie sites above plus any custom sites
|
||||||
@ -222,7 +224,7 @@ const blockedRegexes = {
|
|||||||
'chicagobusiness.com': /(\.tinypass\.com\/|\.chicagobusiness\.com\/.+\/js\/js_.+\.js)/,
|
'chicagobusiness.com': /(\.tinypass\.com\/|\.chicagobusiness\.com\/.+\/js\/js_.+\.js)/,
|
||||||
'dailytelegraph.com.au': /cdn\.ampproject\.org\/v\d\/amp-(access|ad|consent)-.+\.js/,
|
'dailytelegraph.com.au': /cdn\.ampproject\.org\/v\d\/amp-(access|ad|consent)-.+\.js/,
|
||||||
'theglobeandmail.com': /(\.theglobeandmail\.com\/pf\/dist\/engine\/react\.js|smartwall\.theglobeandmail\.com\/)/,
|
'theglobeandmail.com': /(\.theglobeandmail\.com\/pf\/dist\/engine\/react\.js|smartwall\.theglobeandmail\.com\/)/,
|
||||||
'nytimes.com': /(meter-svc\.nytimes\.com\/meter\.js|mwcm\.nyt\.com\/.+\.js|cooking\.nytimes\.com\/api\/.+\/access)/,
|
'nytimes.com': /(\.nytimes\.com\/meter\.js|mwcm\.nyt\.com\/.+\.js|cooking\.nytimes\.com\/api\/.+\/access)/,
|
||||||
'latimes.com': /(metering\.platform\.latimes\.com\/|cdn\.ampproject\.org\/v\d\/amp-(access|subscriptions)-.+\.js)/,
|
'latimes.com': /(metering\.platform\.latimes\.com\/|cdn\.ampproject\.org\/v\d\/amp-(access|subscriptions)-.+\.js)/,
|
||||||
'theathletic.com': /cdn\.ampproject\.org\/v\d\/amp-(access|subscriptions)-.+\.js/,
|
'theathletic.com': /cdn\.ampproject\.org\/v\d\/amp-(access|subscriptions)-.+\.js/,
|
||||||
'japantimes.co.jp': /cdn\.cxense\.com\//,
|
'japantimes.co.jp': /cdn\.cxense\.com\//,
|
||||||
@ -304,6 +306,24 @@ extensionApi.webRequest.onBeforeRequest.addListener(function (details) {
|
|||||||
['blocking']
|
['blocking']
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// nytimes.com
|
||||||
|
extensionApi.webRequest.onHeadersReceived.addListener(function (details) {
|
||||||
|
if (!isSiteEnabled(details)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let headers = details.responseHeaders;
|
||||||
|
headers = headers.map(function (header) {
|
||||||
|
if (header.name === 'x-frame-options') { header.value = 'SAMEORIGIN'; }
|
||||||
|
return header;
|
||||||
|
});
|
||||||
|
return {
|
||||||
|
responseHeaders: headers
|
||||||
|
};
|
||||||
|
}, {
|
||||||
|
urls: ['*://*.nytimes.com/*']
|
||||||
|
},
|
||||||
|
['blocking', 'responseHeaders']);
|
||||||
|
|
||||||
// Disable javascript for these sites
|
// Disable javascript for these sites
|
||||||
extensionApi.webRequest.onBeforeRequest.addListener(function (details) {
|
extensionApi.webRequest.onBeforeRequest.addListener(function (details) {
|
||||||
const headerReferer = details.originUrl ? details.originUrl : details.initiator;
|
const headerReferer = details.originUrl ? details.originUrl : details.initiator;
|
||||||
@ -432,7 +452,6 @@ extensionApi.webRequest.onBeforeSendHeaders.addListener(function (details) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// remove cookies before page load
|
// remove cookies before page load
|
||||||
const enabledCookies = allowCookies.some(function (site) {
|
const enabledCookies = allowCookies.some(function (site) {
|
||||||
return matchUrlDomain(site, details.url);
|
return matchUrlDomain(site, details.url);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
if (!matchDomain(['seekingalpha.com', 'sfchronicle.com', 'cen.acs.org', 'elmundo.es', 'scmp.com'])) {
|
if (!matchDomain(['seekingalpha.com', 'sfchronicle.com', 'cen.acs.org', 'elmundo.es', 'scmp.com', 'nytimes.com'])) {
|
||||||
window.localStorage.clear();
|
window.localStorage.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -258,7 +258,7 @@ if (matchDomain('elmercurio.com')) {
|
|||||||
removeDOMElement(counter, coBanner, support);
|
removeDOMElement(counter, coBanner, support);
|
||||||
});
|
});
|
||||||
} else if (matchDomain('nytimes.com')) {
|
} else if (matchDomain('nytimes.com')) {
|
||||||
const banners = document.querySelectorAll('div[data-testid="inline-message"], div[id^="ad-"], div.expanded-dock');
|
const banners = document.querySelectorAll('div[data-testid="inline-message"], div[id^="ad-"], div.expanded-dock, div.pz-ad-box');
|
||||||
removeDOMElement(...banners);
|
removeDOMElement(...banners);
|
||||||
} else if (matchDomain('technologyreview.com')) {
|
} else if (matchDomain('technologyreview.com')) {
|
||||||
window.setTimeout(function () {
|
window.setTimeout(function () {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user