1var ms2Gallery = { 2 initialize: function (selector) { 3 var galleries = $(selector); 4 if (!galleries.length) { 5 return false; 6 } 7 8 if ($(document).find('.fotorama').length) { 9 this.fotorama(); 10 } 11 12 galleries.each(function () { 13 var gallery = $(this); 14 if (gallery.hasClass('fotorama')) { 15 return; 16 } 17 var thumbnails = gallery.find('.thumbnail'); 18 thumbnails.on('click', function (e) { 19 e.preventDefault(); 20 thumbnails.removeClass('active'); 21 22 var thumbnail = $(this); 23 thumbnail.addClass('active'); 24 25 var main = gallery.find('#mainImage, .mainImage'); 26 main.attr('src', thumbnail.attr('href')); 27 main.parent().attr('href', thumbnail.data('image')); 28 29 var image = $(this).find('img'); 30 if (image.length) { 31 main.attr('title', image[0].title) 32 .attr('alt', image[0].alt); 33 } 34 35 return false; 36 }); 37 gallery.find('.thumbnail:first').click(); 38 }); 39 40 return true; 41 }, 42 43 fotorama: function () { 44 $('<link/>', { 45 rel: 'stylesheet', 46 type: 'text/css', 47 href: ms2GalleryConfig.cssUrl + 'lib/fotorama.min.css', 48 }).appendTo('head'); 49 $('<script/>', { 50 type: 'text/javascript', 51 src: ms2GalleryConfig.jsUrl + 'lib/fotorama.min.js', 52 }).appendTo('head'); 53 } 54}; 55 56$(document).ready(function () { 57 ms2Gallery.initialize('#msGallery, .ms2Gallery'); 58});
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.