// ==UserScript==
// @name        hatena bookmark counter
// @namespace   http://ss-o.net/
// @include     http://*
// @version     1.0.0
// ==/UserScript==

(function(){
	if (window != window.parent) {
		return; //if frame
	}
	if ( /(?:^[^\.]+$|^[\d\.]+$)/.test(location.host)) {
		return;
	}
	if (location.href.length > 100) {
		return;
	}

	var url = location.href.replace(/#/, '%23');

	var div = document.createElement('div');
	div.id = 'hatena_bookmark_div';
	div.setAttribute('style','position:fixed;bottom:5px;left:5px;margin:0px;padding:0px;');
	var a = document.createElement('a');
	var img_logo = document.createElement('img');
	img_logo.src = "data:image/gif;base64,R0lGODlhEAAMAJECAP///xhBzv///wAAACH5BAEAAAIALAAAAAAQAAwAAAIjVI6ZBu3/TlNOAovD1JfnDXZJ+IGl1UFlelLpC8WXodSHUAAAOw==";;
	img_logo.style.border = 'none';
	var img = document.createElement('img');
	img.src = 'http://b.hatena.ne.jp/entry/image/' +url;
	img.style.border = 'none;';
	a.appendChild(img_logo);
	a.appendChild(img);
	a.href = 'http://b.hatena.ne.jp/entry/' + url;
	div.appendChild(a);
	document.body.appendChild(div);
})();
