diff --git a/ddsort.min.js b/ddsort.min.js index ddec9ad..8618cf5 100644 --- a/ddsort.min.js +++ b/ddsort.min.js @@ -2,4 +2,4 @@ * Author: https://github.com/Barrior * DDSort: drag and drop sorting. */ -+function(b){var a={down:b.noop,move:b.noop,up:b.noop,target:"li",delay:100,cloneStyle:{"background-color":"#eee"},floatStyle:{position:"fixed","box-shadow":"10px 10px 20px 0 #eee",webkitTransform:"rotate(4deg)",mozTransform:"rotate(4deg)",msTransform:"rotate(4deg)",transform:"rotate(4deg)"}};b.fn.DDSort=function(c){var e=b(document);var d=b.extend(true,{},a,c);return this.each(function(){var g=b(this);var h="height";var f="width";if(g.css("box-sizing")=="border-box"){h="outerHeight";f="outerWidth"}g.on("mousedown.DDSort",d.target,function(n){var l=new Date().getTime();if(n.which!=1){return}var k=n.target.tagName.toLowerCase();if(k=="input"||k=="textarea"||k=="select"||b(n.target).prop("contenteditable")=="true"){return}var v=this;var q=b(v);var i=q.offset();var t=n.pageX-i.left;var s=n.pageY-i.top;var p=q.clone().css(d.cloneStyle).css("height",q[h]()).empty();var r=1;var m=q.outerHeight();var j=g.outerHeight();var u=m;var o=m;var w=m*3;d.down.call(v);e.on("mousemove.DDSort",function(D){if(new Date().getTime()-lz.offset().top+z.outerHeight()/2){p.before(z)}}var y=g.scrollTop();var x=g.offset().top;var E;if(Bw?w:u;E=y-u}else{if(B+m-x>j){u=m;o=++o>w?w:o;E=y+o}}g.scrollTop(E);d.move.call(v,C-e.scrollLeft(),B-e.scrollTop())}).on("mouseup.DDSort",function(){e.off("mousemove.DDSort mouseup.DDSort");if(!r){p.before(q.removeAttr("style")).remove();d.up.call(v)}});return false})})}}(jQuery); \ No newline at end of file ++function(b){var a={down:b.noop,move:b.noop,up:b.noop,target:"li",delay:100,cloneStyle:{"background-color":"#eee"},floatStyle:{position:"fixed","box-shadow":"10px 10px 20px 0 #eee",webkitTransform:"rotate(4deg)",mozTransform:"rotate(4deg)",msTransform:"rotate(4deg)",transform:"rotate(4deg)"}};b.fn.DDSort=function(c){var e=b(document);var d=b.extend(true,{},a,c);return this.each(function(){var g=b(this);var h="height";var f="width";if(g.css("box-sizing")=="border-box"){h="outerHeight";f="outerWidth"}g.on("mousedown.DDSort touchstart.DDSort",d.target,function(v){var z=new Date().getTime();if(v.type=="mousedown"&&v.which!=1){return}var s=v.target.tagName.toLowerCase();if(s=="input"||s=="textarea"||s=="select"||s=="a"||b(v.target).prop("contenteditable")=="true"){return}var t=this;var o=b(t);var n=o.offset();var j=v.pageX;var i=v.pageY;var w=v.originalEvent.targetTouches;if(v.type=="touchstart"&&w){j=w[0].pageX;i=w[0].pageY}var m=j-n.left;var l=i-n.top;var x=o.clone().css(d.cloneStyle).css("height",o[h]()).empty();var r=1;var k=o.outerHeight();var u=g.outerHeight();var p=k;var q=k;var y=k*3;d.down.call(t);e.on("mousemove.DDSort touchmove.DDSort",function(F){var D=F.pageX;var C=F.pageY;var H=F.originalEvent.targetTouches;if(F.type=="touchmove"&&H){D=H[0].pageX;C=H[0].pageY}if(new Date().getTime()-zE.offset().top+E.outerHeight()/2){x.before(E)}}var K=g.scrollTop();var J=g.offset().top;var G;if(Iy?y:p;G=K-p}else{if(I+k-J>u){p=k;q=++q>y?y:q;G=K+q}}g.scrollTop(G);d.move.call(t,A-e.scrollLeft(),I-e.scrollTop())}).on("mouseup.DDSort touchend.DDSort",function(){e.off("mousemove.DDSort mouseup.DDSort touchmove.DDSort touchend.DDSort");if(!r){x.before(o.removeAttr("style")).remove();d.up.call(t)}});return false})})}}(jQuery); \ No newline at end of file