server/apps/calendar/js/geo.js
2012-01-02 11:35:50 +01:00

21 lines
No EOL
816 B
JavaScript
Executable file

/**
* 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' && typeof(data.message) != 'undefined'){
$('#notification').html(data.message);
$('#notification').attr('title', 'CC BY 3.0 by Geonames.org');
$('#notification').slideDown();
window.setTimeout(function(){$('#notification').slideUp();}, 5000);
}else{
console.log('Can\'t set new timezone.');
}
});
});
}