nextcloud/apps/calendar/js/geo.js

21 lines
777 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) {
$.getJSON(OC.filePath('calendar', 'ajax', 'guesstimezone.php?lat=' + position.coords.latitude + '&long=' + position.coords.longitude + ''),
function(data){
if (data.status == 'success'){
$('#notification').html(data.message);
2011-12-09 17:35:59 +04:00
$('#notification').attr('title', 'CC BY 3.0 by Geonames.org');
2011-11-11 18:51:44 +04:00
$('#notification').slideDown();
window.setTimeout(function(){$('#notification').slideUp();}, 5000);
}else{
console.log('Can\'t set new timezone.');
}
});
});
}