1/*----------------------------------------------------------------------------------- 2 3 Theme Name: Groveland, MA 4 Front-end developer: Abdallah 5 Author Design: Matt Hicks 6 Author URI: https://www.revize.com/ 7 Date: 05/15/2025 8 9-----------------------------------------------------------------------------------*/ 10 11function RZRenderMini(elementList) { 12 $('#mini-events .mini-events-list').each(function () { 13 const $carousel = $(this).find('.tiny-carousel'); 14 15 if ($carousel.length) { 16 $carousel.each(function (i, el) { 17 const $el = $(el); 18 19 // Avoid re-initializing 20 if ($el.hasClass('tns-initialized')) return; 21 22 // Initialize tiny-slider 23 tns({ 24 container: el, 25 items: 2, 26 lazyload: true, 27 lazyloadSelector: '.tns-lazy-img', 28 preventScrollOnTouch: 'force', 29 nav: false, 30 speed: 500, 31 controlsText: [ 32 '<img src="_assets_/images/arrow-left.png" alt="arrow left">', 33 '<img src="_assets_/images/arrow-right.png" alt="arrow right">' 34 ], 35 autoplayButtonOutput: false, 36 responsive: { 37 650: { items: 2 }, 38 0: { items: 1 } 39 }, 40 loop: false, 41 gutter: 12, 42 }); 43 44 // Mark as initialized 45 $el.addClass('tns-initialized'); 46 }); 47 } 48 }); 49 50 $('#events-tabs .tab').click(function () { 51 var tabsIndex = $(this).index(); 52 53 // Tab UI handling 54 $('#events-tabs .tab').removeClass('active'); 55 $(this).addClass('active'); 56 57 $('.tab-calendar').removeClass('active').hide(); 58 $('.tab-calendar').eq(tabsIndex).addClass('active').show(); 59 60 $('.tab-event').removeClass('active').hide(); 61 $('.tab-event').eq(tabsIndex).addClass('active').show(); 62 }); 63} 64 65(function($) { 66 67 'use strict'; 68 69 var $window = $(window), 70 $body = $('body'), 71 $html = $('html'), 72 $rzBarWrap = $('#rz-bar-wrap'), 73 $rzBtnsContainer = $('.rz-btns-container'); 74 75 // RZ Class + remove revize bar 76 if(typeof RZ !== "undefined"){ 77 if(RZ.login){ 78 $body.addClass("user-logged-in"); 79 } else{ 80 $body.addClass("user-not-logged-in"); 81 } 82 } 83 84 // needed for revize bar 85 // $('[data-toggle="tooltip"]').tooltip({trigger:"hover"}) 86 87 //make menu Mega 88 $("#nav>li>ul").filter(function () { 89 return $(this).find('li').length >= 1 90 }).addClass("make-mage").parent().addClass("static"); 91 92 // Menu scroll if long - Remove if not mega 93 if (!$('.site-header #nav li .nav-in').length) { 94 $('.site-header #nav>li>ul').wrapInner('<div class="nav-in"></div>'); 95 } 96 97 98 // Keyboard Navigation: Nav, flyout 99 var isClick = false; 100 $("#nav li a, #flyout li a, a, button, .toggle, .toggle2").on('focusin', function(e) { 101 if( isClick === false ) { 102 $(".focused").removeClass("focused"); 103 $(e.currentTarget).parents("#nav li, #flyout li").addClass("focused"); 104 $(".opened:not(.focused) ul:visible,.opened2:not(.focused) ul:visible").slideUp().parent().removeClass("opened opened2"); 105 } else { 106 $(".focused").removeClass("focused"); 107 isClick = false; 108 } 109 }); 110 111 // for revize buttons container 112 $rzBtnsContainer.each(function(){ 113 var $container = $(this); 114 if($container.html().trim()!=""){ 115 $container.closest(".has-edit-buttons").addClass('yes-has-edit-buttons'); 116 } 117 }); 118 $(".has-edit-buttons").not(".yes-has-edit-buttons").removeClass("has-edit-buttons"); 119 120 // responsive views from revize bar 121 var urlParams = new URLSearchParams(window.location.search); //get all parameters 122 var hidebar = urlParams.get('hidebar'); //extract the hidebar parameter - this will return NULL if hidebar isn't a parameter 123 124 if(hidebar) { //check if hidebar parameter is set to anything 125 $body.removeClass("user-logged-in").addClass("hide-edit-btns"); 126 } 127 128 // prevent focused class changes on click - This way arrows wont pop when clicking nav links 129 $("#nav a,#flyout a").on('mousedown',function(){ 130 isClick = true; 131 }); 132 133 // Search Toggle 134 $('#search-toggle').on('click',function(e){ 135 $('.h-bottom-right').stop().slideToggle(200).css('display','flex'); 136 $('.h-top').stop().slideToggle(200); 137 $(this).toggleClass('fa-search fa-close'); 138 139 }); 140 $('#search-toggle-desktop').on('click',function(e){ 141 $('#search').stop().slideToggle(200); 142 143 }); 144 145 // Navigation Toggle 146 $("#nav-toggle").on("click", function(){ 147 $("#nav").stop().slideToggle(); 148 $(this).toggleClass("fa-bars fa-close"); 149 }); 150 151 // Menu Arrows and Toggles 152 $("#nav >li>ul,#flyout >li>ul").addClass('first-level'); 153 $("#nav li ul ul").addClass('second-level'); 154 $("#nav>li:has(ul)").each(function(){ 155 $('<a href="#" class="fa fa-angle-down toggle" tabindex="0" aria-haspopup="true" aria-expanded="false" id="dropdown-toggle-'+$(this).index()+'" aria-label="Show Dropdown for '+ $(this).find('a:first').text() +'"></a>').insertAfter($(this).find('a:first')); 156 $(this).find('ul:first').attr('aria-labelledby', 'dropdown-toggle-'+$(this).index()); 157 }); 158 $('#nav li ul .nav-in>li:has(ul)').each(function(index) { 159 $('<a href="#" class="fa fa-angle-down toggle2" tabindex="0" aria-haspopup="true" aria-expanded="false" id="sub-dropdown-toggle-'+index+'" aria-label="Show Dropdown for '+ $(this).find('a:first').text() +'"></a>').insertAfter($(this).find('a:first')); 160 $(this).find('ul:first').attr('aria-labelledby', 'sub-dropdown-toggle-'+index); 161 }); 162 $('#flyout >li:has(ul)').each(function() { 163 $('<a href="#" class="fa fa-angle-down toggle" tabindex="0" aria-haspopup="true" aria-expanded="false" id="flyout-dropdown-toggle-'+$(this).index()+'" aria-label="Show Flyout for '+ $(this).find('a:first').text() +'"></a>').insertAfter($(this).find('a:first')); 164 $(this).find('ul:first').attr('aria-labelledby', 'flyout-dropdown-toggle-'+$(this).index()); 165 }); 166 167 function addNavClass() { 168 if ($window.width() < 992) { 169 // Insert needed for mobile 170 } else{ 171 // Insert needed for desktop 172 $('#nav ul, #flyout ul').css('display', ''); 173 } 174 } 175 addNavClass(); 176 $window.resize(addNavClass); 177 178 $(".toggle").on("click keydown",function(e) { 179 if (e.keyCode === 13 || e.type === 'click') { 180 e.preventDefault(); 181 var $parent = $(this).parent(); 182 var $parentLi = $parent.parent(); 183 $parent.toggleClass('opened'); 184 if($parent.addClass('active') && $(this).next('.first-level').is(":visible")){ 185 $(this).next('.first-level').slideUp(); 186 $parent.removeClass('active'); 187 $(this).attr({'aria-expanded': 'false'}); 188 } else { 189 $(this).attr({'aria-expanded': 'true'}); 190 $(".first-level").slideUp("slow"); 191 $parent.addClass('active'); 192 $(this).next('.first-level').slideToggle(); 193 } 194 } 195 }); 196 $(".toggle2").on("click keydown",function(e) { 197 if (e.keyCode === 13 || e.type === 'click') { 198 e.preventDefault(); 199 var $parent = $(this).parent(); 200 var $parentLi = $parent.parent(); 201 $parent.toggleClass('opened2'); 202 if($parent.addClass('active') && $(this).next('.second-level').is(":visible")){ 203 $(this).next('.second-level').slideUp(); 204 $parent.removeClass('active'); 205 $(this).attr({'aria-expanded': 'false'}); 206 } else { 207 $(this).attr({'aria-expanded': 'true'}); 208 $(".second-level").slideUp("slow"); 209 $parent.addClass('active'); 210 $(this).next('.second-level').slideToggle(); 211 } 212 } 213 }); 214 215 // close nav if left 216 $(".desktop *").focus(function(e){ 217 var $opened = $(".opened"); 218 var $opened2 = $(".opened2"); 219 if( $opened.length > 0 || $opened2.length > 0 ) { 220 if( $(".opened :focus").length < 1 ){ 221 $opened.children("ul").slideUp(); 222 $opened.removeClass("opened"); 223 $(".opened2").removeClass("opened2"); 224 } 225 if( $(".opened2 :focus").length < 1 ){ 226 $opened2.children("ul").slideUp(); 227 $opened2.removeClass("opened2"); 228 } 229 } 230 }); 231 232 // Flyout 233 var flyout = $('#flyout'), 234 flyoutwrap = $('#flyout-wrap'); 235 236 if (flyout.text().length){ 237 flyoutwrap.prepend('<div id="flyout-toggle" class="d-lg-none hidden-md"><i class="fa fa-bars"></i> Sub Menu</div>'); 238 } 239 240 $("#flyout-toggle").on("click", function(){ 241 flyout.slideToggle(); 242 $(this).toggleClass("active"); 243 }); 244 245 246 function fillSide(){ 247 var whiteSpace = parseFloat($('.container').css('margin-right')) + 15; 248 $('.fillLeft').css('margin-left',-whiteSpace); 249 $('.fillLeft.withPadding').css('padding-left',whiteSpace); 250 $('.fillRight').css('margin-right',-whiteSpace); 251 $('.fillRight.withPadding').css('padding-right',whiteSpace); 252 } 253 fillSide(); 254 $window.resize(fillSide); 255 256 /* 257 * E-Notify Auto submit 258 */ 259 $.urlParam=function(n){var e=new RegExp("[?&]"+n+"=([^]*)").exec(window.location.href);return null==e?null:e[1]||0}; 260 var $enotify = $('iframe[src*="/revize/plugins/notify/notify.jsp"]'); 261 if( $enotify.length > 0 ){ 262 var emailStr = $.urlParam("email"); 263 if( emailStr != null ){ 264 $enotify.attr("src", $enotify.attr("src") + "&email=" + emailStr); 265 } 266 } 267 268 // Make sure all calendars have unique ids 269 $('iframe[name="calendar"]').each(function (index, calendar) { 270 calendar.id = 'calendar-' + index; 271 }); 272 273 // Start Frame Resizer 274 function resizeIframe(height, frameElement) { 275 if ( frameElement ) { 276 frameElement.height = ""; 277 frameElement.height = height; 278 } 279 } 280 281 var eventMethod = window.addEventListener ? "addEventListener" : "attachEvent"; 282 var eventHandler = window[eventMethod]; 283 var messageEvent = eventMethod === "attachEvent" ? "onmessage" : "message"; 284 eventHandler(messageEvent, function (e) { 285 if ( Array.isArray(e.data) ) {
286 if( e.data[0] === "setCalHeight" || e.data[0] === "setNotifyHeight") { 287 var frames = document.querySelectorAll('iframe'); 288 for( var i = 0; i < frames.length; i++ ) { 289 if( frames[i].contentWindow === e.source ){ 290 resizeIframe(e.data[1], frames[i]); 291 } 292 } 293 } 294 } 295 }); 296 // End Frame Resizer 297 298 // Alert Close Caching 299 if ($("div.alert").length) { 300 var hide = window.sessionStorage && parseInt(window.sessionStorage.getItem("alertClosed")) > 1; 301 if (!hide || $(".user-logged-in").length != 0) { 302 $("div.alert").addClass('show'); 303 } 304 $("div.alert .close-alert").on('click', function(e) { 305 if (window.sessionStorage) { 306 window.sessionStorage.setItem("alertClosed",parseInt(window.sessionStorage.getItem("alertClosed")||0)+1); 307 } 308 }); 309 } 310 311 312 313 314 315 $('#translator-toggle').on('keydown click', function(e){ 316 if (e.keyCode === 13 || e.type === 'click') { 317 $('#translation-dropdown').stop().fadeToggle(); 318 } 319 }); 320 321 $('#translation-dropdown').not('#translation-links ul').on('mouseleave',function(){ 322 $(this).fadeOut(); 323 }); 324 325 326 var $translateButton = $('#translate-button'); 327 $translateButton.on('keydown click', function(e){ 328 if (e.keyCode === 13 || e.type === 'click') { 329 $('#translation-links ul').stop().fadeToggle(); 330 $translateButton.attr('aria-expanded', !('true' === $translateButton.attr('aria-expanded'))); 331 } 332 }); 333 334 $('#translation-links ul').on('mouseleave',function(){ 335 $(this).fadeOut(); 336 $translateButton.attr('aria-expanded', false); 337 }); 338 339 340 function removeCookieString(value, domain) { 341 domain = domain ? 'domain='+domain+'; ' : ''; 342 return value+'; expires=Thu, 01 Jan 1970 00:00:01 GMT; '+domain+'path=/'; 343 } 344 345 function unsetGoogtransCookie() { 346 for (var domains = window.location.hostname.split('.'); domains.length >= 2; domains.shift()) { 347 var cookieString = removeCookieString('googtrans=unset', domains.join('.')); 348 document.cookie=cookieString; 349 if (domains.length === 2) { 350 cookieString = removeCookieString('googtrans=unset', '.'+domains.join('.')); 351 document.cookie=cookieString; 352 } 353 } 354 document.cookie=removeCookieString('googtrans=unset'); 355 } 356 357 if (document.cookie.split(';').some(function(item) { return item.trim().startsWith('googtrans=/auto/en'); })) { 358 unsetGoogtransCookie(); 359 } 360 361 // Translate Script 362 var translateURL = "//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"; 363 $.getScript(translateURL); 364 $('#translation-links a, .quick-language a').click(function(e) { 365 e.preventDefault(); 366 var lang = $(this).data('lang'); 367 var $frame = $('iframe.skiptranslate'); 368 if (!$frame.length) { 369 return false; 370 } 371 var $el = $frame.contents().find('span.text:contains(' + lang + ')').parent().parent().get(0); 372 373 if (!$el) { 374 $frame.contents().find('span.text:contains("English")').parent().parent().get(0); 375 } 376 $el.click(); 377 return false; 378 }); 379 380 var $translateReset = $('#translate-reset'); 381 $translateReset.on('keydown click', function(e){ 382 383 if (e.keyCode === 13 || e.type === 'click') { 384 $('iframe.skiptranslate').contents().find('span.text:contains("English")').parent().parent().get(0).click(); 385 } 386 }); 387 388 // Tiny Slider 389 if (typeof tns !== "undefined") { 390 $('.tiny-slider').each(function(i, el) { 391 tns({ 392 autoplay: true, 393 autoplayTimeout: 8000, 394 container: el, 395 items: 1, 396 lazyload: true, 397 nav:false, 398 lazyloadSelector: '.tns-lazy-img', // accompanied with data src or data-style 399 mode: "gallery", 400 preventScrollOnTouch: 'force', 401 autoplayButtonOutput: false, 402 controlsText: ['<i class="fa fa-angle-left" aria-hidden="true"></i>','<i class="fa fa-angle-right" aria-hidden="true"></i>'] 403 }); 404 }); 405 406 407 $('#quicklinks .tiny-carousel').each(function(i, el) { 408 let qlinksCount = $('#quicklinks .qlink').length; 409 let $el = $(el); 410 let tinyItemCount = $el.children().length; 411 let tinyItemData = $el.data('tinyItems') ? $el.data('tinyItems') : 6; 412 tns({ 413 container: el, 414 items: Math.min(tinyItemCount, tinyItemData), 415 lazyload: true, 416 lazyloadSelector: '.tns-lazy-img', // accompanied with data src or data-style 417 preventScrollOnTouch: 'force', 418 nav: false, 419 speed: 500, 420 controlsText: [ 421 '<img src="_assets_/images/arrow-left.png" alt="arrow left">', 422 '<img src="_assets_/images/arrow-right.png" alt="arrow right">' 423 ], 424 autoplayButtonOutput: false, 425 responsive:{ 426 1400:{ 427 items: qlinksCount >= 5 ? 5 : qlinksCount 428 }, 429 1200:{ 430 items: qlinksCount >= 4 ? 4 : qlinksCount 431 }, 432 992:{ 433 items: qlinksCount >= 3 ? 3 : qlinksCount 434 }, 435 600:{ 436 items: qlinksCount >= 2 ? 2 : qlinksCount 437 }, 438 0: { 439 items: qlinksCount >= 1 ? 1 : qlinksCount 440 } 441 }, 442 loop:false, 443 gutter: 12, 444 }); 445 }); 446 447 $('#news-list .tiny-carousel').each(function(i, el) { 448 var newsCount = $('#news-list .news-box').length; 449 var $el = $(el); 450 var tinyItemCount = $el.children().length; 451 var tinyItemData = $el.data('tinyItems') ? $el.data('tinyItems') : 6; 452 tns({ 453 container: el, 454 items: Math.min(tinyItemCount, tinyItemData), 455 lazyload: true, 456 lazyloadSelector: '.tns-lazy-img', // accompanied with data src or data-style 457 preventScrollOnTouch: 'force', 458 nav: true, 459 speed:500, 460 controlsText: [ 461 '<img src="_assets_/images/arrow-left.png" alt="arrow left">', 462 '<img src="_assets_/images/arrow-right.png" alt="arrow right">' 463 ], 464 autoplayButtonOutput: false, 465 responsive: { 466 1200: { 467 items: newsCount >= 4 ? 4 : newsCount 468 }, 469 991: { 470 items: newsCount >= 3 ? 3 : newsCount 471 }, 472 650: { 473 items: newsCount >= 2 ? 2 : newsCount 474 }, 475 0: { 476 items: newsCount >= 1 ? 1 : newsCount 477 } 478 }, 479 loop: false, 480 gutter:24, 481 }); 482 483 484 485 }); 486 } 487 488 // Responsive Tables 489 $('.post table:not(.layout-table):not(.not-responsive)').wrap('<div class="table-responsive"></div>'); 490 $('.layout-table').attr('role', 'presentation'); 491 492 // Preloader 493 $window.on('load', function() { 494 495 setTimeout(function(){ 496 $body.addClass('loaded'); 497 $('#loader-wrapper').fadeOut(); 498 }, 600); 499 500 }); 501 502 503 $(document).ready(function() { 504 function hasContent($element) { 505 var textContent = $element.contents().filter(function() { 506 return this.nodeType === 3; 507 }).text().trim(); 508 509 if (textContent !== '') { 510 return true; 511 } 512 513 // If element is a link with empty/placeholder href, consider it empty regardless of images 514 if ($element.is('a[href=""], a[href="#"], a[href="./"], a:not([href])')) { 515 return false;
516 } 517 518 // Check if element itself is an image with src 519 if ($element.is('img[src]:not([src=""])')) { 520 return true; 521 } 522 523 // Check for images with src attribute inside element 524 if ($element.find('img[src]:not([src=""])').length > 0) { 525 return true; 526 } 527 528 // Check for functional links inside element (not empty/placeholder hrefs) 529 if ($element.find('a[href]:not([href=""]):not([href="#"]):not([href="./"])').filter(function() { 530 return $(this).attr('href') && $(this).attr('href').trim() !== ''; 531 }).length > 0) { 532 console.log('link is valid', $element); 533 return true; 534 } 535 536 // Check for background images in style attribute 537 if ($element.attr('style') && $element.attr('style').includes('background') && 538 !$element.attr('style').includes('background:url()')) { 539 return true; 540 } 541 542 return false; 543 } 544 545 function hasOnlyImages($element) { 546 547 548 if ($element.hasClass('social-media-link')) { 549 return false; 550 } 551 // Check if element has any meaningful VISIBLE content other than images 552 var visibleTextContent = ''; 553 $element.find('*:visible').addBack().each(function() { 554 var $this = $(this); 555 // Get direct text content (not from children) 556 var directText = $this.contents().filter(function() { 557 return this.nodeType === 3; 558 }).text().trim(); 559 visibleTextContent += directText; 560 }); 561 562 if (visibleTextContent !== '') { 563 return false; 564 } 565 566 // Check for functional visible links 567 var hasValidLinks = $element.find('a[href]:not([href=""]):not([href="#"]):not([href="./"]):visible').filter(function() { 568 return $(this).attr('href') && $(this).attr('href').trim() !== ''; 569 }).length > 0; 570 571 if (hasValidLinks) { 572 return false; 573 } 574 575 // Check for visible background images 576 var hasVisibleBgImages = false; 577 $element.find('*:visible').addBack().each(function() { 578 var style = $(this).attr('style'); 579 if (style && style.includes('background') && !style.includes('background:url()')) { 580 hasVisibleBgImages = true; 581 return false; 582 } 583 }); 584 585 if (hasVisibleBgImages) { 586 return false; 587 } 588 589 // Check if it has visible images 590 var hasVisibleImages = $element.find('img[src]:not([src=""]):visible').length > 0 || 591 ($element.is('img[src]:not([src=""])') && $element.is(':visible')); 592 593 return hasVisibleImages; 594 } 595 596 function hideEmptyChildren($container) { 597 var hasVisibleContent = false; 598 599 $container.children().each(function() { 600 var $child = $(this); 601 602 if ($child.children().length > 0) { 603 var childHasContent = hideEmptyChildren($child); 604 605 if (!childHasContent && !hasContent($child)) { 606 $child.hide(); 607 } else { 608 hasVisibleContent = true; 609 } 610 } else { 611 if (hasContent($child)) { 612 hasVisibleContent = true; 613 } else { 614 $child.hide(); 615 } 616 } 617 }); 618 619 // After hiding empty children, check if container only has images left 620 if (hasVisibleContent && hasOnlyImages($container)) { 621 622 $container.hide(); 623 hasVisibleContent = false; 624 } else if (hasContent($container)) { 625 hasVisibleContent = true; 626 } 627 628 return hasVisibleContent; 629 } 630 631 $('.freeform__box').each(function() { 632 var $box = $(this); 633 var boxHasContent = hideEmptyChildren($box); 634 635 if (!boxHasContent) { 636 $box.hide(); 637 } 638 }); 639 640 if($.trim($('#flyout').html()) === ''){ 641 $("#flyout").hide() 642 } 643 }); 644 645 646 $window.ready(function(){ 647 648 //#Smooth Scrolling 649 $('a[href*="#"]').not('[href="#"]').not('[href*="#collapse"]').not('.faq-header').click(function(event) { 650 if (location.pathname.replace(/^\//,'') === this.pathname.replace(/^\//,'') && location.hostname === this.hostname) { 651 var target = $(this.hash); 652 target = target.length ? target : $('[name=' + this.hash.slice(1) +']'); 653 if (target.length) { 654 event.preventDefault(); 655 $('html,body').animate({ 656 scrollTop: target.offset().top 657 }, 1000, function() { 658 var $target = $(target); 659 $target.focus(); 660 if ($target.is(":focus")) { 661 return false; 662 } else { 663 $target.attr('tabindex','-1');
664 $target.focus(); 665 $target.removeAttr('tabindex'); 666 }; 667 }); 668 } 669 } 670 }); 671 672 }); // Ready 673 674 // Slider video 675 if(typeof $.fn.YTPlayer !== 'undefined' && $('body').attr('id') == 'homepage'){ 676 $("#sliderVideo").YTPlayer(); 677 $('#wrapper_sliderVideo').css('z-index','1') 678 679 var interval = setInterval(hideControl,1000); 680 function hideControl(){ 681 var videoId = document.getElementById('wrapper_sliderVideo'); 682 if(videoId){ 683 if(videoId.style.opacity == '1'){ 684 clearInterval(interval); 685 $('#slider .tns-controls button').hide(); 686 }else{ 687 $('#slider .tns-controls button').show(); 688 } 689 } 690 } 691 692 } 693 694})(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.