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

angular-ui-scrollpoint

Package Overview
Dependencies
Maintainers
2
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

angular-ui-scrollpoint - npm Package Compare versions

Comparing version 2.0.1 to 2.0.2

7

dist/scrollpoint.js
/*!
* angular-ui-scrollpoint
* https://github.com/angular-ui/ui-scrollpoint
* Version: 2.0.1 - 2015-12-23T09:17:36.857Z
* Version: 2.0.2 - 2016-01-03T02:21:51.179Z
* License: MIT

@@ -290,4 +290,5 @@ */

attrs.$observe('uiScrollpointAction', function(uiScrollpointAction){
if(scope[uiScrollpointAction] && angular.isFunction(scope[uiScrollpointAction])){
uiScrollpoint.addAction(scope[uiScrollpointAction]);
var action = scope.$eval(uiScrollpointAction);
if(action && angular.isFunction(action)){
uiScrollpoint.addAction(action);
}

@@ -294,0 +295,0 @@ });

/*!
* angular-ui-scrollpoint
* https://github.com/angular-ui/ui-scrollpoint
* Version: 2.0.1 - 2015-12-23T09:17:36.857Z
* Version: 2.0.2 - 2016-01-03T02:21:51.179Z
* License: MIT
*/
!function(){"use strict";angular.module("ui.scrollpoint",[]).directive("uiScrollpoint",["$window","$timeout",function(t,e){function i(){if(angular.isDefined(t.pageYOffset))return t.pageYOffset;var e=document.compatMode&&"BackCompat"!==document.compatMode?document.documentElement:document.body;return e.scrollTop}function s(){return t.document.body.scrollHeight-t.innerHeight}function n(e){return e?t.document.body.clientHeight:t.innerHeight}return{require:["uiScrollpoint","^?uiScrollpointTarget"],controller:function(){this.$element=void 0,this.$target=void 0,this.hasTarget=!1,this.edges={top:!0},this.hitEdge=void 0,this.absolute=!0,this.percent=!1,this.shift=0,this.posCache={},this.enabled=!0,this.scrollpointClass="ui-scrollpoint",this.actions=void 0,this.addEdge=function(t,e){angular.isString(t)&&(angular.isUndefined(e)&&(e=!0),"view"==t?(this.addEdge("top","bottom"),this.addEdge("bottom","top")):this.edges[t]=e)},this.addAction=function(t){t&&angular.isFunction(t)&&(angular.isUndefined(this.actions)?this.actions=[t]:-1==this.actions.indexOf(t)&&this.actions.push(t))},this.setScrollpoint=function(t){if(t){if("string"==typeof t)if(this.percent="%"==t.charAt(t.length-1),this.percent&&(t=t.substr(0,t.length-1)),"-"===t.charAt(0))this.absolute=this.percent,this.shift=-parseFloat(t.substr(1));else if("+"===t.charAt(0))this.absolute=this.percent,this.shift=parseFloat(t.substr(1));else{var e=parseFloat(t);!isNaN(e)&&isFinite(e)&&(this.absolute=!0,this.shift=e)}else if("number"==typeof t)return void this.setScrollpoint(t.toString())}else this.absolute=!1,this.percent=!1,this.shift=0},this.setClass=function(t){t||(t="ui-scrollpoint"),this.scrollpointClass=t},this.setEdges=function(t){if(angular.isString(t))this.edges={},this.addEdge(t);else if(angular.isArray(t)){this.edges={};for(var e in t)this.addEdge(t[e])}else if(angular.isObject(t)){this.edges={};for(var i in t)this.addEdge(i,t[i])}else this.edges={top:!0}},this.setElement=function(t){this.$element=t},this.setTarget=function(e){e?(this.$target=e,this.hasTarget=!0):(this.$target=angular.element(t),this.hasTarget=!1)},this.scrollEdgeHit=function(){var t,e,i;for(var s in this.edges){var n="top"==s,o="bottom"==s,r=this.edges[s],l="top"==r,a="bottom"==r;r===!0&&(n&&(l=!0),o&&(a=!0));var h=this.getScrollOffset();o&&(h+=this.getTargetHeight());var c;this.absolute?(c=this.percent?this.shift/100*this.getTargetScrollHeight():this.shift,o&&(c=this.getTargetContentHeight()-c,this.hasTarget&&(c+=this.getTargetHeight()))):(l?c=this.getElementTop():a&&(c=this.getElementBottom()),c+=this.shift);var g=h-c;o&&(g*=-1),(angular.isUndefined(t)||g>t)&&(t=g,e=s,i=o&&this.absolute)}return this.hitEdge=t>=0?e:void 0,t*(i?-1:1)},this.getScrollOffset=function(){return this.hasTarget?this.$target[0].scrollTop:i()},this.getTargetHeight=function(){return this.hasTarget?this.$target[0].offsetHeight:n()},this.getTargetContentHeight=function(){return this.hasTarget?this.$target[0].scrollHeight-this.$target[0].clientHeight:n(!0)},this.getTargetScrollHeight=function(){return this.hasTarget?this.$target[0].scrollHeight-this.$target[0].clientHeight:s()},this.getElementTop=function(t){if(!t&&angular.isDefined(this.posCache.top))return this.posCache.top;var e=this.$element[0].getBoundingClientRect(),i=e.top+this.getScrollOffset();if(this.hasTarget){var s=this.$target[0].getBoundingClientRect();i-=s.top}return i},this.getElementBottom=function(t){return this.getElementTop(t)+this.$element[0].offsetHeight},this.cachePosition=function(){this.posCache.top=this.getElementTop(!0)}},link:function(t,i,s,n){function o(){if(c&&a.enabled){var t=a.hitEdge,e=a.scrollEdgeHit(),s=!1;if(e>=0?g||(i.hasClass(a.scrollpointClass)||i.addClass(a.scrollpointClass),s=!0,g=!0):((g||angular.isUndefined(g))&&(i.hasClass(a.scrollpointClass)&&i.removeClass(a.scrollpointClass),s=!0,g=!1),a.cachePosition()),s&&a.actions)for(var n in a.actions)a.actions[n](e,i,a.hitEdge||t)}}function r(){e(function(){i.removeClass(a.scrollpointClass),g=void 0,a.hitEdge=void 0,a.cachePosition(),o()})}function l(){a.$target.on("scroll",o),t.$on("$destroy",function(){a.$target.off("scroll",o)})}var a=n[0],h=n[1],c=!1,g=!1,u=!1;a.setElement(i),a.setTarget(h?h.$element:null),s.$observe("uiScrollpoint",function(t){a.setScrollpoint(t),o()}),s.$observe("uiScrollpointEnabled",function(e){e=t.$eval(e),e!=a.enabled&&r(),a.enabled=e}),s.$observe("uiScrollpointAbsolute",function(e){e=t.$eval(e),e!=u&&(a.$target&&a.$target.off("scroll",o),a.setTarget(!e&&h?h.$element:null),l(),r()),u=e}),s.$observe("uiScrollpointAction",function(e){t[e]&&angular.isFunction(t[e])&&a.addAction(t[e])}),s.$observe("uiScrollpointClass",function(t){a.setClass(t),g=!1,o()}),s.$observe("uiScrollpointEdge",function(e){if(e){var i=["top","bottom","view"];-1==i.indexOf(e)&&(e=t.$eval(e)),a.setEdges(e)}}),l(),i.ready(function(){c=!0,o()}),t.$on("scrollpointShouldReset",r)}}}]).directive("uiScrollpointTarget",[function(){return{controller:["$element",function(t){this.$element=t}]}}])}();
!function(){"use strict";angular.module("ui.scrollpoint",[]).directive("uiScrollpoint",["$window","$timeout",function(t,e){function i(){if(angular.isDefined(t.pageYOffset))return t.pageYOffset;var e=document.compatMode&&"BackCompat"!==document.compatMode?document.documentElement:document.body;return e.scrollTop}function s(){return t.document.body.scrollHeight-t.innerHeight}function n(e){return e?t.document.body.clientHeight:t.innerHeight}return{require:["uiScrollpoint","^?uiScrollpointTarget"],controller:function(){this.$element=void 0,this.$target=void 0,this.hasTarget=!1,this.edges={top:!0},this.hitEdge=void 0,this.absolute=!0,this.percent=!1,this.shift=0,this.posCache={},this.enabled=!0,this.scrollpointClass="ui-scrollpoint",this.actions=void 0,this.addEdge=function(t,e){angular.isString(t)&&(angular.isUndefined(e)&&(e=!0),"view"==t?(this.addEdge("top","bottom"),this.addEdge("bottom","top")):this.edges[t]=e)},this.addAction=function(t){t&&angular.isFunction(t)&&(angular.isUndefined(this.actions)?this.actions=[t]:-1==this.actions.indexOf(t)&&this.actions.push(t))},this.setScrollpoint=function(t){if(t){if("string"==typeof t)if(this.percent="%"==t.charAt(t.length-1),this.percent&&(t=t.substr(0,t.length-1)),"-"===t.charAt(0))this.absolute=this.percent,this.shift=-parseFloat(t.substr(1));else if("+"===t.charAt(0))this.absolute=this.percent,this.shift=parseFloat(t.substr(1));else{var e=parseFloat(t);!isNaN(e)&&isFinite(e)&&(this.absolute=!0,this.shift=e)}else if("number"==typeof t)return void this.setScrollpoint(t.toString())}else this.absolute=!1,this.percent=!1,this.shift=0},this.setClass=function(t){t||(t="ui-scrollpoint"),this.scrollpointClass=t},this.setEdges=function(t){if(angular.isString(t))this.edges={},this.addEdge(t);else if(angular.isArray(t)){this.edges={};for(var e in t)this.addEdge(t[e])}else if(angular.isObject(t)){this.edges={};for(var i in t)this.addEdge(i,t[i])}else this.edges={top:!0}},this.setElement=function(t){this.$element=t},this.setTarget=function(e){e?(this.$target=e,this.hasTarget=!0):(this.$target=angular.element(t),this.hasTarget=!1)},this.scrollEdgeHit=function(){var t,e,i;for(var s in this.edges){var n="top"==s,o="bottom"==s,r=this.edges[s],l="top"==r,a="bottom"==r;r===!0&&(n&&(l=!0),o&&(a=!0));var h=this.getScrollOffset();o&&(h+=this.getTargetHeight());var c;this.absolute?(c=this.percent?this.shift/100*this.getTargetScrollHeight():this.shift,o&&(c=this.getTargetContentHeight()-c,this.hasTarget&&(c+=this.getTargetHeight()))):(l?c=this.getElementTop():a&&(c=this.getElementBottom()),c+=this.shift);var g=h-c;o&&(g*=-1),(angular.isUndefined(t)||g>t)&&(t=g,e=s,i=o&&this.absolute)}return this.hitEdge=t>=0?e:void 0,t*(i?-1:1)},this.getScrollOffset=function(){return this.hasTarget?this.$target[0].scrollTop:i()},this.getTargetHeight=function(){return this.hasTarget?this.$target[0].offsetHeight:n()},this.getTargetContentHeight=function(){return this.hasTarget?this.$target[0].scrollHeight-this.$target[0].clientHeight:n(!0)},this.getTargetScrollHeight=function(){return this.hasTarget?this.$target[0].scrollHeight-this.$target[0].clientHeight:s()},this.getElementTop=function(t){if(!t&&angular.isDefined(this.posCache.top))return this.posCache.top;var e=this.$element[0].getBoundingClientRect(),i=e.top+this.getScrollOffset();if(this.hasTarget){var s=this.$target[0].getBoundingClientRect();i-=s.top}return i},this.getElementBottom=function(t){return this.getElementTop(t)+this.$element[0].offsetHeight},this.cachePosition=function(){this.posCache.top=this.getElementTop(!0)}},link:function(t,i,s,n){function o(){if(c&&a.enabled){var t=a.hitEdge,e=a.scrollEdgeHit(),s=!1;if(e>=0?g||(i.hasClass(a.scrollpointClass)||i.addClass(a.scrollpointClass),s=!0,g=!0):((g||angular.isUndefined(g))&&(i.hasClass(a.scrollpointClass)&&i.removeClass(a.scrollpointClass),s=!0,g=!1),a.cachePosition()),s&&a.actions)for(var n in a.actions)a.actions[n](e,i,a.hitEdge||t)}}function r(){e(function(){i.removeClass(a.scrollpointClass),g=void 0,a.hitEdge=void 0,a.cachePosition(),o()})}function l(){a.$target.on("scroll",o),t.$on("$destroy",function(){a.$target.off("scroll",o)})}var a=n[0],h=n[1],c=!1,g=!1,u=!1;a.setElement(i),a.setTarget(h?h.$element:null),s.$observe("uiScrollpoint",function(t){a.setScrollpoint(t),o()}),s.$observe("uiScrollpointEnabled",function(e){e=t.$eval(e),e!=a.enabled&&r(),a.enabled=e}),s.$observe("uiScrollpointAbsolute",function(e){e=t.$eval(e),e!=u&&(a.$target&&a.$target.off("scroll",o),a.setTarget(!e&&h?h.$element:null),l(),r()),u=e}),s.$observe("uiScrollpointAction",function(e){var i=t.$eval(e);i&&angular.isFunction(i)&&a.addAction(i)}),s.$observe("uiScrollpointClass",function(t){a.setClass(t),g=!1,o()}),s.$observe("uiScrollpointEdge",function(e){if(e){var i=["top","bottom","view"];-1==i.indexOf(e)&&(e=t.$eval(e)),a.setEdges(e)}}),l(),i.ready(function(){c=!0,o()}),t.$on("scrollpointShouldReset",r)}}}]).directive("uiScrollpointTarget",[function(){return{controller:["$element",function(t){this.$element=t}]}}])}();
{
"name": "angular-ui-scrollpoint",
"version": "2.0.1",
"version": "2.0.2",
"author": "https://github.com/angular-ui/ui-scrollpoint/graphs/contributors",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -280,4 +280,5 @@ /**

attrs.$observe('uiScrollpointAction', function(uiScrollpointAction){
if(scope[uiScrollpointAction] && angular.isFunction(scope[uiScrollpointAction])){
uiScrollpoint.addAction(scope[uiScrollpointAction]);
var action = scope.$eval(uiScrollpointAction);
if(action && angular.isFunction(action)){
uiScrollpoint.addAction(action);
}

@@ -284,0 +285,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