Created
June 6, 2017 19:26
-
-
Save eyecatchup/bb62b99a7cc0ce3d3a33ad80e9991a73 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var requirejs, require, define; | |
| (function(e) { | |
| function h(e, t) { | |
| return f.call(e, t) | |
| } | |
| function p(e, t) { | |
| var n, r, i, s, o, a, f, l, h, p, d, v = t && t.split("/"), m = u.map, g = m && m["*"] || {}; | |
| if (e && e.charAt(0) === ".") | |
| if (t) { | |
| v = v.slice(0, v.length - 1), | |
| e = e.split("/"), | |
| o = e.length - 1, | |
| u.nodeIdCompat && c.test(e[o]) && (e[o] = e[o].replace(c, "")), | |
| e = v.concat(e); | |
| for (h = 0; h < e.length; h += 1) { | |
| d = e[h]; | |
| if (d === ".") | |
| e.splice(h, 1), | |
| h -= 1; | |
| else if (d === "..") { | |
| if (h === 1 && (e[2] === ".." || e[0] === "..")) | |
| break; | |
| h > 0 && (e.splice(h - 1, 2), | |
| h -= 2) | |
| } | |
| } | |
| e = e.join("/") | |
| } else | |
| e.indexOf("./") === 0 && (e = e.substring(2)); | |
| if ((v || g) && m) { | |
| n = e.split("/"); | |
| for (h = n.length; h > 0; h -= 1) { | |
| r = n.slice(0, h).join("/"); | |
| if (v) | |
| for (p = v.length; p > 0; p -= 1) { | |
| i = m[v.slice(0, p).join("/")]; | |
| if (i) { | |
| i = i[r]; | |
| if (i) { | |
| s = i, | |
| a = h; | |
| break | |
| } | |
| } | |
| } | |
| if (s) | |
| break; | |
| !f && g && g[r] && (f = g[r], | |
| l = h) | |
| } | |
| !s && f && (s = f, | |
| a = l), | |
| s && (n.splice(0, a, s), | |
| e = n.join("/")) | |
| } | |
| return e | |
| } | |
| function d(t, r) { | |
| return function() { | |
| var i = l.call(arguments, 0); | |
| return typeof i[0] != "string" && i.length === 1 && i.push(null), | |
| n.apply(e, i.concat([t, r])) | |
| } | |
| } | |
| function v(e) { | |
| return function(t) { | |
| return p(t, e) | |
| } | |
| } | |
| function m(e) { | |
| return function(t) { | |
| s[e] = t | |
| } | |
| } | |
| function g(n) { | |
| if (h(o, n)) { | |
| var r = o[n]; | |
| delete o[n], | |
| a[n] = !0, | |
| t.apply(e, r) | |
| } | |
| if (!h(s, n) && !h(a, n)) | |
| throw new Error("No " + n); | |
| return s[n] | |
| } | |
| function y(e) { | |
| var t, n = e ? e.indexOf("!") : -1; | |
| return n > -1 && (t = e.substring(0, n), | |
| e = e.substring(n + 1, e.length)), | |
| [t, e] | |
| } | |
| function b(e) { | |
| return function() { | |
| return u && u.config && u.config[e] || {} | |
| } | |
| } | |
| var t, n, r, i, s = {}, o = {}, u = {}, a = {}, f = Object.prototype.hasOwnProperty, l = [].slice, c = /\.js$/; | |
| r = function(e, t) { | |
| var n, r = y(e), i = r[0]; | |
| return e = r[1], | |
| i && (i = p(i, t), | |
| n = g(i)), | |
| i ? n && n.normalize ? e = n.normalize(e, v(t)) : e = p(e, t) : (e = p(e, t), | |
| r = y(e), | |
| i = r[0], | |
| e = r[1], | |
| i && (n = g(i))), | |
| { | |
| f: i ? i + "!" + e : e, | |
| n: e, | |
| pr: i, | |
| p: n | |
| } | |
| } | |
| , | |
| i = { | |
| require: function(e) { | |
| return d(e) | |
| }, | |
| exports: function(e) { | |
| var t = s[e]; | |
| return typeof t != "undefined" ? t : s[e] = {} | |
| }, | |
| module: function(e) { | |
| return { | |
| id: e, | |
| uri: "", | |
| exports: s[e], | |
| config: b(e) | |
| } | |
| } | |
| }, | |
| t = function(t, n, u, f) { | |
| var l, c, p, v, y, b = [], w = typeof u, E; | |
| f = f || t; | |
| if (w === "undefined" || w === "function") { | |
| n = !n.length && u.length ? ["require", "exports", "module"] : n; | |
| for (y = 0; y < n.length; y += 1) { | |
| v = r(n[y], f), | |
| c = v.f; | |
| if (c === "require") | |
| b[y] = i.require(t); | |
| else if (c === "exports") | |
| b[y] = i.exports(t), | |
| E = !0; | |
| else if (c === "module") | |
| l = b[y] = i.module(t); | |
| else if (h(s, c) || h(o, c) || h(a, c)) | |
| b[y] = g(c); | |
| else { | |
| if (!v.p) | |
| throw new Error(t + " missing " + c); | |
| v.p.load(v.n, d(f, !0), m(c), {}), | |
| b[y] = s[c] | |
| } | |
| } | |
| p = u ? u.apply(s[t], b) : undefined; | |
| if (t) | |
| if (l && l.exports !== e && l.exports !== s[t]) | |
| s[t] = l.exports; | |
| else if (p !== e || !E) | |
| s[t] = p | |
| } else | |
| t && (s[t] = u) | |
| } | |
| , | |
| requirejs = require = n = function(s, o, a, f, l) { | |
| if (typeof s == "string") | |
| return i[s] ? i[s](o) : g(r(s, o).f); | |
| if (!s.splice) { | |
| u = s, | |
| u.deps && n(u.deps, u.callback); | |
| if (!o) | |
| return; | |
| o.splice ? (s = o, | |
| o = a, | |
| a = null) : s = e | |
| } | |
| return o = o || function() {} | |
| , | |
| typeof a == "function" && (a = f, | |
| f = l), | |
| f ? t(e, s, o, a) : setTimeout(function() { | |
| t(e, s, o, a) | |
| }, 4), | |
| n | |
| } | |
| , | |
| n.config = function(e) { | |
| return n(e) | |
| } | |
| , | |
| requirejs._defined = s, | |
| define = function(e, t, n) { | |
| t.splice || (n = t, | |
| t = []), | |
| !h(s, e) && !h(o, e) && (o[e] = [e, t, n]) | |
| } | |
| , | |
| define.amd = { | |
| jQuery: !0 | |
| } | |
| })(), | |
| define("../../../libs/requirejs/almond", function() {}), | |
| function(e, t) { | |
| typeof module == "object" && typeof module.exports == "object" ? module.exports = e.document ? t(e, !0) : function(e) { | |
| if (!e.document) | |
| throw new Error("jQuery requires a window with a document"); | |
| return t(e) | |
| } | |
| : t(e) | |
| }(typeof window != "undefined" ? window : this, function(window, noGlobal) { | |
| function isArrayLike(e) { | |
| var t = !!e && "length"in e && e.length | |
| , n = jQuery.type(e); | |
| return n === "function" || jQuery.isWindow(e) ? !1 : n === "array" || t === 0 || typeof t == "number" && t > 0 && t - 1 in e | |
| } | |
| function winnow(e, t, n) { | |
| if (jQuery.isFunction(t)) | |
| return jQuery.grep(e, function(e, r) { | |
| return !!t.call(e, r, e) !== n | |
| }); | |
| if (t.nodeType) | |
| return jQuery.grep(e, function(e) { | |
| return e === t !== n | |
| }); | |
| if (typeof t == "string") { | |
| if (risSimple.test(t)) | |
| return jQuery.filter(t, e, n); | |
| t = jQuery.filter(t, e) | |
| } | |
| return jQuery.grep(e, function(e) { | |
| return indexOf.call(t, e) > -1 !== n | |
| }) | |
| } | |
| function sibling(e, t) { | |
| while ((e = e[t]) && e.nodeType !== 1) | |
| ; | |
| return e | |
| } | |
| function createOptions(e) { | |
| var t = {}; | |
| return jQuery.each(e.match(rnotwhite) || [], function(e, n) { | |
| t[n] = !0 | |
| }), | |
| t | |
| } | |
| function completed() { | |
| document.removeEventListener("DOMContentLoaded", completed), | |
| window.removeEventListener("load", completed), | |
| jQuery.ready() | |
| } | |
| function Data() { | |
| this.expando = jQuery.expando + Data.uid++ | |
| } | |
| function dataAttr(e, t, n) { | |
| var r; | |
| if (n === undefined && e.nodeType === 1) { | |
| r = "data-" + t.replace(rmultiDash, "-$&").toLowerCase(), | |
| n = e.getAttribute(r); | |
| if (typeof n == "string") { | |
| try { | |
| n = n === "true" ? !0 : n === "false" ? !1 : n === "null" ? null : +n + "" === n ? +n : rbrace.test(n) ? jQuery.parseJSON(n) : n | |
| } catch (i) {} | |
| dataUser.set(e, t, n) | |
| } else | |
| n = undefined | |
| } | |
| return n | |
| } | |
| function adjustCSS(e, t, n, r) { | |
| var i, s = 1, o = 20, u = r ? function() { | |
| return r.cur() | |
| } | |
| : function() { | |
| return jQuery.css(e, t, "") | |
| } | |
| , a = u(), f = n && n[3] || (jQuery.cssNumber[t] ? "" : "px"), l = (jQuery.cssNumber[t] || f !== "px" && +a) && rcssNum.exec(jQuery.css(e, t)); | |
| if (l && l[3] !== f) { | |
| f = f || l[3], | |
| n = n || [], | |
| l = +a || 1; | |
| do | |
| s = s || ".5", | |
| l /= s, | |
| jQuery.style(e, t, l + f); | |
| while (s !== (s = u() / a) && s !== 1 && --o) | |
| } | |
| return n && (l = +l || +a || 0, | |
| i = n[1] ? l + (n[1] + 1) * n[2] : +n[2], | |
| r && (r.unit = f, | |
| r.start = l, | |
| r.end = i)), | |
| i | |
| } | |
| function getAll(e, t) { | |
| var n = typeof e.getElementsByTagName != "undefined" ? e.getElementsByTagName(t || "*") : typeof e.querySelectorAll != "undefined" ? e.querySelectorAll(t || "*") : []; | |
| return t === undefined || t && jQuery.nodeName(e, t) ? jQuery.merge([e], n) : n | |
| } | |
| function setGlobalEval(e, t) { | |
| var n = 0 | |
| , r = e.length; | |
| for (; n < r; n++) | |
| dataPriv.set(e[n], "globalEval", !t || dataPriv.get(t[n], "globalEval")) | |
| } | |
| function buildFragment(e, t, n, r, i) { | |
| var s, o, u, a, f, l, c = t.createDocumentFragment(), h = [], p = 0, d = e.length; | |
| for (; p < d; p++) { | |
| s = e[p]; | |
| if (s || s === 0) | |
| if (jQuery.type(s) === "object") | |
| jQuery.merge(h, s.nodeType ? [s] : s); | |
| else if (!rhtml.test(s)) | |
| h.push(t.createTextNode(s)); | |
| else { | |
| o = o || c.appendChild(t.createElement("div")), | |
| u = (rtagName.exec(s) || ["", ""])[1].toLowerCase(), | |
| a = wrapMap[u] || wrapMap._default, | |
| o.innerHTML = a[1] + jQuery.htmlPrefilter(s) + a[2], | |
| l = a[0]; | |
| while (l--) | |
| o = o.lastChild; | |
| jQuery.merge(h, o.childNodes), | |
| o = c.firstChild, | |
| o.textContent = "" | |
| } | |
| } | |
| c.textContent = "", | |
| p = 0; | |
| while (s = h[p++]) { | |
| if (r && jQuery.inArray(s, r) > -1) { | |
| i && i.push(s); | |
| continue | |
| } | |
| f = jQuery.contains(s.ownerDocument, s), | |
| o = getAll(c.appendChild(s), "script"), | |
| f && setGlobalEval(o); | |
| if (n) { | |
| l = 0; | |
| while (s = o[l++]) | |
| rscriptType.test(s.type || "") && n.push(s) | |
| } | |
| } | |
| return c | |
| } | |
| function returnTrue() { | |
| return !0 | |
| } | |
| function returnFalse() { | |
| return !1 | |
| } | |
| function safeActiveElement() { | |
| try { | |
| return document.activeElement | |
| } catch (e) {} | |
| } | |
| function on(e, t, n, r, i, s) { | |
| var o, u; | |
| if (typeof t == "object") { | |
| typeof n != "string" && (r = r || n, | |
| n = undefined); | |
| for (u in t) | |
| on(e, u, n, r, t[u], s); | |
| return e | |
| } | |
| r == null && i == null ? (i = n, | |
| r = n = undefined) : i == null && (typeof n == "string" ? (i = r, | |
| r = undefined) : (i = r, | |
| r = n, | |
| n = undefined)); | |
| if (i === !1) | |
| i = returnFalse; | |
| else if (!i) | |
| return this; | |
| return s === 1 && (o = i, | |
| i = function(e) { | |
| return jQuery().off(e), | |
| o.apply(this, arguments) | |
| } | |
| , | |
| i.guid = o.guid || (o.guid = jQuery.guid++)), | |
| e.each(function() { | |
| jQuery.event.add(this, t, i, r, n) | |
| }) | |
| } | |
| function manipulationTarget(e, t) { | |
| return jQuery.nodeName(e, "table") && jQuery.nodeName(t.nodeType !== 11 ? t : t.firstChild, "tr") ? e.getElementsByTagName("tbody")[0] || e : e | |
| } | |
| function disableScript(e) { | |
| return e.type = (e.getAttribute("type") !== null) + "/" + e.type, | |
| e | |
| } | |
| function restoreScript(e) { | |
| var t = rscriptTypeMasked.exec(e.type); | |
| return t ? e.type = t[1] : e.removeAttribute("type"), | |
| e | |
| } | |
| function cloneCopyEvent(e, t) { | |
| var n, r, i, s, o, u, a, f; | |
| if (t.nodeType !== 1) | |
| return; | |
| if (dataPriv.hasData(e)) { | |
| s = dataPriv.access(e), | |
| o = dataPriv.set(t, s), | |
| f = s.events; | |
| if (f) { | |
| delete o.handle, | |
| o.events = {}; | |
| for (i in f) | |
| for (n = 0, | |
| r = f[i].length; n < r; n++) | |
| jQuery.event.add(t, i, f[i][n]) | |
| } | |
| } | |
| dataUser.hasData(e) && (u = dataUser.access(e), | |
| a = jQuery.extend({}, u), | |
| dataUser.set(t, a)) | |
| } | |
| function fixInput(e, t) { | |
| var n = t.nodeName.toLowerCase(); | |
| if (n === "input" && rcheckableType.test(e.type)) | |
| t.checked = e.checked; | |
| else if (n === "input" || n === "textarea") | |
| t.defaultValue = e.defaultValue | |
| } | |
| function domManip(e, t, n, r) { | |
| t = concat.apply([], t); | |
| var i, s, o, u, a, f, l = 0, c = e.length, h = c - 1, p = t[0], d = jQuery.isFunction(p); | |
| if (d || c > 1 && typeof p == "string" && !support.checkClone && rchecked.test(p)) | |
| return e.each(function(i) { | |
| var s = e.eq(i); | |
| d && (t[0] = p.call(this, i, s.html())), | |
| domManip(s, t, n, r) | |
| }); | |
| if (c) { | |
| i = buildFragment(t, e[0].ownerDocument, !1, e, r), | |
| s = i.firstChild, | |
| i.childNodes.length === 1 && (i = s); | |
| if (s || r) { | |
| o = jQuery.map(getAll(i, "script"), disableScript), | |
| u = o.length; | |
| for (; l < c; l++) | |
| a = i, | |
| l !== h && (a = jQuery.clone(a, !0, !0), | |
| u && jQuery.merge(o, getAll(a, "script"))), | |
| n.call(e[l], a, l); | |
| if (u) { | |
| f = o[o.length - 1].ownerDocument, | |
| jQuery.map(o, restoreScript); | |
| for (l = 0; l < u; l++) | |
| a = o[l], | |
| rscriptType.test(a.type || "") && !dataPriv.access(a, "globalEval") && jQuery.contains(f, a) && (a.src ? jQuery._evalUrl && jQuery._evalUrl(a.src) : jQuery.globalEval(a.textContent.replace(rcleanScript, ""))) | |
| } | |
| } | |
| } | |
| return e | |
| } | |
| function remove(e, t, n) { | |
| var r, i = t ? jQuery.filter(t, e) : e, s = 0; | |
| for (; (r = i[s]) != null; s++) | |
| !n && r.nodeType === 1 && jQuery.cleanData(getAll(r)), | |
| r.parentNode && (n && jQuery.contains(r.ownerDocument, r) && setGlobalEval(getAll(r, "script")), | |
| r.parentNode.removeChild(r)); | |
| return e | |
| } | |
| function actualDisplay(e, t) { | |
| var n = jQuery(t.createElement(e)).appendTo(t.body) | |
| , r = jQuery.css(n[0], "display"); | |
| return n.detach(), | |
| r | |
| } | |
| function defaultDisplay(e) { | |
| var t = document | |
| , n = elemdisplay[e]; | |
| if (!n) { | |
| n = actualDisplay(e, t); | |
| if (n === "none" || !n) | |
| iframe = (iframe || jQuery("<iframe frameborder='0' width='0' height='0'/>")).appendTo(t.documentElement), | |
| t = iframe[0].contentDocument, | |
| t.write(), | |
| t.close(), | |
| n = actualDisplay(e, t), | |
| iframe.detach(); | |
| elemdisplay[e] = n | |
| } | |
| return n | |
| } | |
| function curCSS(e, t, n) { | |
| var r, i, s, o, u = e.style; | |
| return n = n || getStyles(e), | |
| n && (o = n.getPropertyValue(t) || n[t], | |
| o === "" && !jQuery.contains(e.ownerDocument, e) && (o = jQuery.style(e, t)), | |
| !support.pixelMarginRight() && rnumnonpx.test(o) && rmargin.test(t) && (r = u.width, | |
| i = u.minWidth, | |
| s = u.maxWidth, | |
| u.minWidth = u.maxWidth = u.width = o, | |
| o = n.width, | |
| u.width = r, | |
| u.minWidth = i, | |
| u.maxWidth = s)), | |
| o !== undefined ? o + "" : o | |
| } | |
| function addGetHookIf(e, t) { | |
| return { | |
| get: function() { | |
| if (e()) { | |
| delete this.get; | |
| return | |
| } | |
| return (this.get = t).apply(this, arguments) | |
| } | |
| } | |
| } | |
| function vendorPropName(e) { | |
| if (e in emptyStyle) | |
| return e; | |
| var t = e[0].toUpperCase() + e.slice(1) | |
| , n = cssPrefixes.length; | |
| while (n--) { | |
| e = cssPrefixes[n] + t; | |
| if (e in emptyStyle) | |
| return e | |
| } | |
| } | |
| function setPositiveNumber(e, t, n) { | |
| var r = rcssNum.exec(t); | |
| return r ? Math.max(0, r[2] - (n || 0)) + (r[3] || "px") : t | |
| } | |
| function augmentWidthOrHeight(e, t, n, r, i) { | |
| var s = n === (r ? "border" : "content") ? 4 : t === "width" ? 1 : 0 | |
| , o = 0; | |
| for (; s < 4; s += 2) | |
| n === "margin" && (o += jQuery.css(e, n + cssExpand[s], !0, i)), | |
| r ? (n === "content" && (o -= jQuery.css(e, "padding" + cssExpand[s], !0, i)), | |
| n !== "margin" && (o -= jQuery.css(e, "border" + cssExpand[s] + "Width", !0, i))) : (o += jQuery.css(e, "padding" + cssExpand[s], !0, i), | |
| n !== "padding" && (o += jQuery.css(e, "border" + cssExpand[s] + "Width", !0, i))); | |
| return o | |
| } | |
| function getWidthOrHeight(e, t, n) { | |
| var r = !0 | |
| , i = t === "width" ? e.offsetWidth : e.offsetHeight | |
| , s = getStyles(e) | |
| , o = jQuery.css(e, "boxSizing", !1, s) === "border-box"; | |
| document.msFullscreenElement && window.top !== window && e.getClientRects().length && (i = Math.round(e.getBoundingClientRect()[t] * 100)); | |
| if (i <= 0 || i == null) { | |
| i = curCSS(e, t, s); | |
| if (i < 0 || i == null) | |
| i = e.style[t]; | |
| if (rnumnonpx.test(i)) | |
| return i; | |
| r = o && (support.boxSizingReliable() || i === e.style[t]), | |
| i = parseFloat(i) || 0 | |
| } | |
| return i + augmentWidthOrHeight(e, t, n || (o ? "border" : "content"), r, s) + "px" | |
| } | |
| function showHide(e, t) { | |
| var n, r, i, s = [], o = 0, u = e.length; | |
| for (; o < u; o++) { | |
| r = e[o]; | |
| if (!r.style) | |
| continue; | |
| s[o] = dataPriv.get(r, "olddisplay"), | |
| n = r.style.display, | |
| t ? (!s[o] && n === "none" && (r.style.display = ""), | |
| r.style.display === "" && isHidden(r) && (s[o] = dataPriv.access(r, "olddisplay", defaultDisplay(r.nodeName)))) : (i = isHidden(r), | |
| (n !== "none" || !i) && dataPriv.set(r, "olddisplay", i ? n : jQuery.css(r, "display"))) | |
| } | |
| for (o = 0; o < u; o++) { | |
| r = e[o]; | |
| if (!r.style) | |
| continue; | |
| if (!t || r.style.display === "none" || r.style.display === "") | |
| r.style.display = t ? s[o] || "" : "none" | |
| } | |
| return e | |
| } | |
| function Tween(e, t, n, r, i) { | |
| return new Tween.prototype.init(e,t,n,r,i) | |
| } | |
| function createFxNow() { | |
| return window.setTimeout(function() { | |
| fxNow = undefined | |
| }), | |
| fxNow = jQuery.now() | |
| } | |
| function genFx(e, t) { | |
| var n, r = 0, i = { | |
| height: e | |
| }; | |
| t = t ? 1 : 0; | |
| for (; r < 4; r += 2 - t) | |
| n = cssExpand[r], | |
| i["margin" + n] = i["padding" + n] = e; | |
| return t && (i.opacity = i.width = e), | |
| i | |
| } | |
| function createTween(e, t, n) { | |
| var r, i = (Animation.tweeners[t] || []).concat(Animation.tweeners["*"]), s = 0, o = i.length; | |
| for (; s < o; s++) | |
| if (r = i[s].call(n, t, e)) | |
| return r | |
| } | |
| function defaultPrefilter(e, t, n) { | |
| var r, i, s, o, u, a, f, l, c = this, h = {}, p = e.style, d = e.nodeType && isHidden(e), v = dataPriv.get(e, "fxshow"); | |
| n.queue || (u = jQuery._queueHooks(e, "fx"), | |
| u.unqueued == null && (u.unqueued = 0, | |
| a = u.empty.fire, | |
| u.empty.fire = function() { | |
| u.unqueued || a() | |
| } | |
| ), | |
| u.unqueued++, | |
| c.always(function() { | |
| c.always(function() { | |
| u.unqueued--, | |
| jQuery.queue(e, "fx").length || u.empty.fire() | |
| }) | |
| })), | |
| e.nodeType === 1 && ("height"in t || "width"in t) && (n.overflow = [p.overflow, p.overflowX, p.overflowY], | |
| f = jQuery.css(e, "display"), | |
| l = f === "none" ? dataPriv.get(e, "olddisplay") || defaultDisplay(e.nodeName) : f, | |
| l === "inline" && jQuery.css(e, "float") === "none" && (p.display = "inline-block")), | |
| n.overflow && (p.overflow = "hidden", | |
| c.always(function() { | |
| p.overflow = n.overflow[0], | |
| p.overflowX = n.overflow[1], | |
| p.overflowY = n.overflow[2] | |
| })); | |
| for (r in t) { | |
| i = t[r]; | |
| if (rfxtypes.exec(i)) { | |
| delete t[r], | |
| s = s || i === "toggle"; | |
| if (i === (d ? "hide" : "show")) { | |
| if (i !== "show" || !v || v[r] === undefined) | |
| continue; | |
| d = !0 | |
| } | |
| h[r] = v && v[r] || jQuery.style(e, r) | |
| } else | |
| f = undefined | |
| } | |
| if (!jQuery.isEmptyObject(h)) { | |
| v ? "hidden"in v && (d = v.hidden) : v = dataPriv.access(e, "fxshow", {}), | |
| s && (v.hidden = !d), | |
| d ? jQuery(e).show() : c.done(function() { | |
| jQuery(e).hide() | |
| }), | |
| c.done(function() { | |
| var t; | |
| dataPriv.remove(e, "fxshow"); | |
| for (t in h) | |
| jQuery.style(e, t, h[t]) | |
| }); | |
| for (r in h) | |
| o = createTween(d ? v[r] : 0, r, c), | |
| r in v || (v[r] = o.start, | |
| d && (o.end = o.start, | |
| o.start = r === "width" || r === "height" ? 1 : 0)) | |
| } else | |
| (f === "none" ? defaultDisplay(e.nodeName) : f) === "inline" && (p.display = f) | |
| } | |
| function propFilter(e, t) { | |
| var n, r, i, s, o; | |
| for (n in e) { | |
| r = jQuery.camelCase(n), | |
| i = t[r], | |
| s = e[n], | |
| jQuery.isArray(s) && (i = s[1], | |
| s = e[n] = s[0]), | |
| n !== r && (e[r] = s, | |
| delete e[n]), | |
| o = jQuery.cssHooks[r]; | |
| if (o && "expand"in o) { | |
| s = o.expand(s), | |
| delete e[r]; | |
| for (n in s) | |
| n in e || (e[n] = s[n], | |
| t[n] = i) | |
| } else | |
| t[r] = i | |
| } | |
| } | |
| function Animation(e, t, n) { | |
| var r, i, s = 0, o = Animation.prefilters.length, u = jQuery.Deferred().always(function() { | |
| delete a.elem | |
| }), a = function() { | |
| if (i) | |
| return !1; | |
| var t = fxNow || createFxNow() | |
| , n = Math.max(0, f.startTime + f.duration - t) | |
| , r = n / f.duration || 0 | |
| , s = 1 - r | |
| , o = 0 | |
| , a = f.tweens.length; | |
| for (; o < a; o++) | |
| f.tweens[o].run(s); | |
| return u.notifyWith(e, [f, s, n]), | |
| s < 1 && a ? n : (u.resolveWith(e, [f]), | |
| !1) | |
| }, f = u.promise({ | |
| elem: e, | |
| props: jQuery.extend({}, t), | |
| opts: jQuery.extend(!0, { | |
| specialEasing: {}, | |
| easing: jQuery.easing._default | |
| }, n), | |
| originalProperties: t, | |
| originalOptions: n, | |
| startTime: fxNow || createFxNow(), | |
| duration: n.duration, | |
| tweens: [], | |
| createTween: function(t, n) { | |
| var r = jQuery.Tween(e, f.opts, t, n, f.opts.specialEasing[t] || f.opts.easing); | |
| return f.tweens.push(r), | |
| r | |
| }, | |
| stop: function(t) { | |
| var n = 0 | |
| , r = t ? f.tweens.length : 0; | |
| if (i) | |
| return this; | |
| i = !0; | |
| for (; n < r; n++) | |
| f.tweens[n].run(1); | |
| return t ? (u.notifyWith(e, [f, 1, 0]), | |
| u.resolveWith(e, [f, t])) : u.rejectWith(e, [f, t]), | |
| this | |
| } | |
| }), l = f.props; | |
| propFilter(l, f.opts.specialEasing); | |
| for (; s < o; s++) { | |
| r = Animation.prefilters[s].call(f, e, l, f.opts); | |
| if (r) | |
| return jQuery.isFunction(r.stop) && (jQuery._queueHooks(f.elem, f.opts.queue).stop = jQuery.proxy(r.stop, r)), | |
| r | |
| } | |
| return jQuery.map(l, createTween, f), | |
| jQuery.isFunction(f.opts.start) && f.opts.start.call(e, f), | |
| jQuery.fx.timer(jQuery.extend(a, { | |
| elem: e, | |
| anim: f, | |
| queue: f.opts.queue | |
| })), | |
| f.progress(f.opts.progress).done(f.opts.done, f.opts.complete).fail(f.opts.fail).always(f.opts.always) | |
| } | |
| function getClass(e) { | |
| return e.getAttribute && e.getAttribute("class") || "" | |
| } | |
| function addToPrefiltersOrTransports(e) { | |
| return function(t, n) { | |
| typeof t != "string" && (n = t, | |
| t = "*"); | |
| var r, i = 0, s = t.toLowerCase().match(rnotwhite) || []; | |
| if (jQuery.isFunction(n)) | |
| while (r = s[i++]) | |
| r[0] === "+" ? (r = r.slice(1) || "*", | |
| (e[r] = e[r] || []).unshift(n)) : (e[r] = e[r] || []).push(n) | |
| } | |
| } | |
| function inspectPrefiltersOrTransports(e, t, n, r) { | |
| function o(u) { | |
| var a; | |
| return i[u] = !0, | |
| jQuery.each(e[u] || [], function(e, u) { | |
| var f = u(t, n, r); | |
| if (typeof f == "string" && !s && !i[f]) | |
| return t.dataTypes.unshift(f), | |
| o(f), | |
| !1; | |
| if (s) | |
| return !(a = f) | |
| }), | |
| a | |
| } | |
| var i = {} | |
| , s = e === transports; | |
| return o(t.dataTypes[0]) || !i["*"] && o("*") | |
| } | |
| function ajaxExtend(e, t) { | |
| var n, r, i = jQuery.ajaxSettings.flatOptions || {}; | |
| for (n in t) | |
| t[n] !== undefined && ((i[n] ? e : r || (r = {}))[n] = t[n]); | |
| return r && jQuery.extend(!0, e, r), | |
| e | |
| } | |
| function ajaxHandleResponses(e, t, n) { | |
| var r, i, s, o, u = e.contents, a = e.dataTypes; | |
| while (a[0] === "*") | |
| a.shift(), | |
| r === undefined && (r = e.mimeType || t.getResponseHeader("Content-Type")); | |
| if (r) | |
| for (i in u) | |
| if (u[i] && u[i].test(r)) { | |
| a.unshift(i); | |
| break | |
| } | |
| if (a[0]in n) | |
| s = a[0]; | |
| else { | |
| for (i in n) { | |
| if (!a[0] || e.converters[i + " " + a[0]]) { | |
| s = i; | |
| break | |
| } | |
| o || (o = i) | |
| } | |
| s = s || o | |
| } | |
| if (s) | |
| return s !== a[0] && a.unshift(s), | |
| n[s] | |
| } | |
| function ajaxConvert(e, t, n, r) { | |
| var i, s, o, u, a, f = {}, l = e.dataTypes.slice(); | |
| if (l[1]) | |
| for (o in e.converters) | |
| f[o.toLowerCase()] = e.converters[o]; | |
| s = l.shift(); | |
| while (s) { | |
| e.responseFields[s] && (n[e.responseFields[s]] = t), | |
| !a && r && e.dataFilter && (t = e.dataFilter(t, e.dataType)), | |
| a = s, | |
| s = l.shift(); | |
| if (s) | |
| if (s === "*") | |
| s = a; | |
| else if (a !== "*" && a !== s) { | |
| o = f[a + " " + s] || f["* " + s]; | |
| if (!o) | |
| for (i in f) { | |
| u = i.split(" "); | |
| if (u[1] === s) { | |
| o = f[a + " " + u[0]] || f["* " + u[0]]; | |
| if (o) { | |
| o === !0 ? o = f[i] : f[i] !== !0 && (s = u[0], | |
| l.unshift(u[1])); | |
| break | |
| } | |
| } | |
| } | |
| if (o !== !0) | |
| if (o && e.throws) | |
| t = o(t); | |
| else | |
| try { | |
| t = o(t) | |
| } catch (c) { | |
| return { | |
| state: "parsererror", | |
| error: o ? c : "No conversion from " + a + " to " + s | |
| } | |
| } | |
| } | |
| } | |
| return { | |
| state: "success", | |
| data: t | |
| } | |
| } | |
| function buildParams(e, t, n, r) { | |
| var i; | |
| if (jQuery.isArray(t)) | |
| jQuery.each(t, function(t, i) { | |
| n || rbracket.test(e) ? r(e, i) : buildParams(e + "[" + (typeof i == "object" && i != null ? t : "") + "]", i, n, r) | |
| }); | |
| else if (!n && jQuery.type(t) === "object") | |
| for (i in t) | |
| buildParams(e + "[" + i + "]", t[i], n, r); | |
| else | |
| r(e, t) | |
| } | |
| function getWindow(e) { | |
| return jQuery.isWindow(e) ? e : e.nodeType === 9 && e.defaultView | |
| } | |
| var arr = [] | |
| , document = window.document | |
| , slice = arr.slice | |
| , concat = arr.concat | |
| , push = arr.push | |
| , indexOf = arr.indexOf | |
| , class2type = {} | |
| , toString = class2type.toString | |
| , hasOwn = class2type.hasOwnProperty | |
| , support = {} | |
| , version = "2.2.0" | |
| , jQuery = function(e, t) { | |
| return new jQuery.fn.init(e,t) | |
| } | |
| , rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g | |
| , rmsPrefix = /^-ms-/ | |
| , rdashAlpha = /-([\da-z])/gi | |
| , fcamelCase = function(e, t) { | |
| return t.toUpperCase() | |
| }; | |
| jQuery.fn = jQuery.prototype = { | |
| jquery: version, | |
| constructor: jQuery, | |
| selector: "", | |
| length: 0, | |
| toArray: function() { | |
| return slice.call(this) | |
| }, | |
| get: function(e) { | |
| return e != null ? e < 0 ? this[e + this.length] : this[e] : slice.call(this) | |
| }, | |
| pushStack: function(e) { | |
| var t = jQuery.merge(this.constructor(), e); | |
| return t.prevObject = this, | |
| t.context = this.context, | |
| t | |
| }, | |
| each: function(e) { | |
| return jQuery.each(this, e) | |
| }, | |
| map: function(e) { | |
| return this.pushStack(jQuery.map(this, function(t, n) { | |
| return e.call(t, n, t) | |
| })) | |
| }, | |
| slice: function() { | |
| return this.pushStack(slice.apply(this, arguments)) | |
| }, | |
| first: function() { | |
| return this.eq(0) | |
| }, | |
| last: function() { | |
| return this.eq(-1) | |
| }, | |
| eq: function(e) { | |
| var t = this.length | |
| , n = +e + (e < 0 ? t : 0); | |
| return this.pushStack(n >= 0 && n < t ? [this[n]] : []) | |
| }, | |
| end: function() { | |
| return this.prevObject || this.constructor() | |
| }, | |
| push: push, | |
| sort: arr.sort, | |
| splice: arr.splice | |
| }, | |
| jQuery.extend = jQuery.fn.extend = function() { | |
| var e, t, n, r, i, s, o = arguments[0] || {}, u = 1, a = arguments.length, f = !1; | |
| typeof o == "boolean" && (f = o, | |
| o = arguments[u] || {}, | |
| u++), | |
| typeof o != "object" && !jQuery.isFunction(o) && (o = {}), | |
| u === a && (o = this, | |
| u--); | |
| for (; u < a; u++) | |
| if ((e = arguments[u]) != null) | |
| for (t in e) { | |
| n = o[t], | |
| r = e[t]; | |
| if (o === r) | |
| continue; | |
| f && r && (jQuery.isPlainObject(r) || (i = jQuery.isArray(r))) ? (i ? (i = !1, | |
| s = n && jQuery.isArray(n) ? n : []) : s = n && jQuery.isPlainObject(n) ? n : {}, | |
| o[t] = jQuery.extend(f, s, r)) : r !== undefined && (o[t] = r) | |
| } | |
| return o | |
| } | |
| , | |
| jQuery.extend({ | |
| expando: "jQuery" + (version + Math.random()).replace(/\D/g, ""), | |
| isReady: !0, | |
| error: function(e) { | |
| throw new Error(e) | |
| }, | |
| noop: function() {}, | |
| isFunction: function(e) { | |
| return jQuery.type(e) === "function" | |
| }, | |
| isArray: Array.isArray, | |
| isWindow: function(e) { | |
| return e != null && e === e.window | |
| }, | |
| isNumeric: function(e) { | |
| var t = e && e.toString(); | |
| return !jQuery.isArray(e) && t - parseFloat(t) + 1 >= 0 | |
| }, | |
| isPlainObject: function(e) { | |
| return jQuery.type(e) !== "object" || e.nodeType || jQuery.isWindow(e) ? !1 : e.constructor && !hasOwn.call(e.constructor.prototype, "isPrototypeOf") ? !1 : !0 | |
| }, | |
| isEmptyObject: function(e) { | |
| var t; | |
| for (t in e) | |
| return !1; | |
| return !0 | |
| }, | |
| type: function(e) { | |
| return e == null ? e + "" : typeof e == "object" || typeof e == "function" ? class2type[toString.call(e)] || "object" : typeof e | |
| }, | |
| globalEval: function(code) { | |
| var script, indirect = eval; | |
| code = jQuery.trim(code), | |
| code && (code.indexOf("use strict") === 1 ? (script = document.createElement("script"), | |
| script.text = code, | |
| document.head.appendChild(script).parentNode.removeChild(script)) : indirect(code)) | |
| }, | |
| camelCase: function(e) { | |
| return e.replace(rmsPrefix, "ms-").replace(rdashAlpha, fcamelCase) | |
| }, | |
| nodeName: function(e, t) { | |
| return e.nodeName && e.nodeName.toLowerCase() === t.toLowerCase() | |
| }, | |
| each: function(e, t) { | |
| var n, r = 0; | |
| if (isArrayLike(e)) { | |
| n = e.length; | |
| for (; r < n; r++) | |
| if (t.call(e[r], r, e[r]) === !1) | |
| break | |
| } else | |
| for (r in e) | |
| if (t.call(e[r], r, e[r]) === !1) | |
| break; | |
| return e | |
| }, | |
| trim: function(e) { | |
| return e == null ? "" : (e + "").replace(rtrim, "") | |
| }, | |
| makeArray: function(e, t) { | |
| var n = t || []; | |
| return e != null && (isArrayLike(Object(e)) ? jQuery.merge(n, typeof e == "string" ? [e] : e) : push.call(n, e)), | |
| n | |
| }, | |
| inArray: function(e, t, n) { | |
| return t == null ? -1 : indexOf.call(t, e, n) | |
| }, | |
| merge: function(e, t) { | |
| var n = +t.length | |
| , r = 0 | |
| , i = e.length; | |
| for (; r < n; r++) | |
| e[i++] = t[r]; | |
| return e.length = i, | |
| e | |
| }, | |
| grep: function(e, t, n) { | |
| var r, i = [], s = 0, o = e.length, u = !n; | |
| for (; s < o; s++) | |
| r = !t(e[s], s), | |
| r !== u && i.push(e[s]); | |
| return i | |
| }, | |
| map: function(e, t, n) { | |
| var r, i, s = 0, o = []; | |
| if (isArrayLike(e)) { | |
| r = e.length; | |
| for (; s < r; s++) | |
| i = t(e[s], s, n), | |
| i != null && o.push(i) | |
| } else | |
| for (s in e) | |
| i = t(e[s], s, n), | |
| i != null && o.push(i); | |
| return concat.apply([], o) | |
| }, | |
| guid: 1, | |
| proxy: function(e, t) { | |
| var n, r, i; | |
| return typeof t == "string" && (n = e[t], | |
| t = e, | |
| e = n), | |
| jQuery.isFunction(e) ? (r = slice.call(arguments, 2), | |
| i = function() { | |
| return e.apply(t || this, r.concat(slice.call(arguments))) | |
| } | |
| , | |
| i.guid = e.guid = e.guid || jQuery.guid++, | |
| i) : undefined | |
| }, | |
| now: Date.now, | |
| support: support | |
| }), | |
| typeof Symbol == "function" && (jQuery.fn[Symbol.iterator] = arr[Symbol.iterator]), | |
| jQuery.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "), function(e, t) { | |
| class2type["[object " + t + "]"] = t.toLowerCase() | |
| }); | |
| var Sizzle = function(e) { | |
| function st(e, t, r, i) { | |
| var s, u, f, l, c, d, g, y, S = t && t.ownerDocument, x = t ? t.nodeType : 9; | |
| r = r || []; | |
| if (typeof e != "string" || !e || x !== 1 && x !== 9 && x !== 11) | |
| return r; | |
| if (!i) { | |
| (t ? t.ownerDocument || t : E) !== p && h(t), | |
| t = t || p; | |
| if (v) { | |
| if (x !== 11 && (d = Y.exec(e))) | |
| if (s = d[1]) { | |
| if (x === 9) { | |
| if (!(f = t.getElementById(s))) | |
| return r; | |
| if (f.id === s) | |
| return r.push(f), | |
| r | |
| } else if (S && (f = S.getElementById(s)) && b(t, f) && f.id === s) | |
| return r.push(f), | |
| r | |
| } else { | |
| if (d[2]) | |
| return D.apply(r, t.getElementsByTagName(e)), | |
| r; | |
| if ((s = d[3]) && n.getElementsByClassName && t.getElementsByClassName) | |
| return D.apply(r, t.getElementsByClassName(s)), | |
| r | |
| } | |
| if (n.qsa && !C[e + " "] && (!m || !m.test(e))) { | |
| if (x !== 1) | |
| S = t, | |
| y = e; | |
| else if (t.nodeName.toLowerCase() !== "object") { | |
| (l = t.getAttribute("id")) ? l = l.replace(et, "\\$&") : t.setAttribute("id", l = w), | |
| g = o(e), | |
| u = g.length, | |
| c = $.test(l) ? "#" + l : "[id='" + l + "']"; | |
| while (u--) | |
| g[u] = c + " " + mt(g[u]); | |
| y = g.join(","), | |
| S = Z.test(e) && dt(t.parentNode) || t | |
| } | |
| if (y) | |
| try { | |
| return D.apply(r, S.querySelectorAll(y)), | |
| r | |
| } catch (T) {} finally { | |
| l === w && t.removeAttribute("id") | |
| } | |
| } | |
| } | |
| } | |
| return a(e.replace(U, "$1"), t, r, i) | |
| } | |
| function ot() { | |
| function t(n, i) { | |
| return e.push(n + " ") > r.cacheLength && delete t[e.shift()], | |
| t[n + " "] = i | |
| } | |
| var e = []; | |
| return t | |
| } | |
| function ut(e) { | |
| return e[w] = !0, | |
| e | |
| } | |
| function at(e) { | |
| var t = p.createElement("div"); | |
| try { | |
| return !!e(t) | |
| } catch (n) { | |
| return !1 | |
| } finally { | |
| t.parentNode && t.parentNode.removeChild(t), | |
| t = null | |
| } | |
| } | |
| function ft(e, t) { | |
| var n = e.split("|") | |
| , i = n.length; | |
| while (i--) | |
| r.attrHandle[n[i]] = t | |
| } | |
| function lt(e, t) { | |
| var n = t && e | |
| , r = n && e.nodeType === 1 && t.nodeType === 1 && (~t.sourceIndex || L) - (~e.sourceIndex || L); | |
| if (r) | |
| return r; | |
| if (n) | |
| while (n = n.nextSibling) | |
| if (n === t) | |
| return -1; | |
| return e ? 1 : -1 | |
| } | |
| function ct(e) { | |
| return function(t) { | |
| var n = t.nodeName.toLowerCase(); | |
| return n === "input" && t.type === e | |
| } | |
| } | |
| function ht(e) { | |
| return function(t) { | |
| var n = t.nodeName.toLowerCase(); | |
| return (n === "input" || n === "button") && t.type === e | |
| } | |
| } | |
| function pt(e) { | |
| return ut(function(t) { | |
| return t = +t, | |
| ut(function(n, r) { | |
| var i, s = e([], n.length, t), o = s.length; | |
| while (o--) | |
| n[i = s[o]] && (n[i] = !(r[i] = n[i])) | |
| }) | |
| }) | |
| } | |
| function dt(e) { | |
| return e && typeof e.getElementsByTagName != "undefined" && e | |
| } | |
| function vt() {} | |
| function mt(e) { | |
| var t = 0 | |
| , n = e.length | |
| , r = ""; | |
| for (; t < n; t++) | |
| r += e[t].value; | |
| return r | |
| } | |
| function gt(e, t, n) { | |
| var r = t.dir | |
| , i = n && r === "parentNode" | |
| , s = x++; | |
| return t.first ? function(t, n, s) { | |
| while (t = t[r]) | |
| if (t.nodeType === 1 || i) | |
| return e(t, n, s) | |
| } | |
| : function(t, n, o) { | |
| var u, a, f, l = [S, s]; | |
| if (o) { | |
| while (t = t[r]) | |
| if (t.nodeType === 1 || i) | |
| if (e(t, n, o)) | |
| return !0 | |
| } else | |
| while (t = t[r]) | |
| if (t.nodeType === 1 || i) { | |
| f = t[w] || (t[w] = {}), | |
| a = f[t.uniqueID] || (f[t.uniqueID] = {}); | |
| if ((u = a[r]) && u[0] === S && u[1] === s) | |
| return l[2] = u[2]; | |
| a[r] = l; | |
| if (l[2] = e(t, n, o)) | |
| return !0 | |
| } | |
| } | |
| } | |
| function yt(e) { | |
| return e.length > 1 ? function(t, n, r) { | |
| var i = e.length; | |
| while (i--) | |
| if (!e[i](t, n, r)) | |
| return !1; | |
| return !0 | |
| } | |
| : e[0] | |
| } | |
| function bt(e, t, n) { | |
| var r = 0 | |
| , i = t.length; | |
| for (; r < i; r++) | |
| st(e, t[r], n); | |
| return n | |
| } | |
| function wt(e, t, n, r, i) { | |
| var s, o = [], u = 0, a = e.length, f = t != null; | |
| for (; u < a; u++) | |
| if (s = e[u]) | |
| if (!n || n(s, r, i)) | |
| o.push(s), | |
| f && t.push(u); | |
| return o | |
| } | |
| function Et(e, t, n, r, i, s) { | |
| return r && !r[w] && (r = Et(r)), | |
| i && !i[w] && (i = Et(i, s)), | |
| ut(function(s, o, u, a) { | |
| var f, l, c, h = [], p = [], d = o.length, v = s || bt(t || "*", u.nodeType ? [u] : u, []), m = e && (s || !t) ? wt(v, h, e, u, a) : v, g = n ? i || (s ? e : d || r) ? [] : o : m; | |
| n && n(m, g, u, a); | |
| if (r) { | |
| f = wt(g, p), | |
| r(f, [], u, a), | |
| l = f.length; | |
| while (l--) | |
| if (c = f[l]) | |
| g[p[l]] = !(m[p[l]] = c) | |
| } | |
| if (s) { | |
| if (i || e) { | |
| if (i) { | |
| f = [], | |
| l = g.length; | |
| while (l--) | |
| (c = g[l]) && f.push(m[l] = c); | |
| i(null, g = [], f, a) | |
| } | |
| l = g.length; | |
| while (l--) | |
| (c = g[l]) && (f = i ? H(s, c) : h[l]) > -1 && (s[f] = !(o[f] = c)) | |
| } | |
| } else | |
| g = wt(g === o ? g.splice(d, g.length) : g), | |
| i ? i(null, o, g, a) : D.apply(o, g) | |
| }) | |
| } | |
| function St(e) { | |
| var t, n, i, s = e.length, o = r.relative[e[0].type], u = o || r.relative[" "], a = o ? 1 : 0, l = gt(function(e) { | |
| return e === t | |
| }, u, !0), c = gt(function(e) { | |
| return H(t, e) > -1 | |
| }, u, !0), h = [function(e, n, r) { | |
| var i = !o && (r || n !== f) || ((t = n).nodeType ? l(e, n, r) : c(e, n, r)); | |
| return t = null, | |
| i | |
| } | |
| ]; | |
| for (; a < s; a++) | |
| if (n = r.relative[e[a].type]) | |
| h = [gt(yt(h), n)]; | |
| else { | |
| n = r.filter[e[a].type].apply(null, e[a].matches); | |
| if (n[w]) { | |
| i = ++a; | |
| for (; i < s; i++) | |
| if (r.relative[e[i].type]) | |
| break; | |
| return Et(a > 1 && yt(h), a > 1 && mt(e.slice(0, a - 1).concat({ | |
| value: e[a - 2].type === " " ? "*" : "" | |
| })).replace(U, "$1"), n, a < i && St(e.slice(a, i)), i < s && St(e = e.slice(i)), i < s && mt(e)) | |
| } | |
| h.push(n) | |
| } | |
| return yt(h) | |
| } | |
| function xt(e, t) { | |
| var n = t.length > 0 | |
| , i = e.length > 0 | |
| , s = function(s, o, u, a, l) { | |
| var c, d, m, g = 0, y = "0", b = s && [], w = [], E = f, x = s || i && r.find.TAG("*", l), T = S += E == null ? 1 : Math.random() || .1, N = x.length; | |
| l && (f = o === p || o || l); | |
| for (; y !== N && (c = x[y]) != null; y++) { | |
| if (i && c) { | |
| d = 0, | |
| !o && c.ownerDocument !== p && (h(c), | |
| u = !v); | |
| while (m = e[d++]) | |
| if (m(c, o || p, u)) { | |
| a.push(c); | |
| break | |
| } | |
| l && (S = T) | |
| } | |
| n && ((c = !m && c) && g--, | |
| s && b.push(c)) | |
| } | |
| g += y; | |
| if (n && y !== g) { | |
| d = 0; | |
| while (m = t[d++]) | |
| m(b, w, o, u); | |
| if (s) { | |
| if (g > 0) | |
| while (y--) | |
| !b[y] && !w[y] && (w[y] = M.call(a)); | |
| w = wt(w) | |
| } | |
| D.apply(a, w), | |
| l && !s && w.length > 0 && g + t.length > 1 && st.uniqueSort(a) | |
| } | |
| return l && (S = T, | |
| f = E), | |
| b | |
| }; | |
| return n ? ut(s) : s | |
| } | |
| var t, n, r, i, s, o, u, a, f, l, c, h, p, d, v, m, g, y, b, w = "sizzle" + 1 * new Date, E = e.document, S = 0, x = 0, T = ot(), N = ot(), C = ot(), k = function(e, t) { | |
| return e === t && (c = !0), | |
| 0 | |
| }, L = 1 << 31, A = {}.hasOwnProperty, O = [], M = O.pop, _ = O.push, D = O.push, P = O.slice, H = function(e, t) { | |
| var n = 0 | |
| , r = e.length; | |
| for (; n < r; n++) | |
| if (e[n] === t) | |
| return n; | |
| return -1 | |
| }, B = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped", j = "[\\x20\\t\\r\\n\\f]", F = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+", I = "\\[" + j + "*(" + F + ")(?:" + j + "*([*^$|!~]?=)" + j + "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + F + "))|)" + j + "*\\]", q = ":(" + F + ")(?:\\((" + "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" + "((?:\\\\.|[^\\\\()[\\]]|" + I + ")*)|" + ".*" + ")\\)|)", R = new RegExp(j + "+","g"), U = new RegExp("^" + j + "+|((?:^|[^\\\\])(?:\\\\.)*)" + j + "+$","g"), z = new RegExp("^" + j + "*," + j + "*"), W = new RegExp("^" + j + "*([>+~]|" + j + ")" + j + "*"), X = new RegExp("=" + j + "*([^\\]'\"]*?)" + j + "*\\]","g"), V = new RegExp(q), $ = new RegExp("^" + F + "$"), J = { | |
| ID: new RegExp("^#(" + F + ")"), | |
| CLASS: new RegExp("^\\.(" + F + ")"), | |
| TAG: new RegExp("^(" + F + "|[*])"), | |
| ATTR: new RegExp("^" + I), | |
| PSEUDO: new RegExp("^" + q), | |
| CHILD: new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + j + "*(even|odd|(([+-]|)(\\d*)n|)" + j + "*(?:([+-]|)" + j + "*(\\d+)|))" + j + "*\\)|)","i"), | |
| bool: new RegExp("^(?:" + B + ")$","i"), | |
| needsContext: new RegExp("^" + j + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + j + "*((?:-\\d)?\\d*)" + j + "*\\)|)(?=[^-]|$)","i") | |
| }, K = /^(?:input|select|textarea|button)$/i, Q = /^h\d$/i, G = /^[^{]+\{\s*\[native \w/, Y = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, Z = /[+~]/, et = /'|\\/g, tt = new RegExp("\\\\([\\da-f]{1,6}" + j + "?|(" + j + ")|.)","ig"), nt = function(e, t, n) { | |
| var r = "0x" + t - 65536; | |
| return r !== r || n ? t : r < 0 ? String.fromCharCode(r + 65536) : String.fromCharCode(r >> 10 | 55296, r & 1023 | 56320) | |
| }, rt = function() { | |
| h() | |
| }; | |
| try { | |
| D.apply(O = P.call(E.childNodes), E.childNodes), | |
| O[E.childNodes.length].nodeType | |
| } catch (it) { | |
| D = { | |
| apply: O.length ? function(e, t) { | |
| _.apply(e, P.call(t)) | |
| } | |
| : function(e, t) { | |
| var n = e.length | |
| , r = 0; | |
| while (e[n++] = t[r++]) | |
| ; | |
| e.length = n - 1 | |
| } | |
| } | |
| } | |
| n = st.support = {}, | |
| s = st.isXML = function(e) { | |
| var t = e && (e.ownerDocument || e).documentElement; | |
| return t ? t.nodeName !== "HTML" : !1 | |
| } | |
| , | |
| h = st.setDocument = function(e) { | |
| var t, i, o = e ? e.ownerDocument || e : E; | |
| if (o === p || o.nodeType !== 9 || !o.documentElement) | |
| return p; | |
| p = o, | |
| d = p.documentElement, | |
| v = !s(p), | |
| (i = p.defaultView) && i.top !== i && (i.addEventListener ? i.addEventListener("unload", rt, !1) : i.attachEvent && i.attachEvent("onunload", rt)), | |
| n.attributes = at(function(e) { | |
| return e.className = "i", | |
| !e.getAttribute("className") | |
| }), | |
| n.getElementsByTagName = at(function(e) { | |
| return e.appendChild(p.createComment("")), | |
| !e.getElementsByTagName("*").length | |
| }), | |
| n.getElementsByClassName = G.test(p.getElementsByClassName), | |
| n.getById = at(function(e) { | |
| return d.appendChild(e).id = w, | |
| !p.getElementsByName || !p.getElementsByName(w).length | |
| }), | |
| n.getById ? (r.find.ID = function(e, t) { | |
| if (typeof t.getElementById != "undefined" && v) { | |
| var n = t.getElementById(e); | |
| return n ? [n] : [] | |
| } | |
| } | |
| , | |
| r.filter.ID = function(e) { | |
| var t = e.replace(tt, nt); | |
| return function(e) { | |
| return e.getAttribute("id") === t | |
| } | |
| } | |
| ) : (delete r.find.ID, | |
| r.filter.ID = function(e) { | |
| var t = e.replace(tt, nt); | |
| return function(e) { | |
| var n = typeof e.getAttributeNode != "undefined" && e.getAttributeNode("id"); | |
| return n && n.value === t | |
| } | |
| } | |
| ), | |
| r.find.TAG = n.getElementsByTagName ? function(e, t) { | |
| if (typeof t.getElementsByTagName != "undefined") | |
| return t.getElementsByTagName(e); | |
| if (n.qsa) | |
| return t.querySelectorAll(e) | |
| } | |
| : function(e, t) { | |
| var n, r = [], i = 0, s = t.getElementsByTagName(e); | |
| if (e === "*") { | |
| while (n = s[i++]) | |
| n.nodeType === 1 && r.push(n); | |
| return r | |
| } | |
| return s | |
| } | |
| , | |
| r.find.CLASS = n.getElementsByClassName && function(e, t) { | |
| if (typeof t.getElementsByClassName != "undefined" && v) | |
| return t.getElementsByClassName(e) | |
| } | |
| , | |
| g = [], | |
| m = []; | |
| if (n.qsa = G.test(p.querySelectorAll)) | |
| at(function(e) { | |
| d.appendChild(e).innerHTML = "<a id='" + w + "'></a>" + "<select id='" + w + "-\r\\' msallowcapture=''>" + "<option selected=''></option></select>", | |
| e.querySelectorAll("[msallowcapture^='']").length && m.push("[*^$]=" + j + "*(?:''|\"\")"), | |
| e.querySelectorAll("[selected]").length || m.push("\\[" + j + "*(?:value|" + B + ")"), | |
| e.querySelectorAll("[id~=" + w + "-]").length || m.push("~="), | |
| e.querySelectorAll(":checked").length || m.push(":checked"), | |
| e.querySelectorAll("a#" + w + "+*").length || m.push(".#.+[+~]") | |
| }), | |
| at(function(e) { | |
| var t = p.createElement("input"); | |
| t.setAttribute("type", "hidden"), | |
| e.appendChild(t).setAttribute("name", "D"), | |
| e.querySelectorAll("[name=d]").length && m.push("name" + j + "*[*^$|!~]?="), | |
| e.querySelectorAll(":enabled").length || m.push(":enabled", ":disabled"), | |
| e.querySelectorAll("*,:x"), | |
| m.push(",.*:") | |
| }); | |
| return (n.matchesSelector = G.test(y = d.matches || d.webkitMatchesSelector || d.mozMatchesSelector || d.oMatchesSelector || d.msMatchesSelector)) && at(function(e) { | |
| n.disconnectedMatch = y.call(e, "div"), | |
| y.call(e, "[s!='']:x"), | |
| g.push("!=", q) | |
| }), | |
| m = m.length && new RegExp(m.join("|")), | |
| g = g.length && new RegExp(g.join("|")), | |
| t = G.test(d.compareDocumentPosition), | |
| b = t || G.test(d.contains) ? function(e, t) { | |
| var n = e.nodeType === 9 ? e.documentElement : e | |
| , r = t && t.parentNode; | |
| return e === r || !!r && r.nodeType === 1 && !!(n.contains ? n.contains(r) : e.compareDocumentPosition && e.compareDocumentPosition(r) & 16) | |
| } | |
| : function(e, t) { | |
| if (t) | |
| while (t = t.parentNode) | |
| if (t === e) | |
| return !0; | |
| return !1 | |
| } | |
| , | |
| k = t ? function(e, t) { | |
| if (e === t) | |
| return c = !0, | |
| 0; | |
| var r = !e.compareDocumentPosition - !t.compareDocumentPosition; | |
| return r ? r : (r = (e.ownerDocument || e) === (t.ownerDocument || t) ? e.compareDocumentPosition(t) : 1, | |
| r & 1 || !n.sortDetached && t.compareDocumentPosition(e) === r ? e === p || e.ownerDocument === E && b(E, e) ? -1 : t === p || t.ownerDocument === E && b(E, t) ? 1 : l ? H(l, e) - H(l, t) : 0 : r & 4 ? -1 : 1) | |
| } | |
| : function(e, t) { | |
| if (e === t) | |
| return c = !0, | |
| 0; | |
| var n, r = 0, i = e.parentNode, s = t.parentNode, o = [e], u = [t]; | |
| if (!i || !s) | |
| return e === p ? -1 : t === p ? 1 : i ? -1 : s ? 1 : l ? H(l, e) - H(l, t) : 0; | |
| if (i === s) | |
| return lt(e, t); | |
| n = e; | |
| while (n = n.parentNode) | |
| o.unshift(n); | |
| n = t; | |
| while (n = n.parentNode) | |
| u.unshift(n); | |
| while (o[r] === u[r]) | |
| r++; | |
| return r ? lt(o[r], u[r]) : o[r] === E ? -1 : u[r] === E ? 1 : 0 | |
| } | |
| , | |
| p | |
| } | |
| , | |
| st.matches = function(e, t) { | |
| return st(e, null, null, t) | |
| } | |
| , | |
| st.matchesSelector = function(e, t) { | |
| (e.ownerDocument || e) !== p && h(e), | |
| t = t.replace(X, "='$1']"); | |
| if (n.matchesSelector && v && !C[t + " "] && (!g || !g.test(t)) && (!m || !m.test(t))) | |
| try { | |
| var r = y.call(e, t); | |
| if (r || n.disconnectedMatch || e.document && e.document.nodeType !== 11) | |
| return r | |
| } catch (i) {} | |
| return st(t, p, null, [e]).length > 0 | |
| } | |
| , | |
| st.contains = function(e, t) { | |
| return (e.ownerDocument || e) !== p && h(e), | |
| b(e, t) | |
| } | |
| , | |
| st.attr = function(e, t) { | |
| (e.ownerDocument || e) !== p && h(e); | |
| var i = r.attrHandle[t.toLowerCase()] | |
| , s = i && A.call(r.attrHandle, t.toLowerCase()) ? i(e, t, !v) : undefined; | |
| return s !== undefined ? s : n.attributes || !v ? e.getAttribute(t) : (s = e.getAttributeNode(t)) && s.specified ? s.value : null | |
| } | |
| , | |
| st.error = function(e) { | |
| throw new Error("Syntax error, unrecognized expression: " + e) | |
| } | |
| , | |
| st.uniqueSort = function(e) { | |
| var t, r = [], i = 0, s = 0; | |
| c = !n.detectDuplicates, | |
| l = !n.sortStable && e.slice(0), | |
| e.sort(k); | |
| if (c) { | |
| while (t = e[s++]) | |
| t === e[s] && (i = r.push(s)); | |
| while (i--) | |
| e.splice(r[i], 1) | |
| } | |
| return l = null, | |
| e | |
| } | |
| , | |
| i = st.getText = function(e) { | |
| var t, n = "", r = 0, s = e.nodeType; | |
| if (!s) | |
| while (t = e[r++]) | |
| n += i(t); | |
| else if (s === 1 || s === 9 || s === 11) { | |
| if (typeof e.textContent == "string") | |
| return e.textContent; | |
| for (e = e.firstChild; e; e = e.nextSibling) | |
| n += i(e) | |
| } else if (s === 3 || s === 4) | |
| return e.nodeValue; | |
| return n | |
| } | |
| , | |
| r = st.selectors = { | |
| cacheLength: 50, | |
| createPseudo: ut, | |
| match: J, | |
| attrHandle: {}, | |
| find: {}, | |
| relative: { | |
| ">": { | |
| dir: "parentNode", | |
| first: !0 | |
| }, | |
| " ": { | |
| dir: "parentNode" | |
| }, | |
| "+": { | |
| dir: "previousSibling", | |
| first: !0 | |
| }, | |
| "~": { | |
| dir: "previousSibling" | |
| } | |
| }, | |
| preFilter: { | |
| ATTR: function(e) { | |
| return e[1] = e[1].replace(tt, nt), | |
| e[3] = (e[3] || e[4] || e[5] || "").replace(tt, nt), | |
| e[2] === "~=" && (e[3] = " " + e[3] + " "), | |
| e.slice(0, 4) | |
| }, | |
| CHILD: function(e) { | |
| return e[1] = e[1].toLowerCase(), | |
| e[1].slice(0, 3) === "nth" ? (e[3] || st.error(e[0]), | |
| e[4] = +(e[4] ? e[5] + (e[6] || 1) : 2 * (e[3] === "even" || e[3] === "odd")), | |
| e[5] = +(e[7] + e[8] || e[3] === "odd")) : e[3] && st.error(e[0]), | |
| e | |
| }, | |
| PSEUDO: function(e) { | |
| var t, n = !e[6] && e[2]; | |
| return J.CHILD.test(e[0]) ? null : (e[3] ? e[2] = e[4] || e[5] || "" : n && V.test(n) && (t = o(n, !0)) && (t = n.indexOf(")", n.length - t) - n.length) && (e[0] = e[0].slice(0, t), | |
| e[2] = n.slice(0, t)), | |
| e.slice(0, 3)) | |
| } | |
| }, | |
| filter: { | |
| TAG: function(e) { | |
| var t = e.replace(tt, nt).toLowerCase(); | |
| return e === "*" ? function() { | |
| return !0 | |
| } | |
| : function(e) { | |
| return e.nodeName && e.nodeName.toLowerCase() === t | |
| } | |
| }, | |
| CLASS: function(e) { | |
| var t = T[e + " "]; | |
| return t || (t = new RegExp("(^|" + j + ")" + e + "(" + j + "|$)")) && T(e, function(e) { | |
| return t.test(typeof e.className == "string" && e.className || typeof e.getAttribute != "undefined" && e.getAttribute("class") || "") | |
| }) | |
| }, | |
| ATTR: function(e, t, n) { | |
| return function(r) { | |
| var i = st.attr(r, e); | |
| return i == null ? t === "!=" : t ? (i += "", | |
| t === "=" ? i === n : t === "!=" ? i !== n : t === "^=" ? n && i.indexOf(n) === 0 : t === "*=" ? n && i.indexOf(n) > -1 : t === "$=" ? n && i.slice(-n.length) === n : t === "~=" ? (" " + i.replace(R, " ") + " ").indexOf(n) > -1 : t === "|=" ? i === n || i.slice(0, n.length + 1) === n + "-" : !1) : !0 | |
| } | |
| }, | |
| CHILD: function(e, t, n, r, i) { | |
| var s = e.slice(0, 3) !== "nth" | |
| , o = e.slice(-4) !== "last" | |
| , u = t === "of-type"; | |
| return r === 1 && i === 0 ? function(e) { | |
| return !!e.parentNode | |
| } | |
| : function(t, n, a) { | |
| var f, l, c, h, p, d, v = s !== o ? "nextSibling" : "previousSibling", m = t.parentNode, g = u && t.nodeName.toLowerCase(), y = !a && !u, b = !1; | |
| if (m) { | |
| if (s) { | |
| while (v) { | |
| h = t; | |
| while (h = h[v]) | |
| if (u ? h.nodeName.toLowerCase() === g : h.nodeType === 1) | |
| return !1; | |
| d = v = e === "only" && !d && "nextSibling" | |
| } | |
| return !0 | |
| } | |
| d = [o ? m.firstChild : m.lastChild]; | |
| if (o && y) { | |
| h = m, | |
| c = h[w] || (h[w] = {}), | |
| l = c[h.uniqueID] || (c[h.uniqueID] = {}), | |
| f = l[e] || [], | |
| p = f[0] === S && f[1], | |
| b = p && f[2], | |
| h = p && m.childNodes[p]; | |
| while (h = ++p && h && h[v] || (b = p = 0) || d.pop()) | |
| if (h.nodeType === 1 && ++b && h === t) { | |
| l[e] = [S, p, b]; | |
| break | |
| } | |
| } else { | |
| y && (h = t, | |
| c = h[w] || (h[w] = {}), | |
| l = c[h.uniqueID] || (c[h.uniqueID] = {}), | |
| f = l[e] || [], | |
| p = f[0] === S && f[1], | |
| b = p); | |
| if (b === !1) | |
| while (h = ++p && h && h[v] || (b = p = 0) || d.pop()) | |
| if ((u ? h.nodeName.toLowerCase() === g : h.nodeType === 1) && ++b) { | |
| y && (c = h[w] || (h[w] = {}), | |
| l = c[h.uniqueID] || (c[h.uniqueID] = {}), | |
| l[e] = [S, b]); | |
| if (h === t) | |
| break | |
| } | |
| } | |
| return b -= i, | |
| b === r || b % r === 0 && b / r >= 0 | |
| } | |
| } | |
| }, | |
| PSEUDO: function(e, t) { | |
| var n, i = r.pseudos[e] || r.setFilters[e.toLowerCase()] || st.error("unsupported pseudo: " + e); | |
| return i[w] ? i(t) : i.length > 1 ? (n = [e, e, "", t], | |
| r.setFilters.hasOwnProperty(e.toLowerCase()) ? ut(function(e, n) { | |
| var r, s = i(e, t), o = s.length; | |
| while (o--) | |
| r = H(e, s[o]), | |
| e[r] = !(n[r] = s[o]) | |
| }) : function(e) { | |
| return i(e, 0, n) | |
| } | |
| ) : i | |
| } | |
| }, | |
| pseudos: { | |
| not: ut(function(e) { | |
| var t = [] | |
| , n = [] | |
| , r = u(e.replace(U, "$1")); | |
| return r[w] ? ut(function(e, t, n, i) { | |
| var s, o = r(e, null, i, []), u = e.length; | |
| while (u--) | |
| if (s = o[u]) | |
| e[u] = !(t[u] = s) | |
| }) : function(e, i, s) { | |
| return t[0] = e, | |
| r(t, null, s, n), | |
| t[0] = null, | |
| !n.pop() | |
| } | |
| }), | |
| has: ut(function(e) { | |
| return function(t) { | |
| return st(e, t).length > 0 | |
| } | |
| }), | |
| contains: ut(function(e) { | |
| return e = e.replace(tt, nt), | |
| function(t) { | |
| return (t.textContent || t.innerText || i(t)).indexOf(e) > -1 | |
| } | |
| }), | |
| lang: ut(function(e) { | |
| return $.test(e || "") || st.error("unsupported lang: " + e), | |
| e = e.replace(tt, nt).toLowerCase(), | |
| function(t) { | |
| var n; | |
| do | |
| if (n = v ? t.lang : t.getAttribute("xml:lang") || t.getAttribute("lang")) | |
| return n = n.toLowerCase(), | |
| n === e || n.indexOf(e + "-") === 0; | |
| while ((t = t.parentNode) && t.nodeType === 1);return !1 | |
| } | |
| }), | |
| target: function(t) { | |
| var n = e.location && e.location.hash; | |
| return n && n.slice(1) === t.id | |
| }, | |
| root: function(e) { | |
| return e === d | |
| }, | |
| focus: function(e) { | |
| return e === p.activeElement && (!p.hasFocus || p.hasFocus()) && !!(e.type || e.href || ~e.tabIndex) | |
| }, | |
| enabled: function(e) { | |
| return e.disabled === !1 | |
| }, | |
| disabled: function(e) { | |
| return e.disabled === !0 | |
| }, | |
| checked: function(e) { | |
| var t = e.nodeName.toLowerCase(); | |
| return t === "input" && !!e.checked || t === "option" && !!e.selected | |
| }, | |
| selected: function(e) { | |
| return e.parentNode && e.parentNode.selectedIndex, | |
| e.selected === !0 | |
| }, | |
| empty: function(e) { | |
| for (e = e.firstChild; e; e = e.nextSibling) | |
| if (e.nodeType < 6) | |
| return !1; | |
| return !0 | |
| }, | |
| parent: function(e) { | |
| return !r.pseudos.empty(e) | |
| }, | |
| header: function(e) { | |
| return Q.test(e.nodeName) | |
| }, | |
| input: function(e) { | |
| return K.test(e.nodeName) | |
| }, | |
| button: function(e) { | |
| var t = e.nodeName.toLowerCase(); | |
| return t === "input" && e.type === "button" || t === "button" | |
| }, | |
| text: function(e) { | |
| var t; | |
| return e.nodeName.toLowerCase() === "input" && e.type === "text" && ((t = e.getAttribute("type")) == null || t.toLowerCase() === "text") | |
| }, | |
| first: pt(function() { | |
| return [0] | |
| }), | |
| last: pt(function(e, t) { | |
| return [t - 1] | |
| }), | |
| eq: pt(function(e, t, n) { | |
| return [n < 0 ? n + t : n] | |
| }), | |
| even: pt(function(e, t) { | |
| var n = 0; | |
| for (; n < t; n += 2) | |
| e.push(n); | |
| return e | |
| }), | |
| odd: pt(function(e, t) { | |
| var n = 1; | |
| for (; n < t; n += 2) | |
| e.push(n); | |
| return e | |
| }), | |
| lt: pt(function(e, t, n) { | |
| var r = n < 0 ? n + t : n; | |
| for (; --r >= 0; ) | |
| e.push(r); | |
| return e | |
| }), | |
| gt: pt(function(e, t, n) { | |
| var r = n < 0 ? n + t : n; | |
| for (; ++r < t; ) | |
| e.push(r); | |
| return e | |
| }) | |
| } | |
| }, | |
| r.pseudos.nth = r.pseudos.eq; | |
| for (t in { | |
| radio: !0, | |
| checkbox: !0, | |
| file: !0, | |
| password: !0, | |
| image: !0 | |
| }) | |
| r.pseudos[t] = ct(t); | |
| for (t in { | |
| submit: !0, | |
| reset: !0 | |
| }) | |
| r.pseudos[t] = ht(t); | |
| return vt.prototype = r.filters = r.pseudos, | |
| r.setFilters = new vt, | |
| o = st.tokenize = function(e, t) { | |
| var n, i, s, o, u, a, f, l = N[e + " "]; | |
| if (l) | |
| return t ? 0 : l.slice(0); | |
| u = e, | |
| a = [], | |
| f = r.preFilter; | |
| while (u) { | |
| if (!n || (i = z.exec(u))) | |
| i && (u = u.slice(i[0].length) || u), | |
| a.push(s = []); | |
| n = !1; | |
| if (i = W.exec(u)) | |
| n = i.shift(), | |
| s.push({ | |
| value: n, | |
| type: i[0].replace(U, " ") | |
| }), | |
| u = u.slice(n.length); | |
| for (o in r.filter) | |
| (i = J[o].exec(u)) && (!f[o] || (i = f[o](i))) && (n = i.shift(), | |
| s.push({ | |
| value: n, | |
| type: o, | |
| matches: i | |
| }), | |
| u = u.slice(n.length)); | |
| if (!n) | |
| break | |
| } | |
| return t ? u.length : u ? st.error(e) : N(e, a).slice(0) | |
| } | |
| , | |
| u = st.compile = function(e, t) { | |
| var n, r = [], i = [], s = C[e + " "]; | |
| if (!s) { | |
| t || (t = o(e)), | |
| n = t.length; | |
| while (n--) | |
| s = St(t[n]), | |
| s[w] ? r.push(s) : i.push(s); | |
| s = C(e, xt(i, r)), | |
| s.selector = e | |
| } | |
| return s | |
| } | |
| , | |
| a = st.select = function(e, t, i, s) { | |
| var a, f, l, c, h, p = typeof e == "function" && e, d = !s && o(e = p.selector || e); | |
| i = i || []; | |
| if (d.length === 1) { | |
| f = d[0] = d[0].slice(0); | |
| if (f.length > 2 && (l = f[0]).type === "ID" && n.getById && t.nodeType === 9 && v && r.relative[f[1].type]) { | |
| t = (r.find.ID(l.matches[0].replace(tt, nt), t) || [])[0]; | |
| if (!t) | |
| return i; | |
| p && (t = t.parentNode), | |
| e = e.slice(f.shift().value.length) | |
| } | |
| a = J.needsContext.test(e) ? 0 : f.length; | |
| while (a--) { | |
| l = f[a]; | |
| if (r.relative[c = l.type]) | |
| break; | |
| if (h = r.find[c]) | |
| if (s = h(l.matches[0].replace(tt, nt), Z.test(f[0].type) && dt(t.parentNode) || t)) { | |
| f.splice(a, 1), | |
| e = s.length && mt(f); | |
| if (!e) | |
| return D.apply(i, s), | |
| i; | |
| break | |
| } | |
| } | |
| } | |
| return (p || u(e, d))(s, t, !v, i, !t || Z.test(e) && dt(t.parentNode) || t), | |
| i | |
| } | |
| , | |
| n.sortStable = w.split("").sort(k).join("") === w, | |
| n.detectDuplicates = !!c, | |
| h(), | |
| n.sortDetached = at(function(e) { | |
| return e.compareDocumentPosition(p.createElement("div")) & 1 | |
| }), | |
| at(function(e) { | |
| return e.innerHTML = "<a href='#'></a>", | |
| e.firstChild.getAttribute("href") === "#" | |
| }) || ft("type|href|height|width", function(e, t, n) { | |
| if (!n) | |
| return e.getAttribute(t, t.toLowerCase() === "type" ? 1 : 2) | |
| }), | |
| (!n.attributes || !at(function(e) { | |
| return e.innerHTML = "<input/>", | |
| e.firstChild.setAttribute("value", ""), | |
| e.firstChild.getAttribute("value") === "" | |
| })) && ft("value", function(e, t, n) { | |
| if (!n && e.nodeName.toLowerCase() === "input") | |
| return e.defaultValue | |
| }), | |
| at(function(e) { | |
| return e.getAttribute("disabled") == null | |
| }) || ft(B, function(e, t, n) { | |
| var r; | |
| if (!n) | |
| return e[t] === !0 ? t.toLowerCase() : (r = e.getAttributeNode(t)) && r.specified ? r.value : null | |
| }), | |
| st | |
| }(window); | |
| jQuery.find = Sizzle, | |
| jQuery.expr = Sizzle.selectors, | |
| jQuery.expr[":"] = jQuery.expr.pseudos, | |
| jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort, | |
| jQuery.text = Sizzle.getText, | |
| jQuery.isXMLDoc = Sizzle.isXML, | |
| jQuery.contains = Sizzle.contains; | |
| var dir = function(e, t, n) { | |
| var r = [] | |
| , i = n !== undefined; | |
| while ((e = e[t]) && e.nodeType !== 9) | |
| if (e.nodeType === 1) { | |
| if (i && jQuery(e).is(n)) | |
| break; | |
| r.push(e) | |
| } | |
| return r | |
| } | |
| , siblings = function(e, t) { | |
| var n = []; | |
| for (; e; e = e.nextSibling) | |
| e.nodeType === 1 && e !== t && n.push(e); | |
| return n | |
| } | |
| , rneedsContext = jQuery.expr.match.needsContext | |
| , rsingleTag = /^<([\w-]+)\s*\/?>(?:<\/\1>|)$/ | |
| , risSimple = /^.[^:#\[\.,]*$/; | |
| jQuery.filter = function(e, t, n) { | |
| var r = t[0]; | |
| return n && (e = ":not(" + e + ")"), | |
| t.length === 1 && r.nodeType === 1 ? jQuery.find.matchesSelector(r, e) ? [r] : [] : jQuery.find.matches(e, jQuery.grep(t, function(e) { | |
| return e.nodeType === 1 | |
| })) | |
| } | |
| , | |
| jQuery.fn.extend({ | |
| find: function(e) { | |
| var t, n = this.length, r = [], i = this; | |
| if (typeof e != "string") | |
| return this.pushStack(jQuery(e).filter(function() { | |
| for (t = 0; t < n; t++) | |
| if (jQuery.contains(i[t], this)) | |
| return !0 | |
| })); | |
| for (t = 0; t < n; t++) | |
| jQuery.find(e, i[t], r); | |
| return r = this.pushStack(n > 1 ? jQuery.unique(r) : r), | |
| r.selector = this.selector ? this.selector + " " + e : e, | |
| r | |
| }, | |
| filter: function(e) { | |
| return this.pushStack(winnow(this, e || [], !1)) | |
| }, | |
| not: function(e) { | |
| return this.pushStack(winnow(this, e || [], !0)) | |
| }, | |
| is: function(e) { | |
| return !!winnow(this, typeof e == "string" && rneedsContext.test(e) ? jQuery(e) : e || [], !1).length | |
| } | |
| }); | |
| var rootjQuery, rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/, init = jQuery.fn.init = function(e, t, n) { | |
| var r, i; | |
| if (!e) | |
| return this; | |
| n = n || rootjQuery; | |
| if (typeof e == "string") { | |
| e[0] === "<" && e[e.length - 1] === ">" && e.length >= 3 ? r = [null, e, null] : r = rquickExpr.exec(e); | |
| if (r && (r[1] || !t)) { | |
| if (r[1]) { | |
| t = t instanceof jQuery ? t[0] : t, | |
| jQuery.merge(this, jQuery.parseHTML(r[1], t && t.nodeType ? t.ownerDocument || t : document, !0)); | |
| if (rsingleTag.test(r[1]) && jQuery.isPlainObject(t)) | |
| for (r in t) | |
| jQuery.isFunction(this[r]) ? this[r](t[r]) : this.attr(r, t[r]); | |
| return this | |
| } | |
| return i = document.getElementById(r[2]), | |
| i && i.parentNode && (this.length = 1, | |
| this[0] = i), | |
| this.context = document, | |
| this.selector = e, | |
| this | |
| } | |
| return !t || t.jquery ? (t || n).find(e) : this.constructor(t).find(e) | |
| } | |
| return e.nodeType ? (this.context = this[0] = e, | |
| this.length = 1, | |
| this) : jQuery.isFunction(e) ? n.ready !== undefined ? n.ready(e) : e(jQuery) : (e.selector !== undefined && (this.selector = e.selector, | |
| this.context = e.context), | |
| jQuery.makeArray(e, this)) | |
| } | |
| ; | |
| init.prototype = jQuery.fn, | |
| rootjQuery = jQuery(document); | |
| var rparentsprev = /^(?:parents|prev(?:Until|All))/ | |
| , guaranteedUnique = { | |
| children: !0, | |
| contents: !0, | |
| next: !0, | |
| prev: !0 | |
| }; | |
| jQuery.fn.extend({ | |
| has: function(e) { | |
| var t = jQuery(e, this) | |
| , n = t.length; | |
| return this.filter(function() { | |
| var e = 0; | |
| for (; e < n; e++) | |
| if (jQuery.contains(this, t[e])) | |
| return !0 | |
| }) | |
| }, | |
| closest: function(e, t) { | |
| var n, r = 0, i = this.length, s = [], o = rneedsContext.test(e) || typeof e != "string" ? jQuery(e, t || this.context) : 0; | |
| for (; r < i; r++) | |
| for (n = this[r]; n && n !== t; n = n.parentNode) | |
| if (n.nodeType < 11 && (o ? o.index(n) > -1 : n.nodeType === 1 && jQuery.find.matchesSelector(n, e))) { | |
| s.push(n); | |
| break | |
| } | |
| return this.pushStack(s.length > 1 ? jQuery.uniqueSort(s) : s) | |
| }, | |
| index: function(e) { | |
| return e ? typeof e == "string" ? indexOf.call(jQuery(e), this[0]) : indexOf.call(this, e.jquery ? e[0] : e) : this[0] && this[0].parentNode ? this.first().prevAll().length : -1 | |
| }, | |
| add: function(e, t) { | |
| return this.pushStack(jQuery.uniqueSort(jQuery.merge(this.get(), jQuery(e, t)))) | |
| }, | |
| addBack: function(e) { | |
| return this.add(e == null ? this.prevObject : this.prevObject.filter(e)) | |
| } | |
| }), | |
| jQuery.each({ | |
| parent: function(e) { | |
| var t = e.parentNode; | |
| return t && t.nodeType !== 11 ? t : null | |
| }, | |
| parents: function(e) { | |
| return dir(e, "parentNode") | |
| }, | |
| parentsUntil: function(e, t, n) { | |
| return dir(e, "parentNode", n) | |
| }, | |
| next: function(e) { | |
| return sibling(e, "nextSibling") | |
| }, | |
| prev: function(e) { | |
| return sibling(e, "previousSibling") | |
| }, | |
| nextAll: function(e) { | |
| return dir(e, "nextSibling") | |
| }, | |
| prevAll: function(e) { | |
| return dir(e, "previousSibling") | |
| }, | |
| nextUntil: function(e, t, n) { | |
| return dir(e, "nextSibling", n) | |
| }, | |
| prevUntil: function(e, t, n) { | |
| return dir(e, "previousSibling", n) | |
| }, | |
| siblings: function(e) { | |
| return siblings((e.parentNode || {}).firstChild, e) | |
| }, | |
| children: function(e) { | |
| return siblings(e.firstChild) | |
| }, | |
| contents: function(e) { | |
| return e.contentDocument || jQuery.merge([], e.childNodes) | |
| } | |
| }, function(e, t) { | |
| jQuery.fn[e] = function(n, r) { | |
| var i = jQuery.map(this, t, n); | |
| return e.slice(-5) !== "Until" && (r = n), | |
| r && typeof r == "string" && (i = jQuery.filter(r, i)), | |
| this.length > 1 && (guaranteedUnique[e] || jQuery.uniqueSort(i), | |
| rparentsprev.test(e) && i.reverse()), | |
| this.pushStack(i) | |
| } | |
| }); | |
| var rnotwhite = /\S+/g; | |
| jQuery.Callbacks = function(e) { | |
| e = typeof e == "string" ? createOptions(e) : jQuery.extend({}, e); | |
| var t, n, r, i, s = [], o = [], u = -1, a = function() { | |
| i = e.once, | |
| r = t = !0; | |
| for (; o.length; u = -1) { | |
| n = o.shift(); | |
| while (++u < s.length) | |
| s[u].apply(n[0], n[1]) === !1 && e.stopOnFalse && (u = s.length, | |
| n = !1) | |
| } | |
| e.memory || (n = !1), | |
| t = !1, | |
| i && (n ? s = [] : s = "") | |
| }, f = { | |
| add: function() { | |
| return s && (n && !t && (u = s.length - 1, | |
| o.push(n)), | |
| function r(t) { | |
| jQuery.each(t, function(t, n) { | |
| jQuery.isFunction(n) ? (!e.unique || !f.has(n)) && s.push(n) : n && n.length && jQuery.type(n) !== "string" && r(n) | |
| }) | |
| }(arguments), | |
| n && !t && a()), | |
| this | |
| }, | |
| remove: function() { | |
| return jQuery.each(arguments, function(e, t) { | |
| var n; | |
| while ((n = jQuery.inArray(t, s, n)) > -1) | |
| s.splice(n, 1), | |
| n <= u && u-- | |
| }), | |
| this | |
| }, | |
| has: function(e) { | |
| return e ? jQuery.inArray(e, s) > -1 : s.length > 0 | |
| }, | |
| empty: function() { | |
| return s && (s = []), | |
| this | |
| }, | |
| disable: function() { | |
| return i = o = [], | |
| s = n = "", | |
| this | |
| }, | |
| disabled: function() { | |
| return !s | |
| }, | |
| lock: function() { | |
| return i = o = [], | |
| n || (s = n = ""), | |
| this | |
| }, | |
| locked: function() { | |
| return !!i | |
| }, | |
| fireWith: function(e, n) { | |
| return i || (n = n || [], | |
| n = [e, n.slice ? n.slice() : n], | |
| o.push(n), | |
| t || a()), | |
| this | |
| }, | |
| fire: function() { | |
| return f.fireWith(this, arguments), | |
| this | |
| }, | |
| fired: function() { | |
| return !!r | |
| } | |
| }; | |
| return f | |
| } | |
| , | |
| jQuery.extend({ | |
| Deferred: function(e) { | |
| var t = [["resolve", "done", jQuery.Callbacks("once memory"), "resolved"], ["reject", "fail", jQuery.Callbacks("once memory"), "rejected"], ["notify", "progress", jQuery.Callbacks("memory")]] | |
| , n = "pending" | |
| , r = { | |
| state: function() { | |
| return n | |
| }, | |
| always: function() { | |
| return i.done(arguments).fail(arguments), | |
| this | |
| }, | |
| then: function() { | |
| var e = arguments; | |
| return jQuery.Deferred(function(n) { | |
| jQuery.each(t, function(t, s) { | |
| var o = jQuery.isFunction(e[t]) && e[t]; | |
| i[s[1]](function() { | |
| var e = o && o.apply(this, arguments); | |
| e && jQuery.isFunction(e.promise) ? e.promise().progress(n.notify).done(n.resolve).fail(n.reject) : n[s[0] + "With"](this === r ? n.promise() : this, o ? [e] : arguments) | |
| }) | |
| }), | |
| e = null | |
| }).promise() | |
| }, | |
| promise: function(e) { | |
| return e != null ? jQuery.extend(e, r) : r | |
| } | |
| } | |
| , i = {}; | |
| return r.pipe = r.then, | |
| jQuery.each(t, function(e, s) { | |
| var o = s[2] | |
| , u = s[3]; | |
| r[s[1]] = o.add, | |
| u && o.add(function() { | |
| n = u | |
| }, t[e ^ 1][2].disable, t[2][2].lock), | |
| i[s[0]] = function() { | |
| return i[s[0] + "With"](this === i ? r : this, arguments), | |
| this | |
| } | |
| , | |
| i[s[0] + "With"] = o.fireWith | |
| }), | |
| r.promise(i), | |
| e && e.call(i, i), | |
| i | |
| }, | |
| when: function(e) { | |
| var t = 0, n = slice.call(arguments), r = n.length, i = r !== 1 || e && jQuery.isFunction(e.promise) ? r : 0, s = i === 1 ? e : jQuery.Deferred(), o = function(e, t, n) { | |
| return function(r) { | |
| t[e] = this, | |
| n[e] = arguments.length > 1 ? slice.call(arguments) : r, | |
| n === u ? s.notifyWith(t, n) : --i || s.resolveWith(t, n) | |
| } | |
| }, u, a, f; | |
| if (r > 1) { | |
| u = new Array(r), | |
| a = new Array(r), | |
| f = new Array(r); | |
| for (; t < r; t++) | |
| n[t] && jQuery.isFunction(n[t].promise) ? n[t].promise().progress(o(t, a, u)).done(o(t, f, n)).fail(s.reject) : --i | |
| } | |
| return i || s.resolveWith(f, n), | |
| s.promise() | |
| } | |
| }); | |
| var readyList; | |
| jQuery.fn.ready = function(e) { | |
| return jQuery.ready.promise().done(e), | |
| this | |
| } | |
| , | |
| jQuery.extend({ | |
| isReady: !1, | |
| readyWait: 1, | |
| holdReady: function(e) { | |
| e ? jQuery.readyWait++ : jQuery.ready(!0) | |
| }, | |
| ready: function(e) { | |
| if (e === !0 ? --jQuery.readyWait : jQuery.isReady) | |
| return; | |
| jQuery.isReady = !0; | |
| if (e !== !0 && --jQuery.readyWait > 0) | |
| return; | |
| readyList.resolveWith(document, [jQuery]), | |
| jQuery.fn.triggerHandler && (jQuery(document).triggerHandler("ready"), | |
| jQuery(document).off("ready")) | |
| } | |
| }), | |
| jQuery.ready.promise = function(e) { | |
| return readyList || (readyList = jQuery.Deferred(), | |
| document.readyState === "complete" || document.readyState !== "loading" && !document.documentElement.doScroll ? window.setTimeout(jQuery.ready) : (document.addEventListener("DOMContentLoaded", completed), | |
| window.addEventListener("load", completed))), | |
| readyList.promise(e) | |
| } | |
| , | |
| jQuery.ready.promise(); | |
| var access = function(e, t, n, r, i, s, o) { | |
| var u = 0 | |
| , a = e.length | |
| , f = n == null; | |
| if (jQuery.type(n) === "object") { | |
| i = !0; | |
| for (u in n) | |
| access(e, t, u, n[u], !0, s, o) | |
| } else if (r !== undefined) { | |
| i = !0, | |
| jQuery.isFunction(r) || (o = !0), | |
| f && (o ? (t.call(e, r), | |
| t = null) : (f = t, | |
| t = function(e, t, n) { | |
| return f.call(jQuery(e), n) | |
| } | |
| )); | |
| if (t) | |
| for (; u < a; u++) | |
| t(e[u], n, o ? r : r.call(e[u], u, t(e[u], n))) | |
| } | |
| return i ? e : f ? t.call(e) : a ? t(e[0], n) : s | |
| } | |
| , acceptData = function(e) { | |
| return e.nodeType === 1 || e.nodeType === 9 || !+e.nodeType | |
| }; | |
| Data.uid = 1, | |
| Data.prototype = { | |
| register: function(e, t) { | |
| var n = t || {}; | |
| return e.nodeType ? e[this.expando] = n : Object.defineProperty(e, this.expando, { | |
| value: n, | |
| writable: !0, | |
| configurable: !0 | |
| }), | |
| e[this.expando] | |
| }, | |
| cache: function(e) { | |
| if (!acceptData(e)) | |
| return {}; | |
| var t = e[this.expando]; | |
| return t || (t = {}, | |
| acceptData(e) && (e.nodeType ? e[this.expando] = t : Object.defineProperty(e, this.expando, { | |
| value: t, | |
| configurable: !0 | |
| }))), | |
| t | |
| }, | |
| set: function(e, t, n) { | |
| var r, i = this.cache(e); | |
| if (typeof t == "string") | |
| i[t] = n; | |
| else | |
| for (r in t) | |
| i[r] = t[r]; | |
| return i | |
| }, | |
| get: function(e, t) { | |
| return t === undefined ? this.cache(e) : e[this.expando] && e[this.expando][t] | |
| }, | |
| access: function(e, t, n) { | |
| var r; | |
| return t === undefined || t && typeof t == "string" && n === undefined ? (r = this.get(e, t), | |
| r !== undefined ? r : this.get(e, jQuery.camelCase(t))) : (this.set(e, t, n), | |
| n !== undefined ? n : t) | |
| }, | |
| remove: function(e, t) { | |
| var n, r, i, s = e[this.expando]; | |
| if (s === undefined) | |
| return; | |
| if (t === undefined) | |
| this.register(e); | |
| else { | |
| jQuery.isArray(t) ? r = t.concat(t.map(jQuery.camelCase)) : (i = jQuery.camelCase(t), | |
| t in s ? r = [t, i] : (r = i, | |
| r = r in s ? [r] : r.match(rnotwhite) || [])), | |
| n = r.length; | |
| while (n--) | |
| delete s[r[n]] | |
| } | |
| if (t === undefined || jQuery.isEmptyObject(s)) | |
| e.nodeType ? e[this.expando] = undefined : delete e[this.expando] | |
| }, | |
| hasData: function(e) { | |
| var t = e[this.expando]; | |
| return t !== undefined && !jQuery.isEmptyObject(t) | |
| } | |
| }; | |
| var dataPriv = new Data | |
| , dataUser = new Data | |
| , rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/ | |
| , rmultiDash = /[A-Z]/g; | |
| jQuery.extend({ | |
| hasData: function(e) { | |
| return dataUser.hasData(e) || dataPriv.hasData(e) | |
| }, | |
| data: function(e, t, n) { | |
| return dataUser.access(e, t, n) | |
| }, | |
| removeData: function(e, t) { | |
| dataUser.remove(e, t) | |
| }, | |
| _data: function(e, t, n) { | |
| return dataPriv.access(e, t, n) | |
| }, | |
| _removeData: function(e, t) { | |
| dataPriv.remove(e, t) | |
| } | |
| }), | |
| jQuery.fn.extend({ | |
| data: function(e, t) { | |
| var n, r, i, s = this[0], o = s && s.attributes; | |
| if (e === undefined) { | |
| if (this.length) { | |
| i = dataUser.get(s); | |
| if (s.nodeType === 1 && !dataPriv.get(s, "hasDataAttrs")) { | |
| n = o.length; | |
| while (n--) | |
| o[n] && (r = o[n].name, | |
| r.indexOf("data-") === 0 && (r = jQuery.camelCase(r.slice(5)), | |
| dataAttr(s, r, i[r]))); | |
| dataPriv.set(s, "hasDataAttrs", !0) | |
| } | |
| } | |
| return i | |
| } | |
| return typeof e == "object" ? this.each(function() { | |
| dataUser.set(this, e) | |
| }) : access(this, function(t) { | |
| var n, r; | |
| if (s && t === undefined) { | |
| n = dataUser.get(s, e) || dataUser.get(s, e.replace(rmultiDash, "-$&").toLowerCase()); | |
| if (n !== undefined) | |
| return n; | |
| r = jQuery.camelCase(e), | |
| n = dataUser.get(s, r); | |
| if (n !== undefined) | |
| return n; | |
| n = dataAttr(s, r, undefined); | |
| if (n !== undefined) | |
| return n; | |
| return | |
| } | |
| r = jQuery.camelCase(e), | |
| this.each(function() { | |
| var n = dataUser.get(this, r); | |
| dataUser.set(this, r, t), | |
| e.indexOf("-") > -1 && n !== undefined && dataUser.set(this, e, t) | |
| }) | |
| }, null, t, arguments.length > 1, null, !0) | |
| }, | |
| removeData: function(e) { | |
| return this.each(function() { | |
| dataUser.remove(this, e) | |
| }) | |
| } | |
| }), | |
| jQuery.extend({ | |
| queue: function(e, t, n) { | |
| var r; | |
| if (e) | |
| return t = (t || "fx") + "queue", | |
| r = dataPriv.get(e, t), | |
| n && (!r || jQuery.isArray(n) ? r = dataPriv.access(e, t, jQuery.makeArray(n)) : r.push(n)), | |
| r || [] | |
| }, | |
| dequeue: function(e, t) { | |
| t = t || "fx"; | |
| var n = jQuery.queue(e, t) | |
| , r = n.length | |
| , i = n.shift() | |
| , s = jQuery._queueHooks(e, t) | |
| , o = function() { | |
| jQuery.dequeue(e, t) | |
| }; | |
| i === "inprogress" && (i = n.shift(), | |
| r--), | |
| i && (t === "fx" && n.unshift("inprogress"), | |
| delete s.stop, | |
| i.call(e, o, s)), | |
| !r && s && s.empty.fire() | |
| }, | |
| _queueHooks: function(e, t) { | |
| var n = t + "queueHooks"; | |
| return dataPriv.get(e, n) || dataPriv.access(e, n, { | |
| empty: jQuery.Callbacks("once memory").add(function() { | |
| dataPriv.remove(e, [t + "queue", n]) | |
| }) | |
| }) | |
| } | |
| }), | |
| jQuery.fn.extend({ | |
| queue: function(e, t) { | |
| var n = 2; | |
| return typeof e != "string" && (t = e, | |
| e = "fx", | |
| n--), | |
| arguments.length < n ? jQuery.queue(this[0], e) : t === undefined ? this : this.each(function() { | |
| var n = jQuery.queue(this, e, t); | |
| jQuery._queueHooks(this, e), | |
| e === "fx" && n[0] !== "inprogress" && jQuery.dequeue(this, e) | |
| }) | |
| }, | |
| dequeue: function(e) { | |
| return this.each(function() { | |
| jQuery.dequeue(this, e) | |
| }) | |
| }, | |
| clearQueue: function(e) { | |
| return this.queue(e || "fx", []) | |
| }, | |
| promise: function(e, t) { | |
| var n, r = 1, i = jQuery.Deferred(), s = this, o = this.length, u = function() { | |
| --r || i.resolveWith(s, [s]) | |
| }; | |
| typeof e != "string" && (t = e, | |
| e = undefined), | |
| e = e || "fx"; | |
| while (o--) | |
| n = dataPriv.get(s[o], e + "queueHooks"), | |
| n && n.empty && (r++, | |
| n.empty.add(u)); | |
| return u(), | |
| i.promise(t) | |
| } | |
| }); | |
| var pnum = /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source | |
| , rcssNum = new RegExp("^(?:([+-])=|)(" + pnum + ")([a-z%]*)$","i") | |
| , cssExpand = ["Top", "Right", "Bottom", "Left"] | |
| , isHidden = function(e, t) { | |
| return e = t || e, | |
| jQuery.css(e, "display") === "none" || !jQuery.contains(e.ownerDocument, e) | |
| } | |
| , rcheckableType = /^(?:checkbox|radio)$/i | |
| , rtagName = /<([\w:-]+)/ | |
| , rscriptType = /^$|\/(?:java|ecma)script/i | |
| , wrapMap = { | |
| option: [1, "<select multiple='multiple'>", "</select>"], | |
| thead: [1, "<table>", "</table>"], | |
| col: [2, "<table><colgroup>", "</colgroup></table>"], | |
| tr: [2, "<table><tbody>", "</tbody></table>"], | |
| td: [3, "<table><tbody><tr>", "</tr></tbody></table>"], | |
| _default: [0, "", ""] | |
| }; | |
| wrapMap.optgroup = wrapMap.option, | |
| wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead, | |
| wrapMap.th = wrapMap.td; | |
| var rhtml = /<|&#?\w+;/; | |
| (function() { | |
| var e = document.createDocumentFragment() | |
| , t = e.appendChild(document.createElement("div")) | |
| , n = document.createElement("input"); | |
| n.setAttribute("type", "radio"), | |
| n.setAttribute("checked", "checked"), | |
| n.setAttribute("name", "t"), | |
| t.appendChild(n), | |
| support.checkClone = t.cloneNode(!0).cloneNode(!0).lastChild.checked, | |
| t.innerHTML = "<textarea>x</textarea>", | |
| support.noCloneChecked = !!t.cloneNode(!0).lastChild.defaultValue | |
| })(); | |
| var rkeyEvent = /^key/ | |
| , rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/ | |
| , rtypenamespace = /^([^.]*)(?:\.(.+)|)/; | |
| jQuery.event = { | |
| global: {}, | |
| add: function(e, t, n, r, i) { | |
| var s, o, u, a, f, l, c, h, p, d, v, m = dataPriv.get(e); | |
| if (!m) | |
| return; | |
| n.handler && (s = n, | |
| n = s.handler, | |
| i = s.selector), | |
| n.guid || (n.guid = jQuery.guid++), | |
| (a = m.events) || (a = m.events = {}), | |
| (o = m.handle) || (o = m.handle = function(t) { | |
| return typeof jQuery != "undefined" && jQuery.event.triggered !== t.type ? jQuery.event.dispatch.apply(e, arguments) : undefined | |
| } | |
| ), | |
| t = (t || "").match(rnotwhite) || [""], | |
| f = t.length; | |
| while (f--) { | |
| u = rtypenamespace.exec(t[f]) || [], | |
| p = v = u[1], | |
| d = (u[2] || "").split(".").sort(); | |
| if (!p) | |
| continue; | |
| c = jQuery.event.special[p] || {}, | |
| p = (i ? c.delegateType : c.bindType) || p, | |
| c = jQuery.event.special[p] || {}, | |
| l = jQuery.extend({ | |
| type: p, | |
| origType: v, | |
| data: r, | |
| handler: n, | |
| guid: n.guid, | |
| selector: i, | |
| needsContext: i && jQuery.expr.match.needsContext.test(i), | |
| namespace: d.join(".") | |
| }, s), | |
| (h = a[p]) || (h = a[p] = [], | |
| h.delegateCount = 0, | |
| (!c.setup || c.setup.call(e, r, d, o) === !1) && e.addEventListener && e.addEventListener(p, o)), | |
| c.add && (c.add.call(e, l), | |
| l.handler.guid || (l.handler.guid = n.guid)), | |
| i ? h.splice(h.delegateCount++, 0, l) : h.push(l), | |
| jQuery.event.global[p] = !0 | |
| } | |
| }, | |
| remove: function(e, t, n, r, i) { | |
| var s, o, u, a, f, l, c, h, p, d, v, m = dataPriv.hasData(e) && dataPriv.get(e); | |
| if (!m || !(a = m.events)) | |
| return; | |
| t = (t || "").match(rnotwhite) || [""], | |
| f = t.length; | |
| while (f--) { | |
| u = rtypenamespace.exec(t[f]) || [], | |
| p = v = u[1], | |
| d = (u[2] || "").split(".").sort(); | |
| if (!p) { | |
| for (p in a) | |
| jQuery.event.remove(e, p + t[f], n, r, !0); | |
| continue | |
| } | |
| c = jQuery.event.special[p] || {}, | |
| p = (r ? c.delegateType : c.bindType) || p, | |
| h = a[p] || [], | |
| u = u[2] && new RegExp("(^|\\.)" + d.join("\\.(?:.*\\.|)") + "(\\.|$)"), | |
| o = s = h.length; | |
| while (s--) | |
| l = h[s], | |
| (i || v === l.origType) && (!n || n.guid === l.guid) && (!u || u.test(l.namespace)) && (!r || r === l.selector || r === "**" && l.selector) && (h.splice(s, 1), | |
| l.selector && h.delegateCount--, | |
| c.remove && c.remove.call(e, l)); | |
| o && !h.length && ((!c.teardown || c.teardown.call(e, d, m.handle) === !1) && jQuery.removeEvent(e, p, m.handle), | |
| delete a[p]) | |
| } | |
| jQuery.isEmptyObject(a) && dataPriv.remove(e, "handle events") | |
| }, | |
| dispatch: function(e) { | |
| e = jQuery.event.fix(e); | |
| var t, n, r, i, s, o = [], u = slice.call(arguments), a = (dataPriv.get(this, "events") || {})[e.type] || [], f = jQuery.event.special[e.type] || {}; | |
| u[0] = e, | |
| e.delegateTarget = this; | |
| if (f.preDispatch && f.preDispatch.call(this, e) === !1) | |
| return; | |
| o = jQuery.event.handlers.call(this, e, a), | |
| t = 0; | |
| while ((i = o[t++]) && !e.isPropagationStopped()) { | |
| e.currentTarget = i.elem, | |
| n = 0; | |
| while ((s = i.handlers[n++]) && !e.isImmediatePropagationStopped()) | |
| if (!e.rnamespace || e.rnamespace.test(s.namespace)) | |
| e.handleObj = s, | |
| e.data = s.data, | |
| r = ((jQuery.event.special[s.origType] || {}).handle || s.handler).apply(i.elem, u), | |
| r !== undefined && (e.result = r) === !1 && (e.preventDefault(), | |
| e.stopPropagation()) | |
| } | |
| return f.postDispatch && f.postDispatch.call(this, e), | |
| e.result | |
| }, | |
| handlers: function(e, t) { | |
| var n, r, i, s, o = [], u = t.delegateCount, a = e.target; | |
| if (u && a.nodeType && (e.type !== "click" || isNaN(e.button) || e.button < 1)) | |
| for (; a !== this; a = a.parentNode || this) | |
| if (a.nodeType === 1 && (a.disabled !== !0 || e.type !== "click")) { | |
| r = []; | |
| for (n = 0; n < u; n++) | |
| s = t[n], | |
| i = s.selector + " ", | |
| r[i] === undefined && (r[i] = s.needsContext ? jQuery(i, this).index(a) > -1 : jQuery.find(i, this, null, [a]).length), | |
| r[i] && r.push(s); | |
| r.length && o.push({ | |
| elem: a, | |
| handlers: r | |
| }) | |
| } | |
| return u < t.length && o.push({ | |
| elem: this, | |
| handlers: t.slice(u) | |
| }), | |
| o | |
| }, | |
| props: "altKey bubbles cancelable ctrlKey currentTarget detail eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "), | |
| fixHooks: {}, | |
| keyHooks: { | |
| props: "char charCode key keyCode".split(" "), | |
| filter: function(e, t) { | |
| return e.which == null && (e.which = t.charCode != null ? t.charCode : t.keyCode), | |
| e | |
| } | |
| }, | |
| mouseHooks: { | |
| props: "button buttons clientX clientY offsetX offsetY pageX pageY screenX screenY toElement".split(" "), | |
| filter: function(e, t) { | |
| var n, r, i, s = t.button; | |
| return e.pageX == null && t.clientX != null && (n = e.target.ownerDocument || document, | |
| r = n.documentElement, | |
| i = n.body, | |
| e.pageX = t.clientX + (r && r.scrollLeft || i && i.scrollLeft || 0) - (r && r.clientLeft || i && i.clientLeft || 0), | |
| e.pageY = t.clientY + (r && r.scrollTop || i && i.scrollTop || 0) - (r && r.clientTop || i && i.clientTop || 0)), | |
| !e.which && s !== undefined && (e.which = s & 1 ? 1 : s & 2 ? 3 : s & 4 ? 2 : 0), | |
| e | |
| } | |
| }, | |
| fix: function(e) { | |
| if (e[jQuery.expando]) | |
| return e; | |
| var t, n, r, i = e.type, s = e, o = this.fixHooks[i]; | |
| o || (this.fixHooks[i] = o = rmouseEvent.test(i) ? this.mouseHooks : rkeyEvent.test(i) ? this.keyHooks : {}), | |
| r = o.props ? this.props.concat(o.props) : this.props, | |
| e = new jQuery.Event(s), | |
| t = r.length; | |
| while (t--) | |
| n = r[t], | |
| e[n] = s[n]; | |
| return e.target || (e.target = document), | |
| e.target.nodeType === 3 && (e.target = e.target.parentNode), | |
| o.filter ? o.filter(e, s) : e | |
| }, | |
| special: { | |
| load: { | |
| noBubble: !0 | |
| }, | |
| focus: { | |
| trigger: function() { | |
| if (this !== safeActiveElement() && this.focus) | |
| return this.focus(), | |
| !1 | |
| }, | |
| delegateType: "focusin" | |
| }, | |
| blur: { | |
| trigger: function() { | |
| if (this === safeActiveElement() && this.blur) | |
| return this.blur(), | |
| !1 | |
| }, | |
| delegateType: "focusout" | |
| }, | |
| click: { | |
| trigger: function() { | |
| if (this.type === "checkbox" && this.click && jQuery.nodeName(this, "input")) | |
| return this.click(), | |
| !1 | |
| }, | |
| _default: function(e) { | |
| return jQuery.nodeName(e.target, "a") | |
| } | |
| }, | |
| beforeunload: { | |
| postDispatch: function(e) { | |
| e.result !== undefined && e.originalEvent && (e.originalEvent.returnValue = e.result) | |
| } | |
| } | |
| } | |
| }, | |
| jQuery.removeEvent = function(e, t, n) { | |
| e.removeEventListener && e.removeEventListener(t, n) | |
| } | |
| , | |
| jQuery.Event = function(e, t) { | |
| if (!(this instanceof jQuery.Event)) | |
| return new jQuery.Event(e,t); | |
| e && e.type ? (this.originalEvent = e, | |
| this.type = e.type, | |
| this.isDefaultPrevented = e.defaultPrevented || e.defaultPrevented === undefined && e.returnValue === !1 ? returnTrue : returnFalse) : this.type = e, | |
| t && jQuery.extend(this, t), | |
| this.timeStamp = e && e.timeStamp || jQuery.now(), | |
| this[jQuery.expando] = !0 | |
| } | |
| , | |
| jQuery.Event.prototype = { | |
| constructor: jQuery.Event, | |
| isDefaultPrevented: returnFalse, | |
| isPropagationStopped: returnFalse, | |
| isImmediatePropagationStopped: returnFalse, | |
| preventDefault: function() { | |
| var e = this.originalEvent; | |
| this.isDefaultPrevented = returnTrue, | |
| e && e.preventDefault() | |
| }, | |
| stopPropagation: function() { | |
| var e = this.originalEvent; | |
| this.isPropagationStopped = returnTrue, | |
| e && e.stopPropagation() | |
| }, | |
| stopImmediatePropagation: function() { | |
| var e = this.originalEvent; | |
| this.isImmediatePropagationStopped = returnTrue, | |
| e && e.stopImmediatePropagation(), | |
| this.stopPropagation() | |
| } | |
| }, | |
| jQuery.each({ | |
| mouseenter: "mouseover", | |
| mouseleave: "mouseout", | |
| pointerenter: "pointerover", | |
| pointerleave: "pointerout" | |
| }, function(e, t) { | |
| jQuery.event.special[e] = { | |
| delegateType: t, | |
| bindType: t, | |
| handle: function(e) { | |
| var n, r = this, i = e.relatedTarget, s = e.handleObj; | |
| if (!i || i !== r && !jQuery.contains(r, i)) | |
| e.type = s.origType, | |
| n = s.handler.apply(this, arguments), | |
| e.type = t; | |
| return n | |
| } | |
| } | |
| }), | |
| jQuery.fn.extend({ | |
| on: function(e, t, n, r) { | |
| return on(this, e, t, n, r) | |
| }, | |
| one: function(e, t, n, r) { | |
| return on(this, e, t, n, r, 1) | |
| }, | |
| off: function(e, t, n) { | |
| var r, i; | |
| if (e && e.preventDefault && e.handleObj) | |
| return r = e.handleObj, | |
| jQuery(e.delegateTarget).off(r.namespace ? r.origType + "." + r.namespace : r.origType, r.selector, r.handler), | |
| this; | |
| if (typeof e == "object") { | |
| for (i in e) | |
| this.off(i, t, e[i]); | |
| return this | |
| } | |
| if (t === !1 || typeof t == "function") | |
| n = t, | |
| t = undefined; | |
| return n === !1 && (n = returnFalse), | |
| this.each(function() { | |
| jQuery.event.remove(this, e, n, t) | |
| }) | |
| } | |
| }); | |
| var rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:-]+)[^>]*)\/>/gi | |
| , rnoInnerhtml = /<script|<style|<link/i | |
| , rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i | |
| , rscriptTypeMasked = /^true\/(.*)/ | |
| , rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g; | |
| jQuery.extend({ | |
| htmlPrefilter: function(e) { | |
| return e.replace(rxhtmlTag, "<$1></$2>") | |
| }, | |
| clone: function(e, t, n) { | |
| var r, i, s, o, u = e.cloneNode(!0), a = jQuery.contains(e.ownerDocument, e); | |
| if (!support.noCloneChecked && (e.nodeType === 1 || e.nodeType === 11) && !jQuery.isXMLDoc(e)) { | |
| o = getAll(u), | |
| s = getAll(e); | |
| for (r = 0, | |
| i = s.length; r < i; r++) | |
| fixInput(s[r], o[r]) | |
| } | |
| if (t) | |
| if (n) { | |
| s = s || getAll(e), | |
| o = o || getAll(u); | |
| for (r = 0, | |
| i = s.length; r < i; r++) | |
| cloneCopyEvent(s[r], o[r]) | |
| } else | |
| cloneCopyEvent(e, u); | |
| return o = getAll(u, "script"), | |
| o.length > 0 && setGlobalEval(o, !a && getAll(e, "script")), | |
| u | |
| }, | |
| cleanData: function(e) { | |
| var t, n, r, i = jQuery.event.special, s = 0; | |
| for (; (n = e[s]) !== undefined; s++) | |
| if (acceptData(n)) { | |
| if (t = n[dataPriv.expando]) { | |
| if (t.events) | |
| for (r in t.events) | |
| i[r] ? jQuery.event.remove(n, r) : jQuery.removeEvent(n, r, t.handle); | |
| n[dataPriv.expando] = undefined | |
| } | |
| n[dataUser.expando] && (n[dataUser.expando] = undefined) | |
| } | |
| } | |
| }), | |
| jQuery.fn.extend({ | |
| domManip: domManip, | |
| detach: function(e) { | |
| return remove(this, e, !0) | |
| }, | |
| remove: function(e) { | |
| return remove(this, e) | |
| }, | |
| text: function(e) { | |
| return access(this, function(e) { | |
| return e === undefined ? jQuery.text(this) : this.empty().each(function() { | |
| if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) | |
| this.textContent = e | |
| }) | |
| }, null, e, arguments.length) | |
| }, | |
| append: function() { | |
| return domManip(this, arguments, function(e) { | |
| if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) { | |
| var t = manipulationTarget(this, e); | |
| t.appendChild(e) | |
| } | |
| }) | |
| }, | |
| prepend: function() { | |
| return domManip(this, arguments, function(e) { | |
| if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) { | |
| var t = manipulationTarget(this, e); | |
| t.insertBefore(e, t.firstChild) | |
| } | |
| }) | |
| }, | |
| before: function() { | |
| return domManip(this, arguments, function(e) { | |
| this.parentNode && this.parentNode.insertBefore(e, this) | |
| }) | |
| }, | |
| after: function() { | |
| return domManip(this, arguments, function(e) { | |
| this.parentNode && this.parentNode.insertBefore(e, this.nextSibling) | |
| }) | |
| }, | |
| empty: function() { | |
| var e, t = 0; | |
| for (; (e = this[t]) != null; t++) | |
| e.nodeType === 1 && (jQuery.cleanData(getAll(e, !1)), | |
| e.textContent = ""); | |
| return this | |
| }, | |
| clone: function(e, t) { | |
| return e = e == null ? !1 : e, | |
| t = t == null ? e : t, | |
| this.map(function() { | |
| return jQuery.clone(this, e, t) | |
| }) | |
| }, | |
| html: function(e) { | |
| return access(this, function(e) { | |
| var t = this[0] || {} | |
| , n = 0 | |
| , r = this.length; | |
| if (e === undefined && t.nodeType === 1) | |
| return t.innerHTML; | |
| if (typeof e == "string" && !rnoInnerhtml.test(e) && !wrapMap[(rtagName.exec(e) || ["", ""])[1].toLowerCase()]) { | |
| e = jQuery.htmlPrefilter(e); | |
| try { | |
| for (; n < r; n++) | |
| t = this[n] || {}, | |
| t.nodeType === 1 && (jQuery.cleanData(getAll(t, !1)), | |
| t.innerHTML = e); | |
| t = 0 | |
| } catch (i) {} | |
| } | |
| t && this.empty().append(e) | |
| }, null, e, arguments.length) | |
| }, | |
| replaceWith: function() { | |
| var e = []; | |
| return domManip(this, arguments, function(t) { | |
| var n = this.parentNode; | |
| jQuery.inArray(this, e) < 0 && (jQuery.cleanData(getAll(this)), | |
| n && n.replaceChild(t, this)) | |
| }, e) | |
| } | |
| }), | |
| jQuery.each({ | |
| appendTo: "append", | |
| prependTo: "prepend", | |
| insertBefore: "before", | |
| insertAfter: "after", | |
| replaceAll: "replaceWith" | |
| }, function(e, t) { | |
| jQuery.fn[e] = function(e) { | |
| var n, r = [], i = jQuery(e), s = i.length - 1, o = 0; | |
| for (; o <= s; o++) | |
| n = o === s ? this : this.clone(!0), | |
| jQuery(i[o])[t](n), | |
| push.apply(r, n.get()); | |
| return this.pushStack(r) | |
| } | |
| }); | |
| var iframe, elemdisplay = { | |
| HTML: "block", | |
| BODY: "block" | |
| }, rmargin = /^margin/, rnumnonpx = new RegExp("^(" + pnum + ")(?!px)[a-z%]+$","i"), getStyles = function(e) { | |
| var t = e.ownerDocument.defaultView; | |
| return t.opener || (t = window), | |
| t.getComputedStyle(e) | |
| }, swap = function(e, t, n, r) { | |
| var i, s, o = {}; | |
| for (s in t) | |
| o[s] = e.style[s], | |
| e.style[s] = t[s]; | |
| i = n.apply(e, r || []); | |
| for (s in t) | |
| e.style[s] = o[s]; | |
| return i | |
| }, documentElement = document.documentElement; | |
| (function() { | |
| function o() { | |
| s.style.cssText = "-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;position:relative;display:block;margin:auto;border:1px;padding:1px;top:1%;width:50%", | |
| s.innerHTML = "", | |
| documentElement.appendChild(i); | |
| var o = window.getComputedStyle(s); | |
| e = o.top !== "1%", | |
| r = o.marginLeft === "2px", | |
| t = o.width === "4px", | |
| s.style.marginRight = "50%", | |
| n = o.marginRight === "4px", | |
| documentElement.removeChild(i) | |
| } | |
| var e, t, n, r, i = document.createElement("div"), s = document.createElement("div"); | |
| if (!s.style) | |
| return; | |
| s.style.backgroundClip = "content-box", | |
| s.cloneNode(!0).style.backgroundClip = "", | |
| support.clearCloneStyle = s.style.backgroundClip === "content-box", | |
| i.style.cssText = "border:0;width:8px;height:0;top:0;left:-9999px;padding:0;margin-top:1px;position:absolute", | |
| i.appendChild(s), | |
| jQuery.extend(support, { | |
| pixelPosition: function() { | |
| return o(), | |
| e | |
| }, | |
| boxSizingReliable: function() { | |
| return t == null && o(), | |
| t | |
| }, | |
| pixelMarginRight: function() { | |
| return t == null && o(), | |
| n | |
| }, | |
| reliableMarginLeft: function() { | |
| return t == null && o(), | |
| r | |
| }, | |
| reliableMarginRight: function() { | |
| var e, t = s.appendChild(document.createElement("div")); | |
| return t.style.cssText = s.style.cssText = "-webkit-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:0", | |
| t.style.marginRight = t.style.width = "0", | |
| s.style.width = "1px", | |
| documentElement.appendChild(i), | |
| e = !parseFloat(window.getComputedStyle(t).marginRight), | |
| documentElement.removeChild(i), | |
| s.removeChild(t), | |
| e | |
| } | |
| }) | |
| })(); | |
| var rdisplayswap = /^(none|table(?!-c[ea]).+)/ | |
| , cssShow = { | |
| position: "absolute", | |
| visibility: "hidden", | |
| display: "block" | |
| } | |
| , cssNormalTransform = { | |
| letterSpacing: "0", | |
| fontWeight: "400" | |
| } | |
| , cssPrefixes = ["Webkit", "O", "Moz", "ms"] | |
| , emptyStyle = document.createElement("div").style; | |
| jQuery.extend({ | |
| cssHooks: { | |
| opacity: { | |
| get: function(e, t) { | |
| if (t) { | |
| var n = curCSS(e, "opacity"); | |
| return n === "" ? "1" : n | |
| } | |
| } | |
| } | |
| }, | |
| cssNumber: { | |
| animationIterationCount: !0, | |
| columnCount: !0, | |
| fillOpacity: !0, | |
| flexGrow: !0, | |
| flexShrink: !0, | |
| fontWeight: !0, | |
| lineHeight: !0, | |
| opacity: !0, | |
| order: !0, | |
| orphans: !0, | |
| widows: !0, | |
| zIndex: !0, | |
| zoom: !0 | |
| }, | |
| cssProps: { | |
| "float": "cssFloat" | |
| }, | |
| style: function(e, t, n, r) { | |
| if (!e || e.nodeType === 3 || e.nodeType === 8 || !e.style) | |
| return; | |
| var i, s, o, u = jQuery.camelCase(t), a = e.style; | |
| t = jQuery.cssProps[u] || (jQuery.cssProps[u] = vendorPropName(u) || u), | |
| o = jQuery.cssHooks[t] || jQuery.cssHooks[u]; | |
| if (n === undefined) | |
| return o && "get"in o && (i = o.get(e, !1, r)) !== undefined ? i : a[t]; | |
| s = typeof n, | |
| s === "string" && (i = rcssNum.exec(n)) && i[1] && (n = adjustCSS(e, t, i), | |
| s = "number"); | |
| if (n == null || n !== n) | |
| return; | |
| s === "number" && (n += i && i[3] || (jQuery.cssNumber[u] ? "" : "px")), | |
| !support.clearCloneStyle && n === "" && t.indexOf("background") === 0 && (a[t] = "inherit"); | |
| if (!o || !("set"in o) || (n = o.set(e, n, r)) !== undefined) | |
| a[t] = n | |
| }, | |
| css: function(e, t, n, r) { | |
| var i, s, o, u = jQuery.camelCase(t); | |
| return t = jQuery.cssProps[u] || (jQuery.cssProps[u] = vendorPropName(u) || u), | |
| o = jQuery.cssHooks[t] || jQuery.cssHooks[u], | |
| o && "get"in o && (i = o.get(e, !0, n)), | |
| i === undefined && (i = curCSS(e, t, r)), | |
| i === "normal" && t in cssNormalTransform && (i = cssNormalTransform[t]), | |
| n === "" || n ? (s = parseFloat(i), | |
| n === !0 || isFinite(s) ? s || 0 : i) : i | |
| } | |
| }), | |
| jQuery.each(["height", "width"], function(e, t) { | |
| jQuery.cssHooks[t] = { | |
| get: function(e, n, r) { | |
| if (n) | |
| return rdisplayswap.test(jQuery.css(e, "display")) && e.offsetWidth === 0 ? swap(e, cssShow, function() { | |
| return getWidthOrHeight(e, t, r) | |
| }) : getWidthOrHeight(e, t, r) | |
| }, | |
| set: function(e, n, r) { | |
| var i, s = r && getStyles(e), o = r && augmentWidthOrHeight(e, t, r, jQuery.css(e, "boxSizing", !1, s) === "border-box", s); | |
| return o && (i = rcssNum.exec(n)) && (i[3] || "px") !== "px" && (e.style[t] = n, | |
| n = jQuery.css(e, t)), | |
| setPositiveNumber(e, n, o) | |
| } | |
| } | |
| }), | |
| jQuery.cssHooks.marginLeft = addGetHookIf(support.reliableMarginLeft, function(e, t) { | |
| if (t) | |
| return (parseFloat(curCSS(e, "marginLeft")) || e.getBoundingClientRect().left - swap(e, { | |
| marginLeft: 0 | |
| }, function() { | |
| return e.getBoundingClientRect().left | |
| })) + "px" | |
| }), | |
| jQuery.cssHooks.marginRight = addGetHookIf(support.reliableMarginRight, function(e, t) { | |
| if (t) | |
| return swap(e, { | |
| display: "inline-block" | |
| }, curCSS, [e, "marginRight"]) | |
| }), | |
| jQuery.each({ | |
| margin: "", | |
| padding: "", | |
| border: "Width" | |
| }, function(e, t) { | |
| jQuery.cssHooks[e + t] = { | |
| expand: function(n) { | |
| var r = 0 | |
| , i = {} | |
| , s = typeof n == "string" ? n.split(" ") : [n]; | |
| for (; r < 4; r++) | |
| i[e + cssExpand[r] + t] = s[r] || s[r - 2] || s[0]; | |
| return i | |
| } | |
| }, | |
| rmargin.test(e) || (jQuery.cssHooks[e + t].set = setPositiveNumber) | |
| }), | |
| jQuery.fn.extend({ | |
| css: function(e, t) { | |
| return access(this, function(e, t, n) { | |
| var r, i, s = {}, o = 0; | |
| if (jQuery.isArray(t)) { | |
| r = getStyles(e), | |
| i = t.length; | |
| for (; o < i; o++) | |
| s[t[o]] = jQuery.css(e, t[o], !1, r); | |
| return s | |
| } | |
| return n !== undefined ? jQuery.style(e, t, n) : jQuery.css(e, t) | |
| }, e, t, arguments.length > 1) | |
| }, | |
| show: function() { | |
| return showHide(this, !0) | |
| }, | |
| hide: function() { | |
| return showHide(this) | |
| }, | |
| toggle: function(e) { | |
| return typeof e == "boolean" ? e ? this.show() : this.hide() : this.each(function() { | |
| isHidden(this) ? jQuery(this).show() : jQuery(this).hide() | |
| }) | |
| } | |
| }), | |
| jQuery.Tween = Tween, | |
| Tween.prototype = { | |
| constructor: Tween, | |
| init: function(e, t, n, r, i, s) { | |
| this.elem = e, | |
| this.prop = n, | |
| this.easing = i || jQuery.easing._default, | |
| this.options = t, | |
| this.start = this.now = this.cur(), | |
| this.end = r, | |
| this.unit = s || (jQuery.cssNumber[n] ? "" : "px") | |
| }, | |
| cur: function() { | |
| var e = Tween.propHooks[this.prop]; | |
| return e && e.get ? e.get(this) : Tween.propHooks._default.get(this) | |
| }, | |
| run: function(e) { | |
| var t, n = Tween.propHooks[this.prop]; | |
| return this.options.duration ? this.pos = t = jQuery.easing[this.easing](e, this.options.duration * e, 0, 1, this.options.duration) : this.pos = t = e, | |
| this.now = (this.end - this.start) * t + this.start, | |
| this.options.step && this.options.step.call(this.elem, this.now, this), | |
| n && n.set ? n.set(this) : Tween.propHooks._default.set(this), | |
| this | |
| } | |
| }, | |
| Tween.prototype.init.prototype = Tween.prototype, | |
| Tween.propHooks = { | |
| _default: { | |
| get: function(e) { | |
| var t; | |
| return e.elem.nodeType !== 1 || e.elem[e.prop] != null && e.elem.style[e.prop] == null ? e.elem[e.prop] : (t = jQuery.css(e.elem, e.prop, ""), | |
| !t || t === "auto" ? 0 : t) | |
| }, | |
| set: function(e) { | |
| jQuery.fx.step[e.prop] ? jQuery.fx.step[e.prop](e) : e.elem.nodeType !== 1 || e.elem.style[jQuery.cssProps[e.prop]] == null && !jQuery.cssHooks[e.prop] ? e.elem[e.prop] = e.now : jQuery.style(e.elem, e.prop, e.now + e.unit) | |
| } | |
| } | |
| }, | |
| Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = { | |
| set: function(e) { | |
| e.elem.nodeType && e.elem.parentNode && (e.elem[e.prop] = e.now) | |
| } | |
| }, | |
| jQuery.easing = { | |
| linear: function(e) { | |
| return e | |
| }, | |
| swing: function(e) { | |
| return .5 - Math.cos(e * Math.PI) / 2 | |
| }, | |
| _default: "swing" | |
| }, | |
| jQuery.fx = Tween.prototype.init, | |
| jQuery.fx.step = {}; | |
| var fxNow, timerId, rfxtypes = /^(?:toggle|show|hide)$/, rrun = /queueHooks$/; | |
| jQuery.Animation = jQuery.extend(Animation, { | |
| tweeners: { | |
| "*": [function(e, t) { | |
| var n = this.createTween(e, t); | |
| return adjustCSS(n.elem, e, rcssNum.exec(t), n), | |
| n | |
| } | |
| ] | |
| }, | |
| tweener: function(e, t) { | |
| jQuery.isFunction(e) ? (t = e, | |
| e = ["*"]) : e = e.match(rnotwhite); | |
| var n, r = 0, i = e.length; | |
| for (; r < i; r++) | |
| n = e[r], | |
| Animation.tweeners[n] = Animation.tweeners[n] || [], | |
| Animation.tweeners[n].unshift(t) | |
| }, | |
| prefilters: [defaultPrefilter], | |
| prefilter: function(e, t) { | |
| t ? Animation.prefilters.unshift(e) : Animation.prefilters.push(e) | |
| } | |
| }), | |
| jQuery.speed = function(e, t, n) { | |
| var r = e && typeof e == "object" ? jQuery.extend({}, e) : { | |
| complete: n || !n && t || jQuery.isFunction(e) && e, | |
| duration: e, | |
| easing: n && t || t && !jQuery.isFunction(t) && t | |
| }; | |
| r.duration = jQuery.fx.off ? 0 : typeof r.duration == "number" ? r.duration : r.duration in jQuery.fx.speeds ? jQuery.fx.speeds[r.duration] : jQuery.fx.speeds._default; | |
| if (r.queue == null || r.queue === !0) | |
| r.queue = "fx"; | |
| return r.old = r.complete, | |
| r.complete = function() { | |
| jQuery.isFunction(r.old) && r.old.call(this), | |
| r.queue && jQuery.dequeue(this, r.queue) | |
| } | |
| , | |
| r | |
| } | |
| , | |
| jQuery.fn.extend({ | |
| fadeTo: function(e, t, n, r) { | |
| return this.filter(isHidden).css("opacity", 0).show().end().animate({ | |
| opacity: t | |
| }, e, n, r) | |
| }, | |
| animate: function(e, t, n, r) { | |
| var i = jQuery.isEmptyObject(e) | |
| , s = jQuery.speed(t, n, r) | |
| , o = function() { | |
| var t = Animation(this, jQuery.extend({}, e), s); | |
| (i || dataPriv.get(this, "finish")) && t.stop(!0) | |
| }; | |
| return o.finish = o, | |
| i || s.queue === !1 ? this.each(o) : this.queue(s.queue, o) | |
| }, | |
| stop: function(e, t, n) { | |
| var r = function(e) { | |
| var t = e.stop; | |
| delete e.stop, | |
| t(n) | |
| }; | |
| return typeof e != "string" && (n = t, | |
| t = e, | |
| e = undefined), | |
| t && e !== !1 && this.queue(e || "fx", []), | |
| this.each(function() { | |
| var t = !0 | |
| , i = e != null && e + "queueHooks" | |
| , s = jQuery.timers | |
| , o = dataPriv.get(this); | |
| if (i) | |
| o[i] && o[i].stop && r(o[i]); | |
| else | |
| for (i in o) | |
| o[i] && o[i].stop && rrun.test(i) && r(o[i]); | |
| for (i = s.length; i--; ) | |
| s[i].elem === this && (e == null || s[i].queue === e) && (s[i].anim.stop(n), | |
| t = !1, | |
| s.splice(i, 1)); | |
| (t || !n) && jQuery.dequeue(this, e) | |
| }) | |
| }, | |
| finish: function(e) { | |
| return e !== !1 && (e = e || "fx"), | |
| this.each(function() { | |
| var t, n = dataPriv.get(this), r = n[e + "queue"], i = n[e + "queueHooks"], s = jQuery.timers, o = r ? r.length : 0; | |
| n.finish = !0, | |
| jQuery.queue(this, e, []), | |
| i && i.stop && i.stop.call(this, !0); | |
| for (t = s.length; t--; ) | |
| s[t].elem === this && s[t].queue === e && (s[t].anim.stop(!0), | |
| s.splice(t, 1)); | |
| for (t = 0; t < o; t++) | |
| r[t] && r[t].finish && r[t].finish.call(this); | |
| delete n.finish | |
| }) | |
| } | |
| }), | |
| jQuery.each(["toggle", "show", "hide"], function(e, t) { | |
| var n = jQuery.fn[t]; | |
| jQuery.fn[t] = function(e, r, i) { | |
| return e == null || typeof e == "boolean" ? n.apply(this, arguments) : this.animate(genFx(t, !0), e, r, i) | |
| } | |
| }), | |
| jQuery.each({ | |
| slideDown: genFx("show"), | |
| slideUp: genFx("hide"), | |
| slideToggle: genFx("toggle"), | |
| fadeIn: { | |
| opacity: "show" | |
| }, | |
| fadeOut: { | |
| opacity: "hide" | |
| }, | |
| fadeToggle: { | |
| opacity: "toggle" | |
| } | |
| }, function(e, t) { | |
| jQuery.fn[e] = function(e, n, r) { | |
| return this.animate(t, e, n, r) | |
| } | |
| }), | |
| jQuery.timers = [], | |
| jQuery.fx.tick = function() { | |
| var e, t = 0, n = jQuery.timers; | |
| fxNow = jQuery.now(); | |
| for (; t < n.length; t++) | |
| e = n[t], | |
| !e() && n[t] === e && n.splice(t--, 1); | |
| n.length || jQuery.fx.stop(), | |
| fxNow = undefined | |
| } | |
| , | |
| jQuery.fx.timer = function(e) { | |
| jQuery.timers.push(e), | |
| e() ? jQuery.fx.start() : jQuery.timers.pop() | |
| } | |
| , | |
| jQuery.fx.interval = 13, | |
| jQuery.fx.start = function() { | |
| timerId || (timerId = window.setInterval(jQuery.fx.tick, jQuery.fx.interval)) | |
| } | |
| , | |
| jQuery.fx.stop = function() { | |
| window.clearInterval(timerId), | |
| timerId = null | |
| } | |
| , | |
| jQuery.fx.speeds = { | |
| slow: 600, | |
| fast: 200, | |
| _default: 400 | |
| }, | |
| jQuery.fn.delay = function(e, t) { | |
| return e = jQuery.fx ? jQuery.fx.speeds[e] || e : e, | |
| t = t || "fx", | |
| this.queue(t, function(t, n) { | |
| var r = window.setTimeout(t, e); | |
| n.stop = function() { | |
| window.clearTimeout(r) | |
| } | |
| }) | |
| } | |
| , | |
| function() { | |
| var e = document.createElement("input") | |
| , t = document.createElement("select") | |
| , n = t.appendChild(document.createElement("option")); | |
| e.type = "checkbox", | |
| support.checkOn = e.value !== "", | |
| support.optSelected = n.selected, | |
| t.disabled = !0, | |
| support.optDisabled = !n.disabled, | |
| e = document.createElement("input"), | |
| e.value = "t", | |
| e.type = "radio", | |
| support.radioValue = e.value === "t" | |
| }(); | |
| var boolHook, attrHandle = jQuery.expr.attrHandle; | |
| jQuery.fn.extend({ | |
| attr: function(e, t) { | |
| return access(this, jQuery.attr, e, t, arguments.length > 1) | |
| }, | |
| removeAttr: function(e) { | |
| return this.each(function() { | |
| jQuery.removeAttr(this, e) | |
| }) | |
| } | |
| }), | |
| jQuery.extend({ | |
| attr: function(e, t, n) { | |
| var r, i, s = e.nodeType; | |
| if (s === 3 || s === 8 || s === 2) | |
| return; | |
| if (typeof e.getAttribute == "undefined") | |
| return jQuery.prop(e, t, n); | |
| if (s !== 1 || !jQuery.isXMLDoc(e)) | |
| t = t.toLowerCase(), | |
| i = jQuery.attrHooks[t] || (jQuery.expr.match.bool.test(t) ? boolHook : undefined); | |
| if (n !== undefined) { | |
| if (n === null) { | |
| jQuery.removeAttr(e, t); | |
| return | |
| } | |
| return i && "set"in i && (r = i.set(e, n, t)) !== undefined ? r : (e.setAttribute(t, n + ""), | |
| n) | |
| } | |
| return i && "get"in i && (r = i.get(e, t)) !== null ? r : (r = jQuery.find.attr(e, t), | |
| r == null ? undefined : r) | |
| }, | |
| attrHooks: { | |
| type: { | |
| set: function(e, t) { | |
| if (!support.radioValue && t === "radio" && jQuery.nodeName(e, "input")) { | |
| var n = e.value; | |
| return e.setAttribute("type", t), | |
| n && (e.value = n), | |
| t | |
| } | |
| } | |
| } | |
| }, | |
| removeAttr: function(e, t) { | |
| var n, r, i = 0, s = t && t.match(rnotwhite); | |
| if (s && e.nodeType === 1) | |
| while (n = s[i++]) | |
| r = jQuery.propFix[n] || n, | |
| jQuery.expr.match.bool.test(n) && (e[r] = !1), | |
| e.removeAttribute(n) | |
| } | |
| }), | |
| boolHook = { | |
| set: function(e, t, n) { | |
| return t === !1 ? jQuery.removeAttr(e, n) : e.setAttribute(n, n), | |
| n | |
| } | |
| }, | |
| jQuery.each(jQuery.expr.match.bool.source.match(/\w+/g), function(e, t) { | |
| var n = attrHandle[t] || jQuery.find.attr; | |
| attrHandle[t] = function(e, t, r) { | |
| var i, s; | |
| return r || (s = attrHandle[t], | |
| attrHandle[t] = i, | |
| i = n(e, t, r) != null ? t.toLowerCase() : null, | |
| attrHandle[t] = s), | |
| i | |
| } | |
| }); | |
| var rfocusable = /^(?:input|select|textarea|button)$/i | |
| , rclickable = /^(?:a|area)$/i; | |
| jQuery.fn.extend({ | |
| prop: function(e, t) { | |
| return access(this, jQuery.prop, e, t, arguments.length > 1) | |
| }, | |
| removeProp: function(e) { | |
| return this.each(function() { | |
| delete this[jQuery.propFix[e] || e] | |
| }) | |
| } | |
| }), | |
| jQuery.extend({ | |
| prop: function(e, t, n) { | |
| var r, i, s = e.nodeType; | |
| if (s === 3 || s === 8 || s === 2) | |
| return; | |
| if (s !== 1 || !jQuery.isXMLDoc(e)) | |
| t = jQuery.propFix[t] || t, | |
| i = jQuery.propHooks[t]; | |
| return n !== undefined ? i && "set"in i && (r = i.set(e, n, t)) !== undefined ? r : e[t] = n : i && "get"in i && (r = i.get(e, t)) !== null ? r : e[t] | |
| }, | |
| propHooks: { | |
| tabIndex: { | |
| get: function(e) { | |
| var t = jQuery.find.attr(e, "tabindex"); | |
| return t ? parseInt(t, 10) : rfocusable.test(e.nodeName) || rclickable.test(e.nodeName) && e.href ? 0 : -1 | |
| } | |
| } | |
| }, | |
| propFix: { | |
| "for": "htmlFor", | |
| "class": "className" | |
| } | |
| }), | |
| support.optSelected || (jQuery.propHooks.selected = { | |
| get: function(e) { | |
| var t = e.parentNode; | |
| return t && t.parentNode && t.parentNode.selectedIndex, | |
| null | |
| } | |
| }), | |
| jQuery.each(["tabIndex", "readOnly", "maxLength", "cellSpacing", "cellPadding", "rowSpan", "colSpan", "useMap", "frameBorder", "contentEditable"], function() { | |
| jQuery.propFix[this.toLowerCase()] = this | |
| }); | |
| var rclass = /[\t\r\n\f]/g; | |
| jQuery.fn.extend({ | |
| addClass: function(e) { | |
| var t, n, r, i, s, o, u, a = 0; | |
| if (jQuery.isFunction(e)) | |
| return this.each(function(t) { | |
| jQuery(this).addClass(e.call(this, t, getClass(this))) | |
| }); | |
| if (typeof e == "string" && e) { | |
| t = e.match(rnotwhite) || []; | |
| while (n = this[a++]) { | |
| i = getClass(n), | |
| r = n.nodeType === 1 && (" " + i + " ").replace(rclass, " "); | |
| if (r) { | |
| o = 0; | |
| while (s = t[o++]) | |
| r.indexOf(" " + s + " ") < 0 && (r += s + " "); | |
| u = jQuery.trim(r), | |
| i !== u && n.setAttribute("class", u) | |
| } | |
| } | |
| } | |
| return this | |
| }, | |
| removeClass: function(e) { | |
| var t, n, r, i, s, o, u, a = 0; | |
| if (jQuery.isFunction(e)) | |
| return this.each(function(t) { | |
| jQuery(this).removeClass(e.call(this, t, getClass(this))) | |
| }); | |
| if (!arguments.length) | |
| return this.attr("class", ""); | |
| if (typeof e == "string" && e) { | |
| t = e.match(rnotwhite) || []; | |
| while (n = this[a++]) { | |
| i = getClass(n), | |
| r = n.nodeType === 1 && (" " + i + " ").replace(rclass, " "); | |
| if (r) { | |
| o = 0; | |
| while (s = t[o++]) | |
| while (r.indexOf(" " + s + " ") > -1) | |
| r = r.replace(" " + s + " ", " "); | |
| u = jQuery.trim(r), | |
| i !== u && n.setAttribute("class", u) | |
| } | |
| } | |
| } | |
| return this | |
| }, | |
| toggleClass: function(e, t) { | |
| var n = typeof e; | |
| return typeof t == "boolean" && n === "string" ? t ? this.addClass(e) : this.removeClass(e) : jQuery.isFunction(e) ? this.each(function(n) { | |
| jQuery(this).toggleClass(e.call(this, n, getClass(this), t), t) | |
| }) : this.each(function() { | |
| var t, r, i, s; | |
| if (n === "string") { | |
| r = 0, | |
| i = jQuery(this), | |
| s = e.match(rnotwhite) || []; | |
| while (t = s[r++]) | |
| i.hasClass(t) ? i.removeClass(t) : i.addClass(t) | |
| } else if (e === undefined || n === "boolean") | |
| t = getClass(this), | |
| t && dataPriv.set(this, "__className__", t), | |
| this.setAttribute && this.setAttribute("class", t || e === !1 ? "" : dataPriv.get(this, "__className__") || "") | |
| }) | |
| }, | |
| hasClass: function(e) { | |
| var t, n, r = 0; | |
| t = " " + e + " "; | |
| while (n = this[r++]) | |
| if (n.nodeType === 1 && (" " + getClass(n) + " ").replace(rclass, " ").indexOf(t) > -1) | |
| return !0; | |
| return !1 | |
| } | |
| }); | |
| var rreturn = /\r/g; | |
| jQuery.fn.extend({ | |
| val: function(e) { | |
| var t, n, r, i = this[0]; | |
| if (!arguments.length) { | |
| if (i) | |
| return t = jQuery.valHooks[i.type] || jQuery.valHooks[i.nodeName.toLowerCase()], | |
| t && "get"in t && (n = t.get(i, "value")) !== undefined ? n : (n = i.value, | |
| typeof n == "string" ? n.replace(rreturn, "") : n == null ? "" : n); | |
| return | |
| } | |
| return r = jQuery.isFunction(e), | |
| this.each(function(n) { | |
| var i; | |
| if (this.nodeType !== 1) | |
| return; | |
| r ? i = e.call(this, n, jQuery(this).val()) : i = e, | |
| i == null ? i = "" : typeof i == "number" ? i += "" : jQuery.isArray(i) && (i = jQuery.map(i, function(e) { | |
| return e == null ? "" : e + "" | |
| })), | |
| t = jQuery.valHooks[this.type] || jQuery.valHooks[this.nodeName.toLowerCase()]; | |
| if (!t || !("set"in t) || t.set(this, i, "value") === undefined) | |
| this.value = i | |
| }) | |
| } | |
| }), | |
| jQuery.extend({ | |
| valHooks: { | |
| option: { | |
| get: function(e) { | |
| return jQuery.trim(e.value) | |
| } | |
| }, | |
| select: { | |
| get: function(e) { | |
| var t, n, r = e.options, i = e.selectedIndex, s = e.type === "select-one" || i < 0, o = s ? null : [], u = s ? i + 1 : r.length, a = i < 0 ? u : s ? i : 0; | |
| for (; a < u; a++) { | |
| n = r[a]; | |
| if ((n.selected || a === i) && (support.optDisabled ? !n.disabled : n.getAttribute("disabled") === null) && (!n.parentNode.disabled || !jQuery.nodeName(n.parentNode, "optgroup"))) { | |
| t = jQuery(n).val(); | |
| if (s) | |
| return t; | |
| o.push(t) | |
| } | |
| } | |
| return o | |
| }, | |
| set: function(e, t) { | |
| var n, r, i = e.options, s = jQuery.makeArray(t), o = i.length; | |
| while (o--) { | |
| r = i[o]; | |
| if (r.selected = jQuery.inArray(jQuery.valHooks.option.get(r), s) > -1) | |
| n = !0 | |
| } | |
| return n || (e.selectedIndex = -1), | |
| s | |
| } | |
| } | |
| } | |
| }), | |
| jQuery.each(["radio", "checkbox"], function() { | |
| jQuery.valHooks[this] = { | |
| set: function(e, t) { | |
| if (jQuery.isArray(t)) | |
| return e.checked = jQuery.inArray(jQuery(e).val(), t) > -1 | |
| } | |
| }, | |
| support.checkOn || (jQuery.valHooks[this].get = function(e) { | |
| return e.getAttribute("value") === null ? "on" : e.value | |
| } | |
| ) | |
| }); | |
| var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/; | |
| jQuery.extend(jQuery.event, { | |
| trigger: function(e, t, n, r) { | |
| var i, s, o, u, a, f, l, c = [n || document], h = hasOwn.call(e, "type") ? e.type : e, p = hasOwn.call(e, "namespace") ? e.namespace.split(".") : []; | |
| s = o = n = n || document; | |
| if (n.nodeType === 3 || n.nodeType === 8) | |
| return; | |
| if (rfocusMorph.test(h + jQuery.event.triggered)) | |
| return; | |
| h.indexOf(".") > -1 && (p = h.split("."), | |
| h = p.shift(), | |
| p.sort()), | |
| a = h.indexOf(":") < 0 && "on" + h, | |
| e = e[jQuery.expando] ? e : new jQuery.Event(h,typeof e == "object" && e), | |
| e.isTrigger = r ? 2 : 3, | |
| e.namespace = p.join("."), | |
| e.rnamespace = e.namespace ? new RegExp("(^|\\.)" + p.join("\\.(?:.*\\.|)") + "(\\.|$)") : null, | |
| e.result = undefined, | |
| e.target || (e.target = n), | |
| t = t == null ? [e] : jQuery.makeArray(t, [e]), | |
| l = jQuery.event.special[h] || {}; | |
| if (!r && l.trigger && l.trigger.apply(n, t) === !1) | |
| return; | |
| if (!r && !l.noBubble && !jQuery.isWindow(n)) { | |
| u = l.delegateType || h, | |
| rfocusMorph.test(u + h) || (s = s.parentNode); | |
| for (; s; s = s.parentNode) | |
| c.push(s), | |
| o = s; | |
| o === (n.ownerDocument || document) && c.push(o.defaultView || o.parentWindow || window) | |
| } | |
| i = 0; | |
| while ((s = c[i++]) && !e.isPropagationStopped()) | |
| e.type = i > 1 ? u : l.bindType || h, | |
| f = (dataPriv.get(s, "events") || {})[e.type] && dataPriv.get(s, "handle"), | |
| f && f.apply(s, t), | |
| f = a && s[a], | |
| f && f.apply && acceptData(s) && (e.result = f.apply(s, t), | |
| e.result === !1 && e.preventDefault()); | |
| return e.type = h, | |
| !r && !e.isDefaultPrevented() && (!l._default || l._default.apply(c.pop(), t) === !1) && acceptData(n) && a && jQuery.isFunction(n[h]) && !jQuery.isWindow(n) && (o = n[a], | |
| o && (n[a] = null), | |
| jQuery.event.triggered = h, | |
| n[h](), | |
| jQuery.event.triggered = undefined, | |
| o && (n[a] = o)), | |
| e.result | |
| }, | |
| simulate: function(e, t, n) { | |
| var r = jQuery.extend(new jQuery.Event, n, { | |
| type: e, | |
| isSimulated: !0 | |
| }); | |
| jQuery.event.trigger(r, null, t), | |
| r.isDefaultPrevented() && n.preventDefault() | |
| } | |
| }), | |
| jQuery.fn.extend({ | |
| trigger: function(e, t) { | |
| return this.each(function() { | |
| jQuery.event.trigger(e, t, this) | |
| }) | |
| }, | |
| triggerHandler: function(e, t) { | |
| var n = this[0]; | |
| if (n) | |
| return jQuery.event.trigger(e, t, n, !0) | |
| } | |
| }), | |
| jQuery.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "), function(e, t) { | |
| jQuery.fn[t] = function(e, n) { | |
| return arguments.length > 0 ? this.on(t, null, e, n) : this.trigger(t) | |
| } | |
| }), | |
| jQuery.fn.extend({ | |
| hover: function(e, t) { | |
| return this.mouseenter(e).mouseleave(t || e) | |
| } | |
| }), | |
| support.focusin = "onfocusin"in window, | |
| support.focusin || jQuery.each({ | |
| focus: "focusin", | |
| blur: "focusout" | |
| }, function(e, t) { | |
| var n = function(e) { | |
| jQuery.event.simulate(t, e.target, jQuery.event.fix(e)) | |
| }; | |
| jQuery.event.special[t] = { | |
| setup: function() { | |
| var r = this.ownerDocument || this | |
| , i = dataPriv.access(r, t); | |
| i || r.addEventListener(e, n, !0), | |
| dataPriv.access(r, t, (i || 0) + 1) | |
| }, | |
| teardown: function() { | |
| var r = this.ownerDocument || this | |
| , i = dataPriv.access(r, t) - 1; | |
| i ? dataPriv.access(r, t, i) : (r.removeEventListener(e, n, !0), | |
| dataPriv.remove(r, t)) | |
| } | |
| } | |
| }); | |
| var location = window.location | |
| , nonce = jQuery.now() | |
| , rquery = /\?/; | |
| jQuery.parseJSON = function(e) { | |
| return JSON.parse(e + "") | |
| } | |
| , | |
| jQuery.parseXML = function(e) { | |
| var t; | |
| if (!e || typeof e != "string") | |
| return null; | |
| try { | |
| t = (new window.DOMParser).parseFromString(e, "text/xml") | |
| } catch (n) { | |
| t = undefined | |
| } | |
| return (!t || t.getElementsByTagName("parsererror").length) && jQuery.error("Invalid XML: " + e), | |
| t | |
| } | |
| ; | |
| var rhash = /#.*$/ | |
| , rts = /([?&])_=[^&]*/ | |
| , rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg | |
| , rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/ | |
| , rnoContent = /^(?:GET|HEAD)$/ | |
| , rprotocol = /^\/\// | |
| , prefilters = {} | |
| , transports = {} | |
| , allTypes = "*/".concat("*") | |
| , originAnchor = document.createElement("a"); | |
| originAnchor.href = location.href, | |
| jQuery.extend({ | |
| active: 0, | |
| lastModified: {}, | |
| etag: {}, | |
| ajaxSettings: { | |
| url: location.href, | |
| type: "GET", | |
| isLocal: rlocalProtocol.test(location.protocol), | |
| global: !0, | |
| processData: !0, | |
| async: !0, | |
| contentType: "application/x-www-form-urlencoded; charset=UTF-8", | |
| accepts: { | |
| "*": allTypes, | |
| text: "text/plain", | |
| html: "text/html", | |
| xml: "application/xml, text/xml", | |
| json: "application/json, text/javascript" | |
| }, | |
| contents: { | |
| xml: /\bxml\b/, | |
| html: /\bhtml/, | |
| json: /\bjson\b/ | |
| }, | |
| responseFields: { | |
| xml: "responseXML", | |
| text: "responseText", | |
| json: "responseJSON" | |
| }, | |
| converters: { | |
| "* text": String, | |
| "text html": !0, | |
| "text json": jQuery.parseJSON, | |
| "text xml": jQuery.parseXML | |
| }, | |
| flatOptions: { | |
| url: !0, | |
| context: !0 | |
| } | |
| }, | |
| ajaxSetup: function(e, t) { | |
| return t ? ajaxExtend(ajaxExtend(e, jQuery.ajaxSettings), t) : ajaxExtend(jQuery.ajaxSettings, e) | |
| }, | |
| ajaxPrefilter: addToPrefiltersOrTransports(prefilters), | |
| ajaxTransport: addToPrefiltersOrTransports(transports), | |
| ajax: function(e, t) { | |
| function S(e, t, s, u) { | |
| var f, m, g, b, E, S = t; | |
| if (y === 2) | |
| return; | |
| y = 2, | |
| o && window.clearTimeout(o), | |
| n = undefined, | |
| i = u || "", | |
| w.readyState = e > 0 ? 4 : 0, | |
| f = e >= 200 && e < 300 || e === 304, | |
| s && (b = ajaxHandleResponses(l, w, s)), | |
| b = ajaxConvert(l, b, w, f); | |
| if (f) | |
| l.ifModified && (E = w.getResponseHeader("Last-Modified"), | |
| E && (jQuery.lastModified[r] = E), | |
| E = w.getResponseHeader("etag"), | |
| E && (jQuery.etag[r] = E)), | |
| e === 204 || l.type === "HEAD" ? S = "nocontent" : e === 304 ? S = "notmodified" : (S = b.state, | |
| m = b.data, | |
| g = b.error, | |
| f = !g); | |
| else { | |
| g = S; | |
| if (e || !S) | |
| S = "error", | |
| e < 0 && (e = 0) | |
| } | |
| w.status = e, | |
| w.statusText = (t || S) + "", | |
| f ? p.resolveWith(c, [m, S, w]) : p.rejectWith(c, [w, S, g]), | |
| w.statusCode(v), | |
| v = undefined, | |
| a && h.trigger(f ? "ajaxSuccess" : "ajaxError", [w, l, f ? m : g]), | |
| d.fireWith(c, [w, S]), | |
| a && (h.trigger("ajaxComplete", [w, l]), | |
| --jQuery.active || jQuery.event.trigger("ajaxStop")) | |
| } | |
| typeof e == "object" && (t = e, | |
| e = undefined), | |
| t = t || {}; | |
| var n, r, i, s, o, u, a, f, l = jQuery.ajaxSetup({}, t), c = l.context || l, h = l.context && (c.nodeType || c.jquery) ? jQuery(c) : jQuery.event, p = jQuery.Deferred(), d = jQuery.Callbacks("once memory"), v = l.statusCode || {}, m = {}, g = {}, y = 0, b = "canceled", w = { | |
| readyState: 0, | |
| getResponseHeader: function(e) { | |
| var t; | |
| if (y === 2) { | |
| if (!s) { | |
| s = {}; | |
| while (t = rheaders.exec(i)) | |
| s[t[1].toLowerCase()] = t[2] | |
| } | |
| t = s[e.toLowerCase()] | |
| } | |
| return t == null ? null : t | |
| }, | |
| getAllResponseHeaders: function() { | |
| return y === 2 ? i : null | |
| }, | |
| setRequestHeader: function(e, t) { | |
| var n = e.toLowerCase(); | |
| return y || (e = g[n] = g[n] || e, | |
| m[e] = t), | |
| this | |
| }, | |
| overrideMimeType: function(e) { | |
| return y || (l.mimeType = e), | |
| this | |
| }, | |
| statusCode: function(e) { | |
| var t; | |
| if (e) | |
| if (y < 2) | |
| for (t in e) | |
| v[t] = [v[t], e[t]]; | |
| else | |
| w.always(e[w.status]); | |
| return this | |
| }, | |
| abort: function(e) { | |
| var t = e || b; | |
| return n && n.abort(t), | |
| S(0, t), | |
| this | |
| } | |
| }; | |
| p.promise(w).complete = d.add, | |
| w.success = w.done, | |
| w.error = w.fail, | |
| l.url = ((e || l.url || location.href) + "").replace(rhash, "").replace(rprotocol, location.protocol + "//"), | |
| l.type = t.method || t.type || l.method || l.type, | |
| l.dataTypes = jQuery.trim(l.dataType || "*").toLowerCase().match(rnotwhite) || [""]; | |
| if (l.crossDomain == null) { | |
| u = document.createElement("a"); | |
| try { | |
| u.href = l.url, | |
| u.href = u.href, | |
| l.crossDomain = originAnchor.protocol + "//" + originAnchor.host != u.protocol + "//" + u.host | |
| } catch (E) { | |
| l.crossDomain = !0 | |
| } | |
| } | |
| l.data && l.processData && typeof l.data != "string" && (l.data = jQuery.param(l.data, l.traditional)), | |
| inspectPrefiltersOrTransports(prefilters, l, t, w); | |
| if (y === 2) | |
| return w; | |
| a = jQuery.event && l.global, | |
| a && jQuery.active++ === 0 && jQuery.event.trigger("ajaxStart"), | |
| l.type = l.type.toUpperCase(), | |
| l.hasContent = !rnoContent.test(l.type), | |
| r = l.url, | |
| l.hasContent || (l.data && (r = l.url += (rquery.test(r) ? "&" : "?") + l.data, | |
| delete l.data), | |
| l.cache === !1 && (l.url = rts.test(r) ? r.replace(rts, "$1_=" + nonce++) : r + (rquery.test(r) ? "&" : "?") + "_=" + nonce++)), | |
| l.ifModified && (jQuery.lastModified[r] && w.setRequestHeader("If-Modified-Since", jQuery.lastModified[r]), | |
| jQuery.etag[r] && w.setRequestHeader("If-None-Match", jQuery.etag[r])), | |
| (l.data && l.hasContent && l.contentType !== !1 || t.contentType) && w.setRequestHeader("Content-Type", l.contentType), | |
| w.setRequestHeader("Accept", l.dataTypes[0] && l.accepts[l.dataTypes[0]] ? l.accepts[l.dataTypes[0]] + (l.dataTypes[0] !== "*" ? ", " + allTypes + "; q=0.01" : "") : l.accepts["*"]); | |
| for (f in l.headers) | |
| w.setRequestHeader(f, l.headers[f]); | |
| if (!l.beforeSend || l.beforeSend.call(c, w, l) !== !1 && y !== 2) { | |
| b = "abort"; | |
| for (f in { | |
| success: 1, | |
| error: 1, | |
| complete: 1 | |
| }) | |
| w[f](l[f]); | |
| n = inspectPrefiltersOrTransports(transports, l, t, w); | |
| if (!n) | |
| S(-1, "No Transport"); | |
| else { | |
| w.readyState = 1, | |
| a && h.trigger("ajaxSend", [w, l]); | |
| if (y === 2) | |
| return w; | |
| l.async && l.timeout > 0 && (o = window.setTimeout(function() { | |
| w.abort("timeout") | |
| }, l.timeout)); | |
| try { | |
| y = 1, | |
| n.send(m, S) | |
| } catch (E) { | |
| if (!(y < 2)) | |
| throw E; | |
| S(-1, E) | |
| } | |
| } | |
| return w | |
| } | |
| return w.abort() | |
| }, | |
| getJSON: function(e, t, n) { | |
| return jQuery.get(e, t, n, "json") | |
| }, | |
| getScript: function(e, t) { | |
| return jQuery.get(e, undefined, t, "script") | |
| } | |
| }), | |
| jQuery.each(["get", "post"], function(e, t) { | |
| jQuery[t] = function(e, n, r, i) { | |
| return jQuery.isFunction(n) && (i = i || r, | |
| r = n, | |
| n = undefined), | |
| jQuery.ajax(jQuery.extend({ | |
| url: e, | |
| type: t, | |
| dataType: i, | |
| data: n, | |
| success: r | |
| }, jQuery.isPlainObject(e) && e)) | |
| } | |
| }), | |
| jQuery._evalUrl = function(e) { | |
| return jQuery.ajax({ | |
| url: e, | |
| type: "GET", | |
| dataType: "script", | |
| async: !1, | |
| global: !1, | |
| "throws": !0 | |
| }) | |
| } | |
| , | |
| jQuery.fn.extend({ | |
| wrapAll: function(e) { | |
| var t; | |
| return jQuery.isFunction(e) ? this.each(function(t) { | |
| jQuery(this).wrapAll(e.call(this, t)) | |
| }) : (this[0] && (t = jQuery(e, this[0].ownerDocument).eq(0).clone(!0), | |
| this[0].parentNode && t.insertBefore(this[0]), | |
| t.map(function() { | |
| var e = this; | |
| while (e.firstElementChild) | |
| e = e.firstElementChild; | |
| return e | |
| }).append(this)), | |
| this) | |
| }, | |
| wrapInner: function(e) { | |
| return jQuery.isFunction(e) ? this.each(function(t) { | |
| jQuery(this).wrapInner(e.call(this, t)) | |
| }) : this.each(function() { | |
| var t = jQuery(this) | |
| , n = t.contents(); | |
| n.length ? n.wrapAll(e) : t.append(e) | |
| }) | |
| }, | |
| wrap: function(e) { | |
| var t = jQuery.isFunction(e); | |
| return this.each(function(n) { | |
| jQuery(this).wrapAll(t ? e.call(this, n) : e) | |
| }) | |
| }, | |
| unwrap: function() { | |
| return this.parent().each(function() { | |
| jQuery.nodeName(this, "body") || jQuery(this).replaceWith(this.childNodes) | |
| }).end() | |
| } | |
| }), | |
| jQuery.expr.filters.hidden = function(e) { | |
| return !jQuery.expr.filters.visible(e) | |
| } | |
| , | |
| jQuery.expr.filters.visible = function(e) { | |
| return e.offsetWidth > 0 || e.offsetHeight > 0 || e.getClientRects().length > 0 | |
| } | |
| ; | |
| var r20 = /%20/g | |
| , rbracket = /\[\]$/ | |
| , rCRLF = /\r?\n/g | |
| , rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i | |
| , rsubmittable = /^(?:input|select|textarea|keygen)/i; | |
| jQuery.param = function(e, t) { | |
| var n, r = [], i = function(e, t) { | |
| t = jQuery.isFunction(t) ? t() : t == null ? "" : t, | |
| r[r.length] = encodeURIComponent(e) + "=" + encodeURIComponent(t) | |
| }; | |
| t === undefined && (t = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional); | |
| if (jQuery.isArray(e) || e.jquery && !jQuery.isPlainObject(e)) | |
| jQuery.each(e, function() { | |
| i(this.name, this.value) | |
| }); | |
| else | |
| for (n in e) | |
| buildParams(n, e[n], t, i); | |
| return r.join("&").replace(r20, "+") | |
| } | |
| , | |
| jQuery.fn.extend({ | |
| serialize: function() { | |
| return jQuery.param(this.serializeArray()) | |
| }, | |
| serializeArray: function() { | |
| return this.map(function() { | |
| var e = jQuery.prop(this, "elements"); | |
| return e ? jQuery.makeArray(e) : this | |
| }).filter(function() { | |
| var e = this.type; | |
| return this.name && !jQuery(this).is(":disabled") && rsubmittable.test(this.nodeName) && !rsubmitterTypes.test(e) && (this.checked || !rcheckableType.test(e)) | |
| }).map(function(e, t) { | |
| var n = jQuery(this).val(); | |
| return n == null ? null : jQuery.isArray(n) ? jQuery.map(n, function(e) { | |
| return { | |
| name: t.name, | |
| value: e.replace(rCRLF, "\r\n") | |
| } | |
| }) : { | |
| name: t.name, | |
| value: n.replace(rCRLF, "\r\n") | |
| } | |
| }).get() | |
| } | |
| }), | |
| jQuery.ajaxSettings.xhr = function() { | |
| try { | |
| return new window.XMLHttpRequest | |
| } catch (e) {} | |
| } | |
| ; | |
| var xhrSuccessStatus = { | |
| 0: 200, | |
| 1223: 204 | |
| } | |
| , xhrSupported = jQuery.ajaxSettings.xhr(); | |
| support.cors = !!xhrSupported && "withCredentials"in xhrSupported, | |
| support.ajax = xhrSupported = !!xhrSupported, | |
| jQuery.ajaxTransport(function(e) { | |
| var t, n; | |
| if (support.cors || xhrSupported && !e.crossDomain) | |
| return { | |
| send: function(r, i) { | |
| var s, o = e.xhr(); | |
| o.open(e.type, e.url, e.async, e.username, e.password); | |
| if (e.xhrFields) | |
| for (s in e.xhrFields) | |
| o[s] = e.xhrFields[s]; | |
| e.mimeType && o.overrideMimeType && o.overrideMimeType(e.mimeType), | |
| !e.crossDomain && !r["X-Requested-With"] && (r["X-Requested-With"] = "XMLHttpRequest"); | |
| for (s in r) | |
| o.setRequestHeader(s, r[s]); | |
| t = function(e) { | |
| return function() { | |
| t && (t = n = o.onload = o.onerror = o.onabort = o.onreadystatechange = null, | |
| e === "abort" ? o.abort() : e === "error" ? typeof o.status != "number" ? i(0, "error") : i(o.status, o.statusText) : i(xhrSuccessStatus[o.status] || o.status, o.statusText, (o.responseType || "text") !== "text" || typeof o.responseText != "string" ? { | |
| binary: o.response | |
| } : { | |
| text: o.responseText | |
| }, o.getAllResponseHeaders())) | |
| } | |
| } | |
| , | |
| o.onload = t(), | |
| n = o.onerror = t("error"), | |
| o.onabort !== undefined ? o.onabort = n : o.onreadystatechange = function() { | |
| o.readyState === 4 && window.setTimeout(function() { | |
| t && n() | |
| }) | |
| } | |
| , | |
| t = t("abort"); | |
| try { | |
| o.send(e.hasContent && e.data || null) | |
| } catch (u) { | |
| if (t) | |
| throw u | |
| } | |
| }, | |
| abort: function() { | |
| t && t() | |
| } | |
| } | |
| }), | |
| jQuery.ajaxSetup({ | |
| accepts: { | |
| script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript" | |
| }, | |
| contents: { | |
| script: /\b(?:java|ecma)script\b/ | |
| }, | |
| converters: { | |
| "text script": function(e) { | |
| return jQuery.globalEval(e), | |
| e | |
| } | |
| } | |
| }), | |
| jQuery.ajaxPrefilter("script", function(e) { | |
| e.cache === undefined && (e.cache = !1), | |
| e.crossDomain && (e.type = "GET") | |
| }), | |
| jQuery.ajaxTransport("script", function(e) { | |
| if (e.crossDomain) { | |
| var t, n; | |
| return { | |
| send: function(r, i) { | |
| t = jQuery("<script>").prop({ | |
| charset: e.scriptCharset, | |
| src: e.url | |
| }).on("load error", n = function(e) { | |
| t.remove(), | |
| n = null, | |
| e && i(e.type === "error" ? 404 : 200, e.type) | |
| } | |
| ), | |
| document.head.appendChild(t[0]) | |
| }, | |
| abort: function() { | |
| n && n() | |
| } | |
| } | |
| } | |
| }); | |
| var oldCallbacks = [] | |
| , rjsonp = /(=)\?(?=&|$)|\?\?/; | |
| jQuery.ajaxSetup({ | |
| jsonp: "callback", | |
| jsonpCallback: function() { | |
| var e = oldCallbacks.pop() || jQuery.expando + "_" + nonce++; | |
| return this[e] = !0, | |
| e | |
| } | |
| }), | |
| jQuery.ajaxPrefilter("json jsonp", function(e, t, n) { | |
| var r, i, s, o = e.jsonp !== !1 && (rjsonp.test(e.url) ? "url" : typeof e.data == "string" && (e.contentType || "").indexOf("application/x-www-form-urlencoded") === 0 && rjsonp.test(e.data) && "data"); | |
| if (o || e.dataTypes[0] === "jsonp") | |
| return r = e.jsonpCallback = jQuery.isFunction(e.jsonpCallback) ? e.jsonpCallback() : e.jsonpCallback, | |
| o ? e[o] = e[o].replace(rjsonp, "$1" + r) : e.jsonp !== !1 && (e.url += (rquery.test(e.url) ? "&" : "?") + e.jsonp + "=" + r), | |
| e.converters["script json"] = function() { | |
| return s || jQuery.error(r + " was not called"), | |
| s[0] | |
| } | |
| , | |
| e.dataTypes[0] = "json", | |
| i = window[r], | |
| window[r] = function() { | |
| s = arguments | |
| } | |
| , | |
| n.always(function() { | |
| i === undefined ? jQuery(window).removeProp(r) : window[r] = i, | |
| e[r] && (e.jsonpCallback = t.jsonpCallback, | |
| oldCallbacks.push(r)), | |
| s && jQuery.isFunction(i) && i(s[0]), | |
| s = i = undefined | |
| }), | |
| "script" | |
| }), | |
| support.createHTMLDocument = function() { | |
| var e = document.implementation.createHTMLDocument("").body; | |
| return e.innerHTML = "<form></form><form></form>", | |
| e.childNodes.length === 2 | |
| }(), | |
| jQuery.parseHTML = function(e, t, n) { | |
| if (!e || typeof e != "string") | |
| return null; | |
| typeof t == "boolean" && (n = t, | |
| t = !1), | |
| t = t || (support.createHTMLDocument ? document.implementation.createHTMLDocument("") : document); | |
| var r = rsingleTag.exec(e) | |
| , i = !n && []; | |
| return r ? [t.createElement(r[1])] : (r = buildFragment([e], t, i), | |
| i && i.length && jQuery(i).remove(), | |
| jQuery.merge([], r.childNodes)) | |
| } | |
| ; | |
| var _load = jQuery.fn.load; | |
| jQuery.fn.load = function(e, t, n) { | |
| if (typeof e != "string" && _load) | |
| return _load.apply(this, arguments); | |
| var r, i, s, o = this, u = e.indexOf(" "); | |
| return u > -1 && (r = jQuery.trim(e.slice(u)), | |
| e = e.slice(0, u)), | |
| jQuery.isFunction(t) ? (n = t, | |
| t = undefined) : t && typeof t == "object" && (i = "POST"), | |
| o.length > 0 && jQuery.ajax({ | |
| url: e, | |
| type: i || "GET", | |
| dataType: "html", | |
| data: t | |
| }).done(function(e) { | |
| s = arguments, | |
| o.html(r ? jQuery("<div>").append(jQuery.parseHTML(e)).find(r) : e) | |
| }).always(n && function(e, t) { | |
| o.each(function() { | |
| n.apply(o, s || [e.responseText, t, e]) | |
| }) | |
| } | |
| ), | |
| this | |
| } | |
| , | |
| jQuery.each(["ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend"], function(e, t) { | |
| jQuery.fn[t] = function(e) { | |
| return this.on(t, e) | |
| } | |
| }), | |
| jQuery.expr.filters.animated = function(e) { | |
| return jQuery.grep(jQuery.timers, function(t) { | |
| return e === t.elem | |
| }).length | |
| } | |
| , | |
| jQuery.offset = { | |
| setOffset: function(e, t, n) { | |
| var r, i, s, o, u, a, f, l = jQuery.css(e, "position"), c = jQuery(e), h = {}; | |
| l === "static" && (e.style.position = "relative"), | |
| u = c.offset(), | |
| s = jQuery.css(e, "top"), | |
| a = jQuery.css(e, "left"), | |
| f = (l === "absolute" || l === "fixed") && (s + a).indexOf("auto") > -1, | |
| f ? (r = c.position(), | |
| o = r.top, | |
| i = r.left) : (o = parseFloat(s) || 0, | |
| i = parseFloat(a) || 0), | |
| jQuery.isFunction(t) && (t = t.call(e, n, jQuery.extend({}, u))), | |
| t.top != null && (h.top = t.top - u.top + o), | |
| t.left != null && (h.left = t.left - u.left + i), | |
| "using"in t ? t.using.call(e, h) : c.css(h) | |
| } | |
| }, | |
| jQuery.fn.extend({ | |
| offset: function(e) { | |
| if (arguments.length) | |
| return e === undefined ? this : this.each(function(t) { | |
| jQuery.offset.setOffset(this, e, t) | |
| }); | |
| var t, n, r = this[0], i = { | |
| top: 0, | |
| left: 0 | |
| }, s = r && r.ownerDocument; | |
| if (!s) | |
| return; | |
| return t = s.documentElement, | |
| jQuery.contains(t, r) ? (i = r.getBoundingClientRect(), | |
| n = getWindow(s), | |
| { | |
| top: i.top + n.pageYOffset - t.clientTop, | |
| left: i.left + n.pageXOffset - t.clientLeft | |
| }) : i | |
| }, | |
| position: function() { | |
| if (!this[0]) | |
| return; | |
| var e, t, n = this[0], r = { | |
| top: 0, | |
| left: 0 | |
| }; | |
| return jQuery.css(n, "position") === "fixed" ? t = n.getBoundingClientRect() : (e = this.offsetParent(), | |
| t = this.offset(), | |
| jQuery.nodeName(e[0], "html") || (r = e.offset()), | |
| r.top += jQuery.css(e[0], "borderTopWidth", !0) - e.scrollTop(), | |
| r.left += jQuery.css(e[0], "borderLeftWidth", !0) - e.scrollLeft()), | |
| { | |
| top: t.top - r.top - jQuery.css(n, "marginTop", !0), | |
| left: t.left - r.left - jQuery.css(n, "marginLeft", !0) | |
| } | |
| }, | |
| offsetParent: function() { | |
| return this.map(function() { | |
| var e = this.offsetParent; | |
| while (e && jQuery.css(e, "position") === "static") | |
| e = e.offsetParent; | |
| return e || documentElement | |
| }) | |
| } | |
| }), | |
| jQuery.each({ | |
| scrollLeft: "pageXOffset", | |
| scrollTop: "pageYOffset" | |
| }, function(e, t) { | |
| var n = "pageYOffset" === t; | |
| jQuery.fn[e] = function(r) { | |
| return access(this, function(e, r, i) { | |
| var s = getWindow(e); | |
| if (i === undefined) | |
| return s ? s[t] : e[r]; | |
| s ? s.scrollTo(n ? s.pageXOffset : i, n ? i : s.pageYOffset) : e[r] = i | |
| }, e, r, arguments.length) | |
| } | |
| }), | |
| jQuery.each(["top", "left"], function(e, t) { | |
| jQuery.cssHooks[t] = addGetHookIf(support.pixelPosition, function(e, n) { | |
| if (n) | |
| return n = curCSS(e, t), | |
| rnumnonpx.test(n) ? jQuery(e).position()[t] + "px" : n | |
| }) | |
| }), | |
| jQuery.each({ | |
| Height: "height", | |
| Width: "width" | |
| }, function(e, t) { | |
| jQuery.each({ | |
| padding: "inner" + e, | |
| content: t, | |
| "": "outer" + e | |
| }, function(n, r) { | |
| jQuery.fn[r] = function(r, i) { | |
| var s = arguments.length && (n || typeof r != "boolean") | |
| , o = n || (r === !0 || i === !0 ? "margin" : "border"); | |
| return access(this, function(t, n, r) { | |
| var i; | |
| return jQuery.isWindow(t) ? t.document.documentElement["client" + e] : t.nodeType === 9 ? (i = t.documentElement, | |
| Math.max(t.body["scroll" + e], i["scroll" + e], t.body["offset" + e], i["offset" + e], i["client" + e])) : r === undefined ? jQuery.css(t, n, o) : jQuery.style(t, n, r, o) | |
| }, t, s ? r : undefined, s, null) | |
| } | |
| }) | |
| }), | |
| jQuery.fn.extend({ | |
| bind: function(e, t, n) { | |
| return this.on(e, null, t, n) | |
| }, | |
| unbind: function(e, t) { | |
| return this.off(e, null, t) | |
| }, | |
| delegate: function(e, t, n, r) { | |
| return this.on(t, e, n, r) | |
| }, | |
| undelegate: function(e, t, n) { | |
| return arguments.length === 1 ? this.off(e, "**") : this.off(t, e || "**", n) | |
| }, | |
| size: function() { | |
| return this.length | |
| } | |
| }), | |
| jQuery.fn.andSelf = jQuery.fn.addBack, | |
| typeof define == "function" && define.amd && define("jquery", [], function() { | |
| return jQuery | |
| }); | |
| var _jQuery = window.jQuery | |
| , _$ = window.$; | |
| return jQuery.noConflict = function(e) { | |
| return window.$ === jQuery && (window.$ = _$), | |
| e && window.jQuery === jQuery && (window.jQuery = _jQuery), | |
| jQuery | |
| } | |
| , | |
| noGlobal || (window.jQuery = window.$ = jQuery), | |
| jQuery | |
| }), | |
| function() { | |
| function x(e) { | |
| function t(t, n, r, i, s, o) { | |
| for (; s >= 0 && s < o; s += e) { | |
| var u = i ? i[s] : s; | |
| r = n(r, t[u], u, t) | |
| } | |
| return r | |
| } | |
| return function(n, r, i, s) { | |
| r = v(r, s, 4); | |
| var o = !S(n) && d.keys(n) | |
| , u = (o || n).length | |
| , a = e > 0 ? 0 : u - 1; | |
| return arguments.length < 3 && (i = n[o ? o[a] : a], | |
| a += e), | |
| t(n, r, i, o, a, u) | |
| } | |
| } | |
| function C(e) { | |
| return function(t, n, r) { | |
| n = m(n, r); | |
| var i = E(t) | |
| , s = e > 0 ? 0 : i - 1; | |
| for (; s >= 0 && s < i; s += e) | |
| if (n(t[s], s, t)) | |
| return s; | |
| return -1 | |
| } | |
| } | |
| function k(e, t, n) { | |
| return function(r, i, s) { | |
| var u = 0 | |
| , a = E(r); | |
| if (typeof s == "number") | |
| e > 0 ? u = s >= 0 ? s : Math.max(s + a, u) : a = s >= 0 ? Math.min(s + 1, a) : s + a + 1; | |
| else if (n && s && a) | |
| return s = n(r, i), | |
| r[s] === i ? s : -1; | |
| if (i !== i) | |
| return s = t(o.call(r, u, a), d.isNaN), | |
| s >= 0 ? s + u : -1; | |
| for (s = e > 0 ? u : a - 1; s >= 0 && s < a; s += e) | |
| if (r[s] === i) | |
| return s; | |
| return -1 | |
| } | |
| } | |
| function M(e, t) { | |
| var n = O.length | |
| , i = e.constructor | |
| , s = d.isFunction(i) && i.prototype || r | |
| , o = "constructor"; | |
| d.has(e, o) && !d.contains(t, o) && t.push(o); | |
| while (n--) | |
| o = O[n], | |
| o in e && e[o] !== s[o] && !d.contains(t, o) && t.push(o) | |
| } | |
| var e = this | |
| , t = e._ | |
| , n = Array.prototype | |
| , r = Object.prototype | |
| , i = Function.prototype | |
| , s = n.push | |
| , o = n.slice | |
| , u = r.toString | |
| , a = r.hasOwnProperty | |
| , f = Array.isArray | |
| , l = Object.keys | |
| , c = i.bind | |
| , h = Object.create | |
| , p = function() {} | |
| , d = function(e) { | |
| if (e instanceof d) | |
| return e; | |
| if (!(this instanceof d)) | |
| return new d(e); | |
| this._wrapped = e | |
| }; | |
| typeof exports != "undefined" ? (typeof module != "undefined" && module.exports && (exports = module.exports = d), | |
| exports._ = d) : e._ = d, | |
| d.VERSION = "1.8.3"; | |
| var v = function(e, t, n) { | |
| if (t === void 0) | |
| return e; | |
| switch (n == null ? 3 : n) { | |
| case 1: | |
| return function(n) { | |
| return e.call(t, n) | |
| } | |
| ; | |
| case 2: | |
| return function(n, r) { | |
| return e.call(t, n, r) | |
| } | |
| ; | |
| case 3: | |
| return function(n, r, i) { | |
| return e.call(t, n, r, i) | |
| } | |
| ; | |
| case 4: | |
| return function(n, r, i, s) { | |
| return e.call(t, n, r, i, s) | |
| } | |
| } | |
| return function() { | |
| return e.apply(t, arguments) | |
| } | |
| } | |
| , m = function(e, t, n) { | |
| return e == null ? d.identity : d.isFunction(e) ? v(e, t, n) : d.isObject(e) ? d.matcher(e) : d.property(e) | |
| }; | |
| d.iteratee = function(e, t) { | |
| return m(e, t, Infinity) | |
| } | |
| ; | |
| var g = function(e, t) { | |
| return function(n) { | |
| var r = arguments.length; | |
| if (r < 2 || n == null) | |
| return n; | |
| for (var i = 1; i < r; i++) { | |
| var s = arguments[i] | |
| , o = e(s) | |
| , u = o.length; | |
| for (var a = 0; a < u; a++) { | |
| var f = o[a]; | |
| if (!t || n[f] === void 0) | |
| n[f] = s[f] | |
| } | |
| } | |
| return n | |
| } | |
| } | |
| , y = function(e) { | |
| if (!d.isObject(e)) | |
| return {}; | |
| if (h) | |
| return h(e); | |
| p.prototype = e; | |
| var t = new p; | |
| return p.prototype = null, | |
| t | |
| } | |
| , b = function(e) { | |
| return function(t) { | |
| return t == null ? void 0 : t[e] | |
| } | |
| } | |
| , w = Math.pow(2, 53) - 1 | |
| , E = b("length") | |
| , S = function(e) { | |
| var t = E(e); | |
| return typeof t == "number" && t >= 0 && t <= w | |
| }; | |
| d.each = d.forEach = function(e, t, n) { | |
| t = v(t, n); | |
| var r, i; | |
| if (S(e)) | |
| for (r = 0, | |
| i = e.length; r < i; r++) | |
| t(e[r], r, e); | |
| else { | |
| var s = d.keys(e); | |
| for (r = 0, | |
| i = s.length; r < i; r++) | |
| t(e[s[r]], s[r], e) | |
| } | |
| return e | |
| } | |
| , | |
| d.map = d.collect = function(e, t, n) { | |
| t = m(t, n); | |
| var r = !S(e) && d.keys(e) | |
| , i = (r || e).length | |
| , s = Array(i); | |
| for (var o = 0; o < i; o++) { | |
| var u = r ? r[o] : o; | |
| s[o] = t(e[u], u, e) | |
| } | |
| return s | |
| } | |
| , | |
| d.reduce = d.foldl = d.inject = x(1), | |
| d.reduceRight = d.foldr = x(-1), | |
| d.find = d.detect = function(e, t, n) { | |
| var r; | |
| S(e) ? r = d.findIndex(e, t, n) : r = d.findKey(e, t, n); | |
| if (r !== void 0 && r !== -1) | |
| return e[r] | |
| } | |
| , | |
| d.filter = d.select = function(e, t, n) { | |
| var r = []; | |
| return t = m(t, n), | |
| d.each(e, function(e, n, i) { | |
| t(e, n, i) && r.push(e) | |
| }), | |
| r | |
| } | |
| , | |
| d.reject = function(e, t, n) { | |
| return d.filter(e, d.negate(m(t)), n) | |
| } | |
| , | |
| d.every = d.all = function(e, t, n) { | |
| t = m(t, n); | |
| var r = !S(e) && d.keys(e) | |
| , i = (r || e).length; | |
| for (var s = 0; s < i; s++) { | |
| var o = r ? r[s] : s; | |
| if (!t(e[o], o, e)) | |
| return !1 | |
| } | |
| return !0 | |
| } | |
| , | |
| d.some = d.any = function(e, t, n) { | |
| t = m(t, n); | |
| var r = !S(e) && d.keys(e) | |
| , i = (r || e).length; | |
| for (var s = 0; s < i; s++) { | |
| var o = r ? r[s] : s; | |
| if (t(e[o], o, e)) | |
| return !0 | |
| } | |
| return !1 | |
| } | |
| , | |
| d.contains = d.includes = d.include = function(e, t, n, r) { | |
| S(e) || (e = d.values(e)); | |
| if (typeof n != "number" || r) | |
| n = 0; | |
| return d.indexOf(e, t, n) >= 0 | |
| } | |
| , | |
| d.invoke = function(e, t) { | |
| var n = o.call(arguments, 2) | |
| , r = d.isFunction(t); | |
| return d.map(e, function(e) { | |
| var i = r ? t : e[t]; | |
| return i == null ? i : i.apply(e, n) | |
| }) | |
| } | |
| , | |
| d.pluck = function(e, t) { | |
| return d.map(e, d.property(t)) | |
| } | |
| , | |
| d.where = function(e, t) { | |
| return d.filter(e, d.matcher(t)) | |
| } | |
| , | |
| d.findWhere = function(e, t) { | |
| return d.find(e, d.matcher(t)) | |
| } | |
| , | |
| d.max = function(e, t, n) { | |
| var r = -Infinity, i = -Infinity, s, o; | |
| if (t == null && e != null) { | |
| e = S(e) ? e : d.values(e); | |
| for (var u = 0, a = e.length; u < a; u++) | |
| s = e[u], | |
| s > r && (r = s) | |
| } else | |
| t = m(t, n), | |
| d.each(e, function(e, n, s) { | |
| o = t(e, n, s); | |
| if (o > i || o === -Infinity && r === -Infinity) | |
| r = e, | |
| i = o | |
| }); | |
| return r | |
| } | |
| , | |
| d.min = function(e, t, n) { | |
| var r = Infinity, i = Infinity, s, o; | |
| if (t == null && e != null) { | |
| e = S(e) ? e : d.values(e); | |
| for (var u = 0, a = e.length; u < a; u++) | |
| s = e[u], | |
| s < r && (r = s) | |
| } else | |
| t = m(t, n), | |
| d.each(e, function(e, n, s) { | |
| o = t(e, n, s); | |
| if (o < i || o === Infinity && r === Infinity) | |
| r = e, | |
| i = o | |
| }); | |
| return r | |
| } | |
| , | |
| d.shuffle = function(e) { | |
| var t = S(e) ? e : d.values(e) | |
| , n = t.length | |
| , r = Array(n); | |
| for (var i = 0, s; i < n; i++) | |
| s = d.random(0, i), | |
| s !== i && (r[i] = r[s]), | |
| r[s] = t[i]; | |
| return r | |
| } | |
| , | |
| d.sample = function(e, t, n) { | |
| return t == null || n ? (S(e) || (e = d.values(e)), | |
| e[d.random(e.length - 1)]) : d.shuffle(e).slice(0, Math.max(0, t)) | |
| } | |
| , | |
| d.sortBy = function(e, t, n) { | |
| return t = m(t, n), | |
| d.pluck(d.map(e, function(e, n, r) { | |
| return { | |
| value: e, | |
| index: n, | |
| criteria: t(e, n, r) | |
| } | |
| }).sort(function(e, t) { | |
| var n = e.criteria | |
| , r = t.criteria; | |
| if (n !== r) { | |
| if (n > r || n === void 0) | |
| return 1; | |
| if (n < r || r === void 0) | |
| return -1 | |
| } | |
| return e.index - t.index | |
| }), "value") | |
| } | |
| ; | |
| var T = function(e) { | |
| return function(t, n, r) { | |
| var i = {}; | |
| return n = m(n, r), | |
| d.each(t, function(r, s) { | |
| var o = n(r, s, t); | |
| e(i, r, o) | |
| }), | |
| i | |
| } | |
| }; | |
| d.groupBy = T(function(e, t, n) { | |
| d.has(e, n) ? e[n].push(t) : e[n] = [t] | |
| }), | |
| d.indexBy = T(function(e, t, n) { | |
| e[n] = t | |
| }), | |
| d.countBy = T(function(e, t, n) { | |
| d.has(e, n) ? e[n]++ : e[n] = 1 | |
| }), | |
| d.toArray = function(e) { | |
| return e ? d.isArray(e) ? o.call(e) : S(e) ? d.map(e, d.identity) : d.values(e) : [] | |
| } | |
| , | |
| d.size = function(e) { | |
| return e == null ? 0 : S(e) ? e.length : d.keys(e).length | |
| } | |
| , | |
| d.partition = function(e, t, n) { | |
| t = m(t, n); | |
| var r = [] | |
| , i = []; | |
| return d.each(e, function(e, n, s) { | |
| (t(e, n, s) ? r : i).push(e) | |
| }), | |
| [r, i] | |
| } | |
| , | |
| d.first = d.head = d.take = function(e, t, n) { | |
| return e == null ? void 0 : t == null || n ? e[0] : d.initial(e, e.length - t) | |
| } | |
| , | |
| d.initial = function(e, t, n) { | |
| return o.call(e, 0, Math.max(0, e.length - (t == null || n ? 1 : t))) | |
| } | |
| , | |
| d.last = function(e, t, n) { | |
| return e == null ? void 0 : t == null || n ? e[e.length - 1] : d.rest(e, Math.max(0, e.length - t)) | |
| } | |
| , | |
| d.rest = d.tail = d.drop = function(e, t, n) { | |
| return o.call(e, t == null || n ? 1 : t) | |
| } | |
| , | |
| d.compact = function(e) { | |
| return d.filter(e, d.identity) | |
| } | |
| ; | |
| var N = function(e, t, n, r) { | |
| var i = [] | |
| , s = 0; | |
| for (var o = r || 0, u = E(e); o < u; o++) { | |
| var a = e[o]; | |
| if (S(a) && (d.isArray(a) || d.isArguments(a))) { | |
| t || (a = N(a, t, n)); | |
| var f = 0 | |
| , l = a.length; | |
| i.length += l; | |
| while (f < l) | |
| i[s++] = a[f++] | |
| } else | |
| n || (i[s++] = a) | |
| } | |
| return i | |
| }; | |
| d.flatten = function(e, t) { | |
| return N(e, t, !1) | |
| } | |
| , | |
| d.without = function(e) { | |
| return d.difference(e, o.call(arguments, 1)) | |
| } | |
| , | |
| d.uniq = d.unique = function(e, t, n, r) { | |
| d.isBoolean(t) || (r = n, | |
| n = t, | |
| t = !1), | |
| n != null && (n = m(n, r)); | |
| var i = [] | |
| , s = []; | |
| for (var o = 0, u = E(e); o < u; o++) { | |
| var a = e[o] | |
| , f = n ? n(a, o, e) : a; | |
| t ? ((!o || s !== f) && i.push(a), | |
| s = f) : n ? d.contains(s, f) || (s.push(f), | |
| i.push(a)) : d.contains(i, a) || i.push(a) | |
| } | |
| return i | |
| } | |
| , | |
| d.union = function() { | |
| return d.uniq(N(arguments, !0, !0)) | |
| } | |
| , | |
| d.intersection = function(e) { | |
| var t = [] | |
| , n = arguments.length; | |
| for (var r = 0, i = E(e); r < i; r++) { | |
| var s = e[r]; | |
| if (d.contains(t, s)) | |
| continue; | |
| for (var o = 1; o < n; o++) | |
| if (!d.contains(arguments[o], s)) | |
| break; | |
| o === n && t.push(s) | |
| } | |
| return t | |
| } | |
| , | |
| d.difference = function(e) { | |
| var t = N(arguments, !0, !0, 1); | |
| return d.filter(e, function(e) { | |
| return !d.contains(t, e) | |
| }) | |
| } | |
| , | |
| d.zip = function() { | |
| return d.unzip(arguments) | |
| } | |
| , | |
| d.unzip = function(e) { | |
| var t = e && d.max(e, E).length || 0 | |
| , n = Array(t); | |
| for (var r = 0; r < t; r++) | |
| n[r] = d.pluck(e, r); | |
| return n | |
| } | |
| , | |
| d.object = function(e, t) { | |
| var n = {}; | |
| for (var r = 0, i = E(e); r < i; r++) | |
| t ? n[e[r]] = t[r] : n[e[r][0]] = e[r][1]; | |
| return n | |
| } | |
| , | |
| d.findIndex = C(1), | |
| d.findLastIndex = C(-1), | |
| d.sortedIndex = function(e, t, n, r) { | |
| n = m(n, r, 1); | |
| var i = n(t) | |
| , s = 0 | |
| , o = E(e); | |
| while (s < o) { | |
| var u = Math.floor((s + o) / 2); | |
| n(e[u]) < i ? s = u + 1 : o = u | |
| } | |
| return s | |
| } | |
| , | |
| d.indexOf = k(1, d.findIndex, d.sortedIndex), | |
| d.lastIndexOf = k(-1, d.findLastIndex), | |
| d.range = function(e, t, n) { | |
| t == null && (t = e || 0, | |
| e = 0), | |
| n = n || 1; | |
| var r = Math.max(Math.ceil((t - e) / n), 0) | |
| , i = Array(r); | |
| for (var s = 0; s < r; s++, | |
| e += n) | |
| i[s] = e; | |
| return i | |
| } | |
| ; | |
| var L = function(e, t, n, r, i) { | |
| if (r instanceof t) { | |
| var s = y(e.prototype) | |
| , o = e.apply(s, i); | |
| return d.isObject(o) ? o : s | |
| } | |
| return e.apply(n, i) | |
| }; | |
| d.bind = function(e, t) { | |
| if (c && e.bind === c) | |
| return c.apply(e, o.call(arguments, 1)); | |
| if (!d.isFunction(e)) | |
| throw new TypeError("Bind must be called on a function"); | |
| var n = o.call(arguments, 2) | |
| , r = function() { | |
| return L(e, r, t, this, n.concat(o.call(arguments))) | |
| }; | |
| return r | |
| } | |
| , | |
| d.partial = function(e) { | |
| var t = o.call(arguments, 1) | |
| , n = function() { | |
| var r = 0 | |
| , i = t.length | |
| , s = Array(i); | |
| for (var o = 0; o < i; o++) | |
| s[o] = t[o] === d ? arguments[r++] : t[o]; | |
| while (r < arguments.length) | |
| s.push(arguments[r++]); | |
| return L(e, n, this, this, s) | |
| }; | |
| return n | |
| } | |
| , | |
| d.bindAll = function(e) { | |
| var t, n = arguments.length, r; | |
| if (n <= 1) | |
| throw new Error("bindAll must be passed function names"); | |
| for (t = 1; t < n; t++) | |
| r = arguments[t], | |
| e[r] = d.bind(e[r], e); | |
| return e | |
| } | |
| , | |
| d.memoize = function(e, t) { | |
| var n = function(r) { | |
| var i = n.cache | |
| , s = "" + (t ? t.apply(this, arguments) : r); | |
| return d.has(i, s) || (i[s] = e.apply(this, arguments)), | |
| i[s] | |
| }; | |
| return n.cache = {}, | |
| n | |
| } | |
| , | |
| d.delay = function(e, t) { | |
| var n = o.call(arguments, 2); | |
| return setTimeout(function() { | |
| return e.apply(null, n) | |
| }, t) | |
| } | |
| , | |
| d.defer = d.partial(d.delay, d, 1), | |
| d.throttle = function(e, t, n) { | |
| var r, i, s, o = null, u = 0; | |
| n || (n = {}); | |
| var a = function() { | |
| u = n.leading === !1 ? 0 : d.now(), | |
| o = null, | |
| s = e.apply(r, i), | |
| o || (r = i = null) | |
| }; | |
| return function() { | |
| var f = d.now(); | |
| !u && n.leading === !1 && (u = f); | |
| var l = t - (f - u); | |
| return r = this, | |
| i = arguments, | |
| l <= 0 || l > t ? (o && (clearTimeout(o), | |
| o = null), | |
| u = f, | |
| s = e.apply(r, i), | |
| o || (r = i = null)) : !o && n.trailing !== !1 && (o = setTimeout(a, l)), | |
| s | |
| } | |
| } | |
| , | |
| d.debounce = function(e, t, n) { | |
| var r, i, s, o, u, a = function() { | |
| var f = d.now() - o; | |
| f < t && f >= 0 ? r = setTimeout(a, t - f) : (r = null, | |
| n || (u = e.apply(s, i), | |
| r || (s = i = null))) | |
| }; | |
| return function() { | |
| s = this, | |
| i = arguments, | |
| o = d.now(); | |
| var f = n && !r; | |
| return r || (r = setTimeout(a, t)), | |
| f && (u = e.apply(s, i), | |
| s = i = null), | |
| u | |
| } | |
| } | |
| , | |
| d.wrap = function(e, t) { | |
| return d.partial(t, e) | |
| } | |
| , | |
| d.negate = function(e) { | |
| return function() { | |
| return !e.apply(this, arguments) | |
| } | |
| } | |
| , | |
| d.compose = function() { | |
| var e = arguments | |
| , t = e.length - 1; | |
| return function() { | |
| var n = t | |
| , r = e[t].apply(this, arguments); | |
| while (n--) | |
| r = e[n].call(this, r); | |
| return r | |
| } | |
| } | |
| , | |
| d.after = function(e, t) { | |
| return function() { | |
| if (--e < 1) | |
| return t.apply(this, arguments) | |
| } | |
| } | |
| , | |
| d.before = function(e, t) { | |
| var n; | |
| return function() { | |
| return --e > 0 && (n = t.apply(this, arguments)), | |
| e <= 1 && (t = null), | |
| n | |
| } | |
| } | |
| , | |
| d.once = d.partial(d.before, 2); | |
| var A = !{ | |
| toString: null | |
| }.propertyIsEnumerable("toString") | |
| , O = ["valueOf", "isPrototypeOf", "toString", "propertyIsEnumerable", "hasOwnProperty", "toLocaleString"]; | |
| d.keys = function(e) { | |
| if (!d.isObject(e)) | |
| return []; | |
| if (l) | |
| return l(e); | |
| var t = []; | |
| for (var n in e) | |
| d.has(e, n) && t.push(n); | |
| return A && M(e, t), | |
| t | |
| } | |
| , | |
| d.allKeys = function(e) { | |
| if (!d.isObject(e)) | |
| return []; | |
| var t = []; | |
| for (var n in e) | |
| t.push(n); | |
| return A && M(e, t), | |
| t | |
| } | |
| , | |
| d.values = function(e) { | |
| var t = d.keys(e) | |
| , n = t.length | |
| , r = Array(n); | |
| for (var i = 0; i < n; i++) | |
| r[i] = e[t[i]]; | |
| return r | |
| } | |
| , | |
| d.mapObject = function(e, t, n) { | |
| t = m(t, n); | |
| var r = d.keys(e), i = r.length, s = {}, o; | |
| for (var u = 0; u < i; u++) | |
| o = r[u], | |
| s[o] = t(e[o], o, e); | |
| return s | |
| } | |
| , | |
| d.pairs = function(e) { | |
| var t = d.keys(e) | |
| , n = t.length | |
| , r = Array(n); | |
| for (var i = 0; i < n; i++) | |
| r[i] = [t[i], e[t[i]]]; | |
| return r | |
| } | |
| , | |
| d.invert = function(e) { | |
| var t = {} | |
| , n = d.keys(e); | |
| for (var r = 0, i = n.length; r < i; r++) | |
| t[e[n[r]]] = n[r]; | |
| return t | |
| } | |
| , | |
| d.functions = d.methods = function(e) { | |
| var t = []; | |
| for (var n in e) | |
| d.isFunction(e[n]) && t.push(n); | |
| return t.sort() | |
| } | |
| , | |
| d.extend = g(d.allKeys), | |
| d.extendOwn = d.assign = g(d.keys), | |
| d.findKey = function(e, t, n) { | |
| t = m(t, n); | |
| var r = d.keys(e), i; | |
| for (var s = 0, o = r.length; s < o; s++) { | |
| i = r[s]; | |
| if (t(e[i], i, e)) | |
| return i | |
| } | |
| } | |
| , | |
| d.pick = function(e, t, n) { | |
| var r = {}, i = e, s, o; | |
| if (i == null) | |
| return r; | |
| d.isFunction(t) ? (o = d.allKeys(i), | |
| s = v(t, n)) : (o = N(arguments, !1, !1, 1), | |
| s = function(e, t, n) { | |
| return t in n | |
| } | |
| , | |
| i = Object(i)); | |
| for (var u = 0, a = o.length; u < a; u++) { | |
| var f = o[u] | |
| , l = i[f]; | |
| s(l, f, i) && (r[f] = l) | |
| } | |
| return r | |
| } | |
| , | |
| d.omit = function(e, t, n) { | |
| if (d.isFunction(t)) | |
| t = d.negate(t); | |
| else { | |
| var r = d.map(N(arguments, !1, !1, 1), String); | |
| t = function(e, t) { | |
| return !d.contains(r, t) | |
| } | |
| } | |
| return d.pick(e, t, n) | |
| } | |
| , | |
| d.defaults = g(d.allKeys, !0), | |
| d.create = function(e, t) { | |
| var n = y(e); | |
| return t && d.extendOwn(n, t), | |
| n | |
| } | |
| , | |
| d.clone = function(e) { | |
| return d.isObject(e) ? d.isArray(e) ? e.slice() : d.extend({}, e) : e | |
| } | |
| , | |
| d.tap = function(e, t) { | |
| return t(e), | |
| e | |
| } | |
| , | |
| d.isMatch = function(e, t) { | |
| var n = d.keys(t) | |
| , r = n.length; | |
| if (e == null) | |
| return !r; | |
| var i = Object(e); | |
| for (var s = 0; s < r; s++) { | |
| var o = n[s]; | |
| if (t[o] !== i[o] || !(o in i)) | |
| return !1 | |
| } | |
| return !0 | |
| } | |
| ; | |
| var _ = function(e, t, n, r) { | |
| if (e === t) | |
| return e !== 0 || 1 / e === 1 / t; | |
| if (e == null || t == null) | |
| return e === t; | |
| e instanceof d && (e = e._wrapped), | |
| t instanceof d && (t = t._wrapped); | |
| var i = u.call(e); | |
| if (i !== u.call(t)) | |
| return !1; | |
| switch (i) { | |
| case "[object RegExp]": | |
| case "[object String]": | |
| return "" + e == "" + t; | |
| case "[object Number]": | |
| if (+e !== +e) | |
| return +t !== +t; | |
| return +e === 0 ? 1 / +e === 1 / t : +e === +t; | |
| case "[object Date]": | |
| case "[object Boolean]": | |
| return +e === +t | |
| } | |
| var s = i === "[object Array]"; | |
| if (!s) { | |
| if (typeof e != "object" || typeof t != "object") | |
| return !1; | |
| var o = e.constructor | |
| , a = t.constructor; | |
| if (o !== a && !(d.isFunction(o) && o instanceof o && d.isFunction(a) && a instanceof a) && "constructor"in e && "constructor"in t) | |
| return !1 | |
| } | |
| n = n || [], | |
| r = r || []; | |
| var f = n.length; | |
| while (f--) | |
| if (n[f] === e) | |
| return r[f] === t; | |
| n.push(e), | |
| r.push(t); | |
| if (s) { | |
| f = e.length; | |
| if (f !== t.length) | |
| return !1; | |
| while (f--) | |
| if (!_(e[f], t[f], n, r)) | |
| return !1 | |
| } else { | |
| var l = d.keys(e), c; | |
| f = l.length; | |
| if (d.keys(t).length !== f) | |
| return !1; | |
| while (f--) { | |
| c = l[f]; | |
| if (!d.has(t, c) || !_(e[c], t[c], n, r)) | |
| return !1 | |
| } | |
| } | |
| return n.pop(), | |
| r.pop(), | |
| !0 | |
| }; | |
| d.isEqual = function(e, t) { | |
| return _(e, t) | |
| } | |
| , | |
| d.isEmpty = function(e) { | |
| return e == null ? !0 : S(e) && (d.isArray(e) || d.isString(e) || d.isArguments(e)) ? e.length === 0 : d.keys(e).length === 0 | |
| } | |
| , | |
| d.isElement = function(e) { | |
| return !!e && e.nodeType === 1 | |
| } | |
| , | |
| d.isArray = f || function(e) { | |
| return u.call(e) === "[object Array]" | |
| } | |
| , | |
| d.isObject = function(e) { | |
| var t = typeof e; | |
| return t === "function" || t === "object" && !!e | |
| } | |
| , | |
| d.each(["Arguments", "Function", "String", "Number", "Date", "RegExp", "Error"], function(e) { | |
| d["is" + e] = function(t) { | |
| return u.call(t) === "[object " + e + "]" | |
| } | |
| }), | |
| d.isArguments(arguments) || (d.isArguments = function(e) { | |
| return d.has(e, "callee") | |
| } | |
| ), | |
| typeof /./ != "function" && typeof Int8Array != "object" && (d.isFunction = function(e) { | |
| return typeof e == "function" || !1 | |
| } | |
| ), | |
| d.isFinite = function(e) { | |
| return isFinite(e) && !isNaN(parseFloat(e)) | |
| } | |
| , | |
| d.isNaN = function(e) { | |
| return d.isNumber(e) && e !== +e | |
| } | |
| , | |
| d.isBoolean = function(e) { | |
| return e === !0 || e === !1 || u.call(e) === "[object Boolean]" | |
| } | |
| , | |
| d.isNull = function(e) { | |
| return e === null | |
| } | |
| , | |
| d.isUndefined = function(e) { | |
| return e === void 0 | |
| } | |
| , | |
| d.has = function(e, t) { | |
| return e != null && a.call(e, t) | |
| } | |
| , | |
| d.noConflict = function() { | |
| return e._ = t, | |
| this | |
| } | |
| , | |
| d.identity = function(e) { | |
| return e | |
| } | |
| , | |
| d.constant = function(e) { | |
| return function() { | |
| return e | |
| } | |
| } | |
| , | |
| d.noop = function() {} | |
| , | |
| d.property = b, | |
| d.propertyOf = function(e) { | |
| return e == null ? function() {} | |
| : function(t) { | |
| return e[t] | |
| } | |
| } | |
| , | |
| d.matcher = d.matches = function(e) { | |
| return e = d.extendOwn({}, e), | |
| function(t) { | |
| return d.isMatch(t, e) | |
| } | |
| } | |
| , | |
| d.times = function(e, t, n) { | |
| var r = Array(Math.max(0, e)); | |
| t = v(t, n, 1); | |
| for (var i = 0; i < e; i++) | |
| r[i] = t(i); | |
| return r | |
| } | |
| , | |
| d.random = function(e, t) { | |
| return t == null && (t = e, | |
| e = 0), | |
| e + Math.floor(Math.random() * (t - e + 1)) | |
| } | |
| , | |
| d.now = Date.now || function() { | |
| return (new Date).getTime() | |
| } | |
| ; | |
| var D = { | |
| "&": "&", | |
| "<": "<", | |
| ">": ">", | |
| '"': """, | |
| "'": "'", | |
| "`": "`" | |
| } | |
| , P = d.invert(D) | |
| , H = function(e) { | |
| var t = function(t) { | |
| return e[t] | |
| } | |
| , n = "(?:" + d.keys(e).join("|") + ")" | |
| , r = RegExp(n) | |
| , i = RegExp(n, "g"); | |
| return function(e) { | |
| return e = e == null ? "" : "" + e, | |
| r.test(e) ? e.replace(i, t) : e | |
| } | |
| }; | |
| d.escape = H(D), | |
| d.unescape = H(P), | |
| d.result = function(e, t, n) { | |
| var r = e == null ? void 0 : e[t]; | |
| return r === void 0 && (r = n), | |
| d.isFunction(r) ? r.call(e) : r | |
| } | |
| ; | |
| var B = 0; | |
| d.uniqueId = function(e) { | |
| var t = ++B + ""; | |
| return e ? e + t : t | |
| } | |
| , | |
| d.templateSettings = { | |
| evaluate: /<%([\s\S]+?)%>/g, | |
| interpolate: /<%=([\s\S]+?)%>/g, | |
| escape: /<%-([\s\S]+?)%>/g | |
| }; | |
| var j = /(.)^/ | |
| , F = { | |
| "'": "'", | |
| "\\": "\\", | |
| "\r": "r", | |
| "\n": "n", | |
| "\u2028": "u2028", | |
| "\u2029": "u2029" | |
| } | |
| , I = /\\|'|\r|\n|\u2028|\u2029/g | |
| , q = function(e) { | |
| return "\\" + F[e] | |
| }; | |
| d.template = function(e, t, n) { | |
| !t && n && (t = n), | |
| t = d.defaults({}, t, d.templateSettings); | |
| var r = RegExp([(t.escape || j).source, (t.interpolate || j).source, (t.evaluate || j).source].join("|") + "|$", "g") | |
| , i = 0 | |
| , s = "__p+='"; | |
| e.replace(r, function(t, n, r, o, u) { | |
| return s += e.slice(i, u).replace(I, q), | |
| i = u + t.length, | |
| n ? s += "'+\n((__t=(" + n + "))==null?'':_.escape(__t))+\n'" : r ? s += "'+\n((__t=(" + r + "))==null?'':__t)+\n'" : o && (s += "';\n" + o + "\n__p+='"), | |
| t | |
| }), | |
| s += "';\n", | |
| t.variable || (s = "with(obj||{}){\n" + s + "}\n"), | |
| s = "var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n" + s + "return __p;\n"; | |
| try { | |
| var o = new Function(t.variable || "obj","_",s) | |
| } catch (u) { | |
| throw u.source = s, | |
| u | |
| } | |
| var a = function(e) { | |
| return o.call(this, e, d) | |
| } | |
| , f = t.variable || "obj"; | |
| return a.source = "function(" + f + "){\n" + s + "}", | |
| a | |
| } | |
| , | |
| d.chain = function(e) { | |
| var t = d(e); | |
| return t._chain = !0, | |
| t | |
| } | |
| ; | |
| var R = function(e, t) { | |
| return e._chain ? d(t).chain() : t | |
| }; | |
| d.mixin = function(e) { | |
| d.each(d.functions(e), function(t) { | |
| var n = d[t] = e[t]; | |
| d.prototype[t] = function() { | |
| var e = [this._wrapped]; | |
| return s.apply(e, arguments), | |
| R(this, n.apply(d, e)) | |
| } | |
| }) | |
| } | |
| , | |
| d.mixin(d), | |
| d.each(["pop", "push", "reverse", "shift", "sort", "splice", "unshift"], function(e) { | |
| var t = n[e]; | |
| d.prototype[e] = function() { | |
| var n = this._wrapped; | |
| return t.apply(n, arguments), | |
| (e === "shift" || e === "splice") && n.length === 0 && delete n[0], | |
| R(this, n) | |
| } | |
| }), | |
| d.each(["concat", "join", "slice"], function(e) { | |
| var t = n[e]; | |
| d.prototype[e] = function() { | |
| return R(this, t.apply(this._wrapped, arguments)) | |
| } | |
| }), | |
| d.prototype.value = function() { | |
| return this._wrapped | |
| } | |
| , | |
| d.prototype.valueOf = d.prototype.toJSON = d.prototype.value, | |
| d.prototype.toString = function() { | |
| return "" + this._wrapped | |
| } | |
| , | |
| typeof define == "function" && define.amd && define("underscore", [], function() { | |
| return d | |
| }) | |
| } | |
| .call(this), | |
| define("underscore.mixin", ["underscore"], function(e) { | |
| "use strict"; | |
| var t = { | |
| abbreviate: function(t, n, r) { | |
| r = r || "..."; | |
| if (!t) | |
| return r; | |
| if (t.length > n) { | |
| var i = "[" + r + "]" | |
| , s = i.length | |
| , o = (n - s) / 2 | |
| , u = n - s - o; | |
| t = t.substring(0, o) + i + t.slice(-u) | |
| } | |
| return e.escape(t) | |
| }, | |
| extendEvents: function(t, n) { | |
| return t = e.isFunction(t) ? t() : t, | |
| function() { | |
| if (!n || !n.prototype || !e.keys(e.result(n.prototype, "events")).length) | |
| return t; | |
| var r = e.result(n.prototype, "events") | |
| , i = e.extend(e.clone(r), t) | |
| , s = e.intersection(e.keys(r), e.keys(t)); | |
| return e.each(s, function(s) { | |
| i[s] = function(i) { | |
| e.extend(i, { | |
| isDelegationStopped: e.constant(!1), | |
| stopDelegation: function() { | |
| this.isDelegationStopped = e.constant(!0) | |
| } | |
| }); | |
| var o = s; | |
| o = e.isFunction(o) ? o : t[s], | |
| o = e.isFunction(o) ? o : this[t[s]]; | |
| var u = o.apply(this, arguments); | |
| if (!e.result(i, "isDelegationStopped")) { | |
| var a = r[s] | |
| , f = a; | |
| f = e.isFunction(f) ? f : n.prototype[a], | |
| u = f.apply(this, arguments) | |
| } | |
| return u | |
| } | |
| }), | |
| i | |
| } | |
| } | |
| }; | |
| return e.mixin(t), | |
| e | |
| }), | |
| function(e, t) { | |
| if (typeof define == "function" && define.amd) | |
| define("backbone", ["underscore", "jquery", "exports"], function(n, r, i) { | |
| e.Backbone = t(e, i, n, r) | |
| }); | |
| else if (typeof exports != "undefined") { | |
| var n = require("underscore"); | |
| t(e, exports, n) | |
| } else | |
| e.Backbone = t(e, {}, e._, e.jQuery || e.Zepto || e.ender || e.$) | |
| }(this, function(e, t, n, r) { | |
| var i = e.Backbone | |
| , s = [] | |
| , o = s.push | |
| , u = s.slice | |
| , a = s.splice; | |
| t.VERSION = "1.1.2", | |
| t.$ = r, | |
| t.noConflict = function() { | |
| return e.Backbone = i, | |
| this | |
| } | |
| , | |
| t.emulateHTTP = !1, | |
| t.emulateJSON = !1; | |
| var f = t.Events = { | |
| on: function(e, t, n) { | |
| if (!c(this, "on", e, [t, n]) || !t) | |
| return this; | |
| this._events || (this._events = {}); | |
| var r = this._events[e] || (this._events[e] = []); | |
| return r.push({ | |
| callback: t, | |
| context: n, | |
| ctx: n || this | |
| }), | |
| this | |
| }, | |
| once: function(e, t, r) { | |
| if (!c(this, "once", e, [t, r]) || !t) | |
| return this; | |
| var i = this | |
| , s = n.once(function() { | |
| i.off(e, s), | |
| t.apply(this, arguments) | |
| }); | |
| return s._callback = t, | |
| this.on(e, s, r) | |
| }, | |
| off: function(e, t, r) { | |
| var i, s, o, u, a, f, l, h; | |
| if (!this._events || !c(this, "off", e, [t, r])) | |
| return this; | |
| if (!e && !t && !r) | |
| return this._events = void 0, | |
| this; | |
| u = e ? [e] : n.keys(this._events); | |
| for (a = 0, | |
| f = u.length; a < f; a++) { | |
| e = u[a]; | |
| if (o = this._events[e]) { | |
| this._events[e] = i = []; | |
| if (t || r) | |
| for (l = 0, | |
| h = o.length; l < h; l++) | |
| s = o[l], | |
| (t && t !== s.callback && t !== s.callback._callback || r && r !== s.context) && i.push(s); | |
| i.length || delete this._events[e] | |
| } | |
| } | |
| return this | |
| }, | |
| trigger: function(e) { | |
| if (!this._events) | |
| return this; | |
| var t = u.call(arguments, 1); | |
| if (!c(this, "trigger", e, t)) | |
| return this; | |
| var n = this._events[e] | |
| , r = this._events.all; | |
| return n && h(n, t), | |
| r && h(r, arguments), | |
| this | |
| }, | |
| stopListening: function(e, t, r) { | |
| var i = this._listeningTo; | |
| if (!i) | |
| return this; | |
| var s = !t && !r; | |
| !r && typeof t == "object" && (r = this), | |
| e && ((i = {})[e._listenId] = e); | |
| for (var o in i) | |
| e = i[o], | |
| e.off(t, r, this), | |
| (s || n.isEmpty(e._events)) && delete this._listeningTo[o]; | |
| return this | |
| } | |
| } | |
| , l = /\s+/ | |
| , c = function(e, t, n, r) { | |
| if (!n) | |
| return !0; | |
| if (typeof n == "object") { | |
| for (var i in n) | |
| e[t].apply(e, [i, n[i]].concat(r)); | |
| return !1 | |
| } | |
| if (l.test(n)) { | |
| var s = n.split(l); | |
| for (var o = 0, u = s.length; o < u; o++) | |
| e[t].apply(e, [s[o]].concat(r)); | |
| return !1 | |
| } | |
| return !0 | |
| } | |
| , h = function(e, t) { | |
| var n, r = -1, i = e.length, s = t[0], o = t[1], u = t[2]; | |
| switch (t.length) { | |
| case 0: | |
| while (++r < i) | |
| (n = e[r]).callback.call(n.ctx); | |
| return; | |
| case 1: | |
| while (++r < i) | |
| (n = e[r]).callback.call(n.ctx, s); | |
| return; | |
| case 2: | |
| while (++r < i) | |
| (n = e[r]).callback.call(n.ctx, s, o); | |
| return; | |
| case 3: | |
| while (++r < i) | |
| (n = e[r]).callback.call(n.ctx, s, o, u); | |
| return; | |
| default: | |
| while (++r < i) | |
| (n = e[r]).callback.apply(n.ctx, t); | |
| return | |
| } | |
| } | |
| , p = { | |
| listenTo: "on", | |
| listenToOnce: "once" | |
| }; | |
| n.each(p, function(e, t) { | |
| f[t] = function(t, r, i) { | |
| var s = this._listeningTo || (this._listeningTo = {}) | |
| , o = t._listenId || (t._listenId = n.uniqueId("l")); | |
| return s[o] = t, | |
| !i && typeof r == "object" && (i = this), | |
| t[e](r, i, this), | |
| this | |
| } | |
| }), | |
| f.bind = f.on, | |
| f.unbind = f.off, | |
| n.extend(t, f); | |
| var d = t.Model = function(e, t) { | |
| var r = e || {}; | |
| t || (t = {}), | |
| this.cid = n.uniqueId("c"), | |
| this.attributes = {}, | |
| t.collection && (this.collection = t.collection), | |
| t.parse && (r = this.parse(r, t) || {}), | |
| r = n.defaults({}, r, n.result(this, "defaults")), | |
| this.set(r, t), | |
| this.changed = {}, | |
| this.initialize.apply(this, arguments) | |
| } | |
| ; | |
| n.extend(d.prototype, f, { | |
| changed: null, | |
| validationError: null, | |
| idAttribute: "id", | |
| initialize: function() {}, | |
| toJSON: function(e) { | |
| return n.clone(this.attributes) | |
| }, | |
| sync: function() { | |
| return t.sync.apply(this, arguments) | |
| }, | |
| get: function(e) { | |
| return this.attributes[e] | |
| }, | |
| escape: function(e) { | |
| return n.escape(this.get(e)) | |
| }, | |
| has: function(e) { | |
| return this.get(e) != null | |
| }, | |
| set: function(e, t, r) { | |
| var i, s, o, u, a, f, l, c; | |
| if (e == null) | |
| return this; | |
| typeof e == "object" ? (s = e, | |
| r = t) : (s = {})[e] = t, | |
| r || (r = {}); | |
| if (!this._validate(s, r)) | |
| return !1; | |
| o = r.unset, | |
| a = r.silent, | |
| u = [], | |
| f = this._changing, | |
| this._changing = !0, | |
| f || (this._previousAttributes = n.clone(this.attributes), | |
| this.changed = {}), | |
| c = this.attributes, | |
| l = this._previousAttributes, | |
| this.idAttribute in s && (this.id = s[this.idAttribute]); | |
| for (i in s) | |
| t = s[i], | |
| n.isEqual(c[i], t) || u.push(i), | |
| n.isEqual(l[i], t) ? delete this.changed[i] : this.changed[i] = t, | |
| o ? delete c[i] : c[i] = t; | |
| if (!a) { | |
| u.length && (this._pending = r); | |
| for (var h = 0, p = u.length; h < p; h++) | |
| this.trigger("change:" + u[h], this, c[u[h]], r) | |
| } | |
| if (f) | |
| return this; | |
| if (!a) | |
| while (this._pending) | |
| r = this._pending, | |
| this._pending = !1, | |
| this.trigger("change", this, r); | |
| return this._pending = !1, | |
| this._changing = !1, | |
| this | |
| }, | |
| unset: function(e, t) { | |
| return this.set(e, void 0, n.extend({}, t, { | |
| unset: !0 | |
| })) | |
| }, | |
| clear: function(e) { | |
| var t = {}; | |
| for (var r in this.attributes) | |
| t[r] = void 0; | |
| return this.set(t, n.extend({}, e, { | |
| unset: !0 | |
| })) | |
| }, | |
| hasChanged: function(e) { | |
| return e == null ? !n.isEmpty(this.changed) : n.has(this.changed, e) | |
| }, | |
| changedAttributes: function(e) { | |
| if (!e) | |
| return this.hasChanged() ? n.clone(this.changed) : !1; | |
| var t, r = !1, i = this._changing ? this._previousAttributes : this.attributes; | |
| for (var s in e) { | |
| if (n.isEqual(i[s], t = e[s])) | |
| continue; | |
| (r || (r = {}))[s] = t | |
| } | |
| return r | |
| }, | |
| previous: function(e) { | |
| return e == null || !this._previousAttributes ? null : this._previousAttributes[e] | |
| }, | |
| previousAttributes: function() { | |
| return n.clone(this._previousAttributes) | |
| }, | |
| fetch: function(e) { | |
| e = e ? n.clone(e) : {}, | |
| e.parse === void 0 && (e.parse = !0); | |
| var t = this | |
| , r = e.success; | |
| return e.success = function(n) { | |
| if (!t.set(t.parse(n, e), e)) | |
| return !1; | |
| r && r(t, n, e), | |
| t.trigger("sync", t, n, e) | |
| } | |
| , | |
| I(this, e), | |
| this.sync("read", this, e) | |
| }, | |
| save: function(e, t, r) { | |
| var i, s, o, u = this.attributes; | |
| e == null || typeof e == "object" ? (i = e, | |
| r = t) : (i = {})[e] = t, | |
| r = n.extend({ | |
| validate: !0 | |
| }, r); | |
| if (i && !r.wait) { | |
| if (!this.set(i, r)) | |
| return !1 | |
| } else if (!this._validate(i, r)) | |
| return !1; | |
| i && r.wait && (this.attributes = n.extend({}, u, i)), | |
| r.parse === void 0 && (r.parse = !0); | |
| var a = this | |
| , f = r.success; | |
| return r.success = function(e) { | |
| a.attributes = u; | |
| var t = a.parse(e, r); | |
| r.wait && (t = n.extend(i || {}, t)); | |
| if (n.isObject(t) && !a.set(t, r)) | |
| return !1; | |
| f && f(a, e, r), | |
| a.trigger("sync", a, e, r) | |
| } | |
| , | |
| I(this, r), | |
| s = this.isNew() ? "create" : r.patch ? "patch" : "update", | |
| s === "patch" && (r.attrs = i), | |
| o = this.sync(s, this, r), | |
| i && r.wait && (this.attributes = u), | |
| o | |
| }, | |
| destroy: function(e) { | |
| e = e ? n.clone(e) : {}; | |
| var t = this | |
| , r = e.success | |
| , i = function() { | |
| t.trigger("destroy", t, t.collection, e) | |
| }; | |
| e.success = function(n) { | |
| (e.wait || t.isNew()) && i(), | |
| r && r(t, n, e), | |
| t.isNew() || t.trigger("sync", t, n, e) | |
| } | |
| ; | |
| if (this.isNew()) | |
| return e.success(), | |
| !1; | |
| I(this, e); | |
| var s = this.sync("delete", this, e); | |
| return e.wait || i(), | |
| s | |
| }, | |
| url: function() { | |
| var e = n.result(this, "urlRoot") || n.result(this.collection, "url") || F(); | |
| return this.isNew() ? e : e.replace(/([^\/])$/, "$1/") + encodeURIComponent(this.id) | |
| }, | |
| parse: function(e, t) { | |
| return e | |
| }, | |
| clone: function() { | |
| return new this.constructor(this.attributes) | |
| }, | |
| isNew: function() { | |
| return !this.has(this.idAttribute) | |
| }, | |
| isValid: function(e) { | |
| return this._validate({}, n.extend(e || {}, { | |
| validate: !0 | |
| })) | |
| }, | |
| _validate: function(e, t) { | |
| if (!t.validate || !this.validate) | |
| return !0; | |
| e = n.extend({}, this.attributes, e); | |
| var r = this.validationError = this.validate(e, t) || null; | |
| return r ? (this.trigger("invalid", this, r, n.extend(t, { | |
| validationError: r | |
| })), | |
| !1) : !0 | |
| } | |
| }); | |
| var v = ["keys", "values", "pairs", "invert", "pick", "omit"]; | |
| n.each(v, function(e) { | |
| d.prototype[e] = function() { | |
| var t = u.call(arguments); | |
| return t.unshift(this.attributes), | |
| n[e].apply(n, t) | |
| } | |
| }); | |
| var m = t.Collection = function(e, t) { | |
| t || (t = {}), | |
| t.model && (this.model = t.model), | |
| t.comparator !== void 0 && (this.comparator = t.comparator), | |
| this._reset(), | |
| this.initialize.apply(this, arguments), | |
| e && this.reset(e, n.extend({ | |
| silent: !0 | |
| }, t)) | |
| } | |
| , g = { | |
| add: !0, | |
| remove: !0, | |
| merge: !0 | |
| } | |
| , y = { | |
| add: !0, | |
| remove: !1 | |
| }; | |
| n.extend(m.prototype, f, { | |
| model: d, | |
| initialize: function() {}, | |
| toJSON: function(e) { | |
| return this.map(function(t) { | |
| return t.toJSON(e) | |
| }) | |
| }, | |
| sync: function() { | |
| return t.sync.apply(this, arguments) | |
| }, | |
| add: function(e, t) { | |
| return this.set(e, n.extend({ | |
| merge: !1 | |
| }, t, y)) | |
| }, | |
| remove: function(e, t) { | |
| var r = !n.isArray(e); | |
| e = r ? [e] : n.clone(e), | |
| t || (t = {}); | |
| var i, s, o, u; | |
| for (i = 0, | |
| s = e.length; i < s; i++) { | |
| u = e[i] = this.get(e[i]); | |
| if (!u) | |
| continue; | |
| delete this._byId[u.id], | |
| delete this._byId[u.cid], | |
| o = this.indexOf(u), | |
| this.models.splice(o, 1), | |
| this.length--, | |
| t.silent || (t.index = o, | |
| u.trigger("remove", u, this, t)), | |
| this._removeReference(u, t) | |
| } | |
| return r ? e[0] : e | |
| }, | |
| set: function(e, t) { | |
| t = n.defaults({}, t, g), | |
| t.parse && (e = this.parse(e, t)); | |
| var r = !n.isArray(e); | |
| e = r ? e ? [e] : [] : n.clone(e); | |
| var i, s, o, u, a, f, l, c = t.at, h = this.model, p = this.comparator && c == null && t.sort !== !1, v = n.isString(this.comparator) ? this.comparator : null, m = [], y = [], b = {}, w = t.add, E = t.merge, S = t.remove, x = !p && w && S ? [] : !1; | |
| for (i = 0, | |
| s = e.length; i < s; i++) { | |
| a = e[i] || {}, | |
| a instanceof d ? o = u = a : o = a[h.prototype.idAttribute || "id"]; | |
| if (f = this.get(o)) | |
| S && (b[f.cid] = !0), | |
| E && (a = a === u ? u.attributes : a, | |
| t.parse && (a = f.parse(a, t)), | |
| f.set(a, t), | |
| p && !l && f.hasChanged(v) && (l = !0)), | |
| e[i] = f; | |
| else if (w) { | |
| u = e[i] = this._prepareModel(a, t); | |
| if (!u) | |
| continue; | |
| m.push(u), | |
| this._addReference(u, t) | |
| } | |
| u = f || u, | |
| x && (u.isNew() || !b[u.id]) && x.push(u), | |
| b[u.id] = !0 | |
| } | |
| if (S) { | |
| for (i = 0, | |
| s = this.length; i < s; ++i) | |
| b[(u = this.models[i]).cid] || y.push(u); | |
| y.length && this.remove(y, t) | |
| } | |
| if (m.length || x && x.length) { | |
| p && (l = !0), | |
| this.length += m.length; | |
| if (c != null) | |
| for (i = 0, | |
| s = m.length; i < s; i++) | |
| this.models.splice(c + i, 0, m[i]); | |
| else { | |
| x && (this.models.length = 0); | |
| var T = x || m; | |
| for (i = 0, | |
| s = T.length; i < s; i++) | |
| this.models.push(T[i]) | |
| } | |
| } | |
| l && this.sort({ | |
| silent: !0 | |
| }); | |
| if (!t.silent) { | |
| for (i = 0, | |
| s = m.length; i < s; i++) | |
| (u = m[i]).trigger("add", u, this, t); | |
| (l || x && x.length) && this.trigger("sort", this, t) | |
| } | |
| return r ? e[0] : e | |
| }, | |
| reset: function(e, t) { | |
| t || (t = {}); | |
| for (var r = 0, i = this.models.length; r < i; r++) | |
| this._removeReference(this.models[r], t); | |
| return t.previousModels = this.models, | |
| this._reset(), | |
| e = this.add(e, n.extend({ | |
| silent: !0 | |
| }, t)), | |
| t.silent || this.trigger("reset", this, t), | |
| e | |
| }, | |
| push: function(e, t) { | |
| return this.add(e, n.extend({ | |
| at: this.length | |
| }, t)) | |
| }, | |
| pop: function(e) { | |
| var t = this.at(this.length - 1); | |
| return this.remove(t, e), | |
| t | |
| }, | |
| unshift: function(e, t) { | |
| return this.add(e, n.extend({ | |
| at: 0 | |
| }, t)) | |
| }, | |
| shift: function(e) { | |
| var t = this.at(0); | |
| return this.remove(t, e), | |
| t | |
| }, | |
| slice: function() { | |
| return u.apply(this.models, arguments) | |
| }, | |
| get: function(e) { | |
| return e == null ? void 0 : this._byId[e] || this._byId[e.id] || this._byId[e.cid] | |
| }, | |
| at: function(e) { | |
| return this.models[e] | |
| }, | |
| where: function(e, t) { | |
| return n.isEmpty(e) ? t ? void 0 : [] : this[t ? "find" : "filter"](function(t) { | |
| for (var n in e) | |
| if (e[n] !== t.get(n)) | |
| return !1; | |
| return !0 | |
| }) | |
| }, | |
| findWhere: function(e) { | |
| return this.where(e, !0) | |
| }, | |
| sort: function(e) { | |
| if (!this.comparator) | |
| throw new Error("Cannot sort a set without a comparator"); | |
| return e || (e = {}), | |
| n.isString(this.comparator) || this.comparator.length === 1 ? this.models = this.sortBy(this.comparator, this) : this.models.sort(n.bind(this.comparator, this)), | |
| e.silent || this.trigger("sort", this, e), | |
| this | |
| }, | |
| pluck: function(e) { | |
| return n.invoke(this.models, "get", e) | |
| }, | |
| fetch: function(e) { | |
| e = e ? n.clone(e) : {}, | |
| e.parse === void 0 && (e.parse = !0); | |
| var t = e.success | |
| , r = this; | |
| return e.success = function(n) { | |
| var i = e.reset ? "reset" : "set"; | |
| r[i](n, e), | |
| t && t(r, n, e), | |
| r.trigger("sync", r, n, e) | |
| } | |
| , | |
| I(this, e), | |
| this.sync("read", this, e) | |
| }, | |
| create: function(e, t) { | |
| t = t ? n.clone(t) : {}; | |
| if (!(e = this._prepareModel(e, t))) | |
| return !1; | |
| t.wait || this.add(e, t); | |
| var r = this | |
| , i = t.success; | |
| return t.success = function(e, n) { | |
| t.wait && r.add(e, t), | |
| i && i(e, n, t) | |
| } | |
| , | |
| e.save(null, t), | |
| e | |
| }, | |
| parse: function(e, t) { | |
| return e | |
| }, | |
| clone: function() { | |
| return new this.constructor(this.models) | |
| }, | |
| _reset: function() { | |
| this.length = 0, | |
| this.models = [], | |
| this._byId = {} | |
| }, | |
| _prepareModel: function(e, t) { | |
| if (e instanceof d) | |
| return e; | |
| t = t ? n.clone(t) : {}, | |
| t.collection = this; | |
| var r = new this.model(e,t); | |
| return r.validationError ? (this.trigger("invalid", this, r.validationError, t), | |
| !1) : r | |
| }, | |
| _addReference: function(e, t) { | |
| this._byId[e.cid] = e, | |
| e.id != null && (this._byId[e.id] = e), | |
| e.collection || (e.collection = this), | |
| e.on("all", this._onModelEvent, this) | |
| }, | |
| _removeReference: function(e, t) { | |
| this === e.collection && delete e.collection, | |
| e.off("all", this._onModelEvent, this) | |
| }, | |
| _onModelEvent: function(e, t, n, r) { | |
| if ((e === "add" || e === "remove") && n !== this) | |
| return; | |
| e === "destroy" && this.remove(t, r), | |
| t && e === "change:" + t.idAttribute && (delete this._byId[t.previous(t.idAttribute)], | |
| t.id != null && (this._byId[t.id] = t)), | |
| this.trigger.apply(this, arguments) | |
| } | |
| }); | |
| var b = ["forEach", "each", "map", "collect", "reduce", "foldl", "inject", "reduceRight", "foldr", "find", "detect", "filter", "select", "reject", "every", "all", "some", "any", "include", "contains", "invoke", "max", "min", "toArray", "size", "first", "head", "take", "initial", "rest", "tail", "drop", "last", "without", "difference", "indexOf", "shuffle", "lastIndexOf", "isEmpty", "chain", "sample"]; | |
| n.each(b, function(e) { | |
| m.prototype[e] = function() { | |
| var t = u.call(arguments); | |
| return t.unshift(this.models), | |
| n[e].apply(n, t) | |
| } | |
| }); | |
| var w = ["groupBy", "countBy", "sortBy", "indexBy"]; | |
| n.each(w, function(e) { | |
| m.prototype[e] = function(t, r) { | |
| var i = n.isFunction(t) ? t : function(e) { | |
| return e.get(t) | |
| } | |
| ; | |
| return n[e](this.models, i, r) | |
| } | |
| }); | |
| var E = t.View = function(e) { | |
| this.cid = n.uniqueId("view"), | |
| e || (e = {}), | |
| n.extend(this, n.pick(e, x)), | |
| this._ensureElement(), | |
| this.initialize.apply(this, arguments), | |
| this.delegateEvents() | |
| } | |
| , S = /^(\S+)\s*(.*)$/ | |
| , x = ["model", "collection", "el", "id", "attributes", "className", "tagName", "events"]; | |
| n.extend(E.prototype, f, { | |
| tagName: "div", | |
| $: function(e) { | |
| return this.$el.find(e) | |
| }, | |
| initialize: function() {}, | |
| render: function() { | |
| return this | |
| }, | |
| remove: function() { | |
| return this.$el.remove(), | |
| this.stopListening(), | |
| this | |
| }, | |
| setElement: function(e, n) { | |
| return this.$el && this.undelegateEvents(), | |
| this.$el = e instanceof t.$ ? e : t.$(e), | |
| this.el = this.$el[0], | |
| n !== !1 && this.delegateEvents(), | |
| this | |
| }, | |
| delegateEvents: function(e) { | |
| if (!e && !(e = n.result(this, "events"))) | |
| return this; | |
| this.undelegateEvents(); | |
| for (var t in e) { | |
| var r = e[t]; | |
| n.isFunction(r) || (r = this[e[t]]); | |
| if (!r) | |
| continue; | |
| var i = t.match(S) | |
| , s = i[1] | |
| , o = i[2]; | |
| r = n.bind(r, this), | |
| s += ".delegateEvents" + this.cid, | |
| o === "" ? this.$el.on(s, r) : this.$el.on(s, o, r) | |
| } | |
| return this | |
| }, | |
| undelegateEvents: function() { | |
| return this.$el.off(".delegateEvents" + this.cid), | |
| this | |
| }, | |
| _ensureElement: function() { | |
| if (!this.el) { | |
| var e = n.extend({}, n.result(this, "attributes")); | |
| this.id && (e.id = n.result(this, "id")), | |
| this.className && (e["class"] = n.result(this, "className")); | |
| var r = t.$("<" + n.result(this, "tagName") + ">").attr(e); | |
| this.setElement(r, !1) | |
| } else | |
| this.setElement(n.result(this, "el"), !1) | |
| } | |
| }), | |
| t.sync = function(e, r, i) { | |
| var s = N[e]; | |
| n.defaults(i || (i = {}), { | |
| emulateHTTP: t.emulateHTTP, | |
| emulateJSON: t.emulateJSON | |
| }); | |
| var o = { | |
| type: s, | |
| dataType: "json" | |
| }; | |
| i.url || (o.url = n.result(r, "url") || F()), | |
| i.data == null && r && (e === "create" || e === "update" || e === "patch") && (o.contentType = "application/json", | |
| o.data = JSON.stringify(i.attrs || r.toJSON(i))), | |
| i.emulateJSON && (o.contentType = "application/x-www-form-urlencoded", | |
| o.data = o.data ? { | |
| model: o.data | |
| } : {}); | |
| if (i.emulateHTTP && (s === "PUT" || s === "DELETE" || s === "PATCH")) { | |
| o.type = "POST", | |
| i.emulateJSON && (o.data._method = s); | |
| var u = i.beforeSend; | |
| i.beforeSend = function(e) { | |
| e.setRequestHeader("X-HTTP-Method-Override", s); | |
| if (u) | |
| return u.apply(this, arguments) | |
| } | |
| } | |
| o.type !== "GET" && !i.emulateJSON && (o.processData = !1), | |
| o.type === "PATCH" && T && (o.xhr = function() { | |
| return new ActiveXObject("Microsoft.XMLHTTP") | |
| } | |
| ); | |
| var a = i.xhr = t.ajax(n.extend(o, i)); | |
| return r.trigger("request", r, a, i), | |
| a | |
| } | |
| ; | |
| var T = typeof window != "undefined" && !!window.ActiveXObject && (!window.XMLHttpRequest || !(new XMLHttpRequest).dispatchEvent) | |
| , N = { | |
| create: "POST", | |
| update: "PUT", | |
| patch: "PATCH", | |
| "delete": "DELETE", | |
| read: "GET" | |
| }; | |
| t.ajax = function() { | |
| return t.$.ajax.apply(t.$, arguments) | |
| } | |
| ; | |
| var C = t.Router = function(e) { | |
| e || (e = {}), | |
| e.routes && (this.routes = e.routes), | |
| this._bindRoutes(), | |
| this.initialize.apply(this, arguments) | |
| } | |
| , k = /\((.*?)\)/g | |
| , L = /(\(\?)?:\w+/g | |
| , A = /\*\w+/g | |
| , O = /[\-{}\[\]+?.,\\\^$|#\s]/g; | |
| n.extend(C.prototype, f, { | |
| initialize: function() {}, | |
| route: function(e, r, i) { | |
| n.isRegExp(e) || (e = this._routeToRegExp(e)), | |
| n.isFunction(r) && (i = r, | |
| r = ""), | |
| i || (i = this[r]); | |
| var s = this; | |
| return t.history.route(e, function(n) { | |
| var o = s._extractParameters(e, n); | |
| s.execute(i, o), | |
| s.trigger.apply(s, ["route:" + r].concat(o)), | |
| s.trigger("route", r, o), | |
| t.history.trigger("route", s, r, o) | |
| }), | |
| this | |
| }, | |
| execute: function(e, t) { | |
| e && e.apply(this, t) | |
| }, | |
| navigate: function(e, n) { | |
| return t.history.navigate(e, n), | |
| this | |
| }, | |
| _bindRoutes: function() { | |
| if (!this.routes) | |
| return; | |
| this.routes = n.result(this, "routes"); | |
| var e, t = n.keys(this.routes); | |
| while ((e = t.pop()) != null) | |
| this.route(e, this.routes[e]) | |
| }, | |
| _routeToRegExp: function(e) { | |
| return e = e.replace(O, "\\$&").replace(k, "(?:$1)?").replace(L, function(e, t) { | |
| return t ? e : "([^/?]+)" | |
| }).replace(A, "([^?]*?)"), | |
| new RegExp("^" + e + "(?:\\?([\\s\\S]*))?$") | |
| }, | |
| _extractParameters: function(e, t) { | |
| var r = e.exec(t).slice(1); | |
| return n.map(r, function(e, t) { | |
| return t === r.length - 1 ? e || null : e ? decodeURIComponent(e) : null | |
| }) | |
| } | |
| }); | |
| var M = t.History = function() { | |
| this.handlers = [], | |
| n.bindAll(this, "checkUrl"), | |
| typeof window != "undefined" && (this.location = window.location, | |
| this.history = window.history) | |
| } | |
| , _ = /^[#\/]|\s+$/g | |
| , D = /^\/+|\/+$/g | |
| , P = /msie [\w.]+/ | |
| , H = /\/$/ | |
| , B = /#.*$/; | |
| M.started = !1, | |
| n.extend(M.prototype, f, { | |
| interval: 50, | |
| atRoot: function() { | |
| return this.location.pathname.replace(/[^\/]$/, "$&/") === this.root | |
| }, | |
| getHash: function(e) { | |
| var t = (e || this).location.href.match(/#(.*)$/); | |
| return t ? t[1] : "" | |
| }, | |
| getFragment: function(e, t) { | |
| if (e == null) | |
| if (this._hasPushState || !this._wantsHashChange || t) { | |
| e = decodeURI(this.location.pathname + this.location.search); | |
| var n = this.root.replace(H, ""); | |
| e.indexOf(n) || (e = e.slice(n.length)) | |
| } else | |
| e = this.getHash(); | |
| return e.replace(_, "") | |
| }, | |
| start: function(e) { | |
| if (M.started) | |
| throw new Error("Backbone.history has already been started"); | |
| M.started = !0, | |
| this.options = n.extend({ | |
| root: "/" | |
| }, this.options, e), | |
| this.root = this.options.root, | |
| this._wantsHashChange = this.options.hashChange !== !1, | |
| this._wantsPushState = !!this.options.pushState, | |
| this._hasPushState = !!(this.options.pushState && this.history && this.history.pushState); | |
| var r = this.getFragment() | |
| , i = document.documentMode | |
| , s = P.exec(navigator.userAgent.toLowerCase()) && (!i || i <= 7); | |
| this.root = ("/" + this.root + "/").replace(D, "/"); | |
| if (s && this._wantsHashChange) { | |
| var o = t.$('<iframe src="javascript:0" tabindex="-1">'); | |
| this.iframe = o.hide().appendTo("body")[0].contentWindow, | |
| this.navigate(r) | |
| } | |
| this._hasPushState ? t.$(window).on("popstate", this.checkUrl) : this._wantsHashChange && "onhashchange"in window && !s ? t.$(window).on("hashchange", this.checkUrl) : this._wantsHashChange && (this._checkUrlInterval = setInterval(this.checkUrl, this.interval)), | |
| this.fragment = r; | |
| var u = this.location; | |
| if (this._wantsHashChange && this._wantsPushState) { | |
| if (!this._hasPushState && !this.atRoot()) | |
| return this.fragment = this.getFragment(null, !0), | |
| this.location.replace(this.root + "#" + this.fragment), | |
| !0; | |
| this._hasPushState && this.atRoot() && u.hash && (this.fragment = this.getHash().replace(_, ""), | |
| this.history.replaceState({}, document.title, this.root + this.fragment)) | |
| } | |
| if (!this.options.silent) | |
| return this.loadUrl() | |
| }, | |
| stop: function() { | |
| t.$(window).off("popstate", this.checkUrl).off("hashchange", this.checkUrl), | |
| this._checkUrlInterval && clearInterval(this._checkUrlInterval), | |
| M.started = !1 | |
| }, | |
| route: function(e, t) { | |
| this.handlers.unshift({ | |
| route: e, | |
| callback: t | |
| }) | |
| }, | |
| checkUrl: function(e) { | |
| var t = this.getFragment(); | |
| t === this.fragment && this.iframe && (t = this.getFragment(this.getHash(this.iframe))); | |
| if (t === this.fragment) | |
| return !1; | |
| this.iframe && this.navigate(t), | |
| this.loadUrl() | |
| }, | |
| loadUrl: function(e) { | |
| return e = this.fragment = this.getFragment(e), | |
| n.any(this.handlers, function(t) { | |
| if (t.route.test(e)) | |
| return t.callback(e), | |
| !0 | |
| }) | |
| }, | |
| navigate: function(e, t) { | |
| if (!M.started) | |
| return !1; | |
| if (!t || t === !0) | |
| t = { | |
| trigger: !!t | |
| }; | |
| var n = this.root + (e = this.getFragment(e || "")); | |
| e = e.replace(B, ""); | |
| if (this.fragment === e) | |
| return; | |
| this.fragment = e, | |
| e === "" && n !== "/" && (n = n.slice(0, -1)); | |
| if (this._hasPushState) | |
| this.history[t.replace ? "replaceState" : "pushState"]({}, document.title, n); | |
| else { | |
| if (!this._wantsHashChange) | |
| return this.location.assign(n); | |
| this._updateHash(this.location, e, t.replace), | |
| this.iframe && e !== this.getFragment(this.getHash(this.iframe)) && (t.replace || this.iframe.document.open().close(), | |
| this._updateHash(this.iframe.location, e, t.replace)) | |
| } | |
| if (t.trigger) | |
| return this.loadUrl(e) | |
| }, | |
| _updateHash: function(e, t, n) { | |
| if (n) { | |
| var r = e.href.replace(/(javascript:|#).*$/, ""); | |
| e.replace(r + "#" + t) | |
| } else | |
| e.hash = "#" + t | |
| } | |
| }), | |
| t.history = new M; | |
| var j = function(e, t) { | |
| var r = this, i; | |
| e && n.has(e, "constructor") ? i = e.constructor : i = function() { | |
| return r.apply(this, arguments) | |
| } | |
| , | |
| n.extend(i, r, t); | |
| var s = function() { | |
| this.constructor = i | |
| }; | |
| return s.prototype = r.prototype, | |
| i.prototype = new s, | |
| e && n.extend(i.prototype, e), | |
| i.__super__ = r.prototype, | |
| i | |
| }; | |
| d.extend = m.extend = C.extend = E.extend = M.extend = j; | |
| var F = function() { | |
| throw new Error('A "url" property or function must be specified') | |
| } | |
| , I = function(e, t) { | |
| var n = t.error; | |
| t.error = function(r) { | |
| n && n(e, r, t), | |
| e.trigger("error", e, r, t) | |
| } | |
| }; | |
| return t | |
| }), | |
| define("text", ["module"], function(e) { | |
| "use strict"; | |
| var t, n, r, i, s, o = ["Msxml2.XMLHTTP", "Microsoft.XMLHTTP", "Msxml2.XMLHTTP.4.0"], u = /^\s*<\?xml(\s)+version=[\'\"](\d)*.(\d)*[\'\"](\s)*\?>/im, a = /<body[^>]*>\s*([\s\S]+)\s*<\/body>/im, f = typeof location != "undefined" && location.href, l = f && location.protocol && location.protocol.replace(/\:/, ""), c = f && location.hostname, h = f && (location.port || undefined), p = {}, d = e.config && e.config() || {}; | |
| t = { | |
| version: "2.0.14", | |
| strip: function(e) { | |
| if (e) { | |
| e = e.replace(u, ""); | |
| var t = e.match(a); | |
| t && (e = t[1]) | |
| } else | |
| e = ""; | |
| return e | |
| }, | |
| jsEscape: function(e) { | |
| return e.replace(/(['\\])/g, "\\$1").replace(/[\f]/g, "\\f").replace(/[\b]/g, "\\b").replace(/[\n]/g, "\\n").replace(/[\t]/g, "\\t").replace(/[\r]/g, "\\r").replace(/[\u2028]/g, "\\u2028").replace(/[\u2029]/g, "\\u2029") | |
| }, | |
| createXhr: d.createXhr || function() { | |
| var e, t, n; | |
| if (typeof XMLHttpRequest != "undefined") | |
| return new XMLHttpRequest; | |
| if (typeof ActiveXObject != "undefined") | |
| for (t = 0; t < 3; t += 1) { | |
| n = o[t]; | |
| try { | |
| e = new ActiveXObject(n) | |
| } catch (r) {} | |
| if (e) { | |
| o = [n]; | |
| break | |
| } | |
| } | |
| return e | |
| } | |
| , | |
| parseName: function(e) { | |
| var t, n, r, i = !1, s = e.lastIndexOf("."), o = e.indexOf("./") === 0 || e.indexOf("../") === 0; | |
| return s !== -1 && (!o || s > 1) ? (t = e.substring(0, s), | |
| n = e.substring(s + 1)) : t = e, | |
| r = n || t, | |
| s = r.indexOf("!"), | |
| s !== -1 && (i = r.substring(s + 1) === "strip", | |
| r = r.substring(0, s), | |
| n ? n = r : t = r), | |
| { | |
| moduleName: t, | |
| ext: n, | |
| strip: i | |
| } | |
| }, | |
| xdRegExp: /^((\w+)\:)?\/\/([^\/\\]+)/, | |
| useXhr: function(e, n, r, i) { | |
| var s, o, u, a = t.xdRegExp.exec(e); | |
| return a ? (s = a[2], | |
| o = a[3], | |
| o = o.split(":"), | |
| u = o[1], | |
| o = o[0], | |
| (!s || s === n) && (!o || o.toLowerCase() === r.toLowerCase()) && (!u && !o || u === i)) : !0 | |
| }, | |
| finishLoad: function(e, n, r, i) { | |
| r = n ? t.strip(r) : r, | |
| d.isBuild && (p[e] = r), | |
| i(r) | |
| }, | |
| load: function(e, n, r, i) { | |
| if (i && i.isBuild && !i.inlineText) { | |
| r(); | |
| return | |
| } | |
| d.isBuild = i && i.isBuild; | |
| var s = t.parseName(e) | |
| , o = s.moduleName + (s.ext ? "." + s.ext : "") | |
| , u = n.toUrl(o) | |
| , a = d.useXhr || t.useXhr; | |
| if (u.indexOf("empty:") === 0) { | |
| r(); | |
| return | |
| } | |
| !f || a(u, l, c, h) ? t.get(u, function(n) { | |
| t.finishLoad(e, s.strip, n, r) | |
| }, function(e) { | |
| r.error && r.error(e) | |
| }) : n([o], function(e) { | |
| t.finishLoad(s.moduleName + "." + s.ext, s.strip, e, r) | |
| }) | |
| }, | |
| write: function(e, n, r, i) { | |
| if (p.hasOwnProperty(n)) { | |
| var s = t.jsEscape(p[n]); | |
| r.asModule(e + "!" + n, "define(function () { return '" + s + "';});\n") | |
| } | |
| }, | |
| writeFile: function(e, n, r, i, s) { | |
| var o = t.parseName(n) | |
| , u = o.ext ? "." + o.ext : "" | |
| , a = o.moduleName + u | |
| , f = r.toUrl(o.moduleName + u) + ".js"; | |
| t.load(a, r, function(n) { | |
| var r = function(e) { | |
| return i(f, e) | |
| }; | |
| r.asModule = function(e, t) { | |
| return i.asModule(e, f, t) | |
| } | |
| , | |
| t.write(e, a, r, s) | |
| }, s) | |
| } | |
| }; | |
| if (d.env === "node" || !d.env && typeof process != "undefined" && process.versions && !!process.versions.node && !process.versions["node-webkit"] && !process.versions["atom-shell"]) | |
| n = require.nodeRequire("fs"), | |
| t.get = function(e, t, r) { | |
| try { | |
| var i = n.readFileSync(e, "utf8"); | |
| i[0] === "" && (i = i.substring(1)), | |
| t(i) | |
| } catch (s) { | |
| r && r(s) | |
| } | |
| } | |
| ; | |
| else if (d.env === "xhr" || !d.env && t.createXhr()) | |
| t.get = function(e, n, r, i) { | |
| var s = t.createXhr(), o; | |
| s.open("GET", e, !0); | |
| if (i) | |
| for (o in i) | |
| i.hasOwnProperty(o) && s.setRequestHeader(o.toLowerCase(), i[o]); | |
| d.onXhr && d.onXhr(s, e), | |
| s.onreadystatechange = function(t) { | |
| var i, o; | |
| s.readyState === 4 && (i = s.status || 0, | |
| i > 399 && i < 600 ? (o = new Error(e + " HTTP status: " + i), | |
| o.xhr = s, | |
| r && r(o)) : n(s.responseText), | |
| d.onXhrComplete && d.onXhrComplete(s, e)) | |
| } | |
| , | |
| s.send(null) | |
| } | |
| ; | |
| else if (d.env === "rhino" || !d.env && typeof Packages != "undefined" && typeof java != "undefined") | |
| t.get = function(e, t) { | |
| var n, r, i = "utf-8", s = new java.io.File(e), o = java.lang.System.getProperty("line.separator"), u = new java.io.BufferedReader(new java.io.InputStreamReader(new java.io.FileInputStream(s),i)), a = ""; | |
| try { | |
| n = new java.lang.StringBuffer, | |
| r = u.readLine(), | |
| r && r.length() && r.charAt(0) === 65279 && (r = r.substring(1)), | |
| r !== null && n.append(r); | |
| while ((r = u.readLine()) !== null) | |
| n.append(o), | |
| n.append(r); | |
| a = String(n.toString()) | |
| } finally { | |
| u.close() | |
| } | |
| t(a) | |
| } | |
| ; | |
| else if (d.env === "xpconnect" || !d.env && typeof Components != "undefined" && Components.classes && Components.interfaces) | |
| r = Components.classes, | |
| i = Components.interfaces, | |
| Components.utils["import"]("resource://gre/modules/FileUtils.jsm"), | |
| s = "@mozilla.org/windows-registry-key;1"in r, | |
| t.get = function(e, t) { | |
| var n, o, u, a = {}; | |
| s && (e = e.replace(/\//g, "\\")), | |
| u = new FileUtils.File(e); | |
| try { | |
| n = r["@mozilla.org/network/file-input-stream;1"].createInstance(i.nsIFileInputStream), | |
| n.init(u, 1, 0, !1), | |
| o = r["@mozilla.org/intl/converter-input-stream;1"].createInstance(i.nsIConverterInputStream), | |
| o.init(n, "utf-8", n.available(), i.nsIConverterInputStream.DEFAULT_REPLACEMENT_CHARACTER), | |
| o.readString(n.available(), a), | |
| o.close(), | |
| n.close(), | |
| t(a.value) | |
| } catch (f) { | |
| throw new Error((u && u.path || "") + ": " + f) | |
| } | |
| } | |
| ; | |
| return t | |
| }), | |
| define("json", ["text"], function(text) { | |
| function cacheBust(e) { | |
| return e = e.replace(CACHE_BUST_FLAG, ""), | |
| e += e.indexOf("?") < 0 ? "?" : "&", | |
| e + CACHE_BUST_QUERY_PARAM + "=" + Math.round(2147483647 * Math.random()) | |
| } | |
| var CACHE_BUST_QUERY_PARAM = "bust" | |
| , CACHE_BUST_FLAG = "!bust" | |
| , jsonParse = typeof JSON != "undefined" && typeof JSON.parse == "function" ? JSON.parse : function(val) { | |
| return eval("(" + val + ")") | |
| } | |
| , buildMap = {}; | |
| return { | |
| load: function(e, t, n, r) { | |
| r.isBuild && (r.inlineJSON === !1 || e.indexOf(CACHE_BUST_QUERY_PARAM + "=") !== -1) || t.toUrl(e).indexOf("empty:") === 0 ? n(null) : text.get(t.toUrl(e), function(t) { | |
| r.isBuild ? (buildMap[e] = t, | |
| n(t)) : n(jsonParse(t)) | |
| }, n.error, { | |
| accept: "application/json" | |
| }) | |
| }, | |
| normalize: function(e, t) { | |
| return e.indexOf(CACHE_BUST_FLAG) !== -1 && (e = cacheBust(e)), | |
| t(e) | |
| }, | |
| write: function(e, t, n) { | |
| if (t in buildMap) { | |
| var r = buildMap[t]; | |
| n('define("' + e + "!" + t + '", function(){ return ' + r + ";});\n") | |
| } | |
| } | |
| } | |
| }), | |
| define("json!languageFiles/languageFile.json", function() { | |
| return { | |
| de: { | |
| "app.title": "MagentaCLOUD", | |
| asc: "aufsteigend", | |
| "confirm.cancel": "Abbrechen", | |
| "confirm.ok": "Ok", | |
| copyright: "© Telekom Deutschland GmbH", | |
| desc: "absteigend", | |
| details: "Details", | |
| "encrypted.main": "Die Daten, auf die Sie zugreifen möchten, sind verschlüsselt.", | |
| "error.401": "Nicht autorisiert", | |
| "error.404": "Die Seite, nach der Sie suchen, können wir leider nicht finden.", | |
| "error.410": "Dieser Freigabe-Link ist bereits abgelaufen.", | |
| "error.500": "Ein Fehler ist aufgetreten.", | |
| "error.503": "Die Funktion steht vorübergehend nicht zur Verfügung.", | |
| "error.expired": "Die Sitzung ist abgelaufen. Bitte loggen Sie sich erneut ein.", | |
| "error.password": "Das angegebene Passwort ist ungültig", | |
| "error.password_empty": "Bitte geben Sie ein Passwort ein.", | |
| "file.details.bitdepth": "Bittiefe", | |
| "file.details.datetaken": "Aufnahmedatum", | |
| "file.details.dimensions": "Abmessungen", | |
| "file.details.exposuretime": "Belichtungszeit", | |
| "file.details.fnumber": "Blendenzahl", | |
| "file.details.focallength": "Brennweite", | |
| "file.details.iso": "Iso", | |
| "file.details.manufacturer": "Kamerahersteller", | |
| "file.details.model": "Modell", | |
| "file.download": "Herunterladen", | |
| "file.name": "Name", | |
| "file.size": "Größe", | |
| "file.size.unit.Bytes": "Bytes", | |
| "file.size.unit.GB": "GB", | |
| "file.size.unit.KB": "KB", | |
| "file.size.unit.MB": "MB", | |
| "file.size.unit.PB": "PB", | |
| "file.size.unit.TB": "TB", | |
| "file.type": "Typ", | |
| "file.type.dir": "Ordner", | |
| "file.type.fileitem": "Datei", | |
| "filemanager.delete.error.all": "Beim Löschen von {0} Element(en) ist ein Fehler aufgetreten.", | |
| "filemanager.delete.error.one": '"{0}" konnte nicht gelöscht werden.', | |
| "filemanager.delete.error.some": "{0} Element(e) wurden gelöscht. Beim Löschen von {1} Element(en) ist ein Fehler aufgetreten.", | |
| "filemanager.delete.prompt.cancel": "Abbrechen", | |
| "filemanager.delete.prompt.multi": "Möchten Sie diese {0} Elemente wirklich löschen?", | |
| "filemanager.delete.prompt.ok": "Löschen", | |
| "filemanager.delete.prompt.single": 'Möchten Sie "{0}" wirklich löschen?', | |
| "filemanager.deselectAll": "Auswahl aufheben", | |
| "filemanager.dnd.invitation": "Ziehen Sie Ihre Dateien in diesen Bereich.", | |
| "filemanager.download_dir.error.404": 'Der Ordner "{0}" existiert nicht mehr.', | |
| "filemanager.download.archiveprefix": "magentacloud", | |
| "filemanager.download.error.404": 'Die Datei "{0}" existiert nicht mehr', | |
| "filemanager.download.error.common": 'Beim Laden der Datei "{0}" ist ein Fehler aufgetreten.', | |
| "filemanager.downloadAll": "Alle Dateien herunterladen", | |
| "filemanager.downloadSelected": "Auswahl herunterladen", | |
| "filemanager.newfolder.defaultname": "Neuer Ordner", | |
| "filemanager.newfolder.error.common": "Beim Erstellen des neuen Ordners ist ein Fehler aufgetreten.", | |
| "filemanager.noFiles": "Keine Dateien oder Ordner.", | |
| "filemanager.selectall": "Alles auswählen", | |
| "filesviewer.close": "Schließen", | |
| "fileview.default.button.download": "Herunterladen", | |
| "fileview.default.changed": "{0}, geändert am {1}", | |
| "fileview.default.text": "Diese Datei kann nicht angezeigt werden.", | |
| "fileview.default.timeFormat": "d. M Y", | |
| "folder.loaderror.common": "Beim Laden von {0} ist ein Fehler aufgetreten.", | |
| "format.decimal": ",", | |
| "format.thousand": ".", | |
| "header.teaser.import.button": "Jetzt speichern", | |
| "header.teaser.import.text": "Sie können diese empfangene Freigabe in Ihrer MagentaCLOUD speichern.", | |
| "header.teaser.text1": "Willkommen in der {0}.", | |
| "header.teaser.text2": "Hier ist noch Platz für Sie!", | |
| "header.teaser.url": "https://cloud.telekom-dienste.de", | |
| "help.and.faq.title": "Hilfe & FAQ", | |
| "help.and.faq.url": "https://cloud.telekom-dienste.de/hilfe", | |
| "imprint.title": "Impressum", | |
| "imprint.url": "http://www.telekom.de/impressum", | |
| "js.activate": "Aktivieren Sie bitte JavaScript um MagentaCLOUD im Webrowser benutzen zu können.", | |
| "lang.monthsList.short": "Jan.,Feb.,Mär.,Apr.,Mai.,Jun.,Jul.,Aug.,Sep.,Okt.,Nov.,Dez.", | |
| "lang.name": "Deutsch", | |
| "lang.timeFormat": "d. M Y H:i", | |
| "login.accept": "Login", | |
| "login.header": "Die Freigabe ist passwortgeschützt.", | |
| "login.passwordLabel": "Passwort", | |
| "menubar.delete": "Löschen", | |
| "menubar.newfolder": "Neuer Ordner", | |
| "menubar.select": "Auswählen", | |
| "menubar.select.download": "Herunterladen", | |
| "menubar.unselect": "Abbrechen", | |
| "menubar.upload": "Hochladen", | |
| "pdfview.documenttoolbar.page": "Seite", | |
| "poweredBy.url": "https://cloud.telekom-dienste.de/hilfe?frage=erste-schritte-strato", | |
| "privacy.title": "Datenschutz", | |
| "privacy.url": "http://www.telekom.de/datenschutz", | |
| "statusbar.delete": "Löschen", | |
| "statusbar.download": "Herunterladen", | |
| "teaser.register.text": "Jetzt informieren", | |
| "teaser.register.url": "https://cloud.telekom-dienste.de/", | |
| "teaser.text": "Die {0} ist der sichere und kostenlose Online-Speicher der Telekom. Ideal für Ihre Fotos, Videos und alle anderen Dateien, die Sie sicher speichern wollen. Sie können Ihre Daten direkt vom Smartphone, Tablet oder PC hochladen, von überall abrufen und ganz einfach mit Familie und Freunden teilen.", | |
| "tmcshare.logo.text1": "Magenta", | |
| "tmcshare.logo.text2": "CLOUD", | |
| "upload.detail.cancelAll": "Alle Abbrechen", | |
| "upload.detail.close": "Schließen", | |
| "upload.detail.item.status.aborted": "— Abgebrochen", | |
| "upload.detail.item.status.transferred": "{0} von {1}", | |
| "upload.detail.moreuploads": "Weitere Dateien hochladen", | |
| "upload.detail.title.done.multi": "hochgeladen", | |
| "upload.detail.title.done.single": "hochgeladen", | |
| "upload.detail.title.progress.multi": "{1} Dateien werden hochgeladen …", | |
| "upload.detail.title.progress.single": "1 Datei wird hochgeladen …", | |
| "viewAndSorting.date": "Datum", | |
| "viewAndSorting.name": "Name", | |
| "viewAndSorting.size": "Größe", | |
| "viewAndSorting.sortedBy": "Sortiert nach", | |
| "viewAndSorting.title": "Ansicht", | |
| "viewAndSorting.type": "Typ" | |
| }, | |
| en: { | |
| "app.title": "MagentaCLOUD", | |
| asc: "Ascending", | |
| "confirm.cancel": "Cancel", | |
| "confirm.ok": "Ok", | |
| copyright: "© Telekom Deutschland GmbH", | |
| desc: "Descending", | |
| details: "Details", | |
| "encrypted.main": "The data you are attempting to access are encrypted.", | |
| "error.401": "Not authorised", | |
| "error.404": "Unfortunately we could not find the site you are looking for.", | |
| "error.410": "This share link already expired.", | |
| "error.500": "An unexpected error has occurred.", | |
| "error.503": "Function temporary unavailable.", | |
| "error.expired": "The session has expired. Please log in again.", | |
| "error.password": "The password entered is invalid.", | |
| "error.password_empty": "Please enter a password.", | |
| "file.details.bitdepth": "Bit depth", | |
| "file.details.datetaken": "Date of photo", | |
| "file.details.dimensions": "Dimensions", | |
| "file.details.exposuretime": "Exposure time", | |
| "file.details.fnumber": "F-number", | |
| "file.details.focallength": "Focal length", | |
| "file.details.iso": "Iso", | |
| "file.details.manufacturer": "Camera manufacturer", | |
| "file.details.model": "Model", | |
| "file.download": "Download", | |
| "file.name": "Name", | |
| "file.size": "Size", | |
| "file.size.unit.Bytes": "Bytes", | |
| "file.size.unit.GB": "GB", | |
| "file.size.unit.KB": "KB", | |
| "file.size.unit.MB": "MB", | |
| "file.size.unit.PB": "PB", | |
| "file.size.unit.TB": "TB", | |
| "file.type": "Type", | |
| "file.type.dir": "Folders", | |
| "file.type.fileitem": "File", | |
| "filemanager.delete.error.all": "An error occurred while deleting {0} item(s).", | |
| "filemanager.delete.error.one": 'Could not delete "{0}".', | |
| "filemanager.delete.error.some": "{0} item(s) deleted. An error occurred while deleting {1} item(s).", | |
| "filemanager.delete.prompt.cancel": "Cancel", | |
| "filemanager.delete.prompt.multi": "Do you really want to delete these {0} items?", | |
| "filemanager.delete.prompt.ok": "Delete", | |
| "filemanager.delete.prompt.single": 'Do you really want to delete "{0}"?', | |
| "filemanager.deselectAll": "Cancel selection", | |
| "filemanager.dnd.invitation": "Drag your files into this area.", | |
| "filemanager.download_dir.error.404": 'The folder "{0}" no longer exists', | |
| "filemanager.download.archiveprefix": "magentacloud", | |
| "filemanager.download.error.404": 'The file "{0}" no longer exists.', | |
| "filemanager.download.error.common": 'An error occurred while loading the file "{0}".', | |
| "filemanager.downloadAll": "Download all files", | |
| "filemanager.downloadSelected": "Download selected items", | |
| "filemanager.newfolder.defaultname": "New folder", | |
| "filemanager.newfolder.error.common": "An error occurred when creating the new folder.", | |
| "filemanager.noFiles": "This folder is empty.", | |
| "filemanager.selectall": "Select all", | |
| "filesviewer.close": "Close", | |
| "fileview.default.button.download": "Download", | |
| "fileview.default.changed": "{0}, modified on {1}", | |
| "fileview.default.text": "Cannot display file.", | |
| "fileview.default.timeFormat": "M d. Y", | |
| "folder.loaderror.common": 'An error occurred while loading "{0}".', | |
| "format.decimal": ".", | |
| "format.thousand": ",", | |
| "header.teaser.import.button": "Import now", | |
| "header.teaser.import.text": "You can save the received share in your MagentaCLOUD.", | |
| "header.teaser.text1": "Welcome to {0}.", | |
| "header.teaser.text2": "There is still room for you!", | |
| "header.teaser.url": "https://cloud.telekom-dienste.de", | |
| "help.and.faq.title": "Help & FAQ", | |
| "help.and.faq.url": "https://cloud.telekom-dienste.de/hilfe", | |
| "imprint.title": "Publication details", | |
| "imprint.url": "http://www.telekom.de/impressum", | |
| "js.activate": "Please activate JavaScript to use MagentaCLOUD in your web browser.", | |
| "lang.monthsList.short": "Jan.,Feb.,Mar.,Apr.,May,Jun.,Jul.,Aug.,Sep.,Oct.,Nov.,Dec.", | |
| "lang.name": "English", | |
| "lang.timeFormat": "m/d/y H:i", | |
| "login.accept": "Login", | |
| "login.header": "This share is password protected.", | |
| "login.passwordLabel": "Password", | |
| "menubar.delete": "Delete", | |
| "menubar.newfolder": "New folder", | |
| "menubar.select": "Select", | |
| "menubar.select.download": "Download", | |
| "menubar.unselect": "Cancel", | |
| "menubar.upload": "Upload", | |
| "pdfview.documenttoolbar.page": "Page", | |
| "poweredBy.url": "https://cloud.telekom-dienste.de/hilfe?frage=erste-schritte-strato", | |
| "privacy.title": "Data protection", | |
| "privacy.url": "http://www.telekom.de/datenschutz", | |
| "statusbar.delete": "Delete", | |
| "statusbar.download": "Download", | |
| "teaser.register.text": "More information", | |
| "teaser.register.url": "https://cloud.telekom-dienste.de/", | |
| "teaser.text": "{0} is the safe and free online storage of Telekom. Ideal for your photos, videos and any other files that you want to store safely. Upload your data directly from your smartphone, tablet or PC and retrieve them from anywhere or share them easily with family and friends.", | |
| "tmcshare.logo.text1": "Magenta", | |
| "tmcshare.logo.text2": "CLOUD", | |
| "upload.detail.cancelAll": "Cancel all", | |
| "upload.detail.close": "Close", | |
| "upload.detail.item.status.aborted": "— Canceled", | |
| "upload.detail.item.status.transferred": "{0} of {1}", | |
| "upload.detail.moreuploads": "Upload additional files", | |
| "upload.detail.title.done.multi": "Uploaded", | |
| "upload.detail.title.done.single": "Uploaded", | |
| "upload.detail.title.progress.multi": "Uploading {1} files…", | |
| "upload.detail.title.progress.single": "Uploading 1 file...", | |
| "viewAndSorting.date": "Date", | |
| "viewAndSorting.name": "Name", | |
| "viewAndSorting.size": "Size", | |
| "viewAndSorting.sortedBy": "Sort according to", | |
| "viewAndSorting.title": "View", | |
| "viewAndSorting.type": "Type" | |
| } | |
| } | |
| }), | |
| define("lang/models/langModel", ["underscore", "backbone"], function(e, t) { | |
| return t.Model.extend({ | |
| storageKey: "lang", | |
| initialize: function(e) { | |
| this._languageFileData = e | |
| }, | |
| setLang: function(t) { | |
| if (!t) | |
| throw new Error("no language given to set in langModel"); | |
| var n = this._languageFileData; | |
| if (!(t in n)) | |
| throw new Error('Language "' + t + '" is not defined in languageFileData'); | |
| if (!e.keys(n[t]).length) | |
| throw new Error('No keys in language "' + t + '" defined'); | |
| this.language = t, | |
| this.clear({ | |
| silent: !0 | |
| }), | |
| this.set(n[this.language]) | |
| }, | |
| getLang: function() { | |
| return this.language | |
| }, | |
| getLanguages: function() { | |
| return e.keys(this._languageFileData) | |
| }, | |
| get: function(t, n) { | |
| var r, i = this.attributes[t], s, o, u, a; | |
| if (!i) | |
| return "MISSING PROPERTY '" + t + "' in language '" + this.language + "'"; | |
| s = i.match(/{\d+}/g); | |
| if (!s) | |
| return i; | |
| if (e.isUndefined(n)) | |
| return "MISSING ALL VALUES FOR '" + i + "'"; | |
| e.isArray(n) || (n = [n]), | |
| o = e.map(s, function(e) { | |
| return parseInt(e.substring(1), 10) | |
| }), | |
| u = e.max(o) + 1 - n.length; | |
| if (u > 0) | |
| return "MISSING " + u + " VALUE(S) FOR '" + i + "'"; | |
| for (r = 0; r < s.length; r++) | |
| a = o[r], | |
| e.isUndefined(n[a]) || (i = i.replace(s[r], n[a])); | |
| return i | |
| }, | |
| exists: function(t) { | |
| return e.has(this.attributes, t) | |
| }, | |
| bind: function(t, n) { | |
| return e.bind(this.get, this, t, n) | |
| }, | |
| getInLang: function(e, t) { | |
| var n = this._languageFileData; | |
| if (!n[t]) | |
| throw new Error("language '" + t + "' not defined in getInLang()"); | |
| if (!n[t][e]) | |
| throw new Error("key not defined: " + t + "/" + e); | |
| return n[t][e] | |
| } | |
| }) | |
| }), | |
| define("lang/main", ["json!languageFiles/languageFile.json", "./models/langModel"], function(e, t) { | |
| return new t(e) | |
| }), | |
| define("lang", ["lang/main"], function(e) { | |
| return e | |
| }), | |
| define("modules/window", [], function() { | |
| function e() { | |
| return window.URL && window.URL.createObjectURL ? window.URL.createObjectURL : null | |
| } | |
| return { | |
| setLocation: function(e) { | |
| window.location.href = e | |
| }, | |
| getLocation: function() { | |
| return window.location | |
| }, | |
| getPathname: function() { | |
| return window.location.pathname | |
| }, | |
| open: function(e, t) { | |
| window.open(e, t || "_blank") | |
| }, | |
| getAnchor: function() { | |
| var e = window.location.href; | |
| return /#[^#]+$/.test(e) ? e.split("#")[1] : "" | |
| }, | |
| getNavigatorLang: function() { | |
| var e = window.navigator; | |
| return e.language || e.userLanguage || null | |
| }, | |
| isCreateObjectURLSpported: function() { | |
| return !!e() | |
| }, | |
| createObjectURL: function(t) { | |
| var n = e(); | |
| if (!n) | |
| throw new Error("createObjectURL() not supported"); | |
| return n(t) | |
| }, | |
| getViewportHeight: function() { | |
| return document.body.clientHeight | |
| }, | |
| getDocumentScrollHeight: function() { | |
| return document.body.scrollHeight | |
| }, | |
| getDocumentScrollTop: function() { | |
| return document.body.scrollTop | |
| }, | |
| setTitle: function(e) { | |
| document.title = e | |
| } | |
| } | |
| }), | |
| define("lang/views/langToggleView", ["jquery", "backbone", "lang"], function(e, t, n) { | |
| var r = t.View.extend({ | |
| tagName: "span", | |
| className: "language-toggle", | |
| events: { | |
| click: "onSelect" | |
| }, | |
| render: function() { | |
| var e = n.getLanguages() | |
| , t = e[(e.indexOf(n.getLang()) + 1) % e.length]; | |
| return this.$el.html(n.getInLang("lang.name", t)).attr("data-lang", t), | |
| this | |
| }, | |
| onSelect: function(t) { | |
| var n = e(t.currentTarget).attr("data-lang"); | |
| this.trigger("selected", n) | |
| } | |
| }); | |
| return r | |
| }), | |
| define("base/object", ["underscore", "backbone"], function(e, t) { | |
| var n = function() { | |
| this.cid = e.uniqueId(this.cidPrefix), | |
| this.initialize.apply(this, arguments) | |
| }; | |
| return e.extend(n.prototype, t.Events, { | |
| cidPrefix: "o", | |
| initialize: function() {} | |
| }), | |
| n.extend = t.Model.extend, | |
| n | |
| }), | |
| define("formatters", ["underscore", "lang"], function(e, t) { | |
| function r(e) { | |
| return ("0" + e).slice(-2) | |
| } | |
| function i(e) { | |
| switch (e) { | |
| case 0: | |
| return t.get("file.size.unit.Bytes"); | |
| case 1: | |
| return t.get("file.size.unit.KB"); | |
| case 2: | |
| return t.get("file.size.unit.MB"); | |
| case 3: | |
| return t.get("file.size.unit.GB"); | |
| case 4: | |
| return t.get("file.size.unit.TB"); | |
| default: | |
| return t.get("file.size.unit.PB") | |
| } | |
| } | |
| function s(e) { | |
| var n, r, i, s = ""; | |
| if (typeof e != "number" || isNaN(e)) | |
| return s; | |
| n = e.toString().split("."), | |
| r = t.get("format.thousand"), | |
| s = n[0]; | |
| if (r && s.length > 3) { | |
| i = /(\d+)(\d{3})/; | |
| while (i.test(s)) | |
| s = s.replace(i, "$1" + r + "$2") | |
| } | |
| return n.length > 1 && (s += t.get("format.decimal") + n[1]), | |
| s | |
| } | |
| var n = { | |
| d: function(e) { | |
| return r(e.getDate()) | |
| }, | |
| j: function(e) { | |
| return e.getDate() | |
| }, | |
| m: function(e) { | |
| return r(e.getMonth() + 1) | |
| }, | |
| F: function(e) { | |
| return t.get("lang.monthsList.long").split(",")[e.getMonth()] | |
| }, | |
| M: function(e) { | |
| return t.get("lang.monthsList.short").split(",")[e.getMonth()] | |
| }, | |
| n: function(e) { | |
| return e.getMonth() + 1 | |
| }, | |
| Y: function(e) { | |
| return e.getFullYear() | |
| }, | |
| y: function(e) { | |
| return ("" + e.getFullYear()).substr(2) | |
| }, | |
| a: function(e) { | |
| return e.getHours() < 12 ? "am" : "pm" | |
| }, | |
| A: function(e) { | |
| return e.getHours() < 12 ? "AM" : "PM" | |
| }, | |
| g: function(e) { | |
| return e.getHours() % 12 || 12 | |
| }, | |
| G: function(e) { | |
| return e.getHours() | |
| }, | |
| h: function(e) { | |
| return r(e.getHours() % 12 || 12) | |
| }, | |
| H: function(e) { | |
| return r(e.getHours()) | |
| }, | |
| i: function(e) { | |
| return r(e.getMinutes()) | |
| }, | |
| s: function(e) { | |
| return r(e.getSeconds()) | |
| } | |
| }; | |
| return { | |
| date: function(e, t) { | |
| e = Number(e); | |
| if (isNaN(e)) | |
| throw new Error("time input parameter is not a number"); | |
| if (typeof t == "undefined") | |
| throw new Error("formatstring missing"); | |
| t = String(t); | |
| var r = new Date(e * 1e3); | |
| return t.replace(/[djmnYyaAgGhHisFM]/g, function(e) { | |
| return e in n ? n[e](r) : e.substring(1) | |
| }) | |
| }, | |
| size: function(e, t) { | |
| var n = t ? t : 1 | |
| , r = parseInt(Math.floor(Math.log(Math.max(e, n)) / Math.log(1024)), 10); | |
| if (isNaN(e)) | |
| throw new Error("input parameter is not a number"); | |
| return r === 0 ? s(e) + " " + i(0) : s(Math.round(e / Math.pow(1024, r) * 10) / 10) + " " + i(r) | |
| }, | |
| number: s, | |
| escapedBreakable: function(t) { | |
| return e.escape(this.breakable(t)) | |
| }, | |
| breakable: function(e) { | |
| return e.split("").join("") | |
| } | |
| } | |
| }), | |
| define("modules/config", ["underscore", "base/object"], function(e, t) { | |
| return t.extend({ | |
| initialize: function() { | |
| this.config = e.clone(window.Config || {}) | |
| }, | |
| get: function(e) { | |
| return this.config[e] | |
| } | |
| }) | |
| }), | |
| define("modules/configInst", ["modules/config"], function(e) { | |
| return new e | |
| }), | |
| define("base/view", ["underscore", "backbone", "lang", "formatters", "modules/configInst"], function(e, t, n, r, i) { | |
| return t.View.extend({ | |
| constructor: function(n) { | |
| e.has(n, "template") && (this.template = n.template), | |
| e.has(n, "subviews") && (this.subviews = n.subviews), | |
| e.has(n, "templateData") && (this.templateData = n.templateData), | |
| this._subviews = {}, | |
| t.View.apply(this, arguments), | |
| this._buildSubviews() | |
| }, | |
| empty: function() { | |
| this.el.innerHTML = "" | |
| }, | |
| renderTemplate: function() { | |
| if (!this.template) | |
| return this; | |
| var t = this.template | |
| , s = { | |
| lang: n, | |
| formatters: r, | |
| config: i | |
| } | |
| , o = {}; | |
| return this.model && (s.model = this.model), | |
| this.collection && (s.collection = this.collection), | |
| o = e.extend(s, e.result(this, "templateData", {})), | |
| e.isFunction(t) && (t = t.call(this, o)), | |
| this.el.innerHTML = t, | |
| this | |
| }, | |
| renderSubviews: function() { | |
| return e.each(this._subviews, function(e) { | |
| if (e.target) { | |
| var t = this.$(e.target), n; | |
| t.length && (n = e.view.render().$el, | |
| e.appendToTarget ? t.append(n) : t.replaceWith(n)) | |
| } | |
| }, this), | |
| this | |
| }, | |
| registerSubview: function(e, t, n) { | |
| return this._registerSubviewByName(e.cid, e, t, n), | |
| this | |
| }, | |
| getSubview: function(t) { | |
| return e.has(this._subviews, t) ? this._subviews[t].view : null | |
| }, | |
| render: function() { | |
| return this.onBeforeRender(), | |
| this.renderTemplate(), | |
| this.renderSubviews(), | |
| this.onAfterRender(), | |
| this | |
| }, | |
| remove: function() { | |
| return this._removeSubviews(), | |
| t.View.prototype.remove.call(this) | |
| }, | |
| onBeforeRender: function() {}, | |
| onAfterRender: function() {}, | |
| _buildSubviews: function() { | |
| var t = e.result(this, "subviews", {}); | |
| e.isEmpty(t) || e.each(t, function(t, n) { | |
| var r = new t.klass(t.options || {}); | |
| e.each(t.listeners || {}, function(e, t) { | |
| this.listenTo(r, t, e) | |
| }, this), | |
| this._registerSubviewByName(n, r, t.target, t.appendToTarget) | |
| }, this) | |
| }, | |
| _registerSubviewByName: function(e, t, n, r) { | |
| this._subviews[e] = { | |
| view: t, | |
| target: n, | |
| appendToTarget: !!r | |
| } | |
| }, | |
| _removeSubviews: function() { | |
| e.each(this._subviews, function(e) { | |
| var t = e.view; | |
| this.stopListening(t), | |
| t.remove() | |
| }, this), | |
| this._subviews = {} | |
| } | |
| }) | |
| }), | |
| define("base/viewSwitcher", ["underscore", "backbone"], function(e, t) { | |
| return t.View.extend({ | |
| initialize: function(t) { | |
| if (!e.isObject(t)) | |
| throw new Error("No or invalid options where provided"); | |
| if (!e.has(t, "subviews") || !e.keys(t.subviews).length) | |
| throw new Error("No subviews defined in ViewSwitcher"); | |
| if (!e.has(t, "defaultView")) | |
| throw new Error("No default view defined in ViewSwitcher"); | |
| if (!e.has(t.subviews, t.defaultView)) | |
| throw new Error("Defined default does not exist in subviews"); | |
| this.viewsConfig = t.subviews, | |
| this.views = {}, | |
| this.keepInstances = !!t.keepInstances, | |
| this.current = this.defaultView = t.defaultView | |
| }, | |
| getCurrentViewName: function() { | |
| return this.current | |
| }, | |
| show: function(e, t) { | |
| if (t || e !== this.current) | |
| this.current = e, | |
| this._renderCurrentView(); | |
| return this.currentView | |
| }, | |
| showDefault: function() { | |
| return this.show(this.defaultView) | |
| }, | |
| render: function() { | |
| return this.current = this.defaultView, | |
| this._renderCurrentView(), | |
| this | |
| }, | |
| clear: function() { | |
| return this.current = null, | |
| this._clearCurrentView(), | |
| this | |
| }, | |
| _renderCurrentView: function() { | |
| var t = this.viewsConfig[this.current], n; | |
| this._clearCurrentView(), | |
| e.has(this.views, this.current) || (this.views[this.current] = new t.klass(e.result(t, "options"))), | |
| n = this.currentView = this.views[this.current], | |
| e.each(t.listeners || {}, function(e, t) { | |
| this.listenTo(n, t, e) | |
| }, this), | |
| this.$el.contents().detach(), | |
| this.$el.append(n.render().$el) | |
| }, | |
| _clearCurrentView: function() { | |
| this.currentView && (this.stopListening(this.currentView), | |
| this.keepInstances || (this.currentView.remove(), | |
| this.views = {}), | |
| this.currentView = null) | |
| }, | |
| remove: function() { | |
| e.invoke(this.views, "remove"), | |
| this.views = null, | |
| this.currentView = null, | |
| t.View.prototype.remove.apply(this, arguments) | |
| } | |
| }) | |
| }), | |
| define("base/main", ["./object", "./view", "./viewSwitcher"], function(e, t, n) { | |
| return { | |
| Object: e, | |
| View: t, | |
| ViewSwitcher: n | |
| } | |
| }), | |
| define("base", ["base/main"], function(e) { | |
| return e | |
| }), | |
| define("modules/constants", [], function() { | |
| return { | |
| statusPages: { | |
| ssoError: "sso.error", | |
| mailSuccess: "mail.success", | |
| mailError: "mail.error" | |
| }, | |
| userFields: ["alias", "account", "email", "descr", "language", "statusmail", "is_admin", "is_owner", "home", "home_id"].join(","), | |
| authContext: { | |
| "default": "default", | |
| deviceBackups: "deviceBackups", | |
| sharePrefix: "share-", | |
| shareLinkPrefix: "lnk-" | |
| }, | |
| deviceBackups: { | |
| statusValid: "valid", | |
| statusInvalid: "invalid", | |
| statusRunning: "running", | |
| trashFolder: ".trash" | |
| }, | |
| authRefreshTime: 27e5, | |
| doubleClickDelay: 301 | |
| } | |
| }), | |
| define("auth/registry", ["underscore", "modules/constants"], function(e, t) { | |
| var n = function() { | |
| this._registered = [], | |
| this._instances = {} | |
| }; | |
| return e.extend(n.prototype, { | |
| register: function(t, n) { | |
| if (!e.isString(t) && !e.isRegExp(t)) | |
| throw new Error("matcher argument needs to be a string or regex."); | |
| if (!e.isFunction(n)) | |
| throw new Error("factory argument needs to be function."); | |
| e.isRegExp(t) || (t = new RegExp("^" + t + "$")), | |
| this._registered.push([t, n]) | |
| }, | |
| get: function(n) { | |
| var r; | |
| n = n || t.authContext.default, | |
| r = e.find(this._registered, function(e) { | |
| return e[0].test(n) | |
| }); | |
| if (!r) | |
| throw new Error('no auth class for context "' + n + '" found.'); | |
| return this._instances[n] || (this._instances[n] = r[1](n)), | |
| this._instances[n] | |
| } | |
| }), | |
| n | |
| }), | |
| define("auth/main", ["./registry"], function(e) { | |
| return new e | |
| }), | |
| define("auth", ["auth/main"], function(e) { | |
| return e | |
| }), | |
| define("api/helpers/sync", ["jquery", "underscore", "backbone", "auth"], function(e, t, n, r) { | |
| var i = { | |
| create: "POST", | |
| update: "PUT", | |
| "delete": "DELETE", | |
| read: "GET" | |
| }; | |
| return function(e, n, s) { | |
| var o, u; | |
| if (!i[e]) | |
| throw new Error("Undefined method '" + e + "'."); | |
| o = { | |
| type: i[e], | |
| dataType: "json" | |
| }; | |
| if (!s.url) { | |
| o.url = t.result(this, "url"); | |
| if (!o.url) | |
| throw new Error("No 'url' attribute or function defined") | |
| } | |
| return n && t.contains(["create", "update", "patch"], e) && (o.contentType = "application/json", | |
| o.data = JSON.stringify(s.attrs || n.toJSON(s))), | |
| u = s.xhr = r.get(n.getContext()).ajax(t.extend(o, s)), | |
| n.trigger("request", n, u, s || {}), | |
| u | |
| } | |
| }), | |
| define("api/helpers/encoding", [], function() { | |
| return { | |
| urlDecode: function(e) { | |
| try { | |
| return decodeURIComponent(e) | |
| } catch (t) { | |
| try { | |
| return unescape(e) | |
| } catch (n) { | |
| return e | |
| } | |
| } | |
| } | |
| } | |
| }), | |
| define("api/models/baseModel", ["jquery", "underscore", "backbone", "auth", "../helpers/sync", "../helpers/encoding", "modules/constants"], function(e, t, n, r, i, s, o) { | |
| return n.Model.extend({ | |
| initialize: function(e, t) { | |
| this._context = (t || {}).context || o.authContext.default | |
| }, | |
| getContext: function() { | |
| return this._context | |
| }, | |
| clone: function() { | |
| return new this.constructor(this.attributes,{ | |
| context: this.getContext() | |
| }) | |
| }, | |
| sync: function() { | |
| return i.apply(this, arguments) | |
| }, | |
| urlDecode: function(e) { | |
| return this.has(e) ? s.urlDecode(this.get(e)) : !1 | |
| } | |
| }) | |
| }), | |
| define("api/helpers/filegroups", ["underscore"], function(e) { | |
| var t = { | |
| thumb: ["bmp", "gif", "jpeg", "jpg", "png"], | |
| image: ["ai", "cdr", "eps", "nef", "ps", "psd", "raw", "svg", "tif"], | |
| audio: ["aac", "aif", "ape", "flac", "m4a", "mid", "mp3", "ram", "ra", "wav", "wma"], | |
| video: ["avi", "flv", "mkv", "mov", "mp4", "mpg", "mpeg", "ogg", "ogv", "qt", "rm", "rmvb", "rv", "swf", "webm", "wmv"], | |
| archive: ["dmg", "img", "iso", "mdf"], | |
| compressed: ["bz2", "bzip", "chm", "gz", "rar", "rpm", "tar", "tgz", "zip"], | |
| document: ["doc", "docm", "docx", "dot", "dotm", "dotx", "odt", "pgs", "rtf", "sxw"], | |
| text: ["txt"], | |
| pdf: ["pdf"], | |
| slide: ["key", "odp", "pot", "potm", "potx", "ppam", "pps", "ppsm", "ppsx", "ppt", "pptm", "pptx", "sldm", "sldx", "thmx"], | |
| spreadsheet: ["csv", "num", "ods", "sxc", "xlam", "xls", "xlsb", "xlsm", "xlsx", "xlt", "xltm", "xltx"], | |
| code: ["css", "htm", "html", "js", "php", "pl", "pm", "rb", "sh", "vb", "xml"], | |
| system: ["app", "bat", "com", "dll", "exe"] | |
| } | |
| , n = {}; | |
| return e.each(t, function(t, r) { | |
| e.each(t, function(e) { | |
| n[e] = r | |
| }) | |
| }), | |
| { | |
| get: function(e) { | |
| return e = String(e), | |
| n[e.toLowerCase()] || "default" | |
| } | |
| } | |
| }), | |
| define("api/models/fileModel", ["underscore", "./baseModel", "../helpers/encoding", "../helpers/filegroups"], function(e, t, n, r) { | |
| return t.extend({ | |
| defaults: { | |
| name: "", | |
| type: "", | |
| path: "", | |
| width: 0, | |
| height: 0 | |
| }, | |
| pathSeparator: "/", | |
| isDir: function() { | |
| return this.get("type") === "dir" | |
| }, | |
| isSymlink: function() { | |
| return this.get("type") === "symlink" | |
| }, | |
| getPid: function() { | |
| return this.id | |
| }, | |
| getItemType: function() { | |
| return "FileItem-" + this.getContext() | |
| }, | |
| parse: function(t) { | |
| var i = e.clone(t), s, o, u = ""; | |
| return i.path = i.path || "", | |
| this.pathSeparator ? (s = i.path.split(this.pathSeparator), | |
| i.name = e.last(s), | |
| s[0] === "root" && (s.shift(), | |
| s.unshift("")), | |
| i.path = s.join(this.pathSeparator)) : i.name = i.path, | |
| i.type === "dir" ? i.group = "dir" : i.type === "symlink" ? i.group = "symlink" : (o = i.name.lastIndexOf("."), | |
| o > 0 && o < i.name.length - 1 ? (u = i.name.substr(o + 1), | |
| i.group = r.get(u)) : i.group = "default"), | |
| i.ext = u, | |
| i.isTempUploadFile = i.ext === "webupload", | |
| i.display_name = n.urlDecode(i.name), | |
| i.base_name = i.group === "dir" ? i.display_name : i.display_name.replace(/(.+)\.[^\.]+$/, "$1"), | |
| i | |
| }, | |
| setName: function(t) { | |
| var n = this.get("path"); | |
| n = n.split("/").slice(0, -1).join("/"), | |
| n += "/" + encodeURIComponent(t), | |
| this.set(this.parse(e.extend({}, this.attributes, { | |
| path: n | |
| }))) | |
| }, | |
| getMeta: function(e) { | |
| var t = require("api"); | |
| return t.getMeta({ | |
| context: this.getContext(), | |
| pid: this.getPid(), | |
| fields: e | |
| }) | |
| } | |
| }) | |
| }), | |
| define("api/models/shareItem", ["jquery", "underscore", "auth", "./fileModel", "modules/window"], function(e, t, n, r, i) { | |
| return r.extend({ | |
| getPid: function() { | |
| return this.get("pid") | |
| }, | |
| getItemType: function() { | |
| return "ShareItem" | |
| }, | |
| parse: function(e) { | |
| return t.has(e, "file_type") && (e.type = e.file_type), | |
| e = r.prototype.parse.apply(this, arguments), | |
| e.type === "file" && typeof e.remaining == "undefined" && e.maxcount && (e.remaining = e.maxcount - (e.count || 0)), | |
| e | |
| }, | |
| removeShare: function() { | |
| var t = this.get("share_type") === "sharedir" ? "/api/share" : "/api/sharelink" | |
| , r = new e.Deferred; | |
| return n.get().ajax({ | |
| type: "DELETE", | |
| url: t, | |
| data: { | |
| id: this.get("id") | |
| } | |
| }).done(function(e) { | |
| r.resolve(e) | |
| }).fail(function(e, t, n) { | |
| e.status === 404 ? r.resolve("") : r.reject(e, t, n) | |
| }), | |
| r | |
| }, | |
| updateShare: function(e) { | |
| var r, i = t.extend({}, { | |
| id: this.get("id") | |
| }, e); | |
| return this.get("share_type") === "sharelink" ? r = "/api/sharelink" : r = "/api/share", | |
| n.get().ajax({ | |
| type: "PUT", | |
| url: r, | |
| data: i | |
| }).done(t.bind(function(e) { | |
| t.extend(e, { | |
| type: this.get("type") | |
| }), | |
| e = this.parse(e), | |
| this.set(e); | |
| var n = t.pick(this.omit(t.keys(e)), "has_password", "password", "ttl", "maxcount", "remaining"); | |
| this.set(n, { | |
| unset: !0 | |
| }) | |
| }, this)) | |
| }, | |
| getPreviewUri: function() { | |
| var e = i.getLocation() | |
| , t = e.protocol + "//" + e.host + e.pathname.replace(/\/$/, ""); | |
| return t += this.get("share_type") === "sharedir" ? "/share/" : "/lnk/", | |
| t += this.id, | |
| t | |
| }, | |
| invite: function(r, i, s) { | |
| var o, u; | |
| t.isArray(r) || (r = [r]), | |
| r = t.filter(r, function(e) { | |
| return typeof e == "string" | |
| }); | |
| if (!r.length) | |
| throw new Error("no emails given for invite"); | |
| if (i && !t.isString(i)) | |
| throw new Error("msg should be a string"); | |
| return u = { | |
| id: this.get("id"), | |
| recipient: r, | |
| msg: i | |
| }, | |
| s && t.isString(s.lang) && (u.lang = s.lang), | |
| this.get("share_type") === "sharelink" ? o = "/api/sharelink/invite" : o = "/api/share/invite", | |
| n.get().ajax({ | |
| type: "POST", | |
| url: o, | |
| traditional: !0, | |
| data: u | |
| }).then(t.bind(function(t, n, r) { | |
| return t && t.failed && t.failed.length ? e.Deferred().reject(r, "error", "error") : (this.trigger("invite:success"), | |
| e.Deferred().resolve(t, n, r)) | |
| }, this)).then(null, t.bind(function(e) { | |
| var n = e.responseJSON || { | |
| done: [], | |
| failed: [] | |
| } | |
| , r = { | |
| done: t.pluck(n.done, "to"), | |
| failed: t.pluck(n.failed, "to") | |
| }; | |
| return this.trigger("invite:error", r), | |
| r | |
| }, this)) | |
| } | |
| }) | |
| }), | |
| define("api/models/externalShareModel", ["./shareItem", "underscore"], function(e, t) { | |
| return e.extend({ | |
| pathSeparator: null, | |
| parse: function(t) { | |
| return t.path = String(t.label), | |
| t.share_type = t.type, | |
| t.type = t.share_type === "sharedir" ? "dir" : "file", | |
| e.prototype.parse.call(this, t) | |
| }, | |
| setName: function(e) { | |
| this.set(this.parse(t.extend({}, this.attributes, { | |
| label: e | |
| }))) | |
| } | |
| }) | |
| }), | |
| define("api/apiWrapper.addExternalShare", ["jquery", "underscore", "auth", "api/models/externalShareModel"], function(e, t, n, r) { | |
| return { | |
| addExternalShare: function(i, s, o) { | |
| var u = e.Deferred(); | |
| if (!t.isString(i)) | |
| throw new Error("addExternalShare requires share-id"); | |
| if (!t.isString(s)) | |
| throw new Error("addExternalShare requires share-type"); | |
| if (s !== "sharedir" && s !== "sharelink") | |
| throw new Error("sharelink or sharedir required for share-type"); | |
| return n.get().ajax({ | |
| url: "/api/share/external", | |
| method: "POST", | |
| data: t.extend({}, o, { | |
| id: i, | |
| type: s | |
| }) | |
| }).done(t.bind(function(e) { | |
| var t = new r(e,{ | |
| parse: !0 | |
| }); | |
| this.trigger("addExternalShare:added", t), | |
| u.resolve() | |
| }, this)).fail(function(e) { | |
| e.status === 409 ? u.resolve() : u.reject(e) | |
| }), | |
| u.promise() | |
| } | |
| } | |
| }), | |
| define("api/apiWrapper.copyFiles", ["jquery", "underscore", "auth", "api/models/fileModel"], function(e, t, n, r) { | |
| return { | |
| copyFiles: function(i, s) { | |
| var o = this | |
| , u = t.pluck(s, "id") | |
| , a = [] | |
| , f = [] | |
| , l = e.Deferred() | |
| , c = i.getContext(); | |
| if (t.some(s, function(e) { | |
| return e.getContext() !== c | |
| })) | |
| throw new Error("context of source and target must be the same in copyFiles"); | |
| return n.get(c).ajax({ | |
| method: "POST", | |
| url: "/api/fs/copy", | |
| traditional: !0, | |
| data: { | |
| src_id: u, | |
| dst_id: i.get("id"), | |
| on_exist: "autoname" | |
| } | |
| }).done(function(e) { | |
| a = t.map(e.done, function(e) { | |
| return new r(e,{ | |
| parse: !0, | |
| context: c | |
| }) | |
| }), | |
| f = t.map(e.failed, function(e) { | |
| return t.find(s, function(t) { | |
| return t.get("id") === e.src_id | |
| }) | |
| }), | |
| o.trigger("copyFiles:done", i.get("path"), a), | |
| f.length > 0 ? o.trigger("copyFiles:error", f, a) : o.trigger("copyFiles:success", i, a), | |
| a.length === 0 ? l.reject(f) : l.resolve(f, a) | |
| }).fail(function() { | |
| f = s, | |
| o.trigger("copyFiles:error", f, []), | |
| l.reject(f) | |
| }), | |
| l.promise() | |
| } | |
| } | |
| }), | |
| define("api/apiWrapper.deleteExternalShare", ["jquery", "underscore", "auth", "api/models/externalShareModel"], function(e, t, n, r) { | |
| return { | |
| deleteExternalShare: function(i) { | |
| var s = e.Deferred(); | |
| if (i instanceof r) | |
| return this.trigger("deleteExternalShare:start", i), | |
| n.get().ajax({ | |
| method: "DELETE", | |
| url: "/api/share/external", | |
| data: { | |
| id: i.get("id"), | |
| type: i.get("share_type") | |
| } | |
| }).done(t.bind(function() { | |
| this.trigger("deleteExternalShare:success", i), | |
| s.resolve(i) | |
| }, this)).fail(t.bind(function(e) { | |
| e.status === 404 ? (this.trigger("deleteExternalShare:success", i), | |
| s.resolve(i)) : (this.trigger("deleteExternalShare:error", i), | |
| s.reject(i, e)) | |
| }, this)), | |
| s.promise(); | |
| throw new Error("deleteExternalShare requires an ExternalShareModel") | |
| } | |
| } | |
| }), | |
| define("modules/deleteList", ["underscore", "backbone", "base"], function(e, t, n) { | |
| return n.Object.extend({ | |
| initialize: function() { | |
| this.queues = {} | |
| }, | |
| _checkType: function(t) { | |
| return e.isString(t) | |
| }, | |
| _checkArray: function(t) { | |
| return e.isArray(t) | |
| }, | |
| _testForInvalidModels: function(n) { | |
| var r = e.find(n, function(e) { | |
| return !(e instanceof t.Model) | |
| }); | |
| return !!r | |
| }, | |
| _getQueue: function(e) { | |
| return this.queues[e] || (this.queues[e] = new t.Collection), | |
| this.queues[e] | |
| }, | |
| _remove: function(t, n, r) { | |
| var i = { | |
| silent: !0 | |
| }; | |
| return n = e.compact(this._getQueue(t).remove(n, i)), | |
| n.length && this.trigger(r, t, n), | |
| n | |
| }, | |
| add: function(t, n) { | |
| var r = { | |
| silent: !0 | |
| }, i; | |
| if (!this._checkType(t)) | |
| throw new Error("invalid type in DeleteList.add()"); | |
| if (!this._checkArray(n)) | |
| throw new Error("no models array given in DeleteList.add()"); | |
| if (this._testForInvalidModels(n)) | |
| throw new Error("not only models in array given in DeleteList.add()"); | |
| return i = e.map(n, function(e) { | |
| return e.clone() | |
| }), | |
| i = this._getQueue(t).add(i, r), | |
| this.trigger("added", t, i), | |
| i | |
| }, | |
| recover: function(e, t) { | |
| if (!this._checkType(e)) | |
| throw new Error("invalid type in DeleteList.recover()"); | |
| if (!this._checkArray(t)) | |
| throw new Error("no models array given in DeleteList.recover()"); | |
| return this._remove(e, t, "recovered") | |
| }, | |
| drop: function(e, t) { | |
| if (!this._checkType(e)) | |
| throw new Error("invalid type in DeleteList.drop()"); | |
| if (!this._checkArray(t)) | |
| throw new Error("no models array given in DeleteList.drop()"); | |
| return this._remove(e, t, "dropped") | |
| }, | |
| findByType: function(t, n) { | |
| if (!this._checkType(t)) | |
| throw new Error("invalid type in DeleteList.findByType()"); | |
| if (e.isUndefined(n)) | |
| throw new Error("missing model in DeleteList.findByType()"); | |
| return this._getQueue(t).get(n) | |
| }, | |
| filterByType: function(t, n) { | |
| var r; | |
| if (!this._checkType(t)) | |
| throw new Error("invalid type in DeleteList.filterByType()"); | |
| return typeof n == "function" ? r = e.filter(this._getQueue(t).models, n) : r = e.where(this._getQueue(t).models, n), | |
| r | |
| } | |
| }) | |
| }), | |
| define("deleteListInst", ["modules/deleteList"], function(e) { | |
| return new e | |
| }), | |
| define("api/apiWrapper.deleteFiles", ["jquery", "underscore", "auth", "deleteListInst"], function(e, t, n, r) { | |
| return { | |
| deleteFiles: function(i) { | |
| var s = this, o, u = e.Deferred(), a; | |
| if (!t.isArray(i)) | |
| throw new Error("deleteFiles accepts only an array"); | |
| if (i.length === 0) | |
| return u.resolve([], []), | |
| u.promise(); | |
| a = i[0].getContext(), | |
| o = i[0].getItemType(); | |
| if (t.some(i, function(e) { | |
| return e.getContext() !== a | |
| })) | |
| throw new Error("context of all files must be the same in deleteFiles"); | |
| if (t.some(i, function(e) { | |
| return e.getItemType() !== o | |
| })) | |
| throw new Error("itemType of all files must be the same in deleteFiles"); | |
| return i = r.add(o, i), | |
| n.get(a).ajax({ | |
| url: "/api/fs/delete", | |
| method: "POST", | |
| data: { | |
| pid: t.pluck(i, "id"), | |
| recursive: !0 | |
| }, | |
| traditional: !0 | |
| }).always(function(e) { | |
| var n = [] | |
| , a = []; | |
| e.responseJSON && (e = e.responseJSON), | |
| e.done && e.failed ? (t.each(e.failed, function(e) { | |
| e.code === "404" ? a.push(t.find(i, { | |
| id: e.id | |
| })) : n.push(t.find(i, { | |
| id: e.id | |
| })) | |
| }), | |
| t.each(e.done, function(e) { | |
| a.push(t.find(i, { | |
| id: e.id | |
| })) | |
| })) : n = i, | |
| a.length && r.drop(o, a), | |
| n.length && r.recover(o, n), | |
| n.length && s.trigger("deleteFiles:error", n, a), | |
| a.length ? u.resolve(n, a) : u.reject(n) | |
| }), | |
| u.promise() | |
| } | |
| } | |
| }), | |
| define("api/models/shareLinkModel", ["jquery", "underscore", "./fileModel"], function(e, t, n) { | |
| return n.extend({ | |
| pathSeparator: null, | |
| parse: function(e, r) { | |
| return e.path = e.name, | |
| e.type = "file", | |
| e.ttl > 0 && (e.expirytime = Date.now() / 1e3 + e.ttl | 0), | |
| t.isUndefined(e.readable) && (e.readable = !0), | |
| n.prototype.parse.call(this, e, r) | |
| }, | |
| getMeta: function() { | |
| var n = e.Deferred() | |
| , r = { | |
| readable: !0, | |
| image: {} | |
| }; | |
| return t.defer(function() { | |
| n.resolve(r) | |
| }), | |
| n.promise() | |
| } | |
| }) | |
| }), | |
| define("api/apiWrapper.download", ["jquery", "underscore", "auth", "modules/window", "api/models/shareLinkModel"], function(e, t, n, r, i) { | |
| return { | |
| download: function(e, s, o) { | |
| var u, a, f, l, c, h = []; | |
| o = o || {}, | |
| t.isArray(e) || (e = [e]); | |
| if (!e.length) | |
| throw new Error("models argument missing for download"); | |
| if (e.length > 1 && !s) | |
| throw new Error("base (parent) required to download more than one item"); | |
| return e.length > 1 ? (a = !0, | |
| f = s.getPid(), | |
| l = s.get("name"), | |
| c = s) : e[0].isDir() ? (a = !0, | |
| f = e[0].getPid(), | |
| l = e[0].get("name"), | |
| c = e[0]) : (a = !1, | |
| c = e[0]), | |
| c instanceof i ? this.downloadSharelink(c) : (a ? (u = "/api/file/archive/download?src_id=" + t.map(e, function(e) { | |
| return e.getPid() | |
| }).join("&src_id=") + "&base_id=" + f, | |
| o.archivePrefix && h.push(o.archivePrefix), | |
| o.archiveName ? h.push(encodeURIComponent(o.archiveName.replace(/\/|\n|\r/g, ""))) : h.length && l !== "" && h.push(l), | |
| h.length && (u += "&filename=" + h.join("-") + ".zip")) : (u = "/api/file?attachment=true", | |
| u += "&pid=" + e[0].getPid()), | |
| c.getMeta().done(t.bind(function() { | |
| r.setLocation(n.get(c.getContext()).addAuthToUrl(u)) | |
| }, this)).fail(t.bind(function(t) { | |
| this.trigger("download:error", e, t) | |
| }, this))) | |
| } | |
| } | |
| }), | |
| define("api/apiWrapper.downloadShareLink", ["jquery", "underscore", "auth", "modules/window"], function(e, t, n, r) { | |
| return { | |
| downloadSharelink: function(i) { | |
| function s() { | |
| return n.get(i.getContext()).ajax({ | |
| method: "POST", | |
| url: "/api/sharelink/info", | |
| data: { | |
| fields: "remaining,download_code" | |
| } | |
| }) | |
| } | |
| function o(t) { | |
| return t.remaining >= 1 ? e.Deferred().resolve(t.download_code) : e.Deferred().reject() | |
| } | |
| function u(t) { | |
| var n = "/api/sharelink/download" | |
| , s = { | |
| id: i.get("id"), | |
| download_code: t | |
| }; | |
| r.setLocation(n + "?" + e.param(s)) | |
| } | |
| function a() { | |
| this.trigger("downloadSharelink:error", i) | |
| } | |
| return s(i).then(o).then(u, t.bind(a, this)).promise() | |
| } | |
| } | |
| }), | |
| define("api/apiWrapper.getDir", ["jquery", "underscore", "auth"], function(e, t, n) { | |
| return { | |
| getDir: function(r, i, s, o) { | |
| function h() { | |
| var e = c.length; | |
| s = t.clone(s), | |
| s.limit = [e, f].join(","), | |
| n.get(i).ajax({ | |
| type: "GET", | |
| dataType: "json", | |
| url: "/api/dir?path=" + r, | |
| data: s | |
| }).then(function(e) { | |
| if (t.isFunction(o)) { | |
| o(function() { | |
| a = !0 | |
| }, e); | |
| if (a) | |
| return | |
| } | |
| t.isArray(e.members) && (c = c.concat(e.members)), | |
| l = t.omit(e, "members"), | |
| t.isArray(e.members) && e.members.length === f ? h() : (l.members = c, | |
| u.resolve(l)) | |
| }, function(e, t, n) { | |
| u.reject(e, t, n) | |
| }) | |
| } | |
| var u = e.Deferred() | |
| , a = !1 | |
| , f = 5e3 | |
| , l = {} | |
| , c = []; | |
| return h(), | |
| u.promise() | |
| } | |
| } | |
| }), | |
| define("api/apiWrapper.getFile", ["auth"], function(e) { | |
| return { | |
| getFile: function(t, n) { | |
| return e.get(n).ajax({ | |
| url: "/api/file", | |
| method: "GET", | |
| data: { | |
| path: t | |
| } | |
| }) | |
| } | |
| } | |
| }), | |
| define("api/apiWrapper.getMeta", ["underscore", "auth"], function(e, t) { | |
| return { | |
| getMeta: function(n) { | |
| var r; | |
| if (!e.isObject(n)) | |
| throw new Error("getMeta: options object required"); | |
| if (!n.context) | |
| throw new Error("getMeta: context required"); | |
| if (!n.path && !n.pid) | |
| throw new Error("getMeta: either pid or path are required"); | |
| if (n.fields && !e.isArray(n.fields)) | |
| throw new Error("getMeta: fields option must be an array"); | |
| return r = e.pick(n, "path", "pid"), | |
| n.fields && n.fields.length && (r.fields = n.fields.join(",")), | |
| t.get(n.context).ajax({ | |
| url: "/api/meta", | |
| data: r | |
| }) | |
| } | |
| } | |
| }), | |
| define("api/apiWrapper.getThumbnail", ["jquery", "underscore", "auth", "api/models/fileModel", "api/models/shareLinkModel"], function(e, t, n, r, i) { | |
| function s(r, i) { | |
| var s = "/api/file/thumbnail?pid=" + r.getPid() | |
| , o = e.Deferred(); | |
| return t.isObject(i) && (i.width && (s += "&width=" + Math.ceil(i.width)), | |
| i.height && (s += "&height=" + Math.ceil(i.height))), | |
| s = n.get(r.getContext()).addAuthToUrl(s), | |
| o.resolve(s).promise() | |
| } | |
| function o(e, r) { | |
| var i = {}; | |
| return t.isObject(r) && (r.width && (i.width = Math.ceil(r.width)), | |
| r.height && (i.height = Math.ceil(r.height))), | |
| n.get(e.getContext()).ajax({ | |
| url: "/api/sharelink/thumbnail", | |
| method: "POST", | |
| dataType: "blob", | |
| data: i | |
| }) | |
| } | |
| return { | |
| getThumbnail: function(e, t) { | |
| var n; | |
| if (e instanceof i) | |
| n = o(e, t); | |
| else { | |
| if (!(e instanceof r)) | |
| throw new Error("expecting ShareLinkModel or FileModel"); | |
| n = s(e, t) | |
| } | |
| return n | |
| } | |
| } | |
| }), | |
| define("api/apiWrapper.getShareLinkThumbnail", ["jquery", "underscore", "modules/window"], function(e, t, n) { | |
| return { | |
| getShareLinkThumbnail: function(r, i) { | |
| var s = e.Deferred() | |
| , o = { | |
| id: r | |
| } | |
| , u = new XMLHttpRequest | |
| , a = "/api/sharelink/thumbnail"; | |
| if (!n.isCreateObjectURLSpported()) | |
| return s.reject(r, null, "noblob").promise(); | |
| if (!t.isString(r)) | |
| throw new Error("shareId parameter to getShareLinkThumbnail() has to be a string"); | |
| !isNaN(Number(i.width)) && i.width > 0 && (o.width = i.width), | |
| !isNaN(Number(i.height)) && i.height > 0 && (o.height = i.height); | |
| if (!o.height && !o.width) | |
| throw new Error("At least width or height should be passed"); | |
| return i.password && (o.password = i.password), | |
| u.open("POST", a, !0), | |
| u.responseType = "blob", | |
| u.setRequestHeader("Content-type", "application/x-www-form-urlencoded"), | |
| u.onload = function() { | |
| u.status === 200 ? s.resolve(n.createObjectURL(u.response)) : s.reject(r, u, "error") | |
| } | |
| , | |
| u.send(e.param(o)), | |
| s.promise() | |
| } | |
| } | |
| }), | |
| define("api/apiWrapper.moveFiles", ["jquery", "underscore", "auth", "deleteListInst", "api/models/fileModel"], function(e, t, n, r, i) { | |
| return { | |
| moveFiles: function(s, o) { | |
| var u = s.getItemType() | |
| , a = t.pluck(o, "id") | |
| , f = [] | |
| , l = [] | |
| , c = e.Deferred() | |
| , h = s.getContext(); | |
| if (t.some(o, function(e) { | |
| return e.getContext() !== h | |
| })) | |
| throw new Error("context of source and target must be the same in moveFiles"); | |
| if (t.some(o, function(e) { | |
| return e.getItemType() !== u | |
| })) | |
| throw new Error("itemType of source and target must be the same in moveFiles"); | |
| return r.add(u, o), | |
| n.get(h).ajax({ | |
| method: "POST", | |
| url: "/api/fs/move", | |
| traditional: !0, | |
| data: { | |
| src_id: a, | |
| dst_id: s.get("id"), | |
| on_exist: "autoname" | |
| } | |
| }).done(t.bind(function(e) { | |
| var n; | |
| f = t.map(e.done, function(e) { | |
| return new i(e,{ | |
| parse: !0, | |
| context: h | |
| }) | |
| }, this), | |
| l = t.map(e.failed, function(e) { | |
| return t.find(o, function(t) { | |
| return t.get("id") === e.src_id | |
| }) | |
| }), | |
| n = t.difference(o, l), | |
| l.length && r.recover(u, l), | |
| n.length && r.drop(u, n), | |
| this.trigger("moveFiles:done", s.get("path"), f), | |
| l.length > 0 ? (this.trigger("moveFiles:error", l, f), | |
| c.reject(l, f)) : (this.trigger("moveFiles:success", s, f), | |
| c.resolve(f)) | |
| }, this)).fail(t.bind(function() { | |
| l = o, | |
| r.recover(u, l), | |
| this.trigger("moveFiles:error", l, []), | |
| c.reject(l, []) | |
| }, this)), | |
| c.promise() | |
| } | |
| } | |
| }), | |
| define("api/apiWrapper.newFile", ["jquery", "underscore", "auth", "api/models/fileModel"], function(e, t, n, r) { | |
| return { | |
| newFile: function(i, s) { | |
| var o = e.Deferred(), u, a, f = o.promise(); | |
| f.abort = e.noop; | |
| if (i instanceof r) { | |
| if (!t.isString(s)) | |
| throw new Error("newFile needs a file name"); | |
| return u = i.get("path"), | |
| a = { | |
| dir_id: i.get("id"), | |
| name: s, | |
| on_exist: "autoname" | |
| }, | |
| n.get(i.getContext()).ajax({ | |
| method: "POST", | |
| url: "/api/file?" + e.param(a), | |
| beforeSend: function(e) { | |
| f.abort = e.abort | |
| } | |
| }).done(t.bind(function(e) { | |
| var t = new r(e,{ | |
| parse: !0, | |
| context: i.getContext() | |
| }); | |
| this.trigger("newFile:created", u, t), | |
| o.resolve(t) | |
| }, this)).fail(function(e, t) { | |
| o.reject(i, e, t) | |
| }), | |
| f | |
| } | |
| throw new Error("newFile needs a valid target folder") | |
| } | |
| } | |
| }), | |
| define("api/apiWrapper.newFolder", ["jquery", "underscore", "auth", "api/models/fileModel"], function(e, t, n, r) { | |
| return { | |
| newFolder: function(i, s, o) { | |
| var u = e.Deferred(), a = i.get("path"), f; | |
| if (!t.isObject(i)) | |
| throw new Error("newFolder needs a target folder"); | |
| if (!t.isString(s)) | |
| throw new Error("newFolder needs a new folder name"); | |
| return f = { | |
| pid: i.get("id"), | |
| path: s | |
| }, | |
| o && t.extend(f, { | |
| on_exist: "autoname" | |
| }), | |
| n.get(i.getContext()).ajax({ | |
| method: "POST", | |
| url: "/api/dir", | |
| data: f | |
| }).done(t.bind(function(e) { | |
| var t = new r(e,{ | |
| parse: !0, | |
| context: i.getContext() | |
| }); | |
| this.trigger("newFolder:created", a, t), | |
| u.resolve(t) | |
| }, this)).fail(function(e) { | |
| u.reject(i, e) | |
| }), | |
| u.promise() | |
| } | |
| } | |
| }), | |
| define("api/apiWrapper.patchFile", ["jquery", "underscore", "auth", "api/models/fileModel"], function(e, t, n, r) { | |
| return { | |
| patchFile: function(i, s, o, u) { | |
| var a = e.Deferred() | |
| , f = a.promise(); | |
| f.abort = e.noop; | |
| if (i instanceof r) { | |
| if (!t.isNumber(o)) | |
| throw new Error("offset parameter to patchFile() should be a number"); | |
| if (o < 0) | |
| throw new Error("offset parameter to patchFile() should be >= 0"); | |
| if (s instanceof window.Blob) | |
| return n.get(i.getContext()).ajax({ | |
| method: "PATCH", | |
| url: "/api/file?" + e.param({ | |
| pid: i.getPid(), | |
| offset: o | |
| }), | |
| timeout: 0, | |
| processData: !1, | |
| contentType: !1, | |
| data: s, | |
| xhr: function() { | |
| var n = e.ajaxSettings.xhr(); | |
| return t.isFunction(u) && (n.upload.onprogress = u), | |
| n | |
| }, | |
| beforeSend: function(e) { | |
| f.abort = e.abort | |
| } | |
| }).done(function(e) { | |
| a.resolve(e) | |
| }).fail(function(e, t) { | |
| a.reject(i, e, t) | |
| }), | |
| f; | |
| throw new Error("chunk parameter to patchFile() should be instance of Blob") | |
| } | |
| throw new Error("model parameter to patchFile() should be a FileModel") | |
| } | |
| } | |
| }), | |
| define("api/apiWrapper.rename", ["jquery", "underscore", "auth", "api/models/fileModel"], function(e, t, n, r) { | |
| return { | |
| rename: function(i, s, o) { | |
| var u = e.Deferred(), a, f, l, c, h; | |
| if (i instanceof r != 1) | |
| throw new Error("FileItem Model required to rename"); | |
| if (!t.isString(s)) | |
| throw new Error("new name of type string required by rename"); | |
| if (o && ["autoname", "overwrite"].indexOf(o) < 0) | |
| throw new Error("invalid conflict decision given to rename"); | |
| if (o === "overwrite" && i.isDir()) | |
| throw new Error("overwrite not possible for directories on rename"); | |
| return f = o, | |
| a = i.clone(), | |
| a.setName(s), | |
| l = t.bind(function(e, t, n) { | |
| a.set(a.parse(e)), | |
| this.trigger("rename:success", i, a, n), | |
| u.resolve(i, a, e, t, n) | |
| }, this), | |
| c = t.bind(function(e, t, n) { | |
| this.trigger("rename:error", i, a, e), | |
| u.reject(i, a, e, t, n) | |
| }, this), | |
| (s.indexOf("/") >= 0 || s.match(/^\.{1,2}$/)) && c({ | |
| status: 400, | |
| statusText: "invalid name" | |
| }, "invalid name", 400), | |
| i.get("display_name") === s && l(a.attributes, "success", { | |
| status: 200, | |
| statusText: "OK" | |
| }), | |
| this.trigger("rename:start", i, a), | |
| u.notify(i, a), | |
| h = i.isDir() ? "/api/dir/rename" : "/api/file/rename", | |
| u.state() === "pending" && n.get(i.getContext()).ajax({ | |
| type: "POST", | |
| url: h, | |
| data: { | |
| pid: a.get("id"), | |
| name: a.get("display_name"), | |
| on_exist: f | |
| } | |
| }).done(l).fail(c), | |
| u.promise() | |
| } | |
| } | |
| }), | |
| define("api/apiWrapper.setExternalShareLabel", ["jquery", "underscore", "auth", "api/models/externalShareModel"], function(e, t, n, r) { | |
| return { | |
| setExternalShareLabel: function(i, s) { | |
| var o = e.Deferred(), u; | |
| if (i instanceof r) { | |
| if (!s) | |
| throw new Error("label should be provided to setExternalShareLabel"); | |
| return u = i.clone(), | |
| u.setName(s), | |
| this.trigger("setExternalShareLabel:start", i, u), | |
| n.get().ajax({ | |
| method: "PUT", | |
| url: "/api/share/external", | |
| data: { | |
| id: i.get("id"), | |
| type: i.get("share_type"), | |
| label: s | |
| } | |
| }).done(t.bind(function(e) { | |
| u.set(u.parse(e)), | |
| this.trigger("setExternalShareLabel:success", i, u), | |
| o.resolve(i, u) | |
| }, this)).fail(t.bind(function(e) { | |
| this.trigger("setExternalShareLabel:error", i, u), | |
| o.reject(i, u, e) | |
| }, this)), | |
| o.promise() | |
| } | |
| throw new Error("setExternalShareLabel requires an ExternalShareModel") | |
| } | |
| } | |
| }), | |
| define("api/apiWrapper.setExternalSharePassword", ["jquery", "underscore", "auth", "api/models/externalShareModel"], function(e, t, n, r) { | |
| return { | |
| setExternalSharePassword: function(i, s) { | |
| var o = e.Deferred(); | |
| if (i instanceof r) { | |
| if (t.isUndefined(s)) | |
| throw new Error("password should be provided to setExternalSharePassword"); | |
| return n.get().ajax({ | |
| method: "PUT", | |
| url: "/api/share/external", | |
| data: { | |
| id: i.get("id"), | |
| type: i.get("share_type"), | |
| password: s | |
| } | |
| }).done(t.bind(function() { | |
| this.trigger("setExternalSharePassword:success", i), | |
| o.resolve(i) | |
| }, this)).fail(t.bind(function(e) { | |
| this.trigger("setExternalSharePassword:error", i), | |
| o.reject(i, e) | |
| }, this)), | |
| o.promise() | |
| } | |
| throw new Error("setExternalSharePassword requires an ExternalShareModel") | |
| } | |
| } | |
| }), | |
| define("api/apiWrapper.unzip", ["jquery", "underscore", "auth"], function(e, t, n) { | |
| return { | |
| unzip: function(r, i) { | |
| var s = e.Deferred(); | |
| if (!t.isObject(r)) | |
| throw new Error("unzip needs a valid file"); | |
| if (!t.isObject(i)) | |
| throw new Error("unzip needs a valid destination folder"); | |
| if (r.getContext() !== i.getContext()) | |
| throw new Error("context of source file and destination must be the same in unzip"); | |
| return n.get(i.getContext()).ajax({ | |
| method: "POST", | |
| url: "/api/file/archive/inflate", | |
| data: { | |
| pid: r.id, | |
| dst_id: i.id, | |
| exists: "skipall", | |
| forbidden: "skipall", | |
| unprocessable: "skipall" | |
| } | |
| }).done(function(e) { | |
| s.resolve(e) | |
| }).fail(function(e) { | |
| s.reject(r, e) | |
| }), | |
| s.promise() | |
| } | |
| } | |
| }), | |
| define("api/apiWrapper.updateUser", ["jquery", "underscore", "auth"], function(e, t, n) { | |
| return { | |
| updateUser: function(r, i) { | |
| var s = e.Deferred(); | |
| if (!r) | |
| throw new Error("accountId required for updateUser()"); | |
| if (!i || t.isEmpty(i)) | |
| throw new Error("attributes should not be empty for updateUser()"); | |
| return n.get().ajax({ | |
| type: "PUT", | |
| url: "/api/user", | |
| data: t.extend(i, { | |
| account: r | |
| }) | |
| }).done(function(e) { | |
| s.resolve(e) | |
| }).fail(function(e) { | |
| s.reject(r, e) | |
| }), | |
| s.promise() | |
| } | |
| } | |
| }), | |
| define("api/apiWrapper.zip", ["jquery", "underscore", "auth", "api/models/fileModel"], function(e, t, n, r) { | |
| return { | |
| zip: function(i, s) { | |
| var o = e.Deferred(), u, a; | |
| if (!t.isArray(i) || !i.length) | |
| throw new Error("zip needs valid source files array."); | |
| if (!!s && s instanceof r) { | |
| a = s.getContext(); | |
| if (t.some(i, function(e) { | |
| return e.getContext() !== a | |
| })) | |
| throw new Error("context of source files and destination must be the same in zip"); | |
| return u = t.map(i, function(e) { | |
| return e.urlDecode("path") | |
| }), | |
| n.get(a).ajax({ | |
| method: "POST", | |
| url: "/api/file/archive/deflate", | |
| traditional: !0, | |
| data: { | |
| dst: s.urlDecode("path"), | |
| src: u | |
| } | |
| }).always(function(e, n, r) { | |
| var u = [], a = [], f, l; | |
| e.responseJSON ? l = e.responseJSON : l = e, | |
| t.each(l.done, function(e) { | |
| a.push(t.find(i, function(t) { | |
| return t.get("path") === e.src | |
| })) | |
| }), | |
| a.length === 0 ? u = i : t.each(l.failed, function(e) { | |
| u.push(t.find(i, function(t) { | |
| return t.get("path") === e.src | |
| })) | |
| }), | |
| l.file && s.set(s.parse(l.file)), | |
| f = e.status || r.status, | |
| a.length === 0 ? o.reject(u, a, s, f) : o.resolve(u, a, s, f) | |
| }), | |
| o.promise() | |
| } | |
| throw new Error("zip needs valid destination file.") | |
| } | |
| } | |
| }), | |
| define("api/apiWrapper.zipInfo", ["jquery", "auth", "api/models/fileModel"], function(e, t, n) { | |
| return { | |
| zipInfo: function(r) { | |
| var i = e.Deferred(); | |
| if (r instanceof n) { | |
| if (r.get("ext") !== "zip") | |
| throw new Error(".zip extension required for zipInfo"); | |
| return t.get(r.getContext()).ajax({ | |
| url: "/api/file/archive", | |
| method: "GET", | |
| data: { | |
| pid: r.id | |
| } | |
| }).done(function(e) { | |
| i.resolve(e) | |
| }).fail(function(e) { | |
| i.reject(r, e) | |
| }), | |
| i.promise() | |
| } | |
| throw new Error("FileModel required for zipInfo") | |
| } | |
| } | |
| }), | |
| define("api/apiWrapper", ["underscore", "base", "./apiWrapper.addExternalShare", "./apiWrapper.copyFiles", "./apiWrapper.deleteExternalShare", "./apiWrapper.deleteFiles", "./apiWrapper.download", "./apiWrapper.downloadShareLink", "./apiWrapper.getDir", "./apiWrapper.getFile", "./apiWrapper.getMeta", "./apiWrapper.getThumbnail", "./apiWrapper.getShareLinkThumbnail", "./apiWrapper.moveFiles", "./apiWrapper.newFile", "./apiWrapper.newFolder", "./apiWrapper.patchFile", "./apiWrapper.rename", "./apiWrapper.setExternalShareLabel", "./apiWrapper.setExternalSharePassword", "./apiWrapper.unzip", "./apiWrapper.updateUser", "./apiWrapper.zip", "./apiWrapper.zipInfo"], function(e, t, n, r, i, s, o, u, a, f, l, c, h, p, d, v, m, g, y, b, w, E, S, x) { | |
| var T = {}; | |
| return e.extend(T, n, r, i, s, o, u, a, f, l, c, h, p, d, v, m, g, y, b, w, E, S, x), | |
| t.Object.extend(T) | |
| }), | |
| define("api/collections/baseCollection", ["jquery", "underscore", "backbone", "../helpers/sync", "modules/constants"], function(e, t, n, r, i) { | |
| return n.Collection.extend({ | |
| initialize: function(e, t) { | |
| this._context = (t || {}).context || i.authContext.default | |
| }, | |
| getContext: function() { | |
| return this._context | |
| }, | |
| _prepareModel: function(e, r) { | |
| return r = t.extend({}, r, { | |
| context: this.getContext() | |
| }), | |
| n.Collection.prototype._prepareModel.call(this, e, r) | |
| }, | |
| sync: function(e, t, n) { | |
| return r.call(this, e, t, n) | |
| } | |
| }) | |
| }), | |
| define("api/models/zoneModel", ["jquery", "underscore", "auth", "./baseModel"], function(e, t, n, r) { | |
| return r.extend({ | |
| idAttribute: "name", | |
| url: "/api/zone", | |
| defaults: { | |
| quota: 0, | |
| available: 0, | |
| used: 0, | |
| usedbysnapshots: 0, | |
| usedbyfiles: 0, | |
| sched_interval: null, | |
| sched_ttl: null | |
| }, | |
| parse: function(e) { | |
| var n = [null, null], r; | |
| return t.isArray(e) ? (r = t.findWhere(e, { | |
| parent: null | |
| }), | |
| r.usedbysnapshots = t.reduce(e, function(e, t) { | |
| return e + t.usedbysnapshots | |
| }, 0)) : r = e, | |
| t.has(r, "name") && (r.name = r.name.replace(/^root(\/|$)/, "/")), | |
| r.usedbyfiles = r.used - r.usedbysnapshots, | |
| r && r.sched && (n = r.sched.split(":"), | |
| delete r.sched), | |
| t.extend(r, { | |
| sched_interval: n[0], | |
| sched_ttl: n[1] | |
| }), | |
| r | |
| }, | |
| checkSchedFormat: function(e) { | |
| return /^\d+[dDwWmMyY]$/.test(e) | |
| }, | |
| updateSchedule: function(r, i) { | |
| var s = { | |
| name: this.get("name") | |
| }; | |
| if (t.isUndefined(r) || t.isUndefined(i)) | |
| return e.Deferred().reject(); | |
| if (r === "" && i === "") | |
| s.sched = ""; | |
| else { | |
| if (!this.checkSchedFormat(r) || !this.checkSchedFormat(i)) | |
| return e.Deferred().reject(); | |
| s.sched = r + ":" + i | |
| } | |
| return n.get().ajax({ | |
| type: "PUT", | |
| url: this.url, | |
| data: s | |
| }).done(t.bind(function(e) { | |
| this.set(this.parse(e)) | |
| }, this)).fail(t.bind(function() { | |
| this.trigger("updateSchedule:error") | |
| }, this)) | |
| } | |
| }) | |
| }), | |
| define("api/collections/zones", ["./baseCollection", "../models/zoneModel"], function(e, t) { | |
| return e.extend({ | |
| url: "/api/zone", | |
| model: t | |
| }) | |
| }), | |
| define("lang/helper/localeDetector", ["underscore", "modules/window"], function(e, t) { | |
| function n(e) { | |
| return e.indexOf("-") !== -1 ? e.split("-")[0] : e | |
| } | |
| return function(e, r) { | |
| var i = t.getNavigatorLang(); | |
| if (i) { | |
| i = n(i); | |
| if (e.indexOf(i) !== -1) | |
| return i | |
| } | |
| return r && e.indexOf(r) !== -1 ? r : e[0] | |
| } | |
| }), | |
| define("localstorage/main", ["jquery", "modules/configInst"], function(e, t) { | |
| function r(e) { | |
| return t.get("app").name + "." + e | |
| } | |
| var n = window; | |
| return { | |
| setScope: function(e) { | |
| n = e | |
| }, | |
| put: function(t, i) { | |
| try { | |
| (n.localStorage || { | |
| setItem: e.noop | |
| }).setItem(r(t), i) | |
| } catch (s) { | |
| console.error("Error: cannot put '" + t + "' to localStorage: " + s) | |
| } | |
| }, | |
| get: function(t) { | |
| try { | |
| return (n.localStorage || { | |
| getItem: e.noop | |
| }).getItem(r(t)) | |
| } catch (i) { | |
| return console.error("Error: cannot get '" + t + "' from localStorage: " + i), | |
| null | |
| } | |
| }, | |
| remove: function(t) { | |
| try { | |
| (n.localStorage || { | |
| removeItem: e.noop | |
| }).removeItem(r(t)) | |
| } catch (i) { | |
| console.error("Error: cannot remove '" + t + "' from localStorage: " + i) | |
| } | |
| } | |
| } | |
| }), | |
| define("localstorage", ["localstorage/main"], function(e) { | |
| return e | |
| }), | |
| define("api/router", ["underscore", "backbone", "lang/helper/localeDetector", "localstorage", "lang", "auth", "modules/window"], function(e, t, n, r, i, s, o) { | |
| var u = t.Router.extend({ | |
| defaults: { | |
| langStorageKey: "lang", | |
| lang: "en" | |
| }, | |
| _extractParameters: function(t, n) { | |
| var r = t.exec(n).slice(1); | |
| return e.map(r, function(e) { | |
| return e ? e : null | |
| }) | |
| }, | |
| _setTitle: function() { | |
| var e = i.get("app.title"); | |
| o.setTitle(e) | |
| }, | |
| initialize: function() { | |
| var e = this.defaults.langStorageKey | |
| , t = n(i.getLanguages(), this.defaults.lang) | |
| , o = r.get(e); | |
| try { | |
| i.setLang(o || t) | |
| } catch (u) { | |
| i.setLang(t), | |
| r.remove(e) | |
| } | |
| this._setTitle(), | |
| this.auth = s.get() | |
| }, | |
| setLanguage: function(e) { | |
| i.setLang(e), | |
| this._setTitle(), | |
| r.put(this.defaults.langStorageKey, e) | |
| } | |
| }); | |
| return u | |
| }), | |
| define("api/helpers/fileUrl", ["underscore", "./encoding"], function(e, t) { | |
| return function(n, r) { | |
| var i = t.urlDecode(n.split("/").pop()) || r; | |
| return function() { | |
| var t = e.escape(e.isFunction(i) ? i() : i); | |
| return ['<a href="#$' + n + '">', t, "</a>"].join("") | |
| } | |
| } | |
| }), | |
| define("api/main", ["underscore", "./apiWrapper", "./models/fileModel", "./collections/zones", "./models/zoneModel", "./router", "./helpers/encoding", "./helpers/filegroups", "./helpers/fileUrl"], function(e, t, n, r, i, s, o, u, a) { | |
| return e.extend(new t, { | |
| FileModel: n, | |
| ZonesCollection: r, | |
| ZoneModel: i, | |
| Router: s, | |
| Encoding: o, | |
| Filegroups: u, | |
| fileUrl: a | |
| }) | |
| }), | |
| define("api", ["api/main"], function(e) { | |
| return e | |
| }), | |
| define("api/helpers/base64", [], function() { | |
| function t(t) { | |
| if (/([^\u0000-\u00ff])/.test(t)) | |
| throw new Error("Can't base64 encode non-ASCII characters."); | |
| var n = 0, r, i, s, o = []; | |
| while (n < t.length) { | |
| r = t.charCodeAt(n), | |
| s = n % 3; | |
| switch (s) { | |
| case 0: | |
| o.push(e.charAt(r >> 2)); | |
| break; | |
| case 1: | |
| o.push(e.charAt((i & 3) << 4 | r >> 4)); | |
| break; | |
| case 2: | |
| o.push(e.charAt((i & 15) << 2 | r >> 6)), | |
| o.push(e.charAt(r & 63)) | |
| } | |
| i = r, | |
| n++ | |
| } | |
| return s === 0 ? (o.push(e.charAt((i & 3) << 4)), | |
| o.push("==")) : s === 1 && (o.push(e.charAt((i & 15) << 2)), | |
| o.push("=")), | |
| o.join("") | |
| } | |
| function n(t) { | |
| t = t.replace(/\s/g, ""); | |
| if (!r(t)) | |
| throw new Error("Not a base64-encoded string."); | |
| var n, i, s, o = 0, u = []; | |
| t = t.replace(/\=/g, ""); | |
| while (o < t.length) { | |
| n = e.indexOf(t.charAt(o)), | |
| s = o % 4; | |
| switch (s) { | |
| case 1: | |
| u.push(String.fromCharCode(i << 2 | n >> 4)); | |
| break; | |
| case 2: | |
| u.push(String.fromCharCode((i & 15) << 4 | n >> 2)); | |
| break; | |
| case 3: | |
| u.push(String.fromCharCode((i & 3) << 6 | n)) | |
| } | |
| i = n, | |
| o++ | |
| } | |
| return u.join("") | |
| } | |
| function r(e) { | |
| return typeof e == "string" && e.length % 4 === 0 && /^[a-z0-9+/\s]+\={0,2}$/i.test(e) | |
| } | |
| var e = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; | |
| return { | |
| encode: t, | |
| decode: n, | |
| isValid: r | |
| } | |
| }), | |
| define("tracker/main", ["underscore", "lang", "modules/configInst"], function(e, t, n) { | |
| function r() { | |
| function i() { | |
| var e = window.location.href.split("#"); | |
| e = e.length > 1 ? e[1] : ""; | |
| var t; | |
| switch (!0) { | |
| case /^\$/.test(e): | |
| t = "files"; | |
| break; | |
| case /^shares$/.test(e): | |
| t = "shares"; | |
| break; | |
| case /^downloads$/.test(e): | |
| t = "downloads"; | |
| break; | |
| case /^login$/.test(e): | |
| t = "login"; | |
| break; | |
| case /^password$/.test(e): | |
| t = "password"; | |
| break; | |
| default: | |
| t = "unknown" | |
| } | |
| return t | |
| } | |
| function s(s) { | |
| if (!n.get("hasTracking")) | |
| return; | |
| if (!s) | |
| throw new Error("track() must have an object to track as parameter"); | |
| var o = n.get("app"); | |
| e.extend(s, { | |
| namespace: o.name, | |
| version: o.version, | |
| lang: t.getLang(), | |
| page: i() | |
| }), | |
| r.length && e.each(r, function(e) { | |
| "track"in e && e.track(s) | |
| }) | |
| } | |
| function o(e) { | |
| r.push(e) | |
| } | |
| function u() { | |
| r = [] | |
| } | |
| var r = []; | |
| this.track = s, | |
| this.addAdapter = o, | |
| this.clear = u | |
| } | |
| return new r | |
| }), | |
| define("tracker", ["tracker/main"], function(e) { | |
| return e | |
| }), | |
| define("mixins/trackable", ["underscore", "backbone", "tracker"], function(e, t, n) { | |
| var r = { | |
| bind: function(i, s) { | |
| function a() { | |
| n.track(o()) | |
| } | |
| var o, u; | |
| if (!i || !(i instanceof t.View)) | |
| throw new Error("first argument needs to be a Backbone view."); | |
| if (!e.isObject(s)) | |
| throw new Error("options has to be an object."); | |
| o = s.data, | |
| e.isFunction(o) || (o = e.constant(o)), | |
| u = s.event, | |
| u && i.on(u, a, r), | |
| i.track = a | |
| }, | |
| unbind: function(e) { | |
| e.off(null, null, r), | |
| delete e.track | |
| } | |
| }; | |
| return r | |
| }), | |
| define("actionManager/actionManager", ["underscore", "base"], function(e, t) { | |
| return t.Object.extend({ | |
| initialize: function() { | |
| this.actions = {} | |
| }, | |
| register: function(e, t, n) { | |
| if (this.isRegistered(e)) | |
| throw new Error('an action with the name "' + e + '" is already registered.'); | |
| this.actions[e] = { | |
| callback: t, | |
| config: n, | |
| state: { | |
| "": !0 | |
| } | |
| } | |
| }, | |
| unregister: function(e) { | |
| this._ensureActionIsRegistered(e), | |
| delete this.actions[e], | |
| this.off("state:" + e) | |
| }, | |
| isRegistered: function(e) { | |
| return this.actions.hasOwnProperty(this._parseName(e).name) | |
| }, | |
| execute: function(t) { | |
| var n = this._parseName(t), r = e.rest(arguments), i; | |
| return this._ensureActionIsRegistered(n.name), | |
| i = this.actions[n.name], | |
| typeof i.config != "undefined" && (r = r.concat([i.config])), | |
| this.trigger("execute", n.name), | |
| i.callback.apply(i.callback, r) | |
| }, | |
| getState: function(e) { | |
| var t = this._parseName(e), n; | |
| return this._ensureActionIsRegistered(t.name), | |
| n = this.actions[t.name].state, | |
| t.namespace in n || (n[t.namespace] = n[""]), | |
| n[t.namespace] | |
| }, | |
| setState: function(t, n) { | |
| var r = this._parseName(t), i; | |
| this._ensureActionIsRegistered(r.name), | |
| r.namespace === "*" ? (i = e.keys(this.actions[r.name].state), | |
| e.each(i, function(e) { | |
| this._setNamespaceState(r.name, e, n) | |
| }, this)) : this._setNamespaceState(r.name, r.namespace, n) | |
| }, | |
| registerAll: function(t) { | |
| e.each(t, e.bind(function(e, t) { | |
| this.register(t, e.callback, e.config) | |
| }, this)) | |
| }, | |
| _setNamespaceState: function(e, t, n) { | |
| var r = this.actions[e].state | |
| , i = e + (t === "" ? "" : ":" + t); | |
| n = !!n; | |
| if (!(t in r) || r[t] !== n) | |
| r[t] = n, | |
| this.trigger("state:" + i, n) | |
| }, | |
| _ensureActionIsRegistered: function(e) { | |
| if (!this.isRegistered(e)) | |
| throw new Error('no action with the name "' + e + '" is registered.') | |
| }, | |
| _parseName: function(e) { | |
| var t = e.indexOf(":") | |
| , n = t > -1; | |
| return { | |
| name: n ? e.substr(0, t) : e, | |
| namespace: n ? e.substr(t + 1) : "" | |
| } | |
| } | |
| }) | |
| }), | |
| define("actionManager/main", ["./actionManager"], function(e) { | |
| return new e | |
| }), | |
| define("actionManager", ["actionManager/main"], function(e) { | |
| return e | |
| }), | |
| define("gui/activatable", ["underscore", "backbone", "mixins/trackable", "actionManager"], function(e, t, n, r) { | |
| return t.View.extend({ | |
| events: { | |
| click: "_onClick" | |
| }, | |
| constructor: function(i) { | |
| i = e.isObject(i) ? i : {}, | |
| this.hasAction = !1, | |
| this.hasTracking = !1, | |
| e.has(i, "action") && r.isRegistered(i.action) && (this.hasAction = !0, | |
| this.action = i.action, | |
| e.has(i, "actionData") && (this.actionData = i.actionData), | |
| this.listenTo(r, "state:" + this.action, this.onActionState)), | |
| e.has(i, "tracking") && (n.bind(this, { | |
| data: i.tracking, | |
| event: "executed" | |
| }), | |
| this.hasTracking = !0), | |
| t.View.call(this, i) | |
| }, | |
| remove: function() { | |
| return this.hasTracking && n.unbind(this), | |
| t.View.prototype.remove.call(this) | |
| }, | |
| execute: function() { | |
| if (this.hasAction && this.getActionState()) { | |
| if (e.isUndefined(this.actionData)) | |
| r.execute(this.action); | |
| else { | |
| var t = e.result(this, "actionData"); | |
| r.execute(this.action, t) | |
| } | |
| this.trigger("executed") | |
| } | |
| }, | |
| getActionState: function() { | |
| return this.hasAction ? r.getState(this.action) : undefined | |
| }, | |
| onActionState: function(e) { | |
| this.trigger("state", e) | |
| }, | |
| _onClick: function(e) { | |
| this.execute(), | |
| this.trigger("click", e) | |
| } | |
| }) | |
| }), | |
| define("gui/button/button", ["underscore", "../activatable"], function(e, t) { | |
| return t.extend({ | |
| tagName: "button", | |
| defaults: { | |
| secondary: !1, | |
| alternative: !1 | |
| }, | |
| _labelTpl: e.template('<span class="label"><%- str %></span>'), | |
| initialize: function(t) { | |
| this.config = e.extend({}, this.defaults, t), | |
| this.listenTo(this, "state", this.setState) | |
| }, | |
| setText: function(e) { | |
| return this.config.text = e, | |
| this.render(), | |
| this | |
| }, | |
| setState: function(e) { | |
| this.$el.toggleClass("sj-button-disabled", !e), | |
| this.$el.prop("disabled", !e) | |
| }, | |
| disable: function() { | |
| return this.setState(!1), | |
| this | |
| }, | |
| isDisabled: function() { | |
| return this.$el.hasClass("sj-button-disabled") | |
| }, | |
| enable: function() { | |
| return this.setState(!0), | |
| this | |
| }, | |
| render: function() { | |
| return this.$el.empty().addClass("sj-button").addClass(this.config.className).toggleClass("secondary", this.config.secondary).toggleClass("alternative", this.config.alternative).prepend(this._labelTpl({ | |
| str: e.result(this.config, "text") | |
| })).attr("title", this.config.text), | |
| this.hasAction ? this.setState(this.getActionState()) : this.setState(!this.config.disabled), | |
| this.delegateEvents(), | |
| this | |
| } | |
| }) | |
| }), | |
| define("z-index-mgr", [], function() { | |
| var e = 42; | |
| return function() { | |
| return e++ | |
| } | |
| }), | |
| define("gui/overlay/views/overlayManager", ["underscore", "base"], function(e, t) { | |
| var n = t.Object.extend({ | |
| initialize: function() { | |
| this._overlaysOpened = 0 | |
| }, | |
| push: function() { | |
| this._overlaysOpened++, | |
| this.trigger("pushed"), | |
| this._overlaysOpened === 1 && this.trigger("pushed:first") | |
| }, | |
| pop: function() { | |
| if (this._overlaysOpened === 0) | |
| throw new Error("OverlayManager.pop() called while there aren't any open overlays?!"); | |
| this._overlaysOpened--, | |
| this.trigger("popped"), | |
| this._overlaysOpened === 0 && this.trigger("popped:last") | |
| } | |
| }); | |
| return n.instance = function() { | |
| return n._instance || (n._instance = new n), | |
| n._instance | |
| } | |
| , | |
| n | |
| }), | |
| define("text!gui/overlay/views/overlayView.html", [], function() { | |
| return '<% if (options.isModal) { %>\n <div class="sj-overlay-cover"></div>\n<% } %>\n<div class="sj-overlay-helper"></div>\n<div class="sj-overlay-content">\n <% if (options.canClose) { %>\n <span data-action="close-overlay" class="sj-overlay-close icon-overlay-close"></span>\n <% } %>\n <div class="sj-overlay-body">\n\n </div>\n</div>\n<div class="sj-overlay-helper"></div>\n' | |
| }), | |
| define("gui/overlay/views/overlayView", ["jquery", "backbone", "underscore", "z-index-mgr", "./overlayManager", "text!./overlayView.html"], function(e, t, n, r, i, s) { | |
| return t.View.extend({ | |
| overlayClasses: "sj-overlay dialog-overlay", | |
| events: { | |
| "click .sj-overlay-close": "onClose" | |
| }, | |
| defaults: { | |
| canClose: !0, | |
| isModal: !0 | |
| }, | |
| initialize: function(e) { | |
| var t = n.omit(e, "ContentViewClass", "ContentViewOptions") | |
| , r = e.ContentViewOptions || {}; | |
| this.options = n.extend({}, this.defaults, t), | |
| this.contentView = new e.ContentViewClass(r), | |
| this.listenTo(this.contentView, "all", this.trigger), | |
| this.listenTo(this.contentView, "close-self", this.remove) | |
| }, | |
| remove: function() { | |
| return this.contentView.remove(), | |
| t.View.prototype.remove.call(this), | |
| this._overlayPushed && (i.instance().pop(), | |
| this._overlayPushed = !1), | |
| this.trigger("removed"), | |
| this | |
| }, | |
| render: function() { | |
| return this.$el.html(n.template(s)({ | |
| options: this.options | |
| })), | |
| this.$el.addClass(this.overlayClasses), | |
| this.$el.css("z-index", r()), | |
| this.$content = this.contentView.render().$el, | |
| this.$(".sj-overlay-body").append(this.$content), | |
| this._overlayPushed || (i.instance().push(), | |
| this._overlayPushed = !0), | |
| this.trigger("rendered"), | |
| this | |
| }, | |
| onClose: function() { | |
| n.isFunction(this.contentView.onBeforeClose) && this.contentView.onBeforeClose(), | |
| this.remove() | |
| } | |
| }) | |
| }), | |
| define("text!gui/overlay/views/error.html", [], function() { | |
| return '<span class="icon icon-overlay-error"></span>\n<p><%= message %></p>\n<div class="ok-button-target"></div>\n' | |
| }), | |
| define("gui/overlay/views/baseOverlayView", ["jquery", "underscore", "backbone", "base", "z-index-mgr", "gui/button/button", "./overlayManager", "./overlayView", "text!./overlayView.html", "text!./error.html"], function(e, t, n, r, i, s, o, u, a, f) { | |
| return n.View.extend({ | |
| overlayClasses: "sj-overlay dialog-overlay", | |
| overlayTemplate: t.template(a), | |
| overlayContentContainer: ".sj-overlay-body", | |
| canClose: !0, | |
| isModal: !0, | |
| resultPromise: null, | |
| constructor: function() { | |
| this._createOverlayElement(), | |
| n.View.prototype.constructor.apply(this, arguments) | |
| }, | |
| templateData: function() { | |
| return { | |
| options: { | |
| canClose: this.canClose, | |
| isModal: this.isModal | |
| } | |
| } | |
| }, | |
| open: function() { | |
| var n = t.result(this, "templateData", {}); | |
| return this.$overlayEl.html(this.overlayTemplate(n)).css("z-index", i()).appendTo("body"), | |
| this.render().$el.appendTo(this.$overlayEl.find(this.overlayContentContainer)), | |
| this._overlayPushed || (o.instance().push(), | |
| this._overlayPushed = !0), | |
| this.trigger("opened"), | |
| this.onAfterOpen(), | |
| this.resultPromise = e.Deferred(), | |
| this.resultPromise.promise() | |
| }, | |
| onAfterOpen: function() {}, | |
| close: function() { | |
| t.isFunction(this.onBeforeClose) && this.onBeforeClose.apply(this, arguments), | |
| this._overlayPushed && (o.instance().pop(), | |
| this._overlayPushed = !1), | |
| this.remove(), | |
| this.resultPromise && this.resultPromise.resolve.apply(this.resultPromise, arguments) | |
| }, | |
| setVisible: function(e) { | |
| this.$overlayEl.toggleClass("sj-overlay-hidden", !e) | |
| }, | |
| showError: function(e) { | |
| var n = new r.View({ | |
| className: "sj-overlay-error", | |
| template: t.template(f), | |
| templateData: { | |
| message: e.message | |
| }, | |
| subviews: { | |
| okButton: { | |
| klass: s, | |
| target: ".ok-button-target", | |
| options: { | |
| text: e.okButtonText | |
| }, | |
| listeners: { | |
| click: function() { | |
| n.remove() | |
| } | |
| } | |
| } | |
| } | |
| }); | |
| this.$overlayEl.find(".sj-overlay-content").append(n.render().$el) | |
| }, | |
| remove: function() { | |
| return this.$overlayEl.remove(), | |
| n.View.prototype.remove.call(this), | |
| this.trigger("removed"), | |
| this | |
| }, | |
| _createOverlayElement: function() { | |
| this.$overlayEl = e("<div/>").addClass(this.overlayClasses).on("click", "[data-action~='close-overlay']", t.bind(this._onCloseOverlay, this)) | |
| }, | |
| _onCloseOverlay: function() { | |
| this.close() | |
| } | |
| }) | |
| }), | |
| define("text!templates/gui/overlay/confirm.html", [], function() { | |
| return '<span class="overlay-text"><%= message %></span>\n<div class="overlay-buttons">\n <span class="cancel-target"></span>\n <span class="ok-target"></span>\n</div>\n' | |
| }), | |
| define("gui/overlay/views/confirmOverlayView", ["underscore", "lang", "gui/button/button", "./baseOverlayView", "text!templates/gui/overlay/confirm.html"], function(e, t, n, r, i) { | |
| return r.extend({ | |
| template: e.template(i), | |
| initialize: function(e) { | |
| this.data = e, | |
| this.okButton = new n({ | |
| className: "confirm-overlay-ok", | |
| text: this.data.okButtonText || t.get("confirm.ok") | |
| }), | |
| this.listenTo(this.okButton, "click", this.onOk), | |
| this.cancelButton = new n({ | |
| className: "confirm-overlay-cancel", | |
| text: this.data.cancelButtonText || t.get("confirm.cancel"), | |
| secondary: !0 | |
| }), | |
| this.listenTo(this.cancelButton, "click", this.onCancel) | |
| }, | |
| render: function() { | |
| this.$overlayEl.addClass("confirm-overlay"), | |
| this.$el.html(this.template({ | |
| message: e.result(this.data, "message"), | |
| title: e.result(this.data, "title") | |
| })); | |
| var t = this.$(".ok-target"); | |
| t.length && t.replaceWith(this.okButton.render().$el); | |
| var n = this.$(".cancel-target"); | |
| return n.length && n.replaceWith(this.cancelButton.render().$el), | |
| this | |
| }, | |
| remove: function() { | |
| return this.okButton.remove(), | |
| this.cancelButton.remove(), | |
| r.prototype.remove.apply(this, arguments) | |
| }, | |
| onOk: function() { | |
| this.close(!0) | |
| }, | |
| onCancel: function() { | |
| this.close(!1) | |
| } | |
| }) | |
| }), | |
| define("text!templates/gui/overlay/alert.html", [], function() { | |
| return '<span class="overlay-text"><%= message %></span>\n<div class="overlay-buttons">\n <span class="ok-target"></span>\n</div>\n' | |
| }), | |
| define("gui/overlay/views/alertOverlayView", ["underscore", "lang", "gui/button/button", "./baseOverlayView", "text!templates/gui/overlay/alert.html"], function(e, t, n, r, i) { | |
| return r.extend({ | |
| template: e.template(i), | |
| initialize: function(e) { | |
| this.data = e, | |
| this.okButton = new n({ | |
| className: "alert-overlay-ok", | |
| text: this.data.buttonText || t.get("confirm.ok") | |
| }), | |
| this.listenTo(this.okButton, "click", this.onOk) | |
| }, | |
| render: function() { | |
| this.$overlayEl.addClass("alert-overlay"), | |
| this.$el.html(this.template({ | |
| title: e.result(this.data, "title"), | |
| message: e.result(this.data, "message") | |
| })); | |
| var t = this.$(".ok-target"); | |
| return t.length && t.replaceWith(this.okButton.render().$el), | |
| this | |
| }, | |
| remove: function() { | |
| return this.okButton.remove(), | |
| r.prototype.remove.apply(this, arguments) | |
| }, | |
| onOk: function() { | |
| this.close(!0) | |
| } | |
| }) | |
| }), | |
| define("dialogs", ["underscore", "gui/overlay/views/confirmOverlayView", "gui/overlay/views/alertOverlayView"], function(e, t, n) { | |
| return { | |
| confirm: function(n) { | |
| if (!e.isObject(n) || !n.message) | |
| throw new Error("No message for the confirm-dialog was provided."); | |
| var r = e.pick(n, "message", "title", "okButtonText", "cancelButtonText"); | |
| return (new t(r)).open() | |
| }, | |
| alert: function(t) { | |
| var r = e.pick(t, "title", "message", "buttonText"); | |
| if (!r.message) | |
| throw new Error("No message for the alert-dialog was provided."); | |
| return (new n(r)).open() | |
| } | |
| } | |
| }), | |
| define("text!views/login.html", [], function() { | |
| return '<form class="password-dialog">\n <div class="label">\n <h2 class="password-header"><%= lang.get("login.header", shareName) %></h2>\n <% if (error) { %>\n <span class="error sj-selectable">\n <%= error %>\n </span>\n <% } %>\n </div>\n <div class="input">\n <div class="input-field">\n <input class="password-value" id="password" name="password" type="password" placeholder="<%= lang.get("login.passwordLabel") %>">\n </div>\n <button href="javascript:void(0);" class="sj-button password-accept" type="submit"><%= lang.get("login.accept") %></button>\n </div>\n</form>\n' | |
| }), | |
| function(e) { | |
| define("jquery-watermark", ["jquery"], function() { | |
| return function() { | |
| (function(e) { | |
| var t = /MSIE [1-7]\./.test(navigator.userAgent); | |
| e.watermarker = function() {} | |
| , | |
| e.extend(e.watermarker, { | |
| defaults: { | |
| left: 0, | |
| top: 0, | |
| fallback: !1, | |
| animDuration: 300, | |
| minOpacity: 1 | |
| }, | |
| setDefaults: function(t) { | |
| e.extend(e.watermarker.defaults, t) | |
| }, | |
| checkVal: function(t, n) { | |
| return t.length === 0 ? e(n).show() : e(n).hide(), | |
| t.length > 0 | |
| }, | |
| html5_support: function() { | |
| var e = document.createElement("input"); | |
| return "placeholder"in e | |
| }, | |
| fallbackNot: function(e) { | |
| if (e) | |
| return e.test(navigator.userAgent) | |
| } | |
| }), | |
| e.fn.watermark = function(n, r) { | |
| return r || (r = n, | |
| n = undefined), | |
| r = e.extend({}, e.watermarker.defaults, r), | |
| e.watermarker.fallbackNot(r.fallbackNot) && delete r.fallback, | |
| r.fallback && e.watermarker.html5_support() ? this : (this.filter("textarea, input:not(:checkbox,:radio,:file,:submit,:reset)").each(function() { | |
| var i, s, o, u, a, f, l, c = 0, h; | |
| i = e(this), | |
| f = i.attr("id"); | |
| if (i.attr("data-jq-watermark") === "processed") | |
| return; | |
| s = i.attr("placeholder") !== undefined && i.attr("placeholder") !== "" ? "placeholder" : "title", | |
| o = n === undefined || n === "" ? i.attr(s) : n, | |
| u = e('<span class="watermark_container"></span>').addClass(i.attr("class")), | |
| a = e('<label class="watermark" for="' + f + '">').text(o), | |
| s === "placeholder" && i.removeAttr("placeholder"), | |
| u.css({ | |
| display: "inline-block", | |
| position: "relative" | |
| }), | |
| i.attr("data-percent-width") === "true" && u.css("width", "100%"), | |
| i.attr("data-percent-height") === "true" && u.css("height", "100%"), | |
| t && u.css({ | |
| zoom: 1, | |
| display: "inline" | |
| }), | |
| i.wrap(u).attr("data-jq-watermark", "processed"), | |
| a.css({ | |
| position: "absolute", | |
| display: "block", | |
| textAlign: "left", | |
| pointerEvents: "none", | |
| whiteSpace: "pre-line" | |
| }), | |
| e.watermarker.checkVal(i.val(), a), | |
| f || a.data("jq_watermark_element", i).click(function() { | |
| e(e(this).data("jq_watermark_element")).trigger("click").trigger("focus") | |
| }), | |
| i.before(a).on("focus.jq_watermark", function() { | |
| e.watermarker.checkVal(e(this).val(), a) || a.stop().fadeTo(r.animDuration, r.minOpacity) | |
| }).on("blur.jq_watermark change.jq_watermark input.jq_watermark", function() { | |
| e.watermarker.checkVal(e(this).val(), a) || a.stop().fadeTo(r.animDuration, 1) | |
| }).on("keydown.jq_watermark paste.jq_watermark", function(t) { | |
| e(a).hide() | |
| }).on("keyup.jq_watermark", function(t) { | |
| e.watermarker.checkVal(e(this).val(), a) | |
| }) | |
| }), | |
| this) | |
| } | |
| , | |
| e(function() { | |
| e(".jq_watermark").watermark() | |
| }) | |
| })(jQuery) | |
| } | |
| .apply(e, arguments) | |
| }) | |
| }(this), | |
| define("views/login", ["underscore", "backbone", "lang", "text!./login.html", "jquery-watermark"], function(e, t, n, r, i) { | |
| return t.View.extend({ | |
| className: "password-page", | |
| template: e.template(r), | |
| events: { | |
| submit: "login" | |
| }, | |
| initialize: function(e) { | |
| this.loginCallback = e.loginCallback | |
| }, | |
| _disableSubmitBtn: function() { | |
| this.$('button[type="submit"]').attr("disabled", "") | |
| }, | |
| render: function(e) { | |
| var t, r; | |
| return e && (t = e.error), | |
| !t || (t === "empty" ? r = n.get("error.password_empty") : t === "expired" ? r = n.get("error.expired") : t === "password" ? r = n.get("error.password") : r = n.get("error.500")), | |
| this.$el.html(this.template({ | |
| lang: n, | |
| shareName: "???", | |
| error: r | |
| })), | |
| this.$(".password-value").watermark(), | |
| this | |
| }, | |
| login: function(t) { | |
| t.preventDefault(), | |
| this._disableSubmitBtn(); | |
| var n = this.$("#password").val(); | |
| n === "" ? this.render({ | |
| error: "empty" | |
| }) : e.isFunction(this.loginCallback) && this.loginCallback({ | |
| password: n | |
| }) | |
| } | |
| }) | |
| }), | |
| define("text!views/loadingView.html", [], function() { | |
| return '<span class="loading"></span>\n' | |
| }), | |
| define("views/loadingView", ["underscore", "backbone", "text!./loadingView.html"], function(e, t, n) { | |
| return t.View.extend({ | |
| className: "loading-page", | |
| template: e.template(n), | |
| render: function() { | |
| return this.$el.html(this.template()), | |
| this | |
| } | |
| }) | |
| }), | |
| define("text!templates/httpErrorView.html", [], function() { | |
| return '<span class="error-<%= mappedCode %>"></span><%= message %>\n' | |
| }), | |
| define("modules/httpErrorView", ["underscore", "backbone", "lang", "text!templates/httpErrorView.html"], function(e, t, n, r) { | |
| return t.View.extend({ | |
| className: "error-page", | |
| template: e.template(r), | |
| defaults: { | |
| errorCode: 500 | |
| }, | |
| render: function(e) { | |
| e || (e = { | |
| code: this.defaults.errorCode | |
| }); | |
| var t = e.code, r = { | |
| 400: [n.get("error.404"), 404], | |
| 401: [n.get("error.401"), 500], | |
| 403: [n.get("error.403"), 500], | |
| 404: [n.get("error.404"), 404], | |
| 410: [n.get("error.410"), 410], | |
| 500: [n.get("error.500"), 500], | |
| 503: [n.get("error.503"), 500] | |
| }, i, s; | |
| return r[t] || (t = this.defaults.errorCode), | |
| i = r[t][0], | |
| s = r[t][1], | |
| this.$el.html(this.template({ | |
| code: t, | |
| message: i, | |
| mappedCode: s | |
| })), | |
| this | |
| } | |
| }) | |
| }), | |
| define("text!views/encryptedView.html", [], function() { | |
| return '<span class="encrypted"></span><%= lang.get("encrypted.main") %>\n' | |
| }), | |
| define("views/encryptedView", ["underscore", "backbone", "lang", "text!./encryptedView.html"], function(e, t, n, r) { | |
| return t.View.extend({ | |
| className: "encrypted-page sj-selectable", | |
| template: e.template(r), | |
| render: function() { | |
| return this.$el.html(this.template({ | |
| lang: n | |
| })), | |
| this | |
| } | |
| }) | |
| }), | |
| define("text!views/teaser.html", [], function() { | |
| return '<%= lang.get("teaser.text", tpl) %>\n<a class="register-button" href="<%= lang.get(\'teaser.register.url\') %>">\n <span class="icon-teaser-register"></span>\n <span class="label"><%= lang.get("teaser.register.text") %></span>\n</a>\n' | |
| }), | |
| define("text!views/logo.html", [], function() { | |
| return '<span class="logo-text1"><%= lang.get("tmcshare.logo.text1") %></span><span class="logo-text2"><%= lang.get("tmcshare.logo.text2") %></span>\n' | |
| }), | |
| define("views/teaser", ["underscore", "backbone", "lang", "text!./teaser.html", "text!./logo.html"], function(e, t, n, r, i) { | |
| return t.View.extend({ | |
| className: "teaser sj-selectable", | |
| _template: e.template(r), | |
| _logoTemplate: e.template(i), | |
| initialize: function() {}, | |
| render: function() { | |
| return this.$el.html(this._template({ | |
| lang: n, | |
| tpl: this._logoTemplate({ | |
| lang: n | |
| }) | |
| })), | |
| this | |
| } | |
| }) | |
| }), | |
| define("gui/button/iconButton", ["underscore", "backbone", "./button"], function(e, t, n) { | |
| return n.extend({ | |
| tagName: t.View.prototype.tagName, | |
| defaults: e.extend({ | |
| iconClass: "" | |
| }, n.prototype.defaults), | |
| inputType: "button", | |
| render: function() { | |
| return n.prototype.render.apply(this, arguments), | |
| this.$el.addClass("sj-icon-button icon-container").prepend('<span class="' + ("icon " + this.config.iconClass).trim() + '">'), | |
| this | |
| } | |
| }) | |
| }), | |
| define("gui/dropdown/simple", ["jquery", "underscore", "backbone"], function(e, t, n) { | |
| return n.View.extend({ | |
| tagName: "select", | |
| className: "sj-simpleDropdown", | |
| events: { | |
| change: "_onChange" | |
| }, | |
| initialize: function(e) { | |
| if (t.isUndefined(e) && !t.isObject(e)) | |
| throw new Error("opts required for SimpleDropdown"); | |
| if (!t.isArray(e.items) || !e.items.length) | |
| throw new Error("items required for SimpleDropdown"); | |
| this.items = e.items, | |
| !t.isUndefined(e.initialValue) && t.findWhere(this.items, { | |
| value: e.initialValue | |
| }) ? this.initialValue = e.initialValue : this.initialValue = this.items[0].value | |
| }, | |
| getValue: function() { | |
| return this.$el.val() | |
| }, | |
| setValue: function(t) { | |
| var n = this.$("option").filter(function() { | |
| return e(this).attr("value") === t | |
| }); | |
| return n.length === 1 && this.getValue() !== t && !this.isDisabledValue(t) && (this.$el.val(t), | |
| this._onChange()), | |
| this.getValue() | |
| }, | |
| _setDisabled: function(e, n) { | |
| t.isArray(e) || (e = [e]); | |
| var r = t.filter(this.items, function(t) { | |
| return e.indexOf(t.value) > -1 | |
| }, this); | |
| return t.each(r, function(e) { | |
| this.$el.find("[value='" + e.value + "']").prop("disabled", n) | |
| }, this), | |
| t.pluck(r, "value") | |
| }, | |
| _setNextPossibleValue: function() { | |
| var e = this.$(":selected"); | |
| e.is(":disabled") && this.setValue(this.$("option").not(":disabled")[0].value) | |
| }, | |
| disableValues: function(e) { | |
| var t = this._setDisabled(e, !0); | |
| return this._setNextPossibleValue(), | |
| t | |
| }, | |
| enableValues: function(e) { | |
| return this._setDisabled(e, !1) | |
| }, | |
| isDisabledValue: function(t) { | |
| var n = this.$("option").filter(function() { | |
| return e(this).attr("value") === t | |
| }); | |
| return n.is(":disabled") | |
| }, | |
| isDirty: function() { | |
| return this.getValue() !== this.initialValue | |
| }, | |
| render: function() { | |
| return this.$el.empty(), | |
| t.each(this.items, function(e) { | |
| this.$el.append('<option value="' + t.escape(e.value) + '">' + t.escape(e.text) + "</option>") | |
| }, this), | |
| this.$el.val(this.initialValue), | |
| this | |
| }, | |
| _onChange: function() { | |
| this.trigger("change", this.getValue()) | |
| } | |
| }) | |
| }), | |
| define("gui/grid/models/item", ["backbone"], function(e) { | |
| return e.Model.extend({}) | |
| }), | |
| define("gui/grid/collections/items", ["backbone", "../models/item"], function(e, t) { | |
| return e.Collection.extend({ | |
| model: t | |
| }) | |
| }), | |
| define("gui/grid/views/itemView", ["underscore", "backbone", "lang", "formatters", "api"], function(e, t, n, r, i) { | |
| return t.View.extend({ | |
| className: "sj-item", | |
| template: e.template(""), | |
| initialize: function(e) { | |
| e = e || {}, | |
| e.template && (this.template = e.template), | |
| e.dragdropEnabled && (this.dragdropEnabled = e.dragdropEnabled), | |
| this.$el.data("mid", this.model.id) | |
| }, | |
| render: function() { | |
| return this.el.innerHTML = this.template(this.templateData()), | |
| this | |
| }, | |
| templateData: function() { | |
| return { | |
| model: this.model, | |
| _: e, | |
| lang: n, | |
| formatters: r, | |
| API: i | |
| } | |
| } | |
| }) | |
| }), | |
| define("gui/grid/views/emptyView", ["underscore", "backbone", "lang"], function(e, t, n) { | |
| return t.View.extend({ | |
| className: "empty-view", | |
| template: function() {}, | |
| render: function() { | |
| return this.$el.html(this.template({ | |
| lang: n | |
| })), | |
| this | |
| } | |
| }) | |
| }), | |
| define("gui/grid/views/headerView", ["underscore", "jquery", "backbone", "lang"], function(e, t, n, r) { | |
| var i = n.View.extend({ | |
| className: "sj-item", | |
| events: { | |
| "click .sortable": "onSortClick" | |
| }, | |
| template: t.noop, | |
| initialize: function(t) { | |
| this.sortableCollection() && this.listenTo(this.collection, "sortBy", this.onSort), | |
| t && t.template && (this.template = e.template(t.template)) | |
| }, | |
| sortableCollection: function() { | |
| return this.collection && this.collection.sortable && this.collection.sortable.sortBy | |
| }, | |
| onSortClick: function(e) { | |
| if (this.sortableCollection()) { | |
| var n = t(e.currentTarget) | |
| , r = n.attr("data-field") | |
| , i = n.hasClass("asc") ? "desc" : "asc"; | |
| this.collection.sortable.sortBy(r, i) | |
| } | |
| }, | |
| onSort: function(e, t) { | |
| this.$(".sortable").removeClass("sorted").removeClass("asc desc").filter('[data-field="' + e + '"]').addClass("sorted").addClass(t) | |
| }, | |
| render: function() { | |
| var t = this.sortableCollection(); | |
| return this.$el.html(this.template({ | |
| _: e, | |
| lang: r, | |
| sortable: t | |
| })), | |
| t && this.onSort(this.collection.sortable.getKey(), this.collection.sortable.getDir()), | |
| this.delegateEvents(), | |
| this | |
| } | |
| }); | |
| return i | |
| }), | |
| define("isTouchDevice", [], function() { | |
| return "ontouchstart"in document.documentElement || "onmspointerdown"in document.documentElement || "onpointerdown"in document.documentElement | |
| }), | |
| define("mixins/droppable", ["underscore", "jquery", "backbone"], function(e, t, n) { | |
| function r(e) { | |
| try { | |
| if (e.relatedTarget.nodeType === 3 && e.relatedTarget.parentNode === e.target) | |
| return !1 | |
| } catch (t) {} | |
| return e.target !== e.relatedTarget | |
| } | |
| function i(e, n, r, i) { | |
| var s = n; | |
| while (s && s.nodeType === 1) { | |
| if (t.find.matchesSelector(s, r) && i(s)) | |
| return s; | |
| s = s !== e ? s.parentNode : null | |
| } | |
| return null | |
| } | |
| function s(e) { | |
| return ".droppable-" + e.cid | |
| } | |
| return { | |
| bind: function(t, o) { | |
| function c(e) { | |
| f && (l && l !== "none" && (e.originalEvent.dataTransfer.dropEffect = l), | |
| e.preventDefault(), | |
| e.stopPropagation()) | |
| } | |
| function h() { | |
| a = [], | |
| f = null | |
| } | |
| function p(n, r) { | |
| if (e.has(o, "eventData")) { | |
| var i = o.eventData.call(t, f, r); | |
| t.trigger(n, f, r, i) | |
| } else | |
| t.trigger(n, f, r) | |
| } | |
| var u, a, f, l; | |
| if (!t || !(t instanceof n.View)) | |
| throw new Error("first argument needs to be a Backbone view."); | |
| if (!e.isUndefined(o) && !e.isObject(o)) | |
| throw new Error("options has to be an object."); | |
| u = s(t), | |
| o = e.extend({ | |
| targetSelector: "", | |
| canDrop: !0 | |
| }, o), | |
| e.isFunction(o.canDrop) || (o.canDrop = e.constant(o.canDrop)), | |
| e.has(o, "eventData") && (e.isFunction(o.eventData) || (o.eventData = e.constant(o.eventData))), | |
| h(), | |
| t.$el.on("dragenter" + u, function(n) { | |
| if (!r(n)) | |
| return; | |
| a.length === 0 && t.trigger("drag:enter"), | |
| e.contains(a, n.target) || a.push(n.target); | |
| var s = n.originalEvent.dataTransfer | |
| , u = function(e) { | |
| return !!o.canDrop.call(t, e, s) | |
| } | |
| , h = i(t.el, n.target, o.targetSelector, u); | |
| f !== h && (f = h, | |
| p("drag:over", s), | |
| l = s.dropEffect), | |
| c(n) | |
| }), | |
| t.$el.on("dragleave" + u, function(n) { | |
| if (!r(n)) | |
| return; | |
| a = e.without(a, n.target), | |
| a.length === 0 && (h(), | |
| t.trigger("drag:leave")) | |
| }), | |
| t.$el.on("dragover" + u, c), | |
| t.$el.on("drop" + u, function(e) { | |
| f && (e.stopPropagation(), | |
| e.preventDefault(), | |
| p("drop", e.originalEvent.dataTransfer)), | |
| h(), | |
| t.trigger("drag:leave") | |
| }) | |
| }, | |
| unbind: function(e) { | |
| e.$el.off(s(e)) | |
| } | |
| } | |
| }), | |
| define("gui/grid/views/gridView", ["jquery", "underscore", "backbone", "./itemView", "./emptyView", "./headerView", "isTouchDevice", "mixins/droppable", "tracker"], function(e, t, n, r, i, s, o, u, a) { | |
| function l() {} | |
| var f = 201; | |
| return n.View.extend({ | |
| className: "sj-grid-wrapper", | |
| itemViewClass: r, | |
| itemViewOpts: {}, | |
| emptyViewClass: i, | |
| headerViewClass: s, | |
| itemViews: null, | |
| events: { | |
| click: "delegateEvent", | |
| "click .content .sj-item .selecticon": "select", | |
| "click .content .sj-item": "delegateEvent", | |
| "longpress .content .sj-item": "delegateEvent", | |
| "touchstart .content .sj-item .selecticon": "selectTouchStart", | |
| "touchstart .content .sj-item": "touchstart", | |
| "touchend .content .sj-item .selecticon": "prevent", | |
| "touchend .content .sj-item": "touchend", | |
| "touchmove .content .sj-item": "touchmove", | |
| "MSPointerDown .content .sj-item .selecticon": "selectTouchStart", | |
| "MSPointerDown .content .sj-item": "touchstart", | |
| "MSPointerMove .content .sj-item": "touchmoveMsPointerMove", | |
| "MSPointerUp .content .sj-item .selecticon": "selectMsPointerUp", | |
| "MSPointerUp .content .sj-item": "touchend", | |
| "pointerdown .content .sj-item .selecticon": "onPointerEvent", | |
| "pointerdown .content .sj-item": "onPointerEvent", | |
| "pointermove .content .sj-item": "onPointerEvent", | |
| "pointerup .content .sj-item .selecticon": "onPointerEvent", | |
| "pointerup .content .sj-item": "onPointerEvent", | |
| contextmenu: "contextmenu", | |
| MSHoldVisual: "prevent", | |
| "dragstart .content .sj-item": "_onDragStart", | |
| "dragend .content": "_onDragEnd" | |
| }, | |
| initialize: function(r) { | |
| r = t.extend({}, r), | |
| this.$headerEl = e('<div class="sj-grid header" />'), | |
| this.$contentEl = e('<div class="sj-grid content" />'), | |
| this.itemViews = new n.Collection, | |
| this.dragdropEnabled = !!r.dragdropEnabled, | |
| this.listenTo(this.collection, "add", this._renderOne), | |
| this.listenTo(this.collection, "add:end", this._onAddEnd), | |
| this.listenTo(this.collection, "remove", this.syncItemViewsRemove), | |
| this.listenTo(this.collection, "remove:end", this._onRemoveEnd), | |
| this.listenTo(this.collection, "reset", this.onReset), | |
| this.listenTo(this.collection, "sort", this.syncItemViewsSort), | |
| this._initializeItemViewsComparator(), | |
| r.itemViewClass && (this.itemViewClass = r.itemViewClass), | |
| r.itemTpl && (this.itemViewOpts = { | |
| template: t.template(r.itemTpl) | |
| }), | |
| r.emptyTpl && (this.emptyViewClass = i.extend({ | |
| template: t.template(r.emptyTpl) | |
| })), | |
| this.emptyView = new this.emptyViewClass, | |
| this.headerView = new this.headerViewClass({ | |
| collection: this.collection, | |
| template: r.headerTpl || null | |
| }); | |
| if (t.has(r, "canDrop")) { | |
| var s = r.canDrop; | |
| t.isFunction(s) || (s = t.constant(s)), | |
| u.bind(this, { | |
| targetSelector: ".content, .sj-item", | |
| canDrop: t.bind(function(e, t) { | |
| var n = this.findModelForElement(e); | |
| return s(e, t, n) | |
| }, this), | |
| eventData: t.bind(this.findModelForElement, this) | |
| }) | |
| } | |
| return this | |
| }, | |
| _initializeItemViewsComparator: function() { | |
| var e = this.collection.comparator; | |
| typeof e == "function" ? this.itemViews.comparator = function(t, n) { | |
| return e(t.get("view").model, n.get("view").model) | |
| } | |
| : this.itemViews.comparator = null | |
| }, | |
| _sortItemViews: function() { | |
| this._initializeItemViewsComparator(), | |
| this.itemViews.comparator && this.itemViews.sort() | |
| }, | |
| syncItemViewsSort: function() { | |
| this._sortItemViews(), | |
| this._appendAll() | |
| }, | |
| syncItemViewsRemove: function(e) { | |
| var t = this.itemViews.get(e.cid); | |
| t.get("view").remove(), | |
| this.itemViews.remove(t), | |
| this._appendEmpty() | |
| }, | |
| _onAddEnd: function(e) { | |
| t.each(e, function(e) { | |
| this._renderOne(this.collection.get(e.id)) | |
| }, this), | |
| this._appendAll() | |
| }, | |
| _onRemoveEnd: function(e) { | |
| var n = [], r; | |
| t.each(e, function(e) { | |
| r = this.itemViews.get(e.cid), | |
| n.push(r), | |
| r.get("view").remove() | |
| }, this), | |
| this.itemViews.remove(n, { | |
| silent: !0 | |
| }), | |
| this.itemViews.trigger("remove:end", n), | |
| this._appendEmpty() | |
| }, | |
| onReset: function() { | |
| this.emptyView.remove(), | |
| this.itemViews.each(function(e) { | |
| e.get("view").remove() | |
| }, this), | |
| this.itemViews.reset(), | |
| this.render() | |
| }, | |
| contextmenu: function(e) { | |
| var t = e.target.className || "" | |
| , n = /sj-grid/.test(t) ? "body" : "item" | |
| , r = this.findModelForElement(e.target); | |
| a.track({ | |
| op: "contextmenu", | |
| target: "grid-" + n | |
| }), | |
| r ? this.trigger("contextmenu", e, r) : this.trigger("contextmenu", e), | |
| this.prevent(e) | |
| }, | |
| scrollIntoView: function(t) { | |
| var n = this.collection.get(t), r, i, s, o, u; | |
| n && (r = this.getItemViewByModel(n)), | |
| r && (i = e([window, document]).add("body"), | |
| s = r.$el, | |
| o = this.itemViews.first().get("view").$el.offset().top - s.offsetParent().offset().top, | |
| u = s.position().top - o, | |
| e("<div>").css("top", i.scrollTop()).animate({ | |
| top: u | |
| }, { | |
| step: function(e) { | |
| i.scrollTop(e) | |
| } | |
| })) | |
| }, | |
| onPointerEvent: function() {}, | |
| prevent: function(e) { | |
| l("prevent", e), | |
| e.preventDefault(), | |
| e.stopPropagation() | |
| }, | |
| delegateEvent: function(e) { | |
| l("delegateEvent", (new Date).getTime(), e, this); | |
| var t = this.findModelForElement(e.currentTarget); | |
| return this.trigger(e.type, t, e), | |
| !1 | |
| }, | |
| select: function(e) { | |
| l("select", (new Date).getTime(), e, this), | |
| e.preventDefault(), | |
| e.stopPropagation(); | |
| var t = this.findModelForElement(e.currentTarget); | |
| return this.trigger("select", t, e), | |
| !1 | |
| }, | |
| selectTouchStart: function() { | |
| this.touchTime = new Date | |
| }, | |
| selectMsPointerUp: function(e) { | |
| l("selectMsPointerUp", e.originalEvent); | |
| var t = e.originalEvent; | |
| t.pointerType === t.MSPOINTER_TYPE_TOUCH && (this.select(e), | |
| e.preventDefault(), | |
| e.stopPropagation()) | |
| }, | |
| touchstart: function(n) { | |
| l("touchstart", (new Date).getTime(), this.touchTimeout, this), | |
| this.touchTime = new Date, | |
| this.is_ms(n) || (this.touchTimeout = setTimeout(t.bind(function() { | |
| this.touchTimeout ? (l("executing timeout", (new Date).getTime(), this.touchTimeout, this), | |
| e(n.target).trigger("longpress", n), | |
| this.touchTime = null) : l("timeout aborted", (new Date).getTime(), this.touchTimeout, this) | |
| }, this), f), | |
| l("setting new timeout", (new Date).getTime(), this.touchTimeout, this)) | |
| }, | |
| touchmove: function() { | |
| l("touchmove", (new Date).getTime(), this.touchTimeout, this), | |
| this.touchTimeout && (clearTimeout(this.touchTimeout), | |
| this.touchTimeout = null), | |
| this.touchTime = null | |
| }, | |
| touchmoveMsPointerMove: function(e) { | |
| l("MsPointerMove", e) | |
| }, | |
| touchend: function(t) { | |
| l("touchend", (new Date).getTime(), this.touchTimeout, this), | |
| this.touchTimeout && (l("timeout aborted touchend", (new Date).getTime(), this.touchTimeout, this), | |
| clearTimeout(this.touchTimeout), | |
| this.touchTimeout = null); | |
| var n = this.touchTime ? (new Date).getTime() - this.touchTime : 0; | |
| if (n && n < f) { | |
| if (!this.is_ms(t) || this.ms_isTouchPointer(t)) | |
| l("touchend", "click detected"), | |
| e(t.target).trigger("click", t) | |
| } else | |
| n >= f && (l("touchend", "longpress detected"), | |
| e(t.target).trigger("longpress", t)); | |
| this.touchTime = null | |
| }, | |
| ms_isTouchPointer: function(e) { | |
| var n = e.originalEvent; | |
| return this.is_ms(e) && t.contains([n.MSPOINTER_TYPE_TOUCH, n.MSPOINTER_TYPE_PEN, "touch", "pen"], n.pointerType) | |
| }, | |
| is_ms: function(e) { | |
| var t = e.originalEvent; | |
| return (t || {}).pointerType | |
| }, | |
| _appendEmpty: function() { | |
| this.itemViews.length || (this.$contentEl.has(this.emptyView.$el).length || (this.$headerEl.empty(), | |
| this.$contentEl.empty()), | |
| this.$contentEl.append(this.emptyView.render().$el)) | |
| }, | |
| _appendAll: function() { | |
| this._appendEmpty(), | |
| this.itemViews.length && (this.$contentEl.has(this.emptyView.$el).length && this.emptyView.remove(), | |
| this.$headerEl.append(this.headerView.render().$el), | |
| this.$contentEl.append(t.pluck(this.itemViews.pluck("view"), "$el"))) | |
| }, | |
| render: function() { | |
| return this.$el.append(this.$headerEl), | |
| this.$el.append(this.$contentEl), | |
| this.itemViews.comparator = null, | |
| this.collection.each(function(e) { | |
| this._renderOne(e) | |
| }, this), | |
| this._sortItemViews(), | |
| this._appendAll(), | |
| this.delegateEvents(), | |
| this | |
| }, | |
| _renderOne: function(e) { | |
| this.itemViews.length || this.$contentEl.empty(); | |
| var n = t.extend({}, this.itemViewOpts, { | |
| model: e, | |
| dragdropEnabled: this.dragdropEnabled | |
| }) | |
| , r = (new this.itemViewClass(n)).render(); | |
| this.itemViews.add({ | |
| id: e.cid, | |
| view: r | |
| }), | |
| e.selected && r.$el.addClass("selected") | |
| }, | |
| getItemViewByModel: function(e) { | |
| var t = this.itemViews.get(e.cid); | |
| return t ? t.get("view") : null | |
| }, | |
| findModelForElement: function(n) { | |
| n instanceof e && (n = n.get(0)); | |
| if (!n) | |
| return null; | |
| var r = t.find(this.itemViews.pluck("view"), function(e) { | |
| var t = e.el; | |
| return t.parentNode && (t === n || t.contains(n)) | |
| }); | |
| return r ? r.model : null | |
| }, | |
| remove: function() { | |
| this.emptyView.remove(), | |
| this.headerView.remove(), | |
| u.unbind(this), | |
| t.each(this.itemViews.pluck("view"), function(e) { | |
| e.remove() | |
| }), | |
| this.itemViews.reset([], { | |
| silent: !0 | |
| }), | |
| n.View.prototype.remove.apply(this) | |
| }, | |
| _onDragStart: function(t) { | |
| e(t.target).attr("draggable") && this.trigger("drag:start", t, this.findModelForElement(t.target)) | |
| }, | |
| _onDragEnd: function(e) { | |
| this.trigger("drag:end", e) | |
| } | |
| }) | |
| }), | |
| define("gui/grid/grid", ["jquery", "underscore", "backbone", "./collections/items", "./views/gridView"], function(e, t, n, r, i) { | |
| return function(e) { | |
| return (new i(e)).render() | |
| } | |
| }), | |
| define("modules/helpers/image", ["jquery"], function(e) { | |
| return { | |
| preload: function(t) { | |
| var n = e.Deferred() | |
| , r = new Image; | |
| return r.onload = function() { | |
| r.onload = null, | |
| n.resolve(r) | |
| } | |
| , | |
| r.onerror = n.reject, | |
| r.src = t, | |
| n.promise() | |
| } | |
| } | |
| }), | |
| define("gui/grid/lazyGrid", ["jquery", "underscore", "backbone", "./collections/items", "./views/gridView", "api", "modules/helpers/image"], function(e, t, n, r, i, s, o) { | |
| var u = i.extend({ | |
| namespace: null, | |
| container: null, | |
| $container: null, | |
| initialize: function(n) { | |
| i.prototype.initialize.apply(this, arguments), | |
| this._lazyLoad = t.throttle(this._lazyLoad, 750, { | |
| leading: !1, | |
| trailing: !0 | |
| }), | |
| this.listenTo(this.collection, "load", this._lazyLoad), | |
| this.listenTo(this.collection, "sort", this._lazyLoad), | |
| this.listenTo(this.collection, "remove:end add:end", this._lazyLoad), | |
| this.listenTo(this.itemViews, "change:load", this.onVisible), | |
| this.listenTo(this, "viewmode", this._lazyLoad), | |
| this.namespace = (new Date).getTime(), | |
| n.container ? e(n.container).length ? this._setContainerAndBind(n.container) : e(this.container).length ? this._setContainerAndBind(this.container) : this.container = n.container : this._setContainerAndBind(window) | |
| }, | |
| _setContainerAndBind: function(n) { | |
| this.$container = e(n).on("scroll." + this.namespace + " resize." + this.namespace, t.bind(this._lazyLoad, this)) | |
| }, | |
| remove: function() { | |
| e(this.$container || this.container || window).off("." + this.namespace), | |
| i.prototype.remove.apply(this, arguments) | |
| }, | |
| _lazyLoad: function() { | |
| this.$container || this._setContainerAndBind(this.container); | |
| var e = this.$container.scrollTop() | |
| , t = this.$container.height() + e; | |
| this.itemViews.find(function(n) { | |
| if (n.get("load")) | |
| return !1; | |
| var r = n.get("view").$el | |
| , i = r.position().top - r.parent().position().top | |
| , s = r.height(); | |
| return i + s < e ? !1 : i >= t ? !0 : (n.set({ | |
| load: !0 | |
| }), | |
| !1) | |
| }) | |
| }, | |
| onVisible: function(e, n, r, i) { | |
| var u = e.get("view") | |
| , a = u.model | |
| , f = i ? i.width : 210 | |
| , l = i ? i.height : 210 | |
| , c = !i; | |
| a.get("group") === "thumb" && s.getThumbnail(a, { | |
| width: f, | |
| height: l | |
| }).then(t.bind(function(n) { | |
| n && o.preload(n).then(t.bind(function(t) { | |
| this._applyThumbnailImage(e, t, c) | |
| }, this)) | |
| }, this)) | |
| }, | |
| _applyThumbnailImage: function(t, n, r) { | |
| var i = n.width, s = n.height, o = n.src, u = t.get("view").$el, a = e(".itemcontent .file-item-icon", u), f = e("<div />").css("background-image", "url(" + o + ")"), l, c, h, p, d; | |
| u.addClass("isthumbnail"), | |
| r && this._adjustThumbnail(t, f, n, 140, 210), | |
| l = i >= s, | |
| c = i >= 140, | |
| h = i >= 120, | |
| p = s >= 140, | |
| d = s >= 120, | |
| i < 40 && s < 40 ? f.css("background-size", "inherit") : l && p ? f.addClass("m_by") : !l && c ? f.addClass("m_bx") : !l && !c && d ? f.addClass("m_y") : l && !p && h && f.addClass("m_x"), | |
| a.empty().append(f).addClass("file-item-image-preview").removeClass("file-item-image-icon") | |
| }, | |
| _loadThumbnail: function(e, t) { | |
| this.onVisible(e, undefined, undefined, t) | |
| }, | |
| _adjustThumbnail: function(e, t, n, r, i) { | |
| var s = r | |
| , o = r | |
| , u = ""; | |
| n.width === i && n.height < o && (s = Math.ceil(i * o / n.height), | |
| u = s + "px " + o + "px", | |
| this._loadThumbnail(e, { | |
| height: o | |
| })), | |
| n.height === i && n.width < s && (o = Math.ceil(i * s / n.width), | |
| u = s + "px " + o + "px", | |
| this._loadThumbnail(e, { | |
| width: s | |
| })), | |
| u.length && t.css("background-size", u) | |
| } | |
| }); | |
| return u | |
| }), | |
| define("text!templates/gui/breadcrumb/breadcrumb.html", [], function() { | |
| return '<%\nif (segments.length> 1) {\n// root\nvar root = segments.shift();\n%>\n <div class="root segment">\n <%\n if (root.icon) {\n %>\n <span class="icon <%= root.icon.className %>" title="<%= root.icon.title %>"></span>\n <%\n }\n %>\n <a href="<%= root.href %>" class="link text" title="<%- root.title %>">\n <%- root.name %>\n </a>\n <% if (segments.length> 0) { %>\n <span class="bg-sprite arrow"></span>\n <% } %>\n </div>\n<% } %>\n\n<div class="inner">\n<%\nvar slength = segments.length -1,\n predecessor;\n_.each(segments.reverse(), function(segment, index) {\n var current = !index,\n last = slength == index;\n // to generate the ...> link\n predecessor = segments[index+1];\n%>\n <div class="segment <% if (current) { print(\'current\'); } else if(last) { print(\'last\'); }%>">\n <% if (!last && predecessor) { %>\n <a href="<%= predecessor.href %>" class="hellip link" title="<%- predecessor.title || predecessor.name %>">…</a>\n <span class="bg-sprite arrow"></span>\n <% } %>\n <%\n if (segment.icon) {\n %>\n <span class="icon <%= segment.icon.className %>" title="<%= segment.icon.title %>"></span>\n <%\n }\n %>\n <a <% if (!current) { %>href="<%= segment.href %>"<% } %> class="<% if(!current) { %>link<% } %> text" title="<%- segment.title || segment.name %>">\n <%- segment.name %>\n </a>\n </div>\n<%\n});\n%>\n\n</div>\n' | |
| }), | |
| define("gui/breadcrumb/breadcrumb", ["jquery", "underscore.mixin", "backbone", "text!templates/gui/breadcrumb/breadcrumb.html"], function(e, t, n, r) { | |
| return n.View.extend({ | |
| className: "sj-breadcrumb", | |
| segments: [], | |
| events: { | |
| "click .link": "_onLinkClick", | |
| "click .icon": "_onIconClick" | |
| }, | |
| defaults: { | |
| single_segment_length: 19, | |
| path_max_length: 70, | |
| prefix: "" | |
| }, | |
| initialize: function(e) { | |
| this.config = t.extend({}, this.defaults, e) | |
| }, | |
| template: t.template([r].join("")), | |
| render: function() { | |
| return this.$el.empty().append(this.template({ | |
| segments: t.clone(this.segments) | |
| }, this)), | |
| this | |
| }, | |
| _onLinkClick: function(t) { | |
| t.preventDefault(); | |
| var n = e(t.target).attr("href"), r = e(t.target).hasClass("level-up"), i; | |
| n || (n = e(t.currentTarget).attr("href")); | |
| if (!n) | |
| return; | |
| r || (r = e(t.currentTarget).hasClass("level-up")), | |
| n = n.replace(this.config.prefix, ""), | |
| i = r ? "breadcrumb-arrow" : "breadcrumb-path", | |
| this.trigger("click", n, i) | |
| }, | |
| _onIconClick: function(e) { | |
| this.trigger("iconclick", e) | |
| }, | |
| setSegments: function(e) { | |
| return t.each(e, function(e) { | |
| e.href = this.config.prefix + e.href | |
| }, this), | |
| this.segments = e, | |
| this.render() | |
| }, | |
| addSegment: function(e) { | |
| return this.segments.push(e), | |
| this.render() | |
| } | |
| }) | |
| }), | |
| define("text!gui/toast/views/toastView.html", [], function() { | |
| return '<div class="toast-body sj-selectable">\n <span class="toast-close icon-container">\n <span class="icon-toast-close"></span>\n </span>\n <span class="message"><%= msg %></span>\n</div>\n' | |
| }), | |
| define("gui/toast/views/toastView", ["underscore", "backbone", "jquery", "lang", "z-index-mgr", "text!./toastView.html"], function(e, t, n, r, i, s) { | |
| return t.View.extend({ | |
| className: "toast", | |
| events: { | |
| "click .toast-close": "onToastClose", | |
| mouseover: "stopTimeOut", | |
| mouseout: "restartTimeOut" | |
| }, | |
| types: ["positive", "negative"], | |
| defaultType: "negative", | |
| initialize: function() { | |
| this.messages = [], | |
| this._currentMessage = null, | |
| this.listenTo(r, "change", this.onLanguageChange) | |
| }, | |
| render: function(t) { | |
| if (e.isString(t) || e.isFunction(t)) | |
| t = { | |
| msg: t | |
| }; | |
| if (e.isUndefined(t.type) || !e.contains(this.types, t.type)) | |
| t.type = this.defaultType; | |
| return t = e.defaults(t, { | |
| unescape: !1 | |
| }), | |
| this.messages.push(t), | |
| this._renderNext(), | |
| this | |
| }, | |
| _renderNext: function() { | |
| delete this._currentMessage; | |
| if (!this.messages.length) | |
| return; | |
| this._timeout || (this._currentMessage = this.messages.shift(), | |
| this._renderBody(), | |
| this._startTimeout(this._currentMessage.type !== this.defaultType ? 3e3 : 11e3)) | |
| }, | |
| onLanguageChange: function() { | |
| this._renderBody() | |
| }, | |
| _renderBody: function() { | |
| var t = this._currentMessage; | |
| if (!t) | |
| return; | |
| var r = e.result(t, "msg"); | |
| t.unescape || (r = e.escape(r)), | |
| this.$el.removeClass(this.types.join(" ")).addClass(t.type); | |
| var o = n(e.template(s)({ | |
| msg: r | |
| })).hide(); | |
| this.$el.css("z-index", i()), | |
| this.$el.prependTo("body").html(o), | |
| this.$(".toast-body").fadeIn(500) | |
| }, | |
| _hide: function(e) { | |
| var t = this; | |
| this.$(".toast-body").fadeOut(500, function() { | |
| t.$el.detach(), | |
| e && e() | |
| }) | |
| }, | |
| stopTimeOut: function() { | |
| clearTimeout(this._timeout), | |
| delete this._timeout | |
| }, | |
| restartTimeOut: function() { | |
| this._startTimeout(3e3) | |
| }, | |
| onToastClose: function() { | |
| clearTimeout(this._timeout), | |
| delete this._timeout, | |
| this._hideAndContinue() | |
| }, | |
| _hideAndContinue: function() { | |
| this._hide(e.bind(function() { | |
| this._renderNext() | |
| }, this)) | |
| }, | |
| _startTimeout: function(t) { | |
| this._timeout = setTimeout(e.bind(function() { | |
| delete this._timeout, | |
| this._hideAndContinue() | |
| }, this), t) | |
| } | |
| }) | |
| }), | |
| define("gui/toast/toast", ["./views/toastView"], function(e) { | |
| return e | |
| }), | |
| define("text!gui/tooltip/views/tooltipView.html", [], function() { | |
| return '<div class="sj-tooltip-body sj-selectable"><%= body %></div>\n<div class="sj-tooltip-tip"></div>\n' | |
| }), | |
| define("gui/tooltip/views/tooltipView", ["jquery", "underscore", "backbone", "z-index-mgr", "text!./tooltipView.html"], function(e, t, n, r, i) { | |
| return n.View.extend({ | |
| className: "sj-tooltip", | |
| tpl: t.template(i), | |
| initialize: function(t) { | |
| this._html = t.html, | |
| this._extraClasses = t.extraClasses || "", | |
| this._namespace = String((new Date).getTime()), | |
| this._$relatedEl = e(t.relatedEl) | |
| }, | |
| show: function() { | |
| this.$el.css({ | |
| "z-index": r() | |
| }), | |
| this.$el.show(), | |
| this.align() | |
| }, | |
| hide: function() { | |
| this.$el.hide() | |
| }, | |
| render: function() { | |
| return e(window).on("resize." + this._namespace, t.throttle(t.bind(this.align, this), 250)), | |
| this.$el.html(this.tpl({ | |
| body: this._html | |
| })).addClass(this._extraClasses), | |
| this.$el.appendTo("body"), | |
| this.hide(), | |
| this | |
| }, | |
| align: function() { | |
| if (!this.$el.is(":visible")) | |
| return; | |
| if (!this._$relatedEl.length) | |
| return; | |
| var e = parseInt(this.$el.css("margin-bottom"), 10) || 0 | |
| , t = this._$relatedEl.offset(); | |
| this.$el.css({ | |
| left: t.left, | |
| top: t.top - e - this.$el.height() | |
| }); | |
| return | |
| }, | |
| remove: function() { | |
| return delete this.$relatedEl, | |
| e(window).off("resize." + this._namespace), | |
| n.View.prototype.remove.call(this), | |
| this | |
| } | |
| }) | |
| }), | |
| define("gui/tooltip/tooltip", ["./views/tooltipView"], function(e) { | |
| return e | |
| }), | |
| define("gui/tooltip/views/infoTooltip", ["jquery", "underscore", "backbone", "./tooltipView"], function(e, t, n, r) { | |
| return n.View.extend({ | |
| tagName: "span", | |
| className: "sj-info-tooltip", | |
| events: { | |
| click: "_onClick" | |
| }, | |
| initialize: function(e) { | |
| this.options = t.extend({}, e), | |
| this._isTooltipVisible = !1, | |
| this.tooltip = new r({ | |
| relatedEl: this.$el, | |
| html: this.options.contentHtml | |
| }) | |
| }, | |
| render: function() { | |
| return this.tooltip.render(), | |
| this.$el.addClass("icon icon-info-tooltip"), | |
| this.options.iconClassname && this.$el.addClass(this.options.iconClassname), | |
| this | |
| }, | |
| _onClick: function() { | |
| this._isTooltipVisible || this.tooltipShow() | |
| }, | |
| tooltipShow: function() { | |
| e(document).on("click." + this.cid, t.bind(function(t) { | |
| !e(t.target).closest(this.$el).length && !e(t.target).closest(this.tooltip.$el).length && this.tooltipHide() | |
| }, this)), | |
| this.tooltip.show(), | |
| this._isTooltipVisible = !0 | |
| }, | |
| _unbindDocumentClick: function() { | |
| e(document).off("click." + this.cid) | |
| }, | |
| tooltipHide: function() { | |
| this.tooltip.hide(), | |
| this._unbindDocumentClick(), | |
| this._isTooltipVisible = !1 | |
| }, | |
| remove: function() { | |
| this.tooltip.remove(), | |
| this._unbindDocumentClick(), | |
| n.View.prototype.remove.apply(this) | |
| } | |
| }) | |
| }), | |
| define("gui/flyout/views/flyoutView", ["jquery", "backbone"], function(e, t) { | |
| return t.View.extend({ | |
| className: "sj-flyout", | |
| initialize: function(e) { | |
| e && e.className && (this.className = e.className) | |
| }, | |
| toggle: function() { | |
| this.$el.hasClass("open") ? this.close() : this.open() | |
| }, | |
| open: function() { | |
| var t = this; | |
| this.$el.addClass("open"), | |
| e(document).on("mousedown.sj-flyout", function(n) { | |
| e(n.target).closest(t.$el).length || t.close() | |
| }) | |
| }, | |
| close: function() { | |
| this.$el.removeClass("open"), | |
| e(document).off("mousedown.sj-flyout") | |
| }, | |
| render: function() { | |
| return this.triggerView ? this.contentView ? (this.triggerView instanceof t.View ? this.$el.append(this.triggerView.render().$el.addClass("trigger")) : this.$el.append(this.triggerView.addClass("trigger")), | |
| this.$el.append(this.contentView.render().$el), | |
| this) : (console.error("contentView is mandatory"), | |
| this) : (console.error("triggerView is mandatory"), | |
| this) | |
| }, | |
| remove: function() { | |
| return this.triggerView && this.triggerView.remove(), | |
| this.contentView && this.contentView.remove(), | |
| t.View.prototype.remove.apply(this, arguments) | |
| } | |
| }) | |
| }), | |
| define("gui/flyout/flyout", ["./views/flyoutView"], function(e) { | |
| return e | |
| }), | |
| define("gui/overlay/overlay", ["./views/overlayView"], function(e) { | |
| return e | |
| }), | |
| define("gui/overlay/waitOverlay", ["underscore", "./views/baseOverlayView"], function(e, t) { | |
| var n = t.extend({ | |
| defaults: { | |
| message: "" | |
| }, | |
| initialize: function(t) { | |
| this.options = e.extend(this.defaults, t) | |
| }, | |
| render: function() { | |
| return this.$overlayEl.addClass("sj-wait-overlay sj-selectable"), | |
| this.$el.html('<span class="icon icon-loading"></span><span class="wait-overlay-message">' + this.options.message + "</span>"), | |
| this | |
| } | |
| }); | |
| return n | |
| }), | |
| define("gui/editor/views/editor", ["jquery", "underscore", "backbone", "../../tooltip/tooltip", "jquery-watermark"], function(e, t, n, r, i) { | |
| return n.View.extend({ | |
| inputTpl: t.template('<input type="text">'), | |
| events: { | |
| "keypress input": "_onKeypress", | |
| "keyup input": "_onKeyup", | |
| focusin: "_onFocusIn", | |
| focusout: "_onFocusOut", | |
| "focus input": "_onFocus", | |
| "blur input": "_onBlur" | |
| }, | |
| defaults: { | |
| showValidationErrorIcon: !0, | |
| selectOnFocus: !1, | |
| leftIcon: null, | |
| rightIcon: null | |
| }, | |
| initialValue: null, | |
| config: null, | |
| placeholder: null, | |
| initialize: function(n) { | |
| this.config = t.extend({}, this.defaults, n), | |
| this.config.filter && (this.config.filter instanceof RegExp || (this.config.filter = null, | |
| console.error("EditorView expected a regex as filter in constructor config"))), | |
| this.config.filterTooltipHtml && (this._tooltip = (new r({ | |
| relatedEl: this.$el, | |
| html: this.config.filterTooltipHtml | |
| })).render()), | |
| this.$input = e(this.inputTpl(this)), | |
| this.config.name && this.$input.attr("name", this.config.name), | |
| this.config.placeholder && (this.placeholder = this.config.placeholder), | |
| this.setValue("", !0) | |
| }, | |
| _onKeypress: function(e) { | |
| this.config.filter && this.filterText(e) | |
| }, | |
| _onKeyup: function(e) { | |
| e.keyCode === 27 && (this.setValue(this.tempValue), | |
| this.$input.focusout().blur()) | |
| }, | |
| _onFocusIn: function(n) { | |
| this.trigger("focusIn", n), | |
| this.$el.addClass("sj-editor-focused"), | |
| e(n.target).is("input") && (this.tempValue = this.$input.val()), | |
| this.config.selectOnFocus && t.delay(t.bind(this.setSelection, this)) | |
| }, | |
| _onFocus: function() { | |
| this.trigger("focus") | |
| }, | |
| _onFocusOut: function(e) { | |
| this.trigger("focusOut", e), | |
| this.$el.removeClass("sj-editor-focused"), | |
| t.isFunction(this.config.validationFunc) && this._validateOnBlur() | |
| }, | |
| _validateOnBlur: function() { | |
| this.validate(this.getValue()) | |
| }, | |
| _onBlur: function() { | |
| this.trigger("blur") | |
| }, | |
| render: function() { | |
| return this.$el.html(this.$input), | |
| this.delegateEvents(), | |
| this.$el.addClass("sj-editor"), | |
| this.config.leftIcon && this.setLeftIcon(this.config.leftIcon), | |
| this.config.rightIcon && this.setRightIcon(this.config.rightIcon), | |
| this | |
| }, | |
| setValue: function(e, n) { | |
| return t.isUndefined(e) && (e = ""), | |
| this.$input.val(e), | |
| n && (this.initialValue = e), | |
| this | |
| }, | |
| getValue: function() { | |
| return this.$input.val() | |
| }, | |
| setPlaceholder: function(e) { | |
| var t = e || this.placeholder; | |
| if (t) { | |
| var n = this.$input.closest(".watermark_container"); | |
| n.length && (n.parent().append(this.$input), | |
| n.remove(), | |
| this.$input.off(".jq_watermark"), | |
| this.$input.removeAttr("data-jq-watermark")), | |
| this.$input.attr("placeholder", t), | |
| this.$input.watermark() | |
| } | |
| }, | |
| setLeftIcon: function(t) { | |
| this.$("span.icon:first-child").remove(), | |
| t && (e("<span />").prependTo(this.$el).attr("class", "icon " + t), | |
| this.$el.addClass("sj-editor-icon")) | |
| }, | |
| setRightIcon: function(t) { | |
| this.$("span.icon:last-child").remove(), | |
| t && (e("<span />").appendTo(this.$el).attr("class", "icon " + t), | |
| this.$el.addClass("sj-editor-icon")) | |
| }, | |
| remove: function() { | |
| return this._tooltip && this._tooltip.remove(), | |
| n.View.prototype.remove.call(this), | |
| this | |
| }, | |
| showTooltip: function() { | |
| this._tooltip && this._tooltip.show() | |
| }, | |
| hideTooltip: function() { | |
| this._tooltip && this._tooltip.hide() | |
| }, | |
| filterText: function(e) { | |
| var t = String.fromCharCode(e.which || e.keyCode); | |
| this.config.filter.test(t) && (e.preventDefault(), | |
| this.trigger("filter:error", t)) | |
| }, | |
| setSelection: function(e) { | |
| e || (e = this.getValue().length), | |
| this.$el.hasClass("sj-editor-focused") || this.$input.focus(), | |
| this.$input[0].setSelectionRange(0, e) | |
| }, | |
| isDirty: function() { | |
| return this.getValue() !== this.initialValue | |
| }, | |
| validate: function() { | |
| var n = e.Deferred(), r = this.getValue(), i; | |
| if (this.config.required && r.length === 0) | |
| i = n.reject().promise(); | |
| else if (t.isFunction(this.config.validationFunc) && this.isDirty()) { | |
| i = this.config.validationFunc(r, this); | |
| if (!i || !t.isFunction(i.then)) | |
| throw new Error("The validation function doesn't return a promise.") | |
| } else | |
| i = n.resolve().promise(); | |
| return i.done(t.bind(function() { | |
| this.trigger("validate:success", r), | |
| this.toggleError(!1) | |
| }, this)).fail(t.bind(function() { | |
| this.trigger("validate:error", r), | |
| this.toggleError(!0) | |
| }, this)) | |
| }, | |
| toggleError: function(e) { | |
| this.$el.toggleClass("error", e), | |
| this.config.showValidationErrorIcon && this.setRightIcon(e ? "icon-validation-error" : null) | |
| }, | |
| getInput: function() { | |
| return this.$input | |
| } | |
| }) | |
| }), | |
| define("gui/editor/views/inlineEditor", ["underscore", "./editor"], function(e, t) { | |
| return t.extend({ | |
| inputTpl: e.template('<textarea rows="1"></textarea>'), | |
| tooltipAutohideTimeout: 3e3, | |
| events: e.extend({}, t.prototype.events, { | |
| "keypress textarea": "_onKeypress", | |
| "click textarea": "_stopPropagation", | |
| "dblclick textarea": "_stopPropagation", | |
| "touchstart textarea": "_stopPropagation", | |
| "touchend textarea": "_stopPropagation", | |
| "longpress textarea": "_stopPropagation", | |
| "mouseup textarea": "_stopPropagation", | |
| "mousedown textarea": "_stopPropagation", | |
| "MSPointerDown textarea": "_stopPropagation", | |
| "MSPointerUp textarea": "_stopPropagation", | |
| "MSHoldVisual textarea": "_stopPropagation", | |
| "pointerup textarea": "_stopPropagation", | |
| "pointerdown textarea": "_stopPropagation", | |
| "contextmenu textarea": "_stopPropagation", | |
| "blur textarea": "_blur", | |
| "focus textarea": "_constrainDimensions", | |
| "keyup textarea": "_keyup", | |
| "paste textarea": "_paste" | |
| }), | |
| initialize: function() { | |
| t.prototype.initialize.apply(this, arguments), | |
| this.config.pasteFilter && (this.config.pasteFilter instanceof RegExp || (this.config.pasteFilter = null, | |
| console.error("Config ignored: 'pasteFilter' config should be a Regular Expression!"))), | |
| this.listenTo(this, "filter:error", this.onFilter) | |
| }, | |
| render: function() { | |
| return t.prototype.render.apply(this, arguments), | |
| this.$el.addClass("sj-inline-editor"), | |
| this | |
| }, | |
| remove: function() { | |
| return this._tooltip && this._stopTooltipAutohide(), | |
| t.prototype.remove.call(this), | |
| this | |
| }, | |
| save: function(e) { | |
| this.trigger("done", e) | |
| }, | |
| _paste: function(e) { | |
| var t; | |
| if (!this.config.pasteFilter) | |
| return; | |
| e.preventDefault(); | |
| if (e.originalEvent.clipboardData) | |
| t = e.originalEvent.clipboardData.getData("text/plain"); | |
| else { | |
| if (!window.clipboardData) | |
| return; | |
| t = window.clipboardData.getData("Text") | |
| } | |
| t = t.replace(this.config.pasteFilter, " "), | |
| this._insert(t), | |
| this.trigger("paste", e) | |
| }, | |
| _insert: function(e) { | |
| var t, n, r = this.$input.val(), i = this.$input[0]; | |
| t = i.selectionStart, | |
| n = i.selectionEnd, | |
| this.$input.val(r.substring(0, t) + e + r.substring(n)), | |
| i.selectionStart = t + e.length, | |
| i.selectionEnd = t + e.length | |
| }, | |
| _onKeypress: function(e) { | |
| e.which === 13 && e.preventDefault(), | |
| t.prototype._onKeypress.apply(this, arguments), | |
| this._constrainDimensions() | |
| }, | |
| _constrainDimensions: function() { | |
| var e = this.$input[0]; | |
| e.scrollWidth === e.clientWidth && this.$input.css("width", ""), | |
| e.scrollHeight === e.clientHeight && this.$input.css("height", ""), | |
| e.scrollWidth > e.clientWidth && this.$input.css("width", e.scrollWidth), | |
| e.scrollHeight > e.clientHeight && this.$input.css("height", e.scrollHeight) | |
| }, | |
| _blur: function(e) { | |
| this.save(e) | |
| }, | |
| _stopPropagation: function(e) { | |
| e.stopPropagation() | |
| }, | |
| _keyup: function(e) { | |
| e.which === 13 ? this.save(e) : e.which === 27 ? this.trigger("abort", e) : this._constrainDimensions() | |
| }, | |
| _stopTooltipAutohide: function() { | |
| this._autoHideTimeout && (clearTimeout(this._autoHideTimeout), | |
| this._autoHideTimeout = null) | |
| }, | |
| onFilter: function() { | |
| this.showTooltip(), | |
| this._autoHideTimeout = setTimeout(e.bind(this.hideTooltip, this), this.tooltipAutohideTimeout) | |
| } | |
| }) | |
| }), | |
| define("gui/editor/views/textEditor", ["./editor"], function(e) { | |
| return e.extend({ | |
| initialize: function(t) { | |
| e.prototype.initialize.apply(this, arguments), | |
| t && (t.readonly && (this.$input.prop("readonly", !0), | |
| this.$el.addClass("sj-text-editor-readonly")), | |
| t.disabled && this.setDisabled(!0)) | |
| }, | |
| render: function() { | |
| return e.prototype.render.apply(this, arguments), | |
| this.$el.addClass("sj-text-editor"), | |
| this | |
| }, | |
| setDisabled: function(e) { | |
| this.$input.prop("disabled", e === !0), | |
| this.$el.toggleClass("sj-text-editor-disabled", e === !0), | |
| e === !0 && this.toggleError(!1) | |
| }, | |
| getDisabled: function() { | |
| return this.$input.prop("disabled") | |
| } | |
| }) | |
| }), | |
| define("gui/editor/views/passwordEditor", ["underscore", "./textEditor"], function(e, t) { | |
| return t.extend({ | |
| initialDisabled: null, | |
| initialize: function(e) { | |
| t.prototype.initialize.apply(this, arguments), | |
| this.$input.attr("type", "password"), | |
| this.initialDisabled = !!e && !!e.disabled | |
| }, | |
| isDirty: function() { | |
| var e = t.prototype.isDirty.call(this); | |
| return e || this.initialDisabled !== this.getDisabled() | |
| }, | |
| _validateOnBlur: function() { | |
| this.getValue() !== "" ? this.validate(this.getValue()) : this.toggleError(!1) | |
| } | |
| }) | |
| }), | |
| define("keycodes/keycodes", ["underscore"], function(e) { | |
| var t = { | |
| shift: [16, !0], | |
| ctrl: [17, !0], | |
| alt: [18, !0], | |
| altGr: [225, !0], | |
| capsLock: [20, !0], | |
| meta1: [91, !0], | |
| meta2: [92, !0], | |
| meta3: [93, !0], | |
| backspace: 8, | |
| tab: 9, | |
| enter: 13, | |
| pause: 19, | |
| escape: 27, | |
| pageUp: 33, | |
| pageDown: 34, | |
| end: 35, | |
| home: 36, | |
| leftArrow: 37, | |
| upArrow: 38, | |
| rightArrow: 39, | |
| downArrow: 40, | |
| insert: 45, | |
| "delete": 46 | |
| } | |
| , n = e.chain(t); | |
| return e.extend({ | |
| keyCodes: n.map(function(t) { | |
| return e.isArray(t) ? t[0] : t | |
| }).value(), | |
| modifierKeys: n.filter(function(t) { | |
| return e.isArray(t) && t[1] | |
| }).map(function(t) { | |
| return e.isArray(t) ? t[0] : t | |
| }), | |
| scrollKeys: [t.pageUp, t.pageDown, t.end, t.home, t.upArrow, t.downArrow] | |
| }, t) | |
| }), | |
| define("keycodes", ["keycodes/keycodes"], function(e) { | |
| return e | |
| }), | |
| define("gui/editor/views/taglistEditor", ["underscore", "./textEditor", "keycodes", "jquery"], function(e, t, n, r) { | |
| return t.extend({ | |
| _tags: undefined, | |
| _separator: /[\s,;]+/, | |
| defaults: e.extend({ | |
| submitOnEnter: !0 | |
| }, t.prototype.defaults), | |
| events: e.extendEvents({ | |
| "keypress input": "_onKeypress", | |
| "keyup .tag button": "onKeyupTag", | |
| "keydown .tag button": "onKeyDownTag", | |
| "keydown input": "_onKeydown", | |
| "click .icon-removetag": "onRemoveTag", | |
| "click .tag": "onClickTag", | |
| click: "onClick", | |
| "focus .tag button": "onFocusButtonTag", | |
| "blur .tag button": "onBlurButtonTag", | |
| "keyup input": "_onKeyup", | |
| "blur input": "_onBlur" | |
| }, t), | |
| initialize: function() { | |
| t.prototype.initialize.apply(this, arguments), | |
| this._tags = [], | |
| this._tagCreationEnabled = !0 | |
| }, | |
| render: function() { | |
| return t.prototype.render.apply(this, arguments), | |
| this.$el.addClass("taglist"), | |
| e.each(this._tags, e.bind(function(e) { | |
| r(this._tagTpl({ | |
| value: e | |
| })).insertBefore(this.$input) | |
| }, this)), | |
| this | |
| }, | |
| _tagTpl: e.template('<span class="tag" title="<%- value %>"><button type="button"><%- value %></button><span class="icon-removetag" /></span>'), | |
| setValue: function(t) { | |
| var n, r = this._getEditorValue(); | |
| e.isArray(t) || (t = [t]); | |
| do | |
| n = this.$(".tag").first(), | |
| this.removeTag(n); | |
| while (n.length);return t = r.split(this._separator).concat(t), | |
| this._buildTags(t), | |
| this | |
| }, | |
| _setEditorValue: function() { | |
| t.prototype.setValue.apply(this, arguments) | |
| }, | |
| _getEditorValue: function() { | |
| return t.prototype.getValue.call(this) | |
| }, | |
| createTags: function() { | |
| return this._buildTags(this._getEditorValue().split(this._separator)) | |
| }, | |
| _buildTags: function(t) { | |
| t = e.uniq(e.compact(t)), | |
| this._setEditorValue(""); | |
| if (!t.length) | |
| return r.Deferred().resolve().promise(); | |
| var n = e.map(t, e.bind(function(t) { | |
| var n = r.Deferred(); | |
| return this.validateTag(t).done(e.bind(function() { | |
| this.createTag(t), | |
| n.resolve() | |
| }, this)).fail(e.bind(function() { | |
| n.reject(t) | |
| }, this)), | |
| n | |
| }, this)) | |
| , i = r.Deferred() | |
| , s = { | |
| all: n.length, | |
| failed: 0, | |
| done: 0, | |
| notCreatedTags: [] | |
| }; | |
| return e.each(n, e.bind(function(e) { | |
| e.done(function() { | |
| s.done++ | |
| }).fail(function(e) { | |
| s.notCreatedTags.push(e), | |
| s.failed++ | |
| }) | |
| }, this)), | |
| s.failed ? (this._setEditorValue(s.notCreatedTags.join(" ")), | |
| this.trigger("validate:error"), | |
| this.toggleError(!0), | |
| i.reject(s)) : (this.trigger("validate:success"), | |
| this.toggleError(!1), | |
| i.resolve(s)), | |
| i | |
| }, | |
| createTag: function(e) { | |
| var t = !1, n; | |
| return e && this._tags.indexOf(e) < 0 && (this._tags.push(e), | |
| n = this.$input.parent(".watermark_container")[0] || this.$input, | |
| r(this._tagTpl({ | |
| value: e | |
| })).insertBefore(n), | |
| this.$el.addClass("has-tags"), | |
| t = !0), | |
| t | |
| }, | |
| validateTag: function(t) { | |
| var n = r.Deferred(), i; | |
| return n.done(e.bind(function() { | |
| this.trigger("tag:success", t) | |
| }, this)).fail(e.bind(function() { | |
| this.trigger("tag:error", t) | |
| }, this)), | |
| e.isFunction(this.config.tagValidationFunc) ? (i = this.config.tagValidationFunc(t, this), | |
| i.then && e.isFunction(i.then) ? n = i : i ? n.resolve() : n.reject()) : n.resolve(), | |
| n | |
| }, | |
| onKeyDownTag: function(e) { | |
| e.keyCode === n.backspace && e.preventDefault() | |
| }, | |
| onKeyupTag: function(e) { | |
| var t = this.$(e.target).closest(".tag"); | |
| switch (e.keyCode) { | |
| case n.leftArrow: | |
| t.prev().find("button").focus(); | |
| break; | |
| case n.rightArrow: | |
| var r = t.next().find("button"); | |
| r = r.length ? r : this.$input, | |
| r.focus(); | |
| break; | |
| case n.backspace: | |
| this.removeTag(t.prev(), !0); | |
| break; | |
| case n.delete: | |
| this.removeTag(t, !1); | |
| break; | |
| case n.escape: | |
| this.$(e.target).blur() | |
| } | |
| }, | |
| onRemoveTag: function(e) { | |
| this.removeTag(this.$(e.target).closest(".tag")) | |
| }, | |
| removeTag: function(e, t) { | |
| if (e.length) { | |
| var n = e.text() | |
| , r = e.next().find("button"); | |
| r = r.length ? r : this.$input, | |
| this._tags.splice(this._tags.indexOf(n), 1), | |
| e.remove(), | |
| this.validate(), | |
| r.focus(), | |
| this._tags.length === 0 && this.$el.removeClass("has-tags") | |
| } else | |
| t || this.$input.focus() | |
| }, | |
| _onKeydown: function(e) { | |
| if (this._tags.length && !e.shiftKey && (e.keyCode === n.leftArrow || e.keyCode === n.backspace)) { | |
| var t; | |
| if ("selectionStart"in e.target) | |
| t = e.target.selectionStart; | |
| else if (document.selection) { | |
| e.target.focus(); | |
| var r = document.selection.createRange() | |
| , i = document.selection.createRange().text.length; | |
| r.moveStart("character", -e.target.value.length), | |
| t = r.text.length - i | |
| } | |
| t === 0 && (this._caretOut = !0) | |
| } else | |
| delete this._caretOut | |
| }, | |
| _onKeyup: function(e) { | |
| this._caretOut && (delete this._caretOut, | |
| e.keyCode === n.backspace ? this.removeTag(this.$(".tag:last"), !0) : this.$(".tag:last button").focus()), | |
| this.trigger("keyup", e) | |
| }, | |
| _onKeypress: function(e) { | |
| var t = String.fromCharCode(e.which || e.keyCode) | |
| , r = !this.config.submitOnEnter; | |
| if (this._separator.test(t)) { | |
| e.stopDelegation(); | |
| if (!this._tagCreationEnabled) { | |
| e.keyCode === n.enter && r && e.preventDefault(); | |
| return | |
| } | |
| this.createTags().always(function(t) { | |
| (r || e.keyCode !== n.enter || t) && e.preventDefault() | |
| }) | |
| } | |
| }, | |
| setTagCreationEnabled: function(e) { | |
| this._tagCreationEnabled = !!e | |
| }, | |
| _onBlur: function() { | |
| this.createTags() | |
| }, | |
| onFocusButtonTag: function(e) { | |
| this.$(e.target).closest(".tag").addClass("tag-focused") | |
| }, | |
| onBlurButtonTag: function(e) { | |
| this.$(e.target).closest(".tag").removeClass("tag-focused") | |
| }, | |
| onClickTag: function(e) { | |
| e.stopPropagation() | |
| }, | |
| onClick: function() { | |
| this.$input.focus() | |
| }, | |
| remove: function() { | |
| return r.removeData(this.$input, "width"), | |
| t.prototype.remove.apply(this, arguments) | |
| }, | |
| getValue: function() { | |
| return e.clone(this._tags) | |
| }, | |
| setSelection: function(n) { | |
| e.isUndefined(n) && (n = this.$input.val().length), | |
| t.prototype.setSelection.call(this, n) | |
| }, | |
| validate: function() { | |
| return this.createTags().then(e.bind(function() { | |
| return t.prototype.validate.apply(this, arguments) | |
| }, this)) | |
| } | |
| }) | |
| }), | |
| define("text!templates/gui/toggle/toggle.html", [], function() { | |
| return '<label>\n <input type="checkbox">\n <div class="checkbox">\n <span class="box icon-checkbox-outer"></span>\n <span class="check icon-checkbox-arrow"></span>\n </div>\n <%= text %>\n</label>\n' | |
| }), | |
| define("gui/toggle/views/toggle", ["jquery", "backbone", "underscore", "text!templates/gui/toggle/toggle.html"], function(e, t, n, r) { | |
| return t.View.extend({ | |
| className: "sj-toggle", | |
| events: { | |
| "change :checkbox": "_check" | |
| }, | |
| defaults: { | |
| enabled: !1, | |
| checked: !1, | |
| text: "" | |
| }, | |
| _template: n.template(r), | |
| initialize: function(e) { | |
| this.options = n.defaults(e || {}, this.defaults), | |
| this._enabled = n.defaults(this.options, this.defaults).enabled, | |
| this._checked = n.defaults(this.options, this.defaults).checked | |
| }, | |
| render: function() { | |
| return this._enabled || this.$el.addClass("disabled"), | |
| this.$el.html(this._template({ | |
| text: n.result(this.options, "text") | |
| })), | |
| this.$input = this.$el.find("input"), | |
| this.$input.attr("name", this.options.name), | |
| this.$input.prop("checked", this._checked), | |
| this.delegateEvents(), | |
| this | |
| }, | |
| toggle: function(e) { | |
| this._enabled = n.isUndefined(e) ? !this._enabled : e, | |
| this.$el.toggleClass("disabled", !this._enabled), | |
| this.trigger("toggle", this._enabled) | |
| }, | |
| setChecked: function(e) { | |
| this._checked = e === !0, | |
| this.$input.prop("checked", this._checked) | |
| }, | |
| getValue: function() { | |
| return this._checked | |
| }, | |
| _check: function(t) { | |
| this._checked = e(t.target).prop("checked"), | |
| this.trigger("check", this._checked) | |
| } | |
| }) | |
| }), | |
| define("gui/menubar/views/menubarView", ["jquery", "backbone", "underscore"], function(e, t, n) { | |
| return t.View.extend({ | |
| className: "menubar", | |
| defaults: { | |
| items: {} | |
| }, | |
| initialize: function(e) { | |
| this.options = n.defaults(e || {}, this.defaults), | |
| this._createItems(this.options.items) | |
| }, | |
| _toggleClass: function(e, t) { | |
| var n = e.$el; | |
| n.toggleClass("disabled", t), | |
| n.prev().toggleClass("disabled", t) | |
| }, | |
| toggle: function(e, t) { | |
| n.each(this.items, function(n, r) { | |
| r.match(e) && this._toggleClass(n, !t) | |
| }, this) | |
| }, | |
| enable: function(e) { | |
| this.toggle(e, !0) | |
| }, | |
| disable: function(e) { | |
| this.toggle(e, !1) | |
| }, | |
| disableAll: function() { | |
| n.each(this.items, n.bind(function(e) { | |
| this._toggleClass(e, !0) | |
| }, this)) | |
| }, | |
| setActive: function(e) { | |
| this.$el.toggleClass("active", e) | |
| }, | |
| setItems: function(e) { | |
| this._createItems(e), | |
| this.render() | |
| }, | |
| render: function() { | |
| var t = n.keys(this.items); | |
| return this.$el.contents().detach(), | |
| n.each(t, function(t, r) { | |
| var i = this.items[t]; | |
| r > 0 && this.$el.append(e('<div class="menubar-separator" />')), | |
| this.$el.append(i.render().$el), | |
| n.isFunction(i.isDisabled) && this._toggleClass(i, i.isDisabled()), | |
| i.delegateEvents() | |
| }, this), | |
| this | |
| }, | |
| remove: function() { | |
| return this._removeItems(), | |
| t.View.prototype.remove.apply(this, arguments) | |
| }, | |
| _createItems: function(e) { | |
| this._removeItems(), | |
| this.items = n.clone(e), | |
| n.each(this.items, function(e) { | |
| if (!(e instanceof t.View)) | |
| throw new Error("nothing else than Backbone.View based menubar items allowed"); | |
| this.listenTo(e, "state", n.bind(function(t) { | |
| this._toggleClass(e, !t) | |
| }, this)) | |
| }, this) | |
| }, | |
| _removeItems: function() { | |
| n.each(this.items, function(e) { | |
| this.stopListening(e), | |
| e.remove() | |
| }, this) | |
| } | |
| }) | |
| }), | |
| define("gui/menu/positioning", ["underscore", "jquery"], function(e, t) { | |
| function n(t) { | |
| var n; | |
| if (!e.isString(t)) | |
| throw new Error("Only strings are allowed as position values."); | |
| n = e.uniq(t.trim().split(/ +/)); | |
| if (n.length !== 2) | |
| throw new Error("A position should consist of exactly two values"); | |
| if (e.difference(n, ["top", "right", "bottom", "left"]).length) | |
| throw new Error("A position only supports top, right, bottom and left."); | |
| return n | |
| } | |
| function r(e, t, n) { | |
| var r; | |
| return e <= t ? r = e / 2 - t / 2 : n + t > e ? r = Math.max(0, e / 2 - t / 2, n - t) : r = n, | |
| r | |
| } | |
| function i(e, t, n) { | |
| return { | |
| left: r(t.width, e.width, n.left), | |
| top: r(t.height, e.height, n.top) | |
| } | |
| } | |
| function s(e, n, r, i) { | |
| var s = t(window).width() | |
| , o = t(window).height() | |
| , u = n.indexOf("left") > -1 ? e.left : e.right | |
| , a = n.indexOf("top") > -1 ? e.top : e.bottom | |
| , f = {}; | |
| return u += i.h, | |
| a += i.v, | |
| r.indexOf("left") > -1 ? (f.left = u, | |
| f.width = s - u) : (f.right = s - u, | |
| f.width = u), | |
| r.indexOf("top") > -1 ? (f.top = a, | |
| f.height = o - a) : (f.bottom = o - a, | |
| f.height = a), | |
| f | |
| } | |
| return { | |
| position: function(e, n) { | |
| return e.length ? i(e[0].getBoundingClientRect(), { | |
| width: t(window).width(), | |
| height: t(window).height() | |
| }, n) : n | |
| }, | |
| align: function(r, i, o, u) { | |
| var a; | |
| if (!r) | |
| throw new Error("Anchor element required for alignment"); | |
| a = t(r); | |
| if (!a.length) | |
| throw new Error("No anchor element could be matched"); | |
| i = n(i), | |
| o = n(o), | |
| u || (u = {}), | |
| u = e.defaults(u, { | |
| v: 0, | |
| h: 0 | |
| }); | |
| if (!e.isNumber(u.h) || !e.isFinite(u.h)) | |
| throw new Error("Horizontal offset offset.h should be a finite number"); | |
| if (!e.isNumber(u.v) || !e.isFinite(u.v)) | |
| throw new Error("Vertical offset offset.v should be a finite number"); | |
| return s(a[0].getBoundingClientRect(), i, o, u) | |
| } | |
| } | |
| }), | |
| define("gui/menu/menuItemView", ["underscore", "../activatable"], function(e, t) { | |
| return t.extend({ | |
| events: e.extend({}, t.prototype.events, { | |
| mousemove: "_onMouseMove", | |
| mouseleave: "_onMouseLeave" | |
| }), | |
| initialize: function(e) { | |
| this.text = e.text; | |
| if (!this.hasAction) | |
| throw new Error("no action was provided."); | |
| this.listenTo(this, "state", this.onChangeActionState), | |
| this._selected = !1 | |
| }, | |
| render: function() { | |
| return this.$el.empty().html(e.result(this, "text")).addClass("sj-menuitem"), | |
| this.renderActionState(this.getActionState()), | |
| this | |
| }, | |
| renderActionState: function(e) { | |
| this.$el.toggleClass("sj-menuitem-disabled", !e) | |
| }, | |
| isDisabled: function() { | |
| return this.$el.hasClass("sj-menuitem-disabled") | |
| }, | |
| canSelect: function() { | |
| return !!this.getActionState() | |
| }, | |
| isSelected: function() { | |
| return this._selected | |
| }, | |
| setSelected: function(e) { | |
| e = !!e, | |
| e !== this.isSelected() && (!e || this.canSelect()) && (this._selected = e, | |
| this.$el.toggleClass("sj-menuitem-selected", this._selected), | |
| this.trigger("selected", this._selected)) | |
| }, | |
| _onMouseMove: function() { | |
| this.setSelected(!0) | |
| }, | |
| _onMouseLeave: function() { | |
| this.setSelected(!1) | |
| }, | |
| onChangeActionState: function(e) { | |
| !e && this.isSelected() && this.setSelected(!1), | |
| this.renderActionState(e) | |
| } | |
| }) | |
| }), | |
| define("gui/menu/menuView", ["jquery", "underscore", "backbone", "keycodes", "./positioning", "./menuItemView"], function(e, t, n, r, i, s) { | |
| return n.View.extend({ | |
| itemClass: s, | |
| initialize: function(e) { | |
| e = t.isObject(e) ? e : {}, | |
| e.itemClass && (this.itemClass = e.itemClass), | |
| this._isDisabled = !0, | |
| this._createItems(e.items || []), | |
| this._eventSuffix = ".menu" + this.cid, | |
| this._registeredGlobalEvents = !1 | |
| }, | |
| render: function() { | |
| return this.$el.contents().detach(), | |
| this.$el.addClass("sj-menu"), | |
| t.each(this.items, t.bind(function(e) { | |
| this.$el.append(e.render().$el) | |
| }, this)), | |
| this | |
| }, | |
| remove: function() { | |
| return this._removeItems(), | |
| this._unregisterGlobalEvents(), | |
| n.View.prototype.remove.apply(this, arguments) | |
| }, | |
| isDisabled: function() { | |
| return this._isDisabled | |
| }, | |
| open: function(e) { | |
| var n; | |
| e = t.extend({}, { | |
| left: 0, | |
| top: 0 | |
| }, e), | |
| this.render().$el.appendTo(e.parent || "body"), | |
| e.anchor ? e = i.align(e.anchor, e.alignment || "left bottom", e.origin || "left top", e.offset) : e = i.position(this.$el, e), | |
| n = t.pick(e, "top", "left", "bottom", "right"), | |
| n = t.extend(n, { | |
| "max-height": e.height || "", | |
| "max-width": e.width || "" | |
| }), | |
| this.$el.css(n), | |
| this.trigger("open"), | |
| this._registerGlobalEvents() | |
| }, | |
| close: function() { | |
| this.$el.detach(), | |
| this.trigger("close"), | |
| this._unregisterGlobalEvents() | |
| }, | |
| setItems: function(e) { | |
| this._createItems(e), | |
| this.render() | |
| }, | |
| _removeItems: function() { | |
| t.each(this.items, t.bind(function(e) { | |
| e.remove(), | |
| this.stopListening(e) | |
| }, this)) | |
| }, | |
| _createItems: function(e) { | |
| var n = this.itemClass; | |
| this._removeItems(), | |
| this.items = t.map(e, t.bind(function(e) { | |
| var r = new n(e); | |
| return this.listenTo(r, "executed", this._onItemExecuted), | |
| this.listenTo(r, "selected", t.partial(this._onItemSelected, r)), | |
| this.listenTo(r, "state", this._onItemState), | |
| r | |
| }, this)), | |
| this._onItemState(), | |
| this._selectedItem = null | |
| }, | |
| _registerGlobalEvents: function() { | |
| if (this._registeredGlobalEvents) | |
| return; | |
| var n = t.map(["wheel", "contextmenu"], function(e) { | |
| return e + this._eventSuffix | |
| }, this); | |
| e(document).on("mousedown" + this._eventSuffix, t.bind(this._handleMousedown, this)).on("keydown" + this._eventSuffix, t.bind(this._handleKeydown, this)).on("keyup" + this._eventSuffix, t.bind(this._handleKeyup, this)).on(n.join(" "), t.bind(this._preventEvent, this)), | |
| e(window).on("resize" + this._eventSuffix, t.bind(this._handleResize, this)), | |
| this._registeredGlobalEvents = !0 | |
| }, | |
| _unregisterGlobalEvents: function() { | |
| if (!this._registeredGlobalEvents) | |
| return; | |
| e(document).off(this._eventSuffix), | |
| e(window).off(this._eventSuffix), | |
| this._registeredGlobalEvents = !1 | |
| }, | |
| _preventEvent: function(e) { | |
| return e.preventDefault(), | |
| !1 | |
| }, | |
| _handleMousedown: function(t) { | |
| e(t.target).closest(this.$el).length || this.close() | |
| }, | |
| _handleKeyup: function(e) { | |
| e.which === r.enter && this._selectedItem && (e.preventDefault(), | |
| this._selectedItem.execute()) | |
| }, | |
| _handleKeydown: function(e) { | |
| t.contains(r.scrollKeys, e.which) && e.preventDefault(), | |
| e.which === r.escape ? this.close() : e.which === r.upArrow ? this._selectPreviousItem() : e.which === r.downArrow ? this._selectNextItem() : e.which === r.tab ? (e.shiftKey ? this._selectPreviousItem() : this._selectNextItem(), | |
| e.preventDefault()) : e.which === r.pageUp || e.which === r.home ? this._selectFirstItem() : (e.which === r.pageDown || e.which === r.end) && this._selectLastItem() | |
| }, | |
| _handleResize: function() { | |
| this.close() | |
| }, | |
| _getSelectableItems: function() { | |
| return t.filter(this.items, function(e) { | |
| return e.canSelect() | |
| }) | |
| }, | |
| _selectNextItem: function() { | |
| var e = this._getSelectableItems() | |
| , t = e.indexOf(this._selectedItem) | |
| , n = t < e.length - 1 ? t + 1 : 0; | |
| n > -1 && n < e.length && e[n].setSelected(!0) | |
| }, | |
| _selectPreviousItem: function() { | |
| var e = this._getSelectableItems() | |
| , t = e.indexOf(this._selectedItem) | |
| , n = t > 0 ? t - 1 : e.length - 1; | |
| n > -1 && n < e.length && e[n].setSelected(!0) | |
| }, | |
| _selectFirstItem: function() { | |
| var e = this._getSelectableItems(); | |
| e.length && e[0].setSelected(!0) | |
| }, | |
| _selectLastItem: function() { | |
| var e = this._getSelectableItems(); | |
| e.length && e[e.length - 1].setSelected(!0) | |
| }, | |
| _onItemExecuted: function() { | |
| this.close() | |
| }, | |
| _onItemState: function() { | |
| var e = t.some(this.items, function(e) { | |
| return t.isFunction(e.isDisabled) ? !e.isDisabled() : !0 | |
| }) | |
| , n = this._isDisabled; | |
| this._isDisabled = !e, | |
| this.$el.toggleClass("sj-menu-disabled", this._isDisabled), | |
| n !== this._isDisabled && this.trigger("state", !this._isDisabled) | |
| }, | |
| _onItemSelected: function(e, t) { | |
| t ? (this._selectedItem && this._selectedItem.setSelected(!1), | |
| this._selectedItem = e) : this._selectedItem === e && (this._selectedItem = null) | |
| } | |
| }) | |
| }), | |
| define("gui/charts/segmentCalculator", ["underscore"], function(e) { | |
| return function(t) { | |
| var n = 0 | |
| , r = e.reduce(t, function(t, n) { | |
| e.isObject(n) || (n = { | |
| value: n | |
| }); | |
| var r = e.extend({}, n, { | |
| value: Math.max(0, n.value) || 0, | |
| percent: 0 | |
| }); | |
| return t.totalSum += r.value, | |
| t.segments.push(r), | |
| t | |
| }, { | |
| totalSum: 0, | |
| segments: [] | |
| }); | |
| return r.totalSum > 0 && e.each(r.segments, function(e, t) { | |
| var i; | |
| e.value > 0 && (t === r.segments.length - 1 ? i = 100 - n : (i = Math.round(e.value / r.totalSum * 1e3) / 10, | |
| n += i), | |
| e.percent = i) | |
| }), | |
| r | |
| } | |
| }), | |
| define("gui/charts/barChartView", ["jquery", "underscore", "backbone", "./segmentCalculator"], function(e, t, n, r) { | |
| return n.View.extend({ | |
| className: "sj-barchart", | |
| initialize: function(e) { | |
| e = e || {}, | |
| t.has(e, "values") && this.setValues(e.values) | |
| }, | |
| render: function() { | |
| return this.$el.empty(), | |
| this._data && this._data.totalSum > 0 && t.each(this._data.segments, function(n) { | |
| var r = e('<span class="sj-barchart-segment" />'); | |
| t.has(n, "className") && r.addClass(n.className), | |
| r.css("width", n.percent.toFixed(1) + "%"), | |
| r.appendTo(this.$el) | |
| }, this), | |
| this | |
| }, | |
| setValues: function(e) { | |
| if (!t.isArray(e)) | |
| throw new Error("Provided values need to be an array."); | |
| this._data = r(e) | |
| } | |
| }) | |
| }), | |
| define("gui/highlight", ["underscore"], function(e) { | |
| return { | |
| highlightMatches: function(t, n) { | |
| if (t === "" || n === "") | |
| return n; | |
| t = t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"); | |
| var r = new RegExp(t,"gi") | |
| , i = e.uniq(n.match(r)); | |
| return e.each(i, function(e) { | |
| r = new RegExp(e,"g"), | |
| n = n.replace(r, "<>" + e + "</>") | |
| }), | |
| n.replace(/<>/g, "<em>").replace(/<\/>/g, "</em>") | |
| } | |
| } | |
| }), | |
| define("gui/main", ["./button/button", "./button/iconButton", "./dropdown/simple", "./grid/grid", "./grid/lazyGrid", "./breadcrumb/breadcrumb", "./toast/toast", "./tooltip/tooltip", "./tooltip/views/infoTooltip", "./flyout/flyout", "./overlay/views/overlayManager", "./overlay/views/baseOverlayView", "./overlay/overlay", "./overlay/waitOverlay", "./editor/views/editor", "./editor/views/inlineEditor", "./editor/views/textEditor", "./editor/views/passwordEditor", "./editor/views/taglistEditor", "./toggle/views/toggle", "./menubar/views/menubarView", "./menu/menuView", "./charts/barChartView", "./highlight"], function(e, t, n, r, i, s, o, u, a, f, l, c, h, p, d, v, m, g, y, b, w, E, S, x) { | |
| return { | |
| Button: e, | |
| IconButton: t, | |
| SimpleDropdown: n, | |
| Grid: r, | |
| LazyGrid: i, | |
| Breadcrumb: s, | |
| Toast: o, | |
| Tooltip: u, | |
| InfoTooltip: a, | |
| Flyout: f, | |
| OverlayManager: l, | |
| BaseOverlayView: c, | |
| Overlay: h, | |
| WaitOverlay: p, | |
| Editor: d, | |
| InlineEditor: v, | |
| TextEditor: m, | |
| PasswordEditor: g, | |
| TaglistEditor: y, | |
| Toggle: b, | |
| Menubar: w, | |
| Menu: E, | |
| BarChart: S, | |
| highlight: x | |
| } | |
| }), | |
| define("gui", ["gui/main"], function(e) { | |
| return e | |
| }), | |
| define("views/filemanagerFooter", ["backbone", "gui", "lang", "api", "tracker"], function(e, t, n, r, i) { | |
| return e.View.extend({ | |
| className: "filemanager-footer", | |
| initialize: function() { | |
| this.listenTo(this.model.files, "load add add:end remove remove:end", this.render), | |
| this.downloadAllButton = new t.IconButton({ | |
| className: "sj-button-highlighted filemanager-downloadall", | |
| text: n.bind("filemanager.downloadAll"), | |
| iconClass: "icon-downloadall" | |
| }), | |
| this.listenTo(this.downloadAllButton, "click", this.onDownloadAllClick) | |
| }, | |
| remove: function() { | |
| return this.downloadAllButton.remove(), | |
| e.View.prototype.remove.apply(this, arguments) | |
| }, | |
| render: function() { | |
| return this.$el.empty(), | |
| this.model.files.length && this.downloadAllButton.render().$el.appendTo(this.$el), | |
| this | |
| }, | |
| onDownloadAllClick: function() { | |
| i.track({ | |
| op: "download", | |
| target: "all" | |
| }), | |
| r.download([this.model], this.model, { | |
| archivePrefix: n.get("filemanager.download.archiveprefix") | |
| }) | |
| } | |
| }) | |
| }), | |
| define("gui/thumbnail/thumbnail", ["jquery", "backbone", "underscore"], function(e, t, n) { | |
| function r(e) { | |
| return e.width / e.height | |
| } | |
| return t.View.extend({ | |
| className: "sj-thumbnail", | |
| initialize: function(e) { | |
| e = e || {}; | |
| if (!e.size) | |
| throw new Error("Missing size config"); | |
| this.size = {}, | |
| !isNaN(Number(e.size.width)) && e.size.width > 0 && (this.size.width = e.size.width), | |
| !isNaN(Number(e.size.height)) && e.size.height > 0 && (this.size.height = e.size.height); | |
| if (n.isEmpty(this.size)) | |
| throw new Error("size.width and/or size.height did no pass the check"); | |
| this.imageUrl = e.imageUrl, | |
| this._imageSize = null | |
| }, | |
| _load: function(t) { | |
| var n = e.Deferred() | |
| , r = new Image; | |
| return r.onload = function() { | |
| n.resolve({ | |
| width: r.width, | |
| height: r.height | |
| }, t) | |
| } | |
| , | |
| r.src = t, | |
| n.promise() | |
| }, | |
| renderImage: function(e, t) { | |
| this._imageSize = e, | |
| this.$el.css({ | |
| "background-image": "url(" + t + ")" | |
| }), | |
| this.resizeImage(e) | |
| }, | |
| resizeImage: function() { | |
| var e, t, n = r(this._imageSize), i = { | |
| width: this.$el.parent().width(), | |
| height: this.$el.parent().height() | |
| }; | |
| n >= r(i) ? (t = i.width / n, | |
| e = i.width) : (e = i.height * n, | |
| t = i.height), | |
| e = Math.min(e, this._imageSize.width), | |
| t = Math.min(t, this._imageSize.height), | |
| this.$el.css({ | |
| width: e, | |
| height: t | |
| }) | |
| }, | |
| _toggleLoading: function(e) { | |
| this.$el.toggleClass("sj-thumbnail-loading", e) | |
| }, | |
| render: function() { | |
| return this._imageSize ? (this.resizeImage(), | |
| this) : (this._toggleLoading(!0), | |
| this.imageUrl(this.size).then(this._load).done(n.bind(this._toggleLoading, this, !1)).then(n.bind(this.renderImage, this)), | |
| this) | |
| } | |
| }) | |
| }), | |
| define("text!views/filepreview/filePreview.html", [], function() { | |
| return '<div class="filesviewer">\n <div class="filesviewer-container">\n <div class="filesviewer-content imageview">\n\n </div>\n </div>\n <div class="statusview">\n <div class="left">\n <span class="display-name sj-selectable" title="<%- file.get(\'base_name\') %>"><%- file.get("base_name") %></span>\n </div>\n <div class="action-close">\n <span class="icon icon-filesviewer-close"></span>\n <span class="label"><%= lang.get("filesviewer.close") %></span>\n </div>\n </div>\n</div>\n' | |
| }), | |
| define("views/filepreview/filePreview", ["underscore", "backbone", "jquery", "gui/overlay/overlay", "gui/overlay/views/overlayManager", "z-index-mgr", "lang", "gui/thumbnail/thumbnail", "text!./filePreview.html"], function(e, t, n, r, i, s, o, u, a) { | |
| return r.extend({ | |
| className: "filesviewer-overlay", | |
| template: e.template(a), | |
| events: { | |
| "click .action-close": "remove" | |
| }, | |
| initialize: function(t) { | |
| this.options = n.extend({}, t || {}), | |
| this._onResize = e.throttle(e.bind(this._onResize, this), 250, { | |
| leading: !1 | |
| }), | |
| this.render().$el.appendTo("body") | |
| }, | |
| remove: function() { | |
| return n(window).off("resize.filepreview"), | |
| this._thumbnail.remove(), | |
| this._overlayPushed && (i.instance().pop(), | |
| this._overlayPushed = !1), | |
| this.trigger("removed"), | |
| t.View.prototype.remove.call(this) | |
| }, | |
| _onResize: function() { | |
| this._thumbnail.render() | |
| }, | |
| render: function() { | |
| return this.$el.addClass(this.overlayClasses), | |
| n(window).on("resize.filepreview", this._onResize), | |
| this.$el.css("z-index", s()), | |
| this.$el.html(this.template({ | |
| lang: o, | |
| file: this.model | |
| })), | |
| this._thumbnail || (this._thumbnail = new u({ | |
| size: { | |
| width: 640, | |
| height: 640 | |
| }, | |
| imageUrl: e.bind(this.options.url, this) | |
| })), | |
| this._thumbnail.render(), | |
| this._thumbnail.$el.appendTo(this.$el), | |
| this.trigger("rendered"), | |
| this._overlayPushed || (i.instance().push(), | |
| this._overlayPushed = !0), | |
| this | |
| } | |
| }) | |
| }), | |
| define("text!views/fileitem.html", [], function() { | |
| return '<% if(model.get("readable")) { %>\n<div class="selecticon icon-item-selector">\n <div class="icon-item-selected"></div>\n</div>\n<% } %>\n<div class="itemcontent <%= model.get("type") %> <% if(!model.get("readable")) { %>notReadable<% } %> ">\n\n <span class="file-item-icon sj-unselectable icon-mimetype-group-<%= model.get("group") %>\n unselectable="on"\n data-field="group">\n <span class="label-text group"></span>\n </span>\n\n <span class="file-item-label sj-unselectable file-item-displayname"\n unselectable="on"\n data-field="display_name"\n title="<%- model.get("display_name") %>">\n <span class="label-text display_name">\n <%- model.get("display_name") %>\n </span>\n </span>\n\n <span class="file-item-label sj-unselectable file-item-size"\n unselectable="on"\n data-field="size">\n <span class="label-text size">\n <% if(model.has("size")) { %>\n <%= formatters.size(parseInt(model.get("size"), 10)) %>\n <% } %>\n </span>\n </span>\n\n <span class="file-item-label sj-unselectable file-item-download"\n unselectable="on">\n <span class="icon-container" data-action="download">\n <span class="icon-toolbar-download"></span>\n </span>\n </span>\n</div>\n' | |
| }), | |
| define("text!views/fileitemHeader.html", [], function() { | |
| return '<div class="itemcontent">\n <span class="file-item-icon sj-unselectable" unselectable="on" data-field="group"></span>\n <span class="file-item-label file-item-displayname sj-unselectable <% if (sortable) print("sortable") %>" unselectable="on" data-field="display_name">\n <%= lang.get("file.name") %>\n </span>\n <span class="file-item-label sj-unselectable file-item-size <% if (sortable) print("sortable") %>" unselectable="on" data-field="size">\n <%= lang.get("file.size") %>\n </span>\n <span class="file-item-label sj-unselectable file-item-download" unselectable="on">\n <%= lang.get("file.download") %>\n </span>\n</div>\n' | |
| }), | |
| define("views/shareLinkView", ["underscore", "jquery", "backbone", "api", "gui", "modules/window", "api/models/shareLinkModel", "./login", "./filepreview/filePreview", "text!./fileitem.html", "text!./fileitemHeader.html"], function(e, t, n, r, i, s, o, u, a, f, l) { | |
| return n.View.extend({ | |
| className: "shlnk", | |
| sid: null, | |
| hasPassword: !1, | |
| password: null, | |
| infoPromise: null, | |
| loginError: null, | |
| thumbnailAvailable: !1, | |
| initialize: function() { | |
| this.collection = new n.Collection([],{ | |
| model: o | |
| }), | |
| this.grid = new i.Grid({ | |
| collection: this.collection, | |
| headerTpl: l, | |
| itemTpl: f | |
| }), | |
| this.listenTo(this.grid, "click", this.onItemClick) | |
| }, | |
| render: function(t) { | |
| return this.$el.contents().detach(), | |
| this.collection.reset(), | |
| t && t.sid && (this.sid = t.sid), | |
| this.sid && this.getShareInfo().then(e.bind(this.authenticate, this)).then(e.bind(this.getShareData, this)).then(e.bind(this._triggerShareLinkData, this)).then(e.bind(this.showGrid, this)).fail(e.bind(this.showError, this)), | |
| this | |
| }, | |
| remove: function() { | |
| return this.grid.remove(), | |
| n.View.prototype.remove.apply(this, arguments) | |
| }, | |
| getShareInfo: function() { | |
| return this.infoPromise || (this.infoPromise = t.get("/api/sharelink/info", { | |
| id: this.sid | |
| })), | |
| this.infoPromise | |
| }, | |
| authenticate: function(e) { | |
| return e.has_password && !this.password ? (this.hasPassword = !0, | |
| this.showLogin()) : null | |
| }, | |
| getShareData: function() { | |
| var e = "/api/sharelink/info" | |
| , n = { | |
| id: this.sid, | |
| fields: "name,type,size" | |
| }; | |
| return this.hasPassword && (n.password = this.password, | |
| n.fields += ",download_code"), | |
| t.post(e, n) | |
| }, | |
| _triggerShareLinkData: function(e) { | |
| var t = { | |
| id: this.sid, | |
| type: "sharelink", | |
| name: e.name | |
| }; | |
| return this.hasPassword && (t.pw = this.password), | |
| this.trigger("sharelinkData", t), | |
| e | |
| }, | |
| refreshDownloadCode: function(n) { | |
| var r = "/api/sharelink/info" | |
| , i = { | |
| id: this.sid, | |
| password: this.password, | |
| fields: "download_code" | |
| }; | |
| t.post(r, i).done(function(e) { | |
| n.set("download_code", e.download_code) | |
| }).fail(e.bind(this.showError, this)) | |
| }, | |
| showLogin: function() { | |
| var n = t.Deferred() | |
| , r = new u({ | |
| loginCallback: e.bind(function(e) { | |
| this.password = e.password, | |
| n.resolve() | |
| }, this) | |
| }); | |
| return this.$el.html(r.render({ | |
| error: this.loginError | |
| }).$el), | |
| n.promise() | |
| }, | |
| showGrid: function(e) { | |
| this.item = this.collection.add(e, { | |
| parse: !0 | |
| }), | |
| this.$el.html(t('<div class="filemanager-body" />').append(t('<div class="fm-grid isList" />').append(this.grid.render().$el))), | |
| this.item.get("group") === "thumb" && this.showThumbnail() | |
| }, | |
| showThumbnail: function(n) { | |
| var r = n ? n.width : 210 | |
| , i = n ? n.height : 210 | |
| , s = !n; | |
| this.getThumbnailUrl(r, i).done(e.bind(function(n) { | |
| this.thumbnailAvailable = !0; | |
| var r, i = e.bind(function() { | |
| var e = r[0].width | |
| , i = r[0].height | |
| , o = this.$(".sj-grid.content .itemcontent .file-item-icon") | |
| , u = t("<div />").css("background-image", "url(" + n + ")"); | |
| this.$(".fm-grid .sj-grid.content .sj-item").addClass("isthumbnail"), | |
| s && this._adjustThumbnail(u, r[0], 140, 210); | |
| var a = e >= i | |
| , f = e >= 120 | |
| , l = e >= 140 | |
| , c = i >= 140 | |
| , h = i >= 120; | |
| e < 40 && i < 40 ? u.css("background-size", "inherit") : a && c ? u.addClass("m_by") : !a && l ? u.addClass("m_bx") : !a && !l && h ? u.addClass("m_y") : a && !c && f && u.addClass("m_x"), | |
| o.empty().append(u).addClass("file-item-image-preview").removeClass("file-item-image-icon").removeClass("bg-sprite") | |
| }, this); | |
| r = t("<img />").load(i).attr("src", n) | |
| }, this)) | |
| }, | |
| _adjustThumbnail: function(e, t, n, r) { | |
| var i = n | |
| , s = n | |
| , o = ""; | |
| t.width === r && t.height < s && (i = Math.ceil(r * s / t.height), | |
| o = i + "px " + s + "px", | |
| this.showThumbnail({ | |
| height: s | |
| })), | |
| t.height === r && t.width < i && (s = Math.ceil(r * i / t.width), | |
| o = i + "px " + s + "px", | |
| this.showThumbnail({ | |
| width: i | |
| })), | |
| o.length && e.css("background-size", o) | |
| }, | |
| getThumbnailUrl: function(e, t) { | |
| var n = { | |
| width: e, | |
| height: t | |
| }; | |
| return this.password && (n.password = this.password), | |
| r.getShareLinkThumbnail(this.sid, n) | |
| }, | |
| showError: function(e) { | |
| this.hasPassword && e.status === 401 ? (this.password = null, | |
| this.loginError = "password", | |
| this.render()) : this.trigger("error", e.status) | |
| }, | |
| onItemClick: function(n, r) { | |
| if (t(r.target).closest("[data-action=download]").length) { | |
| var i = "/api/sharelink/download" | |
| , o = { | |
| id: this.sid | |
| }; | |
| n.get("download_code") && (o.download_code = n.get("download_code")), | |
| s.setLocation(i + "?" + t.param(o)), | |
| this.hasPassword && this.refreshDownloadCode(n) | |
| } else if (this.thumbnailAvailable) { | |
| var u = window.innerWidth | |
| , f = window.innerHeight; | |
| new a({ | |
| model: this.item, | |
| width: u, | |
| height: f, | |
| url: e.bind(function() { | |
| return this.getThumbnailUrl(u, f) | |
| }, this) | |
| }) | |
| } | |
| } | |
| }) | |
| }), | |
| define("text!templates/poweredBy.html", [], function() { | |
| return '<div class="inner-wrapper">\n <a href="<%= lang.get("poweredBy.url") %>" target="_blank"\n class="powered-by-icon bg-sprite icon-powered-by-logo">\n </a>\n</div>\n' | |
| }), | |
| define("views/poweredByView", ["underscore", "backbone", "lang", "text!templates/poweredBy.html"], function(e, t, n, r) { | |
| return t.View.extend({ | |
| className: "powered-by", | |
| template: e.template(r), | |
| render: function() { | |
| return this.$el.html(this.template({ | |
| lang: n | |
| })), | |
| this | |
| } | |
| }) | |
| }), | |
| define("text!filemanager/js/views/filemanager.html", [], function() { | |
| return '<div class="filemanager-body">\n <span class="filemanager-loader" />\n <div class="grid-target" />\n</div>\n' | |
| }), | |
| define("mixins/selection", ["jquery", "underscore"], function(e, t) { | |
| return { | |
| bindCollection: function(e, n) { | |
| n = n || {}, | |
| e.on("deselectAll", function() { | |
| e.prev = undefined | |
| }); | |
| var r = function(e, r, i) { | |
| if (!t.isFunction(n.filter) || n.filter(e)) { | |
| var s = !!e.selected; | |
| e.selected = t.isBoolean(r) ? r : !s, | |
| !i && e.selected !== s && e.trigger("change:selected", e) | |
| } | |
| } | |
| , i = function(t) { | |
| r(t, !0), | |
| e.prev = t, | |
| e.each(function(e) { | |
| e !== t && r(e, !1) | |
| }) | |
| } | |
| , s = function() { | |
| e.each(function(e) { | |
| r(e, !1, !0) | |
| }), | |
| e.prev = undefined, | |
| e.trigger("deselectAll") | |
| }; | |
| e.on("remove", function(e) { | |
| r(e, !1), | |
| delete e.selected | |
| }), | |
| e.on("remove:end", function(e) { | |
| t.each(e, function(e) { | |
| delete e.selected | |
| }) | |
| }), | |
| e.on("select", function(n, s) { | |
| if (!s) | |
| n.selected ? e.prev = undefined : e.prev = n, | |
| r(n); | |
| else if (t.isUndefined(e.prev)) | |
| i(n); | |
| else { | |
| var o = e.indexOf(e.prev) | |
| , u = e.indexOf(n) | |
| , a = Math.min(o, u) | |
| , f = Math.max(o, u); | |
| e.each(function(e, t) { | |
| e.selected || r(e, t >= a && t <= f) | |
| }) | |
| } | |
| }), | |
| e.on("reset sync", s), | |
| t.extend(e, { | |
| deselectAll: s, | |
| selectAll: function() { | |
| e.each(function(e) { | |
| r(e, !0, !0) | |
| }), | |
| e.trigger("selectAll") | |
| }, | |
| getSelected: function() { | |
| return t.filter(e.models, function(e) { | |
| return e.selected | |
| }) | |
| }, | |
| firstSelected: function() { | |
| return t.find(e.models, function(e) { | |
| return e.selected | |
| }) | |
| }, | |
| select: function(e) { | |
| r(e, !0) | |
| } | |
| }) | |
| }, | |
| unbindCollection: function(e) { | |
| e.off("remove remove:end"), | |
| e.off("select"), | |
| e.off("deselectAll"), | |
| e.off("reset sync", e.deselectAll), | |
| delete e.deselectAll, | |
| delete e.select | |
| } | |
| } | |
| }), | |
| define("mixins/sortBy", ["underscore"], function(e) { | |
| return { | |
| bindCollection: function(t, n) { | |
| if (!e.isUndefined(t.sortable)) | |
| throw new Error("cannot extend collection, sortable exist"); | |
| var r = null | |
| , i = "asc"; | |
| n && n.key && (r = n.key), | |
| n && n.direction && (i = n.direction); | |
| var s = function(e, n) { | |
| if (!t.comparators || t.comparators.length === 0) | |
| return; | |
| var r = t.comparators[e]; | |
| if (!r) | |
| throw new Error("comparator '" + e + "'not defined"); | |
| n === "desc" ? t.comparator = function(e, t) { | |
| return r.call(this, t, e) | |
| } | |
| : t.comparator = r, | |
| t.sortable.key = e, | |
| t.sortable.direction = n | |
| }; | |
| e.extend(t, { | |
| sortable: { | |
| key: r, | |
| direction: i, | |
| getKey: function() { | |
| return t.sortable.key | |
| }, | |
| getDir: function() { | |
| return t.sortable.direction | |
| }, | |
| sortBy: function(e, n) { | |
| if (!t.comparators) | |
| throw new Error("no comparators defined in collection"); | |
| n = n || t.sortable.direction, | |
| e = e || t.sortable.key, | |
| s(e, n), | |
| t.sort(), | |
| t.trigger("sortBy", e, n) | |
| } | |
| } | |
| }), | |
| s(r, i) | |
| } | |
| } | |
| }), | |
| define("modules/filemanager/js/helpers/compareHelper", [], function() { | |
| return { | |
| isDir: function(e) { | |
| return e.get("type") === "dir" | |
| }, | |
| compareType: function(e, t) { | |
| return this.isDir(t) - this.isDir(e) | |
| }, | |
| compare: function(e, t, n) { | |
| var r = this.compareType(e, t); | |
| return r ? r : (r = n ? n(e, t) : r, | |
| r ? r : (r = this.compareString(e.get("display_name"), t.get("display_name")), | |
| r ? r : this.compareString(e.id, t.id))) | |
| }, | |
| compareString: function(e, t) { | |
| var n = function(e) { | |
| return e === null || typeof e == "undefined" ? "" : String(e) | |
| } | |
| , r = n(e).toLowerCase() | |
| , i = n(t).toLowerCase(); | |
| return r === i ? 0 : r > i ? 1 : -1 | |
| }, | |
| compareDisplayNames: function(e, t) { | |
| return this.compareString(e.get("display_name"), t.get("display_name")) | |
| } | |
| } | |
| }), | |
| define("filemanager/js/collections/fileitems", ["underscore", "api/collections/baseCollection", "api/models/fileModel", "mixins/selection", "mixins/sortBy", "lang", "modules/filemanager/js/helpers/compareHelper"], function(e, t, n, r, i, s, o) { | |
| return t.extend({ | |
| model: n, | |
| defaults: { | |
| itemfilter: function(e) { | |
| return e | |
| }, | |
| sortCol: "display_name", | |
| sortDir: "asc" | |
| }, | |
| comparators: { | |
| display_name: function(e, t) { | |
| return o.compare(e, t) | |
| }, | |
| type: function(e, t) { | |
| return o.compare(e, t, function(e, t) { | |
| return o.compareString(e.get("ext"), t.get("ext")) | |
| }) | |
| }, | |
| size: function(e, t) { | |
| return o.compare(e, t, function(e, t) { | |
| var n = e.has("size") ? parseInt(e.get("size"), 10) : 0 | |
| , r = t.has("size") ? parseInt(t.get("size"), 10) : 0; | |
| return n - r | |
| }) | |
| }, | |
| mtime: function(e, t) { | |
| return o.compare(e, t, function(e, t) { | |
| var n = e.has("mtime") ? e.get("mtime") - (new Date(e.get("mtime") * 1e3)).getSeconds() : 0 | |
| , r = t.has("mtime") ? t.get("mtime") - (new Date(t.get("mtime") * 1e3)).getSeconds() : 0; | |
| return n - r | |
| }) | |
| } | |
| }, | |
| initialize: function(n, s) { | |
| t.prototype.initialize.apply(this, arguments), | |
| this.options = e.extend({}, this.defaults, s), | |
| this.comparator = this.comparators.display_name, | |
| r.bindCollection(this, { | |
| filter: function(e) { | |
| return e.get("readable") | |
| } | |
| }), | |
| i.bindCollection(this, { | |
| key: this.options.sortCol, | |
| direction: this.options.sortDir | |
| }) | |
| }, | |
| parse: function(t) { | |
| e.isArray(t) || (t = new Array(t)); | |
| for (var n = 0; n < t.length; n++) { | |
| var r = t[n]; | |
| r.path && r.path.indexOf("root/") === 0 && (r.path = r.path.replace(/root\//, "/")) | |
| } | |
| return this.options.itemfilter && (t = e.filter(t, this.options.itemfilter, this)), | |
| t | |
| } | |
| }) | |
| }), | |
| define("filemanager/js/models/folder", ["underscore", "api", "../collections/fileitems", "deleteListInst"], function(e, t, n, r) { | |
| return t.FileModel.extend({ | |
| defaults: { | |
| path: "", | |
| id: "", | |
| type: "dir" | |
| }, | |
| files: null, | |
| delayTimer: null, | |
| itemfilter: function() { | |
| return !0 | |
| }, | |
| isDir: function() { | |
| return !0 | |
| }, | |
| initialize: function(i) { | |
| t.FileModel.prototype.initialize.call(this, [], i), | |
| this.options = e.extend({}, this.defaults, i), | |
| this.files = new n([],{ | |
| context: this.getContext(), | |
| itemfilter: e.bind(this.itemfilter, this), | |
| sortCol: this.options.sortCol || "display_name", | |
| sortDir: this.options.sortDir || "asc" | |
| }), | |
| this.listenTo(t, "newFolder:created newFile:created copyFiles:done moveFiles:done", this._onCreatedNewItem), | |
| this.listenTo(this.files, "add", this.onAdd), | |
| this.listenTo(this.files, "change", this._onFileItemUpdate), | |
| this.listenTo(r, "added", this._onDeleteListAdded), | |
| this.listenTo(r, "recovered", this._onDeleteListRecovered) | |
| }, | |
| waitInMilliSeconds: 1e3, | |
| getParent: function() { | |
| var e = this.get("path"), t, n, r = /^(\/.*)\/[^\/]+$/.exec(e); | |
| return r ? (this.set("parentName", r[1].split("/").pop()), | |
| n = this.urlDecode("parentName"), | |
| t = r[1], | |
| { | |
| path: t, | |
| name: n | |
| }) : null | |
| }, | |
| _clearLoadDelayTimeout: function() { | |
| this.delayTimer && (clearTimeout(this.delayTimer), | |
| this.delayTimer = null) | |
| }, | |
| _setLoadDelayTimeout: function() { | |
| var e = this; | |
| this._clearLoadDelayTimeout(), | |
| this.delayTimer = setTimeout(function() { | |
| e.files.trigger("load:delay") | |
| }, this.waitInMilliSeconds) | |
| }, | |
| _onCreatedNewItem: function(t, n) { | |
| var r = [].concat(n) | |
| , i = this.getContext(); | |
| this.get("path") === t && e.every(r, function(e) { | |
| return i === e.getContext() | |
| }) && this.files.add(n) | |
| }, | |
| _onFileItemUpdate: function(e) { | |
| this.getPid() === e.get("parent_id") && this.getContext() === e.getContext() && (this.files.remove(e), | |
| this.files.add(e)) | |
| }, | |
| onAdd: function(e) { | |
| e && e.set({ | |
| movable: this.get("writable") | |
| }, { | |
| silent: !0 | |
| }) | |
| }, | |
| load: function(t) { | |
| var n = e.clone(this.queryData) || { | |
| fields: [] | |
| }, r; | |
| this.options.queryData && (r = this.options.queryData, | |
| e.isFunction(r) ? n = r.call(this, n) : e.extend(n, r)), | |
| n.fields = n.fields.join(","), | |
| this.requestedPath = t, | |
| this._setLoadDelayTimeout(), | |
| this.files.trigger("load:start"), | |
| this.fetch({ | |
| data: n, | |
| path: t, | |
| success: e.bind(function(e) { | |
| this._clearLoadDelayTimeout(), | |
| this.files.reset(e.get("members"), { | |
| parse: !0 | |
| }), | |
| this.files.trigger("load"), | |
| this.trigger("load") | |
| }, this), | |
| error: e.bind(function(e, t, n) { | |
| this._clearLoadDelayTimeout(), | |
| this.files.trigger("load:error", t, n), | |
| this.trigger("load:error", t, n) | |
| }, this), | |
| progress: e.bind(function(e, t) { | |
| this.requestedPath !== t.path && e() | |
| }, this) | |
| }) | |
| }, | |
| fetch: function(n) { | |
| t.getDir(this.requestedPath, this.getContext(), n.data, n.progress).done(e.bind(function(e) { | |
| if (!this.set(this.parse(e, n), n)) | |
| return; | |
| this.trigger("sync", this, e, n), | |
| n.success(this, e, n) | |
| }, this)).fail(e.bind(function(e) { | |
| n.error(this, e, n), | |
| this.trigger("error", this, e, n) | |
| }, this)) | |
| }, | |
| parse: function(n) { | |
| var i, s; | |
| return n = e.clone(n), | |
| n.type = "dir", | |
| n = t.FileModel.prototype.parse.apply(this, arguments), | |
| n.writable && e.each(n.members, function(e) { | |
| e.movable = !0 | |
| }), | |
| i = r.filterByType(this.getItemType(), e.bind(function(e) { | |
| return e.get("parent_id") === this.id | |
| }, this)), | |
| s = e.pluck(i, "id"), | |
| n.members = e.filter(n.members, function(e) { | |
| return s.indexOf(e.id) < 0 | |
| }), | |
| n | |
| }, | |
| reset: function(t) { | |
| var n = e.extend({}, this.defaults, t) | |
| , r = e.omit(this.attributes, e.keys(n)); | |
| this.set(n), | |
| this.set(r, { | |
| unset: !0 | |
| }), | |
| this.files.reset([]) | |
| }, | |
| getPath: function(e) { | |
| return this.get("path") + (this.get("path") === "/" ? "" : "/") + e.get("name") | |
| }, | |
| onChangePath: function(e) { | |
| this.load(e.get("path")) | |
| }, | |
| getFileCount: function() { | |
| return this.files.where({ | |
| isDir: !1 | |
| }).length | |
| }, | |
| sort: function() {}, | |
| _onDeleteListAdded: function(t, n) { | |
| var r, i; | |
| if (t === this.getItemType()) { | |
| r = n.filter(e.bind(function(e) { | |
| return e.get("parent_id") === this.get("id") | |
| }, this)); | |
| if (!r.length) | |
| return; | |
| i = e.compact(this.files.remove(r, { | |
| silent: !0 | |
| })), | |
| i.length && this.files.trigger("remove:end", i) | |
| } | |
| }, | |
| _onDeleteListRecovered: function(t, n) { | |
| var r; | |
| if (t === this.getItemType()) { | |
| r = n.filter(e.bind(function(e) { | |
| return e.get("parent_id") === this.get("id") | |
| }, this)); | |
| if (!r.length) | |
| return; | |
| this.files.add(r, { | |
| silent: !0 | |
| }), | |
| this.files.trigger("add:end", r) | |
| } | |
| } | |
| }) | |
| }), | |
| define("text!filemanager/js/views/emptyView.html", [], function() { | |
| return '<div class="flx">\n <div class="top"></div>\n <div class="empty-text">\n <p class="sj-selectable"><%= lang.get("filemanager.noFiles") %></p>\n <div class="drop-invitation">\n <p><%= lang.get("filemanager.dnd.invitation") %></p>\n </div>\n </div>\n <div class="bottom"></div>\n</div>\n' | |
| }), | |
| define("plugins/jquery/jquery.mouseSelect", ["jquery"], function(e) { | |
| var t = 150, n, r = function() { | |
| return "mousesel-" + (new Date).getTime() % 1e5 + Math.floor(Math.random() * 1e5) | |
| }; | |
| e.fn.mouseSelect = function(i) { | |
| function s(t) { | |
| n = undefined, | |
| e(t).children(".mouse-select").remove(), | |
| e(t).each(function() { | |
| var t = e(this) | |
| , n = t.data("mouseselNs"); | |
| t.off(".mouseSelector"), | |
| e("html").off(".mouseSelector." + n), | |
| t.removeData("mouseselNs") | |
| }); | |
| return | |
| } | |
| (i && i.off || i === "off") && s(this), | |
| i && (n = i.rect || [0, 0, e(this).outerWidth(), e(this).outerHeight()], | |
| t = i.delay || 150); | |
| if (i && i.selector && i.onSelect) | |
| return s(this), | |
| this.each(function() { | |
| var s = this, o = e(this), u = o.parent(), a = !1, f, l, c, h, p, d, v, m, g, y, b = o.children(".mouse-select").length ? o.children(".mouse-select") : e("<a>").appendTo(o).css({ | |
| border: "1px dashed #666", | |
| position: "absolute" | |
| }).addClass("mouse-select").hide(), w = r(); | |
| o.data("mouseselNs", w).on("MSPointerDown.mouseSelector pointerdown.mouseSelector", function(e) { | |
| var t = e.originalEvent; | |
| a = t && (t.pointerType == t.MSPOINTER_TYPE_TOUCH || t.pointerType == t.MSPOINTER_TYPE_PEN) | |
| }).on("mousedown.mouseSelector", function(t) { | |
| f = undefined; | |
| if (a) { | |
| t.preventDefault(); | |
| return | |
| } | |
| if (i.ignoreSelector && e(t.target).closest(i.ignoreSelector).length) | |
| return; | |
| n = [0, 0, e(this).outerWidth(), e(this).outerHeight()], | |
| m = u.scrollTop(), | |
| g = u.offset().top + parseInt(e(this).css("margin-top"), 10), | |
| y = u.offset().left + parseInt(e(this).css("margin-left"), 10), | |
| l = t.pageX - y, | |
| c = t.pageY + m - g, | |
| d = o.innerHeight(), | |
| v = u.innerHeight(); | |
| if (!n || !(l < n[0] || l > n[2] || c < n[1] || c > n[3])) | |
| f = (new Date).getTime(); | |
| t.preventDefault() | |
| }).on("MSHoldVisual contextmenu", function(e) { | |
| e.preventDefault() | |
| }), | |
| e("html").on("MSPointerDown.mouseSelector." + w + " pointerdown.mouseSelector." + w, function(e) { | |
| var t = e.originalEvent; | |
| a = t && [t.MSPOINTER_TYPE_TOUCH, t.MSPOINTER_TYPE_PEN, "pen", "touch"].indexOf(t.pointerType) > -1 | |
| }).on("mouseup.mouseSelector." + w, function(t) { | |
| function n() { | |
| f = undefined, | |
| a = !1, | |
| b.css({ | |
| top: 0, | |
| left: 0, | |
| width: 0, | |
| height: 0 | |
| }).hide() | |
| } | |
| if (!f || a || !e(t.target).closest(s).length) { | |
| n(); | |
| return | |
| } | |
| if (b && b.is(":visible")) { | |
| t.stopImmediatePropagation(); | |
| var r = u.scrollTop(); | |
| h = t.pageX - y, | |
| p = t.pageY + r - g; | |
| if (i && i.selector) { | |
| var o = [Math.min(l, h), Math.min(c, p), Math.max(l, h), Math.max(c, p)] | |
| , d = e.grep(e(i.selector), function(t, n) { | |
| var i = e(t) | |
| , s = i.offset() | |
| , u = [s.left - y, s.top + r - g, s.left + i.width() - y, s.top + i.height() + r - g]; | |
| return !(o[0] > u[2] || o[2] < u[0] || o[1] > u[3] || o[3] < u[1]) | |
| }); | |
| i.onSelect !== undefined && d && setTimeout(function() { | |
| i.onSelect.apply(s, [d]) | |
| }) | |
| } | |
| } | |
| n() | |
| }).on("mousemove.mouseSelector." + w, function(e) { | |
| if (!f || a) | |
| return; | |
| var r = (new Date).getTime() | |
| , m = u.scrollTop(); | |
| h = e.pageX - y, | |
| p = e.pageY + m - g; | |
| var w = b.is(":visible"); | |
| if (b && w || r - f > t || Math.abs(l - h) * Math.abs(l - h) + Math.abs(c - p) * Math.abs(c - p) > 2500) { | |
| if (n === undefined) | |
| return; | |
| var E = Math.max(n[0], Math.min(l, h)) | |
| , S = Math.max(n[1], Math.min(c, p)) | |
| , x = Math.min(Math.abs(l - h), n[2] - E) | |
| , T = p > c ? Math.min(p - c, n[3] - S) : Math.min(c - p, c); | |
| b.css({ | |
| top: S, | |
| left: E, | |
| width: x - 2, | |
| height: T - 2 | |
| }).show(), | |
| !w && i.onStartSelect && i.onStartSelect.apply(s, []); | |
| var N = e.pageY > g + v | |
| , C = e.pageY < o.parent().offset().top; | |
| if (N || C) { | |
| if (o.scrolling) | |
| return; | |
| o.scrolling = !0; | |
| var k = N ? d - v : 0 | |
| , L = N ? d - v - m : m; | |
| u.animate({ | |
| scrollTop: k | |
| }, L, function() { | |
| o.scrolling = !1 | |
| }) | |
| } else | |
| u.stop(!0, !1), | |
| o.scrolling = !1 | |
| } | |
| }) | |
| }) | |
| } | |
| }), | |
| define("filemanager/js/views/fileitem", ["underscore", "gui/grid/views/itemView"], function(e, t) { | |
| return t.extend({ | |
| render: function() { | |
| return t.prototype.render.call(this), | |
| this.toggleDraggable(!0), | |
| this | |
| }, | |
| templateData: function() { | |
| return e.extend({}, t.prototype.templateData.call(this), { | |
| draggable: this._isDraggable() | |
| }) | |
| }, | |
| _isDraggable: function() { | |
| return this.dragdropEnabled && this.model.get("movable") && this.model.get("readable") | |
| }, | |
| toggleDraggable: function(e) { | |
| this.$el.attr("draggable", e && this._isDraggable() ? "true" : null) | |
| } | |
| }) | |
| }), | |
| define("text!filemanager/js/views/fileitem.html", [], function() { | |
| return '<% if(model.get("readable")) { %>\n<div class="selecticon icon-item-selector">\n <div class="icon-item-selected"></div>\n</div>\n<% } %>\n<div class="itemcontent <%= model.get("type") %> <% if(!model.get("readable")) { %>notReadable<% } %> ">\n\n <span class="file-item-icon sj-unselectable icon-mimetype-group-<%= model.get("group") %>"\n unselectable="on"\n data-field="group">\n <span class="label-text group"></span>\n </span>\n\n <span class="file-item-label sj-unselectable file-item-displayname"\n unselectable="on"\n data-field="display_name"\n title="<%- model.get("display_name") %>">\n <% if (model.get("share")) { %>\n <span class="icon-item-shared is-shared-icon"\n data-action="share-info"\n title="<% print(model.get(\'type\') === \'dir\' ? lang.get(\'filemanager.share.dir.tooltip\') : lang.get(\'filemanager.share.fileitem.tooltip\')); %>"></span>\n <% } %>\n <span class="label-text display_name">\n <%- model.get("display_name") %>\n </span>\n </span>\n\n <span class="file-item-share-icon sj-unselectable <% if(model.get("share")) { %> icon-item-shared <% } %>"\n unselectable="on"\n <% if (model.get("share")) { %>\n data-action="share-info"\n title="<% print(model.get(\'type\') === \'dir\' ? lang.get(\'filemanager.share.dir.tooltip\') : lang.get(\'filemanager.share.fileitem.tooltip\')); %>"\n <% } %>\n data-field="shared">\n <span class="label-text shared"></span>\n </span>\n\n <span class="file-item-label sj-unselectable file-item-ext"\n unselectable="on"\n data-field="type">\n <span class="label-text type">\n <% if(model.get("type") === "dir") { %>\n <%= lang.get("file.type.dir") %>\n <% } else {\n var ext = model.urlDecode("ext");\n if (ext) {\n %>\n .<%- ext %>\n <% } else { %>\n <%= lang.get("file.type.fileitem") %>\n <% }\n } %>\n </span>\n </span>\n\n <span class="file-item-label sj-unselectable file-item-size"\n unselectable="on"\n data-field="size">\n <span class="label-text size">\n <% if(model.has("size")) { %>\n <%= formatters.size(parseInt(model.get("size"), 10)) %>\n <% } %>\n </span>\n </span>\n\n <span class="file-item-label sj-unselectable file-item-date"\n unselectable="on"\n data-field="mtime">\n <span class="label-text mtime">\n <% if(model.has("mtime")) { %>\n <%= formatters.date(model.get("mtime"), lang.get("lang.timeFormat")) %>\n <% } %>\n </span>\n\n </span>\n\n</div>\n' | |
| }), | |
| define("text!filemanager/js/views/itemHeader.html", [], function() { | |
| return '<div class="itemcontent">\n <span class="file-item-icon sj-unselectable" unselectable="on" data-field="group"></span>\n <span class="file-item-label file-item-displayname sj-unselectable" unselectable="on" data-field="display_name">\n <%= lang.get("file.name") %>\n </span>\n <span class="file-item-label file-item-ext sj-unselectable" unselectable="on" data-field="type">\n <%= lang.get("file.type") %>\n </span>\n <span class="file-item-label file-item-size sj-unselectable" unselectable="on" data-field="size">\n <%= lang.get("file.size") %>\n </span>\n <span class="file-item-label file-item-date sj-unselectable" unselectable="on" data-field="mtime">\n <%= lang.get("file.update") %>\n </span>\n</div>\n' | |
| }), | |
| define("text!filemanager/js/views/renameTooltip.html", [], function() { | |
| return '<%- Lang.get("filemanager.rename.toast.error.badChars") %> <b><%- chars %></b>\n' | |
| }), | |
| define("filemanager/js/views/fileitemgrid", ["jquery", "underscore", "backbone", "text!./emptyView.html", "lang", "mixins/selection", "plugins/jquery/jquery.mouseSelect", "gui", "gui/grid/views/gridView", "./fileitem", "text!./fileitem.html", "text!./itemHeader.html", "text!./renameTooltip.html", "tracker", "modules/constants"], function(e, t, n, r, i, s, o, u, a, f, l, c, h, p, d) { | |
| return n.View.extend({ | |
| className: "fm-grid", | |
| viewHeight: 0, | |
| scrollTop: 0, | |
| defaults: { | |
| selectmodeEnabled: !0, | |
| lazyLoadingEnabled: !0, | |
| editEnabled: !0, | |
| headerTpl: c, | |
| itemTpl: l, | |
| emptyTpl: r | |
| }, | |
| initialize: function(e) { | |
| var n; | |
| t.defaults(this, e, this.defaults), | |
| this.mouseSelectRunning = !1, | |
| this.lazyLoadingEnabled ? n = u.LazyGrid : n = a, | |
| this.grid = (new n({ | |
| collection: this.collection, | |
| itemTpl: this.itemTpl, | |
| itemViewClass: f, | |
| headerTpl: this.headerTpl, | |
| container: e.container, | |
| emptyTpl: this.emptyTpl, | |
| canDrop: e.canDrop, | |
| dragdropEnabled: !!this.dragdropEnabled | |
| })).render(), | |
| this.listenTo(this.grid, "click", this.onItemClick), | |
| this.listenTo(this.grid, "contextmenu", this.onContextmenu), | |
| this.selectmodeEnabled && (this.listenTo(this.grid, "select", this.onItemSelect), | |
| this.listenTo(this.grid, "longpress", this.onItemSelect)), | |
| this.listenTo(this.collection, "add remove remove:end reset", this.checkEmpty), | |
| this.listenTo(this.collection, "load:start", this.onLoadStart), | |
| this.listenTo(this.collection, "change:selected", this.onChangeSelected), | |
| this.listenTo(this.collection, "selectAll", this.onSelectAll), | |
| this.listenTo(this.collection, "deselectAll", this.onDeselectAll), | |
| this.listenTo(this.collection, "remove:end", this.onRemoveEnd), | |
| this.on("scroll", function() { | |
| this.grid.trigger.apply(this.grid, t.union(["scroll"], arguments)) | |
| }, this), | |
| this.on("scrollIntoView", function(e) { | |
| this.grid.scrollIntoView(e) | |
| }, this), | |
| this._editor = null, | |
| this._editingModel = null, | |
| this._editingStopped = !1, | |
| this._itemToEdit = null, | |
| this._selectMode = !1 | |
| }, | |
| checkEmpty: function() { | |
| var e = this; | |
| this.$el.toggleClass("isEmpty", !this.collection.length), | |
| this.selectmodeEnabled && (this.$el.mouseSelect("off"), | |
| this.collection.length && this.$el.mouseSelect({ | |
| selector: ".sj-item:visible", | |
| onSelect: function(t) { | |
| e.onMouseSelect(t), | |
| e.mouseSelectRunning = !1 | |
| }, | |
| onStartSelect: function() { | |
| e.mouseSelectRunning = !0 | |
| }, | |
| ignoreSelector: this.dragdropEnabled ? ".sj-item.selected, .draggable" : "" | |
| })) | |
| }, | |
| render: function() { | |
| return this.setViewMode(this.viewMode), | |
| this.selectmodeEnabled && this._renderSelectMode(), | |
| this.$el.append(this.grid.$el), | |
| this.checkEmpty(), | |
| this | |
| }, | |
| _renderSelectMode: function() { | |
| this.$el.toggleClass("selected", this._selectMode) | |
| }, | |
| getSelectMode: function() { | |
| return this._selectMode | |
| }, | |
| setSelectMode: function(e) { | |
| e = !!e, | |
| this.selectmodeEnabled && this._selectMode !== e && (this._selectMode = e, | |
| this._renderSelectMode(), | |
| this.trigger("selectmode", this._selectMode)) | |
| }, | |
| setViewMode: function(e) { | |
| e && (this.viewMode = e), | |
| this.viewMode === "grid" ? this.$el.addClass("isGrid").removeClass("isList") : this.$el.addClass("isList").removeClass("isGrid"), | |
| this.grid.trigger("viewmode", this.viewMode) | |
| }, | |
| startEditor: function(e) { | |
| var n = this.grid.getItemViewByModel(e), r, s = "/", o = "\\t\\n\\r", a = t.template(h)({ | |
| Lang: i, | |
| chars: s | |
| }); | |
| if (!n) { | |
| console.error("Cannot start editor: view not found by model", e); | |
| return | |
| } | |
| this._editor && (p.track({ | |
| op: "rename-end", | |
| target: "accident" | |
| }), | |
| this._completeEditing()), | |
| this._editingModel = e, | |
| n.$el.addClass("editing"), | |
| n.toggleDraggable(!1), | |
| r = n.$el.find(".file-item-displayname"), | |
| this._editor = new u.InlineEditor({ | |
| pasteFilter: new RegExp("[" + s + o + "]","g"), | |
| filter: new RegExp("[" + s + "]"), | |
| filterTooltipHtml: a | |
| }), | |
| this._editor.render().$el.appendTo(r), | |
| this._editor.$input.css("white-space") === "nowrap" && this._editor.$input.attr("wrap", "off"), | |
| this.listenTo(this._editor, "done", this._saveEdit), | |
| this.listenTo(this._editor, "abort", this._abortEdit), | |
| this.listenTo(this._editor, "paste", this._editorPaste), | |
| this._editor.setValue(e.get("display_name")), | |
| this._editor.$input.focus(), | |
| this._editor.setSelection(e.get("base_name").length) | |
| }, | |
| _completeEditing: function() { | |
| var e = this.grid.getItemViewByModel(this._editingModel); | |
| e && (e.$el.removeClass("editing"), | |
| e.toggleDraggable(!0)), | |
| this._editor.remove(), | |
| this.stopListening(this._editor, "abort done paste"), | |
| this._editor = null, | |
| this._editingModel = null | |
| }, | |
| _saveEdit: function(e) { | |
| var t, n = this._editor.getValue(); | |
| e && (e.type === "blur" || e.type === "focusout" ? t = "blur" : e.type === "keyup" && e.which === 13 ? t = "enter" : e.type === "click" && (t = "click")), | |
| t && p.track({ | |
| op: "rename-end", | |
| target: t | |
| }), | |
| n && n !== this._editingModel.get("display_name") && (this.model.rename(this._editingModel, n), | |
| this.collection.getSelected().length === 1 && this.collection.deselectAll()), | |
| this._completeEditing() | |
| }, | |
| _abortEdit: function() { | |
| p.track({ | |
| op: "rename-end", | |
| target: "abort" | |
| }), | |
| this._completeEditing() | |
| }, | |
| _editorPaste: function() { | |
| p.track({ | |
| op: "rename", | |
| target: "paste" | |
| }) | |
| }, | |
| stopEditing: function(e) { | |
| return this._editor ? (this._saveEdit(e), | |
| !0) : !1 | |
| }, | |
| onItemClick: function(n, r) { | |
| this._editingStopped || (this._editingStopped = this.stopEditing(r)); | |
| if (!n) { | |
| this._itemToEdit = null; | |
| return | |
| } | |
| if (!n.get("readable")) { | |
| this._itemToEdit = null; | |
| return | |
| } | |
| if (this.mouseSelectRunning) { | |
| this._itemToEdit = null; | |
| return | |
| } | |
| if (!this.editEnabled || !this.model.get("writable") || !n.get("writable")) { | |
| this._itemToEdit = null, | |
| this._actionOrSelect(n, r); | |
| return | |
| } | |
| if (!e(r.target).closest(".label-text.display_name").length) { | |
| this._itemToEdit = null, | |
| this._dblclick_timeout && (clearTimeout(this._dblclick_timeout), | |
| this._dblclick_timeout = null); | |
| if (this._editingStopped) { | |
| this._editingStopped = !1; | |
| return | |
| } | |
| this._actionOrSelect(n, r); | |
| return | |
| } | |
| if (this._itemToEdit && this._itemToEdit !== n) { | |
| this._dblclick_timeout && (clearTimeout(this._dblclick_timeout), | |
| this._dblclick_timeout = null), | |
| this._itemToEdit = null; | |
| return | |
| } | |
| this._dblclick_timeout && this._itemToEdit === n ? (clearTimeout(this._dblclick_timeout), | |
| this._dblclick_timeout = null, | |
| this._itemToEdit = null, | |
| this._rename(n), | |
| p.track({ | |
| op: "rename-start", | |
| target: "dblclick", | |
| viewmode: this.viewMode | |
| }), | |
| this._editingStopped = !1) : (this._itemToEdit = n, | |
| this._dblclick_timeout = setTimeout(t.bind(function() { | |
| this._dblclick_timeout = null, | |
| this._itemToEdit = null, | |
| this._editingStopped ? this._editingStopped = !1 : this._actionOrSelect(n, r) | |
| }, this), d.doubleClickDelay)) | |
| }, | |
| onContextmenu: function(e, t) { | |
| this.selectmodeEnabled && (t && !t.selected ? (this.collection.firstSelected() && this.collection.deselectAll(), | |
| this.collection.select(t)) : t || this.collection.deselectAll()), | |
| this.trigger("contextmenu", e, t) | |
| }, | |
| _actionOrSelect: function(t, n) { | |
| e(n.target).is(".icon-item-shared") && p.track({ | |
| op: "share-info", | |
| target: "file-shareicon" | |
| }); | |
| var r = e(n.target).closest("[data-action]") | |
| , i = r.data("action"); | |
| r && i ? this.trigger("action:" + i, t) : this.collection.firstSelected() || this._selectMode ? this.onItemSelect(t, n, !0) : t.isDir() ? (this._trackNavigation(t, n), | |
| this.model.load(t.get("path"))) : t.get("type") !== "symlink" && this.trigger("open", t) | |
| }, | |
| _trackNavigation: function(t, n) { | |
| var r = "sj-item"; | |
| n && (e(n.target).closest(".file-item-icon").length ? r = "sj-item-icon" : e(n.target).closest(".file-item-label").length && (r = "sj-item-title")), | |
| p.track({ | |
| op: "navigate", | |
| target: r, | |
| viewmode: this.viewMode | |
| }) | |
| }, | |
| _rename: function(e) { | |
| this.trigger("rename", e) | |
| }, | |
| _isMoreThenOneSelected: function() { | |
| var e = !1; | |
| return this.collection.find(function(t) { | |
| return e ? t.selected : (e = t.selected, | |
| !1) | |
| }) | |
| }, | |
| onItemSelect: function(e, n, r) { | |
| if (this.stopEditing()) | |
| return; | |
| if (!e.get("readable")) | |
| return; | |
| var i = this.viewMode | |
| , s = t.bind(function(t) { | |
| e.selected ? this._isMoreThenOneSelected() ? p.track({ | |
| op: "select-remove", | |
| target: t, | |
| viewmode: i | |
| }) : p.track({ | |
| op: "select-end", | |
| target: t, | |
| viewmode: i | |
| }) : p.track({ | |
| op: "select-add", | |
| target: t, | |
| viewmode: i | |
| }) | |
| }, this); | |
| r ? s("icon") : this.collection.firstSelected() ? s("checkbox") : p.track({ | |
| op: "select-start", | |
| target: "checkbox", | |
| viewmode: i | |
| }), | |
| e.trigger("select", e, n.shiftKey, n.ctrlKey) | |
| }, | |
| onLoadStart: function() { | |
| this.$el.contents().detach(), | |
| this.$el.mouseSelect("off") | |
| }, | |
| remove: function() { | |
| return this.$el.mouseSelect("off"), | |
| this.grid.remove(), | |
| n.View.prototype.remove.apply(this, arguments) | |
| }, | |
| onMouseSelect: function(e) { | |
| t.each(e, function(e) { | |
| var t = this.grid.findModelForElement(e); | |
| t && this.collection.select(t) | |
| }, this) | |
| }, | |
| _renderItemSelection: function(e) { | |
| var t = this.grid.getItemViewByModel(e); | |
| t && t.$el.toggleClass("selected", e.selected === !0) | |
| }, | |
| onChangeSelected: function(e) { | |
| this._renderItemSelection(e), | |
| this.setSelectMode(!!this.collection.firstSelected()) | |
| }, | |
| onSelectAll: function() { | |
| t.each(this.collection.getSelected(), function(e) { | |
| this._renderItemSelection(e) | |
| }, this), | |
| this.setSelectMode(!0) | |
| }, | |
| onDeselectAll: function() { | |
| this.collection.each(function(e) { | |
| this._renderItemSelection(e) | |
| }, this), | |
| this.setSelectMode(!1) | |
| }, | |
| onRemoveEnd: function(e) { | |
| t.each(e, function(e) { | |
| this._renderItemSelection(e) | |
| }, this), | |
| this.collection.firstSelected() || this.setSelectMode(!1) | |
| } | |
| }) | |
| }), | |
| define("filemanager/js/views/filemanager", ["jquery", "underscore", "backbone", "text!./filemanager.html", "../models/folder", "./fileitemgrid", "gui", "api", "lang", "tracker"], function(e, t, n, r, i, s, o, u, a, f) { | |
| return n.View.extend({ | |
| className: "filemanager", | |
| template: t.template(r), | |
| downloadArchivePrefix: null, | |
| initialize: function(e) { | |
| this.downloadArchivePrefix = e.downloadArchivePrefix, | |
| this.dragdropEnabled = !!e.dragdropEnabled, | |
| this.uploadEnabled = !!e.uploadEnabled, | |
| this.dropUploadEnabled = !0, | |
| this.uploadItems = e.uploadItems, | |
| this.model = this.model || new i({ | |
| itemfilter: e.itemfilter, | |
| itemparser: e.itemparser | |
| }), | |
| t.defaults(this, t.pick(e, "rootPath"), { | |
| rootPath: "/" | |
| }), | |
| this.listenTo(this.model, "download", this.onDownload), | |
| this.listenTo(this.model.files, "download", this.onSingleDownload), | |
| this.listenTo(this.model.files, "load", this._onLoad), | |
| this.listenTo(this.model.files, "add", this.onAdd), | |
| this.listenTo(this.model.files, "load:start", this._onLoadStart); | |
| var n = { | |
| model: this.model, | |
| collection: this.model.files, | |
| container: e.container, | |
| lazyLoadingEnabled: e.lazyLoadingEnabled, | |
| selectmodeEnabled: e.selectmodeEnabled, | |
| editEnabled: e.editEnabled, | |
| headerTpl: e.headerTpl, | |
| itemTpl: e.itemTpl, | |
| emptyTpl: e.emptyTpl, | |
| dragdropEnabled: this.dragdropEnabled, | |
| viewMode: e.viewMode || "grid" | |
| }; | |
| if (this.dragdropEnabled || this.uploadEnabled) | |
| n.canDrop = t.bind(this._canDrop, this); | |
| this.grid = new s(n), | |
| this._dragItemsIds = [], | |
| this.listenTo(this.grid, "rename", this.rename), | |
| this.listenTo(this.grid, "action:share-info", this.onShareInfo), | |
| this.listenTo(this.grid, "action:download", this.onSingleDownload), | |
| this.listenTo(this.grid, "contextmenu", this.onContextmenu), | |
| this.listenTo(this.grid, "selectmode", this.onSelectMode), | |
| this.listenTo(this.grid, "open", this.onOpen), | |
| this.dragdropEnabled && (this.listenTo(this.grid.grid, "drag:start", this._onDragStart), | |
| this.listenTo(this.grid.grid, "drag:end", this._onDragEnd)); | |
| if (this.dragdropEnabled || this.uploadEnabled) | |
| this.listenTo(this.grid.grid, "drag:over", this._onDragOver), | |
| this.listenTo(this.grid.grid, "drag:leave", this._onDragLeave), | |
| this.listenTo(this.grid.grid, "drop", this._onDrop) | |
| }, | |
| render: function() { | |
| return this.$el.contents().detach(), | |
| this.$el.append(e(this.template())), | |
| this.$(".grid-target").replaceWith(this.grid.$el), | |
| this._onLoadStart(), | |
| this | |
| }, | |
| setViewMode: function(e) { | |
| this.grid.setViewMode(e), | |
| this.loading || this.grid.render() | |
| }, | |
| _onLoad: function() { | |
| this.grid.render(), | |
| this._setLoadingState(!1), | |
| this._updateDropState(!0), | |
| this.model.get("path") && this.trigger("navigate", this.model.get("path")) | |
| }, | |
| _updateDropState: function(e) { | |
| this.canDropUpload = e && !!this.uploadItems && !!this.model.get("writable"), | |
| this.grid.$el.toggleClass("canDropUpload", this.canDropUpload) | |
| }, | |
| remove: function() { | |
| this.grid.remove(), | |
| n.View.prototype.remove.apply(this, arguments) | |
| }, | |
| _onLoadStart: function() { | |
| if (this.loading) | |
| return; | |
| this._updateDropState(!1), | |
| this._setLoadingState(!0) | |
| }, | |
| _setLoadingState: function(e) { | |
| this.loading = e, | |
| this.$el.toggleClass("filemanager-loading", e) | |
| }, | |
| scrollIntoView: function(e) { | |
| this.grid.trigger("scrollIntoView", e) | |
| }, | |
| rename: function(e) { | |
| e || (e = this.model.files.firstSelected()), | |
| this.grid.startEditor(e) | |
| }, | |
| getSelectMode: function() { | |
| return this.grid.getSelectMode() | |
| }, | |
| setSelectMode: function(e) { | |
| this.grid.setSelectMode(e) | |
| }, | |
| onShareInfo: function(e) { | |
| this.model.trigger("share-info", e) | |
| }, | |
| onDownload: function() { | |
| var e = this.model, t = e.files, n = t.getSelected(), r; | |
| n.length && n.length < t.length ? r = n : r = [this.model], | |
| n.length ? n.length === 1 && n[0].isDir() ? f.track({ | |
| op: "download", | |
| target: "folder" | |
| }) : n.length === 1 && !n[0].isDir() ? f.track({ | |
| op: "download", | |
| target: "file" | |
| }) : f.track({ | |
| op: "download", | |
| target: "selection" | |
| }) : f.track({ | |
| op: "download", | |
| target: "all" | |
| }), | |
| u.download(r, this.model, { | |
| archivePrefix: this.downloadArchivePrefix | |
| }), | |
| this.model.files.deselectAll() | |
| }, | |
| onSingleDownload: function(e) { | |
| u.download(e, this.model, { | |
| archivePrefix: this.downloadArchivePrefix | |
| }) | |
| }, | |
| onContextmenu: function(e, t) { | |
| this.trigger("contextmenu", e, t) | |
| }, | |
| onSelectMode: function(e) { | |
| this.trigger("selectmode", e) | |
| }, | |
| onOpen: function(e) { | |
| this.trigger("open", e) | |
| }, | |
| _canDrop: function(e, n, r) { | |
| var i = !1 | |
| , s = !!this._dragItemsIds.length | |
| , o = t.contains(n.types, "Files"); | |
| return r ? s && !t.contains(this._dragItemsIds, r.id) && (i = r.isDir() && r.get("writable") && !r.selected) : this.dropUploadEnabled && this.canDropUpload && o && (n.dropEffect = "copy", | |
| i = !0), | |
| i | |
| }, | |
| _onDragStart: function(e, n) { | |
| var r = n.get("id") | |
| , i = [r] | |
| , s = t.pluck(this.model.files.getSelected(), "id"); | |
| s.length && (t.contains(s, r) ? i = s : this.model.files.deselectAll()), | |
| this._dragItemsIds = i, | |
| e.originalEvent.dataTransfer.effectAllowed = "all", | |
| e.originalEvent.dataTransfer.dropEffect = "move", | |
| e.originalEvent.dataTransfer.setData("Text", JSON.stringify(i)) | |
| }, | |
| _onDragOver: function(t, n, r) { | |
| this.grid.$el.toggleClass("isDraggedOver", !!t && !r), | |
| this.grid.grid.$(".sj-dragged-over").removeClass("sj-dragged-over"), | |
| t && r && e(t).addClass("sj-dragged-over") | |
| }, | |
| _onDragLeave: function() { | |
| this.grid.$el.removeClass("isDraggedOver"), | |
| this.grid.grid.$(".sj-dragged-over").removeClass("sj-dragged-over") | |
| }, | |
| _onDrop: function(e, t, n) { | |
| if (n) { | |
| var r = this.model.files.filter(function(e) { | |
| return this._dragItemsIds.indexOf(e.id) > -1 | |
| }, this); | |
| if (!r.length) | |
| return; | |
| this.trigger("move", n, r) | |
| } else | |
| t && t.files.length && (this.uploadItems.addFiles(this.model, t.files), | |
| this._trackDrop(t)) | |
| }, | |
| _onDragEnd: function() { | |
| this._dragItemsIds = [] | |
| }, | |
| _trackDrop: function(e) { | |
| var n = "unknown" | |
| , r = t.chain(e.types); | |
| r.contains("Files").value() && !r.contains("text/x-moz-url").value() ? n = "files" : n = r.without("Files").map(function(e) { | |
| return e.split("/")[0] | |
| }).uniq().value().sort().join(","), | |
| f.track({ | |
| op: "drop", | |
| target: "filemanager", | |
| data: n | |
| }) | |
| }, | |
| setDropUploadEnabled: function(e) { | |
| this.dropUploadEnabled = !!e | |
| } | |
| }) | |
| }), | |
| define("filemanager/main", ["./js/views/filemanager"], function(e) { | |
| return function(t) { | |
| return new e(t) | |
| } | |
| }), | |
| define("filemanager", ["filemanager/main"], function(e) { | |
| return e | |
| }), | |
| define("filemanager/js/views/folderBreadcrumb", ["underscore", "gui", "api", "lang"], function(e, t, n, r) { | |
| return t.Breadcrumb.extend({ | |
| className: "folder-breadcrumb sj-breadcrumb", | |
| initialize: function() { | |
| t.Breadcrumb.prototype.initialize.apply(this, arguments); | |
| if (this.config.leadInSegment) { | |
| if (!this.config.leadInSegment.name) | |
| throw new Error("lead-in segment must define a name"); | |
| if (!this.config.leadInSegment.href) | |
| throw new Error("lead-in segment must define a href"); | |
| if (!this.config.leadInSegment.title) | |
| throw new Error("lead-in segment must define a title") | |
| } | |
| this.listenTo(this.model, "change:share", this.updateSegments), | |
| this.listenTo(this.model.files, "load", this.renderSegments), | |
| this.buildSegments() | |
| }, | |
| buildSegments: function() { | |
| var t = this.model.get("path"); | |
| t = t.replace(/\/$/, ""); | |
| var i = t.split("/") | |
| , s = [] | |
| , o = "" | |
| , u = this.config.rootName; | |
| this.config.leadInSegment && s.push(this.config.leadInSegment), | |
| e.each(i, function(e) { | |
| var t = o += (o === "/" || o + e === u ? "" : "/") + e | |
| , r = n.Encoding.urlDecode(t); | |
| if (e === "") { | |
| if (!u) | |
| return; | |
| e = u | |
| } | |
| var i = n.Encoding.urlDecode(e); | |
| s.push({ | |
| name: i, | |
| href: this.config.prefix + t, | |
| title: r | |
| }) | |
| }, this), | |
| this.model.get("share") && (s[s.length - 1].icon = { | |
| className: "share icon-breadcrumb-shared", | |
| title: r.get("filemanager.share.tooltip") | |
| }), | |
| this.segments = s | |
| }, | |
| updateSegments: function() { | |
| this.segments.length && this.renderSegments() | |
| }, | |
| renderSegments: function() { | |
| return this.buildSegments(), | |
| this.render() | |
| }, | |
| setRoot: function(e) { | |
| this.config.rootName = e, | |
| this.renderSegments() | |
| } | |
| }) | |
| }), | |
| define("gui/bar/barView", ["backbone"], function(e) { | |
| return e.View.extend({ | |
| className: "bar", | |
| render: function(e) { | |
| return this.$el.width(e + "%"), | |
| this | |
| } | |
| }) | |
| }), | |
| define("filemanager/js/models/uploadItem", ["jquery", "underscore", "backbone", "api", "formatters"], function(e, t, n, r, i) { | |
| var s = { | |
| QUEUED: "queued", | |
| WAITING: "waiting", | |
| RUNNING: "running", | |
| COMPLETE: "complete", | |
| CANCELLED: "cancelled", | |
| FAILED: "failed" | |
| } | |
| , o = 0; | |
| return n.Model.extend({ | |
| defaults: { | |
| progress: 0, | |
| completed: 0, | |
| status: s.QUEUED, | |
| error: null | |
| }, | |
| initialize: function(e) { | |
| var t = e.file, n = "", i = e.folder, s = e.eventId, u; | |
| delete e.folderId, | |
| delete e.file, | |
| delete e.eventId, | |
| this.data = null, | |
| this._file = t, | |
| this._folder = i, | |
| this._eventId = s, | |
| u = t.name.split("."), | |
| u.length > 1 && u[0] !== "" && (n = u.pop()), | |
| this.set({ | |
| id: ++o, | |
| name: t.name, | |
| size: t.size, | |
| modified: t.lastModifiedDate, | |
| type: t.type, | |
| group: r.Filegroups.get(n) | |
| }), | |
| this.listenTo(this, "change:status", this.onChangeStatus) | |
| }, | |
| _getTmpFilename: function() { | |
| var e = new Date | |
| , t = "YmdHis" | |
| , n = i.date(e.getTime() / 1e3, t); | |
| return [this._file.name, n, "webupload"].join(".") | |
| }, | |
| upload: function() { | |
| function f(n, s) { | |
| var o = r.newFile(n, s); | |
| return t._xhrAbort = o.abort, | |
| o.then(function(e) { | |
| i = e.clone() | |
| }, function(t, n, r) { | |
| return e.Deferred().reject(r).promise() | |
| }) | |
| } | |
| function l() { | |
| var n, s = [], f = 0, l = 0, c = Math.ceil(u.size / o), p; | |
| for (; f < c; f++) | |
| p = Math.min(l + o, u.size), | |
| s.push(u.slice(l, p)), | |
| l = p; | |
| return n = s.reduce(function(e, n, s) { | |
| return e.then(function() { | |
| a = s * o; | |
| var e = r.patchFile(i, n, s * o, h); | |
| return t._xhrAbort = e.abort, | |
| e | |
| }) | |
| }, e.Deferred().resolve()), | |
| n.then(null, function(t, n, r) { | |
| return e.Deferred().reject(r).promise() | |
| }) | |
| } | |
| function c() { | |
| return r.rename(i, t.get("name"), t.get("on_exist")).then(function(t, n) { | |
| return e.Deferred().resolve(n.attributes).promise() | |
| }, function(t, n, r, i) { | |
| return e.Deferred().reject(i).promise() | |
| }) | |
| } | |
| function h(e) { | |
| var n = a + e.loaded; | |
| t.set({ | |
| completed: n, | |
| size: u.size, | |
| progress: Math.min(1, +(n / u.size).toFixed(3)) | |
| }) | |
| } | |
| function p() { | |
| i && r.deleteFiles([i]) | |
| } | |
| var t = this, n = this._getTmpFilename(), i, o = 15728640, u = this._file, a = 0; | |
| return this.set({ | |
| status: s.RUNNING | |
| }), | |
| f(this.getFolder(), n).then(l).fail(p).then(c).then(function(e) { | |
| return t._onSuccess(e, "success") | |
| }, function(e) { | |
| return t._onError(e) | |
| }) | |
| }, | |
| _onSuccess: function(t) { | |
| var n = e.Deferred(); | |
| return this.data = t, | |
| this.set({ | |
| progress: 1, | |
| status: s.COMPLETE | |
| }), | |
| n.resolve(this, "success"), | |
| n.promise() | |
| }, | |
| _onError: function(n) { | |
| var r, i = e.Deferred(); | |
| return n === "abort" ? (i.resolve(this, "abort"), | |
| i.promise()) : (r = { | |
| progress: 1, | |
| error: n | |
| }, | |
| this.get("status") !== s.CANCELLED && t.extend(r, { | |
| status: s.FAILED | |
| }), | |
| this.set(r), | |
| i.reject(this, n), | |
| i.promise()) | |
| }, | |
| onChangeStatus: function(e) { | |
| var n = [s.CANCELLED, s.COMPLETE, s.FAILED]; | |
| t.contains(n, e) && (this.destroyItemReferences(), | |
| this.stopListening(this, "change:status", this.onChangeStatus)) | |
| }, | |
| cancel: function() { | |
| var e = [s.FAILED, s.CANCELLED, s.COMPLETE]; | |
| if (t.contains(e, this.get("status"))) | |
| return; | |
| this._xhrAbort && this._xhrAbort(), | |
| this.set("status", s.CANCELLED) | |
| }, | |
| destroy: function() { | |
| this.set({ | |
| id: null | |
| }), | |
| n.Model.prototype.destroy.apply(this, arguments) | |
| }, | |
| destroyItemReferences: function() { | |
| delete this._file, | |
| delete this._xhrAbort | |
| }, | |
| getFolder: function() { | |
| return this._folder | |
| }, | |
| getEventId: function() { | |
| return this._eventId | |
| } | |
| }, { | |
| STATUS: s | |
| }) | |
| }), | |
| define("text!templates/filemanager/uploadItemView.html", [], function() { | |
| return '<div class="upload-item">\n <div class="upload-item-mimetype upload-overlay-group-icon icon-mimetype-group-<%= model.get("group") %>"></div>\n <div class="upload-item-infos">\n <div class="upload-item-details sj-selectable">\n <div class="upload-item-name" title="<%- model.get("name") %>"><%- model.get("name") %></div>\n <div class="upload-item-size-status">\n <span class="upload-item-size-progress"></span>\n <span class="upload-item-status"><%- lang.get("upload.detail.item.status.aborted") %></span>\n </div>\n </div>\n <div class="upload-item-progress progressbar-container">\n </div>\n </div>\n <div class="upload-item-controls">\n <button class="icon-container upload-item-cancel" data-action="cancel" data-track-op="upload-cancel" data-track-target="item">\n <span class="icon-upload-cancel"></span>\n </button>\n </div>\n</div>\n' | |
| }), | |
| define("filemanager/js/views/uploadItemView", ["underscore", "gui/grid/views/itemView", "gui/bar/barView", "../models/uploadItem", "text!templates/filemanager/uploadItemView.html", "lang", "formatters"], function(e, t, n, r, i, s, o) { | |
| var u = e.values(r.STATUS), a, f = function(e) { | |
| return "upload-status-" + e | |
| }; | |
| return a = e.map(u, f).join(" "), | |
| t.extend({ | |
| template: e.template(i), | |
| initialize: function() { | |
| t.prototype.initialize.apply(this, arguments), | |
| this.progressBar = new n, | |
| this.listenTo(this.model, "change:status", this.updateProgress), | |
| this.listenTo(this.model, "change:progress", this.updateProgress) | |
| }, | |
| render: function() { | |
| return t.prototype.render.call(this), | |
| this.updateProgress(), | |
| this | |
| }, | |
| remove: function() { | |
| return this.progressBar.remove(), | |
| t.prototype.remove.apply(this, arguments) | |
| }, | |
| _addStatusClasses: function() { | |
| var e = this.model.get("status"); | |
| this.$el.removeClass(a), | |
| this.$el.addClass(f(e)) | |
| }, | |
| updateProgress: function() { | |
| this._renderProgressBar(), | |
| this._addStatusClasses(), | |
| this.$(".upload-item-size-progress").length && this._renderProgressSize() | |
| }, | |
| _renderProgressBar: function() { | |
| var e = this.$(".progressbar-container"); | |
| if (e.length) { | |
| var t = this.model.get("progress") * 100; | |
| this.progressBar.render(t), | |
| e.html(this.progressBar.$el) | |
| } | |
| }, | |
| _renderProgressSize: function() { | |
| var e, t = o.size(this.model.get("size")); | |
| if (this.model.get("progress") < 1) { | |
| var n = o.size(this.model.get("completed")); | |
| e = s.get("upload.detail.item.status.transferred", [n, t]) | |
| } else | |
| e = t; | |
| this.$(".upload-item-size-progress").text(e) | |
| } | |
| }) | |
| }), | |
| define("text!templates/filemanager/uploadDetailTitle.html", [], function() { | |
| return "<%= progress %>\n" | |
| }), | |
| define("filemanager/js/views/uploadDetailTitleView", ["underscore", "backbone", "lang", "../models/uploadItem", "text!templates/filemanager/uploadDetailTitle.html"], function(e, t, n, r, i) { | |
| return t.View.extend({ | |
| tagName: "span", | |
| template: e.template(i), | |
| initialize: function() { | |
| this.listenTo(this.collection, "add remove change:status reset", this.render) | |
| }, | |
| render: function() { | |
| var e, t = this.collection.length, r = this.collection.filter(this.remainingUploadsFilter), i = r.length > 0; | |
| return i ? e = r.length === 1 ? n.get("upload.detail.title.progress.single", [t, r.length]) : n.get("upload.detail.title.progress.multi", [t, r.length]) : e = t === 1 ? n.get("upload.detail.title.done.single", [t]) : n.get("upload.detail.title.done.multi", [t]), | |
| this.$el.html(this.template({ | |
| lang: n, | |
| progress: e | |
| })), | |
| this | |
| }, | |
| remainingUploadsFilter: function(t) { | |
| var n = [r.STATUS.RUNNING, r.STATUS.WAITING, r.STATUS.QUEUED]; | |
| return e.contains(n, t.get("status")) | |
| } | |
| }) | |
| }), | |
| define("text!templates/filemanager/uploadStats.html", [], function() { | |
| return "" | |
| }), | |
| define("filemanager/js/views/uploadStatsView", ["underscore", "backbone", "lang", "filemanager/js/models/uploadItem", "gui/bar/barView", "text!templates/filemanager/uploadStats.html"], function(e, t, n, r, i, s) { | |
| return t.View.extend({ | |
| className: "upload-stats", | |
| _template: e.template(s), | |
| events: { | |
| click: "onClick", | |
| "click .close": "onClose" | |
| }, | |
| initialize: function() { | |
| this.listenTo(this.collection, "update-stats", this._renderStats), | |
| this.listenTo(this.collection, "change:progress change:status", this._renderProgressBar), | |
| this.progressBarView = new i | |
| }, | |
| onClick: function() { | |
| this.trigger("click") | |
| }, | |
| onClose: function(e) { | |
| e.stopPropagation(), | |
| this.collection.removeFinished(), | |
| this.trigger("close") | |
| }, | |
| render: function() { | |
| return this.$el.html(this._template()), | |
| this._renderStats(this.collection.getStats()), | |
| this._renderProgressBar(), | |
| this | |
| }, | |
| _renderStats: function(e) { | |
| var t = e.all - e.completed - e.failed - e.cancelled; | |
| this.$(".uploads-ok-text").text(n.get("upload.detail.stats.transfer", [e.completed, e.all])), | |
| this.$(".uploads-error-text").text(n.get("upload.detail.stats.error", [e.failed, e.all])), | |
| this.$el.toggleClass("running", !!t), | |
| this.$el.toggleClass("error", !!e.failed), | |
| this.$el.toggleClass("completed", !!e.completed && !t) | |
| }, | |
| _renderProgressBar: function() { | |
| var t = this.$(".progress-bar"); | |
| if (t.length) { | |
| var n = 0; | |
| this.collection.each(function(t) { | |
| e.indexOf([r.STATUS.CANCELLED, r.STATUS.FAILED], t.get("status")) < 0 && (n += t.get("progress")) | |
| }); | |
| var i = n * 100 / (this.collection.getStats().all || 1); | |
| t.html(this.progressBarView.render(i).$el) | |
| } | |
| } | |
| }) | |
| }), | |
| define("filemanager/js/views/uploadButtonView", ["jquery", "backbone", "underscore", "gui", "actionManager"], function(e, t, n, r, i) { | |
| return r.IconButton.extend({ | |
| _singleUploadOnlyUserAgentRegEx: /^.*Mac.*AppleWebKit\/.*Mobile\/.*$/, | |
| getInputAttributes: function(e) { | |
| return { | |
| name: "anyname", | |
| multiple: !e | |
| } | |
| }, | |
| events: { | |
| "change input": "onChange", | |
| "click input": "onClick" | |
| }, | |
| inputType: "file", | |
| render: function() { | |
| r.IconButton.prototype.render.apply(this, arguments); | |
| var t = this._singleUploadOnlyUserAgentRegEx.test(navigator.userAgent) | |
| , n = e('<input type="' + this.inputType + '" />').attr(this.getInputAttributes(t)); | |
| return this.$el.append(n), | |
| this | |
| }, | |
| onClick: function() { | |
| this.trigger("click") | |
| }, | |
| onChange: function() { | |
| var e = this.$("input") | |
| , t = n.toArray(e[0].files) || [{ | |
| name: e.val().split(/\\/).pop(), | |
| file: !1 | |
| }]; | |
| this.config.action && i.execute(this.config.action, t), | |
| this.trigger("add", t), | |
| this.render(), | |
| this.delegateEvents() | |
| } | |
| }) | |
| }), | |
| define("text!templates/filemanager/uploadDetailView.html", [], function() { | |
| return '<div class="overlay-title">\n <div class="title-target"></div>\n</div>\n\n<div class="grid-target"></div>\n\n<div class="overlay-buttons">\n <div class="button-close"></div>\n\n <div class="button-cancel-all"></div>\n\n <div class="button-more-uploads"></div>\n</div>\n' | |
| }), | |
| define("filemanager/js/views/uploadDetailView", ["jquery", "underscore", "gui", "tracker", "lang", "./uploadItemView", "./uploadDetailTitleView", "./uploadStatsView", "./uploadButtonView", "../models/uploadItem", "text!templates/filemanager/uploadDetailView.html"], function(e, t, n, r, i, s, o, u, a, f, l) { | |
| return n.BaseOverlayView.extend({ | |
| template: t.template(l), | |
| autoClose: !1, | |
| events: { | |
| "click .cancel-all": "onCancelAll" | |
| }, | |
| initialize: function(e) { | |
| e && e.autoClose && (this.autoClose = !0), | |
| t.has(e, "canClose") && (this.canClose = e.canClose), | |
| this.grid = new n.Grid({ | |
| collection: this.collection, | |
| itemViewClass: s | |
| }), | |
| this.title = new o({ | |
| collection: this.collection | |
| }), | |
| this.statsView = new u({ | |
| collection: this.collection | |
| }), | |
| this.closeButton = new n.Button({ | |
| text: i.get("upload.detail.close"), | |
| secondary: !0 | |
| }), | |
| this.listenTo(this.closeButton, "click", this.close), | |
| this.upload = new a({ | |
| text: i.bind("upload.detail.moreuploads"), | |
| iconClass: "icon-upload", | |
| disabled: !this.model.get("writable") | |
| }), | |
| this.listenTo(this.upload, "click", this._trackUpload), | |
| this.cancelAllButton = new n.Button({ | |
| text: i.get("upload.detail.cancelAll"), | |
| secondary: !0 | |
| }), | |
| this.listenTo(this.cancelAllButton, "click", this.onCancelAll), | |
| this.listenTo(this.grid, "click", this.onGridClick), | |
| this.listenTo(this.collection, "update-stats", this.onUploadStats) | |
| }, | |
| render: function() { | |
| this.$overlayEl.addClass("uploaddetail-overlay"), | |
| this.$el.html(this.template({ | |
| lang: i | |
| })); | |
| var e = this.$(".grid-target"); | |
| e.length && e.replaceWith(this.grid.$el); | |
| var t = this.$(".title-target"); | |
| t.length && t.replaceWith(this.title.render().$el); | |
| var n = this.$(".stats-target"); | |
| n.length && n.replaceWith(this.statsView.render().$el); | |
| var r = this.$(".button-close"); | |
| r.length && r.append(this.closeButton.render().$el); | |
| var s = this.$(".button-more-uploads"); | |
| s.length && (s.append(this.upload.render().$el), | |
| this.listenTo(this.upload, "add", this.addUpload)); | |
| var o = this.$(".button-cancel-all"); | |
| return o.length && o.append(this.cancelAllButton.render().$el), | |
| this.renderUploadStats(this.collection.getStats()), | |
| this | |
| }, | |
| renderUploadStats: function(e) { | |
| this.$overlayEl.toggleClass("uploads-running", e.remaining > 0) | |
| }, | |
| remove: function() { | |
| return this.grid.remove(), | |
| this.title.remove(), | |
| this.statsView.remove(), | |
| this.closeButton.remove(), | |
| this.cancelAllButton.remove(), | |
| this.upload.remove(), | |
| n.BaseOverlayView.prototype.remove.apply(this, arguments) | |
| }, | |
| onBeforeClose: function() { | |
| this.collection.getStats().remaining || this.collection.removeFinished(), | |
| r.track({ | |
| op: "upload-status-hide", | |
| target: "overlay" | |
| }) | |
| }, | |
| addUpload: function(e) { | |
| this.collection.addFiles(this.model, e) | |
| }, | |
| _trackUpload: function() { | |
| r.track({ | |
| op: "upload", | |
| target: "overlay" | |
| }) | |
| }, | |
| onCancelAction: function(e, t) { | |
| t.data = e.get("status"), | |
| this.collection.cancel(e) | |
| }, | |
| onCancelAll: function() { | |
| this.collection.abort() | |
| }, | |
| onGridClick: function(n, i) { | |
| if (n) { | |
| var s = e(i.target).closest("[data-action]"), o, u, a, f = {}, l = { | |
| cancel: "onCancelAction" | |
| }; | |
| if (!s.length) | |
| return; | |
| u = s.data("track-op"), | |
| a = s.data("track-target"), | |
| u && a && (f = { | |
| op: u, | |
| target: a | |
| }), | |
| o = this[l[s.data("action")]], | |
| t.isFunction(o) && o.call(this, n, f), | |
| f.op && f.target && r.track(f) | |
| } | |
| }, | |
| onUploadStats: function(e) { | |
| this.renderUploadStats(e), | |
| this.autoClose && e.remaining === 0 && e.failed === 0 && this.close() | |
| } | |
| }) | |
| }), | |
| define("filemanager/js/collections/uploadItems", ["jquery", "underscore", "backbone", "filemanager/js/models/uploadItem", "api/models/fileModel"], function(e, t, n, r, i) { | |
| var s = r.STATUS; | |
| return n.Collection.extend({ | |
| model: r, | |
| comparator: function(e, t) { | |
| return e.id > t.id ? 1 : -1 | |
| }, | |
| onError: function() { | |
| return !1 | |
| }, | |
| initialize: function(e, n) { | |
| n = n || {}; | |
| if (!t.isFunction(n.onBeforeStart)) | |
| throw new Error("Upload queue requires a onBeforeStart handler that calls the passed continuation callback"); | |
| this.onBeforeStart = n.onBeforeStart, | |
| t.isFunction(n.onError) && (this.onError = n.onError), | |
| this.listenTo(this, "add", this._onAdd), | |
| this.listenTo(this, "add reset change:status remove", this._updateStats), | |
| this._stats = t.extend({}, this._emptyStats) | |
| }, | |
| _onAdd: function() { | |
| this._alreadyCancelled = !1, | |
| this._next() | |
| }, | |
| _emptyStats: { | |
| all: 0, | |
| completed: 0, | |
| running: 0, | |
| failed: 0, | |
| cancelled: 0, | |
| remaining: 0 | |
| }, | |
| _updateStats: function() { | |
| var e = function(e, t) { | |
| var n = t.get("status"); | |
| return e.all++, | |
| n === s.COMPLETE ? e.completed++ : n === s.FAILED ? e.failed++ : n === s.CANCELLED ? e.cancelled++ : n === s.RUNNING ? (e.running++, | |
| e.remaining++) : e.remaining++, | |
| e | |
| }; | |
| this._stats = t.extend({}, this._emptyStats), | |
| this._stats = t.reduce(this.toArray(), e, this._stats), | |
| this.trigger("update-stats", this._stats) | |
| }, | |
| getStats: function() { | |
| return this._stats | |
| }, | |
| _cancelQueued: function() { | |
| this._alreadyCancelled = !0, | |
| t.each(this.filter(function(e) { | |
| return t.contains([s.QUEUED, s.WAITING], e.get("status")) | |
| }), function(e) { | |
| e.set({ | |
| status: s.CANCELLED, | |
| progress: 0, | |
| error: "CANCELLED" | |
| }) | |
| }), | |
| this.trigger("cancelled") | |
| }, | |
| _findByStatus: function(e) { | |
| return this.findWhere({ | |
| status: e | |
| }) | |
| }, | |
| _findByAnyStatus: function(e) { | |
| return this.find(function(n) { | |
| return t.contains(e, n.get("status")) | |
| }) | |
| }, | |
| _next: function() { | |
| var e = this._findByStatus(r.STATUS.RUNNING) || this._findByStatus(r.STATUS.WAITING); | |
| if (e) | |
| return; | |
| e = this._findByStatus(r.STATUS.QUEUED), | |
| e ? this._beforeUpload(e) : this.trigger("complete") | |
| }, | |
| _beforeUpload: function(e) { | |
| var n = this; | |
| e.set("status", s.WAITING), | |
| this.onBeforeStart(e, function() { | |
| n._upload(e) | |
| }, function() { | |
| e.destroy(), | |
| n._next() | |
| }, function() { | |
| var i = e.getEventId(), o; | |
| o = n.filter(function(e) { | |
| return e.getEventId() === i && t.contains([s.QUEUED, s.WAITING], e.get("status")) | |
| }); | |
| while (o.length > 0) | |
| o.shift().destroy(); | |
| n._next() | |
| }, function() { | |
| e.set("status", r.STATUS.FAILED), | |
| n._next() | |
| }) | |
| }, | |
| _onUploadDone: function(e, t) { | |
| if (t === "abort" || t === "success") { | |
| this._next(); | |
| return | |
| } | |
| this.onError(e, t) === !0 ? this._alreadyCancelled || this._cancelQueued() : this._next() | |
| }, | |
| _upload: function(e) { | |
| if (e.get("status") !== s.WAITING) | |
| return; | |
| e.upload().always(t.bind(this._onUploadDone, this)), | |
| this.trigger("upload", e) | |
| }, | |
| cancel: function(e) { | |
| return e ? (e.cancel(), | |
| this._next(), | |
| this) : this | |
| }, | |
| abort: function() { | |
| return this._cancelQueued(), | |
| this.cancel(this._findByStatus(r.STATUS.RUNNING)), | |
| this | |
| }, | |
| removeFinished: function() { | |
| var e = this.filter(function(e) { | |
| return t.contains([r.STATUS.COMPLETE, r.STATUS.FAILED, r.STATUS.CANCELLED], e.get("status")) | |
| }); | |
| this.remove(e) | |
| }, | |
| reset: function() { | |
| var e = [r.STATUS.RUNNING, r.STATUS.WAITING]; | |
| if (this._findByAnyStatus(e)) | |
| throw new Error("Refusing to reset: there's one item in running or waiting state"); | |
| n.Collection.prototype.reset.apply(this, arguments) | |
| }, | |
| addFiles: function(e, n) { | |
| var r = { | |
| eventId: (new Date).getTime(), | |
| folder: new i(e.attributes,{ | |
| parse: !0, | |
| context: e.getContext() | |
| }) | |
| }; | |
| t.each(n, function(e) { | |
| this.add(t.extend({ | |
| file: e | |
| }, r)) | |
| }, this) | |
| } | |
| }) | |
| }), | |
| define("filemanager/js/models/baseFolder", ["underscore", "jquery", "./folder", "auth", "api"], function(e, t, n, r, i) { | |
| return n.extend({ | |
| initialize: function(e) { | |
| n.prototype.initialize.call(this, e), | |
| this._shareVisitor = (e || {}).shareVisitorFn || t.noop, | |
| this.listenTo(i, "rename:success", this._onRenameSuccess) | |
| }, | |
| parse: function(t) { | |
| var r; | |
| t = n.prototype.parse.apply(this, arguments); | |
| if (!t) | |
| return null; | |
| var i = function(t, n) { | |
| var r = e.find(t, function(e) { | |
| return e.share_type === n | |
| }); | |
| return r ? r.id : null | |
| } | |
| , s = e.bind(function(t, n, r, i) { | |
| return this._shareVisitor(e.extend({ | |
| pid: t, | |
| type: n, | |
| path: r | |
| }, i)) | |
| }, this); | |
| return t.rshare ? (r = e.filter(t.rshare, function(e) { | |
| return e.share_type === "sharedir" | |
| }), | |
| r.length > 0 && s(t.id, "dir", t.path, r[0]) !== !1 ? t.share = i(t.rshare, "sharedir") : t.share = null, | |
| delete t.rshare) : t.share = null, | |
| e.each(t.members, function(t) { | |
| t.rshare && (r = e.filter(t.rshare, function(e) { | |
| return ["sharedir", "sharelink"].indexOf(e.share_type) > -1 | |
| }), | |
| r.length > 0 && s(t.id, t.type, t.path, r[0]) !== !1 && (t.type === "dir" ? t.share = i(t.rshare, "sharedir") : t.share = i(t.rshare, "sharelink")), | |
| delete t.rshare) | |
| }, this), | |
| t | |
| }, | |
| queryData: { | |
| fields: ["id", "path", "writable", "rshare", "members.id", "members.parent_id", "members.name", "members.ctime", "members.mtime", "members.path", "members.readable", "members.writable", "members.type", "members.size", "members.rshare"], | |
| members: "all" | |
| }, | |
| rename: function(t, n) { | |
| if (!t) | |
| throw new Error("no model to rename defined"); | |
| if (t instanceof this.files.model != 1) | |
| throw new Error("FileItem Model required to rename"); | |
| if (e.isUndefined(n)) | |
| throw new Error("new name required in rename"); | |
| if (!e.isString(n)) | |
| throw new Error("new name must be of type string in rename"); | |
| return this.modelToRename = t, | |
| i.rename(t, n).progress(e.bind(function(e, t) { | |
| this.files.remove(e), | |
| this.files.add(t) | |
| }, this)).fail(e.bind(function(e, t) { | |
| this.files.remove(t), | |
| this.files.add(e) | |
| }, this)).always(e.bind(function() { | |
| this.modelToRename = null | |
| })) | |
| }, | |
| _onRenameSuccess: function(e, t) { | |
| this.files.get(e.id) && e !== this.modelToRename && (this.files.remove(e), | |
| this.files.remove(this.files.where({ | |
| path: t.get("path") | |
| })), | |
| this.files.add(t)) | |
| } | |
| }) | |
| }), | |
| define("filemanager/js/models/shareFolder", ["underscore", "./folder", "./baseFolder"], function(e, t, n) { | |
| return n.extend({ | |
| itemfilter: function(e) { | |
| return e.readable && e.type !== "symlink" | |
| }, | |
| parse: function(e) { | |
| return e = t.prototype.parse.apply(this, arguments), | |
| e ? (e.path && e.path.indexOf("/") !== 0 && (e.path = "/" + e.path), | |
| e) : null | |
| }, | |
| queryData: { | |
| fields: ["id", "path", "writable", "members.id", "members.parent_id", "members.name", "members.mtime", "members.path", "members.readable", "members.writable", "members.type", "members.image.width", "members.image.height", "members.size"], | |
| members: "all" | |
| } | |
| }) | |
| }), | |
| define("plugins/jquery/jquery.getscrollbarwidth", ["jquery"], function(e) { | |
| var t; | |
| e.getScrollbarWidth = function() { | |
| if (typeof t == "undefined") { | |
| var n = e("<div />").css({ | |
| width: 100, | |
| height: 100, | |
| overflow: "auto", | |
| position: "absolute", | |
| top: -1e3, | |
| left: -1e3 | |
| }).prependTo("body").append("<div />").find("div").css({ | |
| width: "100%", | |
| height: 200 | |
| }); | |
| t = 100 - n.width(), | |
| n.parent().remove() | |
| } | |
| return e(document).height() > e(window).height() ? t : 0 | |
| } | |
| }), | |
| define("text!views/appView.html", [], function() { | |
| return '<div id="header">\n <a href="<%= lang.get(\'header.teaser.url\') %>" class="header-teaser noimport" target="_blank">\n <div class="header-teaser-img bg-sprite"></div>\n <div class="header-teaser-text">\n <span class="header-teaser-text1"><%= lang.get("header.teaser.text1", logo) %></span>\n <span class="header-teaser-text2"><%= lang.get("header.teaser.text2") %></span>\n </div>\n </a>\n\n <div class="header-teaser import">\n <div class="header-teaser-img bg-sprite"></div>\n <div class="header-teaser-text">\n <span class="header-teaser-text1"><%= lang.get("header.teaser.import.text") %></span>\n <span class="import-target"></span>\n </div>\n </div>\n\n <div class="flex-wrapper">\n <div class="menubar-wrapper">\n <div class="container">\n <div class="logo">\n <span class="icon-logo bg-sprite"></span>\n <%= logo %>\n </div>\n\n <div class="menubar-target"></div>\n <div class="menubar-select-target"></div>\n </div>\n </div>\n\n <div class="breadcrumb-wrapper">\n <div class="container">\n <div class="breadcrumb-target"></div>\n <div class="toolbar-target"></div>\n </div>\n </div>\n </div>\n</div>\n\n<div id="content" class="container"></div>\n<div id="footer">\n <div class="footer-content container">\n <div class="footer-copyright">\n <span><%= lang.get("copyright") %></span>\n </div>\n <div class="footer-links">\n <div class="language-toggle-target"></div>\n <a href="<%= lang.get(\'imprint.url\') %>" class="imprint" target="_blank">\n <%= lang.get("imprint.title") %>\n </a>\n <a href="<%= lang.get(\'privacy.url\') %>" class="privacy_policy" target="_blank">\n <%= lang.get("privacy.title") %>\n </a>\n <a href="<%= lang.get(\'help.and.faq.url\') %>" class="help_contact" target="_blank">\n <%= lang.get("help.and.faq.title") %>\n </a>\n </div>\n </div>\n</div>\n' | |
| }), | |
| define("tracker/tealiumAdapter", ["jquery", "underscore", "modules/configInst"], function(e, t, n) { | |
| var r = null | |
| , i = "magentacloud.de" | |
| , s = "alle"; | |
| return { | |
| trackView: function(o) { | |
| var u, a; | |
| if (!o) | |
| return; | |
| u = o.replace(/^#/, "").replace(/^\$\/.*/, "files").replace(/^\$.[^/]*$/, "").replace(/^\$[^/]+\/.*/, "external-files").replace(/\//g, ".").toLowerCase(); | |
| if (u === "") | |
| return; | |
| a = [i, s, u].join("."), | |
| r || (window.utag_data = { | |
| page_content_id: a | |
| }, | |
| r = e.getScript(n.get("tealium_uri"))), | |
| r.then(function() { | |
| window.utag && t.isFunction(window.utag.view) && window.utag.view({ | |
| page_content_id: a | |
| }) | |
| }) | |
| }, | |
| reset: function() { | |
| r = null | |
| } | |
| } | |
| }), | |
| define("views/appView", ["jquery", "underscore", "backbone", "lang", "lang/views/langToggleView", "api", "api/helpers/base64", "auth", "dialogs", "./login", "./loadingView", "modules/httpErrorView", "./encryptedView", "./teaser", "./filemanagerFooter", "./shareLinkView", "./poweredByView", "filemanager", "filemanager/js/views/folderBreadcrumb", "filemanager/js/views/uploadDetailView", "filemanager/js/collections/uploadItems", "filemanager/js/views/uploadButtonView", "gui", "filemanager/js/models/shareFolder", "plugins/jquery/jquery.getscrollbarwidth", "text!./appView.html", "text!./logo.html", "text!./fileitem.html", "text!./fileitemHeader.html", "localstorage", "tracker/tealiumAdapter", "actionManager"], function(e, t, n, r, i, s, o, u, a, f, l, c, h, p, d, v, m, g, y, b, w, E, S, x, T, N, C, k, L, A, O, M) { | |
| return n.View.extend({ | |
| template: t.template(N), | |
| logoTemplate: t.template(C), | |
| openOverlays: 0, | |
| uploadDetailsOpen: !1, | |
| initialize: function() { | |
| var e, n, o, a, b, T, N, C, O; | |
| this.state = { | |
| page: undefined, | |
| shareInfo: {}, | |
| views: [] | |
| }, | |
| this.views = {}, | |
| e = A.get("fm_sort_key"), | |
| n = A.get("fm_sort_dir"), | |
| this.uploadItems = new w([],{ | |
| onBeforeStart: function(e, t) { | |
| e.set("on_exist", "autoname"), | |
| t() | |
| }, | |
| onError: function() { | |
| return !0 | |
| } | |
| }), | |
| this.listenTo(this.uploadItems, "change:status", this.onChangeUploadItems), | |
| this.listenTo(this.uploadItems, "add", this.onUploadAdded), | |
| this._filemanagerModel = new x({ | |
| sortCol: e, | |
| sortDir: n | |
| }), | |
| this.listenTo(this._filemanagerModel, "load:error", this.onLoadError), | |
| this.listenTo(this._filemanagerModel.files, "sortBy", this.onSortBy), | |
| this.listenTo(this._filemanagerModel.files, "load:start", this.onLoadStart), | |
| this.listenTo(s, "download:error", this.onDownloadError), | |
| this.listenTo(M, "execute", this.onActionExecute), | |
| this.listenTo(S.OverlayManager.instance(), "pushed:first", this.onOverlayRendered), | |
| this.listenTo(S.OverlayManager.instance(), "popped:last", this.onOverlayRemoved), | |
| o = new S.IconButton({ | |
| text: r.bind("menubar.select"), | |
| className: "select", | |
| iconClass: "icon-select" | |
| }), | |
| this.listenTo(o, "click", this.onEnterSelectMode), | |
| a = new S.IconButton({ | |
| text: r.bind("menubar.delete"), | |
| className: "delete", | |
| iconClass: "icon-delete", | |
| action: "deleteFiles:menuItem", | |
| actionData: t.bind(function() { | |
| return this._filemanagerModel.files.getSelected() | |
| }, this) | |
| }), | |
| b = new E({ | |
| text: r.bind("menubar.upload"), | |
| iconClass: "icon-upload" | |
| }), | |
| this.listenTo(b, "add", this.onSelectFiles), | |
| T = new S.IconButton({ | |
| text: r.bind("menubar.newfolder"), | |
| iconClass: "icon-new-folder", | |
| action: "newFolder:menuItem", | |
| actionData: t.bind(function() { | |
| return { | |
| folder: this._filemanagerModel, | |
| targetView: this.views.filemanager | |
| } | |
| }, this), | |
| tracking: { | |
| op: "new-folder", | |
| target: "toolbar" | |
| } | |
| }), | |
| N = new S.IconButton({ | |
| text: r.bind("menubar.unselect"), | |
| className: "cancel" | |
| }), | |
| this.listenTo(N, "click", this.onDeselectAll), | |
| C = new S.IconButton({ | |
| text: r.bind("menubar.unselect"), | |
| className: "cancel" | |
| }), | |
| this.listenTo(C, "click", this.onDeselectAll), | |
| O = new S.IconButton({ | |
| text: r.bind("menubar.select.download"), | |
| iconClass: "icon-download-selection" | |
| }), | |
| this.listenTo(O, "click", this.onDownload), | |
| this.externalShareImportButton = new S.Button({ | |
| className: "import-btn", | |
| text: r.bind("header.teaser.import.button"), | |
| action: "sendDataViaUrl:app", | |
| actionData: t.bind(function() { | |
| return { | |
| target: "_blank", | |
| prefix: "/#external-shares/import=", | |
| data: this.state.shareInfo | |
| } | |
| }, this) | |
| }), | |
| M.setState("sendDataViaUrl:app", !1), | |
| this.viewsConfig = { | |
| login: { | |
| klass: f, | |
| config: { | |
| loginCallback: t.bind(function(e) { | |
| u.get().login(e).then(t.bind(function(e) { | |
| this.trigger("loginSuccess", e) | |
| }, this), t.bind(function(e) { | |
| this.trigger("loginError", e) | |
| }, this)) | |
| }, this) | |
| } | |
| }, | |
| loading: { | |
| klass: l | |
| }, | |
| error: { | |
| klass: c | |
| }, | |
| encrypted: { | |
| klass: h | |
| }, | |
| filemanager: { | |
| klass: g, | |
| config: { | |
| model: this._filemanagerModel, | |
| uploadItems: this.uploadItems, | |
| editEnabled: !1, | |
| headerTpl: L, | |
| itemTpl: k, | |
| downloadArchivePrefix: r.get("filemanager.download.archiveprefix"), | |
| dragdropEnabled: !1, | |
| uploadEnabled: !0, | |
| viewMode: "list" | |
| }, | |
| listeners: { | |
| navigate: function(e) { | |
| this.trigger("navigate", "$" + e) | |
| }, | |
| selectmode: this.updateMenubars, | |
| open: this.onOpen | |
| } | |
| }, | |
| filemanagerFooter: { | |
| klass: d, | |
| config: { | |
| model: this._filemanagerModel | |
| } | |
| }, | |
| shareLink: { | |
| klass: v, | |
| listeners: { | |
| error: function(e) { | |
| this.trigger("error", e) | |
| }, | |
| sharelinkData: function(e) { | |
| this.setData(e) | |
| } | |
| } | |
| }, | |
| teaser: { | |
| klass: p | |
| }, | |
| poweredBy: { | |
| klass: m | |
| }, | |
| breadcrumb: { | |
| klass: y, | |
| target: ".breadcrumb-target", | |
| config: { | |
| model: this._filemanagerModel, | |
| prefix: "#$" | |
| }, | |
| listeners: { | |
| click: this.onBreadcrumbClick | |
| } | |
| } | |
| }, | |
| this.langToggle = new i, | |
| this.listenTo(this.langToggle, "selected", this.onLanguageChange), | |
| this.menubar = new S.Menubar({ | |
| items: { | |
| upload: b, | |
| newFolder: T, | |
| "actual/select": o, | |
| unselect: N | |
| } | |
| }), | |
| this.menubarSelect = new S.Menubar({ | |
| className: "menubar select container", | |
| items: { | |
| unselect: C, | |
| "select/delete": a, | |
| "select/download": O | |
| } | |
| }), | |
| this.listenTo(this._filemanagerModel.files, "load add add:end change:selected selectAll deselectAll remove remove:end", this.updateMenubars), | |
| this.listenTo(this._filemanagerModel, "change", this.updateMenubars) | |
| }, | |
| onEnterSelectMode: function() { | |
| this.views.filemanager.setSelectMode(!0) | |
| }, | |
| onDeselectAll: function() { | |
| this._filemanagerModel.files.deselectAll() | |
| }, | |
| onUploadAdded: function() { | |
| if (!this.uploadDetailsOpen) { | |
| var e = new b({ | |
| collection: this.uploadItems, | |
| model: this._filemanagerModel, | |
| autoClose: !0 | |
| }); | |
| e.once("removed", function() { | |
| this.uploadDetailsOpen = !1 | |
| }, this), | |
| e.open(), | |
| this.uploadDetailsOpen = !0 | |
| } | |
| }, | |
| _onMessage: function(e) { | |
| M.execute("showToast", e) | |
| }, | |
| onLoadError: function(e, t) { | |
| if (!this._filemanagerModel.get("path")) { | |
| if (t.path === this.views.filemanager.rootPath) { | |
| this.trigger("error"); | |
| return | |
| } | |
| this._filemanagerModel.load(this.views.filemanager.rootPath) | |
| } else | |
| this.views.filemanager.render(), | |
| this.updateMenubars(); | |
| this._onMessage({ | |
| msg: r.bind("folder.loaderror.common", s.Encoding.urlDecode(t.path)) | |
| }) | |
| }, | |
| onDownloadError: function(e, t) { | |
| var n = e[0] | |
| , i = n.urlDecode("path"); | |
| this._onMessage({ | |
| msg: t.status === 404 ? n.files ? r.bind("filemanager.download_dir.error.404", i) : r.bind("filemanager.download.error.404", i) : r.bind("filemanager.download.error.common", i) | |
| }) | |
| }, | |
| onSelectFiles: function(e) { | |
| this.uploadItems.addFiles(this._filemanagerModel, e) | |
| }, | |
| onChangeUploadItems: function(e) { | |
| e.get("status") === this.uploadItems.model.STATUS.COMPLETE && e.data && this._filemanagerModel.get("id") === e.getFolder().get("id") && this._filemanagerModel.files.add(e.data, { | |
| parse: !0 | |
| }) | |
| }, | |
| createViews: function() { | |
| t.each(this.viewsConfig, function(e, n) { | |
| this.views[n] = new e.klass(e.config), | |
| e.listeners && t.each(e.listeners, function(e, t) { | |
| this.listenTo(this.views[n], t, e) | |
| }, this) | |
| }, this) | |
| }, | |
| onLoadStart: function() { | |
| this.menubar.setActive(!1) | |
| }, | |
| updateMenubars: function() { | |
| var e = this.views.filemanager | |
| , n = e.getSelectMode() | |
| , r = this._filemanagerModel.files.getSelected() | |
| , i = this._filemanagerModel.get("writable") | |
| , s = t.some(this._filemanagerModel.files.getSelected(), function(e) { | |
| return e.get("isTempUploadFile") | |
| }); | |
| this.menubar.toggle(/upload/, !n && i), | |
| this.menubar.toggle(/unselect/, n), | |
| this.menubar.toggle(/actual\//, !n && !!this._filemanagerModel.files.length), | |
| this.menubarSelect.toggle(/select\/download/, r.length && !s), | |
| M.setState("deleteFiles:menuItem", !!r.length && i), | |
| M.setState("newFolder:menuItem", !n && i), | |
| this.menubar.setActive(!0), | |
| this.menubarSelect.setActive(n) | |
| }, | |
| onSortBy: function(e, t) { | |
| A.put("fm_sort_key", e), | |
| A.put("fm_sort_dir", t) | |
| }, | |
| render: function() { | |
| return this.$el.contents().detach(), | |
| this.$el.html(this.template({ | |
| lang: r, | |
| logo: this.logoTemplate({ | |
| lang: r | |
| }).trim() | |
| })), | |
| t.isEmpty(this.views) && this.createViews(), | |
| t.each(this.views, function(e, t) { | |
| this.viewsConfig[t].target ? this.$(this.viewsConfig[t].target).replaceWith(e.render().$el.hide()) : this.$("#content").append(e.render().$el.hide()) | |
| }, this), | |
| this.$(".import-target").replaceWith(this.externalShareImportButton.render().$el), | |
| this.$(".language-toggle-target").replaceWith(this.langToggle.render().$el), | |
| this.$(".menubar-target").replaceWith(this.menubar.render().$el), | |
| this.$(".menubar-select-target").replaceWith(this.menubarSelect.render().$el), | |
| this.$(".footer-content").append((new m).render().$el), | |
| O.trackView("guestview"), | |
| this | |
| }, | |
| show: function(e, t) { | |
| t = t || {}, | |
| e !== this.state.page && (this._hideCurrentPage(e), | |
| this.menubar.setActive(!1), | |
| this.menubarSelect.setActive(!1), | |
| this.setImportState(!1)); | |
| switch (e) { | |
| case "error": | |
| this._showViews(["error", "teaser", "poweredBy"], t); | |
| break; | |
| case "encrypted": | |
| this._showViews(["encrypted", "teaser", "poweredBy"]); | |
| break; | |
| case "login": | |
| this._showViews(["login", "teaser", "poweredBy"], t); | |
| break; | |
| case "filemanager": | |
| this._showViews(["breadcrumb", "teaser", "filemanager", "filemanagerFooter", "poweredBy"]), | |
| t.path && this._filemanagerModel.load(t.path), | |
| this.setData(); | |
| break; | |
| case "loading": | |
| this._showViews(["loading", "teaser", "poweredBy"], t); | |
| break; | |
| case "shareLink": | |
| this._showViews(["shareLink", "teaser", "poweredBy"], t) | |
| } | |
| }, | |
| _hideCurrentPage: function(e) { | |
| while (!t.isEmpty(this.state.views)) { | |
| var n = this.getView(this.state.views.pop()); | |
| n.clear && n.clear(), | |
| n.$el.hide() | |
| } | |
| this.state.page = e | |
| }, | |
| _showView: function(e, t) { | |
| return this.getView(e).render(t).$el.show(), | |
| this | |
| }, | |
| _showViews: function(e, n) { | |
| var r = this; | |
| t.each(e, function(e) { | |
| r._showView(e, n).state.views.push(e) | |
| }) | |
| }, | |
| getView: function(e) { | |
| if (!this.views[e]) | |
| throw new Error("unknown alias in appView: " + e); | |
| return this.views[e] | |
| }, | |
| clear: function() { | |
| t.each(this.views, function(e, t) { | |
| this.stopListening(e), | |
| e.remove(), | |
| delete this.views[t] | |
| }, this), | |
| this.openOverlays = 0 | |
| }, | |
| setData: function(e) { | |
| t.isObject(e) && (this.state.shareInfo = e), | |
| this.getView("breadcrumb").setRoot(this.state.shareInfo.name), | |
| t.delay(t.bind(this.setImportState, this, !0), 1e3) | |
| }, | |
| setImportState: function(e) { | |
| M.setState("sendDataViaUrl:app", e), | |
| this.$("#header").toggleClass("import-enabled", e) | |
| }, | |
| onOverlayRendered: function() { | |
| this.openOverlays++; | |
| if (this.openOverlays !== 1) | |
| return; | |
| this.views.filemanager && this.getView("filemanager").$(".header").css({ | |
| marginRight: e.getScrollbarWidth() | |
| }), | |
| this.$("#content").css({ | |
| top: -e(document).scrollTop(), | |
| marginRight: e.getScrollbarWidth() | |
| }).addClass("overlayed") | |
| }, | |
| onOverlayRemoved: function() { | |
| this.openOverlays--; | |
| if (this.openOverlays !== 0) | |
| return; | |
| var t = -parseInt(this.$("#content").css("top"), 10); | |
| this.$("#content").removeClass("overlayed").css({ | |
| top: "", | |
| marginRight: "" | |
| }), | |
| this.views.filemanager && this.getView("filemanager").$(".header").css({ | |
| marginRight: "" | |
| }), | |
| e(document).scrollTop(t) | |
| }, | |
| onOpen: function(e) { | |
| M.execute("showFile", e) | |
| }, | |
| onDownload: function() { | |
| this._filemanagerModel.trigger("download") | |
| }, | |
| onBreadcrumbClick: function(e) { | |
| this._filemanagerModel.load(e) | |
| }, | |
| onLanguageChange: function(e) { | |
| this.trigger("navigate", "lang/" + e, { | |
| trigger: !0 | |
| }) | |
| }, | |
| onActionExecute: function(e) { | |
| e === "showFile" && O.trackView("guestview.view") | |
| } | |
| }) | |
| }), | |
| define("modules/helpers/streakDetector", ["base"], function(e) { | |
| return e.Object.extend({ | |
| initialize: function(e, t) { | |
| if (typeof e != "number" || e < 2) | |
| throw new Error("length must be number greater 1"); | |
| if (typeof t != "number" || t < 1) | |
| throw new Error("interval must be number greater 0"); | |
| this._length = e, | |
| this._interval = t, | |
| this.reset() | |
| }, | |
| update: function() { | |
| this._streak.push((new Date).getTime()), | |
| this._streak.length > this._length && this._streak.shift() | |
| }, | |
| hasStreak: function() { | |
| var e; | |
| if (this._streak.length === this._length) { | |
| e = this._streak[this._length - 1] - this._streak[0]; | |
| if (e <= this._interval) | |
| return !0 | |
| } | |
| return !1 | |
| }, | |
| reset: function() { | |
| this._streak = [] | |
| } | |
| }) | |
| }), | |
| define("auth/baseAuth", ["jquery", "underscore", "base", "modules/helpers/streakDetector"], function(e, t, n, r) { | |
| return n.Object.extend({ | |
| REAUTH_STREAK_LENGTH: 5, | |
| REAUTH_STREAK_INTERVAL: 1e4, | |
| initialize: function() { | |
| this._reauthStreakDetector = new r(this.REAUTH_STREAK_LENGTH,this.REAUTH_STREAK_INTERVAL), | |
| this._access_token = null, | |
| this._reauth_fn = null | |
| }, | |
| init: function(e) { | |
| e.reauth_fn && (this._reauth_fn = e.reauth_fn), | |
| e.access_token && (this._access_token = e.access_token) | |
| }, | |
| getAccessToken: function() { | |
| return this._access_token | |
| }, | |
| isAuthorized: function() { | |
| return !!this._access_token | |
| }, | |
| _invalidateAuthorization: function() { | |
| this._access_token = null | |
| }, | |
| addAuthToUrl: function(e) { | |
| return this.getAccessToken() ? (e = e.replace(/[\?&]access_token=[^&]+/, ""), | |
| e.indexOf("?") !== -1 ? /&$/.test(e) || (e += "&") : e += "?", | |
| e += "access_token=" + this.getAccessToken(), | |
| e) : "" | |
| }, | |
| addAuthToXhr: function(e, n) { | |
| if (!this.getAccessToken()) | |
| return; | |
| e.beforeSend = t.bind(function(e) { | |
| e.setRequestHeader("Authorization", "Bearer " + this._access_token), | |
| n && n(e) | |
| }, this) | |
| }, | |
| ajax: function(n) { | |
| if (!this.isAuthorized()) | |
| throw new Error("not logged in"); | |
| var r = { | |
| timeout: 9e4, | |
| retry: !0 | |
| }, i, s, o, u; | |
| return n = n || {}, | |
| i = e.extend(!0, {}, r, t.omit(n, "error")), | |
| this.addAuthToXhr(i, n.beforeSend), | |
| s = e.ajax(i), | |
| o = t.bind(function() { | |
| return this._reauthStreakDetector.reset(), | |
| s | |
| }, this), | |
| u = t.bind(function(r, o) { | |
| var u = n.error || e.noop | |
| , a = n.context || this; | |
| return o === "timeout" ? (u.apply(a, arguments), | |
| s) : this._shouldReauth(r, i) ? (this._invalidateAuthorization(), | |
| this._reauth_fn().then(t.bind(this.ajax, this, n), function() { | |
| return s | |
| })) : (u.apply(a, arguments), | |
| s) | |
| }, this), | |
| t.extend({}, s, s.then(o, u)) | |
| }, | |
| _shouldReauth: function(e, t) { | |
| return e.status !== 401 ? !1 : t.retry ? this._reauth_fn ? (this._reauthStreakDetector.update(), | |
| this._reauthStreakDetector.hasStreak() ? !1 : !0) : !1 : !1 | |
| } | |
| }) | |
| }), | |
| define("auth/shareAuth", ["underscore", "jquery", "auth/baseAuth"], function(e, t, n) { | |
| return n.extend({ | |
| initialize: function() { | |
| this._sid = null, | |
| this._password_login = !1, | |
| n.prototype.initialize.apply(this, arguments) | |
| }, | |
| init: function(e) { | |
| e.sid && (this._sid = e.sid), | |
| n.prototype.init.apply(this, arguments) | |
| }, | |
| _invalidateAuthorization: function() { | |
| this._password_login = !1, | |
| n.prototype._invalidateAuthorization.apply(this) | |
| }, | |
| hasPassword: function() { | |
| return this._password_login | |
| }, | |
| getShareInfo: function() { | |
| return t.get("/api/share/info", { | |
| id: this._sid | |
| }) | |
| }, | |
| getUser: function() { | |
| return { | |
| home: "/" | |
| } | |
| }, | |
| login: function(n) { | |
| var r = { | |
| id: this._sid | |
| } | |
| , i = { | |
| password: null | |
| }; | |
| return n = e.extend(i, n), | |
| n.password && (e.extend(r, { | |
| password: n.password | |
| }), | |
| this._password_login = !0), | |
| t.ajax({ | |
| url: "/api/share/token", | |
| method: "POST", | |
| data: r | |
| }).then(e.bind(function(e) { | |
| return this._access_token = e.access_token, | |
| r.password && (e.password = r.password), | |
| this.trigger("login:success", e), | |
| e | |
| }, this), e.bind(function(e) { | |
| return this._password_login = !1, | |
| this.trigger("login:error", e.status), | |
| e | |
| }, this)).always(e.bind(function() { | |
| this.trigger("auth") | |
| }, this)) | |
| }, | |
| logout: function() { | |
| return this.ajax({ | |
| url: "/api/share/token", | |
| method: "DELETE" | |
| }).done(e.bind(function() { | |
| this._invalidateAuthorization(), | |
| this.trigger("logout:success"), | |
| this.trigger("auth") | |
| }, this)) | |
| } | |
| }) | |
| }), | |
| define("router", ["underscore", "jquery", "backbone", "lang", "modules/window", "./views/appView", "api", "modules/constants", "auth", "auth/shareAuth"], function(e, t, n, r, i, s, o, u, a, f) { | |
| var l = o.Router.extend({ | |
| sid: null, | |
| routesHit: 0, | |
| views: {}, | |
| _startFragment: "", | |
| routes: { | |
| "$*path": "path", | |
| "!:error": "error", | |
| "lang/:lang": "language", | |
| "login(/:state)": "login", | |
| logout: "logout", | |
| encrypted: "encrypted", | |
| file: "shareLink" | |
| }, | |
| initialize: function() { | |
| a.register(u.authContext.default, function() { | |
| return new f | |
| }), | |
| o.Router.prototype.initialize.apply(this, arguments), | |
| n.history.on("route", function() { | |
| this.routesHit++ | |
| }, this), | |
| this.buildViews() | |
| }, | |
| start: function() { | |
| var e = i.getLocation() | |
| , t = e.pathname.match(/(share|lnk)\/([^\/]+)\/?$/); | |
| this._startFragment = i.getAnchor(), | |
| this.navigate(), | |
| t ? (this.sid = t[2], | |
| t[1] === "lnk" ? this.navigate("file", { | |
| replace: !0, | |
| trigger: !0 | |
| }) : this.authenticate()) : this.navigate("!404", !0) | |
| }, | |
| authenticate: function() { | |
| var t = this | |
| , n = function(e) { | |
| e.status === 401 ? t.navigate("login/expired", { | |
| trigger: !0, | |
| replace: !0 | |
| }) : e.status === 404 ? t.navigate("!404", !0) : t.navigate("!500", !0) | |
| }; | |
| this.auth.init({ | |
| sid: this.sid, | |
| reauth_fn: function() { | |
| return t.auth.login().fail(n) | |
| } | |
| }), | |
| this.auth.getShareInfo().done(function(n) { | |
| n.is_encrypted ? t.navigate("encrypted", !0) : n.has_password ? t.navigate("login", !0) : t.auth.login().then(e.bind(t.onLoginSuccess, t), e.bind(t.onLoginError, t)) | |
| }).fail(function(e) { | |
| var n = e.status; | |
| n === 400 && (n = 404), | |
| t.navigate("!" + n, !0) | |
| }) | |
| }, | |
| restart: function(e) { | |
| this.buildViews(), | |
| e && this.back(e) | |
| }, | |
| buildViews: function() { | |
| this.appView ? (this.appView.clear(), | |
| this.appView.render()) : (this.appView = new s, | |
| this.listenTo(this.appView, "navigate", this.navigate), | |
| this.listenTo(this.appView, "error", this.error), | |
| this.listenTo(this.appView, "loginError", this.onLoginError), | |
| this.listenTo(this.appView, "loginSuccess", this.onLoginSuccess), | |
| t("body").html(this.appView.render().$el)), | |
| this.appView.show("loading") | |
| }, | |
| language: function(e) { | |
| var n = this; | |
| t("body").fadeOut("fast", function() { | |
| try { | |
| n.setLanguage(e), | |
| n.restart(1), | |
| t("body").show() | |
| } catch (r) { | |
| t("body").show() | |
| } | |
| }) | |
| }, | |
| login: function(e) { | |
| this.appView.show("login", { | |
| error: e | |
| }) | |
| }, | |
| logout: function() { | |
| this.navigate("login") | |
| }, | |
| path: function(e) { | |
| this.auth.isAuthorized() ? this.appView.show("filemanager", { | |
| path: e | |
| }) : this.navigate("login", !0) | |
| }, | |
| error: function(e) { | |
| this.appView.show("error", { | |
| code: e | |
| }) | |
| }, | |
| encrypted: function() { | |
| this.appView.show("encrypted") | |
| }, | |
| shareLink: function() { | |
| this.appView.show("shareLink", { | |
| sid: this.sid | |
| }) | |
| }, | |
| back: function(e) { | |
| this.routesHit > e ? window.history.go(0 - e) : this.navigate("$/", { | |
| trigger: !0, | |
| replace: !0 | |
| }) | |
| }, | |
| onLoginError: function(e) { | |
| if (i.getAnchor() === "login") { | |
| var t = 500; | |
| if (e.status === 403 || e.status === 401) | |
| t = "password"; | |
| this.appView.show("login", { | |
| error: t | |
| }) | |
| } else | |
| e.status === 401 ? this.navigate("login", { | |
| trigger: !0, | |
| replace: !1 | |
| }) : this.navigate("!" + e.status, { | |
| trigger: !0, | |
| replace: !1 | |
| }) | |
| }, | |
| onLoginSuccess: function(e) { | |
| var t = { | |
| id: this.sid, | |
| name: e.root_name, | |
| type: "sharedir" | |
| }; | |
| e.password && (t.pw = e.password), | |
| this.appView.setData(t); | |
| var n = /^[^$\/].*/ | |
| , r = this._startFragment.replace(n, "$/") || "$/"; | |
| this.navigate(r, { | |
| trigger: !0, | |
| replace: !1 | |
| }) | |
| } | |
| }); | |
| return l | |
| }), | |
| define("actions/deleteFiles", ["underscore", "formatters", "lang", "dialogs", "tracker", "actionManager", "api"], function(e, t, n, r, i, s, o) { | |
| var u = function(e, r) { | |
| var i; | |
| e.length && (r && r.length ? i = n.bind("filemanager.delete.error.some", [r.length, e.length]) : i = e.length === 1 ? n.bind("filemanager.delete.error.one", t.breakable(e[0].get("display_name"))) : n.bind("filemanager.delete.error.all", e.length), | |
| s.execute("showToast", { | |
| msg: i | |
| })) | |
| }; | |
| return function(a) { | |
| var f; | |
| a.length === 1 ? f = n.get("filemanager.delete.prompt.single", t.escapedBreakable(a[0].get("display_name"))) : f = n.get("filemanager.delete.prompt.multi", a.length), | |
| r.confirm({ | |
| message: f, | |
| okButtonText: n.get("filemanager.delete.prompt.ok"), | |
| cancelButtonText: n.get("filemanager.delete.prompt.cancel") | |
| }).then(e.bind(function(e) { | |
| e ? o.deleteFiles(a).always(u) : i.track({ | |
| op: "delete-abort", | |
| target: "confirm-dialog", | |
| data: a.length | |
| }) | |
| }, this)) | |
| } | |
| }), | |
| define("actions/newFolder", ["underscore", "lang", "tracker", "actionManager", "api"], function(e, t, n, r, i) { | |
| return function(s) { | |
| var o = s.folder; | |
| i.newFolder(o, t.get("filemanager.newfolder.defaultname"), !0).done(function(e) { | |
| var t = s.targetView; | |
| n.track({ | |
| op: "new-folder", | |
| data: "created" | |
| }), | |
| e = o.files.get(e); | |
| if (!e) | |
| return; | |
| r.execute("rename", { | |
| model: e, | |
| view: t | |
| }) | |
| }).fail(e.bind(function(e, i) { | |
| n.track({ | |
| op: "new-folder", | |
| data: "error.code." + i.status | |
| }), | |
| r.execute("showToast", { | |
| msg: t.bind("filemanager.newfolder.error.common") | |
| }) | |
| }, this)) | |
| } | |
| }), | |
| define("actions/rename", ["underscore", "backbone"], function(e, t) { | |
| return function(n) { | |
| var r, i; | |
| if (!n || !e.isObject(n)) | |
| throw new Error("The action needs a valid params-object."); | |
| r = n.model, | |
| i = n.view; | |
| if (!i) | |
| throw new Error("A valid view needs to be provided."); | |
| if (!(r instanceof t.Model)) | |
| throw new Error("A valid model needs to be provided."); | |
| if (!e.isFunction(i.rename)) | |
| throw new Error('The provided view needs to have a "rename" method.'); | |
| e.isFunction(i.scrollIntoView) && i.scrollIntoView(r.id), | |
| i.rename(r) | |
| } | |
| }), | |
| define("actions/sendDataViaUrl", ["underscore", "api/helpers/base64", "modules/window"], function(e, t, n) { | |
| return function(r) { | |
| var i = "" | |
| , s = { | |
| target: "_top", | |
| prefix: "" | |
| }; | |
| if (!e.isObject(r)) | |
| throw new Error("config object required in sendDataViaUrl"); | |
| if (!e.has(r, "data")) | |
| throw new Error("data property required in config object for sendDataViaUrl"); | |
| s = e.extend(s, r), | |
| i += s.prefix, | |
| i += t.encode(JSON.stringify(s.data)), | |
| n.open(i, s.target) | |
| } | |
| }), | |
| define("text!templates/filesviewer/fileView.html", [], function() { | |
| return '<div class="filesviewer-group-icon icon-mimetype-group-<%= file.get("group") %>"></div>\n<div class="filesviewer-filename"><%- file.get("base_name") %></div>\n<div class="filesviewer-properties">\n <%=\n lang.get("fileview.default.changed", [\n formatters.size(file.get("size")),\n formatters.date(file.get("mtime"), lang.get("fileview.default.timeFormat"))\n ])\n %>\n</div>\n' | |
| }), | |
| define("filesviewer/js/views/fileView", ["jquery", "underscore", "backbone", "gui/button/iconButton", "lang", "formatters", "text!templates/filesviewer/fileView.html", "api", "auth"], function(e, t, n, r, i, s, o, u, a) { | |
| return n.View.extend({ | |
| _template: undefined, | |
| _defTemplate: t.template(o), | |
| autoPlay: !1, | |
| initialize: function(e) { | |
| this.downloadButton = new r({ | |
| alternative: !0, | |
| text: i.get("fileview.default.button.download"), | |
| iconClass: "icon-filesviewer-download" | |
| }), | |
| this.listenTo(this.downloadButton, "click", this._onDownload), | |
| e && (e.tpl && (this._template = this._defTemplate = t.template(e.tpl)), | |
| e.defTpl && (this._defTemplate = t.template(e.defTpl)), | |
| e.autoPlay && (this.autoPlay = e.autoPlay === !0)), | |
| this._downloading = !1 | |
| }, | |
| getMetaFields: function() {}, | |
| getInfoMetaFields: function() { | |
| return [] | |
| }, | |
| _render: function() { | |
| return this.$el.empty().addClass("fileview").append(this._defTemplate({ | |
| file: this.model, | |
| lang: i, | |
| formatters: s | |
| })), | |
| this | |
| }, | |
| render: function() { | |
| return this._render(), | |
| this.$(".download-button-target").replaceWith(this.downloadButton.render().$el), | |
| this.next(), | |
| this | |
| }, | |
| remove: function() { | |
| this.downloadButton.remove(), | |
| n.View.prototype.remove.call(this) | |
| }, | |
| _onDownload: function() { | |
| this._downloading || (this._downloading = !0, | |
| u.download(this.model).always(t.bind(function() { | |
| this._downloading = !1 | |
| }, this))) | |
| }, | |
| showError: function() { | |
| return this._render().next() | |
| }, | |
| play: function() { | |
| this.next() | |
| }, | |
| pause: function() {}, | |
| seek: function() {}, | |
| next: function(e) { | |
| return this.trigger.apply(this, t.compact(["ended", e])), | |
| this | |
| }, | |
| getStreamUrl: function() { | |
| var e = this.model | |
| , n = { | |
| pid: e.getPid() | |
| }; | |
| return a.get(e.getContext()).ajax({ | |
| url: "/api/file/url", | |
| data: n, | |
| dataFilter: function(n) { | |
| try { | |
| var r = JSON.parse(n); | |
| return r.url ? JSON.stringify(t.extend(r, { | |
| url: r.url + "/" + e.get("name") | |
| })) : n | |
| } catch (i) { | |
| return n | |
| } | |
| } | |
| }) | |
| }, | |
| getFileUrl: function() { | |
| var e = "/api/file?pid=" + this.model.getPid(); | |
| return a.get(this.model.getContext()).addAuthToUrl(e) | |
| } | |
| }) | |
| }), | |
| define("filesviewer/js/helpers/sizeCalculation", ["underscore"], function(e) { | |
| function n(n) { | |
| return e.find(t, function(e, r) { | |
| return r === t.length - 1 || n <= e && n > t[r + 1] || n > e | |
| }) | |
| } | |
| var t = [1280, 640, 210]; | |
| return { | |
| calc: function(e, t, r, i) { | |
| if (!r || !i) | |
| throw new Error("displayWidth and displayHeight need to be filled!"); | |
| var s = {} | |
| , o = e / t | |
| , u = r / i; | |
| return !e || !t ? (s.width = n(r), | |
| s.height = n(i), | |
| s.shouldScale = !0) : o < u ? (s.height = n(Math.min(t, i)), | |
| s.shouldScale = t > i) : (s.width = n(Math.min(e, r)), | |
| s.shouldScale = e > r), | |
| s | |
| } | |
| } | |
| }), | |
| define("filesviewer/js/views/imageView", ["jquery", "backbone", "underscore", "./fileView", "api", "../helpers/sizeCalculation", "modules/helpers/image"], function(e, t, n, r, i, s, o) { | |
| return r.extend({ | |
| className: "imageview", | |
| imageSize: null, | |
| lastThumbSize: null, | |
| renderId: 0, | |
| initialize: function() { | |
| this.resize = n.throttle(n.bind(this._onResize, this), 250), | |
| r.prototype.initialize.apply(this, arguments) | |
| }, | |
| getMetaFields: function() { | |
| return ["image.width", "image.height"] | |
| }, | |
| getInfoMetaFields: function() { | |
| return ["image.exif"] | |
| }, | |
| render: function(e, t, n) { | |
| return e && e.image ? (this.$el.html('<div class="placeholder"></div><span class="filesviewer-loader icon-loading"></span>'), | |
| this.$placeholder = this.$(".placeholder"), | |
| this.imageSize = e.image, | |
| this._renderImage(t, n)) : r.prototype.render.apply(this, arguments), | |
| this | |
| }, | |
| remove: function() { | |
| return this.renderId = -1, | |
| r.prototype.remove.apply(this, arguments) | |
| }, | |
| _onResize: function(e, t) { | |
| this.imageSize && this._renderImage(e, t) | |
| }, | |
| _renderImage: function(t, u) { | |
| var a = s.calc(this.imageSize.width, this.imageSize.height, t, u), f = !this.lastThumbSize, l = this.lastThumbSize || {}, c, h, p, d, v, m; | |
| if (!f && n.isEqual(l, a)) | |
| return; | |
| this._hasKnownImageSize() && this._updateScaling(a, this.imageSize.width, this.imageSize.height), | |
| this.lastThumbSize = a, | |
| c = f || (a.width || 0) > (l.width || 0) || (a.height || 0) > (l.height || 0); | |
| if (!c) | |
| return; | |
| h = i.getThumbnail(this.model, n.pick(a, "width", "height")).then(o.preload), | |
| p = ++this.renderId, | |
| f && !this._hasKnownImageSize() ? v = e.Deferred().reject().promise() : (d = f ? { | |
| width: 210, | |
| height: 210 | |
| } : n.pick(l, "width", "height"), | |
| v = i.getThumbnail(this.model, d)), | |
| m = this.$(".filesviewer-loader"), | |
| f && m.show(), | |
| v.then(n.bind(function(e) { | |
| if (h.state() === "resolved" || p !== this.renderId) | |
| return; | |
| this.$placeholder.css("background-image", "url(" + e + ")"), | |
| f ? this.$placeholder.fadeIn() : this.$placeholder.show() | |
| }, this)), | |
| h.then(n.bind(function(e) { | |
| return !this._hasKnownImageSize() && p === this.renderId && (a = s.calc(e.width, e.height, t, u), | |
| this._updateScaling(a, e.width, e.height), | |
| a.shouldScale || (this.imageSize = n.pick(e, "width", "height"))), | |
| e | |
| }, this)).then(n.bind(function(e) { | |
| p === this.renderId && (this.$el.css("background-image", "url(" + e.src + ")"), | |
| m.hide(), | |
| this.$placeholder.stop(!0).fadeOut(), | |
| this.next(6e3)) | |
| }, this), n.bind(function() { | |
| r.prototype.render.call(this, this.metaData) | |
| }, this)) | |
| }, | |
| _updateScaling: function(e, t, n) { | |
| var r; | |
| e.shouldScale ? (this.$placeholder.css("background-size", "contain"), | |
| this.$el.css("background-size", "contain")) : (r = (e.width ? t + "px" : "auto") + " " + (e.height ? n + "px" : "auto"), | |
| this.$placeholder.css("background-size", r), | |
| this.$el.css("background-size", "")) | |
| }, | |
| _hasKnownImageSize: function() { | |
| return !!this.imageSize.width || !!this.imageSize.height | |
| } | |
| }) | |
| }), | |
| define("filesviewer/js/views/mediaView", ["jquery", "backbone", "underscore", "lang", "formatters", "./fileView"], function(e, t, n, r, i, s) { | |
| return s.extend({ | |
| mediaType: "", | |
| getMetaFields: function() { | |
| return ["mime_type"] | |
| }, | |
| _streamUrl: undefined, | |
| _template: undefined, | |
| render: function(t) { | |
| return this.trigger("canPlay", !1), | |
| this.metaData = t, | |
| this._streamUrl = this.getStreamUrl().done(n.bind(function(s) { | |
| if (!s.url) { | |
| this.showError(); | |
| return | |
| } | |
| var o = e(this._template({ | |
| _: n, | |
| file: this.model, | |
| lang: r, | |
| formatters: i | |
| })); | |
| this.player = o.find(this.mediaType).andSelf().filter(this.mediaType)[0], | |
| t.mime_type && this.player.canPlayType(t.mime_type) !== "" ? (this._createPlayer(s.url, o), | |
| this.trigger("canPlay", !0)) : this._renderDefaultView() | |
| }, this)).fail(n.bind(function() { | |
| this.showError() | |
| }, this)), | |
| this | |
| }, | |
| _createPlayer: function(t, n) { | |
| this._bindPlayerEvents(), | |
| this.player.src = t, | |
| e(this.player).prop("autoplay", this.autoPlay), | |
| this.$el.html(n) | |
| }, | |
| _bindPlayerEvents: function() { | |
| e(this.player).on("error", n.bind(function() { | |
| this.trigger("canPlay", !1), | |
| this._renderDefaultView() | |
| }, this)), | |
| e(this.player).on("loadedmetadata", n.bind(function(e) { | |
| this.trigger("loadedmetadata", e), | |
| this.trigger("setDuration", this.player.duration) | |
| }, this)), | |
| e(this.player).on("play", n.bind(function(e) { | |
| this.trigger("playing", e) | |
| }, this)), | |
| e(this.player).on("pause", n.bind(function(e) { | |
| this.trigger("pause", e) | |
| }, this)), | |
| e(this.player).on("timeupdate", n.bind(function() { | |
| this.trigger("timeupdate", this.player.currentTime) | |
| }, this)), | |
| e(this.player).on("ended", n.bind(function() { | |
| this.next(1e3) | |
| }, this)) | |
| }, | |
| _renderDefaultView: function() { | |
| this.trigger("setDuration", 0), | |
| s.prototype.render.call(this, this.metaData) | |
| }, | |
| remove: function() { | |
| this._streamUrl && this._streamUrl.abort(), | |
| this.player && (this.player.src = "", | |
| this.player.load()), | |
| s.prototype.remove.call(this) | |
| }, | |
| play: function() { | |
| this.player.play() | |
| }, | |
| pause: function() { | |
| this.player.pause() | |
| }, | |
| seek: function(e) { | |
| this.player.currentTime = e | |
| } | |
| }) | |
| }), | |
| define("text!templates/filesviewer/videoPlayer.html", [], function() { | |
| return "<video></video>\n" | |
| }), | |
| define("filesviewer/js/views/videoView", ["backbone", "underscore", "./mediaView", "text!templates/filesviewer/videoPlayer.html"], function(e, t, n, r) { | |
| return n.extend({ | |
| className: "videoview", | |
| mediaType: "video", | |
| _template: t.template(r), | |
| initialize: function() { | |
| n.prototype.initialize.apply(this, arguments), | |
| this.listenTo(this, "loadedmetadata", this._onLoadedMetadata) | |
| }, | |
| _onLoadedMetadata: function(e) { | |
| var t = e.target; | |
| t.width = t.width || Math.max(t.videoWidth || 0, 300), | |
| t.height = t.height || Math.max(t.videoHeight || 0, 150) | |
| } | |
| }) | |
| }), | |
| define("text!templates/filesviewer/audioPlayer.html", [], function() { | |
| return '<audio></audio>\n<div class="audio-visualization"></div>\n<div class="audio-metadata">\n <div class="audio-filename"><%= file.get("base_name") %></div>\n <div class="audio-properties">\n <%=\n lang.get("fileview.default.changed", [\n formatters.size(file.get("size")),\n formatters.date(file.get("mtime"), lang.get("fileview.default.timeFormat"))\n ])\n %>\n\n </div>\n</div>\n' | |
| }), | |
| define("filesviewer/js/views/audioView", ["backbone", "underscore", "./mediaView", "text!templates/filesviewer/audioPlayer.html"], function(e, t, n, r) { | |
| return n.extend({ | |
| className: "audioview", | |
| mediaType: "audio", | |
| _template: t.template(r) | |
| }) | |
| }), | |
| define("filesviewer/js/views/textView", ["jquery", "underscore", "./fileView", "api"], function(e, t, n, r) { | |
| return n.extend({ | |
| className: "textview", | |
| bytesSizeLimit: 102400, | |
| getMetaFields: function() { | |
| return ["size"] | |
| }, | |
| render: function(i) { | |
| return i.size && i.size <= this.bytesSizeLimit ? (r.getFile(this.model.get("path"), this.model.getContext()).done(t.bind(function(t) { | |
| var n = document.createElement("div") | |
| , r = document.createElement("textarea"); | |
| n.className = "text-content", | |
| r.readOnly = !0, | |
| e(r).text(t), | |
| n.appendChild(r), | |
| this.$el.append(n), | |
| this.next() | |
| }, this)).fail(t.bind(function() { | |
| this.showError() | |
| }, this)), | |
| this) : n.prototype.render.call(this) | |
| } | |
| }) | |
| }), | |
| define("modules/browser", ["jquery"], function(e) { | |
| function t() { | |
| var t = navigator.mimeTypes | |
| , n = navigator.plugins; | |
| this.getMimeTypes = function() { | |
| return t | |
| } | |
| , | |
| this.getPlugins = function() { | |
| return n | |
| } | |
| , | |
| this.supportPdf = function() { | |
| var t = e.Deferred() | |
| , n = this.getMimeTypes()["application/pdf"]; | |
| n && t.resolve(), | |
| n = this.getPlugins()["Adobe Acrobat"], | |
| n && t.resolve(); | |
| try { | |
| n = new ActiveXObject("AcroPDF.PDF"), | |
| n || (n = new ActiveXObject("PDF.PdfCtrl")) | |
| } catch (r) {} | |
| return n ? t.resolve() : t.reject(), | |
| t.promise() | |
| } | |
| } | |
| return t | |
| }), | |
| define("browser", ["modules/browser"], function(e) { | |
| return new e | |
| }), | |
| define("text!templates/filesviewer/pdfView.html", [], function() { | |
| return '<object></object>\n<div class="filesviewer-loader icon-loading"></div>\n' | |
| }), | |
| define("filesviewer/js/views/pdfView", ["jquery", "underscore", "browser", "modules/configInst", "./fileView", "../helpers/sizeCalculation", "text!templates/filesviewer/pdfView.html", "lang"], function(e, t, n, r, i, s, o, u) { | |
| function f(e) { | |
| return e && e.state() === "resolved" ? e : null | |
| } | |
| function l(t) { | |
| var n = e.Deferred(); | |
| return t.then(n.resolve, n.reject), | |
| n.promise() | |
| } | |
| var a; | |
| return i.extend({ | |
| className: "pdfview", | |
| _renderId: 0, | |
| _pdf: undefined, | |
| _pdfPro: undefined, | |
| _page: undefined, | |
| _pagePro: undefined, | |
| _htmlPro: undefined, | |
| _drawPro: undefined, | |
| _onFirstResize: undefined, | |
| _onLastResize: undefined, | |
| _currentPage: undefined, | |
| _rejectedPro: e.Deferred().reject().promise(), | |
| _template: t.template(o), | |
| events: { | |
| "click button.pdf-next-page": "onNextPage", | |
| "click button.pdf-prev-page": "onPrevPage", | |
| "change input.current-page": "onPageChange" | |
| }, | |
| initialize: function(e) { | |
| this._currentPage = 1, | |
| this.onFirstResize = t.debounce(this._onResizeStart, 300, !0), | |
| this.onLastResize = t.debounce(this._onResizeEnd, 300), | |
| e && e.tpl && (this._template = t.template(e.tpl)), | |
| i.prototype.initialize.apply(this, arguments) | |
| }, | |
| remove: function() { | |
| return this._pdf && this._pdf.destroy(), | |
| this._page && this._page.destroy(), | |
| delete this._newPage, | |
| delete this._newCanvas, | |
| delete this._newDrawnScale, | |
| this._renderId = -1, | |
| i.prototype.remove.apply(this, arguments) | |
| }, | |
| render: function(r, s, o) { | |
| return this.$el.html(this._template({ | |
| lang: u, | |
| pdfInfo: null | |
| })), | |
| this.$("canvas").length ? (this._renderId++, | |
| s && (this._width = s), | |
| o && (this._height = o), | |
| this._chain()) : this.$("object").length && n.supportPdf().then(t.bind(function() { | |
| return this.getStreamUrl().done(t.bind(function(t) { | |
| var n = e("<div></div>").html(this._template({ | |
| lang: u, | |
| pdfInfo: null | |
| })); | |
| e("object", n).attr("type", "application/pdf"), | |
| e("object", n).attr("data", t.url), | |
| e(".filesviewer-loader", n).hide(), | |
| this.$el.html(n.html()), | |
| this.next(16e3) | |
| }, this)) | |
| }, this)).fail(t.bind(function() { | |
| i.prototype.render.apply(this, arguments) | |
| }, this)), | |
| this | |
| }, | |
| _chain: function() { | |
| this.$("canvas").length && this._loadScripts().then(t.bind(this._loadPdf, this, this._renderId)).then(t.bind(this._loadPage, this, this._renderId)).then(t.bind(this._showHtml, this, this._renderId)).then(t.bind(this._drawPage, this, this._renderId)).then(t.bind(this._postDraw, this, this._renderId, this._canvas)).fail(t.bind(this.showError, this, this._renderId, this._canvas)) | |
| }, | |
| _loadScripts: function() { | |
| var t = r.get("cacheBuster") || ""; | |
| return t !== "" && (t += "/"), | |
| this.$(".filesviewer-loader").show(), | |
| a = f(a) || e.when(e.getScript(t + "external/pdfjs/pdf.js"), e.getScript(t + "external/pdfjs/compatibility.js")).done(function() { | |
| PDFJS.workerSrc = t + "external/pdfjs/pdf.worker.js", | |
| PDFJS.disableFontFace = !0 | |
| }), | |
| a | |
| }, | |
| _loadPdf: function(e) { | |
| return this._renderId !== e ? this._rejectedPro : (PDFJS.disableAutoFetch = !0, | |
| this._pdfPro = f(this._pdfPro) || l(PDFJS.getDocument(this.getFileUrl())), | |
| this._pdfPro) | |
| }, | |
| _loadPage: function(e, t) { | |
| return this._renderId !== e ? (this._pdfPro = this._rejectedPro, | |
| t && t.destroy(), | |
| this._rejectedPro) : (this._pdf = t, | |
| this._pagePro = f(this._pagePro) || l(t.getPage(this._currentPage)), | |
| this._pagePro) | |
| }, | |
| _showHtml: function(n, r) { | |
| return this._renderId !== n ? (this._pagePro = this._rejectedPro, | |
| r && r.destroy(), | |
| this._rejectedPro) : (this._htmlPro = f(this._htmlPro) || e.Deferred(t.bind(function() { | |
| this.$el.html(this._template({ | |
| lang: u, | |
| pdfInfo: { | |
| currentPage: this._currentPage, | |
| totalPages: this._pdf.pdfInfo.numPages | |
| } | |
| })) | |
| }, this)).resolve(r), | |
| this._htmlPro) | |
| }, | |
| _drawPage: function(t, n) { | |
| var r, i, s, o, u; | |
| return this._renderId !== t ? (this._pagePro = this._rejectedPro, | |
| n && n.destroy(), | |
| this._rejectedPro) : (this._newPage = n, | |
| this._page = this._page || this._newPage, | |
| this._newCanvas = e("<canvas>")[0], | |
| this._canvas = this._canvas || this._newCanvas, | |
| r = this.getViewProperties(), | |
| this._newDrawnScale = r.scale, | |
| this._drawnScale = this._drawnScale || this._newDrawnScale, | |
| i = n.getViewport(r.scale), | |
| s = this._newCanvas.getContext("2d"), | |
| u = this.$("canvas")[0], | |
| u.height = this._newCanvas.height = i.height, | |
| u.width = this._newCanvas.width = i.width, | |
| this.$el.css({ | |
| marginTop: (r.height - i.height) / 2, | |
| width: i.width | |
| }), | |
| o = { | |
| canvasContext: s, | |
| viewport: i | |
| }, | |
| this._drawPro = f(this._drawPro) || l(n.render(o)), | |
| this._drawPro) | |
| }, | |
| _postDraw: function(e) { | |
| return this._renderId !== e ? (this._drawPro = this._rejectedPro, | |
| this._rejectedPro) : (this._page = this._newPage, | |
| this._canvas = this._newCanvas, | |
| this._drawnScale = this._newDrawnScale, | |
| delete this._newPage, | |
| delete this._newCanvas, | |
| delete this._newDrawnScale, | |
| this.$("canvas").replaceWith(this._canvas), | |
| this.$(".filesviewer-loader").hide(), | |
| this.next(), | |
| null) | |
| }, | |
| showError: function(t, n) { | |
| if (this._renderId !== t) | |
| return this._rejectedPro; | |
| var r = n || this._canvas; | |
| return delete this._newPage, | |
| delete this._newCanvas, | |
| delete this._newDrawnScale, | |
| e(r).replaceWith("<canvas>"), | |
| this.$(".filesviewer-loader").hide(), | |
| i.prototype.render.apply(this, arguments) | |
| }, | |
| _onResizeStart: function() { | |
| this._renderId++ | |
| }, | |
| _onResizeEnd: function() { | |
| this._drawPro = this._rejectedPro, | |
| this._chain() | |
| }, | |
| getViewProperties: function() { | |
| var e = this._page.getViewport(1), t = this._width, n = this._height - this.$(".document-toolbar").height(), r = s.calc(e.width, e.height, t, n), i; | |
| return r.width ? i = t / e.width : i = n / e.height, | |
| { | |
| width: t, | |
| height: n, | |
| scale: i | |
| } | |
| }, | |
| resize: function(e, t) { | |
| if (this._width === e && this._height === t) | |
| return; | |
| this._width = e, | |
| this._height = t, | |
| this.onFirstResize(), | |
| this.onLastResize(); | |
| if (!this._page || !this._drawnScale) | |
| return; | |
| var n = this.getViewProperties() | |
| , r = n.scale / this._drawnScale; | |
| this.$el.css({ | |
| marginTop: (n.height - this._canvas.height * r) / 2, | |
| width: this._canvas.width * r | |
| }) | |
| }, | |
| _checkedSetCurrentPage: function(e) { | |
| if (!e || e < 1 || e > this._pdf.pdfInfo.numPages || e === this._currentPage) | |
| return; | |
| this._currentPage = e, | |
| this._htmlPro = this._pagePro = this._drawPro = this._rejectedPro, | |
| this.render() | |
| }, | |
| onNextPage: function() { | |
| this._checkedSetCurrentPage(this._currentPage + 1) | |
| }, | |
| onPrevPage: function() { | |
| this._checkedSetCurrentPage(this._currentPage - 1) | |
| }, | |
| onPageChange: function(t) { | |
| this._checkedSetCurrentPage(parseInt(e(t.target).val(), 10)) | |
| } | |
| }) | |
| }), | |
| define("filesviewer/js/helpers/exposureTimeFormatter", [], function() { | |
| return function(e) { | |
| if (isNaN(e)) | |
| throw new Error("Argument needs to be a number!"); | |
| return e >= 1 ? e.toFixed(1) : "1/" + (1 / e).toFixed(0) | |
| } | |
| }), | |
| define("text!templates/filesviewer/detailView.html", [], function() { | |
| return '<h1><%= lang.get("details") %></h1>\n\n<h4><%= lang.get("file.name") %></h4>\n<p class="detail_displayname" title="<%- model.get(\'display_name\') %>"><%- formatters.breakable(model.get("display_name")) %></p>\n\n<% if(detail.mime_type) { %>\n <h4><%= lang.get("file.type") %></h4>\n <p class="detail_mimetype"><%- detail.mime_type %></p>\n<% } %>\n\n<% if(detail.image) { %>\n <h4><%= lang.get("file.details.dimensions") %></h4>\n <p class="detail_dimensions"><%- detail.image.width %> x <%- detail.image.height %></p>\n<% } %>\n\n<% if(detail.size) { %>\n <h4><%= lang.get("file.size") %></h4>\n <p class="detail_size"><%- detail.size %></p>\n<% } %>\n\n<% if(detail.mtime) { %>\n <h4><%= lang.get("file.update") %></h4>\n <p class="detail_mtime"><%- detail.mtime %></p>\n<% } %>\n\n<% if(detail.image && detail.image.exif) { %>\n <% if (detail.image.exif.Model) { %>\n <h4><%= lang.get("file.details.model") %></h4>\n <p class="exif_model"><%- detail.image.exif.Model %></p>\n <% } %>\n\n <% if (detail.image.exif.BitsPerSample) { %>\n <h4><%= lang.get("file.details.bitdepth") %></h4>\n <p class="exif_bitspersample"><%- detail.image.exif.BitsPerSample %></p>\n <% } %>\n\n <% if (detail.image.exif.DateTimeOriginal) { %>\n <h4><%= lang.get("file.details.datetaken") %></h4>\n <p class="exif_datetimeoriginal"><%- detail.image.exif.DateTimeOriginal %></p>\n <% } %>\n\n <% if (detail.image.exif.Make) { %>\n <h4><%= lang.get("file.details.manufacturer") %></h4>\n <p class="exif_make"><%- detail.image.exif.Make %></p>\n <% } %>\n\n <% if (detail.image.exif.Aperture) { %>\n <h4><%= lang.get("file.details.fnumber") %></h4>\n <p class="exif_aperture"><%- detail.image.exif.Aperture %></p>\n <% } %>\n\n <% if (detail.image.exif.ExposureTime) { %>\n <h4><%= lang.get("file.details.exposuretime") %></h4>\n <p class="exif_exposuretime"><%- exposureTimeFormatter(detail.image.exif.ExposureTime) %></p>\n <% } %>\n\n <% if (detail.image.exif.FocalLength) { %>\n <h4><%= lang.get("file.details.focallength") %></h4>\n <p class="exif_focallength"><%- detail.image.exif.FocalLength %></p>\n <% } %>\n\n <% if (detail.image.exif.ISO) { %>\n <h4><%= lang.get("file.details.iso") %></h4>\n <p class="exif_iso"><%- detail.image.exif.ISO %></p>\n <% } %>\n<% } %>\n' | |
| }), | |
| define("filesviewer/js/views/detailView", ["underscore", "underscore.mixin", "backbone", "lang", "formatters", "../helpers/exposureTimeFormatter", "text!templates/filesviewer/detailView.html"], function(e, t, n, r, i, s, o) { | |
| return n.View.extend({ | |
| className: "detailView", | |
| _details: null, | |
| _template: e.template(o), | |
| initialize: function() { | |
| this.listenTo(this.model, "change:meta", this.render) | |
| }, | |
| render: function() { | |
| return this.$el.html(this._template({ | |
| formatters: i, | |
| model: this.model.get("currentModel"), | |
| detail: this._formatDetails(), | |
| lang: r, | |
| exposureTimeFormatter: s | |
| })), | |
| this | |
| }, | |
| _formatDetails: function() { | |
| var t = e.clone(this.model.get("meta")); | |
| return e.isObject(t) && (t.size && (t.size = i.size(t.size)), | |
| t.mtime && (t.mtime = i.date(t.mtime, r.get("lang.timeFormat")))), | |
| t || {} | |
| } | |
| }) | |
| }), | |
| define("text!templates/filesviewer/statusView.html", [], function() { | |
| return '<div class="left">\n <span class="display-name sj-selectable" title="<%- model.get(\'base_name\') %>"><%- model.get("base_name") %></span>\n</div>\n<div class="center">\n <div class="control-buttons">\n <% if (canNavigate) { %>\n <span class="previous icon icon-filesviewer-previous"></span>\n <% } %>\n <span class="play icon icon-filesviewer-play"></span>\n <span class="pause icon icon-filesviewer-pause"></span>\n <% if (canNavigate) { %>\n <span class="next icon icon-filesviewer-next"></span>\n <% } %>\n </div>\n</div>\n<div class="right">\n <div class="more-menu"></div>\n <div class="action-close">\n <span class="icon icon-filesviewer-close"></span>\n <span class="label"><%= lang.get("filesviewer.close") %></span>\n </div>\n</div>\n<div class="progress-bar-container">\n <span class="progress-current"></span>\n <div class="progress-bar"></div>\n <span class="progress-total"></span>\n</div>\n' | |
| }), | |
| define("gui/bar/sliderView", ["backbone", "underscore"], function(e, t) { | |
| return e.View.extend({ | |
| template: t.template("<div class='bar'></div><input class='handle' type='range' max='100' min='0' step='0.01' />"), | |
| events: { | |
| "change .handle": "_onHandleChange", | |
| "input .handle": "_onHandleChange", | |
| "mousedown .handle": "_onMouseDown", | |
| "mouseup .handle": "_onMouseUp" | |
| }, | |
| render: function() { | |
| return this.$el.html(this.template()), | |
| this.update(0), | |
| this.delegateEvents(), | |
| this | |
| }, | |
| update: function(e) { | |
| this.value = "" + e.toFixed(2), | |
| this.$(".bar").width(this.value + "%"), | |
| this.$(".handle").prop("value", this.value) | |
| }, | |
| _onHandleChange: function() { | |
| var e = parseFloat(this.$(".handle").prop("value")).toFixed(2); | |
| e !== this.value && (this.value = e, | |
| this.trigger("change", this.value)) | |
| }, | |
| _onMouseDown: function() { | |
| this.trigger("drag:start") | |
| }, | |
| _onMouseUp: function() { | |
| this.trigger("drag:stop") | |
| } | |
| }) | |
| }), | |
| define("text!templates/filesviewer/moreMenu.html", [], function() { | |
| return '<li class="action-download"><%= lang.get("statusbar.download") %></li>\n<li class="action-delete"><%= lang.get("statusbar.delete") %></li>\n' | |
| }), | |
| define("filesviewer/js/views/moreMenu", ["jquery", "underscore", "backbone", "gui", "lang", "text!templates/filesviewer/moreMenu.html"], function(e, t, n, r, i, s) { | |
| var o = n.View.extend({ | |
| tagName: "ul", | |
| className: "content", | |
| tpl: t.template(s), | |
| render: function() { | |
| return this.$el.html(this.tpl({ | |
| model: this.model, | |
| lang: i | |
| })), | |
| this | |
| } | |
| }); | |
| return r.Flyout.extend({ | |
| events: { | |
| "click .trigger": "toggle" | |
| }, | |
| tpl: t.template(['<a class="trigger">', '<span class="icon icon-filesviewer-toolbar"></span>', "</a>"].join("")), | |
| initialize: function() { | |
| this.triggerView = e(this.tpl({ | |
| lang: i | |
| })), | |
| this.contentView = new o({ | |
| model: this.model | |
| }), | |
| this.listenTo(this, "mousestopped", this.close) | |
| } | |
| }) | |
| }), | |
| define("filesviewer/js/views/statusView", ["underscore", "backbone", "lang", "api", "actionManager", "text!templates/filesviewer/statusView.html", "gui/bar/sliderView", "./moreMenu"], function(e, t, n, r, i, s, o, u) { | |
| return t.View.extend({ | |
| className: "statusview", | |
| events: { | |
| "click .action-download": "onDownload", | |
| "click .action-info": "onInfo", | |
| "click .action-delete": "onDelete", | |
| "click .action-close": "onClose", | |
| "click .control-buttons .play": "onPlay", | |
| "click .control-buttons .pause": "onPause", | |
| "click .control-buttons .next": "onNext", | |
| "click .control-buttons .previous": "onPrevious", | |
| mouseenter: "onMouseEnter", | |
| mouseleave: "onMouseLeave", | |
| mousemove: "onMouseMove" | |
| }, | |
| currentModel: null, | |
| _template: e.template(s), | |
| initialize: function() { | |
| this._progressBarView = new o, | |
| this.listenTo(this.model, "change:currentModel", this.onChangeCurrentModel), | |
| this.listenTo(this._progressBarView, "change", this.onChangeSlider), | |
| this.listenTo(this._progressBarView, "drag:start", this.onPause), | |
| this.listenTo(this._progressBarView, "drag:stop", this.onPlay), | |
| this.listenTo(this.model, "change:mouseMove", this._onModelMouseMove), | |
| this.onChangeCurrentModel(null, this.model.get("currentModel")), | |
| this.listenTo(this.model, "change:meta", this.setButtons), | |
| this.listenTo(this.model, "change:playing", this.setPlayState), | |
| this.listenTo(this.model, "change:diashow", this.setPlayState), | |
| this.listenTo(this.model, "change:canPlay", this.setPlayState), | |
| this.listenTo(this.model, "change:canNavigate", this.setPlayState), | |
| this.listenTo(this.model, "change:duration", this._onDurationChange), | |
| this.listenTo(this.model, "change:currentTime", this._onCurrentTimeChange), | |
| this._downloading = !1 | |
| }, | |
| clear: function() { | |
| this._moreMenu.remove() | |
| }, | |
| remove: function() { | |
| return this.clear(), | |
| this._progressBarView.remove(), | |
| t.View.prototype.remove.apply(this, arguments) | |
| }, | |
| onChangeCurrentModel: function(e, t) { | |
| if (!t) | |
| return; | |
| this.currentModel && (this.stopListening(this.currentModel), | |
| this.clear()), | |
| this.currentModel = t, | |
| this.listenTo(this.currentModel, "change", this.render), | |
| this.render() | |
| }, | |
| setButtons: function() { | |
| var e = !!(this.model.get("meta") || {}).readable | |
| , t = !!this.model.get("currentModel").get("movable") | |
| , n = t && i.isRegistered("deleteFiles"); | |
| this.$(".action-download").toggleClass("enabled", e), | |
| this.$(".action-info").toggleClass("enabled", e), | |
| this.$(".action-delete").toggleClass("enabled", n) | |
| }, | |
| _clearMouseTimer: function() { | |
| this._mouseWithinTimer && (clearTimeout(this._mouseWithinTimer), | |
| this._mouseWithinTimer = null) | |
| }, | |
| _startMouseTimer: function() { | |
| this._clearMouseTimer(), | |
| this._mouseWithinTimer = setTimeout(e.bind(function() { | |
| this._isMouseWithin || (this.$el.removeClass("mousemoved"), | |
| this.$el.addClass("mousestopped"), | |
| this._moreMenu.trigger("mousestopped")) | |
| }, this), 2e3) | |
| }, | |
| _onModelMouseMove: function() { | |
| this._setMouseClasses(), | |
| this._startMouseTimer() | |
| }, | |
| _setMouseClasses: function() { | |
| this.$el.hasClass("mousemoved") || (this.$el.removeClass("mousestopped"), | |
| this.$el.addClass("mousemoved")) | |
| }, | |
| onMouseMove: function(e) { | |
| e.stopPropagation() | |
| }, | |
| onMouseEnter: function() { | |
| this._isMouseWithin = !0, | |
| this._setMouseClasses(), | |
| this._clearMouseTimer() | |
| }, | |
| onMouseLeave: function() { | |
| this._isMouseWithin = !1, | |
| this._startMouseTimer() | |
| }, | |
| onDownload: function() { | |
| this._downloading || (this._downloading = !0, | |
| r.download(this.currentModel).always(e.bind(function() { | |
| this._downloading = !1 | |
| }, this))) | |
| }, | |
| onDelete: function() { | |
| i.execute("deleteFiles", [this.currentModel]) | |
| }, | |
| onPlay: function() { | |
| this.trigger("play") | |
| }, | |
| onPause: function() { | |
| this.trigger("pause") | |
| }, | |
| setPlayState: function() { | |
| var e = this.model.get("playing") === !0 || this.model.get("diashow") === !0 | |
| , t = this.model.get("canPlay") === !0 || this.model.get("canNavigate") === !0; | |
| this.$(".control-buttons .play").toggleClass("disabled", !t || e), | |
| this.$(".control-buttons .pause").toggleClass("disabled", !t || !e) | |
| }, | |
| onPrevious: function() { | |
| this.trigger("previous") | |
| }, | |
| onNext: function() { | |
| this.trigger("next") | |
| }, | |
| onInfo: function() { | |
| this.trigger("info:open") | |
| }, | |
| onClose: function() { | |
| this.trigger("close") | |
| }, | |
| render: function() { | |
| this._moreMenu = new u({ | |
| model: this.currentModel | |
| }), | |
| this.$el.html(this._template({ | |
| lang: n, | |
| model: this.currentModel, | |
| index: this.model.get("currentIndex") + 1, | |
| count: this.collection.length, | |
| canNavigate: this.model.get("canNavigate") | |
| })), | |
| this.$(".more-menu").html(this._moreMenu.render().$el); | |
| var e = this.$(".progress-bar"); | |
| return e.length && e.html(this._progressBarView.render().$el), | |
| this.setButtons(), | |
| this.setPlayState(), | |
| this | |
| }, | |
| _formatTime: function(e) { | |
| var t, n, r; | |
| return isNaN(e) ? e : (t = Math.floor(e / 3600), | |
| n = Math.floor((e - t * 3600) / 60), | |
| r = Math.floor(e - t * 3600 - n * 60), | |
| r < 10 && (r = "0" + r), | |
| t > 0 ? (n < 10 && (n = "0" + n), | |
| t + ":" + n + ":" + r) : n + ":" + r) | |
| }, | |
| _onDurationChange: function(e, t) { | |
| t > 0 ? (this.$(".progress-current").text(this._formatTime(0)), | |
| this.$(".progress-total").text(this._formatTime(t))) : (this.$(".progress-current").empty(), | |
| this.$(".progress-total").empty()), | |
| this._progressBarView.update(0) | |
| }, | |
| _onCurrentTimeChange: function(e, t) { | |
| var n = this.model.get("duration") | |
| , r = 0; | |
| n > 0 && (r = t / n * 100, | |
| this.$(".progress-current").text(this._formatTime(t))), | |
| this._progressBarView.update(r) | |
| }, | |
| onChangeSlider: function(e) { | |
| var t = this.model.get("duration") * e / 100; | |
| this.trigger("seek", t) | |
| } | |
| }) | |
| }), | |
| define("text!templates/filesviewer/filesViewer.html", [], function() { | |
| return '<div class="filesviewer">\n <div class="filesviewer-container">\n <div class="filesviewer-content"></div>\n </div>\n</div>\n' | |
| }), | |
| define("filesviewer/js/views/filesViewer", ["underscore", "backbone", "jquery", "gui/overlay/overlay", "gui/overlay/views/overlayManager", "z-index-mgr", "deleteListInst", "api/models/shareLinkModel", "./fileView", "./imageView", "./videoView", "./audioView", "./textView", "./pdfView", "./detailView", "./statusView", "text!templates/filesviewer/filesViewer.html"], function(e, t, n, r, i, s, o, u, a, f, l, c, h, p, d, v, m) { | |
| return r.extend({ | |
| className: "filesviewer-overlay", | |
| template: e.template(m), | |
| events: { | |
| "click .filesviewer-overlay-close": "remove", | |
| "click .next-button": "gotoNext", | |
| "click .previous-button": "gotoPrevious" | |
| }, | |
| minMouseMovePixels: 5, | |
| autoPlay: !1, | |
| autoContinue: !1, | |
| initialize: function(r) { | |
| var i, s, u; | |
| if (!this.model) | |
| throw new Error("model missing in FilesViewer"); | |
| this.itemType = this.model.getItemType(), | |
| s = this.model.get("group"), | |
| this.contentViewTemplates = {}, | |
| r && (e.has(r, "autoPlay") && (this.autoPlay = r.autoPlay), | |
| e.has(r, "autoContinue") && (this.autoContinue = r.autoContinue)), | |
| this.model.collection ? i = this.model.collection.models : i = [this.model], | |
| u = e.filter(i, function(e) { | |
| return e.get("type") === "file" && e.get("readable") && (!r.filtered || e.get("group") === s) | |
| }, this); | |
| if (!u.length) | |
| throw new Error("no models to show in FilesViewer"); | |
| if (e.some(u, function(e) { | |
| return e.getItemType() !== this.itemType | |
| }, this)) | |
| throw new Error("models differ in itemType/authContext"); | |
| this.collection = new t.Collection(u), | |
| this.allowedGroups = ["thumb", "audio", "video"], | |
| this.state = new t.Model({ | |
| meta: {}, | |
| extendedMeta: !1, | |
| currentModel: this.model, | |
| currentIndex: this.collection.indexOf(this.model), | |
| canNavigate: this.collection.length > 1 && (!r.filtered || e.contains(this.allowedGroups, s)), | |
| canPlay: !1, | |
| mouseMove: !1, | |
| playing: !1, | |
| diashow: !1 | |
| }), | |
| this.listenTo(this.state, "change:currentModel", this._renderContentView), | |
| this.statusView = new v({ | |
| model: this.state, | |
| collection: this.collection | |
| }), | |
| n(window).on("resize.filesviewer", e.bind(this._onResize, this)), | |
| this.listenTo(this.statusView, "info:open", this._toggleDetailView), | |
| this.listenTo(this.statusView, "play", this._onPlay), | |
| this.listenTo(this.statusView, "pause", this._onPause), | |
| this.listenTo(this.statusView, "next", this.gotoNext), | |
| this.listenTo(this.statusView, "previous", this.gotoPrevious), | |
| this.listenTo(this.statusView, "seek", this._onSeek), | |
| this.listenTo(this.statusView, "close", this.remove), | |
| this.lastMousePosition = { | |
| X: 0, | |
| Y: 0 | |
| }, | |
| this.$el.on("mousemove click", e.throttle(e.bind(function(e) { | |
| if (e.type === "click" || Math.abs(this.lastMousePosition.X - e.clientX) > this.minMouseMovePixels || Math.abs(this.lastMousePosition.Y - e.clientY) > this.minMouseMovePixels) | |
| this.state.set({ | |
| mouseMove: !this.state.get("mouseMove") | |
| }), | |
| this.lastMousePosition.X = e.clientX, | |
| this.lastMousePosition.Y = e.clientY | |
| }, this), 200, { | |
| leading: !0 | |
| })), | |
| this.listenTo(o, "added", this._onFileDelete), | |
| this.render().$el.appendTo("body") | |
| }, | |
| render: function() { | |
| return this.$el.addClass(this.overlayClasses), | |
| this.$el.css("z-index", s()), | |
| this.$el.html(this.template({ | |
| showNavButtons: this.state.get("canNavigate") | |
| })), | |
| this._renderContentView(), | |
| this.$(".filesviewer").append(this.statusView.render().$el), | |
| this.trigger("rendered"), | |
| this._overlayPushed || (i.instance().push(), | |
| this._overlayPushed = !0), | |
| this | |
| }, | |
| _getMeta: function(t) { | |
| return t = e.union(t, ["readable", "mtime", "name"]), | |
| this.state.get("currentModel").getMeta(t) | |
| }, | |
| clearContent: function() { | |
| this.contentView && (this.stopListening(this.contentView), | |
| this.contentView.remove()) | |
| }, | |
| remove: function() { | |
| return this.statusView.remove(), | |
| this._removeDetailView(), | |
| this.clearContent(), | |
| this.$el.off(), | |
| n(window).off(".filesviewer"), | |
| this._overlayPushed && (i.instance().pop(), | |
| this._overlayPushed = !1), | |
| this.trigger("removed"), | |
| t.View.prototype.remove.call(this) | |
| }, | |
| _getNextIndex: function(t, n, r) { | |
| var i, s, o; | |
| return t = t.slice(0), | |
| r = r.slice(0), | |
| i = r.indexOf(n) > -1, | |
| i && r.splice(r.indexOf(n), 1), | |
| s = e.difference(t, r), | |
| o = s.indexOf(n), | |
| i && (s.splice(o, 1), | |
| o = o < s.length - 1 ? o : s.length - 1), | |
| o | |
| }, | |
| _onFileDelete: function(t, n) { | |
| if (t !== this.itemType) | |
| return; | |
| var r = this.state.get("currentModel") | |
| , i = e.map(n, function(e) { | |
| return this.collection.get(e.id) | |
| }, this) | |
| , s = this._getNextIndex(this.collection.models, r, i); | |
| this.collection.remove(n), | |
| this.collection.length === 1 && this.state.set({ | |
| diashow: !1, | |
| canNavigate: !1 | |
| }), | |
| this.collection.models.length ? this._gotoIndex(s) : this.remove() | |
| }, | |
| _clearResume: function() { | |
| this._resumeTimeout && clearTimeout(this._resumeTimeout) | |
| }, | |
| _resume: function(t) { | |
| this._clearResume(), | |
| t = t || 5e3, | |
| this._resumeTimeout = e.delay(e.bind(function() { | |
| this.state.get("diashow") && this._next() | |
| }, this), t) | |
| }, | |
| _next: function() { | |
| var e = this.state.get("currentIndex") || 0 | |
| , t = e < this.collection.length - 1 ? e + 1 : 0; | |
| this._gotoIndex(t) | |
| }, | |
| gotoNext: function() { | |
| this.state.set({ | |
| playing: !1, | |
| diashow: !1 | |
| }), | |
| this._next() | |
| }, | |
| gotoPrevious: function() { | |
| var e = this.state.get("currentIndex") || 0 | |
| , t = e > 0 ? e - 1 : this.collection.length - 1; | |
| this.state.set({ | |
| playing: !1, | |
| diashow: !1 | |
| }), | |
| this._gotoIndex(t) | |
| }, | |
| _gotoIndex: function(t) { | |
| this._clearResume(); | |
| var n = this.state.get("currentModel") | |
| , r = this.collection.at(t) | |
| , i = e.without(e.keys(this.state.attributes), "currentIndex", "currentModel", "canNavigate", "diashow", "mouseMove"); | |
| e.each(i, function(e) { | |
| this.state.unset(e) | |
| }, this), | |
| this.state.set({ | |
| currentIndex: t, | |
| currentModel: r | |
| }), | |
| r === n && this.state.trigger("change:currentModel", this.state, r) | |
| }, | |
| _meta: undefined, | |
| _renderContentView: function() { | |
| var t = this.state.get("currentModel"), n; | |
| this.clearContent(), | |
| n = this.$(".filesviewer-content"), | |
| this.contentView = this._getContentView(), | |
| this._bindContentViewEvents(), | |
| this._meta && this._meta.abort(), | |
| this.$(".filesviewer-overlay-filename").text(t.get("base_name")), | |
| this.$el.removeClass("has-duration"), | |
| this._meta = this._getMeta(this.contentView.getMetaFields()).done(e.bind(function(e) { | |
| this.state.set({ | |
| meta: e | |
| }), | |
| this.contentView.render(e, n.width(), n.height()), | |
| n.html(this.contentView.$el), | |
| this.detailView && this._getExtendedMeta() | |
| }, this)).fail(e.bind(function(e, t) { | |
| t !== "abort" && n.html(this.contentView.showError().$el) | |
| }, this)) | |
| }, | |
| _bindContentViewEvents: function() { | |
| this.listenTo(this.contentView, "playing", this._onPlaying), | |
| this.listenTo(this.contentView, "pause", this._onPaused), | |
| this.listenTo(this.contentView, "setDuration", this._onSetDuration), | |
| this.listenTo(this.contentView, "timeupdate", this._onTimeUpdate), | |
| this.listenTo(this.contentView, "ended", this._resume), | |
| this.listenTo(this.contentView, "canPlay", this._onCanPlay) | |
| }, | |
| _getContentView: function() { | |
| var t = this.state.get("currentModel"), n = t.get("group"), r, i = { | |
| thumb: f, | |
| video: l, | |
| audio: c, | |
| text: h, | |
| pdf: p | |
| }; | |
| return t instanceof u && (n = n === "thumb" ? "thumb" : "default"), | |
| e.has(i, n) ? r = i[n] : r = a, | |
| new r({ | |
| model: t, | |
| tpl: this.contentViewTemplates[n], | |
| defTpl: this.contentViewTemplates["default"], | |
| autoPlay: this.autoPlay | |
| }) | |
| }, | |
| _onResize: function() { | |
| if (this.contentView && e.isFunction(this.contentView.resize)) { | |
| var t = this.$(".filesviewer-content") | |
| , n = t.width() | |
| , r = t.height(); | |
| if (!n || !r) | |
| return; | |
| this.contentView.resize(n, r) | |
| } | |
| }, | |
| _onCanPlay: function(e) { | |
| this.state.set("canPlay", e) | |
| }, | |
| _onPlay: function() { | |
| this.state.set({ | |
| playing: !0, | |
| diashow: !0 | |
| }), | |
| this.contentView.play() | |
| }, | |
| _onPause: function() { | |
| this.state.set({ | |
| playing: !1, | |
| diashow: !1 | |
| }), | |
| this.contentView.pause() | |
| }, | |
| _onPlaying: function() { | |
| this.state.set("playing", !0), | |
| this.autoContinue && this.state.set("diashow", !0) | |
| }, | |
| _onPaused: function() { | |
| this.state.set("playing", !1) | |
| }, | |
| _onSetDuration: function(e) { | |
| this.state.set("duration", e), | |
| e > 0 && this.$el.addClass("has-duration") | |
| }, | |
| _onTimeUpdate: function(e) { | |
| this.state.set("currentTime", e) | |
| }, | |
| _onSeek: function(e) { | |
| this.contentView.seek(e) | |
| }, | |
| _toggleDetailView: function() { | |
| this.detailView ? this._hideDetailView() : this._renderDetailView() | |
| }, | |
| _renderDetailView: function() { | |
| this._clearDetailsViewTransitionTimer(), | |
| this.detailView = new d({ | |
| model: this.state | |
| }), | |
| this._getExtendedMeta(), | |
| this.$(".filesviewer-wrapper").append(this.detailView.render().$el), | |
| this.$el.addClass("detailview-active"), | |
| setTimeout(e.bind(function() { | |
| this.detailView.$el.addClass("active") | |
| }, this), 0), | |
| this._detailsViewTransitionTimer = setTimeout(e.bind(function() { | |
| this._detailsViewTransitionTimer = null, | |
| this._onResize() | |
| }, this), 200) | |
| }, | |
| _clearDetailsViewTransitionTimer: function() { | |
| this._detailsViewTransitionTimer && (this._removeDetailView(), | |
| clearTimeout(this._detailsViewTransitionTimer), | |
| this._detailsViewTransitionTimer = null) | |
| }, | |
| _hideDetailView: function() { | |
| this.detailView.$el.removeClass("active"), | |
| this.$el.removeClass("detailview-active"), | |
| this._clearDetailsViewTransitionTimer(), | |
| this._detailsViewTransitionTimer = setTimeout(e.bind(function() { | |
| this._removeDetailView(), | |
| this._onResize() | |
| }, this), 200) | |
| }, | |
| _removeDetailView: function() { | |
| this.detailView && (this.detailView.remove(), | |
| delete this.detailView) | |
| }, | |
| _getExtendedMeta: function() { | |
| var t = this.contentView.getInfoMetaFields() | |
| , r = this.state.get("currentModel"); | |
| t.length && !this.state.get("extendedMeta") && (this.meta = this._getMeta(t).done(e.bind(function(e) { | |
| r.getPid() === this.state.get("currentModel").getPid() && this.state.set({ | |
| meta: n.extend(!0, {}, this.state.get("meta"), e), | |
| extendedMeta: !0 | |
| }) | |
| }, this))) | |
| } | |
| }) | |
| }), | |
| define("filesviewer/main", ["./js/views/filesViewer"], function(e) { | |
| return e | |
| }), | |
| define("filesviewer", ["filesviewer/main"], function(e) { | |
| return e | |
| }), | |
| define("actions/showFile", ["underscore", "tracker", "filesviewer"], function(e, t, n) { | |
| return function(r, i) { | |
| var s = r.get("ext"); | |
| return s && t.track({ | |
| op: "open", | |
| target: s | |
| }), | |
| new n(e.extend({}, i, { | |
| model: r | |
| })) | |
| } | |
| }), | |
| define("actions/showToast", ["gui"], function(e) { | |
| var t = new e.Toast; | |
| return function(e) { | |
| t.render(e) | |
| } | |
| }), | |
| define("appActions", ["actionManager", "actions/deleteFiles", "actions/newFolder", "actions/rename", "actions/sendDataViaUrl", "actions/showFile", "actions/showToast"], function(e, t, n, r, i, s, o) { | |
| var u = {}; | |
| u.deleteFiles = { | |
| callback: t | |
| }, | |
| u.newFolder = { | |
| callback: n | |
| }, | |
| u.rename = { | |
| callback: r | |
| }, | |
| u.sendDataViaUrl = { | |
| callback: i | |
| }, | |
| u.showFile = { | |
| callback: s, | |
| config: { | |
| filtered: !1, | |
| autoPlay: !0, | |
| autoContinue: !0 | |
| } | |
| }, | |
| u.showToast = { | |
| callback: o | |
| }, | |
| e.registerAll(u) | |
| }), | |
| define("plugins/backbone/backbone.touch", ["jquery", "underscore", "backbone", "isTouchDevice"], function(e, t, n, r) { | |
| (function() { | |
| r && (n.EventMgr = function(n) { | |
| var r = [] | |
| , i = { | |
| x: -1e4, | |
| y: -1e4 | |
| }; | |
| return e(document).on("touchstart touchmove", function(e) { | |
| var t = e.originalEvent.touches[0]; | |
| i = { | |
| x: t.clientX, | |
| y: t.clientY | |
| } | |
| }).on("MSPointerUp pointerup", function(e) { | |
| var t = e.originalEvent; | |
| i = { | |
| x: t.clientX, | |
| y: t.clientY | |
| } | |
| }), | |
| { | |
| addTouchEnd: function(e) { | |
| if (e && (e.type === "touchend" || e.type === "MSPointerUp" || e.type === "pointerup")) { | |
| var n = e.originalEvent | |
| , s = (n || {}).pointerType | |
| , o = s && t.contains([n.MSPOINTER_TYPE_TOUCH, n.MSPOINTER_TYPE_PEN], n.pointerType); | |
| if (e.type === "touchend" || o) { | |
| var u = {} | |
| , u = e.type === "touchend" ? t.clone(i) : { | |
| x: e.originalEvent.clientX, | |
| y: e.originalEvent.clientY | |
| }; | |
| r.push(u), | |
| t.delay(function() { | |
| r = t.without(r, u) | |
| }, 2500) | |
| } | |
| } | |
| }, | |
| filterClick: function(e, n) { | |
| if (e && e.type === "click") { | |
| var i = t.find(r, function(t) { | |
| return Math.abs(t.x - e.clientX) < 25 && Math.abs(t.y - e.clientY) < 25 | |
| }); | |
| if (i) | |
| return r = t.without(r, i), | |
| e.preventDefault(), | |
| e.stopImmediatePropagation(), | |
| e.stopPropagation(), | |
| !1 | |
| } | |
| return n() | |
| } | |
| } | |
| }(), | |
| n.View.prototype._delegateEvents = n.View.prototype.delegateEvents, | |
| n.View.prototype.delegateEvents = function(e) { | |
| var r = this | |
| , i = /^(\S+)\s*(.*)$/; | |
| e = e || t.result(this, "events") || {}, | |
| t.each(e, function(e, s) { | |
| if (t.isString(e)) { | |
| var o = s.match(i) | |
| , u = o[1] | |
| , a = o[2]; | |
| if (u === "touchend" || u === "MSPointerUp" || u === "pointerup") { | |
| var f = r[e]; | |
| r[e] = function(e) { | |
| var t = Array.prototype.slice.call(arguments); | |
| return n.EventMgr.addTouchEnd(e), | |
| f.apply(r, t) | |
| } | |
| } | |
| if (u === "click") { | |
| var l = r[e]; | |
| r[e] = function(e) { | |
| var t = Array.prototype.slice.call(arguments); | |
| return n.EventMgr.filterClick(e, function() { | |
| return l.apply(r, t) | |
| }) | |
| } | |
| } | |
| } | |
| }), | |
| n.View.prototype._delegateEvents.apply(r, [e]) | |
| } | |
| ) | |
| })() | |
| }), | |
| require.config(window.requireConfig || {}), | |
| require(["jquery", "backbone", "./router", "appActions", "plugins/backbone/backbone.touch"], function(e, t, n, r, i) { | |
| window.console = window.console || { | |
| assert: e.noop, | |
| clear: e.noop, | |
| count: e.noop, | |
| debug: e.noop, | |
| dir: e.noop, | |
| dirxml: e.noop, | |
| error: e.noop, | |
| exception: e.noop, | |
| group: e.noop, | |
| groupCollapsed: e.noop, | |
| groupEnd: e.noop, | |
| info: e.noop, | |
| log: e.noop, | |
| markTimeline: e.noop, | |
| memory: e.noop, | |
| profile: e.noop, | |
| profileEnd: e.noop, | |
| table: e.noop, | |
| time: e.noop, | |
| timeEnd: e.noop, | |
| timeStamp: e.noop, | |
| trace: e.noop, | |
| warn: e.noop | |
| }, | |
| e(document).ready(function() { | |
| var e = window.router = new n; | |
| t.history.start({ | |
| silent: !0 | |
| }), | |
| e.start() | |
| }), | |
| e(document).on("dragenter dragover drop", function(e) { | |
| var t = e.originalEvent.dataTransfer; | |
| t && (t.dropEffect = "none"), | |
| e.preventDefault() | |
| }) | |
| }), | |
| define("main", function() {}); | |
| if (navigator.userAgent.match(/IEMobile\/10\.0/)) { | |
| var msViewportStyle = document.createElement("style"); | |
| msViewportStyle.appendChild(document.createTextNode("@-ms-viewport{width:auto!important}")), | |
| document.getElementsByTagName("head")[0].appendChild(msViewportStyle) | |
| } | |
| define("../../../libs/polyfills/ie10MobileDeviceWidth.js", function() {}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment