![]() Server : LiteSpeed System : Linux premium84.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64 User : claqxcrl ( 523) PHP Version : 8.1.32 Disable Function : NONE Directory : /home/claqxcrl/confenda.com/wp-content/plugins/wp-event-partners/admin/assets/js/ |
function initMap() { var lat = parseFloat(document.getElementById('lat').value); var lng = parseFloat(document.getElementById('lng').value); if (lat){ var lat = parseFloat(document.getElementById('lat').value); } else { var lat = 27.700769; } if (lng){ var lng = parseFloat(document.getElementById('lng').value); } else { var lng = 85.300140; } var myLatLng = {lat: lat, lng: lng}; var map = new google.maps.Map(document.getElementById('map'), { center: myLatLng, zoom: 13 }); var card = document.getElementById('pac-card'); var input = document.getElementById('pac-input'); var types = document.getElementById('type-selector'); map.controls[google.maps.ControlPosition.TOP_RIGHT].push(card); var autocomplete = new google.maps.places.Autocomplete(input); // Bind the map's bounds (viewport) property to the autocomplete object, // so that the autocomplete requests use the current map bounds for the // bounds option in the request. autocomplete.bindTo('bounds', map); // Set the data fields to return when the user selects a place. autocomplete.setFields( ['address_components', 'geometry', 'icon', 'name']); //var infowindow = new google.maps.InfoWindow(); //var infowindowContent = document.getElementById('infowindow-content'); //infowindow.setContent(infowindowContent); var marker = new google.maps.Marker({ map: map, position: myLatLng, draggable:true, title: 'Drag me', anchorPoint: new google.maps.Point(0, -29) }); autocomplete.addListener('place_changed', function() { //infowindow.close(); marker.setVisible(false); var place = autocomplete.getPlace(); if (!place.geometry) { // User entered the name of a Place that was not suggested and // pressed the Enter key, or the Place Details request failed. window.alert("No details available for input: '" + place.name + "'"); return; } // If the place has a geometry, then present it on a map. if (place.geometry.viewport) { map.fitBounds(place.geometry.viewport); } else { map.setCenter(place.geometry.location); map.setZoom(17); // Why 17? Because it looks good. } marker.setPosition(place.geometry.location); marker.setVisible(true); var address = ''; if (place.address_components) { address = [ (place.address_components[0] && place.address_components[0].short_name || ''), (place.address_components[1] && place.address_components[1].short_name || ''), (place.address_components[2] && place.address_components[2].short_name || '') ].join(' '); } ; }); // Sets a listener on a radio button to change the filter type on Places // Autocomplete. function setupClickListener(id, types) { var radioButton = document.getElementById(id); radioButton.addEventListener('click', function() { autocomplete.setTypes(types); }); } setupClickListener('changetype-all', []); google.maps.event.addListener(marker,'position_changed',function(){ document.getElementById('lat').value = this.getPosition().lat(); document.getElementById('lng').value = this.getPosition().lng(); // jQuery('#shipping_lng').val(lng);*/ } ); } jQuery(document).ready(function($){ jQuery('#pac_btn').click(function(e) { var lat = parseFloat(document.getElementById('lat').value); var lng = parseFloat(document.getElementById('lng').value); $('#pac-input').removeAttr('value'); var myLatLng = {lat: lat, lng: lng}; var map = new google.maps.Map(document.getElementById('map'), { center: myLatLng, zoom: 13 }); var card = document.getElementById('pac-card'); var input = document.getElementById('pac-input'); var types = document.getElementById('type-selector'); map.controls[google.maps.ControlPosition.TOP_RIGHT].push(card); var autocomplete = new google.maps.places.Autocomplete(input); // Bind the map's bounds (viewport) property to the autocomplete object, // so that the autocomplete requests use the current map bounds for the // bounds option in the request. autocomplete.bindTo('bounds', map); // Set the data fields to return when the user selects a place. autocomplete.setFields( ['address_components', 'geometry', 'icon', 'name']); //var infowindow = new google.maps.InfoWindow(); //var infowindowContent = document.getElementById('infowindow-content'); //infowindow.setContent(infowindowContent); var marker = new google.maps.Marker({ map: map, position: myLatLng, draggable:true, title: 'Drag me', anchorPoint: new google.maps.Point(0, -29) }); autocomplete.addListener('place_changed', function() { //infowindow.close(); marker.setVisible(false); var place = autocomplete.getPlace(); if (!place.geometry) { // User entered the name of a Place that was not suggested and // pressed the Enter key, or the Place Details request failed. window.alert("No details available for input: '" + place.name + "'"); return; } // If the place has a geometry, then present it on a map. if (place.geometry.viewport) { map.fitBounds(place.geometry.viewport); } else { map.setCenter(place.geometry.location); map.setZoom(17); // Why 17? Because it looks good. } marker.setPosition(place.geometry.location); marker.setVisible(true); var address = ''; if (place.address_components) { address = [ (place.address_components[0] && place.address_components[0].short_name || ''), (place.address_components[1] && place.address_components[1].short_name || ''), (place.address_components[2] && place.address_components[2].short_name || '') ].join(' '); } ; }); // Sets a listener on a radio button to change the filter type on Places // Autocomplete. function setupClickListener(id, types) { var radioButton = document.getElementById(id); radioButton.addEventListener('click', function() { autocomplete.setTypes(types); }); } setupClickListener('changetype-all', []); google.maps.event.addListener(marker,'position_changed',function(){ document.getElementById('lat').value = this.getPosition().lat(); document.getElementById('lng').value = this.getPosition().lng(); // jQuery('#shipping_lng').val(lng);*/ } ); }); });