1var render_map; 2 3(function($) { 4 5/* 6* render_map 7* 8* This function will render a Google Map onto the selected jQuery element 9*/ 10 11render_map = function( $el ) { 12 13 // var 14 var $markers = $el.find('.marker'); 15 // vars 16 var args = { 17 zoom : 14, 18 center : new google.maps.LatLng(0, 0), 19 mapTypeId : google.maps.MapTypeId.ROADMAP, 20 mapTypeControl: false, 21 scrollwheel : false, 22 styles: [ 23 {"featureType":"landscape","stylers":[{"saturation":-100},{"lightness":65},{"visibility":"on"}]}, 24 {"featureType":"poi","stylers":[{"saturation":-100},{"lightness":51},{"visibility":"simplified"}]}, 25 {"featureType":"road.highway","stylers":[{"saturation":-100},{"visibility":"simplified"}]}, 26 {"featureType":"road.arterial","stylers":[{"saturation":-100},{"lightness":30},{"visibility":"on"}]}, 27 {"featureType":"road.local","stylers":[{"saturation":-100},{"lightness":40},{"visibility":"on"}]}, 28 {"featureType":"transit","stylers":[{"saturation":-100},{"visibility":"simplified"}]}, 29 {"elementType":"labels.text.fill","stylers":[{"visibility":"on"},{"color":"#000000"},{"lightness":16}]}, 30 {"elementType":"labels.icon","stylers":[{"visibility":"off"}]}, 31 {"featureType":"administrative.province","stylers":[{"visibility":"off"}]}, 32 {"featureType":"water","elementType":"labels","stylers":[{"visibility":"on"},{"lightness":-25},{"saturation":-100}]}, 33 {"featureType":"water","elementType":"geometry","stylers":[{"hue":"#ffff00"},{"lightness":-25},{"saturation":-97}]} 34 ] 35 }; 36 37 // create map 38 var map = new google.maps.Map( $el[0], args); 39 // add a markers reference 40 map.markers = []; 41 // add markers 42 $markers.each(function(){ 43 add_marker( $(this), map ); 44 }); 45 // center map 46 center_map( map ); 47} 48 49/* 50* add_marker 51* 52* This function will add a marker to the selected Google Map 53* 54*/ 55 56function add_marker( $marker, map ) { 57 // var 58 var latlngMarker = new google.maps.LatLng( $marker.attr('data-lat'), $marker.attr('data-lng') ); 59 var myIconMarker = new google.maps.MarkerImage("https://paler-law.eu/gewuerzregal/wp-content/themes/silvia-paler/interface/map-icons-marker.svg", null, null, null, new google.maps.Size(64,64)); 60 // create marker 61 var marker = new google.maps.Marker({ 62 position : latlngMarker, 63 map : map, 64 icon : myIconMarker 65 }); 66 // add to array 67 map.markers.push( marker ); 68 // if marker contains HTML, add it to an infoWindow 69 if( $marker.html() ) { 70 // create info window 71 var infowindow = new google.maps.InfoWindow({ 72 content : $marker.html() 73 }); 74 // show info window when marker is clicked 75 google.maps.event.addListener(marker, 'click', function() { 76 infowindow.open( map, marker ); 77 }); 78 } 79} 80 81/* 82* center_map 83* 84* This function will center the map, showing all markers attached to this map 85* 86*/ 87 88function center_map( map ) { 89 // vars 90 var bounds = new google.maps.LatLngBounds(); 91 // loop through all markers and create bounds 92 $.each( map.markers, function( i, marker ){ 93 var latlng = new google.maps.LatLng( marker.position.lat(), marker.position.lng() ); 94 bounds.extend( latlng ); 95 }); 96 // only 1 marker? 97 if( map.markers.length == 1 ) { 98 // set center of map 99 map.setCenter( bounds.getCenter() ); 100 map.setZoom( 14 ); 101 } else { 102 // fit to bounds 103 map.fitBounds( bounds ); 104 } 105} 106 107/* 108* document ready 109* 110* This function will render each map when the document is ready (page has loaded) 111* 112*/ 113 114$(document).ready(function(){ 115 $('.acf-map').each(function(){ 116 render_map( $(this) ); 117 }); 118}); 119 120})(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.