This repository has been archived on 2020-03-24. You can view files and clone it, but cannot push or open issues or pull requests.
quay/static/standalonelib/jquery.overscroll.min.js

1 line
8.5 KiB
JavaScript
Raw Normal View History

2019-11-12 16:09:47 +00:00
!function(a,b,c,d,e,f,g,h,i){"use strict";function j(a,b){b.trigger("overscroll:"+a)}function k(){return(new Date).getTime()}function l(a,b,c){return b.x=a.pageX,b.y=a.pageY,b.time=k(),b.index=c,b}function m(a,b,c,d){var e,f;a&&a.added&&(a.horizontal&&(e=c*(1+b.container.width/b.container.scrollWidth),f=d+b.thumbs.horizontal.top,a.horizontal.css("margin",f+"px 0 0 "+e+"px")),a.vertical&&(e=c+b.thumbs.vertical.left,f=d*(1+b.container.height/b.container.scrollHeight),a.vertical.css("margin",f+"px 0 0 "+e+"px")))}function n(a,b,c){a&&a.added&&!b.persistThumbs&&(c?(a.vertical&&a.vertical.stop(!0,!0).fadeTo("fast",J.thumbOpacity),a.horizontal&&a.horizontal.stop(!0,!0).fadeTo("fast",J.thumbOpacity)):(a.vertical&&a.vertical.fadeTo("fast",0),a.horizontal&&a.horizontal.fadeTo("fast",0)))}function o(a){var b,c="events",d=h._data?h._data(a[0],c):a.data(c);d&&d.click&&(b=d.click.slice(),a.off("click").one("click",function(){return h.each(b,function(b,c){a.click(c)}),!1}))}function p(a){var b=a.data,c=b.thumbs,d=b.options,e="mouseenter"===a.type;n(c,d,e)}function q(a){var b=a.data;b.flags.dragged||m(b.thumbs,b.sizing,this.scrollLeft,this.scrollTop)}function r(a){a.preventDefault();var b=a.data,c=b.options,d=b.sizing,g=b.thumbs,h=b.wheel,i=b.flags,j=a.originalEvent,k=0,l=0,o=0;i.drifting=!1,j.detail?(k=-j.detail,j.detailX&&(l=-j.detailX),j.detailY&&(o=-j.detailY)):j.wheelDelta&&(k=j.wheelDelta/J.wheelTicks,j.wheelDeltaX&&(l=j.wheelDeltaX/J.wheelTicks),j.wheelDeltaY&&(o=j.wheelDeltaY/J.wheelTicks)),k*=c.wheelDelta,l*=c.wheelDelta,o*=c.wheelDelta,h||(b.target.data(G).dragging=i.dragging=!0,b.wheel=h={timeout:null},n(g,c,!0)),"vertical"===c.wheelDirection?this.scrollTop-=k:"horizontal"===c.wheelDirection?this.scrollLeft-=k:(this.scrollLeft-=l,this.scrollTop-=o||k),h.timeout&&f(h.timeout),m(g,d,this.scrollLeft,this.scrollTop),h.timeout=e(function(){b.target.data(G).dragging=i.dragging=!1,n(g,c,b.wheel=null)},J.thumbTimeout)}function s(a){a.preventDefault();var b=a.data,c=a.originalEvent.touches,d=b.options,e=b.sizing,f=b.thumbs,g=b.position,h=b.flags,i=b.target.get(0);c&&c.length&&(a=c[0]),h.dragged||n(f,d,!0),h.dragged=!0,"vertical"!==d.direction&&(i.scrollLeft-=a.pageX-g.x),"horizontal"!==b.options.direction&&(i.scrollTop-=a.pageY-g.y),l(a,b.position),--b.capture.index<=0&&(b.target.data(G).dragging=h.dragging=!0,l(a,b.capture,J.captureThreshold)),m(f,e,i.scrollLeft,i.scrollTop)}function t(a,b,c){var d,e,f,g,h=b.data,i=h.capture,l=h.options,n=h.sizing,o=h.thumbs,p=k()-i.time,q=a.scrollLeft,r=a.scrollTop,s=J.driftDecay;return p>J.driftTimeout?(c(h),void 0):(d=l.scrollDelta*(b.pageX-i.x),e=l.scrollDelta*(b.pageY-i.y),"vertical"!==l.direction&&(q-=d),"horizontal"!==l.direction&&(r-=e),f=d/J.driftSequences,g=e/J.driftSequences,j("driftstart",h.target),h.drifting=!0,H.animate(function t(){if(h.drifting){var b=1,d=-1;h.drifting=!1,(g>b&&a.scrollTop>r||d>g&&a.scrollTop<r)&&(h.drifting=!0,a.scrollTop-=g,g/=s),(f>b&&a.scrollLeft>q||d>f&&a.scrollLeft<q)&&(h.drifting=!0,a.scrollLeft-=f,f/=s),m(o,n,a.scrollLeft,a.scrollTop),H.animate(t)}else j("driftend",h.target),c(h)}),void 0)}function u(a){var b=a.data,c=a.originalEvent.touches,d=b.target,e=b.start=h(a.target),f=b.flags;f.drifting=!1,e.size()&&!e.is(b.options.cancelOn)&&(c||a.preventDefault(),H.overflowScrolling||(d.css("cursor",H.cursor.grabbing),d.data(G).dragging=f.dragging=f.dragged=!1,b.options.dragHold?h(document).on(I.drag,b,s):d.on(I.drag,b,s)),b.position=l(a,{}),b.capture=l(a,{},J.captureThreshold),j("dragstart",d))}function v(a){var b=a.data,c=b.target,d=b.options,e=b.flags,f=b.thumbs,g=function(){f&&!d.hoverThumbs&&n(f,d,!1)};d.dragHold?h(document).unbind(I.drag,s):c.unbind(I.drag,s),b.position&&(j("dragend",c),e.dragging&&!H.overflowScrolling?t(c.get(0),a,g):g()),e.dragging&&!H.overflowScrolling&&b.start&&b.start.is(a.target)&&o(b.start),c.data(G).dragging=b.start=b.capture=b.position=e.dragged=e.dragging=!1,c.css("cursor",H.cursor.grab)}function w(a){return a=h.extend({},K,a),"multi"!==a.direction&&a.direction!==a.wheelDirection&&(a.wheelDirection=a.direction),a.scrollDelta=d.abs(p