Last active
June 15, 2022 10:39
-
-
Save FMCorz/8d4a51d7ce1aaeca2e8e776c2111f1e2 to your computer and use it in GitHub Desktop.
Remove overlays and paywalls from the page, when possible.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
let overlay; | |
let node = document.elementFromPoint(window.innerWidth / 2, window.innerHeight / 2); | |
while (true) { | |
if (!node.parentNode || node.tagName === 'BODY') break; | |
const styles = getComputedStyle(node); | |
if (styles['overflow'] === 'hidden') { | |
overlay = node; | |
} | |
node = node.parentNode; | |
} | |
overlay.style.display = 'none'; | |
document.body.style.overflow = 'auto'; | |
document.addEventListener('scroll', (e) => { | |
e.stopPropagation(); | |
}) | |
})() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment