1jQuery(document).ready(function($) { 2 3 document.onkeydown = KeyPress; 4 5 function calcHero() { 6 var $windowHeight = $(window).height(); 7 $('#main-menu').css('max-height', $windowHeight - $('.header-wrapper').outerHeight()); 8 } 9 10 calcHero(); 11 $(window).load(function() { 12 calcHero(); 13 }); 14 $(window).resize(function() { 15 calcHero(); 16 }); 17 18 // Homepage Hero 19 $('.homepage-hero-images').cycle({ 20 'slides' : '> div', 21 'fx' : 'scrollHorz', 22 'timeout' : 6000, 23 'speed' : 600, 24 'pager' : '.hero-pager', 25 'pause-on-hover' : 'true', 26 }); 27 28 $('.open-signup-form').click(function(){ 29 $('.footer-signup').addClass('opened'); 30 }); 31 32 33 // BACK TO TOP 34 $('.btt-button').click(function(){ 35 var topElement = $(this).data('top'); 36 if (topElement && $(topElement).length) { 37 $('body, html').animate({scrollTop : $(topElement).offset().top}, 300); 38 } else { 39 $('body, html').animate({scrollTop : 0}, 300); 40 } 41 }); 42 43 44 // MENU 45 $('.navbar-default .navbar-nav > li.menu-item-has-children').hover(function(){ 46 $('.site-header').addClass('opened-level-1'); 47 }, function(){ 48 $('.site-header').removeClass('opened-level-1'); 49 }); 50 51 $('.navbar-default .navbar-nav > li > ul > li.menu-item-has-children').hover(function(){ 52 $('.site-header').addClass('opened-level-2'); 53 }, function(){ 54 $('.site-header').removeClass('opened-level-2'); 55 }); 56 57 // FILTERS 58 $('.page-filter-item select').change(function(){ 59 $('.page-filters form').submit(); 60 }); 61 62 $("[data-fancybox]").fancybox({ 63 slideShow : false, 64 fullScreen : false, 65 thumbs : false, 66 infobar : false, 67 buttons : true, 68 }); 69 70 // SECTIONS NAV 71 $('.single-page-navigation .button').click(function(){ 72 var target = $(this).attr('href'); 73 if ($(target).length) { 74 $('body, html').animate({scrollTop: $(target).offset().top - $('.header-wrapper').height() - 30 }, 'slow'); 75 } 76 return false; 77 }); 78 79 80 // CUSTOM UPLOAD 81 $('#document-input').change(function() { 82 var f = $(this).val(); 83 f = f.replace(/.*[\/\\]/, ''); 84 $('.remove-file').remove(); 85 if (f !== '') { 86 $('label[for="document-input"] span').text(f); 87 $('label[for="document-input"]').after('<span class="remove-file">x</span>'); 88 } else { 89 $('label[for="document-input"] span').text('No File Selected'); 90 } 91 }); 92 93 $(document).on('click', '.remove-file', function(){ 94 $('#document-input').val('').trigger('change'); 95 }); 96 97 // RENEW CARD 98 $('.contact-page-form input[name="changed_address"]').change(function(){ 99 var changed = $('.contact-page-form input[name="changed_address"]:checked').val(); 100 if (changed === 'Yes') { 101 $('.renew-address').slideDown(300); 102 } else { 103 $('.renew-address').slideUp(300); 104 } 105 }); 106 //CHILD/TEEN CARD 107 $('.contact-page-form input[name="card_type"]').change(function(){ 108 var changed = $('.contact-page-form input[name="card_type"]:checked').val(); 109 if (changed === 'Child Card - birth to 5th grade' || changed === 'Teen Card - 6th to 12th grade') { 110 $('.date-of-birth').slideDown(300); 111 } else { 112 $('.date-of-birth').slideUp(300); 113 } 114 }); 115 116 117 // NEWSLETTER 118 $('.newsletter-page-heading select').change(function(){ 119 var redirect_page = $(this).val(); 120 window.location.href = redirect_page; 121 }); 122 123 $('.toggle-newsletter-audio').click(function(){ 124 $(this).next('.newsletters-audio').slideToggle(300); 125 }); 126 127 $('.hero-video-play').click(function(){ 128 $(this).fadeOut(300); 129 document.getElementById('hero-video').play(); 130 }); 131 132 $('#hero-video').on('ended',function(){ 133 $('.hero-video-play').fadeIn(300); 134 }); 135 136 $('.board-archive-selector select').change(function(){ 137 $('.board-archive-item').hide(); 138 var year = $(this).val(); 139 $('#archive-' + year).show(); 140 }); 141 142 $('.library-calculator-btn').click(function(){ 143 $('.library-calculator').slideDown(300); 144 $('.budget-archive').slideUp(300); 145 }); 146 147 $('.close-calculator').click(function(){ 148 $('.library-calculator').slideUp(300); 149 }); 150 151 $('.budget-archive-btn').click(function(){ 152 $('.library-calculator').slideUp(300); 153 $('.budget-archive').slideToggle(300); 154 }); 155 156 $('.research-letters ul li a').click(function(){ 157 var target = $(this).attr('href') + '-letter'; 158 $('body, html').animate({scrollTop: $(target).offset().top - $('.header-wrapper').outerHeight()}, 'slow'); 159 return false; 160 }); 161 162 $('.research-filters select').change(function(){ 163 var redirect_page = $(this).val(); 164 window.location.href = redirect_page; 165 }); 166 167 $('.lot-filters select').change(function(){ 168 var redirect_page = $(this).val(); 169 $('#reload-spinner').addClass('on'); 170 window.location.href = redirect_page; 171 172 }); 173 174// if ($(window).width() > 767) {
175 $(".dev-carousel").owlCarousel({ 176 nav : true, 177 dots: false, 178 loop: true, 179 autoplay: true, 180 responsive:{ 181 0:{ 182 items:1, 183 slideBy: 1, 184 }, 185 768:{ 186 items:2, 187 slideBy: 2, 188 }, 189 992:{ 190 items:4, 191 slideBy: 2, 192 } 193 } 194 }); 195 var devCarousel=$(".dev-carousel"); 196 devCarousel.mouseover(function(){ 197 devCarousel.trigger('stop.owl.autoplay'); 198 }); 199 200 devCarousel.mouseleave(function(){ 201 devCarousel.trigger('play.owl.autoplay',[1000]); 202 }); 203 204 205 206 $(".owl-carousel:not(.todays-events-carousel)").owlCarousel({ 207 nav : true, 208 dots: false, 209 autoplay: true, 210 autoplayHoverPause: true, 211 loop: true, 212 responsive:{ 213 0:{ 214 items:1, 215 }, 216 768:{ 217 items:2, 218 }, 219 992:{ 220 items:3, 221 } 222 } 223 }); 224 225 //today's events owl carousel 226 $(".owl-carousel.todays-events-carousel").owlCarousel({ 227 nav : true, 228 dots: true, 229 autoplay: false, 230 autoplayHoverPause: true, 231 loop: false, 232 responsive:{ 233 0:{ 234 items:1, 235 }, 236 500:{ 237 items:2, 238 }, 239 768:{ 240 items:3, 241 }, 242 992:{ 243 items:5, 244 } 245 } 246 }); 247 248 249 250// } 251 252 $('.search-trigger.mobile > span').click(function(){ 253 $('.search-trigger.mobile .megasearch-dropdown').slideToggle(300); 254 $(this).toggleClass('active'); 255 //console.log("mobile"); 256 }); 257 258 $('.search-trigger.desktop > span').click(function(){ 259 260 if( $(this).hasClass('active') ) { 261 $('.search-trigger.desktop .megasearch-dropdown').slideUp(300); 262 $(this).removeClass('active'); 263 console.log("close action"); 264 } 265 266 else { 267 $('.search-trigger.desktop .megasearch-dropdown').slideDown(300); 268 $(this).addClass('active'); 269 console.log("open action"); 270 } 271 }); 272 273 //desktop - turn on and off the website vs. catalogue search 274 $('.megasearch-dropdown.desktop .search-tabs ul li input[type="radio"]').change(function(){ 275 var selectedForm = $('.megasearch-dropdown.desktop .search-tabs ul li input[type="radio"]:checked').val(); 276 $('.megasearch-dropdown.desktop form').removeClass('active'); 277 $('.megasearch-dropdown.desktop .search-form-' + selectedForm).addClass('active'); 278 }); 279 280 //dmobil - turn on and off the website vs. catalogue search 281 $('.megasearch-dropdown.mobile .search-tabs ul li input[type="radio"]').change(function(){ 282 var selectedForm = $('.megasearch-dropdown.mobile .search-tabs ul li input[type="radio"]:checked').val(); 283 $('.megasearch-dropdown.mobile form').removeClass('active'); 284 $('.megasearch-dropdown.mobile .search-form-' + selectedForm).addClass('active'); 285 }); 286 287 $('.megasearch-dropdown .form-item input[type="text"]').keyup(function(){ 288 var $val = $(this).val(); 289 var btn = $(this).next('input'); 290 btn.removeClass('active'); 291 if ($val) { 292 btn.addClass('active'); 293 } 294 }); 295 296 $('.navbar-default .navbar-nav li.menu-item-has-children > a em.arrow').click(function(){ 297 $(this).toggleClass('active'); 298 $(this).parent().next('ul').slideToggle(300); 299 return false; 300 }); 301 302 $('.down-mobile').click(function(){ 303 $('body, html').animate({scrollTop: $('.homepage-hero').next().offset().top - $('.header-wrapper').outerHeight()}, 'slow'); 304 }); 305 306 $('.mobile-item-read-more .button').click(function(){ 307 var opened = $(this).data('opened'); 308 var closed = $(this).data('closed'); 309 if ($(this).hasClass('opened')) { 310 $(this).parent().next('.list-text-excerpt').slideUp(300); 311 $(this).text(closed).removeClass('opened'); 312 } else { 313 $(this).parent().next('.list-text-excerpt').slideDown(300); 314 $(this).text(opened).addClass('opened'); 315 } 316 }); 317 318 $('.policies-section .h2').click(function(){ 319 $(this).toggleClass('opened'); 320 $(this).next('.text').slideToggle(300); 321 }); 322 323 if ($(window).width() < 768) { 324 $('.research-category-letter h3').click(function(){ 325 $(this).toggleClass('opened'); 326 $(this).next('.resources-list-items').slideToggle(300); 327 }); 328 } 329 330 $('#search_formdesktop .search-criteria-col ul li input').change(function(){ 331 if ($('#search_formdesktop #search-criteria-4desktop').is(":checked")) { 332 //alert("checked"); 333 $('#search_formdesktop.search-form-catalog .form-item input[type="text"]').attr('placeholder', 'Last name, first name'); 334 } 335 336 else { 337 //alert("not"); 338 $('#search_formdesktop.search-form-catalog .form-item input[type="text"]').attr('placeholder', 'Search Catalog...'); 339 } 340 341 }); 342 343 $('#search_formmobile .search-criteria-col ul li input').change(function(){ 344 if ($('#search_formmobile #search-criteria-4mobile').is(":checked")) { 345 //alert("checked"); 346 $('#search_formmobile.search-form-catalog .form-item input[type="text"]').attr('placeholder', 'Last name, first name'); 347 } 348 349 else { 350 //alert("not"); 351 $('#search_formmobile.search-form-catalog .form-item input[type="text"]').attr('placeholder', 'Search Catalog...'); 352 } 353 354 }); 355 356 357 358//var affixElement = '#navbar-main.vgl'; 359var affixElement = '#newNavbar'; 360//$(alert("yo!")); 361 362$(affixElement).affix({ 363 offset: { 364 // Distance of between element and top page 365 top: function () { 366 return (this.top = $(affixElement).offset().top) 367 }, 368 // when start #footer 369 bottom: function () { 370 return (this.bottom = $('#footer').outerHeight(true)) 371 } 372 } 373}); 374 375 $( "ul#nav.nav.navbar-nav.vgl > li.menu-item-has-children" ).before( '<span class="plusTriggerWrap"><i class="fas fa-plus"></i><i class="fas fa-minus"></i></span>' ); 376 377 378$('.plusTriggerWrap').click(function() { 379 $thisCaller = $(this); 380 $(this).toggleClass('openPlus'); 381 //alert('triggered!'); 382 //console.log(this); 383 $(this).next('li').toggleClass('open'); 384 $(this).next('li').children('ul.sub-menu').first().slideToggle( "slow", function() { 385 // Animation complete. 386 //$thisCaller.toggleClass('open'); 387 }); 388 389 }); 390 391 392 393//removing display: none inline style when going from narrow to wide 394$(window).resize(function(){ 395 var w = $(window).width(); 396 if(w > 1200) { 397 $('.sub-menu').removeAttr('style'); 398 $('.plusTriggerWrap').removeClass('openPlus'); 399 $('.menu-item').removeClass('open'); 400 resetMainTrigger(); 401 402 $("#mobileCloseTop").removeAttr('style'); 403 $("#mobileTrigger").removeAttr('style'); 404 405 } 406 if(w < 1200 && $("#sachemNotifications").is(":visible")) { 407 408 var notificationHeight = $('#sachemNotifications').height(); 409 $("#mobileBar").css("top", notificationHeight + "px"); 410 console.log("MobileBar:Top "+notificationHeight); 411 } 412 else 413 { 414 $("#mobileBar").css("top", 0 + "px"); 415 console.log("MobileBar:Top "+0); 416 } 417 }); 418 419 420 421
422//When a nav item gets focus... 423$( "ul#nav li a").focus(function() { 424 425 //do nothing if its menu parent has the focus class 426 if ($(this).parents('li.menu-item-has-children').hasClass('myFocus') ) { 427 //console.log("Focus on FOCUS"); 428 } 429 430 //but if it doesn't remove all myFocus classes 431 else { 432 //console.log("Focus on regular"); 433 $('.myFocus').removeClass('myFocus'); 434 } 435 436 /* 437 if ( $('.search-trigger.desktop > span').hasClass('active') ) { 438 //console.log("run"); 439 $('#mySearchSpandesktop .megasearch-dropdown').slideToggle(300); 440 $('.search-trigger.desktop > span').toggleClass('active'); 441 } 442 */ 443 }); 444 445 /* 446 $('.backHomeButton').focus(function() { 447 if ( $('.search-trigger.desktop > span').hasClass('active') ) { 448 console.log("run HOME"); 449 $('#mySearchSpandesktop .megasearch-dropdown').slideToggle(300); 450 $('.search-trigger.desktop > span').toggleClass('active'); 451 } 452 453 }); 454 */ 455 456let mouseDown = false; 457var myElement = document.getElementById('mySearchSpandesktop'); 458 459 460myElement.addEventListener('mousedown', function() { 461 //console.log("here"); 462 mouseDown = true; 463}); 464 465myElement.addEventListener('mouseup', function() { 466 mouseDown = false; 467}); 468 469/* 470myElement.addEventListener('focus', function(event) { 471 if (mouseDown) { 472 event.target.blur(); 473 } 474 else { 475 $('.search-trigger.desktop .megasearch-dropdown').slideToggle(300); 476 $('.search-trigger.desktop > span').toggleClass('active'); 477 478 } 479}); 480*/ 481 482myElement.addEventListener('focus', function(event) { 483 //console.log("on!"); 484 //console.log("openMenu"); 485 486 //so those using the mouse don't create the focus automatically and trigger double events 487 if (mouseDown) { 488 event.target.blur(); 489 } 490 491 else { 492 $('.search-trigger.desktop .megasearch-dropdown').slideDown(300); 493 //$('.search-trigger.desktop > span').toggleClass('active'); 494 $(this).addClass('active'); 495 } 496 497 498 499}); 500 501 502$('.deFocusMenu, .deFocusMenu > a').focus(function(){ 503 //console.log("off!"); 504 $('.search-trigger.desktop .megasearch-dropdown').slideUp(300); 505 $(myElement).removeClass('active'); 506}); 507 508 509 510 511 512 /**/ 513 514 515$('*').on('focus', function(event) { 516 //console.log( "FocusedHTML: " + $(this).html() ); 517 //console.log( "FocusedTag: " + JSON.stringify(this) ); 518}); 519 520 521 522$('.search-trigger.desktop .search-tabs input').on('focus', function(event) { 523 $('.search-trigger.desktop .search-tabs label').addClass('labelOn'); 524}); 525 526$('.search-trigger.desktop .search-tabs input').on('blur', function(event) { 527 $('.search-trigger.desktop .search-tabs label').removeClass('labelOn'); 528}); 529 530$('.search-trigger.desktop .search-criteria-cols input').on('focus', function(event) { 531 $('.search-trigger.desktop .search-criteria-cols label').addClass('labelOn'); 532}); 533 534$('.search-trigger.desktop .search-criteria-cols input').on('blur', function(event) { 535 $('.search-trigger.desktop .search-criteria-cols label').removeClass('labelOn'); 536}); 537 538/* 539$('.search-trigger > span').focus(function() { 540 $('.megasearch-dropdown').slideToggle(300); 541 $(this).toggleClass('active'); 542}); 543 544 545*/ 546 547// This is a hack. When you get off of the last link in the last menu, ditch the myFocus classes 548//otherwise menu stays open 549$("#menu-item-101 a").blur(function() { 550 $('.myFocus').removeClass('myFocus'); 551 }); 552 553//this is what adds the class that turns on the dropdown menu when tabbing 554$( "ul#nav > li.menu-item-has-children > a" ).focus(function() { 555 $(this).parent('li').addClass('myFocus'); 556}); 557 558 559 560 561//in case someone decides to start using the mouse again. 562$('*').hover(function(){ 563 $('.myFocus').removeClass('myFocus'); 564}); 565 566var disableSubmit = false; 567$('.wpcf7-submit').click(function() { 568 $('#waitingInfo').show(); 569 $('#submitWrapper').hide(); 570 571}); 572 573var wpcf7Elm = document.querySelector( '.wpcf7' ); 574 575if(wpcf7Elm != null) { 576 //console.log("Not Null"); 577 wpcf7Elm.addEventListener( 'wpcf7invalid', function( event ) { 578 $('#waitingInfo').hide(); 579 $('#submitWrapper').show(); 580 }, false ); 581 wpcf7Elm.addEventListener( 'wpcf7spam', function( event ) { 582 $('#waitingInfo').hide(); 583 $('#submitWrapper').show(); 584 }, false ); 585 wpcf7Elm.addEventListener( 'wpcf7mailsent', function( event ) { 586 $('#waitingInfo').hide(); 587 $('#submitWrapper').show(); 588 }, false ); 589 wpcf7Elm.addEventListener( 'wpcf7mailfailed', function( event ) { 590 $('#waitingInfo').hide(); 591 $('#submitWrapper').show(); 592 }, false ); 593 594} 595 596 597$("a#snapchatlink").fancybox(); 598 599 600 601var viewportWidth; 602var currentStylesheet; 603var stylesheet; 604 605$(window).resize(function() { 606 viewportWidth = $(window).width(); 607 608 if(viewportWidth < 480) { stylesheet = 'All (smallest)'; } 609 else if (viewportWidth >= 480 && viewportWidth < 768) { stylesheet = 'xsUp'; } 610 else if (viewportWidth >= 768 && viewportWidth < 992) { stylesheet = 'smallUp'; } 611 else if (viewportWidth >= 992 && viewportWidth < 1200) { stylesheet = 'mediumUp'; } 612 else if (viewportWidth >= 1200 && viewportWidth < 1500) { stylesheet = 'largeUp'; } 613 else if (viewportWidth >= 1500) { stylesheet = 'extraLargeUp' }; 614 615 if (stylesheet != currentStylesheet) { 616 currentStylesheet = stylesheet; 617 //console.log(currentStylesheet); 618 } 619 620}); 621 622 623$('#closeItNotification').click(function(){ 624 625 $("#sachemNotifications").hide(); 626 $("#openItNotification").show();
627 setCookie("sachemNotificationShow","False",30); 628 ChangeInNotificationBarX(); 629 630 631}); 632 633$('#openItNotification').click(function(){ 634 635 $("#sachemNotifications").show(); 636 $("#openItNotification").hide(); 637 setCookie("sachemNotificationShow","True",30); 638 ChangeInNotificationBarX(); 639}); 640 641 if ($('.swiper-container').length) { 642 var mySwiper = new Swiper ('.swiper-container', { 643 // Optional parameters 644 keyboardControl: true, 645 loop: true, 646 slidesPerView : 3, 647 autoplay: 2500, 648 autoplayDisableOnInteraction: true, 649 //spaceBetween: 10, 650 breakpoints: { 651 600: { 652 slidesPerView: 1, 653 //spaceBetween: 10, 654 }, 655 992: { 656 slidesPerView: 2, 657 //spaceBetween: 10, 658 }, 659 }, 660 centeredSlides : true, 661 effect : 'coverflow', 662 coverflow: { 663 rotate: 0, 664 stretch: 0, 665 depth: 300, 666 modifier: 1, 667 // slideShadows : true 668 }, 669 670 // If we need pagination 671 //pagination: '.swiper-pagination', 672 673 // Navigation arrows 674 nextButton: '.swiper-button-next', 675 prevButton: '.swiper-button-prev', 676 677 }); 678 679 680 681 var swiperContainer = document.querySelector('.swiper-container'); 682 683 swiperContainer.addEventListener('mouseenter', function() { 684 mySwiper.stopAutoplay(); 685 }); 686 687 swiperContainer.addEventListener('mouseleave', function() { 688 mySwiper.startAutoplay(); 689 }); 690 691 692 693 694 } 695 696 697 698}); 699 700function checknotificationstatus() 701{ 702 let sachemNotificationShow = getCookie("sachemNotificationShow"); 703 console.log(sachemNotificationShow+":Status"); 704 if(sachemNotificationShow=="True" || sachemNotificationShow==0 || sachemNotificationShow=="") 705 { 706 console.log("Showing Notifications"); 707 jQuery("#sachemNotifications").show(); 708 jQuery("#openItNotification").hide(); 709 ChangeInNotificationBarX(); 710 711 } 712 else 713 { 714 console.log("Hiding Notifications"); 715 jQuery("#sachemNotifications").hide(); 716 jQuery("#openItNotification").show(); 717 ChangeInNotificationBarX(); 718 719 } 720} 721 722// ############ NEW MOBILE NAV ################ 723 724jQuery(document).ready(function($) { 725 726 727 $("#mobileMenu ul li.menu-item-has-children").each(function(){ 728 729 730 $(this).children('a').after('<span class="theSubTrigger"><span class="lilLabel"></span><i class="fa-solid fa-caret-right"></i></span>'); 731 }); 732 733 $("#mobileMenu ul.sub-menu").prepend('<li class="theBackButton"><a href="#"><i class="fa-solid fa-caret-left"></i><span class="lilLabel">Back</span></a></li>'); 734 735 736checknotificationstatus(); 737 738 739$("#mobileTrigger, #mobileClose, #mobileCloseTop").click(function(){ 740 741 742 if ( $("#mobileMenu").hasClass('in') ) { 743 744 $("#mobileMenu").removeClass('in'); 745 hideSubmenus(); 746 $('#mobileNav').css('left', '0px'); 747 $("#mobileCloseTop").hide(); 748 $("#mobileTrigger").show(); 749 750 } 751 752 else { 753 $("#mobileMenu").addClass('in'); 754 $("#mobileCloseTop").show(); 755 $("#mobileTrigger").hide(); 756 } 757 758 759 760 761 762}); 763 764$('#mobileMenu > ul li .theSubTrigger').click( function(){ 765 766 //console.log("run"); 767 hideSubmenus(); 768 var thisMenu = $(this).next('ul'); 769 //console.log(thisMenu.html()); 770 $(thisMenu).addClass('showIt'); 771 $(thisMenu).parents('.sub-menu').addClass('showIt'); 772// $('#mobileMenu').css('transform', 'translateX(100%)'); 773// console.log($('#mobileNav').css('left')); 774 775 var currentLeft = $('#mobileNav').css('left'); 776 currentLeft = currentLeft.replace('px', '') 777 var nextLeft = currentLeft - 300; 778 //console.log(currentLeft); 779 console.log(nextLeft); 780// $('#mobileNav').css('left', '-300px'); 781 $('#mobileNav').css('left', nextLeft + 'px'); 782 783}); 784 785 786$('.theBackButton').click(function(){ 787 //$(this).parent('ul').removeClass('in'); 788 789 //$('#mobileMenu').css('transform', 'translateX(-0%)'); 790 791 var currentLeft = $('#mobileNav').css('left'); 792 currentLeft = parseInt(currentLeft.replace('px', '')); 793 var nextLeft = currentLeft + 300; 794 //console.log(currentLeft); 795 //console.log(nextLeft); 796// $('#mobileNav').css('left', '-300px'); 797 $('#mobileNav').css('left', nextLeft + 'px'); 798 799 800 801 802}); 803 804$ ("#mobileMenu ul li.menu-item-has-children > a").click(function(){ 805 var thisHref = $(this).attr('href'); 806 //alert(thisHref); 807 if (thisHref == '#' || thisHref == '') { 808 809 $(this).next('.theSubTrigger').trigger('click'); 810 } 811 812 813 814//stuff here 815}); 816 817 818 // ####################### 819 820 } 821); 822 823 824function hideSubmenus() { 825 jQuery("#mobileMenu ul ul").removeClass('showIt'); 826} 827 828 829function resetMainTrigger() { 830 jQuery("#mobileMenu").removeClass('in'); 831 hideSubmenus(); 832 jQuery('#mobileNav').css('left', '0px'); 833} 834 835 836function KeyPress(e) { 837 838 var evtobj = window.event? event : e 839 if (evtobj.keyCode == 90 && evtobj.ctrlKey) { 840 jQuery( "#wpadminbar" ).toggle(); 841 } 842} 843 844function getCookie(cname) { 845 let name = cname + "="; 846 let decodedCookie = decodeURIComponent(document.cookie); 847 let ca = decodedCookie.split(';'); 848 for(let i = 0; i <ca.length; i++) {
849 let c = ca[i]; 850 while (c.charAt(0) == ' ') { 851 c = c.substring(1); 852 } 853 if (c.indexOf(name) == 0) { 854 return c.substring(name.length, c.length); 855 } 856 } 857 return ""; 858} 859 860function setCookie(cname, cvalue, exmins) { 861 const d = new Date(); 862 d.setTime(d.getTime() + (exmins * 60 * 1000)); 863 let expires = "expires="+ d.toUTCString(); 864 document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/"; 865} 866 867/* 868 869$( "#mySearchSpandesktop" ).focus(function() { 870 alert( "Handler for .focus() called." ); 871}); 872 873*/ 874 875function ChangeInNotificationBarX() 876{ 877 var w = jQuery(window).width(); 878 if(w < 1200 && jQuery("#sachemNotifications").is(":visible")) { 879 880 var notificationHeight = jQuery('#sachemNotifications').height(); 881 jQuery("#mobileBar").css("top", notificationHeight + "px"); 882 console.log("MobileBar:Top "+notificationHeight); 883 } 884 else 885 { 886 jQuery("#mobileBar").css("top", 0 + "px"); 887 console.log("MobileBar:Top "+0); 888 } 889} 890 891 892document.addEventListener("DOMContentLoaded", function() { 893 894 const mybutton = document.getElementById("btt"); // Get the button: 895 896 window.addEventListener("scroll", scrollFunction); // listener for scroll 897 mybutton.addEventListener("click", topFunction); // listener for jup to top 898
899 function topFunction() { 900 document.body.scrollTop = 0; // For Safari 901 document.documentElement.scrollTop = 0; // For Chrome, Firefox, IE and Opera 902 } 903 904 function scrollFunction() { 905 let scrollTop = document.documentElement.scrollTop || document.body.scrollTop; 906 //console.log("value:" + scrollTop); 907 908 if (scrollTop > 2000) { 909 mybutton.style.display = "flex"; 910 } else { 911 mybutton.style.display = "none"; 912 } 913 } 914 915}); 916 917 918/* 919 920// Prevent default action for Swiper navigation buttons 921var swiperButtons = document.querySelectorAll('.swiper-button-next, .swiper-button-prev'); 922swiperButtons.forEach(function(button) { 923 button.addEventListener('click', function(event) { 924 event.preventDefault(); 925 return false; 926 }); 927}); 928*/ 929 930 931 932 933 934document.addEventListener('DOMContentLoaded', function () { 935 936 function updateSwiperA11y(swiperEl) { 937 938 /* ============================= 939 * 1. Container semantics 940 * ============================= */ 941 swiperEl.setAttribute('role', 'region'); 942 swiperEl.setAttribute('aria-roledescription', 'carousel'); 943 944 if (!swiperEl.hasAttribute('aria-label')) { 945 swiperEl.setAttribute('aria-label', 'Content carousel'); 946 } 947 948 /* ============================= 949 * 2. Slides logic (loop + coverflow safe) 950 * ============================= */ 951 const slides = swiperEl.querySelectorAll('.swiper-slide'); 952 let activeIndex = null; 953 954 // Find the REAL active slide index (not duplicate)
955 slides.forEach(slide => { 956 if ( 957 slide.classList.contains('swiper-slide-active') && 958 !slide.classList.contains('swiper-slide-duplicate') 959 ) { 960 activeIndex = slide.getAttribute('data-swiper-slide-index'); 961 } 962 }); 963 964 slides.forEach(slide => { 965 966 // Always hide duplicate slides 967 if (slide.classList.contains('swiper-slide-duplicate')) { 968 slide.setAttribute('aria-hidden', 'true'); 969 slide.removeAttribute('aria-current'); 970 return; 971 } 972 973 // Real active slide 974 if (slide.getAttribute('data-swiper-slide-index') === activeIndex) { 975 slide.removeAttribute('aria-hidden'); 976 slide.setAttribute('aria-current', 'true'); 977 } else { 978 slide.setAttribute('aria-hidden', 'true'); 979 slide.removeAttribute('aria-current'); 980 } 981 982 }); 983 984 /* ============================= 985 * 3. Navigation buttons 986 * ============================= */ 987 const prevBtn = swiperEl.querySelector('.swiper-button-prev'); 988 const nextBtn = swiperEl.querySelector('.swiper-button-next'); 989 990 if (prevBtn) { 991 prevBtn.setAttribute('role', 'button'); 992 prevBtn.setAttribute('tabindex', '0'); 993 prevBtn.setAttribute('aria-label', 'Previous slide'); 994 995 // Keyboard support 996 prevBtn.onkeydown = function (e) { 997 if (e.key === 'Enter' || e.key === ' ') { 998 e.preventDefault(); 999 prevBtn.click(); 1000 } 1001 }; 1002 } 1003 1004 if (nextBtn) { 1005 nextBtn.setAttribute('role', 'button'); 1006 nextBtn.setAttribute('tabindex', '0'); 1007 nextBtn.setAttribute('aria-label', 'Next slide'); 1008 1009 // Keyboard support 1010 nextBtn.onkeydown = function (e) { 1011 if (e.key === 'Enter' || e.key === ' ') { 1012 e.preventDefault(); 1013 nextBtn.click(); 1014 } 1015 }; 1016 } 1017 } 1018 1019 /* ============================= 1020 * 4. Init + re-run after Swiper updates 1021 * ============================= */ 1022 document.querySelectorAll('.swiper-container').forEach(function (swiperEl) { 1023 1024 // Initial run 1025 setTimeout(function () { 1026 updateSwiperA11y(swiperEl); 1027 }, 0); 1028 1029 // After transitions 1030 swiperEl.addEventListener('transitionend', function () { 1031 updateSwiperA11y(swiperEl); 1032 }); 1033 1034 }); 1035 1036}); 1037 1038 1039document.addEventListener('DOMContentLoaded', function () { 1040 1041 document.querySelectorAll('.swiper-container').forEach(function (swiperEl) { 1042 1043 /* ================================= 1044 * 1. Ensure carousel has an ID 1045 * ================================= */ 1046 if (!swiperEl.id) { 1047 swiperEl.id = 'swiper-' + Math.random().toString(36).substr(2, 9); 1048 } 1049 1050 /* ================================= 1051 * 2. Create live region (once) 1052 * ================================= */ 1053 let liveRegion = swiperEl.querySelector('.swiper-status'); 1054 1055 if (!liveRegion) { 1056 liveRegion = document.createElement('div'); 1057 liveRegion.className = 'swiper-status'; 1058 liveRegion.setAttribute('aria-live', 'polite'); 1059 liveRegion.setAttribute('aria-atomic', 'true'); 1060 liveRegion.style.position = 'absolute'; 1061 liveRegion.style.left = '-9999px'; 1062 swiperEl.appendChild(liveRegion); 1063 } 1064 1065 /* ================================= 1066 * 3. Wire navigation buttons 1067 * ================================= */ 1068 swiperEl.querySelectorAll('.swiper-button-prev, .swiper-button-next') 1069 .forEach(function (btn) { 1070 btn.setAttribute('aria-controls', swiperEl.id); 1071 }); 1072 1073 /* ================================= 1074 * 4. Update slides 1075 * ================================= */ 1076 function updateSlides() { 1077 const slides = swiperEl.querySelectorAll('.swiper-slide'); 1078 const totalSlides = swiperEl.querySelectorAll( 1079 '.swiper-slide:not(.swiper-slide-duplicate)' 1080 ).length; 1081 1082 let activeSlide = null; 1083 let activeIndex = null; 1084 1085 slides.forEach(function (slide) { 1086 1087 // Slide semantics 1088 slide.setAttribute('role', 'group'); 1089 slide.setAttribute('aria-roledescription', 'slide'); 1090 1091 if ( 1092 slide.classList.contains('swiper-slide-active') && 1093 !slide.classList.contains('swiper-slide-duplicate') 1094 ) { 1095 activeSlide = slide; 1096 activeIndex = parseInt( 1097 slide.getAttribute('data-swiper-slide-index'), 1098 10 1099 ) + 1; 1100 } 1101 }); 1102
1103 slides.forEach(function (slide) { 1104 const isActive = slide === activeSlide; 1105 const focusables = slide.querySelectorAll( 1106 'a, button, input, textarea, select, [tabindex]' 1107 ); 1108 const images = slide.querySelectorAll('img'); 1109 1110 if (isActive) { 1111 slide.removeAttribute('aria-hidden'); 1112 slide.setAttribute( 1113 'aria-label', 1114 'Slide ' + activeIndex + ' of ' + totalSlides 1115 ); 1116 1117 focusables.forEach(el => el.removeAttribute('tabindex')); 1118 images.forEach(img => img.removeAttribute('aria-hidden')); 1119 1120 } else { 1121 slide.setAttribute('aria-hidden', 'true'); 1122 slide.removeAttribute('aria-label'); 1123 1124 focusables.forEach(el => el.setAttribute('tabindex', '-1')); 1125 images.forEach(img => img.setAttribute('aria-hidden', 'true')); 1126 } 1127 }); 1128 1129 /* ================================= 1130 * 5. Live announcement 1131 * ================================= */ 1132 if (activeSlide) { 1133 const title = activeSlide.querySelector('.titleLink'); 1134 if (title) { 1135 liveRegion.textContent = title.textContent.trim(); 1136 } 1137 } 1138 } 1139 1140 // Initial run 1141 updateSlides(); 1142 1143 // Re-run after slide movement 1144 swiperEl.addEventListener('transitionend', updateSlides); 1145 1146 }); 1147 1148});
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.