1if (!window.console) console = { log: function( logMsg ) { } }; 2 3 4/** 5 * lazySizesConfig 6 **/ 7 window.lazySizesConfig = window.lazySizesConfig || {}; 8 window.lazySizesConfig.loadMode = 1; 9 window.lazySizesConfig.expand = 300; 10 11 12jQuery(function($) { 13 14/** 15 * README 16 * 17 * Variables: 18 * var $foo = DOM Object (div,span,section,h2 etc.) 19 * var foo = Value (Integers,Strings) 20 * 21 **/ 22 23/** 24 * Extensions 25 **/ 26 $.fn.scrollEnd = function(callback, timeout) { 27 $(this).scroll(function(){ 28 var $this = $(this); 29 if ($this.data('scrollTimeout')) { 30 clearTimeout($this.data('scrollTimeout')); 31 } 32 $this.data('scrollTimeout', setTimeout(callback,timeout)); 33 }); 34 }; 35 36/** 37 * Global variables 38 **/ 39 var $window = $( window ) 40 ,$document = $( this ) 41 ,$html = $( 'html' ) 42 ,$body = $( 'body' ) 43 ,scroll_pos = checkScrollPos() 44 ,scroll_dir = checkScrollDir() 45 ,last_scroll_pos = 0 46 ,window_width = checkWindowWidth() 47 ,window_height = checkWindowHeight() 48 ,m_breakpoint = 960 49 ,is_mobile = checkMobile( m_breakpoint ) 50 ,is_ie = GetIEVersion() > 0 ? true : false 51 ,a_cookie = Cookies.get( 'a_cookie' ) 52 ; 53 54 55 // console.log( a_cookie ); 56 57/** 58 * Animation Timings 59 * Base value in seconds (TweenMax standard), to convert to milliseconds multiply 60 * timing variable with the ms variable. 61 * 62 * ie. xslow * ms = 1200ms 63 **/ 64 var instant = 0 65 ,fast = 0.2 66 ,medium = 0.4 67 ,slow = 0.8 68 ,xslow = 1.2 69 ,ms = 1000 70 ; 71 72 73/** 74 * Conditionals 75 * Conditions to do things (ie. on specific posts, in specific environments and s
75o on) 76 **/ 77 var is_development = $body.hasClass( 'development' ) ? true : false 78 79 ; 80 81/** 82 * DOM Elements 83 * For easy access in functions etc. 84 **/ 85 86 // var $domelement = $body.find( '#dom-element' ); 87 88 89/** 90 * Helpers 91 **/ 92 function GetIEVersion() { 93 var sAgent = window.navigator.userAgent; 94 var Idx = sAgent.indexOf("MSIE"); 95 96 // If IE, return version number. 97 if (Idx > 0) 98 return parseInt(sAgent.substring(Idx+ 5, sAgent.indexOf(".", Idx))); 99 100 // If IE 11 then look for Updated user agent string. 101 else if (!!navigator.userAgent.match(/Trident\/7\./)) 102 return 11; 103 104 else 105 return 0; //It is not IE 106 } 107 108 function checkWindowHeight() { 109 var wh = $window.innerHeight(); 110 return wh; 111 } 112 113 function checkWindowWidth() { 114 var ww = $window.innerWidth(); 115 return ww; 116 } 117 118 function checkScrollPos() { 119 var pos = $window.scrollTop(); 120 return pos; 121 } 122 123 function checkMobile( breakpoint ) { 124 var mobile = false 125 if( window_width <= breakpoint ) mobile = true; 126 return mobile; 127 } 128 129 function checkScrollDir() { 130 var st = scroll_pos 131 ,dir = null 132 ; 133 st > last_scroll_pos ? dir = 'down' : dir = 'up'; 134 last_scroll_pos = st; 135 return dir; 136 } 137 138 function responsive_videos( callback ) { 139 var $videos = $body.find( 'iframe[src*="vimeo"],iframe[src*="youtube"],iframe[src*="wistia"]' ); 140 if( $videos.length > 0 ) { 141 142 $videos.each( function() { 143 144 var w = $( this ).attr( 'width' ) 145 ,h = $( this ).attr( 'height' ) 146 ,f = w > h ? 'landscape' : 'portrait' 147 ,r = h / w * 100 148 ; 149 150 if( $( this ).parent()[0].localName === 'p' ) { 151 $( this ).unwrap( 'p' ); 152 } 153 154 $( this ).wrap( '<div class="video__wrapper" style="padding-bottom: ' + r + '%" />') 155 156 157 }); // $videos.each 158 159 if( callback ) 160 callback(); 161 } 162 } // responsive_videos 163 164 function init_anims() { 165 var $anims = $body.find( '.animation' ); 166 167 // console.log( '$anims',$anims ); 168 169 if( $anims.length > 0 ) { 170 $anims.each( function() { 171 var anim_id = $( this ).attr( 'id' ) 172 ,anim_path = $( this ).attr( 'data-path' ) 173 ; 174 175 // console.log( 'id',anim_id ); 176 // console.log( 'path',anim_path ); 177 178 var animData = { 179 wrapper: document.getElementById( anim_id ), 180 animType: 'svg', 181 loop: true, 182 autoplay: true, 183 path: anim_path 184 }; 185 var anim = bodymovin.loadAnimation( animData ); 186 bodymovin.setSubframeRendering( true ); 187 }); 188 } 189 } // init_anims 190 191 function equal_heights( target,els,callback ) { 192 var h; 193 194 var $target = $( target ), 195 $els = $target.find( els ); 196 ; 197 198 $els.css( 'height','' ); 199 200 $target.each( function() { 201 h = 0; 202 203 $( this ).find( els ).each( function() { 204 if( $( this ).height() > h ) 205 h = $( this ).height(); 206 }); 207 208 $( this ).find( els ).height( h ); 209 }); 210 211 if( callback ) 212 callback( h ); 213 } // equal_heights 214 215 216/** 217 * Front-end Functions 218 **/ 219 220 // function do_something_with_dom_elements( els ) { // Do something in here } 221 // do_something_with_dom_elements( '.dom-element' ); 222 223 224 225var $tables = $body.find( 'table.tablepress' ); 226 227 228if( $tables.length > 0 ) { 229 230 231 $tables.each( function() { 232 233 $( this ).wrap( '<div class="tablepress__wrapper"></div>' ); 234 235 }); 236 237} 238 239 240 241 // Select all links with hashes 242$('a[href*="#"]') 243// Remove links that don't actually link to anything 244.not('[href="#"]') 245.not('[href="#0"]') 246.click(function(event) { 247 // On-page links 248 if ( 249 location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') 250 && 251 location.hostname == this.hostname 252 ) { 253 // Figure out element to scroll to 254 var target = $(this.hash); 255 target = target.length ? target : $('[name=' + this.hash.slice(1) + ']'); 256 // Does a scroll target exist? 257 if (target.length) { 258 // Only prevent default if animation is actually gonna happen 259 event.preventDefault(); 260 $('html, body').animate({ 261 scrollTop: target.offset().top - 250 262 }, 1000, function() { 263 // Callback after animation 264 // Must change focus! 265 var $target = $(target); 266 $target.focus(); 267 if ($target.is(":focus")) { // Checking if the target was focused 268 return false; 269 } else { 270 $target.attr('tabindex','-1'); // Adding tabindex for elements not focusable
271 $target.focus(); // Set focus again 272 }; 273 }); 274 } 275 } 276}); 277 278 279 280// MEGAMENUS 281 function close_active() { 282 if( $body.attr( 'data-menu' ) === 'open' ) { 283 var $megamenu = $body.find( '.megamenu[data-state="open"]' ); 284 285 $megamenu.css( 'height','' ); 286 287 $body.attr( 'data-menu','closed' ); 288 $body.find( 'a[data-state="open"],.megamenus[data-state="open"],.megamenu[data-state="open"],.sub-menu[data-state="open"]' ).attr( 'data-state','closed' ).css( 'height','' ); 289 $body.find( '.current-open-item' ).removeClass( 'current-open-item' ).attr( 'data-state','closed' ); 290 $body.removeClass( 'noscroll' ); 291 } 292 } // close_active 293 294 function toggle_megamenus( el,e ) { 295 var $item = $( el ) 296 // ,megamenu = '#megamenu__' + $item.find( 'a' ).attr( 'rel' ) 297 ,megamenu = '#megamenu__' + $item.attr( 'rel' ) 298 ,$megamenu = $body.find( megamenu ) 299 ,$wrap = $megamenu.closest( '.megamenus' ) 300 ; 301 302 if( $megamenu ) { 303 var state = $item.attr( 'data-state' ); 304 305 if( state !== 'open' ) { 306 307 close_active(); 308 309 $body.addClass( 'noscroll' ); 310 $body.attr( 'data-menu','open' ); 311 $item.attr( 'data-state','open' ).closest( '.menu-item' ).addClass( 'current-open-item' ); 312 $wrap.attr( 'data-state','open' ); 313 $megamenu.attr( 'data-state','open' ); 314 315 } else { 316 // if( $item.attr( 'href' ) === '#' ) { 317 // close_active(); 318 // e.preventDefault() 319 // } 320 } 321 322 } 323 } // toggle_megamenus 324 325// RESET MEGAMENUS 326 $document.on( 'click','.megamenu a[rel="close"]',function( e ) { 327 close_active(); 328 e.preventDefault(); 329 }); 330 331 $document.on( 'mouseover',function( e ) { 332 if( !is_mobile ) { 333 334 if( !$(e.target).closest( '#antar__nav-primary' ).length ) { 335 close_active(); 336 } 337 338 // if( !$(e.target).hasClass( 'megamenu' ) ) 339 340 } 341 }); // RESET MEGAMENUS 342 343// RESET MEGAMENU WHEN TOP-LEVEL MENU ITEM DOES NOT HAVE A MEGA MENU 344 $body.find( '#antar__nav-primary > li a' ).on( 'mouseover',function( e ) { 345 if( $(e.target).attr( 'rel' ) === undefined ) { 346 close_active(); 347 } 348 }); 349 350 351// TOGGLE MEGA/SUB MENUS 352 $body.find( 'nav > .menu-item a' ).on( 'mouseover', function( e ) { 353 354 var rel = $( this ).attr( 'rel' ) 355 ,has_megamenu = $( this ).closest( 'nav' ).find( '#megamenu__' + rel ).length > 0 ? true : false 356 ,has_submenu = $( this ).closest( 'li' ).find( '.sub-menu' ).length > 0 ? true : false 357 ; 358 359 360 if( has_megamenu ) { 361 toggle_megamenus( this,e ); 362 } 363 364 if( $( this ).attr( 'href' ) === '#' ) { 365 e.preventDefault(); 366 } 367 368 }); // TOGGLE MEGA/SUB MENUS 369 370 371// MENU SLIDER 372 var $_menu_slider = $body.find( '.menu__slider' ); 373 374 if( $_menu_slider.length > 0 ) { 375 376 $_menu_slider.each( function() { 377 var id = $( this ).attr( 'id' ) 378 ,$slider = $( '#' + id ) 379 ,$slides = $slider.find( '.slides' ) 380 ,$nav = $slides.closest( '.megamenu' ).find( '.mm__slide_nav' ) 381 ; 382 383 var opts = { 384 cellSelector: '.mm__column' 385 ,cellAlign: 'left' 386 ,groupCells: '100%' 387 ,prevNextButtons: false 388 ,pageDots: false 389 ,wrapAround: false 390 ,contain: true 391 ,pauseAutoPlayOnHover: false 392 ,adaptiveHeight: false 393 ,on: { 394 ready: onReady 395 ,change: onChange 396 } 397 }; // opts 398 399 400 // init flickity 401 $slides.flickity( opts ); 402 403 // setup flickity data var 404 // var data = $slider.data( 'flickity' ); 405 406 407 if( $nav.length > 0 ) { 408 409 410 // console.log( 'nav!' ); 411 412 var $next = $nav.find( 'a[href="#next"]' ) 413 ,$prev = $nav.find( 'a[href="#prev"]' ) 414 ; 415 416 417 $next.on( 'click',function(e) { 418 $slides.flickity( 'next' ); 419 e.preventDefault(); 420 }); 421 422 423 $prev.on( 'click',function(e) { 424 $slides.flickity( 'previous' ); 425 e.preventDefault(); 426 }); 427 428 } // $nav 429 430 431 // onReady 432 function onReady() { 433 } // onReady 434 435 // onChange 436 function onChange() { 437 } // onChange 438 439 }) // $_sliders.each 440 441 } // $_sliders > 0 442 443// END MEGAMENUS 444 445// MOBILE MENU TOGGLE 446 447 var $mob_menu_btn = $body.find( '.button__menu.mobile' ).on( 'click',function( e ) { 448 449 var $menu = $body.find( '#antar__nav-mobile' ) 450 ,state = $menu.attr( 'data-state' ) 451 ; 452 453 454 if( state === 'closed' ) { 455 $body.addClass( 'noscroll' ).attr( 'data-menu','open'); 456 $menu.attr( 'data-state','open' ); 457 } else { 458 $body.removeClass( 'noscroll' ).attr( 'data-menu',''); 459 $menu.attr( 'data-state','closed' ); 460 461 // $body.trigger( 'menuClick' ); 462 } 463 464 e.preventDefault(); 465 }); 466// MOBILE MENU SLIDER
467 var $_mob_menu_slider = $body.find( '#antar__nav-mobile .top-level-nav .links' ); 468 469 if( $_mob_menu_slider.length > 0 ) { 470 471 $_mob_menu_slider.each( function() { 472 var id = $( this ).attr( 'id' ) 473 ,$slider = $( '#' + id ) 474 // ,$slides = $slider.find( '.slides' ); 475 ,$slides = $slider 476 // ,$nav = $slides.closest( '.layout' ).find( '.slides__nav' ) 477 ; 478 479 var opts = { 480 cellSelector: '.feature' 481 ,cellAlign: 'left' 482 ,groupCells: '100%' 483 ,prevNextButtons: false 484 ,pageDots: false 485 ,wrapAround: false 486 ,contain: true 487 ,pauseAutoPlayOnHover: false 488 ,adaptiveHeight: true 489 ,on: { 490 ready: onReady 491 ,change: onChange 492 } 493 }; // opts 494 495 496 if( $slides.find( '.feature' ).length > 0 ) { 497 // init flickity 498 $slides.flickity( opts ); 499 } 500 501 // $body.on( 'menuClick',function() { 502 // $slides.flickity( 'resize' ); 503 // }); 504 505 // setup flickity data var 506 // var data = $slider.data( 'flickity' ); 507 508 // onReady 509 function onReady() { 510 } // onReady 511 512 // onChange 513 function onChange() { 514 } // onChange 515 516 }) // $_sliders.each 517 518 519 520 $body.find( 'a[rel="mob-mega"]' ).on( 'click',function( e ) { 521 522 523 var $parent = $( this ).closest( '.top-level-nav' ) 524 ,state = $parent.attr( 'data-state' ) 525 526 527 if( state === 'closed' ) { 528 $parent.attr( 'data-state','open' ); 529 $( this ).find( 'span' ).text( 'CLOSE' ); 530 } else { 531 $parent.attr( 'data-state','closed' ); 532 $( this ).find( 'span' ).text( 'OPEN' ); 533 } 534 535 e.preventDefault(); 536 537 }); 538 539 540 } // $_sliders > 0 541 542 543// TIMELINES 544 545 546 $body.find( 'a[rel="timeline"]' ).on( 'click',function( e ) { 547 548 549 var target = $( this ).attr( 'href' ) 550 ,$target = $( target ) 551 ,state = $target.attr( 'data-state' ) 552 ; 553 554 555 556 if( state !== 'open' ) { 557 $body.addClass( 'noscroll' ); 558 $target.attr( 'data-state','open' ); 559 // $body.find( '.timeline__spacer' ).height( $target.height() ); 560 // $window.scrollTop( $target.offset().top ); 561 } else { 562 $body.removeClass( 'noscroll' ); 563 $target.scrollTop(0); 564 $target.attr( 'data-state','closed' ); 565 // $body.find( '.timeline__spacer' ).height(0); 566 } 567 568 569 e.preventDefault(); 570 571 572 }); 573 574 // var $_tl_slider = $body.find( '.timeline .slider' ); 575 576 // if( $_tl_slider.length > 0 ) { 577 578 // $_tl_slider.each( function() { 579 // var id = $( this ).attr( 'id' ) 580 // ,$slider = $( '#' + id ) 581 // ,$slides = $slider.find( '.slides' ); 582 // // ,$nav = $slides.closest( '.layout' ).find( '.slides__nav' ) 583 // ; 584 585 // var opts = { 586 // cellSelector: '.timeline__event' 587 // ,cellAlign: 'left' 588 // ,groupCells: '100%' 589 // ,prevNextButtons: false 590 // ,pageDots: false 591 // ,wrapAround: false 592 // ,contain: true 593 // ,freeScroll: true 594 // ,pauseAutoPlayOnHover: false 595 // ,adaptiveHeight: false 596 // ,on: { 597 // ready: onReady 598 // ,change: onChange 599 // } 600 // }; // opts 601 602 603 // // init flickity 604 // $slides.flickity( opts ); 605 606 // // setup flickity data var 607 // // var data = $slider.data( 'flickity' ); 608 609 // // onReady 610 // function onReady() { 611 612 // // console.log( 'onReady',height ); 613 // equal_heights( $body.find( '.timeline' ),'.event__content',function( h ) {}); 614 615 // setTimeout( function() { 616 // $slides.flickity( 'resize' ); 617 // },100 ); 618 619 // } // onReady 620 621 // // onChange 622 // function onChange() { 623 // } // onChange 624 625 // }) // $_sliders.each 626 627 // } // $_sliders > 0 628 629 630// ACCORDIONS 631 var $accordion = $body.find( '.accordion' ); 632 633 if( $accordion.length > 0 ) { 634 635 $accordion.each( function() { 636 637 var id = $( this ).attr( 'id' ) 638 ,$this = $( '#' + id ) 639 640 $this.find( '.accordion__item-title' ).on( 'click', function( e ) { 641 642 var state = $( this ).closest( '.accordion__item' ).attr( 'data-state' ); 643 644 if( state !== 'open' ) { 645 $( this ).closest( '.accordion__item' ).attr( 'data-state','open' ); 646 } else { 647 $( this ).closest( '.accordion__item' ).attr( 'data-state','closed' ); 648 } 649 650 e.preventDefault(); 651 }); 652 653 654 }); 655 656 } // ACCORDIONS 657 658 659// PEOPLE CONTENT 660 661 $body.find( 'a[rel="person__content"]' ).on( 'click',function( e ) { 662 663 var id = $( this ).closest( '.person__content' ).attr( 'id' ) 664 ,state = $( '#' + id ).attr( 'data-state' ) 665 ; 666 667 // console.log( id,state ); 668 669 if( state !== 'open' ) { 670 $( this ).closest( '.person__content' ).attr( 'data-state','open' ); 671 $( this ).find( 'span' ).text( 'Read less' ); 672 } else { 673 $( this ).closest( '.person__content' ).attr( 'data-state','closed' ); 674 $( this ).find( 'span' ).text( 'Read more' ); 675 } 676 677 e.preventDefault(); 678 679 680 }); 681 682 683// AUTHOR CONTENT 684 685 $body.find( 'a[rel="author__content"]' ).on( 'click',function( e ) { 686 687 var id = $( this ).closest( '.description' ).attr( 'id' ) 688 ,state = $( '#' + id ).attr( 'data-state' ) 689 ; 690 691 // console.log( id,state ); 692 693 if( state !== 'open' ) { 694 $( this ).closest( '.description' ).attr( 'data-state','open' ); 695 $( this ).find( 'span' ).text( 'Read less' ); 696 } else { 697 $( this ).closest( '.description' ).attr( 'data-state','closed' ); 698 $( this ).find( 'span' ).text( 'Read more' ); 699 } 700 701 e.preventDefault(); 702 703 704 }); 705 706
707// IMAGE + STATEMENT LAYOUT 708 709 function getRandomInt (min, max) { 710 return Math.floor(Math.random() * (max - min + 1)) + min; 711 } 712 713 var randomOrder = function(element) { 714 715 // Viewport Dimensions 716 var vpHeight = window.innerHeight; 717 var vpWidth = window.innerWidth; 718 719 // Image Position 720 var xPos = getRandomInt(0, vpWidth - element.offsetWidth ); 721 var yPos = getRandomInt(0, vpHeight - element.offsetHeight ); 722 var zIndex = getRandomInt(0,13); 723 724 element.style.cssText += '--x-position:' + xPos + 'px; --y-position:' + yPos + 'px; z-index:' + zIndex; 725 }; 726 727 728 function random_order( element ) { 729 730 var $el = $( element ) 731 ,$parent = $el.closest( '.wrapper' ); 732 733 734 // write_log( $el ); 735 // console.log( $el.width(),$el.height() ); 736 737 738 // Dimensions 739 var h = $parent.outerHeight() 740 ,w = $parent.outerWidth() 741 742 743 // console.log( '.wrapper',w,h ); 744 745 746 // Position 747 var x = getRandomInt( 0,w - $el.width() ) 748 ,y = getRandomInt( 0,h - $el.height() ) 749 ,z = getRandomInt( 0,13 ) 750 ; 751 752 753 $el.css({ 754 '--x-pos': x + 'px' 755 ,'--y-pos': y + 'px' 756 ,'z-index': z 757 }); 758 759 760 } 761 762 // Setup 763 764 $body.find( '.layout__image_statement' ).each( function(){ 765 var $this = $( this ); 766 767 $this.find( '.images img' ).each(function(){ 768 // $(this ).on( 'load',function() { 769 random_order( this ); 770 // }); 771 }); 772 773 }); 774 // var imgs = document.querySelectorAll('img'); 775 776 // imgs.forEach((the_img) => { 777 778 // window.addEventListener('load', function() { 779 // randomOrder(the_img); 780 // }); 781 782 // }); //end foreach 783 784/** 785 * SITE_INIT 786 * Fires on DOM Ready. 787 * Any functions or scripts that need to fire on load goes here. 788 **/ 789 function site_init( callback ) { 790 791 // init_complete Event 792 $document.trigger( 'init_complete' ); 793 794// FILTER DROPDOWNS 795 $body.find( '.filter__dropdown' ).on( 'change',function( e ) { 796 797 var val = $( this ).val(); 798 799 // console.log( 'val',val ); 800 801 window.location = val; 802 803 }); 804 805// HEADER 806 807 // SEARCH FORM 808 var $searchbtn = $body.find( 'a[rel="searchform"]' ); 809 810 $searchbtn.on( 'click',function( e ) { 811 812 var $form = $( this ).closest( '#antar__search' ) 813 ,state = $form.attr( 'data-state' ) 814 ; 815 816 if( state === 'open' ) { 817 $form.attr( 'data-state','closed' ); 818 } else { 819 $form.attr( 'data-state','open' );
820 // $form.find( 'input' ).focus(); 821 } 822 823 824 $form.find( 'input[type="text"]' ).on( 'blur',function( e ) { 825 var val = $( this ).val(); 826 827 if(! val ) { 828 $searchbtn.trigger( 'click' ); 829 } else { 830 setTimeout( function() { 831 $searchbtn.trigger( 'click' ); 832 },1500) 833 } 834 }); 835 836 e.preventDefault(); 837 }); 838 839 // MENU BUTTON 840 var $menubtn = $body.find( 'a[rel="menu"]' ); 841 842 $menubtn.on( 'click',function( e ) { 843 844 var $header = $body.find( 'header[role="banner"]' ) 845 ,state = $header.attr( 'data-state' ) 846 ; 847 848 // console.log( 'state',state ); 849 850 if( state === 'minimal' ) { 851 $header.attr( 'data-state','full' ); 852 } 853 854 e.preventDefault(); 855 }); 856 857 858// SLIDESHOWS 859 var $_sliders = $body.find( '[class*="slider"]' ); 860 861 if( $_sliders.length > 0 ) { 862 863 $_sliders.each( function() { 864 var id = $( this ).attr( 'id' ) 865 ,$slider = $( '#' + id ) 866 ,$slides = $slider.find( '.slides' ); 867 // ,$nav = $slides.closest( '.layout' ).find( '.slides__nav' ) 868 ; 869 870 var opts = { 871 cellSelector: '.block' 872 ,cellAlign: 'left' 873 ,groupCells: '100%' 874 ,freeScroll: true 875 ,prevNextButtons: false 876 ,pageDots: false 877 ,wrapAround: false 878 ,contain: true 879 ,pauseAutoPlayOnHover: false 880 ,adaptiveHeight: true 881 ,on: { 882 ready: onReady 883 ,change: onChange 884 } 885 }; // opts 886 887 888 // init flickity 889 $slides.flickity( opts ); 890 891 // setup flickity data var 892 // var data = $slider.data( 'flickity' ); 893 894 // console.log( slides ); 895 // console.log( data ); 896 897 // onReady 898 function onReady() { 899 } // onReady 900 901 // onChange 902 function onChange() { 903 } // onChange 904 905 906 // console.log( '$nav',$nav ); 907 908 // if( $nav.length > 0 ) { 909 910 // var $next = $nav.find( 'a[href="#next"]' ) 911 // ,$prev = $nav.find( 'a[href="#previous"]' ) 912 // ; 913 914 // $next.on( 'click',function( e ) { 915 // $slides.flickity( 'next' ); 916 // e.preventDefault(); 917 // }); 918 919 // $prev.on( 'click',function( e ) { 920 // $slides.flickity( 'previous' ); 921 // e.preventDefault(); 922 // }); 923 924 925 // } 926 927 928 }) // $_sliders.each 929 930 } // $_sliders > 0 931 932 933 934 // Run callback 935 if( callback ) callback(); 936 } 937 938 939// LOAD 940 $document.imagesLoaded( function() { 941 console.log( 'Images Loadedâ¦' ); 942 $body.toggleClass( 'loading loaded' ); 943 944 945 // equal_heights( '.issues__listings','.intro' ); 946 // equal_heights( '.issues__listings','.layout__issue-panel' ); 947 }); // imagesLoaded 948 949 $window.load(function() { 950 console.log( 'All Loadedâ¦' ); 951 // Moved to imagesLoaded as the load() event only fires once per session in Safari/Firefox 952 // $body.toggleClass( 'loading loaded' ); 953 954 955 // CART BUTTON 956 var $cartbtn; 957 // console.log( 'cartbtn',$cartbtn ); 958 959 960 // if( $cartbtn.length > 0 ) { 961 962 wp.hooks.addAction('on.cartUpdate', 'shopwp', function (cartState) { 963 $cartbtn = $body.find( '.swp-cart-icon' ); 964 $cartbtn.closest( '#shopwp-root' ).show(); 965 }); 966 967 wp.hooks.addAction('on.cartLoad', 'shopwp', function (cartState) { 968 969 $cartbtn = $body.find( '.swp-cart-icon' ); 970
971 // console.log('on.cartLoad', cartState) 972 // console.log('on.cartLoad > total', cartState.total) 973 974 var cartCount = parseInt( $cartbtn.find( '.swp-cart-counter-text').text() ); 975 976 console.log( 'cartLoad', cartCount); 977 978 if( cartCount > 0 ) { 979 $cartbtn.closest( '#shopwp-root' ).show(); 980 } else { 981 $cartbtn.closest( '#shopwp-root' ).hide(); 982 } 983 }) 984 985 986 wp.hooks.addAction( 'on.itemsLoad','shopwp',function(payload,settings) { 987 // console.log( 'on.itemsLoad',payload ); 988 // $body.find( '.back' ).show(); 989 $body.find( '#product_author' ).show(); 990 $body.find( '#product-gallery' ).show(); 991 $body.find( '.social__sharing' ).show(); 992 $body.find( '.skeleton' ).hide(); 993 // $body.find( '.wps-product-single-content,.wps-product-single-gallery' ).animate({ opacity: 1 },800); 994 }); 995 996 997 // FORMS 998 var $_hbsptForm = $body.find( '.hbspt-form' ); 999 if( $_hbsptForm.length > 0 ) { 1000 1001 // console.log( 'FOUND HBSPT FORM' ); 1002 1003 $body.on( 'focus','.hs-form-field input',function( e ) { 1004 $( this ).closest( '.hs-form-field' ).addClass( 'focus' ) 1005 // console.log( 'HBSPT Form Field input',$( this ).val() ); 1006 }); 1007 1008 $body.on( 'blur','.hs-form-field input',function( e ) { 1009 $( this ).closest( '.hs-form-field' ).removeClass( 'focus input' ); 1010 if( $( this ).val() ) { 1011 $( this ).closest( '.hs-form-field' ).addClass( 'has-value' ); 1012 } else { 1013 $( this ).closest( '.hs-form-field' ).removeClass( 'has-value' ); 1014 } 1015 // console.log( 'HBSPT Form Field input',$( this ).val() ); 1016 }); 1017 1018 $body.on( 'input','.hs-form-field input',function( e ) { 1019 $( this ).closest( '.hs-form-field' ).addClass( 'input' ) 1020 // console.log( 'HBSPT Form Field input',$( this ).val() ); 1021 }); 1022 } // FORMS 1023 1024 }); // load 1025 1026 1027// FACETWP 1028 1029 $document.on('facetwp-refresh', function() { 1030 // console.log( 'facetwp-refresh' ); 1031 if (FWP.soft_refresh == true) { 1032 FWP.enable_scroll = true; 1033 } else { 1034 FWP.enable_scroll = false; 1035 } 1036 // $body.css({ backgroundColor: 'lime' }); 1037 $body.find( '.facetwp-template' ).addClass( 'is__loading' ); 1038 }); 1039 1040 $document.on('facetwp-loaded', function() { 1041 // console.log( 'facetwp-loaded' ); 1042 if (FWP.enable_scroll == true) { 1043 $('html, body').animate({ 1044 scrollTop: 0 1045 }, 500); 1046 } 1047 $body.find( '.facetwp-template' ).removeClass( 'is__loading' ); 1048 }); 1049 1050 1051// DOM READY 1052 $document.ready( function() { 1053 console.log( 'DOM Readyâ¦' ); 1054 site_init( function( ) { 1055 // console.log( event ); 1056 $document.trigger( 'init_callback_complete' ); 1057 responsive_videos(); 1058 init_anims(); 1059 1060 // console.log( a_cookie ); 1061 1062 1063 if( a_cookie === undefined ) { 1064 $body.find( '#acknowledgement' ).attr( 'data-state','open' ); 1065 $body.addClass( 'noscroll' ); 1066 } else { 1067 $body.find( '#acknowledgement' ).attr( 'data-state','closed' ); 1068 } 1069 1070 $body.find( 'a[rel="overlay"]' ).on( 'click',function(e) { 1071 var target = $( this ).attr( 'href' ) 1072 ,$target = $( target ) 1073 ,state = $target.attr( 'data-state' ) 1074 ; 1075 1076 1077 if( target === '#acknowledgement' && a_cookie === undefined ) { 1078 Cookies.set( 'a_cookie',1 ); 1079 a_cookie = Cookies.get( 'a_cookie' ); 1080 } 1081 1082 if( state === 'open' ) { 1083 $target.attr( 'data-state','closed' ); 1084 $body.removeClass( 'noscroll' ); 1085 // console.log( a_cookie ); 1086 } else { 1087 $target.attr( 'data-state','open' ); 1088 $body.addClass( 'noscroll' ); 1089 } 1090 1091 e.preventDefault(); 1092 1093 }); 1094 }); 1095 1096 1097 1098 1099// IE CHECK 1100 if( is_ie ) $html.addClass( 'ie' ); 1101 1102 1103// SCROLL EVENTS 1104 $window.on( 'scroll',function() { 1105 // Update scrollPos 1106 scroll_pos = checkScrollPos(); 1107 scroll_dir = checkScrollDir(); 1108 // Do stuff... 1109 1110 if( $body.find( '#header__minimal' ).length > 0 ) { 1111 if( scroll_pos >= $( 'header[role="banner"]' ).outerHeight() ) { 1112 if(! $( 'header[role="banner"]' ).attr( 'data-state' ) !== 'minimal' ) { 1113 $( 'header[role="banner"]' ).attr( 'data-state','minimal' ); 1114 } 1115 } else { 1116 $( 'header[role="banner"]' ).attr( 'data-state','full' ); 1117 } 1118 } 1119 1120 }); // Scroll 1121 1122// SCROLL ENDED 1123 // Set delay after scroll has ended (ms) 1124 var scrollend_delay = 250; 1125 $window.scrollEnd( function() { 1126 // Scroll has ended, do stuff.. 1127 },scrollend_delay ); 1128 1129 1130// WINDOW RESIZE 1131 $window.on( 'resize',function() { 1132 1133 // Check if actual window width changes size 1134 // (Prevent width-based events to fire on collapsing chrome on iOS) 1135 if( checkWindowWidth() !== window_width ) { 1136 // Update window_width & window_height 1137 window_width = checkWindowWidth(); 1138 window_height = checkWindowHeight(); 1139 is_mobile = checkMobile( m_breakpoint ); 1140 // Do stuff... 1141 } 1142 1143 1144 // equal_heights( '.issues__listings','.intro' ); 1145 // equal_heights( '.issues__listings','.layout__issue-panel' ); 1146 1147 }); // Resize 1148 1149 1150// GIVE 1151 $_iframe = $body.find( 'iframe[name*="give-embed"]' ); 1152 1153 if( $_iframe.length > 0 ) { 1154 // console.log( 'GIVEWP IFRAME' ); 1155 } 1156 1157 1158// SHOPWP 1159 1160 // var $cartbtn = $body.find( '[class*="CartIconFixed"]' ); 1161 1162 1163 1164 }); // DOM Ready 1165}); // jQuery($)
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.