1/*----------------------------------------------------------------------------------- 2 3 Theme Name: Edison Township, NJ 4 Front-end developer: Abdallah 5 Author Design: Alex Parent 6 Author URI: https://www.revize.com/ 7 Date: 07/26/2024 8 9 10-----------------------------------------------------------------------------------*/ 11 12 13 14(function($) { 15 16 'use strict'; 17 18 var $window = $(window), 19 $body = $('body'), 20 $html = $('html'), 21 $rzBarWrap = $('#rz-bar-wrap'), 22 $rzBtnsContainer = $('.rz-btns-container'); 23 24 // RZ Class + remove revize bar 25 if(typeof RZ !== "undefined"){ 26 if(RZ.login){ 27 $body.addClass("user-logged-in"); 28 } else{ 29 $body.addClass("user-not-logged-in"); 30 } 31 } 32 33 // needed for revize bar 34 $('[data-toggle="tooltip"]').tooltip({trigger:"hover"}) 35 36 //make menu Mega 37 $("#nav>li>ul").filter(function () { 38 return $(this).find('li').length >= 1 39 }).addClass("make-mage").parent().addClass("static"); 40 41 // Menu scroll if long - Remove if not mega 42 if (!$('.site-header #nav li .nav-in').length) { 43 $('.site-header #nav>li>ul').wrapInner('<div class="nav-in"></div>'); 44 } 45 46 47 // Clone icons to each navigation link/span 48 $('#navicons li').each(function(){ 49 var navIconIndex = $(this).index(); 50 $(this).find('img').prependTo($('#nav>li').eq(navIconIndex).children('a,span')); 51 }); 52 53 // Keyboard Navigation: Nav, flyout 54 var isClick = false; 55 $("#nav li a, #flyout li a, a, button, .toggle, .toggle2").on('focusin', function(e) { 56 if( isClick === false ) { 57 $(".focused").removeClass("focused"); 58 $(e.currentTarget).parents("#nav li, #flyout li").addClass("focused"); 59 $(".opened:not(.focused) ul:visible,.opened2:not(.focused) ul:visible").slideUp().parent().removeClass("opened opened2"); 60 } else { 61 $(".focused").removeClass("focused"); 62 isClick = false; 63 } 64 }); 65 66 // for revize buttons container 67 $rzBtnsContainer.each(function(){ 68 var $container = $(this); 69 if($container.html().trim()!=""){ 70 $container.closest(".has-edit-buttons").addClass('yes-has-edit-buttons'); 71 } 72 }); 73 $(".has-edit-buttons").not(".yes-has-edit-buttons").removeClass("has-edit-buttons"); 74 75 // responsive views from revize bar 76 var urlParams = new URLSearchParams(window.location.search); //get all parameters 77 var hidebar = urlParams.get('hidebar'); //extract the hidebar parameter - this will return NULL if hidebar isn't a parameter 78 79 if(hidebar) { //check if hidebar parameter is set to anything 80 $body.removeClass("user-logged-in").addClass("hide-edit-btns"); 81 } 82 83 // prevent focused class changes on click - This way arrows wont pop when clicking nav links 84 $("#nav a,#flyout a").on('mousedown',function(){ 85 isClick = true; 86 }); 87 88 $('#alert-close').on('click',function(e){ 89 $('#alert').stop().slideUp(200); 90 }); 91 92 // Search Toggle 93 $('#search-toggle').on('click',function(e){ 94 $('#search').stop().slideToggle(200); 95 }); 96 $('#search-close').on('click',function(e){ 97 $('#search').stop().slideUp(200); 98 }); 99 100 // Navigation Toggle 101 $("#nav-toggle").on("click", function(){ 102 $("#header-nav").stop().toggleClass('toggled'); 103 $(this).toggleClass("fa-bars fa-close"); 104 }); 105 106 // Add close icon inside #header-nav on screens 991px and below 107 function addCloseIcon() { 108 if ($window.width() <= 991) { 109 if (!$('#header-nav .close-icon').length) { 110 $('#header-nav').prepend(`<span class="close-icon"><img src="_assets_/images/close-icon.png" alt="close icon"/></span>`); 111 } 112 } else { 113 $('#header-nav .close-icon').remove(); 114 $('#header-nav').removeClass('toggled'); // Ensure class is removed on larger screens 115 } 116 } 117 118 // Initial call to addCloseIcon 119 addCloseIcon(); 120 121 // Handle resize event 122 $window.resize(function() { 123 addCloseIcon(); 124 }); 125 126 // Close the menu when the close icon is clicked 127 $(document).on('click', '#header-nav .close-icon', function() { 128 $('#header-nav').removeClass('toggled'); 129 }); 130 131 // Menu Arrows and Toggles 132 $("#nav>li>ul, #flyout>li>ul").addClass('first-level'); 133 $("#nav li ul ul").addClass('second-level'); 134 $("#nav>li:has(ul)").each(function(){ 135 $('<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')); 136 $(this).find('ul:first').attr('aria-labelledby', 'dropdown-toggle-'+$(this).index()); 137 }); 138 $('#nav li ul .nav-in>li:has(ul)').each(function(index) { 139 $('<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')); 140 $(this).find('ul:first').attr('aria-labelledby', 'sub-dropdown-toggle-'+index); 141 }); 142 $('#flyout >li:has(ul)').each(function() { 143 $('<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')); 144 $(this).find('ul:first').attr('aria-labelledby', 'flyout-dropdown-toggle-'+$(this).index()); 145 }); 146 147 function addNavClass() { 148 if ($window.width() < 992) { 149 // Insert needed for mobile 150 } else{ 151 // Insert needed for desktop 152 $('#nav ul, #flyout ul').css('display', ''); 153 } 154 } 155 addNavClass(); 156 $window.resize(addNavClass); 157 158 $(".toggle").on("click keydown",function(e) { 159 if (e.keyCode === 13 || e.type === 'click') { 160 e.preventDefault(); 161 var $parent = $(this).parent(); 162 var $parentLi = $parent.parent(); 163 $parent.toggleClass('opened'); 164 if($parent.addClass('active') && $(this).next('.first-level').is(":visible")){ 165 $(this).next('.first-level').slideUp(); 166 $parent.removeClass('active'); 167 $(this).attr({'aria-expanded': 'false'}); 168 } else { 169 $(this).attr({'aria-expanded': 'true'}); 170 $(".first-level").slideUp("slow"); 171 $parent.addClass('active'); 172 $(this).next('.first-level').slideToggle(); 173 } 174 } 175 }); 176 $(".toggle2").on("click keydown",function(e) { 177 if (e.keyCode === 13 || e.type === 'click') { 178 e.preventDefault(); 179 var $parent = $(this).parent(); 180 var $parentLi = $parent.parent(); 181 $parent.toggleClass('opened2'); 182 if($parent.addClass('active') && $(this).next('.second-level').is(":visible")){ 183 $(this).next('.second-level').slideUp(); 184 $parent.removeClass('active'); 185 $(this).attr({'aria-expanded': 'false'}); 186 } else { 187 $(this).attr({'aria-expanded': 'true'}); 188 $(".second-level").slideUp("slow"); 189 $parent.addClass('active'); 190 $(this).next('.second-level').slideToggle(); 191 } 192 } 193 }); 194 195 // close nav if left 196 $(".desktop *").focus(function(e){ 197 var $opened = $(".opened"); 198 var $opened2 = $(".opened2"); 199 if( $opened.length > 0 || $opened2.length > 0 ) { 200 if( $(".opened :focus").length < 1 ){ 201 $opened.children("ul").slideUp(); 202 $opened.removeClass("opened"); 203 $(".opened2").removeClass("opened2"); 204 } 205 if( $(".opened2 :focus").length < 1 ){ 206 $opened2.children("ul").slideUp(); 207 $opened2.removeClass("opened2"); 208 } 209 } 210 }); 211 212 // Flyout 213 var flyout = $('#flyout'), 214 flyoutwrap = $('#flyout-wrap'); 215 216 if (flyout.text().length){ 217 flyoutwrap.prepend('<div id="flyout-toggle" class="d-lg-none hidden-md"><i class="fa fa-bars"></i> Sub Menu</div>'); 218 } 219 220 $("#flyout-toggle").on("click", function(){ 221 flyout.slideToggle(); 222 $(this).toggleClass("active"); 223 }); 224 225 226 function fillSide(){ 227 var whiteSpace = parseFloat($('.container').css('margin-right')) + 15; 228 $('.fillLeft').css('margin-left',-whiteSpace); 229 $('.fillLeft.withPadding').css('padding-left',whiteSpace); 230 $('.fillRight').css('margin-right',-whiteSpace); 231 $('.fillRight.withPadding').css('padding-right',whiteSpace); 232 } 233 fillSide(); 234 $window.resize(fillSide); 235 236 /* 237 * E-Notify Auto submit 238 */ 239 $.urlParam=function(n){var e=new RegExp("[?&]"+n+"=([^]*)").exec(window.location.href);return null==e?null:e[1]||0}; 240 var $enotify = $('iframe[src*="/revize/plugins/notify/notify.jsp"]'); 241 if( $enotify.length > 0 ){ 242 var emailStr = $.urlParam("email"); 243 if( emailStr != null ){ 244 $enotify.attr("src", $enotify.attr("src") + "&email=" + emailStr); 245 } 246 } 247 248 // Make sure all calendars have unique ids 249 $('iframe[name="calendar"]').each(function (index, calendar) { 250 calendar.id = 'calendar-' + index; 251 }); 252 253 // Start Frame Resizer 254 function resizeIframe(height, frameElement) { 255 if ( frameElement ) { 256 frameElement.height = ""; 257 frameElement.height = height; 258 } 259 } 260 261 var eventMethod = window.addEventListener ? "addEventListener" : "attachEvent"; 262 var eventHandler = window[eventMethod]; 263 var messageEvent = eventMethod === "attachEvent" ? "onmessage" : "message"; 264 eventHandler(messageEvent, function (e) { 265 if ( Array.isArray(e.data) ) {
266 if( e.data[0] === "setCalHeight" || e.data[0] === "setNotifyHeight") { 267 var frames = document.querySelectorAll('iframe'); 268 for( var i = 0; i < frames.length; i++ ) { 269 if( frames[i].contentWindow === e.source ){ 270 resizeIframe(e.data[1], frames[i]); 271 } 272 } 273 } 274 } 275 }); 276 // End Frame Resizer 277 278 // Alert Close Caching 279 if ($("div.alert").length) { 280 var hide = window.sessionStorage && parseInt(window.sessionStorage.getItem("alertClosed")) > 1; 281 if (!hide || $(".user-logged-in").length != 0) { 282 $("div.alert").addClass('show'); 283 } 284 $("div.alert .close-alert").on('click', function(e) { 285 if (window.sessionStorage) { 286 window.sessionStorage.setItem("alertClosed",parseInt(window.sessionStorage.getItem("alertClosed")||0)+1); 287 } 288 }); 289 } 290 291 292 // tabs 293 $('#events-tabs .tab').click(function (e) { 294 var tabsIndex = $(this).index(); 295 console.log(tabsIndex); 296 $('#events-tabs .tab').removeClass('active'); 297 $(this).addClass('active'); 298 $('.tab-calendar').removeClass('active'); 299 $('.tab-calendar').hide(); 300 $('.tab-calendar').eq(tabsIndex).addClass('active'); 301 $('.tab-calendar').eq(tabsIndex).show(); 302 303 $('.tab-event').removeClass('active'); 304 $('.tab-event').hide(); 305 $('.tab-event').eq(tabsIndex).addClass('active'); 306 $('.tab-event').eq(tabsIndex).show(); 307 }); 308 309 310 var $translateButton = $('#translate-button'); 311 $translateButton.on('keydown click', function(e){ 312 if (e.keyCode === 13 || e.type === 'click') { 313 $('#translation-links ul').stop().fadeToggle(); 314 $translateButton.attr('aria-expanded', !('true' === $translateButton.attr('aria-expanded'))); 315 } 316 }); 317 318 $('#translation-links ul').on('mouseleave',function(){ 319 $(this).fadeOut(); 320 $translateButton.attr('aria-expanded', false); 321 }); 322 323 function removeCookieString(value, domain) { 324 domain = domain ? 'domain='+domain+'; ' : ''; 325 return value+'; expires=Thu, 01 Jan 1970 00:00:01 GMT; '+domain+'path=/'; 326 } 327 328 function unsetGoogtransCookie() { 329 for (var domains = window.location.hostname.split('.'); domains.length >= 2; domains.shift()) { 330 var cookieString = removeCookieString('googtrans=unset', domains.join('.')); 331 document.cookie=cookieString; 332 if (domains.length === 2) { 333 cookieString = removeCookieString('googtrans=unset', '.'+domains.join('.')); 334 document.cookie=cookieString; 335 } 336 } 337 document.cookie=removeCookieString('googtrans=unset'); 338 } 339 340 if (document.cookie.split(';').some(function(item) { return item.trim().startsWith('googtrans=/auto/en'); })) { 341 unsetGoogtransCookie(); 342 } 343 344 // Translate Script 345 var translateURL = "//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"; 346 $.getScript(translateURL); 347 $('#translation-links a').click(function(e) { 348 e.preventDefault(); 349 var lang = $(this).data('lang'); 350 var $frame = $('iframe.skiptranslate'); 351 if (!$frame.length) { 352 return false; 353 } 354 var $el = $frame.contents().find('span.text:contains(' + lang + ')').parent().parent().get(0); 355 356 if (!$el) { 357 $frame.contents().find('span.text:contains("English")').parent().parent().get(0); 358 } 359 $el.click(); 360 return false; 361 }); 362 363 var $translateReset = $('#translate-reset'); 364 $translateReset.on('keydown click', function(e){ 365 366 if (e.keyCode === 13 || e.type === 'click') { 367 $('iframe.skiptranslate').contents().find('span.text:contains("English")').parent().parent().get(0).click(); 368 } 369 }); 370 371 // Tiny Slider 372 if (typeof tns !== "undefined") { 373 $('.tiny-slider').each(function(i, el) { 374 tns({ 375 autoplay: true, 376 autoplayTimeout: 8000, 377 container: el, 378 items: 1, 379 lazyload: true, 380 lazyloadSelector: '.tns-lazy-img', // accompanied with data src or data-style 381 mode: "gallery", 382 preventScrollOnTouch: 'force', 383 autoplayButtonOutput: false, 384 nav:false, 385 controlsText: ['<i class="fa fa-angle-left" aria-hidden="true"></i>','<i class="fa fa-angle-right" aria-hidden="true"></i>'] 386 }); 387 }); 388 389 $('#news .tiny-carousel').each(function(i, el) { 390 var newsCount = $('#news .news').length; 391 var $el = $(el); 392 var tinyItemCount = $el.children().length; 393 var tinyItemData = $el.data('tinyItems') ? $el.data('tinyItems') : 6; 394 tns({ 395 container: el, 396 items: Math.min(tinyItemCount, tinyItemData), 397 lazyload: true, 398 lazyloadSelector: '.tns-lazy-img', // accompanied with data src or data-style 399 preventScrollOnTouch: 'force', 400 nav: false, 401 speed: 500, 402 controlsContainer: '#news-controls', 403 autoplayButtonOutput: false, 404 responsive: { 405 991: { 406 items: newsCount >= 3 ? 3 : newsCount 407 }, 408 650: { 409 items: newsCount >= 2 ? 2 : newsCount 410 }, 411 0: { 412 items: newsCount >= 1 ? 1 : newsCount 413 } 414 }, 415 loop: false, 416 gutter:30 417 }); 418 }); 419 420 $('#gallery-list .tiny-carousel').each(function(i, el) { 421 var galleryCount = $('#gallery-list .gallery-item').length; 422 var $el = $(el); 423 var tinyItemCount = $el.children().length; 424 var tinyItemData = $el.data('tinyItems') ? $el.data('tinyItems') : 6; 425 426 tns({ 427 container: el, 428 items: Math.min(tinyItemCount, tinyItemData), 429 lazyload: true, 430 lazyloadSelector: '.gallery-item', // accompanied with data src or data-style 431 preventScrollOnTouch: 'force', 432 controlsContainer: '#gallery-controls', 433 nav: false, 434 speed:500, 435 autoplayButtonOutput: false, 436 responsive: { 437 1400:{ 438 items: galleryCount >= 5 ? 5 : galleryCount 439 }, 440 1200:{ 441 items: galleryCount >= 4 ? 4 : galleryCount 442 }, 443 991: { 444 items: galleryCount >= 3 ? 3 : galleryCount 445 }, 446 0: { 447 items: galleryCount >= 2 ? 2 : galleryCount 448 } 449 }, 450 loop: false, 451 gutter:0 452 }); 453 }); 454 } 455 456 // Responsive Tables 457 $('.post table:not(.layout-table):not(.not-responsive)').wrap('<div class="table-responsive"></div>'); 458 $('.layout-table').attr('role', 'presentation'); 459 460 function moveHeaderTools() { 461 if ($(window).width() < 991) { 462 if (!$('.header_in-tools').parent().is('#toggles')) { 463 $('.header_in-tools').appendTo('#toggles'); 464 } 465 } else { 466 if ($('.header_in-tools').parent().is('#toggles')) { 467 $('.header_in-tools').insertBefore('.logo-wrap'); 468 } 469 } 470 } 471 472 // Call function on page load 473 moveHeaderTools(); 474 475 // Call function on window resize 476 $(window).resize(moveHeaderTools); 477 478 // Social tabs 479 if ($('body').attr('id') == 'homepage') { 480 $(".social-tab").on("click", function() { 481 var tabIndex = $(this).index(); 482 $('.social-tab').removeClass('active'); 483 $(this).addClass('active'); 484 $('social-tab-content').removeClass('active'); 485 $('.social-tab-content').eq(tabIndex).addClass('active'); 486 $('.social-tab-content').stop().hide(); 487 $('.social-tab-content').eq(tabIndex).stop().fadeIn(1000); 488 }); 489 } 490 491 $window.ready(function(){ 492 493 var currentUrl = window.location.href; 494 495 $('#nav li a').each(function() { 496 var menuLink = $(this).attr('href'); 497 if (currentUrl.indexOf(menuLink) !== -1) { 498 $('#nav li a').removeClass('active'); 499 $(this).addClass('active'); 500 } 501 }); 502 503 504 $('#nav>li').hover(function() { 505 if ($(this).children('ul').length > 0) {$('body').addClass('overlay');} 506 }, function() {$('body').removeClass('overlay')}); 507 508 509 if (typeof lightbox !== 'undefined') { 510 lightbox.option({ 511 'showImageNumberLabel': false, 512 }) 513 } 514 515 //#Smooth Scrolling 516 $('a[href*="#"]').not('[href="#"]').not('[href*="#collapse"]').click(function(event) { 517 if (location.pathname.replace(/^\//,'') === this.pathname.replace(/^\//,'') && location.hostname === this.hostname) { 518 var target = $(this.hash); 519 target = target.length ? target : $('[name=' + this.hash.slice(1) +']'); 520 if (target.length) { 521 event.preventDefault(); 522 $('html,body').animate({ 523 scrollTop: target.offset().top 524 }, 1000, function() { 525 var $target = $(target);
526 $target.focus(); 527 if ($target.is(":focus")) { 528 return false; 529 } else { 530 $target.attr('tabindex','-1'); 531 $target.focus(); 532 $target.removeAttr('tabindex'); 533 }; 534 }); 535 } 536 } 537 }); 538 539 540 var loadMoreButton = $('#load-highlights'); 541 var highlightBoxes = $('.highlight-box'); 542 var itemsToShow = 15; 543 var itemsShown = 0; 544 var isShowingMore = false; 545 546 if (highlightBoxes.length <= 15) { 547 loadMoreButton.addClass('hidden'); 548 } 549 550 551 function showNextItems() { 552 var nextItems = highlightBoxes.slice(itemsShown, itemsShown + itemsToShow); 553 nextItems.fadeIn().css('display', 'flex'); 554 itemsShown += itemsToShow; 555 if (itemsShown >= highlightBoxes.length) { 556 loadMoreButton.text('Show Less'); 557 isShowingMore = true; 558 } 559 } 560 561 function showLessItems() { 562 var itemsToHide = highlightBoxes.slice(itemsToShow); 563 itemsToHide.fadeOut(function() { 564 $(this).css('display', 'none'); 565 }); 566 itemsShown = itemsToShow; 567 loadMoreButton.text('Load More'); 568 isShowingMore = false; 569 } 570 571 loadMoreButton.on('click', function () { 572 if (isShowingMore) { 573 showLessItems(); 574 } else { 575 showNextItems(); 576 } 577 }); 578 579 // Initially load the first set of items 580 showNextItems(); 581 582 }); // Ready 583 584 // Slider video 585 if(typeof $.fn.YTPlayer !== 'undefined' && $('body').attr('id') == 'homepage'){ 586 $("#sliderVideo").YTPlayer(); 587 $('#wrapper_sliderVideo').css('z-index','1') 588 589 var interval = setInterval(hideControl,1000); 590 function hideControl(){ 591 var videoId = document.getElementById('wrapper_sliderVideo'); 592 if(videoId){ 593 if(videoId.style.opacity == '1'){ 594 clearInterval(interval); 595 $('#slider .tns-controls button').hide(); 596 }else{ 597 $('#slider .tns-controls button').show(); 598 } 599 } 600 } 601 602 } 603 604 605 606 // For curated search 607 $('#search button').on('click', function(){return false}); 608 609 // Search Tabs 610 $(".search-nav li").on('click',function() { 611 var tab = $(this).data('tab'); 612 $('.search-nav li').removeClass('active'); 613 $(this).addClass('active'); 614 615 $('#search-2 .g-search-wrap,#search-3 .g-search-wrap').html(''); 616 $('#search-results .tab-pane').removeClass('active'); 617 $(tab).addClass('active'); 618 $('#search-2.active .g-search-wrap').html('<iframe src="_assets_/plugins/search-box.html?q='+$('#search-input').val()+' site:https://www.edisonnj.org/ filetype:doc OR filetype:pdf OR filetype:docx"></iframe>'); 619 $('#search-3.active .g-search-wrap').html('<iframe src="_assets_/plugins/search-box.html?q='+$('#search-input').val()+' site:https://www.edisonnj.org/"></iframe>'); 620 621 setTimeout(function(){ 622 $('.g-search-wrap iframe').contents().find(".gsc-results-wrapper-overlay").css({ 623 width: "100%", 624 boxShadow: "none", 625 left: 0, 626 padding: "30px 0", 627 }); 628 }, 500) 629 }); 630 631 $('#search-input').focusin(function(){ 632 $('.search-nav li[data-tab="#search-3"]').click(); 633 }); 634 635 $('#close-curated').on('click',function(){ 636 $('#search-results').fadeOut(); 637 $('#curated-box').removeClass('results-open'); 638 $('#search-input').val(''); 639 }); 640 641 $(function(){ 642 643 function getCleanString(str){ 644 if(str.length){ 645 return str.replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&").replace(/"/g,"\"").replace(/'/g,"\'"); 646 } else { 647 return ""; 648 } 649 } 650 651 var searchStr = ""; 652 var throttle = null; 653 var timer; 654 var $input = $('#search-input'); 655 var termsArr = []; 656 //on keyup, start the countdown 657 $input.on('keyup', function () { 658 clearTimeout(timer); 659 timer = setTimeout(liveSearch, 600); 660 searchStr = $(this).val().toLowerCase(); 661 }); 662 $input.on('keydown', function () { 663 termsArr = []; 664 clearTimeout(timer); 665 }); 666 667 function liveSearch () { 668 if(searchStr.length >= 3){ 669 $('#search-results').fadeIn(); 670 $('.search-nav li[data-tab="#search-3"]').click(); 671 $('#curated-box').addClass('results-open'); 672 termsArr = searchStr.split(' '); 673 //$('#curated').fadeOut(); 674 $('#curated').html(''); 675 $.each(searchJson,function(i,el){ 676 var showRecord = true; 677 $.each(termsArr,function(k,str){ 678 if(el.terms.indexOf(str) < 0) showRecord = false 679 }); 680 if(showRecord){ 681 var tags = ""; 682 if(el.tags !== ""){ 683 tags = el.tags.split(",") 684 .map(function(val){ 685 return '<span>'+val+'</span>'; 686 }).join(''); 687 } 688 689 $('#curated').append('<div class="curated-item clearfix">' 690 + '<div class="pull-right">' 691 + (el.url === '#' ? '<h4>'+el.subheader+'</h4>' : '<a class="search-dept-url" href="'+el.deptUrl+'" target="'+el.deptTarget+'"><h4>'+el.subheader+'</h4></a>') 692 + (el.phone === '' ? '' : '<a class="search-icon" href="tel:'+el.phone+'"><i class="fa fa-phone"></i></a>') 693 + (el.email === '' ? '' : '<a class="search-icon" href="mailto:'+el.email+'"><i class="fa fa-envelope"></i></a>') 694 + (el.address === '' ? '' : '<a class="search-icon" href="maps.google.com/?q='+el.address+'"><i class="fa fa-map-marker"></i></a>') 695 + '</div>' 696 + '<h3 class="pull-left"><a href="'+el.url+'" target="'+el.target+'" class="clearfix">'+el.header+'</a><small style="display:block">'+el.description+'</small></h3>' 697 + '<div class="curated-tags">'+tags+'</div>' 698 + '</div>'); 699 } 700 }); 701 if(!$('.curated-item').length){ 702 $('#curated').append('<div class="curated-item"><h3>
702No keywords found. Use a different keyword or click on the All of Township of Edison tab...</h3></div>'); 703 } 704 } else { 705 $('#search-results').fadeOut(); 706 $('#curated-box').removeClass('results-open'); 707 } 708 } 709 }); 710 711})(jQuery); 712 713window.revizeCalendar_proto.fns.full.postRender = function (el, calendar) { 714 // Create the Export Calendar button 715 var exportButton = document.createElement("button"); 716 exportButton.id = "ics-view-export"; 717 exportButton.className = "btn btn-primary"; 718 exportButton.innerText = "Export Calendar"; 719 exportButton.addEventListener("click", function () { 720 window.revizeCalendar.fns.exportCalendar(calendar); 721 }); 722 el.append(exportButton); 723 724 // Months array 725 const months = [ 726 { value: "01", text: "January" }, 727 { value: "02", text: "February" }, 728 { value: "03", text: "March" }, 729 { value: "04", text: "April" }, 730 { value: "05", text: "May" }, 731 { value: "06", text: "June" }, 732 { value: "07", text: "July" }, 733 { value: "08", text: "August" }, 734 { value: "09", text: "September" }, 735 { value: "10", text: "October" }, 736 { value: "11", text: "November" }, 737 { value: "12", text: "December" } 738 ]; 739 740 const startYear = 2000; 741 const endYear = 2030; 742 743 // Get current search params 744 const urlParams = new URLSearchParams(window.location.search); 745 const currentMonth = urlParams.get('month') || new Date().getMonth() + 1; 746 const currentYear = urlParams.get('year') || new Date().getFullYear(); 747 748 // Ensure month is two digits 749 const currentMonthFormatted = String(currentMonth).padStart(2, '0'); 750 751 // Create and append month select 752 const $monthSelect = $('<select id="monthSelect"></select>'); 753 $.each(months, function (i, month) { 754 $monthSelect.append(`<option value="${month.value}">${month.text}</option>`); 755 }); 756 $monthSelect.val(currentMonthFormatted); // Set the initial value from the search params 757 758 // Create and append year select 759 const $yearSelect = $('<select id="yearSelect"></select>'); 760 for (let year = startYear; year <= endYear; year++) { 761 $yearSelect.append(`<option value="${year}">${year}</option>`); 762 } 763 $yearSelect.val(currentYear); // Set the initial value from the search params 764 765 // Append to the first .fc-button-group 766 const $buttonGroup = $('#calendar .fc-button-group').first(); 767 $buttonGroup.append($monthSelect); 768 $buttonGroup.append($yearSelect); 769 770 // Function to update search params 771 function updateSearchParams(month, year) { 772 const url = new URL(window.location.href); 773 const params = new URLSearchParams(url.search); 774 775 // Keep both month and year in the params 776 params.set('month', month); 777 params.set('year', year); 778 779 // Reload the page with the updated params 780 window.location.href = url.pathname + '?' + params.toString(); 781 } 782 783 // Event listeners for the dropdowns 784 $('#monthSelect, #yearSelect').on('change', function () { 785 const selectedMonth = $('#monthSelect').val(); 786 const selectedYear = $('#yearSelect').val(); 787 788 // Update the search params without losing the selected values 789 updateSearchParams(selectedMonth, selectedYear); 790 }); 791 }; 792 793 794 795if(document.body.id == "homepage" || document.body.id == "freeform" ){ 796 797 798}
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.