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