vendor: 3,116 bytes, lines 1-78
1(function($) { 2 3 /** 4 * Copyright 2012, Digital Fusion Licensed under the MIT license. 5 * http://teamdf.com/jquery-plugins/license/ 6 * 7 * @author Sam Sehnert 8 * @desc A small plugin that checks whether elements are within the user 9 * visible viewport of a web browser. can accounts for vertical 10 * position, horizontal, or both 11 */ 12 var $w = $(window); 13 $.fn.visible = function(partial, hidden, direction, container) { 14 15 if (this.length < 1) 16 return; 17 18 // Set direction default to 'both'. 19 direction = direction || 'both'; 20 21 var $t = this.length > 1 ? this.eq(0) : this, isContained = typeof container !== 'undefined' 22 && container !== null, $c = isContained ? $(container) : $w, wPosition = isContained ? $c 23 .position() 24 : 0, t = $t.get(0), vpWidth = $c.outerWidth(), vpHeight = $c 25 .outerHeight(), clientSize = hidden === true ? t.offsetWidth 26 * t.offsetHeight : true; 27 28 if (typeof t.getBoundingClientRect === 'function') { 29 30 // Use this native browser method, if available. 31 var rec = t.getBoundingClientRect(), tViz = isContained ? rec.top 32 - wPosition.top >= 0 33 && rec.top < vpHeight + wPosition.top : rec.top >= 0 34 && rec.top < vpHeight, bViz = isContained ? rec.bottom 35 - wPosition.top > 0 36 && rec.bottom <= vpHeight + wPosition.top : rec.bottom > 0 37 && rec.bottom <= vpHeight, lViz = isContained ? rec.left 38 - wPosition.left >= 0 39 && rec.left < vpWidth + wPosition.left : rec.left >= 0 40 && rec.left < vpWidth, rViz = isContained ? rec.right 41 - wPosition.left > 0 42 && rec.right < vpWidth + wPosition.left : rec.right > 0 43 && rec.right <= vpWidth, vVisible = partial ? tViz || bViz 44 : tViz && bViz, hVisible = partial ? lViz || rViz : lViz 45 && rViz, vVisible = (rec.top < 0 && rec.bottom > vpHeight) ? true 46 : vVisible, hVisible = (rec.left < 0 && rec.right > vpWidth) ? true 47 : hVisible; 48 49 if (direction === 'both') 50 return clientSize && vVisible && hVisible; 51 else if (direction === 'vertical') 52 return clientSize && vVisible; 53 else if (direction === 'horizontal') 54 return clientSize && hVisible; 55 } else { 56 57 var viewTop = isContained ? 0 : wPosition, viewBottom = viewTop 58 + vpHeight, viewLeft = $c.scrollLeft(), viewRight = viewLeft 59 + vpWidth, position = $t.position(), _top = position.top, _bottom = _top 60 + $t.height(), _left = position.left, _right = _left 61 + $t.width(), compareTop = partial === true ? _bottom 62 : _top, compareBottom = partial === true ? _top : _bottom, compareLeft = partial === true ? _right 63 : _left, compareRight = partial === true ? _left : _right; 64 65 if (direction === 'both') 66 return !!clientSize 67 && ((compareBottom <= viewBottom) && (compareTop >= viewTop)) 68 && ((compareRight <= viewRight) && (compareLeft >= viewLeft)); 69 else if (direction === 'vertical') 70 return !!clientSize 71 && ((compareBottom <= viewBottom) && (compareTop >= viewTop)); 72 else if (direction === 'horizontal') 73 return !!clientSize 74 && ((compareRight <= viewRight) && (compareLeft >= viewLeft)); 75 } 76 }; 77 78})(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.