﻿(function(C) { C.ui = { plugin: { add: function(E, F, H) { var G = C.ui[E].prototype; for (var D in H) { G.plugins[D] = G.plugins[D] || []; G.plugins[D].push([F, H[D]]) } }, call: function(D, F, E) { var H = D.plugins[F]; if (!H) { return } for (var G = 0; G < H.length; G++) { if (D.options[H[G][0]]) { H[G][1].apply(D.element, E) } } } }, cssCache: {}, css: function(D) { if (C.ui.cssCache[D]) { return C.ui.cssCache[D] } var E = C('<div class="ui-gen">').addClass(D).css({ position: "absolute", top: "-5000px", left: "-5000px", display: "block" }).appendTo("body"); C.ui.cssCache[D] = !!((!(/auto|default/).test(E.css("cursor")) || (/^[1-9]/).test(E.css("height")) || (/^[1-9]/).test(E.css("width")) || !(/none/).test(E.css("backgroundImage")) || !(/transparent|rgba\(0, 0, 0, 0\)/).test(E.css("backgroundColor")))); try { C("body").get(0).removeChild(E.get(0)) } catch (F) { } return C.ui.cssCache[D] }, disableSelection: function(D) { C(D).attr("unselectable", "on").css("MozUserSelect", "none") }, enableSelection: function(D) { C(D).attr("unselectable", "off").css("MozUserSelect", "") }, hasScroll: function(G, E) { var D = /top/.test(E || "top") ? "scrollTop" : "scrollLeft", F = false; if (G[D] > 0) { return true } G[D] = 1; F = G[D] > 0 ? true : false; G[D] = 0; return F } }; var B = C.fn.remove; C.fn.remove = function() { C("*", this).add(this).triggerHandler("remove"); return B.apply(this, arguments) }; function A(E, F, G) { var D = C[E][F].getter || []; D = (typeof D == "string" ? D.split(/,?\s+/) : D); return (C.inArray(G, D) != -1) } C.widget = function(E, D) { var F = E.split(".")[0]; E = E.split(".")[1]; C.fn[E] = function(J) { var H = (typeof J == "string"), I = Array.prototype.slice.call(arguments, 1); if (H && A(F, E, J)) { var G = C.data(this[0], E); return (G ? G[J].apply(G, I) : undefined) } return this.each(function() { var K = C.data(this, E); if (H && K && C.isFunction(K[J])) { K[J].apply(K, I) } else { if (!H) { C.data(this, E, new C[F][E](this, J)) } } }) }; C[F][E] = function(I, H) { var G = this; this.widgetName = E; this.widgetBaseClass = F + "-" + E; this.options = C.extend({}, C.widget.defaults, C[F][E].defaults, H); this.element = C(I).bind("setData." + E, function(L, J, K) { return G.setData(J, K) }).bind("getData." + E, function(K, J) { return G.getData(J) }).bind("remove", function() { return G.destroy() }); this.init() }; C[F][E].prototype = C.extend({}, C.widget.prototype, D) }; C.widget.prototype = { init: function() { }, destroy: function() { this.element.removeData(this.widgetName) }, getData: function(D) { return this.options[D] }, setData: function(D, E) { this.options[D] = E; if (D == "disabled") { this.element[E ? "addClass" : "removeClass"](this.widgetBaseClass + "-disabled") } }, enable: function() { this.setData("disabled", false) }, disable: function() { this.setData("disabled", true) } }; C.widget.defaults = { disabled: false }; C.ui.mouse = { mouseInit: function() { var D = this; this.element.bind("mousedown." + this.widgetName, function(E) { return D.mouseDown(E) }); if (C.browser.msie) { this._mouseUnselectable = this.element.attr("unselectable"); this.element.attr("unselectable", "on") } this.started = false }, mouseDestroy: function() { this.element.unbind("." + this.widgetName); (C.browser.msie && this.element.attr("unselectable", this._mouseUnselectable)) }, mouseDown: function(F) { (this._mouseStarted && this.mouseUp(F)); this._mouseDownEvent = F; var E = this, G = (F.which == 1), D = (typeof this.options.cancel == "string" ? C(F.target).parents().add(F.target).filter(this.options.cancel).length : false); if (!G || D || !this.mouseCapture(F)) { return true } this._mouseDelayMet = !this.options.delay; if (!this._mouseDelayMet) { this._mouseDelayTimer = setTimeout(function() { E._mouseDelayMet = true }, this.options.delay) } if (this.mouseDistanceMet(F) && this.mouseDelayMet(F)) { this._mouseStarted = (this.mouseStart(F) !== false); if (!this._mouseStarted) { F.preventDefault(); return true } } this._mouseMoveDelegate = function(H) { return E.mouseMove(H) }; this._mouseUpDelegate = function(H) { return E.mouseUp(H) }; C(document).bind("mousemove." + this.widgetName, this._mouseMoveDelegate).bind("mouseup." + this.widgetName, this._mouseUpDelegate); return false }, mouseMove: function(D) { if (C.browser.msie && !D.button) { return this.mouseUp(D) } if (this._mouseStarted) { this.mouseDrag(D); return false } if (this.mouseDistanceMet(D) && this.mouseDelayMet(D)) { this._mouseStarted = (this.mouseStart(this._mouseDownEvent, D) !== false); (this._mouseStarted ? this.mouseDrag(D) : this.mouseUp(D)) } return !this._mouseStarted }, mouseUp: function(D) { C(document).unbind("mousemove." + this.widgetName, this._mouseMoveDelegate).unbind("mouseup." + this.widgetName, this._mouseUpDelegate); if (this._mouseStarted) { this._mouseStarted = false; this.mouseStop(D) } return false }, mouseDistanceMet: function(D) { return (Math.max(Math.abs(this._mouseDownEvent.pageX - D.pageX), Math.abs(this._mouseDownEvent.pageY - D.pageY)) >= this.options.distance) }, mouseDelayMet: function(D) { return this._mouseDelayMet }, mouseStart: function(D) { }, mouseDrag: function(D) { }, mouseStop: function(D) { }, mouseCapture: function(D) { return true } }; C.ui.mouse.defaults = { cancel: null, distance: 1, delay: 0} })(jQuery); (function(A) { A.widget("ui.tabs", { init: function() { this.options.event += ".tabs"; this.tabify(true) }, setData: function(B, C) { if ((/^selected/).test(B)) { this.select(C) } else { this.options[B] = C; this.tabify() } }, length: function() { return this.$tabs.length }, tabId: function(B) { return B.title && B.title.replace(/\s/g, "_").replace(/[^A-Za-z0-9\-_:\.]/g, "") || this.options.idPrefix + A.data(B) }, ui: function(C, B) { return { options: this.options, tab: C, panel: B, index: this.$tabs.index(C)} }, tabify: function(O) { this.$lis = A("li:has(a[href])", this.element); this.$tabs = this.$lis.map(function() { return A("a", this)[0] }); this.$panels = A([]); var P = this, D = this.options; this.$tabs.each(function(R, Q) { if (Q.hash && Q.hash.replace("#", "")) { P.$panels = P.$panels.add(Q.hash) } else { if (A(Q).attr("href") != "#") { A.data(Q, "href.tabs", Q.href); A.data(Q, "load.tabs", Q.href); var T = P.tabId(Q); Q.href = "#" + T; var S = A("#" + T); if (!S.length) { S = A(D.panelTemplate).attr("id", T).addClass(D.panelClass).insertAfter(P.$panels[R - 1] || P.element); S.data("destroy.tabs", true) } P.$panels = P.$panels.add(S) } else { D.disabled.push(R + 1) } } }); if (O) { this.element.addClass(D.navClass); this.$panels.each(function() { var Q = A(this); Q.addClass(D.panelClass) }); if (D.selected === undefined) { if (location.hash) { this.$tabs.each(function(S, Q) { if (Q.hash == location.hash) { D.selected = S; if (A.browser.msie || A.browser.opera) { var R = A(location.hash), T = R.attr("id"); R.attr("id", ""); setTimeout(function() { R.attr("id", T) }, 500) } scrollTo(0, 0); return false } }) } else { if (D.cookie) { var J = parseInt(A.cookie("ui-tabs" + A.data(P.element)), 10); if (J && P.$tabs[J]) { D.selected = J } } else { if (P.$lis.filter("." + D.selectedClass).length) { D.selected = P.$lis.index(P.$lis.filter("." + D.selectedClass)[0]) } } } } D.selected = D.selected === null || D.selected !== undefined ? D.selected : 0; D.disabled = A.unique(D.disabled.concat(A.map(this.$lis.filter("." + D.disabledClass), function(R, Q) { return P.$lis.index(R) }))).sort(); if (A.inArray(D.selected, D.disabled) != -1) { D.disabled.splice(A.inArray(D.selected, D.disabled), 1) } this.$panels.addClass(D.hideClass); this.$lis.removeClass(D.selectedClass); if (D.selected !== null) { this.$panels.eq(D.selected).show().removeClass(D.hideClass); this.$lis.eq(D.selected).addClass(D.selectedClass); var K = function() { A(P.element).triggerHandler("tabsshow", [P.fakeEvent("tabsshow"), P.ui(P.$tabs[D.selected], P.$panels[D.selected])], D.show) }; if (A.data(this.$tabs[D.selected], "load.tabs")) { this.load(D.selected, K) } else { K() } } A(window).bind("unload", function() { P.$tabs.unbind(".tabs"); P.$lis = P.$tabs = P.$panels = null }) } for (var G = 0, N; N = this.$lis[G]; G++) { A(N)[A.inArray(G, D.disabled) != -1 && !A(N).hasClass(D.selectedClass) ? "addClass" : "removeClass"](D.disabledClass) } if (D.cache === false) { this.$tabs.removeData("cache.tabs") } var C, I, B = { "min-width": 0, duration: 1 }, E = "normal"; if (D.fx && D.fx.constructor == Array) { C = D.fx[0] || B, I = D.fx[1] || B } else { C = I = D.fx || B } var H = { display: "", overflow: "", height: "" }; if (!A.browser.msie) { H.opacity = "" } function M(R, Q, S) { Q.animate(C, C.duration || E, function() { Q.addClass(D.hideClass).css(H); if (A.browser.msie && C.opacity) { Q[0].style.filter = "" } if (S) { L(R, S, Q) } }) } function L(R, S, Q) { if (I === B) { S.css("display", "block") } S.animate(I, I.duration || E, function() { S.removeClass(D.hideClass).css(H); if (A.browser.msie && I.opacity) { S[0].style.filter = "" } A(P.element).triggerHandler("tabsshow", [P.fakeEvent("tabsshow"), P.ui(R, S[0])], D.show) }) } function F(R, T, Q, S) { T.addClass(D.selectedClass).siblings().removeClass(D.selectedClass); M(R, Q, S) } this.$tabs.unbind(".tabs").bind(D.event, function() { var T = A(this).parents("li:eq(0)"), Q = P.$panels.filter(":visible"), S = A(this.hash); if ((T.hasClass(D.selectedClass) && !D.unselect) || T.hasClass(D.disabledClass) || A(this).hasClass(D.loadingClass) || A(P.element).triggerHandler("tabsselect", [P.fakeEvent("tabsselect"), P.ui(this, S[0])], D.select) === false) { this.blur(); return false } P.options.selected = P.$tabs.index(this); if (D.unselect) { if (T.hasClass(D.selectedClass)) { P.options.selected = null; T.removeClass(D.selectedClass); P.$panels.stop(); M(this, Q); this.blur(); return false } else { if (!Q.length) { P.$panels.stop(); var R = this; P.load(P.$tabs.index(this), function() { T.addClass(D.selectedClass).addClass(D.unselectClass); L(R, S) }); this.blur(); return false } } } if (D.cookie) { A.cookie("ui-tabs" + A.data(P.element), P.options.selected, D.cookie) } P.$panels.stop(); if (S.length) { var R = this; P.load(P.$tabs.index(this), Q.length ? function() { F(R, T, Q, S) } : function() { T.addClass(D.selectedClass); L(R, S) }) } else { throw "jQuery UI Tabs: Mismatching fragment identifier." } if (A.browser.msie) { this.blur() } return false }); if (!(/^click/).test(D.event)) { this.$tabs.bind("click.tabs", function() { return false }) } }, add: function(E, D, C) { if (C == undefined) { C = this.$tabs.length } var G = this.options; var I = A(G.tabTemplate.replace(/#\{href\}/g, E).replace(/#\{label\}/g, D)); I.data("destroy.tabs", true); var H = E.indexOf("#") == 0 ? E.replace("#", "") : this.tabId(A("a:first-child", I)[0]); var F = A("#" + H); if (!F.length) { F = A(G.panelTemplate).attr("id", H).addClass(G.hideClass).data("destroy.tabs", true) } F.addClass(G.panelClass); if (C >= this.$lis.length) { I.appendTo(this.element); F.appendTo(this.element[0].parentNode) } else { I.insertBefore(this.$lis[C]); F.insertBefore(this.$panels[C]) } G.disabled = A.map(G.disabled, function(K, J) { return K >= C ? ++K : K }); this.tabify(); if (this.$tabs.length == 1) { I.addClass(G.selectedClass); F.removeClass(G.hideClass); var B = A.data(this.$tabs[0], "load.tabs"); if (B) { this.load(C, B) } } this.element.triggerHandler("tabsadd", [this.fakeEvent("tabsadd"), this.ui(this.$tabs[C], this.$panels[C])], G.add) }, remove: function(B) { var D = this.options, E = this.$lis.eq(B).remove(), C = this.$panels.eq(B).remove(); if (E.hasClass(D.selectedClass) && this.$tabs.length > 1) { this.select(B + (B + 1 < this.$tabs.length ? 1 : -1)) } D.disabled = A.map(A.grep(D.disabled, function(G, F) { return G != B }), function(G, F) { return G >= B ? --G : G }); this.tabify(); this.element.triggerHandler("tabsremove", [this.fakeEvent("tabsremove"), this.ui(E.find("a")[0], C[0])], D.remove) }, enable: function(B) { var C = this.options; if (A.inArray(B, C.disabled) == -1) { return } var D = this.$lis.eq(B).removeClass(C.disabledClass); if (A.browser.safari) { D.css("display", "inline-block"); setTimeout(function() { D.css("display", "block") }, 0) } C.disabled = A.grep(C.disabled, function(F, E) { return F != B }); this.element.triggerHandler("tabsenable", [this.fakeEvent("tabsenable"), this.ui(this.$tabs[B], this.$panels[B])], C.enable) }, disable: function(C) { var B = this, D = this.options; if (C != D.selected) { this.$lis.eq(C).addClass(D.disabledClass); D.disabled.push(C); D.disabled.sort(); this.element.triggerHandler("tabsdisable", [this.fakeEvent("tabsdisable"), this.ui(this.$tabs[C], this.$panels[C])], D.disable) } }, select: function(B) { if (typeof B == "string") { B = this.$tabs.index(this.$tabs.filter("[href$=" + B + "]")[0]) } this.$tabs.eq(B).trigger(this.options.event) }, load: function(G, K) { var L = this, D = this.options, E = this.$tabs.eq(G), J = E[0], H = K == undefined || K === false, B = E.data("load.tabs"); K = K || function() { }; if (!B || !H && A.data(J, "cache.tabs")) { K(); return } var M = function(N) { var O = A(N), P = O.find("*:last"); return P.length && P.is(":not(img)") && P || O }; var C = function() { L.$tabs.filter("." + D.loadingClass).removeClass(D.loadingClass).each(function() { if (D.spinner) { M(this).parent().html(M(this).data("label.tabs")) } }); L.xhr = null }; if (D.spinner) { var I = M(J).html(); M(J).wrapInner("<em></em>").find("em").data("label.tabs", I).html(D.spinner) } var F = A.extend({}, D.ajaxOptions, { url: B, success: function(O, N) { A(J.hash).html(O); C(); if (D.cache) { A.data(J, "cache.tabs", true) } A(L.element).triggerHandler("tabsload", [L.fakeEvent("tabsload"), L.ui(L.$tabs[G], L.$panels[G])], D.load); D.ajaxOptions.success && D.ajaxOptions.success(O, N); K() } }); if (this.xhr) { this.xhr.abort(); C() } E.addClass(D.loadingClass); setTimeout(function() { L.xhr = A.ajax(F) }, 0) }, url: function(C, B) { this.$tabs.eq(C).removeData("cache.tabs").data("load.tabs", B) }, destroy: function() { var B = this.options; this.element.unbind(".tabs").removeClass(B.navClass).removeData("tabs"); this.$tabs.each(function() { var C = A.data(this, "href.tabs"); if (C) { this.href = C } var D = A(this).unbind(".tabs"); A.each(["href", "load", "cache"], function(E, F) { D.removeData(F + ".tabs") }) }); this.$lis.add(this.$panels).each(function() { if (A.data(this, "destroy.tabs")) { A(this).remove() } else { A(this).removeClass([B.selectedClass, B.unselectClass, B.disabledClass, B.panelClass, B.hideClass].join(" ")) } }) }, fakeEvent: function(B) { return A.event.fix({ type: B, target: this.element[0] }) } }); A.ui.tabs.defaults = { unselect: false, event: "click", disabled: [], cookie: null, spinner: "Loading&#8230;", cache: false, idPrefix: "ui-tabs-", ajaxOptions: {}, fx: null, tabTemplate: '<li><a href="#{href}"><span>#{label}</span></a></li>', panelTemplate: "<div></div>", navClass: "ui-tabs-nav", selectedClass: "ui-tabs-selected", unselectClass: "ui-tabs-unselect", disabledClass: "ui-tabs-disabled", panelClass: "ui-tabs-panel", hideClass: "ui-tabs-hide", loadingClass: "ui-tabs-loading" }; A.ui.tabs.getter = "length"; A.extend(A.ui.tabs.prototype, { rotation: null, rotate: function(C, F) { F = F || false; var B = this, E = this.options.selected; function G() { B.rotation = setInterval(function() { E = ++E < B.$tabs.length ? E : 0; B.select(E) }, C) } function D(H) { if (!H || H.clientX) { clearInterval(B.rotation) } } if (C) { G(); if (!F) { this.$tabs.bind(this.options.event, D) } else { this.$tabs.bind(this.options.event, function() { D(); E = B.options.selected; G() }) } } else { D(); this.$tabs.unbind(this.options.event, D) } } }) })(jQuery);
