From 8451985bd83004a7147ab82c001a7cf60f4c5924 Mon Sep 17 00:00:00 2001 From: desmaisons_david Date: Sat, 8 Apr 2017 23:50:54 -0300 Subject: [PATCH 1/7] send insertAfter information in move hook --- Sortable.js | 101 +++++++++++++++++++++++++----------------------- Sortable.min.js | 3 +- 2 files changed, 54 insertions(+), 50 deletions(-) diff --git a/Sortable.js b/Sortable.js index b6654ac..39f09b1 100644 --- a/Sortable.js +++ b/Sortable.js @@ -67,7 +67,7 @@ $ = win.jQuery || win.Zepto, Polymer = win.Polymer, - captureMode = {capture: false, passive: false}, + captureMode = { capture: false, passive: false }, supportDraggable = !!('draggable' in document.createElement('div')), supportCssPointerEvents = (function (el) { @@ -107,7 +107,7 @@ scrollOffsetX, scrollOffsetY - ; + ; // Delect scrollEl if (scrollParentEl !== rootEl) { @@ -158,7 +158,7 @@ scrollOffsetY = vy ? vy * speed : 0; scrollOffsetX = vx ? vx * speed : 0; - if ('function' === typeof(scrollCustomFn)) { + if ('function' === typeof (scrollCustomFn)) { return scrollCustomFn.call(_this, scrollOffsetX, scrollOffsetY, evt); } @@ -200,7 +200,7 @@ var originalGroup = options.group; if (!originalGroup || typeof originalGroup != 'object') { - originalGroup = {name: originalGroup}; + originalGroup = { name: originalGroup }; } group.name = originalGroup.name; @@ -210,7 +210,7 @@ options.group = group; } - ; + ; @@ -261,7 +261,7 @@ fallbackClass: 'sortable-fallback', fallbackOnBody: false, fallbackTolerance: 0, - fallbackOffset: {x: 0, y: 0} + fallbackOffset: { x: 0, y: 0 } }; @@ -384,7 +384,7 @@ dragEl = target; parentEl = dragEl.parentNode; nextEl = dragEl.nextSibling; - lastDownEl = target + lastDownEl = target; activeGroup = options.group; oldIndex = startIndex; @@ -476,11 +476,11 @@ } try { - if (document.selection) { + if (document.selection) { // Timeout neccessary for IE9 setTimeout(function () { document.selection.empty(); - }); + }); } else { window.getSelection().removeAllRanges(); } @@ -552,7 +552,7 @@ _onTouchMove: function (/**TouchEvent*/evt) { if (tapEvt) { - var options = this.options, + var options = this.options, fallbackTolerance = options.fallbackTolerance, fallbackOffset = options.fallbackOffset, touch = evt.touches ? evt.touches[0] : evt, @@ -763,34 +763,36 @@ isLong = (target.offsetHeight > dragEl.offsetHeight), halfway = (floating ? (evt.clientX - targetRect.left) / width : (evt.clientY - targetRect.top) / height) > 0.5, nextSibling = target.nextElementSibling, - moveVector = _onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt), after - ; + ; - if (moveVector !== false) { - _silent = true; - setTimeout(_unsilent, 30); + if (floating) { + var elTop = dragEl.offsetTop, + tgTop = target.offsetTop; - _cloneHide(activeSortable, isOwner); + if (elTop === tgTop) { + after = (target.previousElementSibling === dragEl) && !isWide || halfway && isWide; + } + else if (target.previousElementSibling === dragEl || dragEl.previousElementSibling === target) { + after = (evt.clientY - targetRect.top) / height > 0.5; + } else { + after = tgTop > elTop; + } + } else { + after = (nextSibling !== dragEl) && !isLong || halfway && isLong; + } + var moveVector = _onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, after); + + if (moveVector !== false) { if (moveVector === 1 || moveVector === -1) { after = (moveVector === 1); } - else if (floating) { - var elTop = dragEl.offsetTop, - tgTop = target.offsetTop; - if (elTop === tgTop) { - after = (target.previousElementSibling === dragEl) && !isWide || halfway && isWide; - } - else if (target.previousElementSibling === dragEl || dragEl.previousElementSibling === target) { - after = (evt.clientY - targetRect.top) / height > 0.5; - } else { - after = tgTop > elTop; - } - } else { - after = (nextSibling !== dragEl) && !isLong || halfway && isLong; - } + _silent = true; + setTimeout(_unsilent, 30); + + _cloneHide(activeSortable, isOwner); if (!dragEl.contains(el)) { if (after && !nextSibling) { @@ -941,30 +943,30 @@ this._nulling(); }, - _nulling: function() { + _nulling: function () { rootEl = - dragEl = - parentEl = - ghostEl = - nextEl = - cloneEl = - lastDownEl = + dragEl = + parentEl = + ghostEl = + nextEl = + cloneEl = + lastDownEl = - scrollEl = - scrollParentEl = + scrollEl = + scrollParentEl = - tapEvt = - touchEvt = + tapEvt = + touchEvt = - moved = - newIndex = + moved = + newIndex = - lastEl = - lastCSS = + lastEl = + lastCSS = - putSortable = - activeGroup = - Sortable.active = null; + putSortable = + activeGroup = + Sortable.active = null; }, handleEvent: function (/**Event*/evt) { @@ -1247,7 +1249,7 @@ } - function _onMove(fromEl, toEl, dragEl, dragRect, targetEl, targetRect, originalEvt) { + function _onMove(fromEl, toEl, dragEl, dragRect, targetEl, targetRect, originalEvt, insertAfter) { var evt, sortable = fromEl[expando], onMoveFn = sortable.options.onMove, @@ -1262,6 +1264,7 @@ evt.draggedRect = dragRect; evt.related = targetEl || toEl; evt.relatedRect = targetRect || toEl.getBoundingClientRect(); + evt.insertAfter = insertAfter; fromEl.dispatchEvent(evt); diff --git a/Sortable.min.js b/Sortable.min.js index 40fc746..d4326e1 100644 --- a/Sortable.min.js +++ b/Sortable.min.js @@ -1,2 +1,3 @@ /*! Sortable 1.5.0-rc1 - MIT | git://github.com/rubaxa/Sortable.git */ -!function(a){"use strict";"function"==typeof define&&define.amd?define(a):"undefined"!=typeof module&&"undefined"!=typeof module.exports?module.exports=a():"undefined"!=typeof Package?Sortable=a():window.Sortable=a()}(function(){"use strict";function a(a,b){if(!a||!a.nodeType||1!==a.nodeType)throw"Sortable: `el` must be HTMLElement, and not "+{}.toString.call(a);this.el=a,this.options=b=t({},b),a[Q]=this;var c={group:Math.random(),sort:!0,disabled:!1,store:null,handle:null,scroll:!0,scrollSensitivity:30,scrollSpeed:10,draggable:/[uo]l/i.test(a.nodeName)?"li":">*",ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,animation:0,setData:function(a,b){a.setData("Text",b.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,fallbackOffset:{x:0,y:0}};for(var d in c)!(d in b)&&(b[d]=c[d]);ba(b);for(var e in this)"_"===e.charAt(0)&&"function"==typeof this[e]&&(this[e]=this[e].bind(this));this.nativeDraggable=!b.forceFallback&&W,f(a,"mousedown",this._onTapStart),f(a,"touchstart",this._onTapStart),f(a,"pointerdown",this._onTapStart),this.nativeDraggable&&(f(a,"dragover",this),f(a,"dragenter",this)),_.push(this._onDragOver),b.store&&this.sort(b.store.get(this))}function b(a){y&&y.state!==a&&(i(y,"display",a?"none":""),!a&&y.state&&z.insertBefore(y,v),y.state=a)}function c(a,b,c){if(a){c=c||S;do if(">*"===b&&a.parentNode===c||r(a,b))return a;while(a=d(a))}return null}function d(a){var b=a.host;return b&&b.nodeType?b:a.parentNode}function e(a){a.dataTransfer&&(a.dataTransfer.dropEffect="move"),a.preventDefault()}function f(a,b,c){a.addEventListener(b,c,!1)}function g(a,b,c){a.removeEventListener(b,c,!1)}function h(a,b,c){if(a)if(a.classList)a.classList[c?"add":"remove"](b);else{var d=(" "+a.className+" ").replace(P," ").replace(" "+b+" "," ");a.className=(d+(c?" "+b:"")).replace(P," ")}}function i(a,b,c){var d=a&&a.style;if(d){if(void 0===c)return S.defaultView&&S.defaultView.getComputedStyle?c=S.defaultView.getComputedStyle(a,""):a.currentStyle&&(c=a.currentStyle),void 0===b?c:c[b];b in d||(b="-webkit-"+b),d[b]=c+("string"==typeof c?"":"px")}}function j(a,b,c){if(a){var d=a.getElementsByTagName(b),e=0,f=d.length;if(c)for(;e5||b.clientX-(d.right+d.width)>5)&&c}function p(a){for(var b=a.tagName+a.className+a.src+a.href+a.textContent,c=b.length,d=0;c--;)d+=b.charCodeAt(c);return d.toString(36)}function q(a,b){var c=0;if(!a||!a.parentNode)return-1;for(;a&&(a=a.previousElementSibling);)"TEMPLATE"===a.nodeName.toUpperCase()||">*"!==b&&!r(a,b)||c++;return c}function r(a,b){if(a){b=b.split(".");var c=b.shift().toUpperCase(),d=new RegExp("\\s("+b.join("|")+")(?=\\s)","g");return!(""!==c&&a.nodeName.toUpperCase()!=c||b.length&&((" "+a.className+" ").match(d)||[]).length!=b.length)}return!1}function s(a,b){var c,d;return function(){void 0===c&&(c=arguments,d=this,setTimeout(function(){1===c.length?a.call(d,c[0]):a.apply(d,c),c=void 0},b))}}function t(a,b){if(a&&b)for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c]);return a}function u(a){return U?U(a).clone(!0)[0]:V&&V.dom?V.dom(a).cloneNode(!0):a.cloneNode(!0)}if("undefined"==typeof window||!window.document)return function(){throw new Error("Sortable.js requires a window with a document")};var v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O={},P=/\s+/g,Q="Sortable"+(new Date).getTime(),R=window,S=R.document,T=R.parseInt,U=R.jQuery||R.Zepto,V=R.Polymer,W=!!("draggable"in S.createElement("div")),X=function(a){return!navigator.userAgent.match(/Trident.*rv[ :]?11\./)&&(a=S.createElement("x"),a.style.cssText="pointer-events:auto","auto"===a.style.pointerEvents)}(),Y=!1,Z=Math.abs,$=Math.min,_=([].slice,[]),aa=s(function(a,b,c){if(c&&b.scroll){var d,e,f,g,h,i,j=b.scrollSensitivity,k=b.scrollSpeed,l=a.clientX,m=a.clientY,n=window.innerWidth,o=window.innerHeight;if(C!==c&&(B=b.scroll,C=c,D=b.scrollFn,B===!0)){B=c;do if(B.offsetWidth-1:e==a)}}var c={},d=a.group;d&&"object"==typeof d||(d={name:d}),c.name=d.name,c.checkPull=b(d.pull,!0),c.checkPut=b(d.put),a.group=c};return a.prototype={constructor:a,_onTapStart:function(a){var b,d=this,e=this.el,f=this.options,g=a.type,h=a.touches&&a.touches[0],i=(h||a).target,j=a.target.shadowRoot&&a.path[0]||i,l=f.filter;if(!v&&!("mousedown"===g&&0!==a.button||f.disabled)&&(!f.handle||c(j,f.handle,e))&&(i=c(i,f.draggable,e))){if(b=q(i,f.draggable),"function"==typeof l){if(l.call(this,a,i,this))return k(d,j,"filter",i,e,b),void a.preventDefault()}else if(l&&(l=l.split(",").some(function(a){if(a=c(j,a.trim(),e))return k(d,a,"filter",i,e,b),!0})))return void a.preventDefault();this._prepareDragStart(a,h,i,b)}},_prepareDragStart:function(a,b,c,d){var e,g=this,i=g.el,l=g.options,n=i.ownerDocument;c&&!v&&c.parentNode===i&&(L=a,z=i,v=c,w=v.parentNode,A=v.nextSibling,J=l.group,H=d,this._lastX=(b||a).clientX,this._lastY=(b||a).clientY,v.style["will-change"]="transform",e=function(){g._disableDelayedDrag(),v.draggable=g.nativeDraggable,h(v,l.chosenClass,!0),g._triggerDragStart(a,b),k(g,z,"choose",v,z,H)},l.ignore.split(",").forEach(function(a){j(v,a.trim(),m)}),f(n,"mouseup",g._onDrop),f(n,"touchend",g._onDrop),f(n,"touchcancel",g._onDrop),f(n,"pointercancel",g._onDrop),l.delay?(f(n,"mouseup",g._disableDelayedDrag),f(n,"touchend",g._disableDelayedDrag),f(n,"touchcancel",g._disableDelayedDrag),f(n,"mousemove",g._disableDelayedDrag),f(n,"touchmove",g._disableDelayedDrag),f(n,"pointermove",g._disableDelayedDrag),g._dragStartTimer=setTimeout(e,l.delay)):e())},_disableDelayedDrag:function(){var a=this.el.ownerDocument;clearTimeout(this._dragStartTimer),g(a,"mouseup",this._disableDelayedDrag),g(a,"touchend",this._disableDelayedDrag),g(a,"touchcancel",this._disableDelayedDrag),g(a,"mousemove",this._disableDelayedDrag),g(a,"touchmove",this._disableDelayedDrag),g(a,"pointermove",this._disableDelayedDrag)},_triggerDragStart:function(a,b){b=b||("touch"==a.pointerType?a:null),b?(L={target:v,clientX:b.clientX,clientY:b.clientY},this._onDragStart(L,"touch")):this.nativeDraggable?(f(v,"dragend",this),f(z,"dragstart",this._onDragStart)):this._onDragStart(L,!0);try{S.selection?setTimeout(function(){S.selection.empty()}):window.getSelection().removeAllRanges()}catch(a){}},_dragStarted:function(){if(z&&v){var b=this.options;h(v,b.ghostClass,!0),h(v,b.dragClass,!1),a.active=this,k(this,z,"start",v,z,H)}},_emulateDragOver:function(){if(M){if(this._lastX===M.clientX&&this._lastY===M.clientY)return;this._lastX=M.clientX,this._lastY=M.clientY,X||i(x,"display","none");var a=S.elementFromPoint(M.clientX,M.clientY),b=a,c=_.length;if(b)do{if(b[Q]){for(;c--;)_[c]({clientX:M.clientX,clientY:M.clientY,target:a,rootEl:b});break}a=b}while(b=b.parentNode);X||i(x,"display","")}},_onTouchMove:function(b){if(L){var c=this.options,d=c.fallbackTolerance,e=c.fallbackOffset,f=b.touches?b.touches[0]:b,g=f.clientX-L.clientX+e.x,h=f.clientY-L.clientY+e.y,j=b.touches?"translate3d("+g+"px,"+h+"px,0)":"translate("+g+"px,"+h+"px)";if(!a.active){if(d&&$(Z(f.clientX-this._lastX),Z(f.clientY-this._lastY))v.offsetWidth,D=e.offsetHeight>v.offsetHeight,H=(B?(d.clientX-g.left)/t:(d.clientY-g.top)/u)>.5,I=e.nextElementSibling,L=l(z,j,v,f,e,g,d);if(L!==!1){if(Y=!0,setTimeout(n,30),b(q),1===L||L===-1)s=1===L;else if(B){var M=v.offsetTop,O=e.offsetTop;s=M===O?e.previousElementSibling===v&&!C||H&&C:e.previousElementSibling===v||v.previousElementSibling===e?(d.clientY-g.top)/u>.5:O>M}else s=I!==v&&!D||H&&D;v.contains(j)||(s&&!I?j.appendChild(v):e.parentNode.insertBefore(v,s?I:e)),w=v.parentNode,this._animate(f,v),this._animate(g,e)}}}},_animate:function(a,b){var c=this.options.animation;if(c){var d=b.getBoundingClientRect();i(b,"transition","none"),i(b,"transform","translate3d("+(a.left-d.left)+"px,"+(a.top-d.top)+"px,0)"),b.offsetWidth,i(b,"transition","all "+c+"ms"),i(b,"transform","translate3d(0,0,0)"),clearTimeout(b.animated),b.animated=setTimeout(function(){i(b,"transition",""),i(b,"transform",""),b.animated=!1},c)}},_offUpEvents:function(){var a=this.el.ownerDocument;g(S,"touchmove",this._onTouchMove),g(S,"pointermove",this._onTouchMove),g(a,"mouseup",this._onDrop),g(a,"touchend",this._onDrop),g(a,"pointerup",this._onDrop),g(a,"touchcancel",this._onDrop)},_onDrop:function(b){var c=this.el,d=this.options;clearInterval(this._loopId),clearInterval(O.pid),clearTimeout(this._dragStartTimer),g(S,"mousemove",this._onTouchMove),this.nativeDraggable&&(g(S,"drop",this),g(c,"dragstart",this._onDragStart)),this._offUpEvents(),b&&(N&&(b.preventDefault(),!d.dropBubble&&b.stopPropagation()),x&&x.parentNode.removeChild(x),v&&(this.nativeDraggable&&g(v,"dragend",this),m(v),v.style["will-change"]="",h(v,this.options.ghostClass,!1),h(v,this.options.chosenClass,!1),z!==w?(I=q(v,d.draggable),I>=0&&(k(null,w,"add",v,z,H,I),k(this,z,"remove",v,z,H,I),k(null,w,"sort",v,z,H,I),k(this,z,"sort",v,z,H,I))):(y&&y.parentNode.removeChild(y),v.nextSibling!==A&&(I=q(v,d.draggable),I>=0&&(k(this,z,"update",v,z,H,I),k(this,z,"sort",v,z,H,I)))),a.active&&(null!=I&&I!==-1||(I=H),k(this,z,"end",v,z,H,I),this.save()))),this._nulling()},_nulling:function(){z=v=w=x=A=y=B=C=L=M=N=I=E=F=K=J=a.active=null},handleEvent:function(a){var b=a.type;"dragover"===b||"dragenter"===b?v&&(this._onDragOver(a),e(a)):"drop"!==b&&"dragend"!==b||this._onDrop(a)},toArray:function(){for(var a,b=[],d=this.el.children,e=0,f=d.length,g=this.options;e*",ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,setData:function(a,b){a.setData("Text",b.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,fallbackOffset:{x:0,y:0}};for(var d in c)!(d in b)&&(b[d]=c[d]);da(b);for(var e in this)"_"===e.charAt(0)&&"function"==typeof this[e]&&(this[e]=this[e].bind(this));this.nativeDraggable=!b.forceFallback&&Y,f(a,"mousedown",this._onTapStart),f(a,"touchstart",this._onTapStart),f(a,"pointerdown",this._onTapStart),this.nativeDraggable&&(f(a,"dragover",this),f(a,"dragenter",this)),ba.push(this._onDragOver),b.store&&this.sort(b.store.get(this))}function b(a,b){"clone"!==a.lastPullMode&&(b=!0),y&&y.state!==b&&(i(y,"display",b?"none":""),b||y.state&&(a.options.group.revertClone?(z.insertBefore(y,A),a._animate(v,y)):z.insertBefore(y,v)),y.state=b)}function c(a,b,c){if(a){c=c||T;do{if(">*"===b&&a.parentNode===c||r(a,b))return a}while(a=d(a))}return null}function d(a){var b=a.host;return b&&b.nodeType?b:a.parentNode}function e(a){a.dataTransfer&&(a.dataTransfer.dropEffect="move"),a.preventDefault()}function f(a,b,c){a.addEventListener(b,c,X)}function g(a,b,c){a.removeEventListener(b,c,X)}function h(a,b,c){if(a)if(a.classList)a.classList[c?"add":"remove"](b);else{var d=(" "+a.className+" ").replace(Q," ").replace(" "+b+" "," ");a.className=(d+(c?" "+b:"")).replace(Q," ")}}function i(a,b,c){var d=a&&a.style;if(d){if(void 0===c)return T.defaultView&&T.defaultView.getComputedStyle?c=T.defaultView.getComputedStyle(a,""):a.currentStyle&&(c=a.currentStyle),void 0===b?c:c[b];b in d||(b="-webkit-"+b),d[b]=c+("string"==typeof c?"":"px")}}function j(a,b,c){if(a){var d=a.getElementsByTagName(b),e=0,f=d.length;if(c)for(;e5||b.clientX-(d.right+d.width)>5)&&c}function p(a){for(var b=a.tagName+a.className+a.src+a.href+a.textContent,c=b.length,d=0;c--;)d+=b.charCodeAt(c);return d.toString(36)}function q(a,b){var c=0;if(!a||!a.parentNode)return-1;for(;a&&(a=a.previousElementSibling);)"TEMPLATE"===a.nodeName.toUpperCase()||">*"!==b&&!r(a,b)||c++;return c}function r(a,b){if(a){b=b.split(".");var c=b.shift().toUpperCase(),d=new RegExp("\\s("+b.join("|")+")(?=\\s)","g");return!(""!==c&&a.nodeName.toUpperCase()!=c||b.length&&((" "+a.className+" ").match(d)||[]).length!=b.length)}return!1}function s(a,b){var c,d;return function(){void 0===c&&(c=arguments,d=this,setTimeout(function(){1===c.length?a.call(d,c[0]):a.apply(d,c),c=void 0},b))}}function t(a,b){if(a&&b)for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c]);return a}function u(a){return V?V(a).clone(!0)[0]:W&&W.dom?W.dom(a).cloneNode(!0):a.cloneNode(!0)}if("undefined"==typeof window||!window.document)return function(){throw new Error("Sortable.js requires a window with a document")};var v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P={},Q=/\s+/g,R="Sortable"+(new Date).getTime(),S=window,T=S.document,U=S.parseInt,V=S.jQuery||S.Zepto,W=S.Polymer,X={capture:!1,passive:!1},Y=!!("draggable"in T.createElement("div")),Z=function(a){return!navigator.userAgent.match(/Trident.*rv[ :]?11\./)&&(a=T.createElement("x"),a.style.cssText="pointer-events:auto","auto"===a.style.pointerEvents)}(),$=!1,_=Math.abs,aa=Math.min,ba=[],ca=s(function(a,b,c){if(c&&b.scroll){var d,e,f,g,h,i,j=c[R],k=b.scrollSensitivity,l=b.scrollSpeed,m=a.clientX,n=a.clientY,o=window.innerWidth,p=window.innerHeight;if(D!==c&&(C=b.scroll,D=c,E=b.scrollFn,!0===C)){C=c;do{if(C.offsetWidth-1:e==a)}}var c={},d=a.group;d&&"object"==typeof d||(d={name:d}),c.name=d.name,c.checkPull=b(d.pull,!0),c.checkPut=b(d.put),c.revertClone=d.revertClone,a.group=c};return a.prototype={constructor:a,_onTapStart:function(a){var b,d=this,e=this.el,f=this.options,g=f.preventOnFilter,h=a.type,i=a.touches&&a.touches[0],j=(i||a).target,l=a.target.shadowRoot&&a.path[0]||j,m=f.filter;if(!v&&!("mousedown"===h&&0!==a.button||f.disabled)&&(j=c(j,f.draggable,e))&&B!==j){if(b=q(j,f.draggable),"function"==typeof m){if(m.call(this,a,j,this))return k(d,l,"filter",j,e,b),void(g&&a.preventDefault())}else if(m&&(m=m.split(",").some(function(a){if(a=c(l,a.trim(),e))return k(d,a,"filter",j,e,b),!0})))return void(g&&a.preventDefault());f.handle&&!c(l,f.handle,e)||this._prepareDragStart(a,i,j,b)}},_prepareDragStart:function(a,b,c,d){var e,g=this,i=g.el,l=g.options,n=i.ownerDocument;c&&!v&&c.parentNode===i&&(M=a,z=i,v=c,w=v.parentNode,A=v.nextSibling,B=c,K=l.group,I=d,this._lastX=(b||a).clientX,this._lastY=(b||a).clientY,v.style["will-change"]="transform",e=function(){g._disableDelayedDrag(),v.draggable=g.nativeDraggable,h(v,l.chosenClass,!0),g._triggerDragStart(a,b),k(g,z,"choose",v,z,I)},l.ignore.split(",").forEach(function(a){j(v,a.trim(),m)}),f(n,"mouseup",g._onDrop),f(n,"touchend",g._onDrop),f(n,"touchcancel",g._onDrop),f(n,"pointercancel",g._onDrop),l.delay?(f(n,"mouseup",g._disableDelayedDrag),f(n,"touchend",g._disableDelayedDrag),f(n,"touchcancel",g._disableDelayedDrag),f(n,"mousemove",g._disableDelayedDrag),f(n,"touchmove",g._disableDelayedDrag),f(n,"pointermove",g._disableDelayedDrag),g._dragStartTimer=setTimeout(e,l.delay)):e(),l.forceFallback&&a.preventDefault())},_disableDelayedDrag:function(){var a=this.el.ownerDocument;clearTimeout(this._dragStartTimer),g(a,"mouseup",this._disableDelayedDrag),g(a,"touchend",this._disableDelayedDrag),g(a,"touchcancel",this._disableDelayedDrag),g(a,"mousemove",this._disableDelayedDrag),g(a,"touchmove",this._disableDelayedDrag),g(a,"pointermove",this._disableDelayedDrag)},_triggerDragStart:function(a,b){b=b||("touch"==a.pointerType?a:null),b?(M={target:v,clientX:b.clientX,clientY:b.clientY},this._onDragStart(M,"touch")):this.nativeDraggable?(f(v,"dragend",this),f(z,"dragstart",this._onDragStart)):this._onDragStart(M,!0);try{T.selection?setTimeout(function(){T.selection.empty()}):window.getSelection().removeAllRanges()}catch(a){}},_dragStarted:function(){if(z&&v){var b=this.options;h(v,b.ghostClass,!0),h(v,b.dragClass,!1),a.active=this,k(this,z,"start",v,z,I)}else this._nulling()},_emulateDragOver:function(){if(N){if(this._lastX===N.clientX&&this._lastY===N.clientY)return;this._lastX=N.clientX,this._lastY=N.clientY,Z||i(x,"display","none");var a=T.elementFromPoint(N.clientX,N.clientY),b=a,c=ba.length;if(b)do{if(b[R]){for(;c--;)ba[c]({clientX:N.clientX,clientY:N.clientY,target:a,rootEl:b});break}a=b}while(b=b.parentNode);Z||i(x,"display","")}},_onTouchMove:function(b){if(M){var c=this.options,d=c.fallbackTolerance,e=c.fallbackOffset,f=b.touches?b.touches[0]:b,g=f.clientX-M.clientX+e.x,h=f.clientY-M.clientY+e.y,j=b.touches?"translate3d("+g+"px,"+h+"px,0)":"translate("+g+"px,"+h+"px)";if(!a.active){if(d&&aa(_(f.clientX-this._lastX),_(f.clientY-this._lastY))v.offsetWidth,D=e.offsetHeight>v.offsetHeight,E=(B?(d.clientX-g.left)/t:(d.clientY-g.top)/u)>.5,I=e.nextElementSibling;if(B){var J=v.offsetTop,M=e.offsetTop;s=J===M?e.previousElementSibling===v&&!C||E&&C:e.previousElementSibling===v||v.previousElementSibling===e?(d.clientY-g.top)/u>.5:M>J}else s=I!==v&&!D||E&&D;var N=l(z,j,v,f,e,g,d,s);!1!==N&&(1!==N&&-1!==N||(s=1===N),$=!0,setTimeout(n,30),b(p,q),v.contains(j)||(s&&!I?j.appendChild(v):e.parentNode.insertBefore(v,s?I:e)),w=v.parentNode,this._animate(f,v),this._animate(g,e))}}},_animate:function(a,b){var c=this.options.animation;if(c){var d=b.getBoundingClientRect();1===a.nodeType&&(a=a.getBoundingClientRect()),i(b,"transition","none"),i(b,"transform","translate3d("+(a.left-d.left)+"px,"+(a.top-d.top)+"px,0)"),b.offsetWidth,i(b,"transition","all "+c+"ms"),i(b,"transform","translate3d(0,0,0)"),clearTimeout(b.animated),b.animated=setTimeout(function(){i(b,"transition",""),i(b,"transform",""),b.animated=!1},c)}},_offUpEvents:function(){var a=this.el.ownerDocument;g(T,"touchmove",this._onTouchMove),g(T,"pointermove",this._onTouchMove),g(a,"mouseup",this._onDrop),g(a,"touchend",this._onDrop),g(a,"pointerup",this._onDrop),g(a,"touchcancel",this._onDrop)},_onDrop:function(b){var c=this.el,d=this.options;clearInterval(this._loopId),clearInterval(P.pid),clearTimeout(this._dragStartTimer),g(T,"mousemove",this._onTouchMove),this.nativeDraggable&&(g(T,"drop",this),g(c,"dragstart",this._onDragStart)),this._offUpEvents(),b&&(O&&(b.preventDefault(),!d.dropBubble&&b.stopPropagation()),x&&x.parentNode.removeChild(x),v&&(this.nativeDraggable&&g(v,"dragend",this),m(v),v.style["will-change"]="",h(v,this.options.ghostClass,!1),h(v,this.options.chosenClass,!1),k(this,z,"unchoose",v,z,I),z!==w?(J=q(v,d.draggable))>=0&&(k(null,w,"add",v,z,I,J),k(this,z,"remove",v,z,I,J),k(null,w,"sort",v,z,I,J),k(this,z,"sort",v,z,I,J)):(y&&y.parentNode.removeChild(y),v.nextSibling!==A&&(J=q(v,d.draggable))>=0&&(k(this,z,"update",v,z,I,J),k(this,z,"sort",v,z,I,J))),a.active&&(null!=J&&-1!==J||(J=I),k(this,z,"end",v,z,I,J),this.save()))),this._nulling()},_nulling:function(){z=v=w=x=A=y=B=C=D=M=N=O=J=F=G=L=K=a.active=null},handleEvent:function(a){var b=a.type;"dragover"===b||"dragenter"===b?v&&(this._onDragOver(a),e(a)):"drop"!==b&&"dragend"!==b||this._onDrop(a)},toArray:function(){for(var a,b=[],d=this.el.children,e=0,f=d.length,g=this.options;e Date: Wed, 24 May 2017 11:07:26 -0300 Subject: [PATCH 2/7] remove junk changes --- Sortable.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sortable.js b/Sortable.js index 39f09b1..c21d539 100644 --- a/Sortable.js +++ b/Sortable.js @@ -67,7 +67,7 @@ $ = win.jQuery || win.Zepto, Polymer = win.Polymer, - captureMode = { capture: false, passive: false }, + captureMode = {capture: false, passive: false}, supportDraggable = !!('draggable' in document.createElement('div')), supportCssPointerEvents = (function (el) { From b9e780f384d918cef43ab60f2ae80447c706c7b4 Mon Sep 17 00:00:00 2001 From: desmaisons_david Date: Wed, 24 May 2017 11:28:28 -0300 Subject: [PATCH 3/7] Remove junk changes, part II --- Sortable.js | 54 ++++++++++++++++++++++++++--------------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/Sortable.js b/Sortable.js index c21d539..f6c3911 100644 --- a/Sortable.js +++ b/Sortable.js @@ -107,7 +107,7 @@ scrollOffsetX, scrollOffsetY - ; + ; // Delect scrollEl if (scrollParentEl !== rootEl) { @@ -158,7 +158,7 @@ scrollOffsetY = vy ? vy * speed : 0; scrollOffsetX = vx ? vx * speed : 0; - if ('function' === typeof (scrollCustomFn)) { + if ('function' === typeof(scrollCustomFn)) { return scrollCustomFn.call(_this, scrollOffsetX, scrollOffsetY, evt); } @@ -200,7 +200,7 @@ var originalGroup = options.group; if (!originalGroup || typeof originalGroup != 'object') { - originalGroup = { name: originalGroup }; + originalGroup = {name: originalGroup}; } group.name = originalGroup.name; @@ -210,7 +210,7 @@ options.group = group; } - ; + ; @@ -261,7 +261,7 @@ fallbackClass: 'sortable-fallback', fallbackOnBody: false, fallbackTolerance: 0, - fallbackOffset: { x: 0, y: 0 } + fallbackOffset: {x: 0, y: 0} }; @@ -384,7 +384,7 @@ dragEl = target; parentEl = dragEl.parentNode; nextEl = dragEl.nextSibling; - lastDownEl = target; + lastDownEl = target activeGroup = options.group; oldIndex = startIndex; @@ -476,11 +476,11 @@ } try { - if (document.selection) { + if (document.selection) { // Timeout neccessary for IE9 setTimeout(function () { document.selection.empty(); - }); + }); } else { window.getSelection().removeAllRanges(); } @@ -552,7 +552,7 @@ _onTouchMove: function (/**TouchEvent*/evt) { if (tapEvt) { - var options = this.options, + var options = this.options, fallbackTolerance = options.fallbackTolerance, fallbackOffset = options.fallbackOffset, touch = evt.touches ? evt.touches[0] : evt, @@ -764,7 +764,7 @@ halfway = (floating ? (evt.clientX - targetRect.left) / width : (evt.clientY - targetRect.top) / height) > 0.5, nextSibling = target.nextElementSibling, after - ; + ; if (floating) { var elTop = dragEl.offsetTop, @@ -945,28 +945,28 @@ _nulling: function () { rootEl = - dragEl = - parentEl = - ghostEl = - nextEl = - cloneEl = - lastDownEl = + dragEl = + parentEl = + ghostEl = + nextEl = + cloneEl = + lastDownEl = - scrollEl = - scrollParentEl = + scrollEl = + scrollParentEl = - tapEvt = - touchEvt = + tapEvt = + touchEvt = - moved = - newIndex = + moved = + newIndex = - lastEl = - lastCSS = + lastEl = + lastCSS = - putSortable = - activeGroup = - Sortable.active = null; + putSortable = + activeGroup = + Sortable.active = null; }, handleEvent: function (/**Event*/evt) { From 08b0143f98b58dd8682ccb5b59abaa9f6521ec4d Mon Sep 17 00:00:00 2001 From: desmaisons_david Date: Wed, 24 May 2017 11:41:13 -0300 Subject: [PATCH 4/7] removing junks partIII --- Sortable.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sortable.js b/Sortable.js index f6c3911..2d259e0 100644 --- a/Sortable.js +++ b/Sortable.js @@ -943,7 +943,7 @@ this._nulling(); }, - _nulling: function () { + _nulling: function() { rootEl = dragEl = parentEl = From 0cb1fe82f603a6a30b2fe254e183753075f9cfc6 Mon Sep 17 00:00:00 2001 From: desmaisons_david Date: Thu, 25 May 2017 04:58:43 -0300 Subject: [PATCH 5/7] Rename insertAfter into willInsertAfter --- Sortable.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sortable.js b/Sortable.js index 2d259e0..8626002 100644 --- a/Sortable.js +++ b/Sortable.js @@ -1249,7 +1249,7 @@ } - function _onMove(fromEl, toEl, dragEl, dragRect, targetEl, targetRect, originalEvt, insertAfter) { + function _onMove(fromEl, toEl, dragEl, dragRect, targetEl, targetRect, originalEvt, willInsertAfter) { var evt, sortable = fromEl[expando], onMoveFn = sortable.options.onMove, @@ -1264,7 +1264,7 @@ evt.draggedRect = dragRect; evt.related = targetEl || toEl; evt.relatedRect = targetRect || toEl.getBoundingClientRect(); - evt.insertAfter = insertAfter; + evt.willInsertAfter = willInsertAfter; fromEl.dispatchEvent(evt); From da80bb575b96b9ca67bbdefa028b6ad140cd7302 Mon Sep 17 00:00:00 2001 From: desmaisons_david Date: Thu, 25 May 2017 05:07:51 -0300 Subject: [PATCH 6/7] Regenerate sortable.min --- Sortable.js | 2 +- Sortable.min.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Sortable.js b/Sortable.js index 8626002..33b3c9f 100644 --- a/Sortable.js +++ b/Sortable.js @@ -384,7 +384,7 @@ dragEl = target; parentEl = dragEl.parentNode; nextEl = dragEl.nextSibling; - lastDownEl = target + lastDownEl = target; activeGroup = options.group; oldIndex = startIndex; diff --git a/Sortable.min.js b/Sortable.min.js index d4326e1..f4e1d2e 100644 --- a/Sortable.min.js +++ b/Sortable.min.js @@ -1,3 +1,3 @@ /*! Sortable 1.5.0-rc1 - MIT | git://github.com/rubaxa/Sortable.git */ -!function(a){"use strict";"function"==typeof define&&define.amd?define(a):"undefined"!=typeof module&&void 0!==module.exports?module.exports=a():window.Sortable=a()}(function(){"use strict";function a(a,b){if(!a||!a.nodeType||1!==a.nodeType)throw"Sortable: `el` must be HTMLElement, and not "+{}.toString.call(a);this.el=a,this.options=b=t({},b),a[R]=this;var c={group:Math.random(),sort:!0,disabled:!1,store:null,handle:null,scroll:!0,scrollSensitivity:30,scrollSpeed:10,draggable:/[uo]l/i.test(a.nodeName)?"li":">*",ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,setData:function(a,b){a.setData("Text",b.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,fallbackOffset:{x:0,y:0}};for(var d in c)!(d in b)&&(b[d]=c[d]);da(b);for(var e in this)"_"===e.charAt(0)&&"function"==typeof this[e]&&(this[e]=this[e].bind(this));this.nativeDraggable=!b.forceFallback&&Y,f(a,"mousedown",this._onTapStart),f(a,"touchstart",this._onTapStart),f(a,"pointerdown",this._onTapStart),this.nativeDraggable&&(f(a,"dragover",this),f(a,"dragenter",this)),ba.push(this._onDragOver),b.store&&this.sort(b.store.get(this))}function b(a,b){"clone"!==a.lastPullMode&&(b=!0),y&&y.state!==b&&(i(y,"display",b?"none":""),b||y.state&&(a.options.group.revertClone?(z.insertBefore(y,A),a._animate(v,y)):z.insertBefore(y,v)),y.state=b)}function c(a,b,c){if(a){c=c||T;do{if(">*"===b&&a.parentNode===c||r(a,b))return a}while(a=d(a))}return null}function d(a){var b=a.host;return b&&b.nodeType?b:a.parentNode}function e(a){a.dataTransfer&&(a.dataTransfer.dropEffect="move"),a.preventDefault()}function f(a,b,c){a.addEventListener(b,c,X)}function g(a,b,c){a.removeEventListener(b,c,X)}function h(a,b,c){if(a)if(a.classList)a.classList[c?"add":"remove"](b);else{var d=(" "+a.className+" ").replace(Q," ").replace(" "+b+" "," ");a.className=(d+(c?" "+b:"")).replace(Q," ")}}function i(a,b,c){var d=a&&a.style;if(d){if(void 0===c)return T.defaultView&&T.defaultView.getComputedStyle?c=T.defaultView.getComputedStyle(a,""):a.currentStyle&&(c=a.currentStyle),void 0===b?c:c[b];b in d||(b="-webkit-"+b),d[b]=c+("string"==typeof c?"":"px")}}function j(a,b,c){if(a){var d=a.getElementsByTagName(b),e=0,f=d.length;if(c)for(;e5||b.clientX-(d.right+d.width)>5)&&c}function p(a){for(var b=a.tagName+a.className+a.src+a.href+a.textContent,c=b.length,d=0;c--;)d+=b.charCodeAt(c);return d.toString(36)}function q(a,b){var c=0;if(!a||!a.parentNode)return-1;for(;a&&(a=a.previousElementSibling);)"TEMPLATE"===a.nodeName.toUpperCase()||">*"!==b&&!r(a,b)||c++;return c}function r(a,b){if(a){b=b.split(".");var c=b.shift().toUpperCase(),d=new RegExp("\\s("+b.join("|")+")(?=\\s)","g");return!(""!==c&&a.nodeName.toUpperCase()!=c||b.length&&((" "+a.className+" ").match(d)||[]).length!=b.length)}return!1}function s(a,b){var c,d;return function(){void 0===c&&(c=arguments,d=this,setTimeout(function(){1===c.length?a.call(d,c[0]):a.apply(d,c),c=void 0},b))}}function t(a,b){if(a&&b)for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c]);return a}function u(a){return V?V(a).clone(!0)[0]:W&&W.dom?W.dom(a).cloneNode(!0):a.cloneNode(!0)}if("undefined"==typeof window||!window.document)return function(){throw new Error("Sortable.js requires a window with a document")};var v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P={},Q=/\s+/g,R="Sortable"+(new Date).getTime(),S=window,T=S.document,U=S.parseInt,V=S.jQuery||S.Zepto,W=S.Polymer,X={capture:!1,passive:!1},Y=!!("draggable"in T.createElement("div")),Z=function(a){return!navigator.userAgent.match(/Trident.*rv[ :]?11\./)&&(a=T.createElement("x"),a.style.cssText="pointer-events:auto","auto"===a.style.pointerEvents)}(),$=!1,_=Math.abs,aa=Math.min,ba=[],ca=s(function(a,b,c){if(c&&b.scroll){var d,e,f,g,h,i,j=c[R],k=b.scrollSensitivity,l=b.scrollSpeed,m=a.clientX,n=a.clientY,o=window.innerWidth,p=window.innerHeight;if(D!==c&&(C=b.scroll,D=c,E=b.scrollFn,!0===C)){C=c;do{if(C.offsetWidth-1:e==a)}}var c={},d=a.group;d&&"object"==typeof d||(d={name:d}),c.name=d.name,c.checkPull=b(d.pull,!0),c.checkPut=b(d.put),c.revertClone=d.revertClone,a.group=c};return a.prototype={constructor:a,_onTapStart:function(a){var b,d=this,e=this.el,f=this.options,g=f.preventOnFilter,h=a.type,i=a.touches&&a.touches[0],j=(i||a).target,l=a.target.shadowRoot&&a.path[0]||j,m=f.filter;if(!v&&!("mousedown"===h&&0!==a.button||f.disabled)&&(j=c(j,f.draggable,e))&&B!==j){if(b=q(j,f.draggable),"function"==typeof m){if(m.call(this,a,j,this))return k(d,l,"filter",j,e,b),void(g&&a.preventDefault())}else if(m&&(m=m.split(",").some(function(a){if(a=c(l,a.trim(),e))return k(d,a,"filter",j,e,b),!0})))return void(g&&a.preventDefault());f.handle&&!c(l,f.handle,e)||this._prepareDragStart(a,i,j,b)}},_prepareDragStart:function(a,b,c,d){var e,g=this,i=g.el,l=g.options,n=i.ownerDocument;c&&!v&&c.parentNode===i&&(M=a,z=i,v=c,w=v.parentNode,A=v.nextSibling,B=c,K=l.group,I=d,this._lastX=(b||a).clientX,this._lastY=(b||a).clientY,v.style["will-change"]="transform",e=function(){g._disableDelayedDrag(),v.draggable=g.nativeDraggable,h(v,l.chosenClass,!0),g._triggerDragStart(a,b),k(g,z,"choose",v,z,I)},l.ignore.split(",").forEach(function(a){j(v,a.trim(),m)}),f(n,"mouseup",g._onDrop),f(n,"touchend",g._onDrop),f(n,"touchcancel",g._onDrop),f(n,"pointercancel",g._onDrop),l.delay?(f(n,"mouseup",g._disableDelayedDrag),f(n,"touchend",g._disableDelayedDrag),f(n,"touchcancel",g._disableDelayedDrag),f(n,"mousemove",g._disableDelayedDrag),f(n,"touchmove",g._disableDelayedDrag),f(n,"pointermove",g._disableDelayedDrag),g._dragStartTimer=setTimeout(e,l.delay)):e(),l.forceFallback&&a.preventDefault())},_disableDelayedDrag:function(){var a=this.el.ownerDocument;clearTimeout(this._dragStartTimer),g(a,"mouseup",this._disableDelayedDrag),g(a,"touchend",this._disableDelayedDrag),g(a,"touchcancel",this._disableDelayedDrag),g(a,"mousemove",this._disableDelayedDrag),g(a,"touchmove",this._disableDelayedDrag),g(a,"pointermove",this._disableDelayedDrag)},_triggerDragStart:function(a,b){b=b||("touch"==a.pointerType?a:null),b?(M={target:v,clientX:b.clientX,clientY:b.clientY},this._onDragStart(M,"touch")):this.nativeDraggable?(f(v,"dragend",this),f(z,"dragstart",this._onDragStart)):this._onDragStart(M,!0);try{T.selection?setTimeout(function(){T.selection.empty()}):window.getSelection().removeAllRanges()}catch(a){}},_dragStarted:function(){if(z&&v){var b=this.options;h(v,b.ghostClass,!0),h(v,b.dragClass,!1),a.active=this,k(this,z,"start",v,z,I)}else this._nulling()},_emulateDragOver:function(){if(N){if(this._lastX===N.clientX&&this._lastY===N.clientY)return;this._lastX=N.clientX,this._lastY=N.clientY,Z||i(x,"display","none");var a=T.elementFromPoint(N.clientX,N.clientY),b=a,c=ba.length;if(b)do{if(b[R]){for(;c--;)ba[c]({clientX:N.clientX,clientY:N.clientY,target:a,rootEl:b});break}a=b}while(b=b.parentNode);Z||i(x,"display","")}},_onTouchMove:function(b){if(M){var c=this.options,d=c.fallbackTolerance,e=c.fallbackOffset,f=b.touches?b.touches[0]:b,g=f.clientX-M.clientX+e.x,h=f.clientY-M.clientY+e.y,j=b.touches?"translate3d("+g+"px,"+h+"px,0)":"translate("+g+"px,"+h+"px)";if(!a.active){if(d&&aa(_(f.clientX-this._lastX),_(f.clientY-this._lastY))v.offsetWidth,D=e.offsetHeight>v.offsetHeight,E=(B?(d.clientX-g.left)/t:(d.clientY-g.top)/u)>.5,I=e.nextElementSibling;if(B){var J=v.offsetTop,M=e.offsetTop;s=J===M?e.previousElementSibling===v&&!C||E&&C:e.previousElementSibling===v||v.previousElementSibling===e?(d.clientY-g.top)/u>.5:M>J}else s=I!==v&&!D||E&&D;var N=l(z,j,v,f,e,g,d,s);!1!==N&&(1!==N&&-1!==N||(s=1===N),$=!0,setTimeout(n,30),b(p,q),v.contains(j)||(s&&!I?j.appendChild(v):e.parentNode.insertBefore(v,s?I:e)),w=v.parentNode,this._animate(f,v),this._animate(g,e))}}},_animate:function(a,b){var c=this.options.animation;if(c){var d=b.getBoundingClientRect();1===a.nodeType&&(a=a.getBoundingClientRect()),i(b,"transition","none"),i(b,"transform","translate3d("+(a.left-d.left)+"px,"+(a.top-d.top)+"px,0)"),b.offsetWidth,i(b,"transition","all "+c+"ms"),i(b,"transform","translate3d(0,0,0)"),clearTimeout(b.animated),b.animated=setTimeout(function(){i(b,"transition",""),i(b,"transform",""),b.animated=!1},c)}},_offUpEvents:function(){var a=this.el.ownerDocument;g(T,"touchmove",this._onTouchMove),g(T,"pointermove",this._onTouchMove),g(a,"mouseup",this._onDrop),g(a,"touchend",this._onDrop),g(a,"pointerup",this._onDrop),g(a,"touchcancel",this._onDrop)},_onDrop:function(b){var c=this.el,d=this.options;clearInterval(this._loopId),clearInterval(P.pid),clearTimeout(this._dragStartTimer),g(T,"mousemove",this._onTouchMove),this.nativeDraggable&&(g(T,"drop",this),g(c,"dragstart",this._onDragStart)),this._offUpEvents(),b&&(O&&(b.preventDefault(),!d.dropBubble&&b.stopPropagation()),x&&x.parentNode.removeChild(x),v&&(this.nativeDraggable&&g(v,"dragend",this),m(v),v.style["will-change"]="",h(v,this.options.ghostClass,!1),h(v,this.options.chosenClass,!1),k(this,z,"unchoose",v,z,I),z!==w?(J=q(v,d.draggable))>=0&&(k(null,w,"add",v,z,I,J),k(this,z,"remove",v,z,I,J),k(null,w,"sort",v,z,I,J),k(this,z,"sort",v,z,I,J)):(y&&y.parentNode.removeChild(y),v.nextSibling!==A&&(J=q(v,d.draggable))>=0&&(k(this,z,"update",v,z,I,J),k(this,z,"sort",v,z,I,J))),a.active&&(null!=J&&-1!==J||(J=I),k(this,z,"end",v,z,I,J),this.save()))),this._nulling()},_nulling:function(){z=v=w=x=A=y=B=C=D=M=N=O=J=F=G=L=K=a.active=null},handleEvent:function(a){var b=a.type;"dragover"===b||"dragenter"===b?v&&(this._onDragOver(a),e(a)):"drop"!==b&&"dragend"!==b||this._onDrop(a)},toArray:function(){for(var a,b=[],d=this.el.children,e=0,f=d.length,g=this.options;e*",ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,setData:function(a,b){a.setData("Text",b.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,fallbackOffset:{x:0,y:0}};for(var d in c)!(d in b)&&(b[d]=c[d]);da(b);for(var e in this)"_"===e.charAt(0)&&"function"==typeof this[e]&&(this[e]=this[e].bind(this));this.nativeDraggable=!b.forceFallback&&Y,f(a,"mousedown",this._onTapStart),f(a,"touchstart",this._onTapStart),f(a,"pointerdown",this._onTapStart),this.nativeDraggable&&(f(a,"dragover",this),f(a,"dragenter",this)),ba.push(this._onDragOver),b.store&&this.sort(b.store.get(this))}function b(a,b){"clone"!==a.lastPullMode&&(b=!0),y&&y.state!==b&&(i(y,"display",b?"none":""),b||y.state&&(a.options.group.revertClone?(z.insertBefore(y,A),a._animate(v,y)):z.insertBefore(y,v)),y.state=b)}function c(a,b,c){if(a){c=c||T;do{if(">*"===b&&a.parentNode===c||r(a,b))return a}while(a=d(a))}return null}function d(a){var b=a.host;return b&&b.nodeType?b:a.parentNode}function e(a){a.dataTransfer&&(a.dataTransfer.dropEffect="move"),a.preventDefault()}function f(a,b,c){a.addEventListener(b,c,X)}function g(a,b,c){a.removeEventListener(b,c,X)}function h(a,b,c){if(a)if(a.classList)a.classList[c?"add":"remove"](b);else{var d=(" "+a.className+" ").replace(Q," ").replace(" "+b+" "," ");a.className=(d+(c?" "+b:"")).replace(Q," ")}}function i(a,b,c){var d=a&&a.style;if(d){if(void 0===c)return T.defaultView&&T.defaultView.getComputedStyle?c=T.defaultView.getComputedStyle(a,""):a.currentStyle&&(c=a.currentStyle),void 0===b?c:c[b];b in d||(b="-webkit-"+b),d[b]=c+("string"==typeof c?"":"px")}}function j(a,b,c){if(a){var d=a.getElementsByTagName(b),e=0,f=d.length;if(c)for(;e5||b.clientX-(d.right+d.width)>5)&&c}function p(a){for(var b=a.tagName+a.className+a.src+a.href+a.textContent,c=b.length,d=0;c--;)d+=b.charCodeAt(c);return d.toString(36)}function q(a,b){var c=0;if(!a||!a.parentNode)return-1;for(;a&&(a=a.previousElementSibling);)"TEMPLATE"===a.nodeName.toUpperCase()||">*"!==b&&!r(a,b)||c++;return c}function r(a,b){if(a){b=b.split(".");var c=b.shift().toUpperCase(),d=new RegExp("\\s("+b.join("|")+")(?=\\s)","g");return!(""!==c&&a.nodeName.toUpperCase()!=c||b.length&&((" "+a.className+" ").match(d)||[]).length!=b.length)}return!1}function s(a,b){var c,d;return function(){void 0===c&&(c=arguments,d=this,setTimeout(function(){1===c.length?a.call(d,c[0]):a.apply(d,c),c=void 0},b))}}function t(a,b){if(a&&b)for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c]);return a}function u(a){return V?V(a).clone(!0)[0]:W&&W.dom?W.dom(a).cloneNode(!0):a.cloneNode(!0)}if("undefined"==typeof window||!window.document)return function(){throw new Error("Sortable.js requires a window with a document")};var v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P={},Q=/\s+/g,R="Sortable"+(new Date).getTime(),S=window,T=S.document,U=S.parseInt,V=S.jQuery||S.Zepto,W=S.Polymer,X={capture:!1,passive:!1},Y=!!("draggable"in T.createElement("div")),Z=function(a){return!navigator.userAgent.match(/Trident.*rv[ :]?11\./)&&(a=T.createElement("x"),a.style.cssText="pointer-events:auto","auto"===a.style.pointerEvents)}(),$=!1,_=Math.abs,aa=Math.min,ba=[],ca=s(function(a,b,c){if(c&&b.scroll){var d,e,f,g,h,i,j=c[R],k=b.scrollSensitivity,l=b.scrollSpeed,m=a.clientX,n=a.clientY,o=window.innerWidth,p=window.innerHeight;if(D!==c&&(C=b.scroll,D=c,E=b.scrollFn,!0===C)){C=c;do{if(C.offsetWidth-1:e==a)}}var c={},d=a.group;d&&"object"==typeof d||(d={name:d}),c.name=d.name,c.checkPull=b(d.pull,!0),c.checkPut=b(d.put),c.revertClone=d.revertClone,a.group=c};return a.prototype={constructor:a,_onTapStart:function(a){var b,d=this,e=this.el,f=this.options,g=f.preventOnFilter,h=a.type,i=a.touches&&a.touches[0],j=(i||a).target,l=a.target.shadowRoot&&a.path[0]||j,m=f.filter;if(!v&&!("mousedown"===h&&0!==a.button||f.disabled)&&(j=c(j,f.draggable,e))&&B!==j){if(b=q(j,f.draggable),"function"==typeof m){if(m.call(this,a,j,this))return k(d,l,"filter",j,e,b),void(g&&a.preventDefault())}else if(m&&(m=m.split(",").some(function(a){if(a=c(l,a.trim(),e))return k(d,a,"filter",j,e,b),!0})))return void(g&&a.preventDefault());f.handle&&!c(l,f.handle,e)||this._prepareDragStart(a,i,j,b)}},_prepareDragStart:function(a,b,c,d){var e,g=this,i=g.el,l=g.options,n=i.ownerDocument;c&&!v&&c.parentNode===i&&(M=a,z=i,v=c,w=v.parentNode,A=v.nextSibling,B=c,K=l.group,I=d,this._lastX=(b||a).clientX,this._lastY=(b||a).clientY,v.style["will-change"]="transform",e=function(){g._disableDelayedDrag(),v.draggable=g.nativeDraggable,h(v,l.chosenClass,!0),g._triggerDragStart(a,b),k(g,z,"choose",v,z,I)},l.ignore.split(",").forEach(function(a){j(v,a.trim(),m)}),f(n,"mouseup",g._onDrop),f(n,"touchend",g._onDrop),f(n,"touchcancel",g._onDrop),f(n,"pointercancel",g._onDrop),l.delay?(f(n,"mouseup",g._disableDelayedDrag),f(n,"touchend",g._disableDelayedDrag),f(n,"touchcancel",g._disableDelayedDrag),f(n,"mousemove",g._disableDelayedDrag),f(n,"touchmove",g._disableDelayedDrag),f(n,"pointermove",g._disableDelayedDrag),g._dragStartTimer=setTimeout(e,l.delay)):e(),l.forceFallback&&a.preventDefault())},_disableDelayedDrag:function(){var a=this.el.ownerDocument;clearTimeout(this._dragStartTimer),g(a,"mouseup",this._disableDelayedDrag),g(a,"touchend",this._disableDelayedDrag),g(a,"touchcancel",this._disableDelayedDrag),g(a,"mousemove",this._disableDelayedDrag),g(a,"touchmove",this._disableDelayedDrag),g(a,"pointermove",this._disableDelayedDrag)},_triggerDragStart:function(a,b){b=b||("touch"==a.pointerType?a:null),b?(M={target:v,clientX:b.clientX,clientY:b.clientY},this._onDragStart(M,"touch")):this.nativeDraggable?(f(v,"dragend",this),f(z,"dragstart",this._onDragStart)):this._onDragStart(M,!0);try{T.selection?setTimeout(function(){T.selection.empty()}):window.getSelection().removeAllRanges()}catch(a){}},_dragStarted:function(){if(z&&v){var b=this.options;h(v,b.ghostClass,!0),h(v,b.dragClass,!1),a.active=this,k(this,z,"start",v,z,I)}else this._nulling()},_emulateDragOver:function(){if(N){if(this._lastX===N.clientX&&this._lastY===N.clientY)return;this._lastX=N.clientX,this._lastY=N.clientY,Z||i(x,"display","none");var a=T.elementFromPoint(N.clientX,N.clientY),b=a,c=ba.length;if(b)do{if(b[R]){for(;c--;)ba[c]({clientX:N.clientX,clientY:N.clientY,target:a,rootEl:b});break}a=b}while(b=b.parentNode);Z||i(x,"display","")}},_onTouchMove:function(b){if(M){var c=this.options,d=c.fallbackTolerance,e=c.fallbackOffset,f=b.touches?b.touches[0]:b,g=f.clientX-M.clientX+e.x,h=f.clientY-M.clientY+e.y,j=b.touches?"translate3d("+g+"px,"+h+"px,0)":"translate("+g+"px,"+h+"px)";if(!a.active){if(d&&aa(_(f.clientX-this._lastX),_(f.clientY-this._lastY))v.offsetWidth,D=e.offsetHeight>v.offsetHeight,E=(B?(d.clientX-g.left)/t:(d.clientY-g.top)/u)>.5,I=e.nextElementSibling;if(B){var J=v.offsetTop,M=e.offsetTop;s=J===M?e.previousElementSibling===v&&!C||E&&C:e.previousElementSibling===v||v.previousElementSibling===e?(d.clientY-g.top)/u>.5:M>J}else s=I!==v&&!D||E&&D;var N=l(z,j,v,f,e,g,d,s);!1!==N&&(1!==N&&-1!==N||(s=1===N),$=!0,setTimeout(n,30),b(p,q),v.contains(j)||(s&&!I?j.appendChild(v):e.parentNode.insertBefore(v,s?I:e)),w=v.parentNode,this._animate(f,v),this._animate(g,e))}}},_animate:function(a,b){var c=this.options.animation;if(c){var d=b.getBoundingClientRect();1===a.nodeType&&(a=a.getBoundingClientRect()),i(b,"transition","none"),i(b,"transform","translate3d("+(a.left-d.left)+"px,"+(a.top-d.top)+"px,0)"),b.offsetWidth,i(b,"transition","all "+c+"ms"),i(b,"transform","translate3d(0,0,0)"),clearTimeout(b.animated),b.animated=setTimeout(function(){i(b,"transition",""),i(b,"transform",""),b.animated=!1},c)}},_offUpEvents:function(){var a=this.el.ownerDocument;g(T,"touchmove",this._onTouchMove),g(T,"pointermove",this._onTouchMove),g(a,"mouseup",this._onDrop),g(a,"touchend",this._onDrop),g(a,"pointerup",this._onDrop),g(a,"touchcancel",this._onDrop)},_onDrop:function(b){var c=this.el,d=this.options;clearInterval(this._loopId),clearInterval(P.pid),clearTimeout(this._dragStartTimer),g(T,"mousemove",this._onTouchMove),this.nativeDraggable&&(g(T,"drop",this),g(c,"dragstart",this._onDragStart)),this._offUpEvents(),b&&(O&&(b.preventDefault(),!d.dropBubble&&b.stopPropagation()),x&&x.parentNode.removeChild(x),v&&(this.nativeDraggable&&g(v,"dragend",this),m(v),v.style["will-change"]="",h(v,this.options.ghostClass,!1),h(v,this.options.chosenClass,!1),k(this,z,"unchoose",v,z,I),z!==w?(J=q(v,d.draggable))>=0&&(k(null,w,"add",v,z,I,J),k(this,z,"remove",v,z,I,J),k(null,w,"sort",v,z,I,J),k(this,z,"sort",v,z,I,J)):(y&&y.parentNode.removeChild(y),v.nextSibling!==A&&(J=q(v,d.draggable))>=0&&(k(this,z,"update",v,z,I,J),k(this,z,"sort",v,z,I,J))),a.active&&(null!=J&&-1!==J||(J=I),k(this,z,"end",v,z,I,J),this.save()))),this._nulling()},_nulling:function(){z=v=w=x=A=y=B=C=D=M=N=O=J=F=G=L=K=a.active=null},handleEvent:function(a){var b=a.type;"dragover"===b||"dragenter"===b?v&&(this._onDragOver(a),e(a)):"drop"!==b&&"dragend"!==b||this._onDrop(a)},toArray:function(){for(var a,b=[],d=this.el.children,e=0,f=d.length,g=this.options;e Date: Thu, 25 May 2017 06:11:05 -0300 Subject: [PATCH 7/7] Remove junks --- Sortable.js | 12 ++++++------ Sortable.min.js | 3 ++- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Sortable.js b/Sortable.js index 2f7ea3e..3834653 100644 --- a/Sortable.js +++ b/Sortable.js @@ -442,7 +442,7 @@ } - } + } }, _disableDelayedDrag: function () { @@ -716,7 +716,7 @@ dragRect = dragEl.getBoundingClientRect(); if (putSortable !== this) { - putSortable = this; + putSortable = this; isMovingBetweenSortable = true; } @@ -1002,10 +1002,10 @@ case 'dragover': case 'dragenter': - if (dragEl) { - this._onDragOver(evt); - _globalDragOver(evt); - } + if (dragEl) { + this._onDragOver(evt); + _globalDragOver(evt); + } break; case 'selectstart': diff --git a/Sortable.min.js b/Sortable.min.js index bb1d9a9..5290531 100644 --- a/Sortable.min.js +++ b/Sortable.min.js @@ -1,2 +1,3 @@ /*! Sortable 1.5.1 - MIT | git://github.com/rubaxa/Sortable.git */ -!function(a){"use strict";"function"==typeof define&&define.amd?define(a):"undefined"!=typeof module&&"undefined"!=typeof module.exports?module.exports=a():window.Sortable=a()}(function(){"use strict";function a(a,b){if(!a||!a.nodeType||1!==a.nodeType)throw"Sortable: `el` must be HTMLElement, and not "+{}.toString.call(a);this.el=a,this.options=b=t({},b),a[T]=this;var c={group:Math.random(),sort:!0,disabled:!1,store:null,handle:null,scroll:!0,scrollSensitivity:30,scrollSpeed:10,draggable:/[uo]l/i.test(a.nodeName)?"li":">*",ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,setData:function(a,b){a.setData("Text",b.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,fallbackOffset:{x:0,y:0}};for(var d in c)!(d in b)&&(b[d]=c[d]);ga(b);for(var e in this)"_"===e.charAt(0)&&"function"==typeof this[e]&&(this[e]=this[e].bind(this));this.nativeDraggable=!b.forceFallback&&$,f(a,"mousedown",this._onTapStart),f(a,"touchstart",this._onTapStart),f(a,"pointerdown",this._onTapStart),this.nativeDraggable&&(f(a,"dragover",this),f(a,"dragenter",this)),ea.push(this._onDragOver),b.store&&this.sort(b.store.get(this))}function b(a,b){"clone"!==a.lastPullMode&&(b=!0),z&&z.state!==b&&(i(z,"display",b?"none":""),b||z.state&&(a.options.group.revertClone?(A.insertBefore(z,B),a._animate(w,z)):A.insertBefore(z,w)),z.state=b)}function c(a,b,c){if(a){c=c||V;do if(">*"===b&&a.parentNode===c||r(a,b))return a;while(a=d(a))}return null}function d(a){var b=a.host;return b&&b.nodeType?b:a.parentNode}function e(a){a.dataTransfer&&(a.dataTransfer.dropEffect="move"),a.preventDefault()}function f(a,b,c){a.addEventListener(b,c,Z)}function g(a,b,c){a.removeEventListener(b,c,Z)}function h(a,b,c){if(a)if(a.classList)a.classList[c?"add":"remove"](b);else{var d=(" "+a.className+" ").replace(R," ").replace(" "+b+" "," ");a.className=(d+(c?" "+b:"")).replace(R," ")}}function i(a,b,c){var d=a&&a.style;if(d){if(void 0===c)return V.defaultView&&V.defaultView.getComputedStyle?c=V.defaultView.getComputedStyle(a,""):a.currentStyle&&(c=a.currentStyle),void 0===b?c:c[b];b in d||(b="-webkit-"+b),d[b]=c+("string"==typeof c?"":"px")}}function j(a,b,c){if(a){var d=a.getElementsByTagName(b),e=0,f=d.length;if(c)for(;e5||b.clientX-(d.left+d.width)>5}function p(a){for(var b=a.tagName+a.className+a.src+a.href+a.textContent,c=b.length,d=0;c--;)d+=b.charCodeAt(c);return d.toString(36)}function q(a,b){var c=0;if(!a||!a.parentNode)return-1;for(;a&&(a=a.previousElementSibling);)"TEMPLATE"===a.nodeName.toUpperCase()||">*"!==b&&!r(a,b)||c++;return c}function r(a,b){if(a){b=b.split(".");var c=b.shift().toUpperCase(),d=new RegExp("\\s("+b.join("|")+")(?=\\s)","g");return!(""!==c&&a.nodeName.toUpperCase()!=c||b.length&&((" "+a.className+" ").match(d)||[]).length!=b.length)}return!1}function s(a,b){var c,d;return function(){void 0===c&&(c=arguments,d=this,setTimeout(function(){1===c.length?a.call(d,c[0]):a.apply(d,c),c=void 0},b))}}function t(a,b){if(a&&b)for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c]);return a}function u(a){return X?X(a).clone(!0)[0]:Y&&Y.dom?Y.dom(a).cloneNode(!0):a.cloneNode(!0)}function v(a){for(var b=a.getElementsByTagName("input"),c=b.length;c--;){var d=b[c];d.checked&&da.push(d)}}if("undefined"==typeof window||!window.document)return function(){throw new Error("Sortable.js requires a window with a document")};var w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q={},R=/\s+/g,S=/left|right|inline/,T="Sortable"+(new Date).getTime(),U=window,V=U.document,W=U.parseInt,X=U.jQuery||U.Zepto,Y=U.Polymer,Z=!1,$=!!("draggable"in V.createElement("div")),_=function(a){return!navigator.userAgent.match(/Trident.*rv[ :]?11\./)&&(a=V.createElement("x"),a.style.cssText="pointer-events:auto","auto"===a.style.pointerEvents)}(),aa=!1,ba=Math.abs,ca=Math.min,da=[],ea=[],fa=s(function(a,b,c){if(c&&b.scroll){var d,e,f,g,h,i,j=c[T],k=b.scrollSensitivity,l=b.scrollSpeed,m=a.clientX,n=a.clientY,o=window.innerWidth,p=window.innerHeight;if(E!==c&&(D=b.scroll,E=c,F=b.scrollFn,D===!0)){D=c;do if(D.offsetWidth-1:e==a)}}var c={},d=a.group;d&&"object"==typeof d||(d={name:d}),c.name=d.name,c.checkPull=b(d.pull,!0),c.checkPut=b(d.put),c.revertClone=d.revertClone,a.group=c};a.prototype={constructor:a,_onTapStart:function(a){var b,d=this,e=this.el,f=this.options,g=f.preventOnFilter,h=a.type,i=a.touches&&a.touches[0],j=(i||a).target,l=a.target.shadowRoot&&a.path[0]||j,m=f.filter;if(v(e),!w&&!("mousedown"===h&&0!==a.button||f.disabled)&&(j=c(j,f.draggable,e),j&&C!==j)){if(b=q(j,f.draggable),"function"==typeof m){if(m.call(this,a,j,this))return k(d,l,"filter",j,e,b),void(g&&a.preventDefault())}else if(m&&(m=m.split(",").some(function(a){if(a=c(l,a.trim(),e))return k(d,a,"filter",j,e,b),!0})))return void(g&&a.preventDefault());f.handle&&!c(l,f.handle,e)||this._prepareDragStart(a,i,j,b)}},_prepareDragStart:function(a,b,c,d){var e,g=this,i=g.el,l=g.options,n=i.ownerDocument;c&&!w&&c.parentNode===i&&(N=a,A=i,w=c,x=w.parentNode,B=w.nextSibling,C=c,L=l.group,J=d,this._lastX=(b||a).clientX,this._lastY=(b||a).clientY,w.style["will-change"]="transform",e=function(){g._disableDelayedDrag(),w.draggable=g.nativeDraggable,h(w,l.chosenClass,!0),g._triggerDragStart(a,b),k(g,A,"choose",w,A,J)},l.ignore.split(",").forEach(function(a){j(w,a.trim(),m)}),f(n,"mouseup",g._onDrop),f(n,"touchend",g._onDrop),f(n,"touchcancel",g._onDrop),f(n,"pointercancel",g._onDrop),f(n,"selectstart",g),l.delay?(f(n,"mouseup",g._disableDelayedDrag),f(n,"touchend",g._disableDelayedDrag),f(n,"touchcancel",g._disableDelayedDrag),f(n,"mousemove",g._disableDelayedDrag),f(n,"touchmove",g._disableDelayedDrag),f(n,"pointermove",g._disableDelayedDrag),g._dragStartTimer=setTimeout(e,l.delay)):e())},_disableDelayedDrag:function(){var a=this.el.ownerDocument;clearTimeout(this._dragStartTimer),g(a,"mouseup",this._disableDelayedDrag),g(a,"touchend",this._disableDelayedDrag),g(a,"touchcancel",this._disableDelayedDrag),g(a,"mousemove",this._disableDelayedDrag),g(a,"touchmove",this._disableDelayedDrag),g(a,"pointermove",this._disableDelayedDrag)},_triggerDragStart:function(a,b){b=b||("touch"==a.pointerType?a:null),b?(N={target:w,clientX:b.clientX,clientY:b.clientY},this._onDragStart(N,"touch")):this.nativeDraggable?(f(w,"dragend",this),f(A,"dragstart",this._onDragStart)):this._onDragStart(N,!0);try{V.selection?setTimeout(function(){V.selection.empty()}):window.getSelection().removeAllRanges()}catch(a){}},_dragStarted:function(){if(A&&w){var b=this.options;h(w,b.ghostClass,!0),h(w,b.dragClass,!1),a.active=this,k(this,A,"start",w,A,J)}else this._nulling()},_emulateDragOver:function(){if(O){if(this._lastX===O.clientX&&this._lastY===O.clientY)return;this._lastX=O.clientX,this._lastY=O.clientY,_||i(y,"display","none");var a=V.elementFromPoint(O.clientX,O.clientY),b=a,c=ea.length;if(b)do{if(b[T]){for(;c--;)ea[c]({clientX:O.clientX,clientY:O.clientY,target:a,rootEl:b});break}a=b}while(b=b.parentNode);_||i(y,"display","")}},_onTouchMove:function(b){if(N){var c=this.options,d=c.fallbackTolerance,e=c.fallbackOffset,f=b.touches?b.touches[0]:b,g=f.clientX-N.clientX+e.x,h=f.clientY-N.clientY+e.y,j=b.touches?"translate3d("+g+"px,"+h+"px,0)":"translate("+g+"px,"+h+"px)";if(!a.active){if(d&&ca(ba(f.clientX-this._lastX),ba(f.clientY-this._lastY))w.offsetWidth,D=e.offsetHeight>w.offsetHeight,E=(v?(d.clientX-g.left)/t:(d.clientY-g.top)/u)>.5,F=e.nextElementSibling,J=l(A,j,w,f,e,g,d),K=!1;if(J!==!1){if(aa=!0,setTimeout(n,30),b(p,q),1===J||J===-1)K=1===J;else if(v){var N=w.offsetTop,O=e.offsetTop;K=N===O?e.previousElementSibling===w&&!C||E&&C:e.previousElementSibling===w||w.previousElementSibling===e?(d.clientY-g.top)/u>.5:O>N}else r||(K=F!==w&&!D||E&&D);w.contains(j)||(K&&!F?j.appendChild(w):e.parentNode.insertBefore(w,K?F:e)),x=w.parentNode,this._animate(f,w),this._animate(g,e)}}}},_animate:function(a,b){var c=this.options.animation;if(c){var d=b.getBoundingClientRect();1===a.nodeType&&(a=a.getBoundingClientRect()),i(b,"transition","none"),i(b,"transform","translate3d("+(a.left-d.left)+"px,"+(a.top-d.top)+"px,0)"),b.offsetWidth,i(b,"transition","all "+c+"ms"),i(b,"transform","translate3d(0,0,0)"),clearTimeout(b.animated),b.animated=setTimeout(function(){i(b,"transition",""),i(b,"transform",""),b.animated=!1},c)}},_offUpEvents:function(){var a=this.el.ownerDocument;g(V,"touchmove",this._onTouchMove),g(V,"pointermove",this._onTouchMove),g(a,"mouseup",this._onDrop),g(a,"touchend",this._onDrop),g(a,"pointerup",this._onDrop),g(a,"touchcancel",this._onDrop),g(a,"selectstart",this)},_onDrop:function(b){var c=this.el,d=this.options;clearInterval(this._loopId),clearInterval(Q.pid),clearTimeout(this._dragStartTimer),g(V,"mousemove",this._onTouchMove),this.nativeDraggable&&(g(V,"drop",this),g(c,"dragstart",this._onDragStart)),this._offUpEvents(),b&&(P&&(b.preventDefault(),!d.dropBubble&&b.stopPropagation()),y&&y.parentNode.removeChild(y),A!==x&&"clone"===a.active.lastPullMode||z&&z.parentNode.removeChild(z),w&&(this.nativeDraggable&&g(w,"dragend",this),m(w),w.style["will-change"]="",h(w,this.options.ghostClass,!1),h(w,this.options.chosenClass,!1),k(this,A,"unchoose",w,A,J),A!==x?(K=q(w,d.draggable),K>=0&&(k(null,x,"add",w,A,J,K),k(this,A,"remove",w,A,J,K),k(null,x,"sort",w,A,J,K),k(this,A,"sort",w,A,J,K))):w.nextSibling!==B&&(K=q(w,d.draggable),K>=0&&(k(this,A,"update",w,A,J,K),k(this,A,"sort",w,A,J,K))),a.active&&(null!=K&&K!==-1||(K=J),k(this,A,"end",w,A,J,K),this.save()))),this._nulling()},_nulling:function(){A=w=x=y=B=z=C=D=E=N=O=P=K=G=H=M=L=a.active=null,da.forEach(function(a){a.checked=!0}),da.length=0},handleEvent:function(a){switch(a.type){case"drop":case"dragend":this._onDrop(a);break;case"dragover":case"dragenter":w&&(this._onDragOver(a),e(a));break;case"selectstart":a.preventDefault()}},toArray:function(){for(var a,b=[],d=this.el.children,e=0,f=d.length,g=this.options;e*",ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,setData:function(a,b){a.setData("Text",b.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,fallbackOffset:{x:0,y:0}};for(var d in c)!(d in b)&&(b[d]=c[d]);ga(b);for(var e in this)"_"===e.charAt(0)&&"function"==typeof this[e]&&(this[e]=this[e].bind(this));this.nativeDraggable=!b.forceFallback&&$,f(a,"mousedown",this._onTapStart),f(a,"touchstart",this._onTapStart),f(a,"pointerdown",this._onTapStart),this.nativeDraggable&&(f(a,"dragover",this),f(a,"dragenter",this)),ea.push(this._onDragOver),b.store&&this.sort(b.store.get(this))}function b(a,b){"clone"!==a.lastPullMode&&(b=!0),z&&z.state!==b&&(i(z,"display",b?"none":""),b||z.state&&(a.options.group.revertClone?(A.insertBefore(z,B),a._animate(w,z)):A.insertBefore(z,w)),z.state=b)}function c(a,b,c){if(a){c=c||V;do{if(">*"===b&&a.parentNode===c||r(a,b))return a}while(a=d(a))}return null}function d(a){var b=a.host;return b&&b.nodeType?b:a.parentNode}function e(a){a.dataTransfer&&(a.dataTransfer.dropEffect="move"),a.preventDefault()}function f(a,b,c){a.addEventListener(b,c,Z)}function g(a,b,c){a.removeEventListener(b,c,Z)}function h(a,b,c){if(a)if(a.classList)a.classList[c?"add":"remove"](b);else{var d=(" "+a.className+" ").replace(R," ").replace(" "+b+" "," ");a.className=(d+(c?" "+b:"")).replace(R," ")}}function i(a,b,c){var d=a&&a.style;if(d){if(void 0===c)return V.defaultView&&V.defaultView.getComputedStyle?c=V.defaultView.getComputedStyle(a,""):a.currentStyle&&(c=a.currentStyle),void 0===b?c:c[b];b in d||(b="-webkit-"+b),d[b]=c+("string"==typeof c?"":"px")}}function j(a,b,c){if(a){var d=a.getElementsByTagName(b),e=0,f=d.length;if(c)for(;e5||b.clientX-(d.left+d.width)>5}function p(a){for(var b=a.tagName+a.className+a.src+a.href+a.textContent,c=b.length,d=0;c--;)d+=b.charCodeAt(c);return d.toString(36)}function q(a,b){var c=0;if(!a||!a.parentNode)return-1;for(;a&&(a=a.previousElementSibling);)"TEMPLATE"===a.nodeName.toUpperCase()||">*"!==b&&!r(a,b)||c++;return c}function r(a,b){if(a){b=b.split(".");var c=b.shift().toUpperCase(),d=new RegExp("\\s("+b.join("|")+")(?=\\s)","g");return!(""!==c&&a.nodeName.toUpperCase()!=c||b.length&&((" "+a.className+" ").match(d)||[]).length!=b.length)}return!1}function s(a,b){var c,d;return function(){void 0===c&&(c=arguments,d=this,setTimeout(function(){1===c.length?a.call(d,c[0]):a.apply(d,c),c=void 0},b))}}function t(a,b){if(a&&b)for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c]);return a}function u(a){return X?X(a).clone(!0)[0]:Y&&Y.dom?Y.dom(a).cloneNode(!0):a.cloneNode(!0)}function v(a){for(var b=a.getElementsByTagName("input"),c=b.length;c--;){var d=b[c];d.checked&&da.push(d)}}if("undefined"==typeof window||!window.document)return function(){throw new Error("Sortable.js requires a window with a document")};var w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q={},R=/\s+/g,S=/left|right|inline/,T="Sortable"+(new Date).getTime(),U=window,V=U.document,W=U.parseInt,X=U.jQuery||U.Zepto,Y=U.Polymer,Z=!1,$=!!("draggable"in V.createElement("div")),_=function(a){return!navigator.userAgent.match(/Trident.*rv[ :]?11\./)&&(a=V.createElement("x"),a.style.cssText="pointer-events:auto","auto"===a.style.pointerEvents)}(),aa=!1,ba=Math.abs,ca=Math.min,da=[],ea=[],fa=s(function(a,b,c){if(c&&b.scroll){var d,e,f,g,h,i,j=c[T],k=b.scrollSensitivity,l=b.scrollSpeed,m=a.clientX,n=a.clientY,o=window.innerWidth,p=window.innerHeight;if(E!==c&&(D=b.scroll,E=c,F=b.scrollFn,!0===D)){D=c;do{if(D.offsetWidth-1:e==a)}}var c={},d=a.group;d&&"object"==typeof d||(d={name:d}),c.name=d.name,c.checkPull=b(d.pull,!0),c.checkPut=b(d.put),c.revertClone=d.revertClone,a.group=c};a.prototype={constructor:a,_onTapStart:function(a){var b,d=this,e=this.el,f=this.options,g=f.preventOnFilter,h=a.type,i=a.touches&&a.touches[0],j=(i||a).target,l=a.target.shadowRoot&&a.path[0]||j,m=f.filter;if(v(e),!w&&!("mousedown"===h&&0!==a.button||f.disabled)&&(j=c(j,f.draggable,e))&&C!==j){if(b=q(j,f.draggable),"function"==typeof m){if(m.call(this,a,j,this))return k(d,l,"filter",j,e,b),void(g&&a.preventDefault())}else if(m&&(m=m.split(",").some(function(a){if(a=c(l,a.trim(),e))return k(d,a,"filter",j,e,b),!0})))return void(g&&a.preventDefault());f.handle&&!c(l,f.handle,e)||this._prepareDragStart(a,i,j,b)}},_prepareDragStart:function(a,b,c,d){var e,g=this,i=g.el,l=g.options,n=i.ownerDocument;c&&!w&&c.parentNode===i&&(N=a,A=i,w=c,x=w.parentNode,B=w.nextSibling,C=c,L=l.group,J=d,this._lastX=(b||a).clientX,this._lastY=(b||a).clientY,w.style["will-change"]="transform",e=function(){g._disableDelayedDrag(),w.draggable=g.nativeDraggable,h(w,l.chosenClass,!0),g._triggerDragStart(a,b),k(g,A,"choose",w,A,J)},l.ignore.split(",").forEach(function(a){j(w,a.trim(),m)}),f(n,"mouseup",g._onDrop),f(n,"touchend",g._onDrop),f(n,"touchcancel",g._onDrop),f(n,"pointercancel",g._onDrop),f(n,"selectstart",g),l.delay?(f(n,"mouseup",g._disableDelayedDrag),f(n,"touchend",g._disableDelayedDrag),f(n,"touchcancel",g._disableDelayedDrag),f(n,"mousemove",g._disableDelayedDrag),f(n,"touchmove",g._disableDelayedDrag),f(n,"pointermove",g._disableDelayedDrag),g._dragStartTimer=setTimeout(e,l.delay)):e())},_disableDelayedDrag:function(){var a=this.el.ownerDocument;clearTimeout(this._dragStartTimer),g(a,"mouseup",this._disableDelayedDrag),g(a,"touchend",this._disableDelayedDrag),g(a,"touchcancel",this._disableDelayedDrag),g(a,"mousemove",this._disableDelayedDrag),g(a,"touchmove",this._disableDelayedDrag),g(a,"pointermove",this._disableDelayedDrag)},_triggerDragStart:function(a,b){b=b||("touch"==a.pointerType?a:null),b?(N={target:w,clientX:b.clientX,clientY:b.clientY},this._onDragStart(N,"touch")):this.nativeDraggable?(f(w,"dragend",this),f(A,"dragstart",this._onDragStart)):this._onDragStart(N,!0);try{V.selection?setTimeout(function(){V.selection.empty()}):window.getSelection().removeAllRanges()}catch(a){}},_dragStarted:function(){if(A&&w){var b=this.options;h(w,b.ghostClass,!0),h(w,b.dragClass,!1),a.active=this,k(this,A,"start",w,A,J)}else this._nulling()},_emulateDragOver:function(){if(O){if(this._lastX===O.clientX&&this._lastY===O.clientY)return;this._lastX=O.clientX,this._lastY=O.clientY,_||i(y,"display","none");var a=V.elementFromPoint(O.clientX,O.clientY),b=a,c=ea.length;if(b)do{if(b[T]){for(;c--;)ea[c]({clientX:O.clientX,clientY:O.clientY,target:a,rootEl:b});break}a=b}while(b=b.parentNode);_||i(y,"display","")}},_onTouchMove:function(b){if(N){var c=this.options,d=c.fallbackTolerance,e=c.fallbackOffset,f=b.touches?b.touches[0]:b,g=f.clientX-N.clientX+e.x,h=f.clientY-N.clientY+e.y,j=b.touches?"translate3d("+g+"px,"+h+"px,0)":"translate("+g+"px,"+h+"px)";if(!a.active){if(d&&ca(ba(f.clientX-this._lastX),ba(f.clientY-this._lastY))w.offsetWidth,D=e.offsetHeight>w.offsetHeight,E=(v?(d.clientX-g.left)/t:(d.clientY-g.top)/u)>.5,F=e.nextElementSibling,J=!1;if(v){var K=w.offsetTop,N=e.offsetTop;J=K===N?e.previousElementSibling===w&&!C||E&&C:e.previousElementSibling===w||w.previousElementSibling===e?(d.clientY-g.top)/u>.5:N>K}else r||(J=F!==w&&!D||E&&D);var O=l(A,j,w,f,e,g,d,J);!1!==O&&(1!==O&&-1!==O||(J=1===O),aa=!0,setTimeout(n,30),b(p,q),w.contains(j)||(J&&!F?j.appendChild(w):e.parentNode.insertBefore(w,J?F:e)),x=w.parentNode,this._animate(f,w),this._animate(g,e))}}},_animate:function(a,b){var c=this.options.animation;if(c){var d=b.getBoundingClientRect();1===a.nodeType&&(a=a.getBoundingClientRect()),i(b,"transition","none"),i(b,"transform","translate3d("+(a.left-d.left)+"px,"+(a.top-d.top)+"px,0)"),b.offsetWidth,i(b,"transition","all "+c+"ms"),i(b,"transform","translate3d(0,0,0)"),clearTimeout(b.animated),b.animated=setTimeout(function(){i(b,"transition",""),i(b,"transform",""),b.animated=!1},c)}},_offUpEvents:function(){var a=this.el.ownerDocument;g(V,"touchmove",this._onTouchMove),g(V,"pointermove",this._onTouchMove),g(a,"mouseup",this._onDrop),g(a,"touchend",this._onDrop),g(a,"pointerup",this._onDrop),g(a,"touchcancel",this._onDrop),g(a,"selectstart",this)},_onDrop:function(b){var c=this.el,d=this.options;clearInterval(this._loopId),clearInterval(Q.pid),clearTimeout(this._dragStartTimer),g(V,"mousemove",this._onTouchMove),this.nativeDraggable&&(g(V,"drop",this),g(c,"dragstart",this._onDragStart)),this._offUpEvents(),b&&(P&&(b.preventDefault(),!d.dropBubble&&b.stopPropagation()),y&&y.parentNode.removeChild(y),A!==x&&"clone"===a.active.lastPullMode||z&&z.parentNode.removeChild(z),w&&(this.nativeDraggable&&g(w,"dragend",this),m(w),w.style["will-change"]="",h(w,this.options.ghostClass,!1),h(w,this.options.chosenClass,!1),k(this,A,"unchoose",w,A,J),A!==x?(K=q(w,d.draggable))>=0&&(k(null,x,"add",w,A,J,K),k(this,A,"remove",w,A,J,K),k(null,x,"sort",w,A,J,K),k(this,A,"sort",w,A,J,K)):w.nextSibling!==B&&(K=q(w,d.draggable))>=0&&(k(this,A,"update",w,A,J,K),k(this,A,"sort",w,A,J,K)),a.active&&(null!=K&&-1!==K||(K=J),k(this,A,"end",w,A,J,K),this.save()))),this._nulling()},_nulling:function(){A=w=x=y=B=z=C=D=E=N=O=P=K=G=H=M=L=a.active=null,da.forEach(function(a){a.checked=!0}),da.length=0},handleEvent:function(a){switch(a.type){case"drop":case"dragend":this._onDrop(a);break;case"dragover":case"dragenter":w&&(this._onDragOver(a),e(a));break;case"selectstart":a.preventDefault()}},toArray:function(){for(var a,b=[],d=this.el.children,e=0,f=d.length,g=this.options;e