Add Cicero (Germany)

This commit is contained in:
magnolia1234 2021-01-11 21:00:41 +01:00
parent 2480fba01d
commit 48a695ad06
6 changed files with 53 additions and 25 deletions

View file

@ -237,6 +237,7 @@ Groupe Rossel sites (grouped in options) like
[SudInfo](https://www.sudinfo.be)
##### Germany/Austria
[Cicero](https://www.cicero.de) -
[Deutsche Wirtschafts Nachrichten](https://deutsche-wirtschafts-nachrichten.de) -
[Die Zeit](https://www.zeit.de) -
[Frankfurter Allgemeine Zeitung](https://www.faz.net) -

View file

@ -37,6 +37,7 @@ var allow_cookies_default = [
'bostonglobe.com',
'business-standard.com',
'charliehebdo.fr',
'cicero.de',
'clarin.com',
'chronicle.com',
'df.cl',
@ -779,7 +780,7 @@ ext_api.webRequest.onBeforeSendHeaders.addListener(function(details) {
let uk_nlr_site = (matchUrlDomain('stripe.com', details.url) && matchUrlDomain('newleftreview.org', header_referer) && isSiteEnabled({url: header_referer}));
let bpc_amp_site = (matchUrlDomain('cdn.ampproject.org', details.url) && isSiteEnabled({url: header_referer}) &&
matchUrlDomain(['barrons.com', 'belfasttelegraph.co.uk', 'elmundo.es', 'elperiodico.com', 'expansion.com', 'freiepresse.de', 'fresnobee.com', 'gelocal.it', 'independent.ie', 'irishtimes.com', 'la-croix.com', 'nationalreview.com', 'sacbee.com', 'seekingalpha.com', 'sueddeutsche.de', 'telegraph.co.uk'].concat(au_nine_domains, es_grupo_vocento_domains, fr_groupe_ebra_domains, fr_groupe_la_depeche_domains), header_referer));
matchUrlDomain(['barrons.com', 'belfasttelegraph.co.uk', 'cicero.de', 'elmundo.es', 'elperiodico.com', 'expansion.com', 'freiepresse.de', 'fresnobee.com', 'gelocal.it', 'independent.ie', 'irishtimes.com', 'la-croix.com', 'nationalreview.com', 'sacbee.com', 'seekingalpha.com', 'sueddeutsche.de', 'telegraph.co.uk'].concat(au_nine_domains, es_grupo_vocento_domains, fr_groupe_ebra_domains, fr_groupe_la_depeche_domains), header_referer));
if (!isSiteEnabled(details) && !inkl_site && !au_nc_amp_site && !au_apn_site && !au_swm_site && !uk_nlr_site && !bpc_amp_site) {
return;

View file

@ -2,6 +2,7 @@
Changelog Bypass Paywalls Clean - Firefox
Post-release
Add Cicero (Germany)
Fix-update Faz.net (Zeitung subdomain)
* v2.0.3.0 (2021-01-10)

View file

@ -1907,33 +1907,34 @@ else if (matchDomain('seekingalpha.com')) {
}
}
else if (matchDomain('cicero.de')) {
let url = window.location.href;
if (!url.includes('?amp')) {
let paywall = document.querySelector('.plenigo-paywall');
if (paywall) {
let url_amp = url + '?amp';
replaceDomElementExt(url_amp, false, '.field-name-field-cc-body');
removeDOMElement(paywall);
}
} else {
let teasered_content = document.querySelector('.teasered-content');
if (teasered_content)
teasered_content.classList.remove('teasered-content');
let teasered_content_fader = document.querySelector('.teasered-content-fader');
let btn_read_more = document.querySelector('.btn--read-more');
let amp_ads = document.querySelectorAll('amp-ad');
removeDOMElement(teasered_content_fader, btn_read_more, ...amp_ads);
}
let urban_ad_sign = document.querySelectorAll('.urban-ad-sign');
removeDOMElement(...urban_ad_sign);
}
else if (matchDomain('newleftreview.org')) {
let url = window.location.href;
let paywall = document.querySelector('div.promo-wrapper');
if (paywall) {
let proxyurl = 'https://cors-anywhere.herokuapp.com/';
let nlr_cache = 'https://webcache.googleusercontent.com/search?q=cache:' + url.split('//')[1];
fetch(proxyurl + nlr_cache, { headers: {"Content-Type": "text/plain", "X-Requested-With": "XMLHttpRequest" } })
.then(response => {
let article_old = document.querySelector('div.article-page');
let footer = document.querySelector('div.article-footer');
if (response.ok) {
response.text().then(html => {
let parser = new DOMParser();
let doc = parser.parseFromString(html, 'text/html');
let json = doc.querySelector('div.article-page');
if (json) {
if (article_old && footer) {
removeDOMElement(article_old);
footer.parentElement.insertBefore(json, footer);
}
}
});
} else {
if (article_old && footer)
article_old.appendChild(document.createTextNode('Article not yet in Google webcache ...'));
}
});
let url_cache = 'https://webcache.googleusercontent.com/search?q=cache:' + url.split('//')[1];
replaceDomElementExt(url_cache, true, 'div.article-page', 'Article not yet in Google webcache ...');
removeDOMElement(paywall);
}
}
@ -1968,6 +1969,28 @@ function matchDomain(domains, hostname) {
return matched_domain;
}
function replaceDomElementExt(url, proxy, selector, text_fail) {
let proxyurl = proxy ? 'https://cors-anywhere.herokuapp.com/' : '';
fetch(proxyurl + url, { headers: {"Content-Type": "text/plain", "X-Requested-With": "XMLHttpRequest" } })
.then(response => {
let article = document.querySelector(selector);
if (response.ok) {
response.text().then(html => {
let parser = new DOMParser();
let doc = parser.parseFromString(html, 'text/html');
let article_new = doc.querySelector(selector);
if (article_new) {
if (article)
article.parentNode.replaceChild(article_new, article);
}
});
} else {
if (article)
article.appendChild(document.createTextNode(text_fail));
}
});
}
function removeClassesByPrefix(el, prefix) {
let el_classes = el.classList;
for (let el_class of el_classes) {

View file

@ -85,6 +85,7 @@
"*://*.chicagobusiness.com/*",
"*://*.chicagotribune.com/*",
"*://*.chronicle.com/*",
"*://*.cicero.de/*",
"*://*.clarin.com/*",
"*://*.commentarymagazine.com/*",
"*://*.corriere.it/*",
@ -423,5 +424,5 @@
"*://*.stripe.com/*",
"*://*.userzoom.com/*"
],
"version": "2.0.3.1"
"version": "2.0.3.2"
}

View file

@ -27,6 +27,7 @@ var defaultSites =
"Chemical & Engineering News": "cen.acs.org",
"Chicago Tribune": "chicagotribune.com",
"Chronicle of Higher Education": "chronicle.com",
"Cicero.de": "cicero.de",
"Clarín": "clarin.com",
"Commentary Magazine": "commentarymagazine.com",
"CommonWealth Magazine Taiwan": "cw.com.tw",