gh code highlighting on

noformnocontent 2012-11-29 02:19:31 -08:00
parent 8a10b99f41
commit 111af98d27

@ -9,48 +9,53 @@ To open the inspector, right click on the view and choose `Inspect Element` from
## Hide posts with stopwords plugin ## Hide posts with stopwords plugin
$(document).ready(function() { ``` js
if(tentia_instance.action == "timeline") { $(document).ready(function() {
tentia_instance.body.addEventListener( 'DOMNodeInserted', filter, false ); if(tentia_instance.action == "timeline") {
} tentia_instance.body.addEventListener( 'DOMNodeInserted', filter, false );
}); }
});
function filter(e) { function filter(e) {
var stopwords = [ var stopwords = [
// Add the stopwords here // Add the stopwords here
"apple", "apple",
"#iPhone" "#iPhone"
]; ];
var element = e.target; var element = e.target;
var parent = element.parentNode; var parent = element.parentNode;
if(parent != tentia_instance.body) return; if(parent != tentia_instance.body) return;
var text = element.innerHTML; var text = element.innerHTML;
for(var i=0, count=stopwords.length; i<count; ++i) { for(var i=0, count=stopwords.length; i<count; ++i) {
if(text.indexOf(stopwords[i]) > -1) { if(text.indexOf(stopwords[i]) > -1) {
parent.removeChild(element); parent.removeChild(element);
return; 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: 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 ## Mark post plugin
$("ol").delegate('a', 'click dblclick', function(e) { ``` js
e.stopPropagation(); $("ol").delegate('a', 'click dblclick', function(e) {
}).delegate('li', 'dblclick', function(e) { e.stopPropagation();
var li = $(this); }).delegate('li', 'dblclick', function(e) {
if(li.hasClass("selected")) { var li = $(this);
li.removeClass("selected"); if(li.hasClass("selected")) {
} else { li.removeClass("selected");
li.addClass("selected"); } else {
} li.addClass("selected");
}); }
});
```
And add this to your CSS plugin file. And add this to your CSS plugin file.
.selected { ``` css
border-right: 5px solid green; .selected {
} border-right: 5px solid green;
}
```