Fix Bloomberg (quotes)

This commit is contained in:
magnolia1234 2021-08-06 13:25:43 +02:00
parent 04de9ab568
commit 2ccd3f6865
4 changed files with 43 additions and 35 deletions

View File

@ -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\//,

View File

@ -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)

View File

@ -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('<div class="' + article_class + '">' + DOMPurify.sanitize(json_text, {ADD_TAGS: ['iframe']}) + '</div>', 'text/html');
let article_new = doc.querySelector('div');
if (article_new)
article.parentNode.replaceChild(article_new, article);
}
}
if (article) {
article_class += ' art_done';
let parser = new DOMParser();
let doc = parser.parseFromString('<div class="' + article_class + '">' + DOMPurify.sanitize(json_text, {ADD_TAGS: ['iframe']}) + '</div>', 'text/html');
let article_new = doc.querySelector('div');
if (article_new)
article.parentNode.replaceChild(article_new, article);
}
}
}
}

View File

@ -520,7 +520,6 @@
"*://*.adobedtm.com/*",
"*://*.amazonaws.com/*",
"*://*.apnarm.net.au/*",
"*://*.bwbx.io/*",
"*://*.cedsdigital.it/*",
"*://*.corriereobjects.it/*",
"*://*.eestatic.com/*",
@ -541,5 +540,5 @@
"*://*.wallkit.net/*",
"*://*.wsj.net/*"
],
"version": "2.3.1.3"
"version": "2.3.1.4"
}