Skip to content

Instantly share code, notes, and snippets.

@coolniikou
Created August 24, 2009 16:07
Show Gist options
  • Save coolniikou/173943 to your computer and use it in GitHub Desktop.
Save coolniikou/173943 to your computer and use it in GitHub Desktop.
$(document).ready(function(){
var ff_u_name = 'username';
var ff_uri = 'http://friendfeed-api.com/v2/search?q=from:'+ff_u_name+'+<$mt:EntryPermalink$>&callback=?';
var list = '<h4>Comments for this entry on FriendFeed</h4>';
var no_title='<h4>No Comments for this entry on FriendFeed</h4>';
list += '<ul class="item_list">';
$.getJSON(ff_uri, function(data){
var en = data.entries;
if(!en.length){ $("div.friendfeed_comm").empty().html(no_title); return false; }
for (i=0; i<en.length; i++) {
var co = en[i].comments;
if(!co){ $("div.friendfeed_comm").empty().html(no_title); return false; }
for (d=0; d<co.length; d++){
list += '<li class="item_body">'+co[d].body+'</li>';
list += '<li class="item_meta">'+co[d].date+' <span class="meta_name">'+co[d].from.name+'</span></li>';
}
$("span.ff_com_count").html('<a href="'+en[i].url+'">コメント on FriendFeed ('+co.length+')</a>');
list += '</ul><p class="leave_txt"><a href="'+en[i].url+'">Leave comment on friendfeed</a></p>';
if(en[i].likes)$("span.ff_comm_star").html('<img src="image-url" width="13px" height="13px"/> <a href="'+en[i].url+'">'+en[i].likes.length+'</a> つ いただきました。');
}
$("div.friendfeed_comm").empty().html(list);
});
return false;
});
/*-- HTML
display comments count on FriendFeed
<span class="ff_comm_count"></span>
display star count on FriendFeed
<span class="ff_comm_star"></span>
display Comments on FriendFeed
<div class="friendfeed_comm"></div>
--*/
/*-- CSS
span.ff_comm_count a,
span.ff_comm_star a{
color: #437EC7; }
span.ff_comm_star img{
vertical-align: -3px; }
div.friendfeed_comm {
background: transparent url('http://friendfeed.com/static/images/widget-logo.png?v=da25') no-repeat scroll left 0;
margin: 5px 0 10px;
border: 1px solid #437EC7;
font-size: 13px;
line-height: 17px;
text-align: left;
height: 500px;
overflow: scroll; }
div.friendfeed_comm h4{
margin: 30px 0 10px 20px;
color: #437EC7;
font-size: 16px; }
div.friendfeed_comm ul{
list-style-image: none;
list-style-position: none;
list-style-type: none;
margin: 0 20px;
padding: 0; }
div.friendfeed_comm li.item_meta{
color: #888888;
margin-bottom: 8px; }
div.friendfeed_comm span.meta_name {
color: #7777CC; }
div.friendfeed_comm p.leave_txt a{
color: #7777CC;
margin-left: 20px;
font-size:15px; }
--*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment