From 08984bb0caa34335dc61d874fe970f974a386dc4 Mon Sep 17 00:00:00 2001 From: magnolia1234 <7676006-magnolia1234@users.noreply.gitlab.com> Date: Thu, 28 Jul 2022 20:28:23 +0200 Subject: [PATCH] Add Golem.de --- README.md | 1 + background.js | 2 +- changelog.txt | 1 + contentScript.js | 42 ++++++++++++++++++++++++++++++++++++++++++ manifest.json | 3 ++- sites.js | 4 ++++ 6 files changed, 51 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index dbb69cb3..6b8d402d 100644 --- a/README.md +++ b/README.md @@ -484,6 +484,7 @@ Grouped in options:\ [Die Zeit](https://www.zeit.de) - [Frankfurter Allgemeine Zeitung](https://www.faz.net) - [Freie Presse](https://www.freiepresse.de) - +[Golem.de](https://www.golem.de) - [Kölner Stadt-Anzeiger](https://www.ksta.de) - [Kölnische Rundschau](https://www.rundschau-online.de) - [Krautreporter.de](https://krautreporter.de) - diff --git a/background.js b/background.js index 26e8e7b4..e6e84de6 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']; -const dompurify_sites = ['asiatimes.com', 'bloomberg.com', 'cicero.de', 'economictimes.com', 'hs.fi', 'ilmanifesto.it', 'iltalehti.fi', 'iltirreno.it', 'ipolitics.ca', 'italiaoggi.it', 'lanuovasardegna.it', 'lesechos.fr', 'marianne.net', 'newleftreview.org', 'nzherald.co.nz', 'outlookbusiness.com', 'prospectmagazine.co.uk', 'stratfor.com', 'techinasia.com', 'theathletic.com', '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', 'marianne.net', 'newleftreview.org', 'nzherald.co.nz', 'outlookbusiness.com', 'prospectmagazine.co.uk', 'stratfor.com', 'techinasia.com', 'theathletic.com', '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 94ff0f7b..ca9667f0 100644 --- a/changelog.txt +++ b/changelog.txt @@ -2,6 +2,7 @@ Changelog Bypass Paywalls Clean - Firefox Post-release +Add Golem.de Add Le Soleil - Quebec (+ regional/opt-in to custom sites) Remove Kurier.at (fix obsolete) Fix Bloomberg (graphics) diff --git a/contentScript.js b/contentScript.js index 4139800e..a86553cf 100644 --- a/contentScript.js +++ b/contentScript.js @@ -587,6 +587,48 @@ else if (matchDomain('freiepresse.de')) { } } +else if (matchDomain('golem.de')) { + let url = window.location.href; + let paywall = document.querySelector('article.golemplus'); + if (paywall) { + paywall.classList.remove('golemplus'); + csDoneOnce = true; + if (url.includes('?page=')) + url = url.replace('.html', '-' + url.split('?page=')[1] + '.html').split('?')[0]; + let url_cache = 'https://webcache.googleusercontent.com/search?q=cache:' + url; + replaceDomElementExt(url_cache, true, false, 'article'); + window.setTimeout(function () { + let list_pages = document.querySelectorAll('ol.list-pages > li >a[href]'); + for (let list_page of list_pages) { + let page = list_page.href.match(/-(\d{1,2})\.html/); + if (page && page[1]) { + list_page.href = list_page.href.replace(/-\d{1,2}\.html/, '.html') + '?page=' + page[1]; + } + } + let gallery_images = document.querySelectorAll('ul[class^="golemGallery"] > li > img[data-src]'); + for (let gallery_image of gallery_images) { + if (!gallery_image.src || gallery_image.src.includes('.html')) + removeDOMElement(gallery_image.parentNode); + } + let videos = document.querySelectorAll('figure.gvideofig'); + for (let video of videos) { + let video_text = video.querySelector('div.gvidtext'); + if (!video_text) { + let gwc_link = document.createElement('a'); + gwc_link.href = url_cache; + gwc_link.innerText = 'Watch video on Google webcache'; + gwc_link.target = '_blank'; + video.parentNode.replaceChild(gwc_link, video); + } + } + }, 1000); + } + window.setTimeout(function () { + let ads = document.querySelectorAll('div[id^="iqadtile"], div.wraptusplit'); + removeDOMElement(...ads); + }, 1000); +} + else if (matchDomain('krautreporter.de')) { let paywall = document.querySelector('.js-article-paywall'); if (paywall) { diff --git a/manifest.json b/manifest.json index a0aa7411..1f098bad 100644 --- a/manifest.json +++ b/manifest.json @@ -244,6 +244,7 @@ "*://*.globes.co.il/*", "*://*.globo.com/*", "*://*.goldcoastbulletin.com.au/*", + "*://*.golem.de/*", "*://*.goodhousekeeping.com/*", "*://*.gooieneemlander.nl/*", "*://*.gq.com/*", @@ -695,5 +696,5 @@ "*://gcm.omerlocdn.com/*", "*://webcache.googleusercontent.com/*" ], - "version": "2.7.7.3" + "version": "2.7.7.4" } diff --git a/sites.js b/sites.js index 0804e3cc..1c4a9a5c 100644 --- a/sites.js +++ b/sites.js @@ -589,6 +589,10 @@ var defaultSites = { domain: "globes.co.il", block_regex: /\.tinypass\.com\// }, + "Golem.de": { + domain: "golem.de", + allow_cookies: 1 + }, "Griffith Review": { domain: "griffithreview.com", block_regex: /\.griffithreview\.com\/.+\/leaky-paywall\//,