Last active
August 18, 2019 01:08
-
-
Save iboss-ptk/c84227b2dc3d4f2ec67f5d5242c57a1c to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| const censor = text => { | |
| const iter = document | |
| .evaluate(`//*[contains(text(),'${text}')]`, document, null, XPathResult.ANY_TYPE, null) | |
| let el = iter.iterateNext() | |
| while(el) { | |
| el.style = "color: transparent; text-shadow: 0 0 5px rgba(0,0,0,0.5);" | |
| try { el = iter.iterateNext() } catch (_) { break } | |
| } | |
| } | |
| const observer = new MutationObserver(() => censor('text_to_censor')) | |
| observer.observe(document.body, { childList: true }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment