1/** 2 * Polyfill for older browsers https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray 3 * 4 * @since 4.8 5 * @return boolean 6 */ 7if ( ! Array.isArray ) 8{ 9 Array.isArray = function( arg ) 10 { 11 return Object.prototype.toString.call( arg ) === '[object Array]'; 12 }; 13} 14 15/** 16 * hack to catch and reroute jQuery custom events (default browser events seem to work even when triggered with jQuery) 17 * As events with '-' cannot be monotored with on.... we rename them to avoid possible conflicts 18 * 19 * https://stackoverflow.com/questions/11132553/how-to-catch-the-jquery-event-trigger 20 * https://stackoverflow.com/questions/36914912/how-to-get-jquery-to-trigger-a-native-custom-event-handler 21 * https://stackoverflow.com/questions/40915156/listen-for-jquery-event-with-vanilla-js 22 * 23 * @since 5.6 24 */ 25(function($) 26{ 27 "use strict"; 28 29 const opt = { 30 'bubbles': true, 31 'cancelable': true 32 }; 33 34 // event is always bound to window 35 $( window ).on( 'av-height-change', function( e ) 36 { 37 const event = new CustomEvent( 'avia_height_change', opt ); 38 window.dispatchEvent( event ); 39 }); 40 41 // event is always bound to window 42 $( 'body' ).on( 'av_resize_finished', function( e ) 43 { 44 const event = new CustomEvent( 'avia_resize_finished', opt ); 45 document.body.dispatchEvent( event ); 46 }); 47 48})( jQuery ); 49 50 51(function($) 52{ 53 "use strict"; 54 55 $( function() 56 { 57 $.avia_utilities = $.avia_utilities || {}; 58 59 AviaBrowserDetection( 'html' ); 60 AviaDeviceDetection( 'html' ); 61 62 //show scroll top but1ton 63 avia_scroll_top_fade(); 64 65 //calculate width of content 66 aviaCalcContentWidth(); 67 68 //creates search tooltip 69 new $.AviaTooltip({ 70 "class": 'avia-search-tooltip', 71 data: 'avia-search-tooltip', 72 event: 'click', 73 position: 'bottom', 74 scope: "body", 75 attach: 'element', 76 within_screen: true, 77 close_keys: 27 78 }); 79 80 //creates relate posts tooltip 81 new $.AviaTooltip({ 82 "class": 'avia-related-tooltip', 83 data: 'avia-related-tooltip', 84 scope: ".related_posts, .av-share-box", 85 attach: 'element', 86 delay: 0 87 }); 88 89 //creates ajax search 90 new $.AviaAjaxSearch({scope:'#header, .avia_search_element'}); 91 92 // actiavte portfolio sorting 93 if( $.fn.avia_iso_sort ) 94 { 95 $('.grid-sort-container').avia_iso_sort(); 96 } 97 98 // Checks height of content and sidebar and applies shadow class to the higher one 99 AviaSidebarShadowHelper(); 100 101 $.avia_utilities.avia_ajax_call(); 102 103 // Add single post/portfolio swipe support (in BETA since 5.5) 104 $.avia_utilities.postSwipeSupport(); 105 }); 106 107 $.avia_utilities = $.avia_utilities || {}; 108 109 110 $.avia_utilities.postSwipeSupport = function() 111 { 112 if( ! $.fn.avia_swipe_trigger ) 113 { 114 return; 115 } 116 117 const body = document.getElementsByTagName( 'body' ), 118 methods = {}; 119 120 methods.beforeTrigger = function( slider, direction ) 121 { 122 const loader = $.avia_utilities.loading(); 123 loader.show(); 124 }; 125 126 methods.afterTrigger = function( slider, direction ) 127 { 128 let body = document.getElementsByTagName( 'body' ); 129 if( ! body.length ) 130 { 131 return; 132 } 133 134 let dir = direction == 'prev' ? 'swiped-ltr' : 'swiped-rtl'; 135 body[0].classList.add( 'av-post-swiped-overlay', dir ); 136 }; 137 138 if( ! body.length || ! body[0].classList.contains( 'avia-post-nav-swipe-enabled' ) ) 139 { 140 return; 141 } 142 143 /** 144 * Add swipe to posts and portfolio 145 * 146 * @since 5.5 147 */ 148 let single = document.querySelector( '.single #main' ); 149 if( single == null ) 150 { 151 return; 152 } 153 154 let prev = document.querySelector( '#wrap_all .avia-post-nav.avia-post-prev' ), 155 next = document.querySelector( '#wrap_all .avia-post-nav.avia-post-next' ), 156 param = { 157 prev: prev, 158 next: next, 159 delay_trigger: true, 160 event: { 161 prev: 'native_click', 162 next: 'native_click' 163 }, 164 beforeTrigger: methods.beforeTrigger, 165 afterTrigger: methods.afterTrigger 166 }; 167 168 $( single ).avia_swipe_trigger( param ); 169 }; 170 171 $.avia_utilities.avia_ajax_call = function(container) 172 { 173 if( typeof container == 'undefined' ) 174 { 175 container = 'body'; 176 }; 177 178 $('a.avianolink').on('click', function(e){ e.preventDefault(); }); 179 $('a.aviablank').attr('target', '_blank'); 180 181 //activates the prettyphoto lightbox 182 if($.fn.avia_activate_lightbox) 183 { 184 $(container).avia_activate_lightbox(); 185 } 186 187 //scrollspy for main menu. must be located before smoothscrolling 188 if( $.fn.avia_scrollspy ) 189 { 190 if(container == 'body') 191 { 192 $('body').avia_scrollspy({target:'.main_menu .menu li > a'}); 193 } 194 else 195 {
196 $('body').avia_scrollspy('refresh'); 197 } 198 } 199 200 201 202 //smooth scrooling 203 if( $.fn.avia_smoothscroll ) 204 { 205 $('a[href*="#"]', container).avia_smoothscroll(container); 206 } 207 208 avia_small_fixes(container); 209 210 avia_hover_effect(container); 211 212 avia_iframe_fix(container); 213 214 //activate html5 video player 215 if( $.fn.avia_html5_activation && $.fn.mediaelementplayer ) 216 { 217 $(".avia_video, .avia_audio", container).avia_html5_activation({ratio:'16:9'}); 218 } 219 220 }; 221 222 // ------------------------------------------------------------------------------------------- 223 // Error log helper 224 // ------------------------------------------------------------------------------------------- 225 $.avia_utilities.log = function( text, type, extra ) 226 { 227 if( typeof console == 'undefined' ) 228 { 229 return; 230 } 231 232 if( typeof type == 'undefined' ) 233 { 234 type = "log"; 235 } 236 237 type = "AVIA-" + type.toUpperCase(); 238 239 console.log( "["+type+"] "+text ); 240 241 if( typeof extra != 'undefined' ) 242 { 243 console.log( extra ); 244 } 245 }; 246 247 248 249 // ------------------------------------------------------------------------------------------- 250 // keep track of the browser and content width 251 // ------------------------------------------------------------------------------------------- 252 253 254 255 function aviaCalcContentWidth() 256 { 257 258 var win = $(window), 259 width_select= $('html').is('.html_header_sidebar') ? "#main" : "#header", 260 outer = $(width_select), 261 outerParent = outer.parents('div').eq( 0 ), 262 the_main = $(width_select + ' .container').first(), 263 css_block = "", 264 calc_dimensions = function() 265 { 266 var css = "", 267 w_12 = Math.round( the_main.width() ), 268 w_outer = Math.round( outer.width() ), 269 w_inner = Math.round( outerParent.width() ); 270 271 //css rules for mega menu 272 css += " #header .three.units{width:" + ( w_12 * 0.25)+ "px;}"; 273 css += " #header .six.units{width:" + ( w_12 * 0.50)+ "px;}"; 274 css += " #header .nine.units{width:" + ( w_12 * 0.75)+ "px;}"; 275 css += " #header .twelve.units{width:" +( w_12 ) + "px;}"; 276 277 //css rules for tab sections 278 css += " .av-framed-box .av-layout-tab-inner .container{width:" +( w_inner )+ "px;}"; 279 css += " .html_header_sidebar .av-layout-tab-inner .container{width:" +( w_outer )+ "px;}"; 280 css += " .boxed .av-layout-tab-inner .container{width:" +( w_outer )+ "px;}"; 281 282 //css rules for submenu container 283 css += " .av-framed-box#top .av-submenu-container{width:" +( w_inner )+ "px;}"; 284 285 //ie8 needs different insert method 286 try{ 287 css_block.text(css); 288 } 289 catch(err){ 290 css_block.remove(); 291 var headFirst = $( 'head' ).first(); 292 css_block = $("<style type='text/css' id='av-browser-width-calc'>"+css+"</style>").appendTo( headFirst ); 293 } 294 295 }; 296 297 298 299 if($('.avia_mega_div').length > 0 || $('.av-layout-tab-inner').length > 0 || $('.av-submenu-container').length > 0) 300 { 301 var headFirst = $( 'head' ).first(); 302 css_block = $("<style type='text/css' id='av-browser-width-calc'></style>").appendTo( headFirst ); 303 win.on( 'debouncedresize', calc_dimensions); 304 calc_dimensions(); 305 } 306 } 307 308 309 // ------------------------------------------------------------------------------------------- 310 // Tiny helper for sidebar shadow 311 // ------------------------------------------------------------------------------------------- 312 313 function AviaSidebarShadowHelper() 314 { 315 var $sidebar_container = $('.sidebar_shadow#top #main .sidebar'); 316 var $content_container = $('.sidebar_shadow .content'); 317 318 if( $sidebar_container.height() >= $content_container.height() ) 319 { 320 $sidebar_container.addClass('av-enable-shadow'); 321 } 322 else 323 { 324 $content_container.addClass('av-enable-shadow'); 325 } 326 } 327 328 329 // ------------------------------------------------------------------------------------------- 330 // modified SCROLLSPY by bootstrap 331 // ------------------------------------------------------------------------------------------- 332 333 334 function AviaScrollSpy(element, options) 335 { 336 var self = this; 337 338 var process = self.process.bind( self ), 339 refresh = self.refresh.bind( self ), 340 $element = $(element).is('body') ? $(window) : $(element), 341 href; 342 343 self.$body = $('body'); 344 self.$win = $(window); 345 self.options = $.extend({}, $.fn.avia_scrollspy.defaults, options); 346 self.selector = (self.options.target 347 || ((href = $(element).attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7 348 || ''); 349 350 self.activation_true = false;
351 352 if(self.$body.find(self.selector + "[href*='#']").length) 353 { 354 self.$scrollElement = $element.on('scroll.scroll-spy.data-api', process); 355 self.$win.on('av-height-change', refresh); 356 self.$body.on('av_resize_finished', refresh); 357 self.activation_true = true; 358 self.checkFirst(); 359 360 setTimeout(function() 361 { 362 self.refresh(); 363 self.process(); 364 365 },100); 366 } 367 368 } 369 370 AviaScrollSpy.prototype = { 371 372 constructor: AviaScrollSpy 373 , checkFirst: function () { 374 375 var current = window.location.href.split('#')[0], 376 matching_link = this.$body.find(this.selector + "[href='"+current+"']").attr('href',current+'#top'); 377 } 378 , refresh: function () { 379 380 if(!this.activation_true) return; 381 382 var self = this 383 , $targets; 384 385 this.offsets = $([]); 386 this.targets = $([]); 387 388 $targets = this.$body 389 .find(this.selector) 390 .map(function () { 391 var $el = $(this) 392 , href = $el.data('target') || $el.attr('href') 393 , hash = this.hash 394 , hash = hash.replace(/\//g, "") 395 , $href = /^#\w/.test(hash) && $(hash); 396 397 // $.isWindow deprecated 3.3 https://api.jquery.com/jquery.iswindow/ 398 var obj = self.$scrollElement.get(0); 399 var isWindow = obj != null && obj === obj.window; 400 401 return ( $href 402 && $href.length 403 && [[ $href.position().top + ( ! isWindow && self.$scrollElement.scrollTop() ), href ]] ) || null; 404 }) 405 .sort(function (a, b) { return a[0] - b[0]; }) 406 .each(function () { 407 self.offsets.push(this[0]); 408 self.targets.push(this[1]); 409 }); 410 411 } 412 413 , process: function () { 414 415 if(!this.offsets) return; 416 if(isNaN(this.options.offset)) this.options.offset = 0; 417 418 var scrollTop = this.$scrollElement.scrollTop() + this.options.offset 419 , scrollHeight = this.$scrollElement[0].scrollHeight || this.$body[0].scrollHeight 420 , maxScroll = scrollHeight - this.$scrollElement.height() 421 , offsets = this.offsets 422 , targets = this.targets 423 , activeTarget = this.activeTarget 424 , i; 425 426 if (scrollTop >= maxScroll) { 427 return activeTarget != (i = targets.last()[0]) 428 && this.activate ( i ); 429 } 430 431 for (i = offsets.length; i--;) { 432 activeTarget != targets[i] 433 && scrollTop >= offsets[i] 434 && (!offsets[i + 1] || scrollTop <= offsets[i + 1]) 435 && this.activate( targets[i] ); 436 } 437 } 438 439 , activate: function (target) { 440 var active 441 , selector; 442 443 this.activeTarget = target; 444 445 $(this.selector) 446 .parent('.' + this.options.applyClass) 447 .removeClass(this.options.applyClass); 448 449 selector = this.selector 450 + '[data-target="' + target + '"],' 451 + this.selector + '[href="' + target + '"]'; 452 453 454 455 active = $(selector) 456 .parent('li') 457 .addClass(this.options.applyClass); 458 459 if (active.parent('.sub-menu').length) { 460 active = active.closest('li.dropdown_ul_available').addClass(this.options.applyClass); 461 } 462 463 active.trigger('activate'); 464 } 465 466 }; 467 468 469 /* AviaScrollSpy PLUGIN DEFINITION 470 * =========================== */ 471 472 $.fn.avia_scrollspy = function (option) { 473 return this.each(function () { 474 var $this = $(this) 475 , data = $this.data('scrollspy') 476 , options = typeof option == 'object' && option; 477 if (!data) $this.data('scrollspy', (data = new AviaScrollSpy(this, options))); 478 if (typeof option == 'string') data[option](); 479 }); 480 }; 481 482 $.fn.avia_scrollspy.Constructor = AviaScrollSpy; 483 484 $.fn.avia_scrollspy.calc_offset = function() 485 { 486 var offset_1 = (parseInt($('.html_header_sticky #main').data('scroll-offset'), 10)) || 0, 487 offset_2 = ($(".html_header_sticky:not(.html_top_nav_header) #header_main_alternate").outerHeight()) || 0, 488 offset_3 = ($(".html_header_sticky.html_header_unstick_top_disabled #header_meta").outerHeight()) || 0, 489 offset_4 = 1, 490 offset_5 = parseInt($('html').css('margin-top'),10) || 0, 491 offset_6 = parseInt($('.av-frame-top ').outerHeight(),10) || 0; 492 493 return offset_1 + offset_2 + offset_3 + offset_4 + offset_5 + offset_6; 494 }; 495 496 $.fn.avia_scrollspy.defaults = 497 { 498 offset: $.fn.avia_scrollspy.calc_offset(), 499 applyClass: 'current-menu-item' 500 }; 501 502 503 // ------------------------------------------------------------------------------------------- 504 // detect browser and add class to body 505 // ------------------------------------------------------------------------------------------- 506 function AviaBrowserDetection(outputClassElement) 507 { 508 //code from the old jquery migrate plugin 509 var current_browser = {}, 510 511 uaMatch = function( ua ) 512 { 513 ua = ua.toLowerCase(); 514 515 var match = /(edge)\/([\w.]+)/.exec( ua ) || 516 /(opr)[\/]([\w.]+)/.exec( ua ) || 517 /(chrome)[ \/]([\w.]+)/.exec( ua ) || 518 /(iemobile)[\/]([\w.]+)/.exec( ua ) || 519 /(version)(applewebkit)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec( ua ) || 520 /(webkit)[ \/]([\w.]+).*(version)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec( ua ) || 521 /(webkit)[ \/]([\w.]+)/.exec( ua ) || 522 /(opera)(?:.*version|)[ \/]([\w.]+)/.exec( ua ) || 523 /(msie) ([\w.]+)/.exec( ua ) || 524 ua.indexOf("trident") >= 0 && /(rv)(?::| )([\w.]+)/.exec( ua ) || 525 ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec( ua ) || 526 []; 527 528 return { 529 browser: match[ 5 ] || match[ 3 ] || match[ 1 ] || "", 530 version: match[ 2 ] || match[ 4 ] || "0", 531 versionNumber: match[ 4 ] || match[ 2 ] || "0" 532 }; 533 }; 534 535 var matched = uaMatch( navigator.userAgent ); 536 537 if( matched.browser ) 538 { 539 current_browser.browser = matched.browser; 540 current_browser[ matched.browser ] = true; 541 current_browser.version = matched.version; 542 } 543 544 // Chrome is Webkit, but Webkit is also Safari. 545 if ( current_browser.chrome ) { 546 current_browser.webkit = true; 547 } else if ( current_browser.webkit ) { 548 current_browser.safari = true; 549 } 550 551 if(typeof(current_browser) !== 'undefined') 552 { 553 var bodyclass = '', 554 version = current_browser.version ? parseInt(current_browser.version) : ""; 555 556 if(current_browser.msie || current_browser.rv || current_browser.iemobile){ 557 bodyclass += 'avia-msie'; 558 }else if(current_browser.webkit){ 559 bodyclass += 'avia-webkit'; 560 }else if(current_browser.mozilla){ 561 bodyclass += 'avia-mozilla'; 562 } 563 564 if(current_browser.version) bodyclass += ' ' + bodyclass + '-' + version + ' '; 565 if(current_browser.browser) bodyclass += ' avia-' + current_browser.browser + ' avia-' +current_browser.browser +'-' + version + ' '; 566 } 567 568 if( outputClassElement ) 569 { 570 $(outputClassElement).addClass( bodyclass ); 571 } 572 573 return bodyclass; 574 } 575 576 /** 577 * Detect device features and add a class to body 578 */ 579 function AviaDeviceDetection( outputClassElement ) 580 { 581 var classes = []; 582
583 // https://stackoverflow.com/questions/14439903/how-can-i-detect-device-touch-support-in-javascript 584 $.avia_utilities.isTouchDevice = 'ontouchstart' in window || 585 window.DocumentTouch && document instanceof window.DocumentTouch || 586 navigator.maxTouchPoints > 0 || 587 window.navigator.msMaxTouchPoints > 0; 588 589 classes.push( $.avia_utilities.isTouchDevice ? 'touch-device' : 'no-touch-device' ); 590 591 $.avia_utilities.pointerDevices = []; 592 593 // https://stackdiary.com/detect-mobile-browser-javascript/ 594 if( typeof window.matchMedia != 'function' ) 595 { 596 $.avia_utilities.pointerDevices.push( 'undefined' ); 597 classes.push( 'pointer-device-undefined' ); 598 } 599 else 600 { 601 var pointer_fine = false; 602 603 if( window.matchMedia( '(any-pointer: fine)' ) ) 604 { 605 classes.push( 'pointer-device-fine' ); 606 $.avia_utilities.pointerDevices.push( 'fine' ); 607 pointer_fine = true; 608 } 609 610 if( window.matchMedia( '(any-pointer: coarse)' ) ) 611 { 612 classes.push( 'pointer-device-coarse' ); 613 $.avia_utilities.pointerDevices.push( 'coarse' ); 614 615 if( ! pointer_fine ) 616 { 617 classes.push( 'pointer-device-coarse-only' ); 618 } 619 } 620 621 if( ! $.avia_utilities.pointerDevices.length ) 622 { 623 classes.push( 'pointer-device-none' ); 624 $.avia_utilities.pointerDevices.push( 'none' ); 625 } 626 } 627 628 if( 'undefined' == typeof $.avia_utilities.isMobile ) 629 { 630 if( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) && 'ontouchstart' in document.documentElement) 631 { 632 $.avia_utilities.isMobile = true; 633 } 634 else 635 { 636 $.avia_utilities.isMobile = false; 637 } 638 } 639 640 $( outputClassElement ).addClass( classes.join( ' ') ); 641 } 642 643 // ------------------------------------------------------------------------------------------- 644 // html 5 videos 645 // ------------------------------------------------------------------------------------------- 646 $.fn.avia_html5_activation = function( options ) 647 { 648 var defaults = 649 { 650 ratio: '16:9' 651 }; 652 653 var options = $.extend( defaults, options ); 654 655// isMobile = $.avia_utilities.isMobile; 656// if(isMobile) return; 657 658 this.each( function() 659 { 660 var fv = $(this), 661 id_to_apply = '#' + fv.attr('id'), 662 posterImg = fv.attr('poster'), 663 features = [ 'playpause', 'progress', 'current', 'duration', 'tracks', 'volume' ], 664 container = fv.closest( '.avia-video' ); 665 666 if( container.length > 0 && container.hasClass( 'av-html5-fullscreen-btn' ) ) 667 { 668 features.push( 'fullscreen' ); 669 } 670 671 fv.mediaelementplayer( 672 { 673 // if the <video width> is not specified, this is the default 674 defaultVideoWidth: 480, 675 // if the <video height> is not specified, this is the default 676 defaultVideoHeight: 270, 677 // if set, overrides <video width> 678 videoWidth: -1, 679 // if set, overrides <video height> 680 videoHeight: -1, 681 // width of audio player 682 audioWidth: 400, 683 // height of audio player 684 audioHeight: 30, 685 // initial volume when the player starts 686 startVolume: 0.8, 687 // useful for <audio> player loops 688 loop: false, 689 // enables Flash and Silverlight to resize to content size 690 enableAutosize: false, 691 // the order of controls you want on the control bar (and other plugins below) 692 features: features, 693 // Hide controls when playing and mouse is not over the video 694 alwaysShowControls: false, 695 // force iPad's native controls 696 iPadUseNativeControls: false, 697 // force iPhone's native controls 698 iPhoneUseNativeControls: false, 699 // force Android's native controls 700 AndroidUseNativeControls: false, 701 // forces the hour marker (##:00:00) 702 alwaysShowHours: false, 703 // show framecount in timecode (##:00:00:00) 704 showTimecodeFrameCount: false, 705 // used when showTimecodeFrameCount is set to true 706 framesPerSecond: 25, 707 // turns keyboard support on and off for this instance 708 enableKeyboard: true, 709 // when this player starts, it will pause other players 710 pauseOtherPlayers: false, 711 poster: posterImg, 712 success: function( mediaElement, domObject, instance ) 713 { 714 //make the medialement instance accesible by storing it. usually not necessary but safari has problems since wp version 4.9 715 $.AviaVideoAPI.players[ fv.attr('id').replace( /_html5/,'' ) ] = instance; 716 717 setTimeout(function() 718 { 719 if( mediaElement.pluginType == 'flash' ) 720 { 721 mediaElement.addEventListener('canplay', function() { fv.trigger('av-mediajs-loaded'); }, false); 722 } 723 else 724 { 725 fv.trigger('av-mediajs-loaded').addClass('av-mediajs-loaded'); 726 } 727 728 mediaElement.addEventListener('ended', function() { fv.trigger('av-mediajs-ended'); }, false); 729 730 var html5MediaElement = document.getElementById( $(mediaElement).attr('id') + '_html5' ); 731 if( html5MediaElement && html5MediaElement !== mediaElement ) 732 { 733 mediaElement.addEventListener( "ended", function() 734 { 735 $( html5MediaElement ).trigger( 'av-mediajs-ended' ); 736 }); 737 } 738 }, 10 ); 739 740 }, 741 // fires when a problem is detected 742 error: function() 743 { 744 745 }, 746 // array of keyboard commands 747 keyActions: [] 748 }); 749 }); 750 }; 751 752 // ------------------------------------------------------------------------------------------- 753 // hover effect for images 754 // ------------------------------------------------------------------------------------------- 755 function avia_hover_effect( container ) 756 { 757 //hover overlay for mobile device doesnt really make sense. in addition it often slows down the click event 758 if( $.avia_utilities.isMobile ) 759 { 760 return; 761 } 762 763 if( $('body').hasClass( 'av-disable-avia-hover-effect' ) ) 764 { 765 return; 766 } 767
768 var overlay = "", 769 cssTrans = $.avia_utilities.supports('transition'); 770 771 if(container == 'body') 772 { 773 var elements = $('#main a img').parents('a').not('.noLightbox, .noLightbox a, .avia-gallery-thumb a, .ls-wp-container a, .noHover, .noHover a, .av-logo-container .logo a').add('#main .avia-hover-fx'); 774 } 775 else 776 { 777 var elements = $('a img', container).parents('a').not('.noLightbox, .noLightbox a, .avia-gallery-thumb a, .ls-wp-container a, .noHover, .noHover a, .av-logo-container .logo a').add('.avia-hover-fx', container); 778 } 779 780 elements.each( function(e) 781 { 782 var link = $(this), 783 current = link.find('img').first(); 784 785 if(current.hasClass('alignleft')) link.addClass('alignleft').css({float:'left', margin:0, padding:0}); 786 if(current.hasClass('alignright')) link.addClass('alignright').css({float:'right', margin:0, padding:0}); 787 if(current.hasClass('aligncenter')) link.addClass('aligncenter').css({float:'none','text-align':'center', margin:0, padding:0}); 788 789 if(current.hasClass('alignnone')) 790 { 791 link.addClass('alignnone').css({margin:0, padding:0});; 792 if(!link.css('display') || link.css('display') == 'inline') { link.css({display:'inline-block'}); } 793 } 794 795 if(!link.css('position') || link.css('position') == 'static') { link.css({position:'relative', overflow:'hidden'}); } 796 797 var url = link.attr('href'), 798 span_class = "overlay-type-video", 799 opa = link.data('opacity') || 0.7, 800 overlay_offset = 5, 801 overlay = link.find('.image-overlay'); 802 803 if(url) 804 { 805 if( url.match(/(jpg|gif|jpeg|png|tif)/) ) span_class = "overlay-type-image"; 806 if(!url.match(/(jpg|gif|jpeg|png|\.tif|\.mov|\.swf|vimeo\.com|youtube\.com)/) ) span_class = "overlay-type-extern"; 807 } 808 809 if(!overlay.length) 810 { 811 overlay = $("<span class='image-overlay "+span_class+"'><span class='image-overlay-inside'></span></span>").appendTo(link); 812 } 813 814 link.on('mouseenter', function(e) 815 { 816 var current = link.find('img').first(), 817 _self = current.get(0), 818 outerH = current.outerHeight(), 819 outerW = current.outerWidth(), 820 pos = current.position(), 821 linkCss = link.css('display'), 822 overlay = link.find('.image-overlay'); 823 824 if(outerH > 100) 825 { 826 827 if(!overlay.length) 828 { 829 overlay = $("<span class='image-overlay "+span_class+"'><span class='image-overlay-inside'></span></span>").appendTo(link); 830 831 } 832 //can be wrapped into if !overlay.length statement if chrome fixes fade in problem 833 if(link.height() == 0) { link.addClass(_self.className); _self.className = ""; } 834 if(!linkCss || linkCss == 'inline') { link.css({display:'block'}); } 835 //end wrap 836 837 overlay.css({left:(pos.left - overlay_offset) + parseInt(current.css("margin-left"),10), top:pos.top + parseInt(current.css("margin-top"),10)}) 838 .css({overflow:'hidden',display:'block','height':outerH,'width':(outerW + (2*overlay_offset))}); 839 840 if(cssTrans === false ) overlay.stop().animate({opacity:opa}, 400); 841 } 842 else 843 { 844 overlay.css({display:"none"}); 845 } 846 847 }).on('mouseleave', elements, function(){ 848 849 if(overlay.length) 850 { 851 if(cssTrans === false ) overlay.stop().animate({opacity:0}
851, 400); 852 } 853 }); 854 }); 855 } 856 857 858// ------------------------------------------------------------------------------------------- 859// Smooth scrooling when clicking on anchor links 860// todo: maybe use https://github.com/ryanburnette/scrollToBySpeed/blob/master/src/scrolltobyspeed.jquery.js in the future 861// ------------------------------------------------------------------------------------------- 862 863 (function($) 864 { 865 $.fn.avia_smoothscroll = function( apply_to_container ) 866 { 867 if( ! this.length ) 868 { 869 return; 870 } 871 872 var the_win = $(window), 873 $header = $('#header'), 874 $main = $('.html_header_top.html_header_sticky #main').not('.page-template-template-blank-php #main'), 875 $meta = $('.html_header_top.html_header_unstick_top_disabled #header_meta'), 876 $alt = $('.html_header_top:not(.html_top_nav_header) #header_main_alternate'), 877 menu_above_logo = $('.html_header_top.html_top_nav_header'), 878 shrink = $('.html_header_top.html_header_shrinking').length, 879 frame = $('.av-frame-top'), 880 fixedMainPadding = 0, 881 isMobile = $.avia_utilities.isMobile, 882 sticky_sub = $('.sticky_placeholder').first(), 883 calc_main_padding = function() 884 { 885 if( $header.css('position') == "fixed" ) 886 { 887 var tempPadding = parseInt($main.data('scroll-offset'),10) || 0, 888 non_shrinking = parseInt($meta.outerHeight(),10) || 0, 889 non_shrinking2 = parseInt($alt.outerHeight(),10) || 0; 890 891 if( tempPadding > 0 && shrink ) 892 { 893 tempPadding = (tempPadding / 2 ) + non_shrinking + non_shrinking2; 894 } 895 else 896 { 897 tempPadding = tempPadding + non_shrinking + non_shrinking2; 898 } 899 900 tempPadding += parseInt($('html').css('margin-top'),10); 901 fixedMainPadding = tempPadding; 902 } 903 else 904 { 905 fixedMainPadding = parseInt($('html').css('margin-top'),10); 906 } 907 908 if( frame.length ) 909 { 910 fixedMainPadding += frame.height(); 911 } 912 913 if( menu_above_logo.length ) 914 { 915 //if menu is above logo and we got a sticky height header 916 fixedMainPadding = $('.html_header_sticky #header_main_alternate').height() + parseInt($('html').css('margin-top'),10); 917 } 918 919 if( isMobile ) 920 { 921 fixedMainPadding = 0; 922 } 923 924 }; 925 926 if( isMobile ) 927 { 928 shrink = false; 929 } 930 931 calc_main_padding(); 932 the_win.on( "debouncedresize av-height-change", calc_main_padding ); 933 934 var hash = window.location.hash.replace(/\//g, ""); 935 936 //if a scroll event occurs at pageload and an anchor is set and a coresponding element exists apply the offset to the event 937 if( fixedMainPadding > 0 && hash && apply_to_container == 'body' && hash.charAt(1) != "!" && hash.indexOf("=") === -1 ) 938 { 939 var scroll_to_el = $(hash), modifier = 0; 940 941 if( scroll_to_el.length ) 942 { 943 the_win.on('scroll.avia_first_scroll', function() 944 { 945 setTimeout( function() //small delay so other scripts can perform necessary resizing 946 { 947 if( sticky_sub.length && scroll_to_el.offset().top > sticky_sub.offset().top ) 948 { 949 modifier = sticky_sub.outerHeight() - 3; 950 } 951 952 the_win.off( 'scroll.avia_first_scroll' ).scrollTop( scroll_to_el.offset().top - fixedMainPadding - modifier ); 953 },10); 954 }); 955 } 956 } 957 958 return this.each(function() 959 { 960 $(this).on('click', function(e) 961 { 962 var newHash = this.hash.replace(/\//g, ""), 963 clicked = $(this), 964 data = clicked.data(), 965 ignoreScroll = false, 966 noScrolInViewport = 'undefined' != typeof data.no_scroll_in_viewport && data.no_scroll_in_viewport == 1, 967 ignoreHash = 'undefined' != typeof data.ignore_hash && data.ignore_hash == 1; 968 969 if( newHash != '' && newHash != '#' && newHash != '#prev' && newHash != '#next' && !clicked.is('.comment-reply-link, #cancel-comment-reply-link, .no-scroll')) 970 { 971 var container = "", 972 originHash = ""; 973 974 if( '#next-section' == newHash ) 975 { 976 originHash = newHash; 977 978 // @since 4.8.3 check to scroll to visible sections only (e.g. sections could be hidden on different devices 979 var next_containers = clicked.parents('.container_wrap').eq( 0 ).nextAll('.container_wrap'); 980 next_containers.each( function() 981 { 982 var cont = $( this ); 983 984 if( cont.css( 'display' ) == 'none' || cont.css( 'visibility' ) == 'hidden' ) 985 { 986 return; 987 } 988 989 container = cont; 990 return false;
991 }); 992 993 if( 'object' == typeof container && container.length > 0 ) 994 { 995 newHash = '#' + container.attr('id') ; 996 } 997 } 998 else 999 { 1000 container = $( this.hash.replace(/\//g, "") ); 1001 } 1002 1003 // check if element is already in viewport 1004 if( container.length && noScrolInViewport ) 1005 { 1006 const rect = container[0].getBoundingClientRect(); 1007 1008 if( rect.top > fixedMainPadding && ( rect.top < (window.innerHeight || document.documentElement.clientHeight) ) ) 1009 { 1010 ignoreScroll = true; 1011 } 1012 } 1013 1014 if( container.length && ! ignoreScroll ) 1015 { 1016 var cur_offset = the_win.scrollTop(), 1017 container_offset = container.offset().top, 1018 target = container_offset - fixedMainPadding, 1019 hash = window.location.hash, 1020 hash = hash.replace(/\//g, ""), 1021 oldLocation = window.location.href.replace(hash, ''), 1022 newLocation = this, 1023 duration = data.duration || 1200, 1024 easing = data.easing || 'easeInOutQuint'; 1025 1026 if( sticky_sub.length && container_offset > sticky_sub.offset().top ) 1027 { 1028 target -= sticky_sub.outerHeight() - 3; 1029 } 1030 if( 'undefined' != typeof data.scroll_top_offset && Number.isInteger( data.scroll_top_offset ) ) 1031 { 1032 target -= data.scroll_top_offset; 1033 } 1034 1035 // make sure it's the same location 1036 if( oldLocation + newHash == newLocation || originHash ) 1037 { 1038 if( cur_offset != target ) // if current pos and target are the same dont scroll 1039 { 1040 if( ! ( cur_offset == 0 && target <= 0 ) ) // if we are at the top dont try to scroll to top or above 1041 { 1042 the_win.trigger('avia_smooth_scroll_start'); 1043 1044 // animate to target and set the hash to the window.location after the animation 1045 $('html:not(:animated),body:not(:animated)').animate({ scrollTop: target }, duration, easing, function() 1046 { 1047 the_win.trigger('avia_smooth_scroll_end'); 1048 1049 if( ! ignoreHash ) 1050 { 1051 // add new hash to the browser location 1052 //window.location.href=newLocation; 1053 if( window.history.replaceState ) 1054 { 1055 window.history.replaceState( "", "", newHash ); 1056 } 1057 } 1058 }); 1059 } 1060 } 1061 1062 // cancel default click action 1063 e.preventDefault(); 1064 } 1065 } 1066 } 1067 }); 1068 }); 1069 }; 1070 })(jQuery); 1071 1072 1073 // ------------------------------------------------------------------------------------------- 1074 // iframe fix for firefox and ie so they get proper z index 1075 // ------------------------------------------------------------------------------------------- 1076 function avia_iframe_fix(container) 1077 { 1078 var iframe = jQuery('iframe[src*="youtube.com"]:not(.av_youtube_frame)', container), 1079 youtubeEmbed = jQuery('iframe[src*="youtube.com"]:not(.av_youtube_frame) object, iframe[src*="youtube.com"]:not(.av_youtube_frame) embed', container).attr('wmode','opaque'); 1080 1081 iframe.each(function() 1082 { 1083 var current = jQuery(this), 1084 src = current.attr('src'); 1085 1086 if(src) 1087 { 1088 if(src.indexOf('?') !== -1) 1089 { 1090 src += "&wmode=opaque&rel=0"; 1091 } 1092 else 1093 { 1094 src += "?wmode=opaque&rel=0"; 1095 } 1096 1097 current.attr('src', src); 1098 } 1099 }); 1100 } 1101 1102 // ------------------------------------------------------------------------------------------- 1103 // small js fixes for pixel perfection :) 1104 // ------------------------------------------------------------------------------------------- 1105 function avia_small_fixes(container) 1106 { 1107 if(!container) container = document; 1108 1109 //make sure that iframes do resize correctly. uses css padding bottom iframe trick 1110 var win = jQuery(window), 1111 iframes = jQuery('.avia-iframe-wrap iframe:not(.avia-slideshow iframe):not( iframe.no_resize):not(.avia-video iframe)', container), 1112 adjust_iframes = function() 1113 { 1114 iframes.each(function(){ 1115 1116 var iframe = jQuery(this), parent = iframe.parent(), proportions = 56.25; 1117 1118 if(this.width && this.height) 1119 { 1120 proportions = (100/ this.width) * this.height; 1121 parent.css({"padding-bottom":proportions+"%"}); 1122 } 1123 }); 1124 }; 1125 1126 adjust_iframes(); 1127 1128 } 1129 1130 function avia_scroll_top_fade() 1131 { 1132 var win = $(window), 1133 timeo = false, 1134 scroll_top = $('#scroll-top-link'), 1135 set_status = function() 1136 { 1137 var st = win.scrollTop(); 1138 1139 if(st < 500) 1140 { 1141 scroll_top.removeClass('avia_pop_class'); 1142 } 1143 else if(!scroll_top.is('.avia_pop_class')) 1144 { 1145 scroll_top.addClass('avia_pop_class'); 1146 } 1147 }; 1148 1149 win.on( 'scroll', function(){ window.requestAnimationFrame( set_status ); } ); 1150 set_status(); 1151 } 1152 1153 $.AviaAjaxSearch = function( options ) 1154 { 1155 var defaults = { 1156 delay: 300, //delay in ms until the user stops typing. 1157 minChars: 3, //dont start searching before we got at least that much characters 1158 scope: 'body' 1159 }; 1160 1161 this.options = $.extend({}, defaults, options); 1162 this.scope = $(this.options.scope); 1163 this.timer = false;
1164 this.lastVal = ""; 1165 1166 this.bind_events(); 1167 }; 1168 1169 $.AviaAjaxSearch.prototype = 1170 { 1171 bind_events: function() 1172 { 1173 this.scope.on( 'keyup', '#s:not(".av_disable_ajax_search #s")', this.try_search.bind( this ) ); 1174 this.scope.on( 'click', '#s.av-results-parked', this.reset.bind( this ) ); 1175 }, 1176 1177 try_search: function(e) 1178 { 1179 var form = $(e.currentTarget).parents('form').eq( 0 ), 1180 resultscontainer = form.find('.ajax_search_response'); 1181 1182 clearTimeout(this.timer); 1183 1184 // clear on ESC 1185 if( e.keyCode === 27 ) 1186 { 1187 this.reset(e); 1188 return; 1189 } 1190 1191 //only execute search if chars are at least "minChars" and search differs from last one 1192 if(e.currentTarget.value.length >= this.options.minChars && this.lastVal != e.currentTarget.value.trim() ) 1193 { 1194 //wait at least "delay" milliseconds to execute ajax. if user types again during that time dont execute 1195 this.timer = setTimeout( this.do_search.bind( this, e ), this.options.delay ); 1196 } 1197 //remove the results container if the input field has been emptied 1198 else if ( e.currentTarget.value.length == 0 ) 1199 { 1200 this.timer = setTimeout( this.reset.bind( this, e ), this.options.delay ); 1201 } 1202 }, 1203 1204 reset: function(e) 1205 { 1206 var form = $(e.currentTarget).parents('form').eq( 0 ), 1207 resultscontainer = form.find('.ajax_search_response'), 1208 alternative_resultscontainer = $(form.attr('data-ajaxcontainer')).find('.ajax_search_response'), 1209 searchInput = $(e.currentTarget); 1210 1211 // bring back results that were hidden when user clicked outside the form element 1212 if ($(e.currentTarget).hasClass('av-results-parked')) { 1213 resultscontainer.show(); 1214 alternative_resultscontainer.show(); 1215 1216 // in case results container is attached to body 1217 $('body > .ajax_search_response').show(); 1218 } 1219 else { 1220 // remove results and delete the input value 1221 resultscontainer.remove(); 1222 alternative_resultscontainer.remove(); 1223 searchInput.val(''); 1224 1225 // in case results container is attached to body 1226 $('body > .ajax_search_response').remove(); 1227 } 1228 1229 1230 }, 1231 1232 do_search: function(e) 1233 { 1234 var obj = this, 1235 currentField = $(e.currentTarget).attr( "autocomplete", "off" ), 1236 currentFieldWrapper = $(e.currentTarget).parents('.av_searchform_wrapper').eq( 0 ), 1237 currentField_position = currentFieldWrapper.offset(), 1238 currentField_width = currentFieldWrapper.outerWidth(), 1239 currentField_height = currentFieldWrapper.outerHeight(), 1240 form = currentField.parents('form').eq( 0 ), 1241 submitbtn = form.find('#searchsubmit'), 1242 resultscontainer = form, 1243 results = resultscontainer.find('.ajax_search_response'), 1244 loading = $('<div class="ajax_load"><span class="ajax_load_inner"></span></div>'), 1245 action = form.attr('action'), 1246 values = form.serialize(), 1247 elementID = form.data('element_id'), 1248 custom_color = form.data('custom_color'); 1249 1250 values += '&action=avia_ajax_search'; 1251 1252 1253 // define results div if not found 1254 if( ! results.length ) 1255 { 1256 results = $('<div class="ajax_search_response" style="display:none;"></div>'); 1257 } 1258 1259 if( 'undefined' != typeof elementID ) 1260 { 1261 results.addClass( elementID ); 1262 } 1263 1264 if( 'undefined' != typeof custom_color && custom_color != '' ) 1265 { 1266 results.addClass( 'av_has_custom_color' ); 1267 } 1268 1269 // add class to differentiate betweeen search element and header search 1270 if( form.attr('id') == 'searchform_element') 1271 { 1272 results.addClass('av_searchform_element_results'); 1273 } 1274 1275 //check if the form got get parameters applied and also apply them 1276 if(action.indexOf('?') != -1) 1277 { 1278 action = action.split('?'); 1279 values += "&" + action[1]; 1280 } 1281 1282 //check if there is a results container defined 1283 if( form.attr('data-ajaxcontainer') ) 1284 { 1285 var rescon = form.attr('data-ajaxcontainer'); 1286 1287 // check if defined container exists 1288 if ($(rescon).length) 1289 { 1290 // remove previous search results 1291 $(rescon).find('.ajax_search_response').remove(); 1292 1293 resultscontainer = $(rescon); 1294 } 1295 } 1296 1297 /* 1298 * For the placement option: "Under the search form - overlay other content", 1299 * we have to attach the results to the body in order to overlay the other content,
1300 * and we calculate it's position using the search field 1301 */ 1302 1303 results_css = {}; 1304 1305 if( form.hasClass('av_results_container_fixed') ) 1306 { 1307 // remove previous search results 1308 $('body').find('.ajax_search_response').remove(); 1309 1310 resultscontainer = $('body'); 1311 1312 // add class and position to results if defined above 1313 var results_css = { 1314 top: currentField_position.top + currentField_height, 1315 left: currentField_position.left, 1316 width: currentField_width 1317 }; 1318 1319 // make sure default stylesheet is applied 1320 results.addClass('main_color'); 1321 1322 // remove results and reset if window is resized 1323 $( window ).resize( function() 1324 { 1325 results.remove(); 1326 this.reset.bind( this ); 1327 currentField.val(''); 1328 }); 1329 } 1330 1331 // add additional styles - for backwards comp. only. Attribute has been removed in 4.8.7 with header styles 1332 if ( form.attr('data-results_style') ) 1333 { 1334 var results_style = JSON.parse(form.attr('data-results_style')); 1335 results_css = Object.assign(results_css, results_style); 1336 1337 // add class if font color is applied, so we can use color: inherit 1338 if( "color" in results_css ) 1339 { 1340 results.addClass('av_has_custom_color'); 1341 } 1342 } 1343 1344 // apply inline styles 1345 results.css(results_css); 1346 1347 // add .container class if resultscontainer in a color section 1348 if( resultscontainer.hasClass('avia-section') ) 1349 { 1350 results.addClass('container'); 1351 } 1352 1353 // append results to defined container 1354 results.appendTo(resultscontainer); 1355 1356 1357 //return if we already hit a no result and user is still typing 1358 if(results.find('.ajax_not_found').length && e.currentTarget.value.indexOf(this.lastVal) != -1) 1359 { 1360 return; 1361 } 1362 1363 this.lastVal = e.currentTarget.value; 1364 1365 $.ajax({ 1366 url: avia_framework_globals.ajaxurl, 1367 type: "POST", 1368 data:values, 1369 beforeSend: function() 1370 { 1371 // add loader after submit button 1372 loading.insertAfter(submitbtn); 1373 form.addClass('ajax_loading_now'); 1374 }, 1375 success: function(response) 1376 { 1377 if(response == 0) 1378 { 1379 response = ""; 1380 } 1381 1382 results.html(response).show(); 1383 }, 1384 complete: function() 1385 { 1386 loading.remove(); 1387 form.removeClass('ajax_loading_now'); 1388 } 1389 }); 1390 1391 // Hide search resuls if user clicks anywhere outside the form element 1392 $(document).on('click',function(e) 1393 { 1394 if(!$(e.target).closest(form).length) 1395 { 1396 if($(results).is(":visible")) 1397 { 1398 $(results).hide(); 1399 currentField.addClass('av-results-parked'); 1400 } 1401 } 1402 }); 1403 } 1404 }; 1405 1406 1407 $.AviaTooltip = function( options ) 1408 { 1409 var defaults = { 1410 delay: 1500, //delay in ms until the tooltip appears 1411 delayOut: 300, //delay in ms when instant showing should stop 1412 delayHide: 0, //delay hiding of tooltip in ms 1413 "class": "avia-tooltip", //tooltip classname for css styling and alignment 1414 scope: "body", //area the tooltip should be applied to 1415 data: "avia-tooltip", //data attribute that contains the tooltip text 1416 attach: "body", //either attach the tooltip to the "mouse" or to the "element" // todo: implement mouse, make sure that it doesnt overlap with screen borders 1417 event: 'mouseenter', //mousenter and leave or click and leave 1418 position: 'top', //top or bottom 1419 extraClass: 'avia-tooltip-class', //extra class that is defined by a tooltip element data attribute 1420 permanent: false, // always display the tooltip? 1421 within_screen: false, // if the tooltip is displayed outside the screen adjust its position 1422 close_keys: null // string|[] of keyCodes to close the tooltip (there is no check for empty value !! ) 1423 }; 1424 1425 this.options = $.extend({}, defaults, options); 1426 1427 var close_keys = ''; 1428 if( this.options.close_keys != null ) 1429 { 1430 if( ! Array.isArray( this.options.close_keys ) ) 1431 { 1432 this.options.close_keys = [ this.options.close_keys ]; 1433 } 1434 close_keys = ' data-close-keys="' + this.options.close_keys.join( ',' ) + '" '; 1435 } 1436 1437 this.body = $('body'); 1438 this.scope = $(this.options.scope); 1439 this.tooltip = $( '<div class="' + this.options['class'] + ' avia-tt"' + close_keys + '><span class="avia-arrow-wrap"><span class="avia-arrow"></span></span></div>' ); 1440 this.inner = $( '<div class="inner_tooltip"></div>').prependTo(this.tooltip); 1441 this.open = false;
1442 this.timer = false; 1443 this.active = false; 1444 1445 this.bind_events(); 1446 }; 1447 1448 $.AviaTooltip.openTTs = []; 1449 $.AviaTooltip.openTT_Elements = []; 1450 1451 $.AviaTooltip.prototype = 1452 { 1453 bind_events: function() 1454 { 1455 var perma_tooltips = '.av-permanent-tooltip [data-'+this.options.data+']', 1456 default_tooltips = '[data-'+this.options.data+']:not( .av-permanent-tooltip [data-'+this.options.data+'])'; 1457 1458 this.scope.on( 'av_permanent_show', perma_tooltips, this.display_tooltip.bind( this ) ); 1459 $(perma_tooltips).addClass('av-perma-tooltip').trigger('av_permanent_show'); 1460 1461 1462 this.scope.on( this.options.event + ' mouseleave', default_tooltips, this.start_countdown.bind( this ) ); 1463 1464 if(this.options.event != 'click') 1465 { 1466 this.scope.on( 'mouseleave', default_tooltips, this.hide_tooltip.bind( this ) ); 1467 this.scope.on( 'click', default_tooltips, this.hide_on_click_tooltip.bind( this ) ); 1468 } 1469 else 1470 { 1471 this.body.on( 'mousedown', this.hide_tooltip.bind( this ) ); 1472 } 1473 1474 if( this.options.close_keys != null ) 1475 { 1476 this.body.on( 'keyup', this.close_on_keyup.bind( this ) ); 1477 } 1478 }, 1479 1480 start_countdown: function(e) 1481 { 1482 clearTimeout(this.timer); 1483 1484 var target = this.options.event == "click" ? e.target : e.currentTarget, 1485 element = $(target); 1486 1487 if( e.type == this.options.event ) 1488 { 1489 var delay = this.options.event == 'click' ? 0 : this.open ? 0 : this.options.delay; 1490 1491 this.timer = setTimeout( this.display_tooltip.bind( this, e ), delay ); 1492 } 1493 else if( e.type == 'mouseleave' ) 1494 { 1495 if( ! element.hasClass( 'av-close-on-click-tooltip' ) ) 1496 { 1497 this.timer = setTimeout( this.stop_instant_open.bind( this, e ), this.options.delayOut); 1498 } 1499 } 1500 e.preventDefault(); 1501 }, 1502 1503 reset_countdown: function(e) 1504 { 1505 clearTimeout( this.timer ); 1506 this.timer = false; 1507 }, 1508 1509 display_tooltip: function(e) 1510 { 1511 var _self = this, 1512 target = this.options.event == "click" ? e.target : e.currentTarget, 1513 element = $(target), 1514 text = element.data(this.options.data), 1515 tip_index = element.data('avia-created-tooltip'), 1516 extraClass = element.data('avia-tooltip-class'), 1517 attach = this.options.attach == 'element' ? element : this.body, 1518 offset = this.options.attach == 'element' ? element.position() : element.offset(), 1519 position = element.data('avia-tooltip-position'), 1520 align = element.data('avia-tooltip-alignment'), 1521 force_append= false, 1522 newTip = false, 1523 is_new_tip = false; 1524 1525 text = 'string' == typeof text ? text.trim() : ''; 1526 1527 if(element.is('.av-perma-tooltip')) 1528 { 1529 offset = {top:0, left:0 }; 1530 attach = element; 1531 force_append = true; 1532 } 1533 1534 if( text == "" ) 1535 { 1536 return; 1537 } 1538 if( position == "" || typeof position == 'undefined' ) 1539 { 1540 position = this.options.position; 1541 } 1542 if( align == "" || typeof align == 'undefined' ) 1543 { 1544 align = 'center'; 1545 } 1546 1547 if( typeof tip_index != 'undefined' ) 1548 { 1549 newTip = $.AviaTooltip.openTTs[tip_index]; 1550 } 1551 else 1552 { 1553 this.inner.html(text); 1554 newTip = this.tooltip.clone(); 1555 is_new_tip = true; 1556 1557 if( this.options.attach == 'element' && force_append !== true ) 1558 { 1559 newTip.insertAfter(attach); 1560 } 1561 else 1562 { 1563 newTip.appendTo(attach); 1564 } 1565 1566 if(extraClass != "") 1567 { 1568 newTip.addClass(extraClass); 1569 } 1570 } 1571 1572 if( this.open && this.active == newTip ) 1573 { 1574 return; 1575 } 1576 1577 if( element.hasClass( 'av-close-on-click-tooltip' ) ) 1578 { 1579 this.hide_all_tooltips(); 1580 } 1581 1582 this.open = true; 1583 this.active = newTip; 1584 1585 if( ( newTip.is(':animated:visible') && e.type == 'click' ) || element.is( '.' + this.options['class'] ) || element.parents( '.' + this.options['class'] ).length != 0 ) 1586 { 1587 return; 1588 } 1589 1590 var animate1 = {}, 1591 animate2 = {}, 1592 pos1 = "", 1593 pos2 = ""; 1594 1595 if( position == "top" || position == "bottom" ) 1596 { 1597 switch(align) 1598 {
1599 case "left": 1600 pos2 = offset.left; 1601 break; 1602 case "right": 1603 pos2 = offset.left + element.outerWidth() - newTip.outerWidth(); 1604 break; 1605 default: 1606 pos2 = ( offset.left + ( element.outerWidth() / 2 ) ) - ( newTip.outerWidth() / 2 ); 1607 break; 1608 } 1609 1610 if(_self.options.within_screen) //used to keep search field inside screen 1611 { 1612 var boundary = element.offset().left + (element.outerWidth() / 2) - (newTip.outerWidth() / 2) + parseInt(newTip.css('margin-left'),10); 1613 if(boundary < 0) 1614 { 1615 pos2 = pos2 - boundary; 1616 } 1617 } 1618 } 1619 else 1620 { 1621 switch(align) 1622 { 1623 case "top": 1624 pos1 = offset.top; 1625 break; 1626 case "bottom": 1627 pos1 = offset.top + element.outerHeight() - newTip.outerHeight(); 1628 break; 1629 default: 1630 pos1 = ( offset.top + (element.outerHeight() / 2 ) ) - ( newTip.outerHeight() / 2 ); 1631 break; 1632 } 1633 } 1634 1635 switch(position) 1636 { 1637 case "top": 1638 pos1 = offset.top - newTip.outerHeight(); 1639 animate1 = {top: pos1 - 10, left: pos2}; 1640 animate2 = {top: pos1}; 1641 break; 1642 case "bottom": 1643 pos1 = offset.top + element.outerHeight(); 1644 animate1 = {top: pos1 + 10, left: pos2}; 1645 animate2 = {top: pos1}; 1646 break; 1647 case "left": 1648 pos2 = offset.left - newTip.outerWidth();
1649 animate1 = {top: pos1, left: pos2 -10}; 1650 animate2 = {left: pos2}; 1651 break; 1652 case "right": 1653 pos2 = offset.left + element.outerWidth(); 1654 animate1 = {top: pos1, left: pos2 + 10}; 1655 animate2 = {left: pos2}; 1656 break; 1657 } 1658 1659 animate1['display'] = "block"; 1660 animate1['opacity'] = 0; 1661 animate2['opacity'] = 1; 1662 1663 newTip.css(animate1).stop().animate(animate2,200); 1664 1665 newTip.find('input, textarea').trigger('focus'); 1666 if( is_new_tip ) 1667 { 1668 $.AviaTooltip.openTTs.push(newTip); 1669 $.AviaTooltip.openTT_Elements.push(element); 1670 element.data('avia-created-tooltip', $.AviaTooltip.openTTs.length - 1); 1671 } 1672 }, 1673 1674 hide_on_click_tooltip: function(e) 1675 { 1676 if( this.options.event == "click" ) 1677 { 1678 return; 1679 } 1680 1681 var element = $( e.currentTarget ); 1682 1683 if( ! element.hasClass('av-close-on-click-tooltip') ) 1684 { 1685 return; 1686 } 1687 1688 if( ! element.find( 'a' ) ) 1689 { 1690 e.preventDefault(); 1691 } 1692 1693 // Default behaviour when using mouse - click on active tooltip closes it (moving mouse to another tooltip close others automatically 1694 // On mobile devices or when using touchscreen we show element on click (= old behaviour) and hide when same element 1695 var ttip_index = element.data('avia-created-tooltip'); 1696 1697 if( 'undefined' != typeof ttip_index ) 1698 { 1699 var current = $.AviaTooltip.openTTs[ttip_index]; 1700 if( 'undefined' != typeof current && current == this.active ) 1701 { 1702 this.hide_all_tooltips(); 1703 } 1704 } 1705 1706 }, 1707 1708 close_on_keyup: function( e ) 1709 { 1710 if( this.options.close_keys == null ) 1711 { 1712 return; 1713 } 1714 1715 if( $.inArray( e.keyCode, this.options.close_keys ) < 0 ) 1716 { 1717 return; 1718 } 1719 1720 this.hide_all_tooltips( e.keyCode ); 1721 }, 1722 1723 hide_all_tooltips: function( keyCode ) 1724 { 1725 var ttip, 1726 position, 1727 element, 1728 keyCodeCheck = 'undefined' != typeof keyCode ? keyCode + '' : null; 1729 1730 for( var index = 0; index < $.AviaTooltip.openTTs.length; ++index ) 1731 { 1732 ttip = $.AviaTooltip.openTTs[index]; 1733 element = $.AviaTooltip.openTT_Elements[index]; 1734 position = element.data('avia-tooltip-position'); 1735 1736 // check if tooltip can be closed on keyup 1737 if( keyCodeCheck != null ) 1738 { 1739 var keys = ttip.data( 'close-keys' ); 1740 if( 'undefined' == typeof keys ) 1741 { 1742 continue; 1743 } 1744 1745 keys = keys + ''; 1746 keys = keys.split( ',' ); 1747 if( $.inArray( keyCodeCheck, keys ) < 0 ) 1748 { 1749 continue; 1750 } 1751 } 1752 1753 this.animate_hide_tooltip( ttip, position ); 1754 } 1755 1756 this.open = false; 1757 this.active = false; 1758 }, 1759 1760 hide_tooltip: function(e) 1761 { 1762 var element = $(e.currentTarget) , newTip, animateTo, 1763 position = element.data('avia-tooltip-position'), 1764 align = element.data('avia-tooltip-alignment'), 1765 newTip = false; 1766 1767 if( position == "" || typeof position == 'undefined' ) 1768 { 1769 position = this.options.position; 1770 } 1771 1772 if( align == "" || typeof align == 'undefined' ) 1773 { 1774 align = 'center'; 1775 } 1776 1777 if( this.options.event == 'click' ) 1778 { 1779 element = $(e.target); 1780 1781 if( ! element.is( '.' + this.options['class'] ) && element.parents( '.' + this.options['class'] ).length == 0 ) 1782 { 1783 if( this.active.length ) 1784 { 1785 newTip = this.active; 1786 this.active = false; 1787 } 1788 } 1789 } 1790 else 1791 { 1792 if( ! element.hasClass( 'av-close-on-click-tooltip' ) ) 1793 { 1794 newTip = element.data('avia-created-tooltip'); 1795 newTip = typeof newTip != 'undefined' ? $.AviaTooltip.openTTs[newTip] : false; 1796 } 1797 } 1798 1799 this.animate_hide_tooltip( newTip, position ); 1800 }, 1801 1802 animate_hide_tooltip: function( ttip, position ) 1803 { 1804 if(ttip) 1805 { 1806 var animate = {opacity:0}; 1807 1808 switch(position) 1809 { 1810 case "top": 1811 animate['top'] = parseInt(ttip.css('top'),10) - 10; 1812 break; 1813 case "bottom": 1814 animate['top'] = parseInt(ttip.css('top'),10) + 10; 1815 break;
1816 case "left": 1817 animate['left'] = parseInt(ttip.css('left'), 10) - 10; 1818 break; 1819 case "right": 1820 animate['left'] = parseInt(ttip.css('left'), 10) + 10; 1821 break; 1822 } 1823 1824 ttip.animate( animate, 200, function() 1825 { 1826 ttip.css({display:'none'}); 1827 }); 1828 } 1829 }, 1830 1831 stop_instant_open: function(e) 1832 { 1833 this.open = false; 1834 } 1835 }; 1836 1837})( jQuery ); 1838 1839 1840(function($) 1841{ 1842 "use strict"; 1843 1844 $( function() 1845 { 1846 /** 1847 * Performance fix to pass pagespeed test 1848 * 1849 * https://stackoverflow.com/questions/60357083/does-not-use-passive-listeners-to-improve-scrolling-performance-lighthouse-repo#62177358 1850 * @since 5.4 1851 */ 1852 $.event.special.touchstart = { 1853 setup: function( _, ns, handle ) 1854 { 1855 this.addEventListener( "touchstart", handle, { passive: !ns.includes("noPreventDefault") } ); 1856 } 1857 }; 1858 1859 $.event.special.touchmove = { 1860 setup: function( _, ns, handle ) 1861 { 1862 this.addEventListener( "touchmove", handle, { passive: !ns.includes("noPreventDefault") } ); 1863 } 1864 }; 1865 1866 $.event.special.wheel = { 1867 setup: function( _, ns, handle ) 1868 { 1869 this.addEventListener( "wheel", handle, { passive: true } ); 1870 } 1871 }; 1872 1873 $.event.special.mousewheel = { 1874 setup: function( _, ns, handle ) 1875 { 1876 this.addEventListener( "mousewheel", handle, { passive: true } ); 1877 } 1878 }; 1879 1880 }); 1881 1882})( jQuery ); 1883 1884 1885/** 1886 * Waypoints - 4.0.2 1887 * Copyright © 2011-2016 Caleb Troughton (up to 4.0.1) 1888 * Licensed under the MIT license. 1889 * https://github.com/imakewebthings/waypoints/blob/master/licenses.txt 1890 * 1891 * @since 5.2 moved to own folder /waypoints 1892 */ 1893 1894 1895// http://paulirish.com/2011/requestanimationframe-for-smart-animating/ + http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating 1896// requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel. can be removed if IE9 is no longer supported or all parallax scripts are gone 1897// MIT license 1898(function(){var lastTime=0;var vendors=['ms','moz','webkit','o'];for(var x=0;x<vendors.length&&!window.requestAnimationFrame;++x){window.requestAnimationFrame=window[vendors[x]+'RequestAnimationFrame'];window.cancelAnimationFrame=window[vendors[x]+'CancelAnimationFrame']||window[vendors[x]+'CancelRequestAnimationFrame']}if(!window.requestAnimationFrame)window.requestAnimationFrame=function(callback,element){var currTime=new Date().getTime();var timeToCall=Math.max(0,16-(currTime-lastTime));var id=window.setTimeout(function(){callback(currTime+timeToCall)},timeToCall);lastTime=currTime+timeToCall;return id};if(!window.cancelAnimationFrame)window.cancelAnimationFrame=function(id){clearTimeout(id)}}()); 1899 1900jQuery.expr.pseudos.regex = function(elem, index, match) 1901{ 1902 var matchParams = match[3].split(','), 1903 validLabels = /^(data|css):/, 1904 attr = { 1905 method: matchParams[0].match(validLabels) ? matchParams[0].split(':')[0] : 'attr', 1906 property: matchParams.shift().replace(validLabels,'') 1907 }, 1908 regexFlags = 'ig', 1909 regex = new RegExp(matchParams.join('').replace(/^\s+|\s+$/g,''), regexFlags); 1910 1911 return regex.test(jQuery(elem)[attr.method](attr.property)); 1912}; 1913
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.