Skip to content

Instantly share code, notes, and snippets.

@rlemon
Created August 3, 2015 16:00
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save rlemon/bd51661bca743323ac6c to your computer and use it in GitHub Desktop.
Save rlemon/bd51661bca743323ac6c to your computer and use it in GitHub Desktop.
const parseNode = (node) => {
if( node.classList && node.classList.contains('user-container') ) {
let meta = node.querySelectorAll('.meta');
[].forEach.call(meta,m=>{
let del = document.createElement('span');
del.textContent = 'x';
del.classList.add('vote-count-container');
del.style.cursor = 'pointer';
del.onclick = function() { // fuck you I want `this`
let id = this.parentNode.parentNode.id.split('-')[1];
if( id ) {
$.post('//chat.stackoverflow.com/admin/movePosts/17', fkey({ ids: id, to: 71402 }) );
}
};
m.insertBefore(document.createTextNode(' '), m.firstChild);
m.insertBefore(del, m.firstChild);
});
}
};
[].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