Skip to content
This repository has been archived by the owner on Feb 22, 2022. It is now read-only.

Commit

Permalink
Uses same post template for index page and filtered results.
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelsergio committed Jul 8, 2014
1 parent cf052d9 commit c67dc84
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions public/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,20 @@ function commentsTemplate(info){
+ '</a>';
}

function postTemplate(info, site){
return $('<li id="post"><p><a href="' + info.url
+ ' "style="text-decoration:none" target="_blank">'
+ info.title +'</a> <sup>' + site + " - "
+ commentsTemplate(info)
+ "</sup> </p></li>");
}

function createPost(data, site){
for(var i = 0; i< 15; i++){
if(data[i].title=="scribd"){

}else{
$('<li id="post"><p><a href="' + data[i].url
+ ' "style="text-decoration:none" target="_blank">'
+ data[i].title +'</a> <sup>' + site + " - "
+ commentsTemplate(data[i])
+ "</sup> </p></li>").appendTo('#helper');
postTemplate(data[i], site).appendTo('#helper');
}
}
}
Expand All @@ -30,8 +34,7 @@ function filteredPost(data, q, site){
var re = new RegExp(q, "i");
var treble = re.test(data[i].title);
if((treble == true) && (data[i].title!="scribd")){
$('<li id="post"><p><a href="' + data[i].url + ' "style="text-decoration:none" target="_blank">' + data[i].title + '</a><sup>' + site + '</sup></p></li>').appendTo('#helper');

postTemplate(data[i], site).appendTo('#helper');
}
}
}
Expand Down

0 comments on commit c67dc84

Please sign in to comment.