nextcloud/apps/calendar/js/geo.js

20 lines
758 B
JavaScript
Raw Normal View History

2011-11-11 18:51:44 +04: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-02-20 14:27:25 +04:00
$.getJSON(OC.filePath('calendar', 'ajax/settings', 'guesstimezone.php?lat=' + position.coords.latitude + '&long=' + position.coords.longitude + ''),
2011-11-11 18:51:44 +04:00
function(data){
if (data.status == 'success' && typeof(data.message) != 'undefined'){
2011-11-11 18:51:44 +04:00
$('#notification').html(data.message);
$('#notification').slideDown();
window.setTimeout(function(){$('#notification').slideUp();}, 5000);
}else{
console.log('Can\'t set new timezone.');
}
});
});
}