1jQuery( function( $ ) { 2 "use strict"; 3 4 if ( $( '.header_is_sticky' ).length ) { 5 6 var body = $( document.body ), 7 inla = $( '.inner_layout' ), 8 abar = $( '.admin-bar' ).length ? 32 : 0; 9 10 /* Sticky */ 11 setTimeout( function() { 12 13 $( '.header_is_sticky' ).each( function( n, x ) { 14 15 var header_sticky = $( x ), 16 header_5 = $( '.header_5' ), 17 lastScrollTop = 0, 18 st, sticky_func, 19 h1h = 0, 20 h2h = 0, 21 h3h = 0, 22 scrollTop = header_sticky.offset().top, 23 h_offset = header_sticky.position(), 24 smart_sticky = function( scroll ) { 25 26 if ( header_sticky.hasClass( 'smart_sticky' ) || ( $( '.cz_fixed_footer' ).length && ( $( '.page_content' ).offset().top + $( '.page_content' ).height() <= $( window ).scrollTop() + header_sticky.height() ) ) ) { 27 28 st = scroll.scrollTop(); 29 30 var oHeight = header_sticky.outerHeight(); 31 32 if ( st > ( h_offset.top + oHeight + 100 ) && st > lastScrollTop ) { 33 34 header_sticky.css( 'transform', 'translateY(-' + ( oHeight + 20 ) + 'px)' ); 35 36 } else if ( st < lastScrollTop ) { 37 38 header_sticky.css( 'transform', 'none' ); 39 40 } 41 42 lastScrollTop = st; 43 44 } 45 46 }; 47 48 if ( header_sticky.hasClass( 'header_5' ) ) { 49 50 header_5.addClass( 'onSticky' ); 51 $( window ).on( 'scroll.sticky', function(e){ 52 var ph = $( '.page_header' ).height(); 53 54 if ( $( window ).scrollTop() >= ph ) { 55 header_5.css( 'transform', 'none' ).css( 'width', inla.width() + 'px' ); 56 } else { 57 header_5.css( 'transform', 'translateY(-' + ( ph + 20 ) + 'px)' ).css( 'width', inla.width() + 'px' ); 58 } 59 60 smart_sticky( $( this ) ); 61 }); 62 63 } else if ( header_sticky.length ) { 64 65 /* Add corpse */ 66 if ( ! header_sticky.prev( '.Corpse_Sticky').length ) { 67 header_sticky.before( '<div class="Corpse_Sticky' + ( header_sticky.hasClass( 'header_4' ) ? ' cz_sticky_corpse_for_header_4' : '' ) + '" aria-hidden="true"></div>' ); 68 } 69 70 var scroll_down, 71 scroll_top, 72 new_scrollTop, 73 cz_sticky_h12 = $( '.cz_sticky_h12' ).length, 74 cz_sticky_h13 = $( '.cz_sticky_h13' ).length, 75 cz_sticky_h23 = $( '.cz_sticky_h23' ).length, 76 cz_sticky_h123 = $( '.cz_sticky_h123' ).length; 77 78 sticky_func = function(e) { 79 80 if ( header_sticky.hasClass( 'header_4' ) && header_sticky.css( 'display' ) == 'none' ) { 81 return; 82 } 83 84 new_scrollTop = scrollTop; 85 86 if ( $( '.header_1' ).length ) { 87 h1h = $( '.header_1' ).outerHeight(); 88 } 89 if ( $( '.header_2' ).length ) { 90 h2h = $( '.header_2' ).outerHeight(); 91 } 92 if ( $( '.header_3' ).length ) { 93 h3h = $( '.header_3' ).outerHeight(); 94 } 95 96 if ( cz_sticky_h12 && header_sticky.hasClass( 'header_2' ) ) { 97 new_scrollTop = scrollTop + 1 - h1h; 98 } else if ( cz_sticky_h13 && header_sticky.hasClass( 'header_3' ) ) { 99 new_scrollTop = scrollTop + 1 - h1h; 100 } else if ( cz_sticky_h23 && header_sticky.hasClass( 'header_3' ) ) { 101 new_scrollTop = scrollTop + 1 - h2h; 102 } else if ( cz_sticky_h123 ) { 103 104 if ( header_sticky.hasClass( 'header_2' ) ) { 105 new_scrollTop = scrollTop + 1 - h1h; 106 } 107 108 if ( header_sticky.hasClass( 'header_3' ) ) { 109 new_scrollTop = scrollTop + 1 - ( h1h + h2h ); 110 } 111 112 } 113 114 abar = $( '.xtra-preview-header' ).is( ':visible' ) ? 54 : abar; 115 116 scroll_top = $( window ).scrollTop() + abar; 117 118 if ( scroll_top === abar && ( body.hasClass( 'admin-bar' ) || body.hasClass( 'compose-mode' ) ) ) { 119 scroll_top = -abar; 120 } 121 122 scroll_down = scroll_top > new_scrollTop; 123 124 if ( scroll_down && cz_sticky_h12 && header_sticky.hasClass( 'header_2' ) ) { 125 $( '.header_2' ).css( 'marginTop', h1h ); 126 } else if ( scroll_down && cz_sticky_h13 && header_sticky.hasClass( 'header_3' ) ) { 127 $( '.header_3' ).css( 'marginTop', h1h ); 128 } else if ( scroll_down && cz_sticky_h23 && header_sticky.hasClass( 'header_3' ) ) { 129 $( '.header_3' ).css( 'marginTop', h2h ); 130 } else if ( cz_sticky_h123 ) { 131 if ( scroll_down && header_sticky.hasClass( 'header_2' ) ) { 132 $( '.header_2' ).css( 'marginTop', h1h ); 133 } 134 if ( scroll_down && header_sticky.hasClass( 'header_3' ) ) { 135 $( '.header_3' ).css( 'marginTop', ( h1h + h2h ) ); 136 } 137 } 138 139 if ( scroll_down ) { 140 header_sticky.addClass( 'onSticky' ).prev( '.Corpse_Sticky' ).css({ 141 'height': header_sticky.outerHeight() + 'px' 142 }); 143 } else { 144 header_sticky.css( 'marginTop', '' ).removeClass( 'onSticky' ).prev( '.Corpse_Sticky').css({ 145 'height': 'auto' 146 }); 147 } 148 149 smart_sticky( $( this ) ); 150 header_sticky.css( 'width', inla.width() + 'px' ); 151 setTimeout(function() { 152 header_sticky.css( 'width', inla.width() + 'px' ); 153 }, 500 ); 154 }; 155 156 $( window ).off( 'scroll.cz_sticky_' + n ).on( 'scroll.cz_sticky_' + n, sticky_func ); 157 $( window ).off( 'resize.cz_sticky_' + n ).on( 'resize.cz_sticky_' + n, sticky_func ); 158 } 159 160 }); 161 162 }, 750 ); 163 164 } 165 166});
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.