geo.js 744 B

1234567891011121314151617181920
  1. /**
  2. * Copyright (c) 2011 Georg Ehrke <ownclouddev at georgswebsite dot de>
  3. * This file is licensed under the Affero General Public License version 3 or
  4. * later.
  5. * See the COPYING-README file.
  6. */
  7. if (navigator.geolocation) {
  8. navigator.geolocation.getCurrentPosition(function(position) {
  9. $.post(OC.filePath('calendar', 'ajax/settings', 'guesstimezone.php'), {lat: position.coords.latitude, lng: position.coords.longitude},
  10. function(data){
  11. if (data.status == 'success' && typeof(data.message) != 'undefined'){
  12. $('#notification').html(data.message);
  13. $('#notification').slideDown();
  14. window.setTimeout(function(){$('#notification').slideUp();}, 5000);
  15. }else{
  16. console.log('Can\'t set new timezone.');
  17. }
  18. });
  19. });
  20. }