| Current Path : /home/helpink/www/media/astroid/js/ |
| Current File : /home/helpink/www/media/astroid/js/gmap.min.js |
(function($){$(document).ready(function(){async function initMap(gmap,gdata){const{Map}=await google.maps.importLibrary("maps");const{AdvancedMarkerElement}=await google.maps.importLibrary("marker");const position={lat:parseFloat(gdata.lat),lng:parseFloat(gdata.lng)};$(gmap).empty().removeClass("d-none");let map=new Map(gmap,{center:position,zoom:parseInt(gdata.zoom),mapTypeId:gdata.type,scrollwheel:parseInt(gdata.mousescroll)!==0,disableDefaultUI:parseInt(gdata.show_controllers)!==1,mapId:"DEMO_MAP_ID"});const marker=new AdvancedMarkerElement({map:map,position:position,title:gdata.title});if(gdata.infowindow!==""){const infowindow=new google.maps.InfoWindow({content:"<h5>"+gdata.title+"</h5>"+"<div>"+gdata.infowindow+"</div>",ariaLabel:gdata.title});marker.addListener("click",()=>{infowindow.open({anchor:marker,map:map})})}if(gdata.locations.length){gdata.locations.forEach(location=>{const _marker=new AdvancedMarkerElement({map:map,position:{lat:parseFloat(location.latitude),lng:parseFloat(location.longitude)},title:location.address});const _infowindow=new google.maps.InfoWindow({content:location.address,ariaLabel:location.address});_marker.addListener("click",()=>{_infowindow.open({anchor:_marker,map:map})})})}}Array.from(document.querySelectorAll(".as-gmap")).forEach(function(gmap){initMap(gmap,JSON.parse($(gmap).text()))})})})(jQuery);