%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /proc/985914/root/data/old/home/stash/atlassian-stash/static/util/
Upload File :
Create Path :
Current File : //proc/985914/root/data/old/home/stash/atlassian-stash/static/util/synchronized-scroll-min.js

define("util/synchronized-scroll",["underscore","util/function","util/math","util/performance","exports"],function(W,O,I,P,X){var N=O.spread(I.multiply);function G(Z,a){return W.chain(W.zip(Z,a)).map(N).reduce(I.add,0).value()}function R(Z){if(Z instanceof R){return Z}if(!(this instanceof R)){return new R(Z)}this._el=Z;this._programmatic=false;return this}R.prototype.getScrollInfo=function(){return{top:this._el.scrollTop,left:this._el.scrollLeft,width:this._el.scrollWidth,height:this._el.scrollHeight,clientWidth:this._el.clientWidth,clientHeight:this._el.clientHeight}};R.prototype.scrollTo=function(Z,a){if(a!=null){this._programmatic=true;this._el.scrollTop=a}if(Z!=null){this._programmatic=true;this._el.scrollLeft=Z}};R.prototype.getAndUnsetProgrammaticScrollMarker=function(){var Z=this._programmatic;this._programmatic=false;return Z};function C(a,Z){if(!(this instanceof C)){return new C(a,Z)}this._el=Z;this._parentScrollable=a;if(!this._parentScrollable._el){throw new Error("Regions can't (yet) be created for custom Scrollables. We would need to solve the API problem of where to put a function to get the offset relative to the top of the scrollable.")}return this}C.prototype.getHeight=function(){return this._el.offsetHeight};C.prototype.getOffsetTop=function(){return this._el.getBoundingClientRect().top-this._parentScrollable._el.getBoundingClientRect().top};function Q(Z,a){return a}function A(Z,a){return Z.scrollHeight-Z.clientHeight-a}var S=O.dot("scrollTop");function Y(Z){return Z.scrollHeight-Z.clientHeight-Z.scrollTop}function F(a,b,r,h,q,k){var p=(b.scrollTop!==a.scrollTop);var i=(b.scrollLeft!==a.scrollLeft);r=W.filter(r,function(v){return(p&&v.canScrollVertically)||(i&&v.canScrollHorizontally)});if(!r.length){return[]}if(!p){return W.map(r,function(v){return K(v,null,b.scrollLeft)})}var o=b.scrollTop>a.scrollTop?"down":"up";var t=r.concat(b);var j=W.filter(t,O.dot("canScrollVertically"));var f=O.binary(Math.max);function u(v,w){return W.chain(v).pluck(w).reduce(f,0).value()}var c=u(j,"topness");var e=u(j,"bottomness");var s=T(c*c,e*e,o);var n=s[0];var Z=s[1];var d=s[2];var g=n>0?U(k,b,r,h,q):[];var l=Z>0?W.map(r,o==="up"?L(a,b,S,Q):V(a,b,S,Q)):[];var m=d>0?W.map(r,o==="down"?L(a,b,Y,A):V(a,b,Y,A)):[];return W.chain(r).zip(W.zip(g,l,m)).map(O.spread(function(v,x){var AA=v.scrollLeft!==b.scrollLeft;if(!v.canScrollVertically){return K(v,null,AA&&v.canScrollHorizontally?b.scrollLeft:null)}var z=x.map(O.defaultValue(0)).map(I.clamp(0,v.scrollHeight));var AB=G(z,s);var y=AB-v.scrollTop;var w=0<(o==="up"?-1:1)*y;if(!w&&!AA){return null}return K(v,w?AB:null,AA?b.scrollLeft:null)})).filter(W.identity).value()}function T(d,Z,c){var b=Math.max(d,Z);var a=Math.min(d,Z);var e=(1-b)/(1+a);var g=(1-b)*a/(1+a);var f=d>Z||(d===Z&&c==="up");return[e,f?b:g,f?g:b]}function K(Z,a,b){return{scrollable:Z.scrollable,scrollTop:a,scrollLeft:b}}function L(Z,c,f,e){var a=1;var b=Math.max(f(Z),a);var d=(b-f(c))/b;return function(i){var g=Math.max(f(i),a);var h=g-d*g;if(h<1){h=0}return e(i,h)}}function V(Z,b,e,c){var a=e(Z);var d=e(b)-a;return function(g){var f=e(g)+d;return c(g,f)}}function U(h,i,e,Z,d){var a=i.clientHeight*h;var g=Z(i.scrollable);var c=M(a,g);var b=e.map(function(j){if(!j.canScrollVertically){return null}return J(d(c.region,j.scrollable))});var f=E(a,c);return W.zip(b,e).map(O.spread(function(l,j){if(!j.canScrollVertically){return null}var k=j.clientHeight*h;var n=H(k,f,l);var m=j.scrollTop;return Math.max(0,m+l.offsetTop-n)}))}function E(c,a){var Z=a.offsetTop+a.height;var b=(Z-c)/a.height;return Math.max(0,Math.min(1,b))}function H(b,a,Z){return(a*Z.height)+b-Z.height}function M(a,b){var Z;W.some(b,function(f){var e=J(f);var d=e.offsetTop;var c=e.height;if(a>d&&a<=d+c){Z=e;return true}return false});return Z}function J(Z){return{region:Z,offsetTop:Z.getOffsetTop(),height:Z.getHeight()}}function B(a){var b=a.getScrollInfo();b={scrollable:a,clientWidth:b.clientWidth,clientHeight:b.clientHeight,scrollWidth:b.width,scrollHeight:b.height,scrollTop:b.top,scrollLeft:b.left,canScrollHorizontally:b.clientWidth<b.width,canScrollVertically:b.clientHeight<b.height};var Z=b.clientHeight/2;b.topness=Z?Math.max(0,(Z-b.scrollTop)/Z):0;b.bottomness=Z?Math.max(0,1-(b.scrollHeight-(b.scrollTop+b.clientHeight))/Z):0;return b}function D(b){b=W.extend({},X.getScrollHandler.defaults,b);var c=B(b.self);var a=P.enqueueCapped(requestAnimationFrame,function Z(){var e=B(b.self);var f=W.map(b.others,B);var d=F(c,e,f,b.getRegions,b.getLinkedRegion,b.focusHeightFraction);c=e;if(d.length){b.executeCommands(d)}});return{handle:function(){if(b.self.getAndUnsetProgrammaticScrollMarker()){c=B(b.self);return }a()},reset:function(){c=B(b.self)}}}X.createScrollable=R;X.createRegion=C;X.getScrollHandler=D;X.getScrollHandler.defaults={self:null,others:null,getRegions:null,getLinkedRegion:null,focusHeightFraction:0.5,executeCommands:function(Z){W.forEach(Z,function(a){a.scrollable.scrollTo(a.scrollLeft,a.scrollTop)})}}});

Zerion Mini Shell 1.0