1/** 2 * 3 * This is the main JavaScript file for Radcliffe. 4 */ 5 6( function( $ ) { 7 8 var $window = $( window ); 9 10 // Manage full-screen featured images. 11 function fullScreenImages() { 12 var $entryBackground = $( '.entry-thumbnail' ), 13 $heroArea = $( '.hero-area' ), 14 $windowWidth = $window.width(), 15 $height = Math.round( $windowWidth / 1.33 ); 16 17 if ( $entryBackground ) { 18 // if we're on a blog/archive page, there may be more than one 19 if ( $entryBackground.length > 1 ){ 20 $entryBackground.each( function() { 21 // reset the height 22 $this_height = $height; 23 // find the .entry-header height 24 $entryHeader = $( this ).siblings( '.entry-header' ); 25 if ( $height < $entryHeader.outerHeight() ) { 26 // pick the taller of the two 27 $this_height = $entryHeader.outerHeight(); 28 } 29 $( this ).height( $this_height + 'px' ); 30 } ); 31 } else { 32 $entryBackground.height( Math.round( $windowWidth / 1.33 ) + 'px' ); 33 } 34 } 35 36 if ( $heroArea && $windowWidth > '768' ) { // Set a fixed height for larger screens 37 $heroArea.css( { 'height' : Math.round( $windowWidth / 1.33 ) + 'px', 'min-height' : 'auto' } ); 38 } 39 else if ( $heroArea ) { // Set a min-height for smaller screens 40 $heroArea.css( { 'min-height' : Math.round( $windowWidth / 1.33 ) + 'px', 'height' : 'auto' } ); 41 } 42 } 43 44 // Add SVG image zoom icon 45 function imageZoomIcon() { 46 $( '.single-product div.product .woocommerce-product-gallery .woocommerce-product-gallery__trigger' ) 47 .empty() 48 .append( screenReaderText.icon_zoom ); 49 } 50 51 // Initialize init on page load. 52 $( document ).on( 'ready', function() { 53 fullScreenImages(); 54 imageZoomIcon(); 55 }); 56 57 // ...and on each subsequent Infinite Scroll load, as well. 58 $( document ).on( 'post-load', function() { 59 fullScreenImages(); 60 }); 61 62 // One more time after everything (eg: Custom Fonts) has loaded for better height accuracy 63 $( window ).load( function() { 64 fullScreenImages(); 65 }); 66 67 // On window resize. 68 $( window ).on( 'resize', function() { 69 fullScreenImages(); 70 }); 71 72} )( 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.