diff options
Diffstat (limited to 'templates/includes/map_entry_list_template.html')
-rw-r--r-- | templates/includes/map_entry_list_template.html | 58 |
1 files changed, 31 insertions, 27 deletions
diff --git a/templates/includes/map_entry_list_template.html b/templates/includes/map_entry_list_template.html index 206430a..aae8950 100644 --- a/templates/includes/map_entry_list_template.html +++ b/templates/includes/map_entry_list_template.html @@ -1,6 +1,33 @@ {% load typogrify %} {% load truncateletters %} {% load slugify_under %} + + // center on a country + function focusCountry(latitude, longitude, zoom) { + map.setZoom(zoom); + map.panTo(new google.maps.LatLng(latitude, longitude)); + }; + + {% for route in route_list %} + var {{route.template_var_name}} = [ + {% for point in route.geometry.coords%} + new google.maps.LatLng({{point.1}}, {{point.0}}){% if forloop.last%}{%else%},{%endif%} + {% endfor %} + ]; + {% endfor %} + function showRoute(route, zoom, latitude, longitude) { + var routePath = new google.maps.Polyline({ + path: eval(route), + strokeColor: "#FF0000", + strokeOpacity: 1.0, + strokeWeight: 2 + }); + map.setZoom(zoom); + map.panTo(new google.maps.LatLng(latitude, longitude)); + routePath.setMap(map); + return false; + }; +var map; function initialize() { //custom marker @@ -75,33 +102,10 @@ function initialize() { }); //function to handle click event and display single info window function openWin(content, marker) { - infowindow.close() + infowindow.close(); infowindow.setContent(content); infowindow.open(map,marker); - } -} -// center on a country - function focusCountry(latitude, longitude, zoom) { - map.setZoom(zoom); - map.panTo(new google.maps.LatLng(latitude, longitude)); - }; - -{% for route in route_list %} -var {{route.template_var_name}} = [ -{% for point in route.geometry.coords%} - new google.maps.LatLng({{point.1}}, {{point.0}}){% if forloop.last%}{%else%},{%endif%} -{% endfor %} - ]; -{% endfor %} -function showRoute(route, zoom, latitude, longitude) { - var routePath = new google.maps.Polyline({ - path: eval(route), - strokeColor: "#FF0000", - strokeOpacity: 1.0, - strokeWeight: 2 - }); - map.setZoom(zoom); - map.panTo(new google.maps.LatLng(latitude, longitude)); - routePath.setMap(map); - return false; + }; + + } |