nexus site path corrected
[portal.git] / ecomp-portal-FE / client / bower_components / angular-material / modules / js / sticky / sticky.min.js
1 /*!
2  * Angular Material Design
3  * https://github.com/angular/material
4  * @license MIT
5  * v0.9.8
6  */
7 !function(t,e,n){"use strict";function r(t,r,o,l,c){function s(t){function e(t,e){e.addClass("md-sticky-clone"),e.css("top",$+"px");var n={element:t,clone:e};return v.items.push(n),m.parent().prepend(n.clone),d(),function(){v.items.forEach(function(e,n){e.element[0]===t[0]&&(v.items.splice(n,1),e.clone.remove())}),d()}}function o(){v.items.forEach(s),v.items=v.items.sort(function(t,e){return t.top<e.top?-1:1});for(var t,e=m.prop("scrollTop"),n=v.items.length-1;n>=0;n--)if(e>v.items[n].top){t=v.items[n];break}u(t)}function s(t){var e=t.element[0];for(t.top=0,t.left=0;e&&e!==m[0];)t.top+=e.offsetTop,t.left+=e.offsetLeft,e=e.offsetParent;t.height=t.element.prop("offsetHeight"),t.clone.css("margin-left",t.left+"px"),c.floatingScrollbars()&&t.clone.css("margin-right","0")}function i(){var t=m.prop("scrollTop"),e=t>(i.prevScrollTop||0);i.prevScrollTop=t,0===t?u(null):e&&v.next?v.next.top-t<=0?u(v.next):v.current&&(v.next.top-t<=v.next.height?f(v.current,v.next.top-v.next.height-t):f(v.current,null)):!e&&v.current&&(t<v.current.top&&u(v.prev),v.current&&v.next&&(t>=v.next.top-v.current.height?f(v.current,v.next.top-t-v.current.height):f(v.current,null)))}function u(t){if(v.current!==t){v.current&&(f(v.current,null),p(v.current,null)),t&&p(t,"active"),v.current=t;var e=v.items.indexOf(t);v.next=v.items[e+1],v.prev=v.items[e-1],p(v.next,"next"),p(v.prev,"prev")}}function p(t,e){t&&t.state!==e&&(t.state&&(t.clone.attr("sticky-prev-state",t.state),t.element.attr("sticky-prev-state",t.state)),t.clone.attr("sticky-state",e),t.element.attr("sticky-state",e),t.state=e)}function f(t,e){t&&(null===e||e===n?t.translateY&&(t.translateY=null,t.clone.css(r.CSS.TRANSFORM,"")):(t.translateY=e,t.clone.css(r.CSS.TRANSFORM,"translate3d("+t.left+"px,"+e+"px,0)")))}var m=t.$element,d=l.throttle(o);a(m),m.on("$scrollstart",d),m.on("$scroll",i);var v,$=m.prop("offsetTop");return v={prev:null,current:null,next:null,items:[],add:e,refreshElements:o}}function i(n){var r,o=e.element("<div>");t[0].body.appendChild(o[0]);for(var l=["sticky","-webkit-sticky"],c=0;c<l.length;++c)if(o.css({position:l[c],top:0,"z-index":2}),o.css("position")==l[c]){r=l[c];break}return o.remove(),r}function a(t){function e(){+c.now()-r>o?(n=!1,t.triggerHandler("$scrollend")):(t.triggerHandler("$scroll"),l(e))}var n,r,o=200;t.on("scroll touchmove",function(){n||(n=!0,l(e),t.triggerHandler("$scrollstart")),t.triggerHandler("$scroll"),r=+c.now()})}var u=i();return function(t,e,n){var r=e.controller("mdContent");if(r)if(u)e.css({position:u,top:0,"z-index":2});else{var o=r.$element.data("$$sticky");o||(o=s(r),r.$element.data("$$sticky",o));var l=o.add(e,n||e.clone());t.$on("$destroy",l)}}}e.module("material.components.sticky",["material.core","material.components.content"]).factory("$mdSticky",r),r.$inject=["$document","$mdConstant","$compile","$$rAF","$mdUtil"]}(window,window.angular);