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