text: ﻿!function (e) { function t(g) { var i, u = this, c = g.data || {}; if (c.elem) u = g.dragTarget = c.elem, g.dragProxy = d.proxy || u, g.cursorOffsetX = c.pageX - c.left, g.cursorOffsetY = c.pageY - c.top, g.offsetX = g.pageX - g.cursorOffsetX, g.offsetY = g.pageY - g.cursorOffsetY; else if (d.dragging || c.which > 0 && g.which != c.which || e(g.target).is(c.not)) return; switch (g.type) { case "mousedown": return e.extend(c, e(u).offset(), { elem: u, target: g.target, pageX: g.pageX, pageY: g.pageY }), o.add(document, "mousemove mouseup", t, c), a(u, !1), !1; case !d.dragging && "mousemove": if (n(g.pageX - c.pageX) + n(g.pageY - c.pageY) < c.distance) break; g.target = c.target, i = r(g, "dragstart", u), i !== !1 && (d.dragging = u, d.proxy = g.dragProxy = e(i || u)[0]); case "mousemove": if (d.dragging) { if (i = r(g, "drag", u), s.drop && (s.drop.allowed = i !== !1, s.drop.handler(g)), i !== !1) break; g.type = "mouseup" } case "mouseup": o.remove(document, "mousemove mouseup", t), d.dragging && (s.drop && s.drop.handler(g), r(g, "dragend", u)), a(u, !0), d.dragging = d.proxy = c.elem = null } } function r(e, t, r) { e.type = t; var n = o.dispatch.call(r, e); return n === !1 ? !1 : n || e.result } function n(e) { return Math.pow(e, 2) } function a(e, t) { e && (e.unselectable = t ? "off" : "on", e.onselectstart = function () { return t }, document.selection && document.selection.empty && document.selection.empty(), e.style && (e.style.MozUserSelect = t ? "" : "none")) } e.fn.drag = function (e, t, r) { return t && this.bind("dragstart", e), r && this.bind("dragend", r), e ? this.bind("drag", t ? t : e) : this.trigger("drag") }; var o = e.event, s = o.special, d = s.drag = { not: ":input", distance: 0, which: 1, setup: function (r) { r = e.extend({ distance: d.distance, which: d.which, not: d.not }, r || {}), r.distance = n(r.distance), o.add(this, "mousedown", t, r) }, teardown: function () { o.remove(this, "mousedown", t), this === d.dragging && (d.dragging = d.proxy = null), a(this, !0) } } }(jQuery);