Advertisement
Guest User

Lukian

a guest
Jan 16th, 2008
549
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JavaScript 6.63 KB | None
  1. // ==UserScript==
  2. // @exclude http://*wowhead.com/?item*
  3. // @exclude http://*wowhead.com/?search*
  4. // @exclude http://*mmo-champion.com/*
  5. // @exclude http://nihilum.wazap.com/*
  6. // @exclude http://*worldofraids.com/*
  7. // @exclude http://*wowarmory.com/*
  8. // @exclude http://*freewithmats.com/*
  9. // @exclude http://*thottbot.com/*
  10. // @exclude http://wow.allakhazam.com/*
  11. // ==/UserScript==
  12.  
  13. if(typeof $WowheadPower=="undefined"){var $WowheadPower=new function(){function ce(z,p){var r=document.createElement(z);if(p){cO(r,p);}return r;}function ae(z,y){return z.appendChild(y);}function aE(z,y,x){if(window.attachEvent){z.attachEvent("on"+y,x);}else{z.addEventListener(y,x,false);}}function cO(d,s){for(var p in s){if(typeof s[p]=="object"){if(!d[p]){d[p]={};}cO(d[p],s[p]);}else{d[p]=s[p];}}}function $E(e){if(!e){e=event;}if(!e._button){e._button=e.which?e.which:e.button;e._target=e.target?e.target:e.srcElement;}return e;}function getWindowSize(){var _d=0,height=0;if(typeof window.innerWidth=="number"){_d=window.innerWidth;height=window.innerHeight;}else{if(document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight)){_d=document.documentElement.clientWidth;height=document.documentElement.clientHeight;}else{if(document.body&&(document.body.clientWidth||document.body.clientHeight)){_d=document.body.clientWidth;height=document.body.clientHeight;}}}return {w:_d,h:height};}function getScroll(){var x=0,y=0;if(typeof (window.pageYOffset)=="number"){x=window.pageXOffset;y=window.pageYOffset;}else{if(document.body&&(document.body.scrollLeft||document.body.scrollTop)){x=document.body.scrollLeft;y=document.body.scrollTop;}else{if(document.documentElement&&(document.documentElement.scrollLeft||document.documentElement.scrollTop)){x=document.documentElement.scrollLeft;y=document.documentElement.scrollTop;}}}return {x:x,y:y};}function getCursorPos(e){var x,y;if(window.innerHeight){x=e.pageX;y=e.pageY;}else{var _11=getScroll();x=e.clientX+_11.x;y=e.clientY+_11.y;}return {x:x,y:y};}var _12,currentId,cursorX,cursorY,head=document.getElementsByTagName("head")[0],items=[],tooltip,tooltipTable,tooltipTd,tooltipIcon,ie=!!(window.attachEvent&&!window.opera),ie7=navigator.userAgent.indexOf("MSIE 7.0")!=-1,ie6=navigator.userAgent.indexOf("MSIE 6.0")!=-1&&!ie7,LANG={loading:"Loading...",noresponse:"No response from server =/"},CURSOR_HSPACE=15,CURSOR_VSPACE=15;function init(){ae(head,ce("link",{type:"text/css",href:"http://www.wowhead.com/widgets/power/power.css?2",rel:"stylesheet"}));if(ie){ae(head,ce("link",{type:"text/css",href:"http://www.wowhead.com/widgets/power/power_ie.css",rel:"stylesheet"}));if(ie6){ae(head,ce("link",{type:"text/css",href:"http://www.wowhead.com/widgets/power/power_ie6.css",rel:"stylesheet"}));}}aE(document,"mouseover",onMouseOver);}function updateCursorPos(e){var pos=getCursorPos(e);cursorX=pos.x;cursorY=pos.y;}function onClick(id,t){t.href="http://www.wowhead.com/?item="+id;return false;}function onClickSearch(str,t){t.href="http://www.wowhead.com/?search="+str;return false;}function onMouseOver(e){e=$E(e);var t=e._target;if(t.nodeName!="A"){return;}if(!t.href.length){return;}var m=t.href.match(/http:\/\/(www\.)?wowhead\.com\/\?item=([0-9]+)/);if(!m){m=t.href.match(/http:\/\/(www\.)?thottbot\.com\/\i([0-9]+)/);};if(!m){m=t.href.match(/http:\/\/(wow\.)?allakhazam\.com\/db\/item\.html\?witem=([0-9]+)/);};if(!m){m=t.href.match(/http:\/\/(www\.)?wowarmory\.com\/item-info\.xml\?i=([0-9]+)/);};if(!m){m=t.href.match(/http:\/\/(eu\.)?wowarmory\.com\/item-info\.xml\?i=([0-9]+)/);};if(m){if(!t.onclick){t.onclick=onClick(m[2], t);}if(!t.onmousemove){t.onmousemove=onMouseMove;t.onmouseout=onMouseOut;}updateCursorPos(e);displayItem(m[2]);}var s=t.href.match(/http:\/\/(www\.)?thottbot\.com\/\?s=(.+)/);if(s){if(!t.onclick){t.onclick=onClickSearch(s[2],t);}}}function onMouseMove(e){e=$E(e);updateCursorPos(e);moveTooltip();}function onMouseOut(){_12=null;hideTooltip();}function initTooltip(){if(!tooltip){var d=ce("div"),t=ce("table"),tb=ce("tbody"),tr1=ce("tr"),tr2=ce("tr"),td=ce("td"),th1=ce("th"),th2=ce("th"),th3=ce("th");d.className="wowhead-tooltip";th1.style.backgroundPosition="top right";th2.style.backgroundPosition="bottom left";th3.style.backgroundPosition="bottom right";ae(tr1,td);ae(tr1,th1);ae(tb,tr1);ae(tr2,th2);ae(tr2,th3);ae(tb,tr2);ae(t,tb);tooltipIcon=ce("p");tooltipIcon.style.display="none";ae(tooltipIcon,ce("div"));ae(d,tooltipIcon);ae(d,t);ae(document.body,d);tooltip=d;tooltipTable=t;tooltipTd=td;hideTooltip();}}function showTooltip(_1a,_1b){if(!tooltip){initTooltip();}if(_1b){tooltipIcon.style.backgroundImage="url(http://www.wowhead.com/images/icons/medium/"+_1b.toLowerCase()+".jpg)";tooltipIcon.style.display="";}else{tooltipIcon.style.backgroundImage="none";tooltipIcon.style.display="none";}tooltip.style.display="";tooltip.style.width="320px";tooltipTd.innerHTML=_1a;fixTooltip();moveTooltip();tooltip.style.visibility="visible";}function hideTooltip(){tooltip.style.display="none";tooltip.style.visibility="hidden";}function fixTooltip(){var c=tooltipTd.childNodes;if(c.length>=2&&c[0].nodeName=="TABLE"&&c[1].nodeName=="TABLE"){var m;if(c[1].offsetWidth>300){m=Math.max(300,c[0].offsetWidth)+20;}else{m=Math.max(c[0].offsetWidth,c[1].offsetWidth)+20;}if(m>20){tooltip.style.width=m+"px";c[0].style.width=c[1].style.width="100%";}}else{tooltip.style.width=tooltipTable.offsetWidth+"px";}}function moveTooltip(){if(!tooltip){return;}if(cursorX==null){return;}var _1e=getWindowSize(),scroll=getScroll(),bcw=_1e.w,bch=_1e.h,bsl=scroll.x,bst=scroll.y,tow=tooltipTable.offsetWidth,toh=tooltipTable.offsetHeight,left=cursorX+CURSOR_HSPACE,top=cursorY-toh-CURSOR_VSPACE;if(left<bsl){left=bsl;}else{if(left+tow>bsl+bcw){left=cursorX-tow-CURSOR_HSPACE;}}if(top<bst){top=cursorY+CURSOR_VSPACE;}else{if(top+toh>bst+bch){top=Math.max(bst,bst+bch-toh);}}tooltip.style.left=left+"px";tooltip.style.top=top+"px";}function displayItem(id){_12=1;currentId=id;if(typeof items[id]=="object"){showTooltip(items[id].tooltip,items[id].icon);}else{if(!items[id]){requestItem(id);}else{showTooltip(LANG.loading);}}}function requestItem(id){items[id]=wxXTimeout(function(){showLoading.apply(this,[id]);},150);ajaxIshRequest("http://www.wowhead.com/?item="+id+"&power");}function ajaxIshRequest(url){ae(head,ce("script",{type:"text/javascript",src:url}));}function showLoading(id){if(_12==1&&currentId==id){showTooltip(LANG.loading);items[currentId]=wxXTimeout(function(){itemNotFound.apply(this,[id]);},3850);}}function itemNotFound(id){items[id]=undefined;if(_12==1&&currentId==id){showTooltip(LANG.noresponse);}}this.registerItem=function(id,_25){clearTimeout(items[id]);items[id]=_25;if(_12==1&&id==currentId){showTooltip(items[id].tooltip,items[id].icon);}};init();};}
Advertisement
RAW Paste Data Copied
Advertisement