Skip to content

Instantly share code, notes, and snippets.

@wesleyvicthor
Created September 3, 2012 20:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wesleyvicthor/666ecbea52bc75eec40a to your computer and use it in GitHub Desktop.
Save wesleyvicthor/666ecbea52bc75eec40a to your computer and use it in GitHub Desktop.
issues with namespace in firefox
$(document).on('user.location', getUserLocation);
$(document).on('user.location.check', checkLocation);
$(document).trigger('user.location.check', checkLocation);
function checkLocation()
{
$.get(userLocationUrl, function(result) {
if (!$.isEmptyObject(result)) {
$(document).off('user.location.check');
return;
}
$(document).trigger('user.location');
}, 'json');
}
function getUserLocation()
{
Location.get(function(position, error) {
if (error) {
return error.message;
}
var params = {
uf: position.uf,
city: position.city,
lat: position.coords.latitude,
lng: position.coords.longitude
};
$.get(userLocationUrl, params, function(result) {
if (!$.isEmptyObject(result)) {
window.location.reload();
}
}, 'json');
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment