This filter is based on the geocoding filter, when no distance has been set... Refs #170master
parent
f9470cf07d
commit
fb01a0f8da
18 changed files with 53952 additions and 17 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Binary file not shown.
@ -0,0 +1,32 @@ |
||||
(function() { |
||||
var showPosition; |
||||
|
||||
$(document).on('turbolinks:load', function() { |
||||
if (!navigator.geolocation) { |
||||
return; |
||||
} |
||||
$('a.near-me').click(function(event) { |
||||
event.preventDefault(); |
||||
window.goto = event.target.href; |
||||
return navigator.geolocation.getCurrentPosition(showPosition, function(error) { |
||||
switch (error.code) { |
||||
case error.PERMISSION_DENIED: |
||||
return $('ul.regions li#near-me').remove(); |
||||
} |
||||
}); |
||||
}); |
||||
return $('body.pages.show form').submit(function() { |
||||
if ($('#near_location').val() && $('#near_distance').val()) { |
||||
return $('#city').val(''); |
||||
} else { |
||||
$('#city').val($('#near_location').val()); |
||||
return $('#near_location').val(''); |
||||
} |
||||
}); |
||||
}); |
||||
|
||||
showPosition = function(position) { |
||||
return location.replace(window.goto.replace('[me]', "[" + (position.coords.latitude.toFixed(2)) + ", " + (position.coords.longitude.toFixed(2)) + "]")); |
||||
}; |
||||
|
||||
}).call(this); |
Binary file not shown.
Loading…
Reference in new issue