Fix Madsack Mediengruppe

merge-requests/13/head
magnolia1234 1 year ago
parent f1efa65d25
commit 4dbb80468f

@ -819,16 +819,37 @@ if (typeof browser !== 'object') {
}
}
var set_var_sites = ['cz.de', 'nzherald.co.nz'].concat(de_madsack_domains, de_madsack_custom_domains);
function runOnTab_once_var(tab) {
let tabId = tab.id;
let url = tab.url;
let domain = matchUrlDomain(set_var_sites, url);
// load contentScript_once_var.js to set variables for site
if (domain && enabledSites.includes(domain)) {
ext_api.tabs.executeScript(tabId, {
file: 'contentScript_once_var.js',
runAt: 'document_start'
}, function (res) {
if (ext_api.runtime.lastError || res[0]) {
return;
}
});
}
}
ext_api.tabs.onUpdated.addListener((tabId, changeInfo, tab) => {
let tab_status = changeInfo.status;
if (/^http/.test(tab.url) && ((tab_status && tab_status === 'complete') || (changeInfo.url))) {
let timeout = changeInfo.url ? 500 : 0;
setTimeout(function () {
if (matchUrlDomain(enabledSites, tab.url)) {
runOnTab(tab);
if (/^http/.test(tab.url)) {
if ((tab_status && tab_status === 'complete') || (changeInfo.url)) {
let timeout = changeInfo.url ? 500 : 0;
setTimeout(function () {
if (matchUrlDomain(enabledSites, tab.url)) {
runOnTab(tab);
}
runOnTab_once(tab);
}, timeout);
}
runOnTab_once(tab);
}, timeout);
runOnTab_once_var(tab);
}
});
@ -1020,6 +1041,7 @@ if (matchUrlDomain(change_headers, details.url) && !ignore_types.includes(detail
runOnTab(tab);
}
runOnTab_once(tab);
runOnTab_once_var(tab);
});
}
} else {
@ -1034,6 +1056,7 @@ if (matchUrlDomain(change_headers, details.url) && !ignore_types.includes(detail
runOnTab(tab);
}
runOnTab_once(tab);
runOnTab_once_var(tab);
}
});
}
@ -1310,12 +1333,12 @@ ext_api.runtime.onMessage.addListener(function (message, sender) {
if (message.request === 'clear_cookies_domain' && message.data) {
remove_cookies_fn(message.data.domain);
}
if (message.request === 'custom_domain' && message.data) {
if (message.request === 'custom_domain' && message.data && message.data.domain) {
let custom_domain = message.data.domain;
let group = message.data.group;
if (group) {
let nofix_groups = ['###_substack_custom', '###_ch_tamedia', '###_it_citynews'];
if (enabledSites.concat(nofix_groups).includes(group) && custom_domain && !custom_flex_domains.includes(custom_domain)) {
if (enabledSites.concat(nofix_groups).includes(group) && !custom_flex_domains.includes(custom_domain)) {
let rules;
if (group === 'elmercurio.com')
rules = {block_regex: "(\\.{domain}\\/impresa\\/.+\\/assets\\/(vendor|\\d)\\.js|pram\\.pasedigital\\.cl\\/API\\/User\\/Status\\?)"};
@ -1329,10 +1352,10 @@ ext_api.runtime.onMessage.addListener(function (message, sender) {
if (rules) {
customAddRules(custom_domain, rules);
}
}
} else if (custom_domain) {
} else if (disabledSites.includes(group))
custom_flex_not_domains.push(custom_domain);
} else
custom_flex_not_domains.push(custom_domain);
}
}
if (message.request === 'site_switch') {
site_switch();

@ -4,6 +4,7 @@ Changelog Bypass Paywalls Clean - Firefox
Post-release
Fix Conde Nast magazines (cookies)
Fix DvhN.nl (json)
Fix Madsack Mediengruppe
Fix The Australian (The Oz)
* v3.0.3.0 (2023-01-29)

@ -9,6 +9,7 @@ var ca_gcm_domains = ['lesoleil.com'].concat(['latribune.ca', 'lavoixdelest.ca',
var ca_torstar_domains = ['niagarafallsreview.ca', 'stcatharinesstandard.ca', 'thepeterboroughexaminer.com', 'therecord.com', 'thespec.com', 'thestar.com', 'wellandtribune.ca'];
var de_funke_medien_domains = ['abendblatt.de', 'braunschweiger-zeitung.de', 'morgenpost.de', 'nrz.de', 'otz.de', 'thueringer-allgemeine.de', 'tlz.de', 'waz.de', 'wp.de', 'wr.de'];
var de_madsack_domains = ['haz.de', 'kn-online.de', 'ln-online.de', 'lvz.de', 'maz-online.de', 'neuepresse.de', 'ostsee-zeitung.de', 'rnd.de'];
var de_madsack_custom_domains = ['dnn.de', 'gnz.de', 'goettinger-tageblatt.de', 'op-marburg.de', 'paz-online.de', 'siegener-zeitung.de', 'sn-online.de', 'waz-online.de'];
var de_westfalen_medien_domains = ['muensterschezeitung.de', 'westfalen-blatt.de', 'wn.de'];
var es_epiberica_domains = ['diariodemallorca.es', 'eldia.es', 'epe.es', 'farodevigo.es', 'informacion.es', 'laprovincia.es', 'levante-emv.com', 'lne.es', 'mallorcazeitung.es'];
var es_epiberica_custom_domains = ['diaridegirona.cat', 'diariocordoba.com', 'diariodeibiza.es', 'elperiodicodearagon.com', 'elperiodicoextremadura.com', 'elperiodicomediterraneo.com', 'emporda.info', 'laopinioncoruna.es', 'laopiniondemalaga.es', 'laopiniondemurcia.es', 'laopiniondezamora.es', 'regio7.cat'];
@ -560,7 +561,7 @@ else if (matchDomain('cicero.de')) {
}
else if (matchDomain('cz.de')) {
// plus code in contentScript_once.js (timing)
// plus code in contentScript_once_var.js (timing)
let banner = document.querySelector('.newsletter-signup-wrapper');
removeDOMElement(banner);
}
@ -818,38 +819,9 @@ else if (matchDomain(de_funke_medien_domains) || document.querySelector('a[href=
sessionStorage.setItem('deobfuscate', 'true');
}
else if (matchDomain(de_madsack_domains) || document.querySelector('link[href*=".rndtech.de/"]')) {
else if (matchDomain(de_madsack_domains) || matchDomain(de_madsack_custom_domains)) {
// plus code in contentScript_once_var.js (timing)
if (!window.location.search.startsWith('?outputType=valid_amp')) {
let paywall = document.querySelector('div.paywalledContent');
if (paywall) {
paywall.removeAttribute('class');
let gradient = document.querySelector('div[class^="ArticleContentLoaderstyled__Gradient"]');
let loading = document.querySelector('#article > svg');
removeDOMElement(gradient, loading);
let article = paywall.querySelector('div:not([class])');
let json_script = getArticleJsonScript();
if (json_script) {
let json = JSON.parse(json_script.text);
if (article && json) {
let json_text = json.articleBody;
let article_new = document.createElement('span');
let par = article.querySelector('p');
let par_class = par ? par.getAttribute('class') : '';
article_new.setAttribute('class', par_class);
article_new.innerText = json_text;
article.innerText = '';
if (json.articleSection) {
let json_section = json.articleSection;
let article_section = document.querySelector('span');
article_section.setAttribute('class', par_class);
article_section.setAttribute('style', 'font-weight: bold;');
article_section.innerText = json_section + '. ';
article.appendChild(article_section);
}
article.appendChild(article_new);
}
}
}
let ads = document.querySelectorAll('div[class^="Adstyled__AdWrapper"]');
removeDOMElement(...ads);
} else {
@ -3730,7 +3702,7 @@ else if (matchDomain('nytimes.com')) {
}
else if (matchDomain('nzherald.co.nz')) {
// plus code in contentScript_once.js (timing)
// plus code in contentScript_once_var.js (timing)
let article_content = document.querySelector('.article__content');
if (article_content) {//redundant
let article_offer = document.querySelector('.article-offer');

@ -26,26 +26,6 @@ if (matchDomain('gitlab.com')) {
}, 1000);
}
else if (matchDomain('cz.de')) {
function cz_unhide(node) {
removeDOMElement(node);
let article_not_allowed = document.querySelector('article.news-read-not-allowed');
if (article_not_allowed)
article_not_allowed.classList.remove('news-read-not-allowed')
}
waitDOMElement('div#erasmo', 'DIV', cz_unhide);
}
else if (matchDomain('nzherald.co.nz')) {
function nzherald_main() {
if (window.Fusion)
window.Fusion.globalContent.isPremium = false;
}
window.setTimeout(function () {
insert_script(nzherald_main);
}, 100);
}
else {
window.setTimeout(function () {
@ -157,40 +137,3 @@ function getCookieDomain(hostname) {
}
return domain;
}
function removeDOMElement(...elements) {
for (let element of elements) {
if (element)
element.remove();
}
}
function waitDOMElement(selector, tagName = '', callback, multiple = false) {
new window.MutationObserver(function (mutations) {
for (let mutation of mutations) {
for (let node of mutation.addedNodes) {
if (!tagName || (node.tagName === tagName)) {
if (node.matches(selector)) {
callback(node);
if (!multiple)
this.disconnect();
}
}
}
}
}).observe(document, {
subtree: true,
childList: true
});
}
function insert_script(func, insertAfterDom) {
let bpc_script = document.querySelector('script#bpc_script');
if (!bpc_script) {
let script = document.createElement('script');
script.setAttribute('id', 'bpc_script');
script.appendChild(document.createTextNode('(' + func + ')();'));
let insertAfter = insertAfterDom ? insertAfterDom : (document.body || document.head || document.documentElement);
insertAfter.appendChild(script);
}
}

@ -0,0 +1,92 @@
//'use strict';
var ext_api = (typeof browser === 'object') ? browser : chrome;
var de_madsack_domains = ['haz.de', 'kn-online.de', 'ln-online.de', 'lvz.de', 'maz-online.de', 'neuepresse.de', 'ostsee-zeitung.de', 'rnd.de'];
var de_madsack_custom_domains = ['dnn.de', 'gnz.de', 'goettinger-tageblatt.de', 'op-marburg.de', 'paz-online.de', 'siegener-zeitung.de', 'sn-online.de', 'waz-online.de'];
if (matchDomain('cz.de')) {
function cz_unhide(node) {
removeDOMElement(node);
let article_not_allowed = document.querySelector('article.news-read-not-allowed');
if (article_not_allowed)
article_not_allowed.classList.remove('news-read-not-allowed')
}
waitDOMElement('div#erasmo', 'DIV', cz_unhide);
}
else if (matchDomain(de_madsack_domains) || matchDomain(de_madsack_custom_domains)) {
function madsack_main() {
let done = false;
for (let n = 0; n < 10; n++) {
window.setTimeout(function () {
if (!done && window.Fusion) {
window.Fusion.globalContent.isPaid = false;
done = true;
}
}, n * 50);
}
}
insert_script(madsack_main);
}
else if (matchDomain('nzherald.co.nz')) {
function nzherald_main() {
let done = false;
for (let n = 0; n < 10; n++) {
window.setTimeout(function () {
if (!done && window.Fusion) {
window.Fusion.globalContent.isPremium = false;
done = true;
}
}, n * 50);
}
}
insert_script(nzherald_main);
}
function matchDomain(domains, hostname) {
var matched_domain = false;
if (!hostname)
hostname = window.location.hostname;
if (typeof domains === 'string')
domains = [domains];
domains.some(domain => (hostname === domain || hostname.endsWith('.' + domain)) && (matched_domain = domain));
return matched_domain;
}
function removeDOMElement(...elements) {
for (let element of elements) {
if (element)
element.remove();
}
}
function waitDOMElement(selector, tagName = '', callback, multiple = false) {
new window.MutationObserver(function (mutations) {
for (let mutation of mutations) {
for (let node of mutation.addedNodes) {
if (!tagName || (node.tagName === tagName)) {
if (node.matches(selector)) {
callback(node);
if (!multiple)
this.disconnect();
}
}
}
}
}).observe(document, {
subtree: true,
childList: true
});
}
function insert_script(func, insertAfterDom) {
let bpc_script = document.querySelector('script#bpc_script');
if (!bpc_script) {
let script = document.createElement('script');
script.setAttribute('id', 'bpc_script');
script.appendChild(document.createTextNode('(' + func + ')();'));
let insertAfter = insertAfterDom ? insertAfterDom : (document.body || document.head || document.documentElement);
insertAfter.appendChild(script);
}
}

@ -39,9 +39,7 @@
],
"content_scripts": [{
"matches": [
"*://*.cz.de/*",
"*://*.gitlab.com/magnolia1234",
"*://*.nzherald.co.nz/*"
"*://*.gitlab.com/magnolia1234"
],
"run_at": "document_start",
"js": ["contentScript_once.js"]
@ -728,5 +726,5 @@
"*://*.wallkit.net/*",
"*://webcache.googleusercontent.com/*"
],
"version": "3.0.3.3"
"version": "3.0.3.4"
}

@ -2407,6 +2407,8 @@ expandSiteRules(defaultSites);
// grouped domains (background)
var au_news_corp_domains = grouped_sites['###_au_news_corp'];
var de_madsack_domains = grouped_sites['###_de_madsack'];
var de_madsack_custom_domains = ['dnn.de', 'gnz.de', 'goettinger-tageblatt.de', 'op-marburg.de', 'paz-online.de', 'siegener-zeitung.de', 'sn-online.de', 'waz-online.de'];
var es_grupo_vocento_domains = grouped_sites['###_es_grupo_vocento'];
var nl_mediahuis_region_domains = grouped_sites['###_nl_mediahuis_region'];
var no_nhst_media_domains = grouped_sites['###_no_nhst_media'];

Loading…
Cancel
Save