1/** 2 * brands.js 3 * 4 * Adds sticky functionality to the brands index. 5 */ 6( function () { 7 document.addEventListener( 'DOMContentLoaded', function () { 8 const brandsAZ = document.getElementsByClassName( 'brands_index' ); 9 10 if ( ! brandsAZ.length ) { 11 return; 12 } 13 14 const adminBar = document.body.classList.contains( 'admin-bar' ) 15 ? 32 16 : 0, 17 brandsContainerHeight = 18 document.getElementById( 'brands_a_z' ).scrollHeight, 19 brandsAZHeight = brandsAZ[ 0 ].scrollHeight + 40; 20 21 const stickyBrandsAZ = function () { 22 if ( 23 window.innerWidth > 768 && 24 brandsAZ[ 0 ].getBoundingClientRect().top < 0 25 ) { 26 brandsAZ[ 0 ].style.paddingTop = 27 Math.min( 28 Math.abs( brandsAZ[ 0 ].getBoundingClientRect().top ) + 29 20 + 30 adminBar, 31 brandsContainerHeight - brandsAZHeight 32 ) + 'px'; 33 } else { 34 brandsAZ[ 0 ].style.paddingTop = 0; 35 } 36 }; 37 38 stickyBrandsAZ(); 39 40 window.addEventListener( 'scroll', function () { 41 stickyBrandsAZ(); 42 } ); 43 } ); 44} )();
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.