User:RnDMonkey/global.js

function fhNoConflict{window.jQuery&&document.body?jQuery.noConflict:setTimeout(fhNoConflict,3)}window.jQuery||(document.write('<\/script>'),fhNoConflict); function loadFhTooltip{window.jQuery&&document.body?function(g){fhTooltip=new function{function l(a,b){if("A"!=a.nodeName||0==a.href.length&&0==a.rel.length||-1!=a.href.indexOf("#")&&-1!=a.href.indexOf(location.href.replace(/#.*/,""))||-1!=a.rel.indexOf("nott")||m&&!a.href.match(/^https?:\/\/[^\/]*\.torhead\.com\//))return!1;var d=g(a);if(d.parents("nav").length||d.parents("#subheader").length)return!1;var c;if(0==a.rel.indexOf("ttcustom"))"string"!=typeof b&&(i=b),d.parent(".th-icon").length? (e=a.parentNode,h=1):h=e=0;else if(0==a.rel.indexOf("tt:")){var f=a.rel.replace(/^tt:/,"").replace(/%27/,"'");"string"!=typeof b&&(j=f,i=b);d.parent(".th-icon").length?(e=a.parentNode,h=1):h=e=0;if("list"==b)return!1;if("return"==b)return{target:a,type:"unknown",url:f};n("http://"+window.location.hostname,f)}else if(c=o(a.href)){f=c[2].replace("/detail/","").replace(/#.*/,"").replace(/%20/g," ").replace(/\+/g," ").replace(/%27/,"'");"string"!=typeof b&&(j=f,i=b);d.parent(".th-icon").length?(e=a.parentNode, h=1):h=e=0;if("list"==b)return{host:c[1],type:c[3],url:f};if("return"==b)return{target:a,host:c[1],type:c[3],url:f};n(c[1],f)}else if(d.attr("data-tooltip")){"string"!=typeof b&&(i=b);d.parent(".th-icon").length?(e=a.parentNode,h=1):h=e=0;if("list"==b)return!1;fhTooltip.showTooltip(' ')}else return!1; if(!a.fhEvents)a.fhEvents=1,d.mousemove(p).mouseout(function{j=0;g("#headtt").remove;e=0});return!0}function n(a,b){k[b]?q(b):r(a,b)}function q(a){var b=k[a];j==a&&"Unavailable"!=b.html.substring(0,11)&&fhTooltip.showTooltip(b.html)}function p(a){"undefined"==typeof a&&(a=i);var b=g("#headtt");if(b.length){if(e){var d=g(e).offset,c=d.left+e.offsetWidth+"px",f=d.top-b.height+"px";b.css({left:c,top:f,right:"auto"});c=s(a,b);if(c.x||c.y)c.y&&b.css({top:d.top+e.offsetHeight+"px"}),c.x&&b.css({left:"auto", right:t.r-d.left+"px"})}else if(c=a.pageX+6+"px",f=a.pageY-b.height-6+"px",b.css({left:c,top:f,right:"auto"}),c=s(a,b),c.x||c.y)c.y&&b.css({top:a.pageY+20+"px"}),c.x&&b.css({left:"auto",right:c.x+6+"px"});b.css("display","block")}}function s(a,b){var d,c=0,f=t;if(e){var u=g(e).offset;u.top-b.heightf.r&&(d=1);return{x:d,y:c}}a.pageY-b.height-6f.r&&(d=f.r-a.pageX);return{x:d,y:c}}function r(a,b){var d=document.createElement("script"); d.type="text/javascript";d.src=a+b+(b.match(/tooltips$/)?"":"/tooltip");document.head?document.head.appendChild(d):document.body.appendChild(d)}function o(a){return a.match(/^(http:\/\/[^\/]+)(\/(item|npc|ability|schematic|class|mission)\/([^\/]+))/)}function t{var a=g(window),b=a.scrollLeft,d=a.scrollTop;return{l:b,t:d,r:b+a.width,b:d+a.height}}var i="",k=[],j=0,e=0,h=0,m="undefined"==typeof FH?1:0;this.init=function{if(m){var a=document.createElement("link");a.rel="stylesheet";a.type= "text/css";a.href="http://tor.zamimg.com/tooltips.css";document.head?document.head.appendChild(a):document.body.appendChild(a)}0==g("#headjs").length&&g("body").prepend(' ');g(document).mouseover(fhTooltip.mouseOver).mousemove(fhTooltip.mouseOut);g(document).ready(function{fhTooltip.preload})};this.preload=function{var a="a";g("#main").length&&(a="#main a");var b={};g(a).each(function{var a=l(this,"list");if(a){b[a.host]|| (b[a.host]={});var d=b[a.host];d[a.type]||(d[a.type]=[]);var c=d[a.type];c[a.url.replace(/%20/g," ").replace(/\+/g," ")]=a.url.replace(/%20/g," ").replace(/\+/g," ");d[a.type]=c;b[a.host]=d}});for(var d in b)for(var c in b[d]){var a=[],f;for(f in b[d][c])a.push(b[d][c][f].replace("/"+c+"/","").replace("/",""));r(d,"/"+c+"/"+a.join(";")+"/tooltips")}};this.modifyLinks=function(a){if("object"==typeof framehead_tooltips){var b=framehead_tooltips;if(b.colorlinks||b.iconizelinks){var d=0,c="a";g("#main").length&& (c="#main a");g(c).each(function{if(!(200d&&!l(b,a);)b=b.parentNode,++d};this.mouseOut=function(a){i=a};this.store=function(a,b,d,c){k[a]={html:b,linkColor:d,icon:c}; q(a)};this.showTooltip=function(a){var b=h?' class="hide-icon"':"";g("#headjs").html(''+a+" ");p}};fhTooltip.init}(jQuery):setTimeout(loadFhTooltip,20)}loadFhTooltip;