1( function( $ ) { 2 3 var debounce = function( func, wait ) { 4 var timeout, args, context, timestamp; 5 return function() { 6 context = this; 7 args = [].slice.call( arguments, 0 ); 8 timestamp = new Date(); 9 var later = function() { 10 var last = ( new Date() ) - timestamp; 11 if ( last < wait ) { 12 timeout = setTimeout( later, wait - last ); 13 } else { 14 timeout = null; 15 func.apply( context, args ); 16 } 17 }; 18 if ( ! timeout ) { 19 timeout = setTimeout( later, wait ); 20 } 21 }; 22 }; 23 24 function menuDropdownToggle() { 25 $( '.main-navigation .page_item_has_children > a, .main-navigation .menu-item-has-children > a, .widget_nav_menu .page_item_has_children > a, .widget_nav_menu .menu-item-has-children > a' ).each( function() { 26 if ( ! $( this ).find( '.dropdown-toggle' ).length ) { 27 $( this ).append( '<button class="dropdown-toggle" aria-expanded="false"/>' ); 28 } 29 } ); 30 31 if ( $( window ).width() > 959 ) { 32 $( '.main-navigation .dropdown-toggle' ).remove(); 33 } 34 } 35 36 $( window ).load( menuDropdownToggle ).resize( debounce( menuDropdownToggle, 500 ) ); 37 38 $( window ).load( function() { 39 var menu = $( '#masthead' ).find( 'div' ); 40 if ( ! menu || ! menu.children().length ) { 41 return; 42 } 43 44 $( '.dropdown-toggle' ).click( function( event ) { 45 event.preventDefault(); 46 $( this ).toggleClass( 'toggled' ); 47 $( this ).parent().next( '.children, .sub-menu' ).toggleClass( 'toggled' ); 48 $( this ).attr( 'aria-expanded', $( this ).attr( 'aria-expanded' ) === 'false' ? 'true' : 'false' ); 49 } ); 50 51 if ( 'ontouchstart' in window ) { 52 menu.find( '.menu-item-has-children > a' ).on( 'touchstart', function( e ) { 53 var el = $( this ).parent( 'li' ); 54 55 if ( ! el.hasClass( 'focus' ) ) { 56 e.preventDefault(); 57 el.toggleClass( 'focus' ); 58 el.siblings( '.focus' ).removeClass( 'focus' ); 59 } 60 } ); 61 } 62 63 menu.find( 'a' ).on( 'focus blur', function() { 64 $( this ).parents( '.menu-item' ).toggleClass( 'focus' ); 65 } ); 66 } ); 67 68} )( jQuery ); 69 70( function() { 71 72 var container, button, menu; 73 74 container = document.getElementById( 'site-navigation' ); 75 if ( ! container ) { 76 return; 77 } 78 79 button = container.getElementsByTagName( 'button' )[0]; 80 if ( 'undefined' === typeof button ) { 81 return; 82 } 83 84 menu = container.getElementsByTagName( 'ul' )[0]; 85 if ( 'undefined' === typeof menu ) { 86 button.style.display = 'none'; 87 return; 88 } 89 menu.setAttribute( 'aria-expanded', 'false' ); 90 91 if ( -1 === menu.className.indexOf( 'nav-menu' ) ) { 92 menu.className += ' nav-menu'; 93 } 94 95 button.onclick = function() { 96 if ( -1 !== container.className.indexOf( 'toggled' ) ) { 97 container.className = container.className.replace( ' toggled', '' ); 98 button.setAttribute( 'aria-expanded', 'false' ); 99 menu.setAttribute( 'aria-expanded', 'false' ); 100 } else { 101 container.className += ' toggled'; 102 button.setAttribute( 'aria-expanded', 'true' ); 103 menu.setAttribute( 'aria-expanded', 'true' ); 104 } 105 }; 106 107} )();
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.