mirror of
https://github.com/Noratrieb/mx-3.git
synced 2026-01-16 00:05:06 +01:00
852 lines
38 KiB
JavaScript
852 lines
38 KiB
JavaScript
/* jQuery UI v1.11.4; (c) 2015 jQuery Foundation and other contributors; Licensed MIT */
|
|
(function (e) {
|
|
"function" == typeof define && define.amd ? define(["jquery"], e) : e(jQuery);
|
|
})(function (e) {
|
|
function t(t, s) {
|
|
var n,
|
|
a,
|
|
o,
|
|
r = t.nodeName.toLowerCase();
|
|
return "area" === r
|
|
? ((n = t.parentNode),
|
|
(a = n.name),
|
|
t.href && a && "map" === n.nodeName.toLowerCase()
|
|
? ((o = e("img[usemap='#" + a + "']")[0]), !!o && i(o))
|
|
: !1)
|
|
: (/^(input|select|textarea|button|object)$/.test(r) ? !t.disabled : "a" === r ? t.href || s : s) && i(t);
|
|
}
|
|
function i(t) {
|
|
return (
|
|
e.expr.filters.visible(t) &&
|
|
!e(t)
|
|
.parents()
|
|
.addBack()
|
|
.filter(function () {
|
|
return "hidden" === e.css(this, "visibility");
|
|
}).length
|
|
);
|
|
}
|
|
(e.ui = e.ui || {}),
|
|
e.extend(e.ui, {
|
|
version: "1.11.4",
|
|
keyCode: {
|
|
BACKSPACE: 8,
|
|
COMMA: 188,
|
|
DELETE: 46,
|
|
DOWN: 40,
|
|
END: 35,
|
|
ENTER: 13,
|
|
ESCAPE: 27,
|
|
HOME: 36,
|
|
LEFT: 37,
|
|
PAGE_DOWN: 34,
|
|
PAGE_UP: 33,
|
|
PERIOD: 190,
|
|
RIGHT: 39,
|
|
SPACE: 32,
|
|
TAB: 9,
|
|
UP: 38,
|
|
},
|
|
}),
|
|
e.fn.extend({
|
|
scrollParent: function (t) {
|
|
var i = this.css("position"),
|
|
s = "absolute" === i,
|
|
n = t ? /(auto|scroll|hidden)/ : /(auto|scroll)/,
|
|
a = this.parents()
|
|
.filter(function () {
|
|
var t = e(this);
|
|
return s && "static" === t.css("position")
|
|
? !1
|
|
: n.test(t.css("overflow") + t.css("overflow-y") + t.css("overflow-x"));
|
|
})
|
|
.eq(0);
|
|
return "fixed" !== i && a.length ? a : e(this[0].ownerDocument || document);
|
|
},
|
|
uniqueId: (function () {
|
|
var e = 0;
|
|
return function () {
|
|
return this.each(function () {
|
|
this.id || (this.id = "ui-id-" + ++e);
|
|
});
|
|
};
|
|
})(),
|
|
removeUniqueId: function () {
|
|
return this.each(function () {
|
|
/^ui-id-\d+$/.test(this.id) && e(this).removeAttr("id");
|
|
});
|
|
},
|
|
}),
|
|
e.extend(e.expr[":"], {
|
|
data: e.expr.createPseudo
|
|
? e.expr.createPseudo(function (t) {
|
|
return function (i) {
|
|
return !!e.data(i, t);
|
|
};
|
|
})
|
|
: function (t, i, s) {
|
|
return !!e.data(t, s[3]);
|
|
},
|
|
focusable: function (i) {
|
|
return t(i, !isNaN(e.attr(i, "tabindex")));
|
|
},
|
|
tabbable: function (i) {
|
|
var s = e.attr(i, "tabindex"),
|
|
n = isNaN(s);
|
|
return (n || s >= 0) && t(i, !n);
|
|
},
|
|
}),
|
|
e("<a>").outerWidth(1).jquery ||
|
|
e.each(["Width", "Height"], function (t, i) {
|
|
function s(t, i, s, a) {
|
|
return (
|
|
e.each(n, function () {
|
|
(i -= parseFloat(e.css(t, "padding" + this)) || 0),
|
|
s && (i -= parseFloat(e.css(t, "border" + this + "Width")) || 0),
|
|
a && (i -= parseFloat(e.css(t, "margin" + this)) || 0);
|
|
}),
|
|
i
|
|
);
|
|
}
|
|
var n = "Width" === i ? ["Left", "Right"] : ["Top", "Bottom"],
|
|
a = i.toLowerCase(),
|
|
o = {
|
|
innerWidth: e.fn.innerWidth,
|
|
innerHeight: e.fn.innerHeight,
|
|
outerWidth: e.fn.outerWidth,
|
|
outerHeight: e.fn.outerHeight,
|
|
};
|
|
(e.fn["inner" + i] = function (t) {
|
|
return void 0 === t
|
|
? o["inner" + i].call(this)
|
|
: this.each(function () {
|
|
e(this).css(a, s(this, t) + "px");
|
|
});
|
|
}),
|
|
(e.fn["outer" + i] = function (t, n) {
|
|
return "number" != typeof t
|
|
? o["outer" + i].call(this, t)
|
|
: this.each(function () {
|
|
e(this).css(a, s(this, t, !0, n) + "px");
|
|
});
|
|
});
|
|
}),
|
|
e.fn.addBack ||
|
|
(e.fn.addBack = function (e) {
|
|
return this.add(null == e ? this.prevObject : this.prevObject.filter(e));
|
|
}),
|
|
e("<a>").data("a-b", "a").removeData("a-b").data("a-b") &&
|
|
(e.fn.removeData = (function (t) {
|
|
return function (i) {
|
|
return arguments.length ? t.call(this, e.camelCase(i)) : t.call(this);
|
|
};
|
|
})(e.fn.removeData)),
|
|
(e.ui.ie = !!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase())),
|
|
e.fn.extend({
|
|
focus: (function (t) {
|
|
return function (i, s) {
|
|
return "number" == typeof i
|
|
? this.each(function () {
|
|
var t = this;
|
|
setTimeout(function () {
|
|
e(t).focus(), s && s.call(t);
|
|
}, i);
|
|
})
|
|
: t.apply(this, arguments);
|
|
};
|
|
})(e.fn.focus),
|
|
disableSelection: (function () {
|
|
var e = "onselectstart" in document.createElement("div") ? "selectstart" : "mousedown";
|
|
return function () {
|
|
return this.bind(e + ".ui-disableSelection", function (e) {
|
|
e.preventDefault();
|
|
});
|
|
};
|
|
})(),
|
|
enableSelection: function () {
|
|
return this.unbind(".ui-disableSelection");
|
|
},
|
|
zIndex: function (t) {
|
|
if (void 0 !== t) return this.css("zIndex", t);
|
|
if (this.length)
|
|
for (var i, s, n = e(this[0]); n.length && n[0] !== document; ) {
|
|
if (
|
|
((i = n.css("position")),
|
|
("absolute" === i || "relative" === i || "fixed" === i) &&
|
|
((s = parseInt(n.css("zIndex"), 10)), !isNaN(s) && 0 !== s))
|
|
)
|
|
return s;
|
|
n = n.parent();
|
|
}
|
|
return 0;
|
|
},
|
|
}),
|
|
(e.ui.plugin = {
|
|
add: function (t, i, s) {
|
|
var n,
|
|
a = e.ui[t].prototype;
|
|
for (n in s) (a.plugins[n] = a.plugins[n] || []), a.plugins[n].push([i, s[n]]);
|
|
},
|
|
call: function (e, t, i, s) {
|
|
var n,
|
|
a = e.plugins[t];
|
|
if (a && (s || (e.element[0].parentNode && 11 !== e.element[0].parentNode.nodeType)))
|
|
for (n = 0; a.length > n; n++) e.options[a[n][0]] && a[n][1].apply(e.element, i);
|
|
},
|
|
});
|
|
var s = 0,
|
|
n = Array.prototype.slice;
|
|
(e.cleanData = (function (t) {
|
|
return function (i) {
|
|
var s, n, a;
|
|
for (a = 0; null != (n = i[a]); a++)
|
|
try {
|
|
(s = e._data(n, "events")), s && s.remove && e(n).triggerHandler("remove");
|
|
} catch (o) {}
|
|
t(i);
|
|
};
|
|
})(e.cleanData)),
|
|
(e.widget = function (t, i, s) {
|
|
var n,
|
|
a,
|
|
o,
|
|
r,
|
|
h = {},
|
|
l = t.split(".")[0];
|
|
return (
|
|
(t = t.split(".")[1]),
|
|
(n = l + "-" + t),
|
|
s || ((s = i), (i = e.Widget)),
|
|
(e.expr[":"][n.toLowerCase()] = function (t) {
|
|
return !!e.data(t, n);
|
|
}),
|
|
(e[l] = e[l] || {}),
|
|
(a = e[l][t]),
|
|
(o = e[l][t] =
|
|
function (e, t) {
|
|
return this._createWidget
|
|
? (arguments.length && this._createWidget(e, t), void 0)
|
|
: new o(e, t);
|
|
}),
|
|
e.extend(o, a, { version: s.version, _proto: e.extend({}, s), _childConstructors: [] }),
|
|
(r = new i()),
|
|
(r.options = e.widget.extend({}, r.options)),
|
|
e.each(s, function (t, s) {
|
|
return e.isFunction(s)
|
|
? ((h[t] = (function () {
|
|
var e = function () {
|
|
return i.prototype[t].apply(this, arguments);
|
|
},
|
|
n = function (e) {
|
|
return i.prototype[t].apply(this, e);
|
|
};
|
|
return function () {
|
|
var t,
|
|
i = this._super,
|
|
a = this._superApply;
|
|
return (
|
|
(this._super = e),
|
|
(this._superApply = n),
|
|
(t = s.apply(this, arguments)),
|
|
(this._super = i),
|
|
(this._superApply = a),
|
|
t
|
|
);
|
|
};
|
|
})()),
|
|
void 0)
|
|
: ((h[t] = s), void 0);
|
|
}),
|
|
(o.prototype = e.widget.extend(r, { widgetEventPrefix: a ? r.widgetEventPrefix || t : t }, h, {
|
|
constructor: o,
|
|
namespace: l,
|
|
widgetName: t,
|
|
widgetFullName: n,
|
|
})),
|
|
a
|
|
? (e.each(a._childConstructors, function (t, i) {
|
|
var s = i.prototype;
|
|
e.widget(s.namespace + "." + s.widgetName, o, i._proto);
|
|
}),
|
|
delete a._childConstructors)
|
|
: i._childConstructors.push(o),
|
|
e.widget.bridge(t, o),
|
|
o
|
|
);
|
|
}),
|
|
(e.widget.extend = function (t) {
|
|
for (var i, s, a = n.call(arguments, 1), o = 0, r = a.length; r > o; o++)
|
|
for (i in a[o])
|
|
(s = a[o][i]),
|
|
a[o].hasOwnProperty(i) &&
|
|
void 0 !== s &&
|
|
(t[i] = e.isPlainObject(s)
|
|
? e.isPlainObject(t[i])
|
|
? e.widget.extend({}, t[i], s)
|
|
: e.widget.extend({}, s)
|
|
: s);
|
|
return t;
|
|
}),
|
|
(e.widget.bridge = function (t, i) {
|
|
var s = i.prototype.widgetFullName || t;
|
|
e.fn[t] = function (a) {
|
|
var o = "string" == typeof a,
|
|
r = n.call(arguments, 1),
|
|
h = this;
|
|
return (
|
|
o
|
|
? this.each(function () {
|
|
var i,
|
|
n = e.data(this, s);
|
|
return "instance" === a
|
|
? ((h = n), !1)
|
|
: n
|
|
? e.isFunction(n[a]) && "_" !== a.charAt(0)
|
|
? ((i = n[a].apply(n, r)),
|
|
i !== n && void 0 !== i
|
|
? ((h = i && i.jquery ? h.pushStack(i.get()) : i), !1)
|
|
: void 0)
|
|
: e.error("no such method '" + a + "' for " + t + " widget instance")
|
|
: e.error(
|
|
"cannot call methods on " +
|
|
t +
|
|
" prior to initialization; " +
|
|
"attempted to call method '" +
|
|
a +
|
|
"'"
|
|
);
|
|
})
|
|
: (r.length && (a = e.widget.extend.apply(null, [a].concat(r))),
|
|
this.each(function () {
|
|
var t = e.data(this, s);
|
|
t ? (t.option(a || {}), t._init && t._init()) : e.data(this, s, new i(a, this));
|
|
})),
|
|
h
|
|
);
|
|
};
|
|
}),
|
|
(e.Widget = function () {}),
|
|
(e.Widget._childConstructors = []),
|
|
(e.Widget.prototype = {
|
|
widgetName: "widget",
|
|
widgetEventPrefix: "",
|
|
defaultElement: "<div>",
|
|
options: { disabled: !1, create: null },
|
|
_createWidget: function (t, i) {
|
|
(i = e(i || this.defaultElement || this)[0]),
|
|
(this.element = e(i)),
|
|
(this.uuid = s++),
|
|
(this.eventNamespace = "." + this.widgetName + this.uuid),
|
|
(this.bindings = e()),
|
|
(this.hoverable = e()),
|
|
(this.focusable = e()),
|
|
i !== this &&
|
|
(e.data(i, this.widgetFullName, this),
|
|
this._on(!0, this.element, {
|
|
remove: function (e) {
|
|
e.target === i && this.destroy();
|
|
},
|
|
}),
|
|
(this.document = e(i.style ? i.ownerDocument : i.document || i)),
|
|
(this.window = e(this.document[0].defaultView || this.document[0].parentWindow))),
|
|
(this.options = e.widget.extend({}, this.options, this._getCreateOptions(), t)),
|
|
this._create(),
|
|
this._trigger("create", null, this._getCreateEventData()),
|
|
this._init();
|
|
},
|
|
_getCreateOptions: e.noop,
|
|
_getCreateEventData: e.noop,
|
|
_create: e.noop,
|
|
_init: e.noop,
|
|
destroy: function () {
|
|
this._destroy(),
|
|
this.element
|
|
.unbind(this.eventNamespace)
|
|
.removeData(this.widgetFullName)
|
|
.removeData(e.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: e.noop,
|
|
widget: function () {
|
|
return this.element;
|
|
},
|
|
option: function (t, i) {
|
|
var s,
|
|
n,
|
|
a,
|
|
o = t;
|
|
if (0 === arguments.length) return e.widget.extend({}, this.options);
|
|
if ("string" == typeof t)
|
|
if (((o = {}), (s = t.split(".")), (t = s.shift()), s.length)) {
|
|
for (n = o[t] = e.widget.extend({}, this.options[t]), a = 0; s.length - 1 > a; a++)
|
|
(n[s[a]] = n[s[a]] || {}), (n = n[s[a]]);
|
|
if (((t = s.pop()), 1 === arguments.length)) return void 0 === n[t] ? null : n[t];
|
|
n[t] = i;
|
|
} else {
|
|
if (1 === arguments.length) return void 0 === this.options[t] ? null : this.options[t];
|
|
o[t] = i;
|
|
}
|
|
return this._setOptions(o), this;
|
|
},
|
|
_setOptions: function (e) {
|
|
var t;
|
|
for (t in e) this._setOption(t, e[t]);
|
|
return this;
|
|
},
|
|
_setOption: function (e, t) {
|
|
return (
|
|
(this.options[e] = t),
|
|
"disabled" === e &&
|
|
(this.widget().toggleClass(this.widgetFullName + "-disabled", !!t),
|
|
t &&
|
|
(this.hoverable.removeClass("ui-state-hover"),
|
|
this.focusable.removeClass("ui-state-focus"))),
|
|
this
|
|
);
|
|
},
|
|
enable: function () {
|
|
return this._setOptions({ disabled: !1 });
|
|
},
|
|
disable: function () {
|
|
return this._setOptions({ disabled: !0 });
|
|
},
|
|
_on: function (t, i, s) {
|
|
var n,
|
|
a = this;
|
|
"boolean" != typeof t && ((s = i), (i = t), (t = !1)),
|
|
s
|
|
? ((i = n = e(i)), (this.bindings = this.bindings.add(i)))
|
|
: ((s = i), (i = this.element), (n = this.widget())),
|
|
e.each(s, function (s, o) {
|
|
function r() {
|
|
return t || (a.options.disabled !== !0 && !e(this).hasClass("ui-state-disabled"))
|
|
? ("string" == typeof o ? a[o] : o).apply(a, arguments)
|
|
: void 0;
|
|
}
|
|
"string" != typeof o && (r.guid = o.guid = o.guid || r.guid || e.guid++);
|
|
var h = s.match(/^([\w:-]*)\s*(.*)$/),
|
|
l = h[1] + a.eventNamespace,
|
|
u = h[2];
|
|
u ? n.delegate(u, l, r) : i.bind(l, r);
|
|
});
|
|
},
|
|
_off: function (t, i) {
|
|
(i = (i || "").split(" ").join(this.eventNamespace + " ") + this.eventNamespace),
|
|
t.unbind(i).undelegate(i),
|
|
(this.bindings = e(this.bindings.not(t).get())),
|
|
(this.focusable = e(this.focusable.not(t).get())),
|
|
(this.hoverable = e(this.hoverable.not(t).get()));
|
|
},
|
|
_delay: function (e, t) {
|
|
function i() {
|
|
return ("string" == typeof e ? s[e] : e).apply(s, arguments);
|
|
}
|
|
var s = this;
|
|
return setTimeout(i, t || 0);
|
|
},
|
|
_hoverable: function (t) {
|
|
(this.hoverable = this.hoverable.add(t)),
|
|
this._on(t, {
|
|
mouseenter: function (t) {
|
|
e(t.currentTarget).addClass("ui-state-hover");
|
|
},
|
|
mouseleave: function (t) {
|
|
e(t.currentTarget).removeClass("ui-state-hover");
|
|
},
|
|
});
|
|
},
|
|
_focusable: function (t) {
|
|
(this.focusable = this.focusable.add(t)),
|
|
this._on(t, {
|
|
focusin: function (t) {
|
|
e(t.currentTarget).addClass("ui-state-focus");
|
|
},
|
|
focusout: function (t) {
|
|
e(t.currentTarget).removeClass("ui-state-focus");
|
|
},
|
|
});
|
|
},
|
|
_trigger: function (t, i, s) {
|
|
var n,
|
|
a,
|
|
o = this.options[t];
|
|
if (
|
|
((s = s || {}),
|
|
(i = e.Event(i)),
|
|
(i.type = (t === this.widgetEventPrefix ? t : this.widgetEventPrefix + t).toLowerCase()),
|
|
(i.target = this.element[0]),
|
|
(a = i.originalEvent))
|
|
)
|
|
for (n in a) n in i || (i[n] = a[n]);
|
|
return (
|
|
this.element.trigger(i, s),
|
|
!((e.isFunction(o) && o.apply(this.element[0], [i].concat(s)) === !1) || i.isDefaultPrevented())
|
|
);
|
|
},
|
|
}),
|
|
e.each({ show: "fadeIn", hide: "fadeOut" }, function (t, i) {
|
|
e.Widget.prototype["_" + t] = function (s, n, a) {
|
|
"string" == typeof n && (n = { effect: n });
|
|
var o,
|
|
r = n ? (n === !0 || "number" == typeof n ? i : n.effect || i) : t;
|
|
(n = n || {}),
|
|
"number" == typeof n && (n = { duration: n }),
|
|
(o = !e.isEmptyObject(n)),
|
|
(n.complete = a),
|
|
n.delay && s.delay(n.delay),
|
|
o && e.effects && e.effects.effect[r]
|
|
? s[t](n)
|
|
: r !== t && s[r]
|
|
? s[r](n.duration, n.easing, a)
|
|
: s.queue(function (i) {
|
|
e(this)[t](), a && a.call(s[0]), i();
|
|
});
|
|
};
|
|
}),
|
|
e.widget,
|
|
e.widget("ui.accordion", {
|
|
version: "1.11.4",
|
|
options: {
|
|
active: 0,
|
|
animate: {},
|
|
collapsible: !1,
|
|
event: "click",
|
|
header: "> li > :first-child,> :not(li):even",
|
|
heightStyle: "auto",
|
|
icons: { activeHeader: "ui-icon-triangle-1-s", header: "ui-icon-triangle-1-e" },
|
|
activate: null,
|
|
beforeActivate: null,
|
|
},
|
|
hideProps: {
|
|
borderTopWidth: "hide",
|
|
borderBottomWidth: "hide",
|
|
paddingTop: "hide",
|
|
paddingBottom: "hide",
|
|
height: "hide",
|
|
},
|
|
showProps: {
|
|
borderTopWidth: "show",
|
|
borderBottomWidth: "show",
|
|
paddingTop: "show",
|
|
paddingBottom: "show",
|
|
height: "show",
|
|
},
|
|
_create: function () {
|
|
var t = this.options;
|
|
(this.prevShow = this.prevHide = e()),
|
|
this.element.addClass("ui-accordion ui-widget ui-helper-reset").attr("role", "tablist"),
|
|
t.collapsible || (t.active !== !1 && null != t.active) || (t.active = 0),
|
|
this._processPanels(),
|
|
0 > t.active && (t.active += this.headers.length),
|
|
this._refresh();
|
|
},
|
|
_getCreateEventData: function () {
|
|
return { header: this.active, panel: this.active.length ? this.active.next() : e() };
|
|
},
|
|
_createIcons: function () {
|
|
var t = this.options.icons;
|
|
t &&
|
|
(e("<span>")
|
|
.addClass("ui-accordion-header-icon ui-icon " + t.header)
|
|
.prependTo(this.headers),
|
|
this.active.children(".ui-accordion-header-icon").removeClass(t.header).addClass(t.activeHeader),
|
|
this.headers.addClass("ui-accordion-icons"));
|
|
},
|
|
_destroyIcons: function () {
|
|
this.headers.removeClass("ui-accordion-icons").children(".ui-accordion-header-icon").remove();
|
|
},
|
|
_destroy: function () {
|
|
var e;
|
|
this.element.removeClass("ui-accordion ui-widget ui-helper-reset").removeAttr("role"),
|
|
this.headers
|
|
.removeClass(
|
|
"ui-accordion-header ui-accordion-header-active ui-state-default ui-corner-all ui-state-active ui-state-disabled ui-corner-top"
|
|
)
|
|
.removeAttr("role")
|
|
.removeAttr("aria-expanded")
|
|
.removeAttr("aria-selected")
|
|
.removeAttr("aria-controls")
|
|
.removeAttr("tabIndex")
|
|
.removeUniqueId(),
|
|
this._destroyIcons(),
|
|
(e = this.headers
|
|
.next()
|
|
.removeClass(
|
|
"ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-state-disabled"
|
|
)
|
|
.css("display", "")
|
|
.removeAttr("role")
|
|
.removeAttr("aria-hidden")
|
|
.removeAttr("aria-labelledby")
|
|
.removeUniqueId()),
|
|
"content" !== this.options.heightStyle && e.css("height", "");
|
|
},
|
|
_setOption: function (e, t) {
|
|
return "active" === e
|
|
? (this._activate(t), void 0)
|
|
: ("event" === e &&
|
|
(this.options.event && this._off(this.headers, this.options.event), this._setupEvents(t)),
|
|
this._super(e, t),
|
|
"collapsible" !== e || t || this.options.active !== !1 || this._activate(0),
|
|
"icons" === e && (this._destroyIcons(), t && this._createIcons()),
|
|
"disabled" === e &&
|
|
(this.element.toggleClass("ui-state-disabled", !!t).attr("aria-disabled", t),
|
|
this.headers.add(this.headers.next()).toggleClass("ui-state-disabled", !!t)),
|
|
void 0);
|
|
},
|
|
_keydown: function (t) {
|
|
if (!t.altKey && !t.ctrlKey) {
|
|
var i = e.ui.keyCode,
|
|
s = this.headers.length,
|
|
n = this.headers.index(t.target),
|
|
a = !1;
|
|
switch (t.keyCode) {
|
|
case i.RIGHT:
|
|
case i.DOWN:
|
|
a = this.headers[(n + 1) % s];
|
|
break;
|
|
case i.LEFT:
|
|
case i.UP:
|
|
a = this.headers[(n - 1 + s) % s];
|
|
break;
|
|
case i.SPACE:
|
|
case i.ENTER:
|
|
this._eventHandler(t);
|
|
break;
|
|
case i.HOME:
|
|
a = this.headers[0];
|
|
break;
|
|
case i.END:
|
|
a = this.headers[s - 1];
|
|
}
|
|
a && (e(t.target).attr("tabIndex", -1), e(a).attr("tabIndex", 0), a.focus(), t.preventDefault());
|
|
}
|
|
},
|
|
_panelKeyDown: function (t) {
|
|
t.keyCode === e.ui.keyCode.UP && t.ctrlKey && e(t.currentTarget).prev().focus();
|
|
},
|
|
refresh: function () {
|
|
var t = this.options;
|
|
this._processPanels(),
|
|
(t.active === !1 && t.collapsible === !0) || !this.headers.length
|
|
? ((t.active = !1), (this.active = e()))
|
|
: t.active === !1
|
|
? this._activate(0)
|
|
: this.active.length && !e.contains(this.element[0], this.active[0])
|
|
? this.headers.length === this.headers.find(".ui-state-disabled").length
|
|
? ((t.active = !1), (this.active = e()))
|
|
: this._activate(Math.max(0, t.active - 1))
|
|
: (t.active = this.headers.index(this.active)),
|
|
this._destroyIcons(),
|
|
this._refresh();
|
|
},
|
|
_processPanels: function () {
|
|
var e = this.headers,
|
|
t = this.panels;
|
|
(this.headers = this.element
|
|
.find(this.options.header)
|
|
.addClass("ui-accordion-header ui-state-default ui-corner-all")),
|
|
(this.panels = this.headers
|
|
.next()
|
|
.addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom")
|
|
.filter(":not(.ui-accordion-content-active)")
|
|
.hide()),
|
|
t && (this._off(e.not(this.headers)), this._off(t.not(this.panels)));
|
|
},
|
|
_refresh: function () {
|
|
var t,
|
|
i = this.options,
|
|
s = i.heightStyle,
|
|
n = this.element.parent();
|
|
(this.active = this._findActive(i.active)
|
|
.addClass("ui-accordion-header-active ui-state-active ui-corner-top")
|
|
.removeClass("ui-corner-all")),
|
|
this.active.next().addClass("ui-accordion-content-active").show(),
|
|
this.headers
|
|
.attr("role", "tab")
|
|
.each(function () {
|
|
var t = e(this),
|
|
i = t.uniqueId().attr("id"),
|
|
s = t.next(),
|
|
n = s.uniqueId().attr("id");
|
|
t.attr("aria-controls", n), s.attr("aria-labelledby", i);
|
|
})
|
|
.next()
|
|
.attr("role", "tabpanel"),
|
|
this.headers
|
|
.not(this.active)
|
|
.attr({ "aria-selected": "false", "aria-expanded": "false", tabIndex: -1 })
|
|
.next()
|
|
.attr({ "aria-hidden": "true" })
|
|
.hide(),
|
|
this.active.length
|
|
? this.active
|
|
.attr({ "aria-selected": "true", "aria-expanded": "true", tabIndex: 0 })
|
|
.next()
|
|
.attr({ "aria-hidden": "false" })
|
|
: this.headers.eq(0).attr("tabIndex", 0),
|
|
this._createIcons(),
|
|
this._setupEvents(i.event),
|
|
"fill" === s
|
|
? ((t = n.height()),
|
|
this.element.siblings(":visible").each(function () {
|
|
var i = e(this),
|
|
s = i.css("position");
|
|
"absolute" !== s && "fixed" !== s && (t -= i.outerHeight(!0));
|
|
}),
|
|
this.headers.each(function () {
|
|
t -= e(this).outerHeight(!0);
|
|
}),
|
|
this.headers
|
|
.next()
|
|
.each(function () {
|
|
e(this).height(Math.max(0, t - e(this).innerHeight() + e(this).height()));
|
|
})
|
|
.css("overflow", "auto"))
|
|
: "auto" === s &&
|
|
((t = 0),
|
|
this.headers
|
|
.next()
|
|
.each(function () {
|
|
t = Math.max(t, e(this).css("height", "").height());
|
|
})
|
|
.height(t));
|
|
},
|
|
_activate: function (t) {
|
|
var i = this._findActive(t)[0];
|
|
i !== this.active[0] &&
|
|
((i = i || this.active[0]),
|
|
this._eventHandler({ target: i, currentTarget: i, preventDefault: e.noop }));
|
|
},
|
|
_findActive: function (t) {
|
|
return "number" == typeof t ? this.headers.eq(t) : e();
|
|
},
|
|
_setupEvents: function (t) {
|
|
var i = { keydown: "_keydown" };
|
|
t &&
|
|
e.each(t.split(" "), function (e, t) {
|
|
i[t] = "_eventHandler";
|
|
}),
|
|
this._off(this.headers.add(this.headers.next())),
|
|
this._on(this.headers, i),
|
|
this._on(this.headers.next(), { keydown: "_panelKeyDown" }),
|
|
this._hoverable(this.headers),
|
|
this._focusable(this.headers);
|
|
},
|
|
_eventHandler: function (t) {
|
|
var i = this.options,
|
|
s = this.active,
|
|
n = e(t.currentTarget),
|
|
a = n[0] === s[0],
|
|
o = a && i.collapsible,
|
|
r = o ? e() : n.next(),
|
|
h = s.next(),
|
|
l = { oldHeader: s, oldPanel: h, newHeader: o ? e() : n, newPanel: r };
|
|
t.preventDefault(),
|
|
(a && !i.collapsible) ||
|
|
this._trigger("beforeActivate", t, l) === !1 ||
|
|
((i.active = o ? !1 : this.headers.index(n)),
|
|
(this.active = a ? e() : n),
|
|
this._toggle(l),
|
|
s.removeClass("ui-accordion-header-active ui-state-active"),
|
|
i.icons &&
|
|
s
|
|
.children(".ui-accordion-header-icon")
|
|
.removeClass(i.icons.activeHeader)
|
|
.addClass(i.icons.header),
|
|
a ||
|
|
(n
|
|
.removeClass("ui-corner-all")
|
|
.addClass("ui-accordion-header-active ui-state-active ui-corner-top"),
|
|
i.icons &&
|
|
n
|
|
.children(".ui-accordion-header-icon")
|
|
.removeClass(i.icons.header)
|
|
.addClass(i.icons.activeHeader),
|
|
n.next().addClass("ui-accordion-content-active")));
|
|
},
|
|
_toggle: function (t) {
|
|
var i = t.newPanel,
|
|
s = this.prevShow.length ? this.prevShow : t.oldPanel;
|
|
this.prevShow.add(this.prevHide).stop(!0, !0),
|
|
(this.prevShow = i),
|
|
(this.prevHide = s),
|
|
this.options.animate ? this._animate(i, s, t) : (s.hide(), i.show(), this._toggleComplete(t)),
|
|
s.attr({ "aria-hidden": "true" }),
|
|
s.prev().attr({ "aria-selected": "false", "aria-expanded": "false" }),
|
|
i.length && s.length
|
|
? s.prev().attr({ tabIndex: -1, "aria-expanded": "false" })
|
|
: i.length &&
|
|
this.headers
|
|
.filter(function () {
|
|
return 0 === parseInt(e(this).attr("tabIndex"), 10);
|
|
})
|
|
.attr("tabIndex", -1),
|
|
i
|
|
.attr("aria-hidden", "false")
|
|
.prev()
|
|
.attr({ "aria-selected": "true", "aria-expanded": "true", tabIndex: 0 });
|
|
},
|
|
_animate: function (e, t, i) {
|
|
var s,
|
|
n,
|
|
a,
|
|
o = this,
|
|
r = 0,
|
|
h = e.css("box-sizing"),
|
|
l = e.length && (!t.length || e.index() < t.index()),
|
|
u = this.options.animate || {},
|
|
d = (l && u.down) || u,
|
|
c = function () {
|
|
o._toggleComplete(i);
|
|
};
|
|
return (
|
|
"number" == typeof d && (a = d),
|
|
"string" == typeof d && (n = d),
|
|
(n = n || d.easing || u.easing),
|
|
(a = a || d.duration || u.duration),
|
|
t.length
|
|
? e.length
|
|
? ((s = e.show().outerHeight()),
|
|
t.animate(this.hideProps, {
|
|
duration: a,
|
|
easing: n,
|
|
step: function (e, t) {
|
|
t.now = Math.round(e);
|
|
},
|
|
}),
|
|
e.hide().animate(this.showProps, {
|
|
duration: a,
|
|
easing: n,
|
|
complete: c,
|
|
step: function (e, i) {
|
|
(i.now = Math.round(e)),
|
|
"height" !== i.prop
|
|
? "content-box" === h && (r += i.now)
|
|
: "content" !== o.options.heightStyle &&
|
|
((i.now = Math.round(s - t.outerHeight() - r)), (r = 0));
|
|
},
|
|
}),
|
|
void 0)
|
|
: t.animate(this.hideProps, a, n, c)
|
|
: e.animate(this.showProps, a, n, c)
|
|
);
|
|
},
|
|
_toggleComplete: function (e) {
|
|
var t = e.oldPanel;
|
|
t
|
|
.removeClass("ui-accordion-content-active")
|
|
.prev()
|
|
.removeClass("ui-corner-top")
|
|
.addClass("ui-corner-all"),
|
|
t.length && (t.parent()[0].className = t.parent()[0].className),
|
|
this._trigger("activate", null, e);
|
|
},
|
|
});
|
|
});
|