Skip to content

Instantly share code, notes, and snippets.

@rlemon
Last active December 17, 2015 16:09
Show Gist options
  • Save rlemon/69dfc05c45e96907f5e6 to your computer and use it in GitHub Desktop.
Save rlemon/69dfc05c45e96907f5e6 to your computer and use it in GitHub Desktop.
var mutelist = [],
room = document.forms[0].elements.room.value,
binning = false;
document.getElementById('chat').addEventListener('DOMSubtreeModified', parse_messages);
function bin(ids) {
if( binning ) {
return;
}
binning = true;
$.post("/admin/movePosts/" + room, fkey({
ids: ids.join(','),
to: 23262
})).always(function() {
binning = false;
});
}
function parse_messages() {
var ids = [];
mutelist.forEach(function(id) {
$('.user-' + id + '.monologue .message').each(function () {
ids.push(this.id.split('-')[1]);
});
});
if( ids.length > 0 ) {
bin(ids);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment