Fix The Spectator UK (no amp)

This commit is contained in:
magnolia1234 2022-09-15 12:17:16 +02:00
parent f5c0aaebe5
commit 0ffa02e076
4 changed files with 26 additions and 14 deletions

View File

@ -6,7 +6,7 @@ var ext_name = manifestData.name;
var ext_version = manifestData.version;
const cs_limit_except = ['elespanol.com', 'faz.net', 'nation.africa', 'nationalgeographic.com'].concat(de_westfalen_medien_domains);
const dompurify_sites = ['asiatimes.com', 'bloomberg.com', 'cicero.de', 'ilmanifesto.it', 'iltalehti.fi', 'iltirreno.it', 'ipolitics.ca', 'italiaoggi.it', 'lanuovasardegna.it', 'lesechos.fr', 'marianne.net', 'newleftreview.org', 'newscientist.com', 'nzherald.co.nz', 'outlookbusiness.com', 'prospectmagazine.co.uk', 'stratfor.com', 'techinasia.com', 'timesofindia.com', 'valor.globo.com', 'vn.nl'].concat(be_mediahuis_domains, nl_mediahuis_region_domains, no_nhst_media_domains);
const dompurify_sites = ['asiatimes.com', 'bloomberg.com', 'cicero.de', 'ilmanifesto.it', 'iltalehti.fi', 'iltirreno.it', 'ipolitics.ca', 'italiaoggi.it', 'lanuovasardegna.it', 'lesechos.fr', 'marianne.net', 'newleftreview.org', 'newscientist.com', 'nzherald.co.nz', 'outlookbusiness.com', 'prospectmagazine.co.uk', 'spectator.co.uk', 'stratfor.com', 'techinasia.com', 'timesofindia.com', 'valor.globo.com', 'vn.nl'].concat(be_mediahuis_domains, nl_mediahuis_region_domains, no_nhst_media_domains);
var currentTabUrl = '';
var csDone = false;
var optin_setcookie = false;
@ -24,6 +24,7 @@ var restrictions = {
'esquire.com': /^((?!\/classic\.esquire\.com\/).)*$/,
'faz.net': /^((?!\.faz\.net\/aktuell\/(\?switchfaznet)?$).)*$/,
'lastampa.it': /^((?!\/video\.lastampa\.it\/).)*$/,
'lequipe.fr': /^((?!\.lequipe\.fr\/.+\/les-notes\/).)*$/,
'nytimes.com': /^((?!\/timesmachine\.nytimes\.com\/).)*$/,
'science.org': /^((?!\.science\.org\/doi\/).)*$/,
'timesofindia.com': /\.timesofindia\.com($|\/($|toi-plus(\/.+)?|.+\.cms))/,

View File

@ -7,6 +7,7 @@ Add BusinessPost.ie
Add Private Equity News
Fix Esprit.presse.fr
Fix Gruppo GEDI.it (login)
Fix The Spectator UK (no amp)
* v2.8.4.0 (2022-09-11)
Add PEI Media sites (opt-in to custom sites)

View File

@ -1292,7 +1292,7 @@ else if (matchDomain('leparisien.fr')) {
else if (matchDomain('lequipe.fr')) {
let paywall = document.querySelectorAll('.Paywall, .Article__paywall');
if (paywall.length) {
if (window.location.pathname.includes('/Article/') && paywall.length) {
let scripts = document.querySelectorAll('script:not([src], [type])');
let json_script;
for (let script of scripts) {
@ -2175,18 +2175,26 @@ else if (matchDomain('prospectmagazine.co.uk')) {
}
else if (matchDomain('spectator.co.uk')) {
if (window.location.pathname.match(/\/amp(\/)?$/)) {
let banners = document.querySelectorAll('div[amp-access^="p.show"], div[amp-access*="NOT loggedIn"]');
removeDOMElement(...banners);
} else if (window.location.pathname.startsWith('/article/')) {
let paywall = document.querySelector('.HardPayWallContainer-module__overlay');
if (window.location.pathname.startsWith('/article/')) {
let body_par = document.querySelector('p[class^="ContentPageBodyParagraph"]');
let amphtml = document.querySelector('link[rel="amphtml"]');
if ((paywall || !body_par) && amphtml) {
removeDOMElement(paywall);
window.setTimeout(function () {
window.location.href = amphtml.href;
}, 500);
if (!body_par && dompurify_loaded) {
csDoneOnce = true;
let url = window.location.href;
fetch(url)
.then(response => {
if (response.ok) {
response.text().then(html => {
let parser = new DOMParser();
let doc = parser.parseFromString('<div>' + DOMPurify.sanitize(html) + '</div>', 'text/html');
let article = document.querySelector('main > div');
let article_new = doc.querySelector('main > div');
if (article_new) {
if (article)
article.appendChild(article_new);
}
})
}
})
}
}
}
@ -4004,6 +4012,8 @@ else if ((domain = matchDomain(usa_lee_ent_domains)) || document.querySelector('
elem.removeAttribute('style');
elem.removeAttribute('class');
}
let banners = document.querySelectorAll('div.subscription-required, div.redacted-overlay, div.tnt-ads-container');
removeDOMElement(...banners);
}
}

View File

@ -705,5 +705,5 @@
"*://gcm.omerlocdn.com/*",
"*://webcache.googleusercontent.com/*"
],
"version": "2.8.4.3"
"version": "2.8.4.4"
}