1jQuery(function($) { 2 // Only run this routine once 3 var flag = 'nextgen_pro_albums'; 4 if (typeof($(window).data(flag)) == 'undefined') 5 $(window).data(flag, true); 6 else return; 7 8 // Now that lazy loaded styles are ready, we'll display the galleries 9 $('.nextgen_pro_list_album, .nextgen_pro_grid_album').each(function(){ 10 var $this = $(this); 11 var gallery_id = $this.attr('id').match(/^displayed_gallery_(\w+$)/).pop(); 12 var display_settings = window.galleries['gallery_'+gallery_id].display_settings; 13 14 // List Album 15 if ($this.hasClass('nextgen_pro_list_album')) { 16 if (display_settings.override_thumbnail_settings !== '0') { 17 // Ensure that the screen real estate allocated for an image 18 // is equal to the maximum width of a thumbnail 19 var max_width = display_settings.thumbnail_width; 20 $this.find('.gallery_link a').each(function(){ 21 var $link = $(this); 22 var margin = max_width - $link.width(); 23 // The width of the image is smaller than the allocated real estate. We'll increase 24 // the right margin to fix 25 if (margin > 0) { 26 var right_margin = parseFloat($link.css('margin-right')); 27 $link.css('margin-right', margin/2+right_margin); 28 var left_margin = parseFloat($link.css('margin-left')); 29 $link.css('margin-left', margin/2+left_margin); 30 } 31 }); 32 } 33 } 34 // Grid Album 35 else { 36 // Find the widest and longest image dimensions 37 var widest = 125; // minimum width 38 var longest = 0; 39 $this.find('img').each(function() { 40 var $image = $(this); 41 if (parseFloat($image.attr('width')) > widest) widest = parseFloat($image.attr('width')); 42 if (parseFloat($image.attr('height')) > longest) longest = parseFloat($image.attr('height')); 43 }).each(function() { 44 45 // Ensure that each image is centered in the space allocated 46 var $image = $(this); 47 var margin = longest-parseFloat($image.attr('height')); 48 if (margin > 0) { 49 $image.parent().css({ 50 'margin-top': margin/2, 51 'margin-bottom': margin/2 52 }); 53 } 54 }); 55 56 // All image containers must be the same size. 57 $this.find('.image_container').each(function() { 58 $(this).css({ 59 'width': widest + (display_settings.padding * 2) 60 }); 61 62 // without this the following shave() will cause some themes 63 // to display no caption text at all 64 $(this).find('.gallery_link a').each(function() { 65 $(this).css({ 66 'height': $(this).find('img').attr('height') 67 }); 68 }); 69 $(this).find('.image_link_wrapper').css({ 70 'padding': display_settings.padding 71 }); 72 }); 73 74 const link_height = $('.nextgen_pro_grid_album .caption_link a').height(); 75 shave('.nextgen_pro_grid_album .caption_link a', link_height); 76 77 // Prevent the title from being too big 78 $('.nextgen_pro_grid_album .caption_link a').each(function() { 79 $(this).css('display', 'block'); 80 }); 81 82 // Find the longest captions 83 var longest_caption = 0; 84 $this.find('.caption_link a').each(function() { 85 if ($(this).outerHeight() > longest_caption) { 86 longest_caption = $(this).outerHeight(); 87 } 88 }); 89 90 // Ensure each container has the same height 91 $this.find('.image_link_wrapper').each(function() { 92 $(this).height(longest + longest_caption); 93 }); 94 } 95 96 // Gallery is ready to display! 97 $this.css('opacity', 1.0); 98 }); 99});
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.