diff options
-rw-r--r-- | templates/web/base/maps/google-ol.html | 2 | ||||
-rw-r--r-- | web/js/map-google-ol.js | 24 |
2 files changed, 17 insertions, 9 deletions
diff --git a/templates/web/base/maps/google-ol.html b/templates/web/base/maps/google-ol.html index 58db01856..021570df1 100644 --- a/templates/web/base/maps/google-ol.html +++ b/templates/web/base/maps/google-ol.html @@ -10,7 +10,7 @@ [% END %] [% map_sub_links = BLOCK %] -<a class="hidden-nojs" id="map_layer_toggle" href="">[% loc('Map') %]</a> +<a class="hidden-nojs" id="map_layer_toggle" href="">[% loc('Satellite') %]</a> [% END %] [% map_html = BLOCK %] diff --git a/web/js/map-google-ol.js b/web/js/map-google-ol.js index a0e58cdc2..5a1aa3c57 100644 --- a/web/js/map-google-ol.js +++ b/web/js/map-google-ol.js @@ -1,11 +1,18 @@ $(function(){ - $('#map_layer_toggle').toggle(function(){ - $(this).text(translation_strings.map_satellite); - fixmystreet.map.setBaseLayer(fixmystreet.map.layers[1]); - }, function(){ - $(this).text(translation_strings.map_map); - fixmystreet.map.setBaseLayer(fixmystreet.map.layers[0]); + $('#map_layer_toggle').on('click', function(e){ + e.preventDefault(); + var $t = $(this), text = $t.text(); + if (text == translation_strings.map_map) { + $t.text(translation_strings.map_satellite); + fixmystreet.map.setBaseLayer(fixmystreet.map.layers[0]); + } else { + $t.text(translation_strings.map_map); + fixmystreet.map.setBaseLayer(fixmystreet.map.layers[1]); + } }); + if (typeof fixmystreet_google_default !== 'undefined' && fixmystreet_google_default == 'satellite') { + $('#map_layer_toggle').click(); + } }); function set_map_config(perm) { @@ -25,9 +32,10 @@ function set_map_config(perm) { fixmystreet.map_options = { zoomDuration: 10 }; + fixmystreet.layer_options = [ - { type: google.maps.MapTypeId.HYBRID }, - {} + {}, + { type: google.maps.MapTypeId.HYBRID } ]; } |