Advertisement
Guest User

test

a guest
Mar 22nd, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $(document).ready(function(){
  2.    
  3.     function myMap() {
  4.     var mapOptions = {
  5.         center: new google.maps.LatLng(51.5, -0.12),
  6.         zoom: 10,
  7.         mapTypeId: google.maps.MapTypeId.HYBRID
  8.     }
  9. var map = new google.maps.Map(document.getElementById("map"), mapOptions);
  10. }
  11.  
  12.     navigator.permissions.query({name:'geolocation'})
  13.     .then(function(permissionStatus) {  
  14.     console.log('geolocation permission state is ', permissionStatus.state);
  15.  
  16.     permissionStatus.onchange = function() {  
  17.      console.log('geolocation permission state has changed to ', this.state);
  18.     };
  19.   });
  20.     navigator.permissions.query({name:'push', userVisibleOnly:true})
  21.     navigator.permissions.query({name:'midi', sysex:true})
  22.    
  23.     navigator.geolocation.getCurrentPosition(function(position) {  
  24.     console.log('Geolocation permissions granted');  
  25.     console.log('Latitude:' + position.coords.latitude);  
  26.     console.log('Longitude:' + position.coords.longitude);  
  27.  });
  28.  
  29.     Notification.requestPermission(function(result) {  
  30.     if (result === 'denied') {  
  31.     console.log('Permission wasn\'t granted. Allow a retry.');  
  32.     return;  
  33.   }else if (result === 'default') {  
  34.     console.log('The permission request was dismissed.');  
  35.     return;  
  36.   }  
  37.     console.log('Permission was granted for notifications');  
  38.  });
  39.  
  40.  
  41.  
  42. /*  if (navigator.geolocation)
  43. {
  44.     navigator.geolocation.getCurrentPosition(
  45.  
  46.         function (position) {  
  47.     var current_latitude = position.coords.latitude;
  48.     var current_longitude = position.coords.longitude;
  49.     alert ("Latitude"+current_latitude+"Longitude"+current_longitude);(position.coords.latitude,position.coords.longitude);
  50.     }  
  51.         );
  52.     }
  53.      */
  54. function initMap() {
  55.         var uluru = {lat: -25.363, lng: 131.044};
  56.         var map = new google.maps.Map(document.getElementById('map'), {
  57.           zoom: 4,
  58.           center: uluru
  59.         });
  60.         var marker = new google.maps.Marker({
  61.           position: uluru,
  62.           map: map
  63.         });
  64.       }
  65.  
  66. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement