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