diff options
author | Christian Pointner <equinox@ffgraz.net> | 2013-12-29 22:59:44 +0000 |
---|---|---|
committer | Christian Pointner <equinox@ffgraz.net> | 2013-12-29 22:59:44 +0000 |
commit | 060170fdb2ec56dde0276c867c6398c745ef238f (patch) | |
tree | 76cc86499c076ea26f09535d1a37956616f5b1d9 | |
parent | 53180fa94e95906400abb7a7979dec0a8764410a (diff) |
clicking on links works now
-rw-r--r-- | map.js | 21 |
1 files changed, 8 insertions, 13 deletions
@@ -182,18 +182,12 @@ function convertCoords(x) { function drawLinks(xmlData) { var element = xmlData.getElementsByTagName("link"); for (var i = 0; i< element.length; i++) { - var state; - var color; - var textcolor; - var width; - state="Unbekannt" var id = element[i].getAttribute("from") + "-" + element[i].getAttribute("to"); links[id] = new Link(element[i]); var line = new google.maps.Polyline({path: [links[id].frompoint, links[id].topoint], strokeColor: makeColor(Math.floor(links[id].value)), strokeWeight: makeWeight(Math.floor(links[id].value))}); line.name = id; - line.textcolor = textcolor; - line.state = state; + line.state = "Unbekannt"; line.overlaytype = "link"; line.linkid = id; line.dnsfrom = element[i].getAttribute("dnsfrom"); @@ -202,8 +196,7 @@ function drawLinks(xmlData) { line.Routerto = element[i].getAttribute("to"); // google.maps.event.addListener(line, "mouseout", function() { lineinfo.style.visibility = "hidden"; }); // google.maps.event.addListener(line, "mouseover", function(point) { showLinkInfo(this, point)}); -// google.maps.event.addListener(line, "click", function(point){onLinkClick(this,point)}); -// google.maps.event.addListener(line, "click", function(latlng){map.openInfoWindowHtml(latlng, message)}); + google.maps.event.addListener(line, "click", function(event) { onLinkClick(this, event.latLng) }); line.setMap(map); overlays["links"].push(line); @@ -321,7 +314,7 @@ function Link(element) { return link; } -function onLinkClick(line,latlng) { +function onLinkClick(line, latlng) { var html ='<div class="locinfo">'; html += '<strong>'+line.name+'</strong>'; html += '<table class="linkinfo">'; @@ -330,7 +323,7 @@ function onLinkClick(line,latlng) { for (var i = 0;i < dnsfrom.length; ++i){ if(dnsfrom[i].indexOf(" (")>=0) { link=dnsfrom[i].substring(0,dnsfrom[i].indexOf(" (")); - } else { + } else { link=dnsfrom[i]; } html += '<tr><td> Router:</td><td> </td><td><a href="http://' + link+ '.ext.graz.funkfeuer.at/" target="_blank">'+dnsfrom[i]+'</td></tr>'; @@ -342,7 +335,7 @@ function onLinkClick(line,latlng) { for (var i = 0;i < dnsto.length; ++i){ if(dnsto[i].indexOf(" (")>=0) { link=dnsto[i].substring(0,dnsto[i].indexOf(" (")); - } else { + } else { link=dnsto[i]; } html += '<tr><td> Router:</td><td> </td><td><a href="http://' + link+ '.ext.graz.funkfeuer.at/" target="_blank">'+dnsto[i]+'</td></tr>'; @@ -350,7 +343,9 @@ function onLinkClick(line,latlng) { } html += '</table>'; html += '</div>'; - map.openInfoWindowHtml(latlng,html); + + var infowindow = new google.maps.InfoWindow({ content: html, position: latlng }); + infowindow.open(map); } function makeColor(value) { |