source: trip-planner-front/node_modules/angular-material/modules/js/sticky/sticky.min.js@ 6a3a178

Last change on this file since 6a3a178 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 2.9 KB
Line 
1/*!
2 * AngularJS Material Design
3 * https://github.com/angular/material
4 * @license MIT
5 * v1.2.2-master-0a06f99
6 */
7!function(t,e,p){"use strict";function n(a,f,u,c){var s=u.checkStickySupport();return function(t,e,n){var r=e.controller("mdContent");if(r)if(s)e.css({position:s,top:0,"z-index":2});else{var o=r.$element.data("$$sticky");o||(o=function(t){var r,o=t.$element,i=f.throttle(e);return function(t){var e,n,r=200;function o(){+u.now()-n>r?(e=!1,t.triggerHandler("$scrollend")):(t.triggerHandler("$scroll"),f.throttle(o))}t.on("scroll touchmove",function(){e||(e=!0,f.throttle(o),t.triggerHandler("$scrollstart")),t.triggerHandler("$scroll"),n=+u.now()})}(o),o.on("$scrollstart",i),o.on("$scroll",function t(){var e=o.prop("scrollTop");var n=(t.prevScrollTop||0)<e;t.prevScrollTop=e;if(0===e)return void c(null);if(n){if(r.next&&r.next.top<=e)return void c(r.next);if(r.current&&r.next&&r.next.top-e<=r.next.height)return void s(r.current,e+(r.next.top-r.next.height-e))}if(!n){if(r.current&&r.prev&&e<r.current.top)return void c(r.prev);if(r.next&&r.current&&e>=r.next.top-r.current.height)return void s(r.current,e+(r.next.top-e-r.current.height))}r.current&&s(r.current,e)}),r={prev:null,current:null,next:null,items:[],add:function(n,t){t.addClass("md-sticky-clone");var e={element:n,clone:t};return r.items.push(e),u.nextTick(function(){o.prepend(e.clone)}),i(),function(){r.items.forEach(function(t,e){t.element[0]===n[0]&&(r.items.splice(e,1),t.clone.remove())}),i()}},refreshElements:e};function e(){var t;r.items.forEach(l),r.items=r.items.sort(function(t,e){return t.top<e.top?-1:1});for(var e=o.prop("scrollTop"),n=r.items.length-1;0<=n;n--)if(e>r.items[n].top){t=r.items[n];break}c(t)}function l(t){var e=t.element[0];for(t.top=0,t.left=0,t.right=0;e&&e!==o[0];)t.top+=e.offsetTop,t.left+=e.offsetLeft,e.offsetParent&&(t.right+=e.offsetParent.offsetWidth-e.offsetWidth-e.offsetLeft),e=e.offsetParent;t.height=t.element.prop("offsetHeight");var n=u.floatingScrollbars()?"0":p;u.bidi(t.clone,"margin-left",t.left,n),u.bidi(t.clone,"margin-right",n,t.right)}function c(t){if(r.current!==t){r.current&&(s(r.current,null),n(r.current,null)),t&&n(t,"active"),r.current=t;var e=r.items.indexOf(t);r.next=r.items[e+1],r.prev=r.items[e-1],n(r.next,"next"),n(r.prev,"prev")}}function n(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 s(t,e){t&&(null===e||e===p?t.translateY&&(t.translateY=null,t.clone.css(a.CSS.TRANSFORM,"")):(t.translateY=e,u.bidi(t.clone,a.CSS.TRANSFORM,"translate3d("+t.left+"px,"+e+"px,0)","translateY("+e+"px)")))}}(r),r.$element.data("$$sticky",o));var i=n||c(e.clone())(t),l=o.add(e,i);t.$on("$destroy",l)}}}n.$inject=["$mdConstant","$$rAF","$mdUtil","$compile"],e.module("material.components.sticky",["material.core","material.components.content"]).factory("$mdSticky",n)}(window,window.angular);
Note: See TracBrowser for help on using the repository browser.