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' ).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 ( header_sticky.hasClass( 'header_5' ) && st < 200 ) { 37 38 header_sticky.css( 'transform', '' ); 39 40 } else if ( st < lastScrollTop ) { 41 42 header_sticky.css( 'transform', 'none' ); 43 44 } 45 46 lastScrollTop = st; 47 48 } 49 50 }; 51 52 if ( header_sticky.hasClass( 'header_5' ) ) { 53 54 header_5.addClass( 'onSticky' ); 55 56 $( window ).on( 'scroll.sticky', function(e) { 57 58 var ph = header_5.height(); 59 60 if ( $( window ).scrollTop() >= ph ) { 61 header_5.css( 'transform', 'none' ).css( 'width', inla.width() + 'px' ); 62 } else { 63 header_5.css( 'transform', 'translateY(-' + ( ph + 20 ) + 'px)' ).css( 'width', inla.width() + 'px' ); 64 } 65 66 smart_sticky( $( this ) ); 67 68 }); 69 70 } else if ( header_sticky.length ) { 71 72 /* Add corpse */ 73 if ( ! header_sticky.prev( '.Corpse_Sticky').length ) { 74 header_sticky.before( '<div class="Corpse_Sticky' + ( header_sticky.hasClass( 'header_4' ) ? ' cz_sticky_corpse_for_header_4' : '' ) + '" aria-hidden="true"></div>' ); 75 } 76 77 var scroll_down, 78 scroll_top, 79 new_scrollTop, 80 cz_sticky_h12 = $( '.cz_sticky_h12' ).length, 81 cz_sticky_h13 = $( '.cz_sticky_h13' ).length, 82 cz_sticky_h23 = $( '.cz_sticky_h23' ).length, 83 cz_sticky_h123 = $( '.cz_sticky_h123' ).length; 84 85 sticky_func = function(e) { 86 87 if ( header_sticky.hasClass( 'header_4' ) && header_sticky.css( 'display' ) == 'none' ) { 88 return; 89 } 90 91 new_scrollTop = scrollTop; 92 93 if ( $( '.header_1' ).length ) { 94 h1h = $( '.header_1' ).outerHeight(); 95 } 96 if ( $( '.header_2' ).length ) { 97 h2h = $( '.header_2' ).outerHeight(); 98 } 99 if ( $( '.header_3' ).length ) { 100 h3h = $( '.header_3' ).outerHeight(); 101 } 102 103 if ( cz_sticky_h12 && header_sticky.hasClass( 'header_2' ) ) { 104 new_scrollTop = scrollTop + 1 - h1h; 105 } else if ( cz_sticky_h13 && header_sticky.hasClass( 'header_3' ) ) { 106 new_scrollTop = scrollTop + 1 - h1h; 107 } else if ( cz_sticky_h23 && header_sticky.hasClass( 'header_3' ) ) { 108 new_scrollTop = scrollTop + 1 - h2h; 109 } else if ( cz_sticky_h123 ) { 110 111 if ( header_sticky.hasClass( 'header_2' ) ) { 112 new_scrollTop = scrollTop + 1 - h1h; 113 } 114 115 if ( header_sticky.hasClass( 'header_3' ) ) { 116 new_scrollTop = scrollTop + 1 - ( h1h + h2h ); 117 } 118 119 } 120 121 abar = $( '.xtra-preview-header' ).is( ':visible' ) ? 54 : abar; 122 123 scroll_top = $( window ).scrollTop() + abar; 124 125 if ( scroll_top === abar && ( body.hasClass( 'admin-bar' ) || body.hasClass( 'compose-mode' ) ) ) { 126 scroll_top = -abar; 127 } 128 129 scroll_down = scroll_top > new_scrollTop; 130 131 if ( scroll_down ) { 132 header_sticky.prev( '.Corpse_Sticky' ).css({ 133 'height': header_sticky.outerHeight() + 'px' 134 }); 135 header_sticky.delay( 100 ).addClass( 'onSticky' ); 136 } else { 137 header_sticky.css( 'marginTop', '' ).removeClass( 'onSticky' ).prev( '.Corpse_Sticky').css({ 138 'height': 'auto' 139 }); 140 } 141 142 if ( scroll_down && cz_sticky_h12 && header_sticky.hasClass( 'header_2' ) ) { 143 $( '.header_2' ).css( 'marginTop', h1h ); 144 } else if ( scroll_down && cz_sticky_h13 && header_sticky.hasClass( 'header_3' ) ) { 145 $( '.header_3' ).css( 'marginTop', h1h ); 146 } else if ( scroll_down && cz_sticky_h23 && header_sticky.hasClass( 'header_3' ) ) { 147 $( '.header_3' ).css( 'marginTop', h2h ); 148 } else if ( cz_sticky_h123 ) { 149 if ( scroll_down && header_sticky.hasClass( 'header_2' ) ) { 150 $( '.header_2' ).css( 'marginTop', h1h ); 151 } 152 if ( scroll_down && header_sticky.hasClass( 'header_3' ) ) { 153 $( '.header_3' ).css( 'marginTop', ( h1h + h2h ) ); 154 } 155 } 156 157 smart_sticky( $( this ) ); 158 header_sticky.css( 'width', inla.width() + 'px' ); 159 setTimeout(function() { 160 header_sticky.css( 'width', inla.width() + 'px' ); 161 }, 500 ); 162 }; 163 164 $( window ).off( 'scroll.cz_sticky_' + n ).on( 'scroll.cz_sticky_' + n, sticky_func ); 165 $( window ).off( 'resize.cz_sticky_' + n ).on( 'resize.cz_sticky_' + n, sticky_func ); 166 } 167 168 }); 169 170 }, 750 ); 171 172 } 173 174});
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.