Fix-update group McClatchy (opt-in to custom sites for unlisted)

master
magnolia1234 2021-03-27 11:53:07 +01:00
parent 87a32a78ae
commit 31878d8fd0
5 changed files with 42 additions and 27 deletions

View File

@ -184,7 +184,7 @@ Gannett Group (local USA Today) sites like (opt-in to custom sites)
[Milwaukee Journal Sentinel](https://www.jsonline.com) -
[The Indianapolis Star](https://www.indystar.com) -
[The Record (North Jersey)](https://www.northjersey.com)\
McClatchy Group sites like
McClatchy Group sites like (opt-in to custom sites for unlisted)
[Belleville News-Democrat](https://www.bnd.com) -
[Fort Worth Star-Telegram](https://www.star-telegram.com) -
[Lexington Herald-Leader](https://www.kentucky.com) -

View File

@ -877,6 +877,18 @@ ext_api.webRequest.onBeforeSendHeaders.addListener(function(details) {
enabledSites.push(gn_domain);
}
// block script for additional McClatchy sites (opt-in to custom sites)
var usa_mcc_domain = (matchUrlDomain('mcclatchyinteractive.com', details.url) && ['script'].includes(details.type) && !matchUrlDomain(usa_mcc_domains, header_referer) && enabledSites.includes('###_usa_mcc'));
if (usa_mcc_domain) {
let mcc_domain = urlHost(header_referer).replace('account.', '');
if (!usa_mcc_domains.includes(mcc_domain)) {
blockedRegexes[mcc_domain] = /cdn\.ampproject\.org\/v\d\/amp-subscriptions-.+\.js/;
usa_mcc_domains.push(mcc_domain);
if (!enabledSites.includes(mcc_domain))
enabledSites.push(mcc_domain);
}
}
// block external javascript for custom sites (optional)
var domain_blockjs_ext = matchUrlDomain(block_js_custom_ext, header_referer);
if (domain_blockjs_ext && !matchUrlDomain(domain_blockjs_ext, details.url) && details.type === 'script' && isSiteEnabled({url: header_referer})) {
@ -1038,7 +1050,7 @@ if (matchUrlDomain(change_headers, details.url) && (['main_frame', 'sub_frame',
csDone = false;
currentTabUrl = currentTab.url;
}
if ((['main_frame', 'script', 'image', 'sub_frame', 'xmlhttprequest'].includes(details.type) || matchUrlDomain(cs_limit_except, currentTabUrl)) && !csDone) {
if ((!['font', 'stylesheet'].includes(details.type) || matchUrlDomain(cs_limit_except, currentTabUrl)) && !csDone) {
ext_api.tabs.executeScript(tabId, {
file: 'contentScript.js',
runAt: 'document_start'

View File

@ -3,6 +3,7 @@ Changelog Bypass Paywalls Clean - Chrome
Post-release
Add Apollo Magazine
Fix-update group McClatchy (opt-in to custom sites for unlisted)
Fix-update Wired (Googlebot)
Fix-update WSJ (option to disable Googlebot; http error 500)

View File

@ -1380,30 +1380,6 @@ else if (matchDomain("discovermagazine.com")) {
}, 1000); // Delay (in milliseconds)
}
else if (domain = matchDomain(usa_mcc_domains)) {
let url = window.location.href;
if (url.includes('account.' + domain + '/paywall/')) {
window.setTimeout(function () {
window.location.href = 'https://amp.' + domain + '/article' + url.split('resume=')[1].split('#')[0] + '.html';
}, 500); // Delay (in milliseconds)
} else if (url.includes('amp.' + domain)) {
let subscr_sections = document.querySelectorAll('div[subscriptions-section="content"]');
for (let subscr_section of subscr_sections) {
subscr_section.removeAttribute('subscriptions-section');
}
let subscr_tag = document.querySelector('div#subscriber-exclusive-tag');
let amp_players = document.querySelectorAll('amp-connatix-player');
removeDOMElement(subscr_tag, ...amp_players);
}
let premium_svgs = document.querySelectorAll('h3 > a > svg');
let premium_link;
for (let premium_svg of premium_svgs) {
premium_link = premium_svg.parentElement;
if (premium_link.href.includes('www.'))
premium_link.href = premium_link.href.replace('www.', 'amp.');
}
}
else if (matchDomain("startribune.com")) {
document.addEventListener('DOMContentLoaded', () => {
let react_modal_portal = document.querySelectorAll('div.ReactModalPortal');
@ -2247,6 +2223,32 @@ else if (matchDomain('berliner-zeitung.de')) {
}
}
else if ((domain = matchDomain(usa_mcc_domains)) || document.querySelector('script[src^="https://media.mcclatchyinteractive.com/"]') || window.location.href.match(/\/\/amp\..+\.com\/(.+\/)?article(\d){8,}\.html/)) {
if (!domain)
domain = document.domain.replace(/(account|amp)\./, '');
let url = window.location.href;
if (url.includes('account.' + domain + '/paywall/')) {
window.setTimeout(function () {
window.location.href = 'https://amp.' + domain + '/article' + url.split('resume=')[1].split('#')[0] + '.html';
}, 500); // Delay (in milliseconds)
} else if (url.includes('amp.' + domain + '/')) {
let subscr_sections = document.querySelectorAll('div[subscriptions-section="content"]');
for (let subscr_section of subscr_sections) {
subscr_section.removeAttribute('subscriptions-section');
}
let subscr_tag = document.querySelector('div#subscriber-exclusive-tag');
let amp_players = document.querySelectorAll('amp-connatix-player');
removeDOMElement(subscr_tag, ...amp_players);
}
let premium_svgs = document.querySelectorAll('h3 > a > svg');
let premium_link;
for (let premium_svg of premium_svgs) {
premium_link = premium_svg.parentElement;
if (premium_link.href.includes('www.'))
premium_link.href = premium_link.href.replace('www.', 'amp.');
}
}
else if (!matchDomain(['belfasttelegraph.co.uk', 'independent.ie']))
csDone = true;

View File

@ -481,5 +481,5 @@
"*://*.wallkit.net/*",
"*://*.wsj.net/*"
],
"version": "2.1.3.3"
"version": "2.1.3.4"
}