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 headerStyle() { 25 var featuredContent, featuredContentHeight; 26 27 featuredContent = $( '#featured-content' ); 28 featuredContentHeight = 0; 29 if ( featuredContent.length ) { 30 featuredContentHeight = featuredContent.outerHeight(); 31 } 32 33 if ( $( '.site-branding' ).outerWidth() === 0 ) { 34 $( 'body' ).addClass( 'no-branding' ); 35 } else { 36 $( 'body' ).removeClass( 'no-branding' ); 37 } 38 39 if ( $( '.site-branding' ).outerWidth() + $( '.main-navigation' ).outerWidth() + 15 >= $( '.site-header-inner' ).outerWidth() && $( window ).width() > 839 ) { 40 $( 'body' ).addClass( 'long-menu' ); 41 $( '.main-navigation' ).css( 'margin-top', '' ); 42 } else if ( $( window ).width() < 840 ) { 43 $( 'body' ).removeClass( 'long-menu' ); 44 $( '.main-navigation' ).css( 'margin-top', '' ); 45 } else { 46 $( 'body' ).removeClass( 'long-menu' ); 47 $( '.main-navigation' ).css( 'margin-top', ( $( '.site-header' ).height() - $( '.main-navigation' ).outerHeight() ) / 2 ); 48 } 49 50 $( window ).scroll( function() { 51 if ( $( document.body ).hasClass( 'unfixed-header' ) ) { 52 return; 53 } 54 55 if ( $( document ).scrollTop() > featuredContentHeight && $( window ).width() > 959 ) { 56 $( document.body ).addClass( 'fixed' ).css( 'padding-top', $( '#masthead' ).outerHeight() ); 57 } else { 58 $( document.body ).removeClass( 'fixed' ).css( 'padding-top', '' ); 59 } 60 } ); 61 } 62 63 $( window ).load( headerStyle ).resize( debounce( headerStyle, 500 ) ); 64 65} )( 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.