1 2 3/*----------------------------------------------------------------------------------- 4 5 Theme Name: City of Thomas, Michigan Webgen 6 Developers: Alec Armstrong & Derek Ortiz 7 Author HTML, CSS, and JavaScript: Richard Opiniano 8 Author Design: Samir Alley @samiralley 9 Author URI: http://www.revize.com/ 10 Date: 8/24/18 11 12-----------------------------------------------------------------------------------*/ 13 14(function($) { 15 16 17/*----------------------------------------------------------------------------------- 18 19 Theme Name: City of Thomas, Michigan Webgen 20 Developers: Alec Armstrong & Derek Ortiz 21 Author HTML, CSS, and JavaScript: Richard Opiniano 22 Author Design: Samir Alley @samiralley 23 Author URI: http://www.revize.com/ 24 Date: 8/24/18 25 26-----------------------------------------------------------------------------------*/ 27 28(function($) { 29 30 'use strict'; 31 32 var $window = $(window), 33 $body = $('body'); 34 35 $(function(){ 36 if(RZ.pageid === 'index'){ 37 $("#video-bg").YTPlayer(); 38 } 39 }); 40 41 /*! 42 * IE10 viewport hack for Surface/desktop Windows 8 bug 43 * Copyright 2014-2015 Twitter, Inc. 44 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 45 */ 46 47 // See the Getting Started docs for more information: 48 // http://getbootstrap.com/getting-started/#support-ie10-width 49 if (navigator.userAgent.match(/IEMobile\/10\.0/)) { 50 var msViewportStyle = document.createElement('style'); 51 msViewportStyle.appendChild( 52 document.createTextNode( 53 '@-ms-viewport{width:auto!important}' 54 ) 55 ); document.querySelector('head').appendChild(msViewportStyle); 56 } 57 58 /*! 59 * JavaScript Cookie v2.2.0 60 * https://github.com/js-cookie/js-cookie 61 * 62 * Copyright 2006, 2015 Klaus Hartl & Fagner Brack 63 * Released under the MIT license 64 */ 65 !function(e){var n;if("function"==typeof define&&define.amd&&(define(e),n=!0),"object"==typeof exports&&(module.exports=e(),n=!0),!n){var t=window.Cookies,o=window.Cookies=e();o.noConflict=function(){return window.Cookies=t,o}}}(function(){function f(){for(var e=0,n={};e<arguments.length;e++){var t=arguments[e];for(var o in t)n[o]=t[o]}return n}function a(e){return e.replace(/(%[0-9A-Z]{2}
65)+/g,decodeURIComponent)}return function e(u){function c(){}function t(e,n,t){if("undefined"!=typeof document){"number"==typeof(t=f({path:"/"},c.defaults,t)).expires&&(t.expires=new Date(1*new Date+864e5*t.expires)),t.expires=t.expires?t.expires.toUTCString():"";try{var o=JSON.stringify(n);/^[\{\[]/.test(o)&&(n=o)}catch(e){}n=u.write?u.write(n,e):encodeURIComponent(String(n)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),e=encodeURIComponent(String(e)).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent).replace(/[\(\)]/g,escape);var r="";for(var i in t)t[i]&&(r+="; "+i,!0!==t[i]&&(r+="="+t[i].split(";")[0]));return document.cookie=e+"="+n+r}}function n(e,n){if("undefined"!=typeof document){for(var t={},o=document.cookie?document.cookie.split("; "):[],r=0;r<o.length;r++){var i=o[r].split("="),c=i.slice(1).join("=");n||'"'!==c.charAt(0)||(c=c.slice(1,-1));try{var f=a(i[0]);if(c=(u.read||u)(c,f)||a(c),n)try{c=JSON.parse(c)}catch(e){}if(t[f]=c,e===f)break}catch(e){}}return e?t[e]:t}}return c.set=t,c.get=function(e){return n(e,!1)},c.getJSON=function(e){return n(e,!0)},c.remove=function(e,n){t(e,"",f(n,{expires:-1}))},c.defaults={},c.withConverter=e,c}(function(){})}); 66 67 /* 68 * E-Notify Auto submit 69 */ 70 $.urlParam=function(n){var e=new RegExp("[?&]"+n+"=([^]*)").exec(window.location.href);return null==e?null:e[1]||0}; 71 var $enotify = $('iframe[src*="/revize/plugins/notify/notify.jsp"]'); 72 if( $enotify.length > 0 ){ 73 var emailStr = $.urlParam("email"); 74 if( emailStr != null ){ 75 $enotify.attr("src", $enotify.attr("src") + "&email=" + emailStr); 76 } 77 } 78 79 // For large calendar 80 $('#freeform iframe[src="calendar_app/index.html#css=css/calendar_colors.css"]').attr({'id': 'calendar', 'title': 'calendar'}); 81 82 $('#skip').on('click', function(e) { 83 e.preventDefault(); 84 $('#main').focus(); 85 }); 86 87 function moveSkipLink() { 88 // Wait for UserWay widget to be present in DOM 89 if ($('.uwy').length) { 90 // Move skip link to be first child of body 91 $('body').prepend($('#skip')); 92 } else { 93 // If UserWay isn't loaded yet, try again in 100ms 94 setTimeout(moveSkipLink, 100); 95 } 96} 97 98// Start checking once document is ready 99$(document).ready(function() { 100 moveSkipLink(); 101}); 102 103 // ADA MENU 104 if (Cookies.get("highcontrast") == "on") { 105 $("html").addClass("highcontrast"); 106 $(".highcontrast #flyout li:has(ul)>a").css({ color: "#fff" }); 107 $("#highcontrast").text("High Contrast Off"); 108 } 109 if (Cookies.get("yellowlinks") == "on") { 110 $("html").addClass("yellowlinks"); 111 $("#yellowlinks").text("Yellow Links Off"); 112 } 113 if (Cookies.get("greyscale") == "on") { 114 $("html").addClass("greyscale"); 115 $("#greyscale").text("Grey Scale Off"); 116 } 117 if (Cookies.get("underline-links") == "on") { 118 $("html").addClass("underline-links"); 119 $("#underline-links").text("Underline Links Off"); 120 } 121 $(".accessible-btn a").on("click keydown", function(e) { 122 if (e.keyCode === 13 || e.type === 'click') { 123 e.preventDefault(); 124 $(this).parent().parent().toggleClass("visible"); 125 } 126 }); 127 $("#highcontrast").on("click keydown", function(e) { 128 if (e.keyCode === 13 || e.type === 'click') { 129 e.preventDefault(); 130 if (Cookies.get("highcontrast")) { 131 Cookies.remove("highcontrast"); 132 } else { 133 Cookies.set("highcontrast", "on", { expires: 7 }); 134 } 135 if (Cookies.get("highcontrast") == "on") { 136 $("html").addClass("highcontrast"); 137 $('#calendar').contents().find('html').addClass('highcontrast'); 138 $(this).text("High Contrast Off"); 139 } else { 140 $("html").removeClass("highcontrast"); 141 $('#calendar').contents().find('html').removeClass('highcontrast'); 142 $(this).text("High Contrast"); 143 } 144 } 145 }); 146 $("#yellowlinks").on("click keydown", function(e) { 147 if (e.keyCode === 13 || e.type === 'click') { 148 e.preventDefault(); 149 if (Cookies.get("yellowlinks")) { 150 Cookies.remove("yellowlinks"); 151 } else { 152 Cookies.set("yellowlinks", "on", { expires: 7 }); 153 } 154 if (Cookies.get("yellowlinks") == "on") { 155 $("html").addClass("yellowlinks"); 156 $('#calendar').contents().find('html').addClass('yellowlinks'); 157 $(this).text("Yellow Links Off"); 158 } else { 159 $("html").removeClass("yellowlinks"); 160 $('#calendar').contents().find('html').removeClass('yellowlinks'); 161 $(this).text("Yellow Links"); 162 } 163 } 164 }); 165 $("#greyscale").on("click keydown", function(e) { 166 if (e.keyCode === 13 || e.type === 'click') { 167 e.preventDefault(); 168 if (Cookies.get("greyscale")) { 169 Cookies.remove("greyscale"); 170 } else { 171 Cookies.set("greyscale", "on", { expires: 7 }); 172 } 173 if (Cookies.get("greyscale") == "on") { 174 $("html").addClass("greyscale"); 175 $('#calendar').contents().find('html').addClass('greyscale'); 176 $(this).text("Greyscale Off"); 177 } else { 178 $("html").removeClass("greyscale"); 179 $('#calendar').contents().find('html').removeClass('greyscale'); 180 $(this).text("Grey Scale"); 181 } 182 } 183 }); 184 $("#underline-links").on("click keydown", function(e) { 185 if (e.keyCode === 13 || e.type === 'click') { 186 e.preventDefault(); 187 if (Cookies.get("underline-links")) { 188 Cookies.remove("underline-links"); 189 } else { 190 Cookies.set("underline-links", "on", { expires: 7 }); 191 } 192 if (Cookies.get("underline-links") == "on") { 193 $("html").addClass("underline-links"); 194 $('#calendar').contents().find('html').addClass('underlink-links'); 195 $(this).text("Underline Links Off"); 196 } else { 197 $("html").removeClass("underline-links"); 198 $('#calendar').contents().find('html').removeClass('underlink-links'); 199 $(this).text("Underline Links"); 200 } 201 } 202 }); 203 // ADA MENU END 204 205 // Keyboard Navigation: Nav, flyout
206 var isClick = false; 207 $("#nav li a, #flyout li a, a, button, .toggle, .toggle2").on('focusin', function(e) { 208 if( isClick === false ) { 209 $(".focused").removeClass("focused"); 210 $(e.currentTarget).parents("#nav li, #flyout li").addClass("focused"); 211 $(".opened:not(.focused) ul:visible,.opened2:not(.focused) ul:visible").slideUp().parent().removeClass("opened opened2"); 212 } else { 213 $(".focused").removeClass("focused"); 214 isClick = false; 215 } 216 }); 217 218 // prevent focused class changes on click - This way arrows wont pop when clicking nav links 219 $("#nav a,#flyout a").on('mousedown',function(){ 220 isClick = true; 221 }); 222 223 // RZ Class 224 if(typeof RZ !== "undefined"){ 225 if(RZ.login){ 226 $body.addClass("user-logged-in"); 227 }else { 228 $body.addClass("user-not-logged-in"); 229 } 230 } 231 232 233 234 $('#cookieConsent').remove(); 235 236 // Search Toggle 237 $('#search-toggle').on('click keydown',function(e){ 238 if (e.keyCode === 13 || e.type === 'click') { 239 e.preventDefault(); 240 $('#search').stop().slideToggle(200); 241 $(this).toggleClass('fa-search fa-times'); 242 $("#search-input").focus(); 243 } 244 }); 245 246 $("#search-input").on("keydown", function (e) { 247 if (e.keyCode === 27 && $(window).width() < 992) { 248 $("#search").stop().slideUp(200); 249 $("#search-toggle").toggleClass("fa-search fa-times"); 250 $("#search-toggle").focus(); 251 } 252 }); 253 254 // Navigation Toggle 255 $("#nav-toggle").on("click", function(e){ 256 $("#nav").stop().slideToggle(); 257 $(this).toggleClass("fa-bars fa-times"); 258 }); 259 260 // Menu Toggles 261 $("#nav >li>ul,#flyout >li>ul").addClass('first-level'); 262 $("#nav li ul ul").addClass('second-level'); 263 $("#nav >li:has(ul)").find("a:first").append('<i class="fa fa-angle-down toggle" tabindex="0">'); 264 $("#nav li li:has(ul)").find("a:first").append('<i class="fa fa-angle-down toggle2" tabindex="0">'); 265 $("#flyout >li:has(ul)").find("a:first").append('<i class="fa fa-angle-down toggle" tabindex="0">'); 266 267 function mainSizer(){ 268 var mainHeight = $('#freeform main').outerHeight(); 269 var combinedHeight = $('header').outerHeight() + $('#slider').outerHeight() + $('footer').outerHeight(); 270 var windowHeight = $(window).height(); 271 272 if(mainHeight + combinedHeight < windowHeight){ 273 $('#freeform main').css('min-height',(windowHeight - combinedHeight) + 'px'); 274 } 275 } 276 277 function addNavClass() { 278 mainSizer(); 279 if ($window.width() < 992) { 280 $("body").addClass('mobile'); 281 $("body").removeClass('desktop'); 282 283 } else{ 284 $("body").addClass('mobile'); 285 $("body").removeClass('desktop'); 286 $('#nav ul').css('display','none'); 287 } 288 } 289 addNavClass(); 290 $window.resize(addNavClass); 291 292 $(".toggle").on("click keydown",function(e) { 293 if (e.keyCode === 13 || e.type === 'click') { 294 e.preventDefault(); 295 var $parent = $(this).parent(); 296 var $parentLi = $parent.parent(); 297 $parentLi.toggleClass('opened'); 298 if($parent.addClass('active').next('.first-level').is(":visible")){ 299 $parent.next('.first-level').slideUp(); 300 } else { 301 $(".first-level").slideUp("slow"); 302 $parent.removeClass('active').next('.first-level').slideToggle(); 303 } 304 } 305 }); 306 307 $(".toggle2").on("click keydown",function(e) { 308 if (e.keyCode === 13 || e.type === 'click') { 309 e.preventDefault(); 310 var $parent = $(this).parent(); 311 var $parentLi = $parent.parent(); 312 $parentLi.toggleClass('opened2'); 313 if($parent.next('.second-level').is(":visible")){ 314 $parent.next('.second-level').slideUp(); 315 } else { 316 $(".second-level").slideUp("slow"); 317 $parent.next('.second-level').slideToggle(); 318 } 319 } 320 }); 321 322 //colapse nav if left 323 $(".desktop *").focus(function(e){ 324 var $opened = $(".opened"); 325 var $opened2 = $(".opened2"); 326 if( $opened.length > 0 || $opened2.length > 0 ) { 327 if( $(".opened :focus").length < 1 ){ 328 $opened.children("ul").slideUp(); 329 $opened.removeClass("opened"); 330 $(".opened2").removeClass("opened2"); 331 } 332 if( $(".opened2 :focus").length < 1 ){ 333 $opened2.children("ul").slideUp(); 334 $opened2.removeClass("opened2"); 335 } 336 } 337 }); 338 339 $(document).on("keydown", "#nav", function (e) { 340 if (e.keyCode === 27 && $("#nav").is(":visible") && $(window).width() < 992) { 341 $("#nav").slideUp(); 342 $("#nav-toggle").removeClass("fa-times").addClass("fa-bars"); 343 $("#nav-toggle").focus(); 344 } 345 }); 346 347 // ADA, close menu on escape key (desktop nav) 348 $(document).on("keydown", "ul.menuUL.level1", function (e) { 349 if (e.keyCode === 27 && $("ul.menuUL.level1").is(":visible") && $(window).width() > 992) {
350 $("ul.menuUL.level1").slideUp(); 351 $(this).focus(); 352 } 353 }); 354 355 // Flyout 356 var flyout = $('#flyout'), 357 flyoutwrap = $('#flyout-wrap'); 358 359 if (flyout.text().length){ 360 flyoutwrap.prepend('<div tabindex="0" id="flyout-toggle" class="hidden-lg hidden-md"><i class="fa fa-bars"></i> Sub Menu</div>'); 361 } 362 363 $("#flyout-toggle").on("click keydown", function(e){ 364 if (e.keyCode === 13 || e.type === 'click') { 365 flyout.slideToggle(); 366 $(this).toggleClass("active"); 367 } 368 }); 369 370 $("#flyout").on("keydown", function (e) { 371 if (e.keyCode === 27 && $(window).width() < 992) { 372 flyout.slideUp(); 373 $("#flyout-toggle").removeClass("active"); 374 } 375 }); 376 377 $("#flyout li:last-child").on("keydown", function (e) { 378 if (e.keyCode === 9 && !e.shiftKey && $(window).width() < 992) { 379 flyout.slideUp(); 380 $("#flyout-toggle").removeClass("active"); 381 } 382 }); 383 384 // start calendar resize handler 385 function resizeIframe(height) { 386 var iFrameID = document.getElementById('calendar'); 387 var calendarHTML = $('#calendar').contents().find('html'); 388 calendarHTML.attr('lang', 'en'); 389 if(iFrameID) { 390 // here you can set the height, I delete it first, then I set it again 391 iFrameID.height = ""; 392 iFrameID.height = height; 393 } 394 if (Cookies.get("highcontrast") == "on") { 395 calendarHTML.addClass('highcontrast'); 396 } 397 if (Cookies.get("yellowlinks") == "on") { 398 calendarHTML.addClass('yellowlinks'); 399 } 400 if (Cookies.get("greyscale") == "on") { 401 calendarHTML.addClass("greyscale"); 402 } 403 if (Cookies.get("underline-links") == "on") { 404 calendarHTML.addClass("underline-links"); 405 } 406 $('#calendar').contents().find('#headerMonth').attr({'title': 'Month', 'aria-label': 'Month'}); 407 $('#calendar').contents().find('#headerYear').attr({'title': 'Year', 'aria-label': 'Year'}); 408 $('#calendar').contents().find('select[name="calendarName"]').attr({'title': 'Calendar Name', 'aria-label': 'Calendar Name'}); 409 } 410 var eventMethod = window.addEventListener 411 ? "addEventListener" 412 : "attachEvent"; 413 var eventHandler = window[eventMethod]; 414 var messageEvent = eventMethod === "attachEvent" 415 ? "onmessage" 416 : "message"; 417 eventHandler(messageEvent, function (e) { 418 419 if( e.data && e.data[0] === "setCalHeight" ) 420 { 421 if(typeof resizeIframe === 'function'){ 422 resizeIframe(e.data[1]); 423 } 424 425 } 426 427 }); 428 // end calendar resize handler 429 430 // bxSlider 431 if(typeof $.fn.bxSlider !== "undefined"){ 432 $('.bxslider').bxSlider({ 433 mode:'fade', 434 auto:($('.bxslider').children().length < 2) ? false : true, 435 pager: false 436 }); 437 } 438 439 $(".bx-prev").attr('aria-label', 'Previous Slide').attr("role", "button"); 440 $(".bx-next").attr('aria-label', 'Next Slide').attr("role", "button"); 441 $(".bx-prev, .bx-next").attr('tabindex', '0'); 442 443 // Owl Slider 444 if(typeof $.fn.owlCarousel !== "undefined"){ 445 var quickLinkCount = $('.quick-link').length; 446 $("#quick-links-carousel").owlCarousel({ 447 nav: quickLinkCount > 6, 448 navText: ['<i class="fas fa-chevron-left"></i>','<i class="fas fa-chevron-right"></i>'], 449 margin: quickLinkCount > 6 ? 80 : 0, 450 responsive: { 451 1367: { 452 items: (quickLinkCount >= 6 ? 6 : quickLinkCount), 453 autoplay: (quickLinkCount > 6 ? true : false), 454 nav: false 455 }, 456 1199: { 457 items: (quickLinkCount >= 5 ? 5 : quickLinkCount), 458 autoplay: (quickLinkCount > 5 ? true : false), 459 nav: false 460 }, 461 991: { 462 items: (quickLinkCount >= 4 ? 4 : quickLinkCount), 463 autoplay: (quickLinkCount > 4 ? true : false), 464 nav: true, 465 }, 466 767: { 467 items: (quickLinkCount >= 3 ? 3 : quickLinkCount), 468 autoplay: (quickLinkCount > 3 ? true : false), 469 nav: true 470 }, 471 479: { 472 items: (quickLinkCount >= 2 ? 2 : quickLinkCount), 473 autoplay: (quickLinkCount > 2 ? true : false), 474 nav: true 475 }, 476 0: { 477 items: 1, 478 autoplay: (quickLinkCount > 1 ? true : false), 479 nav: true 480 } 481 }, 482 autoplayTimeout:3000, 483 autoplayHoverPause:true, 484 stageElement: 'ul', 485 itemElement: 'li', 486 navText: ['<i class="fa fa-angle-left"></i>', '<i class="fa fa-angle-right"></i>'], 487 nav: true 488 }); 489 } 490 491 $(".owl-prev").attr('aria-label', 'Previous Slide').attr("role", "button"); 492 $(".owl-next").attr('aria-label', 'Next Slide').attr("role", "button"); 493 $(".owl-prev, .owl-next").attr('tabindex', '0'); 494 495 function observeOwlItemsForActiveClass() { 496 function updateTabindex() { 497 $(".owl-item").each(function () { 498 if ($(this).hasClass("active")) { 499 $(this).find("a.quick-link").attr("tabindex", "0"); 500 } else { 501 $(this).find("a.quick-link").attr("tabindex", "-1"); 502 } 503 }); 504 } 505 506 // MutationObserver callback to detect class changes 507 const observer = new MutationObserver(function (mutations) { 508 mutations.forEach(function (mutation) { 509 if (mutation.attributeName === "class") { 510 updateTabindex(); 511 } 512 }); 513 }); 514 515 // Observe each .owl-item element for changes in class attribute 516 $(".owl-item").each(function () { 517 observer.observe(this, { attributes: true }); 518 }); 519 520 // Initial tabindex setup in case some items are already active 521 updateTabindex(); 522 } 523 524 // Call the function to initialize the observer 525 observeOwlItemsForActiveClass(); 526 527 528 $(function(){// Ready 529 var colors = ['#EC7132','#0EB3D2','#A5C43C','#2A88E6','#6172E5','#4BBFDA']; 530 var max = 6; 531 var cIndex = 0; 532 $('.ql-icon').each(function(i,el){ 533 cIndex = cIndex === max ? 0 : cIndex; 534 $(this).css('background', colors[cIndex]); 535 cIndex++; 536 }); 537 }); 538 539 $window.ready(function(){ 540 var $translateButton = $("#translation-links span, #translation-links button"); 541 $translateButton.on('click', function(e){ 542 if (e.keyCode === 13 || e.type === 'click') { 543 $('#translation-links ul').stop().fadeToggle(); 544 } 545 }); 546 547 $('#translation-links ul').on('mouseleave',function(){ 548 $(this).fadeOut(); 549 }); 550 551 $("#translation-links ul").on("mouseleave", function () { 552 $(this).fadeOut(); 553 $translateButton.attr("aria-expanded", false); 554 }); 555 556 $("#translation-links ul").on("keydown", function (e) { 557 if (e.keyCode === 27) { 558 $(this).fadeOut(); 559 $translateButton.attr("aria-expanded", false); 560 $translateButton.focus(); 561 } 562 }); 563 564 var translateURL = "//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"; 565 566 // Translate Script 567 $.getScript(translateURL); 568 $('#translation-links a').click(function() { 569 var lang = $(this).data('lang'); 570 var $frame = $('iframe.skiptranslate'); 571 if (!$frame.length) { 572 return false;
573 } 574 var $el = $frame.contents().find('span.text:contains(' + lang + ')').parent().parent().get(0); 575 576 if (!$el) { 577 $frame.contents().find('span.text:contains("English")').parent().parent().get(0); 578 } 579 $el.click(); 580 return false; 581 }); 582 583 $('header ul.social-media-links').clone().insertAfter('#logo-footer'); 584 585 // matchHeight 586 if(typeof $.fn.matchHeight !== "undefined"){ 587 $('.equal').matchHeight({ 588 //defaults 589 byRow: true, 590 property: 'height', // height or min-height 591 target: null, 592 remove: false 593 }); 594 } 595 596 //#Smooth Scrolling 597 $('a[href*=#]:not([href=#],[href*="#collapse"])').click(function() { 598 if (location.pathname.replace(/^\//,'') === this.pathname.replace(/^\//,'') && location.hostname === this.hostname) { 599 var target = $(this.hash); 600 target = target.length ? target : $('[name=' + this.hash.slice(1) +']'); 601 if (target.length) { 602 $('html,body').animate({ 603 scrollTop: target.offset().top 604 }, 1000); 605 return false; 606 } 607 } 608 }); 609 610 /*global jQuery */ 611 /*! 612 * FlexVerticalCenter.js 1.0 613 * 614 * Copyright 2011, Paul Sprangers http://paulsprangers.com 615 * Released under the WTFPL license 616 * http://sam.zoy.org/wtfpl/ 617 * 618 * Date: Fri Oct 28 19:12:00 2011 +0100 619 */ 620 $.fn.flexVerticalCenter = function( options ) { 621 var settings = $.extend({ 622 cssAttribute: 'margin-top', // the attribute to apply the calculated value to 623 verticalOffset: 0, // the number of pixels to offset the vertical alignment by 624 parentSelector: null, // a selector representing the parent to vertically center this element within 625 debounceTimeout: 25, // a default debounce timeout in milliseconds 626 deferTilWindowLoad: false // if true, nothing will take effect until the $(window).load event 627 }, options || {}); 628 629 return this.each(function(){ 630 var $this = $(this); // store the object 631 var debounce; 632 633 // recalculate the distance to the top of the element to keep it centered 634 var resizer = function () { 635 636 var parentHeight = (settings.parentSelector && $this.parents(settings.parentSelector).length) ? 637 $this.parents(settings.parentSelector).first().height() : $this.parent().height(); 638 639 $this.css( 640 settings.cssAttribute, ( ( ( parentHeight - $this.height() ) / 2 ) + parseInt(settings.verticalOffset) ) 641 ); 642 }; 643 644 // Call on resize. Opera debounces their resize by default. 645 $(window).resize(function () { 646 clearTimeout(debounce); 647 debounce = setTimeout(resizer, settings.debounceTimeout); 648 }); 649 650 if (!settings.deferTilWindowLoad) { 651 // call it once, immediately. 652 resizer(); 653 } 654 655 // Call again to set after window (frames, images, etc) loads. 656 $(window).load(function () { 657 resizer(); 658 }); 659 660 }); 661 662 }; 663 $('.v-align').flexVerticalCenter(); 664 665 var $modal = $('#shareModal'); 666 667 $modal.on('shown.bs.modal', function () { 668 $modal.find('[tabindex="0"], a, button, input, select, textarea').first().focus(); 669 670 // Trap focus within the modal 671 $modal.on('keydown', function(e) { 672 var focusableElements = $modal.find('a, button, input, select, textarea, [tabindex]:not([tabindex="-1"])').filter(':visible'); 673 var firstElement = focusableElements.first(); 674 var lastElement = focusableElements.last(); 675 676 if (e.key === 'Tab') { 677 if (e.shiftKey) { 678 if (document.activeElement === firstElement[0]) { 679 e.preventDefault(); 680 lastElement.focus(); 681 } 682 } else { 683 if (document.activeElement === lastElement[0]) { 684 e.preventDefault(); 685 firstElement.focus(); 686 } 687 } 688 } 689 }); 690 }); 691 692 $modal.on('hidden.bs.modal', function () { 693 // Remove the keydown event listener when the modal is closed 694 $modal.off('keydown'); 695 }); 696 697 function fixGoogleTranslateInputs() { 698 // Simple mapping of IDs to labels 699 const inputs = [ 700 { id: 'goog-gt-votingInputSrcLang', label: 'Source Language Input' }, 701 { id: 'goog-gt-votingInputTrgLang', label: 'Target Language Input' }, 702 { id: 'goog-gt-votingInputSrcText', label: 'Source Text Input' }, 703 { id: 'goog-gt-votingInputTrgText', label: 'Target Text Input' }, 704 { id: 'goog-gt-votingInputVote', label: 'Vote Input' } 705 ]; 706
707 inputs.forEach(item => { 708 const input = document.getElementById(item.id); 709 if (input) { 710 input.setAttribute('aria-label', item.label); 711 } 712 }); 713 } 714 715 // Create a MutationObserver to watch for changes in the DOM 716 const googleObserver = new MutationObserver((mutationsList, observer) => { 717 for (let mutation of mutationsList) { 718 if (mutation.type === 'childList') { 719 fixGoogleTranslateInputs(); 720 } 721 } 722 }); 723 724 // Start observing the document body for added nodes 725 googleObserver.observe(document.body, { childList: true, subtree: true }); 726 727 // Initial call in case elements are already present 728 fixGoogleTranslateInputs(); 729 730 // Function to update the title attribute 731 function updateIframeTitle() { 732 const iframe = document.querySelector('#tmg-widget-iframe'); 733 if (iframe) { 734 iframe.setAttribute('title', 'Text My Gov'); 735 observer.disconnect(); // Stop observing once the title is updated 736 } 737 } 738 739 // Create a MutationObserver to watch for the #tmg-widget-iframe element 740 const observer = new MutationObserver((mutationsList, observer) => { 741 for (let mutation of mutationsList) { 742 if (mutation.type === 'childList') { 743 updateIframeTitle(); 744 } 745 } 746 }); 747
748 // Start observing the document body for added nodes 749 observer.observe(document.body, { childList: true, subtree: true }); 750 751 // Initial check in case the element is already in the DOM 752 updateIframeTitle(); 753 754 function removeEmptyNewsTitles() { 755 // Select all elements with the class .news-title 756 const newsTitles = document.querySelectorAll('.news-info > a > .news-title'); 757 758 newsTitles.forEach(title => { 759 // Check if the .news-title element has text content 760 if (!title.textContent.trim()) { 761 // Remove the parent anchor element from the DOM if .news-title has no text 762 const anchor = title.closest('a'); 763 if (anchor) { 764 anchor.remove(); 765 } 766 } 767 }); 768} 769 770// Call the function to remove empty news titles and their parent anchors 771removeEmptyNewsTitles(); 772 773// ADA, Docs toggle has proper aria-roles, outline, and focusability 774$(".docs-toggle").attr("tabindex", "0"); 775 $(".docs-toggle").each(function (e) { 776 var list = $(this).siblings(".inner-cat-wrap").first(); 777 var isExpanded = list.css("display") === "block"; 778 $(this).attr("aria-expanded", isExpanded); 779 var controlsId = "inner-cat-wrap-" + e; 780 $(this).attr("aria-controls", controlsId); 781 list.attr("id", controlsId); 782 }); 783 784 $(".docs-toggle").on("click keydown", function (e) { 785 if (e.type === "click" || e.key === "Enter" || e.key === " ") { 786 var currentOpen = $(this).attr("aria-expanded"); 787 $(".docs-toggle").each(function (e) { 788 $(this).attr("aria-expanded", "false"); 789 }); 790 } 791 792 if (e.key === "Enter" || e.key === " ") { 793 $(this).trigger("click"); 794 $(this).trigger("focus"); 795 $(this).attr("aria-expanded", currentOpen === "true" ? "false" : "true"); 796 } else if (e.type === "click") { 797 $(this).trigger("focus"); 798 $(this).attr("aria-expanded", currentOpen === "true" ? "false" : "true"); 799 } 800 }); 801 802 803 }); // Ready 804 805})(jQuery); 806 807$('header .col-md-4').attr('class','col-md-3'); 808$('header .col-md-8').attr('class','col-md-9'); 809$('<iframe src="https://eww.everbridge.net/web-widget/?o=KOOOS5rJ&s=O555JPdN" title="Everbridge Web Widget" style="width:404px;height:400px;">').prependTo($('#events')); 810})(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.