// ==UserScript==
// @name		  x-info
// @namespace	  http://written.4403.biz/archives/2008/05/xinfo.html
// @include 	  http://sankei.jp.msn.com/*
// @version 	  0.1
// ==/UserScript==

(function() {
	var tags  = new Array('地震','余震','震源');
	var tools = new Array('これは地震の話です','余震があったそうです','震源はどこでしょうか');
	
	GM_addStyle("a.tooltip span {display:none; padding:2px 3px; margin-left:8px; width:200px;}");
	GM_addStyle("a.tooltip:hover span{display:inline; position:absolute; background:#ffffff; border:1px solid #cccccc; color:#6c6c6c; text-decoration:none;}");

	var allDivs, thisDiv;
	allDivs = document.evaluate(
		"//div[@class='_LSUCS']",
		document,
		null,
		XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,
		null);
	
	for (var i = 0; i < allDivs.snapshotLength; i++){
		thisDiv = allDivs.snapshotItem(i);
		thisDiv.style.color = 'red';
		for(i in tags){
			re = new RegExp(tags[i],"g");
			thisDiv.innerHTML = thisDiv.innerHTML.replace(re, '<a href="#" class="tooltip">'+tags[i]+'<span>'+tools[i]+'</span></a>');
		}
	}
})();



