1function initializeMaps() { 2 $.each($('.google-maps'), function (index, element) { 3 4 var $element = $(element); 5 6 var lat = $element.data('lat'); 7 var long = $element.data('lng'); 8 9 var markerLatLng = new google.maps.LatLng(lat, long); 10 11 var mapOptions = { 12 zoom: 12, // initialize zoom level - the max value is 21 13 streetViewControl: false, // hide the yellow Street View pegman 14 scaleControl: false, // allow users to zoom the Google Map 15 mapTypeId: google.maps.MapTypeId.ROADMAP, 16 //center: latLng, 17 scrollwheel: false, // disables scrollwheel zooming on the map 18 draggable: false, 19 disableDoubleClickZoom: false, 20 //zoomControl: false, 21 disableDefaultUI: true 22 //mapTypeControl: false 23 }; 24 25 map = new google.maps.Map(element, mapOptions); 26 27 var centerLat = lat; 28 var centerLng = long; 29 30 var latLng = new google.maps.LatLng(centerLat, centerLng); 31 map.setCenter(latLng); 32 33 // Show the default red marker at the location 34 marker = new google.maps.Marker({ 35 position: markerLatLng, 36 map: map, 37 draggable: false, 38 scrollwheel: false//, 39 //animation: google.maps.Animation.DROP, 40 //url: $element.data('url') 41 }); 42 43 google.maps.event.addDomListener(window, 'resize', function () { 44 var latLng = new google.maps.LatLng(centerLat, centerLng); 45 map.setCenter(latLng); 46 }); 47 48 //google.maps.event.addListener(marker, 'click', function () { 49 // window.open(this.url); 50 //}); 51 }); 52 53 $.each($('.map-locations'), function (index, element) { 54 55 var $element = $(element); 56 var map = new google.maps.Map(element, { 57 mapTypeControl: false, 58 streetViewControl: false, 59 scrollwheel: false 60 }); 61 62 var bounds = new google.maps.LatLngBounds(); 63 64 var locations = $element.data('locations'); 65 66 for (i = 0; i < locations.length; i++) { 67 var location = locations[i]; 68 69 var content = '<div class="iw-container">' + 70 '<div class="iw-body">' + 71 '<div class="iw-title"><a href="' + location.NavigateUrl + '">' + location.Title + '</a></div>' + 72 '</div>' + 73 '</div>'; 74 75 var infowindow = new google.maps.InfoWindow(); 76 var markerLatLng = new google.maps.LatLng(location.Latitude, location.Longitude); 77 78 var marker = new google.maps.Marker({ 79 map: map, 80 position: markerLatLng, 81 title: location.Title//, 82 //icon: markerIconUrl 83 }); 84 85 bindInfoWindow(marker, map, infowindow, content); 86 87 // Event that closes the Info Window with a click on the map 88 google.maps.event.addListener(map, 'click', function () { 89 infowindow.close(); 90 }); 91 92 if (locations.length > 1) { 93 // extend boundary 94 bounds.extend(marker.position); 95 } 96 } 97 98 if (locations.length > 1) { 99 // make map zoom out to the detected bounds 100 map.fitBounds(bounds); 101 } 102 103 if (locations.length === 1) { 104 map.setCenter(markerLatLng); 105 map.setZoom(15); 106 } 107 }); 108} 109 110function bindInfoWindow(marker, map, infowindow, html) { 111 marker.addListener('click', function () { 112 infowindow.setContent(html); 113 infowindow.open(map, this); 114 }); 115}
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.