User:Gourra/flightpoints.js

il = new Array; il["4down"]="9/92/"; il["4up"]="4/4b/"; il["8down"]="b/bb/"; il["8up"]="f/fc/"; il["16down"]="8/8d/"; il["16up"]="e/ef/"; il["32down"]="d/d2/"; il["32up"]="5/56/"; il["64down"]="7/71/"; il["64up"]="8/88/"; il["128down"]="b/b2/"; il["128up"]="1/15/"; il["256down"]="9/96/"; il["256up"]="1/1b/";

function drawLine (lineObjectHandle, Ax, Ay, Bx, By) { xMin = Math.min(Ax, Bx); yMin = Math.min(Ay, By); xMax = Math.max(Ax, Bx); yMax = Math.max(Ay, By); boxWidth = Math.max(xMax-xMin, 1); boxHeight = Math.max(yMax-yMin, 1); tmp = Math.min(boxWidth, boxHeight); smallEdge = 1; newSrc = ""; while (tmp>>=1) smallEdge<<=1; smallEdge*=4; if (smallEdge>256) smallEdge=256; newSrc = "http://images.wikia.com/wowwiki/images/"+il[smallEdge+((Bx-Ax)*(By-Ay)<0?"up":"down")]+smallEdge+((Bx-Ax)*(By-Ay)<0?"up":"down")+".gif"; if (lineObjectHandle.src.indexOf(newSrc)==-1) lineObjectHandle.src = newSrc; with (lineObjectHandle.style) { zIndex = 5; width = boxWidth+"%"; height = boxHeight+"%"; left = xMin+"%"; top = yMin+"%"; } }

function fp2fp (div,fp1,fp2) { x1=0; x2=0; y1=0; y2=0; nDivs = document.getElementById("fp"+div).getElementsByTagName("div"); for (b=0;b<nDivs.length;b++) { nDivs[b].style.zIndex=10; if (nDivs[b].childNodes[0].childNodes[0].getAttribute("title") == fp1) { x1 = parseInt(nDivs[b].style.left.replace("%","")); y1 = parseInt(nDivs[b].style.top.replace("%","")); } if (nDivs[b].childNodes[0].childNodes[0].getAttribute("title") == fp2) { x2 = parseInt(nDivs[b].style.left.replace("%","")); y2 = parseInt(nDivs[b].style.top.replace("%","")); } } fpnum = Math.round(Math.random*10000); document.getElementById("fp"+div).innerHTML += ""; drawLine(document.getElementById("fpath"+fpnum),x1,y1,x2,y2); }

function flightPoints { y=0; Divs = document.getElementsByTagName("div"); for (x=0;x/gi,"").split("\n"); for (z=0;z<rawConnect.length;z++) { fps = rawConnect[z].split(":"); if (fps[1]) { fpdests = fps[1].split(","); for (a=0;a<fpdests.length;a++) fp2fp(y,fps[0],fpdests[a]); } } x++; y++; } } } flightPoints;