Created
April 14, 2016 17:09
-
-
Save rlemon/a9433fbe84c80144a4d4b9773a0f46ef to your computer and use it in GitHub Desktop.
php poptart
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
NodeList.prototype[Symbol.iterator] = [][Symbol.iterator]; | |
new MutationObserver( rec => rec.map( n => [...n.addedNodes].map(parser) ) ) | |
.observe(document.body, { childList: true, subtree: true }); | |
[...document.querySelectorAll('.user-container .message')].map(parser); | |
function parser(node) { | |
if( node.classList && node.classList.contains('message') && !node.classList.contains('pending') ) { | |
if( /\bphp\b/gi.test(node.textContent ) ) { | |
node.innerHTML = node.innerHTML.replace(/\bphp\b/gi, 'Poptart'); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment