1Object.keys = Object.keys || function(o) { 2 var result = []; 3 for(var name in o) { 4 if (o.hasOwnProperty(name)) 5 result.push(name); 6 } 7 return result; 8}; 9 10jQuery(document).ready(function($){ 11 12 var animationDelay = 0; 13 var enableAnimation, extraColor, greyscale, enableZoom, enableZoomConnect, markerImg, centerlng, centerlat, zoomLevel, latLng, infoWindows; 14 var map = []; 15 var infoWindows = []; 16 17 window.mapAPI_Loaded = function() { 18 19 for(var i = 0; i < $('.nectar-google-map').length; i++) { 20 infoWindows[i] = []; 21 } 22 23 $('.nectar-google-map').each(function(i){ 24 25 /*var $mapCopy = $(this).clone(); 26 var $currentPosition = $(this).next('.map-marker-list'); 27 $(this).remove(); 28 $mapCopy.insertBefore($currentPosition);*/ 29 30 31 //map margin if page header 32 if( $('#page-header-bg:not("[data-parallax=1]")').length > 0 && $('#contact-map').length > 0 ) { $('#contact-map').css('margin-top', 0); $('.container-wrap').css('padding-top', 0);} 33 if( $('#page-header-bg[data-parallax=1]').length > 0 ) $('#contact-map').css('margin-top', '-30px'); 34 35 zoomLevel = parseFloat($(this).attr('data-zoom-level')); 36 centerlat = parseFloat($(this).attr('data-center-lat')); 37 centerlng = parseFloat($(this).attr('data-center-lng')); 38 markerImg = $(this).attr('data-marker-img'); 39 enableZoom = $(this).attr('data-enable-zoom'); 40 enableZoomConnect = (enableZoom == '1') ? false : true; 41 greyscale = $(this).attr('data-greyscale'); 42 extraColor = $(this).attr('data-extra-color'); 43 ultraFlat = $(this).attr('data-ultra-flat'); 44 darkColorScheme = $(this).attr('data-dark-color-scheme'); 45 var $flatObj = []; 46 var $darkColorObj = []; 47 enableAnimation = $(this).attr('data-enable-animation'); 48 49 if( isNaN(zoomLevel) ) { zoomLevel = 12;} 50 if( isNaN(centerlat) ) { centerlat = 51.47;} 51 if( isNaN(centerlng) ) { centerlng = -0.268199;} 52 if( typeof enableAnimation != 'undefined' && enableAnimation == 1 && $(window).width() > 690) { animationDelay = 180; enableAnimation = google.maps.Animation.BOUNCE } else { enableAnimation = null; } 53 54 latLng = new google.maps.LatLng(centerlat,centerlng); 55 56 //color 57 58 if(ultraFlat == '1') { 59 $flatObj = [{ 60 "featureType": "transit", 61 "elementType": "geometry", 62 "stylers": [ 63 { "visibility": "off" } 64 ] 65 }, 66 { 67 "elementType": "labels", 68 "stylers": [ 69 { "visibility": "off" } 70 ] 71 }, 72 { 73 "featureType": "administrative", 74 "stylers": [ 75 { "visibility": "off" } 76 ] 77 }]; 78 } else { 79 $flatObj[0] = {}; 80 $flatObj[1] = {}; 81 $flatObj[2] = {}; 82 } 83 84 85 if(darkColorScheme == '1') { 86 $darkColorObj = [{ 87 "featureType": "all", 88 "elementType": "labels.text.fill", 89 "stylers": [ 90 { 91 "saturation": 36 92 }, 93 { 94 "color": "#000000" 95 }, 96 { 97 "lightness": 40 98 } 99 ] 100 }, 101 { 102 "featureType": "all", 103 "elementType": "labels.text.stroke", 104 "stylers": [ 105 { 106 "visibility": "on" 107 }, 108 { 109 "color": "#000000" 110 }, 111 { 112 "lightness": 16 113 } 114 ] 115 }, 116 { 117 "featureType": "all", 118 "elementType": "labels.icon", 119 "stylers": [ 120 { 121 "visibility": "off" 122 } 123 ] 124 }, 125 { 126 "featureType": "administrative", 127 "elementType": "geometry.fill", 128 "stylers": [ 129 { 130 "color": "#000000" 131 }, 132 { 133 "lightness": 20 134 } 135 ] 136 }, 137 { 138 "featureType": "administrative", 139 "elementType": "geometry.stroke", 140 "stylers": [ 141 { 142 "color": "#000000" 143 }, 144 { 145 "lightness": 17 146 }, 147 { 148 "weight": 1.2 149 } 150 ] 151 }, 152 { 153 "featureType": "landscape", 154 "elementType": "geometry", 155 "stylers": [ 156 { 157 "color": "#000000" 158 }, 159 { 160 "lightness": 20 161 } 162 ] 163 }, 164 { 165 "featureType": "poi", 166 "elementType": "geometry", 167 "stylers": [ 168 { 169 "color": "#000000" 170 }, 171 { 172 "lightness": 21 173 } 174 ] 175 }, 176 { 177 "featureType": "road.highway", 178 "elementType": "geometry.fill", 179 "stylers": [ 180 { 181 "color": "#000000" 182 }, 183 { 184 "lightness": 17 185 } 186 ] 187 }, 188 { 189 "featureType": "road.highway", 190 "elementType": "geometry.stroke", 191 "stylers": [ 192 { 193 "color": "#000000" 194 }, 195 { 196 "lightness": 29 197 }, 198 { 199 "weight": 0.2 200 } 201 ] 202 }, 203 { 204 "featureType": "road.arterial", 205 "elementType": "geometry", 206 "stylers": [ 207 { 208 "color": "#000000" 209 }, 210 { 211 "lightness": 18 212 } 213 ] 214 }, 215 { 216 "featureType": "road.local", 217 "elementType": "geometry", 218 "stylers": [ 219 { 220 "color": "#000000" 221 }, 222 { 223 "lightness": 16 224 } 225 ] 226 }, 227 { 228 "featureType": "transit", 229 "elementType": "geometry", 230 "stylers": [ 231 { 232 "color": "#000000" 233 }, 234 { 235 "lightness": 19 236 } 237 ] 238 }, 239 { 240 "featureType": "water", 241 "elementType": "geometry", 242 "stylers": [ 243 { 244 "color": "#000000" 245 }, 246 { 247 "lightness": 17 248 } 249 ] 250 }]; 251 } else { 252 $darkColorObj[0] = {}; 253 $darkColorObj[1] = {}; 254 $darkColorObj[2] = {}; 255 $darkColorObj[3] = {}; 256 $darkColorObj[4] = {}; 257 $darkColorObj[5] = {}; 258 $darkColorObj[6] = {}; 259 $darkColorObj[7] = {}; 260 $darkColorObj[8] = {}; 261 $darkColorObj[9] = {}; 262 $darkColorObj[10] = {}; 263 $darkColorObj[11] = {}; 264 $darkColorObj[12] = {}; 265 } 266 267 if(greyscale == '1' && extraColor.length > 0) { 268 styles = [ 269 270 { 271 featureType: "poi", 272 elementType: "labels", 273 stylers: [{ 274 visibility: "off" 275 }] 276 }, 277 { 278 featureType: "road.local", 279 elementType: "labels.icon", 280 stylers: [{ 281 "visibility": "off" 282 }] 283 }, 284 { 285 featureType: "road.arterial", 286 elementType: "labels.icon", 287 stylers: [{ 288 "visibility": "off" 289 }] 290 }, 291 { 292 featureType: "road", 293 elementType: "geometry.stroke", 294 stylers: [{ 295 visibility: "off" 296 }] 297 }, 298 { 299 featureType: "transit", 300 elementType: "geometry.fill", 301 stylers: [ 302 { hue: extraColor }, 303 { visibility: "on" }, 304 { lightness: 1 }, 305 { saturation: 7 } 306 ] 307 }, 308 { 309 elementType: "labels", 310 stylers: [{ 311 saturation: -100, 312 }] 313 }, 314 { 315 featureType: "poi", 316 elementType: "geometry.fill", 317 stylers: [ 318 { hue: extraColor }, 319 { visibility: "on" }, 320 { lightness: 20 }, 321 { saturation: 7 } 322 ] 323 }, 324 { 325 featureType: "landscape", 326 stylers: [ 327 { hue: extraColor }, 328 { visibility: "on" }, 329 { lightness: 20 }, 330 { saturation: 20 } 331 ] 332 333 }, 334 { 335 featureType: "road", 336 elementType: "geometry.fill", 337 stylers: [ 338 { hue: extraColor }, 339 { visibility: "on" }, 340 { lightness: 1 }, 341 { saturation: 7 } 342 ] 343 }, 344 { 345 featureType: "water", 346 elementType: "geometry", 347 stylers: [ 348 { hue: extraColor }, 349 { visibility: "on" }, 350 { lightness: 1 }, 351 { saturation: 7 } 352 ] 353 }, 354 $darkColorObj[0], 355 $darkColorObj[1], 356 $darkColorObj[2], 357 $darkColorObj[3], 358 $darkColorObj[4], 359 $darkColorObj[5], 360 $darkColorObj[6], 361 $darkColorObj[7], 362 $darkColorObj[8], 363 $darkColorObj[9], 364 $darkColorObj[10], 365 $darkColorObj[11], 366 $darkColorObj[12], 367 $flatObj[0], 368 $flatObj[1], 369 $flatObj[2] 370 ]; 371 372 } 373 374 375 376 else if(greyscale == '1'){ 377 378 styles = [ 379 380 { 381 featureType: "poi", 382 elementType: "labels", 383 stylers: [{ 384 visibility: "off" 385 }] 386 }, 387 { 388 featureType: "road.local", 389 elementType: "labels.icon", 390 stylers: [{ 391 "visibility": "off" 392 }] 393 }, 394 { 395 featureType: "road.arterial", 396 elementType: "labels.icon", 397 stylers: [{ 398 "visibility": "off" 399 }] 400 }, 401 { 402 featureType: "road", 403 elementType: "geometry.stroke", 404 stylers: [{ 405 visibility: "off" 406 }] 407 }, 408 { 409 elementType: "geometry", 410 stylers: [{ 411 saturation: -100 412 }] 413 }, 414 { 415 elementType: "labels", 416 stylers: [{ 417 saturation: -100 418 }] 419 }, 420 { 421 featureType: "poi", 422 elementType: "geometry.fill", 423 stylers: [{ 424 color: "#ffffff" 425 }] 426 }, 427 { 428 featureType: "landscape", 429 stylers: [{ 430 color: "#ffffff" 431 }] 432 }, 433 { 434 featureType: "road", 435 elementType: "geometry.fill", 436 stylers: [ { 437 color: "#f1f1f1" 438 }] 439 }, 440 { 441 featureType: "water", 442 elementType: "geometry", 443 stylers: [{ 444 color: "#b9e7f4" 445 }] 446 }, 447 $darkColorObj[0], 448 $darkColorObj[1], 449 $darkColorObj[2], 450 $darkColorObj[3], 451 $darkColorObj[4], 452 $darkColorObj[5], 453 $darkColorObj[6], 454 $darkColorObj[7], 455 $darkColorObj[8], 456 $darkColorObj[9], 457 $darkColorObj[10], 458 $darkColorObj[11], 459 $darkColorObj[12], 460 $flatObj[0], 461 $flatObj[1], 462 $flatObj[2] 463 ]; 464 465 466 } 467 468 469 else { 470 styles = []; 471 } 472 473 474 var styledMap = new google.maps.StyledMapType(styles, 475 {name: "Styled Map"}); 476 477 478 //options 479 var mapOptions = { 480 center: latLng, 481 zoom: zoomLevel, 482 mapTypeControlOptions: { 483 mapTypeIds: [google.maps.MapTypeId.ROADMAP, 'map_style'] 484 }, 485 scrollwheel: false, 486 panControl: false, 487 zoomControl: enableZoom, 488 disableDoubleClickZoom: enableZoomConnect, 489 zoomControlOptions: { 490 style: google.maps.ZoomControlStyle.LARGE, 491 position: google.maps.ControlPosition.LEFT_CENTER 492 }, 493 mapTypeControl: false, 494 scaleControl: false, 495 streetViewControl: false 496 497 }; 498 499 map[i] = new google.maps.Map(document.getElementById($(this).attr('id')), mapOptions); 500 501 //Associate the styled map with the MapTypeId and set it to display. 502 map[i].mapTypes.set('map_style', styledMap); 503 map[i].setMapTypeId('map_style'); 504 505 var $count = i; 506 507 google.maps.event.addListenerOnce(map[i], 'tilesloaded', function() { 508 509 var map_id = $(map[i].getDiv()).attr('id'); 510 511 //don't start the animation until the marker image is loaded if there is one 512 if(markerImg.length > 0) { 513 var markerImgLoad = new Image(); 514 markerImgLoad.src = markerImg; 515 516 $(markerImgLoad).load(function(){ 517 setMarkers(map[i], map_id, $count); 518 });
519 520 } 521 else { 522 setMarkers(map[i], map_id, $count); 523 } 524 }); 525 526 }); 527 528 529 //watcher to resize gmap inside grow-in animatino col 530 var $gMapsAnimatedSelector = $('.col.has-animation[data-animation="grow-in"] .nectar-google-map'); 531 var gMapsInterval = []; 532 var gMapsAnimatedCount = ($gMapsAnimatedSelector.length > 0) ? $gMapsAnimatedSelector.length : 0; 533 $gMapsAnimatedSelector.each(function(i){ 534 535 var $that = $(this); 536 537 //watcher 538 gMapsInterval[i] = setInterval(function(){ 539 540 if($that.parents('.col.has-animation[data-animation="grow-in"]').hasClass('animated-in')) { 541 542 for(var k=0; k < map.length; k++ ) { 543 google.maps.event.trigger(map[k], 'resize'); 544 } 545 546 //clear watcher 547 setTimeout(function(){ 548 clearInterval(gMapsInterval[i]); 549 },1000); 550 551 } 552 553 },500); 554 555 }); 556 557 CustomMarker.prototype = new google.maps.OverlayView(); 558 CustomMarker.prototype.draw = function() { 559 560 var me = this; 561 var div = this.div_; 562 if (!div) { 563 div = this.div_ = $('' + 564 '<div><div class="animated-dot">' + 565 '<div class="middle-dot"></div>' + 566 '<div class="signal"></div>' + 567 '<div class="signal2"></div>' + 568 '</div></div>' + 569 '')[0]; 570 571 572 div.style.position = 'absolute'; 573 div.style.paddingLeft = '0px'; 574 div.style.cursor = 'pointer'; 575 576 var panes = this.getPanes(); 577 panes.overlayImage.appendChild(div); 578 579 580 581 } 582 var point = this.getProjection().fromLatLngToDivPixel(this.latlng_); 583 if (point) { 584 div.style.left = point.x + 'px'; 585 div.style.top = point.y + 'px'; 586 } 587 588 //infowindow 589 google.maps.event.addDomListener(div, "click", function(event) { 590 591 infoWindows[me.mapIndex][me.infoWindowIndex].setPosition(me.latlng_); 592 infoWindows[me.mapIndex][me.infoWindowIndex].open(me.map); 593 594 }); 595 596 }; 597 CustomMarker.prototype.remove = function() { 598 // Check if the overlay was on the map and needs to be removed. 599 if (this.div_) { 600 this.div_.parentNode.removeChild(this.div_); 601 this.div_ = null; 602 } 603 }; 604 605 CustomMarker.prototype.getPosition = function() { 606 return this.latlng_; 607 }; 608 609 } //api loaded 610 611 612 613 if(typeof google === 'object' && typeof google.maps === 'object') { 614 615 616 $(window).on("pronto.render", function(){ 617 mapAPI_Loaded(); 618 }); 619 620 //$(window).trigger('resize'); 621 //mapAPI_Loaded(); 622 //setTimeout(function(){ $(window).trigger('resize'); },200); 623 624 } else { 625 626 if(nectarLove.mapApiKey.length > 0) { 627 $.getScript('https://maps.googleapis.com/maps/api/js?sensor=false&key='+nectarLove.mapApiKey+'&callback=mapAPI_Loaded'); 628 } else { 629 $.getScript('https://maps.googleapis.com/maps/api/js?sensor=false&callback=mapAPI_Loaded'); 630 } 631 632 633 } 634 635 636 637 638 function CustomMarker(latlng, map, PARAM1, PARAM2) { 639 this.latlng_ = latlng; 640 this.infoWindowIndex = PARAM1; 641 this.mapIndex = PARAM2; 642 this.setMap(map); 643 } 644 645 function setMarkers(map,map_id,count) { 646 647 648 $('.map-marker-list.'+map_id).each(function(){ 649 650 var enableAnimation = $('#'+map_id).attr('data-enable-animation'); 651 652 $(this).find('.map-marker').each(function(i){ 653 654 //nectar marker 655 if($('#'+map_id).is('[data-marker-style="nectar"]')) { 656 var latlng = new google.maps.LatLng($(this).attr('data-lat'), $(this).attr('data-lng')); 657 var overlay = new CustomMarker(latlng, map, i, count); 658 } 659 660 661 var marker = new google.maps.Marker({ 662 position: new google.maps.LatLng($(this).attr('data-lat'), $(this).attr('data-lng')), 663 map: map, 664 visible: false, 665 mapIndex: count, 666 infoWindowIndex : i, 667 icon: $('#'+map_id).attr('data-marker-img'), 668 optimized: false 669 }); 670 671 //google default marker 672 if(!$('#'+map_id).is('[data-marker-style="nectar"]')) { 673 //animation 674 if(typeof enableAnimation != 'undefined' && enableAnimation == 1 && $(window).width() > 690) { 675 setTimeout(function() { 676 marker.setAnimation(google.maps.Animation.BOUNCE); 677 marker.setOptions({ visible: true });
678 setTimeout(function(){marker.setAnimation(null);},500); 679 }, i * 200); 680 } else { 681 marker.setOptions({ visible: true }); 682 } 683 } 684 685 //infowindows 686 if($(this).attr('data-mapinfo') != '' && $(this).attr('data-mapinfo') != '<br />' && $(this).attr('data-mapinfo') != '<br/>') { 687 var infowindow = new google.maps.InfoWindow({ 688 content: $(this).attr('data-mapinfo'), 689 maxWidth: 300 690 }); 691 692 infoWindows[count].push(infowindow); 693 694 google.maps.event.addListener(marker, 'click', (function(marker, i) { 695 return function() { 696 infoWindows[this.mapIndex][this.infoWindowIndex].open(map, this); 697 } 698 699 })(marker, i)); 700 } 701 702 703 }); 704 705 }); 706 707 708 }//setMarker 709 710});
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.