diff options
Diffstat (limited to 'catalog-ui/app/third-party/ng-infinite-scroll/build')
-rw-r--r-- | catalog-ui/app/third-party/ng-infinite-scroll/build/ng-infinite-scroll.js | 209 | ||||
-rw-r--r-- | catalog-ui/app/third-party/ng-infinite-scroll/build/ng-infinite-scroll.min.js | 22 |
2 files changed, 231 insertions, 0 deletions
diff --git a/catalog-ui/app/third-party/ng-infinite-scroll/build/ng-infinite-scroll.js b/catalog-ui/app/third-party/ng-infinite-scroll/build/ng-infinite-scroll.js new file mode 100644 index 0000000000..0585004832 --- /dev/null +++ b/catalog-ui/app/third-party/ng-infinite-scroll/build/ng-infinite-scroll.js @@ -0,0 +1,209 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +/* ng-infinite-scroll - v1.3.0 - 2016-06-30 */ +angular.module('infinite-scroll', []).value('THROTTLE_MILLISECONDS', null).directive('infiniteScroll', [ + '$rootScope', '$window', '$interval', 'THROTTLE_MILLISECONDS', function($rootScope, $window, $interval, THROTTLE_MILLISECONDS) { + return { + scope: { + infiniteScroll: '&', + infiniteScrollContainer: '=', + infiniteScrollDistance: '=', + infiniteScrollDisabled: '=', + infiniteScrollUseDocumentBottom: '=', + infiniteScrollListenForEvent: '@' + }, + link: function(scope, elem, attrs) { + var changeContainer, checkInterval, checkWhenEnabled, container, handleInfiniteScrollContainer, handleInfiniteScrollDisabled, handleInfiniteScrollDistance, handleInfiniteScrollUseDocumentBottom, handler, height, immediateCheck, offsetTop, pageYOffset, scrollDistance, scrollEnabled, throttle, unregisterEventListener, useDocumentBottom, windowElement; + windowElement = angular.element($window); + scrollDistance = null; + scrollEnabled = null; + checkWhenEnabled = null; + container = null; + immediateCheck = true; + useDocumentBottom = false; + unregisterEventListener = null; + checkInterval = false; + height = function(elem) { + elem = elem[0] || elem; + if (isNaN(elem.offsetHeight)) { + return elem.document.documentElement.clientHeight; + } else { + return elem.offsetHeight; + } + }; + offsetTop = function(elem) { + if (!elem[0].getBoundingClientRect || elem.css('none')) { + return; + } + return elem[0].getBoundingClientRect().top + pageYOffset(elem); + }; + pageYOffset = function(elem) { + elem = elem[0] || elem; + if (isNaN(window.pageYOffset)) { + return elem.document.documentElement.scrollTop; + } else { + return elem.ownerDocument.defaultView.pageYOffset; + } + }; + handler = function() { + var containerBottom, containerTopOffset, elementBottom, remaining, shouldScroll; + if (container === windowElement) { + containerBottom = height(container) + pageYOffset(container[0].document.documentElement); + elementBottom = offsetTop(elem) + height(elem); + } else { + containerBottom = height(container); + containerTopOffset = 0; + if (offsetTop(container) !== void 0) { + containerTopOffset = offsetTop(container); + } + elementBottom = offsetTop(elem) - containerTopOffset + height(elem); + } + if (useDocumentBottom) { + elementBottom = height((elem[0].ownerDocument || elem[0].document).documentElement); + } + remaining = elementBottom - containerBottom; + shouldScroll = remaining <= height(container) * scrollDistance + 1; + if (shouldScroll) { + checkWhenEnabled = true; + if (scrollEnabled) { + if (scope.$$phase || $rootScope.$$phase) { + return scope.infiniteScroll(); + } else { + return scope.$apply(scope.infiniteScroll); + } + } + } else { + if (checkInterval) { + $interval.cancel(checkInterval); + } + return checkWhenEnabled = false; + } + }; + throttle = function(func, wait) { + var later, previous, timeout; + timeout = null; + previous = 0; + later = function() { + previous = new Date().getTime(); + $interval.cancel(timeout); + timeout = null; + return func.call(); + }; + return function() { + var now, remaining; + now = new Date().getTime(); + remaining = wait - (now - previous); + if (remaining <= 0) { + $interval.cancel(timeout); + timeout = null; + previous = now; + return func.call(); + } else { + if (!timeout) { + return timeout = $interval(later, remaining, 1); + } + } + }; + }; + if (THROTTLE_MILLISECONDS != null) { + handler = throttle(handler, THROTTLE_MILLISECONDS); + } + scope.$on('$destroy', function() { + container.unbind('scroll', handler); + if (unregisterEventListener != null) { + unregisterEventListener(); + unregisterEventListener = null; + } + if (checkInterval) { + return $interval.cancel(checkInterval); + } + }); + handleInfiniteScrollDistance = function(v) { + return scrollDistance = parseFloat(v) || 0; + }; + scope.$watch('infiniteScrollDistance', handleInfiniteScrollDistance); + handleInfiniteScrollDistance(scope.infiniteScrollDistance); + handleInfiniteScrollDisabled = function(v) { + scrollEnabled = !v; + if (scrollEnabled && checkWhenEnabled) { + checkWhenEnabled = false; + return handler(); + } + }; + scope.$watch('infiniteScrollDisabled', handleInfiniteScrollDisabled); + handleInfiniteScrollDisabled(scope.infiniteScrollDisabled); + handleInfiniteScrollUseDocumentBottom = function(v) { + return useDocumentBottom = v; + }; + scope.$watch('infiniteScrollUseDocumentBottom', handleInfiniteScrollUseDocumentBottom); + handleInfiniteScrollUseDocumentBottom(scope.infiniteScrollUseDocumentBottom); + changeContainer = function(newContainer) { + if (container != null) { + container.unbind('scroll', handler); + } + container = newContainer; + if (newContainer != null) { + return container.bind('scroll', handler); + } + }; + changeContainer(windowElement); + if (scope.infiniteScrollListenForEvent) { + unregisterEventListener = $rootScope.$on(scope.infiniteScrollListenForEvent, handler); + } + handleInfiniteScrollContainer = function(newContainer) { + if ((newContainer == null) || newContainer.length === 0) { + return; + } + if (newContainer.nodeType && newContainer.nodeType === 1) { + newContainer = angular.element(newContainer); + } else if (typeof newContainer.append === 'function') { + newContainer = angular.element(newContainer[newContainer.length - 1]); + } else if (typeof newContainer === 'string') { + newContainer = angular.element(document.querySelector(newContainer)); + } + if (newContainer != null) { + return changeContainer(newContainer); + } else { + throw new Error("invalid infinite-scroll-container attribute."); + } + }; + scope.$watch('infiniteScrollContainer', handleInfiniteScrollContainer); + handleInfiniteScrollContainer(scope.infiniteScrollContainer || []); + if (attrs.infiniteScrollParent != null) { + changeContainer(angular.element(elem.parent())); + } + if (attrs.infiniteScrollImmediateCheck != null) { + immediateCheck = scope.$eval(attrs.infiniteScrollImmediateCheck); + } + return checkInterval = $interval((function() { + if (immediateCheck) { + handler(); + } + return $interval.cancel(checkInterval); + })); + } + }; + } +]); + +if (typeof module !== "undefined" && typeof exports !== "undefined" && module.exports === exports) { + module.exports = 'infinite-scroll'; +} diff --git a/catalog-ui/app/third-party/ng-infinite-scroll/build/ng-infinite-scroll.min.js b/catalog-ui/app/third-party/ng-infinite-scroll/build/ng-infinite-scroll.min.js new file mode 100644 index 0000000000..e2a3036422 --- /dev/null +++ b/catalog-ui/app/third-party/ng-infinite-scroll/build/ng-infinite-scroll.min.js @@ -0,0 +1,22 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +/* ng-infinite-scroll - v1.3.0 - 2016-06-30 */ +angular.module("infinite-scroll",[]).value("THROTTLE_MILLISECONDS",null).directive("infiniteScroll",["$rootScope","$window","$interval","THROTTLE_MILLISECONDS",function(a,b,c,d){return{scope:{infiniteScroll:"&",infiniteScrollContainer:"=",infiniteScrollDistance:"=",infiniteScrollDisabled:"=",infiniteScrollUseDocumentBottom:"=",infiniteScrollListenForEvent:"@"},link:function(e,f,g){var h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z;return z=angular.element(b),u=null,v=null,j=null,k=null,r=!0,y=!1,x=null,i=!1,q=function(a){return a=a[0]||a,isNaN(a.offsetHeight)?a.document.documentElement.clientHeight:a.offsetHeight},s=function(a){if(a[0].getBoundingClientRect&&!a.css("none"))return a[0].getBoundingClientRect().top+t(a)},t=function(a){return a=a[0]||a,isNaN(window.pageYOffset)?a.document.documentElement.scrollTop:a.ownerDocument.defaultView.pageYOffset},p=function(){var b,d,g,h,l;return k===z?(b=q(k)+t(k[0].document.documentElement),g=s(f)+q(f)):(b=q(k),d=0,void 0!==s(k)&&(d=s(k)),g=s(f)-d+q(f)),y&&(g=q((f[0].ownerDocument||f[0].document).documentElement)),h=g-b,l=h<=q(k)*u+1,l?(j=!0,v?e.$$phase||a.$$phase?e.infiniteScroll():e.$apply(e.infiniteScroll):void 0):(i&&c.cancel(i),j=!1)},w=function(a,b){var d,e,f;return f=null,e=0,d=function(){return e=(new Date).getTime(),c.cancel(f),f=null,a.call()},function(){var g,h;return g=(new Date).getTime(),h=b-(g-e),h<=0?(c.cancel(f),f=null,e=g,a.call()):f?void 0:f=c(d,h,1)}},null!=d&&(p=w(p,d)),e.$on("$destroy",function(){if(k.unbind("scroll",p),null!=x&&(x(),x=null),i)return c.cancel(i)}),n=function(a){return u=parseFloat(a)||0},e.$watch("infiniteScrollDistance",n),n(e.infiniteScrollDistance),m=function(a){if(v=!a,v&&j)return j=!1,p()},e.$watch("infiniteScrollDisabled",m),m(e.infiniteScrollDisabled),o=function(a){return y=a},e.$watch("infiniteScrollUseDocumentBottom",o),o(e.infiniteScrollUseDocumentBottom),h=function(a){if(null!=k&&k.unbind("scroll",p),k=a,null!=a)return k.bind("scroll",p)},h(z),e.infiniteScrollListenForEvent&&(x=a.$on(e.infiniteScrollListenForEvent,p)),l=function(a){if(null!=a&&0!==a.length){if(a.nodeType&&1===a.nodeType?a=angular.element(a):"function"==typeof a.append?a=angular.element(a[a.length-1]):"string"==typeof a&&(a=angular.element(document.querySelector(a))),null!=a)return h(a);throw new Error("invalid infinite-scroll-container attribute.")}},e.$watch("infiniteScrollContainer",l),l(e.infiniteScrollContainer||[]),null!=g.infiniteScrollParent&&h(angular.element(f.parent())),null!=g.infiniteScrollImmediateCheck&&(r=e.$eval(g.infiniteScrollImmediateCheck)),i=c(function(){return r&&p(),c.cancel(i)})}}}]),"undefined"!=typeof module&&"undefined"!=typeof exports&&module.exports===exports&&(module.exports="infinite-scroll"); |