1/** 2 * navigation.js 3 * 4 * Handles toggling the navigation menu for small screens and enables tab 5 * support for dropdown menus. 6 */ 7( function() { 8 var nav = document.getElementById( 'site-navigation' ), button, menu; 9 if ( ! nav ) { 10 return; 11 } 12 13 button = nav.getElementsByTagName( 'button' )[0]; 14 menu = nav.getElementsByTagName( 'ul' )[0]; 15 if ( ! button ) { 16 return; 17 } 18 19 // Hide button if menu is missing or empty. 20 if ( ! menu || ! menu.childNodes.length ) { 21 button.style.display = 'none'; 22 return; 23 } 24 25 button.onclick = function() { 26 if ( -1 === menu.className.indexOf( 'nav-menu' ) ) { 27 menu.className = 'nav-menu'; 28 } 29 30 if ( -1 !== button.className.indexOf( 'toggled-on' ) ) { 31 button.className = button.className.replace( ' toggled-on', '' ); 32 menu.className = menu.className.replace( ' toggled-on', '' ); 33 } else { 34 button.className += ' toggled-on'; 35 menu.className += ' toggled-on'; 36 } 37 }; 38} )(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.