モロ屋

酒とケモ耳の力を借りて乱世を生き抜くWeb屋の雑記

はてなブックマークカウンタを表示するUserJS

f:id:quintas:20090130214718p:image


SBMカウンタが欲しかったので作って使ってます。

単純に、ページの右下にはてなブックマーク数の画像を表示するようになります。

クリックでエントリページに飛びます。


// ==UserScript==
// @name          Hatena Bookmark Counter
// @version       1.0
// @namespace     http://d.hatena.ne.jp/quintas/20090129/p2
// @description   はてなブックマーク数を右下に表示
// @author        Molokheiya
// @include       http://*
// ==/UserScript==

(function() {
	if (self.location.href!=top.location.href) return;
	var d=document;
	var imgTag=d.createElement('img');
	imgTag.id='hate_bcs';
	d.getElementsByTagName('body')[0].appendChild(imgTag);
	var box=d.getElementById('hate_bcs');
	box.style.display='none';
	box.src='http://b.hatena.ne.jp/entry/image/'+window.location;
	var Timer = setInterval(function(){
		if(box.complete) {
		clearInterval(Timer);
		box.style.display='block';
		}
	},5);
	box.onclick=function() { window.open('http://b.hatena.ne.jp/entry/'+window.location,''); };
	box.style.cursor='pointer';
	box.style.zIndex=99999;
	box.style.position='fixed';
	box.style.right='0px';
	box.style.bottom='0px';
		if(d.all && !window.opera && d.all(p0)){
		var ds = d.all('hate_bcs').style;
		ds.position='absolute';
		ds.bottom='1px'; ds.bottom='0px'; ds.top='auto';
		ds.left=d.body.scrollLeft+'px'; ds.right='auto';
		}
})();


これを「sbmcounter.user.js」で保存して、UserJSの指定フォルダに入れるだけ。


あとこれを組み合わせればすごく便利!

no title