From 9bfbfa69eff7bcf71220abc93e1afe5d1c51eed3 Mon Sep 17 00:00:00 2001 From: magnolia1234 <7676006-magnolia1234@users.noreply.gitlab.com> Date: Fri, 5 Aug 2022 20:40:26 +0200 Subject: [PATCH] Fix Spiegel.de (Google webcache) --- README.md | 2 +- background.js | 2 +- changelog.txt | 1 + contentScript.js | 12 +++++++++--- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 03933277..f7eb7187 100644 --- a/README.md +++ b/README.md @@ -483,7 +483,7 @@ Grouped in options:\ [Badische Neueste Nachrichten](https://www.bnn.de) - [Berliner Zeitung](https://www.berliner-zeitung.de) - [Cicero](https://www.cicero.de) - -[Der Spiegel (link to archive.today)](https://www.spiegel.de) - +[Der Spiegel](https://www.spiegel.de) - [Der Tagesspiegel](https://www.tagesspiegel.de) - [Die Rheinpfalz](https://www.rheinpfalz.de) - [Die Zeit](https://www.zeit.de) - diff --git a/background.js b/background.js index b697df90..6154840f 100644 --- a/background.js +++ b/background.js @@ -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', 'thetimes.co.uk'].concat(de_westfalen_medien_domains); -const dompurify_sites = ['asiatimes.com', 'bloomberg.com', 'cicero.de', 'economictimes.com', 'golem.de', 'hs.fi', 'ilmanifesto.it', 'iltalehti.fi', 'iltirreno.it', 'ipolitics.ca', 'italiaoggi.it', 'lanuovasardegna.it', 'lesechos.fr', 'limburger.nl', 'marianne.net', 'newleftreview.org', 'nzherald.co.nz', 'outlookbusiness.com', 'prospectmagazine.co.uk', 'stratfor.com', 'tagesspiegel.de', 'techinasia.com', 'thetimes.co.uk', 'timesofindia.com', 'vn.nl'].concat(be_mediahuis_domains, nl_mediahuis_region_domains, no_nhst_media_domains); +const dompurify_sites = ['asiatimes.com', 'bloomberg.com', 'cicero.de', 'economictimes.com', 'golem.de', 'hs.fi', 'ilmanifesto.it', 'iltalehti.fi', 'iltirreno.it', 'ipolitics.ca', 'italiaoggi.it', 'lanuovasardegna.it', 'lesechos.fr', 'limburger.nl', 'marianne.net', 'newleftreview.org', 'nzherald.co.nz', 'outlookbusiness.com', 'prospectmagazine.co.uk', 'spiegel.de', 'stratfor.com', 'tagesspiegel.de', 'techinasia.com', 'thetimes.co.uk', 'timesofindia.com', 'vn.nl'].concat(be_mediahuis_domains, nl_mediahuis_region_domains, no_nhst_media_domains); var currentTabUrl = ''; var csDone = false; var optin_setcookie = false; diff --git a/changelog.txt b/changelog.txt index febf18d3..61696340 100644 --- a/changelog.txt +++ b/changelog.txt @@ -6,6 +6,7 @@ Add Limburger.nl Add Standaard.be Add SuomenSotilas.fi Fix Australian Community Media (css) +Fix Spiegel.de (Google webcache) Add Tagesspiegel.de Fix The Athletic (css & amp) Fix TheTimes.co.uk (Google webcache) diff --git a/contentScript.js b/contentScript.js index d3c2dda9..948444c1 100644 --- a/contentScript.js +++ b/contentScript.js @@ -717,9 +717,15 @@ else if (matchDomain('spiegel.de')) { let paywall = document.querySelector('div[data-area="paywall"]'); if (paywall) { removeDOMElement(paywall); - let article = document.querySelector('div[data-area="body"]'); - if (article) - article.insertBefore(archiveLink(url), article.firstChild); + csDoneOnce = true; + let url_cache = 'https://webcache.googleusercontent.com/search?q=cache:' + url.split('?')[0]; + replaceDomElementExt(url_cache, true, false, 'div[data-area="body"]'); + window.setTimeout(function () { + let lazy_images = document.querySelectorAll('img.lazyload[src^="data:image/"][data-src]'); + for (let elem of lazy_images) { + elem.src = elem.getAttribute('data-src'); + } + }, 1000); } }