1/** 2 * navigation.js 3 * 4 * Handles toggling the navigation menu for small screens. 5 */ 6( function() { 7 var container, button, menu; 8 9 container = document.getElementById( 'site-navigation' ); 10 if ( ! container ) 11 return; 12 13 button = container.getElementsByTagName( 'h4' )[0]; 14 if ( 'undefined' === typeof button ) 15 return; 16 17 menu = container.getElementsByTagName( 'ul' )[0]; 18 19 // Hide menu toggle button if menu is empty and return early. 20 if ( 'undefined' === typeof menu ) { 21 button.style.display = 'none'; 22 return; 23 } 24 25 if ( -1 === menu.className.indexOf( 'nav-menu' ) ) 26 menu.className += 'nav-menu'; 27 28 button.onclick = function() { 29 if ( -1 !== container.className.indexOf( 'main-small-navigation' ) ) 30 container.className = container.className.replace( 'main-small-navigation', 'main-navigation' ); 31 else 32 container.className = container.className.replace( 'main-navigation', 'main-small-navigation' ); 33 }; 34} )(); 35 36( function() { 37 var container, button, menu; 38 39 container = document.getElementById( 'top-site-navigation' ); 40 if ( ! container ) 41 return; 42 43 button = container.getElementsByTagName( 'h3' )[0]; 44 if ( 'undefined' === typeof button ) 45 return; 46 47 menu = container.getElementsByTagName( 'ul' )[0]; 48 49 // Hide menu toggle button if menu is empty and return early. 50 if ( 'undefined' === typeof menu ) { 51 button.style.display = 'none'; 52 return; 53 } 54 55 if ( -1 === menu.className.indexOf( 'nav-menu' ) ) 56 menu.className += 'nav-menu'; 57 58 button.onclick = function() { 59 if ( -1 !== container.className.indexOf( 'mobile-small-menu' ) ) 60 container.className = container.className.replace( 'mobile-small-menu', 'small-menu' ); 61 else 62 container.className = container.className.replace( 'small-menu', 'mobile-small-menu' ); 63 }; 64} )();
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.