gh code highlighting on
parent
8a10b99f41
commit
111af98d27
1 changed files with 40 additions and 35 deletions
73
Plugins.md
73
Plugins.md
|
@ -9,48 +9,53 @@ To open the inspector, right click on the view and choose `Inspect Element` from
|
|||
|
||||
## Hide posts with stopwords plugin
|
||||
|
||||
$(document).ready(function() {
|
||||
if(tentia_instance.action == "timeline") {
|
||||
tentia_instance.body.addEventListener( 'DOMNodeInserted', filter, false );
|
||||
}
|
||||
});
|
||||
``` js
|
||||
$(document).ready(function() {
|
||||
if(tentia_instance.action == "timeline") {
|
||||
tentia_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 != tentia_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;
|
||||
}
|
||||
function filter(e) {
|
||||
var stopwords = [
|
||||
// Add the stopwords here
|
||||
"apple",
|
||||
"#iPhone"
|
||||
];
|
||||
var element = e.target;
|
||||
var parent = element.parentNode;
|
||||
if(parent != tentia_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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
You can use the embeded jQuery too, here for example a plugin which lets you mark particular posts so you don't forget them in your timeline:
|
||||
|
||||
## Mark post plugin
|
||||
|
||||
$("ol").delegate('a', 'click dblclick', function(e) {
|
||||
e.stopPropagation();
|
||||
}).delegate('li', 'dblclick', function(e) {
|
||||
var li = $(this);
|
||||
if(li.hasClass("selected")) {
|
||||
li.removeClass("selected");
|
||||
} else {
|
||||
li.addClass("selected");
|
||||
}
|
||||
});
|
||||
``` js
|
||||
$("ol").delegate('a', 'click dblclick', function(e) {
|
||||
e.stopPropagation();
|
||||
}).delegate('li', 'dblclick', function(e) {
|
||||
var li = $(this);
|
||||
if(li.hasClass("selected")) {
|
||||
li.removeClass("selected");
|
||||
} else {
|
||||
li.addClass("selected");
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
And add this to your CSS plugin file.
|
||||
|
||||
.selected {
|
||||
border-right: 5px solid green;
|
||||
}
|
||||
``` css
|
||||
.selected {
|
||||
border-right: 5px solid green;
|
||||
}
|
||||
```
|
||||
|
|
Reference in a new issue