Fix Bloomberg (permission block js)

master
magnolia1234 2021-12-13 20:30:14 +01:00
parent 6919d71978
commit ed01ee80e4
4 changed files with 46 additions and 54 deletions

View File

@ -2,6 +2,7 @@
Changelog Bypass Paywalls Clean - Chrome Changelog Bypass Paywalls Clean - Chrome
Post-release Post-release
Fix Bloomberg (permission block js)
* v2.4.7.0 (2021-12-12) * v2.4.7.0 (2021-12-12)
Add Koelner Stadt-Anzeiger & Koelnische Rundschau Add Koelner Stadt-Anzeiger & Koelnische Rundschau

View File

@ -1714,28 +1714,16 @@ else if (matchDomain('billboard.com')) {
} }
else if (matchDomain('bloomberg.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(); sessionStorage.clear();
let paywall = document.querySelector('div#fortress-paywall-container-root');
let counter = document.querySelector('div#fortress-preblocked-container-root');
let noscroll = document.querySelector('body[data-paywall-overlay-status]');
if (noscroll)
noscroll.removeAttribute('data-paywall-overlay-status');
removeDOMElement(paywall, counter);
let url = window.location.href; let url = window.location.href;
if (url.match(/\/(articles|features)\//)) { if (url.match(/\/(articles|features)\//)) {
let leaderboard = document.querySelector('div[id^="leaderboard"], div.leaderboard-wrapper'); 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, div[data-ad-placeholder]'); let page_ad = document.querySelectorAll('div.page-ad, div[data-ad-placeholder]');
let reg_ui_client = document.querySelector('div#reg-ui-client'); let reg_ui_client = document.querySelector('div#reg-ui-client');
removeDOMElement(leaderboard, ...shimmering_content, ...page_ad, reg_ui_client); removeDOMElement(leaderboard, ...page_ad, reg_ui_client);
let hidden_images = document.querySelectorAll('img.lazy-img__image[src][data-native-src]'); let hidden_images = document.querySelectorAll('img.lazy-img__image[src][data-native-src]');
for (let hidden_image of hidden_images) { for (let hidden_image of hidden_images) {
if (hidden_image.src.match(/\/60x-1\.(png|jpg)$/)) if (hidden_image.src.match(/\/(60|150)x-1\.(png|jpg)$/))
hidden_image.setAttribute('src', hidden_image.getAttribute('data-native-src')); hidden_image.setAttribute('src', hidden_image.getAttribute('data-native-src'));
hidden_image.style.filter = 'none'; hidden_image.style.filter = 'none';
} }
@ -1755,38 +1743,46 @@ else if (matchDomain('bloomberg.com')) {
blur.classList.remove('blur'); blur.classList.remove('blur');
blur.removeAttribute('style'); blur.removeAttribute('style');
} }
let json_script = document.querySelector('script[data-component-props="ArticleBody"], script[data-component-props="FeatureBody"]'); let shimmering_content = document.querySelectorAll('div.shimmering-text');
if (json_script && dompurify_loaded) { let body_transparent = document.querySelector('div[class*="nearly-transparent-text-blur"]');
let json = JSON.parse(json_script.innerHTML); if (shimmering_content || body_transparent) {
if (json) { removeDOMElement(...shimmering_content);
let json_text; if (body_transparent)
json_text = json.body ? json.body : ''; removeClassesByPrefix(body_transparent, 'nearly-transparent-text-blur');
if (!json_text) let json_script = document.querySelector('script[data-component-props="ArticleBody"], script[data-component-props="FeatureBody"]');
json_text = json.story.body ? json.story.body : ''; if (json_script && dompurify_loaded) {
if (json_text) { let json = JSON.parse(json_script.innerHTML);
removeDOMElement(json_script); if (json) {
let article = document.querySelector('div.body-copy-v2:not(.art_done)'); let json_text;
let article_class = 'body-copy-v2'; if (json.body)
if (!article) { json_text = json.body;
article = document.querySelector('div.body-copy:not(.art_done)'); else if (json.story && json.story.body)
article_class = 'body-copy'; json_text = json.story.body;
} if (json_text) {
if (!article) { removeDOMElement(json_script);
article = document.querySelector('div.body-content:not(.art_done)'); let article = document.querySelector('div.body-copy-v2:not(.art_done)');
article_class = 'body-content'; let article_class = 'body-copy-v2';
} if (!article) {
if (article) { article = document.querySelector('div.body-copy:not(.art_done)');
article_class += ' art_done'; article_class = 'body-copy';
let parser = new DOMParser(); }
let doc = parser.parseFromString('<div class="' + article_class + '">' + DOMPurify.sanitize(json_text, {ADD_TAGS: ['iframe', 'script']}) + '</div>', 'text/html'); if (!article) {
let article_new = doc.querySelector('div'); article = document.querySelector('div.body-content:not(.art_done)');
if (article_new) { article_class = 'body-content';
article.parentNode.replaceChild(article_new, article); }
let teaser_body = document.querySelector('div.body-content[class*="teaser-content_"]'); if (article) {
removeDOMElement(teaser_body); article_class += ' art_done';
let body_transparent = document.querySelector('div[class*="nearly-transparent-text-blur_"]'); let parser = new DOMParser();
if (body_transparent) let doc = parser.parseFromString('<div class="' + article_class + '">' + DOMPurify.sanitize(json_text, {ADD_TAGS: ['iframe', 'script']}) + '</div>', 'text/html');
removeClassesByPrefix(body_transparent, 'nearly-transparent-text-blur_'); let article_new = doc.querySelector('div');
if (article_new) {
article.parentNode.replaceChild(article_new, article);
let teaser_body = document.querySelector('div.body-content[class*="teaser-content_"]');
removeDOMElement(teaser_body);
let thirdparty_embed = document.querySelector('div.thirdparty-embed__container[style*="height: 0;"]');
if (thirdparty_embed)
thirdparty_embed.setAttribute('style', 'height: 550px !important;');
}
} }
} }
} }
@ -1795,12 +1791,6 @@ else if (matchDomain('bloomberg.com')) {
} }
} }
else if (matchDomain('bloombergquint.com')) {
let articlesLeftModal = document.querySelector('.paywall-meter-module__story-paywall-container__1UgCE');
let paywall = document.getElementById('paywallDmp');
removeDOMElement(articlesLeftModal, paywall);
}
else if (matchDomain('bostonglobe.com')) { else if (matchDomain('bostonglobe.com')) {
if (window.location.search.startsWith('?outputType=amp')) { if (window.location.search.startsWith('?outputType=amp')) {
amp_unhide_subscr_section(); amp_unhide_subscr_section();

View File

@ -39,5 +39,5 @@
"webRequestBlocking", "webRequestBlocking",
"<all_urls>" "<all_urls>"
], ],
"version": "2.4.7.0" "version": "2.4.7.1"
} }

View File

@ -552,6 +552,7 @@
"*://*.amazonaws.com/*", "*://*.amazonaws.com/*",
"*://*.apnarm.net.au/*", "*://*.apnarm.net.au/*",
"*://*.bntech.io/*", "*://*.bntech.io/*",
"*://*.bwbx.io/*",
"*://*.cedsdigital.it/*", "*://*.cedsdigital.it/*",
"*://*.corriereobjects.it/*", "*://*.corriereobjects.it/*",
"*://*.eestatic.com/*", "*://*.eestatic.com/*",
@ -574,5 +575,5 @@
"*://*.wallkit.net/*", "*://*.wallkit.net/*",
"*://*.wsj.net/*" "*://*.wsj.net/*"
], ],
"version": "2.4.7.0" "version": "2.4.7.1"
} }