Fix Bloomberg

This commit is contained in:
magnolia1234 2021-07-19 19:56:02 +02:00
parent 154d1b9c22
commit 97e1e3c120
4 changed files with 40 additions and 17 deletions

View File

@ -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: ["<all_urls>"]

View File

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

View File

@ -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('<div class="' + article_class + '">' + DOMPurify.sanitize(json_text, {ADD_TAGS: ['iframe']}) + '</div>', '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')) {

View File

@ -535,5 +535,5 @@
"*://*.wallkit.net/*",
"*://*.wsj.net/*"
],
"version": "2.2.9.2"
"version": "2.2.9.3"
}