aboutsummaryrefslogtreecommitdiffstats
path: root/web/js/map-google-ol.js
diff options
context:
space:
mode:
Diffstat (limited to 'web/js/map-google-ol.js')
-rw-r--r--web/js/map-google-ol.js24
1 files changed, 16 insertions, 8 deletions
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 }
];
}