From f0e3829106a3c2b36535f5ff0be77b079a5df59d Mon Sep 17 00:00:00 2001 From: magnolia1234 <7676006-magnolia1234@users.noreply.gitlab.com> Date: Thu, 7 Sep 2023 21:25:12 +0200 Subject: [PATCH] Fix MarketWatch (amp-redirect) --- changelog.txt | 1 + contentScript.js | 12 ++++++------ custom/manifest.json | 2 +- custom/sites_custom.json | 6 ++++++ manifest.json | 2 +- sites_updated.json | 7 +++++++ 6 files changed, 22 insertions(+), 8 deletions(-) diff --git a/changelog.txt b/changelog.txt index 9cc9161..4f342a6 100644 --- a/changelog.txt +++ b/changelog.txt @@ -4,6 +4,7 @@ Updates (install signed xpi-file): https://gitlab.com/magnolia1234/bypass-paywal Post-release Fix Inc42 (js) +Fix MarketWatch (amp-redirect) Fix Puck.news (ld_json_url) Fix Tes Magazine (css) Fix The Diplomat (magazine) diff --git a/contentScript.js b/contentScript.js index d051cd4..6bbd315 100644 --- a/contentScript.js +++ b/contentScript.js @@ -4124,12 +4124,12 @@ else if (matchDomain('magazine.atavist.com')) { } else if (matchDomain('marketwatch.com')) { - let premium = document.querySelector('html.is-paywall'); - let url = window.location.href; - if (!url.includes('/amp/')) { - if (premium) { - premium.classList.remove('is-paywall'); - window.location.href = url.replace('.marketwatch.com/', '.marketwatch.com/amp/'); + if (!window.location.pathname.startsWith('/amp/')) { + let paywall = document.querySelector('div#cx-snippet'); + let amphtml = document.querySelector('link[rel="amphtml"]'); + if (paywall && amphtml) { + removeDOMElement(paywall); + window.location.href = amphtml.href; } } else { let meter = document.querySelector('div.meter'); diff --git a/custom/manifest.json b/custom/manifest.json index ee5c6d5..aee3e74 100644 --- a/custom/manifest.json +++ b/custom/manifest.json @@ -51,5 +51,5 @@ "webRequestBlocking", "*://*/*" ], - "version": "3.3.2.5" + "version": "3.3.2.6" } diff --git a/custom/sites_custom.json b/custom/sites_custom.json index 05c17d7..236adec 100644 --- a/custom/sites_custom.json +++ b/custom/sites_custom.json @@ -283,6 +283,12 @@ "allow_cookies": 1, "domain": "lefigaro.fr" }, + "Lepoint.fr": { + "add_ext_link": "div.info-paywall|div.ArticleBody>p", + "add_ext_link_type": "archive.is", + "allow_cookies": 1, + "domain": "lepoint.fr" + }, "Libraryjournal.com": { "allow_cookies": 1, "block_regex": "\\.libraryjournal.com\\.com\\/.+\\/js\\/metering\\.js", diff --git a/manifest.json b/manifest.json index 018e072..0716c4c 100644 --- a/manifest.json +++ b/manifest.json @@ -796,5 +796,5 @@ "*://*.wyleex.com/*", "*://webcache.googleusercontent.com/*" ], - "version": "3.3.2.5" + "version": "3.3.2.6" } diff --git a/sites_updated.json b/sites_updated.json index f856fbb..75b9c1e 100644 --- a/sites_updated.json +++ b/sites_updated.json @@ -63,6 +63,13 @@ "ld_google_webcache": "div.post-subscribe|div.post-body-wrapper", "upd_version": "3.3.0.5" }, + "MarketWatch": { + "domain": "marketwatch.com", + "allow_cookies": 1, + "block_regex": "(cdn\\.cxense\\.com\\/|cdn\\.ampproject\\.org\\/v\\d\\/amp-(access|subscriptions)-.+\\.js)", + "amp_redirect": "div#cx-snippet", + "upd_version": "3.3.2.6" + }, "Mediahuis Noord": { "domain": "###_nl_mediahuis_noord", "group": [