Skip to content

Instantly share code, notes, and snippets.

@sageworksstudio
Created November 4, 2015 15:32
Show Gist options
  • Save sageworksstudio/c5f08a87f56c3876cda1 to your computer and use it in GitHub Desktop.
Save sageworksstudio/c5f08a87f56c3876cda1 to your computer and use it in GitHub Desktop.
Troll Remover for Mlive forums.
/**
* Add troll names as a key/value pair:
* 'troll-name':''
* Leave the value blank.
*/
var theTrolls = {'some troll':'','another troll':''},
getDivs = document.getElementsByTagName('div'),
divLength = getDivs.length,
i,
foundOne;
function trollAway() {
for (i = 0; i < divLength; i++) {
foundOne = getDivs[i].getAttribute('data-from');
console.log(theTrolls);
if (foundOne in theTrolls) {
getDivs[i].parentElement.style.display = 'none';
console.log(theTrolls + ' was removed!');
} else {}
}
}
window.setInterval(trollAway, 1000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment