diff --git a/servers/dotNet/DisplayMap-Blue.aspx b/servers/dotNet/DisplayMap-Blue.aspx index 5cce8c70..09af958f 100644 --- a/servers/dotNet/DisplayMap-Blue.aspx +++ b/servers/dotNet/DisplayMap-Blue.aspx @@ -8,7 +8,9 @@ - + diff --git a/servers/dotNet/DisplayMap-Dark.aspx b/servers/dotNet/DisplayMap-Dark.aspx index f6e229dd..e80689ec 100644 --- a/servers/dotNet/DisplayMap-Dark.aspx +++ b/servers/dotNet/DisplayMap-Dark.aspx @@ -8,7 +8,9 @@ - + diff --git a/servers/dotNet/DisplayMap.aspx b/servers/dotNet/DisplayMap.aspx index 6f20a424..9bc970de 100755 --- a/servers/dotNet/DisplayMap.aspx +++ b/servers/dotNet/DisplayMap.aspx @@ -8,7 +8,9 @@ - + diff --git a/servers/dotNet/js/maps.js b/servers/dotNet/js/maps.js index 77208319..7d41edac 100644 --- a/servers/dotNet/js/maps.js +++ b/servers/dotNet/js/maps.js @@ -147,29 +147,37 @@ // use leaflet (http://leafletjs.com/) to create our map and map layers var gpsTrackerMap = new L.map('map-canvas'); - - var openStreetMapsURL = ('https:' == document.location.protocol ? 'https://' : 'http://') + - '{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'; - var openStreetMapsLayer = new L.TileLayer(openStreetMapsURL, - {attribution:'©2014 OpenStreetMap contributors'}); - // need to get your own bing maps key, http://www.microsoft.com/maps/create-a-bing-maps-key.aspx - // var bingMapsLayer = new L.BingLayer("GetAKey"); - var googleMapsLayer = new L.Google('ROADMAP'); - // this fixes the zoom buttons from freezing // https://github.com/shramov/leaflet-plugins/issues/62 L.polyline([[0, 0], ]).addTo(gpsTrackerMap); + + // this is the switcher control to switch between map types (upper right hand corner of map) + var layerSwitcher = new L.Control.Layers({}, {}); // add basemap layers below + layerSwitcher.addTo(gpsTrackerMap); - // this sets which map layer will first be displayed - gpsTrackerMap.addLayer(googleMapsLayer); - - // this is the switcher control to switch between map types - gpsTrackerMap.addControl(new L.Control.Layers({ - // 'Bing Maps':bingMapsLayer, - 'Google Maps':googleMapsLayer, - 'OpenStreetMaps':openStreetMapsLayer - }, {})); + // ------ OpenStreetMap basemap: ------ + var openStreetMapsURL = ('https:' == document.location.protocol ? 'https://' : 'http://') + + '{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'; + var openStreetMapsLayer = new L.TileLayer(openStreetMapsURL, + {attribution:'©2014 OpenStreetMap contributors'}); + layerSwitcher.addBaseLayer(openStreetMapsLayer, "OpenStreetMap"); + + // ------ OpenCycleMap basemap: ------ + var openCycleMapsURL = ('https:' == document.location.protocol ? 'https://' : 'http://') + + '{s}.tile.opencyclemap.org/cycle/{z}/{x}/{y}.png'; + var openCycleMapsLayer = new L.TileLayer(openCycleMapsURL, + {attribution:'©2014 OpenCycleMap contributors'}); + layerSwitcher.addBaseLayer(openCycleMapsLayer, "OpenCycleMap"); + + // ------ Google basemap: ------ + if (typeof google != "undefined") { + var googleMapsLayer = new L.Google('ROADMAP'); + layerSwitcher.addBaseLayer(googleMapsLayer, "Google Maps"); + }; + + // this sets which map layer will be displayed by default, + gpsTrackerMap.addLayer(openStreetMapsLayer); } var finalLocation = false; @@ -337,19 +345,21 @@ function displayCityName(latitude, longitude) { var lat = parseFloat(latitude); var lng = parseFloat(longitude); - var latlng = new google.maps.LatLng(lat, lng); - var reverseGeocoder = new google.maps.Geocoder(); - reverseGeocoder.geocode({'latLng': latlng}, function(results, status) { - if (status == google.maps.GeocoderStatus.OK) { - // results[0] is full address - if (results[1]) { - var reverseGeocoderResult = results[1].formatted_address; - showPermanentMessage(reverseGeocoderResult); + if (typeof google != "undefined") { + var latlng = new google.maps.LatLng(lat, lng); + var reverseGeocoder = new google.maps.Geocoder(); + reverseGeocoder.geocode({'latLng': latlng}, function(results, status) { + if (status == google.maps.GeocoderStatus.OK) { + // results[0] is full address + if (results[1]) { + var reverseGeocoderResult = results[1].formatted_address; + showPermanentMessage(reverseGeocoderResult); + } + } else { + console.log('Geocoder failed due to: ' + status); } - } else { - console.log('Geocoder failed due to: ' + status); - } - }); + }); + } } function turnOffAutoRefresh() { diff --git a/servers/php/displaymap-blue.php b/servers/php/displaymap-blue.php index 1227d775..fd2415f0 100644 --- a/servers/php/displaymap-blue.php +++ b/servers/php/displaymap-blue.php @@ -6,7 +6,9 @@ - + diff --git a/servers/php/displaymap-dark.php b/servers/php/displaymap-dark.php index 7db0f8a7..5bbc6426 100644 --- a/servers/php/displaymap-dark.php +++ b/servers/php/displaymap-dark.php @@ -6,7 +6,9 @@ - + diff --git a/servers/php/displaymap.php b/servers/php/displaymap.php index d1b23b12..7c12ca5b 100644 --- a/servers/php/displaymap.php +++ b/servers/php/displaymap.php @@ -6,7 +6,9 @@ - + diff --git a/servers/php/js/maps.js b/servers/php/js/maps.js index 9e60b1d5..326a64fd 100644 --- a/servers/php/js/maps.js +++ b/servers/php/js/maps.js @@ -147,29 +147,43 @@ // use leaflet (http://leafletjs.com/) to create our map and map layers var gpsTrackerMap = new L.map('map-canvas'); - + + // this fixes the zoom buttons from freezing + // https://github.com/shramov/leaflet-plugins/issues/62 + L.polyline([[0, 0], ]).addTo(gpsTrackerMap); + + // this is the switcher control to switch between map types (upper right hand corner of map) + var layerSwitcher = new L.Control.Layers({}, {}); // add basemap layers below + layerSwitcher.addTo(gpsTrackerMap); + + // ------ OpenStreetMap basemap: ------ var openStreetMapsURL = ('https:' == document.location.protocol ? 'https://' : 'http://') + '{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'; var openStreetMapsLayer = new L.TileLayer(openStreetMapsURL, {attribution:'©2014 OpenStreetMap contributors'}); + layerSwitcher.addBaseLayer(openStreetMapsLayer, "OpenStreetMap"); - // need to get your own bing maps key, http://www.microsoft.com/maps/create-a-bing-maps-key.aspx - // var bingMapsLayer = new L.BingLayer("GetAKey"); - var googleMapsLayer = new L.Google('ROADMAP'); - - // this fixes the zoom buttons from freezing - // https://github.com/shramov/leaflet-plugins/issues/62 - L.polyline([[0, 0], ]).addTo(gpsTrackerMap); - - // this sets which map layer will first be displayed - gpsTrackerMap.addLayer(googleMapsLayer); + // ------ OpenCycleMap basemap: ------ + var openCycleMapsURL = ('https:' == document.location.protocol ? 'https://' : 'http://') + + '{s}.tile.opencyclemap.org/cycle/{z}/{x}/{y}.png'; + var openCycleMapsLayer = new L.TileLayer(openCycleMapsURL, + {attribution:'©2014 OpenCycleMap contributors'}); + layerSwitcher.addBaseLayer(openCycleMapsLayer, "OpenCycleMap"); - // this is the switcher control to switch between map types - gpsTrackerMap.addControl(new L.Control.Layers({ - // 'Bing Maps':bingMapsLayer, - 'Google Maps':googleMapsLayer, - 'OpenStreetMaps':openStreetMapsLayer - }, {})); + // ------ Bing basemap: ------ + // need to get your own bing maps key, http://www.microsoft.com/maps/create-a-bing-maps-key.aspx + // and include the Bing API +// var bingMapsLayer = new L.BingLayer("AnH1IKGCBwAiBWfYAHMtIfIhMVybHFx2GxsReNP5W0z6P8kRa67_QwhM4PglI9yL"); +// layerSwitcher.addBaseLayer(bingMapsLayer, "Bing Maps"); + + // ------ Google basemap: ------ + if (typeof google != "undefined") { + var googleMapsLayer = new L.Google('ROADMAP'); + layerSwitcher.addBaseLayer(googleMapsLayer, "Google Maps"); + }; + + // this sets which map layer will be displayed by default, + gpsTrackerMap.addLayer(openStreetMapsLayer); } var finalLocation = false; @@ -337,19 +351,21 @@ function displayCityName(latitude, longitude) { var lat = parseFloat(latitude); var lng = parseFloat(longitude); - var latlng = new google.maps.LatLng(lat, lng); - var reverseGeocoder = new google.maps.Geocoder(); - reverseGeocoder.geocode({'latLng': latlng}, function(results, status) { - if (status == google.maps.GeocoderStatus.OK) { - // results[0] is full address - if (results[1]) { - var reverseGeocoderResult = results[1].formatted_address; - showPermanentMessage(reverseGeocoderResult); + if (typeof google != "undefined") { + var latlng = new google.maps.LatLng(lat, lng); + var reverseGeocoder = new google.maps.Geocoder(); + reverseGeocoder.geocode({'latLng': latlng}, function(results, status) { + if (status == google.maps.GeocoderStatus.OK) { + // results[0] is full address + if (results[1]) { + var reverseGeocoderResult = results[1].formatted_address; + showPermanentMessage(reverseGeocoderResult); + } + } else { + console.log('Geocoder failed due to: ' + status); } - } else { - console.log('Geocoder failed due to: ' + status); - } - }); + }); + } } function turnOffAutoRefresh() { diff --git a/servers/wordpress/gps-tracker/public/assets/js/gpstracker-map.js b/servers/wordpress/gps-tracker/public/assets/js/gpstracker-map.js index af8dc24c..a2c4d3ce 100644 --- a/servers/wordpress/gps-tracker/public/assets/js/gpstracker-map.js +++ b/servers/wordpress/gps-tracker/public/assets/js/gpstracker-map.js @@ -150,29 +150,44 @@ jQuery(document).ready(function($) { // use leaflet (http://leafletjs.com/) to create our map and map layers var gpsTrackerMap = new L.map('map-canvas'); - + + // this fixes the zoom buttons from freezing + // https://github.com/shramov/leaflet-plugins/issues/62 + L.polyline([[0, 0], ]).addTo(gpsTrackerMap); + + // this is the switcher control to switch between map types (upper right hand corner of map) + var layerSwitcher = new L.Control.Layers({}, {}); // add basemap layers below + layerSwitcher.addTo(gpsTrackerMap); + + // ------ OpenStreetMap basemap: ------ var openStreetMapsURL = ('https:' == document.location.protocol ? 'https://' : 'http://') + '{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'; var openStreetMapsLayer = new L.TileLayer(openStreetMapsURL, {attribution:'©2014 OpenStreetMap contributors'}); + layerSwitcher.addBaseLayer(openStreetMapsLayer, "OpenStreetMap"); + + // ------ OpenCycleMap basemap: ------ + var openCycleMapsURL = ('https:' == document.location.protocol ? 'https://' : 'http://') + + '{s}.tile.opencyclemap.org/cycle/{z}/{x}/{y}.png'; + var openCycleMapsLayer = new L.TileLayer(openCycleMapsURL, + {attribution:'©2014 OpenCycleMap contributors'}); + layerSwitcher.addBaseLayer(openCycleMapsLayer, "OpenCycleMap"); + // ------ Bing basemap: ------ // need to get your own bing maps key, http://www.microsoft.com/maps/create-a-bing-maps-key.aspx - // var bingMapsLayer = new L.BingLayer("GetAKey"); - var googleMapsLayer = new L.Google('ROADMAP'); - - // this fixes the zoom buttons from freezing - // https://github.com/shramov/leaflet-plugins/issues/62 - L.polyline([[0, 0], ]).addTo(gpsTrackerMap); + // and include the Bing API +// var bingMapsLayer = new L.BingLayer("AnH1IKGCBwAiBWfYAHMtIfIhMVybHFx2GxsReNP5W0z6P8kRa67_QwhM4PglI9yL"); +// layerSwitcher.addBaseLayer(bingMapsLayer, "Bing Maps"); - // this sets which map layer will first be displayed, go ahead and change it to bingMapsLayer or openStreetMapsLayer to see - gpsTrackerMap.addLayer(googleMapsLayer); + // ------ Google basemap: ------ + if (typeof google != "undefined") { + var googleMapsLayer = new L.Google('ROADMAP'); + layerSwitcher.addBaseLayer(googleMapsLayer, "Google Maps"); + }; + + // this sets which map layer will be displayed by default, + gpsTrackerMap.addLayer(openStreetMapsLayer); - // this is the switcher control to switch between map types (upper right hand corner of map) - gpsTrackerMap.addControl(new L.Control.Layers({ - // 'Bing Maps':bingMapsLayer, - 'Google Maps':googleMapsLayer, - 'OpenStreetMaps':openStreetMapsLayer - }, {})); } var locationArray = []; @@ -333,22 +348,24 @@ jQuery(document).ready(function($) { function displayCityName(latitude, longitude) { var lat = parseFloat(latitude); var lng = parseFloat(longitude); - var latlng = new google.maps.LatLng(lat, lng); - reverseGeocoder = new google.maps.Geocoder(); - reverseGeocoder.geocode({'latLng': latlng}, function(results, status) { - - if (status == google.maps.GeocoderStatus.OK) { - // results[0] is full address - if (results[1]) { - reverseGeocoderResult = results[1].formatted_address; - showPermanentMessage(reverseGeocoderResult); - } else { - console.log('No results found'); - } - } else { - console.log('Geocoder failed due to: ' + status); - } - }); + if (typeof google != "undefined") { + var latlng = new google.maps.LatLng(lat, lng); + reverseGeocoder = new google.maps.Geocoder(); + reverseGeocoder.geocode({'latLng': latlng}, function(results, status) { + + if (status == google.maps.GeocoderStatus.OK) { + // results[0] is full address + if (results[1]) { + reverseGeocoderResult = results[1].formatted_address; + showPermanentMessage(reverseGeocoderResult); + } else { + console.log('No results found'); + } + } else { + console.log('Geocoder failed due to: ' + status); + } + }); + } } function deleteRoute() { diff --git a/servers/wordpress/gps-tracker/public/class-gpstracker.php b/servers/wordpress/gps-tracker/public/class-gpstracker.php index 8de64d07..d97e515d 100644 --- a/servers/wordpress/gps-tracker/public/class-gpstracker.php +++ b/servers/wordpress/gps-tracker/public/class-gpstracker.php @@ -200,7 +200,7 @@ public function enqueue_styles() { * @since 1.0.0 */ public function enqueue_scripts() { - wp_enqueue_script( $this->plugin_slug . '-gpstracker-google-maps', '//maps.google.com/maps/api/js?v=3&sensor=false&libraries=adsense', array(), self::VERSION ); +// wp_enqueue_script( $this->plugin_slug . '-gpstracker-google-maps', '//maps.google.com/maps/api/js?v=3&sensor=false&libraries=adsense', array(), self::VERSION ); wp_enqueue_script( $this->plugin_slug . '-gpstracker-map-js', plugins_url( 'assets/js/gpstracker-map.js', __FILE__ ), array('jquery'), self::VERSION ); wp_enqueue_script( $this->plugin_slug . '-gpstracker-leaflet-js', plugins_url( 'assets/js/leaflet-0.7.5/leaflet.js', __FILE__ ), array('jquery'), self::VERSION ); wp_enqueue_script( $this->plugin_slug . '-gpstracker-google-js', plugins_url( 'assets/js/leaflet-plugins/google.js', __FILE__ ), array('jquery'), self::VERSION );