1(function( $ ) { 2 3 var bt_bb_load_images = function( root ) { 4 root.each(function() { 5 var page_bottom = $( window ).scrollTop() + $( window ).height(); 6 $( this ).find( '.bt_bb_grid_item' ).each(function() { 7 var this_top = $( this ).offset().top; 8 if ( this_top < page_bottom + $( window ).height() ) { 9 var img_src = $( this ).data( 'src' ); 10 if ( img_src !== '' && $( this ).find( '.bt_bb_grid_item_post_thumbnail a' ).html() == '' ) { 11 $( this ).find( '.bt_bb_grid_item_post_thumbnail a' ).html( '<img src="' + img_src + '">' ); 12 } 13 } 14 }); 15 }); 16 } 17 18 var bt_bb_load_posts = function( root ) { 19 root.addClass( 'bt_bb_grid_hide' ); 20 root.find( '.bt_bb_grid_item' ).remove(); 21 if ( root.hasClass( 'masonry' ) ) { 22 root.masonry( 'destroy' ); 23 } 24 25 root.parent().find( '.bt_bb_post_grid_loader' ).show(); 26 if ( root.data( 'post-type' ) == 'portfolio' ) { 27 var action = 'bt_bb_get_tiles_portfolio'; 28 } else { 29 var action = 'bt_bb_get_tiles_portfolio'; 30 } 31 32 var data = { 33 'action': action, 34 'number': root.data( 'number-portfolio' ), 35 'format': root.data( 'format-portfolio' ), 36 'category': root.data( 'category-portfolio' ), 37 'show': root.data( 'show-portfolio' ), 38 'bt-nonce': root.data( 'bt-nonce' ) 39 }; 40 41 $.ajax({ 42 type: 'POST', 43 url: ajax_object.ajax_url, 44 data: data, 45 async: true, 46 success: function( response ) { 47 root.append( response ); 48 bt_bb_resize_tiles( root ); 49 bt_bb_load_images( root ); 50 root.masonry({ 51 columnWidth: '.bt_bb_grid_sizer', 52 itemSelector: '.bt_bb_grid_item', 53 gutter: 0, 54 percentPosition: true 55 }); 56 root.parent().find( '.bt_bb_post_grid_loader' ).hide(); 57 root.removeClass( 'bt_bb_grid_hide' ); 58 $( '.bt_bb_grid_container' ).css( 'height', 'auto' ); 59 }, 60 error: function( response ) { 61 root.parent().find( '.bt_bb_post_grid_loader' ).hide(); 62 root.removeClass( 'bt_bb_grid_hide' ); 63 } 64 65 }); 66 } 67 68 $( document ).ready(function() { 69 70 $( window ).on( 'scroll', function() { 71 bt_bb_load_images( $( '.bt_bb_masonry_post_grid_content' ) ); 72 }); 73 74 $( '.bt_bb_masonry_portfolio_tiles_content' ).each(function() { 75 var grid_content = $( this ); 76 bt_bb_load_posts( grid_content ); 77 }); 78 79 $( '.bt_bb_post_grid_filter_item' ).on( 'click', function() { 80 var root = $( this ).closest( '.bt_bb_grid_container' ); 81 root.height( root.height() ); 82 $( this ).parent().find( '.bt_bb_post_grid_filter_item' ).removeClass( 'active' ); 83 $( this ).addClass( 'active' ); 84 var grid_content = $( this ).closest( '.bt_bb_masonry_portfolio_tiles' ).find( '.bt_bb_masonry_portfolio_tiles_content' ); 85 grid_content.data( 'category-portfolio', $( this ).data( 'category-portfolio' ) ); 86 grid_content.data( 'format-portfolio', $( this ).data( 'format-portfolio' ) ); 87 grid_content.data( 'post-type', $( this ).data( 'post-type' ) ); 88 bt_bb_load_posts( grid_content ); 89 }); 90 91 }); 92 93 94 $( window ).ready(function() { 95 window.bt_bb_resize_tiles = function() { 96 $( '.bt_bb_masonry_portfolio_tiles_content .bt_bb_grid_item .bt_bb_grid_item_inner' ).each( function() { 97 $( this ).css( 'height', '' ); 98 var h = Math.ceil( $( this ).width() * $( this ).data( 'hw' ) ); 99 $( this ).css( 'height', h ); 100 }); 101 $( '.bt_bb_masonry_portfolio_tiles_content .bt_bb_grid_item .bt_bb_grid_item_inner .bt_bb_grid_item_inner_image' ).each( function() { 102 $( this ).css( 'height', '' ); 103 var h = Math.ceil( $( this ).width() * $( this ).data( 'hw' ) ); 104 $( this ).css( 'height', h ); 105 }); 106 $( '.bt_bb_masonry_portfolio_tiles_content' ).each( function() { 107 $( this ).width( 'initial' ); 108 var child_left_margin = parseInt( $( this ).find( '.bt_bb_masonry_post_image_content' ).css( 'margin-left' ) ); 109 var base_item_width = ( $( this ).width() - child_left_margin ) / ( $( this ).data( 'columns' ) ) ; 110 if ( Math.ceil( base_item_width ) != base_item_width ) { 111 $( this ).width( $( this ).data( 'columns' ) * Math.ceil( base_item_width ) + child_left_margin ); 112 } 113 }); 114 115 } 116 }); 117 118 119 $( window ).load(function() { 120 121 bt_bb_resize_tiles(); 122 123 $( '.bt_bb_masonry_post_image_content' ).masonry({ 124 columnWidth: '.bt_bb_grid_sizer', 125 itemSelector: '.bt_bb_grid_item', 126 gutter: 0, 127 percentPosition: true 128 }); 129 130 $( window ).on( 'resize', function() { 131 bt_bb_resize_tiles(); 132 }); 133 134 setTimeout(function() { 135 $( '.bt_bb_masonry_post_image_content' ).masonry( 'layout' ); 136 }, 10 ); 137 138 }); 139 140})( 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.