Fix Quartz (link to archive.is)

This commit is contained in:
magnolia1234 2021-06-29 21:13:53 +02:00
parent 6727774c82
commit cee0cc0794
4 changed files with 31 additions and 13 deletions

View File

@ -365,6 +365,7 @@ var blockedRegexes = {
'observador.pt': /\.tinypass\.com\//,
'parismatch.com': /\.poool\.fr\//,
'quotidiano.net': /\.tinypass\.com\//,
'qz.com': /\.tinypass\.com\//,
'reuters.com': /\.reuters\.com\/(arc\/subs\/p\.min|pf\/resources\/dist\/reuters\/js\/index)\.js/,
'rollingstone.com': /cdn\.cxense\.com\//,
'ruhrnachrichten.de': /\.tinypass\.com\//,
@ -1238,7 +1239,7 @@ if (matchUrlDomain(change_headers, details.url) && (['main_frame', 'sub_frame',
}
if ((!['font', 'stylesheet'].includes(details.type) || matchUrlDomain(cs_limit_except, currentTabUrl)) && !csDone) {
let lib_file = 'lib/empty.js';
if (matchUrlDomain(['business-standard.com', 'cicero.de', 'economictimes.com', 'faz.net', 'gva.be', 'lesechos.fr', 'newleftreview.org', 'newyorker.com', 'nzherald.co.nz', 'prospectmagazine.co.uk', 'sudouest.fr', 'techinasia.com', 'valor.globo.com'].concat(nl_mediahuis_region_domains), currentTabUrl))
if (matchUrlDomain(['business-standard.com', 'cicero.de', 'economictimes.com', 'gva.be', 'lesechos.fr', 'newleftreview.org', 'newyorker.com', 'nzherald.co.nz', 'prospectmagazine.co.uk', 'sudouest.fr', 'techinasia.com', 'valor.globo.com'].concat(nl_mediahuis_region_domains), currentTabUrl))
lib_file = 'lib/purify.min.js';
ext_api.tabs.executeScript(tabId, {
file: lib_file,

View File

@ -3,6 +3,7 @@ Changelog Bypass Paywalls Clean - Firefox
Post-release
Fix Augsburger Allgemeine
Fix Quartz (link to archive.is)
Maintenance contentScript (sanitize html-input)
* v2.2.7.0 (2021-06-27)

View File

@ -374,7 +374,7 @@ else if (matchDomain('faz.net')) {
if (response.ok) {
response.text().then(html => {
var parser = new DOMParser();
var doc = parser.parseFromString(DOMPurify.sanitize(html), 'text/html');
var doc = parser.parseFromString(html, 'text/html');
let json = doc.querySelector('script[id="schemaOrgJson"]');
if (json) {
var json_text = json.text.replace(/(\r|\n)/g, '');
@ -1494,17 +1494,9 @@ else if (matchDomain('thetimes.co.uk')) {
let paywall = document.querySelector('div#paywall-portal-article-footer');
if (paywall && !url.includes('?shareToken=')) {
removeDOMElement(paywall);
let text_fail_div = document.createElement('div');
text_fail_div.appendChild(document.createTextNode('BPC > Read full article text:\r\n'));
let a_link = document.createElement('a');
a_link.innerText = archive_url;
a_link.href = archive_url;
a_link.target = '_blank';
a_link.setAttribute('style', 'font-weight: bold;');
text_fail_div.appendChild(a_link);
let article = document.querySelector('article[role="article"]');
if (article)
article.insertBefore(text_fail_div, article.firstChild);
article.insertBefore(archiveLink(archive_url), article.firstChild);
}
let paywall_page = document.querySelector('div#paywall-portal-page-footer');
removeDOMElement(paywall_page);
@ -2187,11 +2179,22 @@ else if (matchDomain('nytimes.com')) {
}
else if (matchDomain('qz.com')) {
let url = window.location.href;
window.setTimeout(function () {
let url = window.location.href;
if (url.includes('utm_source='))
window.location.href = url.split('?')[0];
}, 500); // Delay (in milliseconds)
let archive_url = 'https://archive.is?url=' + url;
let paywall = document.querySelector('div.KbD9m');
let overflow = document.querySelector('div._7S-qA');
let msg = document.querySelector('div#bpc_archive');
if (paywall && !msg) {
if (overflow)
overflow.classList.remove('_7S-qA');
let article = document.querySelector('div#article-content');
if (article)
article.appendChild(archiveLink(archive_url));
}
}
else if (matchDomain('republic.ru')) {
@ -2646,6 +2649,19 @@ function replaceDomElementExt(url, proxy, base64, selector, text_fail = '') {
});
}
function archiveLink(archive_url) {
let text_fail_div = document.createElement('div');
text_fail_div.id = 'bpc_archive';
text_fail_div.appendChild(document.createTextNode('BPC > Read full article text:\r\n'));
let a_link = document.createElement('a');
a_link.innerText = archive_url;
a_link.href = archive_url;
a_link.target = '_blank';
a_link.setAttribute('style', 'font-weight: bold;');
text_fail_div.appendChild(a_link);
return text_fail_div;
}
function removeClassesByPrefix(el, prefix) {
let el_classes = el.classList;
for (let el_class of el_classes) {

View File

@ -528,5 +528,5 @@
"*://*.wallkit.net/*",
"*://*.wsj.net/*"
],
"version": "2.2.7.2"
"version": "2.2.7.3"
}