From 3bc281ea599bdb6453036fb90a04540947bdbeef Mon Sep 17 00:00:00 2001 From: magnolia1234 <7676006-magnolia1234@users.noreply.gitlab.com> Date: Mon, 5 Dec 2022 16:33:24 +0100 Subject: [PATCH] Fix Business Standard & DN.no (images) --- changelog.txt | 2 ++ contentScript.js | 22 +++++++++++++++++++--- manifest.json | 2 +- 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/changelog.txt b/changelog.txt index 8262e1fc..667ad907 100644 --- a/changelog.txt +++ b/changelog.txt @@ -2,6 +2,8 @@ Changelog Bypass Paywalls Clean - Firefox Post-release +Fix Business Standard (images) +Fix DN.no (images) Fix The Athletic (regwall) * v2.9.6.0 (2022-12-04) diff --git a/contentScript.js b/contentScript.js index 005501ae..2e5f0d84 100644 --- a/contentScript.js +++ b/contentScript.js @@ -2758,6 +2758,15 @@ else if (matchDomain('business-standard.com')) { removeDOMElement(...ads); } else { amp_unhide_subscr_section('amp-ad, amp-embed, .block-cont-amp, #divnonpaidcontent, section > div.article_image, div[subscriptions-actions], .reader'); + let hidden_images = document.querySelectorAll('p > amp-img[src][width]'); + for (let elem of hidden_images) { + let img = document.createElement('img'); + img.src = elem.getAttribute('src'); + elem.parentNode.replaceChild(img, elem); + } + let author_image = document.querySelector('amp-img > img[src*="/bs/img/author/"]'); + if (author_image) + author_image.removeAttribute('class'); } } @@ -2872,14 +2881,13 @@ else if (matchDomain('dn.no')) { let paywall = document.querySelector('div#dn-ncp-popup, div.paywall, iframe[title="Paywall"]'); if (paywall) { removeDOMElement(paywall); - csDoneOnce = true; - let article_sel = 'section.article-main-content'; + let article_sel = 'article'; let article = document.querySelector(article_sel); if (article) { let url_cache = 'https://webcache.googleusercontent.com/search?q=cache:' + url.split('?')[0]; replaceDomElementExt(url_cache, true, false, article_sel); } else { - article = document.querySelector('article, main#main-story, main.lp_article_content'); + article = document.querySelector('main#main-story, main.lp_article_content'); if (article) article.insertBefore(googleWebcacheLink(url), article.firstChild); } @@ -2891,6 +2899,14 @@ else if (matchDomain('dn.no')) { let infobox_content = document.querySelector('div.infobox__content'); if (infobox_content) infobox_content.removeAttribute('class'); + let lazy_images = document.querySelectorAll('img[class*="lazy"][data-srcset]:not([src])'); + for (let elem of lazy_images) { + elem.src = elem.getAttribute('data-srcset').split(' ')[0]; + if (elem.classList.contains('lazy')) + elem.classList.remove('lazy'); + else + elem.removeAttribute('class'); + } let ads = document.querySelectorAll('div[id^="googlead-"]'); removeDOMElement(...ads); }, 1000); diff --git a/manifest.json b/manifest.json index d3c4b6b6..0e20224e 100644 --- a/manifest.json +++ b/manifest.json @@ -732,5 +732,5 @@ "*://gcm.omerlocdn.com/*", "*://webcache.googleusercontent.com/*" ], - "version": "2.9.6.1" + "version": "2.9.6.2" }