1( function( $) { 2 $( window ).load( function() { 3 setSidebarHeight(); 4 window.onresize = setSidebarHeight; 5 6 /** 7 * Set the related posts sidebar below other sidebar items and enable scrollbar if the main content height is too small. 8 * This is only run if contentWidth is larger than 1294px. 9 */ 10 function setSidebarHeight() { 11 const sidebarMargin = 22; 12 const targetContentWidth = 1249; 13 const article = document.querySelector( '.entry-content' ); 14 const sidebar = document.querySelector( '.ala-single-sidebar-related' ); 15 const sidebarWrapper = document.querySelector( '.sidebar-related' ); 16 const sidebarContent = document.querySelector( '.ala-sidebar-content' ); 17 const author = document.querySelector( '.ala-author' ); 18 const minutiae = document.querySelector( '.ala-single-sidebar-minutiae' ); 19 const vw = Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0); 20 21 if ( article && sidebar ) { 22 if ( vw >= targetContentWidth ) { 23 let offsetTop = 0; 24 const articleHeight = article.clientHeight; 25 let authorHeight = 0; 26 let minutiaeHeight = 0; 27 const sidebarHeight = sidebarContent.clientHeight; 28 const contentHeight = (authorHeight + articleHeight - minutiaeHeight - 80); 29 30 let sidebarRect = sidebarWrapper.getBoundingClientRect(); 31 let offsetTopSidebar = sidebarRect.top + window.scrollY; 32 33 if ( author ) { 34 authorHeight = author.clientHeight; 35 } 36 37 if ( minutiae ) { 38 let rect = minutiae.getBoundingClientRect(); 39 offsetTop = rect.top + window.scrollY; 40 minutiaeHeight = minutiae.clientHeight; 41 } 42 43 sidebar.style.top = (sidebarMargin + offsetTop - offsetTopSidebar + minutiaeHeight ) + 'px'; 44 if ( contentHeight < sidebarHeight ) { 45 sidebarContent.style.height = (authorHeight + articleHeight - minutiaeHeight - 80) + 'px'; 46 } 47 sidebar.style.visibility = 'visible'; 48 } else { 49 sidebarContent.style.height = 'auto'; 50 } 51 } 52 } 53 }); 54} )( 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.