1( function( $ ) { 2 $( document ).ready( function() { 3 $( window ).resize( function() { 4 5 $( ".gllr_grid:visible" ).each( function() { 6 var $gallery = $( this ), 7 gallery_wrap_width = $gallery.parents( '.gallery_box_single' ).width(), 8 $gallery_rows = $gallery.find( '.gllr_image_row' ), 9 $gallery_first_row = $gallery_rows.filter( ':first' ), 10 $images = $gallery.find( '.gllr_image_block' ), 11 images_in_first_row = $gallery_first_row.find( '.gllr_image_block' ), 12 count_images_in_first_row = images_in_first_row.length, 13 width_image_block_ = images_in_first_row.filter( ':first' ).width(), 14 columns = $gallery.data( 'gllr-columns' ), 15 count_images = $images.length, 16 pre_count_images_in_row = Math.floor( gallery_wrap_width / width_image_block_ ), 17 count_images_in_row = ( columns < pre_count_images_in_row ) ? columns : pre_count_images_in_row, 18 count_rows = Math.ceil( count_images / count_images_in_row ); 19 20 if ( count_images_in_first_row != count_images_in_row && count_images_in_row != 0 ) { 21 22 $gallery.empty(); 23 24 for( var i = 1; i <= count_rows; i++ ) { 25 var $new_row = $( '<div/>', { 26 'class' : 'gllr_image_row' 27 } ), 28 $new_images_in_row = $images.splice( 0, count_images_in_row ); 29 $new_row.append( $new_images_in_row ); 30 $gallery.append( $new_row ); 31 } 32 } 33 } ); 34 35 /* Set equal sizes for every list item in the row when galleries are set to be displayed inline */ 36 var $inline_list_items = $( '.gllr-display-inline li' ); 37 if ( $inline_list_items.length ) { 38 $inline_list_items.css( { 'width' : '', 'height' : '' } ); 39 var $chunk = $( [] ), 40 item_count = 0, 41 col_margins = $inline_list_items.outerWidth( true ) - $inline_list_items.outerWidth(), 42 /* initial item width */ 43 init_width = $inline_list_items.data( 'gllr-width' ), 44 parent_width = $( '.gllr-display-inline' ).innerWidth(), 45 cols = Math.floor( parent_width/( init_width + col_margins ) ), 46 /* recalculate column width so the columns take all the available width */ 47 calc_width = Math.floor( parent_width / cols ) - col_margins; 48 49 /* set items width to calculated value */ 50 $inline_list_items.css( { 'width' : calc_width } ); 51 52 /* divide items collection into chunks by the calculated columns number */ 53 $inline_list_items.each( function() { 54 /* add each list item to chunk */ 55 $chunk = $chunk.add( $( this ) ); 56 57 item_count++; 58 59 /* when the last element in the row is reached */ 60 if ( item_count == cols ) { 61 /* calculate max item height in the row */ 62 var chunk_max_height = Math.max.apply( null, $chunk.map( function () { 63 return $( this ).outerHeight(); 64 } ) ); 65 66 /* set equal height for all items in the row */ 67 $chunk.css( { 'height' : chunk_max_height } ); 68 /* clear chunk, start new */ 69 item_count = 0; 70 $chunk = $( [] ); 71 } 72 } ); 73 } 74 } ).trigger( 'resize' ); 75 } ); 76} )( 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.