pipesが生きていた頃のサイドバーのランキング #CodePiece
setTimeout(function() {hatebrank();}, 0);
function hatebrank(){
var path = 'http://pipes.yahoo.com/pipes/pipe.run';
var param = [
//'delimiterBlog= - .*',
//記事名とブログ名の区切りが特殊な場合ここをコメントアウトして区切り文字を入れる
'_id=219bcd1d103737a7d7550c48621ae963',
'_render=json',
'_callback=HatenaCallback'
];
var script = document.createElement( 'script' );
script.type = 'text/javascript';
script.src = path + '?' + param.join( '&' );
var firstScript = document.getElementsByTagName( 'script' )[ 0 ];
firstScript.parentNode.insertBefore( script , firstScript );
}
function HatenaCallback( data )
{
var list = document.getElementById("popular_entries_feed");
var htmlstr = '';
var hatenaTitle;
var hatenaLink;
var hatenaDescription;
var hatenaThumbnail;
for (var i in data.value.items)
{
var item = data.value.items[i];
hatenaTitle = item.title;
hatenaLink = item.link;
hatenaDescription = item.description;
hatenaThumbnail = item.thumbnail;
if (hatenaThumbnail.match('heartrails')){
hatenaThumbnail = '';
}
if (i == '0'){
htmlstr += '<span><a href="http://b.hatena.ne.jp/entrylist?sort=count&url=http%3A%2F%2Fveadardiary.blog29.fc2.com%2F" target="_blank"><img src="http://b.hatena.ne.jp/images/widget/favicon.gif"></img>人気記事</a></span>';
}
if (i == 5){
htmlstr += '<a href="http://b.hatena.ne.jp/entrylist?url=http%3A%2F%2Fveadardiary.blog29.fc2.com%2F" target="_blank"><img src="http://b.hatena.ne.jp/images/widget/favicon.gif"></img>新着記事</a>';
}
htmlstr += '<div class="htbl_popular_entry">';
htmlstr += '<a href="' + hatenaLink + '" rel="nofollow">';
htmlstr += '<img class="htbl_popular_entry_img" src="' + hatenaThumbnail + '">';
htmlstr += '<div class="htbl_popular_entry_text">';
htmlstr += '<span class="entry_title">' + hatenaTitle + '</span>';
htmlstr += '<span class="entry_hatebu">';
htmlstr += '<img src="http://b.hatena.ne.jp/entry/image/' + hatenaLink + '">';
htmlstr += '</span>';
htmlstr += '</div>';
htmlstr += '</a>';
htmlstr += '</div>';
}
list.innerHTML = htmlstr;
}