mirror of
https://github.com/iamadamdev/bypass-paywalls-chrome
synced 2025-05-06 10:34:25 +02:00
Fix bloomberg.com (#1060)
This commit is contained in:
parent
4d50bc78e6
commit
ddc315b0ca
@ -174,14 +174,7 @@ if (matchDomain('elmercurio.com')) {
|
|||||||
const paywall = document.getElementsByClassName('paywall')[0];
|
const paywall = document.getElementsByClassName('paywall')[0];
|
||||||
removeDOMElement(paywall);
|
removeDOMElement(paywall);
|
||||||
} else if (matchDomain('bloomberg.com')) {
|
} else if (matchDomain('bloomberg.com')) {
|
||||||
document.addEventListener('DOMContentLoaded', () => {
|
blockElement('#graphics-paywall-overlay', true);
|
||||||
const fence = document.querySelector('.fence-body');
|
|
||||||
if (fence) {
|
|
||||||
fence.classList.remove('fence-body');
|
|
||||||
}
|
|
||||||
const paywall = document.getElementById('paywall-banner');
|
|
||||||
removeDOMElement(paywall);
|
|
||||||
});
|
|
||||||
} else if (matchDomain('bloombergquint.com')) {
|
} else if (matchDomain('bloombergquint.com')) {
|
||||||
const articlesLeftModal = document.getElementsByClassName('paywall-meter-module__story-paywall-container__1UgCE')[0];
|
const articlesLeftModal = document.getElementsByClassName('paywall-meter-module__story-paywall-container__1UgCE')[0];
|
||||||
const paywall = document.getElementById('paywallDmp');
|
const paywall = document.getElementById('paywallDmp');
|
||||||
@ -513,19 +506,21 @@ function pageContains (selector, text) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prevent element from being added to the DOM
|
// Prevent element from being added the first time to the DOM
|
||||||
function blockElement (selector) {
|
function blockElement (selector, blockAlways = false) {
|
||||||
new window.MutationObserver(function (mutations) {
|
new window.MutationObserver(function (mutations) {
|
||||||
for (const mutation of mutations) {
|
for (const mutation of mutations) {
|
||||||
for (const node of mutation.addedNodes) {
|
for (const node of mutation.addedNodes) {
|
||||||
if (node instanceof window.HTMLElement) {
|
if (node instanceof window.HTMLElement) {
|
||||||
if (node.matches(selector)) {
|
if (node.matches(selector)) {
|
||||||
removeDOMElement(node);
|
removeDOMElement(node);
|
||||||
|
if (!blockAlways) {
|
||||||
this.disconnect(); // Stop watching for element being added after one removal
|
this.disconnect(); // Stop watching for element being added after one removal
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}).observe(document, { subtree: true, childList: true });
|
}).observe(document, { subtree: true, childList: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user