youtube chat filter
the streaming chat is full of spammers and this filters them when you flag for spam
by Darby Rathbone
JavaScript
var names = [];
document.getElementById('all-comments').addEventListener('DOMNodeInserted', function (e) {
var flag = e.target.querySelector('button[data-action="flag"]'),
author = e.target.querySelector('.author'),
authortext = author ? author.textContent.trim() : '';
if (flag && authortext) {
flag.addEventListener('click', function (f) {
names.push(new RegExp(authortext));
});
}
if (authortext && names.some(function (f) {
return f.test(authortext);
})) {
e.target.style.display = 'none';
}
});