You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

3 lines
16 KiB

7 years ago
/*! Sortable 1.7.0 - MIT | git://github.com/wchid/Sortable.git */
7 years ago
!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")};var T,S,C,E,x,k,h,v,m,_,N,B,P,c,o,Y,X,d,b,M,t,D={},i=/\s+/g,O=/left|right|inline/,I="Sortable"+(new Date).getTime(),y=window,u=y.document,r=y.parseInt,R=y.setTimeout,e=y.jQuery||y.Zepto,n=y.Polymer,a=!1,l=!1,s="draggable"in u.createElement("div"),f=!navigator.userAgent.match(/(?:Trident.*rv[ :]?11\.|msie)/i)&&((t=u.createElement("x")).style.cssText="pointer-events:auto","auto"===t.style.pointerEvents),A=!1,w=Math.abs,p=Math.min,g=[],H=[],L=function(){return!1},F=it(function(t,e,n){if(n&&e.scroll){var o,i,r,a,l,s,c=n[I],d=e.scrollSensitivity,h=e.scrollSpeed,u=t.clientX,f=t.clientY,p=window.innerWidth,g=window.innerHeight;if(m!==n&&(v=e.scroll,m=n,_=e.scrollFn,!0===v)){v=n;do{if(v.offsetWidth<v.scrollWidth||v.offsetHeight<v.scrollHeight)break}while(v=v.parentNode)}v&&(i=(o=v).getBoundingClientRect(),r=(w(i.right-u)<=d)-(w(i.left-u)<=d),a=(w(i.bottom-f)<=d)-(w(i.top-f)<=d)),r||a||(a=(g-f<=d)-(f<=d),((r=(p-u<=d)-(u<=d))||a)&&(o=y)),D.vx===r&&D.vy===a&&D.el===o||(D.el=o,D.vx=r,D.vy=a,clearInterval(D.pid),o&&(D.pid=setInterval(function(){s=a?a*h:0,l=r?r*h:0,"function"==typeof _&&"continue"!==_.call(c,l,s,t,b,o)||(o===y?y.scrollTo(y.pageXOffset+l,y.pageYOffset+s):(o.scrollTop+=s,o.scrollLeft+=l))},24)))}},30),W=function(t){function e(o,i){return null!=o&&!0!==o||null!=(o=n.name)?"function"==typeof o?o:function(t,e){var n=e.options.group.name;return i?o:o&&(o.join?-1<o.indexOf(n):n==o)}:L}var n={},o=t.group;o&&"object"==typeof o||(o={name:o}),n.name=o.name,n.checkPull=e(o.pull,!0),n.checkPut=e(o.put),n.revertClone=o.revertClone,t.group=n};try{window.addEventListener("test",null,Object.defineProperty({},"passive",{get:function(){a={capture:l=!1,passive:l}}}))}catch(t){}function j(t,e){if(!t||!t.nodeType||1!==t.nodeType)throw"Sortable: `el` must be HTMLElement, and not "+{}.toString.call(t);this.el=t,this.options=e=rt({},e),t[I]=this;var n={group:null,sort:!0,disabled:!1,store:null,handle:null,scroll:!0,scrollSensitivity:30,scrollSpeed:10,draggable:/[uo]l/i.test(t.nodeName)?"li":">*",ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,setData:function(t,e){t.setData("Text",e.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,touchStartThreshold:r(window.devicePixelRatio,10)||1,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,fallbackOffset:{x:0,y:0},supportPointer:!1!==j.supportPointer};for(var o in n)!(o in e)&&(e[o]=n[o]);for(var i in W(e),this)"_"===i.charAt(0)&&"function"==typeof this[i]&&(this[i]=this[i].bind(this));this.nativeDraggable=!e.forceFallback&&s,q(t,"mousedown",this._onTapStart),q(t,"touchstart",this._onTapStart),e.supportPointer&&q(t,"pointerdown",this._onTapStart),this.nativeDraggable&&(q(t,"dragover",this),q(t,"dragenter",this)),H.push(this._onDragOver),e.store&&this.sort(e.store.get(this))}function U(t,e){"clone"!==t.lastPullMode&&(e=!0),E&&E.state!==e&&(Q(E,"display",e?"none":""),e||E.state&&(t.options.group.revertClone?(x.insertBefore(E,k),t._animate(T,E)):x.insertBefore(E,T)),E.state=e)}function V(t,e,n){if(t){n=n||u;do{if(">*"===e&&t.parentNode===n||ot(t,e))return t}while(void 0,t=(i=(o=t).host)&&i.nodeType?i:o.parentNode)}var o,i;return null}function q(t,e,n){t.addEventListener(e,n,a)}function z(t,e,n){t.removeEventListener(e,n,a)}function G(t,e,n){if(t)if(t.classList)t.classList[n?"add":"remove"](e);else{var o=(" "+t.className+" ").replace(i," ").replace(" "+e+" "," ");t.className=(o+(n?" "+e:"")).replace(i," ")}}function Q(t,e,n){var o=t&&t.style;if(o){if(void 0===n)return u.defaultView&&u.defaultView.getComputedStyle?n=u.defaultView.getComputedStyle(t,""):t.currentStyle&&(n=t.currentStyle),void 0===e?n:n[e];e in o||(e="-webkit-"+e),o[