mirror of
https://github.com/zadam/trilium.git
synced 2024-11-18 21:55:26 +08:00
3 lines
25 KiB
JavaScript
3 lines
25 KiB
JavaScript
|
/*! Sortable 1.9.0 - MIT | git://github.com/SortableJS/Sortable.git */
|
||
|
|
||
|
!function(t){"use strict";"function"==typeof define&&define.amd?define(t):"undefined"!=typeof module&&void 0!==module.exports?module.exports=t():window.Sortable=t()}(function(){"use strict";if("undefined"==typeof window||!window.document)return function(){throw new Error("Sortable.js requires a window with a document")};function A(t,e){if(!t||!t.getBoundingClientRect)return ut();var o=t,n=!1;do{if(o.clientWidth<o.scrollWidth||o.clientHeight<o.scrollHeight){var i=Tt(o);if(o.clientWidth<o.scrollWidth&&("auto"==i.overflowX||"scroll"==i.overflowX)||o.clientHeight<o.scrollHeight&&("auto"==i.overflowY||"scroll"==i.overflowY)){if(!o||!o.getBoundingClientRect||o===J.body)return ut();if(n||e)return o;n=!0}}}while(o=o.parentNode);return ut()}function X(t,e,o){t.scrollLeft+=e,t.scrollTop+=o}function n(t){E&&E.parentNode&&E.parentNode[Q]&&E.parentNode[Q]._computeIsAligned(t)}function u(){!it&&p&&Tt(p,"display","none")}function f(){!it&&p&&Tt(p,"display","")}var E,x,p,v,M,N,g,Y,k,I,P,i,O,r,H,B,l,s,c,m,R,L,W,F,z,j,b,U,V=[],q=!1,w=!1,G=!1,d=[],K=!1,Z=!1,_=[],a=/\s+/g,Q="Sortable"+(new Date).getTime(),y=window,J=y.document,D=y.parseInt,$=y.setTimeout,e=y.jQuery||y.Zepto,o=y.Polymer,h={capture:!1,passive:!1},T=!!navigator.userAgent.match(/(?:Trident.*rv[ :]?11\.|msie|iemobile)/i),S=!!navigator.userAgent.match(/Edge/i),C=!!navigator.userAgent.match(/firefox/i),tt=!(!navigator.userAgent.match(/safari/i)||navigator.userAgent.match(/chrome/i)||navigator.userAgent.match(/android/i)),et=!!navigator.userAgent.match(/iP(ad|od|hone)/i),ot=S||T?"cssFloat":"float",nt="draggable"in J.createElement("div"),it=function(){if(T)return!1;var t=J.createElement("x");return t.style.cssText="pointer-events:auto","auto"===t.style.pointerEvents}(),rt=!1,at=!1,lt=Math.abs,st=Math.min,ct=Math.max,dt=[],ht=function(t,e){var o=Tt(t),n=D(o.width)-D(o.paddingLeft)-D(o.paddingRight)-D(o.borderLeftWidth)-D(o.borderRightWidth),i=Pt(t,0,e),r=Pt(t,1,e),a=i&&Tt(i),l=r&&Tt(r),s=a&&D(a.marginLeft)+D(a.marginRight)+Lt(i).width,c=l&&D(l.marginLeft)+D(l.marginRight)+Lt(r).width;if("flex"===o.display)return"column"===o.flexDirection||"column-reverse"===o.flexDirection?"vertical":"horizontal";if("grid"===o.display)return o.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(i&&"none"!==a.float){var d="left"===a.float?"left":"right";return!r||"both"!==l.clear&&l.clear!==d?"horizontal":"vertical"}return i&&("block"===a.display||"flex"===a.display||"table"===a.display||"grid"===a.display||n<=s&&"none"===o[ot]||r&&"none"===o[ot]&&n<s+c)?"vertical":"horizontal"},ut=function(){return T?J.documentElement:J.scrollingElement},ft=t(function(o,t,e,n){if(t.scroll){var i=e?e[Q]:window,r=t.scrollSensitivity,a=t.scrollSpeed,l=o.clientX,s=o.clientY,c=ut(),d=!1;k!==e&&(pt(),Y=t.scroll,I=t.scrollFn,!0===Y&&(Y=A(e,!0),k=Y));var h=0,u=Y;do{var f,p,v,g,m,b,w,_,y,D=u,T=Lt(D),S=T.top,C=T.bottom,E=T.left,x=T.right,M=T.width,N=T.height;if(f=D.scrollWidth,p=D.scrollHeight,v=Tt(D),_=D.scrollLeft,y=D.scrollTop,w=D===c?(b=M<f&&("auto"===v.overflowX||"scroll"===v.overflowX||"visible"===v.overflowX),N<p&&("auto"===v.overflowY||"scroll"===v.overflowY||"visible"===v.overflowY)):(b=M<f&&("auto"===v.overflowX||"scroll"===v.overflowX),N<p&&("auto"===v.overflowY||"scroll"===v.overflowY)),g=b&&(lt(x-l)<=r&&_+M<f)-(lt(E-l)<=r&&!!_),m=w&&(lt(C-s)<=r&&y+N<p)-(lt(S-s)<=r&&!!y),!V[h])for(var P=0;P<=h;P++)V[P]||(V[P]={});V[h].vx==g&&V[h].vy==m&&V[h].el===D||(V[h].el=D,V[h].vx=g,V[h].vy=m,clearInterval(V[h].pid),!D||0==g&&0==m||(d=!0,V[h].pid=setInterval(function(){n&&0===this.layer&&(bt.active._emulateDragOver(!0),bt.active._onTouchMove(R,!0));var t=V[this.layer].vy?V[this.layer].vy*a:0,e=V[this.layer].vx?V[this.layer].vx*a:0;"function"==typeof I&&"continue"!==I.call(i,e,t,o,R,V[this.layer].el)||X(V[this.layer].el,e,t)}.bind({layer:h}),24))),h++}while(t.bubbleScroll&&u!==c&&(u=A(u,!1)));q=d}},30),pt=function(){V.forEach(function(t){clearInterval(t.pid)}),V=[]},vt=function(t){function s(a,l){return function(t,e,o,n){var i=t.options.group.name&&e.options.group.name&&t.options.group.name===e.options.group.nam
|