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{height:"+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 727var $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 758 759 760 761$.easing['jswing'] = $.easing['swing']; 762 763$.extend( $.easing, 764{ 765 def: 'easeOutQuad', 766 swing: function (x, t, b, c, d) { return $.easing[$.easing.def](x, t, b, c, d); }, 767 easeInQuad: function (x, t, b, c, d) { return c*(t/=d)*t + b; }, 768 easeOutQuad: function (x, t, b, c, d) { return -c *(t/=d)*(t-2) + b; }, 769 easeInOutQuad: function (x, t, b, c, d) { if ((t/=d/2) < 1) return c/2*t*t + b; return -c/2 * ((--t)*(t-2) - 1) + b; }, 770 easeInCubic: function (x, t, b, c, d) { return c*(t/=d)*t*t + b; }, 771 easeOutCubic: function (x, t, b, c, d) { return c*((t=t/d-1)*t*t + 1) + b; }, 772 easeInOutCubic: function (x, t, b, c, d) { if ((t/=d/2) < 1) return c/2*t*t*t + b; return c/2*((t-=2)*t*t + 2) + b; }, 773 easeInQuart: function (x, t, b, c, d) { return c*(t/=d)*t*t*t + b; }, 774 easeOutQuart: function (x, t, b, c, d) { return -c * ((t=t/d-1)*t*t*t - 1) + b; }, 775 easeInOutQuart: function (x, t, b, c, d) { if ((t/=d/2) < 1) return c/2*t*t*t*t + b; return -c/2 * ((t-=2)*t*t*t - 2) + b; }, 776 easeInQuint: function (x, t, b, c, d) { return c*(t/=d)*t*t*t*t + b; }, 777 easeOutQuint: function (x, t, b, c, d) { return c*((t=t/d-1)*t*t*t*t + 1) + b; }, 778 easeInOutQuint: function (x, t, b, c, d) { if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b; return c/2*((t-=2)*t*t*t*t + 2) + b; }, 779 easeInSine: function (x, t, b, c, d) { return -c * Math.cos(t/d * (Math.PI/2)) + c + b; }, 780 easeOutSine: function (x, t, b, c, d) { return c * Math.sin(t/d * (Math.PI/2)) + b; }, 781 easeInOutSine: function (x, t, b, c, d) { return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b; }, 782 easeInExpo: function (x, t, b, c, d) { return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b; }, 783 easeOutExpo: function (x, t, b, c, d) { return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b; }, 784 easeInOutExpo: function (x, t, b, c, d) { 785 if (t==0) return b; 786 if (t==d) return b+c; 787 if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b; 788 return c/2 * (-Math.pow(2, -10 * --t) + 2) + b; 789 }, 790 easeInCirc: function (x, t, b, c, d) { return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b; }, 791 easeOutCirc: function (x, t, b, c, d) {return c * Math.sqrt(1 - (t=t/d-1)*t) + b; }, 792 easeInOutCirc: function (x, t, b, c, d) { if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b; return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b; }, 793 easeInElastic: function (x, t, b, c, d) { 794 var s=1.70158;var p=0;var a=c; 795 if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3; 796 if (a < Math.abs(c)) { a=c; var s=p/4; } 797 else var s = p/(2*Math.PI) * Math.asin (c/a); 798 return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b; 799 }, 800 easeOutElastic: function (x, t, b, c, d) { 801 var s=1.70158;var p=0;var a=c; 802 if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3; 803 if (a < Math.abs(c)) { a=c; var s=p/4; } 804 else var s = p/(2*Math.PI) * Math.asin (c/a); 805 return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b; 806 }, 807 easeInOutElastic: function (x, t, b, c, d) { 808 var s=1.70158;var p=0;var a=c; 809 if (t==0) return b; if ((t/=d/2)==2) return b+c; if (!p) p=d*(.3*1.5); 810 if (a < Math.abs(c)) { a=c; var s=p/4; } 811 else var s = p/(2*Math.PI) * Math.asin (c/a); 812 if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b; 813 return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b; 814 }, 815 easeInBack: function (x, t, b, c, d, s) { 816 if (s == undefined) s = 1.70158; 817 return c*(t/=d)*t*((s+1)*t - s) + b; 818 }, 819 easeOutBack: function (x, t, b, c, d, s) { 820 if (s == undefined) s = 1.70158; 821 return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b; 822 }, 823 easeInOutBack: function (x, t, b, c, d, s) { 824 if (s == undefined) s = 1.70158; 825 if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b; 826 return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b; 827 }, 828 easeInBounce: function (x, t, b, c, d) { 829 return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b; 830 }, 831 easeOutBounce: function (x, t, b, c, d) { 832 if ((t/=d) < (1/2.75)) { 833 return c*(7.5625*t*t) + b; 834 } else if (t < (2/2.75)) { 835 return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b; 836 } else if (t < (2.5/2.75)) { 837 return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b; 838 } else { 839 return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b; 840 } 841 }, 842 easeInOutBounce: function (x, t, b, c, d) { 843 if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b; 844 return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b; 845 } 846}); 847 848})( jQuery ); 849 850 851 852/*utility functions*/ 853 854 855(function($) 856{ 857 "use strict"; 858 859 $.avia_utilities = $.avia_utilities || {}; 860 861 /************************************************************************ 862 gloabl loading function 863 *************************************************************************/ 864 $.avia_utilities.loading = function(attach_to, delay){ 865 866 var loader = { 867 868 active: false, 869 870 show: function() 871 { 872 if(loader.active === false) 873 { 874 loader.active = true; 875 loader.loading_item.css({display:'block', opacity:0}
875); 876 } 877 878 loader.loading_item.stop().animate({opacity:1}); 879 }, 880 881 hide: function() 882 { 883 if(typeof delay === 'undefined'){ delay = 600; } 884 885 loader.loading_item.stop().delay( delay ).animate({opacity:0}, function() 886 { 887 loader.loading_item.css({display:'none'}); 888 loader.active = false; 889 }); 890 }, 891 892 attach: function() 893 { 894 if(typeof attach_to === 'undefined'){ attach_to = 'body';} 895 896 loader.loading_item = $('<div class="avia_loading_icon"><div class="av-siteloader"></div></div>').css({display:"none"}).appendTo(attach_to); 897 } 898 }; 899 900 loader.attach(); 901 return loader; 902 }; 903 904 /************************************************************************ 905 gloabl play/pause visualizer function 906 *************************************************************************/ 907 $.avia_utilities.playpause = function(attach_to, delay){ 908 909 var pp = { 910 911 active: false, 912 to1: "", 913 to2: "", 914 set: function(status) 915 { 916 pp.loading_item.removeClass('av-play av-pause'); 917 pp.to1 = setTimeout(function(){ pp.loading_item.addClass('av-' + status); },10); 918 pp.to2 = setTimeout(function(){ pp.loading_item.removeClass('av-' + status); },1500); 919 }, 920 921 attach: function() 922 { 923 if(typeof attach_to === 'undefined'){ attach_to = 'body';} 924 925 pp.loading_item = $('<div class="avia_playpause_icon"></div>').css({display:"none"}).appendTo(attach_to); 926 } 927 }; 928 929 pp.attach(); 930 return pp; 931 }; 932 933 934 935 /************************************************************************ 936 preload images, as soon as all are loaded trigger a special load ready event 937 *************************************************************************/ 938 $.avia_utilities.preload = function(options_passed) 939 { 940 new $.AviaPreloader(options_passed); 941 }; 942 943 $.AviaPreloader = function(options) 944 { 945 this.win = $(window); 946 this.defaults = 947 { 948 container: 'body', 949 maxLoops: 10, 950 trigger_single: true, 951 single_callback: function(){}, 952 global_callback: function(){} 953 954 }; 955 this.options = $.extend({}, this.defaults, options); 956 this.preload_images = 0; 957 958 this.load_images(); 959 }; 960 961 $.AviaPreloader.prototype = 962 { 963 load_images: function() 964 { 965 var _self = this; 966 967 if(typeof _self.options.container === 'string'){ _self.options.container = $(_self.options.container); } 968 969 _self.options.container.each(function() 970 { 971 var container = $(this); 972 973 container.images = container.find('img'); 974 container.allImages = container.images; 975 976 _self.preload_images += container.images.length; 977 setTimeout(function(){ _self.checkImage(container); }, 10); 978 }); 979 }, 980 981 checkImage: function(container) 982 { 983 var _self = this; 984 985 container.images.each(function() 986 { 987 if(this.complete === true) 988 { 989 container.images = container.images.not(this); 990 _self.preload_images -= 1; 991 } 992 }); 993 994 if(container.images.length && _self.options.maxLoops >= 0) 995 { 996 _self.options.maxLoops-=1; 997 setTimeout( function(){ _self.checkImage( container ); }, 500 ); 998 } 999 else 1000 { 1001 _self.preload_images = _self.preload_images - container.images.length; 1002 _self.trigger_loaded(container); 1003 } 1004 }, 1005 1006 trigger_loaded: function(container) 1007 { 1008 var _self = this; 1009 1010 if(_self.options.trigger_single !== false) 1011 { 1012 _self.win.trigger('avia_images_loaded_single', [container]); 1013 _self.options.single_callback.call(container); 1014 } 1015 1016 if(_self.preload_images === 0) 1017 { 1018 _self.win.trigger('avia_images_loaded'); 1019 _self.options.global_callback.call(); 1020 } 1021 1022 } 1023 }; 1024 1025 /************************************************************************ 1026 CSS Easing transformation table 1027 *************************************************************************/ 1028 /* 1029 Easing transform table from jquery.animate-enhanced plugin 1030 http://github.com/benbarnett/jQuery-Animate-Enhanced 1031 */ 1032 $.avia_utilities.css_easings = { 1033 linear: 'linear', 1034 swing: 'ease-in-out', 1035 bounce: 'cubic-bezier(0.0, 0.35, .5, 1.3)', 1036 easeInQuad: 'cubic-bezier(0.550, 0.085, 0.680, 0.530)' , 1037 easeInCubic: 'cubic-bezier(0.550, 0.055, 0.675, 0.190)' , 1038 easeInQuart: 'cubic-bezier(0.895, 0.030, 0.685, 0.220)' , 1039 easeInQuint: 'cubic-bezier(0.755, 0.050, 0.855, 0.060)' , 1040 easeInSine: 'cubic-bezier(0.470, 0.000, 0.745, 0.715)' , 1041 easeInExpo: 'cubic-bezier(0.950, 0.050, 0.795, 0.035)' , 1042 easeInCirc: 'cubic-bezier(0.600, 0.040, 0.980, 0.335)' , 1043 easeInBack: 'cubic-bezier(0.600, -0.280, 0.735, 0.04)' , 1044 easeOutQuad: 'cubic-bezier(0.250, 0.460, 0.450, 0.940)' , 1045 easeOutCubic: 'cubic-bezier(0.215, 0.610, 0.355, 1.000)' , 1046 easeOutQuart: 'cubic-bezier(0.165, 0.840, 0.440, 1.000)' , 1047 easeOutQuint: 'cubic-bezier(0.230, 1.000, 0.320, 1.000)' , 1048 easeOutSine: 'cubic-bezier(0.390, 0.575, 0.565, 1.000)' , 1049 easeOutExpo: 'cubic-bezier(0.190, 1.000, 0.220, 1.000)' , 1050 easeOutCirc: 'cubic-bezier(0.075, 0.820, 0.165, 1.000)' , 1051 easeOutBack: 'cubic-bezier(0.175, 0.885, 0.320, 1.275)' , 1052 easeInOutQuad: 'cubic-bezier(0.455, 0.030, 0.515, 0.955)' , 1053 easeInOutCubic: 'cubic-bezier(0.645, 0.045, 0.355, 1.000)' , 1054 easeInOutQuart: 'cubic-bezier(0.770, 0.000, 0.175, 1.000)' , 1055 easeInOutQuint: 'cubic-bezier(0.860, 0.000, 0.070, 1.000)' , 1056 easeInOutSine: 'cubic-bezier(0.445, 0.050, 0.550, 0.950)' , 1057 easeInOutExpo: 'cubic-bezier(1.000, 0.000, 0.000, 1.000)' , 1058 easeInOutCirc: 'cubic-bezier(0.785, 0.135, 0.150, 0.860)' , 1059 easeInOutBack: 'cubic-bezier(0.680, -0.550, 0.265, 1.55)' , 1060 easeInOutBounce:'cubic-bezier(0.580, -0.365, 0.490, 1.365)', 1061 easeOutBounce: 'cubic-bezier(0.760, 0.085, 0.490, 1.365)' 1062 }; 1063 1064 /************************************************************************ 1065 check if a css feature is supported and save it to the supported array 1066 *************************************************************************/ 1067 $.avia_utilities.supported = {}; 1068 $.avia_utilities.supports = (function() 1069 { 1070 var div = document.createElement('div'), 1071 vendors = ['Khtml', 'Ms','Moz','Webkit']; // vendors = ['Khtml', 'Ms','Moz','Webkit','O']; 1072 1073 return function(prop, vendor_overwrite) 1074 { 1075 if ( div.style[prop] !== undefined ) { return ""; }
1076 if (vendor_overwrite !== undefined) { vendors = vendor_overwrite; } 1077 1078 prop = prop.replace(/^[a-z]/, function(val) 1079 { 1080 return val.toUpperCase(); 1081 }); 1082 1083 var len = vendors.length; 1084 while(len--) 1085 { 1086 if ( div.style[vendors[len] + prop] !== undefined ) 1087 { 1088 return "-" + vendors[len].toLowerCase() + "-"; 1089 } 1090 } 1091 1092 return false; 1093 }; 1094 1095 }()); 1096 1097 /************************************************************************ 1098 animation function 1099 *************************************************************************/ 1100 $.fn.avia_animate = function(prop, speed, easing, callback) 1101 { 1102 if(typeof speed === 'function') {callback = speed; speed = false; } 1103 if(typeof easing === 'function'){callback = easing; easing = false;} 1104 if(typeof speed === 'string'){easing = speed; speed = false;} 1105 1106 if(callback === undefined || callback === false){ callback = function(){}; } 1107 if(easing === undefined || easing === false) { easing = 'easeInQuad'; } 1108 if(speed === undefined || speed === false) { speed = 400; } 1109 1110 if($.avia_utilities.supported.transition === undefined) 1111 { 1112 $.avia_utilities.supported.transition = $.avia_utilities.supports('transition'); 1113 } 1114 1115 1116 1117 if($.avia_utilities.supported.transition !== false ) 1118 { 1119 var prefix = $.avia_utilities.supported.transition + 'transition', 1120 cssRule = {}, 1121 cssProp = {}, 1122 thisStyle = document.body.style, 1123 end = (thisStyle.WebkitTransition !== undefined) ? 'webkitTransitionEnd' : (thisStyle.OTransition !== undefined) ? 'oTransitionEnd' : 'transitionend'; 1124 1125 //translate easing into css easing 1126 easing = $.avia_utilities.css_easings[easing]; 1127 1128 //create css transformation rule 1129 cssRule[prefix] = 'all '+(speed/1000)+'s '+easing; 1130 //add namespace to the transition end trigger 1131 end = end + ".avia_animate"; 1132 1133 //since jquery 1.10 the items passed need to be {} and not [] so make sure they are converted properly 1134 for (var rule in prop) 1135 { 1136 if (prop.hasOwnProperty(rule)) { cssProp[rule] = prop[rule]; } 1137 } 1138 prop = cssProp; 1139 1140 1141 1142 this.each(function() 1143 { 1144 var element = $(this), css_difference = false, rule, current_css; 1145 1146 for (rule in prop) 1147 { 1148 if (prop.hasOwnProperty(rule)) 1149 { 1150 current_css = element.css(rule); 1151 1152 if(prop[rule] != current_css && prop[rule] != current_css.replace(/px|%/g,"")) 1153 { 1154 css_difference = true; 1155 break; 1156 } 1157 } 1158 } 1159 1160 if(css_difference) 1161 { 1162 //if no transform property is set set a 3d translate to enable hardware acceleration 1163 if(!($.avia_utilities.supported.transition+"transform" in prop)) 1164 { 1165 prop[$.avia_utilities.supported.transition+"transform"] = "translateZ(0)"; 1166 } 1167 1168 var endTriggered = false; 1169 1170 element.on(end, function(event) 1171 { 1172 if(event.target != event.currentTarget) return false; 1173 1174 if(endTriggered == true) return false; 1175 endTriggered = true; 1176 1177 cssRule[prefix] = "none"; 1178 1179 element.off(end); 1180 element.css(cssRule); 1181 setTimeout(function(){ callback.call(element); }); 1182 }); 1183 1184 1185 //desktop safari fallback if we are in another tab to trigger the end event 1186 setTimeout(function(){ 1187 if(!endTriggered && !avia_is_mobile && $('html').is('.avia-safari') ) { 1188 element.trigger(end); 1189 $.avia_utilities.log('Safari Fallback '+end+' trigger'); 1190 } 1191 }, speed + 100); 1192 1193 setTimeout(function(){ element.css(cssRule);},10); 1194 setTimeout(function(){ element.css(prop); },20); 1195 } 1196 else 1197 { 1198 setTimeout(function(){ callback.call(element); }); 1199 } 1200 1201 }); 1202 } 1203 else // if css animation is not available use default JS animation 1204 { 1205 this.animate(prop, speed, easing, callback); 1206 } 1207 1208 return this; 1209 }; 1210 1211})( jQuery ); 1212 1213 1214 1215// ------------------------------------------------------------------------------------------- 1216// keyboard controls 1217// ------------------------------------------------------------------------------------------- 1218 1219(function($) 1220{ 1221 "use strict"; 1222 1223 /************************************************************************ 1224 keyboard arrow nav 1225 *************************************************************************/ 1226 $.fn.avia_keyboard_controls = function(options_passed) 1227 { 1228 var defaults = 1229 { 1230 37: '.prev-slide', // prev 1231 39: '.next-slide' // next 1232 }, 1233 1234 methods = { 1235 1236 mousebind: function(slider) 1237 { 1238 slider.on('mouseenter', function(){ 1239 slider.mouseover = true; }) 1240 .on('mouseleave', function(){ 1241 slider.mouseover = false; } 1242 ); 1243 }, 1244 1245 keybind: function(slider) 1246 { 1247 $(document).on('keydown', function(e) 1248 { 1249 if(slider.mouseover && typeof slider.options[e.keyCode] !== 'undefined') 1250 { 1251 var item; 1252 1253 if(typeof slider.options[e.keyCode] === 'string') 1254 { 1255 item = slider.find(slider.options[e.keyCode]); 1256 } 1257 else 1258 { 1259 item = slider.options[e.keyCode]; 1260 } 1261 1262 if(item.length) 1263 { 1264 item.trigger('click', ['keypress']); 1265 return false;
1266 } 1267 } 1268 }); 1269 } 1270 }; 1271 1272 1273 return this.each(function() 1274 { 1275 var slider = $(this); 1276 slider.options = $.extend({}, defaults, options_passed); 1277 slider.mouseover = false; 1278 1279 methods.mousebind(slider); 1280 methods.keybind(slider); 1281 1282 }); 1283 }; 1284 1285 1286 /************************************************************************ 1287 swipe nav 1288 *************************************************************************/ 1289 $.fn.avia_swipe_trigger = function(passed_options) 1290 { 1291 var win = $(window), 1292 isMobile = $.avia_utilities.isMobile, 1293 defaults = 1294 { 1295 prev: '.prev-slide', 1296 next: '.next-slide', 1297 event: { 1298 prev: 'click', 1299 next: 'click' 1300 } 1301 }, 1302 1303 methods = { 1304 1305 activate_touch_control: function(slider) 1306 { 1307 var i, differenceX, differenceY; 1308 1309 slider.touchPos = {}; 1310 slider.hasMoved = false; 1311 1312 slider.on('touchstart', function(event) 1313 { 1314 slider.touchPos.X = event.originalEvent.touches[0].clientX; 1315 slider.touchPos.Y = event.originalEvent.touches[0].clientY; 1316 }); 1317 1318 slider.on('touchend', function(event) 1319 { 1320 slider.touchPos = {}; 1321 if(slider.hasMoved) { event.preventDefault(); } 1322 slider.hasMoved = false; 1323 }); 1324 1325 slider.on('touchmove', function(event) 1326 { 1327 if(!slider.touchPos.X) 1328 { 1329 slider.touchPos.X = event.originalEvent.touches[0].clientX; 1330 slider.touchPos.Y = event.originalEvent.touches[0].clientY; 1331 } 1332 else 1333 { 1334 differenceX = event.originalEvent.touches[0].clientX - slider.touchPos.X; 1335 differenceY = event.originalEvent.touches[0].clientY - slider.touchPos.Y; 1336 1337 //check if user is scrolling the window or moving the slider 1338 if(Math.abs(differenceX) > Math.abs(differenceY)) 1339 { 1340 event.preventDefault(); 1341 1342 if(slider.touchPos !== event.originalEvent.touches[0].clientX) 1343 { 1344 if(Math.abs(differenceX) > 50) 1345 { 1346 i = differenceX > 0 ? 'prev' : 'next'; 1347 1348 if(typeof slider.options[i] === 'string') 1349 { 1350 slider.find(slider.options[i]).trigger(slider.options.event[i], ['swipe']); 1351 } 1352 else 1353 { 1354 slider.options[i].trigger(slider.options.event[i], ['swipe']); 1355 } 1356 1357 slider.hasMoved = true; 1358 slider.touchPos = {}; 1359 return false; 1360 } 1361 } 1362 } 1363 } 1364 }); 1365 } 1366 }; 1367 1368 return this.each(function() 1369 { 1370 if(isMobile) 1371 { 1372 var slider = $(this); 1373 1374 slider.options = $.extend({}, defaults, passed_options); 1375 1376 methods.activate_touch_control(slider); 1377 } 1378 }); 1379 }; 1380 1381}(jQuery)); 1382 1383 1384 1385
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.