A calendar management project, for events and activities related to communities fighting for freedoms.
This can be related to software, art, data, hardware, content, commons, internet.
https://www.agendadulibre.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

26 lines
776 B

$(document).on 'turbolinks:load', ->
return unless navigator.geolocation
$('a.near-me').click (event) ->
event.preventDefault()
# We store the url we're going to
window.goto = event.target.href
navigator.geolocation.getCurrentPosition showPosition, (error) ->
switch error.code
when error.PERMISSION_DENIED
$('ul.regions li#near-me').remove()
$('body.pages.show form').submit ->
# Juggle between near location and city
if $('#near_location').val() && $('#near_distance').val()
$('#city').val('')
else
$('#city').val($('#near_location').val())
$('#near_location').val('')
showPosition = (position) ->
location.replace window.goto.replace '[me]',
"[#{position.coords.latitude.toFixed(2)}, #{position.coords.longitude.toFixed(2)}]"