1(function($) { 2 'use strict'; 3 $.fn.sqrPanorama = function() { 4 $(this).each(function() { 5 var container = $(this), 6 img = container.children('img'), 7 imgNaturalHeight = parseFloat(img.attr('height')), 8 imgNaturalWidth = parseFloat(img.attr('width')), 9 text = container.children('span'), 10 textsize = parseFloat(text.attr('data-size')), 11 textwide = (text.attr('data-wide') === '1'), 12 maxOffset = 0; 13 14 function size() { 15 var width = container.width(), 16 imgHeight = Math.floor(width * imgNaturalHeight / imgNaturalWidth), 17 containerHeight = Math.floor(imgHeight * 0.5); 18 19 maxOffset = imgHeight - containerHeight; 20 21 img.css({ 22 'width': width + 'px', 23 'height': imgHeight + 'px' 24 }); 25 container.css({ 26 'height': containerHeight + 'px' 27 }); 28 29 var fontsize = Math.max(Math.floor(width / 160 * textsize), 15); 30 text.css('font-size', fontsize + 'px'); 31 32 if (textwide) text.css('letter-spacing', (Math.floor(fontsize / 5)) + 'px'); 33 34 place(); 35 } 36 37 function place() { 38 var containerTop = container.offset().top, 39 containerHeight = container.height(), 40 windowheight = $(window).height(), 41 scrolltop = $(window).scrollTop(), 42 top = scrolltop + windowheight - containerTop, 43 range = windowheight + containerHeight, 44 offset = -Math.floor((1 - (top / range)) * maxOffset); 45 46 img.css('transform', 'translateY(' + offset + 'px)'); 47 } 48 49 $(window).on('scroll', place); 50 $(window).on('resize', size); 51 52 size(); 53 }); 54 }; 55})(jQuery); 56 57$(document).ready(function() { 58 $('.sqrpanorama').sqrPanorama(); 59});
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.