2014-09-27 22:04:27 +02:00
|
|
|
if (active_page == 'thread' || active_page == 'index') {
|
|
|
|
$(document).ready(function(){
|
|
|
|
function arrayRemove(a, v) { a.splice(a.indexOf(v) == -1 ? a.length : a.indexOf(v), 1); }
|
2014-09-27 18:47:11 +02:00
|
|
|
|
2014-09-27 22:04:27 +02:00
|
|
|
var idshighlighted = [];
|
2014-09-27 18:47:11 +02:00
|
|
|
|
2014-09-27 22:04:27 +02:00
|
|
|
function getPostsById(id){
|
|
|
|
return $(".poster_id").filter(function(i){
|
|
|
|
return $(this).text() == id;
|
|
|
|
});
|
|
|
|
}
|
2014-09-27 18:47:11 +02:00
|
|
|
|
2014-09-27 22:04:27 +02:00
|
|
|
function getMasterPosts(parents){
|
|
|
|
if(!parents.hasClass("post")) return;
|
|
|
|
|
|
|
|
var toRet = [];
|
|
|
|
|
|
|
|
$(parents).each(function(){
|
|
|
|
if($(this).hasClass("post"))
|
|
|
|
toRet.push($(this));
|
|
|
|
});
|
|
|
|
|
|
|
|
return toRet;
|
|
|
|
}
|
2014-09-27 18:47:11 +02:00
|
|
|
|
2014-09-27 22:04:27 +02:00
|
|
|
$(".poster_id").click(function(){
|
|
|
|
var id = $(this).text();
|
|
|
|
|
|
|
|
if($.inArray(id, idshighlighted) !== -1){
|
|
|
|
arrayRemove(idshighlighted, id);
|
|
|
|
|
|
|
|
$(getMasterPosts(getPostsById(id).parents())).each(function(i){
|
|
|
|
$(this).removeClass("highlighted");
|
|
|
|
});
|
|
|
|
}else{
|
|
|
|
idshighlighted.push(id);
|
|
|
|
|
|
|
|
$(getMasterPosts(getPostsById(id).parents())).each(function(i){
|
|
|
|
$(this).addClass("highlighted");
|
|
|
|
});
|
|
|
|
}
|
2014-09-27 18:47:11 +02:00
|
|
|
});
|
2014-09-27 22:04:27 +02:00
|
|
|
});
|
|
|
|
}
|