]> git.openstreetmap.org Git - rails.git/blobdiff - app/assets/javascripts/welcome.js
Propagate API keys to minimaps in layer switcher
[rails.git] / app / assets / javascripts / welcome.js
index 60648383adc10efa3979950848b5ef47c834be2c..5ba0d7cd2183e28f3ffcbaa88d5901eefece4531 100644 (file)
@@ -16,32 +16,32 @@ $(document).ready(function() {
 
     $('.start-mapping').attr('href', url);
 
 
     $('.start-mapping').attr('href', url);
 
-  } else if (navigator.geolocation) {
-    function geoSuccess(position) {
+  } else {
+    var geoSuccess = function (position) {
       window.location = '/edit' + OSM.formatHash({
         zoom: 17,
         lat: position.coords.latitude,
         lon: position.coords.longitude
       });
       window.location = '/edit' + OSM.formatHash({
         zoom: 17,
         lat: position.coords.latitude,
         lon: position.coords.longitude
       });
-    }
-
-    function geoError() {
-      $('.start-mapping')
-        .removeClass('loading')
-        .addClass('error');
-    }
+    };
 
     $('.start-mapping').on('click', function(e) {
       e.preventDefault();
 
     $('.start-mapping').on('click', function(e) {
       e.preventDefault();
+      $('.start-mapping').addClass('loading');
 
 
-      $('.start-mapping')
-        .addClass('loading');
+      if (navigator.geolocation) {
+        // handle firefox's weird implementation
+        // https://bugzilla.mozilla.org/show_bug.cgi?id=675533
+        window.setTimeout(manualEdit, 4000);
 
 
-      // handle firefox's weird implementation
-      // https://bugzilla.mozilla.org/show_bug.cgi?id=675533
-      window.setTimeout(geoError, 4000);
-
-      navigator.geolocation.getCurrentPosition(geoSuccess, geoError);
+        navigator.geolocation.getCurrentPosition(geoSuccess, manualEdit);
+      } else {
+        manualEdit();
+      }
     });
   }
     });
   }
+
+  function manualEdit() {
+    window.location = '/?edit_help=1';
+  }
 });
 });