{"version":3,"sources":["flashy.js","polyfills.js","functions.js","navigation.js","search-toggle.js"],"names":["ciswaIntersectionObserver","observer","IntersectionObserver","entries","forEach","entry","isIntersecting","target","classList","add","unobserve","rootMargin","threshold","document","querySelectorAll","elements","length","elem","observe","window","NodeList","prototype","Array","Element","matches","msMatchesSelector","webkitMatchesSelector","closest","s","el","this","documentElement","contains","parentElement","parentNode","nodeType","addEventListener","event","body","toc","querySelector","innerHeight","offsetHeight","container","getElementById","menuToggleButton","navItems","mobileMenuOpen","currentMenuItem","toggleMobileMenu","getAttribute","setAttribute","remove","menuClick","e","button","currentTarget","toggleSubmenu","submenu","screenWidth","innerWidth","clientWidth","offsetParent","getBoundingClientRect","left","offsetWidth","preventOffScreenSubmenu","item","getElementsByClassName","id","link","getElementsByTagName","createElement","linkText","innerText","linkSVG","trim","undefined","appendChild","replaceChild","keyCode","focus","searchContainer","searchToggle","searchForm","searchInput","searchSubmit","searchFormOpen","toggleSearchForm"],"mappings":"aAeA,SAASA,4BACR,IAcMC,EAAW,IAAIC,qBATI,SAAUC,EAASF,GAC3CE,EAAQC,QAAS,SAAAC,GACXA,EAAMC,iBACVD,EAAME,OAAOC,UAAUC,IAAK,eAC5BR,EAASS,UAAWL,EAAME,YATL,CACvBI,WAAY,oBACZC,UAAW,KA8BZ,CAfoBC,SAASC,iBAAkB,mBAC5BD,SAASC,iBAAkB,uBAC3BD,SAASC,iBAAkB,wBACpBD,SAASC,iBAAkB,gCAClCD,SAASC,iBAAkB,wBAC3BD,SAASC,iBAAkB,MAClCD,SAASC,iBAAkB,oBACbD,SAASC,iBAAkB,sCAC/BD,SAASC,iBAAkB,kBAC5BD,SAASC,iBAAkB,uCAC7BD,SAASC,iBAAkB,gCAClBD,SAASC,iBAAkB,0BAC/BD,SAASC,iBAAkB,uBAGuIV,QACzL,SAAAW,GACM,OAASA,GAAY,IAAMA,EAASC,QACxCD,EAASX,QAAS,SAAAa,GACZ,OAASA,GACbhB,EAASiB,QAASD,OC7CpBE,O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B,eAC3CuC,EAAetE,SAAS+B,eAAgB,sBACxCwC,EAAavE,SAAS+B,eAAgB,yBACtCyC,EAAcD,EAAW5C,cAAe,sBACxC8C,EAAeF,EAAW5C,cAAe,uBAC3C+C,GAAiB,EAWrB,SAASC,IACRL,EAAahC,aAAc,iBAAmBoC,GAC9CH,EAAWjC,aAAc,cAAeoC,GACxCD,EAAanC,aAAc,WAAYoC,GAAkB,EAAI,GAC7DF,EAAYlC,aAAc,WAAYoC,GAAkB,EAAI,GAQ5DA,GAAmBA,EApBpBJ,EAAahC,aAAc,iBAAiB,GAC5CgC,EAAahC,aAAc,gBAAiB,oBAC5CiC,EAAWjC,aAAc,eAAe,GAGxCmC,EAAanC,aAAc,YAAa,GACxCkC,EAAYlC,aAAc,YAAa,GAkBvCgC,EAAa/C,iBAAkB,QAASoD,GAGxCN,EAAgB9C,iBAAkB,QAAS,SAAUkB,GAC/C,KAAOA,EAAE0B,SACRO,IACJC,IACAL,EAAaF,WAzCf","file":"../ciswa-front.min.js","sourcesContent":["/**\r\n * Make some things glow when they enter the screen\r\n */\r\n\r\nwindow.addEventListener( 'load', function( event ) {\r\n\r\n\tif ( 'undefined' === typeof IntersectionObserver ) {\r\n\t\tdocument.body.classList.add( 'no-intersection-observer' );\r\n\t} else {\r\n\t\tciswaIntersectionObserver();\r\n\t}\r\n\r\n}, false );\r\n\r\n\r\nfunction ciswaIntersectionObserver() {\r\n\tconst observerOptions = {\r\n\t\trootMargin: '-20% 0px -20% 0px', // shrink intersection \"window\" to 20% from top to 20% from bottom\r\n\t\tthreshold: 0.5\r\n\t};\r\n\r\n\tconst observerCallback = function( entries, observer ) {\r\n\t\tentries.forEach( entry => {\r\n\t\t\tif ( entry.isIntersecting ) {\r\n\t\t\t\tentry.target.classList.add( 'intersected' );\r\n\t\t\t\tobserver.unobserve( entry.target );\r\n\t\t\t}\r\n\t\t});\r\n\t};\r\n\r\n\tconst observer = new IntersectionObserver( observerCallback, observerOptions );\r\n\r\n\t// things to observe\r\n\tconst blockquotes = document.querySelectorAll( '.wp-block-quote' );\r\n\tconst pullquotes = document.querySelectorAll( '.wp-block-pullquote' );\r\n\tconst mediaTexts = document.querySelectorAll( '.wp-block-media-text' );\r\n\tconst mediaTextsCaption = document.querySelectorAll( '.is-style-media-text-caption' );\r\n\tconst videoTexts = document.querySelectorAll( '.is-style-video-text' );\r\n\tconst separators = document.querySelectorAll( 'hr' );\r\n\tconst h2s = document.querySelectorAll( '.page-content h2' );\r\n\tconst demographicsStats = document.querySelectorAll( '.impact-section--demographics_bars' );\r\n\tconst outcomesStats = document.querySelectorAll( '.outcomes_stat' );\r\n\tconst impactButton = document.querySelectorAll( '#impact-section-demographics-button' );\r\n\tconst impactKids = document.querySelectorAll( '#impact-section--totals_kids' );\r\n\tconst siteCoordinatorIcon = document.querySelectorAll( '#site-coordinator-icon' );\r\n\tconst homeMissionIcon = document.querySelectorAll( '#home-mission-icon' );\r\n\r\n\t// attach observe handler to every element\r\n\t[ blockquotes, pullquotes, mediaTexts, mediaTextsCaption, videoTexts, separators, h2s, demographicsStats, outcomesStats, impactButton, impactKids, siteCoordinatorIcon, homeMissionIcon ].forEach(\r\n\t\telements => {\r\n\t\t\tif ( null !== elements && 0 !== elements.length ) {\r\n\t\t\t\telements.forEach( elem => {\r\n\t\t\t\t\tif ( null !== elem ) {\r\n\t\t\t\t\t\tobserver.observe( elem );\r\n\t\t\t\t\t}\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t}\r\n\t);\r\n\r\n}\r\n","/*=================================\r\n= Polyfills =\r\n=================================*/\r\n\r\n/*\r\n * NodeList.forEach\r\n * https://developer.mozilla.org/en-US/docs/Web/API/NodeList/forEach#Polyfill\r\n */\r\nif (window.NodeList && ! NodeList.prototype.forEach) {\r\n\tNodeList.prototype.forEach = Array.prototype.forEach;\r\n}\r\n\r\n/*\r\n * Element.closest()\r\n * https://developer.mozilla.org/en-US/docs/Web/API/Element/closest\r\n */\r\nif ( ! Element.prototype.matches ) {\r\n\tElement.prototype.matches = Element.prototype.msMatchesSelector ||\r\n\t\t\t\t\t\t\t\tElement.prototype.webkitMatchesSelector;\r\n}\r\n\r\nif ( ! Element.prototype.closest ) {\r\n\tElement.prototype.closest = function( s ) {\r\n\t\tvar el = this;\r\n\t\tif ( ! document.documentElement.contains( el ) ) {\r\n\t\t\treturn null;\r\n\t\t};\r\n\t\tdo {\r\n\t\t\tif ( el.matches( s ) ) {\r\n\t\t\t\treturn el;\r\n\t\t\t};\r\n\t\t\tel = el.parentElement || el.parentNode;\r\n\t\t} while ( null !== el && 1 === el.nodeType );\r\n\t\treturn null;\r\n\t};\r\n}","( function() {\r\n\r\n\tconst toc = document.querySelector('.wp-block-simpletoc-toc');\r\n\tif( null !== toc ) {\r\n\t\tif( window.innerHeight > toc.offsetHeight ) {\r\n\t\t\ttoc.classList.add('can-be-stuck')\r\n\t\t}\r\n\t}\r\n\r\n}() );\r\n","( function() {\r\n\r\n\t// DOM element(s)\r\n\tconst container = document.getElementById( 'site-navigation' );\r\n\tconst menuToggleButton = document.getElementById( 'site-navigation_toggle' );\r\n\tconst navItems = document.querySelectorAll( '#site-navigation_menu > li' );\r\n\r\n\t// state variables\r\n\tlet mobileMenuOpen = false;\r\n\tlet currentMenuItem = false;\r\n\r\n\t// iteration variables\r\n\tlet i, len;\r\n\r\n\t/*==========================================\r\n\t= Mobile Menu Toggle =\r\n\t==========================================*/\r\n\r\n\t// set up attributes\r\n\tmenuToggleButton.setAttribute( 'aria-controls', 'site-navigation_menu' );\r\n\tmenuToggleButton.setAttribute( 'aria-expanded', 'false' );\r\n\r\n\tfunction toggleMobileMenu() {\r\n\r\n\t\tif ( 'true' === menuToggleButton.getAttribute( 'aria-expanded' ) ) {\r\n\r\n\t\t\tmenuToggleButton.setAttribute( 'aria-expanded', false );\r\n\t\t\tcontainer.classList.remove( 'is-open' );\r\n\t\t\tmobileMenuOpen = false;\r\n\r\n\t\t} else {\r\n\r\n\t\t\tcontainer.classList.add( 'is-open' );\r\n\t\t\tmenuToggleButton.setAttribute( 'aria-expanded', true );\r\n\t\t\tmobileMenuOpen = true;\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n\tmenuToggleButton.addEventListener( 'click', toggleMobileMenu );\r\n\r\n\t/*===================================================\r\n\t= Menu Open / Close Functions =\r\n\t===================================================*/\r\n\tfunction menuClick( e ) {\r\n\r\n\t\tconst button = e.currentTarget;\r\n\r\n\t\tif ( currentMenuItem && button !== currentMenuItem ) {\r\n\t\t\ttoggleSubmenu( currentMenuItem );\r\n\t\t}\r\n\r\n\t\ttoggleSubmenu( button );\r\n\r\n\t}\r\n\r\n\tfunction toggleSubmenu( button ) {\r\n\r\n\t\tconst submenu = document.getElementById( button.getAttribute( 'aria-controls' ) );\r\n\r\n\t\tif ( 'true' === button.getAttribute( 'aria-expanded' ) ) {\r\n\r\n\t\t\tbutton.setAttribute( 'aria-expanded', false );\r\n\t\t\tsubmenu.setAttribute( 'aria-hidden', true );\r\n\t\t\tcurrentMenuItem = false;\r\n\r\n\t\t} else {\r\n\r\n\t\t\tbutton.setAttribute( 'aria-expanded', true );\r\n\t\t\tsubmenu.setAttribute( 'aria-hidden', false );\r\n\t\t\tpreventOffScreenSubmenu( submenu );\r\n\t\t\tcurrentMenuItem = button;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\t// adds a class to submenus that will get clipped off by the right edge of the browser\r\n\tfunction preventOffScreenSubmenu( submenu ) {\r\n\r\n\t\tconst screenWidth =\twindow.innerWidth ||\r\n\t\t\t\t\t\t\tdocument.documentElement.clientWidth ||\r\n\t\t\t\t\t\t\tdocument.body.clientWidth;\r\n\t\tconst parent = submenu.offsetParent; // visible in the DOM before submenu\r\n\t\tconst menuLeftEdge = parent.getBoundingClientRect().left;\r\n\t\tconst menuRightEdge = menuLeftEdge + submenu.offsetWidth;\r\n\r\n\t\tif ( menuRightEdge + 25 > screenWidth ) { // adding 25 so it's not too close\r\n\t\t\tsubmenu.classList.add( 'sub-menu--right' );\r\n\t\t}\r\n\r\n\t}\r\n\r\n\t/*===========================================================\r\n\t= Modify Menu Markup & Bind Listeners =\r\n\t=============================================================*/\r\n\t/*\r\n\t *\t1. replacing top-level links with buttons if there's a submenu\r\n\t *\t2. setting appropriate aria on buttons and submenus\r\n\t */\r\n\tnavItems.forEach( ( item ) => {\r\n\r\n\t\tlet submenu = item.getElementsByClassName( 'sub-menu' )[0];\r\n\r\n\t\tif ( 'undefined' !== typeof submenu ) {\r\n\r\n\t\t\tlet id = item.getAttribute( 'id' ) + '-sub-menu';\r\n\t\t\tlet link = item.getElementsByTagName( 'a' )[0];\r\n\t\t\tlet button = document.createElement( 'button' );\r\n\t\t\tlet linkText = link.innerText;\r\n\t\t\tlet linkSVG = link.getElementsByTagName( 'svg' )[0];\r\n\r\n\t\t\t// copy link attributes into button element, add ARIA to button\r\n\t\t\tbutton.innerText = linkText.trim();\r\n\t\t\tif ( linkSVG !== undefined ) {\r\n\t\t\t\tbutton.appendChild( linkSVG );\r\n\t\t\t}\r\n\t\t\tbutton.setAttribute( 'aria-controls', id );\r\n\t\t\tbutton.setAttribute( 'aria-expanded', false );\r\n\t\t\titem.replaceChild( button, link );\r\n\r\n\t\t\t// tweak submenu\r\n\t\t\tsubmenu.setAttribute( 'id', id );\r\n\t\t\tsubmenu.setAttribute( 'aria-hidden', true );\r\n\r\n\t\t\t// bind event listener to button\r\n\t\t\tbutton.addEventListener( 'click', menuClick );\r\n\r\n\t\t}\r\n\r\n\t});\r\n\r\n\tdocument.addEventListener( 'click', function( e ) {\r\n\r\n\t\tif ( currentMenuItem && ! e.target.closest( '#site-navigation' ) ) {\r\n\t\t\ttoggleSubmenu( currentMenuItem );\r\n\t\t}\r\n\r\n\t});\r\n\r\n\t/*\r\n\t * Handle ESC Key in Navigation\r\n\t *\r\n\t * \t- Close mobile menu and set focus to toggle if mobile menu is open\r\n\t * \t- Close current submenu and return focus to parent item if submenu is open\r\n\t */\r\n\tcontainer.addEventListener( 'keyup', function( e ) {\r\n\r\n\t\tif ( 27 === e.keyCode ) {\r\n\r\n\t\t\t// mobile menu is open and no submenus are open => close mobile menu\r\n\t\t\tif ( mobileMenuOpen && ! currentMenuItem ) {\r\n\r\n\t\t\t\ttoggleMobileMenu();\r\n\t\t\t\tmenuToggleButton.focus();\r\n\r\n\t\t\t// focus is in the open submenu => close submenu, focus parent button\r\n\t\t\t} else if ( e.target.closest( '.sub-menu' ) ) {\r\n\r\n\t\t\t\tcurrentMenuItem.focus();\r\n\t\t\t\ttoggleSubmenu( currentMenuItem );\r\n\r\n\t\t\t// focus is on menu item but not in submenu => close open submenu\r\n\t\t\t// (leave focus alone)\r\n\t\t\t} else {\r\n\r\n\t\t\t\ttoggleSubmenu( currentMenuItem );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t});\r\n\r\n}() );\r\n","( function() {\r\n\r\n\tconst searchContainer = document.getElementById( 'site-search' );\r\n\tconst searchToggle = document.getElementById( 'site-search_toggle' );\r\n\tconst searchForm = document.getElementById( 'site-search_container' );\r\n\tconst searchInput = searchForm.querySelector( '.search-form_field' );\r\n\tconst searchSubmit = searchForm.querySelector( '.search-form_submit' );\r\n\tlet searchFormOpen = false;\r\n\r\n\t// set up ARIA\r\n\tsearchToggle.setAttribute( 'aria-expanded', false );\r\n\tsearchToggle.setAttribute( 'aria-controls', 'site-search-form' );\r\n\tsearchForm.setAttribute( 'aria-hidden', true );\r\n\t\r\n\t// hiding via aria-hidden & tabindex to allow for show/hide transitions\r\n\tsearchSubmit.setAttribute( 'tabindex', -1 );\r\n\tsearchInput.setAttribute( 'tabindex', -1 );\r\n\r\n\tfunction toggleSearchForm() {\r\n\t\tsearchToggle.setAttribute( 'aria-expanded', ! searchFormOpen );\r\n\t\tsearchForm.setAttribute( 'aria-hidden', searchFormOpen );\r\n\t\tsearchSubmit.setAttribute( 'tabindex', searchFormOpen ? -1 : 0 );\r\n\t\tsearchInput.setAttribute( 'tabindex', searchFormOpen ? -1 : 0 );\r\n\r\n/*\t\tif ( ! searchFormOpen ) {\r\n\t\t\tsearchToggle.setAttribute( 'aria-label', 'Hide Search Form' );\r\n\t\t\tsearchInput.focus();\r\n\t\t} else {\r\n\t\t\tsearchToggle.setAttribute( 'aria-label', 'Show Search Form' );\r\n\t\t}*/\r\n\t\tsearchFormOpen = ! searchFormOpen;\r\n\t}\r\n\r\n\t// Attach event handlers for search toggle\r\n\tsearchToggle.addEventListener( 'click', toggleSearchForm );\r\n\r\n\t// esc key in form closes search and returns to toggle button\r\n\tsearchContainer.addEventListener( 'keyup', function( e ) {\r\n\t\tif ( 27 === e.keyCode ) {\r\n\t\t\tif ( searchFormOpen ) {\r\n\t\t\t\ttoggleSearchForm();\r\n\t\t\t\tsearchToggle.focus();\r\n\t\t\t}\r\n\t\t}\r\n\t});\r\n\r\n}() );\r\n"]}