From 759af025dc4e96b3abb15489aab7de094bf64f6f Mon Sep 17 00:00:00 2001 From: magnolia1234 <7676006-magnolia1234@users.noreply.gitlab.com> Date: Fri, 29 Mar 2024 12:38:44 +0100 Subject: [PATCH] Fix Humanite.fr --- changelog.txt | 1 + contentScript.js | 26 ++++---------------------- sites_updated.json | 7 +++++++ 3 files changed, 12 insertions(+), 22 deletions(-) diff --git a/changelog.txt b/changelog.txt index 02073b4..f904af2 100644 --- a/changelog.txt +++ b/changelog.txt @@ -6,6 +6,7 @@ Post-release Add American Purpose Add Ringier Axel Springer Polska Remove Hbvl.be (fix obsolete) +Fix Humanite.fr Fix LeMonde.fr (bug; update rules) Fix WSJ (intro video) Update custom sites (search) diff --git a/contentScript.js b/contentScript.js index c6a3c45..c16f9f8 100644 --- a/contentScript.js +++ b/contentScript.js @@ -1944,28 +1944,10 @@ else if (matchDomain(fr_groupe_nice_matin_domains)) { else if (matchDomain('humanite.fr')) { let paywall = document.querySelector('div.single__categories svg'); if (paywall && dompurify_loaded) { - let json_script = document.querySelector('script[id="module-sage-index.js-js-extra"]'); - if (json_script) { - csDoneOnce = true; - if (json_script.text.match(/js_vars\s?=\s?/)) { - try { - let json = JSON.parse(json_script.text.split(/js_vars\s?=\s?/)[1].split('};')[0] + '}'); - let json_text = json.post.post_content.split('')[1]; - let article = document.querySelector('div.rich-text > div.gs-row'); - if (article) { - let parser = new DOMParser(); - let doc = parser.parseFromString('
' + DOMPurify.sanitize(json_text, dompurify_options) + '
', 'text/html'); - let article_new = doc.querySelector('div'); - if (article_new) { - article.innerHTML = ''; - article.appendChild(article_new); - } - } - } catch (err) { - console.log(err); - } - } - } + csDoneOnce = true; + let url = window.location.href; + let url_cache = 'https://webcache.googleusercontent.com/search?q=cache:' + url.split(/[#\?]/)[0]; + replaceDomElementExt(url_cache, true, false, 'div.rich-text > div.gs-row'); } } diff --git a/sites_updated.json b/sites_updated.json index f660c67..8985fc2 100644 --- a/sites_updated.json +++ b/sites_updated.json @@ -71,6 +71,13 @@ "nofix": 1, "upd_version": "3.6.0.8" }, + "L'Humanité": { + "domain": "humanite.fr", + "allow_cookies": 1, + "block_regex": "\\.qiota\\.com", + "ld_google_webcache": "div.single__categories svg|div.rich-text > div.gs-row", + "upd_version": "3.6.1.5" + }, "Le Monde (link to archive.is)": { "domain": "lemonde.fr", "allow_cookies": 1,