1'use strict'; 2 3/******/ (function() { // webpackBootstrap 4var __webpack_exports__ = {}; 5/** 6 * File navigation.js. 7 * 8 * Handles toggling the navigation menu for small screens and enables TAB key 9 * navigation support for dropdown menus. 10 */ 11(function () { 12 var container, button, menu, links, subMenus, i, len; 13 container = document.getElementById('site-navigation'); 14 if (!container) { 15 return; 16 } 17 button = container.getElementsByTagName('button')[0]; 18 if ('undefined' === typeof button) { 19 return; 20 } 21 menu = container.getElementsByTagName('ul')[0]; 22 23 // Hide menu toggle button if menu is empty and return early. 24 if ('undefined' === typeof menu) { 25 button.style.display = 'none'; 26 return; 27 } 28 menu.setAttribute('aria-expanded', 'false'); 29 if (-1 === menu.className.indexOf('nav-menu')) { 30 menu.className += ' nav-menu'; 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.setAttribute('aria-expanded', 'false'); 37 } else { 38 container.className += ' toggled'; 39 button.setAttribute('aria-expanded', 'true'); 40 menu.setAttribute('aria-expanded', 'true'); 41 } 42 }; 43 44 // Get all the link elements within the menu. 45 links = menu.getElementsByTagName('a'); 46 subMenus = menu.getElementsByTagName('ul'); 47 48 // Set menu items with submenus to aria-haspopup="true". 49 for (i = 0, len = subMenus.length; i < len; i++) { 50 subMenus[i].parentNode.setAttribute('aria-haspopup', 'true'); 51 } 52 53 // Each time a menu link is focused or blurred, toggle focus. 54 for (i = 0, len = links.length; i < len; i++) { 55 links[i].addEventListener('focus', toggleFocus, true); 56 links[i].addEventListener('blur', toggleFocus, true); 57 } 58 59 /** 60 * Sets or removes .focus class on an element. 61 */ 62 function toggleFocus() { 63 var self = this; 64 65 // Move up through the ancestors of the current link until we hit .nav-menu. 66 while (-1 === self.className.indexOf('nav-menu')) { 67 // On li elements toggle the class .focus. 68 if ('li' === self.tagName.toLowerCase()) { 69 if (-1 !== self.className.indexOf('focus')) { 70 self.className = self.className.replace(' focus', ''); 71 } else { 72 self.className += ' focus'; 73 } 74 } 75 self = self.parentElement; 76 } 77 } 78 79 /** 80 * Toggles `focus` class to allow submenu access on tablets. 81 */ 82 (function (container) { 83 var touchStartFn, 84 i, 85 parentLink = container.querySelectorAll('.menu-item-has-children > a, .page_item_has_children > a'); 86 if ('ontouchstart' in window) { 87 touchStartFn = function touchStartFn(e) { 88 var menuItem = this.parentNode, 89 i; 90 if (!menuItem.classList.contains('focus')) { 91 e.preventDefault(); 92 for (i = 0; i < menuItem.parentNode.children.length; ++i) { 93 if (menuItem === menuItem.parentNode.children[i]) { 94 continue; 95 } 96 menuItem.parentNode.children[i].classList.remove('focus'); 97 } 98 menuItem.classList.add('focus'); 99 } else { 100 menuItem.classList.remove('focus'); 101 } 102 }; 103 for (i = 0; i < parentLink.length; ++i) { 104 parentLink[i].addEventListener('touchstart', touchStartFn, false); 105 } 106 } 107 })(container); 108})(); 109/******/ })() 110;
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.