//depot/projects/wardrive-map/map.html#4 – edit change 182 (text) ·revision history
| 1 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" |
| 2 | "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> |
| 3 | <html xmlns="http://www.w3.org/1999/xhtml"> |
| 4 | <head> |
| 5 | <title>ttul wardrive map</title> |
| 6 | <script src="http://maps.google.com/maps?file=api&v=1&key=ABQIAAAA_FAKE_KEY_FOR_TTUL_ORG" type="text/javascript"></script> |
| 7 | <style type="text/css"> |
| 8 | body { font-family: Verdana, sans-serif; font-size: 80%; } |
| 9 | #map { width: 700px; height: 500px; border: 1px solid #999; } |
| 10 | </style> |
| 11 | </head> |
| 12 | <body> |
| 13 | <h1>Access points of Vancouver</h1> |
| 14 | <div id="map"></div> |
| 15 | <p id="status">loading...</p> |
| 16 | <script type="text/javascript"> |
| 17 | //<![CDATA[ |
| 18 | var map = new GMap(document.getElementById("map")); |
| 19 | map.addControl(new GLargeMapControl()); |
| 20 | map.addControl(new GMapTypeControl()); |
| 21 | map.centerAndZoom(new GPoint(-123.1207, 49.2827), 4); |
| 22 | |
| 23 | function getXHR() { |
| 24 | if (window.XMLHttpRequest) return new XMLHttpRequest(); |
| 25 | try { return new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) {} |
| 26 | return new ActiveXObject("Microsoft.XMLHTTP"); |
| 27 | } |
| 28 | |
| 29 | function pin(color) { |
| 30 | var icon = new GIcon(); |
| 31 | icon.image = "icons/" + color + ".png"; |
| 32 | icon.iconSize = new GSize(12, 20); |
| 33 | icon.iconAnchor = new GPoint(6, 20); |
| 34 | icon.infoWindowAnchor = new GPoint(5, 1); |
| 35 | return icon; |
| 36 | } |
| 37 | var openPin = pin("green"), wepPin = pin("red"); |
| 38 | |
| 39 | function makeMarker(p, icon, html) { |
| 40 | var m = new GMarker(p, icon); |
| 41 | GEvent.addListener(m, "click", function() { m.openInfoWindowHtml(html); }); |
| 42 | return m; |
| 43 | } |
| 44 | |
| 45 | var req = getXHR(); |
| 46 | req.open("GET", "nets.xml", true); |
| 47 | req.onreadystatechange = function() { |
| 48 | if (req.readyState != 4) return; |
| 49 | var nets = req.responseXML.documentElement.getElementsByTagName("net"); |
| 50 | for (var i = 0; i < nets.length; i++) { |
| 51 | var p = new GPoint(parseFloat(nets[i].getAttribute("lng")), |
| 52 | parseFloat(nets[i].getAttribute("lat"))); |
| 53 | var html = "<b>" + nets[i].getAttribute("ssid") + "</b><br/>ch " + |
| 54 | nets[i].getAttribute("chan"); |
| 55 | var icon = nets[i].getAttribute("wep") == "1" ? wepPin : openPin; |
| 56 | map.addOverlay(makeMarker(p, icon, html)); |
| 57 | } |
| 58 | document.getElementById("status").innerHTML = nets.length + " networks"; |
| 59 | }; |
| 60 | req.send(null); |
| 61 | //]]> |
| 62 | </script> |
| 63 | </body> |
| 64 | </html> |