Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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: 23262 }) );
}
};
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
You can’t perform that action at this time.