From 3fbfb5a396d405d0025f188a6be04dc8a087dce9 Mon Sep 17 00:00:00 2001 From: magnolia1234 <7676006-magnolia1234@users.noreply.gitlab.com> Date: Thu, 14 Jan 2021 19:26:20 +0100 Subject: [PATCH] Add Schweriner Volkszeitung (Germany) --- README.md | 1 + background.js | 4 +++- changelog.txt | 1 + contentScript.js | 29 +++++++++++++++++++++-------- manifest.json | 3 ++- sites.js | 1 + 6 files changed, 29 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 3b834fdf..31c2c0fe 100644 --- a/README.md +++ b/README.md @@ -248,6 +248,7 @@ Groupe Rossel sites (grouped in options) like [Kurier.at](https://kurier.at) - [Piqd.de](https://www.piqd.de) - [Sächsische Zeitung](https://www.saechsische.de) - +[Schweriner Volkszeitung](https://www.svz.de) - [Süddeutsche Zeitung](https://www.sueddeutsche.de) - [WirtschaftsWoche](https://www.wiwo.de)\ Grouped in options:\ diff --git a/background.js b/background.js index 8f30ff2d..609670ea 100644 --- a/background.js +++ b/background.js @@ -102,6 +102,7 @@ var allow_cookies_default = [ 'startribune.com', 'stocknews.com', 'sueddeutsche.de', + 'svz.de', 'techinasia.com', 'the-american-interest.com', 'thehindu.com', @@ -282,6 +283,7 @@ var blockedRegexes = { 'spectator.co.uk': /cdn\.tinypass\.com\/.+/, 'spectator.com.au': /cdn\.tinypass\.com\/.+/, 'spectator.us': /(cdn\.cxense\.com\/.+|cdn\.tinypass\.com\/.+)/, + 'svz.de': /cdn\.ampproject\.org\/v\d\/amp-(access|(sticky-)?ad|consent|fx-flying-carpet)-.+\.js/, 'technologyreview.com': /.+\.blueconic\.net\/.+/, 'telegraph.co.uk': /(cdn\.tinypass\.com\/|cdn\.ampproject\.org\/v\d\/amp-(access|ad|consent)-.+\.js|\.telegraph\.co\.uk\/.+\/piano.+\.js|assets\.adobedtm\.com\/.+\.js)/, 'thedailybeast.com': /cdn\.tinypass\.com\/.+/, @@ -792,7 +794,7 @@ ext_api.webRequest.onBeforeSendHeaders.addListener(function(details) { let usa_discmag_site = (matchUrlDomain('ctfassets.net', details.url) && matchUrlDomain('discovermagazine.com', 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', '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)); + 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', 'svz.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 && !usa_discmag_site && !bpc_amp_site) { return; diff --git a/changelog.txt b/changelog.txt index a639b56a..e5ff885d 100644 --- a/changelog.txt +++ b/changelog.txt @@ -6,6 +6,7 @@ Add Cicero (Germany) Add Il Secolo XIX (Italy) Add L'Usine Nouvelle (France) Add La Nuova Sardegna (Italy) +Add Schweriner Volkszeitung (Germany) Fix-update Discover Magazine Fix-update Faz.net (Zeitung subdomain) Update set user-agent/referer (limit) diff --git a/contentScript.js b/contentScript.js index 2812013b..cf8c0bef 100644 --- a/contentScript.js +++ b/contentScript.js @@ -370,13 +370,9 @@ else if (matchDomain("nzherald.co.nz")) { } else if (matchDomain(["parool.nl", "trouw.nl", "volkskrant.nl", "humo.be", "demorgen.be"])) { - window.setTimeout(function () { - let top_banner = document.querySelector('div[data-temptation-position="PAGE_TOP"]'); - let paywall = document.querySelector('[data-temptation-position="ARTICLE_BOTTOM"]'); - let hidden_section = document.querySelector('[data-temptation-position="ARTICLE_INLINE"]'); - let overlay = document.querySelector('div[data-temptation-position="PAGE_BOTTOM"]'); - removeDOMElement(top_banner, paywall, hidden_section, overlay); - }, 500); // Delay (in milliseconds) + let banners = document.querySelectorAll('div[data-temptation-position^="PAGE_"], div[class^="ad--"]'); + let paywall = document.querySelectorAll('[data-temptation-position^="ARTICLE_"]'); + removeDOMElement(...banners, ...paywall); } else if (matchDomain("firstthings.com")) { @@ -1946,6 +1942,23 @@ else if (matchDomain('lavanguardia.com')) { removeDOMElement(paywall, infinite_loading); } +else if (matchDomain('svz.de')) { + let paywall = document.querySelector('.paywall'); + let url = window.location.href; + window.setTimeout(function () { + if (paywall && !url.includes('-amp.html')) { + window.location.href = url.replace('.html', '-amp.html'); + } + }, 500); // Delay (in milliseconds) + if (url.includes('-amp.html')) { + let div_hidden = document.querySelector('div[amp-access="NOT data.reduced"]'); + if (div_hidden) + div_hidden.removeAttribute('amp-access-hide'); + } + let amp_ads = document.querySelectorAll('amp-ad, amp-embed, #flying-carpet-wrapper'); + removeDOMElement(...amp_ads); +} + else if (!matchDomain(['belfasttelegraph.co.uk', 'independent.ie'])) csDone = true; @@ -1985,7 +1998,7 @@ function replaceDomElementExt(url, proxy, selector, text_fail) { article.parentNode.replaceChild(article_new, article); } }); - } else { + } else if (text_fail) { if (article) article.appendChild(document.createTextNode(text_fail)); } diff --git a/manifest.json b/manifest.json index 76334aad..bfb4163b 100644 --- a/manifest.json +++ b/manifest.json @@ -333,6 +333,7 @@ "*://*.sueddeutsche.de/*", "*://*.sun-sentinel.com/*", "*://*.sunshinecoastdaily.com.au/*", + "*://*.svz.de/*", "*://*.talouselama.fi/*", "*://*.techinasia.com/*", "*://*.technologyreview.com/*", @@ -428,5 +429,5 @@ "*://*.stripe.com/*", "*://*.userzoom.com/*" ], - "version": "2.0.3.4" + "version": "2.0.3.5" } \ No newline at end of file diff --git a/sites.js b/sites.js index 26f459be..4627c1c5 100644 --- a/sites.js +++ b/sites.js @@ -167,6 +167,7 @@ var defaultSites = "Sächsische Zeitung": "saechsische.de", "San Diego Union Tribune": "sandiegouniontribune.com", "San Francisco Chronicle": "sfchronicle.com", + "Schweriner Volkszeitung": "svz.de", "Science & Vie": "science-et-vie.com", "Sciences et Avenir": "sciencesetavenir.fr", "Scientific American (free articles only)": "scientificamerican.com",