Added errorCallback() to geoCurrentPosition() i.e., if user doesn't

grant permission, removes the Geo processing and (if any) existing geo
location data from notice form.
This commit is contained in:
Sarven Capadisli 2010-01-04 09:52:35 +00:00
parent d1998adb13
commit fe8927a42c

View File

@ -493,7 +493,8 @@ var SN = { // StatusNet
return false;
});
navigator.geolocation.getCurrentPosition(function(position) {
navigator.geolocation.getCurrentPosition(
function(position) {
$('#'+SN.C.S.NoticeLat).val(position.coords.latitude);
$('#'+SN.C.S.NoticeLon).val(position.coords.longitude);
@ -530,7 +531,19 @@ var SN = { // StatusNet
return false;
});
});
});
},
function(error) {
if (error.PERMISSION_DENIED == 1) {
$('label[for='+SN.C.S.NoticeDataGeo+']').removeClass('checked');
NDGS.hide();
$('#'+SN.C.S.NoticeLat).val('');
$('#'+SN.C.S.NoticeLon).val('');
$('#'+SN.C.S.NoticeLocationNs).val('');
$('#'+SN.C.S.NoticeLocationId).val('');
}
}
);
}
else {
$('label[for='+SN.C.S.NoticeDataGeo+']').removeClass('checked');