-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnounou2gmaps.html.tpl
59 lines (57 loc) · 2.33 KB
/
nounou2gmaps.html.tpl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="https://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr" dir="ltr">
<head>
<title>Adresses des Nounous</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script src="https://maps.googleapis.com/maps/api/js?sensor=false&key={{geo_key}}"></script>
<script type="text/javascript">
$(document).ready(function () {
var map;
var elevator;
var myOptions = {
zoom: 13,
center: new google.maps.LatLng(43.185453, 5.608864),
mapTypeId: 'terrain'
};
map = new google.maps.Map($('#map_canvas')[0], myOptions);
$.getJSON('/nounous/marker.json', null, function (result) {
$.each(result.nounous, function (key, nounou) {
$.getJSON('https://maps.googleapis.com/maps/api/geocode/json?address='+nounou.address+'&sensor=false&key={{geo_key}}', null, function (data) {
if (data.results[0] === undefined) {
console.log("nounou: " + nounou.title + " doesn't have a valid address: " + nounou.address);
}
else {
var p = data.results[0].geometry.location;
var latlng = new google.maps.LatLng(p.lat, p.lng);
var marker = new google.maps.Marker({
position: latlng,
map: map,
title: nounou.title
});
var infowindow = new google.maps.InfoWindow({
content: "<h4>" + nounou.title + "</h4></br>" + nounou.address + "</br><strong>" + nounou.phone + "</strong></br>" + nounou.extra
});
google.maps.event.addListener(marker, 'click', function() {
infowindow.open(map, marker);
});
}
});
});
});
});
</script>
<style>
html, body, #map_canvas {
height: 100%;
margin: 0px;
padding: 0px
}
</style>
</head>
<body class="container" ng-app="prelaunchApp">
<div id="map_canvas"></div></body>
</html>