at posts/single.html

人気の日記プラグイン (はてなブックマーク + MM/Memo)

MM/Memo の ExistAPI を使って、 MM/Memo のブックマーク件数も取得できるようにした。 はてなの API を取得する関数 (Hatena::BookmarkAPI#get_count) を切り出して、クラスを継承させただけのやっつけ仕事 (diff) 。 もう少し整理しないとな。

ダウンロードはさっきと同じリンクからどうぞ。 section_footer.rb の記述はこちら。

# 「このエントリを含むMM/Memo」のリンクの追加
if @hatena_bookmark && @hatena_bookmark[:mmcounts]
  users = @hatena_bookmark[:mmcounts][permalink(date, index, false)]
  if users
    r << %Q|<a href="http://1470.net/mm/related?url=#{permalink(date, index)}" title="このエントリを含むMM/Memo"><img src="./images/info_icon.gif" width="19" height="12" style="border: none;" alt="このエントリを含むMM/Memo"> #{users} users</a>|
  end
else
  r << %Q|<a href="http://1470.net/mm/related?url=#{permalink(date, index)}"><img src="./images/info_icon.gif" width="19" height="12" style="border: none;" alt="このエントリを含むMM/Memo" title="このエントリを含むMM/Memo"></a>|
end

関連する日記