jablonka.czprosek.czf

mapstats

Subversion Repositories:
[/] [mapstats.min.js] - Blame information for rev 10

 

Line No. Rev Author Line
19unreal// --------------------------------------------------------
2// This script made by JKLIR as. Unreal][ [http://jklir.net]
3// Map engine originally from Emcee Lam [http://sjsutech.com]
410unreal// Licence: GNU/GPL | Version 4.1
59unreal// (c) 2011 All rights reserved
6// --------------------------------------------------------
7 
810unreal 
9var mainMap;var magnifier;var node=new Array();var nodecount;var file_nodes=new Array();var file_noping=new Array();var file_links=new Array();var file_infopoints=new Array();var file_state=new Array();var ann,m1,m2,m3,m4,m5,m6,m7,m8,m9;var m1_a,m2_a,m3_a,m4_a,m5_a,m6_a,m7_a,m8_a,m9_a;var cntm;var div_paint,div_points,div_wave,div_infopoint,div_name,div_ip,div_status;var numoflinks=0;var maxnumoflinks=17;var is_ie=false;if(typeof(G_vmlCanvasManager)!='undefined'){is_ie=true;}
10actual_links="";var drawing_timer;var is_adding=true;var visibleTilesMap=new Array();Array.prototype.max=function(){var max=this[0];var len=this.length;for(var i=1;i<len;i++)if(this[i]>max)max=this[i];return max;}
119unrealArray.prototype.min=function(){var min=this[0];var len=this.length;for(var i=1;i<len;i++)if(this[i]<min)min=this[i];return min;}
12function mapInit(startzoom){magnifier=new Magnifier();mainMap=new MainMap(startzoom);var miniMapDiv=document.getElementById("miniMapInner");miniMapDiv.onmousedown=function(event){return magnifier.startMove(event)};miniMapDiv.onmousemove=function(event){return magnifier.processMove(event)};miniMapDiv.onmouseup=function(event){return magnifier.stopMove(event)};miniMapDiv.ondragstart=function(){return false;}}
13function Magnifier(){var this1=this;this.f_dragging=false;this.div=document.getElementById("magnifier");this.div.ondragstart=function(){return false;}
14this.div.onmousedown=function(event){return this1.startMove(event)};this.div.onmousemove=function(event){return this1.processMove(event)};this.div.onmouseup=function(event){return this1.stopMove(event)};}
15Magnifier.prototype.startMove=function(event){if(!event)event=window.event;var magnifierDiv=document.getElementById("magnifier");this.dragStartLeft=event.clientX;this.dragStartTop=event.clientY;this.top=magnifierDiv.offsetTop;this.left=magnifierDiv.offsetLeft;this.f_dragging=true;return false;}
16Magnifier.prototype.processMove=function(event){var magnifierDiv=this.div;if(!event)event=window.event;if(this.f_dragging){var minX=0;var maxX=magres_x-magnifierDiv.offsetWidth;var minY=0;var maxY=magres_y-magnifierDiv.offsetHeight;var shiftedLeft=this.left+(event.clientX-this.dragStartLeft);if(shiftedLeft<minX)shiftedLeft=minX;if(shiftedLeft>maxX)shiftedLeft=maxX;magnifierDiv.style.left=shiftedLeft+"px";var shiftedTop=this.top+(event.clientY-this.dragStartTop);if(shiftedTop<minY)shiftedTop=minY;if(shiftedTop>maxY)shiftedTop=maxY;magnifierDiv.style.top=shiftedTop+"px";mainMap.setViewPort();}}
17Magnifier.prototype.stopMove=function(event){this.f_dragging=false;is_adding=true;checkLinks();}
18Magnifier.prototype.setSize=function(innerDivWidth,innerDivHeight){var magnifierWidth=Math.round((magres_x*inres_x)/innerDivWidth)-2;var magnifierHeight=Math.round((magres_y*inres_y)/innerDivHeight)-2;var magnifierDiv=document.getElementById("magnifier");magnifierDiv.style.width=magnifierWidth+"px";magnifierDiv.style.height=magnifierHeight+"px";document.getElementById("wrapper").style.width=inres_x+document.getElementById("menuset").clientWidth+18+"px";}
19Magnifier.prototype.setPosition=function(){var innerDiv=document.getElementById("innerDiv");var innerDivWidth=innerDiv.clientWidth;var innerDivHeight=innerDiv.clientHeight;var innerDivLeft=innerDiv.offsetLeft;var innerDivTop=innerDiv.offsetTop;this.left=Math.round(Math.abs(innerDivLeft)*magres_x/innerDivWidth);this.top=Math.round(Math.abs(innerDivTop)*magres_y/innerDivHeight);var magnifierDiv=this.div;magnifierDiv.style.left=this.left+"px";magnifierDiv.style.top=this.top+"px";}
2010unrealfunction MainMap(zoomfirst){var this1=this;this.viewPortWidth=inres_x;this.viewPortHeight=inres_y;this.tileSize=256;this.f_dragging=false;this.innerDiv=document.getElementById("innerDiv");this.innerDiv.style.cursor="url('grab.cur'), default";this.tilesX=Math.ceil(inres_x/this.tileSize)+1;this.tilesY=Math.ceil(inres_y/this.tileSize)+1;var outerDiv=document.getElementById("outerDiv");this.outerDiv=outerDiv;outerDiv.style.width=inres_x+"px";outerDiv.style.height=inres_y+"px";var underMap=document.getElementById("underMap");underMap.style.width=(inres_x-4)+"px";outerDiv.onmousedown=function(event){return this1.startMove(event)};outerDiv.onmousemove=function(event){return this1.processMove(event)};outerDiv.onmouseup=function(event){return this1.stopMove(event)};outerDiv.ondblclick=function(event){return this1.doubleClick()};outerDiv.ondragstart=function(){return false;}
219unrealif(zoomfirst==eq_mini){zf=0;}
22else if(zoomfirst==eq_medi){zf=1;}
23else if(zoomfirst==eq_high){zf=2;}
24else if(zoomfirst==eq_orig){zf=3;}
25else{zf=0;}
2610unrealthis.zoom=zf;this.zoomDim=[{width:parseInt(full_x*eq_mini),height:parseInt(full_y*eq_mini),size:1,nasobek:eq_mini,numoflinks:17},{width:parseInt(full_x*eq_medi),height:parseInt(full_y*eq_medi),size:2,nasobek:eq_medi,numoflinks:13},{width:parseInt(full_x*eq_high),height:parseInt(full_y*eq_high),size:3,nasobek:eq_high,numoflinks:11},{width:parseInt(full_x*eq_orig),height:parseInt(full_y*eq_orig),size:4,nasobek:eq_orig,numoflinks:8},]
279unrealvar zoomElt=this.zoomDim[this.zoom];this.setInnerDivSize(zoomElt.width,zoomElt.height,zoomElt.size,(parseInt(zoomfirst*1000)/10));document.getElementById("zoom"+this.zoom).className="active";var innerDiv=document.getElementById("innerDiv");innerDiv.style.left=-(start_left*start_mul)+"px";innerDiv.style.top=-(start_top*start_mul)+"px";magnifier.setPosition();this.checkTiles();}
28MainMap.prototype.startMove=function(event){if(!event)event=window.event;this.dragStartLeft=event.clientX;this.dragStartTop=event.clientY;var innerDiv=this.innerDiv;innerDiv.style.cursor="url('grabbing.cur'), default";this.top=innerDiv.offsetTop;this.left=innerDiv.offsetLeft;this.f_dragging=true;is_adding=true;window.clearInterval(drawing_timer);drawing_timer=window.setInterval(checkLinks,1100);return false;}
29MainMap.prototype.processMove=function(event){var zoomElt=this.zoomDim[this.zoom];var maxY=0;var minY=-(zoomElt.height-this.viewPortHeight);var maxX=0;var minX=-(zoomElt.width-this.viewPortWidth);if(!event)event=window.event;var innerDiv=this.innerDiv;if(this.f_dragging){var shiftedTop=this.top+(event.clientY-this.dragStartTop);if(shiftedTop>maxY)shiftedTop=maxY;if(shiftedTop<minY)shiftedTop=minY;innerDiv.style.top=shiftedTop+"px";var shiftedLeft=this.left+(event.clientX-this.dragStartLeft);if(shiftedLeft>maxX)shiftedLeft=maxX;if(shiftedLeft<minX)shiftedLeft=minX;innerDiv.style.left=shiftedLeft+"px";this.checkTiles();magnifier.setPosition();}
30var konst=0;var nasobek=this.zoomDim[this.zoom].nasobek;if(is_ie){konst=-2;}
31var outerDiv=this.outerDiv;var infoDiv=document.getElementById("infoDiv");if(this.f_dragging){infoDiv.innerHTML=parseInt((Math.abs(shiftedLeft)+event.clientX-outerDiv.offsetLeft+konst)/nasobek)+" x "+parseInt((Math.abs(shiftedTop)+event.clientY-outerDiv.offsetTop+konst)/nasobek);}else{infoDiv.innerHTML=parseInt((Math.abs(parseInt(innerDiv.style.left))+event.clientX-outerDiv.offsetLeft+konst)/nasobek)+" x "+parseInt((Math.abs(parseInt(innerDiv.style.top))+event.clientY-outerDiv.offsetTop+konst)/nasobek);}}
32MainMap.prototype.checkZoom=function(){window.clearInterval(drawing_timer);var zoomElt=this.zoomDim[this.zoom];var maxY=0;var minY=-(zoomElt.height-this.viewPortHeight);var maxX=0;var minX=-(zoomElt.width-this.viewPortWidth);var chcky=0;var chckx=0;var innerDiv=this.innerDiv;var shiftedTop=innerDiv.offsetTop;if(shiftedTop>maxY){shiftedTop=maxY;chcky=1;}
33if(shiftedTop<minY){shiftedTop=minY;chcky=1;}
34if(chcky==1)innerDiv.style.top=shiftedTop+"px";var shiftedLeft=innerDiv.offsetLeft;if(shiftedLeft>maxX){shiftedLeft=maxX;chckx=1;}
35if(shiftedLeft<minX){shiftedLeft=minX;chckx=1;}
36if(chckx==1)innerDiv.style.left=shiftedLeft+"px";magnifier.setPosition();document.getElementById("zoom0").className="";document.getElementById("zoom1").className="";document.getElementById("zoom2").className="";document.getElementById("zoom3").className="";document.getElementById("zoom"+this.zoom).className="active";}
3710unrealMainMap.prototype.checkTiles=function(){var innerDiv=this.innerDiv;var tileSize=this.tileSize;var visibleTiles=this.getVisibleTiles();var i;var size=this.zoomDim[this.zoom].size;for(i=0;i<visibleTiles.length;i++){var tile=visibleTiles[i];var xy="x"+tile.x+"y"+tile.y;var tileName=xy+"z"+this.zoom;if(!visibleTilesMap[tileName]){var img=document.createElement("img");img.src="size"+size+"/"+xy+".jpg";img.style.position="absolute";img.style.left=(tile.x*tileSize)+"px";img.style.top=(tile.y*tileSize)+"px";img.setAttribute("id",tileName);innerDiv.appendChild(img);visibleTilesMap[tileName]=true;}}
38var imgs=innerDiv.getElementsByTagName("img");for(i=0;i<imgs.length;i++){var id=imgs[i].getAttribute("id");if(!visibleTilesMap[id]){innerDiv.removeChild(imgs[i]);}}}
39MainMap.prototype.getVisibleTiles=function(){var innerDiv=this.innerDiv;var mapX=innerDiv.offsetLeft;var mapY=innerDiv.offsetTop;var tileSize=this.tileSize;var startX=Math.abs(Math.floor(mapX/tileSize))-1;if(startX<0)startX=0;var startY=Math.abs(Math.floor(mapY/tileSize))-1;if(startY<0)startY=0;var visibleTiles=[];var counter=0;for(x=startX;x<(this.tilesX+startX);x++){for(y=startY;y<(this.tilesY+startY);y++){var tile={};tile.x=x;tile.y=y;visibleTiles[counter++]=tile;}}
409unrealreturn visibleTiles;}
41MainMap.prototype.stopMove=function(event){window.clearInterval(drawing_timer);checkLinks();is_adding=false;checkLinks();this.innerDiv.style.cursor="url('grab.cur'), default";this.f_dragging=false;}
42MainMap.prototype.setViewPort=function(){var magDiv=document.getElementById("magnifier");var innerDiv=this.innerDiv;var magLeft=magDiv.offsetLeft;var magTop=magDiv.offsetTop;var innerDivWidth=innerDiv.clientWidth;var innerDivHeight=innerDiv.clientHeight;var innerDivLeftMin=inres_x-innerDivWidth;var innerDivLeft=Math.round((-magLeft)*innerDivWidth/magres_x);if(innerDivLeft<innerDivLeftMin)innerDivLeft=innerDivLeftMin;innerDiv.style.left=innerDivLeft+"px";var innerDivTopMin=inres_y-innerDivHeight;var innerDivTop=Math.round((-magTop)*innerDivHeight/magres_y);if(innerDivTop<innerDivTopMin)innerDivTop=innerDivTopMin;innerDiv.style.top=innerDivTop+"px";this.checkTiles();}
43MainMap.prototype.setInnerDivSize=function(width,height,size,percent){var innerDiv=this.innerDiv;innerDiv.style.width=width+"px";innerDiv.style.height=height+"px";magnifier.setPosition();magnifier.setSize(width,height);var resolutionInfo=document.getElementById("resolutionInfo");resolutionInfo.innerHTML=percent+"%, "+width+" x "+height+"px";}
44MainMap.prototype.setZoom=function(newZoom){is_adding=true;if(this.zoom==newZoom)return;window.clearInterval(drawing_timer);actual_links="";numoflinks=0;var oldZ=this.zoomDim[this.zoom];var newZ=this.zoomDim[newZoom];var innerDiv=this.innerDiv;var imgs=innerDiv.getElementsByTagName("img");while(imgs.length>0){innerDiv.removeChild(imgs[0]);}
4510unrealvisibleTilesMap=new Array();var oldLeft=innerDiv.offsetLeft;var oldTop=innerDiv.offsetTop;var wdth=Math.round(((magres_x*inres_x)/newZ.width)-2);var hght=Math.round(((magres_y*inres_y)/newZ.height)-2);var wdth2=Math.round(((magres_x*inres_x)/oldZ.width)-2);var hght2=Math.round(((magres_y*inres_y)/oldZ.height)-2);innerDiv.style.left=Math.round(Math.round(newZ.width*oldLeft/oldZ.width)+((wdth-wdth2)*4))+"px";innerDiv.style.top=Math.round(Math.round(newZ.height*oldTop/oldZ.height)+((hght-hght2)*4))+"px";this.zoom=newZoom;this.setInnerDivSize(newZ.width,newZ.height,newZ.size,(newZ.nasobek*1000)/10);maxnumoflinks=newZ.numoflinks;this.checkZoom();this.checkTiles();deleteNames();canvasInit(newZ.nasobek);}
469unrealMainMap.prototype.doubleClick=function(){if(this.zoom==3)return;this.setZoom(this.zoom+1);}
47MainMap.prototype.addNewLinks=function(minx,maxx,miny,maxy,linkname){var innerDiv=this.innerDiv;var frameLeft=-innerDiv.offsetLeft;var frameTop=-innerDiv.offsetTop;var frameRight=frameLeft+inres_x;var frameBottom=frameTop+inres_y;var regexp=new RegExp(linkname+' ','gi');if(!regexp.test(actual_links)){return(minx<=frameRight&&frameLeft<=maxx&&miny<=frameBottom&&frameTop<=maxy);}}
48MainMap.prototype.removeOldLinks=function(minx,maxx,miny,maxy,linkname){var innerDiv=this.innerDiv;var frameLeft=-innerDiv.offsetLeft;var frameTop=-innerDiv.offsetTop;var frameRight=frameLeft+inres_x;var frameBottom=frameTop+inres_y;var regexp=new RegExp(linkname+' ','gi');if(regexp.test(actual_links)&&numoflinks>=maxnumoflinks){if(!(minx<=frameRight&&frameLeft<=maxx&&miny<=frameBottom&&frameTop<=maxy)){actual_links=actual_links.replace(regexp,"");var linkDOM=document.getElementById(linkname);if(is_ie){linkDOM.parentNode.parentNode.removeChild(linkDOM.parentNode);}else{linkDOM.parentNode.removeChild(linkDOM);}
49numoflinks--;return;}}}
50function canvasInit(nasobek){is_adding=true;actual_links="";numoflinks=0;div_paint=document.getElementById("paint");div_points=document.getElementById("mapstats_points");div_wave=document.getElementById("mapstats_wave");div_infopoint=document.getElementById("mapstats_infopoint");div_name=document.getElementById("mapstats_name");div_ip=document.getElementById("mapstats_ip");div_status=document.getElementById("mapstats_status");div_paint.style.width=parseInt(full_x*nasobek)+"px";div_paint.style.height=parseInt(full_y*nasobek)+"px";var mapstats_over=document.getElementById("mapstats_over");mapstats_over.style.width=parseInt(full_x*nasobek)+"px";mapstats_over.style.height=parseInt(full_y*nasobek)+"px";ann=nasobek;var pozdrav2=new Array();var pozdr=new Array();var pozdrav=file_nodes.split('\n');var pozdrav1=file_noping.split('\n');var a_cnt=0;var p0count=pozdrav.length;var p1count=pozdrav1.length;for(a=0;a<p0count;a++){if(pozdrav[a]!=false){node[a]=new Array();pozdrav2=pozdrav[a].split(';');for(b=0;b<pozdrav2.length;b++){node[a][b]=pozdrav2[b];}
51a_cnt++;}}
52for(e=0;e<p1count;e++){if(pozdrav1[e]!=false){node[(e+a_cnt)]=new Array();pozdr=pozdrav1[e].split(';');for(f=0;f<pozdr.length;f++){node[(e+a_cnt)][f]=pozdr[f];}}}
53nodecount=node.length;var pozdrav3=new Array();var pozdrav4=new Array();var size;var clrlnk;m1=0;m1_a=0;m2=0;m2_a=0;m3=0;m3_a=0;m4=0;m4_a=0;m5=0;m5_a=0;m6=0;m6_a=0;m7=0;m7_a=0;m8=0;m8_a=0;m9=0;m9_a=0;cntm=0;checkLinks();cntm=m1+m2+m3+m4+m5+m6+m7+m8+m9+m1_a+m2_a+m3_a+m4_a+m5_a+m6_a+m7_a+m8_a+m9_a;var pozdrav5=new Array();var pozdrav6=new Array();if(ch_infopoint){if(file_infopoints.length>0){pozdrav5=file_infopoints.split('\n');for(d=0;d<pozdrav5.length;d++){if(pozdrav5[d]!=false){pozdrav6=pozdrav5[d].split(';');if(ch_name){drawInfo(pozdrav6[0],pozdrav6[1],pozdrav6[2],nasobek);}
54drawInfoPoint(pozdrav6[1],pozdrav6[2],nasobek);}}}}
55for(e=0;e<p1count;e++){if(pozdrav1[e]!=""){if(ch_noping){if(node[(a_cnt+e)][3]==1){drawClient(node[(a_cnt+e)][1],node[(a_cnt+e)][2],nasobek);if(ch_name){drawName(node[(a_cnt+e)][0],(node[(a_cnt+e)][1])-1,(node[(a_cnt+e)][2])-1,nasobek)}}
56if(node[(a_cnt+e)][3]==2){drawSwitch(node[(a_cnt+e)][1],node[(a_cnt+e)][2],nasobek);}}}}
57var pozdrav7=file_state.split('\n');var pozdrav8=new Array();var clrpnt;var x_pos;var y_pos;var name_pos;var title_pos;var p7count=pozdrav7.length;for(c=0;c<p7count;c++){if(pozdrav7[c]!=false){pozdrav8=pozdrav7[c].split(';');if(pozdrav8[1]==1){clrpnt="on";pozdrav8[2]=pozdrav8[2]+' ms';}else{clrpnt="off";pozdrav8[2]="offline";}
58if(pozdrav8[0]!=node[c][4]){x_pos=ip2sour(pozdrav8[0],1);y_pos=ip2sour(pozdrav8[0],2);name_pos=ip2sour(pozdrav8[0],0);title_pos=ip2sour(pozdrav8[0],3);}else{x_pos=node[c][1];y_pos=node[c][2];name_pos=node[c][0];title_pos=node[c][3];}
59if(title_pos.toLowerCase()=="ap"){if(ch_ap){drawAP(x_pos,y_pos,nasobek);drawNode(x_pos,y_pos,nasobek,clrpnt);if(ch_name){drawName(name_pos,x_pos,y_pos,nasobek);}
60if((ch_ip)&&(ch_status)){drawStatus(pozdrav8[2],x_pos,y_pos,nasobek);drawIP(pozdrav8[0],x_pos,y_pos,nasobek);}else if((!ch_ip)&&(ch_status)){drawStatus(pozdrav8[2],x_pos,y_pos-parseInt(12/nasobek),nasobek);}else if((ch_ip)&&(!ch_status)){drawIP(pozdrav8[0],x_pos,y_pos,nasobek);}}}else if(title_pos.toLowerCase()=="router"){if(ch_router){drawNode(x_pos,y_pos,nasobek,clrpnt);if(ch_name){drawName(name_pos,x_pos,y_pos,nasobek);}
61if(ch_status){drawStatus(pozdrav8[2],x_pos,y_pos-parseInt(12/nasobek),nasobek);}}}else{if(ch_node){drawNode(x_pos,y_pos,nasobek,clrpnt);if(ch_name){drawName(name_pos,x_pos,y_pos,nasobek);}}}}}
62var legend=document.getElementById('legend');if((ch_legend)&&(cntm>0)){drawLegend();legend.style.display="block";}else{legend.style.display="none";}}
63function drawLink(pos,size,nas,color){var linkname="canvas"+pos.replace(/(#|&|_|\.|\:)/gi,"");var points=new Array();var posxy=new Array();var coordinates=new Array();var cor_x=new Array();var cor_y=new Array();points=pos.split('#');var reg=/(\d+)&(\d+)/;for(i=0;i<points.length;i++){if(reg.test(points[i])){posxy=points[i].split('&');coordinates[i*2]=parseInt(posxy[0]*nas);coordinates[i*2+1]=parseInt(posxy[1]*nas);cor_x.push(coordinates[i*2]);cor_y.push(coordinates[i*2+1]);}else{coordinates[i*2]=parseInt(node2sour(points[i],1)*nas);coordinates[i*2+1]=parseInt(node2sour(points[i],2)*nas);cor_x.push(coordinates[i*2]);cor_y.push(coordinates[i*2+1]);}}
64var maxX=cor_x.max();var minX=cor_x.min();var maxY=cor_y.max();var minY=cor_y.min();if(is_adding){if(!mainMap.addNewLinks(minX,maxX,minY,maxY,linkname))return;}else{if(!mainMap.removeOldLinks(minX,maxX,minY,maxY,linkname))return;}
65numoflinks++;actual_links=actual_links+linkname+" ";var canvas=document.createElement("canvas");canvas.width=maxX-minX+10;canvas.height=maxY-minY+10;canvas.id=linkname;if(is_ie){var div=document.createElement("div");div.style.width=maxX-minX+10+"px";div.style.height=maxY-minY+10+"px";div.style.position="absolute";div.style.left=(minX-5)+"px";div.style.top=(minY-5)+"px";div.appendChild(canvas);div_paint.appendChild(div);G_vmlCanvasManager.initElement(canvas);}else{canvas.setAttribute("style","position:absolute;left:"+(minX-5)+"px;top:"+(minY-5)+"px;");div_paint.appendChild(canvas);}
66var ctx=document.getElementById(linkname).getContext('2d');minX-=5;minY-=5;ctx.lineJoin="round";ctx.strokeStyle="rgb(20, 20, 20)";ctx.lineWidth=size+1;ctx.beginPath();ctx.moveTo(coordinates[0]-minX,coordinates[1]-minY);for(i=2;i<coordinates.length;i+=2){ctx.lineTo(coordinates[i]-minX,coordinates[i+1]-minY);}
67ctx.stroke();ctx.lineJoin="round";ctx.strokeStyle="rgb(0, 0, 0)";ctx.lineWidth=size+1;ctx.beginPath();ctx.moveTo(coordinates[0]-minX,coordinates[1]-minY);for(i=2;i<coordinates.length;i+=2){ctx.lineTo(coordinates[i]-minX,coordinates[i+1]-minY);}
68ctx.stroke();ctx.lineJoin="round";ctx.strokeStyle=color;ctx.lineWidth=size-1;ctx.beginPath();ctx.moveTo(coordinates[0]-minX,coordinates[1]-minY);for(i=2;i<coordinates.length;i+=2){ctx.lineTo(coordinates[i]-minX,coordinates[i+1]-minY);}
69ctx.stroke();}
70function drawINPLink(pos,size,nas,color){var linkname="canvas"+pos.replace(/(#|&|_|\.|\:)/gi,"");var points=new Array();var posxy=new Array();var coordinates=new Array();var cor_x=new Array();var cor_y=new Array();points=pos.split('#');var reg=/(\d+)&(\d+)/;for(i=0;i<points.length;i++){if(reg.test(points[i])){posxy=points[i].split('&');coordinates[i*2]=parseInt(posxy[0]*nas);coordinates[i*2+1]=parseInt(posxy[1]*nas);cor_x.push(coordinates[i*2]);cor_y.push(coordinates[i*2+1]);}else{coordinates[i*2]=parseInt(node2sour(points[i],1)*nas);coordinates[i*2+1]=parseInt(node2sour(points[i],2)*nas);cor_x.push(coordinates[i*2]);cor_y.push(coordinates[i*2+1]);}}
71var maxX=cor_x.max();var minX=cor_x.min();var maxY=cor_y.max();var minY=cor_y.min();if(is_adding){if(!mainMap.addNewLinks(minX,maxX,minY,maxY,linkname))return;}else{if(!mainMap.removeOldLinks(minX,maxX,minY,maxY,linkname))return;}
72numoflinks++;actual_links=actual_links+linkname+" ";var canvas=document.createElement("canvas");canvas.width=maxX-minX+10;canvas.height=maxY-minY+10;canvas.id=linkname;if(is_ie){var div=document.createElement("div");div.style.width=maxX-minX+10+"px";div.style.height=maxY-minY+10+"px";div.style.position="absolute";div.style.left=(minX-5)+"px";div.style.top=(minY-5)+"px";div.appendChild(canvas);div_paint.appendChild(div);G_vmlCanvasManager.initElement(canvas);}else{canvas.setAttribute("style","position:absolute;left:"+(minX-5)+"px;top:"+(minY-5)+"px;");div_paint.appendChild(canvas);}
73var ctx=document.getElementById(linkname).getContext('2d');minX-=5;minY-=5;ctx.lineJoin="round";ctx.strokeStyle="rgba(0, 0, 0, 0.1)";ctx.lineWidth=size+1.5;ctx.beginPath();ctx.moveTo(coordinates[0]-minX,coordinates[1]-minY);for(i=2;i<coordinates.length;i+=2){ctx.lineTo(coordinates[i]-minX,coordinates[i+1]-minY);}
74ctx.stroke();ctx.lineJoin="round";ctx.strokeStyle=color;ctx.lineWidth=size+0.5;ctx.beginPath();ctx.moveTo(coordinates[0]-minX,coordinates[1]-minY);for(i=2;i<coordinates.length;i+=2){ctx.lineTo(coordinates[i]-minX,coordinates[i+1]-minY);}
75ctx.stroke();}
76function checkLinks(){if(file_links.length>0){pozdrav3=file_links.split('\n');var p3count=pozdrav3.length;for(a=0;a<p3count;a++){if(pozdrav3[a]!=false){pozdrav4=pozdrav3[a].split(';');if(pozdrav4[1].toLowerCase()=="backbone"){size=4.1;}else{size=2.7;}
77if(pozdrav4[2].toLowerCase()!="inp"){if(pozdrav4[3]==1){clrlnk=wifi_client;m1=1;}
78else if(pozdrav4[3]==2){clrlnk=wifi_backbone;m2=1;}
79else if(pozdrav4[3]==3){clrlnk=eth_100;m3=1;}
80else if(pozdrav4[3]==4){clrlnk=fso;m4=1;}
81else if(pozdrav4[3]==5){clrlnk=fso_backup;m5=1;}
82else if(pozdrav4[3]==6){clrlnk=ghz5;m6=1;}
83else if(pozdrav4[3]==7){clrlnk=ghz10;m7=1;}
84else if(pozdrav4[3]==8){clrlnk=fiber;m8=1;}
85else{clrlnk=other;m9=1;}}else{if(pozdrav4[3]==1){clrlnk=wifi_client_a;m1_a=1;}
86else if(pozdrav4[3]==2){clrlnk=wifi_backbone_a;m2_a=1;}
87else if(pozdrav4[3]==3){clrlnk=eth_100_a;m3_a=1;}
88else if(pozdrav4[3]==4){clrlnk=fso_a;m4_a=1;}
89else if(pozdrav4[3]==5){clrlnk=fso_backup_a;m5_a=1;}
90else if(pozdrav4[3]==6){clrlnk=ghz5_a;m6_a=1;}
91else if(pozdrav4[3]==7){clrlnk=ghz10_a;m7_a=1;}
92else if(pozdrav4[3]==8){clrlnk=fiber_a;m8_a=1;}
93else{clrlnk=other_a;m9_a=1;}}
94if(pozdrav4[2].toLowerCase()!="inp"){if((ch_backbone&&size==4.1)||(ch_client&&size==2.7)){drawLink(pozdrav4[0],size,ann,clrlnk);}}else{if(ch_inp){drawINPLink(pozdrav4[0],size-1,ann,clrlnk);}}}}}}
95function drawNode(xo,yo,nas,img){xo=parseInt((xo*nas)-7);yo=parseInt((yo*nas)-7);var text='<div class="node" style="position:absolute;left:'+xo+'px;top:'+yo+'px;background:url(\''+img+'.png\');" unselectable = "on"></div>';div_points.innerHTML+=text;}
96function drawAP(xn,yn,nas){xn=parseInt((xn*nas)-31);yn=parseInt((yn*nas)-17);var text='<div class="ap" style="position:absolute;left:'+xn+'px;top:'+yn+'px;" unselectable = "on"></div>';div_wave.innerHTML+=text;}
97function drawClient(xc,yc,nas){xc=parseInt((xc*nas)-7);yc=parseInt((yc*nas)-7);var text='<div class="client" style="position:absolute;left:'+xc+'px;top:'+yc+'px;" unselectable = "on"></div>';div_wave.innerHTML+=text;}
98function drawSwitch(xs,ys,nas){xs=parseInt((xs*nas)-6);ys=parseInt((ys*nas)-6);var text='<div class="switch" style="position:absolute;left:'+xs+'px;top:'+ys+'px;" unselectable = "on"></div>';div_wave.innerHTML+=text;}
99function drawInfoPoint(xl,yl,nas){xl=parseInt((xl*nas)-7);yl=parseInt((yl*nas)-7);var text='<div class="infopoint" style="position:absolute;left:'+xl+'px;top:'+yl+'px;" unselectable = "on"></div>';div_wave.innerHTML+=text;}
100function drawInfo(txt,xa,ya,nas){xa=parseInt((xa*nas)+6);ya=parseInt((ya*nas)-13);var text='<div class="stitek" style="position:absolute;left:'+xa+'px;top:'+ya+'px;" unselectable = "on">'+txt+'</div>';div_infopoint.innerHTML+=text;}
101function drawName(txt,xa,ya,nas){xa=parseInt((xa*nas)+6);ya=parseInt((ya*nas)-13);var text='<div class="stitek" style="position:absolute;left:'+xa+'px;top:'+ya+'px;" unselectable = "on">'+txt+'</div>';div_name.innerHTML+=text;}
102function drawIP(txt,xb,yb,nas){xb=parseInt((xb*nas)+6);yb=parseInt((yb*nas)-1);var text='<div class="stitek" style="position:absolute;left:'+xb+'px;top:'+yb+'px;" unselectable = "on">'+txt+'</div>';div_ip.innerHTML+=text;}
103function drawStatus(txt,xc,yc,nas){xc=parseInt((xc*nas)+6);yc=parseInt((yc*nas)+11);var text='<div class="stitek" style="position:absolute;left:'+xc+'px;top:'+yc+'px;" unselectable = "on">'+txt+'</div>';div_status.innerHTML+=text;}
104function drawLegendText(txt){document.getElementById("mapstats_legend").innerHTML='<div class="legend" unselectable = "on">'+txt+'</div>';}
105function drawLegend(){var epsilon;var cislo=0;var name="";var paintlegend=document.getElementById('paintlegend');paintlegend.height=(((cntm-1)*12)+13);paintlegend.width="25";var ctx=paintlegend.getContext('2d');ctx.clearRect(0,0,25,((cntm-1)*12)+13);if(m1==1){epsilon=((cislo*12)+5);drawLegendLink(epsilon,wifi_client,2.7);name=name+name1+"<br/>";cislo++;}
106if(m2==1){epsilon=((cislo*12)+5);drawLegendLink(epsilon,wifi_backbone,4.1);name=name+name2+"<br/>";cislo++;}
107if(m3==1){epsilon=((cislo*12)+5);drawLegendLink(epsilon,eth_100,4.1);name=name+name3+"<br/>";cislo++;}
108if(m4==1){epsilon=((cislo*12)+5);drawLegendLink(epsilon,fso,4.1);name=name+name4+"<br/>";cislo++;}
109if(m5==1){epsilon=((cislo*12)+5);drawLegendLink(epsilon,fso_backup,4.1);name=name+name5+"<br/>";cislo++;}
110if(m6==1){epsilon=((cislo*12)+5);drawLegendLink(epsilon,ghz5,4.1);name=name+name6+"<br/>";cislo++;}
111if(m7==1){epsilon=((cislo*12)+5);drawLegendLink(epsilon,ghz10,4.1);name=name+name7+"<br/>";cislo++;}
112if(m8==1){epsilon=((cislo*12)+5);drawLegendLink(epsilon,fiber,4.1);name=name+name8+"<br/>";cislo++;}
113if(m9==1){epsilon=((cislo*12)+5);drawLegendLink(epsilon,other,4.1);name=name+name9+"<br/>";cislo++;}
114if(m1_a==1){epsilon=((cislo*12)+5);drawLegendINPLink(epsilon,wifi_client_a,2.7);name=name+name1+" "+inp+"<br/>";cislo++;}
115if(m2_a==1){epsilon=((cislo*12)+5);drawLegendINPLink(epsilon,wifi_backbone_a,4.1);name=name+name2+" "+inp+"<br/>";cislo++;}
116if(m3_a==1){epsilon=((cislo*12)+5);drawLegendINPLink(epsilon,eth_100_a,4.1);name=name+name3+" "+inp+"<br/>";cislo++;}
117if(m4_a==1){epsilon=((cislo*12)+5);drawLegendINPLink(epsilon,fso_a,4.1);name=name+name4+" "+inp+"<br/>";cislo++;}
118if(m5_a==1){epsilon=((cislo*12)+5);drawLegendINPLink(epsilon,fso_backup_a,4.1);name=name+name5+" "+inp+"<br/>";cislo++;}
119if(m6_a==1){epsilon=((cislo*12)+5);drawLegendINPLink(epsilon,ghz5_a,4.1);name=name+name6+" "+inp+"<br/>";cislo++;}
120if(m7_a==1){epsilon=((cislo*12)+5);drawLegendINPLink(epsilon,ghz10_a,4.1);name=name+name7+" "+inp+"<br/>";cislo++;}
121if(m8_a==1){epsilon=((cislo*12)+5);drawLegendINPLink(epsilon,fiber_a,4.1);name=name+name8+" "+inp+"<br/>";cislo++;}
122if(m9_a==1){epsilon=((cislo*12)+5);drawLegendINPLink(epsilon,other_a,4.1);name=name+name9+" "+inp+"<br/>";}
123drawLegendText(name);}
124function drawLegendLink(yg,color,size){var ctx=document.getElementById('paintlegend').getContext('2d');ctx.strokeStyle="rgb(20, 20, 20)";ctx.lineWidth=size+1;ctx.beginPath();ctx.moveTo(1,yg);ctx.lineTo(24,yg);ctx.stroke();ctx.strokeStyle="rgb(0, 0, 0)";ctx.lineWidth=size;ctx.beginPath();ctx.moveTo(1,yg);ctx.lineTo(24,yg);ctx.stroke();ctx.strokeStyle=color;ctx.lineWidth=size-1;ctx.beginPath();ctx.moveTo(1,yg);ctx.lineTo(24,yg);ctx.stroke();}
125function drawLegendINPLink(yg,color,size){var ctx=document.getElementById('paintlegend').getContext('2d');ctx.strokeStyle="rgba(255, 255, 255, 0.5)";ctx.lineWidth=size;ctx.beginPath();ctx.moveTo(1,yg);ctx.lineTo(24,yg);ctx.stroke();ctx.strokeStyle="rgba(0, 0, 0, 0.1)";ctx.lineWidth=size;ctx.beginPath();ctx.moveTo(1,yg);ctx.lineTo(24,yg);ctx.stroke();ctx.strokeStyle=color;ctx.lineWidth=size-0.5;ctx.beginPath();ctx.moveTo(1,yg);ctx.lineTo(24,yg);ctx.stroke();}
126function clearMap(){div_paint.innerHTML="";}
127function node2sour(name,pos){var ok=0;for(k=0;k<nodecount;k++){if(node[k][0]==name){ok=node[k][pos];}
128if(ok!=0){return ok;}}
129return ok;}
130function ip2sour(ip,pos){var ok=0;for(k=0;k<nodecount;k++){if(node[k][4]==ip){ok=node[k][pos];}
131if(ok!=0){return ok;}}
132return ok;}
133function loadFiles(){var d=new Date();var tm=d.getTime();file_nodes=getFile(nodes+"?"+tm);file_noping=getFile(noping+"?"+tm);file_links=getFile(links+"?"+tm);file_infopoints=getFile(infopoints+"?"+tm);file_state=getFile(state+"?"+tm);redrawUpdate();}
134function getFile(url){AJAX=(window.XMLHttpRequest?new XMLHttpRequest():(window.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):false));if(AJAX){AJAX.open("GET",url,false);AJAX.setRequestHeader("Cache-Control","no-store");AJAX.setRequestHeader("Cache-Control","no-cache");AJAX.setRequestHeader("Cache-Control","must-revalidate");AJAX.setRequestHeader("Pragma","no-cache");AJAX.send(null);return AJAX.responseText;}else{return false;}}
135function setAutoLoader(){setInterval("loadFiles()",2*60*1000);}
136function setCheckboxes(){document.form_map.ch_ap.checked=ch_ap;document.form_map.ch_router.checked=ch_router;document.form_map.ch_node.checked=ch_node;document.form_map.ch_infopoint.checked=ch_infopoint;document.form_map.ch_noping.checked=ch_noping;document.form_map.ch_legend.checked=ch_legend;document.form_map.ch_name.checked=ch_name;document.form_map.ch_ip.checked=ch_ip;document.form_map.ch_status.checked=ch_status;document.form_map.ch_backbone.checked=ch_backbone;document.form_map.ch_client.checked=ch_client;document.form_map.ch_inp.checked=ch_inp;}
137function deleteNames(){div_paint.innerHTML="";div_points.innerHTML="";div_wave.innerHTML="";div_infopoint.innerHTML="";div_name.innerHTML="";div_ip.innerHTML="";div_status.innerHTML="";document.getElementById("mapstats_legend").innerHTML="";}
138function reDraw(){if(document.form_map.ch_ap.checked){ch_ap=true;}else{ch_ap=false;}
139if(document.form_map.ch_router.checked){ch_router=true;}else{ch_router=false;}
140if(document.form_map.ch_node.checked){ch_node=true;}else{ch_node=false;}
141if(document.form_map.ch_infopoint.checked){ch_infopoint=true;}else{ch_infopoint=false;}
142if(document.form_map.ch_noping.checked){ch_noping=true;}else{ch_noping=false;}
143if(document.form_map.ch_legend.checked){ch_legend=true;}else{ch_legend=false;}
144if(document.form_map.ch_name.checked){ch_name=true;}else{ch_name=false;}
145if(document.form_map.ch_ip.checked){ch_ip=true;}else{ch_ip=false;}
146if(document.form_map.ch_status.checked){ch_status=true;}else{ch_status=false;}
147if(document.form_map.ch_backbone.checked){ch_backbone=true;}else{ch_backbone=false;}
148if(document.form_map.ch_client.checked){ch_client=true;}else{ch_client=false;}
149if(document.form_map.ch_inp.checked){ch_inp=true;}else{ch_inp=false;}
150deleteNames();clearMap();canvasInit(ann);}
151function changeOpacity(opc){var opcprc=opc/100;var mapstats_update=document.getElementById("mapstats_update");if(is_ie){mapstats_update.style.filter='alpha(opacity='+opc+');';}else{mapstats_update.style.setProperty("-moz-opacity",opcprc,null);mapstats_update.style.setProperty("opacity",opcprc,null);}}
152function changeUpdate(){var promenna=new Date();var rok=promenna.getFullYear();var mesic=""+(promenna.getMonth()+1);var den=""+(promenna.getDate());var hodin=""+(promenna.getHours());var minut=""+(promenna.getMinutes());var sekund=""+(promenna.getSeconds());if(mesic.length==1){mesic="0"+mesic;}
153if(den.length==1){den="0"+den;}
154if(hodin.length==1){hodin="0"+hodin;}
155if(minut.length==1){minut="0"+minut;}
156if(sekund.length==1){sekund="0"+sekund;}
157document.getElementById("mapstats_update").innerHTML=den+". "+mesic+". "+rok+" "+hodin+":"+minut+":"+sekund;}
158function redrawUpdate(){setTimeout("changeOpacity(90)",100);setTimeout("changeOpacity(80)",200);setTimeout("changeOpacity(70)",300);setTimeout("changeOpacity(60)",400);setTimeout("changeOpacity(50)",500);setTimeout("changeOpacity(40)",600);setTimeout("changeOpacity(30)",700);setTimeout("changeOpacity(20)",800);setTimeout("changeOpacity(10)",900);setTimeout("changeOpacity(0)",1000);setTimeout("changeUpdate()",1050);setTimeout("changeOpacity(10)",1100);setTimeout("changeOpacity(20)",1200);setTimeout("changeOpacity(30)",1300);setTimeout("changeOpacity(40)",1400);setTimeout("changeOpacity(50)",1500);setTimeout("changeOpacity(60)",1600);setTimeout("changeOpacity(70)",1700);setTimeout("changeOpacity(80)",1800);setTimeout("changeOpacity(90)",1900);setTimeout("changeOpacity(100)",2000);}

Powered by WebSVN 2.2.1