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 subtract = $('#wpadminbar, #header.av_header_top:not(.html_header_transparency #header), #main>.title_container'), 462 css_block = $("<style type='text/css' id='av-browser-height'></style>").appendTo('head:first'), 463 sidebar_menu= $('.html_header_sidebar #top #header_main'), 464 full_slider = $('.html_header_sidebar .avia-fullscreen-slider.avia-builder-el-0.avia-builder-el-no-sibling').addClass('av-solo-full'), 465 pc_heights = [ 25, 50, 75 ], 466 calc_height = function() 467 { 468 var css = "", 469 wh100 = win.height(), 470 ww100 = win.width(), 471 wh100_mod = wh100, 472 whCover = (wh100 / 9) * 16, 473 wwCover = (ww100 / 16) * 9, 474 solo = 0, 475 whCustom = []; 476 477 if(sidebar_menu.length) solo = sidebar_menu.height(); 478 479 subtract.each(function(){ wh100_mod -= this.offsetHeight - 1; }); 480 481 var whCoverMod = (wh100_mod / 9) * 16; 482 483 //fade in of section content with minimum height once the height has been calculated 484 css += ".avia-section.av-minimum-height .container{opacity: 1; }\n"; 485 486 //various section heights (100-25% as well as 100% - header/adminbar in case its the first builder element) 487 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"; 488 489 $.each( pc_heights, function( index, value ) { 490 var wh = Math.round( wh100 * ( value / 100.0 ) ); 491 css += ".av-minimum-height-" + value + " .container, .av-cell-min-height-" + value + " > .flex_cell {height:" + wh + "px;}\n"; 492 }); 493 494 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"; 495 496 css += "#top .av-solo-full .avia-slideshow {min-height:"+solo+"px;}\n"; 497 498 //fullscreen video calculations 499 if(ww100/wh100 < 16/9) 500 { 501 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"; 502 } 503 else 504 { 505 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"; 506 } 507 508 if(ww100/wh100_mod < 16/9) 509 { 510 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"; 511 } 512 else 513 {
514 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"; 515 } 516 517 //ie8 needs different insert method 518 try{ 519 css_block.text(css); 520 } 521 catch(err){ 522 css_block.remove(); 523 css_block = $("<style type='text/css' id='av-browser-height'>"+css+"</style>").appendTo('head:first'); 524 } 525 526 527 setTimeout(function(){ win.trigger('av-height-change'); /*broadcast the height change*/ },100); 528 }; 529 530 this.each( function( index ) { 531 var height = $(this).data('av_minimum_height_pc'); 532 if( 'number' != typeof height ) 533 { 534 return this; 535 } 536 537 height = parseInt( height ); 538 539 if( ! pc_heights.includes( height ) && ( height != 100 ) ) 540 { 541 pc_heights.push( height ); 542 } 543 544 return this; 545 }); 546 547 win.on( 'debouncedresize', calc_height ); 548 calc_height(); 549}; 550 551// ------------------------------------------------------------------------------------------- 552// Video Section helper 553// ------------------------------------------------------------------------------------------- 554 555$.fn.avia_video_section = function() 556{ 557 if(!this.length) return; 558 559 var elements = this.length, content = "", 560 win = $(window), 561 css_block = $("<style type='text/css' id='av-section-height'></style>").appendTo('head:first'), 562 calc_height = function(section, counter) 563 { 564 if(counter === 0) { content = "";} 565 566 var css = "", 567 the_id = '#' +section.attr('id'), 568 wh100 = section.height(), 569 ww100 = section.width(), 570 aspect = section.data('sectionVideoRatio').split(':'), 571 video_w = aspect[0], 572 video_h = aspect[1], 573 whCover = (wh100 / video_h ) * video_w, 574 wwCover = (ww100 / video_w ) * video_h; 575 576 //fullscreen video calculations 577 if(ww100/wh100 < video_w/video_h) 578 { 579 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"; 580 } 581 else 582 { 583 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"; 584 } 585 586 content = content + css; 587 588 if(elements == counter + 1) 589 { 590 //ie8 needs different insert method 591 try{ 592 css_block.text(content); 593 } 594 catch(err){ 595 css_block.remove(); 596 css_block = $("<style type='text/css' id='av-section-height'>"+content+"</style>").appendTo('head:first'); 597 } 598 } 599 }; 600 601 602 return this.each(function(i) 603 { 604 var self = $(this); 605 606 win.on( 'debouncedresize', function(){ calc_height(self, i); }); 607 calc_height(self, i); 608 }); 609 610}; 611 612 613/** 614 * Column or cell with a link 615 * 616 * @returns {jQuery} 617 */ 618$.fn.avia_link_column = function() 619{ 620 return this.each( function() 621 { 622 $(this).on( 'click', function(e){ 623 624 // if event is bubbled from an <a> link, do not activate link of column/cell 625 if( 'undefined' !== typeof e.target && 'undefined' !== typeof e.target.href ) 626 { 627 return; 628 } 629 630 var column = $(this), 631 url = column.data('link-column-url'), 632 target = column.data('link-column-target'), 633 link = window.location.hostname+window.location.pathname; 634 635 if( 'undefined' === typeof url || 'string' !== typeof url ) 636 { 637 return; 638 } 639 640 if( 'undefined' !== typeof target || '_blank' == target ) 641 { 642 window.open( url, '_blank' ); 643 } 644 else 645 { 646 // allow smoothscroll feature when on same page and hash exists - trigger only works for current page 647 if( column.hasClass('av-cell-link') || column.hasClass('av-column-link') ) 648 { 649 var reader = column.hasClass('av-cell-link') ? column.prev('a.av-screen-reader-only').first() : column.find('a.av-screen-reader-only').first(); 650 url = url.trim(); 651 if( (0 == url.indexOf("#")) || ((url.indexOf(link) >= 0) && (url.indexOf("#") > 0) ) ) 652 { 653 reader.trigger('click'); 654 return; 655 } 656 } 657 658 window.location.href = url; 659 } 660 661 e.preventDefault(); 662 return; 663 }); 664 665 }); 666}; 667 668 669// ------------------------------------------------------------------------------------------- 670// HELPER FUNCTIONS 671// ------------------------------------------------------------------------------------------- 672 673 674//waipoint script when something comes into viewport 675 $.fn.avia_waypoints = function(options_passed) 676 { 677 if(! $('html').is('.avia_transform')) return; 678 679 var defaults = { offset: 'bottom-in-view' , triggerOnce: true}, 680 options = $.extend({}, defaults, options_passed), 681 isMobile = $.avia_utilities.isMobile; 682 683 return this.each(function() 684 { 685 var element = $(this); 686 687 setTimeout(function() 688 { 689 if(isMobile) 690 { 691 element.addClass('avia_start_animation').trigger('avia_start_animation'); 692 } 693 else 694 { 695 element.waypoint(function(direction) 696 { 697 var current = $(this.element), 698 parent = current.parents('.av-animation-delay-container:eq(0)'); 699 700 if(parent.length) 701 { 702 current.addClass('avia_start_animation_when_active').trigger('avia_start_animation_when_active'); 703 } 704 705 if(!parent.length || (parent.length && parent.is('.__av_init_open'))) 706 { 707 current.addClass('avia_start_animation').trigger('avia_start_animation'); 708 } 709 710 711 712 }, options ); 713 } 714 },100); 715 716 }); 717 }; 718 719 720 721 722 723 724 725// window resize script 726var $event = $.event, $special, resizeTimeout; 727 728$special = $event.special.debouncedresize = { 729 setup: function() { 730 $( this ).on( "resize", $special.handler ); 731 }, 732 teardown: function() { 733 $( this ).off( "resize", $special.handler ); 734 }, 735 handler: function( event, execAsap ) { 736 // Save the context 737 var context = this, 738 args = arguments, 739 dispatch = function() { 740 // set correct event type 741 event.type = "debouncedresize"; 742 $event.dispatch.apply( context, args ); 743 }; 744 745 if ( resizeTimeout ) { 746 clearTimeout( resizeTimeout ); 747 } 748 749 execAsap ? 750 dispatch() : 751 resizeTimeout = setTimeout( dispatch, $special.threshold ); 752 }, 753 threshold: 150 754}; 755 756 757 758 759 760$.easing['jswing'] = $.easing['swing']; 761 762$.extend( $.easing, 763{ 764 def: 'easeOutQuad', 765 swing: function (x, t, b, c, d) { return $.easing[$.easing.def](x, t, b, c, d); }, 766 easeInQuad: function (x, t, b, c, d) { return c*(t/=d)*t + b; }, 767 easeOutQuad: function (x, t, b, c, d) { return -c *(t/=d)*(t-2) + b; }, 768 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; },
vendor: 4,549 bytes, lines 769-874
769 easeInCubic: function (x, t, b, c, d) { return c*(t/=d)*t*t + b; }, 770 easeOutCubic: function (x, t, b, c, d) { return c*((t=t/d-1)*t*t + 1) + b; }, 771 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; }, 772 easeInQuart: function (x, t, b, c, d) { return c*(t/=d)*t*t*t + b; }, 773 easeOutQuart: function (x, t, b, c, d) { return -c * ((t=t/d-1)*t*t*t - 1) + b; }, 774 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; }, 775 easeInQuint: function (x, t, b, c, d) { return c*(t/=d)*t*t*t*t + b; }, 776 easeOutQuint: function (x, t, b, c, d) { return c*((t=t/d-1)*t*t*t*t + 1) + b; }, 777 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; }, 778 easeInSine: function (x, t, b, c, d) { return -c * Math.cos(t/d * (Math.PI/2)) + c + b; }, 779 easeOutSine: function (x, t, b, c, d) { return c * Math.sin(t/d * (Math.PI/2)) + b; }, 780 easeInOutSine: function (x, t, b, c, d) { return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b; }, 781 easeInExpo: function (x, t, b, c, d) { return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b; }, 782 easeOutExpo: function (x, t, b, c, d) { return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b; }, 783 easeInOutExpo: function (x, t, b, c, d) { 784 if (t==0) return b; 785 if (t==d) return b+c; 786 if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b; 787 return c/2 * (-Math.pow(2, -10 * --t) + 2) + b; 788 }, 789 easeInCirc: function (x, t, b, c, d) { return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b; }, 790 easeOutCirc: function (x, t, b, c, d) {return c * Math.sqrt(1 - (t=t/d-1)*t) + b; }, 791 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; }, 792 easeInElastic: function (x, t, b, c, d) { 793 var s=1.70158;var p=0;var a=c; 794 if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3; 795 if (a < Math.abs(c)) { a=c; var s=p/4; } 796 else var s = p/(2*Math.PI) * Math.asin (c/a); 797 return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b; 798 }, 799 easeOutElastic: function (x, t, b, c, d) { 800 var s=1.70158;var p=0;var a=c; 801 if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3; 802 if (a < Math.abs(c)) { a=c; var s=p/4; } 803 else var s = p/(2*Math.PI) * Math.asin (c/a); 804 return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b; 805 }, 806 easeInOutElastic: function (x, t, b, c, d) { 807 var s=1.70158;var p=0;var a=c; 808 if (t==0) return b; if ((t/=d/2)==2) return b+c; if (!p) p=d*(.3*1.5); 809 if (a < Math.abs(c)) { a=c; var s=p/4; } 810 else var s = p/(2*Math.PI) * Math.asin (c/a); 811 if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b; 812 return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b; 813 }, 814 easeInBack: function (x, t, b, c, d, s) { 815 if (s == undefined) s = 1.70158; 816 return c*(t/=d)*t*((s+1)*t - s) + b; 817 }, 818 easeOutBack: function (x, t, b, c, d, s) { 819 if (s == undefined) s = 1.70158; 820 return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b; 821 }, 822 easeInOutBack: function (x, t, b, c, d, s) { 823 if (s == undefined) s = 1.70158; 824 if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b; 825 return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b; 826 }, 827 easeInBounce: function (x, t, b, c, d) { 828 return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b; 829 }, 830 easeOutBounce: function (x, t, b, c, d) { 831 if ((t/=d) < (1/2.75)) { 832 return c*(7.5625*t*t) + b; 833 } else if (t < (2/2.75)) { 834 return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b; 835 } else if (t < (2.5/2.75)) { 836 return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b; 837 } else { 838 return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b; 839 } 840 }, 841 easeInOutBounce: function (x, t, b, c, d) { 842 if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b; 843 return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b; 844 } 845}); 846 847})( jQuery ); 848 849 850 851/*utility functions*/ 852 853 854(function($) 855{ 856 "use strict"; 857 858 $.avia_utilities = $.avia_utilities || {}; 859 860 /************************************************************************ 861 gloabl loading function 862 *************************************************************************/ 863 $.avia_utilities.loading = function(attach_to, delay){ 864 865 var loader = { 866 867 active: false, 868 869 show: function() 870 { 871 if(loader.active === false) 872 { 873 loader.active = true; 874 loader.loading_item.css({display:'block', opacity:0}
874); 875 } 876 877 loader.loading_item.stop().animate({opacity:1}); 878 }, 879 880 hide: function() 881 { 882 if(typeof delay === 'undefined'){ delay = 600; } 883 884 loader.loading_item.stop().delay( delay ).animate({opacity:0}, function() 885 { 886 loader.loading_item.css({display:'none'}); 887 loader.active = false; 888 }); 889 }, 890 891 attach: function() 892 { 893 if(typeof attach_to === 'undefined'){ attach_to = 'body';} 894 895 loader.loading_item = $('<div class="avia_loading_icon"><div class="av-siteloader"></div></div>').css({display:"none"}).appendTo(attach_to); 896 } 897 }; 898 899 loader.attach(); 900 return loader; 901 }; 902 903 /************************************************************************ 904 gloabl play/pause visualizer function 905 *************************************************************************/ 906 $.avia_utilities.playpause = function(attach_to, delay){ 907 908 var pp = { 909 910 active: false, 911 to1: "", 912 to2: "", 913 set: function(status) 914 { 915 pp.loading_item.removeClass('av-play av-pause'); 916 pp.to1 = setTimeout(function(){ pp.loading_item.addClass('av-' + status); },10); 917 pp.to2 = setTimeout(function(){ pp.loading_item.removeClass('av-' + status); },1500); 918 }, 919 920 attach: function() 921 { 922 if(typeof attach_to === 'undefined'){ attach_to = 'body';} 923 924 pp.loading_item = $('<div class="avia_playpause_icon"></div>').css({display:"none"}).appendTo(attach_to); 925 } 926 }; 927 928 pp.attach(); 929 return pp; 930 }; 931 932 933 934 /************************************************************************ 935 preload images, as soon as all are loaded trigger a special load ready event 936 *************************************************************************/ 937 $.avia_utilities.preload = function(options_passed) 938 { 939 new $.AviaPreloader(options_passed); 940 }; 941 942 $.AviaPreloader = function(options) 943 { 944 this.win = $(window); 945 this.defaults = 946 { 947 container: 'body', 948 maxLoops: 10, 949 trigger_single: true, 950 single_callback: function(){}, 951 global_callback: function(){} 952 953 }; 954 this.options = $.extend({}, this.defaults, options); 955 this.preload_images = 0; 956 957 this.load_images(); 958 }; 959 960 $.AviaPreloader.prototype = 961 { 962 load_images: function() 963 { 964 var _self = this; 965 966 if(typeof _self.options.container === 'string'){ _self.options.container = $(_self.options.container); } 967 968 _self.options.container.each(function() 969 { 970 var container = $(this); 971 972 container.images = container.find('img'); 973 container.allImages = container.images; 974 975 _self.preload_images += container.images.length; 976 setTimeout(function(){ _self.checkImage(container); }, 10); 977 }); 978 }, 979 980 checkImage: function(container) 981 { 982 var _self = this; 983 984 container.images.each(function() 985 { 986 if(this.complete === true) 987 { 988 container.images = container.images.not(this); 989 _self.preload_images -= 1; 990 } 991 }); 992 993 if(container.images.length && _self.options.maxLoops >= 0) 994 { 995 _self.options.maxLoops-=1; 996 setTimeout(function(){ _self.checkImage(container); }, 500); 997 } 998 else 999 { 1000 _self.preload_images = _self.preload_images - container.images.length; 1001 _self.trigger_loaded(container); 1002 } 1003 }, 1004 1005 trigger_loaded: function(container) 1006 { 1007 var _self = this; 1008 1009 if(_self.options.trigger_single !== false) 1010 { 1011 _self.win.trigger('avia_images_loaded_single', [container]); 1012 _self.options.single_callback.call(container); 1013 } 1014 1015 if(_self.preload_images === 0) 1016 { 1017 _self.win.trigger('avia_images_loaded'); 1018 _self.options.global_callback.call(); 1019 } 1020 1021 } 1022 }; 1023 1024 /************************************************************************ 1025 CSS Easing transformation table 1026 *************************************************************************/ 1027 /* 1028 Easing transform table from jquery.animate-enhanced plugin 1029 http://github.com/benbarnett/jQuery-Animate-Enhanced 1030 */ 1031 $.avia_utilities.css_easings = { 1032 linear: 'linear', 1033 swing: 'ease-in-out', 1034 bounce: 'cubic-bezier(0.0, 0.35, .5, 1.3)', 1035 easeInQuad: 'cubic-bezier(0.550, 0.085, 0.680, 0.530)' , 1036 easeInCubic: 'cubic-bezier(0.550, 0.055, 0.675, 0.190)' , 1037 easeInQuart: 'cubic-bezier(0.895, 0.030, 0.685, 0.220)' , 1038 easeInQuint: 'cubic-bezier(0.755, 0.050, 0.855, 0.060)' , 1039 easeInSine: 'cubic-bezier(0.470, 0.000, 0.745, 0.715)' , 1040 easeInExpo: 'cubic-bezier(0.950, 0.050, 0.795, 0.035)' , 1041 easeInCirc: 'cubic-bezier(0.600, 0.040, 0.980, 0.335)' , 1042 easeInBack: 'cubic-bezier(0.600, -0.280, 0.735, 0.04)' , 1043 easeOutQuad: 'cubic-bezier(0.250, 0.460, 0.450, 0.940)' , 1044 easeOutCubic: 'cubic-bezier(0.215, 0.610, 0.355, 1.000)' , 1045 easeOutQuart: 'cubic-bezier(0.165, 0.840, 0.440, 1.000)' , 1046 easeOutQuint: 'cubic-bezier(0.230, 1.000, 0.320, 1.000)' , 1047 easeOutSine: 'cubic-bezier(0.390, 0.575, 0.565, 1.000)' , 1048 easeOutExpo: 'cubic-bezier(0.190, 1.000, 0.220, 1.000)' , 1049 easeOutCirc: 'cubic-bezier(0.075, 0.820, 0.165, 1.000)' , 1050 easeOutBack: 'cubic-bezier(0.175, 0.885, 0.320, 1.275)' , 1051 easeInOutQuad: 'cubic-bezier(0.455, 0.030, 0.515, 0.955)' , 1052 easeInOutCubic: 'cubic-bezier(0.645, 0.045, 0.355, 1.000)' , 1053 easeInOutQuart: 'cubic-bezier(0.770, 0.000, 0.175, 1.000)' , 1054 easeInOutQuint: 'cubic-bezier(0.860, 0.000, 0.070, 1.000)' , 1055 easeInOutSine: 'cubic-bezier(0.445, 0.050, 0.550, 0.950)' , 1056 easeInOutExpo: 'cubic-bezier(1.000, 0.000, 0.000, 1.000)' , 1057 easeInOutCirc: 'cubic-bezier(0.785, 0.135, 0.150, 0.860)' , 1058 easeInOutBack: 'cubic-bezier(0.680, -0.550, 0.265, 1.55)' , 1059 easeInOutBounce:'cubic-bezier(0.580, -0.365, 0.490, 1.365)', 1060 easeOutBounce: 'cubic-bezier(0.760, 0.085, 0.490, 1.365)' 1061 }; 1062 1063 /************************************************************************ 1064 check if a css feature is supported and save it to the supported array 1065 *************************************************************************/ 1066 $.avia_utilities.supported = {}; 1067 $.avia_utilities.supports = (function() 1068 { 1069 var div = document.createElement('div'), 1070 vendors = ['Khtml', 'Ms','Moz','Webkit']; // vendors = ['Khtml', 'Ms','Moz','Webkit','O']; 1071 1072 return function(prop, vendor_overwrite) 1073 { 1074 if ( div.style[prop] !== undefined ) { return ""; }
1075 if (vendor_overwrite !== undefined) { vendors = vendor_overwrite; } 1076 1077 prop = prop.replace(/^[a-z]/, function(val) 1078 { 1079 return val.toUpperCase(); 1080 }); 1081 1082 var len = vendors.length; 1083 while(len--) 1084 { 1085 if ( div.style[vendors[len] + prop] !== undefined ) 1086 { 1087 return "-" + vendors[len].toLowerCase() + "-"; 1088 } 1089 } 1090 1091 return false; 1092 }; 1093 1094 }()); 1095 1096 /************************************************************************ 1097 animation function 1098 *************************************************************************/ 1099 $.fn.avia_animate = function(prop, speed, easing, callback) 1100 { 1101 if(typeof speed === 'function') {callback = speed; speed = false; } 1102 if(typeof easing === 'function'){callback = easing; easing = false;} 1103 if(typeof speed === 'string'){easing = speed; speed = false;} 1104 1105 if(callback === undefined || callback === false){ callback = function(){}; } 1106 if(easing === undefined || easing === false) { easing = 'easeInQuad'; } 1107 if(speed === undefined || speed === false) { speed = 400; } 1108 1109 if($.avia_utilities.supported.transition === undefined) 1110 { 1111 $.avia_utilities.supported.transition = $.avia_utilities.supports('transition'); 1112 } 1113 1114 1115 1116 if($.avia_utilities.supported.transition !== false ) 1117 { 1118 var prefix = $.avia_utilities.supported.transition + 'transition', 1119 cssRule = {}, 1120 cssProp = {}, 1121 thisStyle = document.body.style, 1122 end = (thisStyle.WebkitTransition !== undefined) ? 'webkitTransitionEnd' : (thisStyle.OTransition !== undefined) ? 'oTransitionEnd' : 'transitionend'; 1123 1124 //translate easing into css easing 1125 easing = $.avia_utilities.css_easings[easing]; 1126 1127 //create css transformation rule 1128 cssRule[prefix] = 'all '+(speed/1000)+'s '+easing; 1129 //add namespace to the transition end trigger 1130 end = end + ".avia_animate"; 1131 1132 //since jquery 1.10 the items passed need to be {} and not [] so make sure they are converted properly 1133 for (var rule in prop) 1134 { 1135 if (prop.hasOwnProperty(rule)) { cssProp[rule] = prop[rule]; } 1136 } 1137 prop = cssProp; 1138 1139 1140 1141 this.each(function() 1142 { 1143 var element = $(this), css_difference = false, rule, current_css; 1144 1145 for (rule in prop) 1146 { 1147 if (prop.hasOwnProperty(rule)) 1148 { 1149 current_css = element.css(rule); 1150 1151 if(prop[rule] != current_css && prop[rule] != current_css.replace(/px|%/g,"")) 1152 { 1153 css_difference = true; 1154 break; 1155 } 1156 } 1157 } 1158 1159 if(css_difference) 1160 { 1161 //if no transform property is set set a 3d translate to enable hardware acceleration 1162 if(!($.avia_utilities.supported.transition+"transform" in prop)) 1163 { 1164 prop[$.avia_utilities.supported.transition+"transform"] = "translateZ(0)"; 1165 } 1166 1167 var endTriggered = false; 1168 1169 element.on(end, function(event) 1170 { 1171 if(event.target != event.currentTarget) return false; 1172 1173 if(endTriggered == true) return false; 1174 endTriggered = true; 1175 1176 cssRule[prefix] = "none"; 1177 1178 element.off(end); 1179 element.css(cssRule); 1180 setTimeout(function(){ callback.call(element); }); 1181 }); 1182 1183 1184 //desktop safari fallback if we are in another tab to trigger the end event 1185 setTimeout(function(){ 1186 if(!endTriggered && !avia_is_mobile && $('html').is('.avia-safari') ) { 1187 element.trigger(end); 1188 $.avia_utilities.log('Safari Fallback '+end+' trigger'); 1189 } 1190 }, speed + 100); 1191 1192 setTimeout(function(){ element.css(cssRule);},10); 1193 setTimeout(function(){ element.css(prop); },20); 1194 } 1195 else 1196 { 1197 setTimeout(function(){ callback.call(element); }); 1198 } 1199 1200 }); 1201 } 1202 else // if css animation is not available use default JS animation 1203 { 1204 this.animate(prop, speed, easing, callback); 1205 } 1206 1207 return this; 1208 }; 1209 1210})( jQuery ); 1211 1212 1213 1214// ------------------------------------------------------------------------------------------- 1215// keyboard controls 1216// ------------------------------------------------------------------------------------------- 1217 1218(function($) 1219{ 1220 "use strict"; 1221 1222 /************************************************************************ 1223 keyboard arrow nav 1224 *************************************************************************/ 1225 $.fn.avia_keyboard_controls = function(options_passed) 1226 { 1227 var defaults = 1228 { 1229 37: '.prev-slide', // prev 1230 39: '.next-slide' // next 1231 }, 1232 1233 methods = { 1234 1235 mousebind: function(slider) 1236 { 1237 slider.hover( 1238 function(){ slider.mouseover = true; }, 1239 function(){ slider.mouseover = false; } 1240 ); 1241 }, 1242 1243 keybind: function(slider) 1244 { 1245 $(document).keydown(function(e) 1246 { 1247 if(slider.mouseover && typeof slider.options[e.keyCode] !== 'undefined') 1248 { 1249 var item; 1250 1251 if(typeof slider.options[e.keyCode] === 'string') 1252 { 1253 item = slider.find(slider.options[e.keyCode]); 1254 } 1255 else 1256 { 1257 item = slider.options[e.keyCode]; 1258 } 1259 1260 if(item.length) 1261 { 1262 item.trigger('click', ['keypress']); 1263 return false;
1264 } 1265 } 1266 }); 1267 } 1268 }; 1269 1270 1271 return this.each(function() 1272 { 1273 var slider = $(this); 1274 slider.options = $.extend({}, defaults, options_passed); 1275 slider.mouseover = false; 1276 1277 methods.mousebind(slider); 1278 methods.keybind(slider); 1279 1280 }); 1281 }; 1282 1283 1284 /************************************************************************ 1285 swipe nav 1286 *************************************************************************/ 1287 $.fn.avia_swipe_trigger = function(passed_options) 1288 { 1289 var win = $(window), 1290 isMobile = $.avia_utilities.isMobile, 1291 defaults = 1292 { 1293 prev: '.prev-slide', 1294 next: '.next-slide', 1295 event: { 1296 prev: 'click', 1297 next: 'click' 1298 } 1299 }, 1300 1301 methods = { 1302 1303 activate_touch_control: function(slider) 1304 { 1305 var i, differenceX, differenceY; 1306 1307 slider.touchPos = {}; 1308 slider.hasMoved = false; 1309 1310 slider.on('touchstart', function(event) 1311 { 1312 slider.touchPos.X = event.originalEvent.touches[0].clientX; 1313 slider.touchPos.Y = event.originalEvent.touches[0].clientY; 1314 }); 1315 1316 slider.on('touchend', function(event) 1317 { 1318 slider.touchPos = {}; 1319 if(slider.hasMoved) { event.preventDefault(); } 1320 slider.hasMoved = false; 1321 }); 1322 1323 slider.on('touchmove', function(event) 1324 { 1325 if(!slider.touchPos.X) 1326 { 1327 slider.touchPos.X = event.originalEvent.touches[0].clientX; 1328 slider.touchPos.Y = event.originalEvent.touches[0].clientY; 1329 } 1330 else 1331 { 1332 differenceX = event.originalEvent.touches[0].clientX - slider.touchPos.X; 1333 differenceY = event.originalEvent.touches[0].clientY - slider.touchPos.Y; 1334 1335 //check if user is scrolling the window or moving the slider 1336 if(Math.abs(differenceX) > Math.abs(differenceY)) 1337 { 1338 event.preventDefault(); 1339 1340 if(slider.touchPos !== event.originalEvent.touches[0].clientX) 1341 { 1342 if(Math.abs(differenceX) > 50) 1343 { 1344 i = differenceX > 0 ? 'prev' : 'next'; 1345 1346 if(typeof slider.options[i] === 'string') 1347 { 1348 slider.find(slider.options[i]).trigger(slider.options.event[i], ['swipe']); 1349 } 1350 else 1351 { 1352 slider.options[i].trigger(slider.options.event[i], ['swipe']); 1353 } 1354 1355 slider.hasMoved = true; 1356 slider.touchPos = {}; 1357 return false; 1358 } 1359 } 1360 } 1361 } 1362 }); 1363 } 1364 }; 1365 1366 return this.each(function() 1367 { 1368 if(isMobile) 1369 { 1370 var slider = $(this); 1371 1372 slider.options = $.extend({}, defaults, passed_options); 1373 1374 methods.activate_touch_control(slider); 1375 } 1376 }); 1377 }; 1378 1379}(jQuery)); 1380 1381 1382 1383
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.