1/*! tagged-infinite-scroll - v1.1.1 - 2015-07-17 */ 2(function (root, factory) { 3 if (typeof define === 'function' && define.amd) { 4 // AMD. Register as an anonymous module. 5 define(['angular'], factory); 6 } else { 7 // Browser globals 8 root.taggedInfiniteScroll = factory(root.angular); 9 } 10}(this, function (angular) { 11 "use strict"; 12 13 // Allows a container to support infinite scroll 14 // Based on: http://binarymuse.github.io/ngInfiniteScroll/ 15 var module = angular.module('tagged.directives.infiniteScroll', []); 16 17 module.directive('taggedInfiniteScroll', ['$window', '$timeout', function($window, $timeout) { 18 return { 19 scope: { 20 callback: '&taggedInfiniteScroll', 21 distance: '=taggedInfiniteScrollDistance', 22 disabled: '=taggedInfiniteScrollDisabled' 23 }, 24 link: function(scope, elem, attrs) { 25 var win = angular.element($window); 26 27 var onScroll = function(oldValue, newValue) { 28 // Do nothing if infinite scroll has been disabled 29 if (scope.disabled) { 30 return; 31 } 32 var windowHeight = win[0].innerHeight; 33 var elementBottom = elem[0].offsetTop + elem[0].offsetHeight; 34 var windowBottom = windowHeight + (win[0].scrollY || win[0].pageYOffset); 35 var remaining = elementBottom - windowBottom; 36 var shouldGetMore = (remaining - parseInt(scope.distance || 0, 10) <= 0); 37 38 if (shouldGetMore) { 39 $timeout(scope.callback); 40 } 41 }; 42 43 // Check immediately if we need more items upon reenabling. 44 scope.$watch('disabled', function(isDisabled){ 45 if (false === isDisabled) onScroll(); 46 }); 47 48 win.bind('scroll', onScroll); 49 50 // Remove window scroll handler when this element is removed. 51 scope.$on('$destroy', function() { 52 win.unbind('scroll', onScroll); 53 }); 54 55 // Check on next event loop to give the browser a moment to paint. 56 // Otherwise, the calculations may be off. 57 $timeout(onScroll); 58 } 59 }; 60 }]); 61 62 // Just return a value to define the module export. 63 // This example returns an object, but the module 64 // can return a function as the exported value. 65 return module; 66}));
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.