diff --git a/background.js b/background.js index b9bd106..4f89063 100644 --- a/background.js +++ b/background.js @@ -277,7 +277,7 @@ var blockedRegexes = { 'belfasttelegraph.co.uk': /(cdn\.flip-pay\.com\/clients\/inm\/flip-pay\.js|cdn\.ampproject\.org\/v\d\/amp-(access|ad|consent)-.+\.js)/, 'billboard.com': /(cdn\.cxense\.com\/|\.tinypass\.com\/)/, 'bizjournals.com': /(assets\.bizjournals\.com\/static\/js\/app\/cxense\.js|cdn\.cxense\.com\/)/, - 'bloomberg.com': /(\.tinypass\.com\/|assets\.bwbx\.io\/s3\/fence\/)/, + 'bloomberg.com': /\.tinypass\.com\//, 'bostonglobe.com': /\.blueconic\.net\//, 'businessinsider.com': /\.tinypass\.com\//, 'challenges.fr': /\.poool\.fr\//, diff --git a/changelog.txt b/changelog.txt index b726c9b..1830bdf 100644 --- a/changelog.txt +++ b/changelog.txt @@ -3,7 +3,7 @@ Changelog Bypass Paywalls Clean - Firefox Post-release Add Inc42 (India) -Fix Bloomberg (blurred images) +Fix Bloomberg (quotes/blurred images) Fix Telegraaf.nl * v2.3.1.0 (2021-08-01) diff --git a/contentScript.js b/contentScript.js index 2a0aea8..cccde9a 100644 --- a/contentScript.js +++ b/contentScript.js @@ -1394,7 +1394,7 @@ else if (matchDomain('telegraaf.nl')) { let json_article_id = json.split('uid\":')[1].split(',\"')[0]; if (json_article_id && json_article_id !== article_id) window.location.reload(true); - let json_text = json.split('"body":"')[1].split('","__typename":')[0]; + let json_text = json.includes('"body":"') ? json.split('"body":"')[1].split('","__typename":')[0] : ''; if (json_text) { let intro = document.querySelector('span[id^="articleIntro"]'); if (intro) @@ -1673,39 +1673,48 @@ else if (matchDomain('barrons.com')) { } else if (matchDomain('bloomberg.com')) { + function bloomberg_noscroll(node) { + node.removeAttribute('data-paywall-overlay-status'); + } + waitDOMElement('div#fortress-paywall-container-root', 'DIV', removeDOMElement, true); + waitDOMAttribute('body', 'BODY', 'data-paywall-overlay-status', bloomberg_noscroll, true); 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-"]'); - let page_ad = document.querySelectorAll('div.page-ad'); - removeDOMElement(counter, leaderboard, ...shimmering_content, ...page_ad); - let hidden_images = document.querySelectorAll('img.lazy-img__image[src][data-native-src]'); - for (let hidden_image of hidden_images) { - if (hidden_image.src.match(/\/60x-1\.(png|jpg)$/)) - hidden_image.setAttribute('src', hidden_image.getAttribute('data-native-src')); - hidden_image.style.filter = 'none'; - } - 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 ? json.body : ''; - if (json_text) { - removeDOMElement(json_script); - let article = document.querySelector('div.body-copy-v2:not(.art_done)'); - let article_class = 'body-copy-v2'; - if (!article) { - article = document.querySelector('div.body-copy:not(.art_done)'); - article_class = 'body-copy'; + removeDOMElement(counter); + let url = window.location.href; + if (url.includes('/articles/')) { + let leaderboard = document.querySelector('div[id^="leaderboard"], div.leaderboard-wrapper'); + let shimmering_content = document.querySelectorAll('div[class^="shimmering-"]'); + let page_ad = document.querySelectorAll('div.page-ad'); + removeDOMElement(leaderboard, ...shimmering_content, ...page_ad); + let hidden_images = document.querySelectorAll('img.lazy-img__image[src][data-native-src]'); + for (let hidden_image of hidden_images) { + if (hidden_image.src.match(/\/60x-1\.(png|jpg)$/)) + hidden_image.setAttribute('src', hidden_image.getAttribute('data-native-src')); + hidden_image.style.filter = 'none'; + } + 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 ? json.body : ''; + if (json_text) { + removeDOMElement(json_script); + let article = document.querySelector('div.body-copy-v2:not(.art_done)'); + let article_class = 'body-copy-v2'; + if (!article) { + article = document.querySelector('div.body-copy:not(.art_done)'); + article_class = 'body-copy'; + } + if (article) { + article_class += ' art_done'; + let parser = new DOMParser(); + let doc = parser.parseFromString('