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