Created
June 1, 2021 03:51
-
-
Save ashtonmeuser/cadfa7f19cc709aefe9b8735a68f5bc2 to your computer and use it in GitHub Desktop.
Bookmarklet that toggles hidden elements
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
// 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