diff --git a/background.js b/background.js index 60a51a73..b1bc92e8 100644 --- a/background.js +++ b/background.js @@ -1228,7 +1228,7 @@ if (matchUrlDomain(change_headers, details.url) && (['main_frame', 'sub_frame', } if ((!['font', 'stylesheet'].includes(details.type) || matchUrlDomain(cs_limit_except, currentTabUrl)) && !csDone) { let lib_file = 'lib/empty.js'; - if (matchUrlDomain(['cicero.de', 'economictimes.com', 'gva.be', 'lesechos.fr', 'newleftreview.org', 'newyorker.com', 'nzherald.co.nz', 'prospectmagazine.co.uk', 'sudouest.fr', 'techinasia.com', 'tradewindsnews.com', 'valor.globo.com', 'washingtonpost.com'].concat(nl_mediahuis_region_domains), currentTabUrl)) + if (matchUrlDomain(['bloomberg.com', 'cicero.de', 'economictimes.com', 'gva.be', 'lesechos.fr', 'newleftreview.org', 'newyorker.com', 'nzherald.co.nz', 'prospectmagazine.co.uk', 'sudouest.fr', 'techinasia.com', 'tradewindsnews.com', 'valor.globo.com', 'washingtonpost.com'].concat(nl_mediahuis_region_domains), currentTabUrl)) lib_file = 'lib/purify.min.js'; ext_api.tabs.executeScript(tabId, { file: lib_file, @@ -1440,7 +1440,7 @@ function remove_cookies_fn(domainVar, exclusions = false) { // remove cookies after page load ext_api.webRequest.onCompleted.addListener(function (details) { let domainVar = matchUrlDomain(remove_cookies, details.url); - if (domainVar && ['main_frame', 'xmlhttprequest', 'other'].includes(details.type) && enabledSites.includes(domainVar)) + if (domainVar && ['main_frame', 'sub_frame', 'xmlhttprequest', 'other'].includes(details.type) && enabledSites.includes(domainVar)) remove_cookies_fn(domainVar, true); }, { urls: [""] diff --git a/changelog.txt b/changelog.txt index 6fe3a3cc..563b0bdb 100644 --- a/changelog.txt +++ b/changelog.txt @@ -3,6 +3,7 @@ Changelog Bypass Paywalls Clean - Firefox Post-release Add Southern Weekly (China) +Fix Bloomberg Fix The Daily Telegraph (au) * v2.2.9.0 (2021-07-11) diff --git a/contentScript.js b/contentScript.js index f71ca980..11fa35ba 100644 --- a/contentScript.js +++ b/contentScript.js @@ -1651,21 +1651,43 @@ else if (matchDomain('barrons.com')) { } else if (matchDomain('bloomberg.com')) { - document.addEventListener('DOMContentLoaded', () => { - let fence = document.querySelector('.fence-body'); - if (fence) { - fence.classList.remove('fence-body'); + sessionStorage.clear(); + let counter = document.querySelector('div#fortress-preblocked-container-root'); + let leaderboard = document.querySelector('div[id^="leaderboard"]'); + let shimmering_content = document.querySelectorAll('div[class^="shimmering-"]'); + removeDOMElement(counter, leaderboard, ...shimmering_content); + let hidden_images = document.querySelectorAll('div.lazy-img > img.lazy-img__image[src$="x-1.png"][data-native-src]'); + for (let hidden_image of hidden_images) { + hidden_image.setAttribute('src', hidden_image.getAttribute('data-native-src')); + hidden_image.removeAttribute('class'); + hidden_image.parentElement.removeAttribute('class'); + } + let json_script = document.querySelector('script[data-component-props="ArticleBody"], script[data-component-props="FeatureBody"]'); + if (json_script) { + let json = JSON.parse(json_script.innerHTML); + if (json) { + let json_text = json.body; + let json_id = json.id; + let meta_id = document.querySelector('meta[name="parsely-post-id"][content]'); + if (json_text && json_text !== 'undefined' && json_id && json_id !== 'undefined' && meta_id && meta_id.content === json_id) { + removeDOMElement(json_script); + let article = document.querySelector('div.body-copy-v2'); + let article_class = 'body-copy-v2'; + if (!article) { + article = document.querySelector('div.body-copy'); + article_class = 'body-copy'; + } + let parser = new DOMParser(); + let doc = parser.parseFromString('
' + DOMPurify.sanitize(json_text, {ADD_TAGS: ['iframe']}) + '
', 'text/html'); + let article_new = doc.querySelector('div'); + if (article_new) { + if (article) { + article.parentNode.replaceChild(article_new, article); + } + } + } } - }); - let body_overlay = document.querySelector('body[data-paywall-overlay-status="show"]'); - if (body_overlay) - body_overlay.removeAttribute('data-paywall-overlay-status'); - let noscroll = document.querySelector('body[class*="noScroll"]'); - if (noscroll) - removeClassesByPrefix(noscroll, 'noScroll'); - let paywall_overlay = document.querySelector('div#graphics-paywall-overlay'); - let banner = document.getElementById('paywall-banner'); - removeDOMElement(banner, paywall_overlay); + } } else if (matchDomain('bloombergquint.com')) { diff --git a/manifest.json b/manifest.json index cd347077..c44fc953 100644 --- a/manifest.json +++ b/manifest.json @@ -535,5 +535,5 @@ "*://*.wallkit.net/*", "*://*.wsj.net/*" ], - "version": "2.2.9.2" + "version": "2.2.9.3" } \ No newline at end of file