From b419c85f8c9c79e6bb0425db93967b36240ebbed Mon Sep 17 00:00:00 2001 From: anonfagola Date: Sat, 27 Sep 2014 11:55:39 -0700 Subject: Forgot .js extension --- js/id_highlighter | 40 ---------------------------------------- js/id_highlighter.js | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 40 deletions(-) delete mode 100644 js/id_highlighter create mode 100644 js/id_highlighter.js (limited to 'js') diff --git a/js/id_highlighter b/js/id_highlighter deleted file mode 100644 index 60052031..00000000 --- a/js/id_highlighter +++ /dev/null @@ -1,40 +0,0 @@ -Array.prototype.remove = function(v) { this.splice(this.indexOf(v) == -1 ? this.length : this.indexOf(v), 1); } - -var idshighlighted = []; - -function getPostsById(id){ - return $(".poster_id").filter(function(i){ - return $(this).text() == id; - }); -} - -function getMasterPosts(parents){ - if(!parents.hasClass("post")) return; - - var toRet = []; - - $(parents).each(function(){ - if($(this).hasClass("post")) - toRet.push($(this)); - }); - - return toRet; -} - -$(".poster_id").click(function(){ - var id = $(this).text(); - - if($.inArray(id, idshighlighted) !== -1){ - idshighlighted.remove(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"); - }); - } -}); diff --git a/js/id_highlighter.js b/js/id_highlighter.js new file mode 100644 index 00000000..60052031 --- /dev/null +++ b/js/id_highlighter.js @@ -0,0 +1,40 @@ +Array.prototype.remove = function(v) { this.splice(this.indexOf(v) == -1 ? this.length : this.indexOf(v), 1); } + +var idshighlighted = []; + +function getPostsById(id){ + return $(".poster_id").filter(function(i){ + return $(this).text() == id; + }); +} + +function getMasterPosts(parents){ + if(!parents.hasClass("post")) return; + + var toRet = []; + + $(parents).each(function(){ + if($(this).hasClass("post")) + toRet.push($(this)); + }); + + return toRet; +} + +$(".poster_id").click(function(){ + var id = $(this).text(); + + if($.inArray(id, idshighlighted) !== -1){ + idshighlighted.remove(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"); + }); + } +}); -- cgit v1.3