function $X(path, root) { return document.evaluate(path, root || document, null, 6, null); } function $x(path, root) { return document.evaluate(path, root || document, null, 8, null).singleNodeValue; } function $del(el) { if(el) el.parentNode.removeChild(el); } function $each(list, fn) { if(!list) return; var i = list.snapshotLength; if(i > 0) while(i--) fn(list.snapshotItem(i), i); } function addRefLinkPreview(node) { $each($X('.//a[starts-with(text(),">>")]', node || document), function(link) { link.addEventListener('mouseover', showPostPreview, false); link.addEventListener('mouseout', delPostPreview, false); }); } function showPostPreview(e) { var doc = document; //ref id var pNum = $(this).text().match(/\d+/); if (pNum.length == 0) { return; } //position //var x = e.clientX + (doc.documentElement.scrollLeft || doc.body.scrollLeft) - doc.documentElement.clientLeft + 1; //var y = e.clientY + (doc.documentElement.scrollTop || doc.body.scrollTop) - doc.documentElement.clientTop; var x = e.clientX + (doc.documentElement.scrollLeft || doc.body.scrollLeft) + 2; var y = e.clientY + (doc.documentElement.scrollTop || doc.body.scrollTop); var cln = doc.createElement('div'); cln.id = 'pstprev_' + pNum; cln.className = 'post_preview'; cln.style.cssText = 'top:' + y + 'px;' + (x < doc.body.clientWidth/2 ? 'left:' + x + 'px' : 'right:' + parseInt(doc.body.clientWidth - x + 1) + 'px'); cln.addEventListener('mouseout', delPostPreview, false); var mkPreview = function(cln, html) { cln.innerHTML = html; addRefLinkPreview(cln); //if(!$x('.//small', cln)) showRefMap(post, p_num, refMap) }; cln.innerHTML = "