1 $(document).ready(function() {
2 var params = OSM.params();
4 if (params.lat && params.lon) {
5 $('.edit-located').show();
8 url: "http://nominatim.openstreetmap.org/reverse",
14 success: function(xml) {
15 var result = $(xml).find('result');
17 $('.edit-located').hide();
18 $('.edit-geocoded').show();
19 $('.edit-geocoded-location').text(result.text());
24 $('.start-mapping').on('click', function(e) {
25 window.location = '/edit?zoom=17&lat=' + params.lat + '&lon=' + params.lon;
28 } else if (navigator.geolocation) {
29 $('.edit-geolocated').show();
31 function geoSuccess(position) {
32 window.location = '/edit?zoom=17&lat=' + position.coords.latitude + '&lon=' + position.coords.longitude;
37 .removeClass('loading')
41 $('.start-mapping').on('click', function(e) {
47 // handle firefox's weird implementation
48 // https://bugzilla.mozilla.org/show_bug.cgi?id=675533
49 window.setTimeout(geoError, 4000);
51 navigator.geolocation.getCurrentPosition(geoSuccess, geoError);