1 var map; 2 function lp_initialize_map() { 3 if(jQuery('#lp-custom-latlong').length !=0 ){ 4 var clat; 5 var clong; 6 var myLatlng; 7 8 clat = jQuery('body').data('defaultmaplat'); 9 clong = jQuery('body').data('defaultmaplot'); 10 if (jQuery("#latitude").length){ 11 if(document.getElementById("latitude").value!=''){ 12 clat = document.getElementById("latitude").value; 13 } 14 } 15 if (jQuery("#longitude").length){ 16 if(document.getElementById("longitude").value!=''){ 17 clong = document.getElementById("longitude").value; 18 } 19 } 20 21 if(clat && clong){ 22 myLatlng = new google.maps.LatLng(clat, clong); 23 } 24 else{ 25 myLatlng = new google.maps.LatLng(40.713956, -74.006653); 26 } 27 28 var myOptions = { 29 zoom: 8, 30 center: myLatlng, 31 mapTypeId: google.maps.MapTypeId.ROADMAP 32 }; 33 map = new google.maps.Map(document.getElementById("lp-custom-latlong"), myOptions); 34 var marker = new google.maps.Marker({ 35 draggable: true, 36 position: myLatlng, 37 map: map, 38 title: "" 39 }); 40 google.maps.event.addListener(marker, 'dragend', function (event) { 41 document.getElementById("latitude").value = event.latLng.lat(); 42 document.getElementById("longitude").value = event.latLng.lng(); 43 }); 44 45 // Create the DIV to hold the control and call the CenterControl() 46 // constructor passing in this DIV. 47 var centerControlDiv = document.createElement('div'); 48 var centerControl = new CenterControl(centerControlDiv, map, marker); 49 50 centerControlDiv.index = 1; 51 map.controls[google.maps.ControlPosition.TOP_RIGHT].push(centerControlDiv); 52 } 53 } 54 google.maps.event.addDomListener(window, "load", lp_initialize_map()); 55 56 jQuery('#modal-doppin').on('shown.bs.modal', function () 57 { 58 //google.maps.event.trigger(map, "resize"); 59 google.maps.event.addDomListener(window, "load", lp_initialize_map()); 60 }); 61 62 /* trigger click for custom lat and long toggle on submit page */ 63 jQuery(document).ready(function($){ 64 jQuery(".lp-coordinates a.googledroppin").on('click', function(){ 65 jQuery(".lp-coordinates a.googleAddressbtn").trigger('click'); 66 }); 67 }) 68 69 function CenterControl(controlDiv, map, marker) { 70 71 var btitle = jQuery('#modal-doppin').data('lploctitlemap'); 72 73 // Set CSS for the control border. 74 var controlUI = document.createElement('div'); 75 controlUI.style.backgroundColor = '#fff'; 76 controlUI.style.border = '2px solid #fff'; 77 controlUI.style.borderRadius = '3px'; 78 controlUI.style.boxShadow = '0 2px 6px rgba(0,0,0,.3)'; 79 controlUI.style.cursor = 'pointer'; 80 controlUI.style.marginBottom = '22px'; 81 controlUI.style.textAlign = 'center'; 82 controlUI.title = btitle; 83 controlDiv.appendChild(controlUI); 84 85 // Set CSS for the control interior. 86 var controlText = document.createElement('div'); 87 controlText.style.color = 'rgb(25,25,25)'; 88 controlText.style.fontSize = '13px'; 89 controlText.style.lineHeight = '20px'; 90 controlText.style.paddingLeft = '5px'; 91 controlText.style.paddingRight = '5px'; 92 controlText.innerHTML = btitle; 93 controlUI.appendChild(controlText); 94 95 // Setup the click event listeners: simply set the map to Chicago. 96 controlUI.addEventListener('click', function() { 97 if (navigator.geolocation) { 98 navigator.geolocation.getCurrentPosition(function (position) { 99 var pos = new google.maps.LatLng(position.coords.latitude, position.coords.longitude); 100 101 map.setCenter(pos); 102 marker.setPosition(pos); 103 document.getElementById("latitude").value = position.coords.latitude; 104 document.getElementById("longitude").value = position.coords.longitude; 105 }) 106 } 107 108 }); 109 110 } 111 112
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.