「あわせて読みたい」にはてなブックマークカウンターをつけるuser.js
はてなカウンターのリンク元みてたら「あわせて読みたい」からのリンクがちらほらあって、それを見てたら思いついたので速攻で作ってみました。
はてブカウンターの画像は「注目エントリー」へのリンクにもなっているので、あわせてどれを読むのかの参考になると思います。
これをインストール
動作環境
とりあえず、Firefox+Greasemonkey と Sleipnir+SeaHorse で動きました。
難しいことはやっていないのでOperaとかでも動くと思います(あとで調べる)。⇒調べた。
Operaのuser.js、IE7+Trixieでも動作します。
ソース
// ==UserScript== // @name AwaseteWithHatenaBookmark // @namespace http://d.hatena.ne.jp/sawat/ // @description Awasete.com with Hatena bookmark counter // @include http://awasete.com/show.phtml?* // ==/UserScript== var list = document.getElementsByTagName("li"); for(var i=0, n=list.length; i<n; i++) { var as = list[i].getElementsByTagName("a"); var href; for(var j=0; j<as.length; j++) { if(as[j].href.indexOf("awasete.com") == -1) { href = as[j].href; break; } } if(href) { var hateb = document.createElement("a"); hateb.href = "http://b.hatena.ne.jp/entrylist?url=" + href; hateb.style.marginLeft = "10px"; var img = document.createElement("img"); img.style.width = "75px"; img.style.height= "14px"; img.src = "http://b.hatena.ne.jp/bc/lg/" + href; hateb.appendChild(img); list[i].insertBefore(hateb, list[i].getElementsByTagName("br")[0]); //list[i].getElementsByTagName("div")[0].appendChild(hateb); } }
追記(6/15)
id:trickstar_osさん指摘の部分を直しました。
あと、OperaとTrixieでの動作も確認しました。