User:Toranosuke/quicktooltip.js

// from ttp://www.wowwiki.com/User:Pcj/quicktooltip.js /*

function showTemplateTip(i) { if (tooltipsOn) { var tip = document.getElementById('templatetfb'); var Span = document.getElementById( "tttc" + i ); tooltip = ttHTMLStart + Span.innerHTML + ' '; tip.innerHTML = tooltip; tip.style.position = "absolute"; tip.style.visibility = "hidden"; tip.style.display = "block"; tip.style.zIndex = "999"; moveTemplateTip; tip.style.visibility = "visible"; } }

function hideTemplateTip { var tip = document.getElementById('templatetfb'); tip.innerHTML = ""; tip.style.display = "none"; }

// This function moves the tool-tips when our mouse moves function moveTemplateTip { if (document.documentElement && document.documentElement.scrollTop) { // IE6 +4.01 and user has scrolled dbSleft = document.documentElement.scrollLeft; dbStop = document.documentElement.scrollTop; } else { // IE5 or DTD 3.2 dbSleft = document.body.scrollLeft; dbStop = document.body.scrollTop; } var tip = document.getElementById('templatetfb'); var newTop = mousePos.y - (tip.clientHeight + 40); var newLeft = mousePos.x - ( tip.clientWidth / 2 ); if( newTop < dbStop ) { newTop = mousePos.y + 1; if ( newTop + tip.clientHeight > winSize.y ) newTop = dbStop; } if( newLeft < dbSleft ) newLeft = dbSleft; if( ( mousePos.x + ( tip.clientWidth / 2 ) ) >= winSize.x - 150 ) newLeft = mousePos.x - ( 1.75 * tip.clientWidth ); tip.style.top = newTop + "px"; tip.style.left = newLeft + "px"; }

function ttTemplateMouseOver { ttfdiv = document.createElement("div"); ttfdiv.setAttribute("id", "templatetfb"); contentstart = document.getElementById("content"); contentstart.insertBefore(ttfdiv, contentstart.childNodes[0]); var Spans = document.getElementsByTagName( "span" ); for ( var i = 0; i < Spans.length; i++ ) { if ( hasClass( Spans[i], "tttemplatelink" ) ) { Spans[i].nextSibling.setAttribute("id", "tttc" + i); Spans[i].onmouseover = showTemplateTip.bind(Spans[i],i); Spans[i].onmouseout = hideTemplateTip; Spans[i].onmousemove = moveTemplateTip; } } } ttTemplateMouseOver;

/*