2519 lines
145 KiB
JavaScript
Vendored
2519 lines
145 KiB
JavaScript
Vendored
/*! jQuery UI - v1.9.2 - 2013-10-06
|
|
* http://jqueryui.com
|
|
* Includes: jquery.ui.core.js, jquery.ui.widget.js, jquery.ui.mouse.js, jquery.ui.position.js, jquery.ui.draggable.js, jquery.ui.droppable.js, jquery.ui.resizable.js, jquery.ui.selectable.js, jquery.ui.sortable.js, jquery.ui.slider.js
|
|
* Copyright 2013 jQuery Foundation and other contributors; Licensed MIT */
|
|
|
|
(function(t, e) {
|
|
function n(e, n) {
|
|
var s, r, o, u = e.nodeName.toLowerCase();
|
|
return "area" === u ? (s = e.parentNode, r = s.name, e.href && r && "map" === s.nodeName.toLowerCase() ? (o = t("img[usemap=#" + r + "]")[0], !!o && i(o)) : !1) : (/input|select|textarea|button|object/.test(u) ? !e.disabled : "a" === u ? e.href || n : n) && i(e)
|
|
}
|
|
|
|
function i(e) {
|
|
return t.expr.filters.visible(e) && !t(e).parents().andSelf().filter(function() {
|
|
return "hidden" === t.css(this, "visibility")
|
|
}).length
|
|
}
|
|
var s = 0,
|
|
r = /^ui-id-\d+$/;
|
|
t.ui = t.ui || {}, t.ui.version || (t.extend(t.ui, {
|
|
version: "1.9.2",
|
|
keyCode: {
|
|
BACKSPACE: 8,
|
|
COMMA: 188,
|
|
DELETE: 46,
|
|
DOWN: 40,
|
|
END: 35,
|
|
ENTER: 13,
|
|
ESCAPE: 27,
|
|
HOME: 36,
|
|
LEFT: 37,
|
|
NUMPAD_ADD: 107,
|
|
NUMPAD_DECIMAL: 110,
|
|
NUMPAD_DIVIDE: 111,
|
|
NUMPAD_ENTER: 108,
|
|
NUMPAD_MULTIPLY: 106,
|
|
NUMPAD_SUBTRACT: 109,
|
|
PAGE_DOWN: 34,
|
|
PAGE_UP: 33,
|
|
PERIOD: 190,
|
|
RIGHT: 39,
|
|
SPACE: 32,
|
|
TAB: 9,
|
|
UP: 38
|
|
}
|
|
}), t.fn.extend({
|
|
_focus: t.fn.focus,
|
|
focus: function(e, n) {
|
|
return "number" == typeof e ? this.each(function() {
|
|
var i = this;
|
|
setTimeout(function() {
|
|
t(i).focus(), n && n.call(i)
|
|
}, e)
|
|
}) : this._focus.apply(this, arguments)
|
|
},
|
|
scrollParent: function() {
|
|
var e;
|
|
return e = t.ui.ie && /(static|relative)/.test(this.css("position")) || /absolute/.test(this.css("position")) ? this.parents().filter(function() {
|
|
return /(relative|absolute|fixed)/.test(t.css(this, "position")) && /(auto|scroll)/.test(t.css(this, "overflow") + t.css(this, "overflow-y") + t.css(this, "overflow-x"))
|
|
}).eq(0) : this.parents().filter(function() {
|
|
return /(auto|scroll)/.test(t.css(this, "overflow") + t.css(this, "overflow-y") + t.css(this, "overflow-x"))
|
|
}).eq(0), /fixed/.test(this.css("position")) || !e.length ? t(document) : e
|
|
},
|
|
zIndex: function(n) {
|
|
if (n !== e) return this.css("zIndex", n);
|
|
if (this.length)
|
|
for (var i, s, r = t(this[0]); r.length && r[0] !== document;) {
|
|
if (i = r.css("position"), ("absolute" === i || "relative" === i || "fixed" === i) && (s = parseInt(r.css("zIndex"), 10), !isNaN(s) && 0 !== s)) return s;
|
|
r = r.parent()
|
|
}
|
|
return 0
|
|
},
|
|
uniqueId: function() {
|
|
return this.each(function() {
|
|
this.id || (this.id = "ui-id-" + ++s)
|
|
})
|
|
},
|
|
removeUniqueId: function() {
|
|
return this.each(function() {
|
|
r.test(this.id) && t(this).removeAttr("id")
|
|
})
|
|
}
|
|
}), t.extend(t.expr[":"], {
|
|
data: t.expr.createPseudo ? t.expr.createPseudo(function(e) {
|
|
return function(n) {
|
|
return !!t.data(n, e)
|
|
}
|
|
}) : function(e, n, i) {
|
|
return !!t.data(e, i[3])
|
|
},
|
|
focusable: function(e) {
|
|
return n(e, !isNaN(t.attr(e, "tabindex")))
|
|
},
|
|
tabbable: function(e) {
|
|
var i = t.attr(e, "tabindex"),
|
|
s = isNaN(i);
|
|
return (s || i >= 0) && n(e, !s)
|
|
}
|
|
}), t(function() {
|
|
var e = document.body,
|
|
n = e.appendChild(n = document.createElement("div"));
|
|
n.offsetHeight, t.extend(n.style, {
|
|
minHeight: "100px",
|
|
height: "auto",
|
|
padding: 0,
|
|
borderWidth: 0
|
|
}), t.support.minHeight = 100 === n.offsetHeight, t.support.selectstart = "onselectstart" in n, e.removeChild(n).style.display = "none"
|
|
}), t("<a>").outerWidth(1).jquery || t.each(["Width", "Height"], function(n, i) {
|
|
function s(e, n, i, s) {
|
|
return t.each(r, function() {
|
|
n -= parseFloat(t.css(e, "padding" + this)) || 0, i && (n -= parseFloat(t.css(e, "border" + this + "Width")) || 0), s && (n -= parseFloat(t.css(e, "margin" + this)) || 0)
|
|
}), n
|
|
}
|
|
var r = "Width" === i ? ["Left", "Right"] : ["Top", "Bottom"],
|
|
o = i.toLowerCase(),
|
|
u = {
|
|
innerWidth: t.fn.innerWidth,
|
|
innerHeight: t.fn.innerHeight,
|
|
outerWidth: t.fn.outerWidth,
|
|
outerHeight: t.fn.outerHeight
|
|
};
|
|
t.fn["inner" + i] = function(n) {
|
|
return n === e ? u["inner" + i].call(this) : this.each(function() {
|
|
t(this).css(o, s(this, n) + "px")
|
|
})
|
|
}, t.fn["outer" + i] = function(e, n) {
|
|
return "number" != typeof e ? u["outer" + i].call(this, e) : this.each(function() {
|
|
t(this).css(o, s(this, e, !0, n) + "px")
|
|
})
|
|
}
|
|
}), t("<a>").data("a-b", "a").removeData("a-b").data("a-b") && (t.fn.removeData = function(e) {
|
|
return function(n) {
|
|
return arguments.length ? e.call(this, t.camelCase(n)) : e.call(this)
|
|
}
|
|
}(t.fn.removeData)), function() {
|
|
var e = /msie ([\w.]+)/.exec(navigator.userAgent.toLowerCase()) || [];
|
|
t.ui.ie = e.length ? !0 : !1, t.ui.ie6 = 6 === parseFloat(e[1], 10)
|
|
}(), t.fn.extend({
|
|
disableSelection: function() {
|
|
return this.bind((t.support.selectstart ? "selectstart" : "mousedown") + ".ui-disableSelection", function(t) {
|
|
t.preventDefault()
|
|
})
|
|
},
|
|
enableSelection: function() {
|
|
return this.unbind(".ui-disableSelection")
|
|
}
|
|
}), t.extend(t.ui, {
|
|
plugin: {
|
|
add: function(e, n, i) {
|
|
var s, r = t.ui[e].prototype;
|
|
for (s in i) r.plugins[s] = r.plugins[s] || [], r.plugins[s].push([n, i[s]])
|
|
},
|
|
call: function(t, e, n) {
|
|
var i, s = t.plugins[e];
|
|
if (s && t.element[0].parentNode && 11 !== t.element[0].parentNode.nodeType)
|
|
for (i = 0; s.length > i; i++) t.options[s[i][0]] && s[i][1].apply(t.element, n)
|
|
}
|
|
},
|
|
contains: t.contains,
|
|
hasScroll: function(e, n) {
|
|
if ("hidden" === t(e).css("overflow")) return !1;
|
|
var i = n && "left" === n ? "scrollLeft" : "scrollTop",
|
|
s = !1;
|
|
return e[i] > 0 ? !0 : (e[i] = 1, s = e[i] > 0, e[i] = 0, s)
|
|
},
|
|
isOverAxis: function(t, e, n) {
|
|
return t > e && e + n > t
|
|
},
|
|
isOver: function(e, n, i, s, r, o) {
|
|
return t.ui.isOverAxis(e, i, r) && t.ui.isOverAxis(n, s, o)
|
|
}
|
|
}))
|
|
})(jQuery);
|
|
(function(t, e) {
|
|
var i = 0,
|
|
s = Array.prototype.slice,
|
|
n = t.cleanData;
|
|
t.cleanData = function(e) {
|
|
for (var i, s = 0; null != (i = e[s]); s++) try {
|
|
t(i).triggerHandler("remove")
|
|
} catch (o) {}
|
|
n(e)
|
|
}, t.widget = function(i, s, n) {
|
|
var o, r, a, l, h = i.split(".")[0];
|
|
i = i.split(".")[1], o = h + "-" + i, n || (n = s, s = t.Widget), t.expr[":"][o.toLowerCase()] = function(e) {
|
|
return !!t.data(e, o)
|
|
}, t[h] = t[h] || {}, r = t[h][i], a = t[h][i] = function(t, i) {
|
|
return this._createWidget ? (arguments.length && this._createWidget(t, i), e) : new a(t, i)
|
|
}, t.extend(a, r, {
|
|
version: n.version,
|
|
_proto: t.extend({}, n),
|
|
_childConstructors: []
|
|
}), l = new s, l.options = t.widget.extend({}, l.options), t.each(n, function(e, i) {
|
|
t.isFunction(i) && (n[e] = function() {
|
|
var t = function() {
|
|
return s.prototype[e].apply(this, arguments)
|
|
},
|
|
n = function(t) {
|
|
return s.prototype[e].apply(this, t)
|
|
};
|
|
return function() {
|
|
var e, s = this._super,
|
|
o = this._superApply;
|
|
return this._super = t, this._superApply = n, e = i.apply(this, arguments), this._super = s, this._superApply = o, e
|
|
}
|
|
}())
|
|
}), a.prototype = t.widget.extend(l, {
|
|
widgetEventPrefix: r ? l.widgetEventPrefix : i
|
|
}, n, {
|
|
constructor: a,
|
|
namespace: h,
|
|
widgetName: i,
|
|
widgetBaseClass: o,
|
|
widgetFullName: o
|
|
}), r ? (t.each(r._childConstructors, function(e, i) {
|
|
var s = i.prototype;
|
|
t.widget(s.namespace + "." + s.widgetName, a, i._proto)
|
|
}), delete r._childConstructors) : s._childConstructors.push(a), t.widget.bridge(i, a)
|
|
}, t.widget.extend = function(i) {
|
|
for (var n, o, r = s.call(arguments, 1), a = 0, l = r.length; l > a; a++)
|
|
for (n in r[a]) o = r[a][n], r[a].hasOwnProperty(n) && o !== e && (i[n] = t.isPlainObject(o) ? t.isPlainObject(i[n]) ? t.widget.extend({}, i[n], o) : t.widget.extend({}, o) : o);
|
|
return i
|
|
}, t.widget.bridge = function(i, n) {
|
|
var o = n.prototype.widgetFullName || i;
|
|
t.fn[i] = function(r) {
|
|
var a = "string" == typeof r,
|
|
l = s.call(arguments, 1),
|
|
h = this;
|
|
return r = !a && l.length ? t.widget.extend.apply(null, [r].concat(l)) : r, a ? this.each(function() {
|
|
var s, n = t.data(this, o);
|
|
return n ? t.isFunction(n[r]) && "_" !== r.charAt(0) ? (s = n[r].apply(n, l), s !== n && s !== e ? (h = s && s.jquery ? h.pushStack(s.get()) : s, !1) : e) : t.error("no such method '" + r + "' for " + i + " widget instance") : t.error("cannot call methods on " + i + " prior to initialization; " + "attempted to call method '" + r + "'")
|
|
}) : this.each(function() {
|
|
var e = t.data(this, o);
|
|
e ? e.option(r || {})._init() : t.data(this, o, new n(r, this))
|
|
}), h
|
|
}
|
|
}, t.Widget = function() {}, t.Widget._childConstructors = [], t.Widget.prototype = {
|
|
widgetName: "widget",
|
|
widgetEventPrefix: "",
|
|
defaultElement: "<div>",
|
|
options: {
|
|
disabled: !1,
|
|
create: null
|
|
},
|
|
_createWidget: function(e, s) {
|
|
s = t(s || this.defaultElement || this)[0], this.element = t(s), this.uuid = i++, this.eventNamespace = "." + this.widgetName + this.uuid, this.options = t.widget.extend({}, this.options, this._getCreateOptions(), e), this.bindings = t(), this.hoverable = t(), this.focusable = t(), s !== this && (t.data(s, this.widgetName, this), t.data(s, this.widgetFullName, this), this._on(!0, this.element, {
|
|
remove: function(t) {
|
|
t.target === s && this.destroy()
|
|
}
|
|
}), this.document = t(s.style ? s.ownerDocument : s.document || s), this.window = t(this.document[0].defaultView || this.document[0].parentWindow)), this._create(), this._trigger("create", null, this._getCreateEventData()), this._init()
|
|
},
|
|
_getCreateOptions: t.noop,
|
|
_getCreateEventData: t.noop,
|
|
_create: t.noop,
|
|
_init: t.noop,
|
|
destroy: function() {
|
|
this._destroy(), this.element.unbind(this.eventNamespace).removeData(this.widgetName).removeData(this.widgetFullName).removeData(t.camelCase(this.widgetFullName)), this.widget().unbind(this.eventNamespace).removeAttr("aria-disabled").removeClass(this.widgetFullName + "-disabled " + "ui-state-disabled"), this.bindings.unbind(this.eventNamespace), this.hoverable.removeClass("ui-state-hover"), this.focusable.removeClass("ui-state-focus")
|
|
},
|
|
_destroy: t.noop,
|
|
widget: function() {
|
|
return this.element
|
|
},
|
|
option: function(i, s) {
|
|
var n, o, r, a = i;
|
|
if (0 === arguments.length) return t.widget.extend({}, this.options);
|
|
if ("string" == typeof i)
|
|
if (a = {}, n = i.split("."), i = n.shift(), n.length) {
|
|
for (o = a[i] = t.widget.extend({}, this.options[i]), r = 0; n.length - 1 > r; r++) o[n[r]] = o[n[r]] || {}, o = o[n[r]];
|
|
if (i = n.pop(), s === e) return o[i] === e ? null : o[i];
|
|
o[i] = s
|
|
} else {
|
|
if (s === e) return this.options[i] === e ? null : this.options[i];
|
|
a[i] = s
|
|
}
|
|
return this._setOptions(a), this
|
|
},
|
|
_setOptions: function(t) {
|
|
var e;
|
|
for (e in t) this._setOption(e, t[e]);
|
|
return this
|
|
},
|
|
_setOption: function(t, e) {
|
|
return this.options[t] = e, "disabled" === t && (this.widget().toggleClass(this.widgetFullName + "-disabled ui-state-disabled", !!e).attr("aria-disabled", e), this.hoverable.removeClass("ui-state-hover"), this.focusable.removeClass("ui-state-focus")), this
|
|
},
|
|
enable: function() {
|
|
return this._setOption("disabled", !1)
|
|
},
|
|
disable: function() {
|
|
return this._setOption("disabled", !0)
|
|
},
|
|
_on: function(i, s, n) {
|
|
var o, r = this;
|
|
"boolean" != typeof i && (n = s, s = i, i = !1), n ? (s = o = t(s), this.bindings = this.bindings.add(s)) : (n = s, s = this.element, o = this.widget()), t.each(n, function(n, a) {
|
|
function l() {
|
|
return i || r.options.disabled !== !0 && !t(this).hasClass("ui-state-disabled") ? ("string" == typeof a ? r[a] : a).apply(r, arguments) : e
|
|
}
|
|
"string" != typeof a && (l.guid = a.guid = a.guid || l.guid || t.guid++);
|
|
var h = n.match(/^(\w+)\s*(.*)$/),
|
|
c = h[1] + r.eventNamespace,
|
|
p = h[2];
|
|
p ? o.delegate(p, c, l) : s.bind(c, l)
|
|
})
|
|
},
|
|
_off: function(t, e) {
|
|
e = (e || "").split(" ").join(this.eventNamespace + " ") + this.eventNamespace, t.unbind(e).undelegate(e)
|
|
},
|
|
_delay: function(t, e) {
|
|
function i() {
|
|
return ("string" == typeof t ? s[t] : t).apply(s, arguments)
|
|
}
|
|
var s = this;
|
|
return setTimeout(i, e || 0)
|
|
},
|
|
_hoverable: function(e) {
|
|
this.hoverable = this.hoverable.add(e), this._on(e, {
|
|
mouseenter: function(e) {
|
|
t(e.currentTarget).addClass("ui-state-hover")
|
|
},
|
|
mouseleave: function(e) {
|
|
t(e.currentTarget).removeClass("ui-state-hover")
|
|
}
|
|
})
|
|
},
|
|
_focusable: function(e) {
|
|
this.focusable = this.focusable.add(e), this._on(e, {
|
|
focusin: function(e) {
|
|
t(e.currentTarget).addClass("ui-state-focus")
|
|
},
|
|
focusout: function(e) {
|
|
t(e.currentTarget).removeClass("ui-state-focus")
|
|
}
|
|
})
|
|
},
|
|
_trigger: function(e, i, s) {
|
|
var n, o, r = this.options[e];
|
|
if (s = s || {}, i = t.Event(i), i.type = (e === this.widgetEventPrefix ? e : this.widgetEventPrefix + e).toLowerCase(), i.target = this.element[0], o = i.originalEvent)
|
|
for (n in o) n in i || (i[n] = o[n]);
|
|
return this.element.trigger(i, s), !(t.isFunction(r) && r.apply(this.element[0], [i].concat(s)) === !1 || i.isDefaultPrevented())
|
|
}
|
|
}, t.each({
|
|
show: "fadeIn",
|
|
hide: "fadeOut"
|
|
}, function(e, i) {
|
|
t.Widget.prototype["_" + e] = function(s, n, o) {
|
|
"string" == typeof n && (n = {
|
|
effect: n
|
|
});
|
|
var r, a = n ? n === !0 || "number" == typeof n ? i : n.effect || i : e;
|
|
n = n || {}, "number" == typeof n && (n = {
|
|
duration: n
|
|
}), r = !t.isEmptyObject(n), n.complete = o, n.delay && s.delay(n.delay), r && t.effects && (t.effects.effect[a] || t.uiBackCompat !== !1 && t.effects[a]) ? s[e](n) : a !== e && s[a] ? s[a](n.duration, n.easing, o) : s.queue(function(i) {
|
|
t(this)[e](), o && o.call(s[0]), i()
|
|
})
|
|
}
|
|
}), t.uiBackCompat !== !1 && (t.Widget.prototype._getCreateOptions = function() {
|
|
return t.metadata && t.metadata.get(this.element[0])[this.widgetName]
|
|
})
|
|
})(jQuery);
|
|
(function(t) {
|
|
var e = !1;
|
|
t(document).mouseup(function() {
|
|
e = !1
|
|
}), t.widget("ui.mouse", {
|
|
version: "1.9.2",
|
|
options: {
|
|
cancel: "input,textarea,button,select,option",
|
|
distance: 1,
|
|
delay: 0
|
|
},
|
|
_mouseInit: function() {
|
|
var e = this;
|
|
this.element.bind("mousedown." + this.widgetName, function(t) {
|
|
return e._mouseDown(t)
|
|
}).bind("click." + this.widgetName, function(i) {
|
|
return !0 === t.data(i.target, e.widgetName + ".preventClickEvent") ? (t.removeData(i.target, e.widgetName + ".preventClickEvent"), i.stopImmediatePropagation(), !1) : undefined
|
|
}), this.started = !1
|
|
},
|
|
_mouseDestroy: function() {
|
|
this.element.unbind("." + this.widgetName), this._mouseMoveDelegate && t(document).unbind("mousemove." + this.widgetName, this._mouseMoveDelegate).unbind("mouseup." + this.widgetName, this._mouseUpDelegate)
|
|
},
|
|
_mouseDown: function(i) {
|
|
if (!e) {
|
|
this._mouseStarted && this._mouseUp(i), this._mouseDownEvent = i;
|
|
var s = this,
|
|
o = 1 === i.which,
|
|
n = "string" == typeof this.options.cancel && i.target.nodeName ? t(i.target).closest(this.options.cancel).length : !1;
|
|
return o && !n && this._mouseCapture(i) ? (this.mouseDelayMet = !this.options.delay, this.mouseDelayMet || (this._mouseDelayTimer = setTimeout(function() {
|
|
s.mouseDelayMet = !0
|
|
}, this.options.delay)), this._mouseDistanceMet(i) && this._mouseDelayMet(i) && (this._mouseStarted = this._mouseStart(i) !== !1, !this._mouseStarted) ? (i.preventDefault(), !0) : (!0 === t.data(i.target, this.widgetName + ".preventClickEvent") && t.removeData(i.target, this.widgetName + ".preventClickEvent"), this._mouseMoveDelegate = function(t) {
|
|
return s._mouseMove(t)
|
|
}, this._mouseUpDelegate = function(t) {
|
|
return s._mouseUp(t)
|
|
}, t(document).bind("mousemove." + this.widgetName, this._mouseMoveDelegate).bind("mouseup." + this.widgetName, this._mouseUpDelegate), i.preventDefault(), e = !0, !0)) : !0
|
|
}
|
|
},
|
|
_mouseMove: function(e) {
|
|
return !t.ui.ie || document.documentMode >= 9 || e.button ? this._mouseStarted ? (this._mouseDrag(e), e.preventDefault()) : (this._mouseDistanceMet(e) && this._mouseDelayMet(e) && (this._mouseStarted = this._mouseStart(this._mouseDownEvent, e) !== !1, this._mouseStarted ? this._mouseDrag(e) : this._mouseUp(e)), !this._mouseStarted) : this._mouseUp(e)
|
|
},
|
|
_mouseUp: function(e) {
|
|
return t(document).unbind("mousemove." + this.widgetName, this._mouseMoveDelegate).unbind("mouseup." + this.widgetName, this._mouseUpDelegate), this._mouseStarted && (this._mouseStarted = !1, e.target === this._mouseDownEvent.target && t.data(e.target, this.widgetName + ".preventClickEvent", !0), this._mouseStop(e)), !1
|
|
},
|
|
_mouseDistanceMet: function(t) {
|
|
return Math.max(Math.abs(this._mouseDownEvent.pageX - t.pageX), Math.abs(this._mouseDownEvent.pageY - t.pageY)) >= this.options.distance
|
|
},
|
|
_mouseDelayMet: function() {
|
|
return this.mouseDelayMet
|
|
},
|
|
_mouseStart: function() {},
|
|
_mouseDrag: function() {},
|
|
_mouseStop: function() {},
|
|
_mouseCapture: function() {
|
|
return !0
|
|
}
|
|
})
|
|
})(jQuery);
|
|
(function(e, t) {
|
|
function i(e, t, i) {
|
|
return [parseInt(e[0], 10) * (d.test(e[0]) ? t / 100 : 1), parseInt(e[1], 10) * (d.test(e[1]) ? i / 100 : 1)]
|
|
}
|
|
|
|
function s(t, i) {
|
|
return parseInt(e.css(t, i), 10) || 0
|
|
}
|
|
e.ui = e.ui || {};
|
|
var a, n = Math.max,
|
|
r = Math.abs,
|
|
o = Math.round,
|
|
l = /left|center|right/,
|
|
h = /top|center|bottom/,
|
|
u = /[\+\-]\d+%?/,
|
|
c = /^\w+/,
|
|
d = /%$/,
|
|
p = e.fn.position;
|
|
e.position = {
|
|
scrollbarWidth: function() {
|
|
if (a !== t) return a;
|
|
var i, s, n = e("<div style='display:block;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>"),
|
|
r = n.children()[0];
|
|
return e("body").append(n), i = r.offsetWidth, n.css("overflow", "scroll"), s = r.offsetWidth, i === s && (s = n[0].clientWidth), n.remove(), a = i - s
|
|
},
|
|
getScrollInfo: function(t) {
|
|
var i = t.isWindow ? "" : t.element.css("overflow-x"),
|
|
s = t.isWindow ? "" : t.element.css("overflow-y"),
|
|
a = "scroll" === i || "auto" === i && t.width < t.element[0].scrollWidth,
|
|
n = "scroll" === s || "auto" === s && t.height < t.element[0].scrollHeight;
|
|
return {
|
|
width: a ? e.position.scrollbarWidth() : 0,
|
|
height: n ? e.position.scrollbarWidth() : 0
|
|
}
|
|
},
|
|
getWithinInfo: function(t) {
|
|
var i = e(t || window),
|
|
s = e.isWindow(i[0]);
|
|
return {
|
|
element: i,
|
|
isWindow: s,
|
|
offset: i.offset() || {
|
|
left: 0,
|
|
top: 0
|
|
},
|
|
scrollLeft: i.scrollLeft(),
|
|
scrollTop: i.scrollTop(),
|
|
width: s ? i.width() : i.outerWidth(),
|
|
height: s ? i.height() : i.outerHeight()
|
|
}
|
|
}
|
|
}, e.fn.position = function(t) {
|
|
if (!t || !t.of) return p.apply(this, arguments);
|
|
t = e.extend({}, t);
|
|
var a, d, f, m, g, v = e(t.of),
|
|
y = e.position.getWithinInfo(t.within),
|
|
b = e.position.getScrollInfo(y),
|
|
_ = v[0],
|
|
x = (t.collision || "flip").split(" "),
|
|
k = {};
|
|
return 9 === _.nodeType ? (d = v.width(), f = v.height(), m = {
|
|
top: 0,
|
|
left: 0
|
|
}) : e.isWindow(_) ? (d = v.width(), f = v.height(), m = {
|
|
top: v.scrollTop(),
|
|
left: v.scrollLeft()
|
|
}) : _.preventDefault ? (t.at = "left top", d = f = 0, m = {
|
|
top: _.pageY,
|
|
left: _.pageX
|
|
}) : (d = v.outerWidth(), f = v.outerHeight(), m = v.offset()), g = e.extend({}, m), e.each(["my", "at"], function() {
|
|
var e, i, s = (t[this] || "").split(" ");
|
|
1 === s.length && (s = l.test(s[0]) ? s.concat(["center"]) : h.test(s[0]) ? ["center"].concat(s) : ["center", "center"]), s[0] = l.test(s[0]) ? s[0] : "center", s[1] = h.test(s[1]) ? s[1] : "center", e = u.exec(s[0]), i = u.exec(s[1]), k[this] = [e ? e[0] : 0, i ? i[0] : 0], t[this] = [c.exec(s[0])[0], c.exec(s[1])[0]]
|
|
}), 1 === x.length && (x[1] = x[0]), "right" === t.at[0] ? g.left += d : "center" === t.at[0] && (g.left += d / 2), "bottom" === t.at[1] ? g.top += f : "center" === t.at[1] && (g.top += f / 2), a = i(k.at, d, f), g.left += a[0], g.top += a[1], this.each(function() {
|
|
var l, h, u = e(this),
|
|
c = u.outerWidth(),
|
|
p = u.outerHeight(),
|
|
_ = s(this, "marginLeft"),
|
|
w = s(this, "marginTop"),
|
|
D = c + _ + s(this, "marginRight") + b.width,
|
|
T = p + w + s(this, "marginBottom") + b.height,
|
|
M = e.extend({}, g),
|
|
S = i(k.my, u.outerWidth(), u.outerHeight());
|
|
"right" === t.my[0] ? M.left -= c : "center" === t.my[0] && (M.left -= c / 2), "bottom" === t.my[1] ? M.top -= p : "center" === t.my[1] && (M.top -= p / 2), M.left += S[0], M.top += S[1], e.support.offsetFractions || (M.left = o(M.left), M.top = o(M.top)), l = {
|
|
marginLeft: _,
|
|
marginTop: w
|
|
}, e.each(["left", "top"], function(i, s) {
|
|
e.ui.position[x[i]] && e.ui.position[x[i]][s](M, {
|
|
targetWidth: d,
|
|
targetHeight: f,
|
|
elemWidth: c,
|
|
elemHeight: p,
|
|
collisionPosition: l,
|
|
collisionWidth: D,
|
|
collisionHeight: T,
|
|
offset: [a[0] + S[0], a[1] + S[1]],
|
|
my: t.my,
|
|
at: t.at,
|
|
within: y,
|
|
elem: u
|
|
})
|
|
}), e.fn.bgiframe && u.bgiframe(), t.using && (h = function(e) {
|
|
var i = m.left - M.left,
|
|
s = i + d - c,
|
|
a = m.top - M.top,
|
|
o = a + f - p,
|
|
l = {
|
|
target: {
|
|
element: v,
|
|
left: m.left,
|
|
top: m.top,
|
|
width: d,
|
|
height: f
|
|
},
|
|
element: {
|
|
element: u,
|
|
left: M.left,
|
|
top: M.top,
|
|
width: c,
|
|
height: p
|
|
},
|
|
horizontal: 0 > s ? "left" : i > 0 ? "right" : "center",
|
|
vertical: 0 > o ? "top" : a > 0 ? "bottom" : "middle"
|
|
};
|
|
c > d && d > r(i + s) && (l.horizontal = "center"), p > f && f > r(a + o) && (l.vertical = "middle"), l.important = n(r(i), r(s)) > n(r(a), r(o)) ? "horizontal" : "vertical", t.using.call(this, e, l)
|
|
}), u.offset(e.extend(M, {
|
|
using: h
|
|
}))
|
|
})
|
|
}, e.ui.position = {
|
|
fit: {
|
|
left: function(e, t) {
|
|
var i, s = t.within,
|
|
a = s.isWindow ? s.scrollLeft : s.offset.left,
|
|
r = s.width,
|
|
o = e.left - t.collisionPosition.marginLeft,
|
|
l = a - o,
|
|
h = o + t.collisionWidth - r - a;
|
|
t.collisionWidth > r ? l > 0 && 0 >= h ? (i = e.left + l + t.collisionWidth - r - a, e.left += l - i) : e.left = h > 0 && 0 >= l ? a : l > h ? a + r - t.collisionWidth : a : l > 0 ? e.left += l : h > 0 ? e.left -= h : e.left = n(e.left - o, e.left)
|
|
},
|
|
top: function(e, t) {
|
|
var i, s = t.within,
|
|
a = s.isWindow ? s.scrollTop : s.offset.top,
|
|
r = t.within.height,
|
|
o = e.top - t.collisionPosition.marginTop,
|
|
l = a - o,
|
|
h = o + t.collisionHeight - r - a;
|
|
t.collisionHeight > r ? l > 0 && 0 >= h ? (i = e.top + l + t.collisionHeight - r - a, e.top += l - i) : e.top = h > 0 && 0 >= l ? a : l > h ? a + r - t.collisionHeight : a : l > 0 ? e.top += l : h > 0 ? e.top -= h : e.top = n(e.top - o, e.top)
|
|
}
|
|
},
|
|
flip: {
|
|
left: function(e, t) {
|
|
var i, s, a = t.within,
|
|
n = a.offset.left + a.scrollLeft,
|
|
o = a.width,
|
|
l = a.isWindow ? a.scrollLeft : a.offset.left,
|
|
h = e.left - t.collisionPosition.marginLeft,
|
|
u = h - l,
|
|
c = h + t.collisionWidth - o - l,
|
|
d = "left" === t.my[0] ? -t.elemWidth : "right" === t.my[0] ? t.elemWidth : 0,
|
|
p = "left" === t.at[0] ? t.targetWidth : "right" === t.at[0] ? -t.targetWidth : 0,
|
|
f = -2 * t.offset[0];
|
|
0 > u ? (i = e.left + d + p + f + t.collisionWidth - o - n, (0 > i || r(u) > i) && (e.left += d + p + f)) : c > 0 && (s = e.left - t.collisionPosition.marginLeft + d + p + f - l, (s > 0 || c > r(s)) && (e.left += d + p + f))
|
|
},
|
|
top: function(e, t) {
|
|
var i, s, a = t.within,
|
|
n = a.offset.top + a.scrollTop,
|
|
o = a.height,
|
|
l = a.isWindow ? a.scrollTop : a.offset.top,
|
|
h = e.top - t.collisionPosition.marginTop,
|
|
u = h - l,
|
|
c = h + t.collisionHeight - o - l,
|
|
d = "top" === t.my[1],
|
|
p = d ? -t.elemHeight : "bottom" === t.my[1] ? t.elemHeight : 0,
|
|
f = "top" === t.at[1] ? t.targetHeight : "bottom" === t.at[1] ? -t.targetHeight : 0,
|
|
m = -2 * t.offset[1];
|
|
0 > u ? (s = e.top + p + f + m + t.collisionHeight - o - n, e.top + p + f + m > u && (0 > s || r(u) > s) && (e.top += p + f + m)) : c > 0 && (i = e.top - t.collisionPosition.marginTop + p + f + m - l, e.top + p + f + m > c && (i > 0 || c > r(i)) && (e.top += p + f + m))
|
|
}
|
|
},
|
|
flipfit: {
|
|
left: function() {
|
|
e.ui.position.flip.left.apply(this, arguments), e.ui.position.fit.left.apply(this, arguments)
|
|
},
|
|
top: function() {
|
|
e.ui.position.flip.top.apply(this, arguments), e.ui.position.fit.top.apply(this, arguments)
|
|
}
|
|
}
|
|
},
|
|
function() {
|
|
var t, i, s, a, n, r = document.getElementsByTagName("body")[0],
|
|
o = document.createElement("div");
|
|
t = document.createElement(r ? "div" : "body"), s = {
|
|
visibility: "hidden",
|
|
width: 0,
|
|
height: 0,
|
|
border: 0,
|
|
margin: 0,
|
|
background: "none"
|
|
}, r && e.extend(s, {
|
|
position: "absolute",
|
|
left: "-1000px",
|
|
top: "-1000px"
|
|
});
|
|
for (n in s) t.style[n] = s[n];
|
|
t.appendChild(o), i = r || document.documentElement, i.insertBefore(t, i.firstChild), o.style.cssText = "position: absolute; left: 10.7432222px;", a = e(o).offset().left, e.support.offsetFractions = a > 10 && 11 > a, t.innerHTML = "", i.removeChild(t)
|
|
}(), e.uiBackCompat !== !1 && function(e) {
|
|
var i = e.fn.position;
|
|
e.fn.position = function(s) {
|
|
if (!s || !s.offset) return i.call(this, s);
|
|
var a = s.offset.split(" "),
|
|
n = s.at.split(" ");
|
|
return 1 === a.length && (a[1] = a[0]), /^\d/.test(a[0]) && (a[0] = "+" + a[0]), /^\d/.test(a[1]) && (a[1] = "+" + a[1]), 1 === n.length && (/left|center|right/.test(n[0]) ? n[1] = "center" : (n[1] = n[0], n[0] = "center")), i.call(this, e.extend(s, {
|
|
at: n[0] + a[0] + " " + n[1] + a[1],
|
|
offset: t
|
|
}))
|
|
}
|
|
}(jQuery)
|
|
})(jQuery);
|
|
(function(t) {
|
|
t.widget("ui.draggable", t.ui.mouse, {
|
|
version: "1.9.2",
|
|
widgetEventPrefix: "drag",
|
|
options: {
|
|
addClasses: !0,
|
|
appendTo: "parent",
|
|
axis: !1,
|
|
connectToSortable: !1,
|
|
containment: !1,
|
|
cursor: "auto",
|
|
cursorAt: !1,
|
|
grid: !1,
|
|
handle: !1,
|
|
helper: "original",
|
|
iframeFix: !1,
|
|
opacity: !1,
|
|
refreshPositions: !1,
|
|
revert: !1,
|
|
revertDuration: 500,
|
|
scope: "default",
|
|
scroll: !0,
|
|
scrollSensitivity: 20,
|
|
scrollSpeed: 20,
|
|
snap: !1,
|
|
snapMode: "both",
|
|
snapTolerance: 20,
|
|
stack: !1,
|
|
zIndex: !1
|
|
},
|
|
_create: function() {
|
|
"original" != this.options.helper || /^(?:r|a|f)/.test(this.element.css("position")) || (this.element[0].style.position = "relative"), this.options.addClasses && this.element.addClass("ui-draggable"), this.options.disabled && this.element.addClass("ui-draggable-disabled"), this._mouseInit()
|
|
},
|
|
_destroy: function() {
|
|
this.element.removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled"), this._mouseDestroy()
|
|
},
|
|
_mouseCapture: function(e) {
|
|
var i = this.options;
|
|
return this.helper || i.disabled || t(e.target).is(".ui-resizable-handle") ? !1 : (this.handle = this._getHandle(e), this.handle ? (t(i.iframeFix === !0 ? "iframe" : i.iframeFix).each(function() {
|
|
t('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>').css({
|
|
width: this.offsetWidth + "px",
|
|
height: this.offsetHeight + "px",
|
|
position: "absolute",
|
|
opacity: "0.001",
|
|
zIndex: 1e3
|
|
}).css(t(this).offset()).appendTo("body")
|
|
}), !0) : !1)
|
|
},
|
|
_mouseStart: function(e) {
|
|
var i = this.options;
|
|
return this.helper = this._createHelper(e), this.helper.addClass("ui-draggable-dragging"), this._cacheHelperProportions(), t.ui.ddmanager && (t.ui.ddmanager.current = this), this._cacheMargins(), this.cssPosition = this.helper.css("position"), this.scrollParent = this.helper.scrollParent(), this.offset = this.positionAbs = this.element.offset(), this.offset = {
|
|
top: this.offset.top - this.margins.top,
|
|
left: this.offset.left - this.margins.left
|
|
}, t.extend(this.offset, {
|
|
click: {
|
|
left: e.pageX - this.offset.left,
|
|
top: e.pageY - this.offset.top
|
|
},
|
|
parent: this._getParentOffset(),
|
|
relative: this._getRelativeOffset()
|
|
}), this.originalPosition = this.position = this._generatePosition(e), this.originalPageX = e.pageX, this.originalPageY = e.pageY, i.cursorAt && this._adjustOffsetFromHelper(i.cursorAt), i.containment && this._setContainment(), this._trigger("start", e) === !1 ? (this._clear(), !1) : (this._cacheHelperProportions(), t.ui.ddmanager && !i.dropBehaviour && t.ui.ddmanager.prepareOffsets(this, e), this._mouseDrag(e, !0), t.ui.ddmanager && t.ui.ddmanager.dragStart(this, e), !0)
|
|
},
|
|
_mouseDrag: function(e, i) {
|
|
if (this.position = this._generatePosition(e), this.positionAbs = this._convertPositionTo("absolute"), !i) {
|
|
var s = this._uiHash();
|
|
if (this._trigger("drag", e, s) === !1) return this._mouseUp({}), !1;
|
|
this.position = s.position
|
|
}
|
|
return this.options.axis && "y" == this.options.axis || (this.helper[0].style.left = this.position.left + "px"), this.options.axis && "x" == this.options.axis || (this.helper[0].style.top = this.position.top + "px"), t.ui.ddmanager && t.ui.ddmanager.drag(this, e), !1
|
|
},
|
|
_mouseStop: function(e) {
|
|
var i = !1;
|
|
t.ui.ddmanager && !this.options.dropBehaviour && (i = t.ui.ddmanager.drop(this, e)), this.dropped && (i = this.dropped, this.dropped = !1);
|
|
for (var s = this.element[0], n = !1; s && (s = s.parentNode);) s == document && (n = !0);
|
|
if (!n && "original" === this.options.helper) return !1;
|
|
if ("invalid" == this.options.revert && !i || "valid" == this.options.revert && i || this.options.revert === !0 || t.isFunction(this.options.revert) && this.options.revert.call(this.element, i)) {
|
|
var o = this;
|
|
t(this.helper).animate(this.originalPosition, parseInt(this.options.revertDuration, 10), function() {
|
|
o._trigger("stop", e) !== !1 && o._clear()
|
|
})
|
|
} else this._trigger("stop", e) !== !1 && this._clear();
|
|
return !1
|
|
},
|
|
_mouseUp: function(e) {
|
|
return t("div.ui-draggable-iframeFix").each(function() {
|
|
this.parentNode.removeChild(this)
|
|
}), t.ui.ddmanager && t.ui.ddmanager.dragStop(this, e), t.ui.mouse.prototype._mouseUp.call(this, e)
|
|
},
|
|
cancel: function() {
|
|
return this.helper.is(".ui-draggable-dragging") ? this._mouseUp({}) : this._clear(), this
|
|
},
|
|
_getHandle: function(e) {
|
|
var i = this.options.handle && t(this.options.handle, this.element).length ? !1 : !0;
|
|
return t(this.options.handle, this.element).find("*").andSelf().each(function() {
|
|
this == e.target && (i = !0)
|
|
}), i
|
|
},
|
|
_createHelper: function(e) {
|
|
var i = this.options,
|
|
s = t.isFunction(i.helper) ? t(i.helper.apply(this.element[0], [e])) : "clone" == i.helper ? this.element.clone().removeAttr("id") : this.element;
|
|
return s.parents("body").length || s.appendTo("parent" == i.appendTo ? this.element[0].parentNode : i.appendTo), s[0] == this.element[0] || /(fixed|absolute)/.test(s.css("position")) || s.css("position", "absolute"), s
|
|
},
|
|
_adjustOffsetFromHelper: function(e) {
|
|
"string" == typeof e && (e = e.split(" ")), t.isArray(e) && (e = {
|
|
left: +e[0],
|
|
top: +e[1] || 0
|
|
}), "left" in e && (this.offset.click.left = e.left + this.margins.left), "right" in e && (this.offset.click.left = this.helperProportions.width - e.right + this.margins.left), "top" in e && (this.offset.click.top = e.top + this.margins.top), "bottom" in e && (this.offset.click.top = this.helperProportions.height - e.bottom + this.margins.top)
|
|
},
|
|
_getParentOffset: function() {
|
|
this.offsetParent = this.helper.offsetParent();
|
|
var e = this.offsetParent.offset();
|
|
return "absolute" == this.cssPosition && this.scrollParent[0] != document && t.contains(this.scrollParent[0], this.offsetParent[0]) && (e.left += this.scrollParent.scrollLeft(), e.top += this.scrollParent.scrollTop()), (this.offsetParent[0] == document.body || this.offsetParent[0].tagName && "html" == this.offsetParent[0].tagName.toLowerCase() && t.ui.ie) && (e = {
|
|
top: 0,
|
|
left: 0
|
|
}), {
|
|
top: e.top + (parseInt(this.offsetParent.css("borderTopWidth"), 10) || 0),
|
|
left: e.left + (parseInt(this.offsetParent.css("borderLeftWidth"), 10) || 0)
|
|
}
|
|
},
|
|
_getRelativeOffset: function() {
|
|
if ("relative" == this.cssPosition) {
|
|
var t = this.element.position();
|
|
return {
|
|
top: t.top - (parseInt(this.helper.css("top"), 10) || 0) + this.scrollParent.scrollTop(),
|
|
left: t.left - (parseInt(this.helper.css("left"), 10) || 0) + this.scrollParent.scrollLeft()
|
|
}
|
|
}
|
|
return {
|
|
top: 0,
|
|
left: 0
|
|
}
|
|
},
|
|
_cacheMargins: function() {
|
|
this.margins = {
|
|
left: parseInt(this.element.css("marginLeft"), 10) || 0,
|
|
top: parseInt(this.element.css("marginTop"), 10) || 0,
|
|
right: parseInt(this.element.css("marginRight"), 10) || 0,
|
|
bottom: parseInt(this.element.css("marginBottom"), 10) || 0
|
|
}
|
|
},
|
|
_cacheHelperProportions: function() {
|
|
this.helperProportions = {
|
|
width: this.helper.outerWidth(),
|
|
height: this.helper.outerHeight()
|
|
}
|
|
},
|
|
_setContainment: function() {
|
|
var e = this.options;
|
|
if ("parent" == e.containment && (e.containment = this.helper[0].parentNode), ("document" == e.containment || "window" == e.containment) && (this.containment = ["document" == e.containment ? 0 : t(window).scrollLeft() - this.offset.relative.left - this.offset.parent.left, "document" == e.containment ? 0 : t(window).scrollTop() - this.offset.relative.top - this.offset.parent.top, ("document" == e.containment ? 0 : t(window).scrollLeft()) + t("document" == e.containment ? document : window).width() - this.helperProportions.width - this.margins.left, ("document" == e.containment ? 0 : t(window).scrollTop()) + (t("document" == e.containment ? document : window).height() || document.body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top]), /^(document|window|parent)$/.test(e.containment) || e.containment.constructor == Array) e.containment.constructor == Array && (this.containment = e.containment);
|
|
else {
|
|
var i = t(e.containment),
|
|
s = i[0];
|
|
if (!s) return;
|
|
i.offset();
|
|
var n = "hidden" != t(s).css("overflow");
|
|
this.containment = [(parseInt(t(s).css("borderLeftWidth"), 10) || 0) + (parseInt(t(s).css("paddingLeft"), 10) || 0), (parseInt(t(s).css("borderTopWidth"), 10) || 0) + (parseInt(t(s).css("paddingTop"), 10) || 0), (n ? Math.max(s.scrollWidth, s.offsetWidth) : s.offsetWidth) - (parseInt(t(s).css("borderLeftWidth"), 10) || 0) - (parseInt(t(s).css("paddingRight"), 10) || 0) - this.helperProportions.width - this.margins.left - this.margins.right, (n ? Math.max(s.scrollHeight, s.offsetHeight) : s.offsetHeight) - (parseInt(t(s).css("borderTopWidth"), 10) || 0) - (parseInt(t(s).css("paddingBottom"), 10) || 0) - this.helperProportions.height - this.margins.top - this.margins.bottom], this.relative_container = i
|
|
}
|
|
},
|
|
_convertPositionTo: function(e, i) {
|
|
i || (i = this.position);
|
|
var s = "absolute" == e ? 1 : -1,
|
|
n = (this.options, "absolute" != this.cssPosition || this.scrollParent[0] != document && t.contains(this.scrollParent[0], this.offsetParent[0]) ? this.scrollParent : this.offsetParent),
|
|
o = /(html|body)/i.test(n[0].tagName);
|
|
return {
|
|
top: i.top + this.offset.relative.top * s + this.offset.parent.top * s - ("fixed" == this.cssPosition ? -this.scrollParent.scrollTop() : o ? 0 : n.scrollTop()) * s,
|
|
left: i.left + this.offset.relative.left * s + this.offset.parent.left * s - ("fixed" == this.cssPosition ? -this.scrollParent.scrollLeft() : o ? 0 : n.scrollLeft()) * s
|
|
}
|
|
},
|
|
_generatePosition: function(e) {
|
|
var i = this.options,
|
|
s = "absolute" != this.cssPosition || this.scrollParent[0] != document && t.contains(this.scrollParent[0], this.offsetParent[0]) ? this.scrollParent : this.offsetParent,
|
|
n = /(html|body)/i.test(s[0].tagName),
|
|
o = e.pageX,
|
|
r = e.pageY;
|
|
if (this.originalPosition) {
|
|
var a;
|
|
if (this.containment) {
|
|
if (this.relative_container) {
|
|
var l = this.relative_container.offset();
|
|
a = [this.containment[0] + l.left, this.containment[1] + l.top, this.containment[2] + l.left, this.containment[3] + l.top]
|
|
} else a = this.containment;
|
|
e.pageX - this.offset.click.left < a[0] && (o = a[0] + this.offset.click.left), e.pageY - this.offset.click.top < a[1] && (r = a[1] + this.offset.click.top), e.pageX - this.offset.click.left > a[2] && (o = a[2] + this.offset.click.left), e.pageY - this.offset.click.top > a[3] && (r = a[3] + this.offset.click.top)
|
|
}
|
|
if (i.grid) {
|
|
var c = i.grid[1] ? this.originalPageY + Math.round((r - this.originalPageY) / i.grid[1]) * i.grid[1] : this.originalPageY;
|
|
r = a ? c - this.offset.click.top < a[1] || c - this.offset.click.top > a[3] ? c - this.offset.click.top < a[1] ? c + i.grid[1] : c - i.grid[1] : c : c;
|
|
var h = i.grid[0] ? this.originalPageX + Math.round((o - this.originalPageX) / i.grid[0]) * i.grid[0] : this.originalPageX;
|
|
o = a ? h - this.offset.click.left < a[0] || h - this.offset.click.left > a[2] ? h - this.offset.click.left < a[0] ? h + i.grid[0] : h - i.grid[0] : h : h
|
|
}
|
|
}
|
|
return {
|
|
top: r - this.offset.click.top - this.offset.relative.top - this.offset.parent.top + ("fixed" == this.cssPosition ? -this.scrollParent.scrollTop() : n ? 0 : s.scrollTop()),
|
|
left: o - this.offset.click.left - this.offset.relative.left - this.offset.parent.left + ("fixed" == this.cssPosition ? -this.scrollParent.scrollLeft() : n ? 0 : s.scrollLeft())
|
|
}
|
|
},
|
|
_clear: function() {
|
|
this.helper.removeClass("ui-draggable-dragging"), this.helper[0] == this.element[0] || this.cancelHelperRemoval || this.helper.remove(), this.helper = null, this.cancelHelperRemoval = !1
|
|
},
|
|
_trigger: function(e, i, s) {
|
|
return s = s || this._uiHash(), t.ui.plugin.call(this, e, [i, s]), "drag" == e && (this.positionAbs = this._convertPositionTo("absolute")), t.Widget.prototype._trigger.call(this, e, i, s)
|
|
},
|
|
plugins: {},
|
|
_uiHash: function() {
|
|
return {
|
|
helper: this.helper,
|
|
position: this.position,
|
|
originalPosition: this.originalPosition,
|
|
offset: this.positionAbs
|
|
}
|
|
}
|
|
}), t.ui.plugin.add("draggable", "connectToSortable", {
|
|
start: function(e, i) {
|
|
var s = t(this).data("draggable"),
|
|
n = s.options,
|
|
o = t.extend({}, i, {
|
|
item: s.element
|
|
});
|
|
s.sortables = [], t(n.connectToSortable).each(function() {
|
|
var i = t.data(this, "sortable");
|
|
i && !i.options.disabled && (s.sortables.push({
|
|
instance: i,
|
|
shouldRevert: i.options.revert
|
|
}), i.refreshPositions(), i._trigger("activate", e, o))
|
|
})
|
|
},
|
|
stop: function(e, i) {
|
|
var s = t(this).data("draggable"),
|
|
n = t.extend({}, i, {
|
|
item: s.element
|
|
});
|
|
t.each(s.sortables, function() {
|
|
this.instance.isOver ? (this.instance.isOver = 0, s.cancelHelperRemoval = !0, this.instance.cancelHelperRemoval = !1, this.shouldRevert && (this.instance.options.revert = !0), this.instance._mouseStop(e), this.instance.options.helper = this.instance.options._helper, "original" == s.options.helper && this.instance.currentItem.css({
|
|
top: "auto",
|
|
left: "auto"
|
|
})) : (this.instance.cancelHelperRemoval = !1, this.instance._trigger("deactivate", e, n))
|
|
})
|
|
},
|
|
drag: function(e, i) {
|
|
var s = t(this).data("draggable"),
|
|
n = this;
|
|
t.each(s.sortables, function() {
|
|
var o = !1,
|
|
r = this;
|
|
this.instance.positionAbs = s.positionAbs, this.instance.helperProportions = s.helperProportions, this.instance.offset.click = s.offset.click, this.instance._intersectsWith(this.instance.containerCache) && (o = !0, t.each(s.sortables, function() {
|
|
return this.instance.positionAbs = s.positionAbs, this.instance.helperProportions = s.helperProportions, this.instance.offset.click = s.offset.click, this != r && this.instance._intersectsWith(this.instance.containerCache) && t.ui.contains(r.instance.element[0], this.instance.element[0]) && (o = !1), o
|
|
})), o ? (this.instance.isOver || (this.instance.isOver = 1, this.instance.currentItem = t(n).clone().removeAttr("id").appendTo(this.instance.element).data("sortable-item", !0), this.instance.options._helper = this.instance.options.helper, this.instance.options.helper = function() {
|
|
return i.helper[0]
|
|
}, e.target = this.instance.currentItem[0], this.instance._mouseCapture(e, !0), this.instance._mouseStart(e, !0, !0), this.instance.offset.click.top = s.offset.click.top, this.instance.offset.click.left = s.offset.click.left, this.instance.offset.parent.left -= s.offset.parent.left - this.instance.offset.parent.left, this.instance.offset.parent.top -= s.offset.parent.top - this.instance.offset.parent.top, s._trigger("toSortable", e), s.dropped = this.instance.element, s.currentItem = s.element, this.instance.fromOutside = s), this.instance.currentItem && this.instance._mouseDrag(e)) : this.instance.isOver && (this.instance.isOver = 0, this.instance.cancelHelperRemoval = !0, this.instance.options.revert = !1, this.instance._trigger("out", e, this.instance._uiHash(this.instance)), this.instance._mouseStop(e, !0), this.instance.options.helper = this.instance.options._helper, this.instance.currentItem.remove(), this.instance.placeholder && this.instance.placeholder.remove(), s._trigger("fromSortable", e), s.dropped = !1)
|
|
})
|
|
}
|
|
}), t.ui.plugin.add("draggable", "cursor", {
|
|
start: function() {
|
|
var e = t("body"),
|
|
i = t(this).data("draggable").options;
|
|
e.css("cursor") && (i._cursor = e.css("cursor")), e.css("cursor", i.cursor)
|
|
},
|
|
stop: function() {
|
|
var e = t(this).data("draggable").options;
|
|
e._cursor && t("body").css("cursor", e._cursor)
|
|
}
|
|
}), t.ui.plugin.add("draggable", "opacity", {
|
|
start: function(e, i) {
|
|
var s = t(i.helper),
|
|
n = t(this).data("draggable").options;
|
|
s.css("opacity") && (n._opacity = s.css("opacity")), s.css("opacity", n.opacity)
|
|
},
|
|
stop: function(e, i) {
|
|
var s = t(this).data("draggable").options;
|
|
s._opacity && t(i.helper).css("opacity", s._opacity)
|
|
}
|
|
}), t.ui.plugin.add("draggable", "scroll", {
|
|
start: function() {
|
|
var e = t(this).data("draggable");
|
|
e.scrollParent[0] != document && "HTML" != e.scrollParent[0].tagName && (e.overflowOffset = e.scrollParent.offset())
|
|
},
|
|
drag: function(e) {
|
|
var i = t(this).data("draggable"),
|
|
s = i.options,
|
|
n = !1;
|
|
i.scrollParent[0] != document && "HTML" != i.scrollParent[0].tagName ? (s.axis && "x" == s.axis || (i.overflowOffset.top + i.scrollParent[0].offsetHeight - e.pageY < s.scrollSensitivity ? i.scrollParent[0].scrollTop = n = i.scrollParent[0].scrollTop + s.scrollSpeed : e.pageY - i.overflowOffset.top < s.scrollSensitivity && (i.scrollParent[0].scrollTop = n = i.scrollParent[0].scrollTop - s.scrollSpeed)), s.axis && "y" == s.axis || (i.overflowOffset.left + i.scrollParent[0].offsetWidth - e.pageX < s.scrollSensitivity ? i.scrollParent[0].scrollLeft = n = i.scrollParent[0].scrollLeft + s.scrollSpeed : e.pageX - i.overflowOffset.left < s.scrollSensitivity && (i.scrollParent[0].scrollLeft = n = i.scrollParent[0].scrollLeft - s.scrollSpeed))) : (s.axis && "x" == s.axis || (e.pageY - t(document).scrollTop() < s.scrollSensitivity ? n = t(document).scrollTop(t(document).scrollTop() - s.scrollSpeed) : t(window).height() - (e.pageY - t(document).scrollTop()) < s.scrollSensitivity && (n = t(document).scrollTop(t(document).scrollTop() + s.scrollSpeed))), s.axis && "y" == s.axis || (e.pageX - t(document).scrollLeft() < s.scrollSensitivity ? n = t(document).scrollLeft(t(document).scrollLeft() - s.scrollSpeed) : t(window).width() - (e.pageX - t(document).scrollLeft()) < s.scrollSensitivity && (n = t(document).scrollLeft(t(document).scrollLeft() + s.scrollSpeed)))), n !== !1 && t.ui.ddmanager && !s.dropBehaviour && t.ui.ddmanager.prepareOffsets(i, e)
|
|
}
|
|
}), t.ui.plugin.add("draggable", "snap", {
|
|
start: function() {
|
|
var e = t(this).data("draggable"),
|
|
i = e.options;
|
|
e.snapElements = [], t(i.snap.constructor != String ? i.snap.items || ":data(draggable)" : i.snap).each(function() {
|
|
var i = t(this),
|
|
s = i.offset();
|
|
this != e.element[0] && e.snapElements.push({
|
|
item: this,
|
|
width: i.outerWidth(),
|
|
height: i.outerHeight(),
|
|
top: s.top,
|
|
left: s.left
|
|
})
|
|
})
|
|
},
|
|
drag: function(e, i) {
|
|
for (var s = t(this).data("draggable"), n = s.options, o = n.snapTolerance, r = i.offset.left, a = r + s.helperProportions.width, l = i.offset.top, c = l + s.helperProportions.height, h = s.snapElements.length - 1; h >= 0; h--) {
|
|
var p = s.snapElements[h].left,
|
|
f = p + s.snapElements[h].width,
|
|
d = s.snapElements[h].top,
|
|
u = d + s.snapElements[h].height;
|
|
if (r > p - o && f + o > r && l > d - o && u + o > l || r > p - o && f + o > r && c > d - o && u + o > c || a > p - o && f + o > a && l > d - o && u + o > l || a > p - o && f + o > a && c > d - o && u + o > c) {
|
|
if ("inner" != n.snapMode) {
|
|
var g = o >= Math.abs(d - c),
|
|
m = o >= Math.abs(u - l),
|
|
v = o >= Math.abs(p - a),
|
|
P = o >= Math.abs(f - r);
|
|
g && (i.position.top = s._convertPositionTo("relative", {
|
|
top: d - s.helperProportions.height,
|
|
left: 0
|
|
}).top - s.margins.top), m && (i.position.top = s._convertPositionTo("relative", {
|
|
top: u,
|
|
left: 0
|
|
}).top - s.margins.top), v && (i.position.left = s._convertPositionTo("relative", {
|
|
top: 0,
|
|
left: p - s.helperProportions.width
|
|
}).left - s.margins.left), P && (i.position.left = s._convertPositionTo("relative", {
|
|
top: 0,
|
|
left: f
|
|
}).left - s.margins.left)
|
|
}
|
|
var b = g || m || v || P;
|
|
if ("outer" != n.snapMode) {
|
|
var g = o >= Math.abs(d - l),
|
|
m = o >= Math.abs(u - c),
|
|
v = o >= Math.abs(p - r),
|
|
P = o >= Math.abs(f - a);
|
|
g && (i.position.top = s._convertPositionTo("relative", {
|
|
top: d,
|
|
left: 0
|
|
}).top - s.margins.top), m && (i.position.top = s._convertPositionTo("relative", {
|
|
top: u - s.helperProportions.height,
|
|
left: 0
|
|
}).top - s.margins.top), v && (i.position.left = s._convertPositionTo("relative", {
|
|
top: 0,
|
|
left: p
|
|
}).left - s.margins.left), P && (i.position.left = s._convertPositionTo("relative", {
|
|
top: 0,
|
|
left: f - s.helperProportions.width
|
|
}).left - s.margins.left)
|
|
}!s.snapElements[h].snapping && (g || m || v || P || b) && s.options.snap.snap && s.options.snap.snap.call(s.element, e, t.extend(s._uiHash(), {
|
|
snapItem: s.snapElements[h].item
|
|
})), s.snapElements[h].snapping = g || m || v || P || b
|
|
} else s.snapElements[h].snapping && s.options.snap.release && s.options.snap.release.call(s.element, e, t.extend(s._uiHash(), {
|
|
snapItem: s.snapElements[h].item
|
|
})), s.snapElements[h].snapping = !1
|
|
}
|
|
}
|
|
}), t.ui.plugin.add("draggable", "stack", {
|
|
start: function() {
|
|
var e = t(this).data("draggable").options,
|
|
i = t.makeArray(t(e.stack)).sort(function(e, i) {
|
|
return (parseInt(t(e).css("zIndex"), 10) || 0) - (parseInt(t(i).css("zIndex"), 10) || 0)
|
|
});
|
|
if (i.length) {
|
|
var s = parseInt(i[0].style.zIndex) || 0;
|
|
t(i).each(function(t) {
|
|
this.style.zIndex = s + t
|
|
}), this[0].style.zIndex = s + i.length
|
|
}
|
|
}
|
|
}), t.ui.plugin.add("draggable", "zIndex", {
|
|
start: function(e, i) {
|
|
var s = t(i.helper),
|
|
n = t(this).data("draggable").options;
|
|
s.css("zIndex") && (n._zIndex = s.css("zIndex")), s.css("zIndex", n.zIndex)
|
|
},
|
|
stop: function(e, i) {
|
|
var s = t(this).data("draggable").options;
|
|
s._zIndex && t(i.helper).css("zIndex", s._zIndex)
|
|
}
|
|
})
|
|
})(jQuery);
|
|
(function(e) {
|
|
e.widget("ui.droppable", {
|
|
version: "1.9.2",
|
|
widgetEventPrefix: "drop",
|
|
options: {
|
|
accept: "*",
|
|
activeClass: !1,
|
|
addClasses: !0,
|
|
greedy: !1,
|
|
hoverClass: !1,
|
|
scope: "default",
|
|
tolerance: "intersect"
|
|
},
|
|
_create: function() {
|
|
var t = this.options,
|
|
i = t.accept;
|
|
this.isover = 0, this.isout = 1, this.accept = e.isFunction(i) ? i : function(e) {
|
|
return e.is(i)
|
|
}, this.proportions = {
|
|
width: this.element[0].offsetWidth,
|
|
height: this.element[0].offsetHeight
|
|
}, e.ui.ddmanager.droppables[t.scope] = e.ui.ddmanager.droppables[t.scope] || [], e.ui.ddmanager.droppables[t.scope].push(this), t.addClasses && this.element.addClass("ui-droppable")
|
|
},
|
|
_destroy: function() {
|
|
for (var t = e.ui.ddmanager.droppables[this.options.scope], i = 0; t.length > i; i++) t[i] == this && t.splice(i, 1);
|
|
this.element.removeClass("ui-droppable ui-droppable-disabled")
|
|
},
|
|
_setOption: function(t, i) {
|
|
"accept" == t && (this.accept = e.isFunction(i) ? i : function(e) {
|
|
return e.is(i)
|
|
}), e.Widget.prototype._setOption.apply(this, arguments)
|
|
},
|
|
_activate: function(t) {
|
|
var i = e.ui.ddmanager.current;
|
|
this.options.activeClass && this.element.addClass(this.options.activeClass), i && this._trigger("activate", t, this.ui(i))
|
|
},
|
|
_deactivate: function(t) {
|
|
var i = e.ui.ddmanager.current;
|
|
this.options.activeClass && this.element.removeClass(this.options.activeClass), i && this._trigger("deactivate", t, this.ui(i))
|
|
},
|
|
_over: function(t) {
|
|
var i = e.ui.ddmanager.current;
|
|
i && (i.currentItem || i.element)[0] != this.element[0] && this.accept.call(this.element[0], i.currentItem || i.element) && (this.options.hoverClass && this.element.addClass(this.options.hoverClass), this._trigger("over", t, this.ui(i)))
|
|
},
|
|
_out: function(t) {
|
|
var i = e.ui.ddmanager.current;
|
|
i && (i.currentItem || i.element)[0] != this.element[0] && this.accept.call(this.element[0], i.currentItem || i.element) && (this.options.hoverClass && this.element.removeClass(this.options.hoverClass), this._trigger("out", t, this.ui(i)))
|
|
},
|
|
_drop: function(t, i) {
|
|
var a = i || e.ui.ddmanager.current;
|
|
if (!a || (a.currentItem || a.element)[0] == this.element[0]) return !1;
|
|
var s = !1;
|
|
return this.element.find(":data(droppable)").not(".ui-draggable-dragging").each(function() {
|
|
var t = e.data(this, "droppable");
|
|
return t.options.greedy && !t.options.disabled && t.options.scope == a.options.scope && t.accept.call(t.element[0], a.currentItem || a.element) && e.ui.intersect(a, e.extend(t, {
|
|
offset: t.element.offset()
|
|
}), t.options.tolerance) ? (s = !0, !1) : undefined
|
|
}), s ? !1 : this.accept.call(this.element[0], a.currentItem || a.element) ? (this.options.activeClass && this.element.removeClass(this.options.activeClass), this.options.hoverClass && this.element.removeClass(this.options.hoverClass), this._trigger("drop", t, this.ui(a)), this.element) : !1
|
|
},
|
|
ui: function(e) {
|
|
return {
|
|
draggable: e.currentItem || e.element,
|
|
helper: e.helper,
|
|
position: e.position,
|
|
offset: e.positionAbs
|
|
}
|
|
}
|
|
}), e.ui.intersect = function(t, i, a) {
|
|
if (!i.offset) return !1;
|
|
var s = (t.positionAbs || t.position.absolute).left,
|
|
n = s + t.helperProportions.width,
|
|
r = (t.positionAbs || t.position.absolute).top,
|
|
o = r + t.helperProportions.height,
|
|
l = i.offset.left,
|
|
h = l + i.proportions.width,
|
|
u = i.offset.top,
|
|
d = u + i.proportions.height;
|
|
switch (a) {
|
|
case "fit":
|
|
return s >= l && h >= n && r >= u && d >= o;
|
|
case "intersect":
|
|
return s + t.helperProportions.width / 2 > l && h > n - t.helperProportions.width / 2 && r + t.helperProportions.height / 2 > u && d > o - t.helperProportions.height / 2;
|
|
case "pointer":
|
|
var c = (t.positionAbs || t.position.absolute).left + (t.clickOffset || t.offset.click).left,
|
|
p = (t.positionAbs || t.position.absolute).top + (t.clickOffset || t.offset.click).top,
|
|
m = e.ui.isOver(p, c, u, l, i.proportions.height, i.proportions.width);
|
|
return m;
|
|
case "touch":
|
|
return (r >= u && d >= r || o >= u && d >= o || u > r && o > d) && (s >= l && h >= s || n >= l && h >= n || l > s && n > h);
|
|
default:
|
|
return !1
|
|
}
|
|
}, e.ui.ddmanager = {
|
|
current: null,
|
|
droppables: {
|
|
"default": []
|
|
},
|
|
prepareOffsets: function(t, i) {
|
|
var a = e.ui.ddmanager.droppables[t.options.scope] || [],
|
|
s = i ? i.type : null,
|
|
n = (t.currentItem || t.element).find(":data(droppable)").andSelf();
|
|
e: for (var r = 0; a.length > r; r++)
|
|
if (!(a[r].options.disabled || t && !a[r].accept.call(a[r].element[0], t.currentItem || t.element))) {
|
|
for (var o = 0; n.length > o; o++)
|
|
if (n[o] == a[r].element[0]) {
|
|
a[r].proportions.height = 0;
|
|
continue e
|
|
}
|
|
a[r].visible = "none" != a[r].element.css("display"), a[r].visible && ("mousedown" == s && a[r]._activate.call(a[r], i), a[r].offset = a[r].element.offset(), a[r].proportions = {
|
|
width: a[r].element[0].offsetWidth,
|
|
height: a[r].element[0].offsetHeight
|
|
})
|
|
}
|
|
},
|
|
drop: function(t, i) {
|
|
var a = !1;
|
|
return e.each(e.ui.ddmanager.droppables[t.options.scope] || [], function() {
|
|
this.options && (!this.options.disabled && this.visible && e.ui.intersect(t, this, this.options.tolerance) && (a = this._drop.call(this, i) || a), !this.options.disabled && this.visible && this.accept.call(this.element[0], t.currentItem || t.element) && (this.isout = 1, this.isover = 0, this._deactivate.call(this, i)))
|
|
}), a
|
|
},
|
|
dragStart: function(t, i) {
|
|
t.element.parentsUntil("body").bind("scroll.droppable", function() {
|
|
t.options.refreshPositions || e.ui.ddmanager.prepareOffsets(t, i)
|
|
})
|
|
},
|
|
drag: function(t, i) {
|
|
t.options.refreshPositions && e.ui.ddmanager.prepareOffsets(t, i), e.each(e.ui.ddmanager.droppables[t.options.scope] || [], function() {
|
|
if (!this.options.disabled && !this.greedyChild && this.visible) {
|
|
var a = e.ui.intersect(t, this, this.options.tolerance),
|
|
s = a || 1 != this.isover ? a && 0 == this.isover ? "isover" : null : "isout";
|
|
if (s) {
|
|
var n;
|
|
if (this.options.greedy) {
|
|
var r = this.options.scope,
|
|
o = this.element.parents(":data(droppable)").filter(function() {
|
|
return e.data(this, "droppable").options.scope === r
|
|
});
|
|
o.length && (n = e.data(o[0], "droppable"), n.greedyChild = "isover" == s ? 1 : 0)
|
|
}
|
|
n && "isover" == s && (n.isover = 0, n.isout = 1, n._out.call(n, i)), this[s] = 1, this["isout" == s ? "isover" : "isout"] = 0, this["isover" == s ? "_over" : "_out"].call(this, i), n && "isout" == s && (n.isout = 0, n.isover = 1, n._over.call(n, i))
|
|
}
|
|
}
|
|
})
|
|
},
|
|
dragStop: function(t, i) {
|
|
t.element.parentsUntil("body").unbind("scroll.droppable"), t.options.refreshPositions || e.ui.ddmanager.prepareOffsets(t, i)
|
|
}
|
|
}
|
|
})(jQuery);
|
|
(function(e) {
|
|
e.widget("ui.resizable", e.ui.mouse, {
|
|
version: "1.9.2",
|
|
widgetEventPrefix: "resize",
|
|
options: {
|
|
alsoResize: !1,
|
|
animate: !1,
|
|
animateDuration: "slow",
|
|
animateEasing: "swing",
|
|
aspectRatio: !1,
|
|
autoHide: !1,
|
|
containment: !1,
|
|
ghost: !1,
|
|
grid: !1,
|
|
handles: "e,s,se",
|
|
helper: !1,
|
|
maxHeight: null,
|
|
maxWidth: null,
|
|
minHeight: 10,
|
|
minWidth: 10,
|
|
zIndex: 1e3
|
|
},
|
|
_create: function() {
|
|
var t = this,
|
|
i = this.options;
|
|
if (this.element.addClass("ui-resizable"), e.extend(this, {
|
|
_aspectRatio: !!i.aspectRatio,
|
|
aspectRatio: i.aspectRatio,
|
|
originalElement: this.element,
|
|
_proportionallyResizeElements: [],
|
|
_helper: i.helper || i.ghost || i.animate ? i.helper || "ui-resizable-helper" : null
|
|
}), this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i) && (this.element.wrap(e('<div class="ui-wrapper" style="overflow: hidden;"></div>').css({
|
|
position: this.element.css("position"),
|
|
width: this.element.outerWidth(),
|
|
height: this.element.outerHeight(),
|
|
top: this.element.css("top"),
|
|
left: this.element.css("left")
|
|
})), this.element = this.element.parent().data("resizable", this.element.data("resizable")), this.elementIsWrapper = !0, this.element.css({
|
|
marginLeft: this.originalElement.css("marginLeft"),
|
|
marginTop: this.originalElement.css("marginTop"),
|
|
marginRight: this.originalElement.css("marginRight"),
|
|
marginBottom: this.originalElement.css("marginBottom")
|
|
}), this.originalElement.css({
|
|
marginLeft: 0,
|
|
marginTop: 0,
|
|
marginRight: 0,
|
|
marginBottom: 0
|
|
}), this.originalResizeStyle = this.originalElement.css("resize"), this.originalElement.css("resize", "none"), this._proportionallyResizeElements.push(this.originalElement.css({
|
|
position: "static",
|
|
zoom: 1,
|
|
display: "block"
|
|
})), this.originalElement.css({
|
|
margin: this.originalElement.css("margin")
|
|
}), this._proportionallyResize()), this.handles = i.handles || (e(".ui-resizable-handle", this.element).length ? {
|
|
n: ".ui-resizable-n",
|
|
e: ".ui-resizable-e",
|
|
s: ".ui-resizable-s",
|
|
w: ".ui-resizable-w",
|
|
se: ".ui-resizable-se",
|
|
sw: ".ui-resizable-sw",
|
|
ne: ".ui-resizable-ne",
|
|
nw: ".ui-resizable-nw"
|
|
} : "e,s,se"), this.handles.constructor == String) {
|
|
"all" == this.handles && (this.handles = "n,e,s,w,se,sw,ne,nw");
|
|
var s = this.handles.split(",");
|
|
this.handles = {};
|
|
for (var a = 0; s.length > a; a++) {
|
|
var n = e.trim(s[a]),
|
|
r = "ui-resizable-" + n,
|
|
o = e('<div class="ui-resizable-handle ' + r + '"></div>');
|
|
o.css({
|
|
zIndex: i.zIndex
|
|
}), "se" == n && o.addClass("ui-icon ui-icon-gripsmall-diagonal-se"), this.handles[n] = ".ui-resizable-" + n, this.element.append(o)
|
|
}
|
|
}
|
|
this._renderAxis = function(t) {
|
|
t = t || this.element;
|
|
for (var i in this.handles) {
|
|
if (this.handles[i].constructor == String && (this.handles[i] = e(this.handles[i], this.element).show()), this.elementIsWrapper && this.originalElement[0].nodeName.match(/textarea|input|select|button/i)) {
|
|
var s = e(this.handles[i], this.element),
|
|
a = 0;
|
|
a = /sw|ne|nw|se|n|s/.test(i) ? s.outerHeight() : s.outerWidth();
|
|
var n = ["padding", /ne|nw|n/.test(i) ? "Top" : /se|sw|s/.test(i) ? "Bottom" : /^e$/.test(i) ? "Right" : "Left"].join("");
|
|
t.css(n, a), this._proportionallyResize()
|
|
}
|
|
e(this.handles[i]).length
|
|
}
|
|
}, this._renderAxis(this.element), this._handles = e(".ui-resizable-handle", this.element).disableSelection(), this._handles.mouseover(function() {
|
|
if (!t.resizing) {
|
|
if (this.className) var e = this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i);
|
|
t.axis = e && e[1] ? e[1] : "se"
|
|
}
|
|
}), i.autoHide && (this._handles.hide(), e(this.element).addClass("ui-resizable-autohide").mouseenter(function() {
|
|
i.disabled || (e(this).removeClass("ui-resizable-autohide"), t._handles.show())
|
|
}).mouseleave(function() {
|
|
i.disabled || t.resizing || (e(this).addClass("ui-resizable-autohide"), t._handles.hide())
|
|
})), this._mouseInit()
|
|
},
|
|
_destroy: function() {
|
|
this._mouseDestroy();
|
|
var t = function(t) {
|
|
e(t).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").removeData("ui-resizable").unbind(".resizable").find(".ui-resizable-handle").remove()
|
|
};
|
|
if (this.elementIsWrapper) {
|
|
t(this.element);
|
|
var i = this.element;
|
|
this.originalElement.css({
|
|
position: i.css("position"),
|
|
width: i.outerWidth(),
|
|
height: i.outerHeight(),
|
|
top: i.css("top"),
|
|
left: i.css("left")
|
|
}).insertAfter(i), i.remove()
|
|
}
|
|
return this.originalElement.css("resize", this.originalResizeStyle), t(this.originalElement), this
|
|
},
|
|
_mouseCapture: function(t) {
|
|
var i = !1;
|
|
for (var s in this.handles) e(this.handles[s])[0] == t.target && (i = !0);
|
|
return !this.options.disabled && i
|
|
},
|
|
_mouseStart: function(i) {
|
|
var s = this.options,
|
|
a = this.element.position(),
|
|
n = this.element;
|
|
this.resizing = !0, this.documentScroll = {
|
|
top: e(document).scrollTop(),
|
|
left: e(document).scrollLeft()
|
|
}, (n.is(".ui-draggable") || /absolute/.test(n.css("position"))) && n.css({
|
|
position: "absolute",
|
|
top: a.top,
|
|
left: a.left
|
|
}), this._renderProxy();
|
|
var r = t(this.helper.css("left")),
|
|
o = t(this.helper.css("top"));
|
|
s.containment && (r += e(s.containment).scrollLeft() || 0, o += e(s.containment).scrollTop() || 0), this.offset = this.helper.offset(), this.position = {
|
|
left: r,
|
|
top: o
|
|
}, this.size = this._helper ? {
|
|
width: n.outerWidth(),
|
|
height: n.outerHeight()
|
|
} : {
|
|
width: n.width(),
|
|
height: n.height()
|
|
}, this.originalSize = this._helper ? {
|
|
width: n.outerWidth(),
|
|
height: n.outerHeight()
|
|
} : {
|
|
width: n.width(),
|
|
height: n.height()
|
|
}, this.originalPosition = {
|
|
left: r,
|
|
top: o
|
|
}, this.sizeDiff = {
|
|
width: n.outerWidth() - n.width(),
|
|
height: n.outerHeight() - n.height()
|
|
}, this.originalMousePosition = {
|
|
left: i.pageX,
|
|
top: i.pageY
|
|
}, this.aspectRatio = "number" == typeof s.aspectRatio ? s.aspectRatio : this.originalSize.width / this.originalSize.height || 1;
|
|
var h = e(".ui-resizable-" + this.axis).css("cursor");
|
|
return e("body").css("cursor", "auto" == h ? this.axis + "-resize" : h), n.addClass("ui-resizable-resizing"), this._propagate("start", i), !0
|
|
},
|
|
_mouseDrag: function(e) {
|
|
var t = this.helper,
|
|
i = (this.options, this.originalMousePosition),
|
|
s = this.axis,
|
|
a = e.pageX - i.left || 0,
|
|
n = e.pageY - i.top || 0,
|
|
r = this._change[s];
|
|
if (!r) return !1;
|
|
var o = r.apply(this, [e, a, n]);
|
|
return this._updateVirtualBoundaries(e.shiftKey), (this._aspectRatio || e.shiftKey) && (o = this._updateRatio(o, e)), o = this._respectSize(o, e), this._propagate("resize", e), t.css({
|
|
top: this.position.top + "px",
|
|
left: this.position.left + "px",
|
|
width: this.size.width + "px",
|
|
height: this.size.height + "px"
|
|
}), !this._helper && this._proportionallyResizeElements.length && this._proportionallyResize(), this._updateCache(o), this._trigger("resize", e, this.ui()), !1
|
|
},
|
|
_mouseStop: function(t) {
|
|
this.resizing = !1;
|
|
var i = this.options,
|
|
s = this;
|
|
if (this._helper) {
|
|
var a = this._proportionallyResizeElements,
|
|
n = a.length && /textarea/i.test(a[0].nodeName),
|
|
r = n && e.ui.hasScroll(a[0], "left") ? 0 : s.sizeDiff.height,
|
|
o = n ? 0 : s.sizeDiff.width,
|
|
h = {
|
|
width: s.helper.width() - o,
|
|
height: s.helper.height() - r
|
|
},
|
|
l = parseInt(s.element.css("left"), 10) + (s.position.left - s.originalPosition.left) || null,
|
|
u = parseInt(s.element.css("top"), 10) + (s.position.top - s.originalPosition.top) || null;
|
|
i.animate || this.element.css(e.extend(h, {
|
|
top: u,
|
|
left: l
|
|
})), s.helper.height(s.size.height), s.helper.width(s.size.width), this._helper && !i.animate && this._proportionallyResize()
|
|
}
|
|
return e("body").css("cursor", "auto"), this.element.removeClass("ui-resizable-resizing"), this._propagate("stop", t), this._helper && this.helper.remove(), !1
|
|
},
|
|
_updateVirtualBoundaries: function(e) {
|
|
var t, s, a, n, r, o = this.options;
|
|
r = {
|
|
minWidth: i(o.minWidth) ? o.minWidth : 0,
|
|
maxWidth: i(o.maxWidth) ? o.maxWidth : 1 / 0,
|
|
minHeight: i(o.minHeight) ? o.minHeight : 0,
|
|
maxHeight: i(o.maxHeight) ? o.maxHeight : 1 / 0
|
|
}, (this._aspectRatio || e) && (t = r.minHeight * this.aspectRatio, a = r.minWidth / this.aspectRatio, s = r.maxHeight * this.aspectRatio, n = r.maxWidth / this.aspectRatio, t > r.minWidth && (r.minWidth = t), a > r.minHeight && (r.minHeight = a), r.maxWidth > s && (r.maxWidth = s), r.maxHeight > n && (r.maxHeight = n)), this._vBoundaries = r
|
|
},
|
|
_updateCache: function(e) {
|
|
this.options, this.offset = this.helper.offset(), i(e.left) && (this.position.left = e.left), i(e.top) && (this.position.top = e.top), i(e.height) && (this.size.height = e.height), i(e.width) && (this.size.width = e.width)
|
|
},
|
|
_updateRatio: function(e) {
|
|
var t = (this.options, this.position),
|
|
s = this.size,
|
|
a = this.axis;
|
|
return i(e.height) ? e.width = e.height * this.aspectRatio : i(e.width) && (e.height = e.width / this.aspectRatio), "sw" == a && (e.left = t.left + (s.width - e.width), e.top = null), "nw" == a && (e.top = t.top + (s.height - e.height), e.left = t.left + (s.width - e.width)), e
|
|
},
|
|
_respectSize: function(e, t) {
|
|
var s = (this.helper, this._vBoundaries),
|
|
a = (this._aspectRatio || t.shiftKey, this.axis),
|
|
n = i(e.width) && s.maxWidth && s.maxWidth < e.width,
|
|
r = i(e.height) && s.maxHeight && s.maxHeight < e.height,
|
|
o = i(e.width) && s.minWidth && s.minWidth > e.width,
|
|
h = i(e.height) && s.minHeight && s.minHeight > e.height;
|
|
o && (e.width = s.minWidth), h && (e.height = s.minHeight), n && (e.width = s.maxWidth), r && (e.height = s.maxHeight);
|
|
var l = this.originalPosition.left + this.originalSize.width,
|
|
u = this.position.top + this.size.height,
|
|
d = /sw|nw|w/.test(a),
|
|
c = /nw|ne|n/.test(a);
|
|
o && d && (e.left = l - s.minWidth), n && d && (e.left = l - s.maxWidth), h && c && (e.top = u - s.minHeight), r && c && (e.top = u - s.maxHeight);
|
|
var p = !e.width && !e.height;
|
|
return p && !e.left && e.top ? e.top = null : p && !e.top && e.left && (e.left = null), e
|
|
},
|
|
_proportionallyResize: function() {
|
|
if (this.options, this._proportionallyResizeElements.length)
|
|
for (var t = this.helper || this.element, i = 0; this._proportionallyResizeElements.length > i; i++) {
|
|
var s = this._proportionallyResizeElements[i];
|
|
if (!this.borderDif) {
|
|
var a = [s.css("borderTopWidth"), s.css("borderRightWidth"), s.css("borderBottomWidth"), s.css("borderLeftWidth")],
|
|
n = [s.css("paddingTop"), s.css("paddingRight"), s.css("paddingBottom"), s.css("paddingLeft")];
|
|
this.borderDif = e.map(a, function(e, t) {
|
|
var i = parseInt(e, 10) || 0,
|
|
s = parseInt(n[t], 10) || 0;
|
|
return i + s
|
|
})
|
|
}
|
|
s.css({
|
|
height: t.height() - this.borderDif[0] - this.borderDif[2] || 0,
|
|
width: t.width() - this.borderDif[1] - this.borderDif[3] || 0
|
|
})
|
|
}
|
|
},
|
|
_renderProxy: function() {
|
|
var t = this.element,
|
|
i = this.options;
|
|
if (this.elementOffset = t.offset(), this._helper) {
|
|
this.helper = this.helper || e('<div style="overflow:hidden;"></div>');
|
|
var s = e.ui.ie6 ? 1 : 0,
|
|
a = e.ui.ie6 ? 2 : -1;
|
|
this.helper.addClass(this._helper).css({
|
|
width: this.element.outerWidth() + a,
|
|
height: this.element.outerHeight() + a,
|
|
position: "absolute",
|
|
left: this.elementOffset.left - s + "px",
|
|
top: this.elementOffset.top - s + "px",
|
|
zIndex: ++i.zIndex
|
|
}), this.helper.appendTo("body").disableSelection()
|
|
} else this.helper = this.element
|
|
},
|
|
_change: {
|
|
e: function(e, t) {
|
|
return {
|
|
width: this.originalSize.width + t
|
|
}
|
|
},
|
|
w: function(e, t) {
|
|
var i = (this.options, this.originalSize),
|
|
s = this.originalPosition;
|
|
return {
|
|
left: s.left + t,
|
|
width: i.width - t
|
|
}
|
|
},
|
|
n: function(e, t, i) {
|
|
var s = (this.options, this.originalSize),
|
|
a = this.originalPosition;
|
|
return {
|
|
top: a.top + i,
|
|
height: s.height - i
|
|
}
|
|
},
|
|
s: function(e, t, i) {
|
|
return {
|
|
height: this.originalSize.height + i
|
|
}
|
|
},
|
|
se: function(t, i, s) {
|
|
return e.extend(this._change.s.apply(this, arguments), this._change.e.apply(this, [t, i, s]))
|
|
},
|
|
sw: function(t, i, s) {
|
|
return e.extend(this._change.s.apply(this, arguments), this._change.w.apply(this, [t, i, s]))
|
|
},
|
|
ne: function(t, i, s) {
|
|
return e.extend(this._change.n.apply(this, arguments), this._change.e.apply(this, [t, i, s]))
|
|
},
|
|
nw: function(t, i, s) {
|
|
return e.extend(this._change.n.apply(this, arguments), this._change.w.apply(this, [t, i, s]))
|
|
}
|
|
},
|
|
_propagate: function(t, i) {
|
|
e.ui.plugin.call(this, t, [i, this.ui()]), "resize" != t && this._trigger(t, i, this.ui())
|
|
},
|
|
plugins: {},
|
|
ui: function() {
|
|
return {
|
|
originalElement: this.originalElement,
|
|
element: this.element,
|
|
helper: this.helper,
|
|
position: this.position,
|
|
size: this.size,
|
|
originalSize: this.originalSize,
|
|
originalPosition: this.originalPosition
|
|
}
|
|
}
|
|
}), e.ui.plugin.add("resizable", "alsoResize", {
|
|
start: function() {
|
|
var t = e(this).data("resizable"),
|
|
i = t.options,
|
|
s = function(t) {
|
|
e(t).each(function() {
|
|
var t = e(this);
|
|
t.data("resizable-alsoresize", {
|
|
width: parseInt(t.width(), 10),
|
|
height: parseInt(t.height(), 10),
|
|
left: parseInt(t.css("left"), 10),
|
|
top: parseInt(t.css("top"), 10)
|
|
})
|
|
})
|
|
};
|
|
"object" != typeof i.alsoResize || i.alsoResize.parentNode ? s(i.alsoResize) : i.alsoResize.length ? (i.alsoResize = i.alsoResize[0], s(i.alsoResize)) : e.each(i.alsoResize, function(e) {
|
|
s(e)
|
|
})
|
|
},
|
|
resize: function(t, i) {
|
|
var s = e(this).data("resizable"),
|
|
a = s.options,
|
|
n = s.originalSize,
|
|
r = s.originalPosition,
|
|
o = {
|
|
height: s.size.height - n.height || 0,
|
|
width: s.size.width - n.width || 0,
|
|
top: s.position.top - r.top || 0,
|
|
left: s.position.left - r.left || 0
|
|
},
|
|
h = function(t, s) {
|
|
e(t).each(function() {
|
|
var t = e(this),
|
|
a = e(this).data("resizable-alsoresize"),
|
|
n = {},
|
|
r = s && s.length ? s : t.parents(i.originalElement[0]).length ? ["width", "height"] : ["width", "height", "top", "left"];
|
|
e.each(r, function(e, t) {
|
|
var i = (a[t] || 0) + (o[t] || 0);
|
|
i && i >= 0 && (n[t] = i || null)
|
|
}), t.css(n)
|
|
})
|
|
};
|
|
"object" != typeof a.alsoResize || a.alsoResize.nodeType ? h(a.alsoResize) : e.each(a.alsoResize, function(e, t) {
|
|
h(e, t)
|
|
})
|
|
},
|
|
stop: function() {
|
|
e(this).removeData("resizable-alsoresize")
|
|
}
|
|
}), e.ui.plugin.add("resizable", "animate", {
|
|
stop: function(t) {
|
|
var i = e(this).data("resizable"),
|
|
s = i.options,
|
|
a = i._proportionallyResizeElements,
|
|
n = a.length && /textarea/i.test(a[0].nodeName),
|
|
r = n && e.ui.hasScroll(a[0], "left") ? 0 : i.sizeDiff.height,
|
|
o = n ? 0 : i.sizeDiff.width,
|
|
h = {
|
|
width: i.size.width - o,
|
|
height: i.size.height - r
|
|
},
|
|
l = parseInt(i.element.css("left"), 10) + (i.position.left - i.originalPosition.left) || null,
|
|
u = parseInt(i.element.css("top"), 10) + (i.position.top - i.originalPosition.top) || null;
|
|
i.element.animate(e.extend(h, u && l ? {
|
|
top: u,
|
|
left: l
|
|
} : {}), {
|
|
duration: s.animateDuration,
|
|
easing: s.animateEasing,
|
|
step: function() {
|
|
var s = {
|
|
width: parseInt(i.element.css("width"), 10),
|
|
height: parseInt(i.element.css("height"), 10),
|
|
top: parseInt(i.element.css("top"), 10),
|
|
left: parseInt(i.element.css("left"), 10)
|
|
};
|
|
a && a.length && e(a[0]).css({
|
|
width: s.width,
|
|
height: s.height
|
|
}), i._updateCache(s), i._propagate("resize", t)
|
|
}
|
|
})
|
|
}
|
|
}), e.ui.plugin.add("resizable", "containment", {
|
|
start: function() {
|
|
var i = e(this).data("resizable"),
|
|
s = i.options,
|
|
a = i.element,
|
|
n = s.containment,
|
|
r = n instanceof e ? n.get(0) : /parent/.test(n) ? a.parent().get(0) : n;
|
|
if (r)
|
|
if (i.containerElement = e(r), /document/.test(n) || n == document) i.containerOffset = {
|
|
left: 0,
|
|
top: 0
|
|
}, i.containerPosition = {
|
|
left: 0,
|
|
top: 0
|
|
}, i.parentData = {
|
|
element: e(document),
|
|
left: 0,
|
|
top: 0,
|
|
width: e(document).width(),
|
|
height: e(document).height() || document.body.parentNode.scrollHeight
|
|
};
|
|
else {
|
|
var o = e(r),
|
|
h = [];
|
|
e(["Top", "Right", "Left", "Bottom"]).each(function(e, i) {
|
|
h[e] = t(o.css("padding" + i))
|
|
}), i.containerOffset = o.offset(), i.containerPosition = o.position(), i.containerSize = {
|
|
height: o.innerHeight() - h[3],
|
|
width: o.innerWidth() - h[1]
|
|
};
|
|
var l = i.containerOffset,
|
|
u = i.containerSize.height,
|
|
d = i.containerSize.width,
|
|
c = e.ui.hasScroll(r, "left") ? r.scrollWidth : d,
|
|
p = e.ui.hasScroll(r) ? r.scrollHeight : u;
|
|
i.parentData = {
|
|
element: r,
|
|
left: l.left,
|
|
top: l.top,
|
|
width: c,
|
|
height: p
|
|
}
|
|
}
|
|
},
|
|
resize: function(t) {
|
|
var i = e(this).data("resizable"),
|
|
s = i.options,
|
|
a = (i.containerSize, i.containerOffset),
|
|
n = (i.size, i.position),
|
|
r = i._aspectRatio || t.shiftKey,
|
|
o = {
|
|
top: 0,
|
|
left: 0
|
|
},
|
|
h = i.containerElement;
|
|
h[0] != document && /static/.test(h.css("position")) && (o = a), n.left < (i._helper ? a.left : 0) && (i.size.width = i.size.width + (i._helper ? i.position.left - a.left : i.position.left - o.left), r && (i.size.height = i.size.width / i.aspectRatio), i.position.left = s.helper ? a.left : 0), n.top < (i._helper ? a.top : 0) && (i.size.height = i.size.height + (i._helper ? i.position.top - a.top : i.position.top), r && (i.size.width = i.size.height * i.aspectRatio), i.position.top = i._helper ? a.top : 0), i.offset.left = i.parentData.left + i.position.left, i.offset.top = i.parentData.top + i.position.top;
|
|
var l = Math.abs((i._helper ? i.offset.left - o.left : i.offset.left - o.left) + i.sizeDiff.width),
|
|
u = Math.abs((i._helper ? i.offset.top - o.top : i.offset.top - a.top) + i.sizeDiff.height),
|
|
d = i.containerElement.get(0) == i.element.parent().get(0),
|
|
c = /relative|absolute/.test(i.containerElement.css("position"));
|
|
d && c && (l -= i.parentData.left), l + i.size.width >= i.parentData.width && (i.size.width = i.parentData.width - l, r && (i.size.height = i.size.width / i.aspectRatio)), u + i.size.height >= i.parentData.height && (i.size.height = i.parentData.height - u, r && (i.size.width = i.size.height * i.aspectRatio))
|
|
},
|
|
stop: function() {
|
|
var t = e(this).data("resizable"),
|
|
i = t.options,
|
|
s = (t.position, t.containerOffset),
|
|
a = t.containerPosition,
|
|
n = t.containerElement,
|
|
r = e(t.helper),
|
|
o = r.offset(),
|
|
h = r.outerWidth() - t.sizeDiff.width,
|
|
l = r.outerHeight() - t.sizeDiff.height;
|
|
t._helper && !i.animate && /relative/.test(n.css("position")) && e(this).css({
|
|
left: o.left - a.left - s.left,
|
|
width: h,
|
|
height: l
|
|
}), t._helper && !i.animate && /static/.test(n.css("position")) && e(this).css({
|
|
left: o.left - a.left - s.left,
|
|
width: h,
|
|
height: l
|
|
})
|
|
}
|
|
}), e.ui.plugin.add("resizable", "ghost", {
|
|
start: function() {
|
|
var t = e(this).data("resizable"),
|
|
i = t.options,
|
|
s = t.size;
|
|
t.ghost = t.originalElement.clone(), t.ghost.css({
|
|
opacity: .25,
|
|
display: "block",
|
|
position: "relative",
|
|
height: s.height,
|
|
width: s.width,
|
|
margin: 0,
|
|
left: 0,
|
|
top: 0
|
|
}).addClass("ui-resizable-ghost").addClass("string" == typeof i.ghost ? i.ghost : ""), t.ghost.appendTo(t.helper)
|
|
},
|
|
resize: function() {
|
|
var t = e(this).data("resizable");
|
|
t.options, t.ghost && t.ghost.css({
|
|
position: "relative",
|
|
height: t.size.height,
|
|
width: t.size.width
|
|
})
|
|
},
|
|
stop: function() {
|
|
var t = e(this).data("resizable");
|
|
t.options, t.ghost && t.helper && t.helper.get(0).removeChild(t.ghost.get(0))
|
|
}
|
|
}), e.ui.plugin.add("resizable", "grid", {
|
|
resize: function(t) {
|
|
var i = e(this).data("resizable"),
|
|
s = i.options,
|
|
a = i.size,
|
|
n = i.originalSize,
|
|
r = i.originalPosition,
|
|
o = i.axis;
|
|
s._aspectRatio || t.shiftKey, s.grid = "number" == typeof s.grid ? [s.grid, s.grid] : s.grid;
|
|
var h = Math.round((a.width - n.width) / (s.grid[0] || 1)) * (s.grid[0] || 1),
|
|
l = Math.round((a.height - n.height) / (s.grid[1] || 1)) * (s.grid[1] || 1);
|
|
/^(se|s|e)$/.test(o) ? (i.size.width = n.width + h, i.size.height = n.height + l) : /^(ne)$/.test(o) ? (i.size.width = n.width + h, i.size.height = n.height + l, i.position.top = r.top - l) : /^(sw)$/.test(o) ? (i.size.width = n.width + h, i.size.height = n.height + l, i.position.left = r.left - h) : (i.size.width = n.width + h, i.size.height = n.height + l, i.position.top = r.top - l, i.position.left = r.left - h)
|
|
}
|
|
});
|
|
var t = function(e) {
|
|
return parseInt(e, 10) || 0
|
|
},
|
|
i = function(e) {
|
|
return !isNaN(parseInt(e, 10))
|
|
}
|
|
})(jQuery);
|
|
(function(e) {
|
|
e.widget("ui.selectable", e.ui.mouse, {
|
|
version: "1.9.2",
|
|
options: {
|
|
appendTo: "body",
|
|
autoRefresh: !0,
|
|
distance: 0,
|
|
filter: "*",
|
|
tolerance: "touch"
|
|
},
|
|
_create: function() {
|
|
var t = this;
|
|
this.element.addClass("ui-selectable"), this.dragged = !1;
|
|
var i;
|
|
this.refresh = function() {
|
|
i = e(t.options.filter, t.element[0]), i.addClass("ui-selectee"), i.each(function() {
|
|
var t = e(this),
|
|
i = t.offset();
|
|
e.data(this, "selectable-item", {
|
|
element: this,
|
|
$element: t,
|
|
left: i.left,
|
|
top: i.top,
|
|
right: i.left + t.outerWidth(),
|
|
bottom: i.top + t.outerHeight(),
|
|
startselected: !1,
|
|
selected: t.hasClass("ui-selected"),
|
|
selecting: t.hasClass("ui-selecting"),
|
|
unselecting: t.hasClass("ui-unselecting")
|
|
})
|
|
})
|
|
}, this.refresh(), this.selectees = i.addClass("ui-selectee"), this._mouseInit(), this.helper = e("<div class='ui-selectable-helper'></div>")
|
|
},
|
|
_destroy: function() {
|
|
this.selectees.removeClass("ui-selectee").removeData("selectable-item"), this.element.removeClass("ui-selectable ui-selectable-disabled"), this._mouseDestroy()
|
|
},
|
|
_mouseStart: function(t) {
|
|
var i = this;
|
|
if (this.opos = [t.pageX, t.pageY], !this.options.disabled) {
|
|
var s = this.options;
|
|
this.selectees = e(s.filter, this.element[0]), this._trigger("start", t), e(s.appendTo).append(this.helper), this.helper.css({
|
|
left: t.clientX,
|
|
top: t.clientY,
|
|
width: 0,
|
|
height: 0
|
|
}), s.autoRefresh && this.refresh(), this.selectees.filter(".ui-selected").each(function() {
|
|
var s = e.data(this, "selectable-item");
|
|
s.startselected = !0, t.metaKey || t.ctrlKey || (s.$element.removeClass("ui-selected"), s.selected = !1, s.$element.addClass("ui-unselecting"), s.unselecting = !0, i._trigger("unselecting", t, {
|
|
unselecting: s.element
|
|
}))
|
|
}), e(t.target).parents().andSelf().each(function() {
|
|
var s = e.data(this, "selectable-item");
|
|
if (s) {
|
|
var a = !t.metaKey && !t.ctrlKey || !s.$element.hasClass("ui-selected");
|
|
return s.$element.removeClass(a ? "ui-unselecting" : "ui-selected").addClass(a ? "ui-selecting" : "ui-unselecting"), s.unselecting = !a, s.selecting = a, s.selected = a, a ? i._trigger("selecting", t, {
|
|
selecting: s.element
|
|
}) : i._trigger("unselecting", t, {
|
|
unselecting: s.element
|
|
}), !1
|
|
}
|
|
})
|
|
}
|
|
},
|
|
_mouseDrag: function(t) {
|
|
var i = this;
|
|
if (this.dragged = !0, !this.options.disabled) {
|
|
var s = this.options,
|
|
a = this.opos[0],
|
|
n = this.opos[1],
|
|
r = t.pageX,
|
|
o = t.pageY;
|
|
if (a > r) {
|
|
var h = r;
|
|
r = a, a = h
|
|
}
|
|
if (n > o) {
|
|
var h = o;
|
|
o = n, n = h
|
|
}
|
|
return this.helper.css({
|
|
left: a,
|
|
top: n,
|
|
width: r - a,
|
|
height: o - n
|
|
}), this.selectees.each(function() {
|
|
var h = e.data(this, "selectable-item");
|
|
if (h && h.element != i.element[0]) {
|
|
var l = !1;
|
|
"touch" == s.tolerance ? l = !(h.left > r || a > h.right || h.top > o || n > h.bottom) : "fit" == s.tolerance && (l = h.left > a && r > h.right && h.top > n && o > h.bottom), l ? (h.selected && (h.$element.removeClass("ui-selected"), h.selected = !1), h.unselecting && (h.$element.removeClass("ui-unselecting"), h.unselecting = !1), h.selecting || (h.$element.addClass("ui-selecting"), h.selecting = !0, i._trigger("selecting", t, {
|
|
selecting: h.element
|
|
}))) : (h.selecting && ((t.metaKey || t.ctrlKey) && h.startselected ? (h.$element.removeClass("ui-selecting"), h.selecting = !1, h.$element.addClass("ui-selected"), h.selected = !0) : (h.$element.removeClass("ui-selecting"), h.selecting = !1, h.startselected && (h.$element.addClass("ui-unselecting"), h.unselecting = !0), i._trigger("unselecting", t, {
|
|
unselecting: h.element
|
|
}))), h.selected && (t.metaKey || t.ctrlKey || h.startselected || (h.$element.removeClass("ui-selected"), h.selected = !1, h.$element.addClass("ui-unselecting"), h.unselecting = !0, i._trigger("unselecting", t, {
|
|
unselecting: h.element
|
|
}))))
|
|
}
|
|
}), !1
|
|
}
|
|
},
|
|
_mouseStop: function(t) {
|
|
var i = this;
|
|
return this.dragged = !1, this.options, e(".ui-unselecting", this.element[0]).each(function() {
|
|
var s = e.data(this, "selectable-item");
|
|
s.$element.removeClass("ui-unselecting"), s.unselecting = !1, s.startselected = !1, i._trigger("unselected", t, {
|
|
unselected: s.element
|
|
})
|
|
}), e(".ui-selecting", this.element[0]).each(function() {
|
|
var s = e.data(this, "selectable-item");
|
|
s.$element.removeClass("ui-selecting").addClass("ui-selected"), s.selecting = !1, s.selected = !0, s.startselected = !0, i._trigger("selected", t, {
|
|
selected: s.element
|
|
})
|
|
}), this._trigger("stop", t), this.helper.remove(), !1
|
|
}
|
|
})
|
|
})(jQuery);
|
|
(function(e) {
|
|
e.widget("ui.sortable", e.ui.mouse, {
|
|
version: "1.9.2",
|
|
widgetEventPrefix: "sort",
|
|
ready: !1,
|
|
options: {
|
|
appendTo: "parent",
|
|
axis: !1,
|
|
connectWith: !1,
|
|
containment: !1,
|
|
cursor: "auto",
|
|
cursorAt: !1,
|
|
dropOnEmpty: !0,
|
|
forcePlaceholderSize: !1,
|
|
forceHelperSize: !1,
|
|
grid: !1,
|
|
handle: !1,
|
|
helper: "original",
|
|
items: "> *",
|
|
opacity: !1,
|
|
placeholder: !1,
|
|
revert: !1,
|
|
scroll: !0,
|
|
scrollSensitivity: 20,
|
|
scrollSpeed: 20,
|
|
scope: "default",
|
|
tolerance: "intersect",
|
|
zIndex: 1e3
|
|
},
|
|
_create: function() {
|
|
var e = this.options;
|
|
this.containerCache = {}, this.element.addClass("ui-sortable"), this.refresh(), this.floating = this.items.length ? "x" === e.axis || /left|right/.test(this.items[0].item.css("float")) || /inline|table-cell/.test(this.items[0].item.css("display")) : !1, this.offset = this.element.offset(), this._mouseInit(), this.ready = !0
|
|
},
|
|
_destroy: function() {
|
|
this.element.removeClass("ui-sortable ui-sortable-disabled"), this._mouseDestroy();
|
|
for (var e = this.items.length - 1; e >= 0; e--) this.items[e].item.removeData(this.widgetName + "-item");
|
|
return this
|
|
},
|
|
_setOption: function(t, i) {
|
|
"disabled" === t ? (this.options[t] = i, this.widget().toggleClass("ui-sortable-disabled", !!i)) : e.Widget.prototype._setOption.apply(this, arguments)
|
|
},
|
|
_mouseCapture: function(t, i) {
|
|
var s = this;
|
|
if (this.reverting) return !1;
|
|
if (this.options.disabled || "static" == this.options.type) return !1;
|
|
this._refreshItems(t);
|
|
var a = null;
|
|
if (e(t.target).parents().each(function() {
|
|
return e.data(this, s.widgetName + "-item") == s ? (a = e(this), !1) : undefined
|
|
}), e.data(t.target, s.widgetName + "-item") == s && (a = e(t.target)), !a) return !1;
|
|
if (this.options.handle && !i) {
|
|
var n = !1;
|
|
if (e(this.options.handle, a).find("*").andSelf().each(function() {
|
|
this == t.target && (n = !0)
|
|
}), !n) return !1
|
|
}
|
|
return this.currentItem = a, this._removeCurrentsFromItems(), !0
|
|
},
|
|
_mouseStart: function(t, i, s) {
|
|
var a = this.options;
|
|
if (this.currentContainer = this, this.refreshPositions(), this.helper = this._createHelper(t), this._cacheHelperProportions(), this._cacheMargins(), this.scrollParent = this.helper.scrollParent(), this.offset = this.currentItem.offset(), this.offset = {
|
|
top: this.offset.top - this.margins.top,
|
|
left: this.offset.left - this.margins.left
|
|
}, e.extend(this.offset, {
|
|
click: {
|
|
left: t.pageX - this.offset.left,
|
|
top: t.pageY - this.offset.top
|
|
},
|
|
parent: this._getParentOffset(),
|
|
relative: this._getRelativeOffset()
|
|
}), this.helper.css("position", "absolute"), this.cssPosition = this.helper.css("position"), this.originalPosition = this._generatePosition(t), this.originalPageX = t.pageX, this.originalPageY = t.pageY, a.cursorAt && this._adjustOffsetFromHelper(a.cursorAt), this.domPosition = {
|
|
prev: this.currentItem.prev()[0],
|
|
parent: this.currentItem.parent()[0]
|
|
}, this.helper[0] != this.currentItem[0] && this.currentItem.hide(), this._createPlaceholder(), a.containment && this._setContainment(), a.cursor && (e("body").css("cursor") && (this._storedCursor = e("body").css("cursor")), e("body").css("cursor", a.cursor)), a.opacity && (this.helper.css("opacity") && (this._storedOpacity = this.helper.css("opacity")), this.helper.css("opacity", a.opacity)), a.zIndex && (this.helper.css("zIndex") && (this._storedZIndex = this.helper.css("zIndex")), this.helper.css("zIndex", a.zIndex)), this.scrollParent[0] != document && "HTML" != this.scrollParent[0].tagName && (this.overflowOffset = this.scrollParent.offset()), this._trigger("start", t, this._uiHash()), this._preserveHelperProportions || this._cacheHelperProportions(), !s)
|
|
for (var n = this.containers.length - 1; n >= 0; n--) this.containers[n]._trigger("activate", t, this._uiHash(this));
|
|
return e.ui.ddmanager && (e.ui.ddmanager.current = this), e.ui.ddmanager && !a.dropBehaviour && e.ui.ddmanager.prepareOffsets(this, t), this.dragging = !0, this.helper.addClass("ui-sortable-helper"), this._mouseDrag(t), !0
|
|
},
|
|
_mouseDrag: function(t) {
|
|
if (this.position = this._generatePosition(t), this.positionAbs = this._convertPositionTo("absolute"), this.lastPositionAbs || (this.lastPositionAbs = this.positionAbs), this.options.scroll) {
|
|
var i = this.options,
|
|
s = !1;
|
|
this.scrollParent[0] != document && "HTML" != this.scrollParent[0].tagName ? (this.overflowOffset.top + this.scrollParent[0].offsetHeight - t.pageY < i.scrollSensitivity ? this.scrollParent[0].scrollTop = s = this.scrollParent[0].scrollTop + i.scrollSpeed : t.pageY - this.overflowOffset.top < i.scrollSensitivity && (this.scrollParent[0].scrollTop = s = this.scrollParent[0].scrollTop - i.scrollSpeed), this.overflowOffset.left + this.scrollParent[0].offsetWidth - t.pageX < i.scrollSensitivity ? this.scrollParent[0].scrollLeft = s = this.scrollParent[0].scrollLeft + i.scrollSpeed : t.pageX - this.overflowOffset.left < i.scrollSensitivity && (this.scrollParent[0].scrollLeft = s = this.scrollParent[0].scrollLeft - i.scrollSpeed)) : (t.pageY - e(document).scrollTop() < i.scrollSensitivity ? s = e(document).scrollTop(e(document).scrollTop() - i.scrollSpeed) : e(window).height() - (t.pageY - e(document).scrollTop()) < i.scrollSensitivity && (s = e(document).scrollTop(e(document).scrollTop() + i.scrollSpeed)), t.pageX - e(document).scrollLeft() < i.scrollSensitivity ? s = e(document).scrollLeft(e(document).scrollLeft() - i.scrollSpeed) : e(window).width() - (t.pageX - e(document).scrollLeft()) < i.scrollSensitivity && (s = e(document).scrollLeft(e(document).scrollLeft() + i.scrollSpeed))), s !== !1 && e.ui.ddmanager && !i.dropBehaviour && e.ui.ddmanager.prepareOffsets(this, t)
|
|
}
|
|
this.positionAbs = this._convertPositionTo("absolute"), this.options.axis && "y" == this.options.axis || (this.helper[0].style.left = this.position.left + "px"), this.options.axis && "x" == this.options.axis || (this.helper[0].style.top = this.position.top + "px");
|
|
for (var a = this.items.length - 1; a >= 0; a--) {
|
|
var n = this.items[a],
|
|
r = n.item[0],
|
|
o = this._intersectsWithPointer(n);
|
|
if (o && n.instance === this.currentContainer && r != this.currentItem[0] && this.placeholder[1 == o ? "next" : "prev"]()[0] != r && !e.contains(this.placeholder[0], r) && ("semi-dynamic" == this.options.type ? !e.contains(this.element[0], r) : !0)) {
|
|
if (this.direction = 1 == o ? "down" : "up", "pointer" != this.options.tolerance && !this._intersectsWithSides(n)) break;
|
|
this._rearrange(t, n), this._trigger("change", t, this._uiHash());
|
|
break
|
|
}
|
|
}
|
|
return this._contactContainers(t), e.ui.ddmanager && e.ui.ddmanager.drag(this, t), this._trigger("sort", t, this._uiHash()), this.lastPositionAbs = this.positionAbs, !1
|
|
},
|
|
_mouseStop: function(t, i) {
|
|
if (t) {
|
|
if (e.ui.ddmanager && !this.options.dropBehaviour && e.ui.ddmanager.drop(this, t), this.options.revert) {
|
|
var s = this,
|
|
a = this.placeholder.offset();
|
|
this.reverting = !0, e(this.helper).animate({
|
|
left: a.left - this.offset.parent.left - this.margins.left + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollLeft),
|
|
top: a.top - this.offset.parent.top - this.margins.top + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollTop)
|
|
}, parseInt(this.options.revert, 10) || 500, function() {
|
|
s._clear(t)
|
|
})
|
|
} else this._clear(t, i);
|
|
return !1
|
|
}
|
|
},
|
|
cancel: function() {
|
|
if (this.dragging) {
|
|
this._mouseUp({
|
|
target: null
|
|
}), "original" == this.options.helper ? this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper") : this.currentItem.show();
|
|
for (var t = this.containers.length - 1; t >= 0; t--) this.containers[t]._trigger("deactivate", null, this._uiHash(this)), this.containers[t].containerCache.over && (this.containers[t]._trigger("out", null, this._uiHash(this)), this.containers[t].containerCache.over = 0)
|
|
}
|
|
return this.placeholder && (this.placeholder[0].parentNode && this.placeholder[0].parentNode.removeChild(this.placeholder[0]), "original" != this.options.helper && this.helper && this.helper[0].parentNode && this.helper.remove(), e.extend(this, {
|
|
helper: null,
|
|
dragging: !1,
|
|
reverting: !1,
|
|
_noFinalSort: null
|
|
}), this.domPosition.prev ? e(this.domPosition.prev).after(this.currentItem) : e(this.domPosition.parent).prepend(this.currentItem)), this
|
|
},
|
|
serialize: function(t) {
|
|
var i = this._getItemsAsjQuery(t && t.connected),
|
|
s = [];
|
|
return t = t || {}, e(i).each(function() {
|
|
var i = (e(t.item || this).attr(t.attribute || "id") || "").match(t.expression || /(.+)[-=_](.+)/);
|
|
i && s.push((t.key || i[1] + "[]") + "=" + (t.key && t.expression ? i[1] : i[2]))
|
|
}), !s.length && t.key && s.push(t.key + "="), s.join("&")
|
|
},
|
|
toArray: function(t) {
|
|
var i = this._getItemsAsjQuery(t && t.connected),
|
|
s = [];
|
|
return t = t || {}, i.each(function() {
|
|
s.push(e(t.item || this).attr(t.attribute || "id") || "")
|
|
}), s
|
|
},
|
|
_intersectsWith: function(e) {
|
|
var t = this.positionAbs.left,
|
|
i = t + this.helperProportions.width,
|
|
s = this.positionAbs.top,
|
|
a = s + this.helperProportions.height,
|
|
n = e.left,
|
|
r = n + e.width,
|
|
o = e.top,
|
|
h = o + e.height,
|
|
l = this.offset.click.top,
|
|
u = this.offset.click.left,
|
|
c = s + l > o && h > s + l && t + u > n && r > t + u;
|
|
return "pointer" == this.options.tolerance || this.options.forcePointerForContainers || "pointer" != this.options.tolerance && this.helperProportions[this.floating ? "width" : "height"] > e[this.floating ? "width" : "height"] ? c : t + this.helperProportions.width / 2 > n && r > i - this.helperProportions.width / 2 && s + this.helperProportions.height / 2 > o && h > a - this.helperProportions.height / 2
|
|
},
|
|
_intersectsWithPointer: function(t) {
|
|
var i = "x" === this.options.axis || e.ui.isOverAxis(this.positionAbs.top + this.offset.click.top, t.top, t.height),
|
|
s = "y" === this.options.axis || e.ui.isOverAxis(this.positionAbs.left + this.offset.click.left, t.left, t.width),
|
|
a = i && s,
|
|
n = this._getDragVerticalDirection(),
|
|
r = this._getDragHorizontalDirection();
|
|
return a ? this.floating ? r && "right" == r || "down" == n ? 2 : 1 : n && ("down" == n ? 2 : 1) : !1
|
|
},
|
|
_intersectsWithSides: function(t) {
|
|
var i = e.ui.isOverAxis(this.positionAbs.top + this.offset.click.top, t.top + t.height / 2, t.height),
|
|
s = e.ui.isOverAxis(this.positionAbs.left + this.offset.click.left, t.left + t.width / 2, t.width),
|
|
a = this._getDragVerticalDirection(),
|
|
n = this._getDragHorizontalDirection();
|
|
return this.floating && n ? "right" == n && s || "left" == n && !s : a && ("down" == a && i || "up" == a && !i)
|
|
},
|
|
_getDragVerticalDirection: function() {
|
|
var e = this.positionAbs.top - this.lastPositionAbs.top;
|
|
return 0 != e && (e > 0 ? "down" : "up")
|
|
},
|
|
_getDragHorizontalDirection: function() {
|
|
var e = this.positionAbs.left - this.lastPositionAbs.left;
|
|
return 0 != e && (e > 0 ? "right" : "left")
|
|
},
|
|
refresh: function(e) {
|
|
return this._refreshItems(e), this.refreshPositions(), this
|
|
},
|
|
_connectWith: function() {
|
|
var e = this.options;
|
|
return e.connectWith.constructor == String ? [e.connectWith] : e.connectWith
|
|
},
|
|
_getItemsAsjQuery: function(t) {
|
|
var i = [],
|
|
s = [],
|
|
a = this._connectWith();
|
|
if (a && t)
|
|
for (var n = a.length - 1; n >= 0; n--)
|
|
for (var r = e(a[n]), o = r.length - 1; o >= 0; o--) {
|
|
var h = e.data(r[o], this.widgetName);
|
|
h && h != this && !h.options.disabled && s.push([e.isFunction(h.options.items) ? h.options.items.call(h.element) : e(h.options.items, h.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"), h])
|
|
}
|
|
s.push([e.isFunction(this.options.items) ? this.options.items.call(this.element, null, {
|
|
options: this.options,
|
|
item: this.currentItem
|
|
}) : e(this.options.items, this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"), this]);
|
|
for (var n = s.length - 1; n >= 0; n--) s[n][0].each(function() {
|
|
i.push(this)
|
|
});
|
|
return e(i)
|
|
},
|
|
_removeCurrentsFromItems: function() {
|
|
var t = this.currentItem.find(":data(" + this.widgetName + "-item)");
|
|
this.items = e.grep(this.items, function(e) {
|
|
for (var i = 0; t.length > i; i++)
|
|
if (t[i] == e.item[0]) return !1;
|
|
return !0
|
|
})
|
|
},
|
|
_refreshItems: function(t) {
|
|
this.items = [], this.containers = [this];
|
|
var i = this.items,
|
|
s = [
|
|
[e.isFunction(this.options.items) ? this.options.items.call(this.element[0], t, {
|
|
item: this.currentItem
|
|
}) : e(this.options.items, this.element), this]
|
|
],
|
|
a = this._connectWith();
|
|
if (a && this.ready)
|
|
for (var n = a.length - 1; n >= 0; n--)
|
|
for (var r = e(a[n]), o = r.length - 1; o >= 0; o--) {
|
|
var h = e.data(r[o], this.widgetName);
|
|
h && h != this && !h.options.disabled && (s.push([e.isFunction(h.options.items) ? h.options.items.call(h.element[0], t, {
|
|
item: this.currentItem
|
|
}) : e(h.options.items, h.element), h]), this.containers.push(h))
|
|
}
|
|
for (var n = s.length - 1; n >= 0; n--)
|
|
for (var l = s[n][1], u = s[n][0], o = 0, c = u.length; c > o; o++) {
|
|
var d = e(u[o]);
|
|
d.data(this.widgetName + "-item", l), i.push({
|
|
item: d,
|
|
instance: l,
|
|
width: 0,
|
|
height: 0,
|
|
left: 0,
|
|
top: 0
|
|
})
|
|
}
|
|
},
|
|
refreshPositions: function(t) {
|
|
this.offsetParent && this.helper && (this.offset.parent = this._getParentOffset());
|
|
for (var i = this.items.length - 1; i >= 0; i--) {
|
|
var s = this.items[i];
|
|
if (s.instance == this.currentContainer || !this.currentContainer || s.item[0] == this.currentItem[0]) {
|
|
var a = this.options.toleranceElement ? e(this.options.toleranceElement, s.item) : s.item;
|
|
t || (s.width = a.outerWidth(), s.height = a.outerHeight());
|
|
var n = a.offset();
|
|
s.left = n.left, s.top = n.top
|
|
}
|
|
}
|
|
if (this.options.custom && this.options.custom.refreshContainers) this.options.custom.refreshContainers.call(this);
|
|
else
|
|
for (var i = this.containers.length - 1; i >= 0; i--) {
|
|
var n = this.containers[i].element.offset();
|
|
this.containers[i].containerCache.left = n.left, this.containers[i].containerCache.top = n.top, this.containers[i].containerCache.width = this.containers[i].element.outerWidth(), this.containers[i].containerCache.height = this.containers[i].element.outerHeight()
|
|
}
|
|
return this
|
|
},
|
|
_createPlaceholder: function(t) {
|
|
t = t || this;
|
|
var i = t.options;
|
|
if (!i.placeholder || i.placeholder.constructor == String) {
|
|
var s = i.placeholder;
|
|
i.placeholder = {
|
|
element: function() {
|
|
var i = e(document.createElement(t.currentItem[0].nodeName)).addClass(s || t.currentItem[0].className + " ui-sortable-placeholder").removeClass("ui-sortable-helper")[0];
|
|
return s || (i.style.visibility = "hidden"), i
|
|
},
|
|
update: function(e, a) {
|
|
(!s || i.forcePlaceholderSize) && (a.height() || a.height(t.currentItem.innerHeight() - parseInt(t.currentItem.css("paddingTop") || 0, 10) - parseInt(t.currentItem.css("paddingBottom") || 0, 10)), a.width() || a.width(t.currentItem.innerWidth() - parseInt(t.currentItem.css("paddingLeft") || 0, 10) - parseInt(t.currentItem.css("paddingRight") || 0, 10)))
|
|
}
|
|
}
|
|
}
|
|
t.placeholder = e(i.placeholder.element.call(t.element, t.currentItem)), t.currentItem.after(t.placeholder), i.placeholder.update(t, t.placeholder)
|
|
},
|
|
_contactContainers: function(t) {
|
|
for (var i = null, s = null, a = this.containers.length - 1; a >= 0; a--)
|
|
if (!e.contains(this.currentItem[0], this.containers[a].element[0]))
|
|
if (this._intersectsWith(this.containers[a].containerCache)) {
|
|
if (i && e.contains(this.containers[a].element[0], i.element[0])) continue;
|
|
i = this.containers[a], s = a
|
|
} else this.containers[a].containerCache.over && (this.containers[a]._trigger("out", t, this._uiHash(this)), this.containers[a].containerCache.over = 0);
|
|
if (i)
|
|
if (1 === this.containers.length) this.containers[s]._trigger("over", t, this._uiHash(this)), this.containers[s].containerCache.over = 1;
|
|
else {
|
|
for (var n = 1e4, r = null, o = this.containers[s].floating ? "left" : "top", h = this.containers[s].floating ? "width" : "height", l = this.positionAbs[o] + this.offset.click[o], u = this.items.length - 1; u >= 0; u--)
|
|
if (e.contains(this.containers[s].element[0], this.items[u].item[0]) && this.items[u].item[0] != this.currentItem[0]) {
|
|
var c = this.items[u].item.offset()[o],
|
|
d = !1;
|
|
Math.abs(c - l) > Math.abs(c + this.items[u][h] - l) && (d = !0, c += this.items[u][h]), n > Math.abs(c - l) && (n = Math.abs(c - l), r = this.items[u], this.direction = d ? "up" : "down")
|
|
}
|
|
if (!r && !this.options.dropOnEmpty) return;
|
|
this.currentContainer = this.containers[s], r ? this._rearrange(t, r, null, !0) : this._rearrange(t, null, this.containers[s].element, !0), this._trigger("change", t, this._uiHash()), this.containers[s]._trigger("change", t, this._uiHash(this)), this.options.placeholder.update(this.currentContainer, this.placeholder), this.containers[s]._trigger("over", t, this._uiHash(this)), this.containers[s].containerCache.over = 1
|
|
}
|
|
},
|
|
_createHelper: function(t) {
|
|
var i = this.options,
|
|
s = e.isFunction(i.helper) ? e(i.helper.apply(this.element[0], [t, this.currentItem])) : "clone" == i.helper ? this.currentItem.clone() : this.currentItem;
|
|
return s.parents("body").length || e("parent" != i.appendTo ? i.appendTo : this.currentItem[0].parentNode)[0].appendChild(s[0]), s[0] == this.currentItem[0] && (this._storedCSS = {
|
|
width: this.currentItem[0].style.width,
|
|
height: this.currentItem[0].style.height,
|
|
position: this.currentItem.css("position"),
|
|
top: this.currentItem.css("top"),
|
|
left: this.currentItem.css("left")
|
|
}), ("" == s[0].style.width || i.forceHelperSize) && s.width(this.currentItem.width()), ("" == s[0].style.height || i.forceHelperSize) && s.height(this.currentItem.height()), s
|
|
},
|
|
_adjustOffsetFromHelper: function(t) {
|
|
"string" == typeof t && (t = t.split(" ")), e.isArray(t) && (t = {
|
|
left: +t[0],
|
|
top: +t[1] || 0
|
|
}), "left" in t && (this.offset.click.left = t.left + this.margins.left), "right" in t && (this.offset.click.left = this.helperProportions.width - t.right + this.margins.left), "top" in t && (this.offset.click.top = t.top + this.margins.top), "bottom" in t && (this.offset.click.top = this.helperProportions.height - t.bottom + this.margins.top)
|
|
},
|
|
_getParentOffset: function() {
|
|
this.offsetParent = this.helper.offsetParent();
|
|
var t = this.offsetParent.offset();
|
|
return "absolute" == this.cssPosition && this.scrollParent[0] != document && e.contains(this.scrollParent[0], this.offsetParent[0]) && (t.left += this.scrollParent.scrollLeft(), t.top += this.scrollParent.scrollTop()), (this.offsetParent[0] == document.body || this.offsetParent[0].tagName && "html" == this.offsetParent[0].tagName.toLowerCase() && e.ui.ie) && (t = {
|
|
top: 0,
|
|
left: 0
|
|
}), {
|
|
top: t.top + (parseInt(this.offsetParent.css("borderTopWidth"), 10) || 0),
|
|
left: t.left + (parseInt(this.offsetParent.css("borderLeftWidth"), 10) || 0)
|
|
}
|
|
},
|
|
_getRelativeOffset: function() {
|
|
if ("relative" == this.cssPosition) {
|
|
var e = this.currentItem.position();
|
|
return {
|
|
top: e.top - (parseInt(this.helper.css("top"), 10) || 0) + this.scrollParent.scrollTop(),
|
|
left: e.left - (parseInt(this.helper.css("left"), 10) || 0) + this.scrollParent.scrollLeft()
|
|
}
|
|
}
|
|
return {
|
|
top: 0,
|
|
left: 0
|
|
}
|
|
},
|
|
_cacheMargins: function() {
|
|
this.margins = {
|
|
left: parseInt(this.currentItem.css("marginLeft"), 10) || 0,
|
|
top: parseInt(this.currentItem.css("marginTop"), 10) || 0
|
|
}
|
|
},
|
|
_cacheHelperProportions: function() {
|
|
this.helperProportions = {
|
|
width: this.helper.outerWidth(),
|
|
height: this.helper.outerHeight()
|
|
}
|
|
},
|
|
_setContainment: function() {
|
|
var t = this.options;
|
|
if ("parent" == t.containment && (t.containment = this.helper[0].parentNode), ("document" == t.containment || "window" == t.containment) && (this.containment = [0 - this.offset.relative.left - this.offset.parent.left, 0 - this.offset.relative.top - this.offset.parent.top, e("document" == t.containment ? document : window).width() - this.helperProportions.width - this.margins.left, (e("document" == t.containment ? document : window).height() || document.body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top]), !/^(document|window|parent)$/.test(t.containment)) {
|
|
var i = e(t.containment)[0],
|
|
s = e(t.containment).offset(),
|
|
a = "hidden" != e(i).css("overflow");
|
|
this.containment = [s.left + (parseInt(e(i).css("borderLeftWidth"), 10) || 0) + (parseInt(e(i).css("paddingLeft"), 10) || 0) - this.margins.left, s.top + (parseInt(e(i).css("borderTopWidth"), 10) || 0) + (parseInt(e(i).css("paddingTop"), 10) || 0) - this.margins.top, s.left + (a ? Math.max(i.scrollWidth, i.offsetWidth) : i.offsetWidth) - (parseInt(e(i).css("borderLeftWidth"), 10) || 0) - (parseInt(e(i).css("paddingRight"), 10) || 0) - this.helperProportions.width - this.margins.left, s.top + (a ? Math.max(i.scrollHeight, i.offsetHeight) : i.offsetHeight) - (parseInt(e(i).css("borderTopWidth"), 10) || 0) - (parseInt(e(i).css("paddingBottom"), 10) || 0) - this.helperProportions.height - this.margins.top]
|
|
}
|
|
},
|
|
_convertPositionTo: function(t, i) {
|
|
i || (i = this.position);
|
|
var s = "absolute" == t ? 1 : -1,
|
|
a = (this.options, "absolute" != this.cssPosition || this.scrollParent[0] != document && e.contains(this.scrollParent[0], this.offsetParent[0]) ? this.scrollParent : this.offsetParent),
|
|
n = /(html|body)/i.test(a[0].tagName);
|
|
return {
|
|
top: i.top + this.offset.relative.top * s + this.offset.parent.top * s - ("fixed" == this.cssPosition ? -this.scrollParent.scrollTop() : n ? 0 : a.scrollTop()) * s,
|
|
left: i.left + this.offset.relative.left * s + this.offset.parent.left * s - ("fixed" == this.cssPosition ? -this.scrollParent.scrollLeft() : n ? 0 : a.scrollLeft()) * s
|
|
}
|
|
},
|
|
_generatePosition: function(t) {
|
|
var i = this.options,
|
|
s = "absolute" != this.cssPosition || this.scrollParent[0] != document && e.contains(this.scrollParent[0], this.offsetParent[0]) ? this.scrollParent : this.offsetParent,
|
|
a = /(html|body)/i.test(s[0].tagName);
|
|
"relative" != this.cssPosition || this.scrollParent[0] != document && this.scrollParent[0] != this.offsetParent[0] || (this.offset.relative = this._getRelativeOffset());
|
|
var n = t.pageX,
|
|
r = t.pageY;
|
|
if (this.originalPosition && (this.containment && (t.pageX - this.offset.click.left < this.containment[0] && (n = this.containment[0] + this.offset.click.left), t.pageY - this.offset.click.top < this.containment[1] && (r = this.containment[1] + this.offset.click.top), t.pageX - this.offset.click.left > this.containment[2] && (n = this.containment[2] + this.offset.click.left), t.pageY - this.offset.click.top > this.containment[3] && (r = this.containment[3] + this.offset.click.top)), i.grid)) {
|
|
var o = this.originalPageY + Math.round((r - this.originalPageY) / i.grid[1]) * i.grid[1];
|
|
r = this.containment ? o - this.offset.click.top < this.containment[1] || o - this.offset.click.top > this.containment[3] ? o - this.offset.click.top < this.containment[1] ? o + i.grid[1] : o - i.grid[1] : o : o;
|
|
var h = this.originalPageX + Math.round((n - this.originalPageX) / i.grid[0]) * i.grid[0];
|
|
n = this.containment ? h - this.offset.click.left < this.containment[0] || h - this.offset.click.left > this.containment[2] ? h - this.offset.click.left < this.containment[0] ? h + i.grid[0] : h - i.grid[0] : h : h
|
|
}
|
|
return {
|
|
top: r - this.offset.click.top - this.offset.relative.top - this.offset.parent.top + ("fixed" == this.cssPosition ? -this.scrollParent.scrollTop() : a ? 0 : s.scrollTop()),
|
|
left: n - this.offset.click.left - this.offset.relative.left - this.offset.parent.left + ("fixed" == this.cssPosition ? -this.scrollParent.scrollLeft() : a ? 0 : s.scrollLeft())
|
|
}
|
|
},
|
|
_rearrange: function(e, t, i, s) {
|
|
i ? i[0].appendChild(this.placeholder[0]) : t.item[0].parentNode.insertBefore(this.placeholder[0], "down" == this.direction ? t.item[0] : t.item[0].nextSibling), this.counter = this.counter ? ++this.counter : 1;
|
|
var a = this.counter;
|
|
this._delay(function() {
|
|
a == this.counter && this.refreshPositions(!s)
|
|
})
|
|
},
|
|
_clear: function(t, i) {
|
|
this.reverting = !1;
|
|
var s = [];
|
|
if (!this._noFinalSort && this.currentItem.parent().length && this.placeholder.before(this.currentItem), this._noFinalSort = null, this.helper[0] == this.currentItem[0]) {
|
|
for (var a in this._storedCSS)("auto" == this._storedCSS[a] || "static" == this._storedCSS[a]) && (this._storedCSS[a] = "");
|
|
this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper")
|
|
} else this.currentItem.show();
|
|
this.fromOutside && !i && s.push(function(e) {
|
|
this._trigger("receive", e, this._uiHash(this.fromOutside))
|
|
}), !this.fromOutside && this.domPosition.prev == this.currentItem.prev().not(".ui-sortable-helper")[0] && this.domPosition.parent == this.currentItem.parent()[0] || i || s.push(function(e) {
|
|
this._trigger("update", e, this._uiHash())
|
|
}), this !== this.currentContainer && (i || (s.push(function(e) {
|
|
this._trigger("remove", e, this._uiHash())
|
|
}), s.push(function(e) {
|
|
return function(t) {
|
|
e._trigger("receive", t, this._uiHash(this))
|
|
}
|
|
}.call(this, this.currentContainer)), s.push(function(e) {
|
|
return function(t) {
|
|
e._trigger("update", t, this._uiHash(this))
|
|
}
|
|
}.call(this, this.currentContainer))));
|
|
for (var a = this.containers.length - 1; a >= 0; a--) i || s.push(function(e) {
|
|
return function(t) {
|
|
e._trigger("deactivate", t, this._uiHash(this))
|
|
}
|
|
}.call(this, this.containers[a])), this.containers[a].containerCache.over && (s.push(function(e) {
|
|
return function(t) {
|
|
e._trigger("out", t, this._uiHash(this))
|
|
}
|
|
}.call(this, this.containers[a])), this.containers[a].containerCache.over = 0);
|
|
if (this._storedCursor && e("body").css("cursor", this._storedCursor), this._storedOpacity && this.helper.css("opacity", this._storedOpacity), this._storedZIndex && this.helper.css("zIndex", "auto" == this._storedZIndex ? "" : this._storedZIndex), this.dragging = !1, this.cancelHelperRemoval) {
|
|
if (!i) {
|
|
this._trigger("beforeStop", t, this._uiHash());
|
|
for (var a = 0; s.length > a; a++) s[a].call(this, t);
|
|
this._trigger("stop", t, this._uiHash())
|
|
}
|
|
return this.fromOutside = !1, !1
|
|
}
|
|
if (i || this._trigger("beforeStop", t, this._uiHash()), this.placeholder[0].parentNode.removeChild(this.placeholder[0]), this.helper[0] != this.currentItem[0] && this.helper.remove(), this.helper = null, !i) {
|
|
for (var a = 0; s.length > a; a++) s[a].call(this, t);
|
|
this._trigger("stop", t, this._uiHash())
|
|
}
|
|
return this.fromOutside = !1, !0
|
|
},
|
|
_trigger: function() {
|
|
e.Widget.prototype._trigger.apply(this, arguments) === !1 && this.cancel()
|
|
},
|
|
_uiHash: function(t) {
|
|
var i = t || this;
|
|
return {
|
|
helper: i.helper,
|
|
placeholder: i.placeholder || e([]),
|
|
position: i.position,
|
|
originalPosition: i.originalPosition,
|
|
offset: i.positionAbs,
|
|
item: i.currentItem,
|
|
sender: t ? t.element : null
|
|
}
|
|
}
|
|
})
|
|
})(jQuery);
|
|
(function(e) {
|
|
var t = 5;
|
|
e.widget("ui.slider", e.ui.mouse, {
|
|
version: "1.9.2",
|
|
widgetEventPrefix: "slide",
|
|
options: {
|
|
animate: !1,
|
|
distance: 0,
|
|
max: 100,
|
|
min: 0,
|
|
orientation: "horizontal",
|
|
range: !1,
|
|
step: 1,
|
|
value: 0,
|
|
values: null
|
|
},
|
|
_create: function() {
|
|
var i, s, a = this.options,
|
|
n = this.element.find(".ui-slider-handle").addClass("ui-state-default ui-corner-all"),
|
|
r = "<a class='ui-slider-handle ui-state-default ui-corner-all' href='#'></a>",
|
|
o = [];
|
|
for (this._keySliding = !1, this._mouseSliding = !1, this._animateOff = !0, this._handleIndex = null, this._detectOrientation(), this._mouseInit(), this.element.addClass("ui-slider ui-slider-" + this.orientation + " ui-widget" + " ui-widget-content" + " ui-corner-all" + (a.disabled ? " ui-slider-disabled ui-disabled" : "")), this.range = e([]), a.range && (a.range === !0 && (a.values || (a.values = [this._valueMin(), this._valueMin()]), a.values.length && 2 !== a.values.length && (a.values = [a.values[0], a.values[0]])), this.range = e("<div></div>").appendTo(this.element).addClass("ui-slider-range ui-widget-header" + ("min" === a.range || "max" === a.range ? " ui-slider-range-" + a.range : ""))), s = a.values && a.values.length || 1, i = n.length; s > i; i++) o.push(r);
|
|
this.handles = n.add(e(o.join("")).appendTo(this.element)), this.handle = this.handles.eq(0), this.handles.add(this.range).filter("a").click(function(e) {
|
|
e.preventDefault()
|
|
}).mouseenter(function() {
|
|
a.disabled || e(this).addClass("ui-state-hover")
|
|
}).mouseleave(function() {
|
|
e(this).removeClass("ui-state-hover")
|
|
}).focus(function() {
|
|
a.disabled ? e(this).blur() : (e(".ui-slider .ui-state-focus").removeClass("ui-state-focus"), e(this).addClass("ui-state-focus"))
|
|
}).blur(function() {
|
|
e(this).removeClass("ui-state-focus")
|
|
}), this.handles.each(function(t) {
|
|
e(this).data("ui-slider-handle-index", t)
|
|
}), this._on(this.handles, {
|
|
keydown: function(i) {
|
|
var s, a, n, r, o = e(i.target).data("ui-slider-handle-index");
|
|
switch (i.keyCode) {
|
|
case e.ui.keyCode.HOME:
|
|
case e.ui.keyCode.END:
|
|
case e.ui.keyCode.PAGE_UP:
|
|
case e.ui.keyCode.PAGE_DOWN:
|
|
case e.ui.keyCode.UP:
|
|
case e.ui.keyCode.RIGHT:
|
|
case e.ui.keyCode.DOWN:
|
|
case e.ui.keyCode.LEFT:
|
|
if (i.preventDefault(), !this._keySliding && (this._keySliding = !0, e(i.target).addClass("ui-state-active"), s = this._start(i, o), s === !1)) return
|
|
}
|
|
switch (r = this.options.step, a = n = this.options.values && this.options.values.length ? this.values(o) : this.value(), i.keyCode) {
|
|
case e.ui.keyCode.HOME:
|
|
n = this._valueMin();
|
|
break;
|
|
case e.ui.keyCode.END:
|
|
n = this._valueMax();
|
|
break;
|
|
case e.ui.keyCode.PAGE_UP:
|
|
n = this._trimAlignValue(a + (this._valueMax() - this._valueMin()) / t);
|
|
break;
|
|
case e.ui.keyCode.PAGE_DOWN:
|
|
n = this._trimAlignValue(a - (this._valueMax() - this._valueMin()) / t);
|
|
break;
|
|
case e.ui.keyCode.UP:
|
|
case e.ui.keyCode.RIGHT:
|
|
if (a === this._valueMax()) return;
|
|
n = this._trimAlignValue(a + r);
|
|
break;
|
|
case e.ui.keyCode.DOWN:
|
|
case e.ui.keyCode.LEFT:
|
|
if (a === this._valueMin()) return;
|
|
n = this._trimAlignValue(a - r)
|
|
}
|
|
this._slide(i, o, n)
|
|
},
|
|
keyup: function(t) {
|
|
var i = e(t.target).data("ui-slider-handle-index");
|
|
this._keySliding && (this._keySliding = !1, this._stop(t, i), this._change(t, i), e(t.target).removeClass("ui-state-active"))
|
|
}
|
|
}), this._refreshValue(), this._animateOff = !1
|
|
},
|
|
_destroy: function() {
|
|
this.handles.remove(), this.range.remove(), this.element.removeClass("ui-slider ui-slider-horizontal ui-slider-vertical ui-slider-disabled ui-widget ui-widget-content ui-corner-all"), this._mouseDestroy()
|
|
},
|
|
_mouseCapture: function(t) {
|
|
var i, s, a, n, r, o, h, l, u = this,
|
|
d = this.options;
|
|
return d.disabled ? !1 : (this.elementSize = {
|
|
width: this.element.outerWidth(),
|
|
height: this.element.outerHeight()
|
|
}, this.elementOffset = this.element.offset(), i = {
|
|
x: t.pageX,
|
|
y: t.pageY
|
|
}, s = this._normValueFromMouse(i), a = this._valueMax() - this._valueMin() + 1, this.handles.each(function(t) {
|
|
var i = Math.abs(s - u.values(t));
|
|
a > i && (a = i, n = e(this), r = t)
|
|
}), d.range === !0 && this.values(1) === d.min && (r += 1, n = e(this.handles[r])), o = this._start(t, r), o === !1 ? !1 : (this._mouseSliding = !0, this._handleIndex = r, n.addClass("ui-state-active").focus(), h = n.offset(), l = !e(t.target).parents().andSelf().is(".ui-slider-handle"), this._clickOffset = l ? {
|
|
left: 0,
|
|
top: 0
|
|
} : {
|
|
left: t.pageX - h.left - n.width() / 2,
|
|
top: t.pageY - h.top - n.height() / 2 - (parseInt(n.css("borderTopWidth"), 10) || 0) - (parseInt(n.css("borderBottomWidth"), 10) || 0) + (parseInt(n.css("marginTop"), 10) || 0)
|
|
}, this.handles.hasClass("ui-state-hover") || this._slide(t, r, s), this._animateOff = !0, !0))
|
|
},
|
|
_mouseStart: function() {
|
|
return !0
|
|
},
|
|
_mouseDrag: function(e) {
|
|
var t = {
|
|
x: e.pageX,
|
|
y: e.pageY
|
|
},
|
|
i = this._normValueFromMouse(t);
|
|
return this._slide(e, this._handleIndex, i), !1
|
|
},
|
|
_mouseStop: function(e) {
|
|
return this.handles.removeClass("ui-state-active"), this._mouseSliding = !1, this._stop(e, this._handleIndex), this._change(e, this._handleIndex), this._handleIndex = null, this._clickOffset = null, this._animateOff = !1, !1
|
|
},
|
|
_detectOrientation: function() {
|
|
this.orientation = "vertical" === this.options.orientation ? "vertical" : "horizontal"
|
|
},
|
|
_normValueFromMouse: function(e) {
|
|
var t, i, s, a, n;
|
|
return "horizontal" === this.orientation ? (t = this.elementSize.width, i = e.x - this.elementOffset.left - (this._clickOffset ? this._clickOffset.left : 0)) : (t = this.elementSize.height, i = e.y - this.elementOffset.top - (this._clickOffset ? this._clickOffset.top : 0)), s = i / t, s > 1 && (s = 1), 0 > s && (s = 0), "vertical" === this.orientation && (s = 1 - s), a = this._valueMax() - this._valueMin(), n = this._valueMin() + s * a, this._trimAlignValue(n)
|
|
},
|
|
_start: function(e, t) {
|
|
var i = {
|
|
handle: this.handles[t],
|
|
value: this.value()
|
|
};
|
|
return this.options.values && this.options.values.length && (i.value = this.values(t), i.values = this.values()), this._trigger("start", e, i)
|
|
},
|
|
_slide: function(e, t, i) {
|
|
var s, a, n;
|
|
this.options.values && this.options.values.length ? (s = this.values(t ? 0 : 1), 2 === this.options.values.length && this.options.range === !0 && (0 === t && i > s || 1 === t && s > i) && (i = s), i !== this.values(t) && (a = this.values(), a[t] = i, n = this._trigger("slide", e, {
|
|
handle: this.handles[t],
|
|
value: i,
|
|
values: a
|
|
}), s = this.values(t ? 0 : 1), n !== !1 && this.values(t, i, !0))) : i !== this.value() && (n = this._trigger("slide", e, {
|
|
handle: this.handles[t],
|
|
value: i
|
|
}), n !== !1 && this.value(i))
|
|
},
|
|
_stop: function(e, t) {
|
|
var i = {
|
|
handle: this.handles[t],
|
|
value: this.value()
|
|
};
|
|
this.options.values && this.options.values.length && (i.value = this.values(t), i.values = this.values()), this._trigger("stop", e, i)
|
|
},
|
|
_change: function(e, t) {
|
|
if (!this._keySliding && !this._mouseSliding) {
|
|
var i = {
|
|
handle: this.handles[t],
|
|
value: this.value()
|
|
};
|
|
this.options.values && this.options.values.length && (i.value = this.values(t), i.values = this.values()), this._trigger("change", e, i)
|
|
}
|
|
},
|
|
value: function(e) {
|
|
return arguments.length ? (this.options.value = this._trimAlignValue(e), this._refreshValue(), this._change(null, 0), undefined) : this._value()
|
|
},
|
|
values: function(t, i) {
|
|
var s, a, n;
|
|
if (arguments.length > 1) return this.options.values[t] = this._trimAlignValue(i), this._refreshValue(), this._change(null, t), undefined;
|
|
if (!arguments.length) return this._values();
|
|
if (!e.isArray(arguments[0])) return this.options.values && this.options.values.length ? this._values(t) : this.value();
|
|
for (s = this.options.values, a = arguments[0], n = 0; s.length > n; n += 1) s[n] = this._trimAlignValue(a[n]), this._change(null, n);
|
|
this._refreshValue()
|
|
},
|
|
_setOption: function(t, i) {
|
|
var s, a = 0;
|
|
switch (e.isArray(this.options.values) && (a = this.options.values.length), e.Widget.prototype._setOption.apply(this, arguments), t) {
|
|
case "disabled":
|
|
i ? (this.handles.filter(".ui-state-focus").blur(), this.handles.removeClass("ui-state-hover"), this.handles.prop("disabled", !0), this.element.addClass("ui-disabled")) : (this.handles.prop("disabled", !1), this.element.removeClass("ui-disabled"));
|
|
break;
|
|
case "orientation":
|
|
this._detectOrientation(), this.element.removeClass("ui-slider-horizontal ui-slider-vertical").addClass("ui-slider-" + this.orientation), this._refreshValue();
|
|
break;
|
|
case "value":
|
|
this._animateOff = !0, this._refreshValue(), this._change(null, 0), this._animateOff = !1;
|
|
break;
|
|
case "values":
|
|
for (this._animateOff = !0, this._refreshValue(), s = 0; a > s; s += 1) this._change(null, s);
|
|
this._animateOff = !1;
|
|
break;
|
|
case "min":
|
|
case "max":
|
|
this._animateOff = !0, this._refreshValue(), this._animateOff = !1
|
|
}
|
|
},
|
|
_value: function() {
|
|
var e = this.options.value;
|
|
return e = this._trimAlignValue(e)
|
|
},
|
|
_values: function(e) {
|
|
var t, i, s;
|
|
if (arguments.length) return t = this.options.values[e], t = this._trimAlignValue(t);
|
|
for (i = this.options.values.slice(), s = 0; i.length > s; s += 1) i[s] = this._trimAlignValue(i[s]);
|
|
return i
|
|
},
|
|
_trimAlignValue: function(e) {
|
|
if (this._valueMin() >= e) return this._valueMin();
|
|
if (e >= this._valueMax()) return this._valueMax();
|
|
var t = this.options.step > 0 ? this.options.step : 1,
|
|
i = (e - this._valueMin()) % t,
|
|
s = e - i;
|
|
return 2 * Math.abs(i) >= t && (s += i > 0 ? t : -t), parseFloat(s.toFixed(5))
|
|
},
|
|
_valueMin: function() {
|
|
return this.options.min
|
|
},
|
|
_valueMax: function() {
|
|
return this.options.max
|
|
},
|
|
_refreshValue: function() {
|
|
var t, i, s, a, n, r = this.options.range,
|
|
o = this.options,
|
|
h = this,
|
|
l = this._animateOff ? !1 : o.animate,
|
|
u = {};
|
|
this.options.values && this.options.values.length ? this.handles.each(function(s) {
|
|
i = 100 * ((h.values(s) - h._valueMin()) / (h._valueMax() - h._valueMin())), u["horizontal" === h.orientation ? "left" : "bottom"] = i + "%", e(this).stop(1, 1)[l ? "animate" : "css"](u, o.animate), h.options.range === !0 && ("horizontal" === h.orientation ? (0 === s && h.range.stop(1, 1)[l ? "animate" : "css"]({
|
|
left: i + "%"
|
|
}, o.animate), 1 === s && h.range[l ? "animate" : "css"]({
|
|
width: i - t + "%"
|
|
}, {
|
|
queue: !1,
|
|
duration: o.animate
|
|
})) : (0 === s && h.range.stop(1, 1)[l ? "animate" : "css"]({
|
|
bottom: i + "%"
|
|
}, o.animate), 1 === s && h.range[l ? "animate" : "css"]({
|
|
height: i - t + "%"
|
|
}, {
|
|
queue: !1,
|
|
duration: o.animate
|
|
}))), t = i
|
|
}) : (s = this.value(), a = this._valueMin(), n = this._valueMax(), i = n !== a ? 100 * ((s - a) / (n - a)) : 0, u["horizontal" === this.orientation ? "left" : "bottom"] = i + "%", this.handle.stop(1, 1)[l ? "animate" : "css"](u, o.animate), "min" === r && "horizontal" === this.orientation && this.range.stop(1, 1)[l ? "animate" : "css"]({
|
|
width: i + "%"
|
|
}, o.animate), "max" === r && "horizontal" === this.orientation && this.range[l ? "animate" : "css"]({
|
|
width: 100 - i + "%"
|
|
}, {
|
|
queue: !1,
|
|
duration: o.animate
|
|
}), "min" === r && "vertical" === this.orientation && this.range.stop(1, 1)[l ? "animate" : "css"]({
|
|
height: i + "%"
|
|
}, o.animate), "max" === r && "vertical" === this.orientation && this.range[l ? "animate" : "css"]({
|
|
height: 100 - i + "%"
|
|
}, {
|
|
queue: !1,
|
|
duration: o.animate
|
|
}))
|
|
}
|
|
})
|
|
})(jQuery); |