server/apps/calendar/js/geo.js

20 lines
758 B
JavaScript
Raw Normal View History

2011-11-11 14:51:44 +00:00
/**
* Copyright (c) 2011 Georg Ehrke <ownclouddev at georgswebsite dot de>
* This file is licensed under the Affero General Public License version 3 or
* later.
* See the COPYING-README file.
*/
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function(position) {
2012-04-30 19:18:34 +00:00
$.getJSON(OC.filePath('calendar', 'ajax/settings', 'guesstimezone.php') + '?lat=' + position.coords.latitude + '&long=' + position.coords.longitude,
2011-11-11 14:51:44 +00:00
function(data){
if (data.status == 'success' && typeof(data.message) != 'undefined'){
2011-11-11 14:51:44 +00:00
$('#notification').html(data.message);
$('#notification').slideDown();
window.setTimeout(function(){$('#notification').slideUp();}, 5000);
}else{
console.log('Can\'t set new timezone.');
}
});
});
}