1(function( $ ) { 2 3 var bt_bb_portfolio_tiles_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_portfolio_tiles_load_posts = function( root ) { 19 20 root.addClass( 'bt_bb_grid_hide' ); 21 root.find( '.bt_bb_grid_item' ).remove(); 22 if ( root.hasClass( 'masonry' ) ) { 23 root.masonry( 'destroy' ); 24 } 25 26 root.parent().find( '.bt_bb_post_grid_loader' ).show(); 27 if ( root.data( 'post-type' ) == 'portfolio' ) { 28 var action = 'bt_bb_get_tiles_portfolio'; 29 } else { 30 var action = 'bt_bb_get_tiles_portfolio'; 31 } 32 33 var data = { 34 'action': action, 35 'number': root.data( 'number-portfolio' ), 36 'format': root.data( 'format-portfolio' ), 37 'category': root.data( 'category-portfolio' ), 38 'show': root.data( 'show-portfolio' ), 39 'bt-nonce': root.data( 'bt-nonce' ) 40 }; 41 42 $.ajax({ 43 type: 'POST', 44 url: ajax_object.ajax_url, 45 data: data, 46 async: true, 47 success: function( response ) { 48 root.append( response ); 49 bt_bb_portfolio_tiles_resize( root ); 50 bt_bb_portfolio_tiles_load_images( root ); 51 root.masonry({ 52 columnWidth: '.bt_bb_grid_sizer', 53 itemSelector: '.bt_bb_grid_item', 54 gutter: 0, 55 percentPosition: true 56 }); 57 root.parent().find( '.bt_bb_post_grid_loader' ).hide(); 58 root.removeClass( 'bt_bb_grid_hide' ); 59 $( '.bt_bb_grid_container' ).css( 'height', 'auto' ); 60 }, 61 error: function( response ) { 62 root.parent().find( '.bt_bb_post_grid_loader' ).hide(); 63 root.removeClass( 'bt_bb_grid_hide' ); 64 } 65 }); 66 } 67 68 $( document ).ready(function() { 69 70 $( window ).on( 'scroll', function() { 71 bt_bb_portfolio_tiles_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_portfolio_tiles_load_posts( grid_content ); 77 }); 78 79 $( '.bt_bb_masonry_portfolio_tiles_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_masonry_portfolio_tiles_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_portfolio_tiles_load_posts( grid_content ); 89 }); 90 91 }); 92 93 94 $( window ).ready(function() { 95 window.bt_bb_portfolio_tiles_resize = function() { 96 $( '.bt_bb_masonry_post_grid_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_post_grid_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_post_grid_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_portfolio_tiles_resize(); 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_portfolio_tiles_resize(); 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.