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