2008/01/31


はてなのお気に入りユーザーの情報を取得できる「お気に入りAPI」(Favorites API)を公開しました」って事でさっそく...


ソースはこんな感じ...
追記:このソースはFirefoxでしか動きません。IEで動くものはこのページのHTMLを直接参照下さい。(Firefox限定時の残骸あり) <script type="text/javascript">
<!--
function hatenaFavorites(data) {
  var container = document.getElementById('hatenaFavorites');
  Array.slice(container.childNodes).forEach(container.removeChild, container);
  data.favorites.forEach(function(i) {
    var div = document.createElement('div');
    var img = document.createElement('img');
    img.src='http://www.hatena.ne.jp/users/'+i.name.substring(0,2)+'/'+i.name+'/profile_s.gif'
    div.appendChild(img);
    div.appendChild(document.createTextNode(' ' + i.name));
    container.appendChild(div);
  });
}
function loadHatenaFavorites() {
  var container = document.getElementById('hatenaFavorites');
  Array.slice(container.childNodes).forEach(container.removeChild, container);

  var img = document.createElement('img');
  img.src='http://mattn.kaoriya.net/images/ajax-loader.gif';
  container.appendChild(img);

  var script = document.createElement('script');
  script.charset = 'utf-8';
  script.src = 'http://www.hatena.ne.jp/mattn/favorites.json?callback=hatenaFavorites';
  document.lastChild.appendChild(script);
}
--></script>

追記
os0xさんからの指摘でIEで動かないのを直しました。
↑のソースは張り替えませんので、直接ソースを閲覧して下さい。(残骸が残ってますが...)
Posted at by




リンク先のはてなブックマーク数を表示するブックマークレットは、del.icio.usで使うと面白いのが分かった。
ただそんだけ...

delicious_hatena
Posted at by




はてなスターの☆をクリックする度に画面を鮮やかに彩るグリモン書いた」は好評で、はてなスター日記でも取り上げて頂きました。
ただ、はてなブックマークでは、「Internet Explorerの為見れない」といったコメントを頂きました。

現在、Hatena Beautiful Starは
  • Firefox
  • Opera
  • Safari
にて動作確認をさせて頂いておりますが、実はInternet Explorerでも動かせない訳ではありません。

続きを読む...

Posted at by