1(function($) { 2 function initMap($el) { 3 var $markers = $el.find('.marker'); 4 var mapArgs = { 5 zoom: $el.data('zoom') || 16, 6 center: new google.maps.LatLng(0, 0), 7 mapTypeId: google.maps.MapTypeId.ROADMAP 8 }; 9 10 var map = new google.maps.Map($el[0], mapArgs); 11 map.markers = []; 12 13 // Add markers 14 $markers.each(function() { 15 initMarker($(this), map); 16 }); 17 18 // Center map 19 centerMap(map); 20 return map; 21 } 22 23 function initMarker($marker, map) { 24 var lat = $marker.data('lat'); 25 var lng = $marker.data('lng'); 26 var latLng = new google.maps.LatLng(lat, lng); 27 28 var marker = new google.maps.Marker({ 29 position: latLng, 30 map: map 31 }); 32 33 map.markers.push(marker); 34 } 35 36 function centerMap(map) { 37 var bounds = new google.maps.LatLngBounds(); 38 39 map.markers.forEach(function(marker) { 40 bounds.extend(marker.getPosition()); 41 }); 42 43 if (map.markers.length == 1) { 44 map.setCenter(bounds.getCenter()); 45 } else { 46 map.fitBounds(bounds); 47 } 48 } 49 50 // Init maps on document ready 51 $(document).ready(function() { 52 $('.acf-map').each(function() { 53 initMap($(this)); 54 }); 55 }); 56 57})(jQuery);
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.