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