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 var featuredContent, header, primary; 25 featuredContent = $( '#featured-content' ); 26 header = $( '#masthead' ); 27 primary = $( '#primary' ); 28 29 if ( ! featuredContent.length ) { 30 return; 31 } 32 33 /* Use Featured Image as a Background Image */ 34 featuredContent.find( '.hentry' ).each( function() { 35 if ( ! $( this ).hasClass( 'background-done' ) && $( this ).hasClass( 'has-post-thumbnail' ) ) { 36 var entryImage = $( this ).find( '.post-thumbnail' ), 37 thumbnail = $( this ).find( 'img' ); 38 entryImage.css( 'background-image', 'url(' + thumbnail.attr( 'src' ) + ')' ); 39 $( this ).addClass( 'background-done' ); 40 } 41 } ); 42 43 if ( ! header.length || ! primary.length ) { 44 return; 45 } 46 47 /* Move Featured Content in the DOM depending on the screen size */ 48 function featuredContentPosition() { 49 if ( $( window ).width() > 959 ) { 50 featuredContent.insertBefore( header ); 51 } else { 52 featuredContent.insertBefore( primary ); 53 } 54 featuredContent.show(); 55 } 56 57 $( window ).load( featuredContentPosition ).resize( debounce( featuredContentPosition, 500 ) ); 58 59} )( 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.