mirror of
https://github.com/iamadamdev/bypass-paywalls-chrome
synced 2025-04-30 02:04:26 +02:00
NYTimes fix (#1040)
This commit is contained in:
parent
e6addf4ee1
commit
c23d1ea34c
@ -262,19 +262,15 @@ if (matchDomain('elmercurio.com')) {
|
||||
} else if (matchDomain('nytimes.com')) {
|
||||
const previewButton = document.querySelector('.css-3s1ce0');
|
||||
if (previewButton) { previewButton.click(); }
|
||||
// Prevent bottom dock from appearing
|
||||
new window.MutationObserver(function (mutations) {
|
||||
for (const mutation of mutations) {
|
||||
for (const node of mutation.addedNodes) {
|
||||
if (node instanceof window.HTMLElement) {
|
||||
if (node.matches('.css-3fbowa')) {
|
||||
removeDOMElement(node);
|
||||
this.disconnect();
|
||||
}
|
||||
}
|
||||
}
|
||||
blockElement('.css-3fbowa'); // Prevent bottom dock from appearing
|
||||
blockElement('#gateway-content'); // Remove paywall
|
||||
blockElement('.css-1bd8bfl'); // Remove filter
|
||||
// Restore scrolling
|
||||
document.onreadystatechange = function () {
|
||||
if (document.readyState === 'complete') {
|
||||
document.querySelector('.css-mcm29f').setAttribute('style', 'position:relative');
|
||||
}
|
||||
}).observe(document, { subtree: true, childList: true });
|
||||
};
|
||||
} else if (matchDomain('technologyreview.com')) {
|
||||
window.setTimeout(function () {
|
||||
const bodyObscured = document.querySelector('body[class*="body__obscureContent"]');
|
||||
@ -514,6 +510,22 @@ function pageContains (selector, text) {
|
||||
});
|
||||
}
|
||||
|
||||
// Prevent element from being added to the DOM
|
||||
function blockElement (selector) {
|
||||
new window.MutationObserver(function (mutations) {
|
||||
for (const mutation of mutations) {
|
||||
for (const node of mutation.addedNodes) {
|
||||
if (node instanceof window.HTMLElement) {
|
||||
if (node.matches(selector)) {
|
||||
removeDOMElement(node);
|
||||
this.disconnect(); // Stop watching for element being added after one removal
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}).observe(document, { subtree: true, childList: true });
|
||||
}
|
||||
|
||||
function NZHerald () {
|
||||
const video = document.querySelector('.video-js');
|
||||
if (video) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user