mirror of
https://gitlab.com/magnolia1234/bypass-paywalls-firefox-clean.git
synced 2024-11-10 05:17:46 +01:00
Fix-update Globe and Mail (premium-only)
Premium articles have no video and photo gallery.
This commit is contained in:
parent
7a92e44b69
commit
15148e4ea4
2 changed files with 35 additions and 24 deletions
|
@ -13,7 +13,8 @@ const restrictions = {
|
|||
'elcomercio.pe': /.+\/elcomercio.pe\/.+((\w)+(\-)+){3,}.+/,
|
||||
'gestion.pe': /.+\/gestion.pe\/.+((\w)+(\-)+){3,}.+/,
|
||||
'quora.com': /^((?!quora\.com\/search\?q=).)*$/,
|
||||
'seekingalpha.com': /.+seekingalpha\.com\/article\/.+/
|
||||
'seekingalpha.com': /.+seekingalpha\.com\/article\/.+/,
|
||||
'theglobeandmail.com': /(.+theglobeandmail\.com\/.+\/article-.+|.+theglobeandmail\.com\/pb\/resources\/scripts\/build\/.+\.js)/
|
||||
}
|
||||
|
||||
// Don't remove cookies before page load
|
||||
|
@ -195,7 +196,7 @@ var blockedRegexes = {
|
|||
'theadvocate.com.au': /.+cdn-au\.piano\.io\/api\/tinypass.+\.js/,
|
||||
'thecourier.com.au': /.+cdn-au\.piano\.io\/api\/tinypass.+\.js/,
|
||||
'thedailybeast.com': /.+\.tinypass\.com\/.+/,
|
||||
'theglobeandmail.com': /theglobeandmail\.com\/pb\/resources\/scripts\/build\/chunk-bootstraps\/.+\.js/,
|
||||
'theglobeandmail.com': /theglobeandmail\.com\/pb\/resources\/scripts\/build\/chunk-common-vendor.+\.js/,
|
||||
'thenation.com': /.+\.tinypass\.com\/.+/,
|
||||
'valeursactuelles.com': /.+\.poool\.fr\/.+/
|
||||
};
|
||||
|
@ -401,11 +402,12 @@ ext_api.webRequest.onBeforeSendHeaders.addListener(function(details) {
|
|||
// check for blocked regular expression: domain enabled, match regex, block on an internal or external regex
|
||||
var blockedDomains = Object.keys(blockedRegexes);
|
||||
var domain = matchUrlDomain(blockedDomains, header_referer);
|
||||
var block_regex = true;
|
||||
if (domain && details.url.match(blockedRegexes[domain]) && isSiteEnabled({url: header_referer})) {
|
||||
if (domain == 'theglobeandmail.com' && !(header_referer.includes('/article-'))) {
|
||||
ext_api.webRequest.handlerBehaviorChanged();
|
||||
}
|
||||
return { cancel: true };
|
||||
if (domain === 'theglobeandmail.com' && !(header_referer.includes('?ref=premium'))) {
|
||||
block_regex = false;
|
||||
}
|
||||
if (block_regex) return { cancel: true };
|
||||
}
|
||||
|
||||
if (!isSiteEnabled(details)) {
|
||||
|
|
|
@ -375,24 +375,33 @@ else if (matchDomain("afr.com")) {
|
|||
}
|
||||
|
||||
else if (matchDomain("theglobeandmail.com")) {
|
||||
let paywall = document.querySelector('div.c-article-body__teaser-enabled');
|
||||
if (paywall) {
|
||||
window.setTimeout(function () {
|
||||
if (!window.location.href.includes('?ref=premium'))
|
||||
window.location.href = window.location.href + '?ref=premium';
|
||||
else
|
||||
window.location.reload(true);
|
||||
}, 500);
|
||||
}
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
const lazy_image = document.querySelectorAll('.js-lazyimage');
|
||||
for (let i = 0; i < lazy_image.length; i++) {
|
||||
lazy_image[i].classList.remove('js-lazyimage');
|
||||
}
|
||||
const hidden_image = document.querySelectorAll('img');
|
||||
for (let i = 0; i < hidden_image.length; i++) {
|
||||
var src = hidden_image[i].src;
|
||||
if (src.includes("data:image/gif")) {
|
||||
var data_src = hidden_image[i].getAttribute("data-src");
|
||||
if (data_src)
|
||||
hidden_image[i].setAttribute('src', data_src);
|
||||
var data_bg = hidden_image[i].getAttribute("data-bg");
|
||||
if (data_bg)
|
||||
hidden_image[i].setAttribute('src', data_bg);
|
||||
}
|
||||
}
|
||||
});
|
||||
const lazy_images = document.querySelectorAll('.js-lazyimage');
|
||||
for (let lazy_image of lazy_images) {
|
||||
lazy_image.classList.remove('js-lazyimage');
|
||||
}
|
||||
const hidden_images = document.querySelectorAll('img');
|
||||
for (let hidden_image of hidden_images) {
|
||||
var src = hidden_image.src;
|
||||
if (src.includes("data:image/gif")) {
|
||||
var data_src = hidden_image.getAttribute("data-src");
|
||||
if (data_src)
|
||||
hidden_image.setAttribute('src', data_src);
|
||||
var data_bg = hidden_image.getAttribute("data-bg");
|
||||
if (data_bg)
|
||||
hidden_image.setAttribute('src', data_bg);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
else if (matchDomain("sofrep.com")) {
|
||||
|
@ -667,7 +676,7 @@ else if (matchDomain('spectator.co.uk')) {
|
|||
|
||||
else if (matchDomain('bostonglobe.com')) {
|
||||
if (!document.cookie.split(';').some(function(item) { return item.trim().indexOf('s_fid=') === 0 })) {
|
||||
let s_fid = genHexString(16) + '-' + genHexString(16);
|
||||
let s_fid = genHexString(16) + '-' + genHexString(16);
|
||||
document.cookie = "s_fid=" + s_fid + "; domain=bostonglobe.com; path=/; max-age=1209600";
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue