1(function( $ ) { 2 3 window.bt_no_posts = false; 4 window.bt_loading_grid = false; 5 6 window.bt_ajax_req = []; 7 8 $( document ).ready(function() { 9 10 $( '.btGridContainer' ).height( window.innerHeight ); 11 12 $( '.tilesWall.btAjaxGrid' ).each(function() { 13 window.bt_scroll_loading = $( this ).data( 'scroll-loading' ) == 'yes' ? true : false; 14 window.bt_grid_type = $( this ).data( 'grid-type' ); 15 window.bt_tiled_format = $( this ).data( 'format' ) + ''; 16 if ( window.bt_tiled_format != '' ) { 17 window.bt_tiled_format = window.bt_tiled_format.split( ',' ); 18 } else { 19 window.bt_tiled_format = []; 20 } 21 var $c = $( this ); 22 23 $c.packery({ 24 itemSelector: '.gridItem', 25 columnWidth: '.gridSizer', 26 gutter: 0, 27 percentPosition: true, 28 transitionDuration: 0, 29 isResizeBound: false 30 }); 31 32 bt_load_posts( document.querySelector( '.tilesWall.btAjaxGrid' ) ); 33 34 }); 35 36 $( '.btCatFilterItem.all' ).addClass( 'active' ); 37 38 $( '.btCatFilterItem' ).click(function() { 39 $( '.btCatFilterItem' ).removeClass( 'active' ); 40 $( this ).addClass( 'active' ); 41 $( '.tilesWall.btAjaxGrid' ).data( 'cat-slug', $( this ).data( 'slug' ) ); 42 for ( var n = 0; n < window.bt_ajax_req.length; n++ ) { 43 window.bt_ajax_req[ n ].abort(); 44 } 45 window.bt_ajax_req = []; 46 47 $( '.btGridContainer' ).height( $( '.btGridContainer' ).height() ); 48 49 var $container = $( '.tilesWall.btAjaxGrid' ).packery(); 50 $container.packery( 'remove', $( '.gridItem' ) ); 51 $container.packery(); 52 53 window.bt_grid_offset = 0; 54 55 window.bt_no_posts = false; 56 $( '.btNoMore' ).hide(); 57 $( '.btLoaderGrid' ).show(); 58 bt_load_posts( document.querySelector( '.tilesWall.btAjaxGrid' ) ); 59 }); 60 61 }); 62 63 $( window ).resize(function() { 64 $( '.tilesWall.btAjaxGrid' ).each(function() { 65 $c = $( this ); 66 bt_packery_tweak( $c, window.bt_grid_type ); 67 setTimeout(function() { 68 bt_packery_tweak( $c, window.bt_grid_type ); 69 }, 150 ); 70 }); 71 }); 72 73 $( window ).scroll(function() { 74 if ( bt_is_load_scroll() && window.bt_scroll_loading && ! window.bt_no_posts && ! window.bt_loading_grid ) { 75 window.bt_loading_grid = true; 76 bt_load_posts( document.querySelector( '.tilesWall.btAjaxGrid' ) ); 77 } 78 }); 79 80 var bt_is_load_scroll = function() { 81 var $c = $( '.tilesWall.btAjaxGrid' ); 82 var height = window.innerHeight 83 || document.documentElement.clientHeight 84 || document.body.clientHeight; 85 if ( $( window ).scrollTop() + height > $c.offset().top + $c.height() ) { 86 return true; 87 } 88 return false; 89 } 90 91 // ajax loader 92 93 window.bt_ajax_elems_all = []; 94 95 var bt_load_posts = function( target ) { 96 if ( typeof window.bt_grid_offset === 'undefined' ) window.bt_grid_offset = 0; 97 var num = $( target ).data( 'num' ); 98 var data = { 99 'action': 'bt_get_grid', 100 'number': num, 101 'offset': window.bt_grid_offset, 102 'cat_slug': $( target ).data( 'cat-slug' ), 103 'post_type': $( target ).data( 'post-type' ), 104 'grid_type': $( target ).data( 'grid-type' ), 105 'tiles_title': $( target ).data( 'tiles-title' ), 106 'related': $( target ).data( 'related' ), 107 'sticky_in_grid': $( target ).data( 'sticky' ), 108 'format': window.bt_tiled_format.slice( window.bt_grid_offset, window.bt_grid_offset + num ).join() 109 }; 110 window.bt_grid_offset = window.bt_grid_offset + num; 111 $( '.btLoaderGrid' ).css( 'opacity', '1' ); 112 window.bt_ajax_req.push($.ajax({ 113 type: 'POST', 114 url: window.BoldThemesAJAXURL, 115 data: data, 116 async: true, 117 success: function( response ) { 118 119 var iOS = ( navigator.userAgent.match(/(iPad|iPhone|iPod)/g) ? true : false ); 120 121 if ( ! window.bt_scroll_loading ) $( '.btLoaderGrid' ).hide(); 122 123 if ( response.indexOf( 'no_posts' ) == 0 ) { 124 $( '.btLoaderGrid' ).css( 'opacity', '0' ); 125 $( '.btLoaderGrid' ).hide(); 126 if ( window.bt_scroll_loading ) $( '.btNoMore' ).fadeIn(); 127 window.bt_no_posts = true; 128 return; 129 } 130 131 $post = JSON.parse( response ); 132 133 window.bt_ajax_elems = []; 134 135 $( '.btLoaderGrid' ).css( 'opacity', '0' ); 136 137 for ( var i = 0; i < $post.length; i++ ) { 138 var elem = document.createElement( 'div' );
139 elem.className = $post[ i ].container_class; 140 141 $( elem ).append( $post[ i ].html ); 142 143 window.bt_ajax_elems.push( elem ); 144 window.bt_ajax_elems_all.push( elem ); 145 146 $( elem ).attr( 'data-i', i ); 147 148 imagesLoaded( window.bt_ajax_elems_all[ window.bt_ajax_elems_all.length - 1 ], function() { 149 var n = $( this.elements[0] ).attr( 'data-i' ); 150 $( this.elements[0] ).css( { 'transition-delay': .1 + n * .1 + 's' } ); 151 $( this.elements[0] ).addClass( 'btGridItemLoaded' ); 152 }); 153 } 154 155 for ( var i = 0; i < window.bt_ajax_elems.length; i++ ) { 156 157 $( target ).append( window.bt_ajax_elems[ i ] ); 158 159 var $container = $( '.tilesWall.btAjaxGrid' ).packery(); 160 $container.packery( 'appended', window.bt_ajax_elems[ i ] ); 161 162 bt_packery_tweak( $( target ), window.bt_grid_type ); 163 164 if ( window.bt_grid_type == 'classic' ) { 165 $( '.btMediaBox' ).each(function() { 166 if ( $( this ).attr( 'data-hw' ) != undefined ) { 167 $( this ).height( $( this ).outerWidth( true ) * $( this ).attr( 'data-hw' ) ); 168 } 169 }); 170 } 171 172 bt_packery_tweak( $( target ), window.bt_grid_type ); 173 174 $( '.btAjaxGrid .boldPhotoSlide:not(.btFeaturedPostsSlider)' ).each(function() { 175 if ( ! $( this ).hasClass( 'slick-initialized' ) ) { 176 $( this ).slick({ 177 dots: false, 178 arrows: true, 179 infinite: false, 180 speed: 300, 181 slide: '.bpbItem', 182 slidesToShow: 1, 183 slidesToScroll: 1, 184 prevArrow: window.bt_prevArrowHtml_simple, 185 nextArrow: window.bt_nextArrowHtml_simple 186 }); 187 } 188 }); 189 190 $( '.btAjaxGrid .boldPhotoSlide.btFeaturedPostsSlider' ).each(function() { 191 if ( ! $( this ).hasClass( 'slick-initialized' ) ) { 192 $( this ).slick({ 193 dots: false, 194 arrows: true, 195 infinite: false, 196 speed: 300, 197 slide: '.bpbItem', 198 slidesToShow: 3, 199 slidesToScroll: 3, 200 prevArrow: window.bt_prevArrowHtml, 201 nextArrow: window.bt_nextArrowHtml, 202 responsive: [ 203 { 204 breakpoint: 880, 205 settings: { 206 slidesToShow: 1, 207 slidesToScroll: 1 208 } 209 } 210 ] 211 }); 212 } 213 }); 214 } 215 216 window.bt_loading_grid = false; 217 218 $( '.btGridContainer' ).css( 'height', 'auto' ); 219 220 if ( bt_is_load_scroll() && window.bt_scroll_loading && ! window.bt_no_posts ) { 221 bt_load_posts( document.querySelector( '.tilesWall.btAjaxGrid' ) ); 222 } 223 224 }, 225 error: function( xhr, status, error ) { 226 $( '.btLoaderGrid' ).css( 'opacity', '0' ); 227 } 228 229 })); 230 } 231 232})( 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.