Fix Economist (Javascript/cookies)
parent
2f5900357f
commit
c8b4f6e5e4
|
@ -55,7 +55,6 @@ const remove_cookies_select_drop = {
|
||||||
'caixinglobal.com': ['CAIXINGLB_LOGIN_UUID'],
|
'caixinglobal.com': ['CAIXINGLB_LOGIN_UUID'],
|
||||||
'demorgen.be': ['TID_ID'],
|
'demorgen.be': ['TID_ID'],
|
||||||
'dn.se': ['randomSplusId'],
|
'dn.se': ['randomSplusId'],
|
||||||
'economist.com': ['rvuuid'],
|
|
||||||
'ed.nl': ['temptationTrackingId'],
|
'ed.nl': ['temptationTrackingId'],
|
||||||
'nrc.nl': ['counter'],
|
'nrc.nl': ['counter'],
|
||||||
'theatlantic.com': ['articleViews']
|
'theatlantic.com': ['articleViews']
|
||||||
|
@ -94,7 +93,7 @@ var blockedRegexes = {
|
||||||
'haaretz.com': /haaretz\.com\/hdc\/web\/js\/minified\/header-scripts-int.js.+/,
|
'haaretz.com': /haaretz\.com\/hdc\/web\/js\/minified\/header-scripts-int.js.+/,
|
||||||
'nzherald.co.nz': /nzherald\.co\.nz\/.+\/headjs\/.+\.js/,
|
'nzherald.co.nz': /nzherald\.co\.nz\/.+\/headjs\/.+\.js/,
|
||||||
'businessinsider.com': /(.+\.tinypass\.com\/.+|cdn\.onesignal\.com\/sdks\/.+\.js)/,
|
'businessinsider.com': /(.+\.tinypass\.com\/.+|cdn\.onesignal\.com\/sdks\/.+\.js)/,
|
||||||
'economist.com': /.+\.tinypass\.com\/.+/,
|
'economist.com': /(.+\.tinypass\.com\/.+|economist\.com\/_next\/static\/runtime\/main.+\.js)/,
|
||||||
'lrb.co.uk': /.+\.tinypass\.com\/.+/,
|
'lrb.co.uk': /.+\.tinypass\.com\/.+/,
|
||||||
'bostonglobe.com': /meter\.bostonglobe\.com\/js\/.+/,
|
'bostonglobe.com': /meter\.bostonglobe\.com\/js\/.+/,
|
||||||
'foreignpolicy.com': /.+\.tinypass\.com\/.+/,
|
'foreignpolicy.com': /.+\.tinypass\.com\/.+/,
|
||||||
|
@ -164,7 +163,7 @@ chrome.runtime.onInstalled.addListener(function (details) {
|
||||||
.then(response => {
|
.then(response => {
|
||||||
if (response.ok) {
|
if (response.ok) {
|
||||||
response.json().then(json => {
|
response.json().then(json => {
|
||||||
var defaultSites_merge = {...defaultSites, ...json};
|
var defaultSites_merge = {...defaultSites, ...json};
|
||||||
defaultSites = defaultSites_merge;
|
defaultSites = defaultSites_merge;
|
||||||
// add custom sites
|
// add custom sites
|
||||||
const url_sites_custom = 'https://raw.githubusercontent.com/magnolia1234/bypass-paywalls-chrome/master/sites_custom.json';
|
const url_sites_custom = 'https://raw.githubusercontent.com/magnolia1234/bypass-paywalls-chrome/master/sites_custom.json';
|
||||||
|
@ -172,7 +171,7 @@ chrome.runtime.onInstalled.addListener(function (details) {
|
||||||
.then(response => {
|
.then(response => {
|
||||||
if (response.ok) {
|
if (response.ok) {
|
||||||
response.json().then(json => {
|
response.json().then(json => {
|
||||||
var defaultSites_merge = {...defaultSites, ...json};
|
var defaultSites_merge = {...defaultSites, ...json};
|
||||||
defaultSites = defaultSites_merge;
|
defaultSites = defaultSites_merge;
|
||||||
setDefaultOptions();
|
setDefaultOptions();
|
||||||
})
|
})
|
||||||
|
@ -210,13 +209,13 @@ chrome.webRequest.onBeforeRequest.addListener(function (details) {
|
||||||
["blocking"]
|
["blocking"]
|
||||||
);
|
);
|
||||||
**/
|
**/
|
||||||
|
//"*://*.economist.com/*",
|
||||||
// Disable javascript for these sites/general paywall-scripts
|
// Disable javascript for these sites/general paywall-scripts
|
||||||
chrome.webRequest.onBeforeRequest.addListener(function(details) {
|
chrome.webRequest.onBeforeRequest.addListener(function(details) {
|
||||||
if (!isSiteEnabled(details)) {
|
if (!isSiteEnabled(details)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
return {cancel: true};
|
return {cancel: true};
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
urls: ["*://*.tinypass.com/*", "*://*.poool.fr/*", "*://*.piano.io/*"],
|
urls: ["*://*.tinypass.com/*", "*://*.poool.fr/*", "*://*.piano.io/*"],
|
||||||
|
@ -235,7 +234,7 @@ chrome.webRequest.onBeforeSendHeaders.addListener(function(details) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// remove cookies for sites medium platform (mainfest.json needs in permissions: <all_urls>)
|
// remove cookies for sites medium platform (mainfest.json needs in permissions: <all_urls>)
|
||||||
if (isSiteEnabled({url: '.medium.com'}) && details.url.indexOf('cdn-client.medium.com') !== -1 && header_referer.indexOf('.medium.com') === -1) {
|
if (isSiteEnabled({url: '.medium.com'}) && details.url.indexOf('cdn-client.medium.com') !== -1 && header_referer.indexOf('.medium.com') === -1) {
|
||||||
var domainVar = new URL(header_referer).hostname;
|
var domainVar = new URL(header_referer).hostname;
|
||||||
|
@ -243,9 +242,9 @@ chrome.webRequest.onBeforeSendHeaders.addListener(function(details) {
|
||||||
for (var i=0; i<cookies.length; i++) {
|
for (var i=0; i<cookies.length; i++) {
|
||||||
chrome.cookies.remove({url: (cookies[i].secure ? "https://" : "http://") + cookies[i].domain + cookies[i].path, name: cookies[i].name});
|
chrome.cookies.remove({url: (cookies[i].secure ? "https://" : "http://") + cookies[i].domain + cookies[i].path, name: cookies[i].name});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// check for blocked regular expression: domain enabled, match regex, block on an internal or external regex
|
// check for blocked regular expression: domain enabled, match regex, block on an internal or external regex
|
||||||
for (var domain in blockedRegexes) {
|
for (var domain in blockedRegexes) {
|
||||||
if ((isSiteEnabled({url: '.'+ domain}) || isSiteEnabled({url: header_referer})) && details.url.match(blockedRegexes[domain])) {
|
if ((isSiteEnabled({url: '.'+ domain}) || isSiteEnabled({url: header_referer})) && details.url.match(blockedRegexes[domain])) {
|
||||||
|
@ -303,7 +302,7 @@ chrome.webRequest.onBeforeSendHeaders.addListener(function(details) {
|
||||||
|
|
||||||
// override User-Agent to use Googlebot
|
// override User-Agent to use Googlebot
|
||||||
var useGoogleBot = use_google_bot.filter(function(item) {
|
var useGoogleBot = use_google_bot.filter(function(item) {
|
||||||
return typeof item == 'string' && details.url.indexOf(item) > -1;
|
return typeof item == 'string' && details.url.indexOf(item) > -1;
|
||||||
}).length > 0;
|
}).length > 0;
|
||||||
|
|
||||||
if (useGoogleBot) {
|
if (useGoogleBot) {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
var arr_localstorage_hold = ['sfchronicle.com', 'economist.com'];
|
var arr_localstorage_hold = ['sfchronicle.com'];
|
||||||
var localstorage_hold = arr_localstorage_hold.some(function(url) {
|
var localstorage_hold = arr_localstorage_hold.some(function(url) {
|
||||||
return window.location.href.indexOf(url) !== -1;
|
return window.location.href.indexOf(url) !== -1;
|
||||||
});
|
});
|
||||||
|
@ -197,14 +197,16 @@ if (window.location.href.indexOf("nytimes.com") !== -1) {
|
||||||
|
|
||||||
if (window.location.href.indexOf("economist.com") !== -1) {
|
if (window.location.href.indexOf("economist.com") !== -1) {
|
||||||
document.addEventListener('DOMContentLoaded', () => {
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
|
const subscribe = document.querySelector('.subscription-proposition');
|
||||||
|
const advert = document.querySelector('.advert');
|
||||||
const wrapper = document.getElementById('bottom-page-wrapper');
|
const wrapper = document.getElementById('bottom-page-wrapper');
|
||||||
removeDOMElement(wrapper);
|
removeDOMElement(subscribe, advert, wrapper);
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
const paywall = document.querySelector('.layout-article-regwall'); ;
|
const paywall = document.querySelector('.layout-article-regwall'); ;
|
||||||
if (paywall) {
|
if (paywall) {
|
||||||
window.location.reload(true);
|
window.location.reload(true);
|
||||||
}
|
}
|
||||||
}, 300); // Delay (in milliseconds)
|
}, 600); // Delay (in milliseconds)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue