ng-infinite-scroll
Advanced tools
Comparing version 0.1.0 to 0.2.0
@@ -1,2 +0,2 @@ | ||
/* ngInfiniteScroll - v0.1.0 - 2013-02-21 */ | ||
/* ng-infinite-scroll - v0.1.0 - 2013-02-21 */ | ||
var mod; | ||
@@ -6,14 +6,8 @@ | ||
mod.factory('docWindow', [ | ||
'$window', function($window) { | ||
return angular.element($window); | ||
} | ||
]); | ||
mod.directive('infiniteScroll', [ | ||
'$rootScope', 'docWindow', '$document', function($rootScope, docWindow, $document) { | ||
'$rootScope', '$window', '$timeout', function($rootScope, $window, $timeout) { | ||
return { | ||
link: function(scope, elem, attrs) { | ||
var $window, checkWhenEnabled, handler, scrollDistance, scrollEnabled; | ||
$window = docWindow; | ||
var checkWhenEnabled, handler, scrollDistance, scrollEnabled; | ||
$window = angular.element($window); | ||
scrollDistance = 0; | ||
@@ -37,6 +31,6 @@ if (attrs.infiniteScrollDistance != null) { | ||
handler = function() { | ||
var documentBottom, remaining, shouldScroll, windowBottom; | ||
var elementBottom, remaining, shouldScroll, windowBottom; | ||
windowBottom = $window.height() + $window.scrollTop(); | ||
documentBottom = $document.height(); | ||
remaining = documentBottom - windowBottom; | ||
elementBottom = elem.offset().top + elem.height(); | ||
remaining = elementBottom - windowBottom; | ||
shouldScroll = remaining <= $window.height() * scrollDistance; | ||
@@ -57,5 +51,11 @@ if (shouldScroll && scrollEnabled) { | ||
}); | ||
if (scope.$eval(attrs.infiniteScrollImmediateCheck)) { | ||
return handler(); | ||
} | ||
return $timeout((function() { | ||
if (attrs.infiniteScrollImmediateCheck) { | ||
if (scope.$eval(attrs.infiniteScrollImmediateCheck)) { | ||
return handler(); | ||
} | ||
} else { | ||
return handler(); | ||
} | ||
}), 0); | ||
} | ||
@@ -62,0 +62,0 @@ }; |
@@ -1,2 +0,2 @@ | ||
/* ngInfiniteScroll - v0.1.0 - 2013-02-21 */ | ||
var mod;mod=angular.module("infinite-scroll",[]),mod.factory("docWindow",["$window",function(n){return angular.element(n)}]),mod.directive("infiniteScroll",["$rootScope","docWindow","$document",function(n,i,o){return{link:function(e,l,t){var r,c,a,u,d;return r=i,u=0,null!=t.infiniteScrollDistance&&e.$watch(t.infiniteScrollDistance,function(n){return u=parseInt(n,10)}),d=!0,c=!1,null!=t.infiniteScrollDisabled&&e.$watch(t.infiniteScrollDisabled,function(n){return d=!n,d&&c?(c=!1,a()):void 0}),a=function(){var i,l,a,f;return f=r.height()+r.scrollTop(),i=o.height(),l=i-f,a=r.height()*u>=l,a&&d?n.$$phase?e.$eval(t.infiniteScroll):e.$apply(t.infiniteScroll):a?c=!0:void 0},r.on("scroll",a),e.$on("$destroy",function(){return r.off("scroll",a)}),e.$eval(t.infiniteScrollImmediateCheck)?a():void 0}}}]); | ||
/* ng-infinite-scroll - v0.1.0 - 2013-02-21 */ | ||
var mod;mod=angular.module("infinite-scroll",[]),mod.directive("infiniteScroll",["$rootScope","$window","$timeout",function(i,n,e){return{link:function(t,l,o){var r,c,f,a;return n=angular.element(n),f=0,null!=o.infiniteScrollDistance&&t.$watch(o.infiniteScrollDistance,function(i){return f=parseInt(i,10)}),a=!0,r=!1,null!=o.infiniteScrollDisabled&&t.$watch(o.infiniteScrollDisabled,function(i){return a=!i,a&&r?(r=!1,c()):void 0}),c=function(){var e,c,u,d;return d=n.height()+n.scrollTop(),e=l.offset().top+l.height(),c=e-d,u=n.height()*f>=c,u&&a?i.$$phase?t.$eval(o.infiniteScroll):t.$apply(o.infiniteScroll):u?r=!0:void 0},n.on("scroll",c),t.$on("$destroy",function(){return n.off("scroll",c)}),e(function(){return o.infiniteScrollImmediateCheck?t.$eval(o.infiniteScrollImmediateCheck)?c():void 0:c()},0)}}}]); |
{ | ||
"name": "ng-infinite-scroll", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"description": "Infinite scrolling for AngularJS", | ||
@@ -5,0 +5,0 @@ "repository": { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1013774
27972