Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

angular-smart-scroll

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

angular-smart-scroll - npm Package Compare versions

Comparing version 0.0.4 to 0.0.5

6

bower.json
{
"name": "angular-smart-scroll",
"version": "0.0.4",
"version": "0.0.5",
"homepage": "https://github.com/joonhocho/angular-smart-scroll",

@@ -31,8 +31,8 @@ "authors": [

"dependencies": {
"angular": "~1.2.12",
"angular": "latest",
"jquery": "~2.1.0"
},
"devDependencies": {
"angular-mocks": "~1.2.12"
"angular-mocks": "latest"
}
}

@@ -1,2 +0,2 @@

/*! angular-smart-scroll - v0.0.3 - 2014-07-13 */
/*! angular-smart-scroll - v0.0.5 - 2014-07-22 */
/* global angular */

@@ -63,15 +63,14 @@ angular.module('jun.smartScroll', [])

if (!isDirectionalScroll(remaining, lastRemaining)) {
return;
var prev = !! opts.atTop,
atTop = opts.atTop = !remaining;
if (prev !== atTop && opts.onAtTop) {
opts.onAtTop(atTop);
}
var distance = getOptionVal(opts, 'distanceTop');
if (distance == null) {
return opts.onScrollTop();
if (opts.onScrollTop && isDirectionalScroll(remaining, lastRemaining)) {
var distance = getOptionVal(opts, 'distanceTop');
if (distance == null || remaining <= getScrollThreshold(distance, viewport.innerHeight())) {
opts.onScrollTop();
}
}
var viewportLength = viewport.innerHeight();
if (remaining <= getScrollThreshold(distance, viewportLength)) {
return opts.onScrollTop();
}
}

@@ -86,15 +85,14 @@

if (!isDirectionalScroll(remaining, lastRemaining)) {
return;
var prev = !! opts.atLeft,
atLeft = opts.atLeft = !remaining;
if (prev !== atLeft && opts.onAtLeft) {
opts.onAtLeft(atLeft);
}
var distance = getOptionVal(opts, 'distanceLeft');
if (distance == null) {
return opts.onScrollLeft();
if (opts.onScrollLeft && isDirectionalScroll(remaining, lastRemaining)) {
var distance = getOptionVal(opts, 'distanceLeft');
if (distance == null || remaining <= getScrollThreshold(distance, viewport.innerWidth())) {
opts.onScrollLeft();
}
}
var viewportLength = viewport.innerWidth();
if (remaining <= getScrollThreshold(distance, viewportLength)) {
opts.onScrollLeft();
}
}

@@ -150,14 +148,14 @@

if (!isDirectionalScroll(remaining, lastRemaining)) {
return;
var prev = !! opts.atBottom,
atBottom = opts.atBottom = !remaining;
if (prev !== atBottom && opts.onAtBottom) {
opts.onAtBottom(atBottom);
}
var distance = getOptionVal(opts, 'distanceBottom');
if (distance == null) {
return opts.onScrollBottom();
if (opts.onScrollBottom && isDirectionalScroll(remaining, lastRemaining)) {
var distance = getOptionVal(opts, 'distanceBottom');
if (distance == null || remaining <= getScrollThreshold(distance, stats.viewportLength)) {
opts.onScrollBottom();
}
}
if (remaining <= getScrollThreshold(distance, stats.viewportLength)) {
return opts.onScrollBottom();
}
}

@@ -187,14 +185,14 @@

if (!isDirectionalScroll(remaining, lastRemaining)) {
return;
var prev = !! opts.atRight,
atRight = opts.atRight = !remaining;
if (prev !== atRight && opts.onAtRight) {
opts.onAtRight(atRight);
}
var distance = getOptionVal(opts, 'distanceRight');
if (distance == null) {
return opts.onScrollRight();
if (opts.onScrollRight && isDirectionalScroll(remaining, lastRemaining)) {
var distance = getOptionVal(opts, 'distanceRight');
if (distance == null || remaining <= getScrollThreshold(distance, stats.viewportLength)) {
opts.onScrollRight();
}
}
if (remaining <= getScrollThreshold(distance, stats.viewportLength)) {
return opts.onScrollRight();
}
}

@@ -216,3 +214,3 @@

if (!getOptionVal(opts, 'disabledTop') && opts.onScrollTop) {
if (!getOptionVal(opts, 'disabledTop')) {
onScrollTop(opts);

@@ -223,6 +221,6 @@ }

}
if (!getOptionVal(opts, 'disabledLeft') && opts.onScrollLeft) {
if (!getOptionVal(opts, 'disabledLeft')) {
onScrollLeft(opts);
}
if (!getOptionVal(opts, 'disabledRight') && opts.onScrollRight) {
if (!getOptionVal(opts, 'disabledRight')) {
onScrollRight(opts);

@@ -229,0 +227,0 @@ }

@@ -1,2 +0,2 @@

/*! angular-smart-scroll - v0.0.3 - 2014-07-13 */
angular.module("jun.smartScroll",[]).directive("smartScroll",["$window","$timeout",function(a,b){"use strict";function c(a){if(a.style){var b=x(a);return d(b.css("overflow"))||d(b.css("overflow-x"))||d(b.css("overflow-y"))}return!1}function d(a){return"scroll"===a||"auto"===a}function e(a,b){for(;a;){if(b(a))return a;a=a.parentNode}return null}function f(a,b){return a?"number"==typeof a?a:"%"===a.charAt(a.length-1)?parseInt(a,10)/100*b:parseInt(a,10):0}function g(a,b){return f(a,b)+y}function h(a,b){return null!=b&&b>a}function i(a){var b=a.viewport,c=b.scrollTop(),d=a.remainingTop;if(a.remainingTop=c,h(c,d)){var e=t(a,"distanceTop");if(null==e)return a.onScrollTop();var f=b.innerHeight();return c<=g(e,f)?a.onScrollTop():void 0}}function j(a){var b=a.viewport,c=b.scrollLeft(),d=a.remainingLeft;if(a.remainingLeft=c,h(c,d)){var e=t(a,"distanceLeft");if(null==e)return a.onScrollLeft();var f=b.innerWidth();c<=g(e,f)&&a.onScrollLeft()}}function k(a,b,c){return c-(a+b)}function l(a){return a.html||(a.html=x("html")[0])}function m(a){return a.body||(a.body=x("body")[0])}function n(b,c){return b===a?l(c).scrollWidth||m(c).scrollWidth:b.scrollWidth}function o(b,c){return b===a?l(c).scrollHeight||m(c).scrollHeight:b.scrollHeight}function p(a){a=a||this;var b=a.viewport,c=b.scrollTop(),d=b.innerHeight(),e=o(b[0],a),f=k(c,d,e);return{scrollPos:c,viewportLength:d,scrollLength:e,remaining:f}}function q(a){var b=p(a),c=b.remaining,d=a.remainingBottom;if(a.remainingBottom=c,h(c,d)){var e=t(a,"distanceBottom");return null==e?a.onScrollBottom():c<=g(e,b.viewportLength)?a.onScrollBottom():void 0}}function r(a){a=a||this;var b=a.viewport,c=b.scrollLeft(),d=b.innerWidth(),e=n(b[0],a),f=k(c,d,e);return{scrollPos:c,viewportLength:d,scrollLength:e,remaining:f}}function s(a){var b=r(a),c=b.remaining,d=a.remainingRight;if(a.remainingRight=c,h(c,d)){var e=t(a,"distanceRight");return null==e?a.onScrollRight():c<=g(e,b.viewportLength)?a.onScrollRight():void 0}}function t(a,b){var c=a[b];return"function"==typeof c?a[b]():c}function u(a){return function(){t(a,"disabled")||(!t(a,"disabledTop")&&a.onScrollTop&&i(a),!t(a,"disabledBottom")&&a.onScrollBottom&&q(a),!t(a,"disabledLeft")&&a.onScrollLeft&&j(a),!t(a,"disabledRight")&&a.onScrollRight&&s(a),a.onScroll&&a.onScroll())}}function v(b,d){var f=b.viewport||e(d[0],c)||a;return"function"!=typeof f.on&&(f=x(f)),f}function w(a){for(;a;){if(a.smartScroll)return a.smartScroll;a=a.$parent}}var x=angular.element,y=.9;return{link:function(a,c){var d=w(a)||{},e=d.viewport=v(d,c),f=u(d);d.getScrollRightStats=r,d.getScrollBottomStats=p,e.on("scroll",f),e.on("resize",f),a.$on("$destroy",function(){e.off("scroll",f),e.off("resize",f)}),b(f)}}}]);
/*! angular-smart-scroll - v0.0.5 - 2014-07-22 */
angular.module("jun.smartScroll",[]).directive("smartScroll",["$window","$timeout",function(a,b){"use strict";function c(a){if(a.style){var b=x(a);return d(b.css("overflow"))||d(b.css("overflow-x"))||d(b.css("overflow-y"))}return!1}function d(a){return"scroll"===a||"auto"===a}function e(a,b){for(;a;){if(b(a))return a;a=a.parentNode}return null}function f(a,b){return a?"number"==typeof a?a:"%"===a.charAt(a.length-1)?parseInt(a,10)/100*b:parseInt(a,10):0}function g(a,b){return f(a,b)+y}function h(a,b){return null!=b&&b>a}function i(a){var b=a.viewport,c=b.scrollTop(),d=a.remainingTop;a.remainingTop=c;var e=!!a.atTop,f=a.atTop=!c;if(e!==f&&a.onAtTop&&a.onAtTop(f),a.onScrollTop&&h(c,d)){var i=t(a,"distanceTop");(null==i||c<=g(i,b.innerHeight()))&&a.onScrollTop()}}function j(a){var b=a.viewport,c=b.scrollLeft(),d=a.remainingLeft;a.remainingLeft=c;var e=!!a.atLeft,f=a.atLeft=!c;if(e!==f&&a.onAtLeft&&a.onAtLeft(f),a.onScrollLeft&&h(c,d)){var i=t(a,"distanceLeft");(null==i||c<=g(i,b.innerWidth()))&&a.onScrollLeft()}}function k(a,b,c){return c-(a+b)}function l(a){return a.html||(a.html=x("html")[0])}function m(a){return a.body||(a.body=x("body")[0])}function n(b,c){return b===a?l(c).scrollWidth||m(c).scrollWidth:b.scrollWidth}function o(b,c){return b===a?l(c).scrollHeight||m(c).scrollHeight:b.scrollHeight}function p(a){a=a||this;var b=a.viewport,c=b.scrollTop(),d=b.innerHeight(),e=o(b[0],a),f=k(c,d,e);return{scrollPos:c,viewportLength:d,scrollLength:e,remaining:f}}function q(a){var b=p(a),c=b.remaining,d=a.remainingBottom;a.remainingBottom=c;var e=!!a.atBottom,f=a.atBottom=!c;if(e!==f&&a.onAtBottom&&a.onAtBottom(f),a.onScrollBottom&&h(c,d)){var i=t(a,"distanceBottom");(null==i||c<=g(i,b.viewportLength))&&a.onScrollBottom()}}function r(a){a=a||this;var b=a.viewport,c=b.scrollLeft(),d=b.innerWidth(),e=n(b[0],a),f=k(c,d,e);return{scrollPos:c,viewportLength:d,scrollLength:e,remaining:f}}function s(a){var b=r(a),c=b.remaining,d=a.remainingRight;a.remainingRight=c;var e=!!a.atRight,f=a.atRight=!c;if(e!==f&&a.onAtRight&&a.onAtRight(f),a.onScrollRight&&h(c,d)){var i=t(a,"distanceRight");(null==i||c<=g(i,b.viewportLength))&&a.onScrollRight()}}function t(a,b){var c=a[b];return"function"==typeof c?a[b]():c}function u(a){return function(){t(a,"disabled")||(t(a,"disabledTop")||i(a),!t(a,"disabledBottom")&&a.onScrollBottom&&q(a),t(a,"disabledLeft")||j(a),t(a,"disabledRight")||s(a),a.onScroll&&a.onScroll())}}function v(b,d){var f=b.viewport||e(d[0],c)||a;return"function"!=typeof f.on&&(f=x(f)),f}function w(a){for(;a;){if(a.smartScroll)return a.smartScroll;a=a.$parent}}var x=angular.element,y=.9;return{link:function(a,c){var d=w(a)||{},e=d.viewport=v(d,c),f=u(d);d.getScrollRightStats=r,d.getScrollBottomStats=p,e.on("scroll",f),e.on("resize",f),a.$on("$destroy",function(){e.off("scroll",f),e.off("resize",f)}),b(f)}}}]);
{
"name": "angular-smart-scroll",
"version": "0.0.4",
"version": "0.0.5",
"description": "Smart infinite scroll directive for Angular.js that is customizable to support nested, horizontal, vertical, and/or bidirectional scrolls",

@@ -5,0 +5,0 @@ "main": "src/angular-smart-scroll.js",

@@ -62,15 +62,14 @@ /* global angular */

if (!isDirectionalScroll(remaining, lastRemaining)) {
return;
var prev = !! opts.atTop,
atTop = opts.atTop = !remaining;
if (prev !== atTop && opts.onAtTop) {
opts.onAtTop(atTop);
}
var distance = getOptionVal(opts, 'distanceTop');
if (distance == null) {
return opts.onScrollTop();
if (opts.onScrollTop && isDirectionalScroll(remaining, lastRemaining)) {
var distance = getOptionVal(opts, 'distanceTop');
if (distance == null || remaining <= getScrollThreshold(distance, viewport.innerHeight())) {
opts.onScrollTop();
}
}
var viewportLength = viewport.innerHeight();
if (remaining <= getScrollThreshold(distance, viewportLength)) {
return opts.onScrollTop();
}
}

@@ -85,15 +84,14 @@

if (!isDirectionalScroll(remaining, lastRemaining)) {
return;
var prev = !! opts.atLeft,
atLeft = opts.atLeft = !remaining;
if (prev !== atLeft && opts.onAtLeft) {
opts.onAtLeft(atLeft);
}
var distance = getOptionVal(opts, 'distanceLeft');
if (distance == null) {
return opts.onScrollLeft();
if (opts.onScrollLeft && isDirectionalScroll(remaining, lastRemaining)) {
var distance = getOptionVal(opts, 'distanceLeft');
if (distance == null || remaining <= getScrollThreshold(distance, viewport.innerWidth())) {
opts.onScrollLeft();
}
}
var viewportLength = viewport.innerWidth();
if (remaining <= getScrollThreshold(distance, viewportLength)) {
opts.onScrollLeft();
}
}

@@ -149,14 +147,14 @@

if (!isDirectionalScroll(remaining, lastRemaining)) {
return;
var prev = !! opts.atBottom,
atBottom = opts.atBottom = !remaining;
if (prev !== atBottom && opts.onAtBottom) {
opts.onAtBottom(atBottom);
}
var distance = getOptionVal(opts, 'distanceBottom');
if (distance == null) {
return opts.onScrollBottom();
if (opts.onScrollBottom && isDirectionalScroll(remaining, lastRemaining)) {
var distance = getOptionVal(opts, 'distanceBottom');
if (distance == null || remaining <= getScrollThreshold(distance, stats.viewportLength)) {
opts.onScrollBottom();
}
}
if (remaining <= getScrollThreshold(distance, stats.viewportLength)) {
return opts.onScrollBottom();
}
}

@@ -186,14 +184,14 @@

if (!isDirectionalScroll(remaining, lastRemaining)) {
return;
var prev = !! opts.atRight,
atRight = opts.atRight = !remaining;
if (prev !== atRight && opts.onAtRight) {
opts.onAtRight(atRight);
}
var distance = getOptionVal(opts, 'distanceRight');
if (distance == null) {
return opts.onScrollRight();
if (opts.onScrollRight && isDirectionalScroll(remaining, lastRemaining)) {
var distance = getOptionVal(opts, 'distanceRight');
if (distance == null || remaining <= getScrollThreshold(distance, stats.viewportLength)) {
opts.onScrollRight();
}
}
if (remaining <= getScrollThreshold(distance, stats.viewportLength)) {
return opts.onScrollRight();
}
}

@@ -215,3 +213,3 @@

if (!getOptionVal(opts, 'disabledTop') && opts.onScrollTop) {
if (!getOptionVal(opts, 'disabledTop')) {
onScrollTop(opts);

@@ -222,6 +220,6 @@ }

}
if (!getOptionVal(opts, 'disabledLeft') && opts.onScrollLeft) {
if (!getOptionVal(opts, 'disabledLeft')) {
onScrollLeft(opts);
}
if (!getOptionVal(opts, 'disabledRight') && opts.onScrollRight) {
if (!getOptionVal(opts, 'disabledRight')) {
onScrollRight(opts);

@@ -228,0 +226,0 @@ }

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc