")[0], At = xt.textContent !== r; function It(t) { var e, n, r, a, o, i, l, s = t.aoColumns, u = !1; for (e = 0, r = t.aoData.length; e < r; e++)if (!(l = t.aoData[e])._aFilterData) { for (o = [], n = 0, a = s.length; n < a; n++)s[n].bSearchable ? (null === (i = G(t, e, n, "filter")) && (i = ""), "string" != typeof i && i.toString && (i = i.toString())) : i = "", i.indexOf && -1 !== i.indexOf("&") && (xt.innerHTML = i, i = At ? xt.textContent : xt.innerText), i.replace && (i = i.replace(/[\r\n\u2028]/g, "")), o.push(i); l._aFilterData = o, l._sFilterRow = o.join(" "), u = !0 } return u } function Ft(t) { return { search: t.sSearch, smart: t.bSmart, regex: t.bRegex, caseInsensitive: t.bCaseInsensitive } } function Lt(t) { return { sSearch: t.search, bSmart: t.smart, bRegex: t.regex, bCaseInsensitive: t.caseInsensitive } } function Rt(e) { var n = e.sTableId, r = e.aanFeatures.i, a = t("
", { class: e.oClasses.sInfo, id: r ? null : n + "_info" }); return r || (e.aoDrawCallback.push({ fn: Pt, sName: "information" }), a.attr("role", "status").attr("aria-live", "polite"), t(e.nTable).attr("aria-describedby", n + "_info")), a[0] } function Pt(e) { var n = e.aanFeatures.i; if (0 !== n.length) { var r = e.oLanguage, a = e._iDisplayStart + 1, o = e.fnDisplayEnd(), i = e.fnRecordsTotal(), l = e.fnRecordsDisplay(), s = l ? r.sInfo : r.sInfoEmpty; l !== i && (s += " " + r.sInfoFiltered), s = jt(e, s += r.sInfoPostFix); var u = r.fnInfoCallback; null !== u && (s = u.call(e.oInstance, e, a, o, i, l, s)), t(n).html(s) } } function jt(t, e) { var n = t.fnFormatNumber, r = t._iDisplayStart + 1, a = t._iDisplayLength, o = t.fnRecordsDisplay(), i = -1 === a; return e.replace(/_START_/g, n.call(t, r)).replace(/_END_/g, n.call(t, t.fnDisplayEnd())).replace(/_MAX_/g, n.call(t, t.fnRecordsTotal())).replace(/_TOTAL_/g, n.call(t, o)).replace(/_PAGE_/g, n.call(t, i ? 1 : Math.ceil(r / a))).replace(/_PAGES_/g, n.call(t, i ? 1 : Math.ceil(o / a))) } function Nt(t) { var e, n, r, a = t.iInitDisplayStart, o = t.aoColumns, i = t.oFeatures, l = t.bDeferLoading; if (t.bInitialised) { for (ft(t), lt(t), st(t, t.aoHeader), st(t, t.aoFooter), Bt(t, !0), i.bAutoWidth && qt(t), e = 0, n = o.length; e < n; e++)(r = o[e]).sWidth && (r.nTh.style.width = Zt(r.sWidth)); pe(t, null, "preInit", [t]), ct(t); var s = ve(t); ("ssp" != s || l) && ("ajax" == s ? pt(t, [], (function (n) { var r = mt(t, n); for (e = 0; e < r.length; e++)J(t, r[e]); t.iInitDisplayStart = a, ct(t), Bt(t, !1), Ht(t, n) })) : (Bt(t, !1), Ht(t))) } else setTimeout((function () { Nt(t) }), 200) } function Ht(t, e) { t._bInitComplete = !0, (e || t.oInit.aaData) && M(t), pe(t, null, "plugin-init", [t, e]), pe(t, "aoInitComplete", "init", [t, e]) } function Ot(t, e) { var n = parseInt(e, 10); t._iDisplayLength = n, ge(t), pe(t, null, "length", [t, n]) } function kt(e) { for (var n = e.oClasses, r = e.sTableId, a = e.aLengthMenu, o = Array.isArray(a[0]), i = o ? a[0] : a, l = o ? a[1] : a, s = t("
", { name: r + "_length", "aria-controls": r, class: n.sLengthSelect }), u = 0, c = i.length; u < c; u++)s[0][u] = new Option("number" == typeof l[u] ? e.fnFormatNumber(l[u]) : l[u], i[u]); var f = t("
").addClass(n.sLength); return e.aanFeatures.l || (f[0].id = r + "_length"), f.children().append(e.oLanguage.sLengthMenu.replace("_MENU_", s[0].outerHTML)), t("select", f).val(e._iDisplayLength).on("change.DT", (function (n) { Ot(e, t(this).val()), ut(e) })), t(e.nTable).on("length.dt.DT", (function (n, r, a) { e === r && t("select", f).val(a) })), f[0] } function Mt(e) { var n = e.sPaginationType, r = s.ext.pager[n], a = "function" == typeof r, o = function (t) { ut(t) }, i = t("
").addClass(e.oClasses.sPaging + n)[0], l = e.aanFeatures; return a || r.fnInit(e, i, o), l.p || (i.id = e.sTableId + "_paginate", e.aoDrawCallback.push({ fn: function (t) { if (a) { var e, n, i = t._iDisplayStart, s = t._iDisplayLength, u = t.fnRecordsDisplay(), c = -1 === s, f = c ? 0 : Math.ceil(i / s), d = c ? 1 : Math.ceil(u / s), h = r(f, d); for (e = 0, n = l.p.length; e < n; e++)be(t, "pageButton")(t, l.p[e], e, h, f, d) } else r.fnUpdate(t, o) }, sName: "pagination" })), i } function Wt(t, e, n) { var r = t._iDisplayStart, a = t._iDisplayLength, o = t.fnRecordsDisplay(); 0 === o || -1 === a ? r = 0 : "number" == typeof e ? (r = e * a) > o && (r = 0) : "first" == e ? r = 0 : "previous" == e ? (r = a >= 0 ? r - a : 0) < 0 && (r = 0) : "next" == e ? r + a < o && (r += a) : "last" == e ? r = Math.floor((o - 1) / a) * a : ue(t, 0, "Unknown paging action: " + e, 5); var i = t._iDisplayStart !== r; return t._iDisplayStart = r, i ? (pe(t, null, "page", [t]), n && ut(t)) : pe(t, null, "page-nc", [t]), i } function Et(e) { return t("
", { id: e.aanFeatures.r ? null : e.sTableId + "_processing", class: e.oClasses.sProcessing, role: "status" }).html(e.oLanguage.sProcessing).append("
").insertBefore(e.nTable)[0] } function Bt(e, n) { e.oFeatures.bProcessing && t(e.aanFeatures.r).css("display", n ? "block" : "none"), pe(e, null, "processing", [e, n]) } function Ut(e) { var n = t(e.nTable), r = e.oScroll; if ("" === r.sX && "" === r.sY) return e.nTable; var a = r.sX, o = r.sY, i = e.oClasses, l = n.children("caption"), s = l.length ? l[0]._captionSide : null, u = t(n[0].cloneNode(!1)), c = t(n[0].cloneNode(!1)), f = n.children("tfoot"), d = "
", h = function (t) { return t ? Zt(t) : null }; f.length || (f = null); var p = t(d, { class: i.sScrollWrapper }).append(t(d, { class: i.sScrollHead }).css({ overflow: "hidden", position: "relative", border: 0, width: a ? h(a) : "100%" }).append(t(d, { class: i.sScrollHeadInner }).css({ "box-sizing": "content-box", width: r.sXInner || "100%" }).append(u.removeAttr("id").css("margin-left", 0).append("top" === s ? l : null).append(n.children("thead"))))).append(t(d, { class: i.sScrollBody }).css({ position: "relative", overflow: "auto", width: h(a) }).append(n)); f && p.append(t(d, { class: i.sScrollFoot }).css({ overflow: "hidden", border: 0, width: a ? h(a) : "100%" }).append(t(d, { class: i.sScrollFootInner }).append(c.removeAttr("id").css("margin-left", 0).append("bottom" === s ? l : null).append(n.children("tfoot"))))); var g = p.children(), b = g[0], v = g[1], m = f ? g[2] : null; return a && t(v).on("scroll.DT", (function (t) { var e = this.scrollLeft; b.scrollLeft = e, f && (m.scrollLeft = e) })), t(v).css("max-height", o), r.bCollapse || t(v).css("height", o), e.nScrollHead = b, e.nScrollBody = v, e.nScrollFoot = m, e.aoDrawCallback.push({ fn: Vt, sName: "scrolling" }), p[0] } function Vt(n) { var a, o, i, l, s, u, c, f, d, h = n.oScroll, p = h.sX, g = h.sXInner, b = h.sY, v = h.iBarWidth, m = t(n.nScrollHead), S = m[0].style, D = m.children("div"), _ = D[0].style, w = D.children("table"), C = n.nScrollBody, T = t(C), x = C.style, A = t(n.nScrollFoot).children("div"), I = A.children("table"), F = t(n.nTHead), L = t(n.nTable), R = L[0], P = R.style, j = n.nTFoot ? t(n.nTFoot) : null, N = n.oBrowser, H = N.bScrollOversize, O = (y(n.aoColumns, "nTh"), []), k = [], E = [], B = [], U = function (t) { var e = t.style; e.paddingTop = "0", e.paddingBottom = "0", e.borderTopWidth = "0", e.borderBottomWidth = "0", e.height = 0 }, V = C.scrollHeight > C.clientHeight; if (n.scrollBarVis !== V && n.scrollBarVis !== r) return n.scrollBarVis = V, void M(n); n.scrollBarVis = V, L.children("thead, tfoot").remove(), j && (u = j.clone().prependTo(L), o = j.find("tr"), l = u.find("tr"), u.find("[id]").removeAttr("id")), s = F.clone().prependTo(L), a = F.find("tr"), i = s.find("tr"), s.find("th, td").removeAttr("tabindex"), s.find("[id]").removeAttr("id"), p || (x.width = "100%", m[0].style.width = "100%"), t.each(ht(n, s), (function (t, e) { c = W(n, t), e.style.width = n.aoColumns[c].sWidth })), j && Xt((function (t) { t.style.width = "" }), l), d = L.outerWidth(), "" === p ? (P.width = "100%", H && (L.find("tbody").height() > C.offsetHeight || "scroll" == T.css("overflow-y")) && (P.width = Zt(L.outerWidth() - v)), d = L.outerWidth()) : "" !== g && (P.width = Zt(g), d = L.outerWidth()), Xt(U, i), Xt((function (n) { var r = e.getComputedStyle ? e.getComputedStyle(n).width : Zt(t(n).width()); E.push(n.innerHTML), O.push(r) }), i), Xt((function (t, e) { t.style.width = O[e] }), a), t(i).css("height", 0), j && (Xt(U, l), Xt((function (e) { B.push(e.innerHTML), k.push(Zt(t(e).css("width"))) }), l), Xt((function (t, e) { t.style.width = k[e] }), o), t(l).height(0)), Xt((function (t, e) { t.innerHTML = '
' + E[e] + "
", t.childNodes[0].style.height = "0", t.childNodes[0].style.overflow = "hidden", t.style.width = O[e] }), i), j && Xt((function (t, e) { t.innerHTML = '
' + B[e] + "
", t.childNodes[0].style.height = "0", t.childNodes[0].style.overflow = "hidden", t.style.width = k[e] }), l), Math.round(L.outerWidth()) < Math.round(d) ? (f = C.scrollHeight > C.offsetHeight || "scroll" == T.css("overflow-y") ? d + v : d, H && (C.scrollHeight > C.offsetHeight || "scroll" == T.css("overflow-y")) && (P.width = Zt(f - v)), "" !== p && "" === g || ue(n, 1, "Possible column misalignment", 6)) : f = "100%", x.width = Zt(f), S.width = Zt(f), j && (n.nScrollFoot.style.width = Zt(f)), b || H && (x.height = Zt(R.offsetHeight + v)); var X = L.outerWidth(); w[0].style.width = Zt(X), _.width = Zt(X); var J = L.height() > C.clientHeight || "scroll" == T.css("overflow-y"), q = "padding" + (N.bScrollbarLeft ? "Left" : "Right"); _[q] = J ? v + "px" : "0px", j && (I[0].style.width = Zt(X), A[0].style.width = Zt(X), A[0].style[q] = J ? v + "px" : "0px"), L.children("colgroup").insertBefore(L.children("thead")), T.trigger("scroll"), !n.bSorted && !n.bFiltered || n._drawHold || (C.scrollTop = 0) } function Xt(t, e, n) { for (var r, a, o = 0, i = 0, l = e.length; i < l;) { for (r = e[i].firstChild, a = n ? n[i].firstChild : null; r;)1 === r.nodeType && (n ? t(r, a, o) : t(r, o), o++), r = r.nextSibling, a = n ? a.nextSibling : null; i++ } } var Jt = /<.*?>/g; function qt(n) { var r, a, o, i = n.nTable, l = n.aoColumns, s = n.oScroll, u = s.sY, c = s.sX, f = s.sXInner, d = l.length, h = U(n, "bVisible"), p = t("th", n.nTHead), g = i.getAttribute("width"), b = i.parentNode, v = !1, m = n.oBrowser, S = m.bScrollOversize, y = i.style.width; for (y && -1 !== y.indexOf("%") && (g = y), r = 0; r < h.length; r++)null !== (a = l[h[r]]).sWidth && (a.sWidth = $t(a.sWidthOrig, b), v = !0); if (S || !v && !c && !u && d == B(n) && d == p.length) for (r = 0; r < d; r++) { var D = W(n, r); null !== D && (l[D].sWidth = Zt(p.eq(r).width())) } else { var _ = t(i).clone().css("visibility", "hidden").removeAttr("id"); _.find("tbody tr").remove(); var w = t("
").appendTo(_.find("tbody")); for (_.find("thead, tfoot").remove(), _.append(t(n.nTHead).clone()).append(t(n.nTFoot).clone()), _.find("tfoot th, tfoot td").css("width", ""), p = ht(n, _.find("thead")[0]), r = 0; r < h.length; r++)a = l[h[r]], p[r].style.width = null !== a.sWidthOrig && "" !== a.sWidthOrig ? Zt(a.sWidthOrig) : "", a.sWidthOrig && c && t(p[r]).append(t("
").css({ width: a.sWidthOrig, margin: 0, padding: 0, border: 0, height: 1 })); if (n.aoData.length) for (r = 0; r < h.length; r++)a = l[o = h[r]], t(zt(n, o)).clone(!1).append(a.sContentPadding).appendTo(w); t("[name]", _).removeAttr("name"), t("[id]", _).removeAttr("id"); var C = t("
").css(c || u ? { position: "absolute", top: 0, left: 0, height: 1, right: 0, overflow: "hidden" } : {}).append(_).appendTo(b); c && f ? _.width(f) : c ? (_.css("width", "auto"), _.removeAttr("width"), _.width() < b.clientWidth && g && _.width(b.clientWidth)) : u ? _.width(b.clientWidth) : g && _.width(g); var T = 0; for (r = 0; r < h.length; r++) { var x = t(p[r]), A = x.outerWidth() - x.width(), I = m.bBounding ? Math.ceil(p[r].getBoundingClientRect().width) : x.outerWidth(); T += I, l[h[r]].sWidth = Zt(I - A) } i.style.width = Zt(T), C.remove() } if (g && (i.style.width = Zt(g)), (g || c) && !n._reszEvt) { var F = function () { t(e).on("resize.DT-" + n.sInstance, Gt((function () { M(n) }))) }; S ? setTimeout(F, 1e3) : F(), n._reszEvt = !0 } } var Gt = s.util.throttle; function $t(e, r) { if (!e) return 0; var a = t("
").css("width", Zt(e)).appendTo(r || n.body), o = a[0].offsetWidth; return a.remove(), o } function zt(e, n) { var r = Yt(e, n); if (r < 0) return null; var a = e.aoData[r]; return a.nTr ? a.anCells[n] : t("
").html(G(e, r, n, "display"))[0] } function Yt(t, e) { for (var n, r = -1, a = -1, o = 0, i = t.aoData.length; o < i; o++)(n = (n = (n = G(t, o, e, "display") + "").replace(Jt, "")).replace(/ /g, " ")).length > r && (r = n.length, a = o); return a } function Zt(t) { return null === t ? "0px" : "number" == typeof t ? t < 0 ? "0px" : t + "px" : t.match(/\d$/) ? t + "px" : t } function Kt(e) { var n, a, o, i, l, u, c, f = [], d = e.aoColumns, h = e.aaSortingFixed, p = t.isPlainObject(h), g = [], b = function (e) { e.length && !Array.isArray(e[0]) ? g.push(e) : t.merge(g, e) }; for (Array.isArray(h) && b(h), p && h.pre && b(h.pre), b(e.aaSorting), p && h.post && b(h.post), n = 0; n < g.length; n++)for (a = 0, o = (i = d[c = g[n][0]].aDataSort).length; a < o; a++)u = d[l = i[a]].sType || "string", g[n]._idx === r && (g[n]._idx = t.inArray(g[n][1], d[l].asSorting)), f.push({ src: c, col: l, dir: g[n][1], index: g[n]._idx, type: u, formatter: s.ext.type.order[u + "-pre"] }); return f } function Qt(t) { var e, n, r, a, o, i = [], l = s.ext.type.order, u = t.aoData, c = (t.aoColumns, 0), f = t.aiDisplayMaster; for (V(t), e = 0, n = (o = Kt(t)).length; e < n; e++)(a = o[e]).formatter && c++, ae(t, a.col); if ("ssp" != ve(t) && 0 !== o.length) { for (e = 0, r = f.length; e < r; e++)i[f[e]] = e; c === o.length ? f.sort((function (t, e) { var n, r, a, l, s, c = o.length, f = u[t]._aSortData, d = u[e]._aSortData; for (a = 0; a < c; a++)if (0 !== (l = (n = f[(s = o[a]).col]) < (r = d[s.col]) ? -1 : n > r ? 1 : 0)) return "asc" === s.dir ? l : -l; return (n = i[t]) < (r = i[e]) ? -1 : n > r ? 1 : 0 })) : f.sort((function (t, e) { var n, r, a, s, c, f = o.length, d = u[t]._aSortData, h = u[e]._aSortData; for (a = 0; a < f; a++)if (n = d[(c = o[a]).col], r = h[c.col], 0 !== (s = (l[c.type + "-" + c.dir] || l["string-" + c.dir])(n, r))) return s; return (n = i[t]) < (r = i[e]) ? -1 : n > r ? 1 : 0 })) } t.bSorted = !0 } function te(t) { for (var e, n, r = t.aoColumns, a = Kt(t), o = t.oLanguage.oAria, i = 0, l = r.length; i < l; i++) { var s = r[i], u = s.asSorting, c = s.ariaTitle || s.sTitle.replace(/<.*?>/g, ""), f = s.nTh; f.removeAttribute("aria-sort"), s.bSortable ? (a.length > 0 && a[0].col == i ? (f.setAttribute("aria-sort", "asc" == a[0].dir ? "ascending" : "descending"), n = u[a[0].index + 1] || u[0]) : n = u[0], e = c + ("asc" === n ? o.sSortAscending : o.sSortDescending)) : e = c, f.setAttribute("aria-label", e) } } function ee(e, n, a, o) { var i, l = e.aoColumns[n], s = e.aaSorting, u = l.asSorting, c = function (e, n) { var a = e._idx; return a === r && (a = t.inArray(e[1], u)), a + 1 < u.length ? a + 1 : n ? null : 0 }; if ("number" == typeof s[0] && (s = e.aaSorting = [s]), a && e.oFeatures.bSortMulti) { var f = t.inArray(n, y(s, "0")); -1 !== f ? (null === (i = c(s[f], !0)) && 1 === s.length && (i = 0), null === i ? s.splice(f, 1) : (s[f][1] = u[i], s[f]._idx = i)) : (s.push([n, u[0], 0]), s[s.length - 1]._idx = 0) } else s.length && s[0][0] == n ? (i = c(s[0]), s.length = 1, s[0][1] = u[i], s[0]._idx = i) : (s.length = 0, s.push([n, u[0]]), s[0]._idx = 0); ct(e), "function" == typeof o && o(e) } function ne(t, e, n, r) { var a = t.aoColumns[n]; de(e, {}, (function (e) { !1 !== a.bSortable && (t.oFeatures.bProcessing ? (Bt(t, !0), setTimeout((function () { ee(t, n, e.shiftKey, r), "ssp" !== ve(t) && Bt(t, !1) }), 0)) : ee(t, n, e.shiftKey, r)) })) } function re(e) { var n, r, a, o = e.aLastSort, i = e.oClasses.sSortColumn, l = Kt(e), s = e.oFeatures; if (s.bSort && s.bSortClasses) { for (n = 0, r = o.length; n < r; n++)a = o[n].src, t(y(e.aoData, "anCells", a)).removeClass(i + (n < 2 ? n + 1 : 3)); for (n = 0, r = l.length; n < r; n++)a = l[n].src, t(y(e.aoData, "anCells", a)).addClass(i + (n < 2 ? n + 1 : 3)) } e.aLastSort = l } function ae(t, e) { var n, r, a, o = t.aoColumns[e], i = s.ext.order[o.sSortDataType]; i && (n = i.call(t.oInstance, t, e, E(t, e))); for (var l = s.ext.type.order[o.sType + "-pre"], u = 0, c = t.aoData.length; u < c; u++)(r = t.aoData[u])._aSortData || (r._aSortData = []), r._aSortData[e] && !i || (a = i ? n[u] : G(t, u, e, "sort"), r._aSortData[e] = l ? l(a) : a) } function oe(e) { if (!e._bLoadingState) { var n = { time: +new Date, start: e._iDisplayStart, length: e._iDisplayLength, order: t.extend(!0, [], e.aaSorting), search: Ft(e.oPreviousSearch), columns: t.map(e.aoColumns, (function (t, n) { return { visible: t.bVisible, search: Ft(e.aoPreSearchCols[n]) } })) }; e.oSavedState = n, pe(e, "aoStateSaveParams", "stateSaveParams", [e, n]), e.oFeatures.bStateSave && !e.bDestroying && e.fnStateSaveCallback.call(e.oInstance, e, n) } } function ie(t, e, n) { if (t.oFeatures.bStateSave) { var a = t.fnStateLoadCallback.call(t.oInstance, t, (function (e) { le(t, e, n) })); return a !== r && le(t, a, n), !0 } n() } function le(e, n, a) { var o, i, l = e.aoColumns; e._bLoadingState = !0; var u = e._bInitComplete ? new s.Api(e) : null; if (!n || !n.time) return e._bLoadingState = !1, void a(); var c = pe(e, "aoStateLoadParams", "stateLoadParams", [e, n]); if (-1 !== t.inArray(!1, c)) return e._bLoadingState = !1, void a(); var f = e.iStateDuration; if (f > 0 && n.time < +new Date - 1e3 * f) return e._bLoadingState = !1, void a(); if (n.columns && l.length !== n.columns.length) return e._bLoadingState = !1, void a(); if (e.oLoadedState = t.extend(!0, {}, n), n.length !== r && (u ? u.page.len(n.length) : e._iDisplayLength = n.length), n.start !== r && (null === u ? (e._iDisplayStart = n.start, e.iInitDisplayStart = n.start) : Wt(e, n.start / e._iDisplayLength)), n.order !== r && (e.aaSorting = [], t.each(n.order, (function (t, n) { e.aaSorting.push(n[0] >= l.length ? [0, n[1]] : n) }))), n.search !== r && t.extend(e.oPreviousSearch, Lt(n.search)), n.columns) { for (o = 0, i = n.columns.length; o < i; o++) { var d = n.columns[o]; d.visible !== r && (u ? u.column(o).visible(d.visible, !1) : l[o].bVisible = d.visible), d.search !== r && t.extend(e.aoPreSearchCols[o], Lt(d.search)) } u && u.columns.adjust() } e._bLoadingState = !1, pe(e, "aoStateLoaded", "stateLoaded", [e, n]), a() } function se(e) { var n = s.settings, r = t.inArray(e, y(n, "nTable")); return -1 !== r ? n[r] : null } function ue(t, n, r, a) { if (r = "DataTables warning: " + (t ? "table id=" + t.sTableId + " - " : "") + r, a && (r += ". For more information about this error, please see http://datatables.net/tn/" + a), n) e.console && console.log && console.log(r); else { var o = s.ext, i = o.sErrMode || o.errMode; if (t && pe(t, null, "error", [t, a, r]), "alert" == i) alert(r); else { if ("throw" == i) throw new Error(r); "function" == typeof i && i(t, a, r) } } } function ce(e, n, a, o) { Array.isArray(a) ? t.each(a, (function (t, r) { Array.isArray(r) ? ce(e, n, r[0], r[1]) : ce(e, n, r) })) : (o === r && (o = a), n[a] !== r && (e[o] = n[a])) } function fe(e, n, r) { var a; for (var o in n) n.hasOwnProperty(o) && (a = n[o], t.isPlainObject(a) ? (t.isPlainObject(e[o]) || (e[o] = {}), t.extend(!0, e[o], a)) : r && "data" !== o && "aaData" !== o && Array.isArray(a) ? e[o] = a.slice() : e[o] = a); return e } function de(e, n, r) { t(e).on("click.DT", n, (function (n) { t(e).trigger("blur"), r(n) })).on("keypress.DT", n, (function (t) { 13 === t.which && (t.preventDefault(), r(t)) })).on("selectstart.DT", (function () { return !1 })) } function he(t, e, n, r) { n && t[e].push({ fn: n, sName: r }) } function pe(e, n, r, a) { var o = []; if (n && (o = t.map(e[n].slice().reverse(), (function (t, n) { return t.fn.apply(e.oInstance, a) }))), null !== r) { var i = t.Event(r + ".dt"), l = t(e.nTable); l.trigger(i, a), 0 === l.parents("body").length && t("body").trigger(i, a), o.push(i.result) } return o } function ge(t) { var e = t._iDisplayStart, n = t.fnDisplayEnd(), r = t._iDisplayLength; e >= n && (e = n - r), e -= e % r, (-1 === r || e < 0) && (e = 0), t._iDisplayStart = e } function be(e, n) { var r = e.renderer, a = s.ext.renderer[n]; return t.isPlainObject(r) && r[n] ? a[r[n]] || a._ : "string" == typeof r && a[r] || a._ } function ve(t) { return t.oFeatures.bServerSide ? "ssp" : t.ajax || t.sAjaxSource ? "ajax" : "dom" } var me = [], Se = Array.prototype; o = function (e, n) { if (!(this instanceof o)) return new o(e, n); var r = [], a = function (e) { var n = function (e) { var n, r, a = s.settings, o = t.map(a, (function (t, e) { return t.nTable })); return e ? e.nTable && e.oApi ? [e] : e.nodeName && "table" === e.nodeName.toLowerCase() ? -1 !== (n = t.inArray(e, o)) ? [a[n]] : null : e && "function" == typeof e.settings ? e.settings().toArray() : ("string" == typeof e ? r = t(e) : e instanceof t && (r = e), r ? r.map((function (e) { return -1 !== (n = t.inArray(this, o)) ? a[n] : null })).toArray() : void 0) : [] }(e); n && r.push.apply(r, n) }; if (Array.isArray(e)) for (var i = 0, l = e.length; i < l; i++)a(e[i]); else a(e); this.context = T(r), n && t.merge(this, n), this.selector = { rows: null, cols: null, opts: null }, o.extend(this, this, me) }, s.Api = o, t.extend(o.prototype, { any: function () { return 0 !== this.count() }, concat: Se.concat, context: [], count: function () { return this.flatten().length }, each: function (t) { for (var e = 0, n = this.length; e < n; e++)t.call(this, this[e], e, this); return this }, eq: function (t) { var e = this.context; return e.length > t ? new o(e[t], this[t]) : null }, filter: function (t) { var e = []; if (Se.filter) e = Se.filter.call(this, t, this); else for (var n = 0, r = this.length; n < r; n++)t.call(this, this[n], n, this) && e.push(this[n]); return new o(this.context, e) }, flatten: function () { var t = []; return new o(this.context, t.concat.apply(t, this.toArray())) }, join: Se.join, indexOf: Se.indexOf || function (t, e) { for (var n = e || 0, r = this.length; n < r; n++)if (this[n] === t) return n; return -1 }, iterator: function (t, e, n, a) { var i, l, s, u, c, f, d, h, p = [], g = this.context, b = this.selector; for ("string" == typeof t && (a = n, n = e, e = t, t = !1), l = 0, s = g.length; l < s; l++) { var v = new o(g[l]); if ("table" === e) (i = n.call(v, g[l], l)) !== r && p.push(i); else if ("columns" === e || "rows" === e) (i = n.call(v, g[l], this[l], l)) !== r && p.push(i); else if ("column" === e || "column-rows" === e || "row" === e || "cell" === e) for (d = this[l], "column-rows" === e && (f = Te(g[l], b.opts)), u = 0, c = d.length; u < c; u++)h = d[u], (i = "cell" === e ? n.call(v, g[l], h.row, h.column, l, u) : n.call(v, g[l], h, l, u, f)) !== r && p.push(i) } if (p.length || a) { var m = new o(g, t ? p.concat.apply([], p) : p), S = m.selector; return S.rows = b.rows, S.cols = b.cols, S.opts = b.opts, m } return this }, lastIndexOf: Se.lastIndexOf || function (t, e) { return this.indexOf.apply(this.toArray.reverse(), arguments) }, length: 0, map: function (t) { var e = []; if (Se.map) e = Se.map.call(this, t, this); else for (var n = 0, r = this.length; n < r; n++)e.push(t.call(this, this[n], n)); return new o(this.context, e) }, pluck: function (t) { var e = s.util.get(t); return this.map((function (t) { return e(t) })) }, pop: Se.pop, push: Se.push, reduce: Se.reduce || function (t, e) { return H(this, t, e, 0, this.length, 1) }, reduceRight: Se.reduceRight || function (t, e) { return H(this, t, e, this.length - 1, -1, -1) }, reverse: Se.reverse, selector: null, shift: Se.shift, slice: function () { return new o(this.context, this) }, sort: Se.sort, splice: Se.splice, toArray: function () { return Se.slice.call(this) }, to$: function () { return t(this) }, toJQuery: function () { return t(this) }, unique: function () { return new o(this.context, T(this)) }, unshift: Se.unshift }), o.extend = function (t, e, n) { if (n.length && e && (e instanceof o || e.__dt_wrapper)) { var r, a, i, l = function (t, e, n) { return function () { var r = e.apply(t, arguments); return o.extend(r, r, n.methodExt), r } }; for (r = 0, a = n.length; r < a; r++)e[(i = n[r]).name] = "function" === i.type ? l(t, i.val, i) : "object" === i.type ? {} : i.val, e[i.name].__dt_wrapper = !0, o.extend(t, e[i.name], i.propExt) } }, o.register = i = function (e, n) { if (Array.isArray(e)) for (var r = 0, a = e.length; r < a; r++)o.register(e[r], n); else { var i, l, s, u, c = e.split("."), f = me, d = function (t, e) { for (var n = 0, r = t.length; n < r; n++)if (t[n].name === e) return t[n]; return null }; for (i = 0, l = c.length; i < l; i++) { var h = d(f, s = (u = -1 !== c[i].indexOf("()")) ? c[i].replace("()", "") : c[i]); h || (h = { name: s, val: {}, methodExt: [], propExt: [], type: "object" }, f.push(h)), i === l - 1 ? (h.val = n, h.type = "function" == typeof n ? "function" : t.isPlainObject(n) ? "object" : "other") : f = u ? h.methodExt : h.propExt } } }, o.registerPlural = l = function (t, e, n) { o.register(t, n), o.register(e, (function () { var t = n.apply(this, arguments); return t === this ? this : t instanceof o ? t.length ? Array.isArray(t[0]) ? new o(t.context, t[0]) : t[0] : r : t })) }; var ye = function (e, n) { if (Array.isArray(e)) return t.map(e, (function (t) { return ye(t, n) })); if ("number" == typeof e) return [n[e]]; var r = t.map(n, (function (t, e) { return t.nTable })); return t(r).filter(e).map((function (e) { var a = t.inArray(this, r); return n[a] })).toArray() }; i("tables()", (function (t) { return t !== r && null !== t ? new o(ye(t, this.context)) : this })), i("table()", (function (t) { var e = this.tables(t), n = e.context; return n.length ? new o(n[0]) : e })), l("tables().nodes()", "table().node()", (function () { return this.iterator("table", (function (t) { return t.nTable }), 1) })), l("tables().body()", "table().body()", (function () { return this.iterator("table", (function (t) { return t.nTBody }), 1) })), l("tables().header()", "table().header()", (function () { return this.iterator("table", (function (t) { return t.nTHead }), 1) })), l("tables().footer()", "table().footer()", (function () { return this.iterator("table", (function (t) { return t.nTFoot }), 1) })), l("tables().containers()", "table().container()", (function () { return this.iterator("table", (function (t) { return t.nTableWrapper }), 1) })), i("draw()", (function (t) { return this.iterator("table", (function (e) { "page" === t ? ut(e) : ("string" == typeof t && (t = "full-hold" !== t), ct(e, !1 === t)) })) })), i("page()", (function (t) { return t === r ? this.page.info().page : this.iterator("table", (function (e) { Wt(e, t) })) })), i("page.info()", (function (t) { if (0 === this.context.length) return r; var e = this.context[0], n = e._iDisplayStart, a = e.oFeatures.bPaginate ? e._iDisplayLength : -1, o = e.fnRecordsDisplay(), i = -1 === a; return { page: i ? 0 : Math.floor(n / a), pages: i ? 1 : Math.ceil(o / a), start: n, end: e.fnDisplayEnd(), length: a, recordsTotal: e.fnRecordsTotal(), recordsDisplay: o, serverSide: "ssp" === ve(e) } })), i("page.len()", (function (t) { return t === r ? 0 !== this.context.length ? this.context[0]._iDisplayLength : r : this.iterator("table", (function (e) { Ot(e, t) })) })); var De = function (t, e, n) { if (n) { var r = new o(t); r.one("draw", (function () { n(r.ajax.json()) })) } if ("ssp" == ve(t)) ct(t, e); else { Bt(t, !0); var a = t.jqXHR; a && 4 !== a.readyState && a.abort(), pt(t, [], (function (n) { et(t); for (var r = mt(t, n), a = 0, o = r.length; a < o; a++)J(t, r[a]); ct(t, e), Bt(t, !1) })) } }; i("ajax.json()", (function () { var t = this.context; if (t.length > 0) return t[0].json })), i("ajax.params()", (function () { var t = this.context; if (t.length > 0) return t[0].oAjaxData })), i("ajax.reload()", (function (t, e) { return this.iterator("table", (function (n) { De(n, !1 === e, t) })) })), i("ajax.url()", (function (e) { var n = this.context; return e === r ? 0 === n.length ? r : (n = n[0]).ajax ? t.isPlainObject(n.ajax) ? n.ajax.url : n.ajax : n.sAjaxSource : this.iterator("table", (function (n) { t.isPlainObject(n.ajax) ? n.ajax.url = e : n.ajax = e })) })), i("ajax.url().load()", (function (t, e) { return this.iterator("table", (function (n) { De(n, !1 === e, t) })) })); var _e = function (t, e, n, o, i) { var l, s, u, c, f, d, h = [], p = typeof e; for (e && "string" !== p && "function" !== p && e.length !== r || (e = [e]), u = 0, c = e.length; u < c; u++)for (f = 0, d = (s = e[u] && e[u].split && !e[u].match(/[\[\(:]/) ? e[u].split(",") : [e[u]]).length; f < d; f++)(l = n("string" == typeof s[f] ? s[f].trim() : s[f])) && l.length && (h = h.concat(l)); var g = a.selector[t]; if (g.length) for (u = 0, c = g.length; u < c; u++)h = g[u](o, i, h); return T(h) }, we = function (e) { return e || (e = {}), e.filter && e.search === r && (e.search = e.filter), t.extend({ search: "none", order: "current", page: "all" }, e) }, Ce = function (t) { for (var e = 0, n = t.length; e < n; e++)if (t[e].length > 0) return t[0] = t[e], t[0].length = 1, t.length = 1, t.context = [t.context[e]], t; return t.length = 0, t }, Te = function (e, n) { var r, a = [], o = e.aiDisplay, i = e.aiDisplayMaster, l = n.search, s = n.order, u = n.page; if ("ssp" == ve(e)) return "removed" === l ? [] : _(0, i.length); if ("current" == u) for (f = e._iDisplayStart, d = e.fnDisplayEnd(); f < d; f++)a.push(o[f]); else if ("current" == s || "applied" == s) { if ("none" == l) a = i.slice(); else if ("applied" == l) a = o.slice(); else if ("removed" == l) { for (var c = {}, f = 0, d = o.length; f < d; f++)c[o[f]] = null; a = t.map(i, (function (t) { return c.hasOwnProperty(t) ? null : t })) } } else if ("index" == s || "original" == s) for (f = 0, d = e.aoData.length; f < d; f++)("none" == l || -1 === (r = t.inArray(f, o)) && "removed" == l || r >= 0 && "applied" == l) && a.push(f); return a }; i("rows()", (function (e, n) { e === r ? e = "" : t.isPlainObject(e) && (n = e, e = ""), n = we(n); var a = this.iterator("table", (function (a) { return function (e, n, a) { var o; return _e("row", n, (function (n) { var i = b(n), l = e.aoData; if (null !== i && !a) return [i]; if (o || (o = Te(e, a)), null !== i && -1 !== t.inArray(i, o)) return [i]; if (null === n || n === r || "" === n) return o; if ("function" == typeof n) return t.map(o, (function (t) { var e = l[t]; return n(t, e._aData, e.nTr) ? t : null })); if (n.nodeName) { var s = n._DT_RowIndex, u = n._DT_CellIndex; if (s !== r) return l[s] && l[s].nTr === n ? [s] : []; if (u) return l[u.row] && l[u.row].nTr === n.parentNode ? [u.row] : []; var c = t(n).closest("*[data-dt-row]"); return c.length ? [c.data("dt-row")] : [] } if ("string" == typeof n && "#" === n.charAt(0)) { var f = e.aIds[n.replace(/^#/, "")]; if (f !== r) return [f.idx] } var d = w(D(e.aoData, o, "nTr")); return t(d).filter(n).map((function () { return this._DT_RowIndex })).toArray() }), e, a) }(a, e, n) }), 1); return a.selector.rows = e, a.selector.opts = n, a })), i("rows().nodes()", (function () { return this.iterator("row", (function (t, e) { return t.aoData[e].nTr || r }), 1) })), i("rows().data()", (function () { return this.iterator(!0, "rows", (function (t, e) { return D(t.aoData, e, "_aData") }), 1) })), l("rows().cache()", "row().cache()", (function (t) { return this.iterator("row", (function (e, n) { var r = e.aoData[n]; return "search" === t ? r._aFilterData : r._aSortData }), 1) })), l("rows().invalidate()", "row().invalidate()", (function (t) { return this.iterator("row", (function (e, n) { rt(e, n, t) })) })), l("rows().indexes()", "row().index()", (function () { return this.iterator("row", (function (t, e) { return e }), 1) })), l("rows().ids()", "row().id()", (function (t) { for (var e = [], n = this.context, r = 0, a = n.length; r < a; r++)for (var i = 0, l = this[r].length; i < l; i++) { var s = n[r].rowIdFn(n[r].aoData[this[r][i]]._aData); e.push((!0 === t ? "#" : "") + s) } return new o(n, e) })), l("rows().remove()", "row().remove()", (function () { var t = this; return this.iterator("row", (function (e, n, a) { var o, i, l, s, u, c, f = e.aoData, d = f[n]; for (f.splice(n, 1), o = 0, i = f.length; o < i; o++)if (c = (u = f[o]).anCells, null !== u.nTr && (u.nTr._DT_RowIndex = o), null !== c) for (l = 0, s = c.length; l < s; l++)c[l]._DT_CellIndex.row = o; nt(e.aiDisplayMaster, n), nt(e.aiDisplay, n), nt(t[a], n, !1), e._iRecordsDisplay > 0 && e._iRecordsDisplay--, ge(e); var h = e.rowIdFn(d._aData); h !== r && delete e.aIds[h] })), this.iterator("table", (function (t) { for (var e = 0, n = t.aoData.length; e < n; e++)t.aoData[e].idx = e })), this })), i("rows.add()", (function (e) { var n = this.iterator("table", (function (t) { var n, r, a, o = []; for (r = 0, a = e.length; r < a; r++)(n = e[r]).nodeName && "TR" === n.nodeName.toUpperCase() ? o.push(q(t, n)[0]) : o.push(J(t, n)); return o }), 1), r = this.rows(-1); return r.pop(), t.merge(r, n), r })), i("row()", (function (t, e) { return Ce(this.rows(t, e)) })), i("row().data()", (function (t) { var e = this.context; if (t === r) return e.length && this.length ? e[0].aoData[this[0]]._aData : r; var n = e[0].aoData[this[0]]; return n._aData = t, Array.isArray(t) && n.nTr && n.nTr.id && Q(e[0].rowId)(t, n.nTr.id), rt(e[0], this[0], "data"), this })), i("row().node()", (function () { var t = this.context; return t.length && this.length && t[0].aoData[this[0]].nTr || null })), i("row.add()", (function (e) { e instanceof t && e.length && (e = e[0]); var n = this.iterator("table", (function (t) { return e.nodeName && "TR" === e.nodeName.toUpperCase() ? q(t, e)[0] : J(t, e) })); return this.row(n[0]) })), t(n).on("plugin-init.dt", (function (e, n) { var r = new o(n), a = "on-plugin-init", i = "stateSaveParams." + a, l = "destroy. " + a; r.on(i, (function (t, e, n) { for (var r = e.rowIdFn, a = e.aoData, o = [], i = 0; i < a.length; i++)a[i]._detailsShow && o.push("#" + r(a[i]._aData)); n.childRows = o })), r.on(l, (function () { r.off(i + " " + l) })); var s = r.state.loaded(); s && s.childRows && r.rows(t.map(s.childRows, (function (t) { return t.replace(/:/g, "\\:") }))).every((function () { pe(n, null, "requestChild", [this]) })) })); var xe = s.util.throttle((function (t) { oe(t[0]) }), 500), Ae = function (e, n) { var a = e.context; if (a.length) { var o = a[0].aoData[n !== r ? n : e[0]]; o && o._details && (o._details.remove(), o._detailsShow = r, o._details = r, t(o.nTr).removeClass("dt-hasChild"), xe(a)) } }, Ie = function (e, n) { var r = e.context; if (r.length && e.length) { var a = r[0].aoData[e[0]]; a._details && (a._detailsShow = n, n ? (a._details.insertAfter(a.nTr), t(a.nTr).addClass("dt-hasChild")) : (a._details.detach(), t(a.nTr).removeClass("dt-hasChild")), pe(r[0], null, "childRow", [n, e.row(e[0])]), Fe(r[0]), xe(r)) } }, Fe = function (t) { var e = new o(t), n = ".dt.DT_details", r = "draw" + n, a = "column-sizing" + n, i = "destroy" + n, l = t.aoData; e.off(r + " " + a + " " + i), y(l, "_details").length > 0 && (e.on(r, (function (n, r) { t === r && e.rows({ page: "current" }).eq(0).each((function (t) { var e = l[t]; e._detailsShow && e._details.insertAfter(e.nTr) })) })), e.on(a, (function (e, n, r, a) { if (t === n) for (var o, i = B(n), s = 0, u = l.length; s < u; s++)(o = l[s])._details && o._details.children("td[colspan]").attr("colspan", i) })), e.on(i, (function (n, r) { if (t === r) for (var a = 0, o = l.length; a < o; a++)l[a]._details && Ae(e, a) }))) }, Le = "row().child", Re = Le + "()"; i(Re, (function (e, n) { var a = this.context; return e === r ? a.length && this.length ? a[0].aoData[this[0]]._details : r : (!0 === e ? this.child.show() : !1 === e ? Ae(this) : a.length && this.length && function (e, n, r, a) { var o = [], i = function (n, r) { if (Array.isArray(n) || n instanceof t) for (var a = 0, l = n.length; a < l; a++)i(n[a], r); else if (n.nodeName && "tr" === n.nodeName.toLowerCase()) o.push(n); else { var s = t("
").addClass(r); t("td", s).addClass(r).html(n)[0].colSpan = B(e), o.push(s[0]) } }; i(r, a), n._details && n._details.detach(), n._details = t(o), n._detailsShow && n._details.insertAfter(n.nTr) }(a[0], a[0].aoData[this[0]], e, n), this) })), i([Le + ".show()", Re + ".show()"], (function (t) { return Ie(this, !0), this })), i([Le + ".hide()", Re + ".hide()"], (function () { return Ie(this, !1), this })), i([Le + ".remove()", Re + ".remove()"], (function () { return Ae(this), this })), i(Le + ".isShown()", (function () { var t = this.context; return t.length && this.length && t[0].aoData[this[0]]._detailsShow || !1 })); var Pe = /^([^:]+):(name|visIdx|visible)$/, je = function (t, e, n, r, a) { for (var o = [], i = 0, l = a.length; i < l; i++)o.push(G(t, a[i], e)); return o }; i("columns()", (function (e, n) { e === r ? e = "" : t.isPlainObject(e) && (n = e, e = ""), n = we(n); var a = this.iterator("table", (function (r) { return function (e, n, r) { var a = e.aoColumns, o = y(a, "sName"), i = y(a, "nTh"); return _e("column", n, (function (n) { var l = b(n); if ("" === n) return _(a.length); if (null !== l) return [l >= 0 ? l : a.length + l]; if ("function" == typeof n) { var s = Te(e, r); return t.map(a, (function (t, r) { return n(r, je(e, r, 0, 0, s), i[r]) ? r : null })) } var u = "string" == typeof n ? n.match(Pe) : ""; if (u) switch (u[2]) { case "visIdx": case "visible": var c = parseInt(u[1], 10); if (c < 0) { var f = t.map(a, (function (t, e) { return t.bVisible ? e : null })); return [f[f.length + c]] } return [W(e, c)]; case "name": return t.map(o, (function (t, e) { return t === u[1] ? e : null })); default: return [] }if (n.nodeName && n._DT_CellIndex) return [n._DT_CellIndex.column]; var d = t(i).filter(n).map((function () { return t.inArray(this, i) })).toArray(); if (d.length || !n.nodeName) return d; var h = t(n).closest("*[data-dt-column]"); return h.length ? [h.data("dt-column")] : [] }), e, r) }(r, e, n) }), 1); return a.selector.cols = e, a.selector.opts = n, a })), l("columns().header()", "column().header()", (function (t, e) { return this.iterator("column", (function (t, e) { return t.aoColumns[e].nTh }), 1) })), l("columns().footer()", "column().footer()", (function (t, e) { return this.iterator("column", (function (t, e) { return t.aoColumns[e].nTf }), 1) })), l("columns().data()", "column().data()", (function () { return this.iterator("column-rows", je, 1) })), l("columns().dataSrc()", "column().dataSrc()", (function () { return this.iterator("column", (function (t, e) { return t.aoColumns[e].mData }), 1) })), l("columns().cache()", "column().cache()", (function (t) { return this.iterator("column-rows", (function (e, n, r, a, o) { return D(e.aoData, o, "search" === t ? "_aFilterData" : "_aSortData", n) }), 1) })), l("columns().nodes()", "column().nodes()", (function () { return this.iterator("column-rows", (function (t, e, n, r, a) { return D(t.aoData, a, "anCells", e) }), 1) })), l("columns().visible()", "column().visible()", (function (e, n) { var a = this, o = this.iterator("column", (function (n, a) { if (e === r) return n.aoColumns[a].bVisible; !function (e, n, a) { var o, i, l, s, u = e.aoColumns, c = u[n], f = e.aoData; if (a === r) return c.bVisible; if (c.bVisible !== a) { if (a) { var d = t.inArray(!0, y(u, "bVisible"), n + 1); for (i = 0, l = f.length; i < l; i++)s = f[i].nTr, o = f[i].anCells, s && s.insertBefore(o[n], o[d] || null) } else t(y(e.aoData, "anCells", n)).detach(); c.bVisible = a } }(n, a, e) })); return e !== r && this.iterator("table", (function (o) { st(o, o.aoHeader), st(o, o.aoFooter), o.aiDisplay.length || t(o.nTBody).find("td[colspan]").attr("colspan", B(o)), oe(o), a.iterator("column", (function (t, r) { pe(t, null, "column-visibility", [t, r, e, n]) })), (n === r || n) && a.columns.adjust() })), o })), l("columns().indexes()", "column().index()", (function (t) { return this.iterator("column", (function (e, n) { return "visible" === t ? E(e, n) : n }), 1) })), i("columns.adjust()", (function () { return this.iterator("table", (function (t) { M(t) }), 1) })), i("column.index()", (function (t, e) { if (0 !== this.context.length) { var n = this.context[0]; if ("fromVisible" === t || "toData" === t) return W(n, e); if ("fromData" === t || "toVisible" === t) return E(n, e) } })), i("column()", (function (t, e) { return Ce(this.columns(t, e)) })); i("cells()", (function (e, n, a) { if (t.isPlainObject(e) && (e.row === r ? (a = e, e = null) : (a = n, n = null)), t.isPlainObject(n) && (a = n, n = null), null === n || n === r) return this.iterator("table", (function (n) { return function (e, n, a) { var o, i, l, s, u, c, f, d = e.aoData, h = Te(e, a), p = w(D(d, h, "anCells")), g = t(x([], p)), b = e.aoColumns.length; return _e("cell", n, (function (n) { var a = "function" == typeof n; if (null === n || n === r || a) { for (i = [], l = 0, s = h.length; l < s; l++)for (o = h[l], u = 0; u < b; u++)c = { row: o, column: u }, a ? (f = d[o], n(c, G(e, o, u), f.anCells ? f.anCells[u] : null) && i.push(c)) : i.push(c); return i } if (t.isPlainObject(n)) return n.column !== r && n.row !== r && -1 !== t.inArray(n.row, h) ? [n] : []; var p = g.filter(n).map((function (t, e) { return { row: e._DT_CellIndex.row, column: e._DT_CellIndex.column } })).toArray(); return p.length || !n.nodeName ? p : (f = t(n).closest("*[data-dt-row]")).length ? [{ row: f.data("dt-row"), column: f.data("dt-column") }] : [] }), e, a) }(n, e, we(a)) })); var o, i, l, s, u = a ? { page: a.page, order: a.order, search: a.search } : {}, c = this.columns(n, u), f = this.rows(e, u), d = this.iterator("table", (function (t, e) { var n = []; for (o = 0, i = f[e].length; o < i; o++)for (l = 0, s = c[e].length; l < s; l++)n.push({ row: f[e][o], column: c[e][l] }); return n }), 1), h = a && a.selected ? this.cells(d, a) : d; return t.extend(h.selector, { cols: n, rows: e, opts: a }), h })), l("cells().nodes()", "cell().node()", (function () { return this.iterator("cell", (function (t, e, n) { var a = t.aoData[e]; return a && a.anCells ? a.anCells[n] : r }), 1) })), i("cells().data()", (function () { return this.iterator("cell", (function (t, e, n) { return G(t, e, n) }), 1) })), l("cells().cache()", "cell().cache()", (function (t) { return t = "search" === t ? "_aFilterData" : "_aSortData", this.iterator("cell", (function (e, n, r) { return e.aoData[n][t][r] }), 1) })), l("cells().render()", "cell().render()", (function (t) { return this.iterator("cell", (function (e, n, r) { return G(e, n, r, t) }), 1) })), l("cells().indexes()", "cell().index()", (function () { return this.iterator("cell", (function (t, e, n) { return { row: e, column: n, columnVisible: E(t, n) } }), 1) })), l("cells().invalidate()", "cell().invalidate()", (function (t) { return this.iterator("cell", (function (e, n, r) { rt(e, n, t, r) })) })), i("cell()", (function (t, e, n) { return Ce(this.cells(t, e, n)) })), i("cell().data()", (function (t) { var e = this.context, n = this[0]; return t === r ? e.length && n.length ? G(e[0], n[0].row, n[0].column) : r : ($(e[0], n[0].row, n[0].column, t), rt(e[0], n[0].row, "data", n[0].column), this) })), i("order()", (function (t, e) { var n = this.context; return t === r ? 0 !== n.length ? n[0].aaSorting : r : ("number" == typeof t ? t = [[t, e]] : t.length && !Array.isArray(t[0]) && (t = Array.prototype.slice.call(arguments)), this.iterator("table", (function (e) { e.aaSorting = t.slice() }))) })), i("order.listener()", (function (t, e, n) { return this.iterator("table", (function (r) { ne(r, t, e, n) })) })), i("order.fixed()", (function (e) { if (!e) { var n = this.context, a = n.length ? n[0].aaSortingFixed : r; return Array.isArray(a) ? { pre: a } : a } return this.iterator("table", (function (n) { n.aaSortingFixed = t.extend(!0, {}, e) })) })), i(["columns().order()", "column().order()"], (function (e) { var n = this; return this.iterator("table", (function (r, a) { var o = []; t.each(n[a], (function (t, n) { o.push([n, e]) })), r.aaSorting = o })) })), i("search()", (function (e, n, a, o) { var i = this.context; return e === r ? 0 !== i.length ? i[0].oPreviousSearch.sSearch : r : this.iterator("table", (function (r) { r.oFeatures.bFilter && yt(r, t.extend({}, r.oPreviousSearch, { sSearch: e + "", bRegex: null !== n && n, bSmart: null === a || a, bCaseInsensitive: null === o || o }), 1) })) })), l("columns().search()", "column().search()", (function (e, n, a, o) { return this.iterator("column", (function (i, l) { var s = i.aoPreSearchCols; if (e === r) return s[l].sSearch; i.oFeatures.bFilter && (t.extend(s[l], { sSearch: e + "", bRegex: null !== n && n, bSmart: null === a || a, bCaseInsensitive: null === o || o }), yt(i, i.oPreviousSearch, 1)) })) })), i("state()", (function () { return this.context.length ? this.context[0].oSavedState : null })), i("state.clear()", (function () { return this.iterator("table", (function (t) { t.fnStateSaveCallback.call(t.oInstance, t, {}) })) })), i("state.loaded()", (function () { return this.context.length ? this.context[0].oLoadedState : null })), i("state.save()", (function () { return this.iterator("table", (function (t) { oe(t) })) })), s.use = function (r, a) { "lib" === a || r.fn ? t = r : ("win" == a || r.document) && (e = r, n = r.document) }, s.factory = function (r, a) { var o = !1; return r && r.document && (e = r, n = r.document), a && a.fn && a.fn.jquery && (t = a, o = !0), o }, s.versionCheck = s.fnVersionCheck = function (t) { for (var e, n, r = s.version.split("."), a = t.split("."), o = 0, i = a.length; o < i; o++)if ((e = parseInt(r[o], 10) || 0) !== (n = parseInt(a[o], 10) || 0)) return e > n; return !0 }, s.isDataTable = s.fnIsDataTable = function (e) { var n = t(e).get(0), r = !1; return e instanceof s.Api || (t.each(s.settings, (function (e, a) { var o = a.nScrollHead ? t("table", a.nScrollHead)[0] : null, i = a.nScrollFoot ? t("table", a.nScrollFoot)[0] : null; a.nTable !== n && o !== n && i !== n || (r = !0) })), r) }, s.tables = s.fnTables = function (e) { var n = !1; t.isPlainObject(e) && (n = e.api, e = e.visible); var r = t.map(s.settings, (function (n) { if (!e || e && t(n.nTable).is(":visible")) return n.nTable })); return n ? new o(r) : r }, s.camelToHungarian = F, i("$()", (function (e, n) { var r = this.rows(n).nodes(), a = t(r); return t([].concat(a.filter(e).toArray(), a.find(e).toArray())) })), t.each(["on", "one", "off"], (function (e, n) { i(n + "()", (function () { var e = Array.prototype.slice.call(arguments); e[0] = t.map(e[0].split(/\s/), (function (t) { return t.match(/\.dt\b/) ? t : t + ".dt" })).join(" "); var r = t(this.tables().nodes()); return r[n].apply(r, e), this })) })), i("clear()", (function () { return this.iterator("table", (function (t) { et(t) })) })), i("settings()", (function () { return new o(this.context, this.context) })), i("init()", (function () { var t = this.context; return t.length ? t[0].oInit : null })), i("data()", (function () { return this.iterator("table", (function (t) { return y(t.aoData, "_aData") })).flatten() })), i("destroy()", (function (n) { return n = n || !1, this.iterator("table", (function (r) { var a, i = r.oClasses, l = r.nTable, u = r.nTBody, c = r.nTHead, f = r.nTFoot, d = t(l), h = t(u), p = t(r.nTableWrapper), g = t.map(r.aoData, (function (t) { return t.nTr })); r.bDestroying = !0, pe(r, "aoDestroyCallback", "destroy", [r]), n || new o(r).columns().visible(!0), p.off(".DT").find(":not(tbody *)").off(".DT"), t(e).off(".DT-" + r.sInstance), l != c.parentNode && (d.children("thead").detach(), d.append(c)), f && l != f.parentNode && (d.children("tfoot").detach(), d.append(f)), r.aaSorting = [], r.aaSortingFixed = [], re(r), t(g).removeClass(r.asStripeClasses.join(" ")), t("th, td", c).removeClass(i.sSortable + " " + i.sSortableAsc + " " + i.sSortableDesc + " " + i.sSortableNone), h.children().detach(), h.append(g); var b = r.nTableWrapper.parentNode, v = n ? "remove" : "detach"; d[v](), p[v](), !n && b && (b.insertBefore(l, r.nTableReinsertBefore), d.css("width", r.sDestroyWidth).removeClass(i.sTable), (a = r.asDestroyStripes.length) && h.children().each((function (e) { t(this).addClass(r.asDestroyStripes[e % a]) }))); var m = t.inArray(r, s.settings); -1 !== m && s.settings.splice(m, 1) })) })), t.each(["column", "row", "cell"], (function (t, e) { i(e + "s().every()", (function (t) { var n = this.selector.opts, a = this; return this.iterator(e, (function (o, i, l, s, u) { t.call(a[e](i, "cell" === e ? l : n, "cell" === e ? n : r), i, l, s, u) })) })) })), i("i18n()", (function (e, n, a) { var o = this.context[0], i = K(e)(o.oLanguage); return i === r && (i = n), a !== r && t.isPlainObject(i) && (i = i[a] !== r ? i[a] : i._), i.replace("%d", a) })), s.version = "1.13.4", s.settings = [], s.models = {}, s.models.oSearch = { bCaseInsensitive: !0, sSearch: "", bRegex: !1, bSmart: !0, return: !1 }, s.models.oRow = { nTr: null, anCells: null, _aData: [], _aSortData: null, _aFilterData: null, _sFilterRow: null, _sRowStripe: "", src: null, idx: -1 }, s.models.oColumn = { idx: null, aDataSort: null, asSorting: null, bSearchable: null, bSortable: null, bVisible: null, _sManualType: null, _bAttrSrc: !1, fnCreatedCell: null, fnGetData: null, fnSetData: null, mData: null, mRender: null, nTh: null, nTf: null, sClass: null, sContentPadding: null, sDefaultContent: null, sName: null, sSortDataType: "std", sSortingClass: null, sSortingClassJUI: null, sTitle: null, sType: null, sWidth: null, sWidthOrig: null }, s.defaults = { aaData: null, aaSorting: [[0, "asc"]], aaSortingFixed: [], ajax: null, aLengthMenu: [10, 25, 50, 100], aoColumns: null, aoColumnDefs: null, aoSearchCols: [], asStripeClasses: null, bAutoWidth: !0, bDeferRender: !1, bDestroy: !1, bFilter: !0, bInfo: !0, bLengthChange: !0, bPaginate: !0, bProcessing: !1, bRetrieve: !1, bScrollCollapse: !1, bServerSide: !1, bSort: !0, bSortMulti: !0, bSortCellsTop: !1, bSortClasses: !0, bStateSave: !1, fnCreatedRow: null, fnDrawCallback: null, fnFooterCallback: null, fnFormatNumber: function (t) { return t.toString().replace(/\B(?=(\d{3})+(?!\d))/g, this.oLanguage.sThousands) }, fnHeaderCallback: null, fnInfoCallback: null, fnInitComplete: null, fnPreDrawCallback: null, fnRowCallback: null, fnServerData: null, fnServerParams: null, fnStateLoadCallback: function (t) { try { return JSON.parse((-1 === t.iStateDuration ? sessionStorage : localStorage).getItem("DataTables_" + t.sInstance + "_" + location.pathname)) } catch (t) { return {} } }, fnStateLoadParams: null, fnStateLoaded: null, fnStateSaveCallback: function (t, e) { try { (-1 === t.iStateDuration ? sessionStorage : localStorage).setItem("DataTables_" + t.sInstance + "_" + location.pathname, JSON.stringify(e)) } catch (t) { } }, fnStateSaveParams: null, iStateDuration: 7200, iDeferLoading: null, iDisplayLength: 10, iDisplayStart: 0, iTabIndex: 0, oClasses: {}, oLanguage: { oAria: { sSortAscending: ": activate to sort column ascending", sSortDescending: ": activate to sort column descending" }, oPaginate: { sFirst: "First", sLast: "Last", sNext: "Next", sPrevious: "Previous" }, sEmptyTable: "No data available in table", sInfo: "Showing _START_ to _END_ of _TOTAL_ entries", sInfoEmpty: "Showing 0 to 0 of 0 entries", sInfoFiltered: "(filtered from _MAX_ total entries)", sInfoPostFix: "", sDecimal: "", sThousands: ",", sLengthMenu: "Show _MENU_ entries", sLoadingRecords: "Loading...", sProcessing: "", sSearch: "Search:", sSearchPlaceholder: "", sUrl: "", sZeroRecords: "No matching records found" }, oSearch: t.extend({}, s.models.oSearch), sAjaxDataProp: "data", sAjaxSource: null, sDom: "lfrtip", searchDelay: null, sPaginationType: "simple_numbers", sScrollX: "", sScrollXInner: "", sScrollY: "", sServerMethod: "GET", renderer: null, rowId: "DT_RowId" }, I(s.defaults), s.defaults.column = { aDataSort: null, iDataSort: -1, asSorting: ["asc", "desc"], bSearchable: !0, bSortable: !0, bVisible: !0, fnCreatedCell: null, mData: null, mRender: null, sCellType: "td", sClass: "", sContentPadding: "", sDefaultContent: null, sName: "", sSortDataType: "std", sTitle: null, sType: null, sWidth: null }, I(s.defaults.column), s.models.oSettings = { oFeatures: { bAutoWidth: null, bDeferRender: null, bFilter: null, bInfo: null, bLengthChange: null, bPaginate: null, bProcessing: null, bServerSide: null, bSort: null, bSortMulti: null, bSortClasses: null, bStateSave: null }, oScroll: { bCollapse: null, iBarWidth: 0, sX: null, sXInner: null, sY: null }, oLanguage: { fnInfoCallback: null }, oBrowser: { bScrollOversize: !1, bScrollbarLeft: !1, bBounding: !1, barWidth: 0 }, ajax: null, aanFeatures: [], aoData: [], aiDisplay: [], aiDisplayMaster: [], aIds: {}, aoColumns: [], aoHeader: [], aoFooter: [], oPreviousSearch: {}, aoPreSearchCols: [], aaSorting: null, aaSortingFixed: [], asStripeClasses: null, asDestroyStripes: [], sDestroyWidth: 0, aoRowCallback: [], aoHeaderCallback: [], aoFooterCallback: [], aoDrawCallback: [], aoRowCreatedCallback: [], aoPreDrawCallback: [], aoInitComplete: [], aoStateSaveParams: [], aoStateLoadParams: [], aoStateLoaded: [], sTableId: "", nTable: null, nTHead: null, nTFoot: null, nTBody: null, nTableWrapper: null, bDeferLoading: !1, bInitialised: !1, aoOpenRows: [], sDom: null, searchDelay: null, sPaginationType: "two_button", iStateDuration: 0, aoStateSave: [], aoStateLoad: [], oSavedState: null, oLoadedState: null, sAjaxSource: null, sAjaxDataProp: null, jqXHR: null, json: r, oAjaxData: r, fnServerData: null, aoServerParams: [], sServerMethod: null, fnFormatNumber: null, aLengthMenu: null, iDraw: 0, bDrawing: !1, iDrawError: -1, _iDisplayLength: 10, _iDisplayStart: 0, _iRecordsTotal: 0, _iRecordsDisplay: 0, oClasses: {}, bFiltered: !1, bSorted: !1, bSortCellsTop: null, oInit: null, aoDestroyCallback: [], fnRecordsTotal: function () { return "ssp" == ve(this) ? 1 * this._iRecordsTotal : this.aiDisplayMaster.length }, fnRecordsDisplay: function () { return "ssp" == ve(this) ? 1 * this._iRecordsDisplay : this.aiDisplay.length }, fnDisplayEnd: function () { var t = this._iDisplayLength, e = this._iDisplayStart, n = e + t, r = this.aiDisplay.length, a = this.oFeatures, o = a.bPaginate; return a.bServerSide ? !1 === o || -1 === t ? e + r : Math.min(e + t, this._iRecordsDisplay) : !o || n > r || -1 === t ? r : n }, oInstance: null, sInstance: null, iTabIndex: 0, nScrollHead: null, nScrollFoot: null, aLastSort: [], oPlugins: {}, rowIdFn: null, rowId: null }, s.ext = a = { buttons: {}, classes: {}, builder: "-source-", errMode: "alert", feature: [], search: [], selector: { cell: [], column: [], row: [] }, internal: {}, legacy: { ajax: null }, pager: {}, renderer: { pageButton: {}, header: {} }, order: {}, type: { detect: [], search: {}, order: {} }, _unique: 0, fnVersionCheck: s.fnVersionCheck, iApiIndex: 0, oJUIClasses: {}, sVersion: s.version }, t.extend(a, { afnFiltering: a.search, aTypes: a.type.detect, ofnSearch: a.type.search, oSort: a.type.order, afnSortData: a.order, aoFeatures: a.feature, oApi: a.internal, oStdClasses: a.classes, oPagination: a.pager }), t.extend(s.ext.classes, { sTable: "dataTable", sNoFooter: "no-footer", sPageButton: "paginate_button", sPageButtonActive: "current", sPageButtonDisabled: "disabled", sStripeOdd: "odd", sStripeEven: "even", sRowEmpty: "dataTables_empty", sWrapper: "dataTables_wrapper", sFilter: "dataTables_filter", sInfo: "dataTables_info", sPaging: "dataTables_paginate paging_", sLength: "dataTables_length", sProcessing: "dataTables_processing", sSortAsc: "sorting_asc", sSortDesc: "sorting_desc", sSortable: "sorting", sSortableAsc: "sorting_desc_disabled", sSortableDesc: "sorting_asc_disabled", sSortableNone: "sorting_disabled", sSortColumn: "sorting_", sFilterInput: "", sLengthSelect: "", sScrollWrapper: "dataTables_scroll", sScrollHead: "dataTables_scrollHead", sScrollHeadInner: "dataTables_scrollHeadInner", sScrollBody: "dataTables_scrollBody", sScrollFoot: "dataTables_scrollFoot", sScrollFootInner: "dataTables_scrollFootInner", sHeaderTH: "", sFooterTH: "", sSortJUIAsc: "", sSortJUIDesc: "", sSortJUI: "", sSortJUIAscAllowed: "", sSortJUIDescAllowed: "", sSortJUIWrapper: "", sSortIcon: "", sJUIHeader: "", sJUIFooter: "" }); var Ne = s.ext.pager; function He(t, e) { var n = [], r = Ne.numbers_length, a = Math.floor(r / 2); return e <= r ? n = _(0, e) : t <= a ? ((n = _(0, r - 2)).push("ellipsis"), n.push(e - 1)) : t >= e - 1 - a ? ((n = _(e - (r - 2), e)).splice(0, 0, "ellipsis"), n.splice(0, 0, 0)) : ((n = _(t - a + 2, t + a - 1)).push("ellipsis"), n.push(e - 1), n.splice(0, 0, "ellipsis"), n.splice(0, 0, 0)), n.DT_el = "span", n } t.extend(Ne, { simple: function (t, e) { return ["previous", "next"] }, full: function (t, e) { return ["first", "previous", "next", "last"] }, numbers: function (t, e) { return [He(t, e)] }, simple_numbers: function (t, e) { return ["previous", He(t, e), "next"] }, full_numbers: function (t, e) { return ["first", "previous", He(t, e), "next", "last"] }, first_last_numbers: function (t, e) { return ["first", He(t, e), "last"] }, _numbers: He, numbers_length: 7 }), t.extend(!0, s.ext.renderer, { pageButton: { _: function (e, a, o, i, l, s) { var u, c, f, d = e.oClasses, h = e.oLanguage.oPaginate, p = e.oLanguage.oAria.paginate || {}, g = function (n, r) { var a, i, f, b, v = d.sPageButtonDisabled, m = function (t) { Wt(e, t.data.action, !0) }; for (a = 0, i = r.length; a < i; a++)if (f = r[a], Array.isArray(f)) { var S = t("<" + (f.DT_el || "div") + "/>").appendTo(n); g(S, f) } else { switch (u = null, c = f, b = e.iTabIndex, f) { case "ellipsis": n.append('
… '); break; case "first": u = h.sFirst, 0 === l && (b = -1, c += " " + v); break; case "previous": u = h.sPrevious, 0 === l && (b = -1, c += " " + v); break; case "next": u = h.sNext, 0 !== s && l !== s - 1 || (b = -1, c += " " + v); break; case "last": u = h.sLast, 0 !== s && l !== s - 1 || (b = -1, c += " " + v); break; default: u = e.fnFormatNumber(f + 1), c = l === f ? d.sPageButtonActive : "" }if (null !== u) { var y = e.oInit.pagingTag || "a", D = -1 !== c.indexOf(v); de(t("<" + y + ">", { class: d.sPageButton + " " + c, "aria-controls": e.sTableId, "aria-disabled": D ? "true" : null, "aria-label": p[f], "aria-role": "link", "aria-current": c === d.sPageButtonActive ? "page" : null, "data-dt-idx": f, tabindex: b, id: 0 === o && "string" == typeof f ? e.sTableId + "_" + f : null }).html(u).appendTo(n), { action: f }, m) } } }; try { f = t(a).find(n.activeElement).data("dt-idx") } catch (t) { } g(t(a).empty(), i), f !== r && t(a).find("[data-dt-idx=" + f + "]").trigger("focus") } } }), t.extend(s.ext.type.detect, [function (t, e) { var n = e.oLanguage.sDecimal; return m(t, n) ? "num" + n : null }, function (t, e) { if (t && !(t instanceof Date) && !d.test(t)) return null; var n = Date.parse(t); return null !== n && !isNaN(n) || g(t) ? "date" : null }, function (t, e) { var n = e.oLanguage.sDecimal; return m(t, n, !0) ? "num-fmt" + n : null }, function (t, e) { var n = e.oLanguage.sDecimal; return S(t, n) ? "html-num" + n : null }, function (t, e) { var n = e.oLanguage.sDecimal; return S(t, n, !0) ? "html-num-fmt" + n : null }, function (t, e) { return g(t) || "string" == typeof t && -1 !== t.indexOf("<") ? "html" : null }]), t.extend(s.ext.type.search, { html: function (t) { return g(t) ? t : "string" == typeof t ? t.replace(c, " ").replace(f, "") : "" }, string: function (t) { return g(t) ? t : "string" == typeof t ? t.replace(c, " ") : t } }); var Oe = function (t, e, n, r) { if (0 !== t && (!t || "-" === t)) return -1 / 0; let a = typeof t; return "number" === a || "bigint" === a ? t : (e && (t = v(t, e)), t.replace && (n && (t = t.replace(n, "")), r && (t = t.replace(r, ""))), 1 * t) }; function ke(e) { t.each({ num: function (t) { return Oe(t, e) }, "num-fmt": function (t) { return Oe(t, e, p) }, "html-num": function (t) { return Oe(t, e, f) }, "html-num-fmt": function (t) { return Oe(t, e, f, p) } }, (function (t, n) { a.type.order[t + e + "-pre"] = n, t.match(/^html\-/) && (a.type.search[t + e] = a.type.search.html) })) } t.extend(a.type.order, { "date-pre": function (t) { var e = Date.parse(t); return isNaN(e) ? -1 / 0 : e }, "html-pre": function (t) { return g(t) ? "" : t.replace ? t.replace(/<.*?>/g, "").toLowerCase() : t + "" }, "string-pre": function (t) { return g(t) ? "" : "string" == typeof t ? t.toLowerCase() : t.toString ? t.toString() : "" }, "string-asc": function (t, e) { return t < e ? -1 : t > e ? 1 : 0 }, "string-desc": function (t, e) { return t < e ? 1 : t > e ? -1 : 0 } }), ke(""), t.extend(!0, s.ext.renderer, { header: { _: function (e, n, r, a) { t(e.nTable).on("order.dt.DT", (function (t, o, i, l) { if (e === o) { var s = r.idx; n.removeClass(a.sSortAsc + " " + a.sSortDesc).addClass("asc" == l[s] ? a.sSortAsc : "desc" == l[s] ? a.sSortDesc : r.sSortingClass) } })) }, jqueryui: function (e, n, r, a) { t("
").addClass(a.sSortJUIWrapper).append(n.contents()).append(t("
").addClass(a.sSortIcon + " " + r.sSortingClassJUI)).appendTo(n), t(e.nTable).on("order.dt.DT", (function (t, o, i, l) { if (e === o) { var s = r.idx; n.removeClass(a.sSortAsc + " " + a.sSortDesc).addClass("asc" == l[s] ? a.sSortAsc : "desc" == l[s] ? a.sSortDesc : r.sSortingClass), n.find("span." + a.sSortIcon).removeClass(a.sSortJUIAsc + " " + a.sSortJUIDesc + " " + a.sSortJUI + " " + a.sSortJUIAscAllowed + " " + a.sSortJUIDescAllowed).addClass("asc" == l[s] ? a.sSortJUIAsc : "desc" == l[s] ? a.sSortJUIDesc : r.sSortingClassJUI) } })) } } }); var Me = function (t) { return Array.isArray(t) && (t = t.join(",")), "string" == typeof t ? t.replace(/&/g, "&").replace(//g, ">").replace(/"/g, """) : t }; function We(t, n, r, a, o) { return e.moment ? t[n](o) : e.luxon ? t[r](o) : a ? t[a](o) : t } var Ee = !1; function Be(t, n, r) { var a; if (e.moment) { if (!(a = e.moment.utc(t, n, r, !0)).isValid()) return null } else if (e.luxon) { if (!(a = n && "string" == typeof t ? e.luxon.DateTime.fromFormat(t, n) : e.luxon.DateTime.fromISO(t)).isValid) return null; a.setLocale(r) } else n ? (Ee || alert("DataTables warning: Formatted date without Moment.js or Luxon - https://datatables.net/tn/17"), Ee = !0) : a = new Date(t); return a } function Ue(t) { return function (e, n, a, o) { 0 === arguments.length ? (a = "en", n = null, e = null) : 1 === arguments.length ? (a = "en", n = e, e = null) : 2 === arguments.length && (a = n, n = e, e = null); var i = "datetime-" + n; return s.ext.type.order[i] || (s.ext.type.detect.unshift((function (t) { return t === i && i })), s.ext.type.order[i + "-asc"] = function (t, e) { var n = t.valueOf(), r = e.valueOf(); return n === r ? 0 : n < r ? -1 : 1 }, s.ext.type.order[i + "-desc"] = function (t, e) { var n = t.valueOf(), r = e.valueOf(); return n === r ? 0 : n > r ? -1 : 1 }), function (l, s) { if (null === l || l === r) if ("--now" === o) { var u = new Date; l = new Date(Date.UTC(u.getFullYear(), u.getMonth(), u.getDate(), u.getHours(), u.getMinutes(), u.getSeconds())) } else l = ""; if ("type" === s) return i; if ("" === l) return "sort" !== s ? "" : Be("0000-01-01 00:00:00", null, a); if (null !== n && e === n && "sort" !== s && "type" !== s && !(l instanceof Date)) return l; var c = Be(l, e, a); if (null === c) return l; if ("sort" === s) return c; var f = null === n ? We(c, "toDate", "toJSDate", "")[t]() : We(c, "format", "toFormat", "toISOString", n); return "display" === s ? Me(f) : f } } } var Ve = ",", Xe = "."; if (Intl) try { for (var Je = (new Intl.NumberFormat).formatToParts(100000.1), qe = 0; qe < Je.length; qe++)"group" === Je[qe].type ? Ve = Je[qe].value : "decimal" === Je[qe].type && (Xe = Je[qe].value) } catch (t) { } function Ge(t) { return function () { var e = [se(this[s.ext.iApiIndex])].concat(Array.prototype.slice.call(arguments)); return s.ext.internal[t].apply(this, e) } } return s.datetime = function (t, e) { var n = "datetime-detect-" + t; e || (e = "en"), s.ext.type.order[n] || (s.ext.type.detect.unshift((function (r) { var a = Be(r, t, e); return !("" !== r && !a) && n })), s.ext.type.order[n + "-pre"] = function (n) { return Be(n, t, e) || 0 }) }, s.render = { date: Ue("toLocaleDateString"), datetime: Ue("toLocaleString"), time: Ue("toLocaleTimeString"), number: function (t, e, n, a, o) { return null !== t && t !== r || (t = Ve), null !== e && e !== r || (e = Xe), { display: function (r) { if ("number" != typeof r && "string" != typeof r) return r; if ("" === r || null === r) return r; var i = r < 0 ? "-" : "", l = parseFloat(r); if (isNaN(l)) return Me(r); l = l.toFixed(n), r = Math.abs(l); var s = parseInt(r, 10), u = n ? e + (r - s).toFixed(n).substring(2) : ""; return 0 === s && 0 === parseFloat(u) && (i = ""), i + (a || "") + s.toString().replace(/\B(?=(\d{3})+(?!\d))/g, t) + u + (o || "") } } }, text: function () { return { display: Me, filter: Me } } }, t.extend(s.ext.internal, { _fnExternApiFunc: Ge, _fnBuildAjax: pt, _fnAjaxUpdate: gt, _fnAjaxParameters: bt, _fnAjaxUpdateDraw: vt, _fnAjaxDataSrc: mt, _fnAddColumn: O, _fnColumnOptions: k, _fnAdjustColumnSizing: M, _fnVisibleToColumnIndex: W, _fnColumnIndexToVisible: E, _fnVisbleColumns: B, _fnGetColumns: U, _fnColumnTypes: V, _fnApplyColumnDefs: X, _fnHungarianMap: I, _fnCamelToHungarian: F, _fnLanguageCompat: L, _fnBrowserDetect: N, _fnAddData: J, _fnAddTr: q, _fnNodeToDataIndex: function (t, e) { return e._DT_RowIndex !== r ? e._DT_RowIndex : null }, _fnNodeToColumnIndex: function (e, n, r) { return t.inArray(r, e.aoData[n].anCells) }, _fnGetCellData: G, _fnSetCellData: $, _fnSplitObjNotation: Z, _fnGetObjectDataFn: K, _fnSetObjectDataFn: Q, _fnGetDataMaster: tt, _fnClearTable: et, _fnDeleteIndex: nt, _fnInvalidate: rt, _fnGetRowElements: at, _fnCreateTr: ot, _fnBuildHead: lt, _fnDrawHead: st, _fnDraw: ut, _fnReDraw: ct, _fnAddOptionsHtml: ft, _fnDetectHeader: dt, _fnGetUniqueThs: ht, _fnFeatureHtmlFilter: St, _fnFilterComplete: yt, _fnFilterCustom: Dt, _fnFilterColumn: _t, _fnFilter: wt, _fnFilterCreateSearch: Ct, _fnEscapeRegex: Tt, _fnFilterData: It, _fnFeatureHtmlInfo: Rt, _fnUpdateInfo: Pt, _fnInfoMacros: jt, _fnInitialise: Nt, _fnInitComplete: Ht, _fnLengthChange: Ot, _fnFeatureHtmlLength: kt, _fnFeatureHtmlPaginate: Mt, _fnPageChange: Wt, _fnFeatureHtmlProcessing: Et, _fnProcessingDisplay: Bt, _fnFeatureHtmlTable: Ut, _fnScrollDraw: Vt, _fnApplyToChildren: Xt, _fnCalculateColumnWidths: qt, _fnThrottle: Gt, _fnConvertToWidth: $t, _fnGetWidestNode: zt, _fnGetMaxLenString: Yt, _fnStringToCss: Zt, _fnSortFlatten: Kt, _fnSort: Qt, _fnSortAria: te, _fnSortListener: ee, _fnSortAttachListener: ne, _fnSortingClasses: re, _fnSortData: ae, _fnSaveState: oe, _fnLoadState: ie, _fnImplementState: le, _fnSettingsFromNode: se, _fnLog: ue, _fnMap: ce, _fnBindAction: de, _fnCallbackReg: he, _fnCallbackFire: pe, _fnLengthOverflow: ge, _fnRenderer: be, _fnDataSource: ve, _fnRowAttributes: it, _fnExtend: fe, _fnCalculateEnd: function () { } }), t.fn.dataTable = s, s.$ = t, t.fn.dataTableSettings = s.settings, t.fn.dataTableExt = s.ext, t.fn.DataTable = function (e) { return t(this).dataTable(e).api() }, t.each(s, (function (e, n) { t.fn.DataTable[e] = n })), s }));;
/*! Responsive 2.4.1
* ? SpryMedia Ltd - datatables.net/license
*/
!function(n){var i,r;"function"==typeof define&&define.amd?define(["jquery","datatables.net"],function(e){return n(e,window,document)}):"object"==typeof exports?(i=require("jquery"),r=function(e,t){t.fn.dataTable||require("datatables.net")(e,t)},"undefined"!=typeof window?module.exports=function(e,t){return e=e||window,t=t||i(e),r(e,t),n(t,e,e.document)}:(r(window,i),module.exports=n(i,window,window.document))):n(jQuery,window,document)}(function(f,m,o,h){"use strict";function d(e,t){if(!r.versionCheck||!r.versionCheck("1.10.10"))throw"DataTables Responsive requires DataTables 1.10.10 or newer";this.s={childNodeStore:{},columns:[],current:[],dt:new r.Api(e)},this.s.dt.settings()[0].responsive||(t&&"string"==typeof t.details?t.details={type:t.details}:t&&!1===t.details?t.details={type:!1}:t&&!0===t.details&&(t.details={type:"inline"}),this.c=f.extend(!0,{},d.defaults,r.defaults.responsive,t),(e.responsive=this)._constructor())}var r=f.fn.dataTable,e=(f.extend(d.prototype,{_constructor:function(){var s=this,i=this.s.dt,e=i.settings()[0],t=f(m).innerWidth(),e=(i.settings()[0]._responsive=this,f(m).on("resize.dtr orientationchange.dtr",r.util.throttle(function(){var e=f(m).innerWidth();e!==t&&(s._resize(),t=e)})),e.oApi._fnCallbackReg(e,"aoRowCreatedCallback",function(e,t,n){-1!==f.inArray(!1,s.s.current)&&f(">td, >th",e).each(function(e){e=i.column.index("toData",e);!1===s.s.current[e]&&f(this).css("display","none")})}),i.on("destroy.dtr",function(){i.off(".dtr"),f(i.table().body()).off(".dtr"),f(m).off("resize.dtr orientationchange.dtr"),i.cells(".dtr-control").nodes().to$().removeClass("dtr-control"),f.each(s.s.current,function(e,t){!1===t&&s._setColumnVis(e,!0)})}),this.c.breakpoints.sort(function(e,t){return e.width
t.width?-1:0}),this._classLogic(),this._resizeAuto(),this.c.details);!1!==e.type&&(s._detailsInit(),i.on("column-visibility.dtr",function(){s._timer&&clearTimeout(s._timer),s._timer=setTimeout(function(){s._timer=null,s._classLogic(),s._resizeAuto(),s._resize(!0),s._redrawChildren()},100)}),i.on("draw.dtr",function(){s._redrawChildren()}),f(i.table().node()).addClass("dtr-"+e.type)),i.on("column-reorder.dtr",function(e,t,n){s._classLogic(),s._resizeAuto(),s._resize(!0)}),i.on("column-sizing.dtr",function(){s._resizeAuto(),s._resize()}),i.on("column-calc.dt",function(e,t){for(var n=s.s.current,i=0;i=r&&u(e,l[s].name);else if("not-"===n)for(s=0,o=l.length;s ").append(r).appendTo(i)),f(" ").append(n).appendTo(t),"inline"===this.c.details.type&&f(e).addClass("dtr-inline collapsed"),f(e).find("[name]").removeAttr("name"),f(e).css("position","relative"),(r=f("
").css({width:1,height:1,overflow:"hidden",clear:"both"}).append(e)).insertBefore(s.table().node()),n.each(function(e){e=s.column.index("fromVisible",e);o[e].minWidth=this.offsetWidth||0}),r.remove())},_responsiveOnlyHidden:function(){var n=this.s.dt;return f.map(this.s.current,function(e,t){return!1===n.column(t).visible()||e})},_setColumnVis:function(e,t){var n=this,i=this.s.dt,r=t?"":"none";f(i.column(e).header()).css("display",r).toggleClass("dtr-hidden",!t),f(i.column(e).footer()).css("display",r).toggleClass("dtr-hidden",!t),i.column(e).nodes().to$().css("display",r).toggleClass("dtr-hidden",!t),f.isEmptyObject(this.s.childNodeStore)||i.cells(null,e).indexes().each(function(e){n._childNodesRestore(i,e.row,e.column)})},_tabIndexes:function(){var e=this.s.dt,t=e.cells({page:"current"}).nodes().to$(),n=e.settings()[0],i=this.c.details.target;t.filter("[data-dtr-keyboard]").removeData("[data-dtr-keyboard]"),("number"==typeof i?e.cells(null,i,{page:"current"}).nodes().to$():f(i="td:first-child, th:first-child"===i?">td:first-child, >th:first-child":i,e.rows({page:"current"}).nodes())).attr("tabIndex",n.iTabIndex).data("dtr-keyboard",1)}}),d.defaults={breakpoints:d.breakpoints=[{name:"desktop",width:1/0},{name:"tablet-l",width:1024},{name:"tablet-p",width:768},{name:"mobile-l",width:480},{name:"mobile-p",width:320}],auto:!0,details:{display:(d.display={childRow:function(e,t,n){return t?f(e.node()).hasClass("parent")?(e.child(n(),"child").show(),!0):void 0:e.child.isShown()?(e.child(!1),f(e.node()).removeClass("parent"),!1):(e.child(n(),"child").show(),f(e.node()).addClass("parent"),!0)},childRowImmediate:function(e,t,n){return!t&&e.child.isShown()||!e.responsive.hasHidden()?(e.child(!1),f(e.node()).removeClass("parent"),!1):(e.child(n(),"child").show(),f(e.node()).addClass("parent"),!0)},modal:function(s){return function(e,t,n){var i,r;t?f("div.dtr-modal-content").empty().append(n()):(i=function(){r.remove(),f(o).off("keypress.dtr")},r=f('
').append(f('
').append(f('
').append(n())).append(f('×
').click(function(){i()}))).append(f('
').click(function(){i()})).appendTo("body"),f(o).on("keyup.dtr",function(e){27===e.keyCode&&(e.stopPropagation(),i())})),s&&s.header&&f("div.dtr-modal-content").prepend(""+s.header(e)+" ")}}}).childRow,renderer:(d.renderer={listHiddenNodes:function(){return function(i,e,t){var r=this,s=f(''),o=!1;f.each(t,function(e,t){var n;t.hidden&&(n=t.className?'class="'+t.className+'"':"",f("'+t.title+" ").append(f(' ').append(r._childNodes(i,t.rowIndex,t.columnIndex))).appendTo(s),o=!0)});return!!o&&s}},listHidden:function(){return function(e,t,n){n=f.map(n,function(e){var t=e.className?'class="'+e.className+'"':"";return e.hidden?"'+e.title+' '+e.data+" ":""}).join("");return!!n&&f('').append(n)}},tableAll:function(i){return i=f.extend({tableClass:""},i),function(e,t,n){n=f.map(n,function(e){return"'+e.title+": "+e.data+" "}).join("");return f('').append(n)}}}).listHidden(),target:0,type:"inline"},orthogonal:"display"},f.fn.dataTable.Api);return e.register("responsive()",function(){return this}),e.register("responsive.index()",function(e){return{column:(e=f(e)).data("dtr-index"),row:e.parent().data("dtr-index")}}),e.register("responsive.rebuild()",function(){return this.iterator("table",function(e){e._responsive&&e._responsive._classLogic()})}),e.register("responsive.recalc()",function(){return this.iterator("table",function(e){e._responsive&&(e._responsive._resizeAuto(),e._responsive._resize())})}),e.register("responsive.hasHidden()",function(){var e=this.context[0];return!!e._responsive&&-1!==f.inArray(!1,e._responsive._responsiveOnlyHidden())}),e.registerPlural("columns().responsiveHidden()","column().responsiveHidden()",function(){return this.iterator("column",function(e,t){return!!e._responsive&&e._responsive._responsiveOnlyHidden()[t]},1)}),d.version="2.4.1",f.fn.dataTable.Responsive=d,f.fn.DataTable.Responsive=d,f(o).on("preInit.dt.dtr",function(e,t,n){"dt"===e.namespace&&(f(t.nTable).hasClass("responsive")||f(t.nTable).hasClass("dt-responsive")||t.oInit.responsive||r.defaults.responsive)&&!1!==(e=t.oInit.responsive)&&new d(t,f.isPlainObject(e)?e:{})}),r});;
/*!
* @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014 - 2017
* @version 1.3.4
*
* Date formatter utility library that allows formatting date/time variables or Date objects using PHP DateTime format.
* This library is a standalone javascript library and does not depend on other libraries or plugins like jQuery.
*
* @see http://php.net/manual/en/function.date.php
*
* For more JQuery plugins visit http://plugins.krajee.com
* For more Yii related demos visit http://demos.krajee.com
*/
var DateFormatter;
(function () {
"use strict";
var _compare, _lpad, _extend, _indexOf, defaultSettings, DAY, HOUR;
DAY = 1000 * 60 * 60 * 24;
HOUR = 3600;
_compare = function (str1, str2) {
return typeof (str1) === 'string' && typeof (str2) === 'string' && str1.toLowerCase() === str2.toLowerCase();
};
_lpad = function (value, length, chr) {
var val = value.toString();
chr = chr || '0';
return val.length < length ? _lpad(chr + val, length) : val;
};
_extend = function (out) {
var i, obj;
out = out || {};
for (i = 1; i < arguments.length; i++) {
obj = arguments[i];
if (!obj) {
continue;
}
for (var key in obj) {
if (obj.hasOwnProperty(key)) {
if (typeof obj[key] === 'object') {
_extend(out[key], obj[key]);
} else {
out[key] = obj[key];
}
}
}
}
return out;
};
_indexOf = function (val, arr) {
for (var i = 0; i < arr.length; i++) {
if (arr[i].toLowerCase() === val.toLowerCase()) {
return i;
}
}
return -1;
};
defaultSettings = {
dateSettings: {
days: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
daysShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
months: [
'January', 'February', 'March', 'April', 'May', 'June', 'July',
'August', 'September', 'October', 'November', 'December'
],
monthsShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
meridiem: ['AM', 'PM'],
ordinal: function (number) {
var n = number % 10, suffixes = { 1: 'st', 2: 'nd', 3: 'rd' };
return Math.floor(number % 100 / 10) === 1 || !suffixes[n] ? 'th' : suffixes[n];
}
},
separators: /[ \-+\/\.T:@]/g,
validParts: /[dDjlNSwzWFmMntLoYyaABgGhHisueTIOPZcrU]/g,
intParts: /[djwNzmnyYhHgGis]/g,
tzParts: /\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,
tzClip: /[^-+\dA-Z]/g
};
DateFormatter = function (options) {
var self = this, config = _extend(defaultSettings, options);
self.dateSettings = config.dateSettings;
self.separators = config.separators;
self.validParts = config.validParts;
self.intParts = config.intParts;
self.tzParts = config.tzParts;
self.tzClip = config.tzClip;
};
DateFormatter.prototype = {
constructor: DateFormatter,
getMonth: function (val) {
var self = this, i;
i = _indexOf(val, self.dateSettings.monthsShort) + 1;
if (i === 0) {
i = _indexOf(val, self.dateSettings.months) + 1;
}
return i;
},
parseDate: function (vDate, vFormat) {
var self = this, vFormatParts, vDateParts, i, vDateFlag = false, vTimeFlag = false, vDatePart, iDatePart,
vSettings = self.dateSettings, vMonth, vMeriIndex, vMeriOffset, len, mer,
out = { date: null, year: null, month: null, day: null, hour: 0, min: 0, sec: 0 };
if (!vDate) {
return null;
}
if (vDate instanceof Date) {
return vDate;
}
if (vFormat === 'U') {
i = parseInt(vDate);
return i ? new Date(i * 1000) : vDate;
}
switch (typeof vDate) {
case 'number':
return new Date(vDate);
case 'string':
break;
default:
return null;
}
vFormatParts = vFormat.match(self.validParts);
if (!vFormatParts || vFormatParts.length === 0) {
throw new Error("Invalid date format definition.");
}
vDateParts = vDate.replace(self.separators, '\0').split('\0');
for (i = 0; i < vDateParts.length; i++) {
vDatePart = vDateParts[i];
iDatePart = parseInt(vDatePart);
switch (vFormatParts[i]) {
case 'y':
case 'Y':
if (iDatePart) {
len = vDatePart.length;
out.year = len === 2 ? parseInt((iDatePart < 70 ? '20' : '19') + vDatePart) : iDatePart;
} else {
return null;
}
vDateFlag = true;
break;
case 'm':
case 'n':
case 'M':
case 'F':
if (isNaN(iDatePart)) {
vMonth = self.getMonth(vDatePart);
if (vMonth > 0) {
out.month = vMonth;
} else {
return null;
}
} else {
if (iDatePart >= 1 && iDatePart <= 12) {
out.month = iDatePart;
} else {
return null;
}
}
vDateFlag = true;
break;
case 'd':
case 'j':
if (iDatePart >= 1 && iDatePart <= 31) {
out.day = iDatePart;
} else {
return null;
}
vDateFlag = true;
break;
case 'g':
case 'h':
vMeriIndex = (vFormatParts.indexOf('a') > -1) ? vFormatParts.indexOf('a') :
(vFormatParts.indexOf('A') > -1) ? vFormatParts.indexOf('A') : -1;
mer = vDateParts[vMeriIndex];
if (vMeriIndex !== -1) {
vMeriOffset = _compare(mer, vSettings.meridiem[0]) ? 0 :
(_compare(mer, vSettings.meridiem[1]) ? 12 : -1);
if (iDatePart >= 1 && iDatePart <= 12 && vMeriOffset !== -1) {
out.hour = iDatePart % 12 === 0 ? vMeriOffset : iDatePart + vMeriOffset;
} else {
if (iDatePart >= 0 && iDatePart <= 23) {
out.hour = iDatePart;
}
}
} else {
if (iDatePart >= 0 && iDatePart <= 23) {
out.hour = iDatePart;
} else {
return null;
}
}
vTimeFlag = true;
break;
case 'G':
case 'H':
if (iDatePart >= 0 && iDatePart <= 23) {
out.hour = iDatePart;
} else {
return null;
}
vTimeFlag = true;
break;
case 'i':
if (iDatePart >= 0 && iDatePart <= 59) {
out.min = iDatePart;
} else {
return null;
}
vTimeFlag = true;
break;
case 's':
if (iDatePart >= 0 && iDatePart <= 59) {
out.sec = iDatePart;
} else {
return null;
}
vTimeFlag = true;
break;
}
}
if (vDateFlag === true && out.year && out.month && out.day) {
out.date = new Date(out.year, out.month - 1, out.day, out.hour, out.min, out.sec, 0);
} else {
if (vTimeFlag !== true) {
return null;
}
out.date = new Date(0, 0, 0, out.hour, out.min, out.sec, 0);
}
return out.date;
},
guessDate: function (vDateStr, vFormat) {
if (typeof vDateStr !== 'string') {
return vDateStr;
}
var self = this, vParts = vDateStr.replace(self.separators, '\0').split('\0'), vPattern = /^[djmn]/g, len,
vFormatParts = vFormat.match(self.validParts), vDate = new Date(), vDigit = 0, vYear, i, n, iPart, iSec;
if (!vPattern.test(vFormatParts[0])) {
return vDateStr;
}
for (i = 0; i < vParts.length; i++) {
vDigit = 2;
iPart = vParts[i];
iSec = parseInt(iPart.substr(0, 2));
if (isNaN(iSec)) {
return null;
}
switch (i) {
case 0:
if (vFormatParts[0] === 'm' || vFormatParts[0] === 'n') {
vDate.setMonth(iSec - 1);
} else {
vDate.setDate(iSec);
}
break;
case 1:
if (vFormatParts[0] === 'm' || vFormatParts[0] === 'n') {
vDate.setDate(iSec);
} else {
vDate.setMonth(iSec - 1);
}
break;
case 2:
vYear = vDate.getFullYear();
len = iPart.length;
vDigit = len < 4 ? len : 4;
vYear = parseInt(len < 4 ? vYear.toString().substr(0, 4 - len) + iPart : iPart.substr(0, 4));
if (!vYear) {
return null;
}
vDate.setFullYear(vYear);
break;
case 3:
vDate.setHours(iSec);
break;
case 4:
vDate.setMinutes(iSec);
break;
case 5:
vDate.setSeconds(iSec);
break;
}
n = iPart.substr(vDigit);
if (n.length > 0) {
vParts.splice(i + 1, 0, n);
}
}
return vDate;
},
parseFormat: function (vChar, vDate) {
var self = this, vSettings = self.dateSettings, fmt, backslash = /\\?(.?)/gi, doFormat = function (t, s) {
return fmt[t] ? fmt[t]() : s;
};
fmt = {
/////////
// DAY //
/////////
/**
* Day of month with leading 0: `01..31`
* @return {string}
*/
d: function () {
return _lpad(fmt.j(), 2);
},
/**
* Shorthand day name: `Mon...Sun`
* @return {string}
*/
D: function () {
return vSettings.daysShort[fmt.w()];
},
/**
* Day of month: `1..31`
* @return {number}
*/
j: function () {
return vDate.getDate();
},
/**
* Full day name: `Monday...Sunday`
* @return {number}
*/
l: function () {
return vSettings.days[fmt.w()];
},
/**
* ISO-8601 day of week: `1[Mon]..7[Sun]`
* @return {number}
*/
N: function () {
return fmt.w() || 7;
},
/**
* Day of week: `0[Sun]..6[Sat]`
* @return {number}
*/
w: function () {
return vDate.getDay();
},
/**
* Day of year: `0..365`
* @return {number}
*/
z: function () {
var a = new Date(fmt.Y(), fmt.n() - 1, fmt.j()), b = new Date(fmt.Y(), 0, 1);
return Math.round((a - b) / DAY);
},
//////////
// WEEK //
//////////
/**
* ISO-8601 week number
* @return {number}
*/
W: function () {
var a = new Date(fmt.Y(), fmt.n() - 1, fmt.j() - fmt.N() + 3), b = new Date(a.getFullYear(), 0, 4);
return _lpad(1 + Math.round((a - b) / DAY / 7), 2);
},
///////////
// MONTH //
///////////
/**
* Full month name: `January...December`
* @return {string}
*/
F: function () {
return vSettings.months[vDate.getMonth()];
},
/**
* Month w/leading 0: `01..12`
* @return {string}
*/
m: function () {
return _lpad(fmt.n(), 2);
},
/**
* Shorthand month name; `Jan...Dec`
* @return {string}
*/
M: function () {
return vSettings.monthsShort[vDate.getMonth()];
},
/**
* Month: `1...12`
* @return {number}
*/
n: function () {
return vDate.getMonth() + 1;
},
/**
* Days in month: `28...31`
* @return {number}
*/
t: function () {
return (new Date(fmt.Y(), fmt.n(), 0)).getDate();
},
//////////
// YEAR //
//////////
/**
* Is leap year? `0 or 1`
* @return {number}
*/
L: function () {
var Y = fmt.Y();
return (Y % 4 === 0 && Y % 100 !== 0 || Y % 400 === 0) ? 1 : 0;
},
/**
* ISO-8601 year
* @return {number}
*/
o: function () {
var n = fmt.n(), W = fmt.W(), Y = fmt.Y();
return Y + (n === 12 && W < 9 ? 1 : n === 1 && W > 9 ? -1 : 0);
},
/**
* Full year: `e.g. 1980...2010`
* @return {number}
*/
Y: function () {
return vDate.getFullYear();
},
/**
* Last two digits of year: `00...99`
* @return {string}
*/
y: function () {
return fmt.Y().toString().slice(-2);
},
//////////
// TIME //
//////////
/**
* Meridian lower: `am or pm`
* @return {string}
*/
a: function () {
return fmt.A().toLowerCase();
},
/**
* Meridian upper: `AM or PM`
* @return {string}
*/
A: function () {
var n = fmt.G() < 12 ? 0 : 1;
return vSettings.meridiem[n];
},
/**
* Swatch Internet time: `000..999`
* @return {string}
*/
B: function () {
var H = vDate.getUTCHours() * HOUR, i = vDate.getUTCMinutes() * 60, s = vDate.getUTCSeconds();
return _lpad(Math.floor((H + i + s + HOUR) / 86.4) % 1000, 3);
},
/**
* 12-Hours: `1..12`
* @return {number}
*/
g: function () {
return fmt.G() % 12 || 12;
},
/**
* 24-Hours: `0..23`
* @return {number}
*/
G: function () {
return vDate.getHours();
},
/**
* 12-Hours with leading 0: `01..12`
* @return {string}
*/
h: function () {
return _lpad(fmt.g(), 2);
},
/**
* 24-Hours w/leading 0: `00..23`
* @return {string}
*/
H: function () {
return _lpad(fmt.G(), 2);
},
/**
* Minutes w/leading 0: `00..59`
* @return {string}
*/
i: function () {
return _lpad(vDate.getMinutes(), 2);
},
/**
* Seconds w/leading 0: `00..59`
* @return {string}
*/
s: function () {
return _lpad(vDate.getSeconds(), 2);
},
/**
* Microseconds: `000000-999000`
* @return {string}
*/
u: function () {
return _lpad(vDate.getMilliseconds() * 1000, 6);
},
//////////////
// TIMEZONE //
//////////////
/**
* Timezone identifier: `e.g. Atlantic/Azores, ...`
* @return {string}
*/
e: function () {
var str = /\((.*)\)/.exec(String(vDate))[1];
return str || 'Coordinated Universal Time';
},
/**
* DST observed? `0 or 1`
* @return {number}
*/
I: function () {
var a = new Date(fmt.Y(), 0), c = Date.UTC(fmt.Y(), 0),
b = new Date(fmt.Y(), 6), d = Date.UTC(fmt.Y(), 6);
return ((a - c) !== (b - d)) ? 1 : 0;
},
/**
* Difference to GMT in hour format: `e.g. +0200`
* @return {string}
*/
O: function () {
var tzo = vDate.getTimezoneOffset(), a = Math.abs(tzo);
return (tzo > 0 ? '-' : '+') + _lpad(Math.floor(a / 60) * 100 + a % 60, 4);
},
/**
* Difference to GMT with colon: `e.g. +02:00`
* @return {string}
*/
P: function () {
var O = fmt.O();
return (O.substr(0, 3) + ':' + O.substr(3, 2));
},
/**
* Timezone abbreviation: `e.g. EST, MDT, ...`
* @return {string}
*/
T: function () {
var str = (String(vDate).match(self.tzParts) || [""]).pop().replace(self.tzClip, "");
return str || 'UTC';
},
/**
* Timezone offset in seconds: `-43200...50400`
* @return {number}
*/
Z: function () {
return -vDate.getTimezoneOffset() * 60;
},
////////////////////
// FULL DATE TIME //
////////////////////
/**
* ISO-8601 date
* @return {string}
*/
c: function () {
return 'Y-m-d\\TH:i:sP'.replace(backslash, doFormat);
},
/**
* RFC 2822 date
* @return {string}
*/
r: function () {
return 'D, d M Y H:i:s O'.replace(backslash, doFormat);
},
/**
* Seconds since UNIX epoch
* @return {number}
*/
U: function () {
return vDate.getTime() / 1000 || 0;
}
};
return doFormat(vChar, vChar);
},
formatDate: function (vDate, vFormat) {
var self = this, i, n, len, str, vChar, vDateStr = '', BACKSLASH = '\\';
if (typeof vDate === 'string') {
vDate = self.parseDate(vDate, vFormat);
if (!vDate) {
return null;
}
}
if (vDate instanceof Date) {
len = vFormat.length;
for (i = 0; i < len; i++) {
vChar = vFormat.charAt(i);
if (vChar === 'S' || vChar === BACKSLASH) {
continue;
}
if (i > 0 && vFormat.charAt(i - 1) === BACKSLASH) {
vDateStr += vChar;
continue;
}
str = self.parseFormat(vChar, vDate);
if (i !== (len - 1) && self.intParts.test(vChar) && vFormat.charAt(i + 1) === 'S') {
n = parseInt(str) || 0;
str += self.dateSettings.ordinal(n);
}
vDateStr += str;
}
return vDateStr;
}
return '';
}
};
})();
/**
* @preserve jQuery DateTimePicker plugin v2.5.4
* @homepage http://xdsoft.net/jqplugins/datetimepicker/
* @author Chupurnov Valeriy ()
*/
/*global DateFormatter, document,window,jQuery,setTimeout,clearTimeout,HighlightedDate,getCurrentValue*/
; (function (factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(['jquery', 'jquery-mousewheel'], factory);
} else if (typeof exports === 'object') {
// Node/CommonJS style for Browserify
module.exports = factory;
} else {
// Browser globals
factory(jQuery);
}
}(function ($) {
'use strict';
var default_options = {
i18n: {
ar: { // Arabic
months: [
"????? ??????", "????", "????", "?????", "????", "??????", "????", "??", "?????", "????? ?????", "????? ??????", "????? ?????"
],
dayOfWeekShort: [
"?", "?", "?", "?", "?", "?", "?"
],
dayOfWeek: ["?????", "???????", "????????", "????????", "??????", "??????", "?????", "?????"]
},
ro: { // Romanian
months: [
"Ianuarie", "Februarie", "Martie", "Aprilie", "Mai", "Iunie", "Iulie", "August", "Septembrie", "Octombrie", "Noiembrie", "Decembrie"
],
dayOfWeekShort: [
"Du", "Lu", "Ma", "Mi", "Jo", "Vi", "S?"
],
dayOfWeek: ["Duminic?", "Luni", "Mar?i", "Miercuri", "Joi", "Vineri", "S?mb?t?"]
},
id: { // Indonesian
months: [
"Januari", "Februari", "Maret", "April", "Mei", "Juni", "Juli", "Agustus", "September", "Oktober", "November", "Desember"
],
dayOfWeekShort: [
"Min", "Sen", "Sel", "Rab", "Kam", "Jum", "Sab"
],
dayOfWeek: ["Minggu", "Senin", "Selasa", "Rabu", "Kamis", "Jumat", "Sabtu"]
},
is: { // Icelandic
months: [
"Jan¨²ar", "Febr¨²ar", "Mars", "Apr¨ªl", "Ma¨ª", "J¨²n¨ª", "J¨²l¨ª", "?g¨²st", "September", "Okt¨®ber", "N¨®vember", "Desember"
],
dayOfWeekShort: [
"Sun", "M¨¢n", "?ri?", "Mi?", "Fim", "F?s", "Lau"
],
dayOfWeek: ["Sunnudagur", "M¨¢nudagur", "?ri?judagur", "Mi?vikudagur", "Fimmtudagur", "F?studagur", "Laugardagur"]
},
bg: { // Bulgarian
months: [
"§Á§ß§å§Ñ§â§Ú", "§¶§Ö§Ó§â§å§Ñ§â§Ú", "§®§Ñ§â§ä", "§¡§á§â§Ú§Ý", "§®§Ñ§Û", "§À§ß§Ú", "§À§Ý§Ú", "§¡§Ó§Ô§å§ã§ä", "§³§Ö§á§ä§Ö§Þ§Ó§â§Ú", "§°§Ü§ä§à§Þ§Ó§â§Ú", "§¯§à§Ö§Þ§Ó§â§Ú", "§¥§Ö§Ü§Ö§Þ§Ó§â§Ú"
],
dayOfWeekShort: [
"§¯§Õ", "§±§ß", "§£§ä", "§³§â", "§¹§ä", "§±§ä", "§³§Ò"
],
dayOfWeek: ["§¯§Ö§Õ§Ö§Ý§ñ", "§±§à§ß§Ö§Õ§Ö§Ý§ß§Ú§Ü", "§£§ä§à§â§ß§Ú§Ü", "§³§â§ñ§Õ§Ñ", "§¹§Ö§ä§Ó§ì§â§ä§ì§Ü", "§±§Ö§ä§ì§Ü", "§³§ì§Ò§à§ä§Ñ"]
},
fa: { // Persian/Farsi
months: [
'???????', '????????', '?????', '???', '?????', '??????', '???', '????', '???', '??', '????', '?????'
],
dayOfWeekShort: [
'??????', '??????', '?? ????', '????????', '???????', '????', '????'
],
dayOfWeek: ["???????", "??????", "???????", "????????", "????????", "????", "????", "???????"]
},
ru: { // Russian
months: [
'§Á§ß§Ó§Ñ§â§î', '§¶§Ö§Ó§â§Ñ§Ý§î', '§®§Ñ§â§ä', '§¡§á§â§Ö§Ý§î', '§®§Ñ§Û', '§ª§ð§ß§î', '§ª§ð§Ý§î', '§¡§Ó§Ô§å§ã§ä', '§³§Ö§ß§ä§ñ§Ò§â§î', '§°§Ü§ä§ñ§Ò§â§î', '§¯§à§ñ§Ò§â§î', '§¥§Ö§Ü§Ñ§Ò§â§î'
],
dayOfWeekShort: [
"§£§ã", "§±§ß", "§£§ä", "§³§â", "§¹§ä", "§±§ä", "§³§Ò"
],
dayOfWeek: ["§£§à§ã§Ü§â§Ö§ã§Ö§ß§î§Ö", "§±§à§ß§Ö§Õ§Ö§Ý§î§ß§Ú§Ü", "§£§ä§à§â§ß§Ú§Ü", "§³§â§Ö§Õ§Ñ", "§¹§Ö§ä§Ó§Ö§â§Ô", "§±§ñ§ä§ß§Ú§è§Ñ", "§³§å§Ò§Ò§à§ä§Ñ"]
},
uk: { // Ukrainian
months: [
'§³?§é§Ö§ß§î', '§§ð§ä§Ú§Û', '§¢§Ö§â§Ö§Ù§Ö§ß§î', '§¬§Ó?§ä§Ö§ß§î', '§´§â§Ñ§Ó§Ö§ß§î', '§¹§Ö§â§Ó§Ö§ß§î', '§§Ú§á§Ö§ß§î', '§³§Ö§â§á§Ö§ß§î', '§£§Ö§â§Ö§ã§Ö§ß§î', '§¨§à§Ó§ä§Ö§ß§î', '§§Ú§ã§ä§à§á§Ñ§Õ', '§¤§â§å§Õ§Ö§ß§î'
],
dayOfWeekShort: [
"§¯§Õ§Ý", "§±§ß§Õ", "§£§ä§â", "§³§â§Õ", "§¹§ä§Ó", "§±§ä§ß", "§³§Ò§ä"
],
dayOfWeek: ["§¯§Ö§Õ?§Ý§ñ", "§±§à§ß§Ö§Õ?§Ý§à§Ü", "§£?§Ó§ä§à§â§à§Ü", "§³§Ö§â§Ö§Õ§Ñ", "§¹§Ö§ä§Ó§Ö§â", "§±'§ñ§ä§ß§Ú§è§ñ", "§³§å§Ò§à§ä§Ñ"]
},
en: { // English
months: [
"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"
],
dayOfWeekShort: [
"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
],
dayOfWeek: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
},
el: { // ¦¥¦Ë¦Ë¦Ç¦Í¦É¦Ê?
months: [
"¦©¦Á¦Í¦Ï¦Ô?¦Ñ¦É¦Ï?", "¦µ¦Å¦Â¦Ñ¦Ï¦Ô?¦Ñ¦É¦Ï?", "¦¬?¦Ñ¦Ó¦É¦Ï?", "¦¡¦Ð¦Ñ?¦Ë¦É¦Ï?", "¦¬?¦É¦Ï?", "¦©¦Ï?¦Í¦É¦Ï?", "¦©¦Ï?¦Ë¦É¦Ï?", "¦¡?¦Ã¦Ï¦Ô¦Ò¦Ó¦Ï?", "¦²¦Å¦Ð¦Ó?¦Ì¦Â¦Ñ¦É¦Ï?", "¦¯¦Ê¦Ó?¦Â¦Ñ¦É¦Ï?", "¦¦Ï?¦Ì¦Â¦Ñ¦É¦Ï?", "¦¤¦Å¦Ê?¦Ì¦Â¦Ñ¦É¦Ï?"
],
dayOfWeekShort: [
"¦ª¦Ô¦Ñ", "¦¤¦Å¦Ô", "¦³¦Ñ¦É", "¦³¦Å¦Ó", "¦°¦Å¦Ì", "¦°¦Á¦Ñ", "¦²¦Á¦Â"
],
dayOfWeek: ["¦ª¦Ô¦Ñ¦É¦Á¦Ê?", "¦¤¦Å¦Ô¦Ó?¦Ñ¦Á", "¦³¦Ñ?¦Ó¦Ç", "¦³¦Å¦Ó?¦Ñ¦Ó¦Ç", "¦°?¦Ì¦Ð¦Ó¦Ç", "¦°¦Á¦Ñ¦Á¦Ò¦Ê¦Å¦Ô?", "¦²?¦Â¦Â¦Á¦Ó¦Ï"]
},
de: { // German
months: [
'Januar', 'Februar', 'M?rz', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'
],
dayOfWeekShort: [
"So", "Mo", "Di", "Mi", "Do", "Fr", "Sa"
],
dayOfWeek: ["Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag"]
},
nl: { // Dutch
months: [
"januari", "februari", "maart", "april", "mei", "juni", "juli", "augustus", "september", "oktober", "november", "december"
],
dayOfWeekShort: [
"zo", "ma", "di", "wo", "do", "vr", "za"
],
dayOfWeek: ["zondag", "maandag", "dinsdag", "woensdag", "donderdag", "vrijdag", "zaterdag"]
},
tr: { // Turkish
months: [
"Ocak", "?ubat", "Mart", "Nisan", "May?s", "Haziran", "Temmuz", "A?ustos", "Eyl¨¹l", "Ekim", "Kas?m", "Aral?k"
],
dayOfWeekShort: [
"Paz", "Pts", "Sal", "?ar", "Per", "Cum", "Cts"
],
dayOfWeek: ["Pazar", "Pazartesi", "Sal?", "?ar?amba", "Per?embe", "Cuma", "Cumartesi"]
},
fr: { //French
months: [
"Janvier", "F¨¦vrier", "Mars", "Avril", "Mai", "Juin", "Juillet", "Ao?t", "Septembre", "Octobre", "Novembre", "D¨¦cembre"
],
dayOfWeekShort: [
"Dim", "Lun", "Mar", "Mer", "Jeu", "Ven", "Sam"
],
dayOfWeek: ["dimanche", "lundi", "mardi", "mercredi", "jeudi", "vendredi", "samedi"]
},
es: { // Spanish
months: [
"Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"
],
dayOfWeekShort: [
"Dom", "Lun", "Mar", "Mi¨¦", "Jue", "Vie", "S¨¢b"
],
dayOfWeek: ["Domingo", "Lunes", "Martes", "Mi¨¦rcoles", "Jueves", "Viernes", "S¨¢bado"]
},
th: { // Thai
months: [
'??????', '??????????', '??????', '??????', '???????', '????????', '???????', '???????', '???????', '??????', '?????????', '???????'
],
dayOfWeekShort: [
'??.', '?.', '?.', '?.', '??.', '?.', '?.'
],
dayOfWeek: ["???????", "??????", "??????", "???", "?????", "?????", "?????", "???????"]
},
pl: { // Polish
months: [
"stycze¨½", "luty", "marzec", "kwiecie¨½", "maj", "czerwiec", "lipiec", "sierpie¨½", "wrzesie¨½", "pa?dziernik", "listopad", "grudzie¨½"
],
dayOfWeekShort: [
"nd", "pn", "wt", "?r", "cz", "pt", "sb"
],
dayOfWeek: ["niedziela", "poniedzia?ek", "wtorek", "?roda", "czwartek", "pi?tek", "sobota"]
},
pt: { // Portuguese
months: [
"Janeiro", "Fevereiro", "Mar?o", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"
],
dayOfWeekShort: [
"Dom", "Seg", "Ter", "Qua", "Qui", "Sex", "Sab"
],
dayOfWeek: ["Domingo", "Segunda", "Ter?a", "Quarta", "Quinta", "Sexta", "S¨¢bado"]
},
ch: { // Simplified Chinese
months: [
"Ò»ÔÂ", "¶þÔÂ", "ÈýÔÂ", "ËÄÔÂ", "ÎåÔÂ", "ÁùÔÂ", "ÆßÔÂ", "°ËÔÂ", "¾ÅÔÂ", "Ê®ÔÂ", "ʮһÔÂ", "Ê®¶þÔÂ"
],
dayOfWeekShort: [
"ÈÕ", "Ò»", "¶þ", "Èý", "ËÄ", "Îå", "Áù"
]
},
se: { // Swedish
months: [
"Januari", "Februari", "Mars", "April", "Maj", "Juni", "Juli", "Augusti", "September", "Oktober", "November", "December"
],
dayOfWeekShort: [
"S?n", "M?n", "Tis", "Ons", "Tor", "Fre", "L?r"
]
},
km: { // Khmer
months: [
"?????", "??????", "?????", "?????", "?????", "???????", "???????", "?????", "??????", "?????", "?????????", "?????"
],
dayOfWeekShort: ["?????", "?????", "???????", "????", "??????", "??????", "????"],
dayOfWeek: ["????????", "?????", "???????", "????", "???????????", "??????", "????"]
},
kr: { // Korean
months: [
"1?", "2?", "3?", "4?", "5?", "6?", "7?", "8?", "9?", "10?", "11?", "12?"
],
dayOfWeekShort: [
"?", "?", "?", "?", "?", "?", "?"
],
dayOfWeek: ["???", "???", "???", "???", "???", "???", "???"]
},
it: { // Italian
months: [
"Gennaio", "Febbraio", "Marzo", "Aprile", "Maggio", "Giugno", "Luglio", "Agosto", "Settembre", "Ottobre", "Novembre", "Dicembre"
],
dayOfWeekShort: [
"Dom", "Lun", "Mar", "Mer", "Gio", "Ven", "Sab"
],
dayOfWeek: ["Domenica", "Luned¨¬", "Marted¨¬", "Mercoled¨¬", "Gioved¨¬", "Venerd¨¬", "Sabato"]
},
da: { // Dansk
months: [
"January", "Februar", "Marts", "April", "Maj", "Juni", "July", "August", "September", "Oktober", "November", "December"
],
dayOfWeekShort: [
"S?n", "Man", "Tir", "Ons", "Tor", "Fre", "L?r"
],
dayOfWeek: ["s?ndag", "mandag", "tirsdag", "onsdag", "torsdag", "fredag", "l?rdag"]
},
no: { // Norwegian
months: [
"Januar", "Februar", "Mars", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Desember"
],
dayOfWeekShort: [
"S?n", "Man", "Tir", "Ons", "Tor", "Fre", "L?r"
],
dayOfWeek: ['S?ndag', 'Mandag', 'Tirsdag', 'Onsdag', 'Torsdag', 'Fredag', 'L?rdag']
},
ja: { // Japanese
months: [
"1ÔÂ", "2ÔÂ", "3ÔÂ", "4ÔÂ", "5ÔÂ", "6ÔÂ", "7ÔÂ", "8ÔÂ", "9ÔÂ", "10ÔÂ", "11ÔÂ", "12ÔÂ"
],
dayOfWeekShort: [
"ÈÕ", "ÔÂ", "»ð", "Ë®", "ľ", "½ð", "ÍÁ"
],
dayOfWeek: ["ÈÕê×", "ÔÂê×", "»ðê×", "Ë®ê×", "ľê×", "½ðê×", "ÍÁê×"]
},
vi: { // Vietnamese
months: [
"Th¨¢ng 1", "Th¨¢ng 2", "Th¨¢ng 3", "Th¨¢ng 4", "Th¨¢ng 5", "Th¨¢ng 6", "Th¨¢ng 7", "Th¨¢ng 8", "Th¨¢ng 9", "Th¨¢ng 10", "Th¨¢ng 11", "Th¨¢ng 12"
],
dayOfWeekShort: [
"CN", "T2", "T3", "T4", "T5", "T6", "T7"
],
dayOfWeek: ["Ch? nh?t", "Th? hai", "Th? ba", "Th? t?", "Th? n?m", "Th? s¨¢u", "Th? b?y"]
},
sl: { // Sloven??ina
months: [
"Januar", "Februar", "Marec", "April", "Maj", "Junij", "Julij", "Avgust", "September", "Oktober", "November", "December"
],
dayOfWeekShort: [
"Ned", "Pon", "Tor", "Sre", "?et", "Pet", "Sob"
],
dayOfWeek: ["Nedelja", "Ponedeljek", "Torek", "Sreda", "?etrtek", "Petek", "Sobota"]
},
cs: { // ?e?tina
months: [
"Leden", "?nor", "B?ezen", "Duben", "Kv¨§ten", "?erven", "?ervenec", "Srpen", "Z¨¢?¨ª", "?¨ªjen", "Listopad", "Prosinec"
],
dayOfWeekShort: [
"Ne", "Po", "?t", "St", "?t", "P¨¢", "So"
]
},
hu: { // Hungarian
months: [
"Janu¨¢r", "Febru¨¢r", "M¨¢rcius", "?prilis", "M¨¢jus", "J¨²nius", "J¨²lius", "Augusztus", "Szeptember", "Okt¨®ber", "November", "December"
],
dayOfWeekShort: [
"Va", "H¨¦", "Ke", "Sze", "Cs", "P¨¦", "Szo"
],
dayOfWeek: ["vas¨¢rnap", "h¨¦tf?", "kedd", "szerda", "cs¨¹t?rt?k", "p¨¦ntek", "szombat"]
},
az: { //Azerbaijanian (Azeri)
months: [
"Yanvar", "Fevral", "Mart", "Aprel", "May", "Iyun", "Iyul", "Avqust", "Sentyabr", "Oktyabr", "Noyabr", "Dekabr"
],
dayOfWeekShort: [
"B", "Be", "?a", "?", "Ca", "C", "?"
],
dayOfWeek: ["Bazar", "Bazar ert?si", "??r??nb? ax?am?", "??r??nb?", "C¨¹m? ax?am?", "C¨¹m?", "??nb?"]
},
bs: { //Bosanski
months: [
"Januar", "Februar", "Mart", "April", "Maj", "Jun", "Jul", "Avgust", "Septembar", "Oktobar", "Novembar", "Decembar"
],
dayOfWeekShort: [
"Ned", "Pon", "Uto", "Sri", "?et", "Pet", "Sub"
],
dayOfWeek: ["Nedjelja", "Ponedjeljak", "Utorak", "Srijeda", "?etvrtak", "Petak", "Subota"]
},
ca: { //Catal¨¤
months: [
"Gener", "Febrer", "Mar?", "Abril", "Maig", "Juny", "Juliol", "Agost", "Setembre", "Octubre", "Novembre", "Desembre"
],
dayOfWeekShort: [
"Dg", "Dl", "Dt", "Dc", "Dj", "Dv", "Ds"
],
dayOfWeek: ["Diumenge", "Dilluns", "Dimarts", "Dimecres", "Dijous", "Divendres", "Dissabte"]
},
'en-GB': { //English (British)
months: [
"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"
],
dayOfWeekShort: [
"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
],
dayOfWeek: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
},
et: { //"Eesti"
months: [
"Jaanuar", "Veebruar", "M?rts", "Aprill", "Mai", "Juuni", "Juuli", "August", "September", "Oktoober", "November", "Detsember"
],
dayOfWeekShort: [
"P", "E", "T", "K", "N", "R", "L"
],
dayOfWeek: ["P¨¹hap?ev", "Esmasp?ev", "Teisip?ev", "Kolmap?ev", "Neljap?ev", "Reede", "Laup?ev"]
},
eu: { //Euskara
months: [
"Urtarrila", "Otsaila", "Martxoa", "Apirila", "Maiatza", "Ekaina", "Uztaila", "Abuztua", "Iraila", "Urria", "Azaroa", "Abendua"
],
dayOfWeekShort: [
"Ig.", "Al.", "Ar.", "Az.", "Og.", "Or.", "La."
],
dayOfWeek: ['Igandea', 'Astelehena', 'Asteartea', 'Asteazkena', 'Osteguna', 'Ostirala', 'Larunbata']
},
fi: { //Finnish (Suomi)
months: [
"Tammikuu", "Helmikuu", "Maaliskuu", "Huhtikuu", "Toukokuu", "Kes?kuu", "Hein?kuu", "Elokuu", "Syyskuu", "Lokakuu", "Marraskuu", "Joulukuu"
],
dayOfWeekShort: [
"Su", "Ma", "Ti", "Ke", "To", "Pe", "La"
],
dayOfWeek: ["sunnuntai", "maanantai", "tiistai", "keskiviikko", "torstai", "perjantai", "lauantai"]
},
gl: { //Galego
months: [
"Xan", "Feb", "Maz", "Abr", "Mai", "Xun", "Xul", "Ago", "Set", "Out", "Nov", "Dec"
],
dayOfWeekShort: [
"Dom", "Lun", "Mar", "Mer", "Xov", "Ven", "Sab"
],
dayOfWeek: ["Domingo", "Luns", "Martes", "M¨¦rcores", "Xoves", "Venres", "S¨¢bado"]
},
hr: { //Hrvatski
months: [
"Sije?anj", "Velja?a", "O?ujak", "Travanj", "Svibanj", "Lipanj", "Srpanj", "Kolovoz", "Rujan", "Listopad", "Studeni", "Prosinac"
],
dayOfWeekShort: [
"Ned", "Pon", "Uto", "Sri", "?et", "Pet", "Sub"
],
dayOfWeek: ["Nedjelja", "Ponedjeljak", "Utorak", "Srijeda", "?etvrtak", "Petak", "Subota"]
},
ko: { //Korean (???)
months: [
"1?", "2?", "3?", "4?", "5?", "6?", "7?", "8?", "9?", "10?", "11?", "12?"
],
dayOfWeekShort: [
"?", "?", "?", "?", "?", "?", "?"
],
dayOfWeek: ["???", "???", "???", "???", "???", "???", "???"]
},
lt: { //Lithuanian (lietuvi?)
months: [
"Sausio", "Vasario", "Kovo", "Baland?io", "Gegu??s", "Bir?elio", "Liepos", "Rugpj¨±?io", "Rugs?jo", "Spalio", "Lapkri?io", "Gruod?io"
],
dayOfWeekShort: [
"Sek", "Pir", "Ant", "Tre", "Ket", "Pen", "?e?"
],
dayOfWeek: ["Sekmadienis", "Pirmadienis", "Antradienis", "Tre?iadienis", "Ketvirtadienis", "Penktadienis", "?e?tadienis"]
},
lv: { //Latvian (Latvie?u)
months: [
"Janv¨¡ris", "Febru¨¡ris", "Marts", "Apr¨©lis ", "Maijs", "J¨±nijs", "J¨±lijs", "Augusts", "Septembris", "Oktobris", "Novembris", "Decembris"
],
dayOfWeekShort: [
"Sv", "Pr", "Ot", "Tr", "Ct", "Pk", "St"
],
dayOfWeek: ["Sv¨¥tdiena", "Pirmdiena", "Otrdiena", "Tre?diena", "Ceturtdiena", "Piektdiena", "Sestdiena"]
},
mk: { //Macedonian (§®§Ñ§Ü§Ö§Õ§à§ß§ã§Ü§Ú)
months: [
"?§Ñ§ß§å§Ñ§â§Ú", "§æ§Ö§Ó§â§å§Ñ§â§Ú", "§Þ§Ñ§â§ä", "§Ñ§á§â§Ú§Ý", "§Þ§Ñ?", "?§å§ß§Ú", "?§å§Ý§Ú", "§Ñ§Ó§Ô§å§ã§ä", "§ã§Ö§á§ä§Ö§Þ§Ó§â§Ú", "§à§Ü§ä§à§Þ§Ó§â§Ú", "§ß§à§Ö§Þ§Ó§â§Ú", "§Õ§Ö§Ü§Ö§Þ§Ó§â§Ú"
],
dayOfWeekShort: [
"§ß§Ö§Õ", "§á§à§ß", "§Ó§ä§à", "§ã§â§Ö", "§é§Ö§ä", "§á§Ö§ä", "§ã§Ñ§Ò"
],
dayOfWeek: ["§¯§Ö§Õ§Ö§Ý§Ñ", "§±§à§ß§Ö§Õ§Ö§Ý§ß§Ú§Ü", "§£§ä§à§â§ß§Ú§Ü", "§³§â§Ö§Õ§Ñ", "§¹§Ö§ä§Ó§â§ä§à§Ü", "§±§Ö§ä§à§Ü", "§³§Ñ§Ò§à§ä§Ñ"]
},
mn: { //Mongolian (§®§à§ß§Ô§à§Ý)
months: [
"1-§â §ã§Ñ§â", "2-§â §ã§Ñ§â", "3-§â §ã§Ñ§â", "4-§â §ã§Ñ§â", "5-§â §ã§Ñ§â", "6-§â §ã§Ñ§â", "7-§â §ã§Ñ§â", "8-§â §ã§Ñ§â", "9-§â §ã§Ñ§â", "10-§â §ã§Ñ§â", "11-§â §ã§Ñ§â", "12-§â §ã§Ñ§â"
],
dayOfWeekShort: [
"§¥§Ñ§Ó", "§®§ñ§Ô", "§§ç§Ñ", "§±?§â", "§¢§ã§ß", "§¢§ñ§Þ", "§¯§ñ§Þ"
],
dayOfWeek: ["§¥§Ñ§Ó§Ñ§Ñ", "§®§ñ§Ô§Þ§Ñ§â", "§§ç§Ñ§Ô§Ó§Ñ", "§±?§â§ï§Ó", "§¢§Ñ§Ñ§ã§Ñ§ß", "§¢§ñ§Þ§Ò§Ñ", "§¯§ñ§Þ"]
},
'pt-BR': { //Portugu¨ºs(Brasil)
months: [
"Janeiro", "Fevereiro", "Mar?o", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"
],
dayOfWeekShort: [
"Dom", "Seg", "Ter", "Qua", "Qui", "Sex", "S¨¢b"
],
dayOfWeek: ["Domingo", "Segunda", "Ter?a", "Quarta", "Quinta", "Sexta", "S¨¢bado"]
},
sk: { //Sloven?ina
months: [
"Janu¨¢r", "Febru¨¢r", "Marec", "Apr¨ªl", "M¨¢j", "J¨²n", "J¨²l", "August", "September", "Okt¨®ber", "November", "December"
],
dayOfWeekShort: [
"Ne", "Po", "Ut", "St", "?t", "Pi", "So"
],
dayOfWeek: ["Nede?a", "Pondelok", "Utorok", "Streda", "?tvrtok", "Piatok", "Sobota"]
},
sq: { //Albanian (Shqip)
months: [
"Janar", "Shkurt", "Mars", "Prill", "Maj", "Qershor", "Korrik", "Gusht", "Shtator", "Tetor", "N?ntor", "Dhjetor"
],
dayOfWeekShort: [
"Die", "H?n", "Mar", "M?r", "Enj", "Pre", "Shtu"
],
dayOfWeek: ["E Diel", "E H?n?", "E Mart¨¥", "E M?rkur?", "E Enjte", "E Premte", "E Shtun?"]
},
'sr-YU': { //Serbian (Srpski)
months: [
"Januar", "Februar", "Mart", "April", "Maj", "Jun", "Jul", "Avgust", "Septembar", "Oktobar", "Novembar", "Decembar"
],
dayOfWeekShort: [
"Ned", "Pon", "Uto", "Sre", "?et", "Pet", "Sub"
],
dayOfWeek: ["Nedelja", "Ponedeljak", "Utorak", "Sreda", "?etvrtak", "Petak", "Subota"]
},
sr: { //Serbian Cyrillic (§³§â§á§ã§Ü§Ú)
months: [
"?§Ñ§ß§å§Ñ§â", "§æ§Ö§Ò§â§å§Ñ§â", "§Þ§Ñ§â§ä", "§Ñ§á§â§Ú§Ý", "§Þ§Ñ?", "?§å§ß", "?§å§Ý", "§Ñ§Ó§Ô§å§ã§ä", "§ã§Ö§á§ä§Ö§Þ§Ò§Ñ§â", "§à§Ü§ä§à§Ò§Ñ§â", "§ß§à§Ó§Ö§Þ§Ò§Ñ§â", "§Õ§Ö§è§Ö§Þ§Ò§Ñ§â"
],
dayOfWeekShort: [
"§ß§Ö§Õ", "§á§à§ß", "§å§ä§à", "§ã§â§Ö", "§é§Ö§ä", "§á§Ö§ä", "§ã§å§Ò"
],
dayOfWeek: ["§¯§Ö§Õ§Ö?§Ñ", "§±§à§ß§Ö§Õ§Ö?§Ñ§Ü", "§µ§ä§à§â§Ñ§Ü", "§³§â§Ö§Õ§Ñ", "§¹§Ö§ä§Ó§â§ä§Ñ§Ü", "§±§Ö§ä§Ñ§Ü", "§³§å§Ò§à§ä§Ñ"]
},
sv: { //Svenska
months: [
"Januari", "Februari", "Mars", "April", "Maj", "Juni", "Juli", "Augusti", "September", "Oktober", "November", "December"
],
dayOfWeekShort: [
"S?n", "M?n", "Tis", "Ons", "Tor", "Fre", "L?r"
],
dayOfWeek: ["S?ndag", "M?ndag", "Tisdag", "Onsdag", "Torsdag", "Fredag", "L?rdag"]
},
'zh-TW': { //Traditional Chinese (·±ówÖÐÎÄ)
months: [
"Ò»ÔÂ", "¶þÔÂ", "ÈýÔÂ", "ËÄÔÂ", "ÎåÔÂ", "ÁùÔÂ", "ÆßÔÂ", "°ËÔÂ", "¾ÅÔÂ", "Ê®ÔÂ", "ʮһÔÂ", "Ê®¶þÔÂ"
],
dayOfWeekShort: [
"ÈÕ", "Ò»", "¶þ", "Èý", "ËÄ", "Îå", "Áù"
],
dayOfWeek: ["ÐÇÆÚÈÕ", "ÐÇÆÚÒ»", "ÐÇÆÚ¶þ", "ÐÇÆÚÈý", "ÐÇÆÚËÄ", "ÐÇÆÚÎå", "ÐÇÆÚÁù"]
},
zh: { //Simplified Chinese (¼òÌåÖÐÎÄ)
months: [
"Ò»ÔÂ", "¶þÔÂ", "ÈýÔÂ", "ËÄÔÂ", "ÎåÔÂ", "ÁùÔÂ", "ÆßÔÂ", "°ËÔÂ", "¾ÅÔÂ", "Ê®ÔÂ", "ʮһÔÂ", "Ê®¶þÔÂ"
],
dayOfWeekShort: [
"ÈÕ", "Ò»", "¶þ", "Èý", "ËÄ", "Îå", "Áù"
],
dayOfWeek: ["ÐÇÆÚÈÕ", "ÐÇÆÚÒ»", "ÐÇÆÚ¶þ", "ÐÇÆÚÈý", "ÐÇÆÚËÄ", "ÐÇÆÚÎå", "ÐÇÆÚÁù"]
},
he: { //Hebrew (?????)
months: [
'?????', '??????', '???', '?????', '???', '????', '????', '??????', '??????', '???????', '??????', '?????'
],
dayOfWeekShort: [
'?\'', '?\'', '?\'', '?\'', '?\'', '?\'', '???'
],
dayOfWeek: ["?????", "???", "?????", "?????", "?????", "????", "???", "?????"]
},
hy: { // Armenian
months: [
"???????", "???????", "????", "?????", "?????", "??????", "??????", "???????", "?????????", "?????????", "????????", "?????????"
],
dayOfWeekShort: [
"??", "???", "???", "???", "???", "????", "???"
],
dayOfWeek: ["??????", "??????????", "?????????", "??????????", "?????????", "??????", "?????"]
},
kg: { // Kyrgyz
months: [
'?§é§ä?§ß §Ñ§Û§í', '§¢§Ú§â§Õ§Ú§ß §Ñ§Û§í', '§¨§Ñ§Ý§Ô§Ñ§ß §¬§å§â§Ñ§ß', '§¹§í§ß §¬§å§â§Ñ§ß', '§¢§å§Ô§å', '§¬§å§Ý§Ø§Ñ', '§´§Ö§Ü§Ö', '§¢§Ñ§ê §°§à§ß§Ñ', '§¡§ñ§Ü §°§à§ß§Ñ', '§´§à§Ô§å§Ù§Õ§å§ß §Ñ§Û§í', '§¨§Ö§ä§Ú§ß§Ú§ß §Ñ§Û§í', '§¢§Ö§ê§ä§Ú§ß §Ñ§Û§í'
],
dayOfWeekShort: [
"§¨§Ö§Ü", "§¥?§Û", "§º§Ö§Û", "§º§Ñ§â", "§¢§Ö§Û", "§¨§å§Þ", "§ª§ê§Ö"
],
dayOfWeek: [
"§¨§Ö§Ü§ê§Ö§Þ§Ò", "§¥?§Û§ê?§Þ§Ò", "§º§Ö§Û§ê§Ö§Þ§Ò", "§º§Ñ§â§ê§Ö§Þ§Ò", "§¢§Ö§Û§ê§Ö§Þ§Ò§Ú", "§¨§å§Þ§Ñ", "§ª§ê§Ö§ß§Ò"
]
},
rm: { // Romansh
months: [
"Schaner", "Favrer", "Mars", "Avrigl", "Matg", "Zercladur", "Fanadur", "Avust", "Settember", "October", "November", "December"
],
dayOfWeekShort: [
"Du", "Gli", "Ma", "Me", "Gie", "Ve", "So"
],
dayOfWeek: [
"Dumengia", "Glindesdi", "Mardi", "Mesemna", "Gievgia", "Venderdi", "Sonda"
]
},
ka: { // Georgian
months: [
'???????', '?????????', '?????', '??????', '?????', '??????', '??????', '???????', '??????????', '?????????', '????????', '?????????'
],
dayOfWeekShort: [
"??", "???", "????", "???", "???", "???", "???"
],
dayOfWeek: ["?????", "????????", "?????????", "?????????", "?????????", "?????????", "??????"]
}
},
ownerDocument: document,
contentWindow: window,
value: '',
rtl: false,
format: 'Y/m/d H:i',
formatTime: 'H:i',
formatDate: 'Y/m/d',
startDate: false, // new Date(), '1986/12/08', '-1970/01/05','-1970/01/05',
step: 60,
monthChangeSpinner: true,
closeOnDateSelect: false,
closeOnTimeSelect: true,
closeOnWithoutClick: true,
closeOnInputClick: true,
timepicker: true,
datepicker: true,
weeks: false,
defaultTime: false, // use formatTime format (ex. '10:00' for formatTime: 'H:i')
defaultDate: false, // use formatDate format (ex new Date() or '1986/12/08' or '-1970/01/05' or '-1970/01/05')
minDate: false,
maxDate: false,
minTime: false,
maxTime: false,
disabledMinTime: false,
disabledMaxTime: false,
allowTimes: [],
opened: false,
initTime: true,
inline: false,
theme: '',
onSelectDate: function () { },
onSelectTime: function () { },
onChangeMonth: function () { },
onGetWeekOfYear: function () { },
onChangeYear: function () { },
onChangeDateTime: function () { },
onShow: function () { },
onClose: function () { },
onGenerate: function () { },
withoutCopyright: true,
inverseButton: false,
hours12: false,
next: 'xdsoft_next',
prev: 'xdsoft_prev',
dayOfWeekStart: 0,
parentID: 'body',
timeHeightInTimePicker: 25,
timepickerScrollbar: true,
todayButton: true,
prevButton: true,
nextButton: true,
defaultSelect: true,
scrollMonth: true,
scrollTime: true,
scrollInput: true,
lazyInit: false,
mask: false,
validateOnBlur: true,
allowBlank: true,
yearStart: 1950,
yearEnd: 2050,
monthStart: 0,
monthEnd: 11,
style: '',
id: '',
fixed: false,
roundTime: 'round', // ceil, floor
className: '',
weekends: [],
highlightedDates: [],
highlightedPeriods: [],
allowDates: [],
allowDateRe: null,
disabledDates: [],
disabledWeekDays: [],
yearOffset: 0,
beforeShowDay: null,
enterLikeTab: true,
showApplyButton: false
};
var dateHelper = null,
globalLocaleDefault = 'en',
globalLocale = 'en';
var dateFormatterOptionsDefault = {
meridiem: ['AM', 'PM']
};
var initDateFormatter = function () {
var locale = default_options.i18n[globalLocale],
opts = {
days: locale.dayOfWeek,
daysShort: locale.dayOfWeekShort,
months: locale.months,
monthsShort: $.map(locale.months, function (n) { return n.substring(0, 3) })
};
if (typeof DateFormatter === 'function') {
dateHelper = new DateFormatter({
dateSettings: $.extend({}, dateFormatterOptionsDefault, opts)
});
}
};
// for locale settings
$.datetimepicker = {
setLocale: function (locale) {
var newLocale = default_options.i18n[locale] ? locale : globalLocaleDefault;
if (globalLocale != newLocale) {
globalLocale = newLocale;
// reinit date formatter
initDateFormatter();
}
},
setDateFormatter: function (dateFormatter) {
dateHelper = dateFormatter;
},
RFC_2822: 'D, d M Y H:i:s O',
ATOM: 'Y-m-d\TH:i:sP',
ISO_8601: 'Y-m-d\TH:i:sO',
RFC_822: 'D, d M y H:i:s O',
RFC_850: 'l, d-M-y H:i:s T',
RFC_1036: 'D, d M y H:i:s O',
RFC_1123: 'D, d M Y H:i:s O',
RSS: 'D, d M Y H:i:s O',
W3C: 'Y-m-d\TH:i:sP'
};
// first init date formatter
initDateFormatter();
// fix for ie8
if (!window.getComputedStyle) {
window.getComputedStyle = function (el, pseudo) {
this.el = el;
this.getPropertyValue = function (prop) {
var re = /(\-([a-z]){1})/g;
if (prop === 'float') {
prop = 'styleFloat';
}
if (re.test(prop)) {
prop = prop.replace(re, function (a, b, c) {
return c.toUpperCase();
});
}
return el.currentStyle[prop] || null;
};
return this;
};
}
if (!Array.prototype.indexOf) {
Array.prototype.indexOf = function (obj, start) {
var i, j;
for (i = (start || 0), j = this.length; i < j; i += 1) {
if (this[i] === obj) { return i; }
}
return -1;
};
}
Date.prototype.countDaysInMonth = function () {
return new Date(this.getFullYear(), this.getMonth() + 1, 0).getDate();
};
$.fn.xdsoftScroller = function (options, percent) {
return this.each(function () {
var timeboxparent = $(this),
pointerEventToXY = function (e) {
var out = { x: 0, y: 0 },
touch;
if (e.type === 'touchstart' || e.type === 'touchmove' || e.type === 'touchend' || e.type === 'touchcancel') {
touch = e.originalEvent.touches[0] || e.originalEvent.changedTouches[0];
out.x = touch.clientX;
out.y = touch.clientY;
} else if (e.type === 'mousedown' || e.type === 'mouseup' || e.type === 'mousemove' || e.type === 'mouseover' || e.type === 'mouseout' || e.type === 'mouseenter' || e.type === 'mouseleave') {
out.x = e.clientX;
out.y = e.clientY;
}
return out;
},
timebox,
parentHeight,
height,
scrollbar,
scroller,
maximumOffset = 100,
start = false,
startY = 0,
startTop = 0,
h1 = 0,
touchStart = false,
startTopScroll = 0,
calcOffset = function () { };
if (percent === 'hide') {
timeboxparent.find('.xdsoft_scrollbar').hide();
return;
}
if (!$(this).hasClass('xdsoft_scroller_box')) {
timebox = timeboxparent.children().eq(0);
parentHeight = timeboxparent[0].clientHeight;
height = timebox[0].offsetHeight;
scrollbar = $('
');
scroller = $('
');
scrollbar.append(scroller);
timeboxparent.addClass('xdsoft_scroller_box').append(scrollbar);
calcOffset = function calcOffset(event) {
var offset = pointerEventToXY(event).y - startY + startTopScroll;
if (offset < 0) {
offset = 0;
}
if (offset + scroller[0].offsetHeight > h1) {
offset = h1 - scroller[0].offsetHeight;
}
timeboxparent.trigger('scroll_element.xdsoft_scroller', [maximumOffset ? offset / maximumOffset : 0]);
};
scroller
.on('touchstart.xdsoft_scroller mousedown.xdsoft_scroller', function (event) {
if (!parentHeight) {
timeboxparent.trigger('resize_scroll.xdsoft_scroller', [percent]);
}
startY = pointerEventToXY(event).y;
startTopScroll = parseInt(scroller.css('margin-top'), 10);
h1 = scrollbar[0].offsetHeight;
if (event.type === 'mousedown' || event.type === 'touchstart') {
if (options.ownerDocument) {
$(options.ownerDocument.body).addClass('xdsoft_noselect');
}
$([options.ownerDocument.body, options.contentWindow]).on('touchend mouseup.xdsoft_scroller', function arguments_callee() {
$([options.ownerDocument.body, options.contentWindow]).off('touchend mouseup.xdsoft_scroller', arguments_callee)
.off('mousemove.xdsoft_scroller', calcOffset)
.removeClass('xdsoft_noselect');
});
$(options.ownerDocument.body).on('mousemove.xdsoft_scroller', calcOffset);
} else {
touchStart = true;
event.stopPropagation();
event.preventDefault();
}
})
.on('touchmove', function (event) {
if (touchStart) {
event.preventDefault();
calcOffset(event);
}
})
.on('touchend touchcancel', function () {
touchStart = false;
startTopScroll = 0;
});
timeboxparent
.on('scroll_element.xdsoft_scroller', function (event, percentage) {
if (!parentHeight) {
timeboxparent.trigger('resize_scroll.xdsoft_scroller', [percentage, true]);
}
percentage = percentage > 1 ? 1 : (percentage < 0 || isNaN(percentage)) ? 0 : percentage;
scroller.css('margin-top', maximumOffset * percentage);
setTimeout(function () {
timebox.css('marginTop', -parseInt((timebox[0].offsetHeight - parentHeight) * percentage, 10));
}, 10);
})
.on('resize_scroll.xdsoft_scroller', function (event, percentage, noTriggerScroll) {
var percent, sh;
parentHeight = timeboxparent[0].clientHeight;
height = timebox[0].offsetHeight;
percent = parentHeight / height;
sh = percent * scrollbar[0].offsetHeight;
if (percent > 1) {
scroller.hide();
} else {
scroller.show();
scroller.css('height', parseInt(sh > 10 ? sh : 10, 10));
maximumOffset = scrollbar[0].offsetHeight - scroller[0].offsetHeight;
if (noTriggerScroll !== true) {
timeboxparent.trigger('scroll_element.xdsoft_scroller', [percentage || Math.abs(parseInt(timebox.css('marginTop'), 10)) / (height - parentHeight)]);
}
}
});
timeboxparent.on('mousewheel', function (event) {
var top = Math.abs(parseInt(timebox.css('marginTop'), 10));
top = top - (event.deltaY * 20);
if (top < 0) {
top = 0;
}
timeboxparent.trigger('scroll_element.xdsoft_scroller', [top / (height - parentHeight)]);
event.stopPropagation();
return false;
});
timeboxparent.on('touchstart', function (event) {
start = pointerEventToXY(event);
startTop = Math.abs(parseInt(timebox.css('marginTop'), 10));
});
timeboxparent.on('touchmove', function (event) {
if (start) {
event.preventDefault();
var coord = pointerEventToXY(event);
timeboxparent.trigger('scroll_element.xdsoft_scroller', [(startTop - (coord.y - start.y)) / (height - parentHeight)]);
}
});
timeboxparent.on('touchend touchcancel', function () {
start = false;
startTop = 0;
});
}
timeboxparent.trigger('resize_scroll.xdsoft_scroller', [percent]);
});
};
$.fn.datetimepicker = function (opt, opt2) {
var result = this,
KEY0 = 48,
KEY9 = 57,
_KEY0 = 96,
_KEY9 = 105,
CTRLKEY = 17,
DEL = 46,
ENTER = 13,
ESC = 27,
BACKSPACE = 8,
ARROWLEFT = 37,
ARROWUP = 38,
ARROWRIGHT = 39,
ARROWDOWN = 40,
TAB = 9,
F5 = 116,
AKEY = 65,
CKEY = 67,
VKEY = 86,
ZKEY = 90,
YKEY = 89,
ctrlDown = false,
options = ($.isPlainObject(opt) || !opt) ? $.extend(true, {}, default_options, opt) : $.extend(true, {}, default_options),
lazyInitTimer = 0,
createDateTimePicker,
destroyDateTimePicker,
lazyInit = function (input) {
input
.on('open.xdsoft focusin.xdsoft mousedown.xdsoft touchstart', function initOnActionCallback() {
if (input.is(':disabled') || input.data('xdsoft_datetimepicker')) {
return;
}
clearTimeout(lazyInitTimer);
lazyInitTimer = setTimeout(function () {
if (!input.data('xdsoft_datetimepicker')) {
createDateTimePicker(input);
}
input
.off('open.xdsoft focusin.xdsoft mousedown.xdsoft touchstart', initOnActionCallback)
.trigger('open.xdsoft');
}, 100);
});
};
createDateTimePicker = function (input) {
var datetimepicker = $('
'),
xdsoft_copyright = $('
'),
datepicker = $('
'),
month_picker = $(''),
calendar = $('
'),
timepicker = $(''),
timeboxparent = timepicker.find('.xdsoft_time_box').eq(0),
timebox = $('
'),
applyButton = $('Save Selected '),
monthselect = $(''),
yearselect = $(''),
triggerAfterOpen = false,
XDSoft_datetime,
xchangeTimer,
timerclick,
current_time_index,
setPos,
timer = 0,
_xdsoft_datetime,
forEachAncestorOf,
throttle;
if (options.id) {
datetimepicker.attr('id', options.id);
}
if (options.style) {
datetimepicker.attr('style', options.style);
}
if (options.weeks) {
datetimepicker.addClass('xdsoft_showweeks');
}
if (options.rtl) {
datetimepicker.addClass('xdsoft_rtl');
}
datetimepicker.addClass('xdsoft_' + options.theme);
datetimepicker.addClass(options.className);
month_picker
.find('.xdsoft_month span')
.after(monthselect);
month_picker
.find('.xdsoft_year span')
.after(yearselect);
month_picker
.find('.xdsoft_month,.xdsoft_year')
.on('touchstart mousedown.xdsoft', function (event) {
var select = $(this).find('.xdsoft_select').eq(0),
val = 0,
top = 0,
visible = select.is(':visible'),
items,
i;
month_picker
.find('.xdsoft_select')
.hide();
if (_xdsoft_datetime.currentTime) {
val = _xdsoft_datetime.currentTime[$(this).hasClass('xdsoft_month') ? 'getMonth' : 'getFullYear']();
}
select[visible ? 'hide' : 'show']();
for (items = select.find('div.xdsoft_option'), i = 0; i < items.length; i += 1) {
if (items.eq(i).data('value') === val) {
break;
} else {
top += items[0].offsetHeight;
}
}
select.xdsoftScroller(options, top / (select.children()[0].offsetHeight - (select[0].clientHeight)));
event.stopPropagation();
return false;
});
month_picker
.find('.xdsoft_select')
.xdsoftScroller(options)
.on('touchstart mousedown.xdsoft', function (event) {
event.stopPropagation();
event.preventDefault();
})
.on('touchstart mousedown.xdsoft', '.xdsoft_option', function () {
if (_xdsoft_datetime.currentTime === undefined || _xdsoft_datetime.currentTime === null) {
_xdsoft_datetime.currentTime = _xdsoft_datetime.now();
}
var year = _xdsoft_datetime.currentTime.getFullYear();
if (_xdsoft_datetime && _xdsoft_datetime.currentTime) {
_xdsoft_datetime.currentTime[$(this).parent().parent().hasClass('xdsoft_monthselect') ? 'setMonth' : 'setFullYear']($(this).data('value'));
}
$(this).parent().parent().hide();
datetimepicker.trigger('xchange.xdsoft');
if (options.onChangeMonth && $.isFunction(options.onChangeMonth)) {
options.onChangeMonth.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'));
}
if (year !== _xdsoft_datetime.currentTime.getFullYear() && $.isFunction(options.onChangeYear)) {
options.onChangeYear.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'));
}
});
datetimepicker.getValue = function () {
return _xdsoft_datetime.getCurrentTime();
};
datetimepicker.setOptions = function (_options) {
var highlightedDates = {};
options = $.extend(true, {}, options, _options);
if (_options.allowTimes && $.isArray(_options.allowTimes) && _options.allowTimes.length) {
options.allowTimes = $.extend(true, [], _options.allowTimes);
}
if (_options.weekends && $.isArray(_options.weekends) && _options.weekends.length) {
options.weekends = $.extend(true, [], _options.weekends);
}
if (_options.allowDates && $.isArray(_options.allowDates) && _options.allowDates.length) {
options.allowDates = $.extend(true, [], _options.allowDates);
}
if (_options.allowDateRe && Object.prototype.toString.call(_options.allowDateRe) === "[object String]") {
options.allowDateRe = new RegExp(_options.allowDateRe);
}
if (_options.highlightedDates && $.isArray(_options.highlightedDates) && _options.highlightedDates.length) {
$.each(_options.highlightedDates, function (index, value) {
var splitData = $.map(value.split(','), $.trim),
exDesc,
hDate = new HighlightedDate(dateHelper.parseDate(splitData[0], options.formatDate), splitData[1], splitData[2]), // date, desc, style
keyDate = dateHelper.formatDate(hDate.date, options.formatDate);
if (highlightedDates[keyDate] !== undefined) {
exDesc = highlightedDates[keyDate].desc;
if (exDesc && exDesc.length && hDate.desc && hDate.desc.length) {
highlightedDates[keyDate].desc = exDesc + "\n" + hDate.desc;
}
} else {
highlightedDates[keyDate] = hDate;
}
});
options.highlightedDates = $.extend(true, [], highlightedDates);
}
if (_options.highlightedPeriods && $.isArray(_options.highlightedPeriods) && _options.highlightedPeriods.length) {
highlightedDates = $.extend(true, [], options.highlightedDates);
$.each(_options.highlightedPeriods, function (index, value) {
var dateTest, // start date
dateEnd,
desc,
hDate,
keyDate,
exDesc,
style;
if ($.isArray(value)) {
dateTest = value[0];
dateEnd = value[1];
desc = value[2];
style = value[3];
}
else {
var splitData = $.map(value.split(','), $.trim);
dateTest = dateHelper.parseDate(splitData[0], options.formatDate);
dateEnd = dateHelper.parseDate(splitData[1], options.formatDate);
desc = splitData[2];
style = splitData[3];
}
while (dateTest <= dateEnd) {
hDate = new HighlightedDate(dateTest, desc, style);
keyDate = dateHelper.formatDate(dateTest, options.formatDate);
dateTest.setDate(dateTest.getDate() + 1);
if (highlightedDates[keyDate] !== undefined) {
exDesc = highlightedDates[keyDate].desc;
if (exDesc && exDesc.length && hDate.desc && hDate.desc.length) {
highlightedDates[keyDate].desc = exDesc + "\n" + hDate.desc;
}
} else {
highlightedDates[keyDate] = hDate;
}
}
});
options.highlightedDates = $.extend(true, [], highlightedDates);
}
if (_options.disabledDates && $.isArray(_options.disabledDates) && _options.disabledDates.length) {
options.disabledDates = $.extend(true, [], _options.disabledDates);
}
if (_options.disabledWeekDays && $.isArray(_options.disabledWeekDays) && _options.disabledWeekDays.length) {
options.disabledWeekDays = $.extend(true, [], _options.disabledWeekDays);
}
if ((options.open || options.opened) && (!options.inline)) {
input.trigger('open.xdsoft');
}
if (options.inline) {
triggerAfterOpen = true;
datetimepicker.addClass('xdsoft_inline');
input.after(datetimepicker).hide();
}
if (options.inverseButton) {
options.next = 'xdsoft_prev';
options.prev = 'xdsoft_next';
}
if (options.datepicker) {
datepicker.addClass('active');
} else {
datepicker.removeClass('active');
}
if (options.timepicker) {
timepicker.addClass('active');
} else {
timepicker.removeClass('active');
}
if (options.value) {
_xdsoft_datetime.setCurrentTime(options.value);
if (input && input.val) {
input.val(_xdsoft_datetime.str);
}
}
if (isNaN(options.dayOfWeekStart)) {
options.dayOfWeekStart = 0;
} else {
options.dayOfWeekStart = parseInt(options.dayOfWeekStart, 10) % 7;
}
if (!options.timepickerScrollbar) {
timeboxparent.xdsoftScroller(options, 'hide');
}
if (options.minDate && /^[\+\-](.*)$/.test(options.minDate)) {
options.minDate = dateHelper.formatDate(_xdsoft_datetime.strToDateTime(options.minDate), options.formatDate);
}
if (options.maxDate && /^[\+\-](.*)$/.test(options.maxDate)) {
options.maxDate = dateHelper.formatDate(_xdsoft_datetime.strToDateTime(options.maxDate), options.formatDate);
}
applyButton.toggle(options.showApplyButton);
month_picker
.find('.xdsoft_today_button')
.css('visibility', !options.todayButton ? 'hidden' : 'visible');
month_picker
.find('.' + options.prev)
.css('visibility', !options.prevButton ? 'hidden' : 'visible');
month_picker
.find('.' + options.next)
.css('visibility', !options.nextButton ? 'hidden' : 'visible');
setMask(options);
if (options.validateOnBlur) {
input
.off('blur.xdsoft')
.on('blur.xdsoft', function () {
if (options.allowBlank && (!$.trim($(this).val()).length || (typeof options.mask == "string" && $.trim($(this).val()) === options.mask.replace(/[0-9]/g, '_')))) {
$(this).val(null);
datetimepicker.data('xdsoft_datetime').empty();
} else {
var d = dateHelper.parseDate($(this).val(), options.format);
if (d) { // parseDate() may skip some invalid parts like date or time, so make it clear for user: show parsed date/time
$(this).val(dateHelper.formatDate(d, options.format));
} else {
var splittedHours = +([$(this).val()[0], $(this).val()[1]].join('')),
splittedMinutes = +([$(this).val()[2], $(this).val()[3]].join(''));
// parse the numbers as 0312 => 03:12
if (!options.datepicker && options.timepicker && splittedHours >= 0 && splittedHours < 24 && splittedMinutes >= 0 && splittedMinutes < 60) {
$(this).val([splittedHours, splittedMinutes].map(function (item) {
return item > 9 ? item : '0' + item;
}).join(':'));
} else {
$(this).val(dateHelper.formatDate(_xdsoft_datetime.now(), options.format));
}
}
datetimepicker.data('xdsoft_datetime').setCurrentTime($(this).val());
}
datetimepicker.trigger('changedatetime.xdsoft');
datetimepicker.trigger('close.xdsoft');
});
}
options.dayOfWeekStartPrev = (options.dayOfWeekStart === 0) ? 6 : options.dayOfWeekStart - 1;
datetimepicker
.trigger('xchange.xdsoft')
.trigger('afterOpen.xdsoft');
};
datetimepicker
.data('options', options)
.on('touchstart mousedown.xdsoft', function (event) {
event.stopPropagation();
event.preventDefault();
yearselect.hide();
monthselect.hide();
return false;
});
//scroll_element = timepicker.find('.xdsoft_time_box');
timeboxparent.append(timebox);
timeboxparent.xdsoftScroller(options);
datetimepicker.on('afterOpen.xdsoft', function () {
timeboxparent.xdsoftScroller(options);
});
datetimepicker
.append(datepicker)
.append(timepicker);
if (options.withoutCopyright !== true) {
datetimepicker
.append(xdsoft_copyright);
}
datepicker
.append(month_picker)
.append(calendar)
.append(applyButton);
$(options.parentID)
.append(datetimepicker);
XDSoft_datetime = function () {
var _this = this;
_this.now = function (norecursion) {
var d = new Date(),
date,
time;
if (!norecursion && options.defaultDate) {
date = _this.strToDateTime(options.defaultDate);
d.setDate(1);
d.setFullYear(date.getFullYear());
d.setMonth(date.getMonth());
d.setDate(date.getDate());
}
if (options.yearOffset) {
d.setFullYear(d.getFullYear() + options.yearOffset);
}
if (!norecursion && options.defaultTime) {
time = _this.strtotime(options.defaultTime);
d.setHours(time.getHours());
d.setMinutes(time.getMinutes());
}
return d;
};
_this.isValidDate = function (d) {
if (Object.prototype.toString.call(d) !== "[object Date]") {
return false;
}
return !isNaN(d.getTime());
};
_this.setCurrentTime = function (dTime, requireValidDate) {
if (typeof dTime === 'string') {
_this.currentTime = _this.strToDateTime(dTime);
}
else if (_this.isValidDate(dTime)) {
_this.currentTime = dTime;
}
else if (!dTime && !requireValidDate && options.allowBlank) {
_this.currentTime = null;
}
else {
_this.currentTime = _this.now();
}
datetimepicker.trigger('xchange.xdsoft');
};
_this.empty = function () {
_this.currentTime = null;
};
_this.getCurrentTime = function (dTime) {
return _this.currentTime;
};
_this.nextMonth = function () {
if (_this.currentTime === undefined || _this.currentTime === null) {
_this.currentTime = _this.now();
}
var month = _this.currentTime.getMonth() + 1,
year;
if (month === 12) {
_this.currentTime.setFullYear(_this.currentTime.getFullYear() + 1);
month = 0;
}
year = _this.currentTime.getFullYear();
_this.currentTime.setDate(
Math.min(
new Date(_this.currentTime.getFullYear(), month + 1, 0).getDate(),
_this.currentTime.getDate()
)
);
_this.currentTime.setMonth(month);
if (options.onChangeMonth && $.isFunction(options.onChangeMonth)) {
options.onChangeMonth.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'));
}
if (year !== _this.currentTime.getFullYear() && $.isFunction(options.onChangeYear)) {
options.onChangeYear.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'));
}
datetimepicker.trigger('xchange.xdsoft');
return month;
};
_this.prevMonth = function () {
if (_this.currentTime === undefined || _this.currentTime === null) {
_this.currentTime = _this.now();
}
var month = _this.currentTime.getMonth() - 1;
if (month === -1) {
_this.currentTime.setFullYear(_this.currentTime.getFullYear() - 1);
month = 11;
}
_this.currentTime.setDate(
Math.min(
new Date(_this.currentTime.getFullYear(), month + 1, 0).getDate(),
_this.currentTime.getDate()
)
);
_this.currentTime.setMonth(month);
if (options.onChangeMonth && $.isFunction(options.onChangeMonth)) {
options.onChangeMonth.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'));
}
datetimepicker.trigger('xchange.xdsoft');
return month;
};
_this.getWeekOfYear = function (datetime) {
if (options.onGetWeekOfYear && $.isFunction(options.onGetWeekOfYear)) {
var week = options.onGetWeekOfYear.call(datetimepicker, datetime);
if (typeof week !== 'undefined') {
return week;
}
}
var onejan = new Date(datetime.getFullYear(), 0, 1);
//First week of the year is th one with the first Thursday according to ISO8601
if (onejan.getDay() != 4)
onejan.setMonth(0, 1 + ((4 - onejan.getDay() + 7) % 7));
return Math.ceil((((datetime - onejan) / 86400000) + onejan.getDay() + 1) / 7);
};
_this.strToDateTime = function (sDateTime) {
var tmpDate = [], timeOffset, currentTime;
if (sDateTime && sDateTime instanceof Date && _this.isValidDate(sDateTime)) {
return sDateTime;
}
tmpDate = /^(\+|\-)(.*)$/.exec(sDateTime);
if (tmpDate) {
tmpDate[2] = dateHelper.parseDate(tmpDate[2], options.formatDate);
}
if (tmpDate && tmpDate[2]) {
timeOffset = tmpDate[2].getTime() - (tmpDate[2].getTimezoneOffset()) * 60000;
currentTime = new Date((_this.now(true)).getTime() + parseInt(tmpDate[1] + '1', 10) * timeOffset);
} else {
currentTime = sDateTime ? dateHelper.parseDate(sDateTime, options.format) : _this.now();
}
if (!_this.isValidDate(currentTime)) {
currentTime = _this.now();
}
return currentTime;
};
_this.strToDate = function (sDate) {
if (sDate && sDate instanceof Date && _this.isValidDate(sDate)) {
return sDate;
}
var currentTime = sDate ? dateHelper.parseDate(sDate, options.formatDate) : _this.now(true);
if (!_this.isValidDate(currentTime)) {
currentTime = _this.now(true);
}
return currentTime;
};
_this.strtotime = function (sTime) {
if (sTime && sTime instanceof Date && _this.isValidDate(sTime)) {
return sTime;
}
var currentTime = sTime ? dateHelper.parseDate(sTime, options.formatTime) : _this.now(true);
if (!_this.isValidDate(currentTime)) {
currentTime = _this.now(true);
}
return currentTime;
};
_this.str = function () {
return dateHelper.formatDate(_this.currentTime, options.format);
};
_this.currentTime = this.now();
};
_xdsoft_datetime = new XDSoft_datetime();
applyButton.on('touchend click', function (e) {//pathbrite
e.preventDefault();
datetimepicker.data('changed', true);
_xdsoft_datetime.setCurrentTime(getCurrentValue());
input.val(_xdsoft_datetime.str());
datetimepicker.trigger('close.xdsoft');
});
month_picker
.find('.xdsoft_today_button')
.on('touchend mousedown.xdsoft', function () {
datetimepicker.data('changed', true);
_xdsoft_datetime.setCurrentTime(0, true);
datetimepicker.trigger('afterOpen.xdsoft');
}).on('dblclick.xdsoft', function () {
var currentDate = _xdsoft_datetime.getCurrentTime(), minDate, maxDate;
currentDate = new Date(currentDate.getFullYear(), currentDate.getMonth(), currentDate.getDate());
minDate = _xdsoft_datetime.strToDate(options.minDate);
minDate = new Date(minDate.getFullYear(), minDate.getMonth(), minDate.getDate());
if (currentDate < minDate) {
return;
}
maxDate = _xdsoft_datetime.strToDate(options.maxDate);
maxDate = new Date(maxDate.getFullYear(), maxDate.getMonth(), maxDate.getDate());
if (currentDate > maxDate) {
return;
}
input.val(_xdsoft_datetime.str());
input.trigger('change');
datetimepicker.trigger('close.xdsoft');
});
month_picker
.find('.xdsoft_prev,.xdsoft_next')
.on('touchend mousedown.xdsoft', function () {
var $this = $(this),
timer = 0,
stop = false;
(function arguments_callee1(v) {
if ($this.hasClass(options.next)) {
_xdsoft_datetime.nextMonth();
} else if ($this.hasClass(options.prev)) {
_xdsoft_datetime.prevMonth();
}
if (options.monthChangeSpinner) {
if (!stop) {
timer = setTimeout(arguments_callee1, v || 100);
}
}
}(500));
$([options.ownerDocument.body, options.contentWindow]).on('touchend mouseup.xdsoft', function arguments_callee2() {
clearTimeout(timer);
stop = true;
$([options.ownerDocument.body, options.contentWindow]).off('touchend mouseup.xdsoft', arguments_callee2);
});
});
timepicker
.find('.xdsoft_prev,.xdsoft_next')
.on('touchend mousedown.xdsoft', function () {
var $this = $(this),
timer = 0,
stop = false,
period = 110;
(function arguments_callee4(v) {
var pheight = timeboxparent[0].clientHeight,
height = timebox[0].offsetHeight,
top = Math.abs(parseInt(timebox.css('marginTop'), 10));
if ($this.hasClass(options.next) && (height - pheight) - options.timeHeightInTimePicker >= top) {
timebox.css('marginTop', '-' + (top + options.timeHeightInTimePicker) + 'px');
} else if ($this.hasClass(options.prev) && top - options.timeHeightInTimePicker >= 0) {
timebox.css('marginTop', '-' + (top - options.timeHeightInTimePicker) + 'px');
}
/**
* Fixed bug:
* When using css3 transition, it will cause a bug that you cannot scroll the timepicker list.
* The reason is that the transition-duration time, if you set it to 0, all things fine, otherwise, this
* would cause a bug when you use jquery.css method.
* Let's say: * { transition: all .5s ease; }
* jquery timebox.css('marginTop') will return the original value which is before you clicking the next/prev button,
* meanwhile the timebox[0].style.marginTop will return the right value which is after you clicking the
* next/prev button.
*
* What we should do:
* Replace timebox.css('marginTop') with timebox[0].style.marginTop.
*/
timeboxparent.trigger('scroll_element.xdsoft_scroller', [Math.abs(parseInt(timebox[0].style.marginTop, 10) / (height - pheight))]);
period = (period > 10) ? 10 : period - 10;
if (!stop) {
timer = setTimeout(arguments_callee4, v || period);
}
}(500));
$([options.ownerDocument.body, options.contentWindow]).on('touchend mouseup.xdsoft', function arguments_callee5() {
clearTimeout(timer);
stop = true;
$([options.ownerDocument.body, options.contentWindow])
.off('touchend mouseup.xdsoft', arguments_callee5);
});
});
xchangeTimer = 0;
// base handler - generating a calendar and timepicker
datetimepicker
.on('xchange.xdsoft', function (event) {
clearTimeout(xchangeTimer);
xchangeTimer = setTimeout(function () {
if (_xdsoft_datetime.currentTime === undefined || _xdsoft_datetime.currentTime === null) {
//In case blanks are allowed, delay construction until we have a valid date
if (options.allowBlank)
return;
_xdsoft_datetime.currentTime = _xdsoft_datetime.now();
}
var table = '',
start = new Date(_xdsoft_datetime.currentTime.getFullYear(), _xdsoft_datetime.currentTime.getMonth(), 1, 12, 0, 0),
i = 0,
j,
today = _xdsoft_datetime.now(),
maxDate = false,
minDate = false,
hDate,
day,
d,
y,
m,
w,
classes = [],
customDateSettings,
newRow = true,
time = '',
h = '',
line_time,
description;
while (start.getDay() !== options.dayOfWeekStart) {
start.setDate(start.getDate() - 1);
}
table += '';
if (options.weeks) {
table += ' ';
}
for (j = 0; j < 7; j += 1) {
table += '' + options.i18n[globalLocale].dayOfWeekShort[(j + options.dayOfWeekStart) % 7] + ' ';
}
table += ' ';
table += '';
if (options.maxDate !== false) {
maxDate = _xdsoft_datetime.strToDate(options.maxDate);
maxDate = new Date(maxDate.getFullYear(), maxDate.getMonth(), maxDate.getDate(), 23, 59, 59, 999);
}
if (options.minDate !== false) {
minDate = _xdsoft_datetime.strToDate(options.minDate);
minDate = new Date(minDate.getFullYear(), minDate.getMonth(), minDate.getDate());
}
while (i < _xdsoft_datetime.currentTime.countDaysInMonth() || start.getDay() !== options.dayOfWeekStart || _xdsoft_datetime.currentTime.getMonth() === start.getMonth()) {
classes = [];
i += 1;
day = start.getDay();
d = start.getDate();
y = start.getFullYear();
m = start.getMonth();
w = _xdsoft_datetime.getWeekOfYear(start);
description = '';
classes.push('xdsoft_date');
if (options.beforeShowDay && $.isFunction(options.beforeShowDay.call)) {
customDateSettings = options.beforeShowDay.call(datetimepicker, start);
} else {
customDateSettings = null;
}
if (options.allowDateRe && Object.prototype.toString.call(options.allowDateRe) === "[object RegExp]") {
if (!options.allowDateRe.test(dateHelper.formatDate(start, options.formatDate))) {
classes.push('xdsoft_disabled');
}
} else if (options.allowDates && options.allowDates.length > 0) {
if (options.allowDates.indexOf(dateHelper.formatDate(start, options.formatDate)) === -1) {
classes.push('xdsoft_disabled');
}
} else if ((maxDate !== false && start > maxDate) || (minDate !== false && start < minDate) || (customDateSettings && customDateSettings[0] === false)) {
classes.push('xdsoft_disabled');
} else if (options.disabledDates.indexOf(dateHelper.formatDate(start, options.formatDate)) !== -1) {
classes.push('xdsoft_disabled');
} else if (options.disabledWeekDays.indexOf(day) !== -1) {
classes.push('xdsoft_disabled');
} else if (input.is('[readonly]')) {
classes.push('xdsoft_disabled');
}
if (customDateSettings && customDateSettings[1] !== "") {
classes.push(customDateSettings[1]);
}
if (_xdsoft_datetime.currentTime.getMonth() !== m) {
classes.push('xdsoft_other_month');
}
if ((options.defaultSelect || datetimepicker.data('changed')) && dateHelper.formatDate(_xdsoft_datetime.currentTime, options.formatDate) === dateHelper.formatDate(start, options.formatDate)) {
classes.push('xdsoft_current');
}
if (dateHelper.formatDate(today, options.formatDate) === dateHelper.formatDate(start, options.formatDate)) {
classes.push('xdsoft_today');
}
if (start.getDay() === 0 || start.getDay() === 6 || options.weekends.indexOf(dateHelper.formatDate(start, options.formatDate)) !== -1) {
classes.push('xdsoft_weekend');
}
if (options.highlightedDates[dateHelper.formatDate(start, options.formatDate)] !== undefined) {
hDate = options.highlightedDates[dateHelper.formatDate(start, options.formatDate)];
classes.push(hDate.style === undefined ? 'xdsoft_highlighted_default' : hDate.style);
description = hDate.desc === undefined ? '' : hDate.desc;
}
if (options.beforeShowDay && $.isFunction(options.beforeShowDay)) {
classes.push(options.beforeShowDay(start));
}
if (newRow) {
table += '';
newRow = false;
if (options.weeks) {
table += '' + w + ' ';
}
}
table += '' +
'' + d + '
' +
' ';
if (start.getDay() === options.dayOfWeekStartPrev) {
table += ' ';
newRow = true;
}
start.setDate(d + 1);
}
table += '
';
calendar.html(table);
month_picker.find('.xdsoft_label span').eq(0).text(options.i18n[globalLocale].months[_xdsoft_datetime.currentTime.getMonth()]);
month_picker.find('.xdsoft_label span').eq(1).text(_xdsoft_datetime.currentTime.getFullYear());
// generate timebox
time = '';
h = '';
m = '';
line_time = function line_time(h, m) {
var now = _xdsoft_datetime.now(), optionDateTime, current_time,
isALlowTimesInit = options.allowTimes && $.isArray(options.allowTimes) && options.allowTimes.length;
now.setHours(h);
h = parseInt(now.getHours(), 10);
now.setMinutes(m);
m = parseInt(now.getMinutes(), 10);
optionDateTime = new Date(_xdsoft_datetime.currentTime);
optionDateTime.setHours(h);
optionDateTime.setMinutes(m);
classes = [];
/* begin change */
// https://github.com/xdan/datetimepicker/issues/377
var nowMonth = now.getMonth() + 1;
if (nowMonth < 10) { nowMonth = "0" + nowMonth; }
var minT = nowMonth + "/" + now.getDate() + "/" + now.getFullYear() + " " + options.minTime;
var maxT = nowMonth + "/" + now.getDate() + "/" + now.getFullYear() + " " + options.maxTime;
if ((options.minDateTime !== false && options.minDateTime > optionDateTime) || (options.maxTime !== false && (_xdsoft_datetime.strtotime(new Date(maxT)).getTime() + (options.step * 60000)) < now.getTime()) || (options.minTime !== false && _xdsoft_datetime.strtotime(new Date(minT)).getTime() > now.getTime())) {
classes.push('xdsoft_disabled');
} /* end change */ else if ((options.minDateTime !== false && options.minDateTime > optionDateTime) || ((options.disabledMinTime !== false && now.getTime() > _xdsoft_datetime.strtotime(options.disabledMinTime).getTime()) && (options.disabledMaxTime !== false && now.getTime() < _xdsoft_datetime.strtotime(options.disabledMaxTime).getTime()))) {
classes.push('xdsoft_disabled');
} else if (input.is('[readonly]')) {
classes.push('xdsoft_disabled');
}
current_time = new Date(_xdsoft_datetime.currentTime);
current_time.setHours(parseInt(_xdsoft_datetime.currentTime.getHours(), 10));
if (!isALlowTimesInit) {
current_time.setMinutes(Math[options.roundTime](_xdsoft_datetime.currentTime.getMinutes() / options.step) * options.step);
}
if ((options.initTime || options.defaultSelect || datetimepicker.data('changed')) && current_time.getHours() === parseInt(h, 10) && ((!isALlowTimesInit && options.step > 59) || current_time.getMinutes() === parseInt(m, 10))) {
if (options.defaultSelect || datetimepicker.data('changed')) {
classes.push('xdsoft_current');
} else if (options.initTime) {
classes.push('xdsoft_init_time');
}
}
if (parseInt(today.getHours(), 10) === parseInt(h, 10) && parseInt(today.getMinutes(), 10) === parseInt(m, 10)) {
classes.push('xdsoft_today');
}
time += '' + dateHelper.formatDate(now, options.formatTime) + '
';
};
if (!options.allowTimes || !$.isArray(options.allowTimes) || !options.allowTimes.length) {
for (i = 0, j = 0; i < (options.hours12 ? 12 : 24) ; i += 1) {
for (j = 0; j < 60; j += options.step) {
h = (i < 10 ? '0' : '') + i;
m = (j < 10 ? '0' : '') + j;
line_time(h, m);
}
}
} else {
for (i = 0; i < options.allowTimes.length; i += 1) {
h = _xdsoft_datetime.strtotime(options.allowTimes[i]).getHours();
m = _xdsoft_datetime.strtotime(options.allowTimes[i]).getMinutes();
line_time(h, m);
}
}
timebox.html(time);
opt = '';
i = 0;
for (i = parseInt(options.yearStart, 10) + options.yearOffset; i <= parseInt(options.yearEnd, 10) + options.yearOffset; i += 1) {
opt += '' + i + '
';
}
yearselect.children().eq(0)
.html(opt);
for (i = parseInt(options.monthStart, 10), opt = ''; i <= parseInt(options.monthEnd, 10) ; i += 1) {
opt += '' + options.i18n[globalLocale].months[i] + '
';
}
monthselect.children().eq(0).html(opt);
$(datetimepicker)
.trigger('generate.xdsoft');
}, 10);
event.stopPropagation();
})
.on('afterOpen.xdsoft', function () {
if (options.timepicker) {
var classType, pheight, height, top;
if (timebox.find('.xdsoft_current').length) {
classType = '.xdsoft_current';
} else if (timebox.find('.xdsoft_init_time').length) {
classType = '.xdsoft_init_time';
}
if (classType) {
pheight = timeboxparent[0].clientHeight;
height = timebox[0].offsetHeight;
top = timebox.find(classType).index() * options.timeHeightInTimePicker + 1;
if ((height - pheight) < top) {
top = height - pheight;
}
timeboxparent.trigger('scroll_element.xdsoft_scroller', [parseInt(top, 10) / (height - pheight)]);
} else {
timeboxparent.trigger('scroll_element.xdsoft_scroller', [0]);
}
}
});
timerclick = 0;
calendar
.on('touchend click.xdsoft', 'td', function (xdevent) {
xdevent.stopPropagation(); // Prevents closing of Pop-ups, Modals and Flyouts in Bootstrap
timerclick += 1;
var $this = $(this),
currentTime = _xdsoft_datetime.currentTime;
if (currentTime === undefined || currentTime === null) {
_xdsoft_datetime.currentTime = _xdsoft_datetime.now();
currentTime = _xdsoft_datetime.currentTime;
}
if ($this.hasClass('xdsoft_disabled')) {
return false;
}
currentTime.setDate(1);
currentTime.setFullYear($this.data('year'));
currentTime.setMonth($this.data('month'));
currentTime.setDate($this.data('date'));
datetimepicker.trigger('select.xdsoft', [currentTime]);
input.val(_xdsoft_datetime.str());
if (options.onSelectDate && $.isFunction(options.onSelectDate)) {
options.onSelectDate.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'), xdevent);
}
datetimepicker.data('changed', true);
datetimepicker.trigger('xchange.xdsoft');
datetimepicker.trigger('changedatetime.xdsoft');
if ((timerclick > 1 || (options.closeOnDateSelect === true || (options.closeOnDateSelect === false && !options.timepicker))) && !options.inline) {
datetimepicker.trigger('close.xdsoft');
}
setTimeout(function () {
timerclick = 0;
}, 200);
});
timebox
.on('touchend click.xdsoft', 'div', function (xdevent) {
xdevent.stopPropagation();
var $this = $(this),
currentTime = _xdsoft_datetime.currentTime;
if (currentTime === undefined || currentTime === null) {
_xdsoft_datetime.currentTime = _xdsoft_datetime.now();
currentTime = _xdsoft_datetime.currentTime;
}
if ($this.hasClass('xdsoft_disabled')) {
return false;
}
currentTime.setHours($this.data('hour'));
currentTime.setMinutes($this.data('minute'));
datetimepicker.trigger('select.xdsoft', [currentTime]);
datetimepicker.data('input').val(_xdsoft_datetime.str());
if (options.onSelectTime && $.isFunction(options.onSelectTime)) {
options.onSelectTime.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'), xdevent);
}
datetimepicker.data('changed', true);
datetimepicker.trigger('xchange.xdsoft');
datetimepicker.trigger('changedatetime.xdsoft');
if (options.inline !== true && options.closeOnTimeSelect === true) {
datetimepicker.trigger('close.xdsoft');
}
});
datepicker
.on('mousewheel.xdsoft', function (event) {
if (!options.scrollMonth) {
return true;
}
if (event.deltaY < 0) {
_xdsoft_datetime.nextMonth();
} else {
_xdsoft_datetime.prevMonth();
}
return false;
});
input
.on('mousewheel.xdsoft', function (event) {
if (!options.scrollInput) {
return true;
}
if (!options.datepicker && options.timepicker) {
current_time_index = timebox.find('.xdsoft_current').length ? timebox.find('.xdsoft_current').eq(0).index() : 0;
if (current_time_index + event.deltaY >= 0 && current_time_index + event.deltaY < timebox.children().length) {
current_time_index += event.deltaY;
}
if (timebox.children().eq(current_time_index).length) {
timebox.children().eq(current_time_index).trigger('mousedown');
}
return false;
}
if (options.datepicker && !options.timepicker) {
datepicker.trigger(event, [event.deltaY, event.deltaX, event.deltaY]);
if (input.val) {
input.val(_xdsoft_datetime.str());
}
datetimepicker.trigger('changedatetime.xdsoft');
return false;
}
});
datetimepicker
.on('changedatetime.xdsoft', function (event) {
if (options.onChangeDateTime && $.isFunction(options.onChangeDateTime)) {
var $input = datetimepicker.data('input');
options.onChangeDateTime.call(datetimepicker, _xdsoft_datetime.currentTime, $input, event);
delete options.value;
$input.trigger('change');
}
})
.on('generate.xdsoft', function () {
if (options.onGenerate && $.isFunction(options.onGenerate)) {
options.onGenerate.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'));
}
if (triggerAfterOpen) {
datetimepicker.trigger('afterOpen.xdsoft');
triggerAfterOpen = false;
}
})
.on('click.xdsoft', function (xdevent) {
xdevent.stopPropagation();
});
current_time_index = 0;
/**
* Runs the callback for each of the specified node's ancestors.
*
* Return FALSE from the callback to stop ascending.
*
* @param {DOMNode} node
* @param {Function} callback
* @returns {undefined}
*/
forEachAncestorOf = function (node, callback) {
do {
node = node.parentNode;
if (callback(node) === false) {
break;
}
} while (node.nodeName !== 'HTML');
};
/**
* Sets the position of the picker.
*
* @returns {undefined}
*/
setPos = function () {
var dateInputOffset,
dateInputElem,
verticalPosition,
left,
position,
datetimepickerElem,
dateInputHasFixedAncestor,
$dateInput,
windowWidth,
verticalAnchorEdge,
datetimepickerCss,
windowHeight,
windowScrollTop;
$dateInput = datetimepicker.data('input');
dateInputOffset = $dateInput.offset();
dateInputElem = $dateInput[0];
verticalAnchorEdge = 'top';
verticalPosition = (dateInputOffset.top + dateInputElem.offsetHeight) - 1;
left = dateInputOffset.left;
position = "absolute";
windowWidth = $(options.contentWindow).width();
windowHeight = $(options.contentWindow).height();
windowScrollTop = $(options.contentWindow).scrollTop();
if ((options.ownerDocument.documentElement.clientWidth - dateInputOffset.left) < datepicker.parent().outerWidth(true)) {
var diff = datepicker.parent().outerWidth(true) - dateInputElem.offsetWidth;
left = left - diff;
}
if ($dateInput.parent().css('direction') === 'rtl') {
left -= (datetimepicker.outerWidth() - $dateInput.outerWidth());
}
if (options.fixed) {
verticalPosition -= windowScrollTop;
left -= $(options.contentWindow).scrollLeft();
position = "fixed";
} else {
dateInputHasFixedAncestor = false;
forEachAncestorOf(dateInputElem, function (ancestorNode) {
if (options.contentWindow.getComputedStyle(ancestorNode).getPropertyValue('position') === 'fixed') {
dateInputHasFixedAncestor = true;
return false;
}
});
if (dateInputHasFixedAncestor) {
position = 'fixed';
//If the picker won't fit entirely within the viewport then display it above the date input.
if (verticalPosition + datetimepicker.outerHeight() > windowHeight + windowScrollTop) {
verticalAnchorEdge = 'bottom';
verticalPosition = (windowHeight + windowScrollTop) - dateInputOffset.top;
} else {
verticalPosition -= windowScrollTop;
}
} else {
if (verticalPosition + dateInputElem.offsetHeight > windowHeight + windowScrollTop) {
verticalPosition = dateInputOffset.top - dateInputElem.offsetHeight + 1;
}
}
if (verticalPosition < 0) {
verticalPosition = 0;
}
if (left + dateInputElem.offsetWidth > windowWidth) {
left = windowWidth - dateInputElem.offsetWidth;
}
}
datetimepickerElem = datetimepicker[0];
forEachAncestorOf(datetimepickerElem, function (ancestorNode) {
var ancestorNodePosition;
ancestorNodePosition = options.contentWindow.getComputedStyle(ancestorNode).getPropertyValue('position');
if (ancestorNodePosition === 'relative' && windowWidth >= ancestorNode.offsetWidth) {
left = left - ((windowWidth - ancestorNode.offsetWidth) / 2);
return false;
}
});
datetimepickerCss = {
position: position,
left: left,
top: '', //Initialize to prevent previous values interfering with new ones.
bottom: '' //Initialize to prevent previous values interfering with new ones.
};
datetimepickerCss[verticalAnchorEdge] = verticalPosition;
datetimepicker.css(datetimepickerCss);
};
datetimepicker
.on('open.xdsoft', function (event) {
var onShow = true;
if (options.onShow && $.isFunction(options.onShow)) {
onShow = options.onShow.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'), event);
}
if (onShow !== false) {
datetimepicker.show();
setPos();
$(options.contentWindow)
.off('resize.xdsoft', setPos)
.on('resize.xdsoft', setPos);
if (options.closeOnWithoutClick) {
$([options.ownerDocument.body, options.contentWindow]).on('touchstart mousedown.xdsoft', function arguments_callee6() {
datetimepicker.trigger('close.xdsoft');
$([options.ownerDocument.body, options.contentWindow]).off('touchstart mousedown.xdsoft', arguments_callee6);
});
}
}
})
.on('close.xdsoft', function (event) {
var onClose = true;
month_picker
.find('.xdsoft_month,.xdsoft_year')
.find('.xdsoft_select')
.hide();
if (options.onClose && $.isFunction(options.onClose)) {
onClose = options.onClose.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'), event);
}
if (onClose !== false && !options.opened && !options.inline) {
datetimepicker.hide();
}
event.stopPropagation();
})
.on('toggle.xdsoft', function () {
if (datetimepicker.is(':visible')) {
datetimepicker.trigger('close.xdsoft');
} else {
datetimepicker.trigger('open.xdsoft');
}
})
.data('input', input);
timer = 0;
datetimepicker.data('xdsoft_datetime', _xdsoft_datetime);
datetimepicker.setOptions(options);
function getCurrentValue() {
var ct = false, time;
if (options.startDate) {
ct = _xdsoft_datetime.strToDate(options.startDate);
} else {
ct = options.value || ((input && input.val && input.val()) ? input.val() : '');
if (ct) {
ct = _xdsoft_datetime.strToDateTime(ct);
} else if (options.defaultDate) {
ct = _xdsoft_datetime.strToDateTime(options.defaultDate);
if (options.defaultTime) {
time = _xdsoft_datetime.strtotime(options.defaultTime);
ct.setHours(time.getHours());
ct.setMinutes(time.getMinutes());
}
}
}
if (ct && _xdsoft_datetime.isValidDate(ct)) {
datetimepicker.data('changed', true);
} else {
ct = '';
}
return ct || 0;
}
function setMask(options) {
var isValidValue = function (mask, value) {
var reg = mask
.replace(/([\[\]\/\{\}\(\)\-\.\+]{1})/g, '\\$1')
.replace(/_/g, '{digit+}')
.replace(/([0-9]{1})/g, '{digit$1}')
.replace(/\{digit([0-9]{1})\}/g, '[0-$1_]{1}')
.replace(/\{digit[\+]\}/g, '[0-9_]{1}');
return (new RegExp(reg)).test(value);
},
getCaretPos = function (input) {
try {
if (options.ownerDocument.selection && options.ownerDocument.selection.createRange) {
var range = options.ownerDocument.selection.createRange();
return range.getBookmark().charCodeAt(2) - 2;
}
if (input.setSelectionRange) {
return input.selectionStart;
}
} catch (e) {
return 0;
}
},
setCaretPos = function (node, pos) {
node = (typeof node === "string" || node instanceof String) ? options.ownerDocument.getElementById(node) : node;
if (!node) {
return false;
}
if (node.createTextRange) {
var textRange = node.createTextRange();
textRange.collapse(true);
textRange.moveEnd('character', pos);
textRange.moveStart('character', pos);
textRange.select();
return true;
}
if (node.setSelectionRange) {
node.setSelectionRange(pos, pos);
return true;
}
return false;
};
if (options.mask) {
input.off('keydown.xdsoft');
}
if (options.mask === true) {
if (typeof moment != 'undefined') {
options.mask = options.format
.replace(/Y{4}/g, '9999')
.replace(/Y{2}/g, '99')
.replace(/M{2}/g, '19')
.replace(/D{2}/g, '39')
.replace(/H{2}/g, '29')
.replace(/m{2}/g, '59')
.replace(/s{2}/g, '59');
} else {
options.mask = options.format
.replace(/Y/g, '9999')
.replace(/F/g, '9999')
.replace(/m/g, '19')
.replace(/d/g, '39')
.replace(/H/g, '29')
.replace(/i/g, '59')
.replace(/s/g, '59');
}
}
if ($.type(options.mask) === 'string') {
if (!isValidValue(options.mask, input.val())) {
input.val(options.mask.replace(/[0-9]/g, '_'));
setCaretPos(input[0], 0);
}
input.on('keydown.xdsoft', function (event) {
var val = this.value,
key = event.which,
pos,
digit;
if (((key >= KEY0 && key <= KEY9) || (key >= _KEY0 && key <= _KEY9)) || (key === BACKSPACE || key === DEL)) {
pos = getCaretPos(this);
digit = (key !== BACKSPACE && key !== DEL) ? String.fromCharCode((_KEY0 <= key && key <= _KEY9) ? key - KEY0 : key) : '_';
if ((key === BACKSPACE || key === DEL) && pos) {
pos -= 1;
digit = '_';
}
while (/[^0-9_]/.test(options.mask.substr(pos, 1)) && pos < options.mask.length && pos > 0) {
pos += (key === BACKSPACE || key === DEL) ? -1 : 1;
}
val = val.substr(0, pos) + digit + val.substr(pos + 1);
if ($.trim(val) === '') {
val = options.mask.replace(/[0-9]/g, '_');
} else {
if (pos === options.mask.length) {
event.preventDefault();
return false;
}
}
pos += (key === BACKSPACE || key === DEL) ? 0 : 1;
while (/[^0-9_]/.test(options.mask.substr(pos, 1)) && pos < options.mask.length && pos > 0) {
pos += (key === BACKSPACE || key === DEL) ? -1 : 1;
}
if (isValidValue(options.mask, val)) {
this.value = val;
setCaretPos(this, pos);
} else if ($.trim(val) === '') {
this.value = options.mask.replace(/[0-9]/g, '_');
} else {
input.trigger('error_input.xdsoft');
}
} else {
if (([AKEY, CKEY, VKEY, ZKEY, YKEY].indexOf(key) !== -1 && ctrlDown) || [ESC, ARROWUP, ARROWDOWN, ARROWLEFT, ARROWRIGHT, F5, CTRLKEY, TAB, ENTER].indexOf(key) !== -1) {
return true;
}
}
event.preventDefault();
return false;
});
}
}
_xdsoft_datetime.setCurrentTime(getCurrentValue());
input
.data('xdsoft_datetimepicker', datetimepicker)
.on('open.xdsoft focusin.xdsoft mousedown.xdsoft touchstart', function () {
if (input.is(':disabled') || (input.data('xdsoft_datetimepicker').is(':visible') && options.closeOnInputClick)) {
return;
}
clearTimeout(timer);
timer = setTimeout(function () {
if (input.is(':disabled')) {
return;
}
triggerAfterOpen = true;
_xdsoft_datetime.setCurrentTime(getCurrentValue(), true);
if (options.mask) {
setMask(options);
}
datetimepicker.trigger('open.xdsoft');
}, 100);
})
.on('keydown.xdsoft', function (event) {
var elementSelector,
key = event.which;
if ([ENTER].indexOf(key) !== -1 && options.enterLikeTab) {
elementSelector = $("input:visible,textarea:visible,button:visible,a:visible");
datetimepicker.trigger('close.xdsoft');
elementSelector.eq(elementSelector.index(this) + 1).focus();
return false;
}
if ([TAB].indexOf(key) !== -1) {
datetimepicker.trigger('close.xdsoft');
return true;
}
})
.on('blur.xdsoft', function () {
datetimepicker.trigger('close.xdsoft');
});
};
destroyDateTimePicker = function (input) {
var datetimepicker = input.data('xdsoft_datetimepicker');
if (datetimepicker) {
datetimepicker.data('xdsoft_datetime', null);
datetimepicker.remove();
input
.data('xdsoft_datetimepicker', null)
.off('.xdsoft');
$(options.contentWindow).off('resize.xdsoft');
$([options.contentWindow, options.ownerDocument.body]).off('mousedown.xdsoft touchstart');
if (input.unmousewheel) {
input.unmousewheel();
}
}
};
$(options.ownerDocument)
.off('keydown.xdsoftctrl keyup.xdsoftctrl')
.on('keydown.xdsoftctrl', function (e) {
if (e.keyCode === CTRLKEY) {
ctrlDown = true;
}
})
.on('keyup.xdsoftctrl', function (e) {
if (e.keyCode === CTRLKEY) {
ctrlDown = false;
}
});
this.each(function () {
var datetimepicker = $(this).data('xdsoft_datetimepicker'), $input;
if (datetimepicker) {
if ($.type(opt) === 'string') {
switch (opt) {
case 'show':
$(this).select().focus();
datetimepicker.trigger('open.xdsoft');
break;
case 'hide':
datetimepicker.trigger('close.xdsoft');
break;
case 'toggle':
datetimepicker.trigger('toggle.xdsoft');
break;
case 'destroy':
destroyDateTimePicker($(this));
break;
case 'reset':
this.value = this.defaultValue;
if (!this.value || !datetimepicker.data('xdsoft_datetime').isValidDate(dateHelper.parseDate(this.value, options.format))) {
datetimepicker.data('changed', false);
}
datetimepicker.data('xdsoft_datetime').setCurrentTime(this.value);
break;
case 'validate':
$input = datetimepicker.data('input');
$input.trigger('blur.xdsoft');
break;
default:
if (datetimepicker[opt] && $.isFunction(datetimepicker[opt])) {
result = datetimepicker[opt](opt2);
}
}
} else {
datetimepicker
.setOptions(opt);
}
return 0;
}
if ($.type(opt) !== 'string') {
if (!options.lazyInit || options.open || options.inline) {
createDateTimePicker($(this));
} else {
lazyInit($(this));
}
}
});
return result;
};
$.fn.datetimepicker.defaults = default_options;
function HighlightedDate(date, desc, style) {
"use strict";
this.date = date;
this.desc = desc;
this.style = style;
}
}));
/*!
* jQuery Mousewheel 3.1.13
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license
* http://jquery.org/license
*/
(function (factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(['jquery'], factory);
} else if (typeof exports === 'object') {
// Node/CommonJS style for Browserify
module.exports = factory;
} else {
// Browser globals
factory(jQuery);
}
}(function ($) {
var toFix = ['wheel', 'mousewheel', 'DOMMouseScroll', 'MozMousePixelScroll'],
toBind = ('onwheel' in document || document.documentMode >= 9) ?
['wheel'] : ['mousewheel', 'DomMouseScroll', 'MozMousePixelScroll'],
slice = Array.prototype.slice,
nullLowestDeltaTimeout, lowestDelta;
if ($.event.fixHooks) {
for (var i = toFix.length; i;) {
$.event.fixHooks[toFix[--i]] = $.event.mouseHooks;
}
}
var special = $.event.special.mousewheel = {
version: '3.1.12',
setup: function () {
if (this.addEventListener) {
for (var i = toBind.length; i;) {
this.addEventListener(toBind[--i], handler, false);
}
} else {
this.onmousewheel = handler;
}
// Store the line height and page height for this particular element
$.data(this, 'mousewheel-line-height', special.getLineHeight(this));
$.data(this, 'mousewheel-page-height', special.getPageHeight(this));
},
teardown: function () {
if (this.removeEventListener) {
for (var i = toBind.length; i;) {
this.removeEventListener(toBind[--i], handler, false);
}
} else {
this.onmousewheel = null;
}
// Clean up the data we added to the element
$.removeData(this, 'mousewheel-line-height');
$.removeData(this, 'mousewheel-page-height');
},
getLineHeight: function (elem) {
var $elem = $(elem),
$parent = $elem['offsetParent' in $.fn ? 'offsetParent' : 'parent']();
if (!$parent.length) {
$parent = $('body');
}
return parseInt($parent.css('fontSize'), 10) || parseInt($elem.css('fontSize'), 10) || 16;
},
getPageHeight: function (elem) {
return $(elem).height();
},
settings: {
adjustOldDeltas: true, // see shouldAdjustOldDeltas() below
normalizeOffset: true // calls getBoundingClientRect for each event
}
};
$.fn.extend({
mousewheel: function (fn) {
return fn ? this.bind('mousewheel', fn) : this.trigger('mousewheel');
},
unmousewheel: function (fn) {
return this.unbind('mousewheel', fn);
}
});
function handler(event) {
var orgEvent = event || window.event,
args = slice.call(arguments, 1),
delta = 0,
deltaX = 0,
deltaY = 0,
absDelta = 0,
offsetX = 0,
offsetY = 0;
event = $.event.fix(orgEvent);
event.type = 'mousewheel';
// Old school scrollwheel delta
if ('detail' in orgEvent) { deltaY = orgEvent.detail * -1; }
if ('wheelDelta' in orgEvent) { deltaY = orgEvent.wheelDelta; }
if ('wheelDeltaY' in orgEvent) { deltaY = orgEvent.wheelDeltaY; }
if ('wheelDeltaX' in orgEvent) { deltaX = orgEvent.wheelDeltaX * -1; }
// Firefox < 17 horizontal scrolling related to DOMMouseScroll event
if ('axis' in orgEvent && orgEvent.axis === orgEvent.HORIZONTAL_AXIS) {
deltaX = deltaY * -1;
deltaY = 0;
}
// Set delta to be deltaY or deltaX if deltaY is 0 for backwards compatabilitiy
delta = deltaY === 0 ? deltaX : deltaY;
// New school wheel delta (wheel event)
if ('deltaY' in orgEvent) {
deltaY = orgEvent.deltaY * -1;
delta = deltaY;
}
if ('deltaX' in orgEvent) {
deltaX = orgEvent.deltaX;
if (deltaY === 0) { delta = deltaX * -1; }
}
// No change actually happened, no reason to go any further
if (deltaY === 0 && deltaX === 0) { return; }
// Need to convert lines and pages to pixels if we aren't already in pixels
// There are three delta modes:
// * deltaMode 0 is by pixels, nothing to do
// * deltaMode 1 is by lines
// * deltaMode 2 is by pages
if (orgEvent.deltaMode === 1) {
var lineHeight = $.data(this, 'mousewheel-line-height');
delta *= lineHeight;
deltaY *= lineHeight;
deltaX *= lineHeight;
} else if (orgEvent.deltaMode === 2) {
var pageHeight = $.data(this, 'mousewheel-page-height');
delta *= pageHeight;
deltaY *= pageHeight;
deltaX *= pageHeight;
}
// Store lowest absolute delta to normalize the delta values
absDelta = Math.max(Math.abs(deltaY), Math.abs(deltaX));
if (!lowestDelta || absDelta < lowestDelta) {
lowestDelta = absDelta;
// Adjust older deltas if necessary
if (shouldAdjustOldDeltas(orgEvent, absDelta)) {
lowestDelta /= 40;
}
}
// Adjust older deltas if necessary
if (shouldAdjustOldDeltas(orgEvent, absDelta)) {
// Divide all the things by 40!
delta /= 40;
deltaX /= 40;
deltaY /= 40;
}
// Get a whole, normalized value for the deltas
delta = Math[delta >= 1 ? 'floor' : 'ceil'](delta / lowestDelta);
deltaX = Math[deltaX >= 1 ? 'floor' : 'ceil'](deltaX / lowestDelta);
deltaY = Math[deltaY >= 1 ? 'floor' : 'ceil'](deltaY / lowestDelta);
// Normalise offsetX and offsetY properties
if (special.settings.normalizeOffset && this.getBoundingClientRect) {
var boundingRect = this.getBoundingClientRect();
offsetX = event.clientX - boundingRect.left;
offsetY = event.clientY - boundingRect.top;
}
// Add information to the event object
event.deltaX = deltaX;
event.deltaY = deltaY;
event.deltaFactor = lowestDelta;
event.offsetX = offsetX;
event.offsetY = offsetY;
// Go ahead and set deltaMode to 0 since we converted to pixels
// Although this is a little odd since we overwrite the deltaX/Y
// properties with normalized deltas.
event.deltaMode = 0;
// Add event and delta to the front of the arguments
args.unshift(event, delta, deltaX, deltaY);
// Clearout lowestDelta after sometime to better
// handle multiple device types that give different
// a different lowestDelta
// Ex: trackpad = 3 and mouse wheel = 120
if (nullLowestDeltaTimeout) { clearTimeout(nullLowestDeltaTimeout); }
nullLowestDeltaTimeout = setTimeout(nullLowestDelta, 200);
return ($.event.dispatch || $.event.handle).apply(this, args);
}
function nullLowestDelta() {
lowestDelta = null;
}
function shouldAdjustOldDeltas(orgEvent, absDelta) {
// If this is an older event and the delta is divisable by 120,
// then we are assuming that the browser is treating this as an
// older mouse wheel event and that we should divide the deltas
// by 40 to try and get a more usable deltaFactor.
// Side note, this actually impacts the reported scroll distance
// in older browsers and can cause scrolling to be slower than native.
// Turn this off by setting $.event.special.mousewheel.settings.adjustOldDeltas to false.
return special.settings.adjustOldDeltas && orgEvent.type === 'mousewheel' && absDelta % 120 === 0;
}
}));;
/**
* jquery.mask.js
* @version: v1.13.4
* @author: Igor Escobar
*
* Created by Igor Escobar on 2012-03-10. Please report any bug at http://blog.igorescobar.com
*
* Copyright (c) 2012 Igor Escobar http://blog.igorescobar.com
*
* The MIT License (http://www.opensource.org/licenses/mit-license.php)
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following
* conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/
/* jshint laxbreak: true */
/* global define, jQuery, Zepto */
'use strict';
// UMD (Universal Module Definition) patterns for JavaScript modules that work everywhere.
// https://github.com/umdjs/umd/blob/master/jqueryPluginCommonjs.js
(function (factory) {
if (typeof define === 'function' && define.amd) {
define(['jquery'], factory);
} else if (typeof exports === 'object') {
module.exports = factory(require('jquery'));
} else {
factory(jQuery || Zepto);
}
}(function ($) {
var Mask = function (el, mask, options) {
el = $(el);
var jMask = this, oldValue = el.val(), regexMask;
mask = typeof mask === 'function' ? mask(el.val(), undefined, el, options) : mask;
var p = {
invalid: [],
getCaret: function () {
try {
var sel,
pos = 0,
ctrl = el.get(0),
dSel = document.selection,
cSelStart = ctrl.selectionStart;
// IE Support
if (dSel && navigator.appVersion.indexOf('MSIE 10') === -1) {
sel = dSel.createRange();
sel.moveStart('character', el.is('input') ? -el.val().length : -el.text().length);
pos = sel.text.length;
}
// Firefox support
else if (cSelStart || cSelStart === '0') {
pos = cSelStart;
}
return pos;
} catch (e) {}
},
setCaret: function(pos) {
try {
if (el.is(':focus')) {
var range, ctrl = el.get(0);
if (ctrl.setSelectionRange) {
ctrl.setSelectionRange(pos,pos);
} else if (ctrl.createTextRange) {
range = ctrl.createTextRange();
range.collapse(true);
range.moveEnd('character', pos);
range.moveStart('character', pos);
range.select();
}
}
} catch (e) {}
},
events: function() {
el
.on('input.mask keyup.mask', p.behaviour)
.on('paste.mask drop.mask', function() {
setTimeout(function() {
el.keydown().keyup();
}, 100);
})
.on('change.mask', function(){
el.data('changed', true);
})
.on('blur.mask', function(){
if (oldValue !== el.val() && !el.data('changed')) {
el.triggerHandler('change');
}
el.data('changed', false);
})
// it's very important that this callback remains in this position
// otherwhise oldValue it's going to work buggy
.on('blur.mask', function() {
oldValue = el.val();
})
// select all text on focus
.on('focus.mask', function (e) {
if (options.selectOnFocus === true) {
$(e.target).select();
}
})
// clear the value if it not complete the mask
.on('focusout.mask', function() {
if (options.clearIfNotMatch && !regexMask.test(p.val())) {
p.val('');
}
});
},
getRegexMask: function() {
var maskChunks = [], translation, pattern, optional, recursive, oRecursive, r;
for (var i = 0; i < mask.length; i++) {
translation = jMask.translation[mask.charAt(i)];
if (translation) {
pattern = translation.pattern.toString().replace(/.{1}$|^.{1}/g, '');
optional = translation.optional;
recursive = translation.recursive;
if (recursive) {
maskChunks.push(mask.charAt(i));
oRecursive = {digit: mask.charAt(i), pattern: pattern};
} else {
maskChunks.push(!optional && !recursive ? pattern : (pattern + '?'));
}
} else {
maskChunks.push(mask.charAt(i).replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&'));
}
}
r = maskChunks.join('');
if (oRecursive) {
r = r.replace(new RegExp('(' + oRecursive.digit + '(.*' + oRecursive.digit + ')?)'), '($1)?')
.replace(new RegExp(oRecursive.digit, 'g'), oRecursive.pattern);
}
return new RegExp(r);
},
destroyEvents: function() {
el.off(['input', 'keydown', 'keyup', 'paste', 'drop', 'blur', 'focusout', ''].join('.mask '));
},
val: function(v) {
var isInput = el.is('input'),
method = isInput ? 'val' : 'text',
r;
if (arguments.length > 0) {
if (el[method]() !== v) {
el[method](v);
}
r = el;
} else {
r = el[method]();
}
return r;
},
getMCharsBeforeCount: function(index, onCleanVal) {
for (var count = 0, i = 0, maskL = mask.length; i < maskL && i < index; i++) {
if (!jMask.translation[mask.charAt(i)]) {
index = onCleanVal ? index + 1 : index;
count++;
}
}
return count;
},
caretPos: function (originalCaretPos, oldLength, newLength, maskDif) {
var translation = jMask.translation[mask.charAt(Math.min(originalCaretPos - 1, mask.length - 1))];
return !translation ? p.caretPos(originalCaretPos + 1, oldLength, newLength, maskDif)
: Math.min(originalCaretPos + newLength - oldLength - maskDif, newLength);
},
behaviour: function(e) {
e = e || window.event;
p.invalid = [];
var keyCode = e.keyCode || e.which;
if ($.inArray(keyCode, jMask.byPassKeys) === -1) {
var caretPos = p.getCaret(),
currVal = p.val(),
currValL = currVal.length,
changeCaret = caretPos < currValL,
newVal = p.getMasked(),
newValL = newVal.length,
maskDif = p.getMCharsBeforeCount(newValL - 1) - p.getMCharsBeforeCount(currValL - 1);
p.val(newVal);
// change caret but avoid CTRL+A
if (changeCaret && !(keyCode === 65 && e.ctrlKey)) {
// Avoid adjusting caret on backspace or delete
if (!(keyCode === 8 || keyCode === 46)) {
caretPos = p.caretPos(caretPos, currValL, newValL, maskDif);
}
p.setCaret(caretPos);
}
return p.callbacks(e);
}
},
getMasked: function(skipMaskChars) {
var buf = [],
value = p.val(),
m = 0, maskLen = mask.length,
v = 0, valLen = value.length,
offset = 1, addMethod = 'push',
resetPos = -1,
lastMaskChar,
check;
if (options.reverse) {
addMethod = 'unshift';
offset = -1;
lastMaskChar = 0;
m = maskLen - 1;
v = valLen - 1;
check = function () {
return m > -1 && v > -1;
};
} else {
lastMaskChar = maskLen - 1;
check = function () {
return m < maskLen && v < valLen;
};
}
while (check()) {
var maskDigit = mask.charAt(m),
valDigit = value.charAt(v),
translation = jMask.translation[maskDigit];
if (translation) {
if (valDigit.match(translation.pattern)) {
buf[addMethod](valDigit);
if (translation.recursive) {
if (resetPos === -1) {
resetPos = m;
} else if (m === lastMaskChar) {
m = resetPos - offset;
}
if (lastMaskChar === resetPos) {
m -= offset;
}
}
m += offset;
} else if (translation.optional) {
m += offset;
v -= offset;
} else if (translation.fallback) {
buf[addMethod](translation.fallback);
m += offset;
v -= offset;
} else {
p.invalid.push({p: v, v: valDigit, e: translation.pattern});
}
v += offset;
} else {
if (!skipMaskChars) {
buf[addMethod](maskDigit);
}
if (valDigit === maskDigit) {
v += offset;
}
m += offset;
}
}
var lastMaskCharDigit = mask.charAt(lastMaskChar);
if (maskLen === valLen + 1 && !jMask.translation[lastMaskCharDigit]) {
buf.push(lastMaskCharDigit);
}
return buf.join('');
},
callbacks: function (e) {
var val = p.val(),
changed = val !== oldValue,
defaultArgs = [val, e, el, options],
callback = function(name, criteria, args) {
if (typeof options[name] === 'function' && criteria) {
options[name].apply(this, args);
}
};
callback('onChange', changed === true, defaultArgs);
callback('onKeyPress', changed === true, defaultArgs);
callback('onComplete', val.length === mask.length, defaultArgs);
callback('onInvalid', p.invalid.length > 0, [val, e, el, p.invalid, options]);
}
};
// public methods
jMask.mask = mask;
jMask.options = options;
jMask.remove = function() {
var caret = p.getCaret();
p.destroyEvents();
p.val(jMask.getCleanVal());
p.setCaret(caret - p.getMCharsBeforeCount(caret));
return el;
};
// get value without mask
jMask.getCleanVal = function() {
return p.getMasked(true);
};
jMask.init = function(onlyMask) {
onlyMask = onlyMask || false;
options = options || {};
jMask.byPassKeys = $.jMaskGlobals.byPassKeys;
jMask.translation = $.jMaskGlobals.translation;
jMask.translation = $.extend({}, jMask.translation, options.translation);
jMask = $.extend(true, {}, jMask, options);
regexMask = p.getRegexMask();
if (onlyMask === false) {
if (options.placeholder) {
el.attr('placeholder' , options.placeholder);
}
// this is necessary, otherwise if the user submit the form
// and then press the "back" button, the autocomplete will erase
// the data. Works fine on IE9+, FF, Opera, Safari.
if ($('input').length && 'oninput' in $('input')[0] === false && el.attr('autocomplete') === 'on') {
el.attr('autocomplete', 'off');
}
p.destroyEvents();
p.events();
var caret = p.getCaret();
p.val(p.getMasked());
p.setCaret(caret + p.getMCharsBeforeCount(caret, true));
} else {
p.events();
p.val(p.getMasked());
}
};
jMask.init(!el.is('input'));
};
$.maskWatchers = {};
var HTMLAttributes = function () {
var input = $(this),
options = {},
prefix = 'data-mask-',
mask = input.attr('data-mask');
if (input.attr(prefix + 'reverse')) {
options.reverse = true;
}
if (input.attr(prefix + 'clearifnotmatch')) {
options.clearIfNotMatch = true;
}
if (input.attr(prefix + 'selectonfocus') === 'true') {
options.selectOnFocus = true;
}
if (notSameMaskObject(input, mask, options)) {
return input.data('mask', new Mask(this, mask, options));
}
},
notSameMaskObject = function(field, mask, options) {
options = options || {};
var maskObject = $(field).data('mask'),
stringify = JSON.stringify,
value = $(field).val() || $(field).text();
try {
if (typeof mask === 'function') {
mask = mask(value);
}
return typeof maskObject !== 'object' || stringify(maskObject.options) !== stringify(options) || maskObject.mask !== mask;
} catch (e) {}
};
$.fn.mask = function(mask, options) {
options = options || {};
var selector = this.selector,
globals = $.jMaskGlobals,
interval = $.jMaskGlobals.watchInterval,
maskFunction = function() {
if (notSameMaskObject(this, mask, options)) {
return $(this).data('mask', new Mask(this, mask, options));
}
};
$(this).each(maskFunction);
if (selector && selector !== '' && globals.watchInputs) {
clearInterval($.maskWatchers[selector]);
$.maskWatchers[selector] = setInterval(function(){
$(document).find(selector).each(maskFunction);
}, interval);
}
return this;
};
$.fn.unmask = function() {
clearInterval($.maskWatchers[this.selector]);
delete $.maskWatchers[this.selector];
return this.each(function() {
var dataMask = $(this).data('mask');
if (dataMask) {
dataMask.remove().removeData('mask');
}
});
};
$.fn.cleanVal = function() {
return this.data('mask').getCleanVal();
};
$.applyDataMask = function(selector) {
selector = selector || $.jMaskGlobals.maskElements;
var $selector = (selector instanceof $) ? selector : $(selector);
$selector.filter($.jMaskGlobals.dataMaskAttr).each(HTMLAttributes);
};
var globals = {
maskElements: 'input,td,span,div',
dataMaskAttr: '*[data-mask]',
dataMask: true,
watchInterval: 300,
watchInputs: true,
watchDataMask: false,
byPassKeys: [9, 16, 17, 18, 36, 37, 38, 39, 40, 91],
translation: {
'0': {pattern: /\d/},
'9': {pattern: /\d/, optional: true},
'#': {pattern: /\d/, recursive: true},
'A': {pattern: /[a-zA-Z0-9]/},
'S': {pattern: /[a-zA-Z]/}
}
};
$.jMaskGlobals = $.jMaskGlobals || {};
globals = $.jMaskGlobals = $.extend(true, {}, globals, $.jMaskGlobals);
// looking for inputs with data-mask attribute
if (globals.dataMask) { $.applyDataMask(); }
setInterval(function(){
if ($.jMaskGlobals.watchDataMask) { $.applyDataMask(); }
}, globals.watchInterval);
}));
;
/**
* HideSeek jQuery plugin
*
* @copyright Copyright 2013, Dimitris Krestos
* @license Apache License, Version 2.0 (http://www.opensource.org/licenses/apache2.0.php)
* @link http://vdw.staytuned.gr
* @version v0.5.4
*
* Dependencies are include in minified versions at the bottom:
* 1. Highlight v4 by Johann Burkard
*
*/
/* Sample html structure
or
item 1
...
item 2
or any similar structure...
*/
;(function($, window, undefined) {
"use strict";
$.fn.hideseek = function(options) {
var defaults = {
list: '.hideseek-data',
nodata: '',
attribute: 'text',
highlight: false,
ignore: '',
navigation: false
};
var options = $.extend(defaults, options);
return this.each(function() {
var $this = $(this);
// Ungly overwrite
options.list = $this.data('list') || options.list;
options.nodata = $this.data('nodata') || options.nodata;
options.attribute = $this.data('attribute') || options.attribute;
options.highlight = $this.data('highlight') || options.highlight;
options.ignore = $this.data('ignore') || options.ignore;
var $list = $(options.list);
if (options.navigation) $this.attr('autocomplete', 'off');
$this.keyup(function(e) {
if (e.keyCode != 38 && e.keyCode != 40 && e.keyCode != 13) {
var q = $this.val().toLowerCase();
$list.children(":not(" + options.ignore + ")").removeClass('selected').each(function() {
var data = (options.attribute != 'text') ? $(this).attr(options.attribute).toLowerCase() : $(this).text().toLowerCase();
if (data.indexOf(q) == -1) {
$(this).hide();
$this.trigger('_after_each');
} else {
options.highlight ? $(this).removeHighlight().highlight(q).show() : $(this).show();
$this.trigger('_after_each');
}
});
// No results message
if (options.nodata) {
$list.find('.no-results').remove();
if (!$list.children(':not([style*="display: none"])').length) {
$list
.children()
.first()
.clone()
.removeHighlight()
.addClass('no-results')
.show()
.prependTo(options.list)
.text(options.nodata);
}
}
$this.trigger('_after');
};
// Navigation
function current(element) {
return element.children('.selected:visible');
};
function prev(element) {
return current(element).prevAll(":visible:first");
};
function next(element) {
return current(element).nextAll(":visible:first");
};
if (options.navigation) {
if (e.keyCode == 38) {
if (current($list).length) {
prev($list).addClass('selected');
current($list).last().removeClass('selected');
} else {
$list.children(':visible').last().addClass('selected');
};
} else if (e.keyCode == 40) {
if (current($list).length) {
next($list).addClass('selected');
current($list).first().removeClass('selected');
} else {
$list.children(':visible').first().addClass('selected');
};
} else if (e.keyCode == 13) {
if (current($list).find('a').length) {
document.location = current($list).find('a').attr('href');
} else {
$this.val(current($list).text());
};
};
};
});
});
};
$(document).ready(function () { $('[data-toggle="hideseek"]').hideseek(); });
})(jQuery);
/*
highlight v4
Highlights arbitrary terms.
MIT license.
Johann Burkard
*/
jQuery.fn.highlight=function(t){function e(t,i){var n=0;if(3==t.nodeType){var a=t.data.toUpperCase().indexOf(i);if(a>=0){var s=document.createElement("mark");s.className="highlight";var r=t.splitText(a);r.splitText(i.length);var o=r.cloneNode(!0);s.appendChild(o),r.parentNode.replaceChild(s,r),n=1}}else if(1==t.nodeType&&t.childNodes&&!/(script|style)/i.test(t.tagName))for(var h=0;h tr:not(.child)", function (e, data) {
var $row = $(this);
var $table = $row.closest("table");
if (!data || !data.fromChild) {
var $cell = $(e.target).closest("td");
if ($cell.hasClass("dataTables_empty")) {
return;
}
if ($table.hasClass("collapsed")) {
if ($cell.is(":first-child")) {
return;
}
}
if ($cell.hasClass("actions")) {
return;
}
}
var actionFull = $table.data("action-full");
var actionTarget = $table.data("action-target");
var isJsFunctionName = $table.data("action-isclientside");
if (isJsFunctionName) {
function index(x, i) { return x[i]; }
actionFull.split('.').reduce(index, window)(e);
} else {
var newLocation;
if (actionFull) {
newLocation = actionFull +
"/?" +
($table.data("idparam") || "id") +
"=" +
$row.data("id");
} else {
newLocation = baseUrl +
"/" +
($table.data("action") || "") +
"?" +
($table.data("idparam") || "id") +
"=" +
$row.data("id");
}
if (actionTarget == "_self") {
window.location.href = newLocation;
} else {
window.open(newLocation, actionTarget);
}
}
});
});
},
configureUserStatusArea: function () {
var $el = this;
var $btn = $el.find(".name.button");
var $menu = $el.find(".actions");
$btn.click(function (e) {
var isOpen = !!webservices.isUserStatusAreaOpen;
toggleMenu(!isOpen);
});
function closeMenu() {
toggleMenu(false);
}
function openMenu() {
toggleMenu(true);
}
function toggleMenu(open) {
if (!open) {
$menu.height('0px');
_.defer(function () { $el.blur(); });
} else {
$menu.height('auto');
}
webservices.isUserStatusAreaOpen = open;
}
},
peopleSearch: function (opts) {
this.each(function (i, el) {
var $this = $(el);
var defaultOptions = {
personType: {
defaultValue: "Any",
hide: false
},
alternateEndpoint: null,
version: 2,
resetAfterUse: false
};
var options = _.extend(defaultOptions, opts);
options.elements = {
identityInput: $this
};
if (typeof options.searchButton == "function") {
options.elements.searchButton = options.searchButton.call(options);
} else {
options.elements.searchButton = options.searchButton || $this.closest(".ui3.textfield").parent().find(".ui3.button")
}
var $identityInput = options.elements.identityInput;
var $searchButton = options.elements.searchButton;
var _isSearching = false;
if (!$identityInput || !$identityInput.length) {
throw new Error("PeopleSearch: No $identityInput specified.");
}
if (!$searchButton || !$searchButton.length) {
throw new Error("PeopleSearch: No $searchButton specified and one could not be found automatically.");
}
var template = Handlebars.compile($("#tmpl-global-people-search-dialog-root").html());
var resultItemTemplate = Handlebars.compile($("#tmpl-global-people-search-result-item").html());
var $modal = $(template());
function showSearchModal() {
// get a reference to the directory search container
var $elRoot = $(".webservices-peoplesearch-root", $modal);
$(".webservices-peoplesearch-input-container", $elRoot).hide();
$("#webservices-peoplesearch-input-container-v" + options.version, $elRoot).css({ display: "" });
// configure the search endpoint. Check to see if an alternate endpoint was passed into the options, otherwise use default
var endpoint = options.alternateEndpoint !== null ? options.alternateEndpoint : $elRoot.data("endpoint-v" + options.version);
// get a reference to the dialog search button
var $btnDoSearch = $(".search-button", $elRoot);
// get all of the inputs
var $inputLastName = $(".last-name :text", $elRoot);
var $inputFirstName = $(".first-name :text", $elRoot);
var $inputIdNumber = $(".id-number :text", $elRoot);
var $inputOmnibox = $(".omnibox :text", $elRoot);
var $elResultsContainer = $(".webservices-peoplesearch-results-container", $elRoot);
// get search results destination
var $elResultsList = $(".webservices-peoplesearch-results-list", $elResultsContainer);
$elResultsList.on("click", ".webservices-peoplesearch-result-item", function (e) {
e.preventDefault();
var identity = $(this).data("value");
$identityInput.val(identity).trigger("change");
ui.Dialog.currentDialog.cancel();
if (options.onSelect) {
options.onSelect(identity);
}
});
$(":radio[name=webservices-peoplesearch-option-persontype]", $elRoot).change(doSearch);
// hide person type options
if (options.personType.hide) {
$(".webservices-peoplesearch-options", $elRoot).hide();
}
var personType = null;
if (options.resetAfterUse) {
$inputLastName.val("");
$inputFirstName.val("");
$inputIdNumber.val("");
$inputOmnibox.val("");
$btnDoSearch.addClass("disabled");
$elResultsList.empty();
$elResultsContainer.hide();
personType = options.personType.defaultValue;
} else {
personType = $(":radio[name=webservices-peoplesearch-option-persontype]:checked", $elRoot).val() || options.personType.defaultValue;
}
$(":radio[name=webservices-peoplesearch-option-persontype][value=" + personType + "]", $elRoot).prop("checked", true);
function doSearch() {
var optionPersonType = $(":radio[name='webservices-peoplesearch-option-persontype']:checked", $elRoot).val();
if (_isSearching) return;
if (!isSearchInputValid()) return;
_isSearching = true;
$btnDoSearch.addClass("disabled");
$elResultsContainer.hide();
ui.Dialog.currentDialog.isLoading(true);
var params = null;
if (options.version == 1) {
params = {
firstName: $inputFirstName.val(),
lastName: $inputLastName.val(),
idNumber: $inputIdNumber.val(),
personType: optionPersonType
};
} else if (options.version == 2) {
params = {
input: $inputOmnibox.val(),
personType: optionPersonType
};
}
$.getJSON(endpoint, params, function (data) {
$elResultsList.empty();
$.each(data.Results, function (i, r) {
var result = resultItemTemplate(r);
$elResultsList.append(result);
});
// no results
if (data.Results.length === 0) {
$elResultsContainer.find("h3").hide();
$elResultsList.append(' No Results
');
} else {
$elResultsContainer.find("h3").show().text("" + data.Results.length + " Result" + (data.Results.length == 1 ? "" : "s"));
}
$elResultsContainer.show();
}).always(function () {
$btnDoSearch.removeClass("disabled");
_isSearching = false;
ui.Dialog.currentDialog.isLoading(false);
focusInput();
});
}
$btnDoSearch.click(function (e) {
e.preventDefault();
doSearch();
});
// wire Enter key to search function
$.each([$inputFirstName, $inputLastName, $inputIdNumber, $inputOmnibox], function (i, el) {
el.keyup(function (e) {
e.preventDefault();
var code = (e.keyCode ? e.keyCode : e.which);
if (code == 13)
doSearch();
else
$btnDoSearch.toggleClass("disabled", !isSearchInputValid());
});
});
function isSearchInputValid() {
if (options.version == 1) {
return $inputFirstName.val().trim().length + $inputLastName.val().trim().length + $inputIdNumber.val().trim().length !== 0;
} else if (options.version == 2) {
return $inputOmnibox.val().trim().length !== 0;
}
}
ui.Dialog.push({
title: "People Search",
content: $modal
});
// Populate the search box with the identity input value, and if not empty, perform search
if (options.version == 2) {
$inputOmnibox.val($identityInput.val());
if ($inputOmnibox.val()) {
doSearch();
}
}
_.delay(function () {
focusInput();
}, 400);
function focusInput() {
if (options.version == 1) {
$inputLastName.focus().select();
} else if (options.version == 2) {
$inputOmnibox.focus().select();
}
}
}
$searchButton.each(function (i, searchButtonElement) {
var $searchButtonInst = $(searchButtonElement);
$searchButtonInst.click(function (e) {
e.preventDefault();
showSearchModal();
});
});
});
},
collapsible: function (options) {
var settings = $.extend({
initiallyCollapsed: true,
headerSelector: ".header",
collapsibleContentSelector: ".content"
}, options);
return this.each(function () {
var $el = $(this);
var $header = $el.children(settings.headerSelector).eq(0);
var $collapsibleContent = $el.children(settings.collapsibleContentSelector).eq(0);
$header.addClass("collapsible-header");
$collapsibleContent.addClass("collapsible-content");
$el.toggleClass("collapsed", settings.initiallyCollapsed);
var $handleCollapse = $("").addClass("fa fa-minus-square-o collapsible-handle-collapse");
var $handleExpand = $("").addClass("fa fa-plus-square-o collapsible-handle-expand");
$header.prepend($("").addClass("collapsible-handle").append($handleCollapse).append($handleExpand));
$header.click(function () {
$el.toggleClass("collapsed");
});
});
}
});
})(jQuery);
/*
* Utilities
*/
jQuery.precision = function (x, eps) {
var dec = Math.pow(10, Math.floor(Math.log(1 / eps) * Math.LOG10E));
return Math.round(dec * x) / dec;
};
/*
* Modals/Dialogs
*/
webservices.goBack = function () {
history.go(-1);
}
webservices.delete = async function (options) {
await webservices.confirm({
text: options.confirmationMessage,
confirmButtonStyle: "red",
confirm: function () {
return $.post(options.url, options.parameters, function (result) {
if (result === true) {
if (!options.alternateReload) {
location.reload();
}
else {
window.location = options.alternateReload;
}
}
else {
webservices.alert({
text: options.errorMessage,
acknowledge: function () {
location.reload()
}
});
}
});
}
});
};
webservices.error = async function (options) {
await webservices.alert({
text: options.message,
acknowledge: function () {
location.reload();
}
});
};
webservices.confirm = async function (options) {
await webservices.clearDialogs();
var settings = $.extend({
cancelButtonStyle: "grey",
confirmButtonStyle: null,
acknowledgeButtonStyle: null,
confirmButtonText: "Delete",
cancelButtonText: "Cancel",
acknowledgeButtonText: "OK",
failedCheck: false,
title: "Confirm Action"
}, options);
var template = Handlebars.compile($("#tmpl-global-confirm-modal").html());
var $modal = $(template(settings));
var btnAcknowledgeCheck = $modal.find(".acknowledge-check");
btnAcknowledgeCheck.text(settings.acknowledgeButtonText).addClass(settings.acknowledgeButtonStyle);
var btnConfirm = $modal.find(".confirm");
btnConfirm.text(settings.confirmButtonText).addClass(settings.confirmButtonStyle);
var btnCancel = $modal.find(".cancel");
btnCancel.text(settings.cancelButtonText).addClass(settings.cancelButtonStyle);
var clickedElement;
if (options.preCheck) {
if (!options.preCheck(clickedElement)) {
settings.failedCheck = true;
$modal = $(template(settings));
ui.Dialog.push({
title: settings.title,
content: $modal
});
btnAcknowledgeCheck = $modal.find(".acknowledge-check");
btnAcknowledgeCheck.bind("click", async function () {
await webservices.clearDialogs();
});
return;
}
}
ui.Dialog.push({
title: settings.title,
content: $modal,
onClose: function() {
if (options.onClose) {
options.onClose();
}
}
});
btnConfirm.bind("click", async function () {
if (options.confirm) {
ui.Dialog.currentDialog.isLoading(true);
await Promise.resolve(options.confirm(clickedElement));
ui.Dialog.currentDialog.isLoading(false);
}
await webservices.clearDialogs();
});
btnCancel.bind("click", async function () {
if (options.cancel) {
ui.Dialog.currentDialog.isLoading(true);
await Promise.resolve(options.cancel());
ui.Dialog.currentDialog.isLoading(false);
}
await webservices.clearDialogs();
});
};
webservices.loading = async function () {
await webservices.clearDialogs();
const template = Handlebars.compile(document.getElementById("tmpl-global-loading-modal").innerHTML);
ui.Dialog.push({
title: "Loading",
content: template()
});
};
webservices.alert = async function (options) {
await webservices.clearDialogs();
var settings = $.extend({
acknowledgeButtonStyle: null,
acknowledgeButtonText: "OK",
allowCancel: false,
showClose: false,
title: "Alert"
}, options);
var template = Handlebars.compile($("#tmpl-global-alert-modal").html());
var $modal = $(template(settings));
var btnAcknowledge = $modal.find(".acknowledge");
btnAcknowledge.text(settings.acknowledgeButtonText).addClass(settings.acknowledgeButtonStyle);
ui.Dialog.push({
title: settings.title,
content: $modal,
allowClose: settings.allowCancel,
showClose: settings.showClose
});
btnAcknowledge.bind("click", async function () {
if (options.acknowledge) {
ui.Dialog.currentDialog.isLoading(true);
await Promise.resolve(options.acknowledge());
ui.Dialog.currentDialog.isLoading(false);
}
await webservices.clearDialogs();
});
};
webservices.clearDialogs = async function () {
while ($(".ui.ui-dialog.active:not(.hidden)").length > 0) {
try {
ui.Dialog.hide();
} catch { }
await Promise.resolve(resolve => setTimeout(resolve, 50));
}
}
$.fn.tabs = function (options) {
var settings = $.extend({
tabs: null
}, options);
var container = $(this);
if (!container.hasClass("tab-container"))
container.addClass("tab-container");
// Tabs were passed dynamically
if (settings.tabs !== null) {
tabTitleContainer = $("");
var hasSpecifiedActive = _.filter(settings.tabs, function (tab) { return tab.active !== undefined }).length > 0;
$.each(settings.tabs, function (index, value) {
var active = "";
if ((hasSpecifiedActive && value.active === true) || (!hasSpecifiedActive && index === 0)) {
active = "active";
}
tabTitleContainer.append('' + value.title + ' ');
container.append('' + value.content + '
')
});
container.prepend(tabTitleContainer);
}
$(container).on("click", "ul li a", function () {
var clickedTab = $(this).data("id");
$("ul li a", container).removeClass("active");
$(".tab-content", container).removeClass("active");
$('ul li [data-id="' + clickedTab + '"]', container).addClass("active");
$('.tab-content[data-id="' + clickedTab + '"]', container).addClass("active");
$(container).trigger("tabChange", [clickedTab]);
});
}
/*
* Autosave plugin
* Usage
* $(el).autoSaveInput(options);
* Options
* {
* savedConfirmationText: The message that gets displayed below the text box on successful save,
* textParameterName: the name of the api parameter that contains the text to be saved. Defaults to "text"
* }
* Data Attributes
* data-api: required, the path to the autosave method
* data-*: optional, but will be added to the textParameterName option from above as addition parameters in the POST to the api
*/
$.fn.autoSaveInput = function (options) {
var settings = $.extend({
savedConfirmationText: "Saved",
textParameterName: "text"
}, options);
var timeoutId;
var el = this;
$(el).addClass("auto-save");
var apiPath = $(el).data("api");
var parameters = {};
$.each($(el).data(), function (key, value) {
if (key != "api") {
parameters[key] = value;
}
});
$(el).append('' + settings.savedConfirmationText + ' ');
$("textarea", this).on("keyup", function () {
clearTimeout(timeoutId);
timeoutId = setTimeout(function () {
saveData();
}, 1000);
});
function saveData() {
parameters[settings.textParameterName] = $("textarea", el).val();
$.post(apiPath, parameters, function (data) {
if (data) {
$(".save-indicator", el).show().delay(1000).fadeOut(1000);
} else {
alertModal({
text: "Sorry, the text could not be automatically saved."
})
}
});
}
}
/*
* Form auto-save functionality.
* Enabled when using the AutoSave(string) extension method when creating an MVC form.
*/
var FormSaver = (function () {
let _init = false;
let _options = {};
const formData = {};
const validInputs = ["text", "radio", "checkbox"];
const getLocalStorageKey = function (formName) {
return `umasslowell:monolith:formsaver:v1:${formName}`;
};
const updateValue = function (formName, attributeName, attributeValue) {
formData[formName][attributeName] = attributeValue;
localStorage.setItem(getLocalStorageKey(formName), JSON.stringify(formData[formName]));
};
const handleSubmit = function (e) {
const formName = getFormKey(e.currentTarget);
fetch("/sso/me")
.then(function (response) {
response.json().then(function (data) {
if (data.IsAuthenticated === true) {
localStorage.removeItem(getLocalStorageKey(formName));
}
else {
e.preventDefault();
location.reload();
}
});
});
};
const tryHandleInputEvent = function (event) {
const target = event.target;
const formName = getFormKey(target.closest("form"));
if (!formName) {
return;
}
const attributeName = target.getAttribute("name");
const attributeValue = target.value;
if (attributeName !== null) {
switch (target.tagName) {
case "INPUT":
if (validInputs.includes(target.type)) {
const type = target.getAttribute("type");
switch (type) {
case "checkbox":
updateValue(formName, attributeName, target.checked);
break;
default:
updateValue(formName, attributeName, attributeValue);
}
}
break;
case "TEXTAREA":
case "SELECT":
updateValue(formName, attributeName, attributeValue);
break;
}
}
};
const getFormKey = function (formEl) {
const keyInput = formEl.querySelector(`input[name='${_options.autoSaveInputName}']`);
return keyInput ? (keyInput.value || null) : null;
};
const validateOptions = function (options) {
if (!options) {
throw "FormSaver: Options not provided.";
}
if (!options.autoSaveInputName) {
throw "FormSaver: Option 'autoSaveInputName' required but not provided.";
}
return options;
};
const init = function (options) {
if (_init) {
throw "FormSaver: Invalid operation - already initialized.";
}
_init = true;
_options = validateOptions(options);
const forms = document.querySelectorAll("form");
let shouldCaptureEvents = false;
forms.forEach(function (el) {
const formName = getFormKey(el);
if (!formName) {
return;
}
shouldCaptureEvents = true;
const storedValue = localStorage.getItem(getLocalStorageKey(formName));
const json = storedValue !== null ? JSON.parse(storedValue) : {};
for (const [key, value] of Object.entries(json)) {
const input = el.querySelector(`[name='${key}']`);
if (input !== null) {
switch (input.tagName) {
case "INPUT":
const type = input.getAttribute("type");
switch (type) {
case "text":
input.value = value;
break;
case "radio":
const radio = el.querySelector(`[name='${key}'][value='${value}']`);
if (radio !== null) {
radio.checked = true;
}
break;
case "checkbox":
input.checked = value;
break;
}
break;
default:
input.value = value;
break;
}
}
}
formData[formName] = json;
el.addEventListener("submit", handleSubmit);
});
if (shouldCaptureEvents) {
document.addEventListener("change", tryHandleInputEvent, { passive: true });
}
};
return {
init: init
};
})();
/*
* Add a character/word counter that can be attached to an input
* See StyleGuide index for usage examples
* */
const Counter = () => {
let _input = null;
let _currentValue = null;
let _parent = null;
let _options = {};
const updateCounter = () => {
switch (_options.type) {
case "character":
length = _currentValue ? _currentValue.length : 0;
_parent.dataset.counterText = _options.limit
? `${length}/${_options.limit} characters`
: `${length} characters`;
break;
case "word":
length = _currentValue ? _currentValue.trim().split(/\s+/).length : 0;
_parent.dataset.counterText = _options.limit
? `${length}/${_options.limit} words`
: `${length} words`;
break;
}
if (length > _options.limit)
_parent.classList.add("character-count-over-limit");
else
_parent.classList.remove("character-count-over-limit");
};
const handleKeyup = () => {
_currentValue = _input.value;
updateCounter();
};
const init = (options) => {
_options = options;
_input = document.getElementById(options.elementId);
if (_input) {
_currentValue = _input.value;
_parent = _input.closest(".ui3.textfield");
_parent.classList.add("character-counter");
updateCounter();
_input.addEventListener("keyup", handleKeyup);
}
}
return {
init: init
};
};
const httpPost = async function (url, parameters) {
const response = await fetch(url, {
method: "POST",
headers: {
"Content-type": "application/json"
},
body: JSON.stringify(parameters)
});
if (!response.ok) {
throw new Error(response.status);
}
return await response.json();
};;
(function ($) {
//$.fn.dataTable.Responsive.breakpoints = [
// { name: 'desktop', width: Infinity },
// { name: 'tablet-l', width: 1240 },
// { name: 'tablet-p', width: 950 },
// { name: 'mobile-l', width: 640 },
// { name: 'mobile-p', width: 640 },
//];
$.extend($.fn, {
umlButton: function (options) {
this.on("click", options.click);
if (options.isSubmit && options.disableOnFormSubmit) {
this.closest("form").on("submit", function () {
this.toggleClass("disabled", true);
}.bind(this));
}
},
umlDropDownList: function (options) {
},
umlDataTableDefaults: {
sorting: true,
paging: false,
pagingType: "full_numbers",
info: false,
saveState: false,
orderMulti: true,
deferRender: false,
bAutoWidth: false,
responsive: {
details: {
renderer: function (api, rowIdx, columns) {
var isClickable = $(api.context[0].nTable).hasClass("data-clickable");
var data = $.map(columns, function (col, i) {
return col.hidden ?
'' +
'' + col.title + ' ' +
'' + col.data + ' ' +
' ' :
'';
}).join('');
var body = data ?
$('').append(data) :
false;
if (!isClickable) {
return body;
}
var clickableLink = $('').click(function() {
$(api.row(rowIdx).node()).trigger("click", { fromChild: true });
}).text("Select");
if (body) {
return $('').append(body).append($('
').addClass("child-footer").append(clickableLink));
}
return clickableLink;
}
}
},
dom: 'ftp'
},
umlTable: function (options) {
var dtOptions = _.extend(_.extend({}, $.fn.umlDataTableDefaults), options.tableConfiguration);
dtOptions.columns = options.columnConfiguration;
if (options.showPagingControlsBeforeTable) {
dtOptions.dom = 'fptp';
}
var dt = this.dataTable(dtOptions);
var dtId = "#" + dt.attr("id").replace("$", "\\$");
var wrapper = this.parent();
wrapper.find(".dataTables_filter").find("input[type=search]").attr("placeholder", "Search table...");
window.dataTables = window.dataTables || [];
var oTable = $(dtId).dataTable();
window.dataTables.push(oTable);
this.closest(".table-responsive").addClass("init");
var t;
dt.on("page.dt", function () {
clearTimeout(t);
t = setTimeout(function () {
dt.DataTable().responsive.recalc();
}, 250);
});
}
});
})(jQuery);
$(function () {
var updateDataTableSize = function () {
if (!window.dataTables || !window.dataTables.length) {
return;
}
_.each(window.dataTables, function (oTable) {
$(oTable).css({ width: $(oTable).parent().width() });
oTable.fnAdjustColumnSizing();
});
};
$(window).resize(function () {
clearTimeout(window.refreshDataTableSize);
window.refreshDataTableSize = setTimeout(function () { updateDataTableSize(); }, 250);
});
});;
/*
_ _ _ _
___| (_) ___| | __ (_)___
/ __| | |/ __| |/ / | / __|
\__ \ | | (__| < _ | \__ \
|___/_|_|\___|_|\_(_)/ |___/
|__/
Version: 1.5.5
Author: Ken Wheeler
Website: http://kenwheeler.github.io
Docs: http://kenwheeler.github.io/slick
Repo: http://github.com/kenwheeler/slick
Issues: http://github.com/kenwheeler/slick/issues
*/
/* global window, document, define, jQuery, setInterval, clearInterval */
(function(factory) {
'use strict';
if (typeof define === 'function' && define.amd) {
define(['jquery'], factory);
} else if (typeof exports !== 'undefined') {
module.exports = factory(require('jquery'));
} else {
factory(jQuery);
}
}(function($) {
'use strict';
var Slick = window.Slick || {};
Slick = (function() {
var instanceUid = 0;
function Slick(element, settings) {
var _ = this,
dataSettings, responsiveSettings, breakpoint;
_.defaults = {
accessibility: true,
adaptiveHeight: false,
appendArrows: $(element),
appendDots: $(element),
arrows: true,
asNavFor: null,
prevArrow: '
Previous ',
nextArrow: '
Next ',
autoplay: false,
autoplaySpeed: 3000,
centerMode: false,
centerPadding: '50px',
cssEase: 'ease',
customPaging: function(slider, i) {
return '
' + (i + 1) + ' ';
},
dots: false,
dotsClass: 'slick-dots',
draggable: true,
easing: 'linear',
edgeFriction: 0.35,
fade: false,
focusOnSelect: false,
infinite: true,
initialSlide: 0,
lazyLoad: 'ondemand',
mobileFirst: false,
pauseOnHover: true,
pauseOnDotsHover: false,
respondTo: 'window',
responsive: null,
rows: 1,
rtl: false,
slide: '',
slidesPerRow: 1,
slidesToShow: 1,
slidesToScroll: 1,
speed: 500,
swipe: true,
swipeToSlide: false,
touchMove: true,
touchThreshold: 5,
useCSS: true,
variableWidth: false,
vertical: false,
verticalSwiping: false,
waitForAnimate: true,
zIndex: 1000
};
_.initials = {
animating: false,
dragging: false,
autoPlayTimer: null,
currentDirection: 0,
currentLeft: null,
currentSlide: 0,
direction: 1,
$dots: null,
listWidth: null,
listHeight: null,
loadIndex: 0,
$nextArrow: null,
$prevArrow: null,
slideCount: null,
slideWidth: null,
$slideTrack: null,
$slides: null,
sliding: false,
slideOffset: 0,
swipeLeft: null,
$list: null,
touchObject: {},
transformsEnabled: false,
unslicked: false
};
$.extend(_, _.initials);
_.activeBreakpoint = null;
_.animType = null;
_.animProp = null;
_.breakpoints = [];
_.breakpointSettings = [];
_.cssTransitions = false;
_.hidden = 'hidden';
_.paused = false;
_.positionProp = null;
_.respondTo = null;
_.rowCount = 1;
_.shouldClick = true;
_.$slider = $(element);
_.$slidesCache = null;
_.transformType = null;
_.transitionType = null;
_.visibilityChange = 'visibilitychange';
_.windowWidth = 0;
_.windowTimer = null;
dataSettings = $(element).data('slick') || {};
_.options = $.extend({}, _.defaults, dataSettings, settings);
_.currentSlide = _.options.initialSlide;
_.originalSettings = _.options;
responsiveSettings = _.options.responsive || null;
if (responsiveSettings && responsiveSettings.length > -1) {
_.respondTo = _.options.respondTo || 'window';
for (breakpoint in responsiveSettings) {
if (responsiveSettings.hasOwnProperty(breakpoint)) {
_.breakpoints.push(responsiveSettings[
breakpoint].breakpoint);
_.breakpointSettings[responsiveSettings[
breakpoint].breakpoint] =
responsiveSettings[breakpoint].settings;
}
}
_.breakpoints.sort(function(a, b) {
if (_.options.mobileFirst === true) {
return a - b;
} else {
return b - a;
}
});
}
if (typeof document.mozHidden !== 'undefined') {
_.hidden = 'mozHidden';
_.visibilityChange = 'mozvisibilitychange';
} else if (typeof document.webkitHidden !== 'undefined') {
_.hidden = 'webkitHidden';
_.visibilityChange = 'webkitvisibilitychange';
}
_.autoPlay = $.proxy(_.autoPlay, _);
_.autoPlayClear = $.proxy(_.autoPlayClear, _);
_.changeSlide = $.proxy(_.changeSlide, _);
_.clickHandler = $.proxy(_.clickHandler, _);
_.selectHandler = $.proxy(_.selectHandler, _);
_.setPosition = $.proxy(_.setPosition, _);
_.swipeHandler = $.proxy(_.swipeHandler, _);
_.dragHandler = $.proxy(_.dragHandler, _);
_.keyHandler = $.proxy(_.keyHandler, _);
_.autoPlayIterator = $.proxy(_.autoPlayIterator, _);
_.instanceUid = instanceUid++;
// A simple way to check for HTML strings
// Strict HTML recognition (must start with <)
// Extracted from jQuery v1.11 source
_.htmlExpr = /^(?:\s*(<[\w\W]+>)[^>]*)$/;
_.init(true);
_.checkResponsive(true);
}
return Slick;
}());
Slick.prototype.addSlide = Slick.prototype.slickAdd = function(markup, index, addBefore) {
var _ = this;
if (typeof(index) === 'boolean') {
addBefore = index;
index = null;
} else if (index < 0 || (index >= _.slideCount)) {
return false;
}
_.unload();
if (typeof(index) === 'number') {
if (index === 0 && _.$slides.length === 0) {
$(markup).appendTo(_.$slideTrack);
} else if (addBefore) {
$(markup).insertBefore(_.$slides.eq(index));
} else {
$(markup).insertAfter(_.$slides.eq(index));
}
} else {
if (addBefore === true) {
$(markup).prependTo(_.$slideTrack);
} else {
$(markup).appendTo(_.$slideTrack);
}
}
_.$slides = _.$slideTrack.children(this.options.slide);
_.$slideTrack.children(this.options.slide).detach();
_.$slideTrack.append(_.$slides);
_.$slides.each(function(index, element) {
$(element).attr('data-slick-index', index);
});
_.$slidesCache = _.$slides;
_.reinit();
};
Slick.prototype.animateHeight = function() {
var _ = this;
if (_.options.slidesToShow === 1 && _.options.adaptiveHeight === true && _.options.vertical === false) {
var targetHeight = _.$slides.eq(_.currentSlide).outerHeight(true);
_.$list.animate({
height: targetHeight
}, _.options.speed);
}
};
Slick.prototype.animateSlide = function(targetLeft, callback) {
var animProps = {},
_ = this;
_.animateHeight();
if (_.options.rtl === true && _.options.vertical === false) {
targetLeft = -targetLeft;
}
if (_.transformsEnabled === false) {
if (_.options.vertical === false) {
_.$slideTrack.animate({
left: targetLeft
}, _.options.speed, _.options.easing, callback);
} else {
_.$slideTrack.animate({
top: targetLeft
}, _.options.speed, _.options.easing, callback);
}
} else {
if (_.cssTransitions === false) {
if (_.options.rtl === true) {
_.currentLeft = -(_.currentLeft);
}
$({
animStart: _.currentLeft
}).animate({
animStart: targetLeft
}, {
duration: _.options.speed,
easing: _.options.easing,
step: function(now) {
now = Math.ceil(now);
if (_.options.vertical === false) {
animProps[_.animType] = 'translate(' +
now + 'px, 0px)';
_.$slideTrack.css(animProps);
} else {
animProps[_.animType] = 'translate(0px,' +
now + 'px)';
_.$slideTrack.css(animProps);
}
},
complete: function() {
if (callback) {
callback.call();
}
}
});
} else {
_.applyTransition();
targetLeft = Math.ceil(targetLeft);
if (_.options.vertical === false) {
animProps[_.animType] = 'translate3d(' + targetLeft + 'px, 0px, 0px)';
} else {
animProps[_.animType] = 'translate3d(0px,' + targetLeft + 'px, 0px)';
}
_.$slideTrack.css(animProps);
if (callback) {
setTimeout(function() {
_.disableTransition();
callback.call();
}, _.options.speed);
}
}
}
};
Slick.prototype.asNavFor = function(index) {
var _ = this,
asNavFor = _.options.asNavFor;
if ( asNavFor && asNavFor !== null ) {
asNavFor = $(asNavFor).not(_.$slider);
}
if ( asNavFor !== null && typeof asNavFor === 'object' ) {
asNavFor.each(function() {
var target = $(this).slick('getSlick');
if(!target.unslicked) {
target.slideHandler(index, true);
}
});
}
};
Slick.prototype.applyTransition = function(slide) {
var _ = this,
transition = {};
if (_.options.fade === false) {
transition[_.transitionType] = _.transformType + ' ' + _.options.speed + 'ms ' + _.options.cssEase;
} else {
transition[_.transitionType] = 'opacity ' + _.options.speed + 'ms ' + _.options.cssEase;
}
if (_.options.fade === false) {
_.$slideTrack.css(transition);
} else {
_.$slides.eq(slide).css(transition);
}
};
Slick.prototype.autoPlay = function() {
var _ = this;
if (_.autoPlayTimer) {
clearInterval(_.autoPlayTimer);
}
if (_.slideCount > _.options.slidesToShow && _.paused !== true) {
_.autoPlayTimer = setInterval(_.autoPlayIterator,
_.options.autoplaySpeed);
}
};
Slick.prototype.autoPlayClear = function() {
var _ = this;
if (_.autoPlayTimer) {
clearInterval(_.autoPlayTimer);
}
};
Slick.prototype.autoPlayIterator = function() {
var _ = this;
if (_.options.infinite === false) {
if (_.direction === 1) {
if ((_.currentSlide + 1) === _.slideCount -
1) {
_.direction = 0;
}
_.slideHandler(_.currentSlide + _.options.slidesToScroll);
} else {
if ((_.currentSlide - 1 === 0)) {
_.direction = 1;
}
_.slideHandler(_.currentSlide - _.options.slidesToScroll);
}
} else {
_.slideHandler(_.currentSlide + _.options.slidesToScroll);
}
};
Slick.prototype.buildArrows = function() {
var _ = this;
if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) {
_.$prevArrow = $(_.options.prevArrow);
_.$nextArrow = $(_.options.nextArrow);
if (_.htmlExpr.test(_.options.prevArrow)) {
_.$prevArrow.appendTo(_.options.appendArrows);
}
if (_.htmlExpr.test(_.options.nextArrow)) {
_.$nextArrow.appendTo(_.options.appendArrows);
}
if (_.options.infinite !== true) {
_.$prevArrow.addClass('slick-disabled');
}
}
};
Slick.prototype.buildDots = function() {
var _ = this,
i, dotString;
if (_.options.dots === true && _.slideCount > _.options.slidesToShow) {
dotString = '
';
for (i = 0; i <= _.getDotCount(); i += 1) {
dotString += '' + _.options.customPaging.call(this, _, i) + ' ';
}
dotString += ' ';
_.$dots = $(dotString).appendTo(
_.options.appendDots);
_.$dots.find('li').first().addClass('slick-active').attr('aria-hidden', 'false');
}
};
Slick.prototype.buildOut = function() {
var _ = this;
_.$slides = _.$slider.children(
':not(.slick-cloned)').addClass(
'slick-slide');
_.slideCount = _.$slides.length;
_.$slides.each(function(index, element) {
$(element)
.attr('data-slick-index', index)
.data('originalStyling', $(element).attr('style') || '');
});
_.$slidesCache = _.$slides;
_.$slider.addClass('slick-slider');
_.$slideTrack = (_.slideCount === 0) ?
$('
').appendTo(_.$slider) :
_.$slides.wrapAll('
').parent();
_.$list = _.$slideTrack.wrap(
'
').parent();
_.$slideTrack.css('opacity', 0);
if (_.options.centerMode === true || _.options.swipeToSlide === true) {
_.options.slidesToScroll = 1;
}
$('img[data-lazy]', _.$slider).not('[src]').addClass('slick-loading');
_.setupInfinite();
_.buildArrows();
_.buildDots();
_.updateDots();
if (_.options.accessibility === true) {
_.$list.prop('tabIndex', 0);
}
_.setSlideClasses(typeof _.currentSlide === 'number' ? _.currentSlide : 0);
if (_.options.draggable === true) {
_.$list.addClass('draggable');
}
};
Slick.prototype.buildRows = function() {
var _ = this, a, b, c, newSlides, numOfSlides, originalSlides,slidesPerSection;
newSlides = document.createDocumentFragment();
originalSlides = _.$slider.children();
if(_.options.rows > 1) {
slidesPerSection = _.options.slidesPerRow * _.options.rows;
numOfSlides = Math.ceil(
originalSlides.length / slidesPerSection
);
for(a = 0; a < numOfSlides; a++){
var slide = document.createElement('div');
for(b = 0; b < _.options.rows; b++) {
var row = document.createElement('div');
for(c = 0; c < _.options.slidesPerRow; c++) {
var target = (a * slidesPerSection + ((b * _.options.slidesPerRow) + c));
if (originalSlides.get(target)) {
row.appendChild(originalSlides.get(target));
}
}
slide.appendChild(row);
}
newSlides.appendChild(slide);
}
_.$slider.html(newSlides);
_.$slider.children().children().children()
.css({
'width':(100 / _.options.slidesPerRow) + '%',
'display': 'inline-block'
});
}
};
Slick.prototype.checkResponsive = function(initial) {
var _ = this,
breakpoint, targetBreakpoint, respondToWidth, triggerBreakpoint = false;
var sliderWidth = _.$slider.width();
var windowWidth = window.innerWidth || $(window).width();
if (_.respondTo === 'window') {
respondToWidth = windowWidth;
} else if (_.respondTo === 'slider') {
respondToWidth = sliderWidth;
} else if (_.respondTo === 'min') {
respondToWidth = Math.min(windowWidth, sliderWidth);
}
if (_.originalSettings.responsive && _.originalSettings
.responsive.length > -1 && _.originalSettings.responsive !== null) {
targetBreakpoint = null;
for (breakpoint in _.breakpoints) {
if (_.breakpoints.hasOwnProperty(breakpoint)) {
if (_.originalSettings.mobileFirst === false) {
if (respondToWidth < _.breakpoints[breakpoint]) {
targetBreakpoint = _.breakpoints[breakpoint];
}
} else {
if (respondToWidth > _.breakpoints[breakpoint]) {
targetBreakpoint = _.breakpoints[breakpoint];
}
}
}
}
if (targetBreakpoint !== null) {
if (_.activeBreakpoint !== null) {
if (targetBreakpoint !== _.activeBreakpoint) {
_.activeBreakpoint =
targetBreakpoint;
if (_.breakpointSettings[targetBreakpoint] === 'unslick') {
_.unslick(targetBreakpoint);
} else {
_.options = $.extend({}, _.originalSettings,
_.breakpointSettings[
targetBreakpoint]);
if (initial === true) {
_.currentSlide = _.options.initialSlide;
}
_.refresh(initial);
}
triggerBreakpoint = targetBreakpoint;
}
} else {
_.activeBreakpoint = targetBreakpoint;
if (_.breakpointSettings[targetBreakpoint] === 'unslick') {
_.unslick(targetBreakpoint);
} else {
_.options = $.extend({}, _.originalSettings,
_.breakpointSettings[
targetBreakpoint]);
if (initial === true) {
_.currentSlide = _.options.initialSlide;
}
_.refresh(initial);
}
triggerBreakpoint = targetBreakpoint;
}
} else {
if (_.activeBreakpoint !== null) {
_.activeBreakpoint = null;
_.options = _.originalSettings;
if (initial === true) {
_.currentSlide = _.options.initialSlide;
}
_.refresh(initial);
triggerBreakpoint = targetBreakpoint;
}
}
// only trigger breakpoints during an actual break. not on initialize.
if( !initial && triggerBreakpoint !== false ) {
_.$slider.trigger('breakpoint', [_, triggerBreakpoint]);
}
}
};
Slick.prototype.changeSlide = function(event, dontAnimate) {
var _ = this,
$target = $(event.target),
indexOffset, slideOffset, unevenOffset;
// If target is a link, prevent default action.
if($target.is('a')) {
event.preventDefault();
}
// If target is not the
element (ie: a child), find the .
if(!$target.is('li')) {
$target = $target.closest('li');
}
unevenOffset = (_.slideCount % _.options.slidesToScroll !== 0);
indexOffset = unevenOffset ? 0 : (_.slideCount - _.currentSlide) % _.options.slidesToScroll;
switch (event.data.message) {
case 'previous':
slideOffset = indexOffset === 0 ? _.options.slidesToScroll : _.options.slidesToShow - indexOffset;
if (_.slideCount > _.options.slidesToShow) {
_.slideHandler(_.currentSlide - slideOffset, false, dontAnimate);
}
break;
case 'next':
slideOffset = indexOffset === 0 ? _.options.slidesToScroll : indexOffset;
if (_.slideCount > _.options.slidesToShow) {
_.slideHandler(_.currentSlide + slideOffset, false, dontAnimate);
}
break;
case 'index':
var index = event.data.index === 0 ? 0 :
event.data.index || $target.index() * _.options.slidesToScroll;
_.slideHandler(_.checkNavigable(index), false, dontAnimate);
$target.children().trigger('focus');
break;
default:
return;
}
};
Slick.prototype.checkNavigable = function(index) {
var _ = this,
navigables, prevNavigable;
navigables = _.getNavigableIndexes();
prevNavigable = 0;
if (index > navigables[navigables.length - 1]) {
index = navigables[navigables.length - 1];
} else {
for (var n in navigables) {
if (index < navigables[n]) {
index = prevNavigable;
break;
}
prevNavigable = navigables[n];
}
}
return index;
};
Slick.prototype.cleanUpEvents = function() {
var _ = this;
if (_.options.dots && _.$dots !== null) {
$('li', _.$dots).off('click.slick', _.changeSlide);
if (_.options.pauseOnDotsHover === true && _.options.autoplay === true) {
$('li', _.$dots)
.off('mouseenter.slick', $.proxy(_.setPaused, _, true))
.off('mouseleave.slick', $.proxy(_.setPaused, _, false));
}
}
if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) {
_.$prevArrow && _.$prevArrow.off('click.slick', _.changeSlide);
_.$nextArrow && _.$nextArrow.off('click.slick', _.changeSlide);
}
_.$list.off('touchstart.slick mousedown.slick', _.swipeHandler);
_.$list.off('touchmove.slick mousemove.slick', _.swipeHandler);
_.$list.off('touchend.slick mouseup.slick', _.swipeHandler);
_.$list.off('touchcancel.slick mouseleave.slick', _.swipeHandler);
_.$list.off('click.slick', _.clickHandler);
$(document).off(_.visibilityChange, _.visibility);
_.$list.off('mouseenter.slick', $.proxy(_.setPaused, _, true));
_.$list.off('mouseleave.slick', $.proxy(_.setPaused, _, false));
if (_.options.accessibility === true) {
_.$list.off('keydown.slick', _.keyHandler);
}
if (_.options.focusOnSelect === true) {
$(_.$slideTrack).children().off('click.slick', _.selectHandler);
}
$(window).off('orientationchange.slick.slick-' + _.instanceUid, _.orientationChange);
$(window).off('resize.slick.slick-' + _.instanceUid, _.resize);
$('[draggable!=true]', _.$slideTrack).off('dragstart', _.preventDefault);
$(window).off('load.slick.slick-' + _.instanceUid, _.setPosition);
$(document).off('ready.slick.slick-' + _.instanceUid, _.setPosition);
};
Slick.prototype.cleanUpRows = function() {
var _ = this, originalSlides;
if(_.options.rows > 1) {
originalSlides = _.$slides.children().children();
originalSlides.removeAttr('style');
_.$slider.html(originalSlides);
}
};
Slick.prototype.clickHandler = function(event) {
var _ = this;
if (_.shouldClick === false) {
event.stopImmediatePropagation();
event.stopPropagation();
event.preventDefault();
}
};
Slick.prototype.destroy = function(refresh) {
var _ = this;
_.autoPlayClear();
_.touchObject = {};
_.cleanUpEvents();
$('.slick-cloned', _.$slider).detach();
if (_.$dots) {
_.$dots.remove();
}
if (_.$prevArrow && (typeof _.options.prevArrow !== 'object')) {
_.$prevArrow.remove();
}
if (_.$nextArrow && (typeof _.options.nextArrow !== 'object')) {
_.$nextArrow.remove();
}
if (_.$slides) {
_.$slides
.removeClass('slick-slide slick-active slick-center slick-visible slick-current')
.removeAttr('aria-hidden')
.removeAttr('data-slick-index')
.each(function(){
$(this).attr('style', $(this).data('originalStyling'));
});
_.$slideTrack.children(this.options.slide).detach();
_.$slideTrack.detach();
_.$list.detach();
_.$slider.append(_.$slides);
}
_.cleanUpRows();
_.$slider.removeClass('slick-slider');
_.$slider.removeClass('slick-initialized');
_.unslicked = true;
if(!refresh) {
_.$slider.trigger('destroy', [_]);
}
};
Slick.prototype.disableTransition = function(slide) {
var _ = this,
transition = {};
transition[_.transitionType] = '';
if (_.options.fade === false) {
_.$slideTrack.css(transition);
} else {
_.$slides.eq(slide).css(transition);
}
};
Slick.prototype.fadeSlide = function(slideIndex, callback) {
var _ = this;
if (_.cssTransitions === false) {
_.$slides.eq(slideIndex).css({
zIndex: _.options.zIndex
});
_.$slides.eq(slideIndex).animate({
opacity: 1
}, _.options.speed, _.options.easing, callback);
} else {
_.applyTransition(slideIndex);
_.$slides.eq(slideIndex).css({
opacity: 1,
zIndex: _.options.zIndex
});
if (callback) {
setTimeout(function() {
_.disableTransition(slideIndex);
callback.call();
}, _.options.speed);
}
}
};
Slick.prototype.fadeSlideOut = function(slideIndex) {
var _ = this;
if (_.cssTransitions === false) {
_.$slides.eq(slideIndex).animate({
opacity: 0,
zIndex: _.options.zIndex - 2
}, _.options.speed, _.options.easing);
} else {
_.applyTransition(slideIndex);
_.$slides.eq(slideIndex).css({
opacity: 0,
zIndex: _.options.zIndex - 2
});
}
};
Slick.prototype.filterSlides = Slick.prototype.slickFilter = function(filter) {
var _ = this;
if (filter !== null) {
_.unload();
_.$slideTrack.children(this.options.slide).detach();
_.$slidesCache.filter(filter).appendTo(_.$slideTrack);
_.reinit();
}
};
Slick.prototype.getCurrent = Slick.prototype.slickCurrentSlide = function() {
var _ = this;
return _.currentSlide;
};
Slick.prototype.getDotCount = function() {
var _ = this;
var breakPoint = 0;
var counter = 0;
var pagerQty = 0;
if (_.options.infinite === true) {
while (breakPoint < _.slideCount) {
++pagerQty;
breakPoint = counter + _.options.slidesToShow;
counter += _.options.slidesToScroll <= _.options.slidesToShow ? _.options.slidesToScroll : _.options.slidesToShow;
}
} else if (_.options.centerMode === true) {
pagerQty = _.slideCount;
} else {
while (breakPoint < _.slideCount) {
++pagerQty;
breakPoint = counter + _.options.slidesToShow;
counter += _.options.slidesToScroll <= _.options.slidesToShow ? _.options.slidesToScroll : _.options.slidesToShow;
}
}
return pagerQty - 1;
};
Slick.prototype.getLeft = function(slideIndex) {
var _ = this,
targetLeft,
verticalHeight,
verticalOffset = 0,
targetSlide;
_.slideOffset = 0;
verticalHeight = _.$slides.first().outerHeight();
if (_.options.infinite === true) {
if (_.slideCount > _.options.slidesToShow) {
_.slideOffset = (_.slideWidth * _.options.slidesToShow) * -1;
verticalOffset = (verticalHeight * _.options.slidesToShow) * -1;
}
if (_.slideCount % _.options.slidesToScroll !== 0) {
if (slideIndex + _.options.slidesToScroll > _.slideCount && _.slideCount > _.options.slidesToShow) {
if (slideIndex > _.slideCount) {
_.slideOffset = ((_.options.slidesToShow - (slideIndex - _.slideCount)) * _.slideWidth) * -1;
verticalOffset = ((_.options.slidesToShow - (slideIndex - _.slideCount)) * verticalHeight) * -1;
} else {
_.slideOffset = ((_.slideCount % _.options.slidesToScroll) * _.slideWidth) * -1;
verticalOffset = ((_.slideCount % _.options.slidesToScroll) * verticalHeight) * -1;
}
}
}
} else {
if (slideIndex + _.options.slidesToShow > _.slideCount) {
_.slideOffset = ((slideIndex + _.options.slidesToShow) - _.slideCount) * _.slideWidth;
verticalOffset = ((slideIndex + _.options.slidesToShow) - _.slideCount) * verticalHeight;
}
}
if (_.slideCount <= _.options.slidesToShow) {
_.slideOffset = 0;
verticalOffset = 0;
}
if (_.options.centerMode === true && _.options.infinite === true) {
_.slideOffset += _.slideWidth * Math.floor(_.options.slidesToShow / 2) - _.slideWidth;
} else if (_.options.centerMode === true) {
_.slideOffset = 0;
_.slideOffset += _.slideWidth * Math.floor(_.options.slidesToShow / 2);
}
if (_.options.vertical === false) {
targetLeft = ((slideIndex * _.slideWidth) * -1) + _.slideOffset;
} else {
targetLeft = ((slideIndex * verticalHeight) * -1) + verticalOffset;
}
if (_.options.variableWidth === true) {
if (_.slideCount <= _.options.slidesToShow || _.options.infinite === false) {
targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex);
} else {
targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex + _.options.slidesToShow);
}
targetLeft = targetSlide[0] ? targetSlide[0].offsetLeft * -1 : 0;
if (_.options.centerMode === true) {
if (_.options.infinite === false) {
targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex);
} else {
targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex + _.options.slidesToShow + 1);
}
targetLeft = targetSlide[0] ? targetSlide[0].offsetLeft * -1 : 0;
targetLeft += (_.$list.width() - targetSlide.outerWidth()) / 2;
}
}
return targetLeft;
};
Slick.prototype.getOption = Slick.prototype.slickGetOption = function(option) {
var _ = this;
return _.options[option];
};
Slick.prototype.getNavigableIndexes = function() {
var _ = this,
breakPoint = 0,
counter = 0,
indexes = [],
max;
if (_.options.infinite === false) {
max = _.slideCount;
} else {
breakPoint = _.options.slidesToScroll * -1;
counter = _.options.slidesToScroll * -1;
max = _.slideCount * 2;
}
while (breakPoint < max) {
indexes.push(breakPoint);
breakPoint = counter + _.options.slidesToScroll;
counter += _.options.slidesToScroll <= _.options.slidesToShow ? _.options.slidesToScroll : _.options.slidesToShow;
}
return indexes;
};
Slick.prototype.getSlick = function() {
return this;
};
Slick.prototype.getSlideCount = function() {
var _ = this,
slidesTraversed, swipedSlide, centerOffset;
centerOffset = _.options.centerMode === true ? _.slideWidth * Math.floor(_.options.slidesToShow / 2) : 0;
if (_.options.swipeToSlide === true) {
_.$slideTrack.find('.slick-slide').each(function(index, slide) {
if (slide.offsetLeft - centerOffset + ($(slide).outerWidth() / 2) > (_.swipeLeft * -1)) {
swipedSlide = slide;
return false;
}
});
slidesTraversed = Math.abs($(swipedSlide).attr('data-slick-index') - _.currentSlide) || 1;
return slidesTraversed;
} else {
return _.options.slidesToScroll;
}
};
Slick.prototype.goTo = Slick.prototype.slickGoTo = function(slide, dontAnimate) {
var _ = this;
_.changeSlide({
data: {
message: 'index',
index: parseInt(slide)
}
}, dontAnimate);
};
Slick.prototype.init = function(creation) {
var _ = this;
if (!$(_.$slider).hasClass('slick-initialized')) {
$(_.$slider).addClass('slick-initialized');
_.buildRows();
_.buildOut();
_.setProps();
_.startLoad();
_.loadSlider();
_.initializeEvents();
_.updateArrows();
_.updateDots();
}
if (creation) {
_.$slider.trigger('init', [_]);
}
};
Slick.prototype.initArrowEvents = function() {
var _ = this;
if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) {
_.$prevArrow.on('click.slick', {
message: 'previous'
}, _.changeSlide);
_.$nextArrow.on('click.slick', {
message: 'next'
}, _.changeSlide);
}
};
Slick.prototype.initDotEvents = function() {
var _ = this;
if (_.options.dots === true && _.slideCount > _.options.slidesToShow) {
$('li', _.$dots).on('click.slick', {
message: 'index'
}, _.changeSlide);
}
if (_.options.dots === true && _.options.pauseOnDotsHover === true && _.options.autoplay === true) {
$('li', _.$dots)
.on('mouseenter.slick', $.proxy(_.setPaused, _, true))
.on('mouseleave.slick', $.proxy(_.setPaused, _, false));
}
};
Slick.prototype.initializeEvents = function() {
var _ = this;
_.initArrowEvents();
_.initDotEvents();
_.$list.on('touchstart.slick mousedown.slick', {
action: 'start'
}, _.swipeHandler);
_.$list.on('touchmove.slick mousemove.slick', {
action: 'move'
}, _.swipeHandler);
_.$list.on('touchend.slick mouseup.slick', {
action: 'end'
}, _.swipeHandler);
_.$list.on('touchcancel.slick mouseleave.slick', {
action: 'end'
}, _.swipeHandler);
_.$list.on('click.slick', _.clickHandler);
$(document).on(_.visibilityChange, $.proxy(_.visibility, _));
_.$list.on('mouseenter.slick', $.proxy(_.setPaused, _, true));
_.$list.on('mouseleave.slick', $.proxy(_.setPaused, _, false));
if (_.options.accessibility === true) {
_.$list.on('keydown.slick', _.keyHandler);
}
if (_.options.focusOnSelect === true) {
$(_.$slideTrack).children().on('click.slick', _.selectHandler);
}
$(window).on('orientationchange.slick.slick-' + _.instanceUid, $.proxy(_.orientationChange, _));
$(window).on('resize.slick.slick-' + _.instanceUid, $.proxy(_.resize, _));
$('[draggable!=true]', _.$slideTrack).on('dragstart', _.preventDefault);
$(window).on('load.slick.slick-' + _.instanceUid, _.setPosition);
$(document).on('ready.slick.slick-' + _.instanceUid, _.setPosition);
};
Slick.prototype.initUI = function() {
var _ = this;
if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) {
_.$prevArrow.show();
_.$nextArrow.show();
}
if (_.options.dots === true && _.slideCount > _.options.slidesToShow) {
_.$dots.show();
}
if (_.options.autoplay === true) {
_.autoPlay();
}
};
Slick.prototype.keyHandler = function(event) {
var _ = this;
if (event.keyCode === 37 && _.options.accessibility === true) {
_.changeSlide({
data: {
message: 'previous'
}
});
} else if (event.keyCode === 39 && _.options.accessibility === true) {
_.changeSlide({
data: {
message: 'next'
}
});
}
};
Slick.prototype.lazyLoad = function() {
var _ = this,
loadRange, cloneRange, rangeStart, rangeEnd;
function loadImages(imagesScope) {
$('img[data-lazy]', imagesScope).each(function() {
var image = $(this),
imageSource = $(this).attr('data-lazy'),
imageToLoad = document.createElement('img');
imageToLoad.onload = function() {
image
.animate({ opacity: 0 }, 100, function() {
image
.attr('src', imageSource)
.animate({ opacity: 1 }, 200, function() {
image
.removeAttr('data-lazy')
.removeClass('slick-loading');
});
});
};
imageToLoad.src = imageSource;
});
}
if (_.options.centerMode === true) {
if (_.options.infinite === true) {
rangeStart = _.currentSlide + (_.options.slidesToShow / 2 + 1);
rangeEnd = rangeStart + _.options.slidesToShow + 2;
} else {
rangeStart = Math.max(0, _.currentSlide - (_.options.slidesToShow / 2 + 1));
rangeEnd = 2 + (_.options.slidesToShow / 2 + 1) + _.currentSlide;
}
} else {
rangeStart = _.options.infinite ? _.options.slidesToShow + _.currentSlide : _.currentSlide;
rangeEnd = rangeStart + _.options.slidesToShow;
if (_.options.fade === true) {
if (rangeStart > 0) rangeStart--;
if (rangeEnd <= _.slideCount) rangeEnd++;
}
}
loadRange = _.$slider.find('.slick-slide').slice(rangeStart, rangeEnd);
loadImages(loadRange);
if (_.slideCount <= _.options.slidesToShow) {
cloneRange = _.$slider.find('.slick-slide');
loadImages(cloneRange);
} else
if (_.currentSlide >= _.slideCount - _.options.slidesToShow) {
cloneRange = _.$slider.find('.slick-cloned').slice(0, _.options.slidesToShow);
loadImages(cloneRange);
} else if (_.currentSlide === 0) {
cloneRange = _.$slider.find('.slick-cloned').slice(_.options.slidesToShow * -1);
loadImages(cloneRange);
}
};
Slick.prototype.loadSlider = function() {
var _ = this;
_.setPosition();
_.$slideTrack.css({
opacity: 1
});
_.$slider.removeClass('slick-loading');
_.initUI();
if (_.options.lazyLoad === 'progressive') {
_.progressiveLazyLoad();
}
};
Slick.prototype.next = Slick.prototype.slickNext = function() {
var _ = this;
_.changeSlide({
data: {
message: 'next'
}
});
};
Slick.prototype.orientationChange = function() {
var _ = this;
_.checkResponsive();
_.setPosition();
};
Slick.prototype.pause = Slick.prototype.slickPause = function() {
var _ = this;
_.autoPlayClear();
_.paused = true;
};
Slick.prototype.play = Slick.prototype.slickPlay = function() {
var _ = this;
_.paused = false;
_.autoPlay();
};
Slick.prototype.postSlide = function(index) {
var _ = this;
_.$slider.trigger('afterChange', [_, index]);
_.animating = false;
_.setPosition();
_.swipeLeft = null;
if (_.options.autoplay === true && _.paused === false) {
_.autoPlay();
}
};
Slick.prototype.prev = Slick.prototype.slickPrev = function() {
var _ = this;
_.changeSlide({
data: {
message: 'previous'
}
});
};
Slick.prototype.preventDefault = function(e) {
e.preventDefault();
};
Slick.prototype.progressiveLazyLoad = function() {
var _ = this,
imgCount, targetImage;
imgCount = $('img[data-lazy]', _.$slider).length;
if (imgCount > 0) {
targetImage = $('img[data-lazy]', _.$slider).first();
targetImage.attr('src', targetImage.attr('data-lazy')).removeClass('slick-loading').load(function() {
targetImage.removeAttr('data-lazy');
_.progressiveLazyLoad();
if (_.options.adaptiveHeight === true) {
_.setPosition();
}
})
.error(function() {
targetImage.removeAttr('data-lazy');
_.progressiveLazyLoad();
});
}
};
Slick.prototype.refresh = function( initializing ) {
var _ = this,
currentSlide = _.currentSlide;
_.destroy(true);
$.extend(_, _.initials, { currentSlide: currentSlide });
_.init();
if( !initializing ) {
_.changeSlide({
data: {
message: 'index',
index: currentSlide
}
}, false);
}
};
Slick.prototype.reinit = function() {
var _ = this;
_.$slides =
_.$slideTrack
.children(_.options.slide)
.addClass('slick-slide');
_.slideCount = _.$slides.length;
if (_.currentSlide >= _.slideCount && _.currentSlide !== 0) {
_.currentSlide = _.currentSlide - _.options.slidesToScroll;
}
if (_.slideCount <= _.options.slidesToShow) {
_.currentSlide = 0;
}
_.setProps();
_.setupInfinite();
_.buildArrows();
_.updateArrows();
_.initArrowEvents();
_.buildDots();
_.updateDots();
_.initDotEvents();
if (_.options.focusOnSelect === true) {
$(_.$slideTrack).children().on('click.slick', _.selectHandler);
}
_.setSlideClasses(0);
_.setPosition();
_.$slider.trigger('reInit', [_]);
};
Slick.prototype.resize = function() {
var _ = this;
if ($(window).width() !== _.windowWidth) {
clearTimeout(_.windowDelay);
_.windowDelay = window.setTimeout(function() {
_.windowWidth = $(window).width();
_.checkResponsive();
if( !_.unslicked ) { _.setPosition(); }
}, 50);
}
};
Slick.prototype.removeSlide = Slick.prototype.slickRemove = function(index, removeBefore, removeAll) {
var _ = this;
if (typeof(index) === 'boolean') {
removeBefore = index;
index = removeBefore === true ? 0 : _.slideCount - 1;
} else {
index = removeBefore === true ? --index : index;
}
if (_.slideCount < 1 || index < 0 || index > _.slideCount - 1) {
return false;
}
_.unload();
if (removeAll === true) {
_.$slideTrack.children().remove();
} else {
_.$slideTrack.children(this.options.slide).eq(index).remove();
}
_.$slides = _.$slideTrack.children(this.options.slide);
_.$slideTrack.children(this.options.slide).detach();
_.$slideTrack.append(_.$slides);
_.$slidesCache = _.$slides;
_.reinit();
};
Slick.prototype.setCSS = function(position) {
var _ = this,
positionProps = {},
x, y;
if (_.options.rtl === true) {
position = -position;
}
x = _.positionProp == 'left' ? Math.ceil(position) + 'px' : '0px';
y = _.positionProp == 'top' ? Math.ceil(position) + 'px' : '0px';
positionProps[_.positionProp] = position;
if (_.transformsEnabled === false) {
_.$slideTrack.css(positionProps);
} else {
positionProps = {};
if (_.cssTransitions === false) {
positionProps[_.animType] = 'translate(' + x + ', ' + y + ')';
_.$slideTrack.css(positionProps);
} else {
positionProps[_.animType] = 'translate3d(' + x + ', ' + y + ', 0px)';
_.$slideTrack.css(positionProps);
}
}
};
Slick.prototype.setDimensions = function() {
var _ = this;
if (_.options.vertical === false) {
if (_.options.centerMode === true) {
_.$list.css({
padding: ('0px ' + _.options.centerPadding)
});
}
} else {
_.$list.height(_.$slides.first().outerHeight(true) * _.options.slidesToShow);
if (_.options.centerMode === true) {
_.$list.css({
padding: (_.options.centerPadding + ' 0px')
});
}
}
_.listWidth = _.$list.width();
_.listHeight = _.$list.height();
if (_.options.vertical === false && _.options.variableWidth === false) {
_.slideWidth = Math.ceil(_.listWidth / _.options.slidesToShow);
_.$slideTrack.width(Math.ceil((_.slideWidth * _.$slideTrack.children('.slick-slide').length)));
} else if (_.options.variableWidth === true) {
_.$slideTrack.width(5000 * _.slideCount);
} else {
_.slideWidth = Math.ceil(_.listWidth);
_.$slideTrack.height(Math.ceil((_.$slides.first().outerHeight(true) * _.$slideTrack.children('.slick-slide').length)));
}
var offset = _.$slides.first().outerWidth(true) - _.$slides.first().width();
if (_.options.variableWidth === false) _.$slideTrack.children('.slick-slide').width(_.slideWidth - offset);
};
Slick.prototype.setFade = function() {
var _ = this,
targetLeft;
_.$slides.each(function(index, element) {
targetLeft = (_.slideWidth * index) * -1;
if (_.options.rtl === true) {
$(element).css({
position: 'relative',
right: targetLeft,
top: 0,
zIndex: _.options.zIndex - 2,
opacity: 0
});
} else {
$(element).css({
position: 'relative',
left: targetLeft,
top: 0,
zIndex: _.options.zIndex - 2,
opacity: 0
});
}
});
_.$slides.eq(_.currentSlide).css({
zIndex: _.options.zIndex - 1,
opacity: 1
});
};
Slick.prototype.setHeight = function() {
var _ = this;
if (_.options.slidesToShow === 1 && _.options.adaptiveHeight === true && _.options.vertical === false) {
var targetHeight = _.$slides.eq(_.currentSlide).outerHeight(true);
_.$list.css('height', targetHeight);
}
};
Slick.prototype.setOption = Slick.prototype.slickSetOption = function(option, value, refresh) {
var _ = this;
_.options[option] = value;
if (refresh === true) {
_.unload();
_.reinit();
}
};
Slick.prototype.setPosition = function() {
var _ = this;
_.setDimensions();
_.setHeight();
if (_.options.fade === false) {
_.setCSS(_.getLeft(_.currentSlide));
} else {
_.setFade();
}
_.$slider.trigger('setPosition', [_]);
};
Slick.prototype.setProps = function() {
var _ = this,
bodyStyle = document.body.style;
_.positionProp = _.options.vertical === true ? 'top' : 'left';
if (_.positionProp === 'top') {
_.$slider.addClass('slick-vertical');
} else {
_.$slider.removeClass('slick-vertical');
}
if (bodyStyle.WebkitTransition !== undefined ||
bodyStyle.MozTransition !== undefined ||
bodyStyle.msTransition !== undefined) {
if (_.options.useCSS === true) {
_.cssTransitions = true;
}
}
if ( _.options.fade ) {
if ( typeof _.options.zIndex === 'number' ) {
if( _.options.zIndex < 3 ) {
_.options.zIndex = 3;
}
} else {
_.options.zIndex = _.defaults.zIndex;
}
}
if (bodyStyle.OTransform !== undefined) {
_.animType = 'OTransform';
_.transformType = '-o-transform';
_.transitionType = 'OTransition';
if (bodyStyle.perspectiveProperty === undefined && bodyStyle.webkitPerspective === undefined) _.animType = false;
}
if (bodyStyle.MozTransform !== undefined) {
_.animType = 'MozTransform';
_.transformType = '-moz-transform';
_.transitionType = 'MozTransition';
if (bodyStyle.perspectiveProperty === undefined && bodyStyle.MozPerspective === undefined) _.animType = false;
}
if (bodyStyle.webkitTransform !== undefined) {
_.animType = 'webkitTransform';
_.transformType = '-webkit-transform';
_.transitionType = 'webkitTransition';
if (bodyStyle.perspectiveProperty === undefined && bodyStyle.webkitPerspective === undefined) _.animType = false;
}
if (bodyStyle.msTransform !== undefined) {
_.animType = 'msTransform';
_.transformType = '-ms-transform';
_.transitionType = 'msTransition';
if (bodyStyle.msTransform === undefined) _.animType = false;
}
if (bodyStyle.transform !== undefined && _.animType !== false) {
_.animType = 'transform';
_.transformType = 'transform';
_.transitionType = 'transition';
}
_.transformsEnabled = (_.animType !== null && _.animType !== false);
};
Slick.prototype.setSlideClasses = function(index) {
var _ = this,
centerOffset, allSlides, indexOffset, remainder;
allSlides = _.$slider
.find('.slick-slide')
.removeClass('slick-active slick-center slick-current')
.attr('aria-hidden', 'true');
_.$slides
.eq(index)
.addClass('slick-current');
if (_.options.centerMode === true) {
centerOffset = Math.floor(_.options.slidesToShow / 2);
if (_.options.infinite === true) {
if (index >= centerOffset && index <= (_.slideCount - 1) - centerOffset) {
_.$slides
.slice(index - centerOffset, index + centerOffset + 1)
.addClass('slick-active')
.attr('aria-hidden', 'false');
} else {
indexOffset = _.options.slidesToShow + index;
allSlides
.slice(indexOffset - centerOffset + 1, indexOffset + centerOffset + 2)
.addClass('slick-active')
.attr('aria-hidden', 'false');
}
if (index === 0) {
allSlides
.eq(allSlides.length - 1 - _.options.slidesToShow)
.addClass('slick-center');
} else if (index === _.slideCount - 1) {
allSlides
.eq(_.options.slidesToShow)
.addClass('slick-center');
}
}
_.$slides
.eq(index)
.addClass('slick-center');
} else {
if (index >= 0 && index <= (_.slideCount - _.options.slidesToShow)) {
_.$slides
.slice(index, index + _.options.slidesToShow)
.addClass('slick-active')
.attr('aria-hidden', 'false');
} else if (allSlides.length <= _.options.slidesToShow) {
allSlides
.addClass('slick-active')
.attr('aria-hidden', 'false');
} else {
remainder = _.slideCount % _.options.slidesToShow;
indexOffset = _.options.infinite === true ? _.options.slidesToShow + index : index;
if (_.options.slidesToShow == _.options.slidesToScroll && (_.slideCount - index) < _.options.slidesToShow) {
allSlides
.slice(indexOffset - (_.options.slidesToShow - remainder), indexOffset + remainder)
.addClass('slick-active')
.attr('aria-hidden', 'false');
} else {
allSlides
.slice(indexOffset, indexOffset + _.options.slidesToShow)
.addClass('slick-active')
.attr('aria-hidden', 'false');
}
}
}
if (_.options.lazyLoad === 'ondemand') {
_.lazyLoad();
}
};
Slick.prototype.setupInfinite = function() {
var _ = this,
i, slideIndex, infiniteCount;
if (_.options.fade === true) {
_.options.centerMode = false;
}
if (_.options.infinite === true && _.options.fade === false) {
slideIndex = null;
if (_.slideCount > _.options.slidesToShow) {
if (_.options.centerMode === true) {
infiniteCount = _.options.slidesToShow + 1;
} else {
infiniteCount = _.options.slidesToShow;
}
for (i = _.slideCount; i > (_.slideCount -
infiniteCount); i -= 1) {
slideIndex = i - 1;
$(_.$slides[slideIndex]).clone(true).attr('id', '')
.attr('data-slick-index', slideIndex - _.slideCount)
.prependTo(_.$slideTrack).addClass('slick-cloned');
}
for (i = 0; i < infiniteCount; i += 1) {
slideIndex = i;
$(_.$slides[slideIndex]).clone(true).attr('id', '')
.attr('data-slick-index', slideIndex + _.slideCount)
.appendTo(_.$slideTrack).addClass('slick-cloned');
}
_.$slideTrack.find('.slick-cloned').find('[id]').each(function() {
$(this).attr('id', '');
});
}
}
};
Slick.prototype.setPaused = function(paused) {
var _ = this;
if (_.options.autoplay === true && _.options.pauseOnHover === true) {
_.paused = paused;
if (!paused) {
_.autoPlay();
} else {
_.autoPlayClear();
}
}
};
Slick.prototype.selectHandler = function(event) {
var _ = this;
var targetElement =
$(event.target).is('.slick-slide') ?
$(event.target) :
$(event.target).parents('.slick-slide');
var index = parseInt(targetElement.attr('data-slick-index'));
if (!index) index = 0;
if (_.slideCount <= _.options.slidesToShow) {
_.setSlideClasses(index);
_.asNavFor(index);
return;
}
_.slideHandler(index);
};
Slick.prototype.slideHandler = function(index, sync, dontAnimate) {
var targetSlide, animSlide, oldSlide, slideLeft, targetLeft = null,
_ = this;
sync = sync || false;
if (_.animating === true && _.options.waitForAnimate === true) {
return;
}
if (_.options.fade === true && _.currentSlide === index) {
return;
}
if (_.slideCount <= _.options.slidesToShow) {
return;
}
if (sync === false) {
_.asNavFor(index);
}
targetSlide = index;
targetLeft = _.getLeft(targetSlide);
slideLeft = _.getLeft(_.currentSlide);
_.currentLeft = _.swipeLeft === null ? slideLeft : _.swipeLeft;
if (_.options.infinite === false && _.options.centerMode === false && (index < 0 || index > _.getDotCount() * _.options.slidesToScroll)) {
if (_.options.fade === false) {
targetSlide = _.currentSlide;
if (dontAnimate !== true) {
_.animateSlide(slideLeft, function() {
_.postSlide(targetSlide);
});
} else {
_.postSlide(targetSlide);
}
}
return;
} else if (_.options.infinite === false && _.options.centerMode === true && (index < 0 || index > (_.slideCount - _.options.slidesToScroll))) {
if (_.options.fade === false) {
targetSlide = _.currentSlide;
if (dontAnimate !== true) {
_.animateSlide(slideLeft, function() {
_.postSlide(targetSlide);
});
} else {
_.postSlide(targetSlide);
}
}
return;
}
if (_.options.autoplay === true) {
clearInterval(_.autoPlayTimer);
}
if (targetSlide < 0) {
if (_.slideCount % _.options.slidesToScroll !== 0) {
animSlide = _.slideCount - (_.slideCount % _.options.slidesToScroll);
} else {
animSlide = _.slideCount + targetSlide;
}
} else if (targetSlide >= _.slideCount) {
if (_.slideCount % _.options.slidesToScroll !== 0) {
animSlide = 0;
} else {
animSlide = targetSlide - _.slideCount;
}
} else {
animSlide = targetSlide;
}
_.animating = true;
_.$slider.trigger('beforeChange', [_, _.currentSlide, animSlide]);
oldSlide = _.currentSlide;
_.currentSlide = animSlide;
_.setSlideClasses(_.currentSlide);
_.updateDots();
_.updateArrows();
if (_.options.fade === true) {
if (dontAnimate !== true) {
_.fadeSlideOut(oldSlide);
_.fadeSlide(animSlide, function() {
_.postSlide(animSlide);
});
} else {
_.postSlide(animSlide);
}
_.animateHeight();
return;
}
if (dontAnimate !== true) {
_.animateSlide(targetLeft, function() {
_.postSlide(animSlide);
});
} else {
_.postSlide(animSlide);
}
};
Slick.prototype.startLoad = function() {
var _ = this;
if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) {
_.$prevArrow.hide();
_.$nextArrow.hide();
}
if (_.options.dots === true && _.slideCount > _.options.slidesToShow) {
_.$dots.hide();
}
_.$slider.addClass('slick-loading');
};
Slick.prototype.swipeDirection = function() {
var xDist, yDist, r, swipeAngle, _ = this;
xDist = _.touchObject.startX - _.touchObject.curX;
yDist = _.touchObject.startY - _.touchObject.curY;
r = Math.atan2(yDist, xDist);
swipeAngle = Math.round(r * 180 / Math.PI);
if (swipeAngle < 0) {
swipeAngle = 360 - Math.abs(swipeAngle);
}
if ((swipeAngle <= 45) && (swipeAngle >= 0)) {
return (_.options.rtl === false ? 'left' : 'right');
}
if ((swipeAngle <= 360) && (swipeAngle >= 315)) {
return (_.options.rtl === false ? 'left' : 'right');
}
if ((swipeAngle >= 135) && (swipeAngle <= 225)) {
return (_.options.rtl === false ? 'right' : 'left');
}
if (_.options.verticalSwiping === true) {
if ((swipeAngle >= 35) && (swipeAngle <= 135)) {
return 'left';
} else {
return 'right';
}
}
return 'vertical';
};
Slick.prototype.swipeEnd = function(event) {
var _ = this,
slideCount;
_.dragging = false;
_.shouldClick = (_.touchObject.swipeLength > 10) ? false : true;
if (_.touchObject.curX === undefined) {
return false;
}
if (_.touchObject.edgeHit === true) {
_.$slider.trigger('edge', [_, _.swipeDirection()]);
}
if (_.touchObject.swipeLength >= _.touchObject.minSwipe) {
switch (_.swipeDirection()) {
case 'left':
slideCount = _.options.swipeToSlide ? _.checkNavigable(_.currentSlide + _.getSlideCount()) : _.currentSlide + _.getSlideCount();
_.slideHandler(slideCount);
_.currentDirection = 0;
_.touchObject = {};
_.$slider.trigger('swipe', [_, 'left']);
break;
case 'right':
slideCount = _.options.swipeToSlide ? _.checkNavigable(_.currentSlide - _.getSlideCount()) : _.currentSlide - _.getSlideCount();
_.slideHandler(slideCount);
_.currentDirection = 1;
_.touchObject = {};
_.$slider.trigger('swipe', [_, 'right']);
break;
}
} else {
if (_.touchObject.startX !== _.touchObject.curX) {
_.slideHandler(_.currentSlide);
_.touchObject = {};
}
}
};
Slick.prototype.swipeHandler = function(event) {
var _ = this;
if ((_.options.swipe === false) || ('ontouchend' in document && _.options.swipe === false)) {
return;
} else if (_.options.draggable === false && event.type.indexOf('mouse') !== -1) {
return;
}
_.touchObject.fingerCount = event.originalEvent && event.originalEvent.touches !== undefined ?
event.originalEvent.touches.length : 1;
_.touchObject.minSwipe = _.listWidth / _.options
.touchThreshold;
if (_.options.verticalSwiping === true) {
_.touchObject.minSwipe = _.listHeight / _.options
.touchThreshold;
}
switch (event.data.action) {
case 'start':
_.swipeStart(event);
break;
case 'move':
_.swipeMove(event);
break;
case 'end':
_.swipeEnd(event);
break;
}
};
Slick.prototype.swipeMove = function(event) {
var _ = this,
edgeWasHit = false,
curLeft, swipeDirection, swipeLength, positionOffset, touches;
touches = event.originalEvent !== undefined ? event.originalEvent.touches : null;
if (!_.dragging || touches && touches.length !== 1) {
return false;
}
curLeft = _.getLeft(_.currentSlide);
_.touchObject.curX = touches !== undefined ? touches[0].pageX : event.clientX;
_.touchObject.curY = touches !== undefined ? touches[0].pageY : event.clientY;
_.touchObject.swipeLength = Math.round(Math.sqrt(
Math.pow(_.touchObject.curX - _.touchObject.startX, 2)));
if (_.options.verticalSwiping === true) {
_.touchObject.swipeLength = Math.round(Math.sqrt(
Math.pow(_.touchObject.curY - _.touchObject.startY, 2)));
}
swipeDirection = _.swipeDirection();
if (swipeDirection === 'vertical') {
return;
}
if (event.originalEvent !== undefined && _.touchObject.swipeLength > 4) {
event.preventDefault();
}
positionOffset = (_.options.rtl === false ? 1 : -1) * (_.touchObject.curX > _.touchObject.startX ? 1 : -1);
if (_.options.verticalSwiping === true) {
positionOffset = _.touchObject.curY > _.touchObject.startY ? 1 : -1;
}
swipeLength = _.touchObject.swipeLength;
_.touchObject.edgeHit = false;
if (_.options.infinite === false) {
if ((_.currentSlide === 0 && swipeDirection === 'right') || (_.currentSlide >= _.getDotCount() && swipeDirection === 'left')) {
swipeLength = _.touchObject.swipeLength * _.options.edgeFriction;
_.touchObject.edgeHit = true;
}
}
if (_.options.vertical === false) {
_.swipeLeft = curLeft + swipeLength * positionOffset;
} else {
_.swipeLeft = curLeft + (swipeLength * (_.$list.height() / _.listWidth)) * positionOffset;
}
if (_.options.verticalSwiping === true) {
_.swipeLeft = curLeft + swipeLength * positionOffset;
}
if (_.options.fade === true || _.options.touchMove === false) {
return false;
}
if (_.animating === true) {
_.swipeLeft = null;
return false;
}
_.setCSS(_.swipeLeft);
};
Slick.prototype.swipeStart = function(event) {
var _ = this,
touches;
if (_.touchObject.fingerCount !== 1 || _.slideCount <= _.options.slidesToShow) {
_.touchObject = {};
return false;
}
if (event.originalEvent !== undefined && event.originalEvent.touches !== undefined) {
touches = event.originalEvent.touches[0];
}
_.touchObject.startX = _.touchObject.curX = touches !== undefined ? touches.pageX : event.clientX;
_.touchObject.startY = _.touchObject.curY = touches !== undefined ? touches.pageY : event.clientY;
_.dragging = true;
};
Slick.prototype.unfilterSlides = Slick.prototype.slickUnfilter = function() {
var _ = this;
if (_.$slidesCache !== null) {
_.unload();
_.$slideTrack.children(this.options.slide).detach();
_.$slidesCache.appendTo(_.$slideTrack);
_.reinit();
}
};
Slick.prototype.unload = function() {
var _ = this;
$('.slick-cloned', _.$slider).remove();
if (_.$dots) {
_.$dots.remove();
}
if (_.$prevArrow && (typeof _.options.prevArrow !== 'object')) {
_.$prevArrow.remove();
}
if (_.$nextArrow && (typeof _.options.nextArrow !== 'object')) {
_.$nextArrow.remove();
}
_.$slides
.removeClass('slick-slide slick-active slick-visible slick-current')
.attr('aria-hidden', 'true')
.css('width', '');
};
Slick.prototype.unslick = function(fromBreakpoint) {
var _ = this;
_.$slider.trigger('unslick', [_, fromBreakpoint]);
_.destroy();
};
Slick.prototype.updateArrows = function() {
var _ = this,
centerOffset;
centerOffset = Math.floor(_.options.slidesToShow / 2);
if (_.options.arrows === true && _.options.infinite !==
true && _.slideCount > _.options.slidesToShow) {
_.$prevArrow.removeClass('slick-disabled');
_.$nextArrow.removeClass('slick-disabled');
if (_.currentSlide === 0) {
_.$prevArrow.addClass('slick-disabled');
_.$nextArrow.removeClass('slick-disabled');
} else if (_.currentSlide >= _.slideCount - _.options.slidesToShow && _.options.centerMode === false) {
_.$nextArrow.addClass('slick-disabled');
_.$prevArrow.removeClass('slick-disabled');
} else if (_.currentSlide >= _.slideCount - 1 && _.options.centerMode === true) {
_.$nextArrow.addClass('slick-disabled');
_.$prevArrow.removeClass('slick-disabled');
}
}
};
Slick.prototype.updateDots = function() {
var _ = this;
if (_.$dots !== null) {
_.$dots
.find('li')
.removeClass('slick-active')
.attr('aria-hidden', 'true');
_.$dots
.find('li')
.eq(Math.floor(_.currentSlide / _.options.slidesToScroll))
.addClass('slick-active')
.attr('aria-hidden', 'false');
}
};
Slick.prototype.visibility = function() {
var _ = this;
if (document[_.hidden]) {
_.paused = true;
_.autoPlayClear();
} else {
if (_.options.autoplay === true) {
_.paused = false;
_.autoPlay();
}
}
};
$.fn.slick = function() {
var _ = this,
opt = arguments[0],
args = Array.prototype.slice.call(arguments, 1),
l = _.length,
i = 0,
ret;
for (i; i < l; i++) {
if (typeof opt == 'object' || typeof opt == 'undefined')
_[i].slick = new Slick(_[i], opt);
else
ret = _[i].slick[opt].apply(_[i].slick, args);
if (typeof ret != 'undefined') return ret;
}
return _;
};
}));
;
/*
*
* More info at [www.dropzonejs.com](http://www.dropzonejs.com)
*
* Copyright (c) 2012, Matias Meno
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*/
(function() {
var Dropzone, Emitter, camelize, contentLoaded, detectVerticalSquash, drawImageIOSFix, noop, without,
__slice = [].slice,
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
noop = function() {};
Emitter = (function() {
function Emitter() {}
Emitter.prototype.addEventListener = Emitter.prototype.on;
Emitter.prototype.on = function(event, fn) {
this._callbacks = this._callbacks || {};
if (!this._callbacks[event]) {
this._callbacks[event] = [];
}
this._callbacks[event].push(fn);
return this;
};
Emitter.prototype.emit = function() {
var args, callback, callbacks, event, _i, _len;
event = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
this._callbacks = this._callbacks || {};
callbacks = this._callbacks[event];
if (callbacks) {
for (_i = 0, _len = callbacks.length; _i < _len; _i++) {
callback = callbacks[_i];
callback.apply(this, args);
}
}
return this;
};
Emitter.prototype.removeListener = Emitter.prototype.off;
Emitter.prototype.removeAllListeners = Emitter.prototype.off;
Emitter.prototype.removeEventListener = Emitter.prototype.off;
Emitter.prototype.off = function(event, fn) {
var callback, callbacks, i, _i, _len;
if (!this._callbacks || arguments.length === 0) {
this._callbacks = {};
return this;
}
callbacks = this._callbacks[event];
if (!callbacks) {
return this;
}
if (arguments.length === 1) {
delete this._callbacks[event];
return this;
}
for (i = _i = 0, _len = callbacks.length; _i < _len; i = ++_i) {
callback = callbacks[i];
if (callback === fn) {
callbacks.splice(i, 1);
break;
}
}
return this;
};
return Emitter;
})();
Dropzone = (function(_super) {
var extend, resolveOption;
__extends(Dropzone, _super);
Dropzone.prototype.Emitter = Emitter;
/*
This is a list of all available events you can register on a dropzone object.
You can register an event handler like this:
dropzone.on("dragEnter", function() { });
*/
Dropzone.prototype.events = ["drop", "dragstart", "dragend", "dragenter", "dragover", "dragleave", "addedfile", "removedfile", "thumbnail", "error", "errormultiple", "processing", "processingmultiple", "uploadprogress", "totaluploadprogress", "sending", "sendingmultiple", "success", "successmultiple", "canceled", "canceledmultiple", "complete", "completemultiple", "reset", "maxfilesexceeded", "maxfilesreached", "queuecomplete"];
Dropzone.prototype.defaultOptions = {
url: null,
method: "post",
withCredentials: false,
parallelUploads: 2,
uploadMultiple: false,
maxFilesize: 256,
paramName: "file",
createImageThumbnails: true,
maxThumbnailFilesize: 10,
thumbnailWidth: 120,
thumbnailHeight: 120,
filesizeBase: 1000,
maxFiles: null,
filesizeBase: 1000,
params: {},
clickable: true,
ignoreHiddenFiles: true,
acceptedFiles: null,
acceptedMimeTypes: null,
autoProcessQueue: true,
autoQueue: true,
addRemoveLinks: false,
previewsContainer: null,
capture: null,
dictDefaultMessage: "Drop files here to upload",
dictFallbackMessage: "Your browser does not support drag'n'drop file uploads.",
dictFallbackText: "Please use the fallback form below to upload your files like in the olden days.",
dictFileTooBig: "File is too big ({{filesize}}MiB). Max filesize: {{maxFilesize}}MiB.",
dictInvalidFileType: "You can't upload files of this type.",
dictResponseError: "Server responded with {{statusCode}} code.",
dictCancelUpload: "Cancel upload",
dictCancelUploadConfirmation: "Are you sure you want to cancel this upload?",
dictRemoveFile: "Remove file",
dictRemoveFileConfirmation: null,
dictMaxFilesExceeded: "You can not upload any more files.",
accept: function(file, done) {
return done();
},
init: function() {
return noop;
},
forceFallback: false,
fallback: function() {
var child, messageElement, span, _i, _len, _ref;
this.element.className = "" + this.element.className + " dz-browser-not-supported";
_ref = this.element.getElementsByTagName("div");
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
child = _ref[_i];
if (/(^| )dz-message($| )/.test(child.className)) {
messageElement = child;
child.className = "dz-message";
continue;
}
}
if (!messageElement) {
messageElement = Dropzone.createElement("
");
this.element.appendChild(messageElement);
}
span = messageElement.getElementsByTagName("span")[0];
if (span) {
span.textContent = this.options.dictFallbackMessage;
}
return this.element.appendChild(this.getFallbackForm());
},
resize: function(file) {
var info, srcRatio, trgRatio;
info = {
srcX: 0,
srcY: 0,
srcWidth: file.width,
srcHeight: file.height
};
srcRatio = file.width / file.height;
info.optWidth = this.options.thumbnailWidth;
info.optHeight = this.options.thumbnailHeight;
if ((info.optWidth == null) && (info.optHeight == null)) {
info.optWidth = info.srcWidth;
info.optHeight = info.srcHeight;
} else if (info.optWidth == null) {
info.optWidth = srcRatio * info.optHeight;
} else if (info.optHeight == null) {
info.optHeight = (1 / srcRatio) * info.optWidth;
}
trgRatio = info.optWidth / info.optHeight;
if (file.height < info.optHeight || file.width < info.optWidth) {
info.trgHeight = info.srcHeight;
info.trgWidth = info.srcWidth;
} else {
if (srcRatio > trgRatio) {
info.srcHeight = file.height;
info.srcWidth = info.srcHeight * trgRatio;
} else {
info.srcWidth = file.width;
info.srcHeight = info.srcWidth / trgRatio;
}
}
info.srcX = (file.width - info.srcWidth) / 2;
info.srcY = (file.height - info.srcHeight) / 2;
return info;
},
/*
Those functions register themselves to the events on init and handle all
the user interface specific stuff. Overwriting them won't break the upload
but can break the way it's displayed.
You can overwrite them if you don't like the default behavior. If you just
want to add an additional event handler, register it on the dropzone object
and don't overwrite those options.
*/
drop: function(e) {
return this.element.classList.remove("dz-drag-hover");
},
dragstart: noop,
dragend: function(e) {
return this.element.classList.remove("dz-drag-hover");
},
dragenter: function(e) {
return this.element.classList.add("dz-drag-hover");
},
dragover: function(e) {
return this.element.classList.add("dz-drag-hover");
},
dragleave: function(e) {
return this.element.classList.remove("dz-drag-hover");
},
paste: noop,
reset: function() {
return this.element.classList.remove("dz-started");
},
addedfile: function(file) {
var node, removeFileEvent, removeLink, _i, _j, _k, _len, _len1, _len2, _ref, _ref1, _ref2, _results;
if (this.element === this.previewsContainer) {
this.element.classList.add("dz-started");
}
if (this.previewsContainer) {
file.previewElement = Dropzone.createElement(this.options.previewTemplate.trim());
file.previewTemplate = file.previewElement;
this.previewsContainer.appendChild(file.previewElement);
_ref = file.previewElement.querySelectorAll("[data-dz-name]");
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
node = _ref[_i];
node.textContent = file.name;
}
_ref1 = file.previewElement.querySelectorAll("[data-dz-size]");
for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
node = _ref1[_j];
node.innerHTML = this.filesize(file.size);
}
if (this.options.addRemoveLinks) {
file._removeLink = Dropzone.createElement("" + this.options.dictRemoveFile + " ");
file.previewElement.appendChild(file._removeLink);
}
removeFileEvent = (function(_this) {
return function(e) {
e.preventDefault();
e.stopPropagation();
if (file.status === Dropzone.UPLOADING) {
return Dropzone.confirm(_this.options.dictCancelUploadConfirmation, function() {
return _this.removeFile(file);
});
} else {
if (_this.options.dictRemoveFileConfirmation) {
return Dropzone.confirm(_this.options.dictRemoveFileConfirmation, function() {
return _this.removeFile(file);
});
} else {
return _this.removeFile(file);
}
}
};
})(this);
_ref2 = file.previewElement.querySelectorAll("[data-dz-remove]");
_results = [];
for (_k = 0, _len2 = _ref2.length; _k < _len2; _k++) {
removeLink = _ref2[_k];
_results.push(removeLink.addEventListener("click", removeFileEvent));
}
return _results;
}
},
removedfile: function(file) {
var _ref;
if (file.previewElement) {
if ((_ref = file.previewElement) != null) {
_ref.parentNode.removeChild(file.previewElement);
}
}
return this._updateMaxFilesReachedClass();
},
thumbnail: function(file, dataUrl) {
var thumbnailElement, _i, _len, _ref;
if (file.previewElement) {
file.previewElement.classList.remove("dz-file-preview");
_ref = file.previewElement.querySelectorAll("[data-dz-thumbnail]");
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
thumbnailElement = _ref[_i];
thumbnailElement.alt = file.name;
thumbnailElement.src = dataUrl;
}
return setTimeout(((function(_this) {
return function() {
return file.previewElement.classList.add("dz-image-preview");
};
})(this)), 1);
}
},
error: function(file, message) {
var node, _i, _len, _ref, _results;
if (file.previewElement) {
file.previewElement.classList.add("dz-error");
if (typeof message !== "String" && message.error) {
message = message.error;
}
_ref = file.previewElement.querySelectorAll("[data-dz-errormessage]");
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
node = _ref[_i];
_results.push(node.textContent = message);
}
return _results;
}
},
errormultiple: noop,
processing: function(file) {
if (file.previewElement) {
file.previewElement.classList.add("dz-processing");
if (file._removeLink) {
return file._removeLink.textContent = this.options.dictCancelUpload;
}
}
},
processingmultiple: noop,
uploadprogress: function(file, progress, bytesSent) {
var node, _i, _len, _ref, _results;
if (file.previewElement) {
_ref = file.previewElement.querySelectorAll("[data-dz-uploadprogress]");
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
node = _ref[_i];
if (node.nodeName === 'PROGRESS') {
_results.push(node.value = progress);
} else {
_results.push(node.style.width = "" + progress + "%");
}
}
return _results;
}
},
totaluploadprogress: noop,
sending: noop,
sendingmultiple: noop,
success: function(file) {
if (file.previewElement) {
return file.previewElement.classList.add("dz-success");
}
},
successmultiple: noop,
canceled: function(file) {
return this.emit("error", file, "Upload canceled.");
},
canceledmultiple: noop,
complete: function(file) {
if (file._removeLink) {
file._removeLink.textContent = this.options.dictRemoveFile;
}
if (file.previewElement) {
return file.previewElement.classList.add("dz-complete");
}
},
completemultiple: noop,
maxfilesexceeded: noop,
maxfilesreached: noop,
queuecomplete: noop,
previewTemplate: "\n
\n
\n
\n
\n
\n
\n Check \n \n \n \n \n \n
\n
\n
\n Error \n \n \n \n \n \n \n \n
\n
"
};
extend = function() {
var key, object, objects, target, val, _i, _len;
target = arguments[0], objects = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
for (_i = 0, _len = objects.length; _i < _len; _i++) {
object = objects[_i];
for (key in object) {
val = object[key];
target[key] = val;
}
}
return target;
};
function Dropzone(element, options) {
var elementOptions, fallback, _ref;
this.element = element;
this.version = Dropzone.version;
this.defaultOptions.previewTemplate = this.defaultOptions.previewTemplate.replace(/\n*/g, "");
this.clickableElements = [];
this.listeners = [];
this.files = [];
if (typeof this.element === "string") {
this.element = document.querySelector(this.element);
}
if (!(this.element && (this.element.nodeType != null))) {
throw new Error("Invalid dropzone element.");
}
if (this.element.dropzone) {
throw new Error("Dropzone already attached.");
}
Dropzone.instances.push(this);
this.element.dropzone = this;
elementOptions = (_ref = Dropzone.optionsForElement(this.element)) != null ? _ref : {};
this.options = extend({}, this.defaultOptions, elementOptions, options != null ? options : {});
if (this.options.forceFallback || !Dropzone.isBrowserSupported()) {
return this.options.fallback.call(this);
}
if (this.options.url == null) {
this.options.url = this.element.getAttribute("action");
}
if (!this.options.url) {
throw new Error("No URL provided.");
}
if (this.options.acceptedFiles && this.options.acceptedMimeTypes) {
throw new Error("You can't provide both 'acceptedFiles' and 'acceptedMimeTypes'. 'acceptedMimeTypes' is deprecated.");
}
if (this.options.acceptedMimeTypes) {
this.options.acceptedFiles = this.options.acceptedMimeTypes;
delete this.options.acceptedMimeTypes;
}
this.options.method = this.options.method.toUpperCase();
if ((fallback = this.getExistingFallback()) && fallback.parentNode) {
fallback.parentNode.removeChild(fallback);
}
if (this.options.previewsContainer !== false) {
if (this.options.previewsContainer) {
this.previewsContainer = Dropzone.getElement(this.options.previewsContainer, "previewsContainer");
} else {
this.previewsContainer = this.element;
}
}
if (this.options.clickable) {
if (this.options.clickable === true) {
this.clickableElements = [this.element];
} else {
this.clickableElements = Dropzone.getElements(this.options.clickable, "clickable");
}
}
this.init();
}
Dropzone.prototype.getAcceptedFiles = function() {
var file, _i, _len, _ref, _results;
_ref = this.files;
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
file = _ref[_i];
if (file.accepted) {
_results.push(file);
}
}
return _results;
};
Dropzone.prototype.getRejectedFiles = function() {
var file, _i, _len, _ref, _results;
_ref = this.files;
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
file = _ref[_i];
if (!file.accepted) {
_results.push(file);
}
}
return _results;
};
Dropzone.prototype.getFilesWithStatus = function(status) {
var file, _i, _len, _ref, _results;
_ref = this.files;
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
file = _ref[_i];
if (file.status === status) {
_results.push(file);
}
}
return _results;
};
Dropzone.prototype.getQueuedFiles = function() {
return this.getFilesWithStatus(Dropzone.QUEUED);
};
Dropzone.prototype.getUploadingFiles = function() {
return this.getFilesWithStatus(Dropzone.UPLOADING);
};
Dropzone.prototype.getActiveFiles = function() {
var file, _i, _len, _ref, _results;
_ref = this.files;
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
file = _ref[_i];
if (file.status === Dropzone.UPLOADING || file.status === Dropzone.QUEUED) {
_results.push(file);
}
}
return _results;
};
Dropzone.prototype.init = function() {
var eventName, noPropagation, setupHiddenFileInput, _i, _len, _ref, _ref1;
if (this.element.tagName === "form") {
this.element.setAttribute("enctype", "multipart/form-data");
}
if (this.element.classList.contains("dropzone") && !this.element.querySelector(".dz-message")) {
this.element.appendChild(Dropzone.createElement("" + this.options.dictDefaultMessage + "
"));
}
if (this.clickableElements.length) {
setupHiddenFileInput = (function(_this) {
return function() {
if (_this.hiddenFileInput) {
document.body.removeChild(_this.hiddenFileInput);
}
_this.hiddenFileInput = document.createElement("input");
_this.hiddenFileInput.setAttribute("type", "file");
if ((_this.options.maxFiles == null) || _this.options.maxFiles > 1) {
_this.hiddenFileInput.setAttribute("multiple", "multiple");
}
_this.hiddenFileInput.className = "dz-hidden-input";
if (_this.options.acceptedFiles != null) {
_this.hiddenFileInput.setAttribute("accept", _this.options.acceptedFiles);
}
if (_this.options.capture != null) {
_this.hiddenFileInput.setAttribute("capture", _this.options.capture);
}
_this.hiddenFileInput.style.visibility = "hidden";
_this.hiddenFileInput.style.position = "absolute";
_this.hiddenFileInput.style.top = "0";
_this.hiddenFileInput.style.left = "0";
_this.hiddenFileInput.style.height = "0";
_this.hiddenFileInput.style.width = "0";
document.body.appendChild(_this.hiddenFileInput);
return _this.hiddenFileInput.addEventListener("change", function() {
var file, files, _i, _len;
files = _this.hiddenFileInput.files;
if (files.length) {
for (_i = 0, _len = files.length; _i < _len; _i++) {
file = files[_i];
_this.addFile(file);
}
}
return setupHiddenFileInput();
});
};
})(this);
setupHiddenFileInput();
}
this.URL = (_ref = window.URL) != null ? _ref : window.webkitURL;
_ref1 = this.events;
for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
eventName = _ref1[_i];
this.on(eventName, this.options[eventName]);
}
this.on("uploadprogress", (function(_this) {
return function() {
return _this.updateTotalUploadProgress();
};
})(this));
this.on("removedfile", (function(_this) {
return function() {
return _this.updateTotalUploadProgress();
};
})(this));
this.on("canceled", (function(_this) {
return function(file) {
return _this.emit("complete", file);
};
})(this));
this.on("complete", (function(_this) {
return function(file) {
if (_this.getUploadingFiles().length === 0 && _this.getQueuedFiles().length === 0) {
return setTimeout((function() {
return _this.emit("queuecomplete");
}), 0);
}
};
})(this));
noPropagation = function(e) {
e.stopPropagation();
if (e.preventDefault) {
return e.preventDefault();
} else {
return e.returnValue = false;
}
};
this.listeners = [
{
element: this.element,
events: {
"dragstart": (function(_this) {
return function(e) {
return _this.emit("dragstart", e);
};
})(this),
"dragenter": (function(_this) {
return function(e) {
noPropagation(e);
return _this.emit("dragenter", e);
};
})(this),
"dragover": (function(_this) {
return function(e) {
var efct;
try {
efct = e.dataTransfer.effectAllowed;
} catch (_error) {}
e.dataTransfer.dropEffect = 'move' === efct || 'linkMove' === efct ? 'move' : 'copy';
noPropagation(e);
return _this.emit("dragover", e);
};
})(this),
"dragleave": (function(_this) {
return function(e) {
return _this.emit("dragleave", e);
};
})(this),
"drop": (function(_this) {
return function(e) {
noPropagation(e);
return _this.drop(e);
};
})(this),
"dragend": (function(_this) {
return function(e) {
return _this.emit("dragend", e);
};
})(this)
}
}
];
this.clickableElements.forEach((function(_this) {
return function(clickableElement) {
return _this.listeners.push({
element: clickableElement,
events: {
"click": function(evt) {
if ((clickableElement !== _this.element) || (evt.target === _this.element || Dropzone.elementInside(evt.target, _this.element.querySelector(".dz-message")))) {
return _this.hiddenFileInput.click();
}
}
}
});
};
})(this));
this.enable();
return this.options.init.call(this);
};
Dropzone.prototype.destroy = function() {
var _ref;
this.disable();
this.removeAllFiles(true);
if ((_ref = this.hiddenFileInput) != null ? _ref.parentNode : void 0) {
this.hiddenFileInput.parentNode.removeChild(this.hiddenFileInput);
this.hiddenFileInput = null;
}
delete this.element.dropzone;
return Dropzone.instances.splice(Dropzone.instances.indexOf(this), 1);
};
Dropzone.prototype.updateTotalUploadProgress = function() {
var activeFiles, file, totalBytes, totalBytesSent, totalUploadProgress, _i, _len, _ref;
totalBytesSent = 0;
totalBytes = 0;
activeFiles = this.getActiveFiles();
if (activeFiles.length) {
_ref = this.getActiveFiles();
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
file = _ref[_i];
totalBytesSent += file.upload.bytesSent;
totalBytes += file.upload.total;
}
totalUploadProgress = 100 * totalBytesSent / totalBytes;
} else {
totalUploadProgress = 100;
}
return this.emit("totaluploadprogress", totalUploadProgress, totalBytes, totalBytesSent);
};
Dropzone.prototype._getParamName = function(n) {
if (typeof this.options.paramName === "function") {
return this.options.paramName(n);
} else {
return "" + this.options.paramName + (this.options.uploadMultiple ? "[" + n + "]" : "");
}
};
Dropzone.prototype.getFallbackForm = function() {
var existingFallback, fields, fieldsString, form;
if (existingFallback = this.getExistingFallback()) {
return existingFallback;
}
fieldsString = "";
fields = Dropzone.createElement(fieldsString);
if (this.element.tagName !== "FORM") {
form = Dropzone.createElement("");
form.appendChild(fields);
} else {
this.element.setAttribute("enctype", "multipart/form-data");
this.element.setAttribute("method", this.options.method);
}
return form != null ? form : fields;
};
Dropzone.prototype.getExistingFallback = function() {
var fallback, getFallback, tagName, _i, _len, _ref;
getFallback = function(elements) {
var el, _i, _len;
for (_i = 0, _len = elements.length; _i < _len; _i++) {
el = elements[_i];
if (/(^| )fallback($| )/.test(el.className)) {
return el;
}
}
};
_ref = ["div", "form"];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
tagName = _ref[_i];
if (fallback = getFallback(this.element.getElementsByTagName(tagName))) {
return fallback;
}
}
};
Dropzone.prototype.setupEventListeners = function() {
var elementListeners, event, listener, _i, _len, _ref, _results;
_ref = this.listeners;
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
elementListeners = _ref[_i];
_results.push((function() {
var _ref1, _results1;
_ref1 = elementListeners.events;
_results1 = [];
for (event in _ref1) {
listener = _ref1[event];
_results1.push(elementListeners.element.addEventListener(event, listener, false));
}
return _results1;
})());
}
return _results;
};
Dropzone.prototype.removeEventListeners = function() {
var elementListeners, event, listener, _i, _len, _ref, _results;
_ref = this.listeners;
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
elementListeners = _ref[_i];
_results.push((function() {
var _ref1, _results1;
_ref1 = elementListeners.events;
_results1 = [];
for (event in _ref1) {
listener = _ref1[event];
_results1.push(elementListeners.element.removeEventListener(event, listener, false));
}
return _results1;
})());
}
return _results;
};
Dropzone.prototype.disable = function() {
var file, _i, _len, _ref, _results;
this.clickableElements.forEach(function(element) {
return element.classList.remove("dz-clickable");
});
this.removeEventListeners();
_ref = this.files;
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
file = _ref[_i];
_results.push(this.cancelUpload(file));
}
return _results;
};
Dropzone.prototype.enable = function() {
this.clickableElements.forEach(function(element) {
return element.classList.add("dz-clickable");
});
return this.setupEventListeners();
};
Dropzone.prototype.filesize = function(size) {
var cutoff, i, selectedSize, selectedUnit, unit, units, _i, _len;
units = ['TB', 'GB', 'MB', 'KB', 'b'];
selectedSize = selectedUnit = null;
for (i = _i = 0, _len = units.length; _i < _len; i = ++_i) {
unit = units[i];
cutoff = Math.pow(this.options.filesizeBase, 4 - i) / 10;
if (size >= cutoff) {
selectedSize = size / Math.pow(this.options.filesizeBase, 4 - i);
selectedUnit = unit;
break;
}
}
selectedSize = Math.round(10 * selectedSize) / 10;
return "" + selectedSize + " " + selectedUnit;
};
Dropzone.prototype._updateMaxFilesReachedClass = function() {
if ((this.options.maxFiles != null) && this.getAcceptedFiles().length >= this.options.maxFiles) {
if (this.getAcceptedFiles().length === this.options.maxFiles) {
this.emit('maxfilesreached', this.files);
}
return this.element.classList.add("dz-max-files-reached");
} else {
return this.element.classList.remove("dz-max-files-reached");
}
};
Dropzone.prototype.drop = function(e) {
var files, items;
if (!e.dataTransfer) {
return;
}
this.emit("drop", e);
files = e.dataTransfer.files;
if (files.length) {
items = e.dataTransfer.items;
if (items && items.length && (items[0].webkitGetAsEntry != null)) {
this._addFilesFromItems(items);
} else {
this.handleFiles(files);
}
}
};
Dropzone.prototype.paste = function(e) {
var items, _ref;
if ((e != null ? (_ref = e.clipboardData) != null ? _ref.items : void 0 : void 0) == null) {
return;
}
this.emit("paste", e);
items = e.clipboardData.items;
if (items.length) {
return this._addFilesFromItems(items);
}
};
Dropzone.prototype.handleFiles = function(files) {
var file, _i, _len, _results;
_results = [];
for (_i = 0, _len = files.length; _i < _len; _i++) {
file = files[_i];
_results.push(this.addFile(file));
}
return _results;
};
Dropzone.prototype._addFilesFromItems = function(items) {
var entry, item, _i, _len, _results;
_results = [];
for (_i = 0, _len = items.length; _i < _len; _i++) {
item = items[_i];
if ((item.webkitGetAsEntry != null) && (entry = item.webkitGetAsEntry())) {
if (entry.isFile) {
_results.push(this.addFile(item.getAsFile()));
} else if (entry.isDirectory) {
_results.push(this._addFilesFromDirectory(entry, entry.name));
} else {
_results.push(void 0);
}
} else if (item.getAsFile != null) {
if ((item.kind == null) || item.kind === "file") {
_results.push(this.addFile(item.getAsFile()));
} else {
_results.push(void 0);
}
} else {
_results.push(void 0);
}
}
return _results;
};
Dropzone.prototype._addFilesFromDirectory = function(directory, path) {
var dirReader, entriesReader;
dirReader = directory.createReader();
entriesReader = (function(_this) {
return function(entries) {
var entry, _i, _len;
for (_i = 0, _len = entries.length; _i < _len; _i++) {
entry = entries[_i];
if (entry.isFile) {
entry.file(function(file) {
if (_this.options.ignoreHiddenFiles && file.name.substring(0, 1) === '.') {
return;
}
file.fullPath = "" + path + "/" + file.name;
return _this.addFile(file);
});
} else if (entry.isDirectory) {
_this._addFilesFromDirectory(entry, "" + path + "/" + entry.name);
}
}
};
})(this);
return dirReader.readEntries(entriesReader, function(error) {
return typeof console !== "undefined" && console !== null ? typeof console.log === "function" ? console.log(error) : void 0 : void 0;
});
};
Dropzone.prototype.accept = function(file, done) {
if (file.size > this.options.maxFilesize * 1024 * 1024) {
return done(this.options.dictFileTooBig.replace("{{filesize}}", Math.round(file.size / 1024 / 10.24) / 100).replace("{{maxFilesize}}", this.options.maxFilesize));
} else if (!Dropzone.isValidFile(file, this.options.acceptedFiles)) {
return done(this.options.dictInvalidFileType);
} else if ((this.options.maxFiles != null) && this.getAcceptedFiles().length >= this.options.maxFiles) {
done(this.options.dictMaxFilesExceeded.replace("{{maxFiles}}", this.options.maxFiles));
return this.emit("maxfilesexceeded", file);
} else {
return this.options.accept.call(this, file, done);
}
};
Dropzone.prototype.addFile = function(file) {
file.upload = {
progress: 0,
total: file.size,
bytesSent: 0
};
this.files.push(file);
file.status = Dropzone.ADDED;
this.emit("addedfile", file);
this._enqueueThumbnail(file);
return this.accept(file, (function(_this) {
return function(error) {
if (error) {
file.accepted = false;
_this._errorProcessing([file], error);
} else {
file.accepted = true;
if (_this.options.autoQueue) {
_this.enqueueFile(file);
}
}
return _this._updateMaxFilesReachedClass();
};
})(this));
};
Dropzone.prototype.enqueueFiles = function(files) {
var file, _i, _len;
for (_i = 0, _len = files.length; _i < _len; _i++) {
file = files[_i];
this.enqueueFile(file);
}
return null;
};
Dropzone.prototype.enqueueFile = function(file) {
if (file.status === Dropzone.ADDED && file.accepted === true) {
file.status = Dropzone.QUEUED;
if (this.options.autoProcessQueue) {
return setTimeout(((function(_this) {
return function() {
return _this.processQueue();
};
})(this)), 0);
}
} else {
throw new Error("This file can't be queued because it has already been processed or was rejected.");
}
};
Dropzone.prototype._thumbnailQueue = [];
Dropzone.prototype._processingThumbnail = false;
Dropzone.prototype._enqueueThumbnail = function(file) {
if (this.options.createImageThumbnails && file.type.match(/image.*/) && file.size <= this.options.maxThumbnailFilesize * 1024 * 1024) {
this._thumbnailQueue.push(file);
return setTimeout(((function(_this) {
return function() {
return _this._processThumbnailQueue();
};
})(this)), 0);
}
};
Dropzone.prototype._processThumbnailQueue = function() {
if (this._processingThumbnail || this._thumbnailQueue.length === 0) {
return;
}
this._processingThumbnail = true;
return this.createThumbnail(this._thumbnailQueue.shift(), (function(_this) {
return function() {
_this._processingThumbnail = false;
return _this._processThumbnailQueue();
};
})(this));
};
Dropzone.prototype.removeFile = function(file) {
if (file.status === Dropzone.UPLOADING) {
this.cancelUpload(file);
}
this.files = without(this.files, file);
this.emit("removedfile", file);
if (this.files.length === 0) {
return this.emit("reset");
}
};
Dropzone.prototype.removeAllFiles = function(cancelIfNecessary) {
var file, _i, _len, _ref;
if (cancelIfNecessary == null) {
cancelIfNecessary = false;
}
_ref = this.files.slice();
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
file = _ref[_i];
if (file.status !== Dropzone.UPLOADING || cancelIfNecessary) {
this.removeFile(file);
}
}
return null;
};
Dropzone.prototype.createThumbnail = function(file, callback) {
var fileReader;
fileReader = new FileReader;
fileReader.onload = (function(_this) {
return function() {
if (file.type === "image/svg+xml") {
_this.emit("thumbnail", file, fileReader.result);
if (callback != null) {
callback();
}
return;
}
return _this.createThumbnailFromUrl(file, fileReader.result, callback);
};
})(this);
return fileReader.readAsDataURL(file);
};
Dropzone.prototype.createThumbnailFromUrl = function(file, imageUrl, callback) {
var img;
img = document.createElement("img");
img.onload = (function(_this) {
return function() {
var canvas, ctx, resizeInfo, thumbnail, _ref, _ref1, _ref2, _ref3;
file.width = img.width;
file.height = img.height;
resizeInfo = _this.options.resize.call(_this, file);
if (resizeInfo.trgWidth == null) {
resizeInfo.trgWidth = resizeInfo.optWidth;
}
if (resizeInfo.trgHeight == null) {
resizeInfo.trgHeight = resizeInfo.optHeight;
}
canvas = document.createElement("canvas");
ctx = canvas.getContext("2d");
canvas.width = resizeInfo.trgWidth;
canvas.height = resizeInfo.trgHeight;
drawImageIOSFix(ctx, img, (_ref = resizeInfo.srcX) != null ? _ref : 0, (_ref1 = resizeInfo.srcY) != null ? _ref1 : 0, resizeInfo.srcWidth, resizeInfo.srcHeight, (_ref2 = resizeInfo.trgX) != null ? _ref2 : 0, (_ref3 = resizeInfo.trgY) != null ? _ref3 : 0, resizeInfo.trgWidth, resizeInfo.trgHeight);
thumbnail = canvas.toDataURL("image/png");
_this.emit("thumbnail", file, thumbnail);
if (callback != null) {
return callback();
}
};
})(this);
if (callback != null) {
img.onerror = callback;
}
return img.src = imageUrl;
};
Dropzone.prototype.processQueue = function() {
var i, parallelUploads, processingLength, queuedFiles;
parallelUploads = this.options.parallelUploads;
processingLength = this.getUploadingFiles().length;
i = processingLength;
if (processingLength >= parallelUploads) {
return;
}
queuedFiles = this.getQueuedFiles();
if (!(queuedFiles.length > 0)) {
return;
}
if (this.options.uploadMultiple) {
return this.processFiles(queuedFiles.slice(0, parallelUploads - processingLength));
} else {
while (i < parallelUploads) {
if (!queuedFiles.length) {
return;
}
this.processFile(queuedFiles.shift());
i++;
}
}
};
Dropzone.prototype.processFile = function(file) {
return this.processFiles([file]);
};
Dropzone.prototype.processFiles = function(files) {
var file, _i, _len;
for (_i = 0, _len = files.length; _i < _len; _i++) {
file = files[_i];
file.processing = true;
file.status = Dropzone.UPLOADING;
this.emit("processing", file);
}
if (this.options.uploadMultiple) {
this.emit("processingmultiple", files);
}
return this.uploadFiles(files);
};
Dropzone.prototype._getFilesWithXhr = function(xhr) {
var file, files;
return files = (function() {
var _i, _len, _ref, _results;
_ref = this.files;
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
file = _ref[_i];
if (file.xhr === xhr) {
_results.push(file);
}
}
return _results;
}).call(this);
};
Dropzone.prototype.cancelUpload = function(file) {
var groupedFile, groupedFiles, _i, _j, _len, _len1, _ref;
if (file.status === Dropzone.UPLOADING) {
groupedFiles = this._getFilesWithXhr(file.xhr);
for (_i = 0, _len = groupedFiles.length; _i < _len; _i++) {
groupedFile = groupedFiles[_i];
groupedFile.status = Dropzone.CANCELED;
}
file.xhr.abort();
for (_j = 0, _len1 = groupedFiles.length; _j < _len1; _j++) {
groupedFile = groupedFiles[_j];
this.emit("canceled", groupedFile);
}
if (this.options.uploadMultiple) {
this.emit("canceledmultiple", groupedFiles);
}
} else if ((_ref = file.status) === Dropzone.ADDED || _ref === Dropzone.QUEUED) {
file.status = Dropzone.CANCELED;
this.emit("canceled", file);
if (this.options.uploadMultiple) {
this.emit("canceledmultiple", [file]);
}
}
if (this.options.autoProcessQueue) {
return this.processQueue();
}
};
resolveOption = function() {
var args, option;
option = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
if (typeof option === 'function') {
return option.apply(this, args);
}
return option;
};
Dropzone.prototype.uploadFile = function(file) {
return this.uploadFiles([file]);
};
Dropzone.prototype.uploadFiles = function(files) {
var file, formData, handleError, headerName, headerValue, headers, i, input, inputName, inputType, key, method, option, progressObj, response, updateProgress, url, value, xhr, _i, _j, _k, _l, _len, _len1, _len2, _len3, _m, _ref, _ref1, _ref2, _ref3, _ref4, _ref5;
xhr = new XMLHttpRequest();
for (_i = 0, _len = files.length; _i < _len; _i++) {
file = files[_i];
file.xhr = xhr;
}
method = resolveOption(this.options.method, files);
url = resolveOption(this.options.url, files);
xhr.open(method, url, true);
xhr.withCredentials = !!this.options.withCredentials;
response = null;
handleError = (function(_this) {
return function() {
var _j, _len1, _results;
_results = [];
for (_j = 0, _len1 = files.length; _j < _len1; _j++) {
file = files[_j];
_results.push(_this._errorProcessing(files, response || _this.options.dictResponseError.replace("{{statusCode}}", xhr.status), xhr));
}
return _results;
};
})(this);
updateProgress = (function(_this) {
return function(e) {
var allFilesFinished, progress, _j, _k, _l, _len1, _len2, _len3, _results;
if (e != null) {
progress = 100 * e.loaded / e.total;
for (_j = 0, _len1 = files.length; _j < _len1; _j++) {
file = files[_j];
file.upload = {
progress: progress,
total: e.total,
bytesSent: e.loaded
};
}
} else {
allFilesFinished = true;
progress = 100;
for (_k = 0, _len2 = files.length; _k < _len2; _k++) {
file = files[_k];
if (!(file.upload.progress === 100 && file.upload.bytesSent === file.upload.total)) {
allFilesFinished = false;
}
file.upload.progress = progress;
file.upload.bytesSent = file.upload.total;
}
if (allFilesFinished) {
return;
}
}
_results = [];
for (_l = 0, _len3 = files.length; _l < _len3; _l++) {
file = files[_l];
_results.push(_this.emit("uploadprogress", file, progress, file.upload.bytesSent));
}
return _results;
};
})(this);
xhr.onload = (function(_this) {
return function(e) {
var _ref;
if (files[0].status === Dropzone.CANCELED) {
return;
}
if (xhr.readyState !== 4) {
return;
}
response = xhr.responseText;
if (xhr.getResponseHeader("content-type") && ~xhr.getResponseHeader("content-type").indexOf("application/json")) {
try {
response = JSON.parse(response);
} catch (_error) {
e = _error;
response = "Invalid JSON response from server.";
}
}
updateProgress();
if (!((200 <= (_ref = xhr.status) && _ref < 300))) {
return handleError();
} else {
return _this._finished(files, response, e);
}
};
})(this);
xhr.onerror = (function(_this) {
return function() {
if (files[0].status === Dropzone.CANCELED) {
return;
}
return handleError();
};
})(this);
progressObj = (_ref = xhr.upload) != null ? _ref : xhr;
progressObj.onprogress = updateProgress;
headers = {
"Accept": "application/json",
"Cache-Control": "no-cache",
"X-Requested-With": "XMLHttpRequest"
};
if (this.options.headers) {
extend(headers, this.options.headers);
}
for (headerName in headers) {
headerValue = headers[headerName];
xhr.setRequestHeader(headerName, headerValue);
}
formData = new FormData();
if (this.options.params) {
_ref1 = this.options.params;
for (key in _ref1) {
value = _ref1[key];
formData.append(key, value);
}
}
for (_j = 0, _len1 = files.length; _j < _len1; _j++) {
file = files[_j];
this.emit("sending", file, xhr, formData);
}
if (this.options.uploadMultiple) {
this.emit("sendingmultiple", files, xhr, formData);
}
if (this.element.tagName === "FORM") {
_ref2 = this.element.querySelectorAll("input, textarea, select, button");
for (_k = 0, _len2 = _ref2.length; _k < _len2; _k++) {
input = _ref2[_k];
inputName = input.getAttribute("name");
inputType = input.getAttribute("type");
if (input.tagName === "SELECT" && input.hasAttribute("multiple")) {
_ref3 = input.options;
for (_l = 0, _len3 = _ref3.length; _l < _len3; _l++) {
option = _ref3[_l];
if (option.selected) {
formData.append(inputName, option.value);
}
}
} else if (!inputType || ((_ref4 = inputType.toLowerCase()) !== "checkbox" && _ref4 !== "radio") || input.checked) {
formData.append(inputName, input.value);
}
}
}
for (i = _m = 0, _ref5 = files.length - 1; 0 <= _ref5 ? _m <= _ref5 : _m >= _ref5; i = 0 <= _ref5 ? ++_m : --_m) {
formData.append(this._getParamName(i), files[i], files[i].name);
}
return xhr.send(formData);
};
Dropzone.prototype._finished = function(files, responseText, e) {
var file, _i, _len;
for (_i = 0, _len = files.length; _i < _len; _i++) {
file = files[_i];
file.status = Dropzone.SUCCESS;
this.emit("success", file, responseText, e);
this.emit("complete", file);
}
if (this.options.uploadMultiple) {
this.emit("successmultiple", files, responseText, e);
this.emit("completemultiple", files);
}
if (this.options.autoProcessQueue) {
return this.processQueue();
}
};
Dropzone.prototype._errorProcessing = function(files, message, xhr) {
var file, _i, _len;
for (_i = 0, _len = files.length; _i < _len; _i++) {
file = files[_i];
file.status = Dropzone.ERROR;
this.emit("error", file, message, xhr);
this.emit("complete", file);
}
if (this.options.uploadMultiple) {
this.emit("errormultiple", files, message, xhr);
this.emit("completemultiple", files);
}
if (this.options.autoProcessQueue) {
return this.processQueue();
}
};
return Dropzone;
})(Emitter);
Dropzone.version = "4.0.1";
Dropzone.options = {};
Dropzone.optionsForElement = function(element) {
if (element.getAttribute("id")) {
return Dropzone.options[camelize(element.getAttribute("id"))];
} else {
return void 0;
}
};
Dropzone.instances = [];
Dropzone.forElement = function(element) {
if (typeof element === "string") {
element = document.querySelector(element);
}
if ((element != null ? element.dropzone : void 0) == null) {
throw new Error("No Dropzone found for given element. This is probably because you're trying to access it before Dropzone had the time to initialize. Use the `init` option to setup any additional observers on your Dropzone.");
}
return element.dropzone;
};
Dropzone.autoDiscover = true;
Dropzone.discover = function() {
var checkElements, dropzone, dropzones, _i, _len, _results;
if (document.querySelectorAll) {
dropzones = document.querySelectorAll(".dropzone");
} else {
dropzones = [];
checkElements = function(elements) {
var el, _i, _len, _results;
_results = [];
for (_i = 0, _len = elements.length; _i < _len; _i++) {
el = elements[_i];
if (/(^| )dropzone($| )/.test(el.className)) {
_results.push(dropzones.push(el));
} else {
_results.push(void 0);
}
}
return _results;
};
checkElements(document.getElementsByTagName("div"));
checkElements(document.getElementsByTagName("form"));
}
_results = [];
for (_i = 0, _len = dropzones.length; _i < _len; _i++) {
dropzone = dropzones[_i];
if (Dropzone.optionsForElement(dropzone) !== false) {
_results.push(new Dropzone(dropzone));
} else {
_results.push(void 0);
}
}
return _results;
};
Dropzone.blacklistedBrowsers = [/opera.*Macintosh.*version\/12/i];
Dropzone.isBrowserSupported = function() {
var capableBrowser, regex, _i, _len, _ref;
capableBrowser = true;
if (window.File && window.FileReader && window.FileList && window.Blob && window.FormData && document.querySelector) {
if (!("classList" in document.createElement("a"))) {
capableBrowser = false;
} else {
_ref = Dropzone.blacklistedBrowsers;
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
regex = _ref[_i];
if (regex.test(navigator.userAgent)) {
capableBrowser = false;
continue;
}
}
}
} else {
capableBrowser = false;
}
return capableBrowser;
};
without = function(list, rejectedItem) {
var item, _i, _len, _results;
_results = [];
for (_i = 0, _len = list.length; _i < _len; _i++) {
item = list[_i];
if (item !== rejectedItem) {
_results.push(item);
}
}
return _results;
};
camelize = function(str) {
return str.replace(/[\-_](\w)/g, function(match) {
return match.charAt(1).toUpperCase();
});
};
Dropzone.createElement = function(string) {
var div;
div = document.createElement("div");
div.innerHTML = string;
return div.childNodes[0];
};
Dropzone.elementInside = function(element, container) {
if (element === container) {
return true;
}
while (element = element.parentNode) {
if (element === container) {
return true;
}
}
return false;
};
Dropzone.getElement = function(el, name) {
var element;
if (typeof el === "string") {
element = document.querySelector(el);
} else if (el.nodeType != null) {
element = el;
}
if (element == null) {
throw new Error("Invalid `" + name + "` option provided. Please provide a CSS selector or a plain HTML element.");
}
return element;
};
Dropzone.getElements = function(els, name) {
var e, el, elements, _i, _j, _len, _len1, _ref;
if (els instanceof Array) {
elements = [];
try {
for (_i = 0, _len = els.length; _i < _len; _i++) {
el = els[_i];
elements.push(this.getElement(el, name));
}
} catch (_error) {
e = _error;
elements = null;
}
} else if (typeof els === "string") {
elements = [];
_ref = document.querySelectorAll(els);
for (_j = 0, _len1 = _ref.length; _j < _len1; _j++) {
el = _ref[_j];
elements.push(el);
}
} else if (els.nodeType != null) {
elements = [els];
}
if (!((elements != null) && elements.length)) {
throw new Error("Invalid `" + name + "` option provided. Please provide a CSS selector, a plain HTML element or a list of those.");
}
return elements;
};
Dropzone.confirm = function(question, accepted, rejected) {
if (window.confirm(question)) {
return accepted();
} else if (rejected != null) {
return rejected();
}
};
Dropzone.isValidFile = function(file, acceptedFiles) {
var baseMimeType, mimeType, validType, _i, _len;
if (!acceptedFiles) {
return true;
}
acceptedFiles = acceptedFiles.split(",");
mimeType = file.type;
baseMimeType = mimeType.replace(/\/.*$/, "");
for (_i = 0, _len = acceptedFiles.length; _i < _len; _i++) {
validType = acceptedFiles[_i];
validType = validType.trim();
if (validType.charAt(0) === ".") {
if (file.name.toLowerCase().indexOf(validType.toLowerCase(), file.name.length - validType.length) !== -1) {
return true;
}
} else if (/\/\*$/.test(validType)) {
if (baseMimeType === validType.replace(/\/.*$/, "")) {
return true;
}
} else {
if (mimeType === validType) {
return true;
}
}
}
return false;
};
if (typeof jQuery !== "undefined" && jQuery !== null) {
jQuery.fn.dropzone = function(options) {
return this.each(function() {
return new Dropzone(this, options);
});
};
}
if (typeof module !== "undefined" && module !== null) {
module.exports = Dropzone;
} else {
window.Dropzone = Dropzone;
}
Dropzone.ADDED = "added";
Dropzone.QUEUED = "queued";
Dropzone.ACCEPTED = Dropzone.QUEUED;
Dropzone.UPLOADING = "uploading";
Dropzone.PROCESSING = Dropzone.UPLOADING;
Dropzone.CANCELED = "canceled";
Dropzone.ERROR = "error";
Dropzone.SUCCESS = "success";
/*
Bugfix for iOS 6 and 7
Source: http://stackoverflow.com/questions/11929099/html5-canvas-drawimage-ratio-bug-ios
based on the work of https://github.com/stomita/ios-imagefile-megapixel
*/
detectVerticalSquash = function(img) {
var alpha, canvas, ctx, data, ey, ih, iw, py, ratio, sy;
iw = img.naturalWidth;
ih = img.naturalHeight;
canvas = document.createElement("canvas");
canvas.width = 1;
canvas.height = ih;
ctx = canvas.getContext("2d");
ctx.drawImage(img, 0, 0);
data = ctx.getImageData(0, 0, 1, ih).data;
sy = 0;
ey = ih;
py = ih;
while (py > sy) {
alpha = data[(py - 1) * 4 + 3];
if (alpha === 0) {
ey = py;
} else {
sy = py;
}
py = (ey + sy) >> 1;
}
ratio = py / ih;
if (ratio === 0) {
return 1;
} else {
return ratio;
}
};
drawImageIOSFix = function(ctx, img, sx, sy, sw, sh, dx, dy, dw, dh) {
var vertSquashRatio;
vertSquashRatio = detectVerticalSquash(img);
return ctx.drawImage(img, sx, sy, sw, sh, dx, dy, dw, dh / vertSquashRatio);
};
/*
* contentloaded.js
*
* Author: Diego Perini (diego.perini at gmail.com)
* Summary: cross-browser wrapper for DOMContentLoaded
* Updated: 20101020
* License: MIT
* Version: 1.2
*
* URL:
* http://javascript.nwbox.com/ContentLoaded/
* http://javascript.nwbox.com/ContentLoaded/MIT-LICENSE
*/
contentLoaded = function(win, fn) {
var add, doc, done, init, poll, pre, rem, root, top;
done = false;
top = true;
doc = win.document;
root = doc.documentElement;
add = (doc.addEventListener ? "addEventListener" : "attachEvent");
rem = (doc.addEventListener ? "removeEventListener" : "detachEvent");
pre = (doc.addEventListener ? "" : "on");
init = function(e) {
if (e.type === "readystatechange" && doc.readyState !== "complete") {
return;
}
(e.type === "load" ? win : doc)[rem](pre + e.type, init, false);
if (!done && (done = true)) {
return fn.call(win, e.type || e);
}
};
poll = function() {
var e;
try {
root.doScroll("left");
} catch (_error) {
e = _error;
setTimeout(poll, 50);
return;
}
return init("poll");
};
if (doc.readyState !== "complete") {
if (doc.createEventObject && root.doScroll) {
try {
top = !win.frameElement;
} catch (_error) {}
if (top) {
poll();
}
}
doc[add](pre + "DOMContentLoaded", init, false);
doc[add](pre + "readystatechange", init, false);
return win[add](pre + "load", init, false);
}
};
Dropzone._autoDiscoverFunction = function() {
if (Dropzone.autoDiscover) {
return Dropzone.discover();
}
};
contentLoaded(window, Dropzone._autoDiscoverFunction);
}).call(this);
;
(function(){
// Copyright (c) 2005 Tom Wu
// All Rights Reserved.
// See "LICENSE" for details.
// Basic JavaScript BN library - subset useful for RSA encryption.
// Bits per digit
var dbits;
// JavaScript engine analysis
var canary = 0xdeadbeefcafe;
var j_lm = ((canary&0xffffff)==0xefcafe);
// (public) Constructor
function BigInteger(a,b,c) {
if(a != null)
if("number" == typeof a) this.fromNumber(a,b,c);
else if(b == null && "string" != typeof a) this.fromString(a,256);
else this.fromString(a,b);
}
// return new, unset BigInteger
function nbi() { return new BigInteger(null); }
// am: Compute w_j += (x*this_i), propagate carries,
// c is initial carry, returns final carry.
// c < 3*dvalue, x < 2*dvalue, this_i < dvalue
// We need to select the fastest one that works in this environment.
// am1: use a single mult and divide to get the high bits,
// max digit bits should be 26 because
// max internal value = 2*dvalue^2-2*dvalue (< 2^53)
function am1(i,x,w,j,c,n) {
while(--n >= 0) {
var v = x*this[i++]+w[j]+c;
c = Math.floor(v/0x4000000);
w[j++] = v&0x3ffffff;
}
return c;
}
// am2 avoids a big mult-and-extract completely.
// Max digit bits should be <= 30 because we do bitwise ops
// on values up to 2*hdvalue^2-hdvalue-1 (< 2^31)
function am2(i,x,w,j,c,n) {
var xl = x&0x7fff, xh = x>>15;
while(--n >= 0) {
var l = this[i]&0x7fff;
var h = this[i++]>>15;
var m = xh*l+h*xl;
l = xl*l+((m&0x7fff)<<15)+w[j]+(c&0x3fffffff);
c = (l>>>30)+(m>>>15)+xh*h+(c>>>30);
w[j++] = l&0x3fffffff;
}
return c;
}
// Alternately, set max digit bits to 28 since some
// browsers slow down when dealing with 32-bit numbers.
function am3(i,x,w,j,c,n) {
var xl = x&0x3fff, xh = x>>14;
while(--n >= 0) {
var l = this[i]&0x3fff;
var h = this[i++]>>14;
var m = xh*l+h*xl;
l = xl*l+((m&0x3fff)<<14)+w[j]+c;
c = (l>>28)+(m>>14)+xh*h;
w[j++] = l&0xfffffff;
}
return c;
}
var inBrowser = typeof navigator !== "undefined";
if(inBrowser && j_lm && (navigator.appName == "Microsoft Internet Explorer")) {
BigInteger.prototype.am = am2;
dbits = 30;
}
else if(inBrowser && j_lm && (navigator.appName != "Netscape")) {
BigInteger.prototype.am = am1;
dbits = 26;
}
else { // Mozilla/Netscape seems to prefer am3
BigInteger.prototype.am = am3;
dbits = 28;
}
BigInteger.prototype.DB = dbits;
BigInteger.prototype.DM = ((1<= 0; --i) r[i] = this[i];
r.t = this.t;
r.s = this.s;
}
// (protected) set from integer value x, -DV <= x < DV
function bnpFromInt(x) {
this.t = 1;
this.s = (x<0)?-1:0;
if(x > 0) this[0] = x;
else if(x < -1) this[0] = x+this.DV;
else this.t = 0;
}
// return bigint initialized to value
function nbv(i) { var r = nbi(); r.fromInt(i); return r; }
// (protected) set from string and radix
function bnpFromString(s,b) {
var k;
if(b == 16) k = 4;
else if(b == 8) k = 3;
else if(b == 256) k = 8; // byte array
else if(b == 2) k = 1;
else if(b == 32) k = 5;
else if(b == 4) k = 2;
else { this.fromRadix(s,b); return; }
this.t = 0;
this.s = 0;
var i = s.length, mi = false, sh = 0;
while(--i >= 0) {
var x = (k==8)?s[i]&0xff:intAt(s,i);
if(x < 0) {
if(s.charAt(i) == "-") mi = true;
continue;
}
mi = false;
if(sh == 0)
this[this.t++] = x;
else if(sh+k > this.DB) {
this[this.t-1] |= (x&((1<<(this.DB-sh))-1))<>(this.DB-sh));
}
else
this[this.t-1] |= x<= this.DB) sh -= this.DB;
}
if(k == 8 && (s[0]&0x80) != 0) {
this.s = -1;
if(sh > 0) this[this.t-1] |= ((1<<(this.DB-sh))-1)< 0 && this[this.t-1] == c) --this.t;
}
// (public) return string representation in given radix
function bnToString(b) {
if(this.s < 0) return "-"+this.negate().toString(b);
var k;
if(b == 16) k = 4;
else if(b == 8) k = 3;
else if(b == 2) k = 1;
else if(b == 32) k = 5;
else if(b == 4) k = 2;
else return this.toRadix(b);
var km = (1< 0) {
if(p < this.DB && (d = this[i]>>p) > 0) { m = true; r = int2char(d); }
while(i >= 0) {
if(p < k) {
d = (this[i]&((1<>(p+=this.DB-k);
}
else {
d = (this[i]>>(p-=k))&km;
if(p <= 0) { p += this.DB; --i; }
}
if(d > 0) m = true;
if(m) r += int2char(d);
}
}
return m?r:"0";
}
// (public) -this
function bnNegate() { var r = nbi(); BigInteger.ZERO.subTo(this,r); return r; }
// (public) |this|
function bnAbs() { return (this.s<0)?this.negate():this; }
// (public) return + if this > a, - if this < a, 0 if equal
function bnCompareTo(a) {
var r = this.s-a.s;
if(r != 0) return r;
var i = this.t;
r = i-a.t;
if(r != 0) return (this.s<0)?-r:r;
while(--i >= 0) if((r=this[i]-a[i]) != 0) return r;
return 0;
}
// returns bit length of the integer x
function nbits(x) {
var r = 1, t;
if((t=x>>>16) != 0) { x = t; r += 16; }
if((t=x>>8) != 0) { x = t; r += 8; }
if((t=x>>4) != 0) { x = t; r += 4; }
if((t=x>>2) != 0) { x = t; r += 2; }
if((t=x>>1) != 0) { x = t; r += 1; }
return r;
}
// (public) return the number of bits in "this"
function bnBitLength() {
if(this.t <= 0) return 0;
return this.DB*(this.t-1)+nbits(this[this.t-1]^(this.s&this.DM));
}
// (protected) r = this << n*DB
function bnpDLShiftTo(n,r) {
var i;
for(i = this.t-1; i >= 0; --i) r[i+n] = this[i];
for(i = n-1; i >= 0; --i) r[i] = 0;
r.t = this.t+n;
r.s = this.s;
}
// (protected) r = this >> n*DB
function bnpDRShiftTo(n,r) {
for(var i = n; i < this.t; ++i) r[i-n] = this[i];
r.t = Math.max(this.t-n,0);
r.s = this.s;
}
// (protected) r = this << n
function bnpLShiftTo(n,r) {
var bs = n%this.DB;
var cbs = this.DB-bs;
var bm = (1<= 0; --i) {
r[i+ds+1] = (this[i]>>cbs)|c;
c = (this[i]&bm)<= 0; --i) r[i] = 0;
r[ds] = c;
r.t = this.t+ds+1;
r.s = this.s;
r.clamp();
}
// (protected) r = this >> n
function bnpRShiftTo(n,r) {
r.s = this.s;
var ds = Math.floor(n/this.DB);
if(ds >= this.t) { r.t = 0; return; }
var bs = n%this.DB;
var cbs = this.DB-bs;
var bm = (1<>bs;
for(var i = ds+1; i < this.t; ++i) {
r[i-ds-1] |= (this[i]&bm)<>bs;
}
if(bs > 0) r[this.t-ds-1] |= (this.s&bm)<>= this.DB;
}
if(a.t < this.t) {
c -= a.s;
while(i < this.t) {
c += this[i];
r[i++] = c&this.DM;
c >>= this.DB;
}
c += this.s;
}
else {
c += this.s;
while(i < a.t) {
c -= a[i];
r[i++] = c&this.DM;
c >>= this.DB;
}
c -= a.s;
}
r.s = (c<0)?-1:0;
if(c < -1) r[i++] = this.DV+c;
else if(c > 0) r[i++] = c;
r.t = i;
r.clamp();
}
// (protected) r = this * a, r != this,a (HAC 14.12)
// "this" should be the larger one if appropriate.
function bnpMultiplyTo(a,r) {
var x = this.abs(), y = a.abs();
var i = x.t;
r.t = i+y.t;
while(--i >= 0) r[i] = 0;
for(i = 0; i < y.t; ++i) r[i+x.t] = x.am(0,y[i],r,i,0,x.t);
r.s = 0;
r.clamp();
if(this.s != a.s) BigInteger.ZERO.subTo(r,r);
}
// (protected) r = this^2, r != this (HAC 14.16)
function bnpSquareTo(r) {
var x = this.abs();
var i = r.t = 2*x.t;
while(--i >= 0) r[i] = 0;
for(i = 0; i < x.t-1; ++i) {
var c = x.am(i,x[i],r,2*i,0,1);
if((r[i+x.t]+=x.am(i+1,2*x[i],r,2*i+1,c,x.t-i-1)) >= x.DV) {
r[i+x.t] -= x.DV;
r[i+x.t+1] = 1;
}
}
if(r.t > 0) r[r.t-1] += x.am(i,x[i],r,2*i,0,1);
r.s = 0;
r.clamp();
}
// (protected) divide this by m, quotient and remainder to q, r (HAC 14.20)
// r != q, this != m. q or r may be null.
function bnpDivRemTo(m,q,r) {
var pm = m.abs();
if(pm.t <= 0) return;
var pt = this.abs();
if(pt.t < pm.t) {
if(q != null) q.fromInt(0);
if(r != null) this.copyTo(r);
return;
}
if(r == null) r = nbi();
var y = nbi(), ts = this.s, ms = m.s;
var nsh = this.DB-nbits(pm[pm.t-1]); // normalize modulus
if(nsh > 0) { pm.lShiftTo(nsh,y); pt.lShiftTo(nsh,r); }
else { pm.copyTo(y); pt.copyTo(r); }
var ys = y.t;
var y0 = y[ys-1];
if(y0 == 0) return;
var yt = y0*(1<1)?y[ys-2]>>this.F2:0);
var d1 = this.FV/yt, d2 = (1<= 0) {
r[r.t++] = 1;
r.subTo(t,r);
}
BigInteger.ONE.dlShiftTo(ys,t);
t.subTo(y,y); // "negative" y so we can replace sub with am later
while(y.t < ys) y[y.t++] = 0;
while(--j >= 0) {
// Estimate quotient digit
var qd = (r[--i]==y0)?this.DM:Math.floor(r[i]*d1+(r[i-1]+e)*d2);
if((r[i]+=y.am(0,qd,r,j,0,ys)) < qd) { // Try it out
y.dlShiftTo(j,t);
r.subTo(t,r);
while(r[i] < --qd) r.subTo(t,r);
}
}
if(q != null) {
r.drShiftTo(ys,q);
if(ts != ms) BigInteger.ZERO.subTo(q,q);
}
r.t = ys;
r.clamp();
if(nsh > 0) r.rShiftTo(nsh,r); // Denormalize remainder
if(ts < 0) BigInteger.ZERO.subTo(r,r);
}
// (public) this mod a
function bnMod(a) {
var r = nbi();
this.abs().divRemTo(a,null,r);
if(this.s < 0 && r.compareTo(BigInteger.ZERO) > 0) a.subTo(r,r);
return r;
}
// Modular reduction using "classic" algorithm
function Classic(m) { this.m = m; }
function cConvert(x) {
if(x.s < 0 || x.compareTo(this.m) >= 0) return x.mod(this.m);
else return x;
}
function cRevert(x) { return x; }
function cReduce(x) { x.divRemTo(this.m,null,x); }
function cMulTo(x,y,r) { x.multiplyTo(y,r); this.reduce(r); }
function cSqrTo(x,r) { x.squareTo(r); this.reduce(r); }
Classic.prototype.convert = cConvert;
Classic.prototype.revert = cRevert;
Classic.prototype.reduce = cReduce;
Classic.prototype.mulTo = cMulTo;
Classic.prototype.sqrTo = cSqrTo;
// (protected) return "-1/this % 2^DB"; useful for Mont. reduction
// justification:
// xy == 1 (mod m)
// xy = 1+km
// xy(2-xy) = (1+km)(1-km)
// x[y(2-xy)] = 1-k^2m^2
// x[y(2-xy)] == 1 (mod m^2)
// if y is 1/x mod m, then y(2-xy) is 1/x mod m^2
// should reduce x and y(2-xy) by m^2 at each step to keep size bounded.
// JS multiply "overflows" differently from C/C++, so care is needed here.
function bnpInvDigit() {
if(this.t < 1) return 0;
var x = this[0];
if((x&1) == 0) return 0;
var y = x&3; // y == 1/x mod 2^2
y = (y*(2-(x&0xf)*y))&0xf; // y == 1/x mod 2^4
y = (y*(2-(x&0xff)*y))&0xff; // y == 1/x mod 2^8
y = (y*(2-(((x&0xffff)*y)&0xffff)))&0xffff; // y == 1/x mod 2^16
// last step - calculate inverse mod DV directly;
// assumes 16 < DB <= 32 and assumes ability to handle 48-bit ints
y = (y*(2-x*y%this.DV))%this.DV; // y == 1/x mod 2^dbits
// we really want the negative inverse, and -DV < y < DV
return (y>0)?this.DV-y:-y;
}
// Montgomery reduction
function Montgomery(m) {
this.m = m;
this.mp = m.invDigit();
this.mpl = this.mp&0x7fff;
this.mph = this.mp>>15;
this.um = (1<<(m.DB-15))-1;
this.mt2 = 2*m.t;
}
// xR mod m
function montConvert(x) {
var r = nbi();
x.abs().dlShiftTo(this.m.t,r);
r.divRemTo(this.m,null,r);
if(x.s < 0 && r.compareTo(BigInteger.ZERO) > 0) this.m.subTo(r,r);
return r;
}
// x/R mod m
function montRevert(x) {
var r = nbi();
x.copyTo(r);
this.reduce(r);
return r;
}
// x = x/R mod m (HAC 14.32)
function montReduce(x) {
while(x.t <= this.mt2) // pad x so am has enough room later
x[x.t++] = 0;
for(var i = 0; i < this.m.t; ++i) {
// faster way of calculating u0 = x[i]*mp mod DV
var j = x[i]&0x7fff;
var u0 = (j*this.mpl+(((j*this.mph+(x[i]>>15)*this.mpl)&this.um)<<15))&x.DM;
// use am to combine the multiply-shift-add into one call
j = i+this.m.t;
x[j] += this.m.am(0,u0,x,i,0,this.m.t);
// propagate carry
while(x[j] >= x.DV) { x[j] -= x.DV; x[++j]++; }
}
x.clamp();
x.drShiftTo(this.m.t,x);
if(x.compareTo(this.m) >= 0) x.subTo(this.m,x);
}
// r = "x^2/R mod m"; x != r
function montSqrTo(x,r) { x.squareTo(r); this.reduce(r); }
// r = "xy/R mod m"; x,y != r
function montMulTo(x,y,r) { x.multiplyTo(y,r); this.reduce(r); }
Montgomery.prototype.convert = montConvert;
Montgomery.prototype.revert = montRevert;
Montgomery.prototype.reduce = montReduce;
Montgomery.prototype.mulTo = montMulTo;
Montgomery.prototype.sqrTo = montSqrTo;
// (protected) true iff this is even
function bnpIsEven() { return ((this.t>0)?(this[0]&1):this.s) == 0; }
// (protected) this^e, e < 2^32, doing sqr and mul with "r" (HAC 14.79)
function bnpExp(e,z) {
if(e > 0xffffffff || e < 1) return BigInteger.ONE;
var r = nbi(), r2 = nbi(), g = z.convert(this), i = nbits(e)-1;
g.copyTo(r);
while(--i >= 0) {
z.sqrTo(r,r2);
if((e&(1< 0) z.mulTo(r2,g,r);
else { var t = r; r = r2; r2 = t; }
}
return z.revert(r);
}
// (public) this^e % m, 0 <= e < 2^32
function bnModPowInt(e,m) {
var z;
if(e < 256 || m.isEven()) z = new Classic(m); else z = new Montgomery(m);
return this.exp(e,z);
}
// protected
BigInteger.prototype.copyTo = bnpCopyTo;
BigInteger.prototype.fromInt = bnpFromInt;
BigInteger.prototype.fromString = bnpFromString;
BigInteger.prototype.clamp = bnpClamp;
BigInteger.prototype.dlShiftTo = bnpDLShiftTo;
BigInteger.prototype.drShiftTo = bnpDRShiftTo;
BigInteger.prototype.lShiftTo = bnpLShiftTo;
BigInteger.prototype.rShiftTo = bnpRShiftTo;
BigInteger.prototype.subTo = bnpSubTo;
BigInteger.prototype.multiplyTo = bnpMultiplyTo;
BigInteger.prototype.squareTo = bnpSquareTo;
BigInteger.prototype.divRemTo = bnpDivRemTo;
BigInteger.prototype.invDigit = bnpInvDigit;
BigInteger.prototype.isEven = bnpIsEven;
BigInteger.prototype.exp = bnpExp;
// public
BigInteger.prototype.toString = bnToString;
BigInteger.prototype.negate = bnNegate;
BigInteger.prototype.abs = bnAbs;
BigInteger.prototype.compareTo = bnCompareTo;
BigInteger.prototype.bitLength = bnBitLength;
BigInteger.prototype.mod = bnMod;
BigInteger.prototype.modPowInt = bnModPowInt;
// "constants"
BigInteger.ZERO = nbv(0);
BigInteger.ONE = nbv(1);
// Copyright (c) 2005-2009 Tom Wu
// All Rights Reserved.
// See "LICENSE" for details.
// Extended JavaScript BN functions, required for RSA private ops.
// Version 1.1: new BigInteger("0", 10) returns "proper" zero
// Version 1.2: square() API, isProbablePrime fix
// (public)
function bnClone() { var r = nbi(); this.copyTo(r); return r; }
// (public) return value as integer
function bnIntValue() {
if(this.s < 0) {
if(this.t == 1) return this[0]-this.DV;
else if(this.t == 0) return -1;
}
else if(this.t == 1) return this[0];
else if(this.t == 0) return 0;
// assumes 16 < DB < 32
return ((this[1]&((1<<(32-this.DB))-1))<>24; }
// (public) return value as short (assumes DB>=16)
function bnShortValue() { return (this.t==0)?this.s:(this[0]<<16)>>16; }
// (protected) return x s.t. r^x < DV
function bnpChunkSize(r) { return Math.floor(Math.LN2*this.DB/Math.log(r)); }
// (public) 0 if this == 0, 1 if this > 0
function bnSigNum() {
if(this.s < 0) return -1;
else if(this.t <= 0 || (this.t == 1 && this[0] <= 0)) return 0;
else return 1;
}
// (protected) convert to radix string
function bnpToRadix(b) {
if(b == null) b = 10;
if(this.signum() == 0 || b < 2 || b > 36) return "0";
var cs = this.chunkSize(b);
var a = Math.pow(b,cs);
var d = nbv(a), y = nbi(), z = nbi(), r = "";
this.divRemTo(d,y,z);
while(y.signum() > 0) {
r = (a+z.intValue()).toString(b).substr(1) + r;
y.divRemTo(d,y,z);
}
return z.intValue().toString(b) + r;
}
// (protected) convert from radix string
function bnpFromRadix(s,b) {
this.fromInt(0);
if(b == null) b = 10;
var cs = this.chunkSize(b);
var d = Math.pow(b,cs), mi = false, j = 0, w = 0;
for(var i = 0; i < s.length; ++i) {
var x = intAt(s,i);
if(x < 0) {
if(s.charAt(i) == "-" && this.signum() == 0) mi = true;
continue;
}
w = b*w+x;
if(++j >= cs) {
this.dMultiply(d);
this.dAddOffset(w,0);
j = 0;
w = 0;
}
}
if(j > 0) {
this.dMultiply(Math.pow(b,j));
this.dAddOffset(w,0);
}
if(mi) BigInteger.ZERO.subTo(this,this);
}
// (protected) alternate constructor
function bnpFromNumber(a,b,c) {
if("number" == typeof b) {
// new BigInteger(int,int,RNG)
if(a < 2) this.fromInt(1);
else {
this.fromNumber(a,c);
if(!this.testBit(a-1)) // force MSB set
this.bitwiseTo(BigInteger.ONE.shiftLeft(a-1),op_or,this);
if(this.isEven()) this.dAddOffset(1,0); // force odd
while(!this.isProbablePrime(b)) {
this.dAddOffset(2,0);
if(this.bitLength() > a) this.subTo(BigInteger.ONE.shiftLeft(a-1),this);
}
}
}
else {
// new BigInteger(int,RNG)
var x = new Array(), t = a&7;
x.length = (a>>3)+1;
b.nextBytes(x);
if(t > 0) x[0] &= ((1< 0) {
if(p < this.DB && (d = this[i]>>p) != (this.s&this.DM)>>p)
r[k++] = d|(this.s<<(this.DB-p));
while(i >= 0) {
if(p < 8) {
d = (this[i]&((1<>(p+=this.DB-8);
}
else {
d = (this[i]>>(p-=8))&0xff;
if(p <= 0) { p += this.DB; --i; }
}
if((d&0x80) != 0) d |= -256;
if(k == 0 && (this.s&0x80) != (d&0x80)) ++k;
if(k > 0 || d != this.s) r[k++] = d;
}
}
return r;
}
function bnEquals(a) { return(this.compareTo(a)==0); }
function bnMin(a) { return(this.compareTo(a)<0)?this:a; }
function bnMax(a) { return(this.compareTo(a)>0)?this:a; }
// (protected) r = this op a (bitwise)
function bnpBitwiseTo(a,op,r) {
var i, f, m = Math.min(a.t,this.t);
for(i = 0; i < m; ++i) r[i] = op(this[i],a[i]);
if(a.t < this.t) {
f = a.s&this.DM;
for(i = m; i < this.t; ++i) r[i] = op(this[i],f);
r.t = this.t;
}
else {
f = this.s&this.DM;
for(i = m; i < a.t; ++i) r[i] = op(f,a[i]);
r.t = a.t;
}
r.s = op(this.s,a.s);
r.clamp();
}
// (public) this & a
function op_and(x,y) { return x&y; }
function bnAnd(a) { var r = nbi(); this.bitwiseTo(a,op_and,r); return r; }
// (public) this | a
function op_or(x,y) { return x|y; }
function bnOr(a) { var r = nbi(); this.bitwiseTo(a,op_or,r); return r; }
// (public) this ^ a
function op_xor(x,y) { return x^y; }
function bnXor(a) { var r = nbi(); this.bitwiseTo(a,op_xor,r); return r; }
// (public) this & ~a
function op_andnot(x,y) { return x&~y; }
function bnAndNot(a) { var r = nbi(); this.bitwiseTo(a,op_andnot,r); return r; }
// (public) ~this
function bnNot() {
var r = nbi();
for(var i = 0; i < this.t; ++i) r[i] = this.DM&~this[i];
r.t = this.t;
r.s = ~this.s;
return r;
}
// (public) this << n
function bnShiftLeft(n) {
var r = nbi();
if(n < 0) this.rShiftTo(-n,r); else this.lShiftTo(n,r);
return r;
}
// (public) this >> n
function bnShiftRight(n) {
var r = nbi();
if(n < 0) this.lShiftTo(-n,r); else this.rShiftTo(n,r);
return r;
}
// return index of lowest 1-bit in x, x < 2^31
function lbit(x) {
if(x == 0) return -1;
var r = 0;
if((x&0xffff) == 0) { x >>= 16; r += 16; }
if((x&0xff) == 0) { x >>= 8; r += 8; }
if((x&0xf) == 0) { x >>= 4; r += 4; }
if((x&3) == 0) { x >>= 2; r += 2; }
if((x&1) == 0) ++r;
return r;
}
// (public) returns index of lowest 1-bit (or -1 if none)
function bnGetLowestSetBit() {
for(var i = 0; i < this.t; ++i)
if(this[i] != 0) return i*this.DB+lbit(this[i]);
if(this.s < 0) return this.t*this.DB;
return -1;
}
// return number of 1 bits in x
function cbit(x) {
var r = 0;
while(x != 0) { x &= x-1; ++r; }
return r;
}
// (public) return number of set bits
function bnBitCount() {
var r = 0, x = this.s&this.DM;
for(var i = 0; i < this.t; ++i) r += cbit(this[i]^x);
return r;
}
// (public) true iff nth bit is set
function bnTestBit(n) {
var j = Math.floor(n/this.DB);
if(j >= this.t) return(this.s!=0);
return((this[j]&(1<<(n%this.DB)))!=0);
}
// (protected) this op (1<>= this.DB;
}
if(a.t < this.t) {
c += a.s;
while(i < this.t) {
c += this[i];
r[i++] = c&this.DM;
c >>= this.DB;
}
c += this.s;
}
else {
c += this.s;
while(i < a.t) {
c += a[i];
r[i++] = c&this.DM;
c >>= this.DB;
}
c += a.s;
}
r.s = (c<0)?-1:0;
if(c > 0) r[i++] = c;
else if(c < -1) r[i++] = this.DV+c;
r.t = i;
r.clamp();
}
// (public) this + a
function bnAdd(a) { var r = nbi(); this.addTo(a,r); return r; }
// (public) this - a
function bnSubtract(a) { var r = nbi(); this.subTo(a,r); return r; }
// (public) this * a
function bnMultiply(a) { var r = nbi(); this.multiplyTo(a,r); return r; }
// (public) this^2
function bnSquare() { var r = nbi(); this.squareTo(r); return r; }
// (public) this / a
function bnDivide(a) { var r = nbi(); this.divRemTo(a,r,null); return r; }
// (public) this % a
function bnRemainder(a) { var r = nbi(); this.divRemTo(a,null,r); return r; }
// (public) [this/a,this%a]
function bnDivideAndRemainder(a) {
var q = nbi(), r = nbi();
this.divRemTo(a,q,r);
return new Array(q,r);
}
// (protected) this *= n, this >= 0, 1 < n < DV
function bnpDMultiply(n) {
this[this.t] = this.am(0,n-1,this,0,0,this.t);
++this.t;
this.clamp();
}
// (protected) this += n << w words, this >= 0
function bnpDAddOffset(n,w) {
if(n == 0) return;
while(this.t <= w) this[this.t++] = 0;
this[w] += n;
while(this[w] >= this.DV) {
this[w] -= this.DV;
if(++w >= this.t) this[this.t++] = 0;
++this[w];
}
}
// A "null" reducer
function NullExp() {}
function nNop(x) { return x; }
function nMulTo(x,y,r) { x.multiplyTo(y,r); }
function nSqrTo(x,r) { x.squareTo(r); }
NullExp.prototype.convert = nNop;
NullExp.prototype.revert = nNop;
NullExp.prototype.mulTo = nMulTo;
NullExp.prototype.sqrTo = nSqrTo;
// (public) this^e
function bnPow(e) { return this.exp(e,new NullExp()); }
// (protected) r = lower n words of "this * a", a.t <= n
// "this" should be the larger one if appropriate.
function bnpMultiplyLowerTo(a,n,r) {
var i = Math.min(this.t+a.t,n);
r.s = 0; // assumes a,this >= 0
r.t = i;
while(i > 0) r[--i] = 0;
var j;
for(j = r.t-this.t; i < j; ++i) r[i+this.t] = this.am(0,a[i],r,i,0,this.t);
for(j = Math.min(a.t,n); i < j; ++i) this.am(0,a[i],r,i,0,n-i);
r.clamp();
}
// (protected) r = "this * a" without lower n words, n > 0
// "this" should be the larger one if appropriate.
function bnpMultiplyUpperTo(a,n,r) {
--n;
var i = r.t = this.t+a.t-n;
r.s = 0; // assumes a,this >= 0
while(--i >= 0) r[i] = 0;
for(i = Math.max(n-this.t,0); i < a.t; ++i)
r[this.t+i-n] = this.am(n-i,a[i],r,0,0,this.t+i-n);
r.clamp();
r.drShiftTo(1,r);
}
// Barrett modular reduction
function Barrett(m) {
// setup Barrett
this.r2 = nbi();
this.q3 = nbi();
BigInteger.ONE.dlShiftTo(2*m.t,this.r2);
this.mu = this.r2.divide(m);
this.m = m;
}
function barrettConvert(x) {
if(x.s < 0 || x.t > 2*this.m.t) return x.mod(this.m);
else if(x.compareTo(this.m) < 0) return x;
else { var r = nbi(); x.copyTo(r); this.reduce(r); return r; }
}
function barrettRevert(x) { return x; }
// x = x mod m (HAC 14.42)
function barrettReduce(x) {
x.drShiftTo(this.m.t-1,this.r2);
if(x.t > this.m.t+1) { x.t = this.m.t+1; x.clamp(); }
this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3);
this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);
while(x.compareTo(this.r2) < 0) x.dAddOffset(1,this.m.t+1);
x.subTo(this.r2,x);
while(x.compareTo(this.m) >= 0) x.subTo(this.m,x);
}
// r = x^2 mod m; x != r
function barrettSqrTo(x,r) { x.squareTo(r); this.reduce(r); }
// r = x*y mod m; x,y != r
function barrettMulTo(x,y,r) { x.multiplyTo(y,r); this.reduce(r); }
Barrett.prototype.convert = barrettConvert;
Barrett.prototype.revert = barrettRevert;
Barrett.prototype.reduce = barrettReduce;
Barrett.prototype.mulTo = barrettMulTo;
Barrett.prototype.sqrTo = barrettSqrTo;
// (public) this^e % m (HAC 14.85)
function bnModPow(e,m) {
var i = e.bitLength(), k, r = nbv(1), z;
if(i <= 0) return r;
else if(i < 18) k = 1;
else if(i < 48) k = 3;
else if(i < 144) k = 4;
else if(i < 768) k = 5;
else k = 6;
if(i < 8)
z = new Classic(m);
else if(m.isEven())
z = new Barrett(m);
else
z = new Montgomery(m);
// precomputation
var g = new Array(), n = 3, k1 = k-1, km = (1< 1) {
var g2 = nbi();
z.sqrTo(g[1],g2);
while(n <= km) {
g[n] = nbi();
z.mulTo(g2,g[n-2],g[n]);
n += 2;
}
}
var j = e.t-1, w, is1 = true, r2 = nbi(), t;
i = nbits(e[j])-1;
while(j >= 0) {
if(i >= k1) w = (e[j]>>(i-k1))&km;
else {
w = (e[j]&((1<<(i+1))-1))<<(k1-i);
if(j > 0) w |= e[j-1]>>(this.DB+i-k1);
}
n = k;
while((w&1) == 0) { w >>= 1; --n; }
if((i -= n) < 0) { i += this.DB; --j; }
if(is1) { // ret == 1, don't bother squaring or multiplying it
g[w].copyTo(r);
is1 = false;
}
else {
while(n > 1) { z.sqrTo(r,r2); z.sqrTo(r2,r); n -= 2; }
if(n > 0) z.sqrTo(r,r2); else { t = r; r = r2; r2 = t; }
z.mulTo(r2,g[w],r);
}
while(j >= 0 && (e[j]&(1< 0) {
x.rShiftTo(g,x);
y.rShiftTo(g,y);
}
while(x.signum() > 0) {
if((i = x.getLowestSetBit()) > 0) x.rShiftTo(i,x);
if((i = y.getLowestSetBit()) > 0) y.rShiftTo(i,y);
if(x.compareTo(y) >= 0) {
x.subTo(y,x);
x.rShiftTo(1,x);
}
else {
y.subTo(x,y);
y.rShiftTo(1,y);
}
}
if(g > 0) y.lShiftTo(g,y);
return y;
}
// (protected) this % n, n < 2^26
function bnpModInt(n) {
if(n <= 0) return 0;
var d = this.DV%n, r = (this.s<0)?n-1:0;
if(this.t > 0)
if(d == 0) r = this[0]%n;
else for(var i = this.t-1; i >= 0; --i) r = (d*r+this[i])%n;
return r;
}
// (public) 1/this % m (HAC 14.61)
function bnModInverse(m) {
var ac = m.isEven();
if((this.isEven() && ac) || m.signum() == 0) return BigInteger.ZERO;
var u = m.clone(), v = this.clone();
var a = nbv(1), b = nbv(0), c = nbv(0), d = nbv(1);
while(u.signum() != 0) {
while(u.isEven()) {
u.rShiftTo(1,u);
if(ac) {
if(!a.isEven() || !b.isEven()) { a.addTo(this,a); b.subTo(m,b); }
a.rShiftTo(1,a);
}
else if(!b.isEven()) b.subTo(m,b);
b.rShiftTo(1,b);
}
while(v.isEven()) {
v.rShiftTo(1,v);
if(ac) {
if(!c.isEven() || !d.isEven()) { c.addTo(this,c); d.subTo(m,d); }
c.rShiftTo(1,c);
}
else if(!d.isEven()) d.subTo(m,d);
d.rShiftTo(1,d);
}
if(u.compareTo(v) >= 0) {
u.subTo(v,u);
if(ac) a.subTo(c,a);
b.subTo(d,b);
}
else {
v.subTo(u,v);
if(ac) c.subTo(a,c);
d.subTo(b,d);
}
}
if(v.compareTo(BigInteger.ONE) != 0) return BigInteger.ZERO;
if(d.compareTo(m) >= 0) return d.subtract(m);
if(d.signum() < 0) d.addTo(m,d); else return d;
if(d.signum() < 0) return d.add(m); else return d;
}
var lowprimes = [2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997];
var lplim = (1<<26)/lowprimes[lowprimes.length-1];
// (public) test primality with certainty >= 1-.5^t
function bnIsProbablePrime(t) {
var i, x = this.abs();
if(x.t == 1 && x[0] <= lowprimes[lowprimes.length-1]) {
for(i = 0; i < lowprimes.length; ++i)
if(x[0] == lowprimes[i]) return true;
return false;
}
if(x.isEven()) return false;
i = 1;
while(i < lowprimes.length) {
var m = lowprimes[i], j = i+1;
while(j < lowprimes.length && m < lplim) m *= lowprimes[j++];
m = x.modInt(m);
while(i < j) if(m%lowprimes[i++] == 0) return false;
}
return x.millerRabin(t);
}
// (protected) true if probably prime (HAC 4.24, Miller-Rabin)
function bnpMillerRabin(t) {
var n1 = this.subtract(BigInteger.ONE);
var k = n1.getLowestSetBit();
if(k <= 0) return false;
var r = n1.shiftRight(k);
t = (t+1)>>1;
if(t > lowprimes.length) t = lowprimes.length;
var a = nbi();
for(var i = 0; i < t; ++i) {
//Pick bases at random, instead of starting at 2
a.fromInt(lowprimes[Math.floor(Math.random()*lowprimes.length)]);
var y = a.modPow(r,this);
if(y.compareTo(BigInteger.ONE) != 0 && y.compareTo(n1) != 0) {
var j = 1;
while(j++ < k && y.compareTo(n1) != 0) {
y = y.modPowInt(2,this);
if(y.compareTo(BigInteger.ONE) == 0) return false;
}
if(y.compareTo(n1) != 0) return false;
}
}
return true;
}
// protected
BigInteger.prototype.chunkSize = bnpChunkSize;
BigInteger.prototype.toRadix = bnpToRadix;
BigInteger.prototype.fromRadix = bnpFromRadix;
BigInteger.prototype.fromNumber = bnpFromNumber;
BigInteger.prototype.bitwiseTo = bnpBitwiseTo;
BigInteger.prototype.changeBit = bnpChangeBit;
BigInteger.prototype.addTo = bnpAddTo;
BigInteger.prototype.dMultiply = bnpDMultiply;
BigInteger.prototype.dAddOffset = bnpDAddOffset;
BigInteger.prototype.multiplyLowerTo = bnpMultiplyLowerTo;
BigInteger.prototype.multiplyUpperTo = bnpMultiplyUpperTo;
BigInteger.prototype.modInt = bnpModInt;
BigInteger.prototype.millerRabin = bnpMillerRabin;
// public
BigInteger.prototype.clone = bnClone;
BigInteger.prototype.intValue = bnIntValue;
BigInteger.prototype.byteValue = bnByteValue;
BigInteger.prototype.shortValue = bnShortValue;
BigInteger.prototype.signum = bnSigNum;
BigInteger.prototype.toByteArray = bnToByteArray;
BigInteger.prototype.equals = bnEquals;
BigInteger.prototype.min = bnMin;
BigInteger.prototype.max = bnMax;
BigInteger.prototype.and = bnAnd;
BigInteger.prototype.or = bnOr;
BigInteger.prototype.xor = bnXor;
BigInteger.prototype.andNot = bnAndNot;
BigInteger.prototype.not = bnNot;
BigInteger.prototype.shiftLeft = bnShiftLeft;
BigInteger.prototype.shiftRight = bnShiftRight;
BigInteger.prototype.getLowestSetBit = bnGetLowestSetBit;
BigInteger.prototype.bitCount = bnBitCount;
BigInteger.prototype.testBit = bnTestBit;
BigInteger.prototype.setBit = bnSetBit;
BigInteger.prototype.clearBit = bnClearBit;
BigInteger.prototype.flipBit = bnFlipBit;
BigInteger.prototype.add = bnAdd;
BigInteger.prototype.subtract = bnSubtract;
BigInteger.prototype.multiply = bnMultiply;
BigInteger.prototype.divide = bnDivide;
BigInteger.prototype.remainder = bnRemainder;
BigInteger.prototype.divideAndRemainder = bnDivideAndRemainder;
BigInteger.prototype.modPow = bnModPow;
BigInteger.prototype.modInverse = bnModInverse;
BigInteger.prototype.pow = bnPow;
BigInteger.prototype.gcd = bnGCD;
BigInteger.prototype.isProbablePrime = bnIsProbablePrime;
// JSBN-specific extension
BigInteger.prototype.square = bnSquare;
// Expose the Barrett function
BigInteger.prototype.Barrett = Barrett
// BigInteger interfaces not implemented in jsbn:
// BigInteger(int signum, byte[] magnitude)
// double doubleValue()
// float floatValue()
// int hashCode()
// long longValue()
// static BigInteger valueOf(long val)
// Random number generator - requires a PRNG backend, e.g. prng4.js
// For best results, put code like
//
// in your main HTML document.
var rng_state;
var rng_pool;
var rng_pptr;
// Mix in a 32-bit integer into the pool
function rng_seed_int(x) {
rng_pool[rng_pptr++] ^= x & 255;
rng_pool[rng_pptr++] ^= (x >> 8) & 255;
rng_pool[rng_pptr++] ^= (x >> 16) & 255;
rng_pool[rng_pptr++] ^= (x >> 24) & 255;
if(rng_pptr >= rng_psize) rng_pptr -= rng_psize;
}
// Mix in the current time (w/milliseconds) into the pool
function rng_seed_time() {
rng_seed_int(new Date().getTime());
}
// Initialize the pool with junk if needed.
if(rng_pool == null) {
rng_pool = new Array();
rng_pptr = 0;
var t;
if(typeof window !== "undefined" && window.crypto) {
if (window.crypto.getRandomValues) {
// Use webcrypto if available
var ua = new Uint8Array(32);
window.crypto.getRandomValues(ua);
for(t = 0; t < 32; ++t)
rng_pool[rng_pptr++] = ua[t];
}
else if(navigator.appName == "Netscape" && navigator.appVersion < "5") {
// Extract entropy (256 bits) from NS4 RNG if available
var z = window.crypto.random(32);
for(t = 0; t < z.length; ++t)
rng_pool[rng_pptr++] = z.charCodeAt(t) & 255;
}
}
while(rng_pptr < rng_psize) { // extract some randomness from Math.random()
t = Math.floor(65536 * Math.random());
rng_pool[rng_pptr++] = t >>> 8;
rng_pool[rng_pptr++] = t & 255;
}
rng_pptr = 0;
rng_seed_time();
//rng_seed_int(window.screenX);
//rng_seed_int(window.screenY);
}
function rng_get_byte() {
if(rng_state == null) {
rng_seed_time();
rng_state = prng_newstate();
rng_state.init(rng_pool);
for(rng_pptr = 0; rng_pptr < rng_pool.length; ++rng_pptr)
rng_pool[rng_pptr] = 0;
rng_pptr = 0;
//rng_pool = null;
}
// TODO: allow reseeding after first request
return rng_state.next();
}
function rng_get_bytes(ba) {
var i;
for(i = 0; i < ba.length; ++i) ba[i] = rng_get_byte();
}
function SecureRandom() {}
SecureRandom.prototype.nextBytes = rng_get_bytes;
// prng4.js - uses Arcfour as a PRNG
function Arcfour() {
this.i = 0;
this.j = 0;
this.S = new Array();
}
// Initialize arcfour context from key, an array of ints, each from [0..255]
function ARC4init(key) {
var i, j, t;
for(i = 0; i < 256; ++i)
this.S[i] = i;
j = 0;
for(i = 0; i < 256; ++i) {
j = (j + this.S[i] + key[i % key.length]) & 255;
t = this.S[i];
this.S[i] = this.S[j];
this.S[j] = t;
}
this.i = 0;
this.j = 0;
}
function ARC4next() {
var t;
this.i = (this.i + 1) & 255;
this.j = (this.j + this.S[this.i]) & 255;
t = this.S[this.i];
this.S[this.i] = this.S[this.j];
this.S[this.j] = t;
return this.S[(t + this.S[this.i]) & 255];
}
Arcfour.prototype.init = ARC4init;
Arcfour.prototype.next = ARC4next;
// Plug in your RNG constructor here
function prng_newstate() {
return new Arcfour();
}
// Pool size must be a multiple of 4 and greater than 32.
// An array of bytes the size of the pool will be passed to init()
var rng_psize = 256;
if (typeof exports !== 'undefined') {
exports = module.exports = {
BigInteger: BigInteger,
SecureRandom: SecureRandom,
};
} else {
this.jsbn = {
BigInteger: BigInteger,
SecureRandom: SecureRandom
};
}
}).call(this);
;
(function (factory) {
"use strict";
var root = (typeof self === "object" && self.self === self && self) ||
(typeof global === "object" && global.global === global && global);
if (typeof exports !== "undefined") {
var BigInteger = require("jsbn").BigInteger;
factory(root, exports, BigInteger);
} else {
var BigInt = root.BigInteger ? root.BigInteger : root.jsbn.BigInteger;
root.Money = factory(root, {}, BigInt);
}
}(function (root, Money, BigInteger) {
"use strict";
var Currency = function (code) {
this.code = code;
},
separateThousands = function (inStr, withStr) {
var sign = "",
src = inStr,
ret = "",
appendix;
if (inStr[0] === "-") {
sign = "-";
src = src.substr(1);
}
while (src.length > 0) {
if (ret.length > 0) {
ret = withStr + ret;
}
if (src.length <= 3) {
ret = src + ret;
break;
}
appendix = src.substr(src.length - 3, 3);
ret = appendix + ret;
src = src.substr(0, src.length - 3);
}
return sign + ret;
},
integerValue = function (amount) {
return (/^(\-?\d+)\.\d\d$/).exec(amount)[1];
},
isString = function (obj) {
return Object.prototype.toString.call(obj) === "[object String]";
},
round = function (amount) {
var fraction = parseInt(amount.substr(-2), 10),
wholeAmount = integerValue(amount) + ".00";
return (
fraction < 50 ?
wholeAmount :
Money.add(wholeAmount, "1.00")
);
};
Currency.prototype.format = function (amount) {
switch (this.code) {
case "JPY":
return separateThousands(integerValue(amount), ",");
case "EUR":
case "GBP":
return separateThousands(integerValue(amount), ".") + "," + amount.substr(-2);
case "CHF":
case "USD":
return separateThousands(integerValue(amount), ",") + "." + amount.substr(-2);
case "SEK":
case "LTL":
case "PLN":
case "SKK":
case "UAH":
return separateThousands(integerValue(amount), " ") + "," + amount.substr(-2);
default:
return amount;
}
};
Money.amountToCents = function (amount) {
return amount.replace(".", "");
};
Money.centsToAmount = function (cents) {
var sign,
abs;
if (!isString(cents)) {
return undefined;
}
sign = (cents[0] === "-" ? "-" : "");
abs = (sign === "-" ? cents.substr(1) : cents);
while (abs.length < 3) {
abs = ["0", abs].join("");
}
return sign + abs.substr(0, abs.length - 2) + "." + abs.substr(-2);
};
Money.floatToAmount = function (f) {
return ("" + (Math.round(f * 100.0) / 100.0))
.replace(/^-(\d+)$/, "-$1.00") //-xx
.replace(/^(\d+)$/, "$1.00") //xx
.replace(/^-(\d+)\.(\d)$/, "-$1.$20") //-xx.xx
.replace(/^(\d+)\.(\d)$/, "$1.$20"); //xx.xx
};
Money.integralPart = function (amount) {
return integerValue(amount);
};
Money.format = function (currency, amount) {
return new Currency(currency).format(amount);
};
Money.add = function (a, b) {
return Money.centsToAmount(
new BigInteger(
Money.amountToCents(a)
).add(
new BigInteger(Money.amountToCents(b))
).toString()
);
};
Money.subtract = function (a, b) {
return Money.centsToAmount(
new BigInteger(
Money.amountToCents(a)
).subtract(
new BigInteger(Money.amountToCents(b))
).toString()
);
};
Money.mul = function (a, b) {
return Money.centsToAmount(
new BigInteger(
Money.amountToCents(a)
).multiply(
new BigInteger(Money.amountToCents(b))
).divide(
new BigInteger("100")
).toString()
);
};
Money.div = function (a, b) {
var hundredthsOfCents = new BigInteger(
Money.amountToCents(a)
).multiply(
new BigInteger("10000")
).divide(
new BigInteger(Money.amountToCents(b))
),
remainder = parseInt(hundredthsOfCents.toString().substr(-2), 10);
return Money.centsToAmount(
hundredthsOfCents.divide(
new BigInteger("100")
).add(
new BigInteger(remainder > 50 ? "1" : "0")
).toString()
);
};
Money.percent = function (value, percent) {
var p = new BigInteger(
Money.amountToCents(value)
).multiply(
new BigInteger(Money.amountToCents(percent))
),
q = p.divide(new BigInteger("10000")),
r = p.mod(new BigInteger("10000"));
return Money.centsToAmount(
(r.compareTo(new BigInteger("4999")) > 0 ? q.add(new BigInteger("1")) : q).toString()
);
};
Money.roundUpTo5Cents = function (amount) {
var lastDigit = parseInt(amount.substr(-1), 10),
additon = "0.00";
if ((lastDigit % 5) !== 0) {
additon = "0.0" + (5 - (lastDigit % 5));
}
return Money.add(amount, additon);
};
Money.roundTo5Cents = function (amount) {
return Money.div(
round(Money.mul(amount, "20.00")),
"20.00"
);
};
Money.cmp = function (a, b) {
return new BigInteger(a.replace(".", "")).compareTo(new BigInteger(b.replace(".", "")));
};
return Money;
}));
;
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o\n ";
},
gradient: function(dir, dur){
var colors, ret, len, gx, gy, x, y, i$, i, idx;
dir == null && (dir = 45);
dur == null && (dur = 1);
colors = slice$.call(arguments, 2);
ret = [this.head("0 0 100 100")];
len = colors.length * 4 + 1;
dir = dir * Math.PI / 180;
gx = Math.pow(Math.cos(dir), 2);
gy = Math.sqrt(gx - Math.pow(gx, 2));
if (dir > Math.PI * 0.25) {
gy = Math.pow(Math.sin(dir), 2);
gx = Math.sqrt(gy - Math.pow(gy, 2));
}
x = gx * 100;
y = gy * 100;
ret.push("");
for (i$ = 0; i$ < len; ++i$) {
i = i$;
idx = i * 100 / (len - 1);
ret.push(" ");
}
ret.push(" \n\n ");
return wrap(ret.join(""));
},
stripe: function(c1, c2, dur){
var ret, i;
c1 == null && (c1 = '#b4b4b4');
c2 == null && (c2 = '#e6e6e6');
dur == null && (dur = 1);
ret = [this.head("0 0 100 100")];
ret = ret.concat([
"", "", (function(){
var i$, results$ = [];
for (i$ = 0; i$ < 13; ++i$) {
i = i$;
results$.push((" "));
}
return results$;
}()).join(""), " "
].join(""));
return wrap(ret);
},
bubble: function(c1, c2, count, dur, size, sw){
var ret, i$, i, idx, x, r, d;
c1 == null && (c1 = '#39d');
c2 == null && (c2 = '#9cf');
count == null && (count = 15);
dur == null && (dur = 1);
size == null && (size = 6);
sw == null && (sw = 1);
ret = [this.head("0 0 200 200"), " "];
for (i$ = 0; i$ < count; ++i$) {
i = i$;
idx = -(i / count) * dur;
x = Math.random() * 184 + 8;
r = (Math.random() * 0.7 + 0.3) * size;
d = dur * (1 + Math.random() * 0.5);
ret.push(["", "", " ", "", "", " "].join(""));
}
return wrap(ret.join("") + "");
}
};
handler = {
queue: {},
running: false,
main: function(timestamp){
var keepon, removed, k, ref$, func, ret, this$ = this;
keepon = false;
removed = [];
for (k in ref$ = this.queue) {
func = ref$[k];
ret = func(timestamp);
if (!ret) {
removed.push(func);
}
keepon = keepon || ret;
}
for (k in ref$ = this.queue) {
func = ref$[k];
if (removed.indexOf(func) >= 0) {
delete this.queue[k];
}
}
if (keepon) {
return requestAnimationFrame(function(it){
return this$.main(it);
});
} else {
return this.running = false;
}
},
add: function(key, f){
var this$ = this;
if (!this.queue[key]) {
this.queue[key] = f;
}
if (!this.running) {
this.running = true;
return requestAnimationFrame(function(it){
return this$.main(it);
});
}
}
};
window.ldBar = ldBar = function(selector, option){
var xmlns, root, cls, idPrefix, id, domTree, newNode, x$, config, attr, that, isStroke, parseRes, dom, svg, text, group, length, path0, path1, patimg, img, ret, size, this$ = this;
option == null && (option = {});
xmlns = {
xlink: "http://www.w3.org/1999/xlink"
};
root = toString$.call(selector).slice(8, -1) === 'String' ? document.querySelector(selector) : selector;
if (!root.ldBar) {
root.ldBar = this;
} else {
return root.ldBar;
}
cls = root.getAttribute('class') || '';
if (!~cls.indexOf('ldBar')) {
root.setAttribute('class', cls + " ldBar");
}
idPrefix = "ldBar-" + Math.random().toString(16).substring(2);
id = {
key: idPrefix,
clip: idPrefix + "-clip",
filter: idPrefix + "-filter",
pattern: idPrefix + "-pattern",
mask: idPrefix + "-mask",
maskPath: idPrefix + "-mask-path"
};
domTree = function(n, o){
var k, v;
n = newNode(n);
for (k in o) {
v = o[k];
if (k !== 'attr') {
n.appendChild(domTree(k, v || {}));
}
}
n.attrs(o.attr || {});
return n;
};
newNode = function(n){
return document.createElementNS("http://www.w3.org/2000/svg", n);
};
x$ = document.body.__proto__.__proto__.__proto__;
x$.text = function(t){
return this.appendChild(document.createTextNode(t));
};
x$.attrs = function(o){
var k, v, ret, results$ = [];
for (k in o) {
v = o[k];
ret = /([^:]+):([^:]+)/.exec(k);
if (!ret || !xmlns[ret[1]]) {
results$.push(this.setAttribute(k, v));
} else {
results$.push(this.setAttributeNS(xmlns[ret[1]], k, v));
}
}
return results$;
};
x$.styles = function(o){
var k, v, results$ = [];
for (k in o) {
v = o[k];
results$.push(this.style[k] = v);
}
return results$;
};
x$.append = function(n){
var r;
return this.appendChild(r = document.createElementNS("http://www.w3.og/2000/svg", n));
};
x$.attr = function(n, v){
if (v != null) {
return this.setAttribute(n, v);
} else {
return this.getAttribute(n);
}
};
config = {
"type": 'stroke',
"img": '',
"path": 'M10 10L90 10M90 8M90 12',
"fill-dir": 'btt',
"fill": '#25b',
"fill-background": '#ddd',
"fill-background-extrude": 3,
"pattern-size": null,
"stroke-dir": 'normal',
"stroke": '#25b',
"stroke-width": '3',
"stroke-trail": '#ddd',
"stroke-trail-width": 0.5,
"duration": 1,
"easing": 'linear',
"value": 0,
"img-size": null,
"bbox": null,
"set-dim": true,
"aspect-ratio": "xMidYMid",
"transition-in": false,
"min": 0,
"max": 100,
"precision": 0,
"padding": undefined
};
config["preset"] = root.attr("data-preset") || option["preset"];
if (config.preset != null) {
import$(config, presets[config.preset]);
}
for (attr in config) {
if (that = that = root.attr("data-" + attr)) {
config[attr] = that;
}
}
import$(config, option);
if (config.img) {
config.path = null;
}
isStroke = config.type === 'stroke';
parseRes = function(v){
var parser, ret;
parser = /data:ldbar\/res,([^()]+)\(([^)]+)\)/;
ret = parser.exec(v);
if (!ret) {
return v;
}
return ret = make[ret[1]].apply(make, ret[2].split(','));
};
config.fill = parseRes(config.fill);
config.stroke = parseRes(config.stroke);
if (config["set-dim"] === 'false') {
config["set-dim"] = false;
}
dom = {
attr: {
"xmlns:xlink": 'http://www.w3.org/1999/xlink',
preserveAspectRatio: config["aspect-ratio"],
width: "100%",
height: "100%"
},
defs: {
filter: {
attr: {
id: id.filter,
x: -1,
y: -1,
width: 3,
height: 3
},
feMorphology: {
attr: {
operator: +config["fill-background-extrude"] >= 0 ? 'dilate' : 'erode',
radius: Math.abs(+config["fill-background-extrude"])
}
},
feColorMatrix: {
attr: {
values: '0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 1 0',
result: "cm"
}
}
},
mask: {
attr: {
id: id.mask
},
image: {
attr: {
"xlink:href": config.img,
filter: "url(#" + id.filter + ")",
x: 0,
y: 0,
width: 100,
height: 100,
preserveAspectRatio: config["aspect-ratio"]
}
}
},
g: {
mask: {
attr: {
id: id.maskPath
},
path: {
attr: {
d: config.path || "",
fill: '#fff',
stroke: '#fff',
filter: "url(#" + id.filter + ")"
}
}
}
},
clipPath: {
attr: {
id: id.clip
},
rect: {
attr: {
'class': 'mask',
fill: '#000'
}
}
},
pattern: {
attr: {
id: id.pattern,
patternUnits: 'userSpaceOnUse',
x: 0,
y: 0,
width: 300,
height: 300
},
image: {
attr: {
x: 0,
y: 0,
width: 300,
height: 300
}
}
}
}
};
svg = domTree('svg', dom);
text = document.createElement('div');
text.setAttribute('class', 'ldBar-label');
root.appendChild(svg);
root.appendChild(text);
group = [0, 0];
length = 0;
this.fit = function(){
var that, box, d, rect;
if (that = config["bbox"]) {
box = that.split(' ').map(function(it){
return +it.trim();
});
box = {
x: box[0],
y: box[1],
width: box[2],
height: box[3]
};
} else {
box = group[1].getBBox();
}
if (!box || box.width === 0 || box.height === 0) {
box = {
x: 0,
y: 0,
width: 100,
height: 100
};
}
d = Math.max.apply(null, ['stroke-width', 'stroke-trail-width', 'fill-background-extrude'].map(function(it){
return config[it];
})) * 1.5;
if (config["padding"] != null) {
d = +config["padding"];
}
svg.attrs({
viewBox: [box.x - d, box.y - d, box.width + d * 2, box.height + d * 2].join(" ")
});
if (config["set-dim"]) {
['width', 'height'].map(function(it){
if (!root.style[it] || this$.fit[it]) {
root.style[it] = (box[it] + d * 2) + "px";
return this$.fit[it] = true;
}
});
}
rect = group[0].querySelector('rect');
if (rect) {
return rect.attrs({
x: box.x - d,
y: box.y - d,
width: box.width + d * 2,
height: box.height + d * 2
});
}
};
if (config.path) {
if (isStroke) {
group[0] = domTree('g', {
path: {
attr: {
d: config.path,
fill: 'none',
'class': 'baseline'
}
}
});
} else {
group[0] = domTree('g', {
rect: {
attr: {
x: 0,
y: 0,
width: 100,
height: 100,
mask: "url(#" + id.maskPath + ")",
fill: config["fill-background"],
'class': 'frame'
}
}
});
}
svg.appendChild(group[0]);
group[1] = domTree('g', {
path: {
attr: {
d: config.path,
'class': isStroke ? 'mainline' : 'solid',
"clip-path": config.type === 'fill' ? "url(#" + id.clip + ")" : ''
}
}
});
svg.appendChild(group[1]);
path0 = group[0].querySelector(isStroke ? 'path' : 'rect');
path1 = group[1].querySelector('path');
if (isStroke) {
path1.attrs({
fill: 'none'
});
}
patimg = svg.querySelector('pattern image');
img = new Image();
img.addEventListener('load', function(){
var box, that;
box = (that = config["pattern-size"])
? {
width: +that,
height: +that
}
: img.width && img.height
? {
width: img.width,
height: img.height
}
: {
width: 300,
height: 300
};
svg.querySelector('pattern').attrs({
width: box.width,
height: box.height
});
return patimg.attrs({
width: box.width,
height: box.height
});
});
if (/.+\..+|^data:/.exec(!isStroke
? config.fill
: config.stroke)) {
img.src = !isStroke
? config.fill
: config.stroke;
patimg.attrs({
"xlink:href": img.src
});
}
if (isStroke) {
path0.attrs({
stroke: config["stroke-trail"],
"stroke-width": config["stroke-trail-width"]
});
path1.attrs({
"stroke-width": config["stroke-width"],
stroke: /.+\..+|^data:/.exec(config.stroke)
? "url(#" + id.pattern + ")"
: config.stroke
});
}
if (config.fill && !isStroke) {
path1.attrs({
fill: /.+\..+|^data:/.exec(config.fill)
? "url(#" + id.pattern + ")"
: config.fill
});
}
length = path1.getTotalLength();
this.fit();
this.inited = true;
} else if (config.img) {
if (config["img-size"]) {
ret = config["img-size"].split(',');
size = {
width: +ret[0],
height: +ret[1]
};
} else {
size = {
width: 100,
height: 100
};
}
group[0] = domTree('g', {
rect: {
attr: {
x: 0,
y: 0,
width: 100,
height: 100,
mask: "url(#" + id.mask + ")",
fill: config["fill-background"]
}
}
});
svg.querySelector('mask image').attrs({
width: size.width,
height: size.height
});
group[1] = domTree('g', {
image: {
attr: {
width: size.width,
height: size.height,
x: 0,
y: 0,
preserveAspectRatio: config["aspect-ratio"],
"clip-path": config.type === 'fill' ? "url(#" + id.clip + ")" : '',
"xlink:href": config.img,
'class': 'solid'
}
}
});
img = new Image();
img.addEventListener('load', function(){
var ret, size, v;
if (config["img-size"]) {
ret = config["img-size"].split(',');
size = {
width: +ret[0],
height: +ret[1]
};
} else if (img.width && img.height) {
size = {
width: img.width,
height: img.height
};
} else {
size = {
width: 100,
height: 100
};
}
svg.querySelector('mask image').attrs({
width: size.width,
height: size.height
});
group[1].querySelector('image').attrs({
width: size.width,
height: size.height
});
this$.fit();
v = this$.value;
this$.value = undefined;
this$.set(v, true);
return this$.inited = true;
});
img.src = config.img;
svg.appendChild(group[0]);
svg.appendChild(group[1]);
}
svg.attrs({
width: '100%',
height: '100%'
});
this.transition = {
value: {
src: 0,
des: 0
},
time: {},
ease: function(t, b, c, d){
t = t / (d * 0.5);
if (t < 1) {
return c * 0.5 * t * t + b;
}
t = t - 1;
return -c * 0.5 * (t * (t - 2) - 1) + b;
},
handler: function(time, doTransition){
var ref$, min, max, prec, dv, dt, dur, v, p, node, style, box, dir;
doTransition == null && (doTransition = true);
if (this.time.src == null) {
this.time.src = time;
}
ref$ = [config["min"], config["max"], 1 / config["precision"]], min = ref$[0], max = ref$[1], prec = ref$[2];
ref$ = [this.value.des - this.value.src, (time - this.time.src) * 0.001, +config["duration"] || 1], dv = ref$[0], dt = ref$[1], dur = ref$[2];
v = doTransition
? this.ease(dt, this.value.src, dv, dur)
: this.value.des;
if (config.precision) {
v = Math.round(v * prec) / prec;
} else if (doTransition) {
v = Math.round(v);
}
v >= min || (v = min);
v <= max || (v = max);
text.textContent = v;
p = 100.0 * (v - min) / (max - min);
if (isStroke) {
node = path1;
style = {
"stroke-dasharray": config["stroke-dir"] === 'reverse'
? "0 " + length * (100 - p) * 0.01 + " " + length * p * 0.01 + " 0"
: p * 0.01 * length + " " + ((100 - p) * 0.01 * length + 1)
};
} else {
box = group[1].getBBox();
dir = config["fill-dir"];
style = dir === 'btt' || !dir
? {
y: box.y + box.height * (100 - p) * 0.01,
height: box.height * p * 0.01,
x: box.x,
width: box.width
}
: dir === 'ttb'
? {
y: box.y,
height: box.height * p * 0.01,
x: box.x,
width: box.width
}
: dir === 'ltr'
? {
y: box.y,
height: box.height,
x: box.x,
width: box.width * p * 0.01
}
: dir === 'rtl' ? {
y: box.y,
height: box.height,
x: box.x + box.width * (100 - p) * 0.01,
width: box.width * p * 0.01
} : void 8;
node = svg.querySelector('rect');
}
node.attrs(style);
if (dt >= dur) {
delete this.time.src;
return false;
}
return true;
},
start: function(src, des, doTransition){
var ref$, this$ = this;
ref$ = this.value;
ref$.src = src;
ref$.des = des;
!!(root.offsetWidth || root.offsetHeight || root.getClientRects().length);
if (!doTransition || !(root.offsetWidth || root.offsetHeight || root.getClientRects().length)) {
this.time.src = 0;
this.handler(1000, false);
return;
}
return handler.add(id.key, function(time){
return this$.handler(time);
});
}
};
this.set = function(v, doTransition){
var src, des;
doTransition == null && (doTransition = true);
src = this.value || 0;
if (v != null) {
this.value = v;
} else {
v = this.value;
}
des = this.value;
return this.transition.start(src, des, doTransition);
};
this.set(+config.value || 0, config["transition-in"]) || false;
return this;
};
return window.addEventListener('load', function(){
var i$, ref$, len$, node, results$ = [];
for (i$ = 0, len$ = (ref$ = document.querySelectorAll('.ldBar')).length; i$ < len$; ++i$) {
node = ref$[i$];
if (!node.ldBar) {
results$.push(node.ldBar = new ldBar(node));
}
}
return results$;
}, false);
})();
module.exports = ldBar;
function import$(obj, src){
var own = {}.hasOwnProperty;
for (var key in src) if (own.call(src, key)) obj[key] = src[key];
return obj;
}
},{"./presets":2}],2:[function(require,module,exports){
// Generated by LiveScript 1.3.1
var presets, out$ = typeof exports != 'undefined' && exports || this;
out$.presets = presets = {
rainbow: {
"type": 'stroke',
"path": 'M10 10L90 10',
"stroke": 'data:ldbar/res,gradient(0,1,#a551df,#fd51ad,#ff7f82,#ffb874,#ffeb90)',
"bbox": "10 10 80 10"
},
energy: {
"type": 'fill',
"path": 'M15 5L85 5A5 5 0 0 1 85 15L15 15A5 5 0 0 1 15 5',
"stroke": '#f00',
"fill": 'data:ldbar/res,gradient(45,2,#4e9,#8fb,#4e9)',
"fill-dir": "ltr",
"fill-background": '#444',
"fill-background-extrude": 1,
"bbox": "10 5 80 10"
},
stripe: {
"type": 'fill',
"path": 'M15 5L85 5A5 5 0 0 1 85 15L15 15A5 5 0 0 1 15 5',
"stroke": '#f00',
"fill": 'data:ldbar/res,stripe(#25b,#58e,1)',
"fill-dir": "ltr",
"fill-background": '#ddd',
"fill-background-extrude": 1,
"bbox": "10 5 80 10"
},
text: {
"type": 'fill',
"img": "data:image/svg+xml,LOADING ",
"fill-background-extrude": 1.3,
"pattern-size": 100,
"fill-dir": "ltr",
"img-size": "70,20",
"bbox": "0 0 70 20"
},
line: {
"type": 'stroke',
"path": 'M10 10L90 10',
"stroke": '#25b',
"stroke-width": 3,
"stroke-trail": '#ddd',
"stroke-trail-width": 1,
"bbox": "10 10 80 10"
},
fan: {
"type": 'stroke',
"path": 'M10 90A40 40 0 0 1 90 90',
"fill-dir": 'btt',
"fill": '#25b',
"fill-background": '#ddd',
"fill-background-extrude": 3,
"stroke-dir": 'normal',
"stroke": '#25b',
"stroke-width": '3',
"stroke-trail": '#ddd',
"stroke-trail-width": 0.5,
"bbox": "10 50 80 40"
},
circle: {
"type": 'stroke',
"path": 'M50 10A40 40 0 0 1 50 90A40 40 0 0 1 50 10',
"fill-dir": 'btt',
"fill": '#25b',
"fill-background": '#ddd',
"fill-background-extrude": 3,
"stroke-dir": 'normal',
"stroke": '#25b',
"stroke-width": '3',
"stroke-trail": '#ddd',
"stroke-trail-width": 0.5,
"bbox": "10 10 80 80"
},
bubble: {
"type": 'fill',
"path": 'M50 10A40 40 0 0 1 50 90A40 40 0 0 1 50 10',
"fill-dir": 'btt',
"fill": 'data:ldbar/res,bubble(#39d,#cef)',
"pattern-size": "150",
"fill-background": '#ddd',
"fill-background-extrude": 2,
"stroke-dir": 'normal',
"stroke": '#25b',
"stroke-width": '3',
"stroke-trail": '#ddd',
"stroke-trail-width": 0.5,
"bbox": "10 10 80 80"
}
};
},{}]},{},[1]);
;