Last active
June 12, 2020 20:25
-
-
Save torbiak/4d87868a96ec657986f6122e26ebd502 to your computer and use it in GitHub Desktop.
Try to make a webpage readable by hiding any fixed/sticky elements---popups, dickbars, etc---and changing overflow=hidden to visible.
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
// Try to make a webpage readable by hiding any fixed/sticky elements---popups, | |
// dickbars, etc---and changing overflow=hidden to visible. | |
// | |
// Adapted from [here](https://alisdair.mcdiarmid.org/kill-sticky-headers/). | |
// | |
// I like to use this as a bookmarklet bound to a keyword. To create a | |
// bookmarklet, use the below code as the url for a bookmark, prefixed by | |
// `javascript:`. | |
// | |
// Go over all elements and hide any fixed/sticky ones in multiple ways so that | |
// they're less likely to get re-displayed. | |
// | |
// Also, set overflow to visible since scrolling is often in concert with | |
// showing popups disabled by setting overflow to hidden. | |
(function () { | |
document.querySelectorAll('*').forEach((e) => { | |
let s = getComputedStyle(e); | |
if (s.position === 'fixed' || s.position === 'sticky') { | |
e.style.setProperty('display', 'none', 'important'); | |
e.style.setProperty('visibility', 'hidden', 'important'); | |
} | |
if (s.overflow === 'hidden') { | |
e.style.setProperty('overflow', 'visible', 'important'); | |
} | |
}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment