1/** 2 * File navigation.js. 3 * 4 * Handles toggling the navigation menu for small screens and enables TAB key 5 * navigation support for dropdown menus. 6 */ 7( function() { 8 var container, button, menu, links, i, len; 9 10 container = document.getElementById( 'site-navigation' ); 11 if ( ! container ) { 12 return; 13 } 14 15 button = document.getElementById('menu-button'); 16 if ( 'undefined' === typeof button ) { 17 return; 18 } 19 20 menu = container.getElementsByTagName( 'ul' )[0]; 21 22 // Hide menu toggle button if menu is empty and return early. 23 if ( 'undefined' === typeof menu ) { 24 button.style.display = 'none'; 25 return; 26 } 27 28 if ( -1 === menu.className.indexOf( 'nav-menu' ) ) { 29 menu.className += ' nav-menu'; 30 } 31 32 button.onclick = function() { 33 if ( -1 !== container.className.indexOf( 'toggled' ) ) { 34 container.className = container.className.replace( ' toggled', '' ); 35 button.setAttribute( 'aria-expanded', 'false' ); 36 $(menu).slideUp(); 37 } else { 38 container.className += ' toggled'; 39 button.setAttribute( 'aria-expanded', 'true' ); 40 $(menu).slideDown(); 41 } 42 }; 43 44 // Close small menu when user clicks outside 45 document.addEventListener( 'click', function( event ) { 46 47 // Only dismiss the menu if it has been toggled on. 48 if ( -1 === container.className.indexOf( 'toggled' ) ) { 49 return; 50 } 51 52 var isClickInside = container.contains( event.target ); 53 var isClickInsideButton = button.contains( event.target ); 54 if ( ! isClickInside && !isClickInsideButton) { 55 container.className = container.className.replace( ' toggled', '' ); 56 button.setAttribute( 'aria-expanded', 'false' ); 57 $(menu).slideUp(); 58 } 59 } ); 60 61 // Get all the link elements within the menu. 62 links = menu.getElementsByTagName( 'a' ); 63 64 // Each time a menu link is focused or blurred, toggle focus. 65 for ( i = 0, len = links.length; i < len; i++ ) { 66 links[i].addEventListener( 'focus', toggleFocus, true ); 67 links[i].addEventListener( 'blur', toggleFocus, true ); 68 } 69 70 /** 71 * Sets or removes .focus class on an element. 72 */ 73 function toggleFocus() { 74 var self = this; 75 76 // Move up through the ancestors of the current link until we hit .nav-menu. 77 while ( -1 === self.className.indexOf( 'nav-menu' ) ) { 78 // On li elements toggle the class .focus. 79 if ( 'li' === self.tagName.toLowerCase() ) { 80 if ( -1 !== self.className.indexOf( 'focus' ) ) { 81 self.className = self.className.replace( ' focus', '' ); 82 } else { 83 self.className += ' focus'; 84 } 85 } 86 87 self = self.parentElement; 88 } 89 } 90 91 /** 92 * Toggles `focus` class to allow submenu access on tablets. 93 */ 94 ( function() { 95 var touchStartFn, 96 parentLink = container.querySelectorAll( '.menu-item-has-children > a, .page_item_has_children > a' ); 97 98 if ( 'ontouchstart' in window ) { 99 touchStartFn = function( e ) { 100 var menuItem = this.parentNode; 101 102 if ( ! menuItem.classList.contains( 'focus' ) ) { 103 e.preventDefault(); 104 for ( i = 0; i < menuItem.parentNode.children.length; ++i ) { 105 if ( menuItem === menuItem.parentNode.children[i] ) { 106 continue; 107 } 108 menuItem.parentNode.children[i].classList.remove( 'focus' ); 109 } 110 menuItem.classList.add( 'focus' ); 111 } else { 112 menuItem.classList.remove( 'focus' ); 113 } 114 }; 115 116 for ( i = 0; i < parentLink.length; ++i ) { 117 parentLink[i].addEventListener( 'touchstart', touchStartFn, false ); 118 } 119 } 120 }( container ) ); 121}() ); 122 123 124(function() { 125 let header = document.getElementById('masthead'); 126 if (!header || !('IntersectionObserver' in window)) { 127 return; 128 } 129 130 let html = document.documentElement; 131 let body = document.body; 132 133 body.classList.add('sticky-nav'); 134 html.style.setProperty('--sticky-nav-height', header.offsetHeight + 'px'); 135 body.classList.remove('sticky-nav'); 136 137 let mobileRegisterBar = document.querySelector('.mobile-register'); 138 if (mobileRegisterBar) { 139 html.style.setProperty('--mobile-register-height', mobileRegisterBar.offsetHeight + 'px'); 140 } 141 142 let headerPlaceholder = document.createElement('div'); 143 header.after(headerPlaceholder); 144 145 new IntersectionObserver(function(entries) { 146 let isSticky = !entries[0].isIntersecting; 147 if (isSticky === body.classList.contains('sticky-nav')) { 148 return; 149 } 150 headerPlaceholder.style.height = isSticky ? header.offsetHeight + 'px' : ''; 151 body.classList.toggle('sticky-nav', isSticky); 152 }).observe(headerPlaceholder); 153 154 let logoLink = header.querySelector('.site-branding a'); 155 156 document.querySelectorAll('.back-to-top, .footer-button').forEach(function(topButton) { 157 topButton.addEventListener('click', function(e) { 158 e.preventDefault(); 159 let prefersReducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches; 160 window.scrollTo({ top: 0, behavior: prefersReducedMotion ? 'auto' : 'smooth' }); 161 logoLink.focus({ preventScroll: true }); 162 }); 163 }); 164})(); 165 166 167 168$(document).ready(function() { 169 170
171 // Setting the "current" link on the nav bar. 172 let urlPath = window.location.pathname + $(location).attr('hash'); 173 $(".nav-item").each(function(){ 174 if($(this).attr("href") === urlPath){ 175 $(this).addClass("current"); 176 } 177 }) 178 179 // Handling the filter 180 $(".category-filter").on("click", function(e) { 181 182 e.preventDefault(); 183 let category = $(this).data("category") 184 185 if(category){ 186 187 // Set opacities and borders. 188 $('.small-session-card').filter(`[data-category!="${category}"]`).addClass("filtered"); 189 $('.small-session-card').filter(`[data-category="${category}"]`).removeClass("filtered"); 190 191 192 // Set the filtered to text. 193 $("#sessionFilterDropdown").html(category) 194 195 } else { 196 $('.small-session-card').removeClass("filtered"); 197 $("#sessionFilterDropdown").html("Filter Sessions by Stage ") 198 } 199 200 }) 201});
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.