tbillenstein/jTweetsAnywhere — Issue #2: Adding a simple blacklist filter
Author: lazymanc
Created: 2011-12-19 16:45:17+00:00
State: open

Here's a quick example of how to stop tweets containing particular words from displaying.

```javascript
$("#tweets").jTweetsAnywhere({
blacklist : [
"badWord1",
"badWord2",
"badWord3",
"etc"
],
tweetFilter: function(tweet, options) {
var blacklistCount = options.blacklist.length;

if(blacklistCount < 1) {
return true;
}

for(var i = 0; i < blacklistCount; i++) {
var regex = new RegExp(options.blacklist[i], "gi");

if(tweet.from_user.search(regex) != -1 || tweet.text.search(regex) != -1) {
return false;
}
}

return true;
}
});
```

Not sure if this is the right place to post it, but hopefully it'll come in handy for someone.