1 | 1 | unreal | // -------------------------------------------------------- |
2 | | | // This script made JKLIR as. Unreal][ [http://jklir.net] |
3 | 4 | unreal | // Map engine originally from Emcee Lam [http://sjsutech.com] |
4 | 1 | unreal | // Licence: GNU/GPL |
5 | | | // (c) 2008 All rights reserved |
6 | | | // -------------------------------------------------------- |
7 | | | |
8 | | | var mainMap; |
9 | | | var magnifier; |
10 | | | imgon = new Image(); |
11 | | | imgon.src = 'on.png'; |
12 | | | var imgoff = new Image(); |
13 | | | imgoff.src = 'off.png'; |
14 | | | var imginfo = new Image(); |
15 | | | imginfo.src = 'info.png'; |
16 | | | var imgap = new Image(); |
17 | | | imgap.src = 'ap.png'; |
18 | | | var imgcn = new Image(); |
19 | | | imgcn.src = 'client.png'; |
20 | | | var imgsw = new Image(); |
21 | | | imgsw.src = 'switch.png'; |
22 | | | |
23 | | | var node = new Array(); |
24 | | | var pozdrav8 = new Array(); |
25 | | | var pomocna = new Array(); |
26 | | | var pomocna1 = new Array(); |
27 | | | var pomocna2 = new Array(); |
28 | | | var pomocna3 = new Array(); |
29 | | | var pomocna4 = new Array(); |
30 | | | var ann; |
31 | | | var m1; |
32 | | | var m2; |
33 | | | var m3; |
34 | | | var m4; |
35 | | | var m5; |
36 | | | var m6; |
37 | | | var m7; |
38 | | | var m8; |
39 | | | var m9; |
40 | | | var m1_a; |
41 | | | var m2_a; |
42 | | | var m3_a; |
43 | | | var m4_a; |
44 | | | var m5_a; |
45 | | | var m6_a; |
46 | | | var m7_a; |
47 | | | var m8_a; |
48 | | | var m9_a; |
49 | | | var cntm; |
50 | | | |
51 | | | function mapInit(startzoom) { |
52 | | | magnifier = new Magnifier(); |
53 | | | mainMap = new MainMap(startzoom); |
54 | | | |
55 | | | var miniMapDiv = document.getElementById("miniMapInner"); |
56 | | | miniMapDiv.onmousedown |
57 | | | = function (event) { return magnifier.startMove(event) }; |
58 | | | miniMapDiv.onmousemove |
59 | | | = function (event) { return magnifier.processMove(event) }; |
60 | | | miniMapDiv.onmouseup |
61 | | | = function (event) { return magnifier.stopMove(event) }; |
62 | | | miniMapDiv.ondragstart = function() { return false; } // for IE |
63 | | | } |
64 | | | |
65 | | | function Magnifier () { |
66 | | | var this1 = this; |
67 | | | this.f_dragging = false; |
68 | | | this.div = document.getElementById("magnifier"); |
69 | | | this.div.ondragstart = function() { return false; } // for IE |
70 | | | this.div.onmousedown |
71 | | | = function (event) { return this1.startMove(event) }; |
72 | | | this.div.onmousemove |
73 | | | = function (event) { return this1.processMove(event) }; |
74 | | | this.div.onmouseup |
75 | | | = function (event) { return this1.stopMove(event) }; |
76 | | | } |
77 | | | |
78 | | | Magnifier.prototype.startMove = |
79 | | | function (event) { |
80 | | | // for IE |
81 | | | if (!event) |
82 | | | event = window.event; |
83 | | | |
84 | 4 | unreal | var magnifierDiv = document.getElementById("magnifier"); |
85 | | | //var magnifierDiv = this.div; |
86 | 1 | unreal | this.dragStartLeft = event.clientX; |
87 | | | this.dragStartTop = event.clientY; |
88 | 4 | unreal | //magnifierDiv.style.cursor = "move"; |
89 | 1 | unreal | |
90 | | | this.top = magnifierDiv.offsetTop; |
91 | | | this.left = magnifierDiv.offsetLeft; |
92 | | | |
93 | | | this.f_dragging = true; |
94 | | | return false; |
95 | | | } |
96 | | | |
97 | | | /* As you drag the mouse in the mini map, the magnifier responds by |
98 | | | moving. Likewise, the main map will show the current area |
99 | | | enclosed by the magnifier. */ |
100 | | | Magnifier.prototype.processMove = |
101 | | | function (event) { |
102 | | | var magnifierDiv = this.div; |
103 | | | |
104 | | | if (!event) event = window.event; // for IE |
105 | | | if (this.f_dragging) { |
106 | | | |
107 | | | var minX = 0; |
108 | | | var maxX = magres_x - magnifierDiv.offsetWidth; |
109 | | | var minY = 0; |
110 | | | var maxY = magres_y - magnifierDiv.offsetHeight; |
111 | | | |
112 | | | var shiftedLeft = this.left + (event.clientX - this.dragStartLeft); |
113 | | | if (shiftedLeft < minX) shiftedLeft = minX; // map is not infinite |
114 | | | if (shiftedLeft > maxX) shiftedLeft = maxX; |
115 | | | magnifierDiv.style.left = shiftedLeft + "px"; |
116 | | | |
117 | | | var shiftedTop = this.top + (event.clientY - this.dragStartTop); |
118 | | | if (shiftedTop < minY) shiftedTop = minY; // map is not infinite |
119 | | | if (shiftedTop > maxY) shiftedTop = maxY; |
120 | | | magnifierDiv.style.top = shiftedTop + "px"; |
121 | | | |
122 | | | mainMap.setViewPort(); |
123 | | | } |
124 | | | } |
125 | | | |
126 | | | Magnifier.prototype.stopMove = |
127 | | | function (event) { |
128 | 4 | unreal | //this.div.style.cursor = ""; |
129 | 1 | unreal | this.f_dragging = false; |
130 | | | } |
131 | | | |
132 | | | Magnifier.prototype.setSize = |
133 | | | function (innerDivWidth, innerDivHeight) { |
134 | | | var magnifierWidth = Math.round((magres_x * inres_x) / innerDivWidth) - 2; // 200 * 700px |
135 | | | /* We subtract 2 because the borders are 1 pixel each */ |
136 | | | var magnifierHeight = Math.round((magres_y * inres_y) / innerDivHeight) - 2; // 141 * 500px |
137 | | | /* We subtract 2 because the borders are 1 pixel each */ |
138 | | | var magnifierDiv = document.getElementById("magnifier"); |
139 | | | magnifierDiv.style.width = magnifierWidth + "px"; |
140 | | | magnifierDiv.style.height = magnifierHeight + "px"; |
141 | | | } |
142 | | | |
143 | | | Magnifier.prototype.setPosition = |
144 | | | function () { |
145 | | | var innerDiv = document.getElementById("innerDiv"); |
146 | | | var innerDivWidth = innerDiv.clientWidth; |
147 | | | var innerDivHeight = innerDiv.clientHeight; |
148 | | | var innerDivLeft = innerDiv.offsetLeft; |
149 | | | var innerDivTop = innerDiv.offsetTop; |
150 | | | this.left |
151 | | | = Math.round(Math.abs(innerDivLeft) * magres_x / innerDivWidth); |
152 | | | this.top |
153 | | | = Math.round(Math.abs(innerDivTop) * magres_y / innerDivHeight); |
154 | | | |
155 | | | // alter magnifier |
156 | | | var magnifierDiv = this.div; |
157 | | | magnifierDiv.style.left = this.left + "px"; |
158 | | | magnifierDiv.style.top = this.top + "px"; |
159 | | | } |
160 | | | |
161 | | | function MainMap (zoomfirst) { |
162 | | | var this1 = this; |
163 | | | |
164 | | | // constants |
165 | | | // view port is the visible portion of the main map |
166 | | | this.viewPortWidth = inres_x; //500 |
167 | | | this.viewPortHeight = inres_y; //400 |
168 | | | |
169 | | | this.tileSize = 256; |
170 | | | this.f_dragging = false; |
171 | | | this.innerDiv = document.getElementById("innerDiv"); |
172 | 4 | unreal | this.innerDiv.style.cursor = "url(grab.cur), default"; |
173 | 1 | unreal | |
174 | | | var outerDiv = document.getElementById("outerDiv"); |
175 | | | this.outerDiv = outerDiv; |
176 | | | outerDiv.style.width = inres_x + "px"; |
177 | | | outerDiv.style.height = inres_y + "px"; |
178 | | | var underMap = document.getElementById("underMap"); |
179 | | | underMap.style.width = (inres_x - 4) + "px"; |
180 | | | |
181 | | | outerDiv.onmousedown |
182 | | | = function(event) { return this1.startMove(event) }; |
183 | | | outerDiv.onmousemove |
184 | | | = function(event) { return this1.processMove(event) }; |
185 | | | outerDiv.onmouseup |
186 | | | = function(event) { return this1.stopMove(event) }; |
187 | | | outerDiv.ondblclick |
188 | | | = function(event) { return this1.doubleClick() }; |
189 | | | outerDiv.ondragstart = function() { return false; } // for IE |
190 | | | |
191 | | | var zf = 0; |
192 | | | if(zoomfirst==eq_mini) { zf = 0; } |
193 | | | if(zoomfirst==eq_medi) { zf = 1; } |
194 | | | if(zoomfirst==eq_high) { zf = 2; } |
195 | | | if(zoomfirst==eq_orig) { zf = 3; } |
196 | | | |
197 | | | this.zoom = zf; |
198 | | | this.zoomDim = [ |
199 | | | { |
200 | | | width:parseInt(full_x * eq_mini), |
201 | | | height:parseInt(full_y * eq_mini), |
202 | | | size:1 |
203 | | | }, |
204 | | | { |
205 | | | width:parseInt(full_x * eq_medi), |
206 | | | height:parseInt(full_y * eq_medi), |
207 | | | size:2 |
208 | | | }, |
209 | | | { |
210 | | | width:parseInt(full_x * eq_high), |
211 | | | height:parseInt(full_y * eq_high), |
212 | | | size:3 |
213 | | | }, |
214 | | | { |
215 | | | width:parseInt(full_x * eq_orig), |
216 | | | height:parseInt(full_y * eq_orig), |
217 | | | size:4 |
218 | | | }, |
219 | | | ] |
220 | | | |
221 | | | var zoomElt = this.zoomDim[this.zoom]; |
222 | | | this.setInnerDivSize (zoomElt.width, zoomElt.height, zoomElt.size, (parseInt(start_mul*1000)/10)); |
223 | | | |
224 | | | var innerDiv = document.getElementById("innerDiv"); |
225 | | | innerDiv.style.left = -(start_left) + "px"; |
226 | | | innerDiv.style.top = -(start_top) + "px"; |
227 | | | |
228 | | | magnifier.setPosition(); |
229 | | | this.checkTiles(); |
230 | | | } |
231 | | | |
232 | | | MainMap.prototype.startMove = |
233 | | | function (event) { |
234 | | | // for IE |
235 | | | if (!event) event = window.event; |
236 | | | |
237 | | | this.dragStartLeft = event.clientX; |
238 | | | this.dragStartTop = event.clientY; |
239 | | | var innerDiv = this.innerDiv; |
240 | 4 | unreal | innerDiv.style.cursor = "url(grabbing.cur), default"; |
241 | 1 | unreal | |
242 | | | this.top = innerDiv.offsetTop; |
243 | | | this.left = innerDiv.offsetLeft; |
244 | | | |
245 | | | this.f_dragging = true; |
246 | | | return false; |
247 | | | } |
248 | | | |
249 | | | MainMap.prototype.processMove = |
250 | | | function (event) { |
251 | | | var zoomElt = this.zoomDim[this.zoom]; |
252 | | | var maxY = 0; |
253 | | | var minY = -(zoomElt.height - this.viewPortHeight); |
254 | | | var maxX = 0; |
255 | | | var minX = -(zoomElt.width - this.viewPortWidth); |
256 | | | |
257 | | | if (!event) event = window.event; // for IE |
258 | | | var innerDiv = this.innerDiv; |
259 | | | if (this.f_dragging) { |
260 | | | var shiftedTop = this.top + (event.clientY - this.dragStartTop); |
261 | | | if (shiftedTop > maxY) shiftedTop = maxY; // map is not infinite |
262 | | | if (shiftedTop < minY) shiftedTop = minY; |
263 | | | innerDiv.style.top = shiftedTop + "px"; |
264 | | | |
265 | | | var shiftedLeft = this.left + (event.clientX - this.dragStartLeft); |
266 | | | if (shiftedLeft > maxX) shiftedLeft = maxX; // map is not infinite |
267 | | | if (shiftedLeft < minX) shiftedLeft = minX; |
268 | | | innerDiv.style.left = shiftedLeft + "px"; |
269 | | | |
270 | | | this.checkTiles(); |
271 | | | magnifier.setPosition(); |
272 | | | } |
273 | | | |
274 | | | var nasobek; |
275 | | | var konst = 0; |
276 | | | if(this.zoom==0) { nasobek = eq_mini; } |
277 | | | if(this.zoom==1) { nasobek = eq_medi; } |
278 | | | if(this.zoom==2) { nasobek = eq_high; } |
279 | | | if(this.zoom==3) { nasobek = eq_orig; } |
280 | | | if (navigator.appName=="Microsoft Internet Explorer") { konst = -2; } |
281 | | | var outerDiv = document.getElementById("outerDiv"); |
282 | | | var infoDiv = document.getElementById("infoDiv"); |
283 | | | 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); |
284 | | | } |
285 | | | |
286 | | | MainMap.prototype.checkZoom = |
287 | | | function () { |
288 | | | var zoomElt = this.zoomDim[this.zoom]; |
289 | | | var maxY = 0; |
290 | | | var minY = -(zoomElt.height - this.viewPortHeight); |
291 | | | var maxX = 0; |
292 | | | var minX = -(zoomElt.width - this.viewPortWidth); |
293 | | | var chcky = 0; |
294 | | | var chckx = 0; |
295 | | | |
296 | | | var innerDiv = this.innerDiv; |
297 | | | var shiftedTop = innerDiv.offsetTop; |
298 | | | if (shiftedTop > maxY) { shiftedTop = maxY; chcky = 1; } // map is not infinite |
299 | | | if (shiftedTop < minY) { shiftedTop = minY; chcky = 1; } |
300 | | | if (chcky == 1) innerDiv.style.top = shiftedTop + "px"; |
301 | | | |
302 | | | var shiftedLeft = innerDiv.offsetLeft; |
303 | | | if (shiftedLeft > maxX) { shiftedLeft = maxX; chckx = 1; }// map is not infinite |
304 | | | if (shiftedLeft < minX) { shiftedLeft = minX; chckx = 1; } |
305 | | | if (chcky == 1) innerDiv.style.left = shiftedLeft + "px"; |
306 | | | |
307 | | | magnifier.setPosition(); |
308 | | | } |
309 | | | |
310 | | | MainMap.prototype.checkTiles = |
311 | | | function () { |
312 | | | var innerDiv = this.innerDiv; |
313 | | | var tileSize = this.tileSize; |
314 | | | var visibleTiles = this.getVisibleTiles(); |
315 | | | var visibleTilesMap = {}; |
316 | | | var i; |
317 | | | |
318 | | | var size = this.zoomDim[this.zoom].size; |
319 | | | for (i=0;i<visibleTiles.length; i++) { |
320 | | | var tile = visibleTiles[i]; |
321 | | | var xy = "x" + tile.x + "y" + tile.y; |
322 | | | var tileName |
323 | | | = xy + "z" + this.zoom; |
324 | | | visibleTilesMap[tileName] = true; |
325 | | | var img = document.getElementById (tileName); |
326 | | | if (!img) { |
327 | | | img = document.createElement("img"); |
328 | | | img.src |
329 | | | = "size" + size + "/" + xy + ".jpg"; |
330 | | | img.style.position = "absolute"; |
331 | | | img.style.left = (tile.x * tileSize) + "px"; |
332 | | | img.style.top = (tile.y * tileSize) + "px"; |
333 | | | img.setAttribute("id", tileName); |
334 | | | img.setAttribute("galleryimg", "no"); |
335 | | | innerDiv.appendChild(img); |
336 | | | } |
337 | | | } |
338 | | | |
339 | | | var imgs = innerDiv.getElementsByTagName("img"); |
340 | | | for (i = 0; i < imgs.length; i++) { |
341 | | | var id = imgs[i].getAttribute("id"); |
342 | | | if (!visibleTilesMap[id]) { |
343 | | | innerDiv.removeChild(imgs[i]); |
344 | | | i--; |
345 | | | } |
346 | | | } |
347 | | | } |
348 | | | |
349 | | | MainMap.prototype.getVisibleTiles = |
350 | | | function () { |
351 | | | var innerDiv = this.innerDiv; |
352 | | | var mapX = innerDiv.offsetLeft; |
353 | | | var mapY = innerDiv.offsetTop; |
354 | | | var tileSize = this.tileSize; |
355 | | | |
356 | | | var startX = Math.abs(Math.floor(mapX / tileSize)) - 1; |
357 | | | if (startX < 0) startX = 0; |
358 | | | var startY = Math.abs(Math.floor(mapY / tileSize)) - 1; |
359 | | | if (startY < 0) startY = 0; |
360 | | | var tilesX = Math.ceil(this.viewPortWidth / tileSize) + 1; |
361 | | | var tilesY = Math.ceil(this.viewPortHeight / tileSize) + 1; |
362 | | | |
363 | | | var visibleTiles = []; |
364 | | | var counter = 0; |
365 | | | for (x = startX; x < (tilesX + startX); x++) { |
366 | | | for (y = startY; y < (tilesY + startY); y++) { |
367 | | | var tile = {}; |
368 | | | tile.x = x; |
369 | | | tile.y = y; |
370 | | | visibleTiles[counter++] = tile; |
371 | | | } |
372 | | | } |
373 | | | return visibleTiles; |
374 | | | } |
375 | | | |
376 | | | MainMap.prototype.stopMove = |
377 | | | function (event) { |
378 | 4 | unreal | this.innerDiv.style.cursor = "url(grab.cur), default"; |
379 | 1 | unreal | this.f_dragging = false; |
380 | | | } |
381 | | | |
382 | | | // movement in the magnifier moves main map's view port |
383 | | | MainMap.prototype.setViewPort = |
384 | | | function () { |
385 | | | var magDiv = document.getElementById("magnifier"); |
386 | | | var innerDiv = this.innerDiv; |
387 | | | var magLeft = magDiv.offsetLeft; |
388 | | | var magTop = magDiv.offsetTop; |
389 | | | var innerDivWidth = innerDiv.clientWidth; |
390 | | | var innerDivHeight = innerDiv.clientHeight; |
391 | | | |
392 | | | /* set innerDivLeft */ |
393 | | | var innerDivLeftMin = inres_x - innerDivWidth; //500 |
394 | | | var innerDivLeft |
395 | | | = Math.round((-magLeft) * innerDivWidth / magres_x); |
396 | | | if (innerDivLeft < innerDivLeftMin) innerDivLeft = innerDivLeftMin; |
397 | | | innerDiv.style.left = innerDivLeft + "px"; |
398 | | | |
399 | | | /* set innerDivTop */ |
400 | | | var innerDivTopMin = inres_y - innerDivHeight; //400 |
401 | | | var innerDivTop |
402 | | | = Math.round((-magTop) * innerDivHeight / magres_y); |
403 | | | if (innerDivTop < innerDivTopMin) innerDivTop = innerDivTopMin; |
404 | | | innerDiv.style.top = innerDivTop + "px"; |
405 | | | |
406 | | | this.checkTiles(); |
407 | | | } |
408 | | | |
409 | | | MainMap.prototype.setInnerDivSize = |
410 | | | function (width, height, size, percent) { |
411 | | | var innerDiv = this.innerDiv; |
412 | | | innerDiv.style.width = width + "px"; |
413 | | | innerDiv.style.height = height + "px"; |
414 | | | magnifier.setPosition(); |
415 | | | magnifier.setSize (width, height); |
416 | | | |
417 | | | var resolutionInfo = document.getElementById("resolutionInfo"); |
418 | | | resolutionInfo.innerHTML = percent + "%, " + width + " x " + height + "px"; |
419 | | | } |
420 | | | |
421 | | | MainMap.prototype.setZoom = |
422 | | | function (newZoom) { |
423 | | | if (this.zoom == newZoom) return; |
424 | | | var oldZ = this.zoomDim[this.zoom]; |
425 | | | var newZ = this.zoomDim[newZoom]; |
426 | | | var innerDiv = this.innerDiv; |
427 | | | var imgs = innerDiv.getElementsByTagName("img"); |
428 | | | while (imgs.length > 0) { |
429 | | | innerDiv.removeChild(imgs[0]); |
430 | | | } |
431 | | | |
432 | | | var oldLeft = innerDiv.offsetLeft; |
433 | | | var oldTop = innerDiv.offsetTop; |
434 | | | var wdth = Math.round(((magres_x * inres_x) / newZ.width) - 2); // 200 * 700px |
435 | | | var hght = Math.round(((magres_y * inres_y) / newZ.height) - 2); // 141 * 500px |
436 | | | var wdth2 = Math.round(((magres_x * inres_x) / oldZ.width) - 2); // 200 * 700px |
437 | | | var hght2 = Math.round(((magres_y * inres_y) / oldZ.height) - 2); // 141 * 500px |
438 | | | |
439 | | | var newLeft = Math.round(newZ.width * oldLeft / oldZ.width); |
440 | | | var newTop = Math.round(newZ.height * oldTop / oldZ.height); |
441 | | | |
442 | | | if (this.zoom < newZoom) { |
443 | | | newLeft = Math.round(newLeft + ((wdth-wdth2)*4)); |
444 | | | newTop = Math.round(newTop + ((hght-hght2)*4)); |
445 | | | } |
446 | | | if (this.zoom > newZoom) { |
447 | | | newLeft = Math.round(newLeft + ((wdth-wdth2)*4)); |
448 | | | newTop = Math.round(newTop + ((hght-hght2)*4)); |
449 | | | } |
450 | | | |
451 | | | innerDiv.style.left = newLeft + "px"; |
452 | | | innerDiv.style.top = newTop + "px"; |
453 | | | this.zoom = newZoom; // set the global zoom |
454 | | | var nasobek; |
455 | | | if(this.zoom==0) { nasobek = eq_mini; } |
456 | | | if(this.zoom==1) { nasobek = eq_medi; } |
457 | | | if(this.zoom==2) { nasobek = eq_high; } |
458 | | | if(this.zoom==3) { nasobek = eq_orig; } |
459 | | | this.setInnerDivSize(newZ.width, newZ.height, newZ.size, (parseInt(nasobek*1000)/10)); |
460 | | | |
461 | | | this.checkZoom(); |
462 | | | this.checkTiles(); |
463 | | | |
464 | | | titulek1 = document.getElementById("mapstats_infopoint"); |
465 | | | titulek1.innerHTML = ""; |
466 | | | titulek2 = document.getElementById("mapstats_name"); |
467 | | | titulek2.innerHTML = ""; |
468 | | | titulek3 = document.getElementById("mapstats_ip"); |
469 | | | titulek3.innerHTML = ""; |
470 | | | titulek4 = document.getElementById("mapstats_status"); |
471 | | | titulek4.innerHTML = ""; |
472 | | | titulek5 = document.getElementById("mapstats_legend"); |
473 | | | titulek5.innerHTML = ""; |
474 | | | |
475 | | | canvasInit(nasobek); |
476 | | | |
477 | | | } |
478 | | | |
479 | | | MainMap.prototype.doubleClick = |
480 | | | function () { |
481 | | | if (this.zoom == 3) return; |
482 | | | |
483 | | | var stara = this.zoom; |
484 | | | stara = stara + 1; |
485 | | | this.setZoom(stara); |
486 | | | |
487 | | | } |
488 | | | |
489 | | | function canvasInit(nasobek) { |
490 | | | |
491 | | | var canvas_id1 = document.getElementById("paint"); |
492 | | | canvas_id1.width = parseInt(full_x*nasobek); |
493 | | | canvas_id1.height = parseInt(full_y*nasobek); |
494 | | | |
495 | | | var canvas_id2 = document.getElementById("paint2"); |
496 | | | canvas_id2.width = parseInt(full_x*nasobek); |
497 | | | canvas_id2.height = parseInt(full_y*nasobek); |
498 | | | |
499 | | | ann = nasobek; |
500 | | | var pozdrav = new Array(); |
501 | | | var pozdrav1 = new Array(); |
502 | | | var pozdrav2 = new Array(); |
503 | | | var pozdr = new Array(); |
504 | | | pozdrav = pomocna.split('\n'); |
505 | | | pozdrav1 = pomocna1.split('\n'); |
506 | | | var a_cnt = 0; |
507 | | | |
508 | | | for(a=0;a<pozdrav.length;a++){ |
509 | | | if(pozdrav[a]!="") { |
510 | | | node[a] = new Array(); |
511 | | | pozdrav2 = pozdrav[a].split(';'); |
512 | | | for(b=0;b<pozdrav2.length;b++){ |
513 | | | node[a][b] = pozdrav2[b]; |
514 | | | } |
515 | | | a_cnt++; |
516 | | | } |
517 | | | } |
518 | | | for(e=0;e<pozdrav1.length;e++) { |
519 | | | if(pozdrav1[e]!="") { |
520 | | | node[(e+a_cnt)] = new Array(); |
521 | | | pozdr = pozdrav1[e].split(';'); |
522 | | | for(f=0;f<pozdr.length;f++){ |
523 | | | node[(e+a_cnt)][f] = pozdr[f]; |
524 | | | } |
525 | | | } |
526 | | | } |
527 | | | |
528 | | | var pozdrav3 = new Array(); |
529 | | | var pozdrav4 = new Array(); |
530 | | | var size; |
531 | | | var clrlnk; |
532 | | | m1 = 0; |
533 | | | m2 = 0; |
534 | | | m3 = 0; |
535 | | | m4 = 0; |
536 | | | m5 = 0; |
537 | | | m6 = 0; |
538 | | | m7 = 0; |
539 | | | m8 = 0; |
540 | | | m9 = 0; |
541 | | | m1_a = 0; |
542 | | | m2_a = 0; |
543 | | | m3_a = 0; |
544 | | | m4_a = 0; |
545 | | | m5_a = 0; |
546 | | | m6_a = 0; |
547 | | | m7_a = 0; |
548 | | | m8_a = 0; |
549 | | | m9_a = 0; |
550 | | | cntm = 0; |
551 | | | |
552 | | | if(pomocna2.length>0) { |
553 | | | pozdrav3 = pomocna2.split('\n'); |
554 | | | for(a=0;a<pozdrav3.length;a++){ |
555 | | | if(pozdrav3[a]!="") { |
556 | | | pozdrav4 = pozdrav3[a].split(';'); |
557 | 4 | unreal | if(pozdrav4[1].toLowerCase()=="backbone") { size = 4.5; } else { size = 2.7; } |
558 | 1 | unreal | if(pozdrav4[2].toLowerCase()=="inp") { |
559 | | | if(pozdrav4[3]==1) { clrlnk = wifi_client_a; m1_a = 1; } |
560 | | | else if(pozdrav4[3]==2) { clrlnk = wifi_backbone_a; m2_a = 1; } |
561 | | | else if(pozdrav4[3]==3) { clrlnk = eth_100_a; m3_a = 1; } |
562 | | | else if(pozdrav4[3]==4) { clrlnk = fso_a; m4_a = 1; } |
563 | | | else if(pozdrav4[3]==5) { clrlnk = fso_backup_a; m5_a = 1; } |
564 | | | else if(pozdrav4[3]==6) { clrlnk = ghz5_a; m6_a = 1; } |
565 | | | else if(pozdrav4[3]==7) { clrlnk = ghz10_a; m7_a = 1; } |
566 | | | else if(pozdrav4[3]==8) { clrlnk = fiber_a; m8_a = 1; } |
567 | | | else { clrlnk = other_a; m9_a = 1; } |
568 | | | } else { |
569 | | | if(pozdrav4[3]==1) { clrlnk = wifi_client; m1 = 1; } |
570 | | | else if(pozdrav4[3]==2) { clrlnk = wifi_backbone; m2 = 1; } |
571 | | | else if(pozdrav4[3]==3) { clrlnk = eth_100; m3 = 1; } |
572 | | | else if(pozdrav4[3]==4) { clrlnk = fso; m4 = 1; } |
573 | | | else if(pozdrav4[3]==5) { clrlnk = fso_backup; m5 = 1; } |
574 | | | else if(pozdrav4[3]==6) { clrlnk = ghz5; m6 = 1; } |
575 | | | else if(pozdrav4[3]==7) { clrlnk = ghz10; m7 = 1; } |
576 | | | else if(pozdrav4[3]==8) { clrlnk = fiber; m8 = 1; } |
577 | | | else { clrlnk = other; m9 = 1; } |
578 | | | } |
579 | | | |
580 | | | // Vykreslime si nase linky |
581 | | | if(pozdrav4[2].toLowerCase()=="inp") { |
582 | | | if(ch_inp) { |
583 | | | drawINPLink(pozdrav4[0], size-1, nasobek, clrlnk); |
584 | | | } |
585 | | | } else { |
586 | | | if((ch_backbone) && (size==4.5)) { |
587 | | | drawLink(pozdrav4[0], size, nasobek, clrlnk); |
588 | | | } |
589 | 4 | unreal | if((ch_client) && (size==2.7)) { |
590 | 1 | unreal | drawLink(pozdrav4[0], size, nasobek, clrlnk); |
591 | | | } |
592 | | | } |
593 | | | } |
594 | | | } |
595 | | | } |
596 | | | |
597 | | | 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; |
598 | | | |
599 | | | var pozdrav5 = new Array(); |
600 | | | var pozdrav6 = new Array(); |
601 | | | if(ch_infopoint) { |
602 | | | if(pomocna3.length>0) { |
603 | | | pozdrav5 = pomocna3.split('\n'); |
604 | | | for(d=0;d<pozdrav5.length;d++) { |
605 | | | if(pozdrav5[d]!="") { |
606 | | | pozdrav6 = pozdrav5[d].split(';'); |
607 | | | // Vykreslime si infopointy |
608 | | | if(ch_name) { |
609 | | | drawInfo(pozdrav6[0],pozdrav6[1],pozdrav6[2],nasobek); |
610 | | | } |
611 | | | drawInfoPoint(pozdrav6[1],pozdrav6[2],nasobek); |
612 | | | } |
613 | | | } |
614 | | | } |
615 | | | } |
616 | | | |
617 | | | for(e=0;e<pozdrav1.length;e++) { |
618 | | | if(pozdrav1[e]!="") { |
619 | | | if(ch_noping) { |
620 | | | if(node[(a_cnt+e)][3]==1) { |
621 | | | drawClient(node[(a_cnt+e)][1],node[(a_cnt+e)][2],nasobek); |
622 | | | if(ch_name) { |
623 | | | drawName(node[(a_cnt+e)][0],(node[(a_cnt+e)][1])-1,(node[(a_cnt+e)][2])-1,nasobek) |
624 | | | } |
625 | | | } |
626 | | | if(node[(a_cnt+e)][3]==2) { |
627 | | | drawSwitch(node[(a_cnt+e)][1],node[(a_cnt+e)][2],nasobek); |
628 | | | } |
629 | | | } |
630 | | | } |
631 | | | } |
632 | | | |
633 | | | var pozdrav7 = new Array(); |
634 | | | pozdrav7 = pomocna4.split('\n'); |
635 | | | var clrpnt; |
636 | | | var x_pos; |
637 | | | var y_pos; |
638 | | | var name_pos; |
639 | | | var title_pos; |
640 | | | |
641 | | | for(c=0;c<pozdrav7.length;c++){ |
642 | | | if(pozdrav7[c]!="") { |
643 | | | pozdrav8 = pozdrav7[c].split(';'); |
644 | | | if(pozdrav8[1]==1) { clrpnt = imgon; pozdrav8[2] = pozdrav8[2] + ' ms'; } else { clrpnt = imgoff; pozdrav8[2] = "offline"; } |
645 | | | if(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]; } // check if the result doesnt replaced |
646 | | | |
647 | | | if(title_pos.toLowerCase()=="ap") { |
648 | | | if(ch_ap) { |
649 | | | drawAP(x_pos,y_pos,nasobek); |
650 | | | drawNode(x_pos,y_pos,nasobek,clrpnt); |
651 | | | if(ch_name) { |
652 | | | drawName(name_pos,x_pos,y_pos,nasobek); |
653 | | | } |
654 | | | if((ch_ip) && (ch_status)) { |
655 | | | drawStatus(pozdrav8[2],x_pos,y_pos,nasobek); |
656 | | | drawIP(pozdrav8[0],x_pos,y_pos,nasobek); |
657 | | | } else if((!ch_ip) && (ch_status)) { |
658 | | | drawStatus(pozdrav8[2],x_pos,y_pos-parseInt(12/nasobek),nasobek); |
659 | | | } else if((ch_ip) && (!ch_status)) { |
660 | | | drawIP(pozdrav8[0],x_pos,y_pos,nasobek); |
661 | | | } |
662 | | | } |
663 | | | } else if(title_pos.toLowerCase()=="router") { |
664 | | | if(ch_router) { |
665 | | | drawNode(x_pos,y_pos,nasobek,clrpnt); |
666 | | | if(ch_name) { |
667 | | | drawName(name_pos,x_pos,y_pos,nasobek); |
668 | | | } |
669 | | | if(ch_status) { |
670 | | | drawStatus(pozdrav8[2],x_pos,y_pos-parseInt(12/nasobek),nasobek); |
671 | | | } |
672 | | | } |
673 | | | } else { |
674 | | | if(ch_node) { |
675 | | | drawNode(x_pos,y_pos,nasobek,clrpnt); |
676 | | | if(ch_name) { |
677 | | | drawName(name_pos,x_pos,y_pos,nasobek); |
678 | | | } |
679 | | | } |
680 | | | } |
681 | | | } |
682 | | | } |
683 | | | |
684 | | | var legend = document.getElementById('legend'); |
685 | | | if((ch_legend) && (cntm>0)) { |
686 | | | drawLegend(); |
687 | | | legend.style.display = "block"; |
688 | | | } else { |
689 | | | legend.style.display = "none"; |
690 | | | } |
691 | | | |
692 | | | } |
693 | | | |
694 | | | function drawLink(pos, size, nas, color) { |
695 | | | var ctx = document.getElementById('paint').getContext('2d'); |
696 | | | var points = new Array(); |
697 | | | var posxy = new Array(); |
698 | | | var coordinates = new Array(); |
699 | | | points = pos.split('#'); |
700 | | | var reg=/(\d+)&(\d+)/; |
701 | | | for(i=0;i<points.length;i++){ |
702 | | | if (reg.test(points[i])) { |
703 | | | posxy = points[i].split('&'); |
704 | | | coordinates[i*2] = parseInt(posxy[0]*nas); // checkni to.... |
705 | | | coordinates[i*2+1] = parseInt(posxy[1]*nas); |
706 | | | } else { |
707 | | | coordinates[i*2] = parseInt(node2sour(points[i],1)*nas); |
708 | | | coordinates[i*2+1] = parseInt(node2sour(points[i],2)*nas); |
709 | | | } |
710 | | | } |
711 | | | |
712 | | | ctx.lineJoin = "round"; |
713 | | | ctx.strokeStyle = "rgb(20, 20, 20)"; |
714 | | | ctx.lineWidth = size+1; |
715 | | | ctx.beginPath(); |
716 | | | ctx.moveTo(coordinates[0],coordinates[1]); |
717 | | | for(i=2;i<coordinates.length;i+=2){ |
718 | | | ctx.lineTo(coordinates[i],coordinates[i+1]); |
719 | | | } |
720 | | | ctx.stroke(); |
721 | | | |
722 | | | ctx.lineJoin = "round"; |
723 | | | ctx.strokeStyle = "rgb(0, 0, 0)"; |
724 | | | ctx.lineWidth = size; |
725 | | | ctx.beginPath(); |
726 | | | ctx.moveTo(coordinates[0],coordinates[1]); |
727 | | | for(i=2;i<coordinates.length;i+=2){ |
728 | | | ctx.lineTo(coordinates[i],coordinates[i+1]); |
729 | | | } |
730 | | | ctx.stroke(); |
731 | | | |
732 | | | ctx.lineJoin = "round"; |
733 | | | ctx.strokeStyle = color; |
734 | | | ctx.lineWidth = size-1; |
735 | | | ctx.beginPath(); |
736 | | | ctx.moveTo(coordinates[0],coordinates[1]); |
737 | | | for(i=2;i<coordinates.length;i+=2){ |
738 | | | ctx.lineTo(coordinates[i],coordinates[i+1]); |
739 | | | } |
740 | | | ctx.stroke(); |
741 | | | } |
742 | | | |
743 | | | function drawINPLink(pos, size, nas, color) { |
744 | | | var ctx = document.getElementById('paint').getContext('2d'); |
745 | | | var points = new Array(); |
746 | | | var posxy = new Array(); |
747 | | | var coordinates = new Array(); |
748 | | | points = pos.split('#'); |
749 | | | var reg=/(\d+)&(\d+)/; |
750 | | | for(i=0;i<points.length;i++){ |
751 | | | if (reg.test(points[i])) { |
752 | | | posxy = points[i].split('&'); |
753 | | | coordinates[i*2] = parseInt(posxy[0]*nas); |
754 | | | coordinates[i*2+1] = parseInt(posxy[1]*nas); |
755 | | | } else { |
756 | | | coordinates[i*2] = parseInt(node2sour(points[i],1)*nas); |
757 | | | coordinates[i*2+1] = parseInt(node2sour(points[i],2)*nas); |
758 | | | } |
759 | | | } |
760 | | | |
761 | | | ctx.lineJoin = "round"; |
762 | | | ctx.strokeStyle = "rgba(0, 0, 0, 0.1)"; |
763 | | | ctx.lineWidth = size+1.5; |
764 | | | ctx.beginPath(); |
765 | | | ctx.moveTo(coordinates[0],coordinates[1]); |
766 | | | for(i=2;i<coordinates.length;i+=2){ |
767 | | | ctx.lineTo(coordinates[i],coordinates[i+1]); |
768 | | | } |
769 | | | ctx.stroke(); |
770 | | | |
771 | | | ctx.lineJoin = "round"; |
772 | | | ctx.strokeStyle = color; |
773 | | | ctx.lineWidth = size+0.5; |
774 | | | ctx.beginPath(); |
775 | | | ctx.moveTo(coordinates[0],coordinates[1]); |
776 | | | for(i=2;i<coordinates.length;i+=2){ |
777 | | | ctx.lineTo(coordinates[i],coordinates[i+1]); |
778 | | | } |
779 | | | ctx.stroke(); |
780 | | | } |
781 | | | |
782 | | | function drawNode(xo, yo, nas, img) { |
783 | | | var ctx = document.getElementById('paint2').getContext('2d'); |
784 | | | ctx.drawImage(img,parseInt((xo*nas)-7),parseInt((yo*nas)-7)); |
785 | | | } |
786 | | | |
787 | | | function drawAP(xn, yn, nas) { |
788 | | | var ctx = document.getElementById('paint').getContext('2d'); |
789 | | | ctx.drawImage(imgap,parseInt((xn*nas)-31),parseInt((yn*nas)-17)); |
790 | | | } |
791 | | | |
792 | | | function drawClient(xc, yc, nas) { |
793 | | | var ctx = document.getElementById('paint').getContext('2d'); |
794 | | | ctx.drawImage(imgcn,parseInt((xc*nas)-7),parseInt((yc*nas)-7)); |
795 | | | } |
796 | | | |
797 | | | function drawSwitch(xs, ys, nas) { |
798 | | | var ctx = document.getElementById('paint').getContext('2d'); |
799 | | | ctx.drawImage(imgsw,parseInt((xs*nas)-6),parseInt((ys*nas)-6)); |
800 | | | } |
801 | | | |
802 | | | function drawInfoPoint(xl, yl, nas) { |
803 | | | var ctx = document.getElementById('paint').getContext('2d'); |
804 | | | ctx.drawImage(imginfo,parseInt((xl*nas)-7),parseInt((yl*nas)-7)); |
805 | | | } |
806 | | | |
807 | | | function drawLegend() { |
808 | | | var epsilon; |
809 | | | var cislo = 0; |
810 | | | var name = ""; |
811 | | | var paintlegend = document.getElementById('paintlegend'); |
812 | | | paintlegend.height = (((cntm-1) * 12)+13); |
813 | | | paintlegend.width = "25"; |
814 | | | var ctx = paintlegend.getContext('2d'); |
815 | | | ctx.clearRect(0,0,25,((cntm-1) * 12)+13); |
816 | 4 | unreal | if(m1==1) { epsilon = ((cislo*12)+5); drawLegendLink(epsilon,wifi_client,2.9); name = name + name1 + "<br/>"; cislo++; } |
817 | 1 | unreal | if(m2==1) { epsilon = ((cislo*12)+5); drawLegendLink(epsilon,wifi_backbone,4.5); name = name + name2 + "<br/>"; cislo++; } |
818 | | | if(m3==1) { epsilon = ((cislo*12)+5); drawLegendLink(epsilon,eth_100,4.5); name = name + name3 + "<br/>"; cislo++; } |
819 | | | if(m4==1) { epsilon = ((cislo*12)+5); drawLegendLink(epsilon,fso,4.5); name = name + name4 + "<br/>"; cislo++; } |
820 | | | if(m5==1) { epsilon = ((cislo*12)+5); drawLegendLink(epsilon,fso_backup,4.5); name = name + name5 + "<br/>"; cislo++; } |
821 | | | if(m6==1) { epsilon = ((cislo*12)+5); drawLegendLink(epsilon,ghz5,4.5); name = name + name6 + "<br/>"; cislo++; } |
822 | | | if(m7==1) { epsilon = ((cislo*12)+5); drawLegendLink(epsilon,ghz10,4.5); name = name + name7 + "<br/>"; cislo++; } |
823 | | | if(m8==1) { epsilon = ((cislo*12)+5); drawLegendLink(epsilon,fiber,4.5); name = name + name8 + "<br/>"; cislo++; } |
824 | | | if(m9==1) { epsilon = ((cislo*12)+5); drawLegendLink(epsilon,other,4.5); name = name + name9 + "<br/>"; cislo++; } |
825 | 4 | unreal | if(m1_a==1) { epsilon = ((cislo*12)+5); drawLegendINPLink(epsilon,wifi_client_a,2.9); name = name + name1 + " " + inp + "<br/>"; cislo++; } |
826 | 1 | unreal | if(m2_a==1) { epsilon = ((cislo*12)+5); drawLegendINPLink(epsilon,wifi_backbone_a,4.5); name = name + name2 + " " + inp + "<br/>"; cislo++; } |
827 | | | if(m3_a==1) { epsilon = ((cislo*12)+5); drawLegendINPLink(epsilon,eth_100_a,4.5); name = name + name3 + " " + inp + "<br/>"; cislo++; } |
828 | | | if(m4_a==1) { epsilon = ((cislo*12)+5); drawLegendINPLink(epsilon,fso_a,4.5); name = name + name4 + " " + inp + "<br/>"; cislo++; } |
829 | | | if(m5_a==1) { epsilon = ((cislo*12)+5); drawLegendINPLink(epsilon,fso_backup_a,4.5); name = name + name5 + " " + inp + "<br/>"; cislo++; } |
830 | | | if(m6_a==1) { epsilon = ((cislo*12)+5); drawLegendINPLink(epsilon,ghz5_a,4.5); name = name + name6 + " " + inp + "<br/>"; cislo++; } |
831 | | | if(m7_a==1) { epsilon = ((cislo*12)+5); drawLegendINPLink(epsilon,ghz10_a,4.5); name = name + name7 + " " + inp + "<br/>"; cislo++; } |
832 | | | if(m8_a==1) { epsilon = ((cislo*12)+5); drawLegendINPLink(epsilon,fiber_a,4.5); name = name + name8 + " " + inp + "<br/>"; cislo++; } |
833 | | | if(m9_a==1) { epsilon = ((cislo*12)+5); drawLegendINPLink(epsilon,other_a,4.5); name = name + name9 + " " + inp + "<br/>"; } |
834 | | | drawLegendText(name); |
835 | | | } |
836 | | | |
837 | | | function drawLegendLink(yg,color,size) { |
838 | | | var ctx = document.getElementById('paintlegend').getContext('2d'); |
839 | | | ctx.strokeStyle = "rgb(20, 20, 20)"; |
840 | | | ctx.lineWidth = size+1; |
841 | | | ctx.beginPath(); |
842 | | | ctx.moveTo(1,yg); |
843 | | | ctx.lineTo(24,yg); |
844 | | | ctx.stroke(); |
845 | | | |
846 | | | ctx.strokeStyle = "rgb(0, 0, 0)"; |
847 | | | ctx.lineWidth = size; |
848 | | | ctx.beginPath(); |
849 | | | ctx.moveTo(1,yg); |
850 | | | ctx.lineTo(24,yg); |
851 | | | ctx.stroke(); |
852 | | | |
853 | | | ctx.strokeStyle = color; |
854 | | | ctx.lineWidth = size-1; |
855 | | | ctx.beginPath(); |
856 | | | ctx.moveTo(1,yg); |
857 | | | ctx.lineTo(24,yg); |
858 | | | ctx.stroke(); |
859 | | | |
860 | | | } |
861 | | | |
862 | | | function drawLegendINPLink(yg,color,size) { |
863 | | | var ctx = document.getElementById('paintlegend').getContext('2d'); |
864 | 4 | unreal | ctx.strokeStyle = "rgba(255, 255, 255, 0.5)"; |
865 | | | ctx.lineWidth = size; |
866 | | | ctx.beginPath(); |
867 | | | ctx.moveTo(1,yg); |
868 | | | ctx.lineTo(24,yg); |
869 | | | ctx.stroke(); |
870 | | | |
871 | 1 | unreal | ctx.strokeStyle = "rgba(0, 0, 0, 0.1)"; |
872 | | | ctx.lineWidth = size; |
873 | | | ctx.beginPath(); |
874 | | | ctx.moveTo(1,yg); |
875 | | | ctx.lineTo(24,yg); |
876 | | | ctx.stroke(); |
877 | | | |
878 | | | ctx.strokeStyle = color; |
879 | | | ctx.lineWidth = size-0.5; |
880 | | | ctx.beginPath(); |
881 | | | ctx.moveTo(1,yg); |
882 | | | ctx.lineTo(24,yg); |
883 | | | ctx.stroke(); |
884 | | | } |
885 | | | |
886 | | | function clearMap(ann) { |
887 | | | var ctx = document.getElementById('paint').getContext('2d'); |
888 | | | ctx.clearRect(0,0,parseInt(full_x * ann),parseInt(full_y * ann)); |
889 | | | var ctx2 = document.getElementById('paint2').getContext('2d'); |
890 | | | ctx2.clearRect(0,0,parseInt(full_x * ann),parseInt(full_y * ann)); |
891 | | | } |
892 | | | |
893 | | | function node2sour(name, pos) { |
894 | | | var ok = 0; |
895 | | | for(k=0;k<node.length;k++){ |
896 | | | if(node[k][0]==name) { |
897 | | | ok = node[k][pos]; |
898 | | | } |
899 | | | if(ok!=0) { return ok; } |
900 | | | } |
901 | | | return ok; |
902 | | | } |
903 | | | |
904 | | | function ip2sour(ip, pos) { |
905 | | | var ok = 0; |
906 | | | for(k=0;k<node.length;k++){ |
907 | | | if(node[k][4]==ip) { |
908 | | | ok = node[k][pos]; |
909 | | | } |
910 | | | if(ok!=0) { return ok; } |
911 | | | } |
912 | | | return ok; |
913 | | | } |
914 | | | |
915 | | | function nactiSoubory() { |
916 | | | pomocna = getFile(nodes); |
917 | | | pomocna1 = getFile(noping); |
918 | | | pomocna2 = getFile(links); |
919 | | | pomocna3 = getFile(infopoints); |
920 | | | pomocna4 = getFile(state); |
921 | | | redrawUpdate(); |
922 | | | } |
923 | | | |
924 | | | function getFile(url) { |
925 | | | AJAX = (window.XMLHttpRequest ? new XMLHttpRequest() : (window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : false)); |
926 | | | if (AJAX) { |
927 | | | AJAX.open("GET", url, false); |
928 | 4 | unreal | AJAX.setRequestHeader("Cache-Control", "no-store"); |
929 | | | AJAX.setRequestHeader("Cache-Control", "no-cache"); |
930 | | | AJAX.setRequestHeader("Cache-Control", "must-revalidate"); |
931 | | | AJAX.setRequestHeader("Pragma", "no-cache"); |
932 | 1 | unreal | AJAX.send(null); |
933 | | | return AJAX.responseText; |
934 | | | } else { |
935 | | | return false; |
936 | | | } |
937 | | | } |
938 | | | |
939 | | | function timerMe() { |
940 | | | // auto-downloading source files every 2 minutes |
941 | | | setInterval("nactiSoubory()", 2 * 60 * 1000); |
942 | | | } |
943 | | | |
944 | | | function nastavCheck() { |
945 | | | document.form_map.ch_ap.checked = ch_ap; |
946 | | | document.form_map.ch_router.checked = ch_router; |
947 | | | document.form_map.ch_node.checked = ch_node; |
948 | | | document.form_map.ch_infopoint.checked = ch_infopoint; |
949 | | | document.form_map.ch_noping.checked = ch_noping; |
950 | | | document.form_map.ch_legend.checked = ch_legend; |
951 | | | document.form_map.ch_name.checked = ch_name; |
952 | | | document.form_map.ch_ip.checked = ch_ip; |
953 | | | document.form_map.ch_status.checked = ch_status; |
954 | | | document.form_map.ch_backbone.checked = ch_backbone; |
955 | | | document.form_map.ch_client.checked = ch_client; |
956 | | | document.form_map.ch_inp.checked = ch_inp; |
957 | | | } |
958 | | | |
959 | | | function reDraw() { |
960 | | | if(document.form_map.ch_ap.checked) { ch_ap = true; } else { ch_ap = false; } |
961 | | | if(document.form_map.ch_router.checked) { ch_router = true; } else { ch_router = false; } |
962 | | | if(document.form_map.ch_node.checked) { ch_node = true; } else { ch_node = false; } |
963 | | | if(document.form_map.ch_infopoint.checked) { ch_infopoint = true; } else { ch_infopoint = false; } |
964 | | | if(document.form_map.ch_noping.checked) { ch_noping = true; } else { ch_noping = false; } |
965 | | | if(document.form_map.ch_legend.checked) { ch_legend = true; } else { ch_legend = false; } |
966 | | | if(document.form_map.ch_name.checked) { ch_name = true; } else { ch_name = false; } |
967 | | | if(document.form_map.ch_ip.checked) { ch_ip = true; } else { ch_ip = false; } |
968 | | | if(document.form_map.ch_status.checked) { ch_status = true; } else { ch_status = false; } |
969 | | | if(document.form_map.ch_backbone.checked) { ch_backbone = true; } else { ch_backbone = false; } |
970 | | | if(document.form_map.ch_client.checked) { ch_client = true; } else { ch_client = false; } |
971 | | | if(document.form_map.ch_inp.checked) { ch_inp = true; } else { ch_inp = false; } |
972 | | | titulek1 = document.getElementById("mapstats_infopoint"); |
973 | | | titulek1.innerHTML = ""; |
974 | | | titulek2 = document.getElementById("mapstats_name"); |
975 | | | titulek2.innerHTML = ""; |
976 | | | titulek3 = document.getElementById("mapstats_ip"); |
977 | | | titulek3.innerHTML = ""; |
978 | | | titulek4 = document.getElementById("mapstats_status"); |
979 | | | titulek4.innerHTML = ""; |
980 | | | titulek5 = document.getElementById("mapstats_legend"); |
981 | | | titulek5.innerHTML = ""; |
982 | | | clearMap(ann); |
983 | | | canvasInit(ann); |
984 | | | } |
985 | | | |
986 | | | function drawInfo(txt, xa, ya, nas) { |
987 | | | xa = parseInt((xa*nas)+6); |
988 | | | ya = parseInt((ya*nas)-13); |
989 | | | var text = '<div style="position:absolute;white-space:nowrap;letter-spacing: 1px;left:' + xa + 'px;top:' + ya + 'px;font-family: arial;font-size: 9px;background-color: #000000;color: #ffffff;padding-left: 3px;padding-right: 2px;cursor: default;" unselectable = "on">' + txt + '</div>'; |
990 | | | |
991 | | | titulek = document.getElementById("mapstats_infopoint"); |
992 | | | titulek.innerHTML = titulek.innerHTML + text; |
993 | | | } |
994 | | | |
995 | | | function drawName(txt, xa, ya, nas) { |
996 | | | xa = parseInt((xa*nas)+6); |
997 | | | ya = parseInt((ya*nas)-13); |
998 | | | var text = '<div style="position:absolute;white-space:nowrap;letter-spacing: 1px;left:' + xa + 'px;top:' + ya + 'px;font-family: arial;font-size: 9px;background-color: #000000;color: #ffffff;padding-left: 3px;padding-right: 2px;cursor: default;" unselectable = "on">' + txt + '</div>'; |
999 | | | |
1000 | | | titulek = document.getElementById("mapstats_name"); |
1001 | | | titulek.innerHTML = titulek.innerHTML + text; |
1002 | | | } |
1003 | | | |
1004 | | | function drawIP(txt, xb, yb, nas) { |
1005 | | | xb = parseInt((xb*nas)+6); |
1006 | | | yb = parseInt((yb*nas)-1); |
1007 | | | var text = '<div style="position:absolute;white-space:nowrap;letter-spacing: 1px;left:' + xb + 'px;top:' + yb + 'px;font-family: arial;font-size: 9px;background-color: #000000;color: #ffffff;padding-left: 3px;padding-right: 2px;cursor: default;" unselectable = "on">' + txt + '</div>'; |
1008 | | | |
1009 | | | titulek = document.getElementById("mapstats_ip"); |
1010 | | | titulek.innerHTML = titulek.innerHTML + text; |
1011 | | | } |
1012 | | | |
1013 | | | function drawStatus(txt, xc, yc, nas) { |
1014 | | | xc = parseInt((xc*nas)+6); |
1015 | | | yc = parseInt((yc*nas)+11); |
1016 | | | var text = '<div style="position:absolute;white-space:nowrap;letter-spacing: 1px;left:' + xc + 'px;top:' + yc + 'px;font-family: arial;font-size: 9px;background-color: #000000;color: #ffffff;padding-left: 3px;padding-right: 2px;cursor: default;" unselectable = "on">' + txt + '</div>'; |
1017 | | | |
1018 | | | titulek = document.getElementById("mapstats_status"); |
1019 | | | titulek.innerHTML = titulek.innerHTML + text; |
1020 | | | } |
1021 | | | |
1022 | | | function drawLegendText(txt) { |
1023 | | | var text = '<div style="position:relative;white-space:nowrap;letter-spacing: 1px;font-family: arial;font-size: 9px;color: black;padding-left: 3px;padding-right: 2px;cursor: default;" unselectable = "on">' + txt + '</div>'; |
1024 | | | |
1025 | | | titulek = document.getElementById("mapstats_legend"); |
1026 | | | titulek.innerHTML = text; |
1027 | | | } |
1028 | | | |
1029 | | | function changeOpacity(opc) { |
1030 | | | var opcprc = opc / 100; |
1031 | | | var mapstats_update = document.getElementById("mapstats_update"); |
1032 | | | |
1033 | | | if (navigator.appName=="Microsoft Internet Explorer") { |
1034 | | | mapstats_update.style.filter = 'alpha(opacity=' + opc + ');'; |
1035 | | | } else { |
1036 | | | mapstats_update.style.setProperty("-moz-opacity",opcprc,null); |
1037 | | | mapstats_update.style.setProperty("opacity",opcprc,null); |
1038 | | | } |
1039 | | | } |
1040 | | | |
1041 | | | function changeUpdate() { |
1042 | | | var promenna = new Date(); |
1043 | | | var rok = promenna.getFullYear(); |
1044 | | | var mesic = "" + (promenna.getMonth() + 1); |
1045 | | | var den = "" + (promenna.getDate()); |
1046 | | | var hodin = "" + (promenna.getHours()); |
1047 | | | var minut = "" + (promenna.getMinutes()); |
1048 | | | var sekund = "" + (promenna.getSeconds()); |
1049 | | | if(mesic.length==1) { mesic = "0" + mesic; } |
1050 | | | if(den.length==1) { den = "0" + den; } |
1051 | | | if(hodin.length==1) { hodin = "0" + hodin; } |
1052 | | | if(minut.length==1) { minut = "0" + minut; } |
1053 | | | if(sekund.length==1) { sekund = "0" + sekund; } |
1054 | | | var mapstats_update = document.getElementById("mapstats_update"); |
1055 | | | mapstats_update.innerHTML = den + ". " + mesic + ". " + rok + " " + hodin + ":" + minut + ":" + sekund; |
1056 | | | } |
1057 | | | |
1058 | | | function redrawUpdate() { |
1059 | | | setTimeout("changeOpacity(90)",100); |
1060 | | | setTimeout("changeOpacity(80)",200); |
1061 | | | setTimeout("changeOpacity(70)",300); |
1062 | | | setTimeout("changeOpacity(60)",400); |
1063 | | | setTimeout("changeOpacity(50)",500); |
1064 | | | setTimeout("changeOpacity(40)",600); |
1065 | | | setTimeout("changeOpacity(30)",700); |
1066 | | | setTimeout("changeOpacity(20)",800); |
1067 | | | setTimeout("changeOpacity(10)",900); |
1068 | | | setTimeout("changeOpacity(0)",1000); |
1069 | | | setTimeout("changeUpdate()",1050); |
1070 | | | setTimeout("changeOpacity(10)",1100); |
1071 | | | setTimeout("changeOpacity(20)",1200); |
1072 | | | setTimeout("changeOpacity(30)",1300); |
1073 | | | setTimeout("changeOpacity(40)",1400); |
1074 | | | setTimeout("changeOpacity(50)",1500); |
1075 | | | setTimeout("changeOpacity(60)",1600); |
1076 | | | setTimeout("changeOpacity(70)",1700); |
1077 | | | setTimeout("changeOpacity(80)",1800); |
1078 | | | setTimeout("changeOpacity(90)",1900); |
1079 | | | setTimeout("changeOpacity(100)",2000); |
1080 | | | } |