From 6a375a24770d88c0ce00c730f23f9d277b702068 Mon Sep 17 00:00:00 2001 From: magnolia1234 <7676006-magnolia1234@users.noreply.gitlab.com> Date: Mon, 11 Dec 2023 12:15:33 +0100 Subject: [PATCH] Fix Australia News Corp (media on amp) --- changelog.txt | 1 + contentScript.js | 32 ++++++++++---------------------- custom/manifest.json | 2 +- manifest.json | 2 +- 4 files changed, 13 insertions(+), 24 deletions(-) diff --git a/changelog.txt b/changelog.txt index 2ac41c45..90175d8b 100644 --- a/changelog.txt +++ b/changelog.txt @@ -3,6 +3,7 @@ Changelog Bypass Paywalls Clean - Firefox Updates (install signed xpi-file): https://gitlab.com/magnolia1234/bypass-paywalls-firefox-clean/-/releases Post-release +Fix Australia News Corp (media on amp) Remove JungeFreiheit.de (fix obsolete) Remove Wissenschaft.de (fix obsolete) diff --git a/contentScript.js b/contentScript.js index 0b3bba37..ff1dd361 100644 --- a/contentScript.js +++ b/contentScript.js @@ -426,21 +426,12 @@ else { // Australia News Corp let au_news_corp_domains = ['adelaidenow.com.au', 'cairnspost.com.au', 'couriermail.com.au', 'dailytelegraph.com.au', 'geelongadvertiser.com.au', 'goldcoastbulletin.com.au', 'heraldsun.com.au', 'ntnews.com.au', 'theaustralian.com.au', 'thechronicle.com.au', 'themercury.com.au', 'townsvillebulletin.com.au', 'weeklytimesnow.com.au']; if (matchDomain(au_news_corp_domains)) { - if (window.location.hostname.startsWith('amp.') || window.location.search.match(/[&\?]amp/)) { + if (window.location.search.match(/[&\?]amp/)) { + amp_unhide_subscr_section('amp-ad, amp-embed, [id^="ad-mrec-"], [class*="ad-container"]', false); let figure_stretch = document.querySelectorAll('figure.stretch'); for (let elem of figure_stretch) elem.classList.remove('stretch'); - let amp_ads_sel = 'amp-ad, amp-embed, [id^="ad-mrec-"], [class*="ad-container"]'; - let comments; - if (window.location.hostname.startsWith('amp.')) { - amp_unhide_subscr_section(amp_ads_sel, true, true, '.newscdn.com.au'); - comments = document.querySelector('#story-comments, .comments-wrapper'); - } else if (window.location.search.match(/(\?|&)amp/)) { - amp_unhide_subscr_section(amp_ads_sel, true, true, '.newscdn.com.au'); - comments = document.querySelector('#comments-load, .comments-module'); - let amp_iframe_sizers = document.querySelectorAll('amp-iframe > i-amphtml-sizer'); - removeDOMElement(...amp_iframe_sizers) - } + let comments = document.querySelector('#comments-load, .comments-module'); removeDOMElement(comments); } else { let ads = document.querySelectorAll('.header_ads-container, .ad-block, .ad-container'); @@ -829,14 +820,10 @@ else if (matchDomain('faz.net')) { removeDOMElement(...pars); json_text = breakText_headers(json_text).split("\n\n"); for (let p_text of json_text) { - let elem; - if (p_text.length < 80) { - elem = document.createElement("h2"); - elem.setAttribute('class', 'atc-SubHeadline'); - } else { - elem = document.createElement("p"); - elem.setAttribute('class', 'atc-TextParagraph'); - }; + let elem = document.createElement("p"); + elem.setAttribute('class', 'atc-TextParagraph'); + if (p_text.length < 80) + elem.style = 'font-weight: bold;'; elem.innerText = p_text; article_text.appendChild(elem); }; @@ -4235,9 +4222,10 @@ else if (matchDomain('janes.com')) { else if (matchDomain('japantimes.co.jp')) { if (!window.location.pathname.endsWith('/amp')) { window.setTimeout(function () { - let paywall = document.querySelector('div.blocker > div.tp-container-inner'); + let paywall = document.querySelector('div.subscribe'); if (paywall) { - removeDOMElement(paywall.parentNode); + let banner = document.querySelector('div.blocker > div.tp-container-inner'); + removeDOMElement(paywall, banner); let article = document.querySelector('div.article-body'); if (article) { let url = window.location.href; diff --git a/custom/manifest.json b/custom/manifest.json index fb8e6f5a..067dd879 100644 --- a/custom/manifest.json +++ b/custom/manifest.json @@ -51,5 +51,5 @@ "webRequestBlocking", "*://*/*" ], - "version": "3.4.6.1" + "version": "3.4.6.2" } diff --git a/manifest.json b/manifest.json index 5661d6e5..a6d7dbd7 100644 --- a/manifest.json +++ b/manifest.json @@ -828,5 +828,5 @@ "*://archive.vn/*", "*://webcache.googleusercontent.com/*" ], - "version": "3.4.6.1" + "version": "3.4.6.2" }