vendor: 3,130 bytes, lines 1-104
1/* 2 * jQuery.appear 3 * https://github.com/bas2k/jquery.appear/ 4 * http://code.google.com/p/jquery-appear/ 5 * http://bas2k.ru/ 6 * 7 * Copyright (c) 2009 Michael Hixson 8 * Copyright (c) 2012-2014 Alexander Brovikov 9 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php) 10 */ 11(function($) { 12 $.fn.appear = function(fn, options) { 13 var settings = $.extend({ 14 15 data: undefined, 16 17 one: true, 18 accX: 0, 19 accY: 0 20 21 }, options); 22 23 return this.each(function() { 24 var t = $(this); 25 t.appeared = false; 26 if (!fn) { 27 t.trigger('appear', settings.data); 28 return; 29 } 30 var w = $(window); 31 var check = function() { 32 if (!t.is(':visible')) { 33 t.appeared = false; 34 return; 35 } 36 37 var a = w.scrollLeft(); 38 var b = w.scrollTop(); 39 var o = t.offset(); 40 var x = o.left; 41 var y = o.top; 42 43 var ax = settings.accX; 44 var ay = settings.accY; 45 var th = t.height(); 46 var wh = w.height(); 47 var tw = t.width(); 48 var ww = w.width(); 49 50 if (y + th + ay >= b && 51 y <= b + wh + ay && 52 x + tw + ax >= a && 53 x <= a + ww + ax) { 54 if (!t.appeared) t.trigger('appear', settings.data); 55 } else { 56 t.appeared = false; 57 } 58 }; 59 var modifiedFn = function() { 60 t.appeared = true; 61 if (settings.one) { 62 w.unbind('scroll', check); 63 var i = $.inArray(check, $.fn.appear.checks); 64 if (i >= 0) $.fn.appear.checks.splice(i, 1); 65 } 66 fn.apply(this, arguments); 67 }; 68 69 if (settings.one) t.one('appear', settings.data, modifiedFn); 70 else t.bind('appear', settings.data, modifiedFn); 71 w.scroll(check); 72 $.fn.appear.checks.push(check); 73 (check)(); 74 }); 75 }; 76 77 $.extend($.fn.appear, { 78 79 checks: [], 80 timeout: null, 81 82 checkAll: function() { 83 var length = $.fn.appear.checks.length; 84 if (length > 0) while (length--) ($.fn.appear.checks[length])(); 85 }, 86 run: function() { 87 if ($.fn.appear.timeout) clearTimeout($.fn.appear.timeout); 88 $.fn.appear.timeout = setTimeout($.fn.appear.checkAll, 20); 89 } 90 }); 91 $.each(['append', 'prepend', 'after', 'before', 'attr', 92 'removeAttr', 'addClass', 'removeClass', 'toggleClass', 93 'remove', 'css', 'show', 'hide'], function(i, n) { 94 var old = $.fn[n]; 95 if (old) { 96 $.fn[n] = function() { 97 var r = old.apply(this, arguments); 98 $.fn.appear.run(); 99 return r; 100 } 101 } 102 }); 103 104})(jQuery);
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.