Fixed loading of API

master
Keith Irwin 2017-08-07 10:24:58 -04:00
parent 10709b1342
commit 3d3838943b
No known key found for this signature in database
GPG Key ID: 378933C743E2BBC0
2 changed files with 6 additions and 6 deletions

View File

@ -26,7 +26,7 @@
<main></main>
<script async defer
src="https://maps.googleapis.com/maps/api/js?key=AIzaSyCNFRG3ItKvYNSTCJrDcQCqy0470RdhI6A&callback=init">
src="https://maps.googleapis.com/maps/api/js?key=AIzaSyAaDEDFAbk7Iefh9y61wuooDH2kWHRT_k8&callback=init">
</script>
<script src="script.js"></script>

View File

@ -1,12 +1,12 @@
'use strict';
/* global navigator googlemaps $ */
/* global navigator google */
var pano, newLoc;
const main = document.getElementsByTagName('main')[0];
// Create panorama
function init(){
pano = new googlemaps.StreetViewPanorama(main, {
pano = new google.maps.StreetViewPanorama(main, {
panControl: false,
zoomControl: false,
addressControl: false,
@ -20,7 +20,7 @@ function init(){
function getStreetViewData(loc,rad,cb) {
// Ensure that the location hasn't changed (or this is the initial setting)
if ( newLoc == null || loc.tim===newLoc.tim ) {
if (!sv) { var sv=new googlemaps.StreetViewService(); }
if (!sv) { var sv=new google.maps.StreetViewService(); }
sv.getPanorama({
location: {
lat: loc.lat,
@ -29,11 +29,11 @@ function getStreetViewData(loc,rad,cb) {
radius: rad
}, function(data,status){ switch (status){
// Success
case googlemaps.StreetViewStatus.OK:
case google.maps.StreetViewStatus.OK:
cb(data);
break;
// No results in that radius
case googlemaps.StreetViewStatus.ZERO_RESULTS:
case google.maps.StreetViewStatus.ZERO_RESULTS:
// Try again with a bigger radius
getStreetViewData(loc,rad*2,cb);
break;