1$(document).ready(function(){ 2 3 setTimeout(function(){ 4 if( $('.header-util').hasClass('has-alert') ){ 5 $('.alert-box').addClass('animate'); 6 } 7 }, 2000); 8 9 10 function resizeFunctions(){ 11 var navBoxHeight = $("#fixed-header-wrap").outerHeight(); 12 $('main').css('margin-top', navBoxHeight); 13 $('.mobile-navigation').css('height', window.outerHeight - navBoxHeight); 14 15 $('.text-with-4blocks').each(function(){ 16 var copy = $(this).find('.blocks .block-copy'); 17 var maxHeight = 0; 18 19 copy.css('height', 'auto').each(function(){ 20 if( $(this).outerHeight() > maxHeight ) maxHeight = $(this).outerHeight(); 21 }); 22 23 copy.css('height', maxHeight); 24 }); 25 26 $('.image-blocks').each(function(){ 27 var copy = $(this).find('.block-wrapper .block-copy'); 28 var maxHeight = 0; 29 30 copy.css('height', 'auto').each(function(){ 31 if( $(this).outerHeight() > maxHeight ) maxHeight = $(this).outerHeight(); 32 }); 33 34 copy.css('height', maxHeight); 35 }); 36 37 $('.blue-callouts').each(function(){ 38 var copy = $(this).find('.inner .content'); 39 var maxHeight = 0; 40 41 copy.css('height', 'auto'); 42 43 if( window.innerWidth >= 992 ){ 44 copy.each(function(){ 45 if( $(this).outerHeight() > maxHeight ) maxHeight = $(this).outerHeight(); 46 }); 47 48 copy.css('height', maxHeight); 49 } 50 }); 51 52 $('.donation-info-block .icon-blocks').each(function(){ 53 var copy = $(this).find('.copy-wrap'); 54 var maxHeight = 0; 55 56 copy.css('height', 'auto'); 57 58 if( window.innerWidth >= 992 ){ 59 copy.each(function(){ 60 if( $(this).outerHeight() > maxHeight ) maxHeight = $(this).outerHeight(); 61 }); 62 63 copy.css('height', maxHeight); 64 } 65 }); 66 67 $('.wide-images-text').each(function(){ 68 var copy = $(this).find('.copy-wrap'); 69 var maxHeight = 0; 70 71 copy.css('height', 'auto'); 72 73 if( window.innerWidth >= 992 ){ 74 copy.each(function(){ 75 if( $(this).outerHeight() > maxHeight ) maxHeight = $(this).outerHeight(); 76 }); 77 78 copy.css('height', maxHeight); 79 } 80 }); 81 82 $('.program-blocks').each(function(){ 83 var copy = $(this).find('.content-text'); 84 var maxHeight = 0; 85 86 copy.css('height', 'auto'); 87 88 if( window.innerWidth >= 992 ){ 89 copy.each(function(){ 90 if( $(this).outerHeight() > maxHeight ) maxHeight = $(this).outerHeight(); 91 }); 92 93 copy.css('height', maxHeight); 94 } 95 }); 96 97 teamBlockResize(); 98 } 99 100 resizeFunctions(); 101 102 function teamBlockResize(){ 103 $('.team-grid').each(function(){ 104 var copy = $(this).find('.team-block .team-text'); 105 var maxHeight = 0; 106 107 copy.css('height', 'auto'); 108 109 if( window.innerWidth >= 992 ){ 110 copy.each(function(){ 111 if( $(this).outerHeight() > maxHeight ) maxHeight = $(this).outerHeight(); 112 }); 113 114 copy.css('height', maxHeight); 115 } 116 }); 117 118 $('.people-grid').each(function(){ 119 var copy = $(this).find('.people-card .people-text'); 120 var maxHeight = 0; 121 122 copy.css('height', 'auto'); 123 124 if( window.innerWidth >= 992 ){ 125 copy.each(function(){ 126 if( $(this).outerHeight() > maxHeight ) maxHeight = $(this).outerHeight(); 127 }); 128 129 copy.css('height', maxHeight); 130 } 131 }); 132 133 $('.people-grid-component').each(function(){ 134 var copy = $(this).find('.people-block .people-text .text-wrap'); 135 var maxHeight = 0; 136 137 copy.css('height', 'auto'); 138 139 if( window.innerWidth >= 992 ){ 140 copy.each(function(){ 141 if( $(this).outerHeight() > maxHeight ) maxHeight = $(this).outerHeight(); 142 }); 143 144 copy.css('height', maxHeight); 145 } 146 147 148 var copy = $(this).find('.people-block .people-text'); 149 var maxHeight = 0; 150 151 copy.css('height', 'auto'); 152 153 if( window.innerWidth >= 992 ){ 154 copy.each(function(){ 155 if( $(this).outerHeight() > maxHeight ) maxHeight = $(this).outerHeight(); 156 }); 157 158 copy.css('height', maxHeight); 159 } 160 }); 161 162 163 } 164 165 window.addEventListener('resize', function(event){ 166 resizeFunctions(); 167 168 if( PageFlipper ){ 169 PageFlipper.setWrapperHeight(); 170 } 171 });
172 173 $('.text-with-4blocks .mobile-blocks').slick({ 174 dots: true, 175 arrows: false, 176 slidesToShow: 1, 177 slidesToScroll: 1, 178 infinite: true, 179 autoplay: true, 180 autoplaySpeed: 5000 181 }); 182 183 $('.success-stories .success-stories-mobile').slick({ 184 dots: true, 185 arrows: false, 186 slidesToShow: 1, 187 slidesToScroll: 1, 188 infinite: true, 189 autoplay: true, 190 autoplaySpeed: 5000 191 }); 192 193 $('.story-slides').slick({ 194 dots: false, 195 arrows: true, 196 infinite: true, 197 speed: 300, 198 slidesToShow: 3, 199 slidesToScroll: 1, 200 prevArrow: '.story-prev', 201 nextArrow: '.story-next', 202 centerMode: true, 203 centerPadding: '0px;', 204 205 responsive: [ 206 { 207 breakpoint: 992, 208 settings: { 209 slidesToShow: 3, 210 slidesToScroll: 3 211 } 212 }, 213 { 214 breakpoint: 768, 215 settings: { 216 slidesToShow: 3, 217 slidesToScroll: 3 218 } 219 }, 220 { 221 breakpoint: 480, 222 settings: { 223 slidesToShow: 3, 224 slidesToScroll: 3 225 } 226 } 227 ], 228 }); 229 230 231 // icon carousel functions 232 233 $(".icon-carousel").on("init", function(event, slick){ 234 if( slick.slideCount <= slick.options.slidesToShow ){ 235 console.log("not enough slides: hiding arrows"); 236 $(this).parent().find(".icon-carousel-arrows").removeClass("active"); 237 } else { 238 console.log("showing arrows"); 239 $(this).parent().find(".icon-carousel-arrows").addClass("active"); 240 } 241 }); 242 243 $(".icon-carousel").on("breakpoint", function(event, slick, breakpoint){ 244 if( slick.slideCount <= slick.options.slidesToShow ){ 245 console.log("not enough slides: hiding arrows"); 246 $(this).parent().find(".icon-carousel-arrows").removeClass("active"); 247 } else { 248 console.log("showing arrows"); 249 $(this).parent().find(".icon-carousel-arrows").addClass("active"); 250 } 251 }); 252 253 $('.icon-carousel').each( function(){ 254 var nextButton = $(this).parent().find(".icon-next"); 255 var prevButton = $(this).parent().find(".icon-prev"); 256 257 $(this).slick({ 258 dots: true, 259 arrows: true, 260 infinite: true, 261 speed: 300, 262 slidesToShow: 6, 263 slidesToScroll: 1, 264 prevArrow: prevButton, 265 nextArrow: nextButton, 266 centerMode: false, 267 centerPadding: '0px;', 268 269 responsive: [ 270 { 271 breakpoint: 992, 272 settings: { 273 slidesToShow: 4, 274 slidesToScroll: 1 275 } 276 }, 277 { 278 breakpoint: 768, 279 settings: { 280 slidesToShow: 3, 281 slidesToScroll: 1 282 } 283 }, 284 { 285 breakpoint: 540, 286 settings: { 287 slidesToShow: 1, 288 slidesToScroll: 1 289 } 290 } 291 ] 292 }); 293 294 }); 295 296 297 298 299 $('.story-slides').on('afterChange', function(event,slick,currentSlide, nextSlide){ 300 var thing = $('.story-slides .slick-current').next().attr('data-story'); 301 $('.story-contents').find('div').removeClass('active'); 302 $('.story-contents').children('[data-story=' + thing + ']').addClass('active'); 303 304 }); 305 306 $(".expander").on("click", function(){ 307 var parent = $(this).parent(); 308 309 if( parent.hasClass('active') ){ 310 parent.removeClass('active'); 311 } else { 312 parent.addClass('active'); 313 } 314 });
315 316 $('.find-location-bar a').on('click', function(e){ 317 e.preventDefault(); 318 var loc = $('.find-location-bar input[name=zip]').val(); 319 320 if( loc ){ 321 loc = encodeURIComponent(loc); 322 window.location.href = document.location.origin + "/locations/?zip=" + loc; 323 } else { 324 window.location.href = document.location.origin + "/locations/"; 325 } 326 }); 327 328 $('.career-center-bar a').on('click', function(e){ 329 e.preventDefault(); 330 $('.career-center-bar input[name=zip]').removeClass('field-error'); 331 var loc = $('.career-center-bar input[name=zip]').val(); 332 var distance = $('.career-center-bar select').val(); 333 var locType = $('.career-center-bar input[name=location_type]').val(); 334 335 if( loc ){ 336 loc = encodeURIComponent(loc); 337 var url = document.location.origin + "/locations/?zip=" + loc + "&distance=" + distance + "&location_type=" + locType; 338 window.location.href = url; 339 } else { 340 $('.career-center-bar input[name=zip]').addClass('field-error'); 341 } 342 }); 343 344 $('.donate-bar .amt').on('click', function(e){ 345 e.preventDefault(); 346 var amount = $(this).data('amt'); 347 348 if( amount === "other" ){ 349 window.location.href = document.location.origin + "/ways-to-support/monetary-giving/form-online-donation/"; 350 } else if( amount ) { 351 var url = document.location.origin + "/ways-to-support/monetary-giving/form-online-donation/?amt=" + amount; 352 window.location.href = url; 353 } 354 }); 355 356 $('.donate-bar a').on('click', function(e){ 357 e.preventDefault(); 358 var url = document.location.origin + "/ways-to-support/monetary-giving/form-online-donation/"; 359 window.location.href = url; 360 }); 361 362 if( $('.form-page').length > 0 ){ 363 console.log('what'); 364 var amount = getParameterByName('amt'); 365 366 if( amount ){ 367 // loop and check for field because it takes a bit to load 368 var amountLoop = setInterval(function(){ 369 if( $('input[name=donation-amount]').length > 0 ){ 370 $('input[name=donation-amount]').val(parseInt(amount)); 371 clearInterval(amountLoop); 372 } 373 374 }, 500); 375 } 376 } 377 378 $('.donate-bar .amt').on('click', function(){ 379 $('.donate-bar .amt').removeClass('active'); 380 $(this).addClass('active'); 381 }); 382 383 // $('.header-util .give-button').on('click', function(e){ 384 // e.preventDefault(); 385 // var db = $('.donate-bar'); 386 // $('.find-location-bar').removeClass('active'); 387 // closeSearchBar(); 388 389 // if( db.hasClass('active') ){ 390 // db.removeClass('active'); 391 // } else { 392 // db.addClass('active'); 393 // } 394 // }); 395 396 $('.header-util .find-location-button').on('click', function(e){ 397 e.preventDefault(); 398 var db = $('.find-location-bar'); 399 $('.donate-bar').removeClass('active'); 400 closeSearchBar(); 401 402 if( db.hasClass('active') ){ 403 db.removeClass('active'); 404 } else { 405 db.addClass('active'); 406 } 407 }); 408 409 $('.header .find-location-button-mobile, .header .find-location-button-close').on('click', function(e){ 410 e.preventDefault(); 411 var fl = $('.find-location-bar'); 412 $('.donate-bar,.search-bar').removeClass('active'); 413 414 if( fl.hasClass('active') ){ 415 closeLocationBar(); 416 } else { 417 openLocationBar(); 418 } 419 }) 420 421 $('.header .search-button, .header .search-button-close').on('click', function(e){ 422 e.preventDefault(); 423 var sb = $('.search-bar'); 424 $('.donate-bar,.find-location-bar').removeClass('active'); 425 426 if( sb.hasClass('active') ){ 427 closeSearchBar(); 428 } else { 429 openSearchBar(); 430 } 431 }) 432 433 $('.header .mobile-menu-button, .header .mobile-menu-close').on('click', function(e){
434 e.preventDefault(); 435 var m = $('.mobile-navigation'); 436 $('.donate-bar,.find-location-bar,.search-bar').removeClass('active'); 437 438 if( m.hasClass('active') ){ 439 m.removeClass('active'); 440 $('.icon-links-li[data-menu=mobile-menu]').removeClass('active'); 441 } else { 442 m.addClass('active'); 443 $('.icon-links-li[data-menu=mobile-menu]').addClass('active'); 444 } 445 }) 446 447 function closeSearchBar(){ 448 $('.search-bar').removeClass('active'); 449 $('.icon-links-li[data-menu=search-dropdown]').removeClass('active'); 450 } 451 452 function openSearchBar(){ 453 $('.search-bar').addClass('active'); 454 $('.icon-links-li[data-menu=search-dropdown]').addClass('active'); 455 } 456 457 function closeLocationBar(){ 458 $('.find-location-bar').removeClass('active'); 459 $('.icon-links-li[data-menu=location-dropdown]').removeClass('active'); 460 } 461 462 function openLocationBar(){ 463 $('.find-location-bar').addClass('active'); 464 $('.icon-links-li[data-menu=location-dropdown]').addClass('active'); 465 } 466 467 // color of the Week 468 var currentTime = new Date(); 469 var day = currentTime.getDay(); 470 471 // check if today is sunday or monday 472 if( day === 0 || day === 1 ){ 473 $('.cotw-slider').addClass('active'); 474 } 475 476 $('.team-switcher .switcher-button').on('click', function(){ 477 if( !$(this).hasClass('active') ){ 478 $('.team-switcher .switcher-button').removeClass('active'); 479 $(this).addClass('active'); 480 481 if( $(this).hasClass('board') ){ 482 $('.team-grid.board-of-directors').addClass('active'); 483 $('.team-grid.executive-staff').removeClass('active'); 484 $('.board-text').addClass('active'); 485 $('.executive-text').removeClass('active'); 486 $('.team-grid.lifetime-members').addClass('active'); 487 $('.lmtext').addClass('active'); 488 } else { 489 $('.team-grid.board-of-directors').removeClass('active'); 490 $('.team-grid.executive-staff').addClass('active'); 491 $('.board-text').removeClass('active'); 492 $('.executive-text').addClass('active') 493 $('.team-grid.lifetime-members').removeClass('active'); 494 $('.lmtext').removeClass('active'); 495 } 496 } 497 498 teamBlockResize(); 499 }); 500 501 $('.e2ma_signup_form_element input[name=email]').attr('placeholder', 'Enter Email'); 502 $('.e2ma_signup_form_button').addClass("btn").addClass('btn-white'); 503 504 // handle mobile Menu 505 $('.mobile-navigation .mobile-link-main').on('click', function(e){ 506 e.preventDefault(); 507 $('.mobile-navigation .mobile-link-main').removeClass('active'); 508 $(this).addClass('active'); 509 510 $('.mobile-link-content').removeClass('active'); 511 $('.mobile-link-content[data-linkid=' + $(this).attr('data-linkid') + ']').addClass('active'); 512 $('.mobile-link-contents').addClass('active'); 513 }) 514 515 $('.mobile-link-back').on('click', function(e){ 516 e.preventDefault(); 517 $('.mobile-navigation .mobile-link-main').removeClass('active'); 518 $('.mobile-link-contents').removeClass('active'); 519 }); 520 521 // Accordions, click and keypress 522 $(".accordion-expand-trigger").keypress(function (e) { 523 if (e.which == 13) { 524 console.log(e.which); 525 $(this).parents('.accordion-item').toggleClass('is-open'); 526 }; 527 }); 528 529 $('.accordion-expand-trigger').click(function () { 530 $(this).parents('.accordion-item').toggleClass('is-open'); 531 }); 532 533 534 var logoSliderCount = 0; 535 536 $('.logos-slider').each(function(){ 537 logoSliderCount++; 538 539 var el = $(this); 540 var slideCount = 6; 541 542 if( el.hasClass('small') ){ 543 slideCount = 8; 544 } else if( el.hasClass('large') ){ 545 slideCount = 4; 546 } 547 548 var prevClass = 'logo-slider-prev' + logoSliderCount;
549 var nextClass = 'logo-slider-next' + logoSliderCount; 550 551 el.parent().find('.slider-arrow-prev').removeClass('logo-slider-prev').addClass(prevClass); 552 el.parent().find('.slider-arrow-next').removeClass('logo-slider-next').addClass(nextClass); 553 554 el.slick({ 555 dots: false, 556 arrows: true, 557 infinite: true, 558 speed: 300, 559 slidesToShow: slideCount, 560 slidesToScroll: 1, 561 prevArrow: '.' + prevClass, 562 nextArrow: '.' + nextClass, 563 centerMode: false, 564 centerPadding: '0px;', 565 566 responsive: [ 567 { 568 breakpoint: 992, 569 settings: { 570 slidesToShow: 4, 571 slidesToScroll: 3 572 } 573 }, 574 { 575 breakpoint: 768, 576 settings: { 577 slidesToShow: 3, 578 slidesToScroll: 3 579 } 580 }, 581 { 582 breakpoint: 480, 583 settings: { 584 slidesToShow: 1, 585 slidesToScroll: 1 586 } 587 } 588 ], 589 }); 590 591 592 }); 593 594 595 596 597 598 $('.people-slider').slick({ 599 dots: false, 600 arrows: true, 601 infinite: true, 602 speed: 300, 603 slidesToShow: 4, 604 slidesToScroll: 4, 605 prevArrow: '.people-slider-prev', 606 nextArrow: '.people-slider-next', 607 // centerMode: true, 608 centerPadding: '0px;', 609 610 responsive: [ 611 { 612 breakpoint: 992, 613 settings: { 614 slidesToShow: 3, 615 slidesToScroll: 3 616 } 617 }, 618 { 619 breakpoint: 768, 620 settings: { 621 slidesToShow: 2, 622 slidesToScroll: 2 623 } 624 }, 625 { 626 breakpoint: 480, 627 settings: { 628 slidesToShow: 1, 629 slidesToScroll: 1 630 } 631 } 632 ], 633 }); 634 635 636 637 ////////////////////////////////////////////////////////////////////////////////// 638 // horizontal video carousel functions 639 640 641 642 // populate content each time the slide changes 643 $('.video-carousel-horizontal').on("beforeChange", function(event, slick, currentSlide, nextSlide){ 644 var el = $(this).find('[data-slick-index=' + nextSlide + ']'); 645 var parent = $(this).parent().siblings('.video-content'); 646 parent.children('.video-content-title').empty().append(el.attr('data-title')); 647 parent.children('.video-content-description').empty().append(el.attr('data-description')); 648 }); 649 650 // populate content on carousel init 651 $('.video-carousel-horizontal').on("init", function(){ 652 var el = $(this).find('[data-slick-index=0]'); 653 var parent = $(this).parent().siblings('.video-content'); 654 parent.children('.video-content-title').empty().append(el.attr('data-title')); 655 parent.children('.video-content-description').empty().append(el.attr('data-description')); 656 }); 657 658 // horizontal video initialize 659 $('.video-carousel-horizontal').slick({ 660 slidesToShow: 1, 661 dots: false, 662 infinite: true, 663 centerMode: true, 664 centerPadding: '80px', 665 prevArrow: '<div class="vid-arrow-prev slick-arrow" style=""><i class="fa fa-chevron-left"></i></div>', 666 nextArrow: '<div class="vid-arrow-next slick-arrow" style=""><i class="fa fa-chevron-right"></i></div>', 667 668 responsive: [ 669 { 670 breakpoint: 992, 671 settings: { 672 centerPadding: '60px' 673 } 674 }, 675 { 676 breakpoint: 768, 677 settings: { 678 centerPadding: '40px' 679 } 680 } 681 ] 682 });
683 684 685 686 687 688 689 690 ////////////////////////////////////////////////////////////////////////////////// 691 // vertical video carousel functions 692 693 var transitionTime = 500; // if changed here change on ".slide" css as well 694 var zindexOffset = 10; 695 var slidingActive = false; 696 697 // init functions 698 $('.video-carousel-vertical').each(function(){ 699 700 var el = $(this); 701 702 // set video text 703 var activeSlide = $(this).find('.slide-active'); 704 var parent = el.parent().siblings('.video-content'); 705 parent.children('.video-content-title').empty().append(activeSlide.attr('data-title')); 706 parent.children('.video-content-description').empty().append(activeSlide.attr('data-description')); 707 708 // z-index everything 709 var slideCount = el.find('.slide').length; 710 for( var i = slideCount+zindexOffset; i > zindexOffset; i--){ 711 var slideIndex = slideCount + zindexOffset - i; 712 el.find('.slide[data-slideIndex=' + slideIndex + ']').css('z-index', i); 713 } 714 715 }); 716 717 718 // next button click 719 $('.video-carousel-vertical .vid-arrow-next').on("click", function(){ 720 721 if( slidingActive ){ 722 console.log('cant slide yet'); 723 return; 724 } 725 726 slidingActive = true; 727 728 var slider = $(this).parent(); 729 var slideCount = slider.find('.slide').length; 730 var currentSlide = slider.find('.slide-active'); 731 var currentSlideIndex = parseInt(currentSlide.attr('data-slideIndex')); 732 733 var nextSlideIndex = currentSlideIndex === (slideCount - 1) ? 0 : (currentSlideIndex + 1); 734 735 var nextSlide = slider.find('.slide[data-slideIndex=' + nextSlideIndex + ']'); 736
737 ///////////////// 738 // swap text // 739 var parent = slider.parent().siblings('.video-content'); 740 parent.children('.video-content-title').empty().append(nextSlide.attr('data-title')); 741 parent.children('.video-content-description').empty().append(nextSlide.attr('data-description')); 742 //////////////// 743 744 nextSlide.addClass('slide-active'); 745 currentSlide.addClass('fade-out'); 746 747 setTimeout(function(){ 748 // move current slide to the back now that it's invisible 749 currentSlide.css('z-index', (slideCount+zindexOffset) - (slideCount-1) ); 750 751 // remove classes 752 currentSlide.removeClass('slide-active'); 753 currentSlide.removeClass('fade-out'); 754 755 var iterator = nextSlideIndex; 756 while ( iterator !== currentSlideIndex){ 757 var el = slider.find('.slide[data-slideIndex=' + iterator + ']'); 758 el.css('z-index', parseInt(el.css('z-index')) + 1); 759 760 iterator++; 761 762 if( iterator >= slideCount ){ 763 iterator = 0; 764 } 765 } 766 767 slidingActive = false; 768 }, transitionTime) 769 770 }); 771 772 // previous button click 773 $('.video-carousel-vertical .vid-arrow-prev').on("click", function(){ 774 775 if( slidingActive ){ 776 console.log('cant slide yet'); 777 return; 778 } 779 780 slidingActive = true; 781 782 var slider = $(this).parent(); 783 var slideCount = slider.find('.slide').length; 784 var currentSlide = slider.find('.slide-active'); 785 var currentSlideIndex = parseInt(currentSlide.attr('data-slideIndex')); 786 787 var nextSlideIndex = currentSlideIndex === 0 ? (slideCount - 1) : (currentSlideIndex - 1); 788 789 var nextSlide = slider.find('.slide[data-slideIndex=' + nextSlideIndex + ']'); 790
791 ///////////////// 792 // swap text // 793 var parent = slider.parent().siblings('.video-content'); 794 parent.children('.video-content-title').empty().append(nextSlide.attr('data-title')); 795 parent.children('.video-content-description').empty().append(nextSlide.attr('data-description')); 796 //////////////// 797 798 var nextZ = parseInt(currentSlide.css('z-index')) + 1; 799 800 nextSlide.addClass('slide-to-front').css('z-index', nextZ); 801 currentSlide.addClass('slide-return'); 802 803 804 setTimeout(function(){ 805 nextSlide.addClass('fade-in'); 806 }, 32); 807 808 setTimeout( function (){ 809 nextSlide.addClass('slide-active').removeClass('slide-to-front').removeClass('fade-in'); 810 currentSlide.removeClass('slide-active').removeClass('slide-return'); 811 812 for( var i = 0; i < slideCount; i++ ){ 813 var el = slider.find('.slide[data-slideIndex=' + i + ']'); 814 el.css('z-index', parseInt(el.css('z-index')) - 1); 815 } 816 817 slidingActive = false; 818 }, transitionTime ); 819 820 }); 821 822 823 // play full-width video on scroll 824 $(document).on("scroll", function(){ 825 var scrollElements = $('.play-on-scroll'); 826 827 if( scrollElements.length > 0 ){ 828 var doc = document.documentElement; 829 var top = doc.scrollTop; 830 var windowHeight = $(window).height(); 831 832 scrollElements.each(function(){ 833 var el = $(this); 834 if( top + (windowHeight/2) > el.offset().top ){ 835 el.removeClass("play-on-scroll"); 836 el.attr('src', el.attr('data-src')); 837 } 838 }); 839 } 840 }); 841 842 843 844 // People grid component functions 845 846 $(document).on("click", function(e){ 847 var el = $(e.target); 848 if( el.hasClass("quote-box") && el.hasClass("active") ){ 849 //do nothing 850 851 // this is dumb and i hate it but I don't know how else to do this 852 } else if( el.hasClass("quote-preview") || el.hasClass("quote-trigger-icon") || el.hasClass("quote-trigger") || el.hasClass("quote-inner") || el.hasClass("quote-name") || el.hasClass("quote-trigger-plus") ) { 853 // also do nothing 854 } else { 855 $('.quote-box.active').removeClass("active"); 856 } 857 }); 858 859 $('.people-grid-component .quote-trigger').on("click", function(){ 860 $('.quote-box.active').removeClass("active"); 861 var el = $(this).parents('.people-block').children(".quote-box"); 862 el.addClass("active"); 863 }); 864 865 $(".people-grid-component .quote-box .quote-close").on("click", function(){ 866 console.log("closing quote"); 867 var el = $(this).parents(".quote-box"); 868 el.removeClass("active"); 869 }); 870 871 $(".people-grid-component .clear-search").on("click", function(){ 872 var el = $(this).parents(".people-grid-component"); 873 874 el.find("input[name=search-query]").val(""); 875 el.find(".people-block-cell").addClass("active"); 876 el.find(".no-results").removeClass("active"); 877 el.find(".search-input .clear-search").removeClass("active"); 878 el.find(".search-text").removeClass("active"); 879 }); 880 881 var timeLimit = 350; 882 var inputTimer; 883 $(".people-grid-component input[name=search-query]").on("input", function(){ 884 var el = $(this); 885 var wrapper = el.parents(".people-grid-component"); 886 clearTimeout(inputTimer); 887 888 inputTimer = setTimeout(function(){ 889 var q = el.val().toLowerCase(); 890 var blocks = wrapper.find(".people-block-cell"); 891 var count = blocks.length; 892 var iterator = 0; 893 var itemsHidden = 0; 894 895 console.log(q.length); 896 897 if( q.length > 0 ){ 898 wrapper.find(".search-input .clear-search").addClass("active"); 899 } else { 900 wrapper.find(".search-input .clear-search").removeClass("active"); 901 wrapper.find(".search-text").removeClass("active"); 902 } 903 904 blocks.each(function(){ 905 var name = $(this).find(".person-name").text().toLowerCase(); 906 907 if( name.indexOf(q) === -1 ){ 908 if( $(this).hasClass("active") ){ 909 $(this).removeClass("active"); 910 } 911 itemsHidden++; 912 } else { 913 $(this).addClass("active"); 914 } 915 916 iterator++; 917 918 if( iterator >= count ){ 919 var resultsFound = count - itemsHidden; 920 var searchText = "0 Results Found"; 921 922 if( resultsFound === 1 ){ 923 searchText = "1 Result Found"; 924 } else if( resultsFound > 1 ){ 925 searchText = resultsFound + " Results Found"; 926 } 927 928 if( q.length > 0 ){ 929 wrapper.find(".search-text").addClass("active").empty().append(searchText); 930 } 931 932 if( resultsFound === 0 ){ 933 wrapper.find(".no-results").addClass("active"); 934 } else { 935 wrapper.find(".no-results").removeClass("active"); 936 } 937 } 938 }); 939 940 941 }, timeLimit); 942 });
943 944}); 945 946 947function getParameterByName(name, url) { 948 if (!url) url = window.location.href; 949 name = name.replace(/[\[\]]/g, "\\$&"); 950 var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"), 951 results = regex.exec(url); 952 if (!results) return null; 953 if (!results[2]) return ''; 954 return decodeURIComponent(results[2].replace(/\+/g, " ")); 955}
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.