Skip to content

Instantly share code, notes, and snippets.

@FMCorz
Last active June 15, 2022 10:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FMCorz/8d4a51d7ce1aaeca2e8e776c2111f1e2 to your computer and use it in GitHub Desktop.
Save FMCorz/8d4a51d7ce1aaeca2e8e776c2111f1e2 to your computer and use it in GitHub Desktop.
Remove overlays and paywalls from the page, when possible.
(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