1(function($) { 2$('.contact-map #googleMap').each(function(){ 3 var zoom = $(this).data('zoom'); 4 var color = $('#googleMap').data('color'); 5 if(!color){ 6 color = '#93c23d'; 7 } 8 var contentString1, 9 mapmakerSmall; 10 11 mapmakerSmall = $(this).attr('data-mapker'); 12 var locations_array = $(this).data('json'); 13 var address_lat,address_lng,marker_info; 14 var i; 15 var locations = []; 16 for (i = 0; i < locations_array.length; i++) { 17 var content_class = '.wrapper-places-'+i; 18 var target = $('.contact-map').find(content_class); 19 var clone = target.clone(); 20 clone.wrap('<div>'); 21 contentString1 = clone.parent().html(); 22 if (locations_array[i] != '') { 23 $.ajax({ 24 url: "http://maps.googleapis.com/maps/api/geocode/json?address="+locations_array[i]+"&sensor=false", 25 type: "POST", 26 async: false, 27 success: function(res){ 28 if (res.status == 'OK') { 29 address_lat = res.results[0].geometry.location.lat; 30 address_lng = res.results[0].geometry.location.lng; 31 marker_info = [locations_array[i],address_lat, address_lng,i,contentString1,mapmakerSmall]; 32 locations.push(marker_info); 33 } 34 } 35 }); 36 }; 37 } 38 39 function init() { 40 if (locations.length === 0) { 41 var center_in_screen = new google.maps.LatLng(39.9679831, -75.1641189); 42 }else{ 43 var center_in_screen = new google.maps.LatLng(locations[0][1], locations[0][2]); 44 } 45 46 var isDraggable = true; 47 var styles = [{ 48 "featureType": "water", 49 "elementType": "geometry", 50 "stylers": [{ 51 "color": "#e9e9e9" 52 }, { 53 "lightness": 17 54 }] 55 }, { 56 "featureType": "landscape", 57 "elementType": "geometry", 58 "stylers": [{ 59 "color": "#f5f5f5" 60 }, { 61 "lightness": 20 62 }] 63 }, { 64 "featureType": "road.highway", 65 "elementType": "geometry.fill", 66 "stylers": [{ 67 "color": "#ffffff" 68 }, { 69 "lightness": 17 70 }] 71 }, { 72 "featureType": "road.highway", 73 "elementType": "geometry.stroke", 74 "stylers": [{ 75 "color": "#ffffff" 76 }, { 77 "lightness": 29 78 }, { 79 "weight": 0.2 80 }] 81 }, { 82 "featureType": "road.arterial", 83 "elementType": "geometry", 84 "stylers": [{ 85 "color": "#ffffff" 86 }, { 87 "lightness": 18 88 }] 89 }, { 90 "featureType": "road.local", 91 "elementType": "geometry", 92 "stylers": [{ 93 "color": "#ffffff" 94 }, { 95 "lightness": 16 96 }] 97 }, { 98 "featureType": "poi", 99 "elementType": "geometry", 100 "stylers": [{ 101 "color": "#f5f5f5" 102 }, { 103 "lightness": 21 104 }] 105 }, { 106 "featureType": "poi.park", 107 "elementType": "geometry", 108 "stylers": [{ 109 "color": "#dedede" 110 }, { 111 "lightness": 21 112 }] 113 }, { 114 "elementType": "labels.text.stroke", 115 "stylers": [{ 116 "visibility": "on" 117 }, { 118 "color": "#ffffff" 119 }, { 120 "lightness": 16 121 }] 122 }, { 123 "elementType": "labels.text.fill", 124 "stylers": [{ 125 "saturation": 36 126 }, { 127 "color": "#333333" 128 }, { 129 "lightness": 40 130 }] 131 }, { 132 "elementType": "labels.icon", 133 "stylers": [{ 134 "visibility": "off" 135 }] 136 }, { 137 "featureType": "transit", 138 "elementType": "geometry", 139 "stylers": [{ 140 "color": "#f2f2f2" 141 }, { 142 "lightness": 19 143 }] 144 }, { 145 "featureType": "administrative", 146 "elementType": "geometry.fill", 147 "stylers": [{ 148 "color": "#fefefe" 149 }, { 150 "lightness": 20 151 }] 152 }, { 153 "featureType": "administrative", 154 "elementType": "geometry.stroke", 155 "stylers": [{ 156 "color": "#fefefe" 157 }, { 158 "lightness": 17 159 }, { 160 "weight": 1.2 161 }] 162 }]; 163 164 var styledMap = new google.maps.StyledMapType(styles, { name: "Styled Map" }); 165 var myOptions = { 166 zoom: zoom, 167 center: center_in_screen, 168 mapTypeControl: true, 169 mapTypeId: google.maps.MapTypeId.ROADMAP, 170 draggable: isDraggable, 171 scrollwheel: false, 172 mapTypeControlOptions: { 173 mapTypeIds: [google.maps.MapTypeId.ROADMAP, 'map_style'] 174 } 175 176 }; 177 178 var map = new google.maps.Map(document.getElementById('googleMap'), myOptions); 179 180 var infowindow = new google.maps.InfoWindow({ 181 }); 182 183 var marker, i; 184 185 for (i = 0; i < locations.length; i++) { 186 var marker = new google.maps.Marker({ 187 position: new google.maps.LatLng(locations[i][1], locations[i][2]), 188 map: map, 189 icon: locations[i][5], 190 }); 191 map.mapTypes.set('map_style', styledMap); 192 map.setMapTypeId('map_style'); 193 google.maps.event.addListener(marker, 'click', (function(marker, i) { 194 return function() { 195 infowindow.setContent(locations[i][4]); 196 infowindow.open(map, marker); 197 } 198 })(marker, i)); 199 200 } 201 202 google.maps.event.addListener(infowindow, 'domready', function() { 203 204 205 // Reference to the DIV which receives the contents of the infowindow using jQuery 206 var iwOuter = $('.gm-style-iw'); 207 208 /* The DIV we want to change is above the .gm-style-iw DIV.
209 * So, we use jQuery and create a iwBackground variable, 210 * and took advantage of the existing reference to .gm-style-iw for the previous DIV with .prev(). 211 */ 212 var iwBackground = iwOuter.prev(); 213 214 // Remove the background shadow DIV 215 // iwBackground.css({'display' : 'none'}); 216 iwBackground.children(':nth-child(2)').css({ 217 'box-shadow': 'none', 218 'background-color': 'transparent', 219 }); 220 221 //Remove close button 222 var iwCloseBtn = iwOuter.next(); 223 224 // Remove the white background DIV 225 iwBackground.children(':nth-child(4)').css({ 226 'border': '2px solid', 227 'border-color':color, 228 }); 229 iwBackground.children(':nth-child(3)').find('div').children().css({ 230 'box-shadow': ''+color+' 1px 2px 6px', 231 'z-index': '1', 232 233 }); 234 235 }); 236 237 var directionsService = new google.maps.DirectionsService; 238 var directionsDisplay = new google.maps.DirectionsRenderer; 239 240 $('.location-link').on('click', function() { 241 242 var destination = $(this).data('attr'); 243 if (navigator.geolocation) { 244 navigator.geolocation.getCurrentPosition(function(position) { 245 var pos = { 246 lat: position.coords.latitude, 247 lng: position.coords.longitude 248 }; 249 calculateAndDisplayRoute(directionsService, directionsDisplay, pos, destination); 250 }); 251 } 252 directionsDisplay.setMap(map); 253 }); 254 } 255 google.maps.event.addDomListener(window, 'load', init); 256 257 //END GOOGLE MAP 258 259 // Set isotope for info-location-content 260 setTimeout(function() { 261 $('.location-wrapper .row').isotope({ 262 // options 263 itemSelector: '.location-address-content', 264 layoutMode: 'masonry' 265 }); 266 }, 1500); 267 268 function calculateAndDisplayRoute(directionsService, directionsDisplay, pos, destination) { 269 directionsService.route({ 270 origin: pos, 271 destination: destination, 272 travelMode: google.maps.TravelMode.DRIVING 273 }, function(response, status) { 274 if (status === google.maps.DirectionsStatus.OK) { 275 directionsDisplay.setDirections(response); 276 setTimeout(function() { 277 $('html, body').animate({ 278 scrollTop: $("#map").offset().top 279 }, 500); 280 }, 500); 281 282 } else { 283 window.alert('Directions request failed due to ' + status); 284 } 285 286 }); 287 } 288 }); 289})(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.