1jQuery(function($) { 2 var ticking = false; 3 4 $.fn.zoomInstagramWidget = function () { 5 return $(this).each(function () { 6 var $list = $(this); 7 8 var minItemsPerRow = $list.data('images-per-row'); 9 var desiredItemWidth = $list.data('image-width'); 10 var itemSpacing = $list.data('image-spacing'); 11 var imageLazyLoading = $list.data('image-lazy-loading'); 12 13 var containerWidth = $list.width(); 14 15 var fitPerRow; 16 var itemWidth; 17 18 if (containerWidth / desiredItemWidth < minItemsPerRow) { 19 fitPerRow = minItemsPerRow; 20 itemWidth = Math.floor((containerWidth - 1 - (minItemsPerRow - 1) * itemSpacing) / minItemsPerRow); 21 } else { 22 fitPerRow = Math.floor((containerWidth - 1) / desiredItemWidth); 23 itemWidth = Math.floor((containerWidth - 1 - (fitPerRow - 1) * itemSpacing) / fitPerRow); 24 } 25 26 $list.find('li').each(function(i) { 27 if ( ++i % fitPerRow == 0 ) { 28 $(this).css('margin-right', '0'); 29 } else { 30 $(this).css('margin-right', itemSpacing + 'px'); 31 $(this).css('margin-bottom', itemSpacing + 'px'); 32 } 33 }); 34 35 $list.find('a.zoom-instagram-link').css({ 36 width: itemWidth, 37 height: itemWidth 38 }); 39 40 if (imageLazyLoading) { 41 $list.find('a.zoom-instagram-link').lazy(); 42 } 43 44 $list.removeClass('zoom-instagram-widget__items--no-js'); 45 }); 46 }; 47 48 function requestTick() { 49 if (!ticking) { 50 ticking = true; 51 requestAnimationFrame()(update); 52 } 53 } 54 55 function requestAnimationFrame() { 56 return window.requestAnimationFrame || 57 window.webkitRequestAnimationFrame || 58 window.mozRequestAnimationFrame || 59 function (callback){ 60 window.setTimeout(callback, 1000 / 60); 61 }; 62 } 63 64 function update() { 65 $('.zoom-instagram-widget__items').zoomInstagramWidget(); 66 ticking = false; 67 } 68 69 $(window).on('resize orientationchange', requestTick); 70 requestTick(); 71});
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.