1/*==============================================================*/ 2// Google Maps 3/*==============================================================*/ 4(function($) { 5 6/* 7* render_map 8* 9* This function will render a Google Map onto the selected jQuery element 10* 11* @type function 12* @date 8/11/2013 13* @since 4.3.0 14* 15* @param $el (jQuery element) 16* @return n/a 17*/ 18 19function render_map( $el ) { 20 // Create a new StyledMapType object, passing it an array of styles, 21 // and the name to be displayed on the map type control. 22 // https://developers.google.com/maps/documentation/javascript/styling 23 var styledMapType = new google.maps.StyledMapType( 24 25 26[ 27 { 28 "featureType": "all", 29 "elementType": "labels.text.fill", 30 "stylers": [ 31 { 32 "saturation": 36 33 }, 34 { 35 "color": "#000000" 36 }, 37 { 38 "lightness": 40 39 } 40 ] 41 }, 42 { 43 "featureType": "all", 44 "elementType": "labels.text.stroke", 45 "stylers": [ 46 { 47 "visibility": "on" 48 }, 49 { 50 "color": "#000000" 51 }, 52 { 53 "lightness": 16 54 } 55 ] 56 }, 57 { 58 "featureType": "all", 59 "elementType": "labels.icon", 60 "stylers": [ 61 { 62 "visibility": "off" 63 } 64 ] 65 }, 66 { 67 "featureType": "administrative", 68 "elementType": "geometry.fill", 69 "stylers": [ 70 { 71 "color": "#000000" 72 }, 73 { 74 "lightness": 20 75 } 76 ] 77 }, 78 { 79 "featureType": "administrative", 80 "elementType": "geometry.stroke", 81 "stylers": [ 82 { 83 "color": "#000000" 84 }, 85 { 86 "lightness": 17 87 }, 88 { 89 "weight": 1.2 90 } 91 ] 92 }, 93 { 94 "featureType": "administrative.country", 95 "elementType": "geometry", 96 "stylers": [ 97 { 98 "visibility": "off" 99 } 100 ] 101 }, 102 { 103 "featureType": "administrative.country", 104 "elementType": "labels", 105 "stylers": [ 106 { 107 "visibility": "off" 108 } 109 ] 110 }, 111 { 112 "featureType": "administrative.province", 113 "elementType": "geometry", 114 "stylers": [ 115 { 116 "visibility": "off" 117 } 118 ] 119 }, 120 { 121 "featureType": "administrative.province", 122 "elementType": "labels", 123 "stylers": [ 124 { 125 "visibility": "off" 126 } 127 ] 128 }, 129 { 130 "featureType": "administrative.locality", 131 "elementType": "all", 132 "stylers": [ 133 { 134 "visibility": "off" 135 } 136 ] 137 }, 138 { 139 "featureType": "administrative.locality", 140 "elementType": "geometry", 141 "stylers": [ 142 { 143 "visibility": "off" 144 } 145 ] 146 }, 147 { 148 "featureType": "administrative.locality", 149 "elementType": "geometry.fill", 150 "stylers": [ 151 { 152 "visibility": "off" 153 } 154 ] 155 }, 156 { 157 "featureType": "administrative.locality", 158 "elementType": "geometry.stroke", 159 "stylers": [ 160 { 161 "visibility": "off" 162 } 163 ] 164 }, 165 { 166 "featureType": "administrative.locality", 167 "elementType": "labels", 168 "stylers": [ 169 { 170 "visibility": "off" 171 } 172 ] 173 }, 174 { 175 "featureType": "administrative.locality", 176 "elementType": "labels.text", 177 "stylers": [ 178 { 179 "visibility": "off" 180 } 181 ] 182 }, 183 { 184 "featureType": "administrative.locality", 185 "elementType": "labels.text.fill", 186 "stylers": [ 187 { 188 "color": "#f5f3f3" 189 }, 190 { 191 "visibility": "off" 192 } 193 ] 194 }, 195 { 196 "featureType": "administrative.locality", 197 "elementType": "labels.text.stroke", 198 "stylers": [ 199 { 200 "visibility": "off" 201 } 202 ] 203 }, 204 { 205 "featureType": "administrative.neighborhood", 206 "elementType": "geometry.stroke", 207 "stylers": [ 208 { 209 "saturation": "-16" 210 }, 211 { 212 "visibility": "off" 213 } 214 ] 215 }, 216 { 217 "featureType": "administrative.neighborhood", 218 "elementType": "labels.text", 219 "stylers": [ 220 { 221 "visibility": "off" 222 } 223 ] 224 }, 225 { 226 "featureType": "landscape", 227 "elementType": "geometry", 228 "stylers": [ 229 { 230 "color": "#000000" 231 }, 232 { 233 "lightness": 20 234 } 235 ] 236 }, 237 { 238 "featureType": "landscape.natural.landcover", 239 "elementType": "geometry.fill", 240 "stylers": [ 241 { 242 "visibility": "off" 243 } 244 ] 245 }, 246 { 247 "featureType": "landscape.natural.terrain", 248 "elementType": "geometry.fill", 249 "stylers": [ 250 { 251 "visibility": "off" 252 }, 253 { 254 "color": "#ff0000" 255 } 256 ] 257 }, 258 { 259 "featureType": "poi", 260 "elementType": "geometry", 261 "stylers": [ 262 { 263 "color": "#000000" 264 }, 265 { 266 "lightness": 21 267 } 268 ] 269 }, 270 { 271 "featureType": "road", 272 "elementType": "labels.text", 273 "stylers": [ 274 { 275 "visibility": "on" 276 } 277 ] 278 }, 279 { 280 "featureType": "road.highway", 281 "elementType": "geometry.fill", 282 "stylers": [ 283 { 284 "color": "#949393" 285 }, 286 { 287 "lightness": 17 288 }, 289 { 290 "visibility": "on" 291 } 292 ] 293 }, 294 { 295 "featureType": "road.highway", 296 "elementType": "geometry.stroke", 297 "stylers": [ 298 { 299 "color": "#000000" 300 }, 301 { 302 "lightness": 29 303 }, 304 { 305 "weight": 0.2 306 } 307 ] 308 }, 309 { 310 "featureType": "road.highway", 311 "elementType": "labels.text.fill", 312 "stylers": [ 313 { 314 "visibility": "on" 315 }, 316 { 317 "color": "#823636" 318 } 319 ] 320 }, 321 { 322 "featureType": "road.highway", 323 "elementType": "labels.text.stroke", 324 "stylers": [ 325 { 326 "color": "#914646" 327 }, 328 { 329 "visibility": "on" 330 } 331 ] 332 }, 333 { 334 "featureType": "road.arterial", 335 "elementType": "geometry", 336 "stylers": [ 337 { 338 "color": "#000000" 339 }, 340 { 341 "lightness": 18 342 } 343 ] 344 }, 345 { 346 "featureType": "road.arterial", 347 "elementType": "geometry.fill", 348 "stylers": [ 349 { 350 "visibility": "on" 351 }, 352 { 353 "color": "#676767" 354 } 355 ] 356 }, 357 { 358 "featureType": "road.local", 359 "elementType": "geometry", 360 "stylers": [ 361 { 362 "color": "#000000" 363 }, 364 { 365 "lightness": 16 366 } 367 ] 368 }, 369 { 370 "featureType": "transit", 371 "elementType": "geometry", 372 "stylers": [ 373 { 374 "color": "#000000" 375 }, 376 { 377 "lightness": 19 378 } 379 ] 380 }, 381 { 382 "featureType": "water", 383 "elementType": "geometry", 384 "stylers": [ 385 { 386 "color": "#6d96b9" 387 }, 388 { 389 "lightness": 17 390 } 391 ] 392 } 393], 394 {name: 'Styled Map'}); 395 396 // var 397 var $markers = $el.find('.marker'); 398 399 // vars 400 var args = { 401 zoom : 13, 402 center : new google.maps.LatLng(0, 0), 403 mapTypeId : google.maps.MapTypeId.ROADMAP 404 }; 405 406 // create map 407 var map = new google.maps.Map( $el[0], args); 408 409 // add a markers reference 410 map.markers = []; 411 412 // add markers 413 $markers.each(function(){ 414 415 add_marker( $(this), map ); 416 417 }); 418 //Associate the styled map with the MapTypeId and set it to display. 419 map.mapTypes.set('styled_map', styledMapType); 420 map.setMapTypeId('styled_map'); 421 422 // center map 423 center_map( map ); 424 425} 426 427/* 428* add_marker 429* 430* This function will add a marker to the selected Google Map 431* 432* @type function 433* @date 8/11/2013 434* @since 4.3.0 435* 436* @param $marker (jQuery element) 437* @param map (Google Map object) 438* @return n/a 439*/ 440 441function add_marker( $marker, map ) { 442 443 444 // var 445 var latlng = new google.maps.LatLng( $marker.attr('data-lat'), $marker.attr('data-lng') ); 446 447 // create marker 448 var marker = new google.maps.Marker({ 449 position : latlng, 450 map : map, 451 animation: google.maps.Animation.DROP, 452 icon: { 453 anchor: new google.maps.Point(16, 16), 454 url: 'data:image/svg+xml;utf-8, \ 455 <svg width="42" height="42" viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg"> \ 456 <path fill="rgba(70, 169, 224, 1)" stroke="" class="cls-1" d="M12.16,0A12.16,12.16,0,0,0,2.47,19.51l9.16,12.26h0a.71.71,0,0,0,1,0h0l9.16-12.26A12.16,12.16,0,0,0,12.16,0Zm0,16.2a4,4,0,1,1,4-4A4,4,0,0,1,12.16,16.2Z"/> \ 457 </svg>' 458} 459 }); 460 461 // add to array 462 map.markers.push( marker ); 463 464 // if marker contains HTML, add it to an infoWindow 465 if( $marker.html() ) 466 {
467 // create info window 468 var infowindow = new google.maps.InfoWindow({ 469 content : $marker.html() 470 }); 471 472 // show info window when marker is clicked 473 google.maps.event.addListener(marker, 'click', function() { 474 475 infowindow.open( map, marker ); 476 477 }); 478 } 479 480} 481 482/* 483* center_map 484* 485* This function will center the map, showing all markers attached to this map 486* 487* @type function 488* @date 8/11/2013 489* @since 4.3.0 490* 491* @param map (Google Map object) 492* @return n/a 493*/ 494 495function center_map( map ) { 496 497 // vars 498 var bounds = new google.maps.LatLngBounds(); 499 500 // loop through all markers and create bounds 501 $.each( map.markers, function( i, marker ){ 502 503 var latlng = new google.maps.LatLng( marker.position.lat(), marker.position.lng() ); 504 505 bounds.extend( latlng ); 506 507 }); 508 509 // only 1 marker? 510 if( map.markers.length == 1 ) 511 { 512 // set center of map 513 map.setCenter( bounds.getCenter() ); 514 map.setZoom( 13 ); 515 } 516 else 517 { 518 // fit to bounds 519 map.fitBounds( bounds ); 520 } 521 522} 523 524/* 525* document ready 526* 527* This function will render each map when the document is ready (page has loaded) 528* 529* @type function 530* @date 8/11/2013 531* @since 5.0.0 532* 533* @param n/a 534* @return n/a 535*/ 536 537$(document).ready(function(){ 538 539 540 $('.acf-map').each(function(){ 541 542 render_map( $(this) ); 543 544 }); 545 546}); 547 548})(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.