//depot/projects/wardrive-map/map.html#2 – edit change 126 (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.centerAndZoom(new GPoint(-123.1207, 49.2827), 4); |
| 21 | |
| 22 | function getXHR() { |
| 23 | if (window.XMLHttpRequest) return new XMLHttpRequest(); |
| 24 | try { return new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) {} |
| 25 | return new ActiveXObject("Microsoft.XMLHTTP"); |
| 26 | } |
| 27 | |
| 28 | function makeMarker(p, html) { |
| 29 | var m = new GMarker(p); |
| 30 | GEvent.addListener(m, "click", function() { m.openInfoWindowHtml(html); }); |
| 31 | return m; |
| 32 | } |
| 33 | |
| 34 | var req = getXHR(); |
| 35 | req.open("GET", "nets.xml", true); |
| 36 | req.onreadystatechange = function() { |
| 37 | if (req.readyState != 4) return; |
| 38 | var nets = req.responseXML.documentElement.getElementsByTagName("net"); |
| 39 | for (var i = 0; i < nets.length; i++) { |
| 40 | var p = new GPoint(parseFloat(nets[i].getAttribute("lng")), |
| 41 | parseFloat(nets[i].getAttribute("lat"))); |
| 42 | var html = "<b>" + nets[i].getAttribute("ssid") + "</b><br/>ch " + |
| 43 | nets[i].getAttribute("chan"); |
| 44 | map.addOverlay(makeMarker(p, html)); |
| 45 | } |
| 46 | document.getElementById("status").innerHTML = nets.length + " networks"; |
| 47 | }; |
| 48 | req.send(null); |
| 49 | //]]> |
| 50 | </script> |
| 51 | </body> |
| 52 | </html> |