add apikey to map

This commit is contained in:
Jan-Piet Mens 2016-07-15 09:05:51 +02:00
parent 834530a1f5
commit b8325f49de
2 changed files with 21 additions and 4 deletions

View File

@ -3,7 +3,7 @@
// https://developers.google.com/maps/documentation/javascript/datalayer
var infowindow = new google.maps.InfoWindow();
var infowindow;
function processPoints(geometry, callback, thisArg) {
if (geometry instanceof google.maps.LatLng) {
@ -22,6 +22,8 @@ function initialize() {
var map;
var center = new google.maps.LatLng( 46.993665, 10.399188);
infowindow = new google.maps.InfoWindow();
mapOptions = {
center: center,
zoom: 5,
@ -92,5 +94,3 @@ function initialize() {
infowindow.open(map);
});
}
google.maps.event.addDomListener(window, 'load', initialize);

View File

@ -16,10 +16,27 @@
body { font-size: 80%; padding: 0; margin: 0px; }
</style>
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&signed_in=true"></script>
<script src="../static/js/mustache.js"></script>
<script src="../static/js/moment.min.js"></script>
<script src="functions.js"></script>
<script src="../static/apikey.js"></script>
<script>
function loadMapsAPI() {
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = 'https://maps.googleapis.com/maps/api/js?v=3' +
'&signed_in=true&key=' + apiKey +'&callback=initialize';
document.body.appendChild(script);
}
document.addEventListener("DOMContentLoaded", function(event) {
loadMapsAPI();
});
</script>
</head>
<body>
<div id="map-canvas"></div>