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