// -------------------------------------------------------- // This script made JKLIR as. Unreal][ [http://jklir.net] // Map engine originally from Emcee Lam [http://sjsutech.com] // Licence: GNU/GPL // (c) 2008 All rights reserved // -------------------------------------------------------- var mainMap; var magnifier; if (navigator.appName=="Microsoft Internet Explorer") { var imgon = new Image(); imgon.src = 'on.png'; var imgoff = new Image(); imgoff.src = 'off.png'; var imginfo = new Image(); imginfo.src = 'info.png'; var imgap = new Image(); imgap.src = 'ap.png'; var imgcn = new Image(); imgcn.src = 'client.png'; var imgsw = new Image(); imgsw.src = 'switch.png'; } var node = new Array(); var nodecount; var pozdrav8 = new Array(); var pomocna = new Array(); var pomocna1 = new Array(); var pomocna2 = new Array(); var pomocna3 = new Array(); var pomocna4 = new Array(); var ann; var m1; var m2; var m3; var m4; var m5; var m6; var m7; var m8; var m9; var m1_a; var m2_a; var m3_a; var m4_a; var m5_a; var m6_a; var m7_a; var m8_a; var m9_a; var cntm; function 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; } // for IE } function Magnifier () { var this1 = this; this.f_dragging = false; this.div = document.getElementById("magnifier"); this.div.ondragstart = function() { return false; } // for IE this.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) }; } Magnifier.prototype.startMove = function (event) { // for IE if (!event) event = window.event; var magnifierDiv = document.getElementById("magnifier"); //var magnifierDiv = this.div; this.dragStartLeft = event.clientX; this.dragStartTop = event.clientY; //magnifierDiv.style.cursor = "move"; this.top = magnifierDiv.offsetTop; this.left = magnifierDiv.offsetLeft; this.f_dragging = true; return false; } /* As you drag the mouse in the mini map, the magnifier responds by moving. Likewise, the main map will show the current area enclosed by the magnifier. */ Magnifier.prototype.processMove = function (event) { var magnifierDiv = this.div; if (!event) event = window.event; // for IE 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; // map is not infinite if (shiftedLeft > maxX) shiftedLeft = maxX; magnifierDiv.style.left = shiftedLeft + "px"; var shiftedTop = this.top + (event.clientY - this.dragStartTop); if (shiftedTop < minY) shiftedTop = minY; // map is not infinite if (shiftedTop > maxY) shiftedTop = maxY; magnifierDiv.style.top = shiftedTop + "px"; mainMap.setViewPort(); } } Magnifier.prototype.stopMove = function (event) { //this.div.style.cursor = ""; this.f_dragging = false; } Magnifier.prototype.setSize = function (innerDivWidth, innerDivHeight) { var magnifierWidth = Math.round((magres_x * inres_x) / innerDivWidth) - 2; // 200 * 700px /* We subtract 2 because the borders are 1 pixel each */ var magnifierHeight = Math.round((magres_y * inres_y) / innerDivHeight) - 2; // 141 * 500px /* We subtract 2 because the borders are 1 pixel each */ var magnifierDiv = document.getElementById("magnifier"); magnifierDiv.style.width = magnifierWidth + "px"; magnifierDiv.style.height = magnifierHeight + "px"; } Magnifier.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); // alter magnifier var magnifierDiv = this.div; magnifierDiv.style.left = this.left + "px"; magnifierDiv.style.top = this.top + "px"; } function MainMap (zoomfirst) { var this1 = this; // constants // view port is the visible portion of the main map this.viewPortWidth = inres_x; //500 this.viewPortHeight = inres_y; //400 this.tileSize = 256; this.f_dragging = false; this.innerDiv = document.getElementById("innerDiv"); this.innerDiv.style.cursor = "url(grab.cur), default"; 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; } // for IE var zf = 0; if(zoomfirst==eq_mini) { zf = 0; } if(zoomfirst==eq_medi) { zf = 1; } if(zoomfirst==eq_high) { zf = 2; } if(zoomfirst==eq_orig) { zf = 3; } this.zoom = zf; this.zoomDim = [ { width:parseInt(full_x * eq_mini), height:parseInt(full_y * eq_mini), size:1 }, { width:parseInt(full_x * eq_medi), height:parseInt(full_y * eq_medi), size:2 }, { width:parseInt(full_x * eq_high), height:parseInt(full_y * eq_high), size:3 }, { width:parseInt(full_x * eq_orig), height:parseInt(full_y * eq_orig), size:4 }, ] var zoomElt = this.zoomDim[this.zoom]; this.setInnerDivSize (zoomElt.width, zoomElt.height, zoomElt.size, (parseInt(zoomfirst*1000)/10)); var innerDiv = document.getElementById("innerDiv"); innerDiv.style.left = -(start_left) + "px"; innerDiv.style.top = -(start_top) + "px"; magnifier.setPosition(); this.checkTiles(); } MainMap.prototype.startMove = function (event) { // for IE 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; return false; } MainMap.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; // for IE var innerDiv = this.innerDiv; if (this.f_dragging) { var shiftedTop = this.top + (event.clientY - this.dragStartTop); if (shiftedTop > maxY) shiftedTop = maxY; // map is not infinite if (shiftedTop < minY) shiftedTop = minY; innerDiv.style.top = shiftedTop + "px"; var shiftedLeft = this.left + (event.clientX - this.dragStartLeft); if (shiftedLeft > maxX) shiftedLeft = maxX; // map is not infinite if (shiftedLeft < minX) shiftedLeft = minX; innerDiv.style.left = shiftedLeft + "px"; this.checkTiles(); magnifier.setPosition(); } var nasbek; var konst = 0; if(this.zoom==0) { nasbek = eq_mini; } if(this.zoom==1) { nasbek = eq_medi; } if(this.zoom==2) { nasbek = eq_high; } if(this.zoom==3) { nasbek = eq_orig; } if (navigator.appName=="Microsoft Internet Explorer") { konst = -2; } var outerDiv = document.getElementById("outerDiv"); var infoDiv = document.getElementById("infoDiv"); if (this.f_dragging) { infoDiv.innerHTML = parseInt((Math.abs(shiftedLeft) + event.clientX - outerDiv.offsetLeft + konst)/nasbek) + " x " + parseInt((Math.abs(shiftedTop) + event.clientY - outerDiv.offsetTop + konst)/nasbek); } else { infoDiv.innerHTML = parseInt((Math.abs(parseInt(innerDiv.style.left)) + event.clientX - outerDiv.offsetLeft + konst)/nasbek) + " x " + parseInt((Math.abs(parseInt(innerDiv.style.top)) + event.clientY - outerDiv.offsetTop + konst)/nasbek); } } MainMap.prototype.checkZoom = function () { 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; } // map is not infinite if (shiftedTop < minY) { shiftedTop = minY; chcky = 1; } if (chcky == 1) innerDiv.style.top = shiftedTop + "px"; var shiftedLeft = innerDiv.offsetLeft; if (shiftedLeft > maxX) { shiftedLeft = maxX; chckx = 1; }// map is not infinite if (shiftedLeft < minX) { shiftedLeft = minX; chckx = 1; } if (chckx == 1) innerDiv.style.left = shiftedLeft + "px"; magnifier.setPosition(); } MainMap.prototype.checkTiles = function () { var innerDiv = this.innerDiv; var tileSize = this.tileSize; var visibleTiles = this.getVisibleTiles(); var visibleTilesMap = {}; var i; var size = this.zoomDim[this.zoom].size; for (i=0;i 0) { innerDiv.removeChild(imgs[0]); } var oldLeft = innerDiv.offsetLeft; var oldTop = innerDiv.offsetTop; var wdth = Math.round(((magres_x * inres_x) / newZ.width) - 2); // 200 * 700px var hght = Math.round(((magres_y * inres_y) / newZ.height) - 2); // 141 * 500px var wdth2 = Math.round(((magres_x * inres_x) / oldZ.width) - 2); // 200 * 700px var hght2 = Math.round(((magres_y * inres_y) / oldZ.height) - 2); // 141 * 500px var newLeft = Math.round(newZ.width * oldLeft / oldZ.width); var newTop = Math.round(newZ.height * oldTop / oldZ.height); if (this.zoom < newZoom) { newLeft = Math.round(newLeft + ((wdth-wdth2)*4)); newTop = Math.round(newTop + ((hght-hght2)*4)); } if (this.zoom > newZoom) { newLeft = Math.round(newLeft + ((wdth-wdth2)*4)); newTop = Math.round(newTop + ((hght-hght2)*4)); } innerDiv.style.left = newLeft + "px"; innerDiv.style.top = newTop + "px"; this.zoom = newZoom; // set the global zoom var nasobek; if(this.zoom==0) { nasobek = eq_mini; } if(this.zoom==1) { nasobek = eq_medi; } if(this.zoom==2) { nasobek = eq_high; } if(this.zoom==3) { nasobek = eq_orig; } this.setInnerDivSize(newZ.width, newZ.height, newZ.size, (nasobek*1000)/10); this.checkZoom(); this.checkTiles(); titulek1 = document.getElementById("mapstats_infopoint"); titulek2 = document.getElementById("mapstats_name"); titulek3 = document.getElementById("mapstats_ip"); titulek4 = document.getElementById("mapstats_status"); titulek5 = document.getElementById("mapstats_legend"); titulek6 = document.getElementById("mapstats_wave"); titulek7 = document.getElementById("mapstats_points"); titulek1.innerHTML = ""; titulek2.innerHTML = ""; titulek3.innerHTML = ""; titulek4.innerHTML = ""; titulek5.innerHTML = ""; titulek6.innerHTML = ""; titulek7.innerHTML = ""; canvasInit(nasobek); } MainMap.prototype.doubleClick = function () { if (this.zoom == 3) return; var stara = this.zoom; stara = stara + 1; this.setZoom(stara); } function canvasInit(nasobek) { var canvas_id1 = document.getElementById("paint"); canvas_id1.width = parseInt(full_x*nasobek); canvas_id1.height = parseInt(full_y*nasobek); if (navigator.appName=="Microsoft Internet Explorer") { var canvas_id2 = document.getElementById("paint2"); canvas_id2.width = parseInt(full_x*nasobek); canvas_id2.height = parseInt(full_y*nasobek); } ann = nasobek; var pozdrav = new Array(); var pozdrav1 = new Array(); var pozdrav2 = new Array(); var pozdr = new Array(); pozdrav = pomocna.split('\n'); pozdrav1 = pomocna1.split('\n'); var a_cnt = 0; var p0count = pozdrav.length; var p1count = pozdrav1.length; for(a=0;a0) { pozdrav3 = pomocna2.split('\n'); var p3count = pozdrav3.length; for(a=0;a0) { pozdrav5 = pomocna3.split('\n'); for(d=0;d0)) { drawLegend(); legend.style.display = "block"; } else { legend.style.display = "none"; } } function drawLink(pos, size, nas, color) { var ctx = document.getElementById('paint').getContext('2d'); var points = new Array(); var posxy = new Array(); var coordinates = new Array(); points = pos.split('#'); var reg=/(\d+)&(\d+)/; for(i=0;i'; titulek = document.getElementById("mapstats_points"); titulek.innerHTML = titulek.innerHTML + text; } } function drawAP(xn, yn, nas) { xn = parseInt((xn*nas)-31); yn = parseInt((yn*nas)-17); if (navigator.appName=="Microsoft Internet Explorer") { var ctx = document.getElementById('paint').getContext('2d'); ctx.drawImage(imgap,xn,yn); } else { var text = '
'; titulek = document.getElementById("mapstats_wave"); titulek.innerHTML = titulek.innerHTML + text; } } function drawClient(xc, yc, nas) { xc = parseInt((xc*nas)-7); yc = parseInt((yc*nas)-7); if (navigator.appName=="Microsoft Internet Explorer") { var ctx = document.getElementById('paint').getContext('2d'); ctx.drawImage(imgcn,xc,yc); } else { var text = '
'; titulek = document.getElementById("mapstats_wave"); titulek.innerHTML = titulek.innerHTML + text; } } function drawSwitch(xs, ys, nas) { xs = parseInt((xs*nas)-6); ys = parseInt((ys*nas)-6); if (navigator.appName=="Microsoft Internet Explorer") { var ctx = document.getElementById('paint').getContext('2d'); ctx.drawImage(imgsw,xs,ys); } else { var text = '
'; titulek = document.getElementById("mapstats_wave"); titulek.innerHTML = titulek.innerHTML + text; } } function drawInfoPoint(xl, yl, nas) { xl = parseInt((xl*nas)-7); yl = parseInt((yl*nas)-7); if (navigator.appName=="Microsoft Internet Explorer") { var ctx = document.getElementById('paint').getContext('2d'); ctx.drawImage(imginfo,xl,yl); } else { var text = '
'; titulek = document.getElementById("mapstats_wave"); titulek.innerHTML = titulek.innerHTML + text; } } function 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.9); name = name + name1 + "
"; cislo++; } if(m2==1) { epsilon = ((cislo*12)+5); drawLegendLink(epsilon,wifi_backbone,4.5); name = name + name2 + "
"; cislo++; } if(m3==1) { epsilon = ((cislo*12)+5); drawLegendLink(epsilon,eth_100,4.5); name = name + name3 + "
"; cislo++; } if(m4==1) { epsilon = ((cislo*12)+5); drawLegendLink(epsilon,fso,4.5); name = name + name4 + "
"; cislo++; } if(m5==1) { epsilon = ((cislo*12)+5); drawLegendLink(epsilon,fso_backup,4.5); name = name + name5 + "
"; cislo++; } if(m6==1) { epsilon = ((cislo*12)+5); drawLegendLink(epsilon,ghz5,4.5); name = name + name6 + "
"; cislo++; } if(m7==1) { epsilon = ((cislo*12)+5); drawLegendLink(epsilon,ghz10,4.5); name = name + name7 + "
"; cislo++; } if(m8==1) { epsilon = ((cislo*12)+5); drawLegendLink(epsilon,fiber,4.5); name = name + name8 + "
"; cislo++; } if(m9==1) { epsilon = ((cislo*12)+5); drawLegendLink(epsilon,other,4.5); name = name + name9 + "
"; cislo++; } if(m1_a==1) { epsilon = ((cislo*12)+5); drawLegendINPLink(epsilon,wifi_client_a,2.9); name = name + name1 + " " + inp + "
"; cislo++; } if(m2_a==1) { epsilon = ((cislo*12)+5); drawLegendINPLink(epsilon,wifi_backbone_a,4.5); name = name + name2 + " " + inp + "
"; cislo++; } if(m3_a==1) { epsilon = ((cislo*12)+5); drawLegendINPLink(epsilon,eth_100_a,4.5); name = name + name3 + " " + inp + "
"; cislo++; } if(m4_a==1) { epsilon = ((cislo*12)+5); drawLegendINPLink(epsilon,fso_a,4.5); name = name + name4 + " " + inp + "
"; cislo++; } if(m5_a==1) { epsilon = ((cislo*12)+5); drawLegendINPLink(epsilon,fso_backup_a,4.5); name = name + name5 + " " + inp + "
"; cislo++; } if(m6_a==1) { epsilon = ((cislo*12)+5); drawLegendINPLink(epsilon,ghz5_a,4.5); name = name + name6 + " " + inp + "
"; cislo++; } if(m7_a==1) { epsilon = ((cislo*12)+5); drawLegendINPLink(epsilon,ghz10_a,4.5); name = name + name7 + " " + inp + "
"; cislo++; } if(m8_a==1) { epsilon = ((cislo*12)+5); drawLegendINPLink(epsilon,fiber_a,4.5); name = name + name8 + " " + inp + "
"; cislo++; } if(m9_a==1) { epsilon = ((cislo*12)+5); drawLegendINPLink(epsilon,other_a,4.5); name = name + name9 + " " + inp + "
"; } drawLegendText(name); } function 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(); } function 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(); } function clearMap(ann) { var ctx = document.getElementById('paint').getContext('2d'); ctx.clearRect(0,0,parseInt(full_x * ann),parseInt(full_y * ann)); if (navigator.appName=="Microsoft Internet Explorer") { var ctx2 = document.getElementById('paint2').getContext('2d'); ctx2.clearRect(0,0,parseInt(full_x * ann),parseInt(full_y * ann)); } } function node2sour(name, pos) { var ok = 0; for(k=0;k' + txt + ''; titulek = document.getElementById("mapstats_infopoint"); titulek.innerHTML = titulek.innerHTML + text; } function drawName(txt, xa, ya, nas) { xa = parseInt((xa*nas)+6); ya = parseInt((ya*nas)-13); var text = '
' + txt + '
'; titulek = document.getElementById("mapstats_name"); titulek.innerHTML = titulek.innerHTML + text; } function drawIP(txt, xb, yb, nas) { xb = parseInt((xb*nas)+6); yb = parseInt((yb*nas)-1); var text = '
' + txt + '
'; titulek = document.getElementById("mapstats_ip"); titulek.innerHTML = titulek.innerHTML + text; } function drawStatus(txt, xc, yc, nas) { xc = parseInt((xc*nas)+6); yc = parseInt((yc*nas)+11); var text = '
' + txt + '
'; titulek = document.getElementById("mapstats_status"); titulek.innerHTML = titulek.innerHTML + text; } function drawLegendText(txt) { var text = '
' + txt + '
'; titulek = document.getElementById("mapstats_legend"); titulek.innerHTML = text; } function changeOpacity(opc) { var opcprc = opc / 100; var mapstats_update = document.getElementById("mapstats_update"); if (navigator.appName=="Microsoft Internet Explorer") { mapstats_update.style.filter = 'alpha(opacity=' + opc + ');'; } else { mapstats_update.style.setProperty("-moz-opacity",opcprc,null); mapstats_update.style.setProperty("opacity",opcprc,null); } } function 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; } if(den.length==1) { den = "0" + den; } if(hodin.length==1) { hodin = "0" + hodin; } if(minut.length==1) { minut = "0" + minut; } if(sekund.length==1) { sekund = "0" + sekund; } var mapstats_update = document.getElementById("mapstats_update"); mapstats_update.innerHTML = den + ". " + mesic + ". " + rok + " " + hodin + ":" + minut + ":" + sekund; } function 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); }// -------------------------------------------------------- // This script made JKLIR as. Unreal][ [http://jklir.net] // Map engine originally from Emcee Lam [http://sjsutech.com] // Licence: GNU/GPL // (c) 2008 All rights reserved // -------------------------------------------------------- var mainMap; var magnifier; if (navigator.appName=="Microsoft Internet Explorer") { var imgon = new Image(); imgon.src = 'on.png'; var imgoff = new Image(); imgoff.src = 'off.png'; var imginfo = new Image(); imginfo.src = 'info.png'; var imgap = new Image(); imgap.src = 'ap.png'; var imgcn = new Image(); imgcn.src = 'client.png'; var imgsw = new Image(); imgsw.src = 'switch.png'; } var node = new Array(); var nodecount; var pozdrav8 = new Array(); var pomocna = new Array(); var pomocna1 = new Array(); var pomocna2 = new Array(); var pomocna3 = new Array(); var pomocna4 = new Array(); var ann; var m1; var m2; var m3; var m4; var m5; var m6; var m7; var m8; var m9; var m1_a; var m2_a; var m3_a; var m4_a; var m5_a; var m6_a; var m7_a; var m8_a; var m9_a; var cntm; function 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; } // for IE } function Magnifier () { var this1 = this; this.f_dragging = false; this.div = document.getElementById("magnifier"); this.div.ondragstart = function() { return false; } // for IE this.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) }; } Magnifier.prototype.startMove = function (event) { // for IE if (!event) event = window.event; var magnifierDiv = document.getElementById("magnifier"); //var magnifierDiv = this.div; this.dragStartLeft = event.clientX; this.dragStartTop = event.clientY; //magnifierDiv.style.cursor = "move"; this.top = magnifierDiv.offsetTop; this.left = magnifierDiv.offsetLeft; this.f_dragging = true; return false; } /* As you drag the mouse in the mini map, the magnifier responds by moving. Likewise, the main map will show the current area enclosed by the magnifier. */ Magnifier.prototype.processMove = function (event) { var magnifierDiv = this.div; if (!event) event = window.event; // for IE 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; // map is not infinite if (shiftedLeft > maxX) shiftedLeft = maxX; magnifierDiv.style.left = shiftedLeft + "px"; var shiftedTop = this.top + (event.clientY - this.dragStartTop); if (shiftedTop < minY) shiftedTop = minY; // map is not infinite if (shiftedTop > maxY) shiftedTop = maxY; magnifierDiv.style.top = shiftedTop + "px"; mainMap.setViewPort(); } } Magnifier.prototype.stopMove = function (event) { //this.div.style.cursor = ""; this.f_dragging = false; } Magnifier.prototype.setSize = function (innerDivWidth, innerDivHeight) { var magnifierWidth = Math.round((magres_x * inres_x) / innerDivWidth) - 2; // 200 * 700px /* We subtract 2 because the borders are 1 pixel each */ var magnifierHeight = Math.round((magres_y * inres_y) / innerDivHeight) - 2; // 141 * 500px /* We subtract 2 because the borders are 1 pixel each */ var magnifierDiv = document.getElementById("magnifier"); magnifierDiv.style.width = magnifierWidth + "px"; magnifierDiv.style.height = magnifierHeight + "px"; } Magnifier.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); // alter magnifier var magnifierDiv = this.div; magnifierDiv.style.left = this.left + "px"; magnifierDiv.style.top = this.top + "px"; } function MainMap (zoomfirst) { var this1 = this; // constants // view port is the visible portion of the main map this.viewPortWidth = inres_x; //500 this.viewPortHeight = inres_y; //400 this.tileSize = 256; this.f_dragging = false; this.innerDiv = document.getElementById("innerDiv"); this.innerDiv.style.cursor = "url(grab.cur), default"; 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; } // for IE var zf = 0; if(zoomfirst==eq_mini) { zf = 0; } if(zoomfirst==eq_medi) { zf = 1; } if(zoomfirst==eq_high) { zf = 2; } if(zoomfirst==eq_orig) { zf = 3; } this.zoom = zf; this.zoomDim = [ { width:parseInt(full_x * eq_mini), height:parseInt(full_y * eq_mini), size:1 }, { width:parseInt(full_x * eq_medi), height:parseInt(full_y * eq_medi), size:2 }, { width:parseInt(full_x * eq_high), height:parseInt(full_y * eq_high), size:3 }, { width:parseInt(full_x * eq_orig), height:parseInt(full_y * eq_orig), size:4 }, ] var zoomElt = this.zoomDim[this.zoom]; this.setInnerDivSize (zoomElt.width, zoomElt.height, zoomElt.size, (parseInt(zoomfirst*1000)/10)); var innerDiv = document.getElementById("innerDiv"); innerDiv.style.left = -(start_left) + "px"; innerDiv.style.top = -(start_top) + "px"; magnifier.setPosition(); this.checkTiles(); } MainMap.prototype.startMove = function (event) { // for IE 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; return false; } MainMap.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; // for IE var innerDiv = this.innerDiv; if (this.f_dragging) { var shiftedTop = this.top + (event.clientY - this.dragStartTop); if (shiftedTop > maxY) shiftedTop = maxY; // map is not infinite if (shiftedTop < minY) shiftedTop = minY; innerDiv.style.top = shiftedTop + "px"; var shiftedLeft = this.left + (event.clientX - this.dragStartLeft); if (shiftedLeft > maxX) shiftedLeft = maxX; // map is not infinite if (shiftedLeft < minX) shiftedLeft = minX; innerDiv.style.left = shiftedLeft + "px"; this.checkTiles(); magnifier.setPosition(); } var nasobek; var konst = 0; if(this.zoom==0) { nasobek = eq_mini; } if(this.zoom==1) { nasobek = eq_medi; } if(this.zoom==2) { nasobek = eq_high; } if(this.zoom==3) { nasobek = eq_orig; } if (navigator.appName=="Microsoft Internet Explorer") { konst = -2; } var outerDiv = document.getElementById("outerDiv"); var infoDiv = document.getElementById("infoDiv"); 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); } MainMap.prototype.checkZoom = function () { 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; } // map is not infinite if (shiftedTop < minY) { shiftedTop = minY; chcky = 1; } if (chcky == 1) innerDiv.style.top = shiftedTop + "px"; var shiftedLeft = innerDiv.offsetLeft; if (shiftedLeft > maxX) { shiftedLeft = maxX; chckx = 1; }// map is not infinite if (shiftedLeft < minX) { shiftedLeft = minX; chckx = 1; } if (chcky == 1) innerDiv.style.left = shiftedLeft + "px"; magnifier.setPosition(); } MainMap.prototype.checkTiles = function () { var innerDiv = this.innerDiv; var tileSize = this.tileSize; var visibleTiles = this.getVisibleTiles(); var visibleTilesMap = {}; var i; var size = this.zoomDim[this.zoom].size; for (i=0;i 0) { innerDiv.removeChild(imgs[0]); } var oldLeft = innerDiv.offsetLeft; var oldTop = innerDiv.offsetTop; var wdth = Math.round(((magres_x * inres_x) / newZ.width) - 2); // 200 * 700px var hght = Math.round(((magres_y * inres_y) / newZ.height) - 2); // 141 * 500px var wdth2 = Math.round(((magres_x * inres_x) / oldZ.width) - 2); // 200 * 700px var hght2 = Math.round(((magres_y * inres_y) / oldZ.height) - 2); // 141 * 500px var newLeft = Math.round(newZ.width * oldLeft / oldZ.width); var newTop = Math.round(newZ.height * oldTop / oldZ.height); if (this.zoom < newZoom) { newLeft = Math.round(newLeft + ((wdth-wdth2)*4)); newTop = Math.round(newTop + ((hght-hght2)*4)); } if (this.zoom > newZoom) { newLeft = Math.round(newLeft + ((wdth-wdth2)*4)); newTop = Math.round(newTop + ((hght-hght2)*4)); } innerDiv.style.left = newLeft + "px"; innerDiv.style.top = newTop + "px"; this.zoom = newZoom; // set the global zoom var nasobek; if(this.zoom==0) { nasobek = eq_mini; } if(this.zoom==1) { nasobek = eq_medi; } if(this.zoom==2) { nasobek = eq_high; } if(this.zoom==3) { nasobek = eq_orig; } this.setInnerDivSize(newZ.width, newZ.height, newZ.size, (parseInt(nasobek*1000)/10)); this.checkZoom(); this.checkTiles(); titulek1 = document.getElementById("mapstats_infopoint"); titulek2 = document.getElementById("mapstats_name"); titulek3 = document.getElementById("mapstats_ip"); titulek4 = document.getElementById("mapstats_status"); titulek5 = document.getElementById("mapstats_legend"); titulek6 = document.getElementById("mapstats_wave"); titulek7 = document.getElementById("mapstats_points"); titulek1.innerHTML = ""; titulek2.innerHTML = ""; titulek3.innerHTML = ""; titulek4.innerHTML = ""; titulek5.innerHTML = ""; titulek6.innerHTML = ""; titulek7.innerHTML = ""; canvasInit(nasobek); } MainMap.prototype.doubleClick = function () { if (this.zoom == 3) return; var stara = this.zoom; stara = stara + 1; this.setZoom(stara); } function canvasInit(nasobek) { var canvas_id1 = document.getElementById("paint"); canvas_id1.width = parseInt(full_x*nasobek); canvas_id1.height = parseInt(full_y*nasobek); var canvas_id2 = document.getElementById("paint2"); canvas_id2.width = parseInt(full_x*nasobek); canvas_id2.height = parseInt(full_y*nasobek); ann = nasobek; var pozdrav = new Array(); var pozdrav1 = new Array(); var pozdrav2 = new Array(); var pozdr = new Array(); pozdrav = pomocna.split('\n'); pozdrav1 = pomocna1.split('\n'); var a_cnt = 0; var p0count = pozdrav.length; var p1count = pozdrav1.length; for(a=0;a0) { pozdrav3 = pomocna2.split('\n'); var p3count = pozdrav3.length; for(a=0;a0) { pozdrav5 = pomocna3.split('\n'); for(d=0;d0)) { drawLegend(); legend.style.display = "block"; } else { legend.style.display = "none"; } } function drawLink(pos, size, nas, color) { var ctx = document.getElementById('paint').getContext('2d'); var points = new Array(); var posxy = new Array(); var coordinates = new Array(); points = pos.split('#'); var reg=/(\d+)&(\d+)/; for(i=0;i'; titulek = document.getElementById("mapstats_points"); titulek.innerHTML = titulek.innerHTML + text; } } function drawAP(xn, yn, nas) { xn = parseInt((xn*nas)-31); yn = parseInt((yn*nas)-17); if (navigator.appName=="Microsoft Internet Explorer") { var ctx = document.getElementById('paint').getContext('2d'); ctx.drawImage(imgap,xn,yn); } else { var text = '
'; titulek = document.getElementById("mapstats_wave"); titulek.innerHTML = titulek.innerHTML + text; } } function drawClient(xc, yc, nas) { xc = parseInt((xc*nas)-7); yc = parseInt((yc*nas)-7); if (navigator.appName=="Microsoft Internet Explorer") { var ctx = document.getElementById('paint').getContext('2d'); ctx.drawImage(imgcn,xc,yc); } else { var text = '
'; titulek = document.getElementById("mapstats_wave"); titulek.innerHTML = titulek.innerHTML + text; } } function drawSwitch(xs, ys, nas) { xs = parseInt((xs*nas)-6); ys = parseInt((ys*nas)-6); if (navigator.appName=="Microsoft Internet Explorer") { var ctx = document.getElementById('paint').getContext('2d'); ctx.drawImage(imgsw,xs,ys); } else { var text = '
'; titulek = document.getElementById("mapstats_wave"); titulek.innerHTML = titulek.innerHTML + text; } } function drawInfoPoint(xl, yl, nas) { xl = parseInt((xl*nas)-7); yl = parseInt((yl*nas)-7); if (navigator.appName=="Microsoft Internet Explorer") { var ctx = document.getElementById('paint').getContext('2d'); ctx.drawImage(imginfo,xl,yl); } else { var text = '
'; titulek = document.getElementById("mapstats_wave"); titulek.innerHTML = titulek.innerHTML + text; } } function 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.9); name = name + name1 + "
"; cislo++; } if(m2==1) { epsilon = ((cislo*12)+5); drawLegendLink(epsilon,wifi_backbone,4.5); name = name + name2 + "
"; cislo++; } if(m3==1) { epsilon = ((cislo*12)+5); drawLegendLink(epsilon,eth_100,4.5); name = name + name3 + "
"; cislo++; } if(m4==1) { epsilon = ((cislo*12)+5); drawLegendLink(epsilon,fso,4.5); name = name + name4 + "
"; cislo++; } if(m5==1) { epsilon = ((cislo*12)+5); drawLegendLink(epsilon,fso_backup,4.5); name = name + name5 + "
"; cislo++; } if(m6==1) { epsilon = ((cislo*12)+5); drawLegendLink(epsilon,ghz5,4.5); name = name + name6 + "
"; cislo++; } if(m7==1) { epsilon = ((cislo*12)+5); drawLegendLink(epsilon,ghz10,4.5); name = name + name7 + "
"; cislo++; } if(m8==1) { epsilon = ((cislo*12)+5); drawLegendLink(epsilon,fiber,4.5); name = name + name8 + "
"; cislo++; } if(m9==1) { epsilon = ((cislo*12)+5); drawLegendLink(epsilon,other,4.5); name = name + name9 + "
"; cislo++; } if(m1_a==1) { epsilon = ((cislo*12)+5); drawLegendINPLink(epsilon,wifi_client_a,2.9); name = name + name1 + " " + inp + "
"; cislo++; } if(m2_a==1) { epsilon = ((cislo*12)+5); drawLegendINPLink(epsilon,wifi_backbone_a,4.5); name = name + name2 + " " + inp + "
"; cislo++; } if(m3_a==1) { epsilon = ((cislo*12)+5); drawLegendINPLink(epsilon,eth_100_a,4.5); name = name + name3 + " " + inp + "
"; cislo++; } if(m4_a==1) { epsilon = ((cislo*12)+5); drawLegendINPLink(epsilon,fso_a,4.5); name = name + name4 + " " + inp + "
"; cislo++; } if(m5_a==1) { epsilon = ((cislo*12)+5); drawLegendINPLink(epsilon,fso_backup_a,4.5); name = name + name5 + " " + inp + "
"; cislo++; } if(m6_a==1) { epsilon = ((cislo*12)+5); drawLegendINPLink(epsilon,ghz5_a,4.5); name = name + name6 + " " + inp + "
"; cislo++; } if(m7_a==1) { epsilon = ((cislo*12)+5); drawLegendINPLink(epsilon,ghz10_a,4.5); name = name + name7 + " " + inp + "
"; cislo++; } if(m8_a==1) { epsilon = ((cislo*12)+5); drawLegendINPLink(epsilon,fiber_a,4.5); name = name + name8 + " " + inp + "
"; cislo++; } if(m9_a==1) { epsilon = ((cislo*12)+5); drawLegendINPLink(epsilon,other_a,4.5); name = name + name9 + " " + inp + "
"; } drawLegendText(name); } function 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(); } function 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(); } function clearMap(ann) { var ctx = document.getElementById('paint').getContext('2d'); ctx.clearRect(0,0,parseInt(full_x * ann),parseInt(full_y * ann)); var ctx2 = document.getElementById('paint2').getContext('2d'); ctx2.clearRect(0,0,parseInt(full_x * ann),parseInt(full_y * ann)); } function node2sour(name, pos) { var ok = 0; for(k=0;k' + txt + ''; titulek = document.getElementById("mapstats_infopoint"); titulek.innerHTML = titulek.innerHTML + text; } function drawName(txt, xa, ya, nas) { xa = parseInt((xa*nas)+6); ya = parseInt((ya*nas)-13); var text = '
' + txt + '
'; titulek = document.getElementById("mapstats_name"); titulek.innerHTML = titulek.innerHTML + text; } function drawIP(txt, xb, yb, nas) { xb = parseInt((xb*nas)+6); yb = parseInt((yb*nas)-1); var text = '
' + txt + '
'; titulek = document.getElementById("mapstats_ip"); titulek.innerHTML = titulek.innerHTML + text; } function drawStatus(txt, xc, yc, nas) { xc = parseInt((xc*nas)+6); yc = parseInt((yc*nas)+11); var text = '
' + txt + '
'; titulek = document.getElementById("mapstats_status"); titulek.innerHTML = titulek.innerHTML + text; } function drawLegendText(txt) { var text = '
' + txt + '
'; titulek = document.getElementById("mapstats_legend"); titulek.innerHTML = text; } function changeOpacity(opc) { var opcprc = opc / 100; var mapstats_update = document.getElementById("mapstats_update"); if (navigator.appName=="Microsoft Internet Explorer") { mapstats_update.style.filter = 'alpha(opacity=' + opc + ');'; } else { mapstats_update.style.setProperty("-moz-opacity",opcprc,null); mapstats_update.style.setProperty("opacity",opcprc,null); } } function 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; } if(den.length==1) { den = "0" + den; } if(hodin.length==1) { hodin = "0" + hodin; } if(minut.length==1) { minut = "0" + minut; } if(sekund.length==1) { sekund = "0" + sekund; } var mapstats_update = document.getElementById("mapstats_update"); mapstats_update.innerHTML = den + ". " + mesic + ". " + rok + " " + hodin + ":" + minut + ":" + sekund; } function 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); } WebSVN - mapstats - Diff - Rev 6 and 5 - /mapstats.js
  jablonka.czprosek.czf

mapstats

Subversion Repositories:
[/] [mapstats.js] - Diff between revs 5 and 6

Show entire file Ignore whitespace

Rev 5 Rev 6

Powered by WebSVN 2.2.1