-
-
Notifications
You must be signed in to change notification settings - Fork 21
/
min.js
1 lines (1 loc) · 2.16 KB
/
min.js
1
(()=>{let d=(e,t)=>{for(var r of e)t(r);return e},h=(e,t)=>e.push(t),f=e=>d(e,e=>e()),b=(e,t,r)=>e.setAttribute(t,r),m=(e,t)=>e.insertBefore(t,e.firstChild),v=e=>{var t=document.createElement("div");return b(t,"class",e),t},y=e=>e.offsetHeight,w=e=>e.getBoundingClientRect(),E=(t,e,r)=>{let n=[];return d(e.split(" "),e=>{h(n,((e,t,r)=>e.removeEventListener(t,r)).bind(0,t,e,r)),t.addEventListener(e,r)}),f.bind(0,n)},g=(e,t,r)=>r?r.a/(r.a+r.b):w(e).height/w(t).height;return e=>{let t=(e=>{let[t,r]=(()=>{let n=new Map;return[(e,t)=>{let r=n.get(e)||new Set;return n.set(e,r),d([t],e=>r.add(e))},(e,t)=>d((e=n.get(e),Array.from(e)),e=>e(t))]})(),n={Z:u=(e=e.ownerDocument).documentElement,J:u,d:u,e:e,f:e.defaultView,c:e},o=(s=n,[()=>s,e=>s=e]),i=o[0],l=(()=>{let e=(e=>{let t=o[1];return()=>t({a:e.f.innerHeight,b:w(e.J).height-e.f.innerHeight})})(n);return()=>d([e],e=>e())})(),a=i.bind(0);var s,u;return n,u=n.Z,new ResizeObserver(()=>{l(),r("u")}).observe(u),a.n=e=>t("u",e),a.m=n,a})(e),r=(e=>{let[t]=(e=>{var t,r,n,o;let{c:i,Z:l,d:a}=e,s=(e,n)=>d(e,t=>{var[t,r]=n(t);d(Object.keys(r),e=>t.style[e]=r[e])}),u=[];return r={g:e=v("scrollbar"),h:o=v("track"),i:t=v("thumb")},m(e,o),m(o,t),h(u,r),n=r,b,e=i,o=a,f.bind(0,((e,c,d,h)=>{let{i:b,h:m}=n,v="scrollTop",g="clientY";return E(m,"pointerdown",a=>{var s;let u=Element.prototype.closest.call(a.target,".thumb")===b,p=u?b:m;if(0===a.button&&a.isPrimary&&u&&e.scrollbars.pointers.includes(a.pointerType)){s=d[v];let r=a[g],e=w(b),t=w(m),n=e.top-t.top+e.height/2,o=u?0:r-t.top-n,i=e=>{f(l),p.releasePointerCapture(e.pointerId)},l=[E(c,"pointerup pointerleave pointercancel lostpointercapture",i),E(m,"pointermove",e=>{var t;e=e[g]-r,u&&(e=o+e,t=h().b,e=e/(y(m)-y(b))*t,d[v]=s+e)})];b.setPointerCapture(a.pointerId)}})})(p,e,o,c)),[{k:r=>s(u,e=>{var{i:e,h:t}=e;return[e,{height:(100*g(e,t,r)).toFixed(3)+"%"}]}),l:o=>s(u,e=>{var t,r,{i:e,h:n}=e;return[e,{transform:`translateY(${(100*(r=o.b,t=a.scrollTop/r,1/(r=g(e,n))*(1-r)*t)).toFixed(3)}%)`}]})},m(l,u[0].g)]})(e.m,(p={scrollbars:{dragScroll:!0,pointers:["mouse","touch","pen"]}},c=e)),r=e.m.e,{k:n,l:o}=t;var p,c;return E(r,"scroll",()=>o(e())),()=>{n(e()),o(e())}})(t);return t.n(()=>r())}})()(document.body)