mirror of
https://github.com/nikdoof/vapemap.git
synced 2025-12-17 19:59:22 +00:00
Initial Import.
This commit is contained in:
17
app/stores/static/js/geolocation.js
Normal file
17
app/stores/static/js/geolocation.js
Normal file
@@ -0,0 +1,17 @@
|
||||
|
||||
function supports_geolocation() {
|
||||
return 'geolocation' in navigator;
|
||||
}
|
||||
|
||||
function init_geolocation() {
|
||||
if (supports_geolocation()) {
|
||||
navigator.geolocation.getCurrentPosition(handle_geolocation_event)
|
||||
}
|
||||
}
|
||||
|
||||
function handle_geolocation_event(position) {
|
||||
$('#geolocation a').attr('href', '/stores/search/?lat=' + position.coords.latitude + '&lng=' + position.coords.longitude + '&distance=10');
|
||||
$('#geolocation').fadeIn(1000);
|
||||
}
|
||||
|
||||
$(document).ready(function() {init_geolocation();})
|
||||
Reference in New Issue
Block a user