1var ms2Gallery = { 2 initialize: function(selector) { 3 var galleries = $(selector); 4 if (!galleries.length) { 5 return false; 6 } 7 8 galleries.each(function() { 9 var gallery = $(this); 10 var thumbnails = gallery.find('.thumbnail'); 11 thumbnails.on('click', function(e) { 12 e.preventDefault(); 13 thumbnails.removeClass('active'); 14 15 var thumbnail = $(this); 16 thumbnail.addClass('active'); 17 18 var main = gallery.find('#mainImage, .mainImage'); 19 main.attr('src', thumbnail.attr('href')); 20 main.parent().attr('href', thumbnail.data('image')); 21 22 var image = $(this).find('img'); 23 if (image.length) { 24 main.attr('title', image[0].title) 25 .attr('alt', image[0].alt); 26 } 27 28 return false; 29 }); 30 gallery.find('.thumbnail:first').click(); 31 }); 32 33 return true; 34 } 35}; 36 37$(document).ready(function() { 38 ms2Gallery.initialize('#msGallery, .ms2Gallery'); 39});
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.