Skip to content

Instantly share code, notes, and snippets.

@ashtonmeuser
Created June 1, 2021 03:51
Show Gist options
  • Save ashtonmeuser/cadfa7f19cc709aefe9b8735a68f5bc2 to your computer and use it in GitHub Desktop.
Save ashtonmeuser/cadfa7f19cc709aefe9b8735a68f5bc2 to your computer and use it in GitHub Desktop.
Bookmarklet that toggles hidden elements
// bookmarklet-title: Unhide
// bookmarklet-about: Toggle hidden elements. Credit to u/jcunews1 via https://www.reddit.com/r/bookmarklets/comments/nowz0j/toggle_hidden_elements
if (window.unhiddens_bmkl) {
unhiddens_bmkl.forEach(o => o[0].style.cssText = o[1]);
unhiddens_bmkl = undefined;
} else {
window.unhiddens_bmkl = [];
document.body.querySelectorAll('*:not(script,style)').forEach(e => {
if (getComputedStyle(e).display === 'none') {
unhiddens_bmkl.push([e, e.style.cssText]);
e.style.cssText += ';display:revert!important;outline:1px solid red!important';
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment