Guest User

Untitled

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