1var heroApp; 2var mapApp; 3var tabsApp; 4var faqsApp; 5(function($){ 6 'use strict'; 7 $(document).ready(function() { 8 MG.init(); 9 MM.init(); 10 MS.init(); 11 MC.init(); 12 MA.init(); 13 $('[data-lightbox], .gallery-icon a').attr('rel', 'lightbox-gallery').fancybox({ 14 openEffect: 'fade', 15 closeEffect: 'fade', 16 prevEffect: 'fade', 17 nextEffect: 'fade', 18 padding: 0, 19 helpers: {title: {type: 'inside'}, overlay: {css: {'background-color': 'rgba(0,0,0,0.5)'}}} 20 }); 21 $('[data-popup]').addPopups(); 22 $('[data-videopopup]').addVideoPopup(); 23 $('[data-iframe]').addIFrame(); 24 if (!Modernizr.objectfit) { 25 $('.of-fix').each(function () { 26 var c = $(this), 27 i = c.find('img').prop('src'); 28 if(imgUrl) { 29 c.css('backgroundImage', 'url(' + i + ')').addClass('of-fix-fit'); 30 } 31 }); 32 } 33 }); 34 $( window ).on( 'load', function() { 35 MA.start(); 36 equalizer.init(); 37 equalall.init(); 38 }); 39 var MA = { 40 top: 0, 41 last: 0, 42 init: function() { 43 $(window).on('scroll.direction', function(){ 44 MA.last = MA.top; 45 MA.top = $(this).scrollTop(); 46 $('body').toggleClass('scrolled-up', MA.top < MA.last); 47 }); 48 }, 49 start: function() { 50 var waypoint1 = new Waypoint({ 51 element: $('body'), 52 handler: function(direction) { 53 $('body').toggleClass('scrolled', direction === 'down'); 54 }, 55 offset: -120 56 }); 57 var waypoint2 = new Waypoint({ 58 element: $('body'), 59 handler: function(direction) { 60 $('body').toggleClass('scrolled-menu', direction === 'down'); 61 }, 62 offset: -300 63 }); 64 } 65 }; 66 var equalizer = { 67 resizing: false, 68 resizer: {}, 69 init: function() { 70 this.resize(); 71 $(window).on('resize.equalizer', function() { 72 if(!equalizer.resizing) { 73 equalizer.resizing = true; 74 } 75 clearTimeout(equalizer.resizer); 76 equalizer.resizer = setTimeout(function(){equalizer.resize();}, 250); 77 }); 78 }, 79 resize: function() { 80 $('[data-equal]').each(function() { 81 var name = $(this).attr('data-equal'), 82 sizer = $(this).attr('data-equalitem'), 83 width = $(this).width(), 84 items = $(this).find(name + ':visible'), 85 itemwidth = items.width(), 86 columns = Math.round(width/itemwidth), 87 sets = [], 88 current = 0, 89 count = 1, 90 s, m; 91 items.each(function() {
92 var set = Math.ceil(count/columns), obj; 93 if(set !== current) { 94 current = set; 95 sets.push(current); 96 } 97 obj = (sizer === undefined) ? $(this) : $(this).find(sizer); 98 obj.attr('data-equalset', set).css('height', 'auto'); 99 count += 1; 100 }); 101 if(columns > 1) { 102 for(s=0; s < sets.length; s++) { 103 m = -1; 104 $(this).find('[data-equalset=' + sets[s] + ']').each(function() { 105 m = Math.max(m, $(this).height()); 106 }).height(m); 107 } 108 } 109 }); 110 this.resizing = false; 111 } 112 }; 113 var equalall = { 114 resizing: false, 115 resizer: {}, 116 init: function() { 117 this.resize(); 118 $(window).on('resize.equalall', function() { 119 if(!equalall.resizing) { 120 equalall.resizing = true; 121 } 122 clearTimeout(equalall.resizer); 123 equalall.resizer = setTimeout(function(){equalall.resize();}, 250); 124 }); 125 }, 126 resize: function() { 127 $('[data-equalall]').each(function() { 128 var name = $(this).attr('data-equalall'), 129 sizer = $(this).attr('data-equalallitem'), 130 items = $(this).find(name + ':visible'), 131 height = -1; 132 items.each(function() { 133 var obj = $(this).find(sizer); 134 obj.css('height', 'auto'); 135 height = Math.max(height, obj.height()); 136 }); 137 items.each(function() { 138 $(this).find(sizer).css('height', height); 139 }); 140 }); 141 this.resizing = false; 142 } 143 }; 144 heroApp = { 145 Playing: false, 146 Control: {}, 147 Wait: 7000, 148 Pos: 1, 149 W: 0, 150 Record: 0, 151 init: function() { 152 this.Record = $('#hero-items>div').length; 153 if(this.Record > 1) { 154 this.play(); 155 } 156 }, 157 stop: function() { 158 if(this.Playing) { 159 clearTimeout(this.Control); 160 this.Playing = false; 161 } 162 }, 163 play: function() { 164 this.Playing = true; 165 this.delay(); 166 }, 167 delay: function() { 168 if(this.Playing) this.Control = setTimeout('heroApp.auto();', this.Wait); 169 }, 170 auto: function() { 171 this.goto((this.Pos != this.Record) ? this.Pos+1 : 1); 172 }, 173 next: function() { 174 if(this.Playing) this.stop(); 175 this.auto(); 176 return false; 177 }, 178 prev: function() { 179 if(this.Playing) this.stop(); 180 this.goto((this.Pos != 1) ? this.Pos-1 : this.Record); 181 return false; 182 }, 183 choose: function(p) { 184 this.stop(); 185 this.goto(p); 186 return false; 187 }, 188 goto: function(p) { 189 $('#hero-' + this.Pos).removeClass('hero-current'); 190 $('#hero-text-' + this.Pos).removeClass('hero-current'); 191 $('#hero-button-' + this.Pos).removeClass('hero-current'); 192 this.Pos = p; 193 $('#hero-' + this.Pos).addClass('hero-current'); 194 $('#hero-text-' + this.Pos).addClass('hero-current'); 195 $('#hero-button-' + this.Pos).addClass('hero-current'); 196 if(this.Playing) this.delay(); 197 } 198 }; 199 mapApp = { 200 z: 1, 201 created: false, 202 markers: {}, 203 close: function() { 204 $('#map').removeClass('hide'); 205 this.create($('#map')); 206 }, 207 create: function(obj) { 208 var markers = obj.find('.marker'); 209 var args = { 210 zoom: 13, 211 center: new google.maps.LatLng(0, 0), 212 mapTypeId: google.maps.MapTypeId.ROADMAP 213 }; 214 this.created = true; 215 this.map = new google.maps.Map(obj[0], args); 216 this.map.markers = []; 217 markers.each(function() { 218 var id = $(this).attr('data-id'); 219 mapApp.markers['m' + id] = { 220 lat: $(this).attr('data-lat'), 221 lng: $(this).attr('data-lng'), 222 icon: $(this).attr('data-icon'), 223 html: $(this).html() 224 }; 225 mapApp.marker(id); 226 }); 227 this.center(); 228 }, 229 marker: function(id) { 230 var info = this.markers['m' + id]; 231 var latlng = new google.maps.LatLng(info.lat, info.lng), 232 icon = info.icon, iconfile; 233 switch(icon) { 234 case 'location': { 235 iconfile = (id <= 50) ? 'location-' + id + '.svg' : 'location-0.svg'; 236 break; 237 } 238 case 'office': { 239 iconfile = 'office.svg'; 240 break; 241 } 242 default: { 243 iconfile = 'location.svg'; 244 break; 245 } 246 } 247 var marker = new google.maps.Marker({ 248 map: this.map, 249 position: latlng, 250 icon: mapApp.geticon(iconfile) 251 }); 252 marker.setValues({id: id, iconfile: iconfile}); 253 this.map.markers.push(marker); 254 if(info.html) { 255 var infowindow = new google.maps.InfoWindow({ 256 content: info.html 257 }); 258 google.maps.event.addListener(marker, 'click', function() { 259 infowindow.open(mapApp.map, marker); 260 }); 261 google.maps.event.addListener(marker, 'mouseover', function() { 262 marker.setZIndex(google.maps.Marker.MAX_ZINDEX + mapApp.z++); 263 marker.setIcon(mapApp.geticon('h-' + marker.get('iconfile'))); 264 }); 265 google.maps.event.addListener(marker, 'mouseout', function() { 266 marker.setIcon(mapApp.geticon(marker.get('iconfile'))); 267 }); 268 } 269 }, 270 geticon: function(f) { 271 return new google.maps.MarkerImage(mywp.template_url + '/assets/map/' + f, new google.maps.Size(24, 30), new google.maps.Point(0, 0), new google.maps.Point(12, 30)); 272 }, 273 mouseeffect: function(p, c) { 274 google.maps.event.trigger(this.map.markers[p], c); 275 }, 276 center: function() { 277 var bounds = new google.maps.LatLngBounds(); 278 $.each(this.map.markers, function(i, marker) { 279 var latlng = new google.maps.LatLng(marker.position.lat(), marker.position.lng()); 280 bounds.extend( latlng ); 281 }); 282 if(this.map.markers.length == 1) { 283 this.map.setCenter(bounds.getCenter()); 284 this.map.setZoom(13); 285 } else { 286 this.map.fitBounds(bounds); 287 } 288 } 289 }; 290 tabsApp = { 291 tab: function(id, t) { 292 $('#tabs-' + id).attr('data-current', t); 293 } 294 }; 295 faqsApp = { 296 init: function() { 297 $('.faqs-header').on('click', function(e) { 298 e.stopPropagation(); 299 var id = $(this).attr('data-id'); 300 faqsApp.toggle(id); 301 }); 302 }, 303 toggle: function(id) { 304 var open = Number($('#faq' + id).attr('data-open')); 305 if(open) { 306 $('#faq' + id).attr('data-open', 0); 307 $('#faq-answer' + id).css({'maxHeight': '0px'}); 308 } else { 309 var height = $('#faq-answer' + id).prop('scrollHeight'); 310 $('#faq' + id).attr('data-open', 1); 311 $('#faq-answer' + id).css({'maxHeight': height + 'px'}); 312 } 313 $('#faq-header' + id).toggleClass('o'); 314 $('#faq-answer' + id).toggleClass('o'); 315 $('#faq-icon' + id).toggleClass('mf-plus mf-close'); 316 } 317 }; 318 var MG = { 319 Current: '', 320 Delay: {}, 321 init: function() { 322 $('.mega-hover').on('mouseover', function() {
323 clearTimeout(MG.Delay); 324 var id = $(this).attr('id'); 325 if(id !== MG.Current) { 326 if(MG.Current !== '') { 327 MG.close(); 328 } 329 MG.Current = id; 330 $(this).addClass('hover'); 331 } 332 }).on('mouseout', function() { 333 MG.Delay = setTimeout(function(){MG.close();}, 500); 334 }); 335 }, 336 close: function() { 337 $('#' + MG.Current).removeClass('hover'); 338 MG.Current = ''; 339 } 340 }; 341 var MM = { 342 Open: false, 343 Created: false, 344 init: function() { 345 $('.mobile-toggle').click(function(e) { 346 e.preventDefault(); 347 if(MM.Open) { 348 $('html').removeClass('menu-open'); 349 $('#menu-mobile-items').removeClass('hide'); 350 } else { 351 if(!MM.Created) { 352 MM.create(); 353 } 354 setTimeout(function() { 355 $('html').addClass('menu-open'); 356 }, 0); 357 } 358 MM.Open = !MM.Open; 359 }); 360 }, 361 create: function() { 362 var n = 0; 363 $('#menu-mobile-items li').each(function() { 364 var l = $(this).find('ul'), 365 a; 366 if(l.length) { 367 n += 1; 368 a = $(this).find('a:first'); 369 a.attr('data-mmid', n).attr('data-open', 'no').click(function(e) { 370 e.preventDefault(); 371 var o = $(this).attr('data-open'); 372 var i = $(this).attr('data-mmid'); 373 if(o === 'no') { 374 $(this).attr('data-open', 'yes'); 375 $('#mm-icon-' + i).removeClass('mf-chevron-right').addClass('mf-chevron-down'); 376 $('#mm-sub-' + i).addClass('mm-show'); 377 } else { 378 $(this).attr('data-open', 'no'); 379 $('#mm-icon-' + i).removeClass('mf-chevron-down').addClass('mf-chevron-right'); 380 $('#mm-sub-' + i).removeClass('mm-show'); 381 } 382 }); 383 a.append('<i id="mm-icon-' + n + '" class="mf mf-chevron-right fam" aria-hidden="true"></i>'); 384 l.attr('id', 'mm-sub-' + n); 385 } 386 }); 387 MM.Created = true; 388 } 389 }; 390 var MS = { 391 Open: false, 392 init: function() { 393 $('#header-search button').click(function(e) { 394 e.preventDefault(); 395 if(MS.Open) { 396 $('html').removeClass('search-open'); 397 $('#header-search button i').addClass('mf-search').removeClass('mf-close'); 398 } else { 399 $('html').addClass('search-open'); 400 $('#header-search-input').focus(); 401 $('#header-search button i').removeClass('mf-search').addClass('mf-close'); 402 } 403 MS.Open =! MS.Open; 404 }); 405 } 406 }; 407 var MC = { 408 init: function() { 409 var responsive = [ 410 { 411 breakpoint: 768, 412 settings: { 413 arrows: false, 414 slidesToShow: 2, 415 slidesToScroll: 2 416 } 417 },{ 418 breakpoint: 480, 419 settings: { 420 arrows: false, 421 slidesToShow: 1, 422 slidesToScroll: 1 423 } 424 } 425 ]; 426 var defaults = { 427 arrows: true, 428 dots: true, 429 infinite: false, 430 speed: 300, 431 slidesToShow: 3, 432 slidesToScroll: 3, 433 responsive: responsive 434 }; 435 $('.do-scroll').slick(defaults); 436 defaults.slidesToShow = 4; 437 defaults.responsive.unshift({ 438 breakpoint: 1024, 439 settings: { 440 arrows: false, 441 slidesToShow: 3, 442 slidesToScroll: 3 443 } 444 }); 445 $('.do-scroll-more').slick(defaults); 446 $('.do-scroll-2').slick({ 447 arrows: true, 448 dots: true, 449 infinite: false, 450 speed: 300, 451 slidesToShow: 2, 452 slidesToScroll: 2, 453 responsive: [ 454 { 455 breakpoint: 600, 456 settings: { 457 arrows: false, 458 slidesToShow: 1, 459 slidesToScroll: 1 460 } 461 } 462 ] 463 }); 464 } 465 }; 466 $.fn.addPopups = function(){ 467 return this.each(function(){ 468 $(this).click(function(t){ 469 t.preventDefault(); 470 var e = Math.min($(window).height(), 800); 471 return window.open($(this).attr('href'), 'SitePopup', 'width=600, height=' + e + ', resizable=yes, scrollbars=yes'); 472 }); 473 }); 474 }; 475 $.fn.addVideoPopup = function(){ 476 return this.each(function(){ 477 $(this).fancybox({ 478 padding: 0, 479 openEffect: 'none', 480 closeEffect: 'none', 481 aspectRatio: true, 482 width: 800, 483 height: 450, 484 helpers : { 485 media: {}, 486 title: { 487 type: 'inside' 488 }, 489 overlay : { 490 css : { 491 'background-color' : 'rgba(0,0,0,0.5)' 492 } 493 } 494 } 495 }); 496 }); 497 }; 498 $.fn.addIFrame = function(){ 499 return this.each(function(){ 500 $(this).fancybox({ 501 padding: 0, 502 type: 'iframe', 503 openEffect: 'none', 504 closeEffect: 'none', 505 width: 800, 506 height: '80%', 507 helpers : { 508 media: {}, 509 overlay : { 510 css : { 511 'background-color' : 'rgba(0,0,0,0.5)' 512 } 513 } 514 } 515 }); 516 }); 517 }; 518})(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.