mirror of
https://github.com/iamadamdev/bypass-paywalls-chrome
synced 2025-05-02 02:24:25 +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')) {
|
} else if (matchDomain('nytimes.com')) {
|
||||||
const previewButton = document.querySelector('.css-3s1ce0');
|
const previewButton = document.querySelector('.css-3s1ce0');
|
||||||
if (previewButton) { previewButton.click(); }
|
if (previewButton) { previewButton.click(); }
|
||||||
// Prevent bottom dock from appearing
|
blockElement('.css-3fbowa'); // Prevent bottom dock from appearing
|
||||||
new window.MutationObserver(function (mutations) {
|
blockElement('#gateway-content'); // Remove paywall
|
||||||
for (const mutation of mutations) {
|
blockElement('.css-1bd8bfl'); // Remove filter
|
||||||
for (const node of mutation.addedNodes) {
|
// Restore scrolling
|
||||||
if (node instanceof window.HTMLElement) {
|
document.onreadystatechange = function () {
|
||||||
if (node.matches('.css-3fbowa')) {
|
if (document.readyState === 'complete') {
|
||||||
removeDOMElement(node);
|
document.querySelector('.css-mcm29f').setAttribute('style', 'position:relative');
|
||||||
this.disconnect();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}).observe(document, { subtree: true, childList: true });
|
};
|
||||||
} else if (matchDomain('technologyreview.com')) {
|
} else if (matchDomain('technologyreview.com')) {
|
||||||
window.setTimeout(function () {
|
window.setTimeout(function () {
|
||||||
const bodyObscured = document.querySelector('body[class*="body__obscureContent"]');
|
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 () {
|
function NZHerald () {
|
||||||
const video = document.querySelector('.video-js');
|
const video = document.querySelector('.video-js');
|
||||||
if (video) {
|
if (video) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user