owncalendar/js/geo.js

20 lines
743 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.
*/
2012-09-07 12:32:45 +00:00
if (navigator.geolocation) {
2011-11-11 14:51:44 +00:00
navigator.geolocation.getCurrentPosition(function(position) {
2012-06-09 12:40:15 +00:00
$.post(OC.filePath('calendar', 'ajax/settings', 'guesstimezone.php'), {lat: position.coords.latitude, lng: 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.');
}
});
});
}