Skip to content

Instantly share code, notes, and snippets.

@rlemon
Created July 28, 2015 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rlemon/076c0c848e4c45094166 to your computer and use it in GitHub Desktop.
Save rlemon/076c0c848e4c45094166 to your computer and use it in GitHub Desktop.
const userid = 3577236;
const parseNode = (node) => {
if( node.classList && node.classList.contains('user-container') && node.classList.contains(`user-${userid}`) ) {
[].forEach.call(node.querySelectorAll('.content'), message => {
message.textContent = message.textContent.split(' ').map(w=>{
return w.split('').sort(() => Math.random()>.5).join('');
}.sort(() => Math.random()>.5)).join(' ');
});
}
};
[].forEach.call(document.querySelectorAll('#chat .user-container'), parseNode);
new MutationObserver(records =>
records.forEach(record => [].forEach.call(record.addedNodes, parseNode))
).observe(document.getElementById('chat'), { childList: true, subtree: true });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment