Migrated from plugins v1
parent
426e9a7f3a
commit
a99787d928
1 changed files with 25 additions and 0 deletions
25
Plugins.textile
Normal file
25
Plugins.textile
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
This is a example plugin to get you started. It removes tweets which contain one of the stopwords. Save the code in a file called Plugin.js @~/Library/Application Support/Twittia/@. You have to create this directory yourself.
|
||||||
|
|
||||||
|
|
||||||
|
bc. $(document).ready(function() {
|
||||||
|
if(twittia_instance.action == "home_timeline") {
|
||||||
|
twittia_instance.body.addEventListener( 'DOMNodeInserted', filter, false );
|
||||||
|
}
|
||||||
|
});
|
||||||
|
function filter(e) {
|
||||||
|
var stopwords = [
|
||||||
|
// Add the stopwords here
|
||||||
|
"apple",
|
||||||
|
"#iPhone"
|
||||||
|
];
|
||||||
|
var element = e.target;
|
||||||
|
var parent = element.parentNode;
|
||||||
|
if(parent != twittia_instance.body) return;
|
||||||
|
var text = element.innerHTML;
|
||||||
|
for(var i=0, count=stopwords.length; i<count; ++i) {
|
||||||
|
if(text.indexOf(stopwords[i]) > -1) {
|
||||||
|
parent.removeChild(element);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in a new issue