1(function($) 2{ 3 "use strict"; 4 5 $( function() 6 { 7 //global variables that are used on several ocassions 8 $.avia_utilities = $.avia_utilities || {}; 9 10 if( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) && 'ontouchstart' in document.documentElement) 11 { 12 $.avia_utilities.isMobile = true; 13 } 14 else 15 { 16 $.avia_utilities.isMobile = false; 17 } 18 19 //activate fixed bg fallback for mobile 20 if( $.fn.avia_mobile_fixed ) 21 { 22 $('.avia-bg-style-fixed').avia_mobile_fixed(); 23 } 24 25 //activate parallax scrolling for backgrounds. 26 if( $.fn.avia_parallax ) 27 { 28 $('.av-parallax').avia_parallax(); 29 } 30 31 //calculate the browser height and append a css rule to the head 32 if( $.fn.avia_browser_height ) 33 { 34 $('.av-minimum-height, .avia-fullscreen-slider, .av-cell-min-height').avia_browser_height(); 35 } 36 37 //calculate the height of each video section 38 if( $.fn.avia_video_section ) 39 { 40 $('.av-section-with-video-bg').avia_video_section(); 41 } 42 43 //creates team social icon tooltip 44 new $.AviaTooltip({'class': "avia-tooltip", data: "avia-tooltip", delay:0, scope: "body"}); 45 46 //creates icon element tooltip 47 new $.AviaTooltip({'class': "avia-tooltip avia-icon-tooltip", data: "avia-icon-tooltip", delay:0, scope: "body"}); 48 49 $.avia_utilities.activate_shortcode_scripts(); 50 51 //layer slider height helper 52 if( $.fn.layer_slider_height_helper ) 53 { 54 $('.avia-layerslider').layer_slider_height_helper(); 55 } 56 57 //"ajax" portfolio 58 if($.fn.avia_portfolio_preview) 59 { 60 $('.grid-links-ajax').avia_portfolio_preview(); 61 } 62 63 // actiavte the masonry script: sorting/loading/etc 64 if( $.fn.avia_masonry ) 65 { 66 $('.av-masonry').avia_masonry(); 67 } 68 69 //activate the accordion 70 if( $.fn.aviaccordion ) 71 { 72 $('.aviaccordion').aviaccordion(); 73 } 74 75 76 //activate the accordion 77 if( $.fn.avia_textrotator ) 78 { 79 $('.av-rotator-container').avia_textrotator(); 80 } 81 82 //activates the tab section shortcode 83 if($.fn.avia_sc_tab_section) 84 { 85 $('.av-tab-section-container').avia_sc_tab_section(); 86 } 87 88 //activates the hor gallery shortcode 89 if($.fn.avia_hor_gallery) 90 { 91 $('.av-horizontal-gallery').avia_hor_gallery(); 92 } 93 94 // activate columns and cells with a link 95 if($.fn.avia_link_column) 96 { 97 $('.avia-link-column').avia_link_column(); 98 } 99 100 if($.fn.avia_delayed_animation_in_container) 101 { 102 $('.av-animation-delay-container').avia_delayed_animation_in_container(); 103 } 104 }); 105 106 107 108 109 110// ------------------------------------------------------------------------------------------- 111// ACTIVATE ALL SHORTCODES 112// ------------------------------------------------------------------------------------------- 113 114 $.avia_utilities = $.avia_utilities || {}; 115 $.avia_utilities.activate_shortcode_scripts = function(container) 116 { 117 if( typeof container == 'undefined' ) 118 { 119 container = 'body'; 120 } 121 122 //activates the form shortcode 123 if($.fn.avia_ajax_form) 124 { 125 $('.avia_ajax_form:not( .avia-disable-default-ajax )', container).avia_ajax_form(); 126 } 127 128 activate_waypoints(container); 129 130 //activate the video api 131 if($.fn.aviaVideoApi) 132 { 133 $('.avia-slideshow iframe[src*="youtube.com"], .av_youtube_frame, .av_vimeo_frame, .avia-slideshow video').aviaVideoApi({}, 'li'); 134 } 135 136 //activates the toggle shortcode 137 if($.fn.avia_sc_toggle) 138 { 139 $('.togglecontainer', container).avia_sc_toggle(); 140 } 141 142 //activates the tabs shortcode 143 if($.fn.avia_sc_tabs) 144 { 145 $('.top_tab', container).avia_sc_tabs(); 146 $('.sidebar_tab', container).avia_sc_tabs({sidebar:true}); 147 } 148 149 //activates behavior and animation for gallery 150 if($.fn.avia_sc_gallery) 151 { 152 $('.avia-gallery', container).avia_sc_gallery(); 153 } 154 155 //activates animated number shortcode 156 if($.fn.avia_sc_animated_number) 157 { 158 $('.avia-animated-number', container).avia_sc_animated_number(); 159 } 160 161 //animation for elements that are not connected like icon shortcode 162 if($.fn.avia_sc_animation_delayed) 163 { 164 $('.av_font_icon', container).avia_sc_animation_delayed({delay:100}); 165 $('.avia-image-container', container).avia_sc_animation_delayed({delay:100}); 166 $('.av-hotspot-image-container', container).avia_sc_animation_delayed({delay:100}); 167 $('.av-animated-generic', container).avia_sc_animation_delayed({delay:100}); 168 } 169 170 //activates animation for iconlist 171 if($.fn.avia_sc_iconlist) 172 { 173 $('.avia-icon-list.av-iconlist-big.avia-iconlist-animate', container).avia_sc_iconlist(); 174 } 175 176 //activates animation for progress bar 177 if($.fn.avia_sc_progressbar) 178 { 179 $('.avia-progress-bar-container', container).avia_sc_progressbar(); 180 } 181 182 //activates animation for testimonial 183 if($.fn.avia_sc_testimonial) 184 { 185 $('.avia-testimonial-wrapper', container).avia_sc_testimonial(); 186 } 187 188 //activate the fullscreen slider 189 if($.fn.aviaFullscreenSlider) 190 { 191 $('.avia-slideshow.av_fullscreen', container).aviaFullscreenSlider(); 192 } 193 194 //activate the aviaslider 195 if($.fn.aviaSlider) 196 { 197 $('.avia-slideshow:not(.av_fullscreen)', container).aviaSlider(); 198 199 //content slider 200 $('.avia-content-slider-active', container).aviaSlider({wrapElement: '.avia-content-slider-inner', slideElement:'.slide-entry-wrap', fullfade:true}); 201 202 //testimonial slider 203 $('.avia-slider-testimonials', container).aviaSlider({wrapElement: '.avia-testimonial-row', slideElement:'.avia-testimonial', fullfade:true}); 204 } 205 206 //load magazine sorting 207 if($.fn.aviaMagazine) 208 { 209 $('.av-magazine-tabs-active', container).aviaMagazine(); 210 } 211 212 //load image hotspot 213 if($.fn.aviaHotspots) 214 { 215 $('.av-hotspot-image-container', container).aviaHotspots(); 216 } 217 218 //load countdown 219 if($.fn.aviaCountdown) 220 { 221 $('.av-countdown-timer', container).aviaCountdown(); 222 } 223 224 //load audio player 225 if($.fn.aviaPlayer) 226 { 227 $('.av-player', container).aviaPlayer(); 228 } 229 }; 230 231 232 function activate_waypoints(container) 233 { 234 //activates simple css animations of the content once the user scrolls to an elements 235 if( $.fn.avia_waypoints ) 236 { 237 if( typeof container == 'undefined' ) 238 { 239 container = 'body'; 240 } 241 242 $('.avia_animate_when_visible', container).avia_waypoints(); 243 $('.avia_animate_when_almost_visible', container).avia_waypoints({ offset: '80%'}); 244 245 if( container == 'body' ) 246 { 247 container = '.avia_desktop body'; 248 } 249 250 $('.av-animated-generic', container).avia_waypoints({ offset: '95%'}); 251 } 252 } 253 254 255// ------------------------------------------------------------------------------------------- 256 257 $.AviaParallaxElement = function(options, element) 258 { 259 this.$el = $( element ).addClass('active-parallax'); 260 this.$win = $( window ); 261 this.$body = $( 'body' ); 262 this.$parent = this.$el.parent(); 263 this.property = {}; 264 this.isMobile = $.avia_utilities.isMobile; 265 this.ratio = this.$el.data('avia-parallax-ratio') || 0.5; 266 this.transform = document.documentElement.className.indexOf('avia_transform') !== -1 ? true : false;
267 this.transform3d= document.documentElement.className.indexOf('avia_transform3d') !== -1 ? true : false; 268 this.ticking = false; 269 270 if($.avia_utilities.supported.transition === undefined) 271 { 272 $.avia_utilities.supported.transition = $.avia_utilities.supports('transition'); 273 } 274 275 this._init( options ); 276 }; 277 278 $.AviaParallaxElement.prototype = 279 { 280 _init: function( options ) 281 { 282 var _self = this; 283 if(_self.isMobile) 284 { 285 return; //disable parallax scrolling on mobile 286 } 287 288 //fetch window constants 289 setTimeout(function() 290 { 291 _self._fetch_properties(); 292 },30); 293 294 this.$win.on("debouncedresize av-height-change", $.proxy( _self._fetch_properties, _self)); 295 this.$body.on("av_resize_finished", $.proxy( _self._fetch_properties, _self)); 296 297 298 299 //activate the scrolling 300 setTimeout(function() 301 { 302 _self.$win.on( 'scroll', $.proxy( _self._on_scroll, _self) ); 303 304 },100); 305 }, 306 307 _fetch_properties: function() 308 { 309 this.property.offset = this.$parent.offset().top; 310 this.property.wh = this.$win.height(); 311 this.property.height = this.$parent.outerHeight(); 312 313 //set the height of the element based on the windows height, offset ratio and parent height 314 this.$el.height(Math.ceil((this.property.wh * this.ratio) + this.property.height)); 315 316 //re-position the element 317 this._parallax_scroll(); 318 }, 319 320 _on_scroll: function(e) 321 { 322 var _self = this; 323 324 if(!_self.ticking) { 325 _self.ticking = true; 326 window.requestAnimationFrame( $.proxy( _self._parallax_scroll, _self) ); 327 } 328 }, 329 330 _parallax_scroll: function(e) 331 { 332 var winTop = this.$win.scrollTop(), 333 winBottom = winTop + this.property.wh, 334 scrollPos = "0", 335 prop = {}; 336 337 //shift element when it moves into viewport 338 if(this.property.offset < winBottom && winTop <= this.property.offset + this.property.height) 339 { 340 scrollPos = Math.ceil( (winBottom - this.property.offset) * this.ratio ); 341 342 //parallax movement via backround position change, although 343 if(this.transform3d) 344 { 345 prop[$.avia_utilities.supported.transition+"transform"] = "translate3d(0px,"+ scrollPos +"px, 0px)"; 346 } 347 else if(this.transform) 348 { 349 prop[$.avia_utilities.supported.transition+"transform"] = "translate(0px,"+ scrollPos +"px)"; 350 } 351 else 352 { 353 prop["background-position"] = "0px "+ scrollPos +"px"; 354 } 355 356 this.$el.css(prop); 357 } 358 359 this.ticking = false; 360 } 361 }; 362 363 364 $.fn.avia_parallax = function(options) 365 { 366 return this.each(function() 367 { 368 var self = $.data( this, 'aviaParallax' ); 369 370 if(!self) 371 { 372 self = $.data( this, 'aviaParallax', new $.AviaParallaxElement( options, this ) ); 373 } 374 }); 375 }; 376 377 378 // ------------------------------------------------------------------------------------------- 379 // Helper to allow fixed bgs on mobile 380 // ------------------------------------------------------------------------------------------- 381 382 $.fn.avia_mobile_fixed = function(options) 383 { 384 var isMobile = $.avia_utilities.isMobile; 385 if(!isMobile) return; 386 387 return this.each(function() 388 { 389 var current = $(this).addClass('av-parallax-section'), 390 $background = current.attr('style'), 391 $attachment_class = current.data('section-bg-repeat'), 392 template = ""; 393 394 if($attachment_class == 'stretch' || $attachment_class == 'no-repeat' ) 395 { 396 $attachment_class = " avia-full-stretch"; 397 } 398 else 399 { 400 $attachment_class = ""; 401 } 402 403 template = "<div class='av-parallax " + $attachment_class + "' data-avia-parallax-ratio='0.0' style = '" + $background + "' ></div>"; 404 405 current.prepend(template); 406 current.attr('style',''); 407 }); 408 }; 409 410 411 412 // ------------------------------------------------------------------------------------------- 413 // shortcode javascript for delayed animation even when non connected elements are used 414 // ------------------------------------------------------------------------------------------- 415 416 $.fn.avia_sc_animation_delayed = function(options) 417 { 418 var global_timer = 0,
419 delay = options.delay || 50, 420 max_timer = 10, 421 new_max = setTimeout(function(){ max_timer = 20; }, 500); 422 423 return this.each(function() 424 { 425 var elements = $(this); 426 427 //trigger displaying of thumbnails 428 elements.on('avia_start_animation', function() 429 { 430 var element = $(this); 431 432 if(global_timer < max_timer) global_timer ++; 433 434 setTimeout(function() 435 { 436 element.addClass('avia_start_delayed_animation'); 437 if(global_timer > 0) global_timer --; 438 439 }, (global_timer * delay)); 440 441 }); 442 }); 443 }; 444 445 /*delayd animations when used within tab sections or similar elements. this way they get animated each new time a tab is shown*/ 446 $.fn.avia_delayed_animation_in_container = function(options) 447 { 448 return this.each(function() 449 { 450 var elements = $(this); 451 452 elements.on('avia_start_animation_if_current_slide_is_active', function() 453 { 454 var current = $(this), 455 animate = current.find('.avia_start_animation_when_active'); 456 457 animate.addClass('avia_start_animation').trigger('avia_start_animation'); 458 }); 459 460 elements.on('avia_remove_animation', function() 461 { 462 var current = $(this), 463 animate = current.find('.avia_start_animation_when_active, .avia_start_animation'); 464 animate.removeClass('avia_start_animation avia_start_delayed_animation'); 465 }); 466 }); 467 }; 468 469 470 471 472 473 // ------------------------------------------------------------------------------------------- 474 // Section Height Helper 475 // ------------------------------------------------------------------------------------------- 476 477 $.fn.avia_browser_height = function() 478 { 479 if(!this.length) return; 480 481 var win = $(window), 482 html_el = $('html'), 483 headFirst = $( 'head' ).first(), 484 subtract = $('#wpadminbar, #header.av_header_top:not(.html_header_transparency #header), #main>.title_container'), 485 css_block = $("<style type='text/css' id='av-browser-height'></style>").appendTo( headFirst ), 486 sidebar_menu= $('.html_header_sidebar #top #header_main'), 487 full_slider = $('.html_header_sidebar .avia-fullscreen-slider.avia-builder-el-0.avia-builder-el-no-sibling').addClass('av-solo-full'), 488 pc_heights = [ 25, 50, 75 ], 489 calc_height = function() 490 { 491 var css = "", 492 wh100 = win.height(), 493 ww100 = win.width(), 494 wh100_mod = wh100, 495 whCover = (wh100 / 9) * 16, 496 wwCover = (ww100 / 16) * 9, 497 solo = 0, 498 whCustom = []; 499 500 if(sidebar_menu.length) solo = sidebar_menu.height(); 501 502 subtract.each(function(){ wh100_mod -= this.offsetHeight - 1; }); 503 504 var whCoverMod = (wh100_mod / 9) * 16; 505 506 //fade in of section content with minimum height once the height has been calculated 507 css += ".avia-section.av-minimum-height .container{opacity: 1; }\n"; 508 509 //various section heights (100-25% as well as 100% - header/adminbar in case its the first builder element) 510 css += ".av-minimum-height-100 .container, .avia-fullscreen-slider .avia-slideshow, #top.avia-blank .av-minimum-height-100 .container, .av-cell-min-height-100 > .flex_cell{height:"+wh100+"px;}\n"; 511 512 $.each( pc_heights, function( index, value ) { 513 var wh = Math.round( wh100 * ( value / 100.0 ) ); 514 css += ".av-minimum-height-" + value + " .container, .av-cell-min-height-" + value + " > .flex_cell {height:" + wh + "px;}\n"; 515 }); 516 517 css += ".avia-builder-el-0.av-minimum-height-100 .container, .avia-builder-el-0.avia-fullscreen-slider .avia-slideshow, .avia-builder-el-0.av-cell-min-height-100 > .flex_cell{height:"+wh100_mod+"px;}\n"; 518 519 css += "#top .av-solo-full .avia-slideshow {min-height:"+solo+"px;}\n"; 520 521 //fullscreen video calculations 522 if(ww100/wh100 < 16/9) 523 { 524 css += "#top .av-element-cover iframe, #top .av-element-cover embed, #top .av-element-cover object, #top .av-element-cover video{width:"+whCover+"px; left: -"+(whCover - ww100)/2+"px;}\n"; 525 } 526 else 527 { 528 css += "#top .av-element-cover iframe, #top .av-element-cover embed, #top .av-element-cover object, #top .av-element-cover video{height:"+wwCover+"px; top: -"+(wwCover - wh100)/2+"px;}\n"; 529 } 530 531 if(ww100/wh100_mod < 16/9) 532 { 533 css += "#top .avia-builder-el-0 .av-element-cover iframe, #top .avia-builder-el-0 .av-element-cover embed, #top .avia-builder-el-0 .av-element-cover object, #top .avia-builder-el-0 .av-element-cover video{width:"+whCoverMod+"px; left: -"+(whCoverMod - ww100)/2+"px;}\n"; 534 } 535 else 536 { 537 css += "#top .avia-builder-el-0 .av-element-cover iframe, #top .avia-builder-el-0 .av-element-cover embed, #top .avia-builder-el-0 .av-element-cover object, #top .avia-builder-el-0 .av-element-cover video{he
537ight:"+wwCover+"px; top: -"+(wwCover - wh100_mod)/2+"px;}\n"; 538 } 539 540 //ie8 needs different insert method 541 try{ 542 css_block.text(css); 543 } 544 catch(err){ 545 css_block.remove(); 546 css_block = $("<style type='text/css' id='av-browser-height'>"+css+"</style>").appendTo( headFirst ); 547 } 548 549 550 setTimeout(function(){ win.trigger('av-height-change'); /*broadcast the height change*/ },100); 551 }; 552 553 this.each( function( index ) { 554 var height = $(this).data('av_minimum_height_pc'); 555 if( 'number' != typeof height ) 556 { 557 return this; 558 } 559 560 height = parseInt( height ); 561 562 if( ( -1 == $.inArray( height, pc_heights ) ) && ( height != 100 ) ) 563 { 564 pc_heights.push( height ); 565 } 566 567 return this; 568 }); 569 570 win.on( 'debouncedresize', calc_height ); 571 calc_height(); 572 }; 573 574 // ------------------------------------------------------------------------------------------- 575 // Video Section helper 576 // ------------------------------------------------------------------------------------------- 577 578 $.fn.avia_video_section = function() 579 { 580 if(!this.length) return; 581 582 var elements = this.length, content = "", 583 win = $(window), 584 headFirst = $( 'head' ).first(), 585 css_block = $("<style type='text/css' id='av-section-height'></style>").appendTo( headFirst ), 586 calc_height = function(section, counter) 587 { 588 if(counter === 0) { content = "";} 589 590 var css = "", 591 the_id = '#' +section.attr('id'), 592 wh100 = section.height(), 593 ww100 = section.width(), 594 aspect = section.data('sectionVideoRatio').split(':'), 595 video_w = aspect[0], 596 video_h = aspect[1], 597 whCover = (wh100 / video_h ) * video_w, 598 wwCover = (ww100 / video_w ) * video_h; 599 600 //fullscreen video calculations 601 if(ww100/wh100 < video_w/video_h) 602 { 603 css += "#top "+the_id+" .av-section-video-bg iframe, #top "+the_id+" .av-section-video-bg embed, #top "+the_id+" .av-section-video-bg object, #top "+the_id+" .av-section-video-bg video{width:"+whCover+"px; left: -"+(whCover - ww100)/2+"px;}\n"; 604 } 605 else 606 { 607 css += "#top "+the_id+" .av-section-video-bg iframe, #top "+the_id+" .av-section-video-bg embed, #top "+the_id+" .av-section-video-bg object, #top "+the_id+" .av-section-video-bg video{height:"+wwCover+"px; top: -"+(wwCover - wh100)/2+"px;}\n"; 608 } 609 610 content = content + css; 611 612 if(elements == counter + 1) 613 { 614 //ie8 needs different insert method 615 try{ 616 css_block.text(content); 617 } 618 catch(err){ 619 css_block.remove(); 620 css_block = $("<style type='text/css' id='av-section-height'>"+content+"</style>").appendTo( headFirst ); 621 } 622 } 623 }; 624 625 626 return this.each(function(i) 627 { 628 var self = $(this); 629 630 win.on( 'debouncedresize', function(){ calc_height(self, i); }); 631 calc_height(self, i); 632 }); 633 634 }; 635 636 637 /** 638 * Column or cell with a link 639 * 640 * @returns {jQuery} 641 */ 642 $.fn.avia_link_column = function() 643 { 644 return this.each( function() 645 { 646 $(this).on( 'click', function(e){ 647 648 // if event is bubbled from an <a> link, do not activate link of column/cell 649 if( 'undefined' !== typeof e.target && 'undefined' !== typeof e.target.href ) 650 { 651 return; 652 } 653 654 var column = $(this), 655 url = column.data('link-column-url'), 656 target = column.data('link-column-target'), 657 link = window.location.hostname+window.location.pathname; 658 659 if( 'undefined' === typeof url || 'string' !== typeof url ) 660 { 661 return; 662 } 663 664 if( 'undefined' !== typeof target || '_blank' == target ) 665 { 666 // in FF and other browsers this opens a new window and not only a new tab 667 // window.open( url, '_blank', 'noopener noreferrer' ); 668 var a = document.createElement('a'); 669 a.href = url; 670 a.target = '_blank'; 671 a.rel = 'noopener noreferrer'; 672 a.click(); 673 return false; 674 } 675 else 676 { 677 // allow smoothscroll feature when on same page and hash exists - trigger only works for current page 678 if( column.hasClass('av-cell-link') || column.hasClass('av-column-link') ) 679 { 680 var reader = column.hasClass('av-cell-link') ? column.prev('a.av-screen-reader-only').first() : column.find('a.av-screen-reader-only').first(); 681 url = url.trim(); 682 if( (0 == url.indexOf("#")) || ((url.indexOf(link) >= 0) && (url.indexOf("#") > 0) ) ) 683 { 684 reader.trigger('click'); 685 return; 686 } 687 } 688 689 window.location.href = url; 690 } 691 692 e.preventDefault(); 693 return; 694 }); 695 696 }); 697 }; 698 699 700 // ------------------------------------------------------------------------------------------- 701 // HELPER FUNCTIONS 702 // ------------------------------------------------------------------------------------------- 703 704 705 //waipoint script when something comes into viewport 706 $.fn.avia_waypoints = function(options_passed) 707 { 708 if(! $('html').is('.avia_transform')) return; 709 710 var defaults = { offset: 'bottom-in-view' , triggerOnce: true}, 711 options = $.extend({}, defaults, options_passed), 712 isMobile = $.avia_utilities.isMobile; 713 714 return this.each(function() 715 { 716 var element = $(this); 717 718 setTimeout(function() 719 { 720 if(isMobile) 721 { 722 element.addClass('avia_start_animation').trigger('avia_start_animation'); 723 } 724 else 725 { 726 element.waypoint(function(direction) 727 { 728 var current = $(this.element), 729 parent = current.parents('.av-animation-delay-container').eq( 0 ); 730 731 if(parent.length) 732 { 733 current.addClass('avia_start_animation_when_active').trigger('avia_start_animation_when_active'); 734 } 735 736 if( !parent.length || (parent.length && parent.is('.__av_init_open')) || (parent.length && parent.is('.av-active-tab-content')) ) 737 { 738 current.addClass('avia_start_animation').trigger('avia_start_animation'); 739 } 740 }, options ); 741 } 742 },100); 743 744 }); 745 }; 746 747 748 // window resize script 749 var $event = $.event, $special, resizeTimeout; 750 751 $special = $event.special.debouncedresize = { 752 setup: function() { 753 $( this ).on( "resize", $special.handler ); 754 }, 755 teardown: function() { 756 $( this ).off( "resize", $special.handler ); 757 }, 758 handler: function( event, execAsap ) { 759 // Save the context 760 var context = this, 761 args = arguments, 762 dispatch = function() { 763 // set correct event type 764 event.type = "debouncedresize"; 765 $event.dispatch.apply( context, args ); 766 }; 767 768 if ( resizeTimeout ) { 769 clearTimeout( resizeTimeout ); 770 } 771 772 execAsap ? 773 dispatch() : 774 resizeTimeout = setTimeout( dispatch, $special.threshold ); 775 }, 776 threshold: 150 777 }; 778 779})( jQuery ); 780 781 782 783/*utility functions*/ 784 785 786(function($) 787{ 788 "use strict"; 789 790 $.avia_utilities = $.avia_utilities || {}; 791 792 /************************************************************************ 793 gloabl loading function 794 *************************************************************************/ 795 $.avia_utilities.loading = function(attach_to, delay){ 796 797 var loader = { 798 799 active: false, 800 801 show: function() 802 { 803 if(loader.active === false) 804 { 805 loader.active = true; 806 loader.loading_item.css({display:'block', opacity:0}
806); 807 } 808 809 loader.loading_item.stop().animate({opacity:1}); 810 }, 811 812 hide: function() 813 { 814 if(typeof delay === 'undefined'){ delay = 600; } 815 816 loader.loading_item.stop().delay( delay ).animate({opacity:0}, function() 817 { 818 loader.loading_item.css({display:'none'}); 819 loader.active = false; 820 }); 821 }, 822 823 attach: function() 824 { 825 if(typeof attach_to === 'undefined'){ attach_to = 'body';} 826 827 loader.loading_item = $('<div class="avia_loading_icon"><div class="av-siteloader"></div></div>').css({display:"none"}).appendTo(attach_to); 828 } 829 }; 830 831 loader.attach(); 832 return loader; 833 }; 834 835 /************************************************************************ 836 gloabl play/pause visualizer function 837 *************************************************************************/ 838 $.avia_utilities.playpause = function(attach_to, delay){ 839 840 var pp = { 841 842 active: false, 843 to1: "", 844 to2: "", 845 set: function(status) 846 { 847 pp.loading_item.removeClass('av-play av-pause'); 848 pp.to1 = setTimeout(function(){ pp.loading_item.addClass('av-' + status); },10); 849 pp.to2 = setTimeout(function(){ pp.loading_item.removeClass('av-' + status); },1500); 850 }, 851 852 attach: function() 853 { 854 if(typeof attach_to === 'undefined'){ attach_to = 'body';} 855 856 pp.loading_item = $('<div class="avia_playpause_icon"></div>').css({display:"none"}).appendTo(attach_to); 857 } 858 }; 859 860 pp.attach(); 861 return pp; 862 }; 863 864 865 866 /************************************************************************ 867 preload images, as soon as all are loaded trigger a special load ready event 868 *************************************************************************/ 869 $.avia_utilities.preload = function(options_passed) 870 { 871 new $.AviaPreloader(options_passed); 872 }; 873 874 $.AviaPreloader = function(options) 875 { 876 this.win = $(window); 877 this.defaults = 878 { 879 container: 'body', 880 maxLoops: 10, 881 trigger_single: true, 882 single_callback: function(){}, 883 global_callback: function(){} 884 885 }; 886 this.options = $.extend({}, this.defaults, options); 887 this.preload_images = 0; 888 889 this.load_images(); 890 }; 891 892 $.AviaPreloader.prototype = 893 { 894 load_images: function() 895 { 896 var _self = this; 897 898 if(typeof _self.options.container === 'string'){ _self.options.container = $(_self.options.container); } 899 900 _self.options.container.each(function() 901 { 902 var container = $(this); 903 904 container.images = container.find('img'); 905 container.allImages = container.images; 906 907 _self.preload_images += container.images.length; 908 setTimeout(function(){ _self.checkImage(container); }, 10); 909 }); 910 }, 911 912 checkImage: function(container) 913 { 914 var _self = this; 915 916 container.images.each(function() 917 { 918 if(this.complete === true) 919 { 920 container.images = container.images.not(this); 921 _self.preload_images -= 1; 922 } 923 }); 924 925 if(container.images.length && _self.options.maxLoops >= 0) 926 { 927 _self.options.maxLoops-=1; 928 setTimeout( function(){ _self.checkImage( container ); }, 500 ); 929 } 930 else 931 { 932 _self.preload_images = _self.preload_images - container.images.length; 933 _self.trigger_loaded(container); 934 } 935 }, 936 937 trigger_loaded: function(container) 938 { 939 var _self = this; 940 941 if(_self.options.trigger_single !== false) 942 { 943 _self.win.trigger('avia_images_loaded_single', [container]); 944 _self.options.single_callback.call(container); 945 } 946 947 if(_self.preload_images === 0) 948 { 949 _self.win.trigger('avia_images_loaded'); 950 _self.options.global_callback.call(); 951 } 952 953 } 954 }; 955 956 /************************************************************************ 957 CSS Easing transformation table 958 *************************************************************************/ 959 /* 960 Easing transform table from jquery.animate-enhanced plugin 961 http://github.com/benbarnett/jQuery-Animate-Enhanced 962 */ 963 $.avia_utilities.css_easings = { 964 linear: 'linear', 965 swing: 'ease-in-out', 966 bounce: 'cubic-bezier(0.0, 0.35, .5, 1.3)', 967 easeInQuad: 'cubic-bezier(0.550, 0.085, 0.680, 0.530)' , 968 easeInCubic: 'cubic-bezier(0.550, 0.055, 0.675, 0.190)' , 969 easeInQuart: 'cubic-bezier(0.895, 0.030, 0.685, 0.220)' , 970 easeInQuint: 'cubic-bezier(0.755, 0.050, 0.855, 0.060)' , 971 easeInSine: 'cubic-bezier(0.470, 0.000, 0.745, 0.715)' , 972 easeInExpo: 'cubic-bezier(0.950, 0.050, 0.795, 0.035)' , 973 easeInCirc: 'cubic-bezier(0.600, 0.040, 0.980, 0.335)' , 974 easeInBack: 'cubic-bezier(0.600, -0.280, 0.735, 0.04)' , 975 easeOutQuad: 'cubic-bezier(0.250, 0.460, 0.450, 0.940)' , 976 easeOutCubic: 'cubic-bezier(0.215, 0.610, 0.355, 1.000)' , 977 easeOutQuart: 'cubic-bezier(0.165, 0.840, 0.440, 1.000)' , 978 easeOutQuint: 'cubic-bezier(0.230, 1.000, 0.320, 1.000)' , 979 easeOutSine: 'cubic-bezier(0.390, 0.575, 0.565, 1.000)' , 980 easeOutExpo: 'cubic-bezier(0.190, 1.000, 0.220, 1.000)' , 981 easeOutCirc: 'cubic-bezier(0.075, 0.820, 0.165, 1.000)' , 982 easeOutBack: 'cubic-bezier(0.175, 0.885, 0.320, 1.275)' , 983 easeInOutQuad: 'cubic-bezier(0.455, 0.030, 0.515, 0.955)' , 984 easeInOutCubic: 'cubic-bezier(0.645, 0.045, 0.355, 1.000)' , 985 easeInOutQuart: 'cubic-bezier(0.770, 0.000, 0.175, 1.000)' , 986 easeInOutQuint: 'cubic-bezier(0.860, 0.000, 0.070, 1.000)' , 987 easeInOutSine: 'cubic-bezier(0.445, 0.050, 0.550, 0.950)' , 988 easeInOutExpo: 'cubic-bezier(1.000, 0.000, 0.000, 1.000)' , 989 easeInOutCirc: 'cubic-bezier(0.785, 0.135, 0.150, 0.860)' , 990 easeInOutBack: 'cubic-bezier(0.680, -0.550, 0.265, 1.55)' , 991 easeInOutBounce:'cubic-bezier(0.580, -0.365, 0.490, 1.365)', 992 easeOutBounce: 'cubic-bezier(0.760, 0.085, 0.490, 1.365)' 993 }; 994 995 /************************************************************************ 996 check if a css feature is supported and save it to the supported array 997 *************************************************************************/ 998 $.avia_utilities.supported = {}; 999 $.avia_utilities.supports = (function() 1000 { 1001 var div = document.createElement('div'), 1002 vendors = ['Khtml', 'Ms','Moz','Webkit']; // vendors = ['Khtml', 'Ms','Moz','Webkit','O']; 1003 1004 return function(prop, vendor_overwrite) 1005 { 1006 if ( div.style[prop] !== undefined ) { return ""; }
1007 if (vendor_overwrite !== undefined) { vendors = vendor_overwrite; } 1008 1009 prop = prop.replace(/^[a-z]/, function(val) 1010 { 1011 return val.toUpperCase(); 1012 }); 1013 1014 var len = vendors.length; 1015 while(len--) 1016 { 1017 if ( div.style[vendors[len] + prop] !== undefined ) 1018 { 1019 return "-" + vendors[len].toLowerCase() + "-"; 1020 } 1021 } 1022 1023 return false; 1024 }; 1025 1026 }()); 1027 1028 /************************************************************************ 1029 animation function 1030 *************************************************************************/ 1031 $.fn.avia_animate = function(prop, speed, easing, callback) 1032 { 1033 if(typeof speed === 'function') {callback = speed; speed = false; } 1034 if(typeof easing === 'function'){callback = easing; easing = false;} 1035 if(typeof speed === 'string'){easing = speed; speed = false;} 1036 1037 if(callback === undefined || callback === false){ callback = function(){}; } 1038 if(easing === undefined || easing === false) { easing = 'easeInQuad'; } 1039 if(speed === undefined || speed === false) { speed = 400; } 1040 1041 if($.avia_utilities.supported.transition === undefined) 1042 { 1043 $.avia_utilities.supported.transition = $.avia_utilities.supports('transition'); 1044 } 1045 1046 1047 1048 if($.avia_utilities.supported.transition !== false ) 1049 { 1050 var prefix = $.avia_utilities.supported.transition + 'transition', 1051 cssRule = {}, 1052 cssProp = {}, 1053 thisStyle = document.body.style, 1054 end = (thisStyle.WebkitTransition !== undefined) ? 'webkitTransitionEnd' : (thisStyle.OTransition !== undefined) ? 'oTransitionEnd' : 'transitionend'; 1055 1056 //translate easing into css easing 1057 easing = $.avia_utilities.css_easings[easing]; 1058 1059 //create css transformation rule 1060 cssRule[prefix] = 'all '+(speed/1000)+'s '+easing; 1061 //add namespace to the transition end trigger 1062 end = end + ".avia_animate"; 1063 1064 //since jquery 1.10 the items passed need to be {} and not [] so make sure they are converted properly 1065 for (var rule in prop) 1066 { 1067 if (prop.hasOwnProperty(rule)) { cssProp[rule] = prop[rule]; } 1068 } 1069 prop = cssProp; 1070 1071 1072 1073 this.each(function() 1074 { 1075 var element = $(this), css_difference = false, rule, current_css; 1076 1077 for (rule in prop) 1078 { 1079 if (prop.hasOwnProperty(rule)) 1080 { 1081 current_css = element.css(rule); 1082 1083 if(prop[rule] != current_css && prop[rule] != current_css.replace(/px|%/g,"")) 1084 { 1085 css_difference = true; 1086 break; 1087 } 1088 } 1089 } 1090 1091 if(css_difference) 1092 { 1093 //if no transform property is set set a 3d translate to enable hardware acceleration 1094 if(!($.avia_utilities.supported.transition+"transform" in prop)) 1095 { 1096 prop[$.avia_utilities.supported.transition+"transform"] = "translateZ(0)"; 1097 } 1098 1099 var endTriggered = false; 1100 1101 element.on(end, function(event) 1102 { 1103 if(event.target != event.currentTarget) return false; 1104 1105 if(endTriggered == true) return false; 1106 endTriggered = true; 1107 1108 cssRule[prefix] = "none"; 1109 1110 element.off(end); 1111 element.css(cssRule); 1112 setTimeout(function(){ callback.call(element); }); 1113 }); 1114 1115 1116 //desktop safari fallback if we are in another tab to trigger the end event 1117 setTimeout(function(){ 1118 if(!endTriggered && !avia_is_mobile && $('html').is('.avia-safari') ) { 1119 element.trigger(end); 1120 $.avia_utilities.log('Safari Fallback '+end+' trigger'); 1121 } 1122 }, speed + 100); 1123 1124 setTimeout(function(){ element.css(cssRule);},10); 1125 setTimeout(function(){ element.css(prop); },20); 1126 } 1127 else 1128 { 1129 setTimeout(function(){ callback.call(element); }); 1130 } 1131 1132 }); 1133 } 1134 else // if css animation is not available use default JS animation 1135 { 1136 this.animate(prop, speed, easing, callback); 1137 } 1138 1139 return this; 1140 }; 1141 1142})( jQuery ); 1143 1144 1145 1146// ------------------------------------------------------------------------------------------- 1147// keyboard controls 1148// ------------------------------------------------------------------------------------------- 1149 1150(function($) 1151{ 1152 "use strict"; 1153 1154 /************************************************************************ 1155 keyboard arrow nav 1156 *************************************************************************/ 1157 $.fn.avia_keyboard_controls = function(options_passed) 1158 { 1159 var defaults = 1160 { 1161 37: '.prev-slide', // prev 1162 39: '.next-slide' // next 1163 }, 1164 1165 methods = { 1166 1167 mousebind: function(slider) 1168 { 1169 slider.on('mouseenter', function(){ 1170 slider.mouseover = true; }) 1171 .on('mouseleave', function(){ 1172 slider.mouseover = false; } 1173 ); 1174 }, 1175 1176 keybind: function(slider) 1177 { 1178 $(document).on('keydown', function(e) 1179 { 1180 if(slider.mouseover && typeof slider.options[e.keyCode] !== 'undefined') 1181 { 1182 var item; 1183 1184 if(typeof slider.options[e.keyCode] === 'string') 1185 { 1186 item = slider.find(slider.options[e.keyCode]); 1187 } 1188 else 1189 { 1190 item = slider.options[e.keyCode]; 1191 } 1192 1193 if(item.length) 1194 { 1195 item.trigger('click', ['keypress']); 1196 return false;
1197 } 1198 } 1199 }); 1200 } 1201 }; 1202 1203 1204 return this.each(function() 1205 { 1206 var slider = $(this); 1207 slider.options = $.extend({}, defaults, options_passed); 1208 slider.mouseover = false; 1209 1210 methods.mousebind(slider); 1211 methods.keybind(slider); 1212 1213 }); 1214 }; 1215 1216 1217 /************************************************************************ 1218 swipe nav 1219 *************************************************************************/ 1220 $.fn.avia_swipe_trigger = function(passed_options) 1221 { 1222 var win = $(window), 1223 isMobile = $.avia_utilities.isMobile, 1224 defaults = 1225 { 1226 prev: '.prev-slide', 1227 next: '.next-slide', 1228 event: { 1229 prev: 'click', 1230 next: 'click' 1231 } 1232 }, 1233 1234 methods = { 1235 1236 activate_touch_control: function(slider) 1237 { 1238 var i, differenceX, differenceY; 1239 1240 slider.touchPos = {}; 1241 slider.hasMoved = false; 1242 1243 slider.on('touchstart', function(event) 1244 { 1245 slider.touchPos.X = event.originalEvent.touches[0].clientX; 1246 slider.touchPos.Y = event.originalEvent.touches[0].clientY; 1247 }); 1248 1249 slider.on('touchend', function(event) 1250 { 1251 slider.touchPos = {}; 1252 if(slider.hasMoved) { event.preventDefault(); } 1253 slider.hasMoved = false; 1254 }); 1255 1256 slider.on('touchmove', function(event) 1257 { 1258 if(!slider.touchPos.X) 1259 { 1260 slider.touchPos.X = event.originalEvent.touches[0].clientX; 1261 slider.touchPos.Y = event.originalEvent.touches[0].clientY; 1262 } 1263 else 1264 { 1265 differenceX = event.originalEvent.touches[0].clientX - slider.touchPos.X; 1266 differenceY = event.originalEvent.touches[0].clientY - slider.touchPos.Y; 1267 1268 //check if user is scrolling the window or moving the slider 1269 if(Math.abs(differenceX) > Math.abs(differenceY)) 1270 { 1271 event.preventDefault(); 1272 1273 if(slider.touchPos !== event.originalEvent.touches[0].clientX) 1274 { 1275 if(Math.abs(differenceX) > 50) 1276 { 1277 i = differenceX > 0 ? 'prev' : 'next'; 1278 1279 if(typeof slider.options[i] === 'string') 1280 { 1281 slider.find(slider.options[i]).trigger(slider.options.event[i], ['swipe']); 1282 } 1283 else 1284 { 1285 slider.options[i].trigger(slider.options.event[i], ['swipe']); 1286 } 1287 1288 slider.hasMoved = true; 1289 slider.touchPos = {}; 1290 return false; 1291 } 1292 } 1293 } 1294 } 1295 }); 1296 } 1297 }; 1298 1299 return this.each(function() 1300 { 1301 if(isMobile) 1302 { 1303 var slider = $(this); 1304 1305 slider.options = $.extend({}, defaults, passed_options); 1306 1307 methods.activate_touch_control(slider); 1308 } 1309 }); 1310 }; 1311 1312}(jQuery)); 1313 1314/** 1315 * jQuery 3.x: JQMIGRATE: easing function âjQuery.easing.swingâ should use only first argument 1316 * https://stackoverflow.com/questions/39355019/jqmigrate-easing-function-jquery-easing-swing-should-use-only-first-argument 1317 * https://github.com/gdsmith/jquery.easing/blob/master/jquery.easing.js 1318 * 1319 * @since 4.8.4 1320 * @param {jQuery} $ 1321 */ 1322(function($) 1323{ 1324 // Preserve the original jQuery "swing" easing as "jswing" 1325 if (typeof $.easing !== 'undefined') { 1326 $.easing['jswing'] = $.easing['swing']; 1327 } 1328 1329 var pow = Math.pow, 1330 sqrt = Math.sqrt, 1331 sin = Math.sin, 1332 cos = Math.cos, 1333 PI = Math.PI, 1334 c1 = 1.70158, 1335 c2 = c1 * 1.525, 1336 c3 = c1 + 1, 1337 c4 = ( 2 * PI ) / 3, 1338 c5 = ( 2 * PI ) / 4.5; 1339 1340 // x is the fraction of animation progress, in the range 0..1 1341 function bounceOut(x) { 1342 var n1 = 7.5625, 1343 d1 = 2.75; 1344 if ( x < 1/d1 ) { 1345 return n1*x*x; 1346 } else if ( x < 2/d1 ) { 1347 return n1*(x-=(1.5/d1))*x + .75; 1348 } else if ( x < 2.5/d1 ) { 1349 return n1*(x-=(2.25/d1))*x + .9375; 1350 } else { 1351 return n1*(x-=(2.625/d1))*x + .984375; 1352 } 1353 } 1354 1355 $.extend( $.easing, 1356 { 1357 def: 'easeOutQuad', 1358 swing: function (x) { 1359 return $.easing[$.easing.def](x); 1360 }, 1361 easeInQuad: function (x) { 1362 return x * x; 1363 }, 1364 easeOutQuad: function (x) { 1365 return 1 - ( 1 - x ) * ( 1 - x ); 1366 }, 1367 easeInOutQuad: function (x) { 1368 return x < 0.5 ? 1369 2 * x * x : 1370 1 - pow( -2 * x + 2, 2 ) / 2; 1371 }, 1372 easeInCubic: function (x) { 1373 return x * x * x; 1374 }, 1375 easeOutCubic: function (x) { 1376 return 1 - pow( 1 - x, 3 ); 1377 }, 1378 easeInOutCubic: function (x) { 1379 return x < 0.5 ? 1380 4 * x * x * x : 1381 1 - pow( -2 * x + 2, 3 ) / 2; 1382 }, 1383 easeInQuart: function (x) { 1384 return x * x * x * x; 1385 }, 1386 easeOutQuart: function (x) { 1387 return 1 - pow( 1 - x, 4 ); 1388 }, 1389 easeInOutQuart: function (x) { 1390 return x < 0.5 ? 1391 8 * x * x * x * x : 1392 1 - pow( -2 * x + 2, 4 ) / 2; 1393 }, 1394 easeInQuint: function (x) { 1395 return x * x * x * x * x; 1396 }, 1397 easeOutQuint: function (x) { 1398 return 1 - pow( 1 - x, 5 ); 1399 }, 1400 easeInOutQuint: function (x) { 1401 return x < 0.5 ? 1402 16 * x * x * x * x * x : 1403 1 - pow( -2 * x + 2, 5 ) / 2; 1404 }, 1405 easeInSine: function (x) { 1406 return 1 - cos( x * PI/2 ); 1407 }, 1408 easeOutSine: function (x) { 1409 return sin( x * PI/2 ); 1410 }, 1411 easeInOutSine: function (x) { 1412 return -( cos( PI * x ) - 1 ) / 2; 1413 }, 1414 easeInExpo: function (x) { 1415 return x === 0 ? 0 : pow( 2, 10 * x - 10 ); 1416 }, 1417 easeOutExpo: function (x) { 1418 return x === 1 ? 1 : 1 - pow( 2, -10 * x ); 1419 }, 1420 easeInOutExpo: function (x) { 1421 return x === 0 ? 0 : x === 1 ? 1 : x < 0.5 ? 1422 pow( 2, 20 * x - 10 ) / 2 : 1423 ( 2 - pow( 2, -20 * x + 10 ) ) / 2; 1424 }, 1425 easeInCirc: function (x) { 1426 return 1 - sqrt( 1 - pow( x, 2 ) ); 1427 }, 1428 easeOutCirc: function (x) { 1429 return sqrt( 1 - pow( x - 1, 2 ) ); 1430 }, 1431 easeInOutCirc: function (x) { 1432 return x < 0.5 ? 1433 ( 1 - sqrt( 1 - pow( 2 * x, 2 ) ) ) / 2 : 1434 ( sqrt( 1 - pow( -2 * x + 2, 2 ) ) + 1 ) / 2; 1435 }, 1436 easeInElastic: function (x) { 1437 return x === 0 ? 0 : x === 1 ? 1 : 1438 -pow( 2, 10 * x - 10 ) * sin( ( x * 10 - 10.75 ) * c4 ); 1439 }, 1440 easeOutElastic: function (x) { 1441 return x === 0 ? 0 : x === 1 ? 1 : 1442 pow( 2, -10 * x ) * sin( ( x * 10 - 0.75 ) * c4 ) + 1; 1443 }, 1444 easeInOutElastic: function (x) { 1445 return x === 0 ? 0 : x === 1 ? 1 : x < 0.5 ? 1446 -( pow( 2, 20 * x - 10 ) * sin( ( 20 * x - 11.125 ) * c5 )) / 2 : 1447 pow( 2, -20 * x + 10 ) * sin( ( 20 * x - 11.125 ) * c5 ) / 2 + 1; 1448 }, 1449 easeInBack: function (x) { 1450 return c3 * x * x * x - c1 * x * x; 1451 }, 1452 easeOutBack: function (x) { 1453 return 1 + c3 * pow( x - 1, 3 ) + c1 * pow( x - 1, 2 ); 1454 }, 1455 easeInOutBack: function (x) { 1456 return x < 0.5 ? 1457 ( pow( 2 * x, 2 ) * ( ( c2 + 1 ) * 2 * x - c2 ) ) / 2 : 1458 ( pow( 2 * x - 2, 2 ) *( ( c2 + 1 ) * ( x * 2 - 2 ) + c2 ) + 2 ) / 2; 1459 }, 1460 easeInBounce: function (x) { 1461 return 1 - bounceOut( 1 - x ); 1462 }, 1463 easeOutBounce: bounceOut, 1464 easeInOutBounce: function (x) { 1465 return x < 0.5 ? 1466 ( 1 - bounceOut( 1 - 2 * x ) ) / 2 : 1467 ( 1 + bounceOut( 2 * x - 1 ) ) / 2; 1468 } 1469 }); 1470 1471}(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.