Created
June 12, 2014 08:44
-
-
Save tyage/dd8c0936430d6b7022e2 to your computer and use it in GitHub Desktop.
tweetdeck before xss fixed
This file has been truncated, but you can view the full file.
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
function ScribeTransport(e) { | |
this.SESSION_BUFFER_KEY = "ScribeTransport", this.SCRIBE_API_ENDPOINT = "/i/jot", this.options = {}, e && (this.updateOptions(e), this.registerEventHandlers(e)) | |
} | |
function ClientEvent(e) { | |
this.scribeContext = {}, this.scribeData = {}, this.scribe = function (t, i) { | |
var n = e || window.scribeTransport; | |
if (!n) throw new Error("You must create a global scribeTransport variable or pass one into this constructor."); | |
if (!t || "object" != typeof t || i && "object" != typeof i) throw new Error("Invalid terms or data hash argument when calling ClientEvent.scribe()."); | |
if (this.scribeContext) { | |
var r = "function" == typeof this.scribeContext ? this.scribeContext() : this.scribeContext; | |
t = $.extend({}, r, t) | |
} | |
for (var s in t) t[s] = t[s] && ("" + t[s]).toLowerCase().replace(/_?[^a-z0-9_]+_?/g, "_"); | |
n.options.debug && $.each(["client", "action"], function (e, i) { | |
if (!t[i]) throw new Error("You must specify a " + i + " term in your client_event.") | |
}); | |
var i = $.extend({}, i); | |
if (this.scribeData) { | |
var o = "function" == typeof this.scribeData ? this.scribeData() : this.scribeData; | |
i = $.extend({}, o, i) | |
} | |
i.event_namespace = t, i.triggered_on = i.triggered_on || +new Date, i.format_version = i.format_version || 2, n.send(i, "client_event") | |
} | |
} | |
function FastClick(e) { | |
"use strict"; | |
var t, i = this; | |
if (this.trackingClick = !1, this.trackingClickStart = 0, this.targetElement = null, this.touchStartX = 0, this.touchStartY = 0, this.lastTouchIdentifier = 0, this.touchBoundary = 10, this.layer = e, !e || !e.nodeType) throw new TypeError("Layer must be a document node"); | |
this.onClick = function () { | |
return FastClick.prototype.onClick.apply(i, arguments) | |
}, this.onMouse = function () { | |
return FastClick.prototype.onMouse.apply(i, arguments) | |
}, this.onTouchStart = function () { | |
return FastClick.prototype.onTouchStart.apply(i, arguments) | |
}, this.onTouchEnd = function () { | |
return FastClick.prototype.onTouchEnd.apply(i, arguments) | |
}, this.onTouchCancel = function () { | |
return FastClick.prototype.onTouchCancel.apply(i, arguments) | |
}, FastClick.notNeeded(e) || (this.deviceIsAndroid && (e.addEventListener("mouseover", this.onMouse, !0), e.addEventListener("mousedown", this.onMouse, !0), e.addEventListener("mouseup", this.onMouse, !0)), e.addEventListener("click", this.onClick, !0), e.addEventListener("touchstart", this.onTouchStart, !1), e.addEventListener("touchend", this.onTouchEnd, !1), e.addEventListener("touchcancel", this.onTouchCancel, !1), Event.prototype.stopImmediatePropagation || (e.removeEventListener = function (t, i, n) { | |
var r = Node.prototype.removeEventListener; | |
"click" === t ? r.call(e, t, i.hijacked || i, n) : r.call(e, t, i, n) | |
}, e.addEventListener = function (t, i, n) { | |
var r = Node.prototype.addEventListener; | |
"click" === t ? r.call(e, t, i.hijacked || (i.hijacked = function (e) { | |
e.propagationStopped || i(e) | |
}), n) : r.call(e, t, i, n) | |
}), "function" == typeof e.onclick && (t = e.onclick, e.addEventListener("click", function (e) { | |
t(e) | |
}, !1), e.onclick = null)) | |
} | |
window.Modernizr = function (e, t, i) { | |
function n(e) { | |
y.cssText = e | |
} | |
function r(e, t) { | |
return n(b.join(e + ";") + (t || "")) | |
} | |
function s(e, t) { | |
return typeof e === t | |
} | |
function o(e, t) { | |
return !!~("" + e).indexOf(t) | |
} | |
function a(e, t) { | |
for (var n in e) { | |
var r = e[n]; | |
if (!o(r, "-") && y[r] !== i) return "pfx" == t ? r : !0 | |
} | |
return !1 | |
} | |
function c(e, t, n) { | |
for (var r in e) { | |
var o = t[e[r]]; | |
if (o !== i) return n === !1 ? e[r] : s(o, "function") ? o.bind(n || t) : o | |
} | |
return !1 | |
} | |
function u(e, t, i) { | |
var n = e.charAt(0).toUpperCase() + e.slice(1), | |
r = (e + " " + S.join(n + " ") + n).split(" "); | |
return s(t, "string") || s(t, "undefined") ? a(r, t) : (r = (e + " " + E.join(n + " ") + n).split(" "), c(r, t, i)) | |
} | |
function l() { | |
f.input = function (i) { | |
for (var n = 0, r = i.length; r > n; n++) M[i[n]] = !!(i[n] in D); | |
return M.list && (M.list = !(!t.createElement("datalist") || !e.HTMLDataListElement)), M | |
}("autocomplete autofocus list placeholder max min multiple pattern required step".split(" ")), f.inputtypes = function (e) { | |
for (var n, r, s, o = 0, a = e.length; a > o; o++) D.setAttribute("type", r = e[o]), n = "text" !== D.type, n && (D.value = w, D.style.cssText = "position:absolute;visibility:hidden;", /^range$/.test(r) && D.style.WebkitAppearance !== i ? (g.appendChild(D), s = t.defaultView, n = s.getComputedStyle && "textfield" !== s.getComputedStyle(D, null).WebkitAppearance && 0 !== D.offsetHeight, g.removeChild(D)) : /^(search|tel)$/.test(r) || (n = /^(url|email)$/.test(r) ? D.checkValidity && D.checkValidity() === !1 : D.value != w)), k[e[o]] = !!n; | |
return k | |
}("search tel url email datetime date month week time datetime-local number range color".split(" ")) | |
} | |
var d, h, p = "2.7.2", | |
f = {}, | |
m = !0, | |
g = t.documentElement, | |
T = "modernizr", | |
v = t.createElement(T), | |
y = v.style, | |
D = t.createElement("input"), | |
w = ":)", | |
_ = {}.toString, | |
b = " -webkit- -moz- -o- -ms- ".split(" "), | |
C = "Webkit Moz O ms", | |
S = C.split(" "), | |
E = C.toLowerCase().split(" "), | |
A = { | |
svg: "http://www.w3.org/2000/svg" | |
}, | |
I = {}, | |
k = {}, | |
M = {}, | |
x = [], | |
L = x.slice, | |
R = function (e, i, n, r) { | |
var s, o, a, c, u = t.createElement("div"), | |
l = t.body, | |
d = l || t.createElement("body"); | |
if (parseInt(n, 10)) | |
for (; n--;) a = t.createElement("div"), a.id = r ? r[n] : T + (n + 1), u.appendChild(a); | |
return s = ["­", '<style id="s', T, '">', e, "</style>"].join(""), u.id = T, (l ? u : d).innerHTML += s, d.appendChild(u), l || (d.style.background = "", d.style.overflow = "hidden", c = g.style.overflow, g.style.overflow = "hidden", g.appendChild(d)), o = i(u, e), l ? u.parentNode.removeChild(u) : (d.parentNode.removeChild(d), g.style.overflow = c), !!o | |
}, | |
N = function (t) { | |
var i = e.matchMedia || e.msMatchMedia; | |
if (i) return i(t).matches; | |
var n; | |
return R("@media " + t + " { #" + T + " { position: absolute; } }", function (t) { | |
n = "absolute" == (e.getComputedStyle ? getComputedStyle(t, null) : t.currentStyle).position | |
}), n | |
}, | |
O = function () { | |
function e(e, r) { | |
r = r || t.createElement(n[e] || "div"), e = "on" + e; | |
var o = e in r; | |
return o || (r.setAttribute || (r = t.createElement("div")), r.setAttribute && r.removeAttribute && (r.setAttribute(e, ""), o = s(r[e], "function"), s(r[e], "undefined") || (r[e] = i), r.removeAttribute(e))), r = null, o | |
} | |
var n = { | |
select: "input", | |
change: "input", | |
submit: "form", | |
reset: "form", | |
error: "img", | |
load: "img", | |
abort: "img" | |
}; | |
return e | |
}(), | |
F = {}.hasOwnProperty; | |
h = s(F, "undefined") || s(F.call, "undefined") ? function (e, t) { | |
return t in e && s(e.constructor.prototype[t], "undefined") | |
} : function (e, t) { | |
return F.call(e, t) | |
}, Function.prototype.bind || (Function.prototype.bind = function (e) { | |
var t = this; | |
if ("function" != typeof t) throw new TypeError; | |
var i = L.call(arguments, 1), | |
n = function () { | |
if (this instanceof n) { | |
var r = function () {}; | |
r.prototype = t.prototype; | |
var s = new r, | |
o = t.apply(s, i.concat(L.call(arguments))); | |
return Object(o) === o ? o : s | |
} | |
return t.apply(e, i.concat(L.call(arguments))) | |
}; | |
return n | |
}), I.flexbox = function () { | |
return u("flexWrap") | |
}, I.flexboxlegacy = function () { | |
return u("boxDirection") | |
}, I.canvas = function () { | |
var e = t.createElement("canvas"); | |
return !(!e.getContext || !e.getContext("2d")) | |
}, I.canvastext = function () { | |
return !(!f.canvas || !s(t.createElement("canvas").getContext("2d").fillText, "function")) | |
}, I.webgl = function () { | |
return !!e.WebGLRenderingContext | |
}, I.touch = function () { | |
var i; | |
return "ontouchstart" in e || e.DocumentTouch && t instanceof DocumentTouch ? i = !0 : R(["@media (", b.join("touch-enabled),("), T, ")", "{#modernizr{top:9px;position:absolute}}"].join(""), function (e) { | |
i = 9 === e.offsetTop | |
}), i | |
}, I.geolocation = function () { | |
return "geolocation" in navigator | |
}, I.postmessage = function () { | |
return !!e.postMessage | |
}, I.websqldatabase = function () { | |
return !!e.openDatabase | |
}, I.indexedDB = function () { | |
return !!u("indexedDB", e) | |
}, I.hashchange = function () { | |
return O("hashchange", e) && (t.documentMode === i || t.documentMode > 7) | |
}, I.history = function () { | |
return !(!e.history || !history.pushState) | |
}, I.draganddrop = function () { | |
var e = t.createElement("div"); | |
return "draggable" in e || "ondragstart" in e && "ondrop" in e | |
}, I.websockets = function () { | |
return "WebSocket" in e || "MozWebSocket" in e | |
}, I.rgba = function () { | |
return n("background-color:rgba(150,255,150,.5)"), o(y.backgroundColor, "rgba") | |
}, I.hsla = function () { | |
return n("background-color:hsla(120,40%,100%,.5)"), o(y.backgroundColor, "rgba") || o(y.backgroundColor, "hsla") | |
}, I.multiplebgs = function () { | |
return n("background:url(https://),url(https://),red url(https://)"), /(url\s*\(.*?){3}/.test(y.background) | |
}, I.backgroundsize = function () { | |
return u("backgroundSize") | |
}, I.borderimage = function () { | |
return u("borderImage") | |
}, I.borderradius = function () { | |
return u("borderRadius") | |
}, I.boxshadow = function () { | |
return u("boxShadow") | |
}, I.textshadow = function () { | |
return "" === t.createElement("div").style.textShadow | |
}, I.opacity = function () { | |
return r("opacity:.55"), /^0.55$/.test(y.opacity) | |
}, I.cssanimations = function () { | |
return u("animationName") | |
}, I.csscolumns = function () { | |
return u("columnCount") | |
}, I.cssgradients = function () { | |
var e = "background-image:", | |
t = "gradient(linear,left top,right bottom,from(#9f9),to(white));", | |
i = "linear-gradient(left top,#9f9, white);"; | |
return n((e + "-webkit- ".split(" ").join(t + e) + b.join(i + e)).slice(0, -e.length)), o(y.backgroundImage, "gradient") | |
}, I.cssreflections = function () { | |
return u("boxReflect") | |
}, I.csstransforms = function () { | |
return !!u("transform") | |
}, I.csstransforms3d = function () { | |
var e = !!u("perspective"); | |
return e && "webkitPerspective" in g.style && R("@media (transform-3d),(-webkit-transform-3d){#modernizr{left:9px;position:absolute;height:3px;}}", function (t) { | |
e = 9 === t.offsetLeft && 3 === t.offsetHeight | |
}), e | |
}, I.csstransitions = function () { | |
return u("transition") | |
}, I.fontface = function () { | |
var e; | |
return R('@font-face {font-family:"font";src:url("https://")}', function (i, n) { | |
var r = t.getElementById("smodernizr"), | |
s = r.sheet || r.styleSheet, | |
o = s ? s.cssRules && s.cssRules[0] ? s.cssRules[0].cssText : s.cssText || "" : ""; | |
e = /src/i.test(o) && 0 === o.indexOf(n.split(" ")[0]) | |
}), e | |
}, I.generatedcontent = function () { | |
var e; | |
return R(["#", T, "{font:0/0 a}#", T, ':after{content:"', w, '";visibility:hidden;font:3px/1 a}'].join(""), function (t) { | |
e = t.offsetHeight >= 3 | |
}), e | |
}, I.video = function () { | |
var e = t.createElement("video"), | |
i = !1; | |
try { | |
(i = !!e.canPlayType) && (i = new Boolean(i), i.ogg = e.canPlayType('video/ogg; codecs="theora"').replace(/^no$/, ""), i.h264 = e.canPlayType('video/mp4; codecs="avc1.42E01E"').replace(/^no$/, ""), i.webm = e.canPlayType('video/webm; codecs="vp8, vorbis"').replace(/^no$/, "")) | |
} catch (n) {} | |
return i | |
}, I.audio = function () { | |
var e = t.createElement("audio"), | |
i = !1; | |
try { | |
(i = !!e.canPlayType) && (i = new Boolean(i), i.ogg = e.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/, ""), i.mp3 = e.canPlayType("audio/mpeg;").replace(/^no$/, ""), i.wav = e.canPlayType('audio/wav; codecs="1"').replace(/^no$/, ""), i.m4a = (e.canPlayType("audio/x-m4a;") || e.canPlayType("audio/aac;")).replace(/^no$/, "")) | |
} catch (n) {} | |
return i | |
}, I.localstorage = function () { | |
try { | |
return localStorage.setItem(T, T), localStorage.removeItem(T), !0 | |
} catch (e) { | |
return !1 | |
} | |
}, I.sessionstorage = function () { | |
try { | |
return sessionStorage.setItem(T, T), sessionStorage.removeItem(T), !0 | |
} catch (e) { | |
return !1 | |
} | |
}, I.webworkers = function () { | |
return !!e.Worker | |
}, I.applicationcache = function () { | |
return !!e.applicationCache | |
}, I.svg = function () { | |
return !!t.createElementNS && !!t.createElementNS(A.svg, "svg").createSVGRect | |
}, I.inlinesvg = function () { | |
var e = t.createElement("div"); | |
return e.innerHTML = "<svg/>", (e.firstChild && e.firstChild.namespaceURI) == A.svg | |
}, I.smil = function () { | |
return !!t.createElementNS && /SVGAnimate/.test(_.call(t.createElementNS(A.svg, "animate"))) | |
}, I.svgclippaths = function () { | |
return !!t.createElementNS && /SVGClipPath/.test(_.call(t.createElementNS(A.svg, "clipPath"))) | |
}; | |
for (var U in I) h(I, U) && (d = U.toLowerCase(), f[d] = I[U](), x.push((f[d] ? "" : "no-") + d)); | |
return f.input || l(), f.addTest = function (e, t) { | |
if ("object" == typeof e) | |
for (var n in e) h(e, n) && f.addTest(n, e[n]); | |
else { | |
if (e = e.toLowerCase(), f[e] !== i) return f; | |
t = "function" == typeof t ? t() : t, "undefined" != typeof m && m && (g.className += " " + (t ? "" : "no-") + e), f[e] = t | |
} | |
return f | |
}, n(""), v = D = null, | |
function (e, t) { | |
function i(e, t) { | |
var i = e.createElement("p"), | |
n = e.getElementsByTagName("head")[0] || e.documentElement; | |
return i.innerHTML = "x<style>" + t + "</style>", n.insertBefore(i.lastChild, n.firstChild) | |
} | |
function n() { | |
var e = v.elements; | |
return "string" == typeof e ? e.split(" ") : e | |
} | |
function r(e) { | |
var t = T[e[m]]; | |
return t || (t = {}, g++, e[m] = g, T[g] = t), t | |
} | |
function s(e, i, n) { | |
if (i || (i = t), l) return i.createElement(e); | |
n || (n = r(i)); | |
var s; | |
return s = n.cache[e] ? n.cache[e].cloneNode() : f.test(e) ? (n.cache[e] = n.createElem(e)).cloneNode() : n.createElem(e), !s.canHaveChildren || p.test(e) || s.tagUrn ? s : n.frag.appendChild(s) | |
} | |
function o(e, i) { | |
if (e || (e = t), l) return e.createDocumentFragment(); | |
i = i || r(e); | |
for (var s = i.frag.cloneNode(), o = 0, a = n(), c = a.length; c > o; o++) s.createElement(a[o]); | |
return s | |
} | |
function a(e, t) { | |
t.cache || (t.cache = {}, t.createElem = e.createElement, t.createFrag = e.createDocumentFragment, t.frag = t.createFrag()), e.createElement = function (i) { | |
return v.shivMethods ? s(i, e, t) : t.createElem(i) | |
}, e.createDocumentFragment = Function("h,f", "return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&(" + n().join().replace(/[\w\-]+/g, function (e) { | |
return t.createElem(e), t.frag.createElement(e), 'c("' + e + '")' | |
}) + ");return n}")(v, t.frag) | |
} | |
function c(e) { | |
e || (e = t); | |
var n = r(e); | |
return !v.shivCSS || u || n.hasCSS || (n.hasCSS = !!i(e, "article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}mark{background:#FF0;color:#000}template{display:none}")), l || a(e, n), e | |
} | |
var u, l, d = "3.7.0", | |
h = e.html5 || {}, | |
p = /^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i, | |
f = /^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i, | |
m = "_html5shiv", | |
g = 0, | |
T = {}; | |
! function () { | |
try { | |
var e = t.createElement("a"); | |
e.innerHTML = "<xyz></xyz>", u = "hidden" in e, l = 1 == e.childNodes.length || function () { | |
t.createElement("a"); | |
var e = t.createDocumentFragment(); | |
return "undefined" == typeof e.cloneNode || "undefined" == typeof e.createDocumentFragment || "undefined" == typeof e.createElement | |
}() | |
} catch (i) { | |
u = !0, l = !0 | |
} | |
}(); | |
var v = { | |
elements: h.elements || "abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output progress section summary template time video", | |
version: d, | |
shivCSS: h.shivCSS !== !1, | |
supportsUnknownElements: l, | |
shivMethods: h.shivMethods !== !1, | |
type: "default", | |
shivDocument: c, | |
createElement: s, | |
createDocumentFragment: o | |
}; | |
e.html5 = v, c(t) | |
}(this, t), f._version = p, f._prefixes = b, f._domPrefixes = E, f._cssomPrefixes = S, f.mq = N, f.hasEvent = O, f.testProp = function (e) { | |
return a([e]) | |
}, f.testAllProps = u, f.testStyles = R, f.prefixed = function (e, t, i) { | |
return t ? u(e, t, i) : u(e, "pfx") | |
}, g.className = g.className.replace(/(^|\s)no-js(\s|$)/, "$1$2") + (m ? " js " + x.join(" ") : ""), f | |
}(this, this.document), window.console || (window.console = { | |
log: function () {} | |
}); | |
var TD = { | |
storage: {}, | |
core: {}, | |
net: {}, | |
mustaches: "undefined" == typeof TD_mustaches ? {} : TD_mustaches, | |
templates: {}, | |
components: {}, | |
services: {}, | |
controller: { | |
auth: {} | |
}, | |
vo: {}, | |
ui: {}, | |
sync: {}, | |
cache: {} | |
}; | |
TD.buildID = "19002e5b5af908182db93fdec359a49551b6c6b0", TD.buildIDShort = "19002e5", TD.version = "3.7.1", TD.config = { | |
api_root: "https://tweetdeck.twitter.com", | |
twitter_api_base: "https://api.twitter.com", | |
twitter_api_version: "1.1", | |
td_create_key: "WRaMQNHU2Jy51bhFEL3C", | |
td_create_secret: "MiLkmD1t1xlZqKoLLY8ScxX5gwpOQsjBopZcV4KLcuo=", | |
client_name: "blackbird", | |
debug_menu: !1, | |
touchdeck: !0, | |
custom_timelines: !0, | |
twogin: !0, | |
sync_name: "blackbird" | |
}; | |
var Hogan = {}; | |
! function (e, t) { | |
function i(e, t, i) { | |
var n; | |
return t && "object" == typeof t && (null != t[e] ? n = t[e] : i && t.get && "function" == typeof t.get && (n = t.get(e))), n | |
} | |
function n(e, t, i, n) { | |
function r() {} | |
function s() {} | |
r.prototype = e, s.prototype = e.subs; | |
var o, a = new r; | |
a.subs = new s, a.subsText = {}, a.ib(); | |
for (o in t) a.subs[o] = t[o], a.subsText[o] = n; | |
for (o in i) a.partials[o] = i[o]; | |
return a | |
} | |
function r(e) { | |
return String(null === e || void 0 === e ? "" : e) | |
} | |
function s(e) { | |
return e = r(e), d.test(e) ? e.replace(o, "&").replace(a, "<").replace(c, ">").replace(u, "'").replace(l, """) : e | |
} | |
e.Template = function (e, t, i, n) { | |
e = e || {}, this.r = e.code || this.r, this.c = i, this.options = n || {}, this.text = t || "", this.partials = e.partials || {}, this.subs = e.subs || {}, this.ib() | |
}, e.Template.prototype = { | |
r: function () { | |
return "" | |
}, | |
v: s, | |
t: r, | |
render: function (e, t, i) { | |
return this.ri([e], t || {}, i) | |
}, | |
ri: function (e, t, i) { | |
return this.r(e, t, i) | |
}, | |
ep: function (e, t) { | |
var i = this.partials[e], | |
r = t[i.name]; | |
if (i.instance && i.base == r) return i.instance; | |
if ("string" == typeof r) { | |
if (!this.c) throw new Error("No compiler available."); | |
r = this.c.compile(r, this.options) | |
} | |
return r ? (this.partials[e].base = r, i.subs && (void 0 === this.activeSub && (t.stackText = this.text), r = n(r, i.subs, i.partials, t.stackText || this.text)), this.partials[e].instance = r, r) : null | |
}, | |
rp: function (e, t, i, n) { | |
var r = this.ep(e, i); | |
return r ? r.ri(t, i, n) : "" | |
}, | |
rs: function (e, t, i) { | |
var n = e[e.length - 1]; | |
if (!h(n)) return void i(e, t, this); | |
for (var r = 0; r < n.length; r++) e.push(n[r]), i(e, t, this), e.pop() | |
}, | |
s: function (e, t, i, n, r, s, o) { | |
var a; | |
return h(e) && 0 === e.length ? !1 : ("function" == typeof e && (e = this.ms(e, t, i, n, r, s, o)), a = !!e, !n && a && t && t.push("object" == typeof e ? e : t[t.length - 1]), a) | |
}, | |
d: function (e, t, n, r) { | |
var s, o = e.split("."), | |
a = this.f(o[0], t, n, r), | |
c = this.options.modelGet, | |
u = null; | |
if ("." === e && h(t[t.length - 2])) a = t[t.length - 1]; | |
else | |
for (var l = 1; l < o.length; l++) s = i(o[l], a, c), null != s ? (u = a, a = s) : a = ""; | |
return r && !a ? !1 : (r || "function" != typeof a || (t.push(u), a = this.mv(a, t, n), t.pop()), a) | |
}, | |
f: function (e, t, n, r) { | |
for (var s = !1, o = null, a = !1, c = this.options.modelGet, u = t.length - 1; u >= 0; u--) | |
if (o = t[u], s = i(e, o, c), null != s) { | |
a = !0; | |
break | |
} | |
return a ? (r || "function" != typeof s || (s = this.mv(s, t, n)), s) : r ? !1 : "" | |
}, | |
ls: function (e, t, i, n, s) { | |
var o = this.options.delimiters; | |
return this.options.delimiters = s, this.b(this.ct(r(e.call(t, n)), t, i)), this.options.delimiters = o, !1 | |
}, | |
ct: function (e, t, i) { | |
if (this.options.disableLambda) throw new Error("Lambda features disabled."); | |
return this.c.compile(e, this.options).render(t, i) | |
}, | |
b: t ? function (e) { | |
this.buf.push(e) | |
} : function (e) { | |
this.buf += e | |
}, | |
fl: t ? function () { | |
var e = this.buf.join(""); | |
return this.buf = [], e | |
} : function () { | |
var e = this.buf; | |
return this.buf = "", e | |
}, | |
ib: function () { | |
this.buf = t ? [] : "" | |
}, | |
ms: function (e, t, i, n, r, s, o) { | |
var a, c = t[t.length - 1], | |
u = e.call(c); | |
return "function" == typeof u ? n ? !0 : (a = this.activeSub && this.subsText[this.activeSub] ? this.subsText[this.activeSub] : this.text, this.ls(u, c, i, a.substring(r, s), o)) : u | |
}, | |
mv: function (e, t, i) { | |
var n = t[t.length - 1], | |
s = e.call(n); | |
return "function" == typeof s ? this.ct(r(s.call(n)), n, i) : s | |
}, | |
sub: function (e, t, i, n) { | |
var r = this.subs[e]; | |
r && (this.activeSub = e, r(t, i, this, n), this.activeSub = !1) | |
} | |
}; | |
var o = /&/g, | |
a = /</g, | |
c = />/g, | |
u = /\'/g, | |
l = /\"/g, | |
d = /[&<>\"\']/, | |
h = Array.isArray || function (e) { | |
return "[object Array]" === Object.prototype.toString.call(e) | |
} | |
}("undefined" != typeof exports ? exports : Hogan), | |
function (e) { | |
function t(e) { | |
"}" === e.n.substr(e.n.length - 1) && (e.n = e.n.substring(0, e.n.length - 1)) | |
} | |
function i(e) { | |
return e.trim ? e.trim() : e.replace(/^\s*|\s*$/g, "") | |
} | |
function n(e, t, i) { | |
if (t.charAt(i) != e.charAt(0)) return !1; | |
for (var n = 1, r = e.length; r > n; n++) | |
if (t.charAt(i + n) != e.charAt(n)) return !1; | |
return !0 | |
} | |
function r(t, i, n, a) { | |
var c = [], | |
u = null, | |
l = null, | |
d = null; | |
for (l = n[n.length - 1]; t.length > 0;) { | |
if (d = t.shift(), l && "<" == l.tag && !(d.tag in y)) throw new Error("Illegal content in < super tag."); | |
if (e.tags[d.tag] <= e.tags.$ || s(d, a)) n.push(d), d.nodes = r(t, d.tag, n, a); | |
else { | |
if ("/" == d.tag) { | |
if (0 === n.length) throw new Error("Closing tag without opener: /" + d.n); | |
if (u = n.pop(), d.n != u.n && !o(d.n, u.n, a)) throw new Error("Nesting error: " + u.n + " vs. " + d.n); | |
return u.end = d.i, c | |
} | |
"\n" == d.tag && (d.last = 0 == t.length || "\n" == t[0].tag) | |
} | |
c.push(d) | |
} | |
if (n.length > 0) throw new Error("missing closing tag: " + n.pop().n); | |
return c | |
} | |
function s(e, t) { | |
for (var i = 0, n = t.length; n > i; i++) | |
if (t[i].o == e.n) return e.tag = "#", !0 | |
} | |
function o(e, t, i) { | |
for (var n = 0, r = i.length; r > n; n++) | |
if (i[n].c == e && i[n].o == t) return !0 | |
} | |
function a(e) { | |
var t = []; | |
for (var i in e) t.push('"' + u(i) + '": function(c,p,t,i) {' + e[i] + "}"); | |
return "{ " + t.join(",") + " }" | |
} | |
function c(e) { | |
var t = []; | |
for (var i in e.partials) t.push('"' + u(i) + '":{name:"' + u(e.partials[i].name) + '", ' + c(e.partials[i]) + "}"); | |
return "partials: {" + t.join(",") + "}, subs: " + a(e.subs) | |
} | |
function u(e) { | |
return e.replace(v, "\\\\").replace(m, '\\"').replace(g, "\\n").replace(T, "\\r") | |
} | |
function l(e) { | |
return ~e.indexOf(".") ? "d" : "f" | |
} | |
function d(e, t) { | |
var i = "<" + (t.prefix || ""), | |
n = i + e.n + D++; | |
return t.partials[n] = { | |
name: e.n, | |
partials: {} | |
}, t.code += 't.b(t.rp("' + u(n) + '",c,p,"' + (e.indent || "") + '"));', n | |
} | |
function h(e, t) { | |
t.code += "t.b(t.t(t." + l(e.n) + '("' + u(e.n) + '",c,p,0)));' | |
} | |
function p(e) { | |
return "t.b(" + e + ");" | |
} | |
var f = /\S/, | |
m = /\"/g, | |
g = /\n/g, | |
T = /\r/g, | |
v = /\\/g; | |
e.tags = { | |
"#": 1, | |
"^": 2, | |
"<": 3, | |
$: 4, | |
"/": 5, | |
"!": 6, | |
">": 7, | |
"=": 8, | |
_v: 9, | |
"{": 10, | |
"&": 11, | |
_t: 12 | |
}, e.scan = function (r, s) { | |
function o() { | |
v.length > 0 && (y.push({ | |
tag: "_t", | |
text: new String(v) | |
}), v = "") | |
} | |
function a() { | |
for (var t = !0, i = _; i < y.length; i++) | |
if (t = e.tags[y[i].tag] < e.tags._v || "_t" == y[i].tag && null === y[i].text.match(f), !t) return !1; | |
return t | |
} | |
function c(e, t) { | |
if (o(), e && a()) | |
for (var i, n = _; n < y.length; n++) y[n].text && ((i = y[n + 1]) && ">" == i.tag && (i.indent = y[n].text.toString()), y.splice(n, 1)); | |
else t || y.push({ | |
tag: "\n" | |
}); | |
D = !1, _ = y.length | |
} | |
function u(e, t) { | |
var n = "=" + C, | |
r = e.indexOf(n, t), | |
s = i(e.substring(e.indexOf("=", t) + 1, r)).split(" "); | |
return b = s[0], C = s[s.length - 1], r + n.length - 1 | |
} | |
var l = r.length, | |
d = 0, | |
h = 1, | |
p = 2, | |
m = d, | |
g = null, | |
T = null, | |
v = "", | |
y = [], | |
D = !1, | |
w = 0, | |
_ = 0, | |
b = "{{", | |
C = "}}"; | |
for (s && (s = s.split(" "), b = s[0], C = s[1]), w = 0; l > w; w++) m == d ? n(b, r, w) ? (--w, o(), m = h) : "\n" == r.charAt(w) ? c(D) : v += r.charAt(w) : m == h ? (w += b.length - 1, T = e.tags[r.charAt(w + 1)], g = T ? r.charAt(w + 1) : "_v", "=" == g ? (w = u(r, w), m = d) : (T && w++, m = p), D = w) : n(C, r, w) ? (y.push({ | |
tag: g, | |
n: i(v), | |
otag: b, | |
ctag: C, | |
i: "/" == g ? D - b.length : w + C.length | |
}), v = "", w += C.length - 1, m = d, "{" == g && ("}}" == C ? w++ : t(y[y.length - 1]))) : v += r.charAt(w); | |
return c(D, !0), y | |
}; | |
var y = { | |
_t: !0, | |
"\n": !0, | |
$: !0, | |
"/": !0 | |
}; | |
e.stringify = function (t) { | |
return "{code: function (c,p,i) { " + e.wrapMain(t.code) + " }," + c(t) + "}" | |
}; | |
var D = 0; | |
e.generate = function (t, i, n) { | |
D = 0; | |
var r = { | |
code: "", | |
subs: {}, | |
partials: {} | |
}; | |
return e.walk(t, r), n.asString ? this.stringify(r, i, n) : this.makeTemplate(r, i, n) | |
}, e.wrapMain = function (e) { | |
return 'var t=this;t.b(i=i||"");' + e + "return t.fl();" | |
}, e.template = e.Template, e.makeTemplate = function (e, t, i) { | |
var n = this.makePartials(e); | |
return n.code = new Function("c", "p", "i", this.wrapMain(e.code)), new this.template(n, t, this, i) | |
}, e.makePartials = function (e) { | |
var t, i = { | |
subs: {}, | |
partials: e.partials, | |
name: e.name | |
}; | |
for (t in i.partials) i.partials[t] = this.makePartials(i.partials[t]); | |
for (t in e.subs) i.subs[t] = new Function("c", "p", "t", "i", e.subs[t]); | |
return i | |
}, e.codegen = { | |
"#": function (t, i) { | |
i.code += "if(t.s(t." + l(t.n) + '("' + u(t.n) + '",c,p,1),c,p,0,' + t.i + "," + t.end + ',"' + t.otag + " " + t.ctag + '")){t.rs(c,p,function(c,p,t){', e.walk(t.nodes, i), i.code += "});c.pop();}" | |
}, | |
"^": function (t, i) { | |
i.code += "if(!t.s(t." + l(t.n) + '("' + u(t.n) + '",c,p,1),c,p,1,0,0,"")){', e.walk(t.nodes, i), i.code += "};" | |
}, | |
">": d, | |
"<": function (t, i) { | |
var n = { | |
partials: {}, | |
code: "", | |
subs: {}, | |
inPartial: !0 | |
}; | |
e.walk(t.nodes, n); | |
var r = i.partials[d(t, i)]; | |
r.subs = n.subs, r.partials = n.partials | |
}, | |
$: function (t, i) { | |
var n = { | |
subs: {}, | |
code: "", | |
partials: i.partials, | |
prefix: t.n | |
}; | |
e.walk(t.nodes, n), i.subs[t.n] = n.code, i.inPartial || (i.code += 't.sub("' + u(t.n) + '",c,p,i);') | |
}, | |
"\n": function (e, t) { | |
t.code += p('"\\n"' + (e.last ? "" : " + i")) | |
}, | |
_v: function (e, t) { | |
t.code += "t.b(t.v(t." + l(e.n) + '("' + u(e.n) + '",c,p,0)));' | |
}, | |
_t: function (e, t) { | |
t.code += p('"' + u(e.text) + '"') | |
}, | |
"{": h, | |
"&": h | |
}, e.walk = function (t, i) { | |
for (var n, r = 0, s = t.length; s > r; r++) n = e.codegen[t[r].tag], n && n(t[r], i); | |
return i | |
}, e.parse = function (e, t, i) { | |
return i = i || {}, r(e, "", [], i.sectionTags || []) | |
}, e.cache = {}, e.cacheKey = function (e, t) { | |
return [e, !!t.asString, !!t.disableLambda, t.delimiters, !!t.modelGet].join("||") | |
}, e.compile = function (t, i) { | |
i = i || {}; | |
var n = e.cacheKey(t, i), | |
r = this.cache[n]; | |
return r ? r : (r = this.generate(this.parse(this.scan(t, i.delimiters), t, i), t, i), this.cache[n] = r) | |
} | |
}("undefined" != typeof exports ? exports : Hogan), ScribeTransport.prototype = { | |
flush: function (e, t) { | |
if (e && e.length) { | |
if (void 0 === t && (t = !!this.options.sync), this.options.useAjax) { | |
var i = { | |
url: this.options.url, | |
data: $.extend(this.ajaxParams(e), this.options.requestParameters), | |
type: "POST", | |
dataType: "json", | |
async: !t, | |
headers: { | |
"X-Twitter-Polling": !0 | |
} | |
}; | |
this.options.debug && (this.options.debugHandler && (i.success = this.options.debugHandler), i.data.debug = "1"), $.ajax(i) | |
} else { | |
var n = this.options.debug ? "&debug=1" : ""; | |
(new Image).src = this.options.url + "?q=" + (+new Date).toString().slice(-4) + n + "&" + this.imageParams(e) | |
} | |
this.reset() | |
} | |
}, | |
ajaxParams: function (e) { | |
if ("string" == typeof e) return { | |
log: "[" + e + "]" | |
}; | |
var t = this.options.encodeParameters; | |
return t && "function" == typeof t ? t.apply(this, arguments) : { | |
log: JSON.stringify(e) | |
} | |
}, | |
imageParams: function (e) { | |
if ("string" == typeof e) return "log=%5B" + e + "%5D"; | |
var t = this.options.encodeParameters; | |
return t && "function" == typeof t ? t.apply(this, arguments) : "log=" + encodeURIComponent(JSON.stringify(e)) | |
}, | |
reset: function () { | |
this.options.bufferEvents && (this.skipUnloadFlush = !1, sessionStorage.removeItem(this.options.bufferKey)) | |
}, | |
getBuffer: function () { | |
return sessionStorage.getItem(this.options.bufferKey) || "" | |
}, | |
send: function (e, t, i) { | |
if (t && e && !(this.options.bufferSize < 0)) { | |
if (e._category_ = t, !i && this.options.bufferEvents && this.options.bufferSize) { | |
var n = JSON.stringify(e); | |
this.options.useAjax || (n = encodeURIComponent(n)); | |
var r = this.getBuffer(), | |
s = r + (r ? this.SEPARATOR + n : n); | |
this.options.bufferSize && this.fullBuffer(s) ? this.options.useAjax ? this.flush(s) : (this.flush(r), sessionStorage.setItem(this.options.bufferKey, n)) : sessionStorage.setItem(this.options.bufferKey, s) | |
} else this.flush([e], i); | |
this.options.debug && $(document).trigger("scribedata." + this.options.bufferKey, e), this.options.metrics && "debug" != e.event_info && $(document).trigger("debugscribe", e) | |
} | |
}, | |
fullBuffer: function (e) { | |
return e.length >= (this.options.useAjax ? 2083 * this.options.bufferSize : 2050 - this.options.url.length) | |
}, | |
updateOptions: function (e) { | |
if (this.options = $.extend({}, this.options, e), this.options.requestParameters || (this.options.requestParameters = {}), void 0 === this.options.flushOnUnload && (this.options.flushOnUnload = !0), this.options.bufferKey || (this.options.bufferKey = this.SESSION_BUFFER_KEY), 0 === this.options.bufferSize && (this.options.bufferEvents = !1), void 0 === this.options.useAjax && (this.options.useAjax = !0), this.options.bufferEvents || void 0 == this.options.bufferEvents) try { | |
sessionStorage.setItem(this.SESSION_BUFFER_KEY + ".init", "test"); | |
var t = "test" == sessionStorage.getItem(this.SESSION_BUFFER_KEY + ".init"); | |
sessionStorage.removeItem(this.SESSION_BUFFER_KEY + ".init"), this.options.bufferEvents = t | |
} catch (i) { | |
this.options.bufferEvents = !1 | |
} | |
if (this.options.debug && !this.options.debugHandler) { | |
var n = this; | |
this.options.debugHandler = e.debugHandler || function (e) { | |
$(document).trigger("handlescribe." + n.options.bufferKey, e) | |
} | |
} | |
var r = "https:" === window.location.protocol ? "https:" : "http:"; | |
this.options.url = void 0 === this.options.url ? this.options.useAjax ? this.SCRIBE_API_ENDPOINT : "https://twitter.com" + this.SCRIBE_API_ENDPOINT : this.options.url.replace(/^[a-z]+:/g, r).replace(/\/$/, ""), this.options.bufferEvents && void 0 === this.options.bufferSize && (this.options.bufferSize = 20) | |
}, | |
appHost: function () { | |
return window.location.host | |
}, | |
registerEventHandlers: function () { | |
var e = this, | |
t = $(document); | |
if (this.options.bufferEvents && (t.on("flushscribe." + e.options.bufferKey, function () { | |
e.flush(e.getBuffer(), !0) | |
}), this.options.flushOnUnload)) { | |
var i = function (t) { | |
e.skipUnloadFlush = !t || !t.match(/http/) || !!t.match(new RegExp("^https?://" + e.appHost(), "gi")), e.skipUnloadFlush && window.setTimeout(function () { | |
e.skipUnloadFlush = !1 | |
}, 3e3) | |
}; | |
t.on("mouseup." + this.options.bufferKey, "a", function (e) { | |
this.getAttribute("target") || e.button || e.metaKey || e.shiftKey || e.altKey || e.ctrlKey || i(this.getAttribute("href")) | |
}), t.on("submit." + this.options.bufferKey, "form", function () { | |
i(this.getAttribute("action")) | |
}), t.on("uiNavigate." + this.options.bufferKey, function (e, t) { | |
i(t.url) | |
}), $(window).on("unload." + this.options.bufferKey, function () { | |
e.skipUnloadFlush || e.flush(e.getBuffer(), !0), e.skipUnloadFlush = !1 | |
}) | |
} | |
this.SEPARATOR = this.options.useAjax ? "," : encodeURIComponent(",") | |
}, | |
destroy: function () { | |
this.flush(this.getBuffer()), $(document).off("flushscribe." + this.options.bufferKey), $(window).off("unload." + this.options.bufferKey), $(document).off("mouseup." + this.options.bufferKey), $(document).off("submit." + this.options.bufferKey), $(document).off("uiNavigate." + this.options.bufferKey) | |
} | |
}, | |
function (e, t) { | |
"object" == typeof module && "object" == typeof module.exports ? 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) | |
}("undefined" != typeof window ? window : this, function (e, t) { | |
function i(e) { | |
var t = e.length, | |
i = et.type(e); | |
return "function" === i || et.isWindow(e) ? !1 : 1 === e.nodeType && t ? !0 : "array" === i || 0 === t || "number" == typeof t && t > 0 && t - 1 in e | |
} | |
function n(e, t, i) { | |
if (et.isFunction(t)) return et.grep(e, function (e, n) { | |
return !!t.call(e, n, e) !== i | |
}); | |
if (t.nodeType) return et.grep(e, function (e) { | |
return e === t !== i | |
}); | |
if ("string" == typeof t) { | |
if (at.test(t)) return et.filter(t, e, i); | |
t = et.filter(t, e) | |
} | |
return et.grep(e, function (e) { | |
return V.call(t, e) >= 0 !== i | |
}) | |
} | |
function r(e, t) { | |
for (; | |
(e = e[t]) && 1 !== e.nodeType;); | |
return e | |
} | |
function s(e) { | |
var t = ft[e] = {}; | |
return et.each(e.match(pt) || [], function (e, i) { | |
t[i] = !0 | |
}), t | |
} | |
function o() { | |
J.removeEventListener("DOMContentLoaded", o, !1), e.removeEventListener("load", o, !1), et.ready() | |
} | |
function a() { | |
Object.defineProperty(this.cache = {}, 0, { | |
get: function () { | |
return {} | |
} | |
}), this.expando = et.expando + Math.random() | |
} | |
function c(e, t, i) { | |
var n; | |
if (void 0 === i && 1 === e.nodeType) | |
if (n = "data-" + t.replace(Dt, "-$1").toLowerCase(), i = e.getAttribute(n), "string" == typeof i) { | |
try { | |
i = "true" === i ? !0 : "false" === i ? !1 : "null" === i ? null : +i + "" === i ? +i : yt.test(i) ? et.parseJSON(i) : i | |
} catch (r) {} | |
vt.set(e, t, i) | |
} else i = void 0; | |
return i | |
} | |
function u() { | |
return !0 | |
} | |
function l() { | |
return !1 | |
} | |
function d() { | |
try { | |
return J.activeElement | |
} catch (e) {} | |
} | |
function h(e, t) { | |
return et.nodeName(e, "table") && et.nodeName(11 !== t.nodeType ? t : t.firstChild, "tr") ? e.getElementsByTagName("tbody")[0] || e.appendChild(e.ownerDocument.createElement("tbody")) : e | |
} | |
function p(e) { | |
return e.type = (null !== e.getAttribute("type")) + "/" + e.type, e | |
} | |
function f(e) { | |
var t = Ft.exec(e.type); | |
return t ? e.type = t[1] : e.removeAttribute("type"), e | |
} | |
function m(e, t) { | |
for (var i = 0, n = e.length; n > i; i++) Tt.set(e[i], "globalEval", !t || Tt.get(t[i], "globalEval")) | |
} | |
function g(e, t) { | |
var i, n, r, s, o, a, c, u; | |
if (1 === t.nodeType) { | |
if (Tt.hasData(e) && (s = Tt.access(e), o = Tt.set(t, s), u = s.events)) { | |
delete o.handle, o.events = {}; | |
for (r in u) | |
for (i = 0, n = u[r].length; n > i; i++) et.event.add(t, r, u[r][i]) | |
} | |
vt.hasData(e) && (a = vt.access(e), c = et.extend({}, a), vt.set(t, c)) | |
} | |
} | |
function T(e, t) { | |
var i = e.getElementsByTagName ? e.getElementsByTagName(t || "*") : e.querySelectorAll ? e.querySelectorAll(t || "*") : []; | |
return void 0 === t || t && et.nodeName(e, t) ? et.merge([e], i) : i | |
} | |
function v(e, t) { | |
var i = t.nodeName.toLowerCase(); | |
"input" === i && Ct.test(e.type) ? t.checked = e.checked : ("input" === i || "textarea" === i) && (t.defaultValue = e.defaultValue) | |
} | |
function y(t, i) { | |
var n = et(i.createElement(t)).appendTo(i.body), | |
r = e.getDefaultComputedStyle ? e.getDefaultComputedStyle(n[0]).display : et.css(n[0], "display"); | |
return n.detach(), r | |
} | |
function D(e) { | |
var t = J, | |
i = Bt[e]; | |
return i || (i = y(e, t), "none" !== i && i || (Pt = (Pt || et("<iframe frameborder='0' width='0' height='0'/>")).appendTo(t.documentElement), t = Pt[0].contentDocument, t.write(), t.close(), i = y(e, t), Pt.detach()), Bt[e] = i), i | |
} | |
function w(e, t, i) { | |
var n, r, s, o, a = e.style; | |
return i = i || Wt(e), i && (o = i.getPropertyValue(t) || i[t]), i && ("" !== o || et.contains(e.ownerDocument, e) || (o = et.style(e, t)), Ht.test(o) && jt.test(t) && (n = a.width, r = a.minWidth, s = a.maxWidth, a.minWidth = a.maxWidth = a.width = o, o = i.width, a.width = n, a.minWidth = r, a.maxWidth = s)), void 0 !== o ? o + "" : o | |
} | |
function _(e, t) { | |
return { | |
get: function () { | |
return e() ? void delete this.get : (this.get = t).apply(this, arguments) | |
} | |
} | |
} | |
function b(e, t) { | |
if (t in e) return t; | |
for (var i = t[0].toUpperCase() + t.slice(1), n = t, r = Yt.length; r--;) | |
if (t = Yt[r] + i, t in e) return t; | |
return n | |
} | |
function C(e, t, i) { | |
var n = Gt.exec(t); | |
return n ? Math.max(0, n[1] - (i || 0)) + (n[2] || "px") : t | |
} | |
function S(e, t, i, n, r) { | |
for (var s = i === (n ? "border" : "content") ? 4 : "width" === t ? 1 : 0, o = 0; 4 > s; s += 2) "margin" === i && (o += et.css(e, i + _t[s], !0, r)), n ? ("content" === i && (o -= et.css(e, "padding" + _t[s], !0, r)), "margin" !== i && (o -= et.css(e, "border" + _t[s] + "Width", !0, r))) : (o += et.css(e, "padding" + _t[s], !0, r), "padding" !== i && (o += et.css(e, "border" + _t[s] + "Width", !0, r))); | |
return o | |
} | |
function E(e, t, i) { | |
var n = !0, | |
r = "width" === t ? e.offsetWidth : e.offsetHeight, | |
s = Wt(e), | |
o = "border-box" === et.css(e, "boxSizing", !1, s); | |
if (0 >= r || null == r) { | |
if (r = w(e, t, s), (0 > r || null == r) && (r = e.style[t]), Ht.test(r)) return r; | |
n = o && (X.boxSizingReliable() || r === e.style[t]), r = parseFloat(r) || 0 | |
} | |
return r + S(e, t, i || (o ? "border" : "content"), n, s) + "px" | |
} | |
function A(e, t) { | |
for (var i, n, r, s = [], o = 0, a = e.length; a > o; o++) n = e[o], n.style && (s[o] = Tt.get(n, "olddisplay"), i = n.style.display, t ? (s[o] || "none" !== i || (n.style.display = ""), "" === n.style.display && bt(n) && (s[o] = Tt.access(n, "olddisplay", D(n.nodeName)))) : s[o] || (r = bt(n), (i && "none" !== i || !r) && Tt.set(n, "olddisplay", r ? i : et.css(n, "display")))); | |
for (o = 0; a > o; o++) n = e[o], n.style && (t && "none" !== n.style.display && "" !== n.style.display || (n.style.display = t ? s[o] || "" : "none")); | |
return e | |
} | |
function I(e, t, i, n, r) { | |
return new I.prototype.init(e, t, i, n, r) | |
} | |
function k() { | |
return setTimeout(function () { | |
Qt = void 0 | |
}), Qt = et.now() | |
} | |
function M(e, t) { | |
var i, n = 0, | |
r = { | |
height: e | |
}; | |
for (t = t ? 1 : 0; 4 > n; n += 2 - t) i = _t[n], r["margin" + i] = r["padding" + i] = e; | |
return t && (r.opacity = r.width = e), r | |
} | |
function x(e, t, i) { | |
for (var n, r = (ii[t] || []).concat(ii["*"]), s = 0, o = r.length; o > s; s++) | |
if (n = r[s].call(i, t, e)) return n | |
} | |
function L(e, t, i) { | |
var n, r, s, o, a, c, u, l = this, | |
d = {}, | |
h = e.style, | |
p = e.nodeType && bt(e), | |
f = Tt.get(e, "fxshow"); | |
i.queue || (a = et._queueHooks(e, "fx"), null == a.unqueued && (a.unqueued = 0, c = a.empty.fire, a.empty.fire = function () { | |
a.unqueued || c() | |
}), a.unqueued++, l.always(function () { | |
l.always(function () { | |
a.unqueued--, et.queue(e, "fx").length || a.empty.fire() | |
}) | |
})), 1 === e.nodeType && ("height" in t || "width" in t) && (i.overflow = [h.overflow, h.overflowX, h.overflowY], u = et.css(e, "display"), "none" === u && (u = D(e.nodeName)), "inline" === u && "none" === et.css(e, "float") && (h.display = "inline-block")), i.overflow && (h.overflow = "hidden", l.always(function () { | |
h.overflow = i.overflow[0], h.overflowX = i.overflow[1], h.overflowY = i.overflow[2] | |
})); | |
for (n in t) | |
if (r = t[n], Jt.exec(r)) { | |
if (delete t[n], s = s || "toggle" === r, r === (p ? "hide" : "show")) { | |
if ("show" !== r || !f || void 0 === f[n]) continue; | |
p = !0 | |
} | |
d[n] = f && f[n] || et.style(e, n) | |
} | |
if (!et.isEmptyObject(d)) { | |
f ? "hidden" in f && (p = f.hidden) : f = Tt.access(e, "fxshow", {}), s && (f.hidden = !p), p ? et(e).show() : l.done(function () { | |
et(e).hide() | |
}), l.done(function () { | |
var t; | |
Tt.remove(e, "fxshow"); | |
for (t in d) et.style(e, t, d[t]) | |
}); | |
for (n in d) o = x(p ? f[n] : 0, n, l), n in f || (f[n] = o.start, p && (o.end = o.start, o.start = "width" === n || "height" === n ? 1 : 0)) | |
} | |
} | |
function R(e, t) { | |
var i, n, r, s, o; | |
for (i in e) | |
if (n = et.camelCase(i), r = t[n], s = e[i], et.isArray(s) && (r = s[1], s = e[i] = s[0]), i !== n && (e[n] = s, delete e[i]), o = et.cssHooks[n], o && "expand" in o) { | |
s = o.expand(s), delete e[n]; | |
for (i in s) i in e || (e[i] = s[i], t[i] = r) | |
} else t[n] = r | |
} | |
function N(e, t, i) { | |
var n, r, s = 0, | |
o = ti.length, | |
a = et.Deferred().always(function () { | |
delete c.elem | |
}), | |
c = function () { | |
if (r) return !1; | |
for (var t = Qt || k(), i = Math.max(0, u.startTime + u.duration - t), n = i / u.duration || 0, s = 1 - n, o = 0, c = u.tweens.length; c > o; o++) u.tweens[o].run(s); | |
return a.notifyWith(e, [u, s, i]), 1 > s && c ? i : (a.resolveWith(e, [u]), !1) | |
}, | |
u = a.promise({ | |
elem: e, | |
props: et.extend({}, t), | |
opts: et.extend(!0, { | |
specialEasing: {} | |
}, i), | |
originalProperties: t, | |
originalOptions: i, | |
startTime: Qt || k(), | |
duration: i.duration, | |
tweens: [], | |
createTween: function (t, i) { | |
var n = et.Tween(e, u.opts, t, i, u.opts.specialEasing[t] || u.opts.easing); | |
return u.tweens.push(n), n | |
}, | |
stop: function (t) { | |
var i = 0, | |
n = t ? u.tweens.length : 0; | |
if (r) return this; | |
for (r = !0; n > i; i++) u.tweens[i].run(1); | |
return t ? a.resolveWith(e, [u, t]) : a.rejectWith(e, [u, t]), this | |
} | |
}), | |
l = u.props; | |
for (R(l, u.opts.specialEasing); o > s; s++) | |
if (n = ti[s].call(u, e, l, u.opts)) return n; | |
return et.map(l, x, u), et.isFunction(u.opts.start) && u.opts.start.call(e, u), et.fx.timer(et.extend(c, { | |
elem: e, | |
anim: u, | |
queue: u.opts.queue | |
})), u.progress(u.opts.progress).done(u.opts.done, u.opts.complete).fail(u.opts.fail).always(u.opts.always) | |
} | |
function O(e) { | |
return function (t, i) { | |
"string" != typeof t && (i = t, t = "*"); | |
var n, r = 0, | |
s = t.toLowerCase().match(pt) || []; | |
if (et.isFunction(i)) | |
for (; n = s[r++];) "+" === n[0] ? (n = n.slice(1) || "*", (e[n] = e[n] || []).unshift(i)) : (e[n] = e[n] || []).push(i) | |
} | |
} | |
function F(e, t, i, n) { | |
function r(a) { | |
var c; | |
return s[a] = !0, et.each(e[a] || [], function (e, a) { | |
var u = a(t, i, n); | |
return "string" != typeof u || o || s[u] ? o ? !(c = u) : void 0 : (t.dataTypes.unshift(u), r(u), !1) | |
}), c | |
} | |
var s = {}, | |
o = e === wi; | |
return r(t.dataTypes[0]) || !s["*"] && r("*") | |
} | |
function U(e, t) { | |
var i, n, r = et.ajaxSettings.flatOptions || {}; | |
for (i in t) void 0 !== t[i] && ((r[i] ? e : n || (n = {}))[i] = t[i]); | |
return n && et.extend(!0, e, n), e | |
} | |
function $(e, t, i) { | |
for (var n, r, s, o, a = e.contents, c = e.dataTypes; | |
"*" === c[0];) c.shift(), void 0 === n && (n = e.mimeType || t.getResponseHeader("Content-Type")); | |
if (n) | |
for (r in a) | |
if (a[r] && a[r].test(n)) { | |
c.unshift(r); | |
break | |
} | |
if (c[0] in i) s = c[0]; | |
else { | |
for (r in i) { | |
if (!c[0] || e.converters[r + " " + c[0]]) { | |
s = r; | |
break | |
} | |
o || (o = r) | |
} | |
s = s || o | |
} | |
return s ? (s !== c[0] && c.unshift(s), i[s]) : void 0 | |
} | |
function P(e, t, i, n) { | |
var r, s, o, a, c, u = {}, | |
l = e.dataTypes.slice(); | |
if (l[1]) | |
for (o in e.converters) u[o.toLowerCase()] = e.converters[o]; | |
for (s = l.shift(); s;) | |
if (e.responseFields[s] && (i[e.responseFields[s]] = t), !c && n && e.dataFilter && (t = e.dataFilter(t, e.dataType)), c = s, s = l.shift()) | |
if ("*" === s) s = c; | |
else if ("*" !== c && c !== s) { | |
if (o = u[c + " " + s] || u["* " + s], !o) | |
for (r in u) | |
if (a = r.split(" "), a[1] === s && (o = u[c + " " + a[0]] || u["* " + a[0]])) { | |
o === !0 ? o = u[r] : u[r] !== !0 && (s = a[0], l.unshift(a[1])); | |
break | |
} | |
if (o !== !0) | |
if (o && e["throws"]) t = o(t); | |
else try { | |
t = o(t) | |
} catch (d) { | |
return { | |
state: "parsererror", | |
error: o ? d : "No conversion from " + c + " to " + s | |
} | |
} | |
} | |
return { | |
state: "success", | |
data: t | |
} | |
} | |
function B(e, t, i, n) { | |
var r; | |
if (et.isArray(t)) et.each(t, function (t, r) { | |
i || Si.test(e) ? n(e, r) : B(e + "[" + ("object" == typeof r ? t : "") + "]", r, i, n) | |
}); | |
else if (i || "object" !== et.type(t)) n(e, t); | |
else | |
for (r in t) B(e + "[" + r + "]", t[r], i, n) | |
} | |
function j(e) { | |
return et.isWindow(e) ? e : 9 === e.nodeType && e.defaultView | |
} | |
var H = [], | |
W = H.slice, | |
K = H.concat, | |
G = H.push, | |
V = H.indexOf, | |
z = {}, | |
q = z.toString, | |
Y = z.hasOwnProperty, | |
Q = "".trim, | |
X = {}, | |
J = e.document, | |
Z = "2.1.0", | |
et = function (e, t) { | |
return new et.fn.init(e, t) | |
}, | |
tt = /^-ms-/, | |
it = /-([\da-z])/gi, | |
nt = function (e, t) { | |
return t.toUpperCase() | |
}; | |
et.fn = et.prototype = { | |
jquery: Z, | |
constructor: et, | |
selector: "", | |
length: 0, | |
toArray: function () { | |
return W.call(this) | |
}, | |
get: function (e) { | |
return null != e ? 0 > e ? this[e + this.length] : this[e] : W.call(this) | |
}, | |
pushStack: function (e) { | |
var t = et.merge(this.constructor(), e); | |
return t.prevObject = this, t.context = this.context, t | |
}, | |
each: function (e, t) { | |
return et.each(this, e, t) | |
}, | |
map: function (e) { | |
return this.pushStack(et.map(this, function (t, i) { | |
return e.call(t, i, t) | |
})) | |
}, | |
slice: function () { | |
return this.pushStack(W.apply(this, arguments)) | |
}, | |
first: function () { | |
return this.eq(0) | |
}, | |
last: function () { | |
return this.eq(-1) | |
}, | |
eq: function (e) { | |
var t = this.length, | |
i = +e + (0 > e ? t : 0); | |
return this.pushStack(i >= 0 && t > i ? [this[i]] : []) | |
}, | |
end: function () { | |
return this.prevObject || this.constructor(null) | |
}, | |
push: G, | |
sort: H.sort, | |
splice: H.splice | |
}, et.extend = et.fn.extend = function () { | |
var e, t, i, n, r, s, o = arguments[0] || {}, | |
a = 1, | |
c = arguments.length, | |
u = !1; | |
for ("boolean" == typeof o && (u = o, o = arguments[a] || {}, a++), "object" == typeof o || et.isFunction(o) || (o = {}), a === c && (o = this, a--); c > a; a++) | |
if (null != (e = arguments[a])) | |
for (t in e) i = o[t], n = e[t], o !== n && (u && n && (et.isPlainObject(n) || (r = et.isArray(n))) ? (r ? (r = !1, s = i && et.isArray(i) ? i : []) : s = i && et.isPlainObject(i) ? i : {}, o[t] = et.extend(u, s, n)) : void 0 !== n && (o[t] = n)); | |
return o | |
}, et.extend({ | |
expando: "jQuery" + (Z + Math.random()).replace(/\D/g, ""), | |
isReady: !0, | |
error: function (e) { | |
throw new Error(e) | |
}, | |
noop: function () {}, | |
isFunction: function (e) { | |
return "function" === et.type(e) | |
}, | |
isArray: Array.isArray, | |
isWindow: function (e) { | |
return null != e && e === e.window | |
}, | |
isNumeric: function (e) { | |
return e - parseFloat(e) >= 0 | |
}, | |
isPlainObject: function (e) { | |
if ("object" !== et.type(e) || e.nodeType || et.isWindow(e)) return !1; | |
try { | |
if (e.constructor && !Y.call(e.constructor.prototype, "isPrototypeOf")) return !1 | |
} catch (t) { | |
return !1 | |
} | |
return !0 | |
}, | |
isEmptyObject: function (e) { | |
var t; | |
for (t in e) return !1; | |
return !0 | |
}, | |
type: function (e) { | |
return null == e ? e + "" : "object" == typeof e || "function" == typeof e ? z[q.call(e)] || "object" : typeof e | |
}, | |
globalEval: function (e) { | |
var t, i = eval; | |
e = et.trim(e), e && (1 === e.indexOf("use strict") ? (t = J.createElement("script"), t.text = e, J.head.appendChild(t).parentNode.removeChild(t)) : i(e)) | |
}, | |
camelCase: function (e) { | |
return e.replace(tt, "ms-").replace(it, nt) | |
}, | |
nodeName: function (e, t) { | |
return e.nodeName && e.nodeName.toLowerCase() === t.toLowerCase() | |
}, | |
each: function (e, t, n) { | |
var r, s = 0, | |
o = e.length, | |
a = i(e); | |
if (n) { | |
if (a) | |
for (; o > s && (r = t.apply(e[s], n), r !== !1); s++); | |
else | |
for (s in e) | |
if (r = t.apply(e[s], n), r === !1) break | |
} else if (a) | |
for (; o > s && (r = t.call(e[s], s, e[s]), r !== !1); s++); | |
else | |
for (s in e) | |
if (r = t.call(e[s], s, e[s]), r === !1) break; return e | |
}, | |
trim: function (e) { | |
return null == e ? "" : Q.call(e) | |
}, | |
makeArray: function (e, t) { | |
var n = t || []; | |
return null != e && (i(Object(e)) ? et.merge(n, "string" == typeof e ? [e] : e) : G.call(n, e)), n | |
}, | |
inArray: function (e, t, i) { | |
return null == t ? -1 : V.call(t, e, i) | |
}, | |
merge: function (e, t) { | |
for (var i = +t.length, n = 0, r = e.length; i > n; n++) e[r++] = t[n]; | |
return e.length = r, e | |
}, | |
grep: function (e, t, i) { | |
for (var n, r = [], s = 0, o = e.length, a = !i; o > s; s++) n = !t(e[s], s), n !== a && r.push(e[s]); | |
return r | |
}, | |
map: function (e, t, n) { | |
var r, s = 0, | |
o = e.length, | |
a = i(e), | |
c = []; | |
if (a) | |
for (; o > s; s++) r = t(e[s], s, n), null != r && c.push(r); | |
else | |
for (s in e) r = t(e[s], s, n), null != r && c.push(r); | |
return K.apply([], c) | |
}, | |
guid: 1, | |
proxy: function (e, t) { | |
var i, n, r; | |
return "string" == typeof t && (i = e[t], t = e, e = i), et.isFunction(e) ? (n = W.call(arguments, 2), r = function () { | |
return e.apply(t || this, n.concat(W.call(arguments))) | |
}, r.guid = e.guid = e.guid || et.guid++, r) : void 0 | |
}, | |
now: Date.now, | |
support: X | |
}), et.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function (e, t) { | |
z["[object " + t + "]"] = t.toLowerCase() | |
}); | |
var rt = function (e) { | |
function t(e, t, i, n) { | |
var r, s, o, a, c, u, d, f, m, g; | |
if ((t ? t.ownerDocument || t : B) !== L && x(t), t = t || L, i = i || [], !e || "string" != typeof e) return i; | |
if (1 !== (a = t.nodeType) && 9 !== a) return []; | |
if (N && !n) { | |
if (r = vt.exec(e)) | |
if (o = r[1]) { | |
if (9 === a) { | |
if (s = t.getElementById(o), !s || !s.parentNode) return i; | |
if (s.id === o) return i.push(s), i | |
} else if (t.ownerDocument && (s = t.ownerDocument.getElementById(o)) && $(t, s) && s.id === o) return i.push(s), i | |
} else { | |
if (r[2]) return Z.apply(i, t.getElementsByTagName(e)), i; | |
if ((o = r[3]) && b.getElementsByClassName && t.getElementsByClassName) return Z.apply(i, t.getElementsByClassName(o)), i | |
} | |
if (b.qsa && (!O || !O.test(e))) { | |
if (f = d = P, m = t, g = 9 === a && e, 1 === a && "object" !== t.nodeName.toLowerCase()) { | |
for (u = h(e), (d = t.getAttribute("id")) ? f = d.replace(Dt, "\\$&") : t.setAttribute("id", f), f = "[id='" + f + "'] ", c = u.length; c--;) u[c] = f + p(u[c]); | |
m = yt.test(e) && l(t.parentNode) || t, g = u.join(",") | |
} | |
if (g) try { | |
return Z.apply(i, m.querySelectorAll(g)), i | |
} catch (T) {} finally { | |
d || t.removeAttribute("id") | |
} | |
} | |
} | |
return w(e.replace(ct, "$1"), t, i, n) | |
} | |
function i() { | |
function e(i, n) { | |
return t.push(i + " ") > C.cacheLength && delete e[t.shift()], e[i + " "] = n | |
} | |
var t = []; | |
return e | |
} | |
function n(e) { | |
return e[P] = !0, e | |
} | |
function r(e) { | |
var t = L.createElement("div"); | |
try { | |
return !!e(t) | |
} catch (i) { | |
return !1 | |
} finally { | |
t.parentNode && t.parentNode.removeChild(t), t = null | |
} | |
} | |
function s(e, t) { | |
for (var i = e.split("|"), n = e.length; n--;) C.attrHandle[i[n]] = t | |
} | |
function o(e, t) { | |
var i = t && e, | |
n = i && 1 === e.nodeType && 1 === t.nodeType && (~t.sourceIndex || q) - (~e.sourceIndex || q); | |
if (n) return n; | |
if (i) | |
for (; i = i.nextSibling;) | |
if (i === t) return -1; | |
return e ? 1 : -1 | |
} | |
function a(e) { | |
return function (t) { | |
var i = t.nodeName.toLowerCase(); | |
return "input" === i && t.type === e | |
} | |
} | |
function c(e) { | |
return function (t) { | |
var i = t.nodeName.toLowerCase(); | |
return ("input" === i || "button" === i) && t.type === e | |
} | |
} | |
function u(e) { | |
return n(function (t) { | |
return t = +t, n(function (i, n) { | |
for (var r, s = e([], i.length, t), o = s.length; o--;) i[r = s[o]] && (i[r] = !(n[r] = i[r])) | |
}) | |
}) | |
} | |
function l(e) { | |
return e && typeof e.getElementsByTagName !== z && e | |
} | |
function d() {} | |
function h(e, i) { | |
var n, r, s, o, a, c, u, l = K[e + " "]; | |
if (l) return i ? 0 : l.slice(0); | |
for (a = e, c = [], u = C.preFilter; a;) { | |
(!n || (r = ut.exec(a))) && (r && (a = a.slice(r[0].length) || a), c.push(s = [])), n = !1, (r = lt.exec(a)) && (n = r.shift(), s.push({ | |
value: n, | |
type: r[0].replace(ct, " ") | |
}), a = a.slice(n.length)); | |
for (o in C.filter)!(r = ft[o].exec(a)) || u[o] && !(r = u[o](r)) || (n = r.shift(), s.push({ | |
value: n, | |
type: o, | |
matches: r | |
}), a = a.slice(n.length)); | |
if (!n) break | |
} | |
return i ? a.length : a ? t.error(e) : K(e, c).slice(0) | |
} | |
function p(e) { | |
for (var t = 0, i = e.length, n = ""; i > t; t++) n += e[t].value; | |
return n | |
} | |
function f(e, t, i) { | |
var n = t.dir, | |
r = i && "parentNode" === n, | |
s = H++; | |
return t.first ? function (t, i, s) { | |
for (; t = t[n];) | |
if (1 === t.nodeType || r) return e(t, i, s) | |
} : function (t, i, o) { | |
var a, c, u = [j, s]; | |
if (o) { | |
for (; t = t[n];) | |
if ((1 === t.nodeType || r) && e(t, i, o)) return !0 | |
} else | |
for (; t = t[n];) | |
if (1 === t.nodeType || r) { | |
if (c = t[P] || (t[P] = {}), (a = c[n]) && a[0] === j && a[1] === s) return u[2] = a[2]; | |
if (c[n] = u, u[2] = e(t, i, o)) return !0 | |
} | |
} | |
} | |
function m(e) { | |
return e.length > 1 ? function (t, i, n) { | |
for (var r = e.length; r--;) | |
if (!e[r](t, i, n)) return !1; | |
return !0 | |
} : e[0] | |
} | |
function g(e, t, i, n, r) { | |
for (var s, o = [], a = 0, c = e.length, u = null != t; c > a; a++)(s = e[a]) && (!i || i(s, n, r)) && (o.push(s), u && t.push(a)); | |
return o | |
} | |
function T(e, t, i, r, s, o) { | |
return r && !r[P] && (r = T(r)), s && !s[P] && (s = T(s, o)), n(function (n, o, a, c) { | |
var u, l, d, h = [], | |
p = [], | |
f = o.length, | |
m = n || D(t || "*", a.nodeType ? [a] : a, []), | |
T = !e || !n && t ? m : g(m, h, e, a, c), | |
v = i ? s || (n ? e : f || r) ? [] : o : T; | |
if (i && i(T, v, a, c), r) | |
for (u = g(v, p), r(u, [], a, c), l = u.length; l--;)(d = u[l]) && (v[p[l]] = !(T[p[l]] = d)); | |
if (n) { | |
if (s || e) { | |
if (s) { | |
for (u = [], l = v.length; l--;)(d = v[l]) && u.push(T[l] = d); | |
s(null, v = [], u, c) | |
} | |
for (l = v.length; l--;)(d = v[l]) && (u = s ? tt.call(n, d) : h[l]) > -1 && (n[u] = !(o[u] = d)) | |
} | |
} else v = g(v === o ? v.splice(f, v.length) : v), s ? s(null, o, v, c) : Z.apply(o, v) | |
}) | |
} | |
function v(e) { | |
for (var t, i, n, r = e.length, s = C.relative[e[0].type], o = s || C.relative[" "], a = s ? 1 : 0, c = f(function (e) { | |
return e === t | |
}, o, !0), u = f(function (e) { | |
return tt.call(t, e) > -1 | |
}, o, !0), l = [ | |
function (e, i, n) { | |
return !s && (n || i !== I) || ((t = i).nodeType ? c(e, i, n) : u(e, i, n)) | |
} | |
]; r > a; a++) | |
if (i = C.relative[e[a].type]) l = [f(m(l), i)]; | |
else { | |
if (i = C.filter[e[a].type].apply(null, e[a].matches), i[P]) { | |
for (n = ++a; r > n && !C.relative[e[n].type]; n++); | |
return T(a > 1 && m(l), a > 1 && p(e.slice(0, a - 1).concat({ | |
value: " " === e[a - 2].type ? "*" : "" | |
})).replace(ct, "$1"), i, n > a && v(e.slice(a, n)), r > n && v(e = e.slice(n)), r > n && p(e)) | |
} | |
l.push(i) | |
} | |
return m(l) | |
} | |
function y(e, i) { | |
var r = i.length > 0, | |
s = e.length > 0, | |
o = function (n, o, a, c, u) { | |
var l, d, h, p = 0, | |
f = "0", | |
m = n && [], | |
T = [], | |
v = I, | |
y = n || s && C.find.TAG("*", u), | |
D = j += null == v ? 1 : Math.random() || .1, | |
w = y.length; | |
for (u && (I = o !== L && o); f !== w && null != (l = y[f]); f++) { | |
if (s && l) { | |
for (d = 0; h = e[d++];) | |
if (h(l, o, a)) { | |
c.push(l); | |
break | |
} | |
u && (j = D) | |
} | |
r && ((l = !h && l) && p--, n && m.push(l)) | |
} | |
if (p += f, r && f !== p) { | |
for (d = 0; h = i[d++];) h(m, T, o, a); | |
if (n) { | |
if (p > 0) | |
for (; f--;) m[f] || T[f] || (T[f] = X.call(c)); | |
T = g(T) | |
} | |
Z.apply(c, T), u && !n && T.length > 0 && p + i.length > 1 && t.uniqueSort(c) | |
} | |
return u && (j = D, I = v), m | |
}; | |
return r ? n(o) : o | |
} | |
function D(e, i, n) { | |
for (var r = 0, s = i.length; s > r; r++) t(e, i[r], n); | |
return n | |
} | |
function w(e, t, i, n) { | |
var r, s, o, a, c, u = h(e); | |
if (!n && 1 === u.length) { | |
if (s = u[0] = u[0].slice(0), s.length > 2 && "ID" === (o = s[0]).type && b.getById && 9 === t.nodeType && N && C.relative[s[1].type]) { | |
if (t = (C.find.ID(o.matches[0].replace(wt, _t), t) || [])[0], !t) return i; | |
e = e.slice(s.shift().value.length) | |
} | |
for (r = ft.needsContext.test(e) ? 0 : s.length; r-- && (o = s[r], !C.relative[a = o.type]);) | |
if ((c = C.find[a]) && (n = c(o.matches[0].replace(wt, _t), yt.test(s[0].type) && l(t.parentNode) || t))) { | |
if (s.splice(r, 1), e = n.length && p(s), !e) return Z.apply(i, n), i; | |
break | |
} | |
} | |
return A(e, u)(n, t, !N, i, yt.test(e) && l(t.parentNode) || t), i | |
} | |
var _, b, C, S, E, A, I, k, M, x, L, R, N, O, F, U, $, P = "sizzle" + -new Date, | |
B = e.document, | |
j = 0, | |
H = 0, | |
W = i(), | |
K = i(), | |
G = i(), | |
V = function (e, t) { | |
return e === t && (M = !0), 0 | |
}, | |
z = "undefined", | |
q = 1 << 31, | |
Y = {}.hasOwnProperty, | |
Q = [], | |
X = Q.pop, | |
J = Q.push, | |
Z = Q.push, | |
et = Q.slice, | |
tt = Q.indexOf || function (e) { | |
for (var t = 0, i = this.length; i > t; t++) | |
if (this[t] === e) return t; | |
return -1 | |
}, | |
it = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped", | |
nt = "[\\x20\\t\\r\\n\\f]", | |
rt = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+", | |
st = rt.replace("w", "w#"), | |
ot = "\\[" + nt + "*(" + rt + ")" + nt + "*(?:([*^$|!~]?=)" + nt + "*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|(" + st + ")|)|)" + nt + "*\\]", | |
at = ":(" + rt + ")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|" + ot.replace(3, 8) + ")*)|.*)\\)|)", | |
ct = new RegExp("^" + nt + "+|((?:^|[^\\\\])(?:\\\\.)*)" + nt + "+$", "g"), | |
ut = new RegExp("^" + nt + "*," + nt + "*"), | |
lt = new RegExp("^" + nt + "*([>+~]|" + nt + ")" + nt + "*"), | |
dt = new RegExp("=" + nt + "*([^\\]'\"]*?)" + nt + "*\\]", "g"), | |
ht = new RegExp(at), | |
pt = new RegExp("^" + st + "$"), | |
ft = { | |
ID: new RegExp("^#(" + rt + ")"), | |
CLASS: new RegExp("^\\.(" + rt + ")"), | |
TAG: new RegExp("^(" + rt.replace("w", "w*") + ")"), | |
ATTR: new RegExp("^" + ot), | |
PSEUDO: new RegExp("^" + at), | |
CHILD: new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + nt + "*(even|odd|(([+-]|)(\\d*)n|)" + nt + "*(?:([+-]|)" + nt + "*(\\d+)|))" + nt + "*\\)|)", "i"), | |
bool: new RegExp("^(?:" + it + ")$", "i"), | |
needsContext: new RegExp("^" + nt + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + nt + "*((?:-\\d)?\\d*)" + nt + "*\\)|)(?=[^-]|$)", "i") | |
}, | |
mt = /^(?:input|select|textarea|button)$/i, | |
gt = /^h\d$/i, | |
Tt = /^[^{]+\{\s*\[native \w/, | |
vt = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, | |
yt = /[+~]/, | |
Dt = /'|\\/g, | |
wt = new RegExp("\\\\([\\da-f]{1,6}" + nt + "?|(" + nt + ")|.)", "ig"), | |
_t = function (e, t, i) { | |
var n = "0x" + t - 65536; | |
return n !== n || i ? t : 0 > n ? String.fromCharCode(n + 65536) : String.fromCharCode(n >> 10 | 55296, 1023 & n | 56320) | |
}; | |
try { | |
Z.apply(Q = et.call(B.childNodes), B.childNodes), Q[B.childNodes.length].nodeType | |
} catch (bt) { | |
Z = { | |
apply: Q.length ? function (e, t) { | |
J.apply(e, et.call(t)) | |
} : function (e, t) { | |
for (var i = e.length, n = 0; e[i++] = t[n++];); | |
e.length = i - 1 | |
} | |
} | |
} | |
b = t.support = {}, E = t.isXML = function (e) { | |
var t = e && (e.ownerDocument || e).documentElement; | |
return t ? "HTML" !== t.nodeName : !1 | |
}, x = t.setDocument = function (e) { | |
var t, i = e ? e.ownerDocument || e : B, | |
n = i.defaultView; | |
return i !== L && 9 === i.nodeType && i.documentElement ? (L = i, R = i.documentElement, N = !E(i), n && n !== n.top && (n.addEventListener ? n.addEventListener("unload", function () { | |
x() | |
}, !1) : n.attachEvent && n.attachEvent("onunload", function () { | |
x() | |
})), b.attributes = r(function (e) { | |
return e.className = "i", !e.getAttribute("className") | |
}), b.getElementsByTagName = r(function (e) { | |
return e.appendChild(i.createComment("")), !e.getElementsByTagName("*").length | |
}), b.getElementsByClassName = Tt.test(i.getElementsByClassName) && r(function (e) { | |
return e.innerHTML = "<div class='a'></div><div class='a i'></div>", e.firstChild.className = "i", 2 === e.getElementsByClassName("i").length | |
}), b.getById = r(function (e) { | |
return R.appendChild(e).id = P, !i.getElementsByName || !i.getElementsByName(P).length | |
}), b.getById ? (C.find.ID = function (e, t) { | |
if (typeof t.getElementById !== z && N) { | |
var i = t.getElementById(e); | |
return i && i.parentNode ? [i] : [] | |
} | |
}, C.filter.ID = function (e) { | |
var t = e.replace(wt, _t); | |
return function (e) { | |
return e.getAttribute("id") === t | |
} | |
}) : (delete C.find.ID, C.filter.ID = function (e) { | |
var t = e.replace(wt, _t); | |
return function (e) { | |
var i = typeof e.getAttributeNode !== z && e.getAttributeNode("id"); | |
return i && i.value === t | |
} | |
}), C.find.TAG = b.getElementsByTagName ? function (e, t) { | |
return typeof t.getElementsByTagName !== z ? t.getElementsByTagName(e) : void 0 | |
} : function (e, t) { | |
var i, n = [], | |
r = 0, | |
s = t.getElementsByTagName(e); | |
if ("*" === e) { | |
for (; i = s[r++];) 1 === i.nodeType && n.push(i); | |
return n | |
} | |
return s | |
}, C.find.CLASS = b.getElementsByClassName && function (e, t) { | |
return typeof t.getElementsByClassName !== z && N ? t.getElementsByClassName(e) : void 0 | |
}, F = [], O = [], (b.qsa = Tt.test(i.querySelectorAll)) && (r(function (e) { | |
e.innerHTML = "<select t=''><option selected=''></option></select>", e.querySelectorAll("[t^='']").length && O.push("[*^$]=" + nt + "*(?:''|\"\")"), e.querySelectorAll("[selected]").length || O.push("\\[" + nt + "*(?:value|" + it + ")"), e.querySelectorAll(":checked").length || O.push(":checked") | |
}), r(function (e) { | |
var t = i.createElement("input"); | |
t.setAttribute("type", "hidden"), e.appendChild(t).setAttribute("name", "D"), e.querySelectorAll("[name=d]").length && O.push("name" + nt + "*[*^$|!~]?="), e.querySelectorAll(":enabled").length || O.push(":enabled", ":disabled"), e.querySelectorAll("*,:x"), O.push(",.*:") | |
})), (b.matchesSelector = Tt.test(U = R.webkitMatchesSelector || R.mozMatchesSelector || R.oMatchesSelector || R.msMatchesSelector)) && r(function (e) { | |
b.disconnectedMatch = U.call(e, "div"), U.call(e, "[s!='']:x"), F.push("!=", at) | |
}), O = O.length && new RegExp(O.join("|")), F = F.length && new RegExp(F.join("|")), t = Tt.test(R.compareDocumentPosition), $ = t || Tt.test(R.contains) ? function (e, t) { | |
var i = 9 === e.nodeType ? e.documentElement : e, | |
n = t && t.parentNode; | |
return e === n || !(!n || 1 !== n.nodeType || !(i.contains ? i.contains(n) : e.compareDocumentPosition && 16 & e.compareDocumentPosition(n))) | |
} : function (e, t) { | |
if (t) | |
for (; t = t.parentNode;) | |
if (t === e) return !0; | |
return !1 | |
}, V = t ? function (e, t) { | |
if (e === t) return M = !0, 0; | |
var n = !e.compareDocumentPosition - !t.compareDocumentPosition; | |
return n ? n : (n = (e.ownerDocument || e) === (t.ownerDocument || t) ? e.compareDocumentPosition(t) : 1, 1 & n || !b.sortDetached && t.compareDocumentPosition(e) === n ? e === i || e.ownerDocument === B && $(B, e) ? -1 : t === i || t.ownerDocument === B && $(B, t) ? 1 : k ? tt.call(k, e) - tt.call(k, t) : 0 : 4 & n ? -1 : 1) | |
} : function (e, t) { | |
if (e === t) return M = !0, 0; | |
var n, r = 0, | |
s = e.parentNode, | |
a = t.parentNode, | |
c = [e], | |
u = [t]; | |
if (!s || !a) return e === i ? -1 : t === i ? 1 : s ? -1 : a ? 1 : k ? tt.call(k, e) - tt.call(k, t) : 0; | |
if (s === a) return o(e, t); | |
for (n = e; n = n.parentNode;) c.unshift(n); | |
for (n = t; n = n.parentNode;) u.unshift(n); | |
for (; c[r] === u[r];) r++; | |
return r ? o(c[r], u[r]) : c[r] === B ? -1 : u[r] === B ? 1 : 0 | |
}, i) : L | |
}, t.matches = function (e, i) { | |
return t(e, null, null, i) | |
}, t.matchesSelector = function (e, i) { | |
if ((e.ownerDocument || e) !== L && x(e), i = i.replace(dt, "='$1']"), !(!b.matchesSelector || !N || F && F.test(i) || O && O.test(i))) try { | |
var n = U.call(e, i); | |
if (n || b.disconnectedMatch || e.document && 11 !== e.document.nodeType) return n | |
} catch (r) {} | |
return t(i, L, null, [e]).length > 0 | |
}, t.contains = function (e, t) { | |
return (e.ownerDocument || e) !== L && x(e), $(e, t) | |
}, t.attr = function (e, t) { | |
(e.ownerDocument || e) !== L && x(e); | |
var i = C.attrHandle[t.toLowerCase()], | |
n = i && Y.call(C.attrHandle, t.toLowerCase()) ? i(e, t, !N) : void 0; | |
return void 0 !== n ? n : b.attributes || !N ? e.getAttribute(t) : (n = e.getAttributeNode(t)) && n.specified ? n.value : null | |
}, t.error = function (e) { | |
throw new Error("Syntax error, unrecognized expression: " + e) | |
}, t.uniqueSort = function (e) { | |
var t, i = [], | |
n = 0, | |
r = 0; | |
if (M = !b.detectDuplicates, k = !b.sortStable && e.slice(0), e.sort(V), M) { | |
for (; t = e[r++];) t === e[r] && (n = i.push(r)); | |
for (; n--;) e.splice(i[n], 1) | |
} | |
return k = null, e | |
}, S = t.getText = function (e) { | |
var t, i = "", | |
n = 0, | |
r = e.nodeType; | |
if (r) { | |
if (1 === r || 9 === r || 11 === r) { | |
if ("string" == typeof e.textContent) return e.textContent; | |
for (e = e.firstChild; e; e = e.nextSibling) i += S(e) | |
} else if (3 === r || 4 === r) return e.nodeValue | |
} else | |
for (; t = e[n++];) i += S(t); | |
return i | |
}, C = t.selectors = { | |
cacheLength: 50, | |
createPseudo: n, | |
match: ft, | |
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(wt, _t), e[3] = (e[4] || e[5] || "").replace(wt, _t), "~=" === e[2] && (e[3] = " " + e[3] + " "), e.slice(0, 4) | |
}, | |
CHILD: function (e) { | |
return e[1] = e[1].toLowerCase(), "nth" === e[1].slice(0, 3) ? (e[3] || t.error(e[0]), e[4] = +(e[4] ? e[5] + (e[6] || 1) : 2 * ("even" === e[3] || "odd" === e[3])), e[5] = +(e[7] + e[8] || "odd" === e[3])) : e[3] && t.error(e[0]), e | |
}, | |
PSEUDO: function (e) { | |
var t, i = !e[5] && e[2]; | |
return ft.CHILD.test(e[0]) ? null : (e[3] && void 0 !== e[4] ? e[2] = e[4] : i && ht.test(i) && (t = h(i, !0)) && (t = i.indexOf(")", i.length - t) - i.length) && (e[0] = e[0].slice(0, t), e[2] = i.slice(0, t)), e.slice(0, 3)) | |
} | |
}, | |
filter: { | |
TAG: function (e) { | |
var t = e.replace(wt, _t).toLowerCase(); | |
return "*" === e ? function () { | |
return !0 | |
} : function (e) { | |
return e.nodeName && e.nodeName.toLowerCase() === t | |
} | |
}, | |
CLASS: function (e) { | |
var t = W[e + " "]; | |
return t || (t = new RegExp("(^|" + nt + ")" + e + "(" + nt + "|$)")) && W(e, function (e) { | |
return t.test("string" == typeof e.className && e.className || typeof e.getAttribute !== z && e.getAttribute("class") || "") | |
}) | |
}, | |
ATTR: function (e, i, n) { | |
return function (r) { | |
var s = t.attr(r, e); | |
return null == s ? "!=" === i : i ? (s += "", "=" === i ? s === n : "!=" === i ? s !== n : "^=" === i ? n && 0 === s.indexOf(n) : "*=" === i ? n && s.indexOf(n) > -1 : "$=" === i ? n && s.slice(-n.length) === n : "~=" === i ? (" " + s + " ").indexOf(n) > -1 : "|=" === i ? s === n || s.slice(0, n.length + 1) === n + "-" : !1) : !0 | |
} | |
}, | |
CHILD: function (e, t, i, n, r) { | |
var s = "nth" !== e.slice(0, 3), | |
o = "last" !== e.slice(-4), | |
a = "of-type" === t; | |
return 1 === n && 0 === r ? function (e) { | |
return !!e.parentNode | |
} : function (t, i, c) { | |
var u, l, d, h, p, f, m = s !== o ? "nextSibling" : "previousSibling", | |
g = t.parentNode, | |
T = a && t.nodeName.toLowerCase(), | |
v = !c && !a; | |
if (g) { | |
if (s) { | |
for (; m;) { | |
for (d = t; d = d[m];) | |
if (a ? d.nodeName.toLowerCase() === T : 1 === d.nodeType) return !1; | |
f = m = "only" === e && !f && "nextSibling" | |
} | |
return !0 | |
} | |
if (f = [o ? g.firstChild : g.lastChild], o && v) { | |
for (l = g[P] || (g[P] = {}), u = l[e] || [], p = u[0] === j && u[1], h = u[0] === j && u[2], d = p && g.childNodes[p]; d = ++p && d && d[m] || (h = p = 0) || f.pop();) | |
if (1 === d.nodeType && ++h && d === t) { | |
l[e] = [j, p, h]; | |
break | |
} | |
} else if (v && (u = (t[P] || (t[P] = {}))[e]) && u[0] === j) h = u[1]; | |
else | |
for (; | |
(d = ++p && d && d[m] || (h = p = 0) || f.pop()) && ((a ? d.nodeName.toLowerCase() !== T : 1 !== d.nodeType) || !++h || (v && ((d[P] || (d[P] = {}))[e] = [j, h]), d !== t));); | |
return h -= r, h === n || h % n === 0 && h / n >= 0 | |
} | |
} | |
}, | |
PSEUDO: function (e, i) { | |
var r, s = C.pseudos[e] || C.setFilters[e.toLowerCase()] || t.error("unsupported pseudo: " + e); | |
return s[P] ? s(i) : s.length > 1 ? (r = [e, e, "", i], C.setFilters.hasOwnProperty(e.toLowerCase()) ? n(function (e, t) { | |
for (var n, r = s(e, i), o = r.length; o--;) n = tt.call(e, r[o]), e[n] = !(t[n] = r[o]) | |
}) : function (e) { | |
return s(e, 0, r) | |
}) : s | |
} | |
}, | |
pseudos: { | |
not: n(function (e) { | |
var t = [], | |
i = [], | |
r = A(e.replace(ct, "$1")); | |
return r[P] ? n(function (e, t, i, n) { | |
for (var s, o = r(e, null, n, []), a = e.length; a--;)(s = o[a]) && (e[a] = !(t[a] = s)) | |
}) : function (e, n, s) { | |
return t[0] = e, r(t, null, s, i), !i.pop() | |
} | |
}), | |
has: n(function (e) { | |
return function (i) { | |
return t(e, i).length > 0 | |
} | |
}), | |
contains: n(function (e) { | |
return function (t) { | |
return (t.textContent || t.innerText || S(t)).indexOf(e) > -1 | |
} | |
}), | |
lang: n(function (e) { | |
return pt.test(e || "") || t.error("unsupported lang: " + e), e = e.replace(wt, _t).toLowerCase(), | |
function (t) { | |
var i; | |
do | |
if (i = N ? t.lang : t.getAttribute("xml:lang") || t.getAttribute("lang")) return i = i.toLowerCase(), i === e || 0 === i.indexOf(e + "-"); | |
while ((t = t.parentNode) && 1 === t.nodeType); | |
return !1 | |
} | |
}), | |
target: function (t) { | |
var i = e.location && e.location.hash; | |
return i && i.slice(1) === t.id | |
}, | |
root: function (e) { | |
return e === R | |
}, | |
focus: function (e) { | |
return e === L.activeElement && (!L.hasFocus || L.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 "input" === t && !!e.checked || "option" === t && !!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 !C.pseudos.empty(e) | |
}, | |
header: function (e) { | |
return gt.test(e.nodeName) | |
}, | |
input: function (e) { | |
return mt.test(e.nodeName) | |
}, | |
button: function (e) { | |
var t = e.nodeName.toLowerCase(); | |
return "input" === t && "button" === e.type || "button" === t | |
}, | |
text: function (e) { | |
var t; | |
return "input" === e.nodeName.toLowerCase() && "text" === e.type && (null == (t = e.getAttribute("type")) || "text" === t.toLowerCase()) | |
}, | |
first: u(function () { | |
return [0] | |
}), | |
last: u(function (e, t) { | |
return [t - 1] | |
}), | |
eq: u(function (e, t, i) { | |
return [0 > i ? i + t : i] | |
}), | |
even: u(function (e, t) { | |
for (var i = 0; t > i; i += 2) e.push(i); | |
return e | |
}), | |
odd: u(function (e, t) { | |
for (var i = 1; t > i; i += 2) e.push(i); | |
return e | |
}), | |
lt: u(function (e, t, i) { | |
for (var n = 0 > i ? i + t : i; --n >= 0;) e.push(n); | |
return e | |
}), | |
gt: u(function (e, t, i) { | |
for (var n = 0 > i ? i + t : i; ++n < t;) e.push(n); | |
return e | |
}) | |
} | |
}, C.pseudos.nth = C.pseudos.eq; | |
for (_ in { | |
radio: !0, | |
checkbox: !0, | |
file: !0, | |
password: !0, | |
image: !0 | |
}) C.pseudos[_] = a(_); | |
for (_ in { | |
submit: !0, | |
reset: !0 | |
}) C.pseudos[_] = c(_); | |
return d.prototype = C.filters = C.pseudos, C.setFilters = new d, A = t.compile = function (e, t) { | |
var i, n = [], | |
r = [], | |
s = G[e + " "]; | |
if (!s) { | |
for (t || (t = h(e)), i = t.length; i--;) s = v(t[i]), s[P] ? n.push(s) : r.push(s); | |
s = G(e, y(r, n)) | |
} | |
return s | |
}, b.sortStable = P.split("").sort(V).join("") === P, b.detectDuplicates = !!M, x(), b.sortDetached = r(function (e) { | |
return 1 & e.compareDocumentPosition(L.createElement("div")) | |
}), r(function (e) { | |
return e.innerHTML = "<a href='#'></a>", "#" === e.firstChild.getAttribute("href") | |
}) || s("type|href|height|width", function (e, t, i) { | |
return i ? void 0 : e.getAttribute(t, "type" === t.toLowerCase() ? 1 : 2) | |
}), b.attributes && r(function (e) { | |
return e.innerHTML = "<input/>", e.firstChild.setAttribute("value", ""), "" === e.firstChild.getAttribute("value") | |
}) || s("value", function (e, t, i) { | |
return i || "input" !== e.nodeName.toLowerCase() ? void 0 : e.defaultValue | |
}), r(function (e) { | |
return null == e.getAttribute("disabled") | |
}) || s(it, function (e, t, i) { | |
var n; | |
return i ? void 0 : e[t] === !0 ? t.toLowerCase() : (n = e.getAttributeNode(t)) && n.specified ? n.value : null | |
}), t | |
}(e); | |
et.find = rt, et.expr = rt.selectors, et.expr[":"] = et.expr.pseudos, et.unique = rt.uniqueSort, et.text = rt.getText, et.isXMLDoc = rt.isXML, et.contains = rt.contains; | |
var st = et.expr.match.needsContext, | |
ot = /^<(\w+)\s*\/?>(?:<\/\1>|)$/, | |
at = /^.[^:#\[\.,]*$/; | |
et.filter = function (e, t, i) { | |
var n = t[0]; | |
return i && (e = ":not(" + e + ")"), 1 === t.length && 1 === n.nodeType ? et.find.matchesSelector(n, e) ? [n] : [] : et.find.matches(e, et.grep(t, function (e) { | |
return 1 === e.nodeType | |
})) | |
}, et.fn.extend({ | |
find: function (e) { | |
var t, i = this.length, | |
n = [], | |
r = this; | |
if ("string" != typeof e) return this.pushStack(et(e).filter(function () { | |
for (t = 0; i > t; t++) | |
if (et.contains(r[t], this)) return !0 | |
})); | |
for (t = 0; i > t; t++) et.find(e, r[t], n); | |
return n = this.pushStack(i > 1 ? et.unique(n) : n), n.selector = this.selector ? this.selector + " " + e : e, n | |
}, | |
filter: function (e) { | |
return this.pushStack(n(this, e || [], !1)) | |
}, | |
not: function (e) { | |
return this.pushStack(n(this, e || [], !0)) | |
}, | |
is: function (e) { | |
return !!n(this, "string" == typeof e && st.test(e) ? et(e) : e || [], !1).length | |
} | |
}); | |
var ct, ut = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/, | |
lt = et.fn.init = function (e, t) { | |
var i, n; | |
if (!e) return this; | |
if ("string" == typeof e) { | |
if (i = "<" === e[0] && ">" === e[e.length - 1] && e.length >= 3 ? [null, e, null] : ut.exec(e), !i || !i[1] && t) return !t || t.jquery ? (t || ct).find(e) : this.constructor(t).find(e); | |
if (i[1]) { | |
if (t = t instanceof et ? t[0] : t, et.merge(this, et.parseHTML(i[1], t && t.nodeType ? t.ownerDocument || t : J, !0)), ot.test(i[1]) && et.isPlainObject(t)) | |
for (i in t) et.isFunction(this[i]) ? this[i](t[i]) : this.attr(i, t[i]); | |
return this | |
} | |
return n = J.getElementById(i[2]), n && n.parentNode && (this.length = 1, this[0] = n), this.context = J, this.selector = e, this | |
} | |
return e.nodeType ? (this.context = this[0] = e, this.length = 1, this) : et.isFunction(e) ? "undefined" != typeof ct.ready ? ct.ready(e) : e(et) : (void 0 !== e.selector && (this.selector = e.selector, this.context = e.context), et.makeArray(e, this)) | |
}; | |
lt.prototype = et.fn, ct = et(J); | |
var dt = /^(?:parents|prev(?:Until|All))/, | |
ht = { | |
children: !0, | |
contents: !0, | |
next: !0, | |
prev: !0 | |
}; | |
et.extend({ | |
dir: function (e, t, i) { | |
for (var n = [], r = void 0 !== i; | |
(e = e[t]) && 9 !== e.nodeType;) | |
if (1 === e.nodeType) { | |
if (r && et(e).is(i)) break; | |
n.push(e) | |
} | |
return n | |
}, | |
sibling: function (e, t) { | |
for (var i = []; e; e = e.nextSibling) 1 === e.nodeType && e !== t && i.push(e); | |
return i | |
} | |
}), et.fn.extend({ | |
has: function (e) { | |
var t = et(e, this), | |
i = t.length; | |
return this.filter(function () { | |
for (var e = 0; i > e; e++) | |
if (et.contains(this, t[e])) return !0 | |
}) | |
}, | |
closest: function (e, t) { | |
for (var i, n = 0, r = this.length, s = [], o = st.test(e) || "string" != typeof e ? et(e, t || this.context) : 0; r > n; n++) | |
for (i = this[n]; i && i !== t; i = i.parentNode) | |
if (i.nodeType < 11 && (o ? o.index(i) > -1 : 1 === i.nodeType && et.find.matchesSelector(i, e))) { | |
s.push(i); | |
break | |
} | |
return this.pushStack(s.length > 1 ? et.unique(s) : s) | |
}, | |
index: function (e) { | |
return e ? "string" == typeof e ? V.call(et(e), this[0]) : V.call(this, e.jquery ? e[0] : e) : this[0] && this[0].parentNode ? this.first().prevAll().length : -1 | |
}, | |
add: function (e, t) { | |
return this.pushStack(et.unique(et.merge(this.get(), et(e, t)))) | |
}, | |
addBack: function (e) { | |
return this.add(null == e ? this.prevObject : this.prevObject.filter(e)) | |
} | |
}), et.each({ | |
parent: function (e) { | |
var t = e.parentNode; | |
return t && 11 !== t.nodeType ? t : null | |
}, | |
parents: function (e) { | |
return et.dir(e, "parentNode") | |
}, | |
parentsUntil: function (e, t, i) { | |
return et.dir(e, "parentNode", i) | |
}, | |
next: function (e) { | |
return r(e, "nextSibling") | |
}, | |
prev: function (e) { | |
return r(e, "previousSibling") | |
}, | |
nextAll: function (e) { | |
return et.dir(e, "nextSibling") | |
}, | |
prevAll: function (e) { | |
return et.dir(e, "previousSibling") | |
}, | |
nextUntil: function (e, t, i) { | |
return et.dir(e, "nextSibling", i) | |
}, | |
prevUntil: function (e, t, i) { | |
return et.dir(e, "previousSibling", i) | |
}, | |
siblings: function (e) { | |
return et.sibling((e.parentNode || {}).firstChild, e) | |
}, | |
children: function (e) { | |
return et.sibling(e.firstChild) | |
}, | |
contents: function (e) { | |
return e.contentDocument || et.merge([], e.childNodes) | |
} | |
}, function (e, t) { | |
et.fn[e] = function (i, n) { | |
var r = et.map(this, t, i); | |
return "Until" !== e.slice(-5) && (n = i), n && "string" == typeof n && (r = et.filter(n, r)), this.length > 1 && (ht[e] || et.unique(r), dt.test(e) && r.reverse()), this.pushStack(r) | |
} | |
}); | |
var pt = /\S+/g, | |
ft = {}; | |
et.Callbacks = function (e) { | |
e = "string" == typeof e ? ft[e] || s(e) : et.extend({}, e); | |
var t, i, n, r, o, a, c = [], | |
u = !e.once && [], | |
l = function (s) { | |
for (t = e.memory && s, i = !0, a = r || 0, r = 0, o = c.length, n = !0; c && o > a; a++) | |
if (c[a].apply(s[0], s[1]) === !1 && e.stopOnFalse) { | |
t = !1; | |
break | |
} | |
n = !1, c && (u ? u.length && l(u.shift()) : t ? c = [] : d.disable()) | |
}, | |
d = { | |
add: function () { | |
if (c) { | |
var i = c.length; | |
! function s(t) { | |
et.each(t, function (t, i) { | |
var n = et.type(i); | |
"function" === n ? e.unique && d.has(i) || c.push(i) : i && i.length && "string" !== n && s(i) | |
}) | |
}(arguments), n ? o = c.length : t && (r = i, l(t)) | |
} | |
return this | |
}, | |
remove: function () { | |
return c && et.each(arguments, function (e, t) { | |
for (var i; | |
(i = et.inArray(t, c, i)) > -1;) c.splice(i, 1), n && (o >= i && o--, a >= i && a--) | |
}), this | |
}, | |
has: function (e) { | |
return e ? et.inArray(e, c) > -1 : !(!c || !c.length) | |
}, | |
empty: function () { | |
return c = [], o = 0, this | |
}, | |
disable: function () { | |
return c = u = t = void 0, this | |
}, | |
disabled: function () { | |
return !c | |
}, | |
lock: function () { | |
return u = void 0, t || d.disable(), this | |
}, | |
locked: function () { | |
return !u | |
}, | |
fireWith: function (e, t) { | |
return !c || i && !u || (t = t || [], t = [e, t.slice ? t.slice() : t], n ? u.push(t) : l(t)), this | |
}, | |
fire: function () { | |
return d.fireWith(this, arguments), this | |
}, | |
fired: function () { | |
return !!i | |
} | |
}; | |
return d | |
}, et.extend({ | |
Deferred: function (e) { | |
var t = [ | |
["resolve", "done", et.Callbacks("once memory"), "resolved"], | |
["reject", "fail", et.Callbacks("once memory"), "rejected"], | |
["notify", "progress", et.Callbacks("memory")] | |
], | |
i = "pending", | |
n = { | |
state: function () { | |
return i | |
}, | |
always: function () { | |
return r.done(arguments).fail(arguments), this | |
}, | |
then: function () { | |
var e = arguments; | |
return et.Deferred(function (i) { | |
et.each(t, function (t, s) { | |
var o = et.isFunction(e[t]) && e[t]; | |
r[s[1]](function () { | |
var e = o && o.apply(this, arguments); | |
e && et.isFunction(e.promise) ? e.promise().done(i.resolve).fail(i.reject).progress(i.notify) : i[s[0] + "With"](this === n ? i.promise() : this, o ? [e] : arguments) | |
}) | |
}), e = null | |
}).promise() | |
}, | |
promise: function (e) { | |
return null != e ? et.extend(e, n) : n | |
} | |
}, | |
r = {}; | |
return n.pipe = n.then, et.each(t, function (e, s) { | |
var o = s[2], | |
a = s[3]; | |
n[s[1]] = o.add, a && o.add(function () { | |
i = a | |
}, t[1 ^ e][2].disable, t[2][2].lock), r[s[0]] = function () { | |
return r[s[0] + "With"](this === r ? n : this, arguments), this | |
}, r[s[0] + "With"] = o.fireWith | |
}), n.promise(r), e && e.call(r, r), r | |
}, | |
when: function (e) { | |
var t, i, n, r = 0, | |
s = W.call(arguments), | |
o = s.length, | |
a = 1 !== o || e && et.isFunction(e.promise) ? o : 0, | |
c = 1 === a ? e : et.Deferred(), | |
u = function (e, i, n) { | |
return function (r) { | |
i[e] = this, n[e] = arguments.length > 1 ? W.call(arguments) : r, n === t ? c.notifyWith(i, n) : --a || c.resolveWith(i, n) | |
} | |
}; | |
if (o > 1) | |
for (t = new Array(o), i = new Array(o), n = new Array(o); o > r; r++) s[r] && et.isFunction(s[r].promise) ? s[r].promise().done(u(r, n, s)).fail(c.reject).progress(u(r, i, t)) : --a; | |
return a || c.resolveWith(n, s), c.promise() | |
} | |
}); | |
var mt; | |
et.fn.ready = function (e) { | |
return et.ready.promise().done(e), this | |
}, et.extend({ | |
isReady: !1, | |
readyWait: 1, | |
holdReady: function (e) { | |
e ? et.readyWait++ : et.ready(!0) | |
}, | |
ready: function (e) { | |
(e === !0 ? --et.readyWait : et.isReady) || (et.isReady = !0, e !== !0 && --et.readyWait > 0 || (mt.resolveWith(J, [et]), et.fn.trigger && et(J).trigger("ready").off("ready"))) | |
} | |
}), et.ready.promise = function (t) { | |
return mt || (mt = et.Deferred(), "complete" === J.readyState ? setTimeout(et.ready) : (J.addEventListener("DOMContentLoaded", o, !1), e.addEventListener("load", o, !1))), mt.promise(t) | |
}, et.ready.promise(); | |
var gt = et.access = function (e, t, i, n, r, s, o) { | |
var a = 0, | |
c = e.length, | |
u = null == i; | |
if ("object" === et.type(i)) { | |
r = !0; | |
for (a in i) et.access(e, t, a, i[a], !0, s, o) | |
} else if (void 0 !== n && (r = !0, et.isFunction(n) || (o = !0), u && (o ? (t.call(e, n), t = null) : (u = t, t = function (e, t, i) { | |
return u.call(et(e), i) | |
})), t)) | |
for (; c > a; a++) t(e[a], i, o ? n : n.call(e[a], a, t(e[a], i))); | |
return r ? e : u ? t.call(e) : c ? t(e[0], i) : s | |
}; | |
et.acceptData = function (e) { | |
return 1 === e.nodeType || 9 === e.nodeType || !+e.nodeType | |
}, a.uid = 1, a.accepts = et.acceptData, a.prototype = { | |
key: function (e) { | |
if (!a.accepts(e)) return 0; | |
var t = {}, | |
i = e[this.expando]; | |
if (!i) { | |
i = a.uid++; | |
try { | |
t[this.expando] = { | |
value: i | |
}, Object.defineProperties(e, t) | |
} catch (n) { | |
t[this.expando] = i, et.extend(e, t) | |
} | |
} | |
return this.cache[i] || (this.cache[i] = {}), i | |
}, | |
set: function (e, t, i) { | |
var n, r = this.key(e), | |
s = this.cache[r]; | |
if ("string" == typeof t) s[t] = i; | |
else if (et.isEmptyObject(s)) et.extend(this.cache[r], t); | |
else | |
for (n in t) s[n] = t[n]; | |
return s | |
}, | |
get: function (e, t) { | |
var i = this.cache[this.key(e)]; | |
return void 0 === t ? i : i[t] | |
}, | |
access: function (e, t, i) { | |
var n; | |
return void 0 === t || t && "string" == typeof t && void 0 === i ? (n = this.get(e, t), void 0 !== n ? n : this.get(e, et.camelCase(t))) : (this.set(e, t, i), void 0 !== i ? i : t) | |
}, | |
remove: function (e, t) { | |
var i, n, r, s = this.key(e), | |
o = this.cache[s]; | |
if (void 0 === t) this.cache[s] = {}; | |
else { | |
et.isArray(t) ? n = t.concat(t.map(et.camelCase)) : (r = et.camelCase(t), t in o ? n = [t, r] : (n = r, n = n in o ? [n] : n.match(pt) || [])), i = n.length; | |
for (; i--;) delete o[n[i]] | |
} | |
}, | |
hasData: function (e) { | |
return !et.isEmptyObject(this.cache[e[this.expando]] || {}) | |
}, | |
discard: function (e) { | |
e[this.expando] && delete this.cache[e[this.expando]] | |
} | |
}; | |
var Tt = new a, | |
vt = new a, | |
yt = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/, | |
Dt = /([A-Z])/g; | |
et.extend({ | |
hasData: function (e) { | |
return vt.hasData(e) || Tt.hasData(e) | |
}, | |
data: function (e, t, i) { | |
return vt.access(e, t, i) | |
}, | |
removeData: function (e, t) { | |
vt.remove(e, t) | |
}, | |
_data: function (e, t, i) { | |
return Tt.access(e, t, i) | |
}, | |
_removeData: function (e, t) { | |
Tt.remove(e, t) | |
} | |
}), et.fn.extend({ | |
data: function (e, t) { | |
var i, n, r, s = this[0], | |
o = s && s.attributes; | |
if (void 0 === e) { | |
if (this.length && (r = vt.get(s), 1 === s.nodeType && !Tt.get(s, "hasDataAttrs"))) { | |
for (i = o.length; i--;) n = o[i].name, 0 === n.indexOf("data-") && (n = et.camelCase(n.slice(5)), c(s, n, r[n])); | |
Tt.set(s, "hasDataAttrs", !0) | |
} | |
return r | |
} | |
return "object" == typeof e ? this.each(function () { | |
vt.set(this, e) | |
}) : gt(this, function (t) { | |
var i, n = et.camelCase(e); | |
if (s && void 0 === t) { | |
if (i = vt.get(s, e), void 0 !== i) return i; | |
if (i = vt.get(s, n), void 0 !== i) return i; | |
if (i = c(s, n, void 0), void 0 !== i) return i | |
} else this.each(function () { | |
var i = vt.get(this, n); | |
vt.set(this, n, t), -1 !== e.indexOf("-") && void 0 !== i && vt.set(this, e, t) | |
}) | |
}, null, t, arguments.length > 1, null, !0) | |
}, | |
removeData: function (e) { | |
return this.each(function () { | |
vt.remove(this, e) | |
}) | |
} | |
}), et.extend({ | |
queue: function (e, t, i) { | |
var n; | |
return e ? (t = (t || "fx") + "queue", n = Tt.get(e, t), i && (!n || et.isArray(i) ? n = Tt.access(e, t, et.makeArray(i)) : n.push(i)), n || []) : void 0 | |
}, | |
dequeue: function (e, t) { | |
t = t || "fx"; | |
var i = et.queue(e, t), | |
n = i.length, | |
r = i.shift(), | |
s = et._queueHooks(e, t), | |
o = function () { | |
et.dequeue(e, t) | |
}; | |
"inprogress" === r && (r = i.shift(), n--), r && ("fx" === t && i.unshift("inprogress"), delete s.stop, r.call(e, o, s)), !n && s && s.empty.fire() | |
}, | |
_queueHooks: function (e, t) { | |
var i = t + "queueHooks"; | |
return Tt.get(e, i) || Tt.access(e, i, { | |
empty: et.Callbacks("once memory").add(function () { | |
Tt.remove(e, [t + "queue", i]) | |
}) | |
}) | |
} | |
}), et.fn.extend({ | |
queue: function (e, t) { | |
var i = 2; | |
return "string" != typeof e && (t = e, e = "fx", i--), arguments.length < i ? et.queue(this[0], e) : void 0 === t ? this : this.each(function () { | |
var i = et.queue(this, e, t); | |
et._queueHooks(this, e), "fx" === e && "inprogress" !== i[0] && et.dequeue(this, e) | |
}) | |
}, | |
dequeue: function (e) { | |
return this.each(function () { | |
et.dequeue(this, e) | |
}) | |
}, | |
clearQueue: function (e) { | |
return this.queue(e || "fx", []) | |
}, | |
promise: function (e, t) { | |
var i, n = 1, | |
r = et.Deferred(), | |
s = this, | |
o = this.length, | |
a = function () { | |
--n || r.resolveWith(s, [s]) | |
}; | |
for ("string" != typeof e && (t = e, e = void 0), e = e || "fx"; o--;) i = Tt.get(s[o], e + "queueHooks"), i && i.empty && (n++, i.empty.add(a)); | |
return a(), r.promise(t) | |
} | |
}); | |
var wt = /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source, | |
_t = ["Top", "Right", "Bottom", "Left"], | |
bt = function (e, t) { | |
return e = t || e, "none" === et.css(e, "display") || !et.contains(e.ownerDocument, e) | |
}, | |
Ct = /^(?:checkbox|radio)$/i; | |
! function () { | |
var e = J.createDocumentFragment(), | |
t = e.appendChild(J.createElement("div")); | |
t.innerHTML = "<input type='radio' checked='checked' name='t'/>", X.checkClone = t.cloneNode(!0).cloneNode(!0).lastChild.checked, t.innerHTML = "<textarea>x</textarea>", X.noCloneChecked = !!t.cloneNode(!0).lastChild.defaultValue | |
}(); | |
var St = "undefined"; | |
X.focusinBubbles = "onfocusin" in e; | |
var Et = /^key/, | |
At = /^(?:mouse|contextmenu)|click/, | |
It = /^(?:focusinfocus|focusoutblur)$/, | |
kt = /^([^.]*)(?:\.(.+)|)$/; | |
et.event = { | |
global: {}, | |
add: function (e, t, i, n, r) { | |
var s, o, a, c, u, l, d, h, p, f, m, g = Tt.get(e); | |
if (g) | |
for (i.handler && (s = i, i = s.handler, r = s.selector), i.guid || (i.guid = et.guid++), (c = g.events) || (c = g.events = {}), (o = g.handle) || (o = g.handle = function (t) { | |
return typeof et !== St && et.event.triggered !== t.type ? et.event.dispatch.apply(e, arguments) : void 0 | |
}), t = (t || "").match(pt) || [""], u = t.length; u--;) a = kt.exec(t[u]) || [], p = m = a[1], f = (a[2] || "").split(".").sort(), p && (d = et.event.special[p] || {}, p = (r ? d.delegateType : d.bindType) || p, d = et.event.special[p] || {}, l = et.extend({ | |
type: p, | |
origType: m, | |
data: n, | |
handler: i, | |
guid: i.guid, | |
selector: r, | |
needsContext: r && et.expr.match.needsContext.test(r), | |
namespace: f.join(".") | |
}, s), (h = c[p]) || (h = c[p] = [], h.delegateCount = 0, d.setup && d.setup.call(e, n, f, o) !== !1 || e.addEventListener && e.addEventListener(p, o, !1)), d.add && (d.add.call(e, l), l.handler.guid || (l.handler.guid = i.guid)), r ? h.splice(h.delegateCount++, 0, l) : h.push(l), et.event.global[p] = !0) | |
}, | |
remove: function (e, t, i, n, r) { | |
var s, o, a, c, u, l, d, h, p, f, m, g = Tt.hasData(e) && Tt.get(e); | |
if (g && (c = g.events)) { | |
for (t = (t || "").match(pt) || [""], u = t.length; u--;) | |
if (a = kt.exec(t[u]) || [], p = m = a[1], f = (a[2] || "").split(".").sort(), p) { | |
for (d = et.event.special[p] || {}, p = (n ? d.delegateType : d.bindType) || p, h = c[p] || [], a = a[2] && new RegExp("(^|\\.)" + f.join("\\.(?:.*\\.|)") + "(\\.|$)"), o = s = h.length; s--;) l = h[s], !r && m !== l.origType || i && i.guid !== l.guid || a && !a.test(l.namespace) || n && n !== l.selector && ("**" !== n || !l.selector) || (h.splice(s, 1), l.selector && h.delegateCount--, d.remove && d.remove.call(e, l)); | |
o && !h.length && (d.teardown && d.teardown.call(e, f, g.handle) !== !1 || et.removeEvent(e, p, g.handle), delete c[p]) | |
} else | |
for (p in c) et.event.remove(e, p + t[u], i, n, !0); | |
et.isEmptyObject(c) && (delete g.handle, Tt.remove(e, "events")) | |
} | |
}, | |
trigger: function (t, i, n, r) { | |
var s, o, a, c, u, l, d, h = [n || J], | |
p = Y.call(t, "type") ? t.type : t, | |
f = Y.call(t, "namespace") ? t.namespace.split(".") : []; | |
if (o = a = n = n || J, 3 !== n.nodeType && 8 !== n.nodeType && !It.test(p + et.event.triggered) && (p.indexOf(".") >= 0 && (f = p.split("."), p = f.shift(), f.sort()), u = p.indexOf(":") < 0 && "on" + p, t = t[et.expando] ? t : new et.Event(p, "object" == typeof t && t), t.isTrigger = r ? 2 : 3, t.namespace = f.join("."), t.namespace_re = t.namespace ? new RegExp("(^|\\.)" + f.join("\\.(?:.*\\.|)") + "(\\.|$)") : null, t.result = void 0, t.target || (t.target = n), i = null == i ? [t] : et.makeArray(i, [t]), d = et.event.special[p] || {}, r || !d.trigger || d.trigger.apply(n, i) !== !1)) { | |
if (!r && !d.noBubble && !et.isWindow(n)) { | |
for (c = d.delegateType || p, It.test(c + p) || (o = o.parentNode); o; o = o.parentNode) h.push(o), a = o; | |
a === (n.ownerDocument || J) && h.push(a.defaultView || a.parentWindow || e) | |
} | |
for (s = 0; | |
(o = h[s++]) && !t.isPropagationStopped();) t.type = s > 1 ? c : d.bindType || p, l = (Tt.get(o, "events") || {})[t.type] && Tt.get(o, "handle"), l && l.apply(o, i), l = u && o[u], l && l.apply && et.acceptData(o) && (t.result = l.apply(o, i), t.result === !1 && t.preventDefault()); | |
return t.type = p, r || t.isDefaultPrevented() || d._default && d._default.apply(h.pop(), i) !== !1 || !et.acceptData(n) || u && et.isFunction(n[p]) && !et.isWindow(n) && (a = n[u], a && (n[u] = null), et.event.triggered = p, n[p](), et.event.triggered = void 0, a && (n[u] = a)), t.result | |
} | |
}, | |
dispatch: function (e) { | |
e = et.event.fix(e); | |
var t, i, n, r, s, o = [], | |
a = W.call(arguments), | |
c = (Tt.get(this, "events") || {})[e.type] || [], | |
u = et.event.special[e.type] || {}; | |
if (a[0] = e, e.delegateTarget = this, !u.preDispatch || u.preDispatch.call(this, e) !== !1) { | |
for (o = et.event.handlers.call(this, e, c), t = 0; | |
(r = o[t++]) && !e.isPropagationStopped();) | |
for (e.currentTarget = r.elem, i = 0; | |
(s = r.handlers[i++]) && !e.isImmediatePropagationStopped();)(!e.namespace_re || e.namespace_re.test(s.namespace)) && (e.handleObj = s, e.data = s.data, n = ((et.event.special[s.origType] || {}).handle || s.handler).apply(r.elem, a), void 0 !== n && (e.result = n) === !1 && (e.preventDefault(), e.stopPropagation())); | |
return u.postDispatch && u.postDispatch.call(this, e), e.result | |
} | |
}, | |
handlers: function (e, t) { | |
var i, n, r, s, o = [], | |
a = t.delegateCount, | |
c = e.target; | |
if (a && c.nodeType && (!e.button || "click" !== e.type)) | |
for (; c !== this; c = c.parentNode || this) | |
if (c.disabled !== !0 || "click" !== e.type) { | |
for (n = [], i = 0; a > i; i++) s = t[i], r = s.selector + " ", void 0 === n[r] && (n[r] = s.needsContext ? et(r, this).index(c) >= 0 : et.find(r, this, null, [c]).length), n[r] && n.push(s); | |
n.length && o.push({ | |
elem: c, | |
handlers: n | |
}) | |
} | |
return a < t.length && o.push({ | |
elem: this, | |
handlers: t.slice(a) | |
}), o | |
}, | |
props: "altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "), | |
fixHooks: {}, | |
keyHooks: { | |
props: "char charCode key keyCode".split(" "), | |
filter: function (e, t) { | |
return null == e.which && (e.which = null != t.charCode ? t.charCode : t.keyCode), e | |
} | |
}, | |
mouseHooks: { | |
props: "button buttons clientX clientY offsetX offsetY pageX pageY screenX screenY toElement".split(" "), | |
filter: function (e, t) { | |
var i, n, r, s = t.button; | |
return null == e.pageX && null != t.clientX && (i = e.target.ownerDocument || J, n = i.documentElement, r = i.body, e.pageX = t.clientX + (n && n.scrollLeft || r && r.scrollLeft || 0) - (n && n.clientLeft || r && r.clientLeft || 0), e.pageY = t.clientY + (n && n.scrollTop || r && r.scrollTop || 0) - (n && n.clientTop || r && r.clientTop || 0)), e.which || void 0 === s || (e.which = 1 & s ? 1 : 2 & s ? 3 : 4 & s ? 2 : 0), e | |
} | |
}, | |
fix: function (e) { | |
if (e[et.expando]) return e; | |
var t, i, n, r = e.type, | |
s = e, | |
o = this.fixHooks[r]; | |
for (o || (this.fixHooks[r] = o = At.test(r) ? this.mouseHooks : Et.test(r) ? this.keyHooks : {}), n = o.props ? this.props.concat(o.props) : this.props, e = new et.Event(s), t = n.length; t--;) i = n[t], e[i] = s[i]; | |
return e.target || (e.target = J), 3 === e.target.nodeType && (e.target = e.target.parentNode), o.filter ? o.filter(e, s) : e | |
}, | |
special: { | |
load: { | |
noBubble: !0 | |
}, | |
focus: { | |
trigger: function () { | |
return this !== d() && this.focus ? (this.focus(), !1) : void 0 | |
}, | |
delegateType: "focusin" | |
}, | |
blur: { | |
trigger: function () { | |
return this === d() && this.blur ? (this.blur(), !1) : void 0 | |
}, | |
delegateType: "focusout" | |
}, | |
click: { | |
trigger: function () { | |
return "checkbox" === this.type && this.click && et.nodeName(this, "input") ? (this.click(), !1) : void 0 | |
}, | |
_default: function (e) { | |
return et.nodeName(e.target, "a") | |
} | |
}, | |
beforeunload: { | |
postDispatch: function (e) { | |
void 0 !== e.result && (e.originalEvent.returnValue = e.result) | |
} | |
} | |
}, | |
simulate: function (e, t, i, n) { | |
var r = et.extend(new et.Event, i, { | |
type: e, | |
isSimulated: !0, | |
originalEvent: {} | |
}); | |
n ? et.event.trigger(r, null, t) : et.event.dispatch.call(t, r), r.isDefaultPrevented() && i.preventDefault() | |
} | |
}, et.removeEvent = function (e, t, i) { | |
e.removeEventListener && e.removeEventListener(t, i, !1) | |
}, et.Event = function (e, t) { | |
return this instanceof et.Event ? (e && e.type ? (this.originalEvent = e, this.type = e.type, this.isDefaultPrevented = e.defaultPrevented || void 0 === e.defaultPrevented && e.getPreventDefault && e.getPreventDefault() ? u : l) : this.type = e, t && et.extend(this, t), this.timeStamp = e && e.timeStamp || et.now(), void(this[et.expando] = !0)) : new et.Event(e, t) | |
}, et.Event.prototype = { | |
isDefaultPrevented: l, | |
isPropagationStopped: l, | |
isImmediatePropagationStopped: l, | |
preventDefault: function () { | |
var e = this.originalEvent; | |
this.isDefaultPrevented = u, e && e.preventDefault && e.preventDefault() | |
}, | |
stopPropagation: function () { | |
var e = this.originalEvent; | |
this.isPropagationStopped = u, e && e.stopPropagation && e.stopPropagation() | |
}, | |
stopImmediatePropagation: function () { | |
this.isImmediatePropagationStopped = u, this.stopPropagation() | |
} | |
}, et.each({ | |
mouseenter: "mouseover", | |
mouseleave: "mouseout" | |
}, function (e, t) { | |
et.event.special[e] = { | |
delegateType: t, | |
bindType: t, | |
handle: function (e) { | |
var i, n = this, | |
r = e.relatedTarget, | |
s = e.handleObj; | |
return (!r || r !== n && !et.contains(n, r)) && (e.type = s.origType, i = s.handler.apply(this, arguments), e.type = t), i | |
} | |
} | |
}), X.focusinBubbles || et.each({ | |
focus: "focusin", | |
blur: "focusout" | |
}, function (e, t) { | |
var i = function (e) { | |
et.event.simulate(t, e.target, et.event.fix(e), !0) | |
}; | |
et.event.special[t] = { | |
setup: function () { | |
var n = this.ownerDocument || this, | |
r = Tt.access(n, t); | |
r || n.addEventListener(e, i, !0), Tt.access(n, t, (r || 0) + 1) | |
}, | |
teardown: function () { | |
var n = this.ownerDocument || this, | |
r = Tt.access(n, t) - 1; | |
r ? Tt.access(n, t, r) : (n.removeEventListener(e, i, !0), Tt.remove(n, t)) | |
} | |
} | |
}), et.fn.extend({ | |
on: function (e, t, i, n, r) { | |
var s, o; | |
if ("object" == typeof e) { | |
"string" != typeof t && (i = i || t, t = void 0); | |
for (o in e) this.on(o, t, i, e[o], r); | |
return this | |
} | |
if (null == i && null == n ? (n = t, i = t = void 0) : null == n && ("string" == typeof t ? (n = i, i = void 0) : (n = i, i = t, t = void 0)), n === !1) n = l; | |
else if (!n) return this; | |
return 1 === r && (s = n, n = function (e) { | |
return et().off(e), s.apply(this, arguments) | |
}, n.guid = s.guid || (s.guid = et.guid++)), this.each(function () { | |
et.event.add(this, e, n, i, t) | |
}) | |
}, | |
one: function (e, t, i, n) { | |
return this.on(e, t, i, n, 1) | |
}, | |
off: function (e, t, i) { | |
var n, r; | |
if (e && e.preventDefault && e.handleObj) return n = e.handleObj, et(e.delegateTarget).off(n.namespace ? n.origType + "." + n.namespace : n.origType, n.selector, n.handler), this; | |
if ("object" == typeof e) { | |
for (r in e) this.off(r, t, e[r]); | |
return this | |
} | |
return (t === !1 || "function" == typeof t) && (i = t, t = void 0), i === !1 && (i = l), this.each(function () { | |
et.event.remove(this, e, i, t) | |
}) | |
}, | |
trigger: function (e, t) { | |
return this.each(function () { | |
et.event.trigger(e, t, this) | |
}) | |
}, | |
triggerHandler: function (e, t) { | |
var i = this[0]; | |
return i ? et.event.trigger(e, t, i, !0) : void 0 | |
} | |
}); | |
var Mt = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi, | |
xt = /<([\w:]+)/, | |
Lt = /<|&#?\w+;/, | |
Rt = /<(?:script|style|link)/i, | |
Nt = /checked\s*(?:[^=]|=\s*.checked.)/i, | |
Ot = /^$|\/(?:java|ecma)script/i, | |
Ft = /^true\/(.*)/, | |
Ut = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g, | |
$t = { | |
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, "", ""] | |
}; | |
$t.optgroup = $t.option, $t.tbody = $t.tfoot = $t.colgroup = $t.caption = $t.thead, $t.th = $t.td, et.extend({ | |
clone: function (e, t, i) { | |
var n, r, s, o, a = e.cloneNode(!0), | |
c = et.contains(e.ownerDocument, e); | |
if (!(X.noCloneChecked || 1 !== e.nodeType && 11 !== e.nodeType || et.isXMLDoc(e))) | |
for (o = T(a), s = T(e), n = 0, r = s.length; r > n; n++) v(s[n], o[n]); | |
if (t) | |
if (i) | |
for (s = s || T(e), o = o || T(a), n = 0, r = s.length; r > n; n++) g(s[n], o[n]); | |
else g(e, a); | |
return o = T(a, "script"), o.length > 0 && m(o, !c && T(e, "script")), a | |
}, | |
buildFragment: function (e, t, i, n) { | |
for (var r, s, o, a, c, u, l = t.createDocumentFragment(), d = [], h = 0, p = e.length; p > h; h++) | |
if (r = e[h], r || 0 === r) | |
if ("object" === et.type(r)) et.merge(d, r.nodeType ? [r] : r); | |
else if (Lt.test(r)) { | |
for (s = s || l.appendChild(t.createElement("div")), o = (xt.exec(r) || ["", ""])[1].toLowerCase(), a = $t[o] || $t._default, s.innerHTML = a[1] + r.replace(Mt, "<$1></$2>") + a[2], u = a[0]; u--;) s = s.lastChild; | |
et.merge(d, s.childNodes), s = l.firstChild, s.textContent = "" | |
} else d.push(t.createTextNode(r)); | |
for (l.textContent = "", h = 0; r = d[h++];) | |
if ((!n || -1 === et.inArray(r, n)) && (c = et.contains(r.ownerDocument, r), s = T(l.appendChild(r), "script"), c && m(s), i)) | |
for (u = 0; r = s[u++];) Ot.test(r.type || "") && i.push(r); | |
return l | |
}, | |
cleanData: function (e) { | |
for (var t, i, n, r, s, o, a = et.event.special, c = 0; void 0 !== (i = e[c]); c++) { | |
if (et.acceptData(i) && (s = i[Tt.expando], s && (t = Tt.cache[s]))) { | |
if (n = Object.keys(t.events || {}), n.length) | |
for (o = 0; void 0 !== (r = n[o]); o++) a[r] ? et.event.remove(i, r) : et.removeEvent(i, r, t.handle); | |
Tt.cache[s] && delete Tt.cache[s] | |
} | |
delete vt.cache[i[vt.expando]] | |
} | |
} | |
}), et.fn.extend({ | |
text: function (e) { | |
return gt(this, function (e) { | |
return void 0 === e ? et.text(this) : this.empty().each(function () { | |
(1 === this.nodeType || 11 === this.nodeType || 9 === this.nodeType) && (this.textContent = e) | |
}) | |
}, null, e, arguments.length) | |
}, | |
append: function () { | |
return this.domManip(arguments, function (e) { | |
if (1 === this.nodeType || 11 === this.nodeType || 9 === this.nodeType) { | |
var t = h(this, e); | |
t.appendChild(e) | |
} | |
}) | |
}, | |
prepend: function () { | |
return this.domManip(arguments, function (e) { | |
if (1 === this.nodeType || 11 === this.nodeType || 9 === this.nodeType) { | |
var t = h(this, e); | |
t.insertBefore(e, t.firstChild) | |
} | |
}) | |
}, | |
before: function () { | |
return this.domManip(arguments, function (e) { | |
this.parentNode && this.parentNode.insertBefore(e, this) | |
}) | |
}, | |
after: function () { | |
return this.domManip(arguments, function (e) { | |
this.parentNode && this.parentNode.insertBefore(e, this.nextSibling) | |
}) | |
}, | |
remove: function (e, t) { | |
for (var i, n = e ? et.filter(e, this) : this, r = 0; null != (i = n[r]); r++) t || 1 !== i.nodeType || et.cleanData(T(i)), i.parentNode && (t && et.contains(i.ownerDocument, i) && m(T(i, "script")), i.parentNode.removeChild(i)); | |
return this | |
}, | |
empty: function () { | |
for (var e, t = 0; null != (e = this[t]); t++) 1 === e.nodeType && (et.cleanData(T(e, !1)), e.textContent = ""); | |
return this | |
}, | |
clone: function (e, t) { | |
return e = null == e ? !1 : e, t = null == t ? e : t, this.map(function () { | |
return et.clone(this, e, t) | |
}) | |
}, | |
html: function (e) { | |
return gt(this, function (e) { | |
var t = this[0] || {}, | |
i = 0, | |
n = this.length; | |
if (void 0 === e && 1 === t.nodeType) return t.innerHTML; | |
if ("string" == typeof e && !Rt.test(e) && !$t[(xt.exec(e) || ["", ""])[1].toLowerCase()]) { | |
e = e.replace(Mt, "<$1></$2>"); | |
try { | |
for (; n > i; i++) t = this[i] || {}, 1 === t.nodeType && (et.cleanData(T(t, !1)), t.innerHTML = e); | |
t = 0 | |
} catch (r) {} | |
} | |
t && this.empty().append(e) | |
}, null, e, arguments.length) | |
}, | |
replaceWith: function () { | |
var e = arguments[0]; | |
return this.domManip(arguments, function (t) { | |
e = this.parentNode, et.cleanData(T(this)), e && e.replaceChild(t, this) | |
}), e && (e.length || e.nodeType) ? this : this.remove() | |
}, | |
detach: function (e) { | |
return this.remove(e, !0) | |
}, | |
domManip: function (e, t) { | |
e = K.apply([], e); | |
var i, n, r, s, o, a, c = 0, | |
u = this.length, | |
l = this, | |
d = u - 1, | |
h = e[0], | |
m = et.isFunction(h); | |
if (m || u > 1 && "string" == typeof h && !X.checkClone && Nt.test(h)) return this.each(function (i) { | |
var n = l.eq(i); | |
m && (e[0] = h.call(this, i, n.html())), n.domManip(e, t) | |
}); | |
if (u && (i = et.buildFragment(e, this[0].ownerDocument, !1, this), n = i.firstChild, 1 === i.childNodes.length && (i = n), n)) { | |
for (r = et.map(T(i, "script"), p), s = r.length; u > c; c++) o = i, c !== d && (o = et.clone(o, !0, !0), s && et.merge(r, T(o, "script"))), t.call(this[c], o, c); | |
if (s) | |
for (a = r[r.length - 1].ownerDocument, et.map(r, f), c = 0; s > c; c++) o = r[c], Ot.test(o.type || "") && !Tt.access(o, "globalEval") && et.contains(a, o) && (o.src ? et._evalUrl && et._evalUrl(o.src) : et.globalEval(o.textContent.replace(Ut, ""))) | |
} | |
return this | |
} | |
}), et.each({ | |
appendTo: "append", | |
prependTo: "prepend", | |
insertBefore: "before", | |
insertAfter: "after", | |
replaceAll: "replaceWith" | |
}, function (e, t) { | |
et.fn[e] = function (e) { | |
for (var i, n = [], r = et(e), s = r.length - 1, o = 0; s >= o; o++) i = o === s ? this : this.clone(!0), et(r[o])[t](i), G.apply(n, i.get()); | |
return this.pushStack(n) | |
} | |
}); | |
var Pt, Bt = {}, | |
jt = /^margin/, | |
Ht = new RegExp("^(" + wt + ")(?!px)[a-z%]+$", "i"), | |
Wt = function (e) { | |
return e.ownerDocument.defaultView.getComputedStyle(e, null) | |
}; | |
! function () { | |
function t() { | |
a.style.cssText = "-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%", s.appendChild(o); | |
var t = e.getComputedStyle(a, null); | |
i = "1%" !== t.top, n = "4px" === t.width, s.removeChild(o) | |
} | |
var i, n, r = "padding:0;margin:0;border:0;display:block;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box", | |
s = J.documentElement, | |
o = J.createElement("div"), | |
a = J.createElement("div"); | |
a.style.backgroundClip = "content-box", a.cloneNode(!0).style.backgroundClip = "", X.clearCloneStyle = "content-box" === a.style.backgroundClip, o.style.cssText = "border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px", o.appendChild(a), e.getComputedStyle && et.extend(X, { | |
pixelPosition: function () { | |
return t(), i | |
}, | |
boxSizingReliable: function () { | |
return null == n && t(), n | |
}, | |
reliableMarginRight: function () { | |
var t, i = a.appendChild(J.createElement("div")); | |
return i.style.cssText = a.style.cssText = r, i.style.marginRight = i.style.width = "0", a.style.width = "1px", s.appendChild(o), t = !parseFloat(e.getComputedStyle(i, null).marginRight), s.removeChild(o), a.innerHTML = "", t | |
} | |
}) | |
}(), et.swap = function (e, t, i, n) { | |
var r, s, o = {}; | |
for (s in t) o[s] = e.style[s], e.style[s] = t[s]; | |
r = i.apply(e, n || []); | |
for (s in t) e.style[s] = o[s]; | |
return r | |
}; | |
var Kt = /^(none|table(?!-c[ea]).+)/, | |
Gt = new RegExp("^(" + wt + ")(.*)$", "i"), | |
Vt = new RegExp("^([+-])=(" + wt + ")", "i"), | |
zt = { | |
position: "absolute", | |
visibility: "hidden", | |
display: "block" | |
}, | |
qt = { | |
letterSpacing: 0, | |
fontWeight: 400 | |
}, | |
Yt = ["Webkit", "O", "Moz", "ms"]; | |
et.extend({ | |
cssHooks: { | |
opacity: { | |
get: function (e, t) { | |
if (t) { | |
var i = w(e, "opacity"); | |
return "" === i ? "1" : i | |
} | |
} | |
} | |
}, | |
cssNumber: { | |
columnCount: !0, | |
fillOpacity: !0, | |
fontWeight: !0, | |
lineHeight: !0, | |
opacity: !0, | |
order: !0, | |
orphans: !0, | |
widows: !0, | |
zIndex: !0, | |
zoom: !0 | |
}, | |
cssProps: { | |
"float": "cssFloat" | |
}, | |
style: function (e, t, i, n) { | |
if (e && 3 !== e.nodeType && 8 !== e.nodeType && e.style) { | |
var r, s, o, a = et.camelCase(t), | |
c = e.style; | |
return t = et.cssProps[a] || (et.cssProps[a] = b(c, a)), o = et.cssHooks[t] || et.cssHooks[a], void 0 === i ? o && "get" in o && void 0 !== (r = o.get(e, !1, n)) ? r : c[t] : (s = typeof i, "string" === s && (r = Vt.exec(i)) && (i = (r[1] + 1) * r[2] + parseFloat(et.css(e, t)), s = "number"), null != i && i === i && ("number" !== s || et.cssNumber[a] || (i += "px"), X.clearCloneStyle || "" !== i || 0 !== t.indexOf("background") || (c[t] = "inherit"), o && "set" in o && void 0 === (i = o.set(e, i, n)) || (c[t] = "", c[t] = i)), void 0) | |
} | |
}, | |
css: function (e, t, i, n) { | |
var r, s, o, a = et.camelCase(t); | |
return t = et.cssProps[a] || (et.cssProps[a] = b(e.style, a)), o = et.cssHooks[t] || et.cssHooks[a], o && "get" in o && (r = o.get(e, !0, i)), void 0 === r && (r = w(e, t, n)), "normal" === r && t in qt && (r = qt[t]), "" === i || i ? (s = parseFloat(r), i === !0 || et.isNumeric(s) ? s || 0 : r) : r | |
} | |
}), et.each(["height", "width"], function (e, t) { | |
et.cssHooks[t] = { | |
get: function (e, i, n) { | |
return i ? 0 === e.offsetWidth && Kt.test(et.css(e, "display")) ? et.swap(e, zt, function () { | |
return E(e, t, n) | |
}) : E(e, t, n) : void 0 | |
}, | |
set: function (e, i, n) { | |
var r = n && Wt(e); | |
return C(e, i, n ? S(e, t, n, "border-box" === et.css(e, "boxSizing", !1, r), r) : 0) | |
} | |
} | |
}), et.cssHooks.marginRight = _(X.reliableMarginRight, function (e, t) { | |
return t ? et.swap(e, { | |
display: "inline-block" | |
}, w, [e, "marginRight"]) : void 0 | |
}), et.each({ | |
margin: "", | |
padding: "", | |
border: "Width" | |
}, function (e, t) { | |
et.cssHooks[e + t] = { | |
expand: function (i) { | |
for (var n = 0, r = {}, s = "string" == typeof i ? i.split(" ") : [i]; 4 > n; n++) r[e + _t[n] + t] = s[n] || s[n - 2] || s[0]; | |
return r | |
} | |
}, jt.test(e) || (et.cssHooks[e + t].set = C) | |
}), et.fn.extend({ | |
css: function (e, t) { | |
return gt(this, function (e, t, i) { | |
var n, r, s = {}, | |
o = 0; | |
if (et.isArray(t)) { | |
for (n = Wt(e), r = t.length; r > o; o++) s[t[o]] = et.css(e, t[o], !1, n); | |
return s | |
} | |
return void 0 !== i ? et.style(e, t, i) : et.css(e, t) | |
}, e, t, arguments.length > 1) | |
}, | |
show: function () { | |
return A(this, !0) | |
}, | |
hide: function () { | |
return A(this) | |
}, | |
toggle: function (e) { | |
return "boolean" == typeof e ? e ? this.show() : this.hide() : this.each(function () { | |
bt(this) ? et(this).show() : et(this).hide() | |
}) | |
} | |
}), et.Tween = I, I.prototype = { | |
constructor: I, | |
init: function (e, t, i, n, r, s) { | |
this.elem = e, this.prop = i, this.easing = r || "swing", this.options = t, this.start = this.now = this.cur(), this.end = n, this.unit = s || (et.cssNumber[i] ? "" : "px") | |
}, | |
cur: function () { | |
var e = I.propHooks[this.prop]; | |
return e && e.get ? e.get(this) : I.propHooks._default.get(this) | |
}, | |
run: function (e) { | |
var t, i = I.propHooks[this.prop]; | |
return this.pos = t = this.options.duration ? et.easing[this.easing](e, this.options.duration * e, 0, 1, this.options.duration) : e, this.now = (this.end - this.start) * t + this.start, this.options.step && this.options.step.call(this.elem, this.now, this), i && i.set ? i.set(this) : I.propHooks._default.set(this), this | |
} | |
}, I.prototype.init.prototype = I.prototype, I.propHooks = { | |
_default: { | |
get: function (e) { | |
var t; | |
return null == e.elem[e.prop] || e.elem.style && null != e.elem.style[e.prop] ? (t = et.css(e.elem, e.prop, ""), t && "auto" !== t ? t : 0) : e.elem[e.prop] | |
}, | |
set: function (e) { | |
et.fx.step[e.prop] ? et.fx.step[e.prop](e) : e.elem.style && (null != e.elem.style[et.cssProps[e.prop]] || et.cssHooks[e.prop]) ? et.style(e.elem, e.prop, e.now + e.unit) : e.elem[e.prop] = e.now | |
} | |
} | |
}, I.propHooks.scrollTop = I.propHooks.scrollLeft = { | |
set: function (e) { | |
e.elem.nodeType && e.elem.parentNode && (e.elem[e.prop] = e.now) | |
} | |
}, et.easing = { | |
linear: function (e) { | |
return e | |
}, | |
swing: function (e) { | |
return .5 - Math.cos(e * Math.PI) / 2 | |
} | |
}, et.fx = I.prototype.init, et.fx.step = {}; | |
var Qt, Xt, Jt = /^(?:toggle|show|hide)$/, | |
Zt = new RegExp("^(?:([+-])=|)(" + wt + ")([a-z%]*)$", "i"), | |
ei = /queueHooks$/, | |
ti = [L], | |
ii = { | |
"*": [ | |
function (e, t) { | |
var i = this.createTween(e, t), | |
n = i.cur(), | |
r = Zt.exec(t), | |
s = r && r[3] || (et.cssNumber[e] ? "" : "px"), | |
o = (et.cssNumber[e] || "px" !== s && +n) && Zt.exec(et.css(i.elem, e)), | |
a = 1, | |
c = 20; | |
if (o && o[3] !== s) { | |
s = s || o[3], r = r || [], o = +n || 1; | |
do a = a || ".5", o /= a, et.style(i.elem, e, o + s); while (a !== (a = i.cur() / n) && 1 !== a && --c) | |
} | |
return r && (o = i.start = +o || +n || 0, i.unit = s, i.end = r[1] ? o + (r[1] + 1) * r[2] : +r[2]), i | |
} | |
] | |
}; | |
et.Animation = et.extend(N, { | |
tweener: function (e, t) { | |
et.isFunction(e) ? (t = e, e = ["*"]) : e = e.split(" "); | |
for (var i, n = 0, r = e.length; r > n; n++) i = e[n], ii[i] = ii[i] || [], ii[i].unshift(t) | |
}, | |
prefilter: function (e, t) { | |
t ? ti.unshift(e) : ti.push(e) | |
} | |
}), et.speed = function (e, t, i) { | |
var n = e && "object" == typeof e ? et.extend({}, e) : { | |
complete: i || !i && t || et.isFunction(e) && e, | |
duration: e, | |
easing: i && t || t && !et.isFunction(t) && t | |
}; | |
return n.duration = et.fx.off ? 0 : "number" == typeof n.duration ? n.duration : n.duration in et.fx.speeds ? et.fx.speeds[n.duration] : et.fx.speeds._default, (null == n.queue || n.queue === !0) && (n.queue = "fx"), n.old = n.complete, n.complete = function () { | |
et.isFunction(n.old) && n.old.call(this), n.queue && et.dequeue(this, n.queue) | |
}, n | |
}, et.fn.extend({ | |
fadeTo: function (e, t, i, n) { | |
return this.filter(bt).css("opacity", 0).show().end().animate({ | |
opacity: t | |
}, e, i, n) | |
}, | |
animate: function (e, t, i, n) { | |
var r = et.isEmptyObject(e), | |
s = et.speed(t, i, n), | |
o = function () { | |
var t = N(this, et.extend({}, e), s); | |
(r || Tt.get(this, "finish")) && t.stop(!0) | |
}; | |
return o.finish = o, r || s.queue === !1 ? this.each(o) : this.queue(s.queue, o) | |
}, | |
stop: function (e, t, i) { | |
var n = function (e) { | |
var t = e.stop; | |
delete e.stop, t(i) | |
}; | |
return "string" != typeof e && (i = t, t = e, e = void 0), t && e !== !1 && this.queue(e || "fx", []), this.each(function () { | |
var t = !0, | |
r = null != e && e + "queueHooks", | |
s = et.timers, | |
o = Tt.get(this); | |
if (r) o[r] && o[r].stop && n(o[r]); | |
else | |
for (r in o) o[r] && o[r].stop && ei.test(r) && n(o[r]); | |
for (r = s.length; r--;) s[r].elem !== this || null != e && s[r].queue !== e || (s[r].anim.stop(i), t = !1, s.splice(r, 1)); | |
(t || !i) && et.dequeue(this, e) | |
}) | |
}, | |
finish: function (e) { | |
return e !== !1 && (e = e || "fx"), this.each(function () { | |
var t, i = Tt.get(this), | |
n = i[e + "queue"], | |
r = i[e + "queueHooks"], | |
s = et.timers, | |
o = n ? n.length : 0; | |
for (i.finish = !0, et.queue(this, e, []), r && r.stop && r.stop.call(this, !0), t = s.length; t--;) s[t].elem === this && s[t].queue === e && (s[t].anim.stop(!0), s.splice(t, 1)); | |
for (t = 0; o > t; t++) n[t] && n[t].finish && n[t].finish.call(this); | |
delete i.finish | |
}) | |
} | |
}), et.each(["toggle", "show", "hide"], function (e, t) { | |
var i = et.fn[t]; | |
et.fn[t] = function (e, n, r) { | |
return null == e || "boolean" == typeof e ? i.apply(this, arguments) : this.animate(M(t, !0), e, n, r) | |
} | |
}), et.each({ | |
slideDown: M("show"), | |
slideUp: M("hide"), | |
slideToggle: M("toggle"), | |
fadeIn: { | |
opacity: "show" | |
}, | |
fadeOut: { | |
opacity: "hide" | |
}, | |
fadeToggle: { | |
opacity: "toggle" | |
} | |
}, function (e, t) { | |
et.fn[e] = function (e, i, n) { | |
return this.animate(t, e, i, n) | |
} | |
}), et.timers = [], et.fx.tick = function () { | |
var e, t = 0, | |
i = et.timers; | |
for (Qt = et.now(); t < i.length; t++) e = i[t], e() || i[t] !== e || i.splice(t--, 1); | |
i.length || et.fx.stop(), Qt = void 0 | |
}, et.fx.timer = function (e) { | |
et.timers.push(e), e() ? et.fx.start() : et.timers.pop() | |
}, et.fx.interval = 13, et.fx.start = function () { | |
Xt || (Xt = setInterval(et.fx.tick, et.fx.interval)) | |
}, et.fx.stop = function () { | |
clearInterval(Xt), Xt = null | |
}, et.fx.speeds = { | |
slow: 600, | |
fast: 200, | |
_default: 400 | |
}, et.fn.delay = function (e, t) { | |
return e = et.fx ? et.fx.speeds[e] || e : e, t = t || "fx", this.queue(t, function (t, i) { | |
var n = setTimeout(t, e); | |
i.stop = function () { | |
clearTimeout(n) | |
} | |
}) | |
}, | |
function () { | |
var e = J.createElement("input"), | |
t = J.createElement("select"), | |
i = t.appendChild(J.createElement("option")); | |
e.type = "checkbox", X.checkOn = "" !== e.value, X.optSelected = i.selected, t.disabled = !0, X.optDisabled = !i.disabled, e = J.createElement("input"), e.value = "t", e.type = "radio", X.radioValue = "t" === e.value | |
}(); | |
var ni, ri, si = et.expr.attrHandle; | |
et.fn.extend({ | |
attr: function (e, t) { | |
return gt(this, et.attr, e, t, arguments.length > 1) | |
}, | |
removeAttr: function (e) { | |
return this.each(function () { | |
et.removeAttr(this, e) | |
}) | |
} | |
}), et.extend({ | |
attr: function (e, t, i) { | |
var n, r, s = e.nodeType; | |
if (e && 3 !== s && 8 !== s && 2 !== s) return typeof e.getAttribute === St ? et.prop(e, t, i) : (1 === s && et.isXMLDoc(e) || (t = t.toLowerCase(), n = et.attrHooks[t] || (et.expr.match.bool.test(t) ? ri : ni)), void 0 === i ? n && "get" in n && null !== (r = n.get(e, t)) ? r : (r = et.find.attr(e, t), null == r ? void 0 : r) : null !== i ? n && "set" in n && void 0 !== (r = n.set(e, i, t)) ? r : (e.setAttribute(t, i + ""), i) : void et.removeAttr(e, t)) | |
}, | |
removeAttr: function (e, t) { | |
var i, n, r = 0, | |
s = t && t.match(pt); | |
if (s && 1 === e.nodeType) | |
for (; i = s[r++];) n = et.propFix[i] || i, et.expr.match.bool.test(i) && (e[n] = !1), e.removeAttribute(i) | |
}, | |
attrHooks: { | |
type: { | |
set: function (e, t) { | |
if (!X.radioValue && "radio" === t && et.nodeName(e, "input")) { | |
var i = e.value; | |
return e.setAttribute("type", t), i && (e.value = i), t | |
} | |
} | |
} | |
} | |
}), ri = { | |
set: function (e, t, i) { | |
return t === !1 ? et.removeAttr(e, i) : e.setAttribute(i, i), i | |
} | |
}, et.each(et.expr.match.bool.source.match(/\w+/g), function (e, t) { | |
var i = si[t] || et.find.attr; | |
si[t] = function (e, t, n) { | |
var r, s; | |
return n || (s = si[t], si[t] = r, r = null != i(e, t, n) ? t.toLowerCase() : null, si[t] = s), r | |
} | |
}); | |
var oi = /^(?:input|select|textarea|button)$/i; | |
et.fn.extend({ | |
prop: function (e, t) { | |
return gt(this, et.prop, e, t, arguments.length > 1) | |
}, | |
removeProp: function (e) { | |
return this.each(function () { | |
delete this[et.propFix[e] || e] | |
}) | |
} | |
}), et.extend({ | |
propFix: { | |
"for": "htmlFor", | |
"class": "className" | |
}, | |
prop: function (e, t, i) { | |
var n, r, s, o = e.nodeType; | |
if (e && 3 !== o && 8 !== o && 2 !== o) return s = 1 !== o || !et.isXMLDoc(e), s && (t = et.propFix[t] || t, r = et.propHooks[t]), void 0 !== i ? r && "set" in r && void 0 !== (n = r.set(e, i, t)) ? n : e[t] = i : r && "get" in r && null !== (n = r.get(e, t)) ? n : e[t] | |
}, | |
propHooks: { | |
tabIndex: { | |
get: function (e) { | |
return e.hasAttribute("tabindex") || oi.test(e.nodeName) || e.href ? e.tabIndex : -1 | |
} | |
} | |
} | |
}), X.optSelected || (et.propHooks.selected = { | |
get: function (e) { | |
var t = e.parentNode; | |
return t && t.parentNode && t.parentNode.selectedIndex, null | |
} | |
}), et.each(["tabIndex", "readOnly", "maxLength", "cellSpacing", "cellPadding", "rowSpan", "colSpan", "useMap", "frameBorder", "contentEditable"], function () { | |
et.propFix[this.toLowerCase()] = this | |
}); | |
var ai = /[\t\r\n\f]/g; | |
et.fn.extend({ | |
addClass: function (e) { | |
var t, i, n, r, s, o, a = "string" == typeof e && e, | |
c = 0, | |
u = this.length; | |
if (et.isFunction(e)) return this.each(function (t) { | |
et(this).addClass(e.call(this, t, this.className)) | |
}); | |
if (a) | |
for (t = (e || "").match(pt) || []; u > c; c++) | |
if (i = this[c], n = 1 === i.nodeType && (i.className ? (" " + i.className + " ").replace(ai, " ") : " ")) { | |
for (s = 0; r = t[s++];) n.indexOf(" " + r + " ") < 0 && (n += r + " "); | |
o = et.trim(n), i.className !== o && (i.className = o) | |
} | |
return this | |
}, | |
removeClass: function (e) { | |
var t, i, n, r, s, o, a = 0 === arguments.length || "string" == typeof e && e, | |
c = 0, | |
u = this.length; | |
if (et.isFunction(e)) return this.each(function (t) { | |
et(this).removeClass(e.call(this, t, this.className)) | |
}); | |
if (a) | |
for (t = (e || "").match(pt) || []; u > c; c++) | |
if (i = this[c], n = 1 === i.nodeType && (i.className ? (" " + i.className + " ").replace(ai, " ") : "")) { | |
for (s = 0; r = t[s++];) | |
for (; n.indexOf(" " + r + " ") >= 0;) n = n.replace(" " + r + " ", " "); | |
o = e ? et.trim(n) : "", i.className !== o && (i.className = o) | |
} | |
return this | |
}, | |
toggleClass: function (e, t) { | |
var i = typeof e; | |
return "boolean" == typeof t && "string" === i ? t ? this.addClass(e) : this.removeClass(e) : this.each(et.isFunction(e) ? function (i) { | |
et(this).toggleClass(e.call(this, i, this.className, t), t) | |
} : function () { | |
if ("string" === i) | |
for (var t, n = 0, r = et(this), s = e.match(pt) || []; t = s[n++];) r.hasClass(t) ? r.removeClass(t) : r.addClass(t); | |
else(i === St || "boolean" === i) && (this.className && Tt.set(this, "__className__", this.className), this.className = this.className || e === !1 ? "" : Tt.get(this, "__className__") || "") | |
}) | |
}, | |
hasClass: function (e) { | |
for (var t = " " + e + " ", i = 0, n = this.length; n > i; i++) | |
if (1 === this[i].nodeType && (" " + this[i].className + " ").replace(ai, " ").indexOf(t) >= 0) return !0; | |
return !1 | |
} | |
}); | |
var ci = /\r/g; | |
et.fn.extend({ | |
val: function (e) { | |
var t, i, n, r = this[0]; { | |
if (arguments.length) return n = et.isFunction(e), this.each(function (i) { | |
var r; | |
1 === this.nodeType && (r = n ? e.call(this, i, et(this).val()) : e, null == r ? r = "" : "number" == typeof r ? r += "" : et.isArray(r) && (r = et.map(r, function (e) { | |
return null == e ? "" : e + "" | |
})), t = et.valHooks[this.type] || et.valHooks[this.nodeName.toLowerCase()], t && "set" in t && void 0 !== t.set(this, r, "value") || (this.value = r)) | |
}); | |
if (r) return t = et.valHooks[r.type] || et.valHooks[r.nodeName.toLowerCase()], t && "get" in t && void 0 !== (i = t.get(r, "value")) ? i : (i = r.value, "string" == typeof i ? i.replace(ci, "") : null == i ? "" : i) | |
} | |
} | |
}), et.extend({ | |
valHooks: { | |
select: { | |
get: function (e) { | |
for (var t, i, n = e.options, r = e.selectedIndex, s = "select-one" === e.type || 0 > r, o = s ? null : [], a = s ? r + 1 : n.length, c = 0 > r ? a : s ? r : 0; a > c; c++) | |
if (i = n[c], !(!i.selected && c !== r || (X.optDisabled ? i.disabled : null !== i.getAttribute("disabled")) || i.parentNode.disabled && et.nodeName(i.parentNode, "optgroup"))) { | |
if (t = et(i).val(), s) return t; | |
o.push(t) | |
} | |
return o | |
}, | |
set: function (e, t) { | |
for (var i, n, r = e.options, s = et.makeArray(t), o = r.length; o--;) n = r[o], (n.selected = et.inArray(et(n).val(), s) >= 0) && (i = !0); | |
return i || (e.selectedIndex = -1), s | |
} | |
} | |
} | |
}), et.each(["radio", "checkbox"], function () { | |
et.valHooks[this] = { | |
set: function (e, t) { | |
return et.isArray(t) ? e.checked = et.inArray(et(e).val(), t) >= 0 : void 0 | |
} | |
}, X.checkOn || (et.valHooks[this].get = function (e) { | |
return null === e.getAttribute("value") ? "on" : e.value | |
}) | |
}), et.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) { | |
et.fn[t] = function (e, i) { | |
return arguments.length > 0 ? this.on(t, null, e, i) : this.trigger(t) | |
} | |
}), et.fn.extend({ | |
hover: function (e, t) { | |
return this.mouseenter(e).mouseleave(t || e) | |
}, | |
bind: function (e, t, i) { | |
return this.on(e, null, t, i) | |
}, | |
unbind: function (e, t) { | |
return this.off(e, null, t) | |
}, | |
delegate: function (e, t, i, n) { | |
return this.on(t, e, i, n) | |
}, | |
undelegate: function (e, t, i) { | |
return 1 === arguments.length ? this.off(e, "**") : this.off(t, e || "**", i) | |
} | |
}); | |
var ui = et.now(), | |
li = /\?/; | |
et.parseJSON = function (e) { | |
return JSON.parse(e + "") | |
}, et.parseXML = function (e) { | |
var t, i; | |
if (!e || "string" != typeof e) return null; | |
try { | |
i = new DOMParser, t = i.parseFromString(e, "text/xml") | |
} catch (n) { | |
t = void 0 | |
} | |
return (!t || t.getElementsByTagName("parsererror").length) && et.error("Invalid XML: " + e), t | |
}; | |
var di, hi, pi = /#.*$/, | |
fi = /([?&])_=[^&]*/, | |
mi = /^(.*?):[ \t]*([^\r\n]*)$/gm, | |
gi = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/, | |
Ti = /^(?:GET|HEAD)$/, | |
vi = /^\/\//, | |
yi = /^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/, | |
Di = {}, | |
wi = {}, | |
_i = "*/".concat("*"); | |
try { | |
hi = location.href | |
} catch (bi) { | |
hi = J.createElement("a"), hi.href = "", hi = hi.href | |
} | |
di = yi.exec(hi.toLowerCase()) || [], et.extend({ | |
active: 0, | |
lastModified: {}, | |
etag: {}, | |
ajaxSettings: { | |
url: hi, | |
type: "GET", | |
isLocal: gi.test(di[1]), | |
global: !0, | |
processData: !0, | |
async: !0, | |
contentType: "application/x-www-form-urlencoded; charset=UTF-8", | |
accepts: { | |
"*": _i, | |
text: "text/plain", | |
html: "text/html", | |
xml: "application/xml, text/xml", | |
json: "application/json, text/javascript" | |
}, | |
contents: { | |
xml: /xml/, | |
html: /html/, | |
json: /json/ | |
}, | |
responseFields: { | |
xml: "responseXML", | |
text: "responseText", | |
json: "responseJSON" | |
}, | |
converters: { | |
"* text": String, | |
"text html": !0, | |
"text json": et.parseJSON, | |
"text xml": et.parseXML | |
}, | |
flatOptions: { | |
url: !0, | |
context: !0 | |
} | |
}, | |
ajaxSetup: function (e, t) { | |
return t ? U(U(e, et.ajaxSettings), t) : U(et.ajaxSettings, e) | |
}, | |
ajaxPrefilter: O(Di), | |
ajaxTransport: O(wi), | |
ajax: function (e, t) { | |
function i(e, t, i, o) { | |
var c, l, T, v, D, _ = t; | |
2 !== y && (y = 2, a && clearTimeout(a), n = void 0, s = o || "", w.readyState = e > 0 ? 4 : 0, c = e >= 200 && 300 > e || 304 === e, i && (v = $(d, w, i)), v = P(d, v, w, c), c ? (d.ifModified && (D = w.getResponseHeader("Last-Modified"), D && (et.lastModified[r] = D), D = w.getResponseHeader("etag"), D && (et.etag[r] = D)), 204 === e || "HEAD" === d.type ? _ = "nocontent" : 304 === e ? _ = "notmodified" : (_ = v.state, l = v.data, T = v.error, c = !T)) : (T = _, (e || !_) && (_ = "error", 0 > e && (e = 0))), w.status = e, w.statusText = (t || _) + "", c ? f.resolveWith(h, [l, _, w]) : f.rejectWith(h, [w, _, T]), w.statusCode(g), g = void 0, u && p.trigger(c ? "ajaxSuccess" : "ajaxError", [w, d, c ? l : T]), m.fireWith(h, [w, _]), u && (p.trigger("ajaxComplete", [w, d]), --et.active || et.event.trigger("ajaxStop"))) | |
} | |
"object" == typeof e && (t = e, e = void 0), t = t || {}; | |
var n, r, s, o, a, c, u, l, d = et.ajaxSetup({}, t), | |
h = d.context || d, | |
p = d.context && (h.nodeType || h.jquery) ? et(h) : et.event, | |
f = et.Deferred(), | |
m = et.Callbacks("once memory"), | |
g = d.statusCode || {}, | |
T = {}, | |
v = {}, | |
y = 0, | |
D = "canceled", | |
w = { | |
readyState: 0, | |
getResponseHeader: function (e) { | |
var t; | |
if (2 === y) { | |
if (!o) | |
for (o = {}; t = mi.exec(s);) o[t[1].toLowerCase()] = t[2]; | |
t = o[e.toLowerCase()] | |
} | |
return null == t ? null : t | |
}, | |
getAllResponseHeaders: function () { | |
return 2 === y ? s : null | |
}, | |
setRequestHeader: function (e, t) { | |
var i = e.toLowerCase(); | |
return y || (e = v[i] = v[i] || e, T[e] = t), this | |
}, | |
overrideMimeType: function (e) { | |
return y || (d.mimeType = e), this | |
}, | |
statusCode: function (e) { | |
var t; | |
if (e) | |
if (2 > y) | |
for (t in e) g[t] = [g[t], e[t]]; | |
else w.always(e[w.status]); | |
return this | |
}, | |
abort: function (e) { | |
var t = e || D; | |
return n && n.abort(t), i(0, t), this | |
} | |
}; | |
if (f.promise(w).complete = m.add, w.success = w.done, w.error = w.fail, d.url = ((e || d.url || hi) + "").replace(pi, "").replace(vi, di[1] + "//"), d.type = t.method || t.type || d.method || d.type, d.dataTypes = et.trim(d.dataType || "*").toLowerCase().match(pt) || [""], null == d.crossDomain && (c = yi.exec(d.url.toLowerCase()), d.crossDomain = !(!c || c[1] === di[1] && c[2] === di[2] && (c[3] || ("http:" === c[1] ? "80" : "443")) === (di[3] || ("http:" === di[1] ? "80" : "443")))), d.data && d.processData && "string" != typeof d.data && (d.data = et.param(d.data, d.traditional)), F(Di, d, t, w), 2 === y) return w; | |
u = d.global, u && 0 === et.active++ && et.event.trigger("ajaxStart"), d.type = d.type.toUpperCase(), d.hasContent = !Ti.test(d.type), r = d.url, d.hasContent || (d.data && (r = d.url += (li.test(r) ? "&" : "?") + d.data, delete d.data), d.cache === !1 && (d.url = fi.test(r) ? r.replace(fi, "$1_=" + ui++) : r + (li.test(r) ? "&" : "?") + "_=" + ui++)), d.ifModified && (et.lastModified[r] && w.setRequestHeader("If-Modified-Since", et.lastModified[r]), et.etag[r] && w.setRequestHeader("If-None-Match", et.etag[r])), (d.data && d.hasContent && d.contentType !== !1 || t.contentType) && w.setRequestHeader("Content-Type", d.contentType), w.setRequestHeader("Accept", d.dataTypes[0] && d.accepts[d.dataTypes[0]] ? d.accepts[d.dataTypes[0]] + ("*" !== d.dataTypes[0] ? ", " + _i + "; q=0.01" : "") : d.accepts["*"]); | |
for (l in d.headers) w.setRequestHeader(l, d.headers[l]); | |
if (d.beforeSend && (d.beforeSend.call(h, w, d) === !1 || 2 === y)) return w.abort(); | |
D = "abort"; | |
for (l in { | |
success: 1, | |
error: 1, | |
complete: 1 | |
}) w[l](d[l]); | |
if (n = F(wi, d, t, w)) { | |
w.readyState = 1, u && p.trigger("ajaxSend", [w, d]), d.async && d.timeout > 0 && (a = setTimeout(function () { | |
w.abort("timeout") | |
}, d.timeout)); | |
try { | |
y = 1, n.send(T, i) | |
} catch (_) { | |
if (!(2 > y)) throw _; | |
i(-1, _) | |
} | |
} else i(-1, "No Transport"); | |
return w | |
}, | |
getJSON: function (e, t, i) { | |
return et.get(e, t, i, "json") | |
}, | |
getScript: function (e, t) { | |
return et.get(e, void 0, t, "script") | |
} | |
}), et.each(["get", "post"], function (e, t) { | |
et[t] = function (e, i, n, r) { | |
return et.isFunction(i) && (r = r || n, n = i, i = void 0), et.ajax({ | |
url: e, | |
type: t, | |
dataType: r, | |
data: i, | |
success: n | |
}) | |
} | |
}), et.each(["ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend"], function (e, t) { | |
et.fn[t] = function (e) { | |
return this.on(t, e) | |
} | |
}), et._evalUrl = function (e) { | |
return et.ajax({ | |
url: e, | |
type: "GET", | |
dataType: "script", | |
async: !1, | |
global: !1, | |
"throws": !0 | |
}) | |
}, et.fn.extend({ | |
wrapAll: function (e) { | |
var t; | |
return et.isFunction(e) ? this.each(function (t) { | |
et(this).wrapAll(e.call(this, t)) | |
}) : (this[0] && (t = et(e, this[0].ownerDocument).eq(0).clone(!0), this[0].parentNode && t.insertBefore(this[0]), t.map(function () { | |
for (var e = this; e.firstElementChild;) e = e.firstElementChild; | |
return e | |
}).append(this)), this) | |
}, | |
wrapInner: function (e) { | |
return this.each(et.isFunction(e) ? function (t) { | |
et(this).wrapInner(e.call(this, t)) | |
} : function () { | |
var t = et(this), | |
i = t.contents(); | |
i.length ? i.wrapAll(e) : t.append(e) | |
}) | |
}, | |
wrap: function (e) { | |
var t = et.isFunction(e); | |
return this.each(function (i) { | |
et(this).wrapAll(t ? e.call(this, i) : e) | |
}) | |
}, | |
unwrap: function () { | |
return this.parent().each(function () { | |
et.nodeName(this, "body") || et(this).replaceWith(this.childNodes) | |
}).end() | |
} | |
}), et.expr.filters.hidden = function (e) { | |
return e.offsetWidth <= 0 && e.offsetHeight <= 0 | |
}, et.expr.filters.visible = function (e) { | |
return !et.expr.filters.hidden(e) | |
}; | |
var Ci = /%20/g, | |
Si = /\[\]$/, | |
Ei = /\r?\n/g, | |
Ai = /^(?:submit|button|image|reset|file)$/i, | |
Ii = /^(?:input|select|textarea|keygen)/i; | |
et.param = function (e, t) { | |
var i, n = [], | |
r = function (e, t) { | |
t = et.isFunction(t) ? t() : null == t ? "" : t, n[n.length] = encodeURIComponent(e) + "=" + encodeURIComponent(t) | |
}; | |
if (void 0 === t && (t = et.ajaxSettings && et.ajaxSettings.traditional), et.isArray(e) || e.jquery && !et.isPlainObject(e)) et.each(e, function () { | |
r(this.name, this.value) | |
}); | |
else | |
for (i in e) B(i, e[i], t, r); | |
return n.join("&").replace(Ci, "+") | |
}, et.fn.extend({ | |
serialize: function () { | |
return et.param(this.serializeArray()) | |
}, | |
serializeArray: function () { | |
return this.map(function () { | |
var e = et.prop(this, "elements"); | |
return e ? et.makeArray(e) : this | |
}).filter(function () { | |
var e = this.type; | |
return this.name && !et(this).is(":disabled") && Ii.test(this.nodeName) && !Ai.test(e) && (this.checked || !Ct.test(e)) | |
}).map(function (e, t) { | |
var i = et(this).val(); | |
return null == i ? null : et.isArray(i) ? et.map(i, function (e) { | |
return { | |
name: t.name, | |
value: e.replace(Ei, "\r\n") | |
} | |
}) : { | |
name: t.name, | |
value: i.replace(Ei, "\r\n") | |
} | |
}).get() | |
} | |
}), et.ajaxSettings.xhr = function () { | |
try { | |
return new XMLHttpRequest | |
} catch (e) {} | |
}; | |
var ki = 0, | |
Mi = {}, | |
xi = { | |
0: 200, | |
1223: 204 | |
}, | |
Li = et.ajaxSettings.xhr(); | |
e.ActiveXObject && et(e).on("unload", function () { | |
for (var e in Mi) Mi[e]() | |
}), X.cors = !!Li && "withCredentials" in Li, X.ajax = Li = !!Li, et.ajaxTransport(function (e) { | |
var t; | |
return X.cors || Li && !e.crossDomain ? { | |
send: function (i, n) { | |
var r, s = e.xhr(), | |
o = ++ki; | |
if (s.open(e.type, e.url, e.async, e.username, e.password), e.xhrFields) | |
for (r in e.xhrFields) s[r] = e.xhrFields[r]; | |
e.mimeType && s.overrideMimeType && s.overrideMimeType(e.mimeType), e.crossDomain || i["X-Requested-With"] || (i["X-Requested-With"] = "XMLHttpRequest"); | |
for (r in i) s.setRequestHeader(r, i[r]); | |
t = function (e) { | |
return function () { | |
t && (delete Mi[o], t = s.onload = s.onerror = null, "abort" === e ? s.abort() : "error" === e ? n(s.status, s.statusText) : n(xi[s.status] || s.status, s.statusText, "string" == typeof s.responseText ? { | |
text: s.responseText | |
} : void 0, s.getAllResponseHeaders())) | |
} | |
}, s.onload = t(), s.onerror = t("error"), t = Mi[o] = t("abort"), s.send(e.hasContent && e.data || null) | |
}, | |
abort: function () { | |
t && t() | |
} | |
} : void 0 | |
}), et.ajaxSetup({ | |
accepts: { | |
script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript" | |
}, | |
contents: { | |
script: /(?:java|ecma)script/ | |
}, | |
converters: { | |
"text script": function (e) { | |
return et.globalEval(e), e | |
} | |
} | |
}), et.ajaxPrefilter("script", function (e) { | |
void 0 === e.cache && (e.cache = !1), e.crossDomain && (e.type = "GET") | |
}), et.ajaxTransport("script", function (e) { | |
if (e.crossDomain) { | |
var t, i; | |
return { | |
send: function (n, r) { | |
t = et("<script>").prop({ | |
async: !0, | |
charset: e.scriptCharset, | |
src: e.url | |
}).on("load error", i = function (e) { | |
t.remove(), i = null, e && r("error" === e.type ? 404 : 200, e.type) | |
}), J.head.appendChild(t[0]) | |
}, | |
abort: function () { | |
i && i() | |
} | |
} | |
} | |
}); | |
var Ri = [], | |
Ni = /(=)\?(?=&|$)|\?\?/; | |
et.ajaxSetup({ | |
jsonp: "callback", | |
jsonpCallback: function () { | |
var e = Ri.pop() || et.expando + "_" + ui++; | |
return this[e] = !0, e | |
} | |
}), et.ajaxPrefilter("json jsonp", function (t, i, n) { | |
var r, s, o, a = t.jsonp !== !1 && (Ni.test(t.url) ? "url" : "string" == typeof t.data && !(t.contentType || "").indexOf("application/x-www-form-urlencoded") && Ni.test(t.data) && "data"); | |
return a || "jsonp" === t.dataTypes[0] ? (r = t.jsonpCallback = et.isFunction(t.jsonpCallback) ? t.jsonpCallback() : t.jsonpCallback, a ? t[a] = t[a].replace(Ni, "$1" + r) : t.jsonp !== !1 && (t.url += (li.test(t.url) ? "&" : "?") + t.jsonp + "=" + r), t.converters["script json"] = function () { | |
return o || et.error(r + " was not called"), o[0] | |
}, t.dataTypes[0] = "json", s = e[r], e[r] = function () { | |
o = arguments | |
}, n.always(function () { | |
e[r] = s, t[r] && (t.jsonpCallback = i.jsonpCallback, Ri.push(r)), o && et.isFunction(s) && s(o[0]), o = s = void 0 | |
}), "script") : void 0 | |
}), et.parseHTML = function (e, t, i) { | |
if (!e || "string" != typeof e) return null; | |
"boolean" == typeof t && (i = t, t = !1), t = t || J; | |
var n = ot.exec(e), | |
r = !i && []; | |
return n ? [t.createElement(n[1])] : (n = et.buildFragment([e], t, r), r && r.length && et(r).remove(), et.merge([], n.childNodes)) | |
}; | |
var Oi = et.fn.load; | |
et.fn.load = function (e, t, i) { | |
if ("string" != typeof e && Oi) return Oi.apply(this, arguments); | |
var n, r, s, o = this, | |
a = e.indexOf(" "); | |
return a >= 0 && (n = e.slice(a), e = e.slice(0, a)), et.isFunction(t) ? (i = t, t = void 0) : t && "object" == typeof t && (r = "POST"), o.length > 0 && et.ajax({ | |
url: e, | |
type: r, | |
dataType: "html", | |
data: t | |
}).done(function (e) { | |
s = arguments, o.html(n ? et("<div>").append(et.parseHTML(e)).find(n) : e) | |
}).complete(i && function (e, t) { | |
o.each(i, s || [e.responseText, t, e]) | |
}), this | |
}, et.expr.filters.animated = function (e) { | |
return et.grep(et.timers, function (t) { | |
return e === t.elem | |
}).length | |
}; | |
var Fi = e.document.documentElement; | |
et.offset = { | |
setOffset: function (e, t, i) { | |
var n, r, s, o, a, c, u, l = et.css(e, "position"), | |
d = et(e), | |
h = {}; | |
"static" === l && (e.style.position = "relative"), a = d.offset(), s = et.css(e, "top"), c = et.css(e, "left"), u = ("absolute" === l || "fixed" === l) && (s + c).indexOf("auto") > -1, u ? (n = d.position(), o = n.top, r = n.left) : (o = parseFloat(s) || 0, r = parseFloat(c) || 0), et.isFunction(t) && (t = t.call(e, i, a)), null != t.top && (h.top = t.top - a.top + o), null != t.left && (h.left = t.left - a.left + r), "using" in t ? t.using.call(e, h) : d.css(h) | |
} | |
}, et.fn.extend({ | |
offset: function (e) { | |
if (arguments.length) return void 0 === e ? this : this.each(function (t) { | |
et.offset.setOffset(this, e, t) | |
}); | |
var t, i, n = this[0], | |
r = { | |
top: 0, | |
left: 0 | |
}, | |
s = n && n.ownerDocument; | |
if (s) return t = s.documentElement, et.contains(t, n) ? (typeof n.getBoundingClientRect !== St && (r = n.getBoundingClientRect()), i = j(s), { | |
top: r.top + i.pageYOffset - t.clientTop, | |
left: r.left + i.pageXOffset - t.clientLeft | |
}) : r | |
}, | |
position: function () { | |
if (this[0]) { | |
var e, t, i = this[0], | |
n = { | |
top: 0, | |
left: 0 | |
}; | |
return "fixed" === et.css(i, "position") ? t = i.getBoundingClientRect() : (e = this.offsetParent(), t = this.offset(), et.nodeName(e[0], "html") || (n = e.offset()), n.top += et.css(e[0], "borderTopWidth", !0), n.left += et.css(e[0], "borderLeftWidth", !0)), { | |
top: t.top - n.top - et.css(i, "marginTop", !0), | |
left: t.left - n.left - et.css(i, "marginLeft", !0) | |
} | |
} | |
}, | |
offsetParent: function () { | |
return this.map(function () { | |
for (var e = this.offsetParent || Fi; e && !et.nodeName(e, "html") && "static" === et.css(e, "position");) e = e.offsetParent; | |
return e || Fi | |
}) | |
} | |
}), et.each({ | |
scrollLeft: "pageXOffset", | |
scrollTop: "pageYOffset" | |
}, function (t, i) { | |
var n = "pageYOffset" === i; | |
et.fn[t] = function (r) { | |
return gt(this, function (t, r, s) { | |
var o = j(t); | |
return void 0 === s ? o ? o[i] : t[r] : void(o ? o.scrollTo(n ? e.pageXOffset : s, n ? s : e.pageYOffset) : t[r] = s) | |
}, t, r, arguments.length, null) | |
} | |
}), et.each(["top", "left"], function (e, t) { | |
et.cssHooks[t] = _(X.pixelPosition, function (e, i) { | |
return i ? (i = w(e, t), Ht.test(i) ? et(e).position()[t] + "px" : i) : void 0 | |
}) | |
}), et.each({ | |
Height: "height", | |
Width: "width" | |
}, function (e, t) { | |
et.each({ | |
padding: "inner" + e, | |
content: t, | |
"": "outer" + e | |
}, function (i, n) { | |
et.fn[n] = function (n, r) { | |
var s = arguments.length && (i || "boolean" != typeof n), | |
o = i || (n === !0 || r === !0 ? "margin" : "border"); | |
return gt(this, function (t, i, n) { | |
var r; | |
return et.isWindow(t) ? t.document.documentElement["client" + e] : 9 === t.nodeType ? (r = t.documentElement, Math.max(t.body["scroll" + e], r["scroll" + e], t.body["offset" + e], r["offset" + e], r["client" + e])) : void 0 === n ? et.css(t, i, o) : et.style(t, i, n, o) | |
}, t, s ? n : void 0, s, null) | |
} | |
}) | |
}), et.fn.size = function () { | |
return this.length | |
}, et.fn.andSelf = et.fn.addBack, "function" == typeof define && define.amd && define("jquery", [], function () { | |
return et | |
}); | |
var Ui = e.jQuery, | |
$i = e.$; | |
return et.noConflict = function (t) { | |
return e.$ === et && (e.$ = $i), t && e.jQuery === et && (e.jQuery = Ui), et | |
}, typeof t === St && (e.jQuery = e.$ = et), et | |
}), | |
function (e, t, i) { | |
function n(i) { | |
var n = t.console; | |
s[i] || (s[i] = !0, e.migrateWarnings.push(i), n && n.warn && !e.migrateMute && (n.warn("JQMIGRATE: " + i), e.migrateTrace && n.trace && n.trace())) | |
} | |
function r(t, i, r, s) { | |
if (Object.defineProperty) try { | |
return void Object.defineProperty(t, i, { | |
configurable: !0, | |
enumerable: !0, | |
get: function () { | |
return n(s), r | |
}, | |
set: function (e) { | |
n(s), r = e | |
} | |
}) | |
} catch (o) {} | |
e._definePropertyBroken = !0, t[i] = r | |
} | |
var s = {}; | |
e.migrateWarnings = [], !e.migrateMute && t.console && t.console.log && t.console.log("JQMIGRATE: Logging is active"), e.migrateTrace === i && (e.migrateTrace = !0), e.migrateReset = function () { | |
s = {}, e.migrateWarnings.length = 0 | |
}, "BackCompat" === document.compatMode && n("jQuery is not compatible with Quirks Mode"); | |
var o = e("<input/>", { | |
size: 1 | |
}).attr("size") && e.attrFn, | |
a = e.attr, | |
c = e.attrHooks.value && e.attrHooks.value.get || function () { | |
return null | |
}, | |
u = e.attrHooks.value && e.attrHooks.value.set || function () { | |
return i | |
}, | |
l = /^(?:input|button)$/i, | |
d = /^[238]$/, | |
h = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i, | |
p = /^(?:checked|selected)$/i; | |
r(e, "attrFn", o || {}, "jQuery.attrFn is deprecated"), e.attr = function (t, r, s, c) { | |
var u = r.toLowerCase(), | |
f = t && t.nodeType; | |
return c && (a.length < 4 && n("jQuery.fn.attr( props, pass ) is deprecated"), t && !d.test(f) && (o ? r in o : e.isFunction(e.fn[r]))) ? e(t)[r](s) : ("type" === r && s !== i && l.test(t.nodeName) && t.parentNode && n("Can't change the 'type' of an input or button in IE 6/7/8"), !e.attrHooks[u] && h.test(u) && (e.attrHooks[u] = { | |
get: function (t, n) { | |
var r, s = e.prop(t, n); | |
return s === !0 || "boolean" != typeof s && (r = t.getAttributeNode(n)) && r.nodeValue !== !1 ? n.toLowerCase() : i | |
}, | |
set: function (t, i, n) { | |
var r; | |
return i === !1 ? e.removeAttr(t, n) : (r = e.propFix[n] || n, r in t && (t[r] = !0), t.setAttribute(n, n.toLowerCase())), n | |
} | |
}, p.test(u) && n("jQuery.fn.attr('" + u + "') may use property instead of attribute")), a.call(e, t, r, s)) | |
}, e.attrHooks.value = { | |
get: function (e, t) { | |
var i = (e.nodeName || "").toLowerCase(); | |
return "button" === i ? c.apply(this, arguments) : ("input" !== i && "option" !== i && n("jQuery.fn.attr('value') no longer gets properties"), t in e ? e.value : null) | |
}, | |
set: function (e, t) { | |
var i = (e.nodeName || "").toLowerCase(); | |
return "button" === i ? u.apply(this, arguments) : ("input" !== i && "option" !== i && n("jQuery.fn.attr('value', val) no longer sets properties"), void(e.value = t)) | |
} | |
}; | |
var f, m, g = e.fn.init, | |
T = e.parseJSON, | |
v = /^([^<]*)(<[\w\W]+>)([^>]*)$/; | |
e.fn.init = function (t, i, r) { | |
var s; | |
return t && "string" == typeof t && !e.isPlainObject(i) && (s = v.exec(e.trim(t))) && s[0] && ("<" !== t.charAt(0) && n("$(html) HTML strings must start with '<' character"), s[3] && n("$(html) HTML text after last tag is ignored"), "#" === s[0].charAt(0) && (n("HTML string cannot start with a '#' character"), e.error("JQMIGRATE: Invalid selector string (XSS)")), i && i.context && (i = i.context), e.parseHTML) ? g.call(this, e.parseHTML(s[2], i, !0), i, r) : g.apply(this, arguments) | |
}, e.fn.init.prototype = e.fn, e.parseJSON = function (e) { | |
return e || null === e ? T.apply(this, arguments) : (n("jQuery.parseJSON requires a valid JSON string"), null) | |
}, e.uaMatch = function (e) { | |
e = e.toLowerCase(); | |
var t = /(chrome)[ \/]([\w.]+)/.exec(e) || /(webkit)[ \/]([\w.]+)/.exec(e) || /(opera)(?:.*version|)[ \/]([\w.]+)/.exec(e) || /(msie) ([\w.]+)/.exec(e) || e.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec(e) || []; | |
return { | |
browser: t[1] || "", | |
version: t[2] || "0" | |
} | |
}, e.browser || (f = e.uaMatch(navigator.userAgent), m = {}, f.browser && (m[f.browser] = !0, m.version = f.version), m.chrome ? m.webkit = !0 : m.webkit && (m.safari = !0), e.browser = m), r(e, "browser", e.browser, "jQuery.browser is deprecated"), e.sub = function () { | |
function t(e, i) { | |
return new t.fn.init(e, i) | |
} | |
e.extend(!0, t, this), t.superclass = this, t.fn = t.prototype = this(), t.fn.constructor = t, t.sub = this.sub, t.fn.init = function (n, r) { | |
return r && r instanceof e && !(r instanceof t) && (r = t(r)), e.fn.init.call(this, n, r, i) | |
}, t.fn.init.prototype = t.fn; | |
var i = t(document); | |
return n("jQuery.sub() is deprecated"), t | |
}, e.ajaxSetup({ | |
converters: { | |
"text json": e.parseJSON | |
} | |
}); | |
var y = e.fn.data; | |
e.fn.data = function (t) { | |
var r, s, o = this[0]; | |
return !o || "events" !== t || 1 !== arguments.length || (r = e.data(o, t), s = e._data(o, t), r !== i && r !== s || s === i) ? y.apply(this, arguments) : (n("Use of jQuery.fn.data('events') is deprecated"), s) | |
}; | |
var D = /\/(java|ecma)script/i, | |
w = e.fn.andSelf || e.fn.addBack; | |
e.fn.andSelf = function () { | |
return n("jQuery.fn.andSelf() replaced by jQuery.fn.addBack()"), w.apply(this, arguments) | |
}, e.clean || (e.clean = function (t, i, r, s) { | |
i = i || document, i = !i.nodeType && i[0] || i, i = i.ownerDocument || i, n("jQuery.clean() is deprecated"); | |
var o, a, c, u, l = []; | |
if (e.merge(l, e.buildFragment(t, i).childNodes), r) | |
for (c = function (e) { | |
return !e.type || D.test(e.type) ? s ? s.push(e.parentNode ? e.parentNode.removeChild(e) : e) : r.appendChild(e) : void 0 | |
}, o = 0; null != (a = l[o]); o++) e.nodeName(a, "script") && c(a) || (r.appendChild(a), "undefined" != typeof a.getElementsByTagName && (u = e.grep(e.merge([], a.getElementsByTagName("script")), c), l.splice.apply(l, [o + 1, 0].concat(u)), o += u.length)); | |
return l | |
}); | |
var _ = e.event.add, | |
b = e.event.remove, | |
C = e.event.trigger, | |
S = e.fn.toggle, | |
E = e.fn.live, | |
A = e.fn.die, | |
I = "ajaxStart|ajaxStop|ajaxSend|ajaxComplete|ajaxError|ajaxSuccess", | |
k = new RegExp("\\b(?:" + I + ")\\b"), | |
M = /(?:^|\s)hover(\.\S+|)\b/, | |
x = function (t) { | |
return "string" != typeof t || e.event.special.hover ? t : (M.test(t) && n("'hover' pseudo-event is deprecated, use 'mouseenter mouseleave'"), t && t.replace(M, "mouseenter$1 mouseleave$1")) | |
}; | |
e.event.props && "attrChange" !== e.event.props[0] && e.event.props.unshift("attrChange", "attrName", "relatedNode", "srcElement"), e.event.dispatch && r(e.event, "handle", e.event.dispatch, "jQuery.event.handle is undocumented and deprecated"), e.event.add = function (e, t, i, r, s) { | |
e !== document && k.test(t) && n("AJAX events should be attached to document: " + t), _.call(this, e, x(t || ""), i, r, s) | |
}, e.event.remove = function (e, t, i, n, r) { | |
b.call(this, e, x(t) || "", i, n, r) | |
}, e.fn.error = function () { | |
var e = Array.prototype.slice.call(arguments, 0); | |
return n("jQuery.fn.error() is deprecated"), e.splice(0, 0, "error"), arguments.length ? this.bind.apply(this, e) : (this.triggerHandler.apply(this, e), this) | |
}, e.fn.toggle = function (t, i) { | |
if (!e.isFunction(t) || !e.isFunction(i)) return S.apply(this, arguments); | |
n("jQuery.fn.toggle(handler, handler...) is deprecated"); | |
var r = arguments, | |
s = t.guid || e.guid++, | |
o = 0, | |
a = function (i) { | |
var n = (e._data(this, "lastToggle" + t.guid) || 0) % o; | |
return e._data(this, "lastToggle" + t.guid, n + 1), i.preventDefault(), r[n].apply(this, arguments) || !1 | |
}; | |
for (a.guid = s; o < r.length;) r[o++].guid = s; | |
return this.click(a) | |
}, e.fn.live = function (t, i, r) { | |
return n("jQuery.fn.live() is deprecated"), E ? E.apply(this, arguments) : (e(this.context).on(t, this.selector, i, r), this) | |
}, e.fn.die = function (t, i) { | |
return n("jQuery.fn.die() is deprecated"), A ? A.apply(this, arguments) : (e(this.context).off(t, this.selector || "**", i), this) | |
}, e.event.trigger = function (e, t, i, r) { | |
return i || k.test(e) || n("Global events are undocumented and deprecated"), C.call(this, e, t, i || document, r) | |
}, e.each(I.split("|"), function (t, i) { | |
e.event.special[i] = { | |
setup: function () { | |
var t = this; | |
return t !== document && (e.event.add(document, i + "." + e.guid, function () { | |
e.event.trigger(i, null, t, !0) | |
}), e._data(this, i, e.guid++)), !1 | |
}, | |
teardown: function () { | |
return this !== document && e.event.remove(document, i + "." + e._data(this, i)), !1 | |
} | |
} | |
}) | |
}(jQuery, window), FastClick.prototype.deviceIsAndroid = navigator.userAgent.indexOf("Android") > 0, FastClick.prototype.deviceIsIOS = /iP(ad|hone|od)/.test(navigator.userAgent), FastClick.prototype.deviceIsIOS4 = FastClick.prototype.deviceIsIOS && /OS 4_\d(_\d)?/.test(navigator.userAgent), FastClick.prototype.deviceIsIOSWithBadTarget = FastClick.prototype.deviceIsIOS && /OS ([6-9]|\d{2})_\d/.test(navigator.userAgent), FastClick.prototype.needsClick = function (e) { | |
"use strict"; | |
switch (e.nodeName.toLowerCase()) { | |
case "button": | |
case "select": | |
case "textarea": | |
if (e.disabled) return !0; | |
break; | |
case "input": | |
if (this.deviceIsIOS && "file" === e.type || e.disabled) return !0; | |
break; | |
case "label": | |
case "video": | |
return !0 | |
} | |
return /\bneedsclick\b/.test(e.className) | |
}, FastClick.prototype.needsFocus = function (e) { | |
"use strict"; | |
switch (e.nodeName.toLowerCase()) { | |
case "textarea": | |
case "select": | |
return !0; | |
case "input": | |
switch (e.type) { | |
case "button": | |
case "checkbox": | |
case "file": | |
case "image": | |
case "radio": | |
case "submit": | |
return !1 | |
} | |
return !e.disabled && !e.readOnly; | |
default: | |
return /\bneedsfocus\b/.test(e.className) | |
} | |
}, FastClick.prototype.sendClick = function (e, t) { | |
"use strict"; | |
var i, n; | |
document.activeElement && document.activeElement !== e && document.activeElement.blur(), n = t.changedTouches[0], i = document.createEvent("MouseEvents"), i.initMouseEvent("click", !0, !0, window, 1, n.screenX, n.screenY, n.clientX, n.clientY, !1, !1, !1, !1, 0, null), i.forwardedTouchEvent = !0, e.dispatchEvent(i) | |
}, FastClick.prototype.focus = function (e) { | |
"use strict"; | |
var t; | |
this.deviceIsIOS && e.setSelectionRange ? (t = e.value.length, e.setSelectionRange(t, t)) : e.focus() | |
}, FastClick.prototype.updateScrollParent = function (e) { | |
"use strict"; | |
var t, i; | |
if (t = e.fastClickScrollParent, !t || !t.contains(e)) { | |
i = e; | |
do { | |
if (i.scrollHeight > i.offsetHeight) { | |
t = i, e.fastClickScrollParent = i; | |
break | |
} | |
i = i.parentElement | |
} while (i) | |
} | |
t && (t.fastClickLastScrollTop = t.scrollTop) | |
}, FastClick.prototype.getTargetElementFromEventTarget = function (e) { | |
"use strict"; | |
return e.nodeType === Node.TEXT_NODE ? e.parentNode : e | |
}, FastClick.prototype.onTouchStart = function (e) { | |
"use strict"; | |
var t, i, n; | |
if (e.targetTouches.length > 1) return !0; | |
if (t = this.getTargetElementFromEventTarget(e.target), i = e.targetTouches[0], this.deviceIsIOS) { | |
if (n = window.getSelection(), n.rangeCount && !n.isCollapsed) return !0; | |
if (!this.deviceIsIOS4) { | |
if (i.identifier === this.lastTouchIdentifier) return e.preventDefault(), !1; | |
this.lastTouchIdentifier = i.identifier, this.updateScrollParent(t) | |
} | |
} | |
return this.trackingClick = !0, this.trackingClickStart = e.timeStamp, this.targetElement = t, this.touchStartX = i.pageX, this.touchStartY = i.pageY, e.timeStamp - this.lastClickTime < 200 && e.preventDefault(), !0 | |
}, FastClick.prototype.touchHasMoved = function (e) { | |
"use strict"; | |
var t = e.changedTouches[0], | |
i = this.touchBoundary; | |
return Math.abs(t.pageX - this.touchStartX) > i || Math.abs(t.pageY - this.touchStartY) > i ? !0 : !1 | |
}, FastClick.prototype.findControl = function (e) { | |
"use strict"; | |
return void 0 !== e.control ? e.control : e.htmlFor ? document.getElementById(e.htmlFor) : e.querySelector("button, input:not([type=hidden]), keygen, meter, output, progress, select, textarea") | |
}, FastClick.prototype.onTouchEnd = function (e) { | |
"use strict"; | |
var t, i, n, r, s, o = this.targetElement; | |
if (this.touchHasMoved(e) && (this.trackingClick = !1, this.targetElement = null), !this.trackingClick) return !0; | |
if (e.timeStamp - this.lastClickTime < 200) return this.cancelNextClick = !0, !0; | |
if (this.lastClickTime = e.timeStamp, i = this.trackingClickStart, this.trackingClick = !1, this.trackingClickStart = 0, this.deviceIsIOSWithBadTarget && (s = e.changedTouches[0], o = document.elementFromPoint(s.pageX - window.pageXOffset, s.pageY - window.pageYOffset) || o, o.fastClickScrollParent = this.targetElement.fastClickScrollParent), n = o.tagName.toLowerCase(), "label" === n) { | |
if (t = this.findControl(o)) { | |
if (this.focus(o), this.deviceIsAndroid) return !1; | |
o = t | |
} | |
} else if (this.needsFocus(o)) return e.timeStamp - i > 100 || this.deviceIsIOS && window.top !== window && "input" === n ? (this.targetElement = null, !1) : (this.focus(o), this.deviceIsIOS4 && "select" === n || (this.targetElement = null, e.preventDefault()), !1); | |
return this.deviceIsIOS && !this.deviceIsIOS4 && (r = o.fastClickScrollParent, r && r.fastClickLastScrollTop !== r.scrollTop) ? !0 : (this.needsClick(o) || (e.preventDefault(), this.sendClick(o, e)), !1) | |
}, FastClick.prototype.onTouchCancel = function () { | |
"use strict"; | |
this.trackingClick = !1, this.targetElement = null | |
}, FastClick.prototype.onMouse = function (e) { | |
"use strict"; | |
return this.targetElement ? e.forwardedTouchEvent ? !0 : e.cancelable && (!this.needsClick(this.targetElement) || this.cancelNextClick) ? (e.stopImmediatePropagation ? e.stopImmediatePropagation() : e.propagationStopped = !0, e.stopPropagation(), e.preventDefault(), !1) : !0 : !0 | |
}, FastClick.prototype.onClick = function (e) { | |
"use strict"; | |
var t; | |
return this.trackingClick ? (this.targetElement = null, this.trackingClick = !1, !0) : "submit" === e.target.type && 0 === e.detail ? !0 : (t = this.onMouse(e), t || (this.targetElement = null), t) | |
}, FastClick.prototype.destroy = function () { | |
"use strict"; | |
var e = this.layer; | |
this.deviceIsAndroid && (e.removeEventListener("mouseover", this.onMouse, !0), e.removeEventListener("mousedown", this.onMouse, !0), e.removeEventListener("mouseup", this.onMouse, !0)), e.removeEventListener("click", this.onClick, !0), e.removeEventListener("touchstart", this.onTouchStart, !1), e.removeEventListener("touchend", this.onTouchEnd, !1), e.removeEventListener("touchcancel", this.onTouchCancel, !1) | |
}, FastClick.notNeeded = function (e) { | |
"use strict"; | |
var t; | |
if ("undefined" == typeof window.ontouchstart) return !0; | |
if (/Chrome\/[0-9]+/.test(navigator.userAgent)) { | |
if (!FastClick.prototype.deviceIsAndroid) return !0; | |
if (t = document.querySelector("meta[name=viewport]"), t && -1 !== t.content.indexOf("user-scalable=no")) return !0 | |
} | |
return "none" === e.style.msTouchAction ? !0 : !1 | |
}, FastClick.attach = function (e) { | |
"use strict"; | |
return new FastClick(e) | |
}, "undefined" != typeof define && define.amd ? define(function () { | |
"use strict"; | |
return FastClick | |
}) : "undefined" != typeof module && module.exports ? (module.exports = FastClick.attach, module.exports.FastClick = FastClick) : window.FastClick = FastClick, window.TD = window.TD || {}, window.TD.config = window.TD.config || {}, window.TD.metrics = function () { | |
var e = {}; | |
return e.history = [], e.DEBUG = TD.config.debug_level >= 4, e.throttle = 5e3, e.apiRoot = TD.config.api_root || "", e.namespaces = { | |
raw: "", | |
by_build: function () { | |
return TD.buildIDShort | |
}, | |
by_env: function () { | |
return TD.util && TD.util.getAppEnv ? TD.util.getAppEnv() : "unknown" | |
}, | |
by_version: function () { | |
return TD.version | |
} | |
}, e.log = function (t) { | |
e.history.add("log", t), e.realtime(t), e.scribe(t) | |
}, e.realtime = function () { | |
function t() { | |
e.send(r), r = { | |
counters: {} | |
}, n = null | |
} | |
function i(i) { | |
e.history.add("realtime", i), i.key = e.key(i.key); | |
var s = i.key.split(":"), | |
o = s.shift(), | |
a = Object.keys(e.namespaces).map(function (t) { | |
var i = e.namespaces[t]; | |
"function" == typeof e.namespaces[t] && (i = e.namespaces[t]()); | |
var n = e.key.bind(null, o, t, i).apply(null, s); | |
return n | |
}), | |
c = {}; | |
a.forEach(function (t) { | |
t.split(":").forEach(function (t, n, s) { | |
var o = n + 1, | |
a = s[o - 1]; | |
if (!e.namespaces.hasOwnProperty(a)) { | |
var u = s.slice(0, o).join(":"); | |
if (!c[u]) { | |
c[u] = !0, r.counters[u] = r.counters[u] || 0; | |
var l = "undefined" == typeof i.count ? 1 : parseInt(i.count, 10); | |
r.counters[u] += l | |
} | |
} | |
}) | |
}), e.throttle === !1 ? t() : n || (n = setTimeout(t, e.throttle)) | |
} | |
var n, r = { | |
counters: {} | |
}; | |
return i | |
}(), e.send = function (t) { | |
var i = new XMLHttpRequest; | |
i.open("post", e.apiRoot + "/metrics", !0), i.setRequestHeader("Content-Type", "application/json"); | |
try { | |
i.send(JSON.stringify(t) + "\n"), e.history.add("send", t) | |
} catch (n) {} | |
return i | |
}, e.scribe = function (t) { | |
if (TD && TD.controller && TD.controller.stats) { | |
var i, n = { | |
page: "main", | |
action: t.action | |
}; | |
try { | |
i = JSON.stringify(t) | |
} catch (r) { | |
i = '{"error": "Failed to parse metric data."}' | |
} | |
var s = { | |
event_info: i, | |
url: t.key | |
}; | |
return e.history.add("scribe", { | |
terms: n, | |
data: s | |
}), TD.controller.stats.generic(n, s) | |
} | |
}, e.key = function () { | |
var e = [].slice.call(arguments); | |
return ["blackbird"].concat(e).join(":").replace(/:{2,}/, ":").toLowerCase().replace(/^((?:blackbird:){2,})/, "blackbird:") | |
}, e.history.add = function (t, i) { | |
return e.DEBUG && console.log("metrics:", t, i), e.history.push({ | |
action: t, | |
data: i | |
}) | |
}, e.dump = function () { | |
console.log(JSON.stringify(e.history)) | |
}, e | |
}(), TD.metrics.error = function () { | |
var e = {}; | |
return e.preventCallThrough = !1, e.original = function () {}, e.handler = function (t, i, n, r, s) { | |
var o = { | |
action: "error", | |
data: {} | |
}; | |
return s ? (o.data.type = s.constructor.name, o.data.message = s.message, o.data.stack = s.stack) : (o.data.type = (t.match(/([a-z]+error)/i) || [])[1], o.data.message = (t.match(/:(.*)$/) || [])[1], o.data.message = (o.message || "").toString().trim()), o.data.file = i, o.data.line = n, o.data.column = r, o.key = TD.metrics.key(o.action, o.data.type), TD.metrics.log(o), e.preventCallThrough === !0 ? !0 : e.original.apply(null, arguments) | |
}, e.attach = function () { | |
e.attached || (e.attached = !0, e.original = window.onerror || e.original, window.onerror = e.handler) | |
}, e | |
}(), TD.metrics.event = function () { | |
var e = {}; | |
e.LOG = "metricLog", e.REALTIME = "metricRealtime", e.handler = function (t, i) { | |
if (e.attached && i) { | |
var n = e.makeMetric(i); | |
if (n) { | |
var r = "log"; | |
t.type === e.REALTIME && (r = "realtime"), TD.metrics[r](n) | |
} | |
} | |
}, e.makeMetric = function (e) { | |
return e.action ? (e.key || (e.key = e.action), e.key = TD.metrics.key(e.key), e.data = e.data || {}, e) : console.error("metric missing action:", e) | |
}, e.attach = function () { | |
e.attached || (e.attached = !0) | |
}; | |
try { | |
$(window).on([e.LOG, e.REALTIME].join(" "), e.handler) | |
} catch (t) { | |
console.error("Could not attach metric event listener.") | |
} | |
return e | |
}(), TD && TD.config && (TD.config.disable_metrics_error || TD.metrics.error.attach(), TD.config.disable_metrics_event || TD.metrics.event.attach()), TD.controller.feather = function () { | |
var exposed = {}; | |
return exposed.latestFeatherId = 18, exposed.loadFeathers = function (isRetry) { | |
var d = new TD.core.defer.Deferred; | |
return $.get(TD.config.api_root + "/web/scripts/unbundled/feathers.js").success(function (feathers) { | |
try { | |
eval(feathers), d.callback() | |
} catch (e) { | |
d.errback() | |
} | |
}).error(function () { | |
isRetry || exposed.loadFeathers(!0), d.errback() | |
}), d | |
}, exposed.applyFeathers = function (e) { | |
for (var t, i = exposed.latestFeatherId, n = _.sortBy(e, function (e) { | |
return e.id | |
}), r = 0; r < n.length; r++) | |
if (t = n[r], t.id > i) try { | |
t.patch(), i = t.id | |
} catch (s) { | |
console.log("Error patching feather id: " + t.id + " " + s) | |
} | |
exposed.latestFeatherId = i | |
}, setInterval(exposed.loadFeathers, 36e5), exposed | |
}(), | |
function (e) { | |
var t = {}; | |
e.publish = function (i, n) { | |
var r = t[i]; | |
r && e.each(r, function () { | |
this.apply(e, n || []) | |
}) | |
}, e.subscribe = function (e, i) { | |
return t[e] || (t[e] = []), t[e].push(i), [e, i] | |
}, e.unsubscribe = function (i) { | |
if (!(i && i instanceof Array)) throw new Error("unsubscribe(): handle must be an instance of Array."); | |
var n = i[0]; | |
t[n] && e.each(t[n], function (e) { | |
this == i[1] && t[n].splice(e, 1) | |
}) | |
}, e.unsubscribeAll = function (e) { | |
delete t[e] | |
} | |
}(jQuery), window.TD = window.TD || {}, TD.core = TD.core || {}, TD.core.base64 = function () { | |
var e = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", | |
t = function (e) { | |
e = e.replace(/\r\n/g, "\n"); | |
for (var t = "", i = 0; i < e.length; i++) { | |
var n = e.charCodeAt(i); | |
128 > n ? t += String.fromCharCode(n) : n > 127 && 2048 > n ? (t += String.fromCharCode(n >> 6 | 192), t += String.fromCharCode(63 & n | 128)) : (t += String.fromCharCode(n >> 12 | 224), t += String.fromCharCode(n >> 6 & 63 | 128), t += String.fromCharCode(63 & n | 128)) | |
} | |
return t | |
}, | |
i = function (e) { | |
for (var t = "", i = 0, n = c1 = c2 = 0; i < e.length;) n = e.charCodeAt(i), 128 > n ? (t += String.fromCharCode(n), i++) : n > 191 && 224 > n ? (c2 = e.charCodeAt(i + 1), t += String.fromCharCode((31 & n) << 6 | 63 & c2), i += 2) : (c2 = e.charCodeAt(i + 1), c3 = e.charCodeAt(i + 2), t += String.fromCharCode((15 & n) << 12 | (63 & c2) << 6 | 63 & c3), i += 3); | |
return t | |
}, | |
n = function (i) { | |
var n, r, s, o, a, c, u, l = "", | |
d = 0; | |
for (i = t(i); d < i.length;) n = i.charCodeAt(d++), r = i.charCodeAt(d++), s = i.charCodeAt(d++), o = n >> 2, a = (3 & n) << 4 | r >> 4, c = (15 & r) << 2 | s >> 6, u = 63 & s, isNaN(r) ? c = u = 64 : isNaN(s) && (u = 64), l = l + e.charAt(o) + e.charAt(a) + e.charAt(c) + e.charAt(u); | |
return l | |
}, | |
r = function (t) { | |
var n, r, s, o, a, c, u, l = "", | |
d = 0; | |
for (t = t.replace(/[^A-Za-z0-9\+\/\=]/g, ""); d < t.length;) o = e.indexOf(t.charAt(d++)), a = e.indexOf(t.charAt(d++)), c = e.indexOf(t.charAt(d++)), u = e.indexOf(t.charAt(d++)), n = o << 2 | a >> 4, r = (15 & a) << 4 | c >> 2, s = (3 & c) << 6 | u, l += String.fromCharCode(n), 64 != c && (l += String.fromCharCode(r)), 64 != u && (l += String.fromCharCode(s)); | |
return l = i(l) | |
}; | |
return { | |
encode: n, | |
decode: r | |
} | |
}(), | |
function () { | |
function e(e, t, i) { | |
for (var n = (i || 0) - 1, r = e ? e.length : 0; ++n < r;) | |
if (e[n] === t) return n; | |
return -1 | |
} | |
function t(t, i) { | |
var n = typeof i; | |
if (t = t.cache, "boolean" == n || null == i) return t[i] ? 0 : -1; | |
"number" != n && "string" != n && (n = "object"); | |
var r = "number" == n ? i : T + i; | |
return t = (t = t[n]) && t[r], "object" == n ? t && e(t, i) > -1 ? 0 : -1 : t ? 0 : -1 | |
} | |
function i(e) { | |
var t = this.cache, | |
i = typeof e; | |
if ("boolean" == i || null == e) t[e] = !0; | |
else { | |
"number" != i && "string" != i && (i = "object"); | |
var n = "number" == i ? e : T + e, | |
r = t[i] || (t[i] = {}); | |
"object" == i ? (r[n] || (r[n] = [])).push(e) : r[n] = !0 | |
} | |
} | |
function n(e) { | |
return e.charCodeAt(0) | |
} | |
function r(e, t) { | |
for (var i = e.criteria, n = t.criteria, r = -1, s = i.length; ++r < s;) { | |
var o = i[r], | |
a = n[r]; | |
if (o !== a) { | |
if (o > a || "undefined" == typeof o) return 1; | |
if (a > o || "undefined" == typeof a) return -1 | |
} | |
} | |
return e.index - t.index | |
} | |
function s(e) { | |
var t = -1, | |
n = e.length, | |
r = e[0], | |
s = e[n / 2 | 0], | |
o = e[n - 1]; | |
if (r && "object" == typeof r && s && "object" == typeof s && o && "object" == typeof o) return !1; | |
var a = c(); | |
a["false"] = a["null"] = a["true"] = a.undefined = !1; | |
var u = c(); | |
for (u.array = e, u.cache = a, u.push = i; ++t < n;) u.push(e[t]); | |
return u | |
} | |
function o(e) { | |
return "\\" + z[e] | |
} | |
function a() { | |
return f.pop() || [] | |
} | |
function c() { | |
return m.pop() || { | |
array: null, | |
cache: null, | |
criteria: null, | |
"false": !1, | |
index: 0, | |
"null": !1, | |
number: null, | |
object: null, | |
push: null, | |
string: null, | |
"true": !1, | |
undefined: !1, | |
value: null | |
} | |
} | |
function u(e) { | |
e.length = 0, f.length < y && f.push(e) | |
} | |
function l(e) { | |
var t = e.cache; | |
t && l(t), e.array = e.cache = e.criteria = e.object = e.number = e.string = e.value = null, m.length < y && m.push(e) | |
} | |
function d(e, t, i) { | |
t || (t = 0), "undefined" == typeof i && (i = e ? e.length : 0); | |
for (var n = -1, r = i - t || 0, s = Array(0 > r ? 0 : r); ++n < r;) s[n] = e[t + n]; | |
return s | |
} | |
function h(i) { | |
function f(e) { | |
return e && "object" == typeof e && !Jn(e) && Nn.call(e, "__wrapped__") ? e : new m(e) | |
} | |
function m(e, t) { | |
this.__chain__ = !!t, this.__wrapped__ = e | |
} | |
function y(e) { | |
function t() { | |
if (n) { | |
var e = d(n); | |
On.apply(e, arguments) | |
} | |
if (this instanceof t) { | |
var s = Y(i.prototype), | |
o = i.apply(s, e || arguments); | |
return Mt(o) ? o : s | |
} | |
return i.apply(r, e || arguments) | |
} | |
var i = e[0], | |
n = e[2], | |
r = e[4]; | |
return Xn(t, e), t | |
} | |
function z(e, t, i, n, r) { | |
if (i) { | |
var s = i(e); | |
if ("undefined" != typeof s) return s | |
} | |
var o = Mt(e); | |
if (!o) return e; | |
var c = An.call(e); | |
if (!W[c]) return e; | |
var l = Yn[c]; | |
switch (c) { | |
case F: | |
case U: | |
return new l(+e); | |
case P: | |
case H: | |
return new l(e); | |
case j: | |
return s = l(e.source, S.exec(e)), s.lastIndex = e.lastIndex, s | |
} | |
var h = Jn(e); | |
if (t) { | |
var p = !n; | |
n || (n = a()), r || (r = a()); | |
for (var f = n.length; f--;) | |
if (n[f] == e) return r[f]; | |
s = h ? l(e.length) : {} | |
} else s = h ? d(e) : sr({}, e); | |
return h && (Nn.call(e, "index") && (s.index = e.index), Nn.call(e, "input") && (s.input = e.input)), t ? (n.push(e), r.push(s), (h ? Qt : cr)(e, function (e, o) { | |
s[o] = z(e, t, i, n, r) | |
}), p && (u(n), u(r)), s) : s | |
} | |
function Y(e) { | |
return Mt(e) ? Bn(e) : {} | |
} | |
function Q(e, t, i) { | |
if ("function" != typeof e) return Xi; | |
if ("undefined" == typeof t || !("prototype" in e)) return e; | |
var n = e.__bindData__; | |
if ("undefined" == typeof n && (Qn.funcNames && (n = !e.name), n = n || !Qn.funcDecomp, !n)) { | |
var r = Ln.call(e); | |
Qn.funcNames || (n = !E.test(r)), n || (n = M.test(r), Xn(e, n)) | |
} | |
if (n === !1 || n !== !0 && 1 & n[1]) return e; | |
switch (i) { | |
case 1: | |
return function (i) { | |
return e.call(t, i) | |
}; | |
case 2: | |
return function (i, n) { | |
return e.call(t, i, n) | |
}; | |
case 3: | |
return function (i, n, r) { | |
return e.call(t, i, n, r) | |
}; | |
case 4: | |
return function (i, n, r, s) { | |
return e.call(t, i, n, r, s) | |
} | |
} | |
return Ni(e, t) | |
} | |
function X(e) { | |
function t() { | |
var e = c ? o : this; | |
if (r) { | |
var f = d(r); | |
On.apply(f, arguments) | |
} | |
if ((s || l) && (f || (f = d(arguments)), s && On.apply(f, s), l && f.length < a)) return n |= 16, X([i, h ? n : -4 & n, f, null, o, a]); | |
if (f || (f = arguments), u && (i = e[p]), this instanceof t) { | |
e = Y(i.prototype); | |
var m = i.apply(e, f); | |
return Mt(m) ? m : e | |
} | |
return i.apply(e, f) | |
} | |
var i = e[0], | |
n = e[1], | |
r = e[2], | |
s = e[3], | |
o = e[4], | |
a = e[5], | |
c = 1 & n, | |
u = 2 & n, | |
l = 4 & n, | |
h = 8 & n, | |
p = i; | |
return Xn(t, e), t | |
} | |
function J(i, n) { | |
var r = -1, | |
o = ct(), | |
a = i ? i.length : 0, | |
c = a >= v && o === e, | |
u = []; | |
if (c) { | |
var d = s(n); | |
d ? (o = t, n = d) : c = !1 | |
} | |
for (; ++r < a;) { | |
var h = i[r]; | |
o(n, h) < 0 && u.push(h) | |
} | |
return c && l(n), u | |
} | |
function et(e, t, i, n) { | |
for (var r = (n || 0) - 1, s = e ? e.length : 0, o = []; ++r < s;) { | |
var a = e[r]; | |
if (a && "object" == typeof a && "number" == typeof a.length && (Jn(a) || ht(a))) { | |
t || (a = et(a, t, i)); | |
var c = -1, | |
u = a.length, | |
l = o.length; | |
for (o.length += u; ++c < u;) o[l++] = a[c] | |
} else i || o.push(a) | |
} | |
return o | |
} | |
function tt(e, t, i, n, r, s) { | |
if (i) { | |
var o = i(e, t); | |
if ("undefined" != typeof o) return !!o | |
} | |
if (e === t) return 0 !== e || 1 / e == 1 / t; | |
var c = typeof e, | |
l = typeof t; | |
if (!(e !== e || e && V[c] || t && V[l])) return !1; | |
if (null == e || null == t) return e === t; | |
var d = An.call(e), | |
h = An.call(t); | |
if (d == N && (d = B), h == N && (h = B), d != h) return !1; | |
switch (d) { | |
case F: | |
case U: | |
return +e == +t; | |
case P: | |
return e != +e ? t != +t : 0 == e ? 1 / e == 1 / t : e == +t; | |
case j: | |
case H: | |
return e == _n(t) | |
} | |
var p = d == O; | |
if (!p) { | |
var f = Nn.call(e, "__wrapped__"), | |
m = Nn.call(t, "__wrapped__"); | |
if (f || m) return tt(f ? e.__wrapped__ : e, m ? t.__wrapped__ : t, i, n, r, s); | |
if (d != B) return !1; | |
var g = e.constructor, | |
T = t.constructor; | |
if (g != T && !(kt(g) && g instanceof g && kt(T) && T instanceof T) && "constructor" in e && "constructor" in t) return !1 | |
} | |
var v = !r; | |
r || (r = a()), s || (s = a()); | |
for (var y = r.length; y--;) | |
if (r[y] == e) return s[y] == t; | |
var D = 0; | |
if (o = !0, r.push(e), s.push(t), p) { | |
if (y = e.length, D = t.length, o = D == y, o || n) | |
for (; D--;) { | |
var w = y, | |
_ = t[D]; | |
if (n) | |
for (; w-- && !(o = tt(e[w], _, i, n, r, s));); | |
else if (!(o = tt(e[D], _, i, n, r, s))) break | |
} | |
} else ar(t, function (t, a, c) { | |
return Nn.call(c, a) ? (D++, o = Nn.call(e, a) && tt(e[a], t, i, n, r, s)) : void 0 | |
}), o && !n && ar(e, function (e, t, i) { | |
return Nn.call(i, t) ? o = --D > -1 : void 0 | |
}); | |
return r.pop(), s.pop(), v && (u(r), u(s)), o | |
} | |
function it(e, t, i, n, r) { | |
(Jn(t) ? Qt : cr)(t, function (t, s) { | |
var o, a, c = t, | |
u = e[s]; | |
if (t && ((a = Jn(t)) || ur(t))) { | |
for (var l = n.length; l--;) | |
if (o = n[l] == t) { | |
u = r[l]; | |
break | |
} | |
if (!o) { | |
var d; | |
i && (c = i(u, t), (d = "undefined" != typeof c) && (u = c)), d || (u = a ? Jn(u) ? u : [] : ur(u) ? u : {}), n.push(t), r.push(u), d || it(u, t, i, n, r) | |
} | |
} else i && (c = i(u, t), "undefined" == typeof c && (c = t)), "undefined" != typeof c && (u = c); | |
e[s] = u | |
}) | |
} | |
function nt(e, t) { | |
return e + xn(qn() * (t - e + 1)) | |
} | |
function rt(i, n, r) { | |
var o = -1, | |
c = ct(), | |
d = i ? i.length : 0, | |
h = [], | |
p = !n && d >= v && c === e, | |
f = r || p ? a() : h; | |
if (p) { | |
var m = s(f); | |
c = t, f = m | |
} | |
for (; ++o < d;) { | |
var g = i[o], | |
T = r ? r(g, o, i) : g; | |
(n ? !o || f[f.length - 1] !== T : c(f, T) < 0) && ((r || p) && f.push(T), h.push(g)) | |
} | |
return p ? (u(f.array), l(f)) : r && u(f), h | |
} | |
function st(e) { | |
return function (t, i, n) { | |
var r = {}; | |
i = f.createCallback(i, n, 3); | |
var s = -1, | |
o = t ? t.length : 0; | |
if ("number" == typeof o) | |
for (; ++s < o;) { | |
var a = t[s]; | |
e(r, a, i(a, s, t), t) | |
} else cr(t, function (t, n, s) { | |
e(r, t, i(t, n, s), s) | |
}); | |
return r | |
} | |
} | |
function ot(e, t, i, n, r, s) { | |
var o = 1 & t, | |
a = 2 & t, | |
c = 4 & t, | |
u = 16 & t, | |
l = 32 & t; | |
if (!a && !kt(e)) throw new bn; | |
u && !i.length && (t &= -17, u = i = !1), l && !n.length && (t &= -33, l = n = !1); | |
var h = e && e.__bindData__; | |
if (h && h !== !0) return h = d(h), h[2] && (h[2] = d(h[2])), h[3] && (h[3] = d(h[3])), !o || 1 & h[1] || (h[4] = r), !o && 1 & h[1] && (t |= 8), !c || 4 & h[1] || (h[5] = s), u && On.apply(h[2] || (h[2] = []), i), l && $n.apply(h[3] || (h[3] = []), n), h[1] |= t, ot.apply(null, h); | |
var p = 1 == t || 17 === t ? y : X; | |
return p([e, t, i, n, r, s]) | |
} | |
function at(e) { | |
return tr[e] | |
} | |
function ct() { | |
var t = (t = f.indexOf) === Ti ? e : t; | |
return t | |
} | |
function ut(e) { | |
return "function" == typeof e && In.test(e) | |
} | |
function lt(e) { | |
var t, i; | |
return e && An.call(e) == B && (t = e.constructor, !kt(t) || t instanceof t) ? (ar(e, function (e, t) { | |
i = t | |
}), "undefined" == typeof i || Nn.call(e, i)) : !1 | |
} | |
function dt(e) { | |
return ir[e] | |
} | |
function ht(e) { | |
return e && "object" == typeof e && "number" == typeof e.length && An.call(e) == N || !1 | |
} | |
function pt(e, t, i, n) { | |
return "boolean" != typeof t && null != t && (n = i, i = t, t = !1), z(e, t, "function" == typeof i && Q(i, n, 1)) | |
} | |
function ft(e, t, i) { | |
return z(e, !0, "function" == typeof t && Q(t, i, 1)) | |
} | |
function mt(e, t) { | |
var i = Y(e); | |
return t ? sr(i, t) : i | |
} | |
function gt(e, t, i) { | |
var n; | |
return t = f.createCallback(t, i, 3), cr(e, function (e, i, r) { | |
return t(e, i, r) ? (n = i, !1) : void 0 | |
}), n | |
} | |
function Tt(e, t, i) { | |
var n; | |
return t = f.createCallback(t, i, 3), yt(e, function (e, i, r) { | |
return t(e, i, r) ? (n = i, !1) : void 0 | |
}), n | |
} | |
function vt(e, t, i) { | |
var n = []; | |
ar(e, function (e, t) { | |
n.push(t, e) | |
}); | |
var r = n.length; | |
for (t = Q(t, i, 3); r-- && t(n[r--], n[r], e) !== !1;); | |
return e | |
} | |
function yt(e, t, i) { | |
var n = er(e), | |
r = n.length; | |
for (t = Q(t, i, 3); r--;) { | |
var s = n[r]; | |
if (t(e[s], s, e) === !1) break | |
} | |
return e | |
} | |
function Dt(e) { | |
var t = []; | |
return ar(e, function (e, i) { | |
kt(e) && t.push(i) | |
}), t.sort() | |
} | |
function wt(e, t) { | |
return e ? Nn.call(e, t) : !1 | |
} | |
function _t(e) { | |
for (var t = -1, i = er(e), n = i.length, r = {}; ++t < n;) { | |
var s = i[t]; | |
r[e[s]] = s | |
} | |
return r | |
} | |
function bt(e) { | |
return e === !0 || e === !1 || e && "object" == typeof e && An.call(e) == F || !1 | |
} | |
function Ct(e) { | |
return e && "object" == typeof e && An.call(e) == U || !1 | |
} | |
function St(e) { | |
return e && 1 === e.nodeType || !1 | |
} | |
function Et(e) { | |
var t = !0; | |
if (!e) return t; | |
var i = An.call(e), | |
n = e.length; | |
return i == O || i == H || i == N || i == B && "number" == typeof n && kt(e.splice) ? !n : (cr(e, function () { | |
return t = !1 | |
}), t) | |
} | |
function At(e, t, i, n) { | |
return tt(e, t, "function" == typeof i && Q(i, n, 2)) | |
} | |
function It(e) { | |
return Hn(e) && !Wn(parseFloat(e)) | |
} | |
function kt(e) { | |
return "function" == typeof e | |
} | |
function Mt(e) { | |
return !(!e || !V[typeof e]) | |
} | |
function xt(e) { | |
return Rt(e) && e != +e | |
} | |
function Lt(e) { | |
return null === e | |
} | |
function Rt(e) { | |
return "number" == typeof e || e && "object" == typeof e && An.call(e) == P || !1 | |
} | |
function Nt(e) { | |
return e && "object" == typeof e && An.call(e) == j || !1 | |
} | |
function Ot(e) { | |
return "string" == typeof e || e && "object" == typeof e && An.call(e) == H || !1 | |
} | |
function Ft(e) { | |
return "undefined" == typeof e | |
} | |
function Ut(e, t, i) { | |
var n = {}; | |
return t = f.createCallback(t, i, 3), cr(e, function (e, i, r) { | |
n[i] = t(e, i, r) | |
}), n | |
} | |
function $t(e) { | |
var t = arguments, | |
i = 2; | |
if (!Mt(e)) return e; | |
if ("number" != typeof t[2] && (i = t.length), i > 3 && "function" == typeof t[i - 2]) var n = Q(t[--i - 1], t[i--], 2); | |
else i > 2 && "function" == typeof t[i - 1] && (n = t[--i]); | |
for (var r = d(arguments, 1, i), s = -1, o = a(), c = a(); ++s < i;) it(e, r[s], n, o, c); | |
return u(o), u(c), e | |
} | |
function Pt(e, t, i) { | |
var n = {}; | |
if ("function" != typeof t) { | |
var r = []; | |
ar(e, function (e, t) { | |
r.push(t) | |
}), r = J(r, et(arguments, !0, !1, 1)); | |
for (var s = -1, o = r.length; ++s < o;) { | |
var a = r[s]; | |
n[a] = e[a] | |
} | |
} else t = f.createCallback(t, i, 3), ar(e, function (e, i, r) { | |
t(e, i, r) || (n[i] = e) | |
}); | |
return n | |
} | |
function Bt(e) { | |
for (var t = -1, i = er(e), n = i.length, r = fn(n); ++t < n;) { | |
var s = i[t]; | |
r[t] = [s, e[s]] | |
} | |
return r | |
} | |
function jt(e, t, i) { | |
var n = {}; | |
if ("function" != typeof t) | |
for (var r = -1, s = et(arguments, !0, !1, 1), o = Mt(e) ? s.length : 0; ++r < o;) { | |
var a = s[r]; | |
a in e && (n[a] = e[a]) | |
} else t = f.createCallback(t, i, 3), ar(e, function (e, i, r) { | |
t(e, i, r) && (n[i] = e) | |
}); | |
return n | |
} | |
function Ht(e, t, i, n) { | |
var r = Jn(e); | |
if (null == i) | |
if (r) i = []; | |
else { | |
var s = e && e.constructor, | |
o = s && s.prototype; | |
i = Y(o) | |
} | |
return t && (t = f.createCallback(t, n, 4), (r ? Qt : cr)(e, function (e, n, r) { | |
return t(i, e, n, r) | |
})), i | |
} | |
function Wt(e) { | |
for (var t = -1, i = er(e), n = i.length, r = fn(n); ++t < n;) r[t] = e[i[t]]; | |
return r | |
} | |
function Kt(e) { | |
for (var t = arguments, i = -1, n = et(t, !0, !1, 1), r = t[2] && t[2][t[1]] === e ? 1 : n.length, s = fn(r); ++i < r;) s[i] = e[n[i]]; | |
return s | |
} | |
function Gt(e, t, i) { | |
var n = -1, | |
r = ct(), | |
s = e ? e.length : 0, | |
o = !1; | |
return i = (0 > i ? Gn(0, s + i) : i) || 0, Jn(e) ? o = r(e, t, i) > -1 : "number" == typeof s ? o = (Ot(e) ? e.indexOf(t, i) : r(e, t, i)) > -1 : cr(e, function (e) { | |
return ++n >= i ? !(o = e === t) : void 0 | |
}), o | |
} | |
function Vt(e, t, i) { | |
var n = !0; | |
t = f.createCallback(t, i, 3); | |
var r = -1, | |
s = e ? e.length : 0; | |
if ("number" == typeof s) | |
for (; ++r < s && (n = !!t(e[r], r, e));); | |
else cr(e, function (e, i, r) { | |
return n = !!t(e, i, r) | |
}); | |
return n | |
} | |
function zt(e, t, i) { | |
var n = []; | |
t = f.createCallback(t, i, 3); | |
var r = -1, | |
s = e ? e.length : 0; | |
if ("number" == typeof s) | |
for (; ++r < s;) { | |
var o = e[r]; | |
t(o, r, e) && n.push(o) | |
} else cr(e, function (e, i, r) { | |
t(e, i, r) && n.push(e) | |
}); | |
return n | |
} | |
function qt(e, t, i) { | |
t = f.createCallback(t, i, 3); | |
var n = -1, | |
r = e ? e.length : 0; | |
if ("number" != typeof r) { | |
var s; | |
return cr(e, function (e, i, n) { | |
return t(e, i, n) ? (s = e, !1) : void 0 | |
}), s | |
} | |
for (; ++n < r;) { | |
var o = e[n]; | |
if (t(o, n, e)) return o | |
} | |
} | |
function Yt(e, t, i) { | |
var n; | |
return t = f.createCallback(t, i, 3), Xt(e, function (e, i, r) { | |
return t(e, i, r) ? (n = e, !1) : void 0 | |
}), n | |
} | |
function Qt(e, t, i) { | |
var n = -1, | |
r = e ? e.length : 0; | |
if (t = t && "undefined" == typeof i ? t : Q(t, i, 3), "number" == typeof r) | |
for (; ++n < r && t(e[n], n, e) !== !1;); | |
else cr(e, t); | |
return e | |
} | |
function Xt(e, t, i) { | |
var n = e ? e.length : 0; | |
if (t = t && "undefined" == typeof i ? t : Q(t, i, 3), "number" == typeof n) | |
for (; n-- && t(e[n], n, e) !== !1;); | |
else { | |
var r = er(e); | |
n = r.length, cr(e, function (e, i, s) { | |
return i = r ? r[--n] : --n, t(s[i], i, s) | |
}) | |
} | |
return e | |
} | |
function Jt(e, t) { | |
var i = d(arguments, 2), | |
n = -1, | |
r = "function" == typeof t, | |
s = e ? e.length : 0, | |
o = fn("number" == typeof s ? s : 0); | |
return Qt(e, function (e) { | |
o[++n] = (r ? t : e[t]).apply(e, i) | |
}), o | |
} | |
function Zt(e, t, i) { | |
var n = -1, | |
r = e ? e.length : 0; | |
if (t = f.createCallback(t, i, 3), "number" == typeof r) | |
for (var s = fn(r); ++n < r;) s[n] = t(e[n], n, e); | |
else s = [], cr(e, function (e, i, r) { | |
s[++n] = t(e, i, r) | |
}); | |
return s | |
} | |
function ei(e, t, i) { | |
var r = -1 / 0, | |
s = r; | |
if ("function" != typeof t && i && i[t] === e && (t = null), null == t && Jn(e)) | |
for (var o = -1, a = e.length; ++o < a;) { | |
var c = e[o]; | |
c > s && (s = c) | |
} else t = null == t && Ot(e) ? n : f.createCallback(t, i, 3), Qt(e, function (e, i, n) { | |
var o = t(e, i, n); | |
o > r && (r = o, s = e) | |
}); | |
return s | |
} | |
function ti(e, t, i) { | |
var r = 1 / 0, | |
s = r; | |
if ("function" != typeof t && i && i[t] === e && (t = null), null == t && Jn(e)) | |
for (var o = -1, a = e.length; ++o < a;) { | |
var c = e[o]; | |
s > c && (s = c) | |
} else t = null == t && Ot(e) ? n : f.createCallback(t, i, 3), Qt(e, function (e, i, n) { | |
var o = t(e, i, n); | |
r > o && (r = o, s = e) | |
}); | |
return s | |
} | |
function ii(e, t, i, n) { | |
if (!e) return i; | |
var r = arguments.length < 3; | |
t = f.createCallback(t, n, 4); | |
var s = -1, | |
o = e.length; | |
if ("number" == typeof o) | |
for (r && (i = e[++s]); ++s < o;) i = t(i, e[s], s, e); | |
else cr(e, function (e, n, s) { | |
i = r ? (r = !1, e) : t(i, e, n, s) | |
}); | |
return i | |
} | |
function ni(e, t, i, n) { | |
var r = arguments.length < 3; | |
return t = f.createCallback(t, n, 4), Xt(e, function (e, n, s) { | |
i = r ? (r = !1, e) : t(i, e, n, s) | |
}), i | |
} | |
function ri(e, t, i) { | |
return t = f.createCallback(t, i, 3), zt(e, function (e, i, n) { | |
return !t(e, i, n) | |
}) | |
} | |
function si(e, t, i) { | |
if (e && "number" != typeof e.length && (e = Wt(e)), null == t || i) return e ? e[nt(0, e.length - 1)] : p; | |
var n = oi(e); | |
return n.length = Vn(Gn(0, t), n.length), n | |
} | |
function oi(e) { | |
var t = -1, | |
i = e ? e.length : 0, | |
n = fn("number" == typeof i ? i : 0); | |
return Qt(e, function (e) { | |
var i = nt(0, ++t); | |
n[t] = n[i], n[i] = e | |
}), n | |
} | |
function ai(e) { | |
var t = e ? e.length : 0; | |
return "number" == typeof t ? t : er(e).length | |
} | |
function ci(e, t, i) { | |
var n; | |
t = f.createCallback(t, i, 3); | |
var r = -1, | |
s = e ? e.length : 0; | |
if ("number" == typeof s) | |
for (; ++r < s && !(n = t(e[r], r, e));); | |
else cr(e, function (e, i, r) { | |
return !(n = t(e, i, r)) | |
}); | |
return !!n | |
} | |
function ui(e, t, i) { | |
var n = -1, | |
s = Jn(t), | |
o = e ? e.length : 0, | |
d = fn("number" == typeof o ? o : 0); | |
for (s || (t = f.createCallback(t, i, 3)), Qt(e, function (e, i, r) { | |
var o = d[++n] = c(); | |
s ? o.criteria = Zt(t, function (t) { | |
return e[t] | |
}) : (o.criteria = a())[0] = t(e, i, r), o.index = n, o.value = e | |
}), o = d.length, d.sort(r); o--;) { | |
var h = d[o]; | |
d[o] = h.value, s || u(h.criteria), l(h) | |
} | |
return d | |
} | |
function li(e) { | |
return e && "number" == typeof e.length ? d(e) : Wt(e) | |
} | |
function di(e) { | |
for (var t = -1, i = e ? e.length : 0, n = []; ++t < i;) { | |
var r = e[t]; | |
r && n.push(r) | |
} | |
return n | |
} | |
function hi(e) { | |
return J(e, et(arguments, !0, !0, 1)) | |
} | |
function pi(e, t, i) { | |
var n = -1, | |
r = e ? e.length : 0; | |
for (t = f.createCallback(t, i, 3); ++n < r;) | |
if (t(e[n], n, e)) return n; | |
return -1 | |
} | |
function fi(e, t, i) { | |
var n = e ? e.length : 0; | |
for (t = f.createCallback(t, i, 3); n--;) | |
if (t(e[n], n, e)) return n; | |
return -1 | |
} | |
function mi(e, t, i) { | |
var n = 0, | |
r = e ? e.length : 0; | |
if ("number" != typeof t && null != t) { | |
var s = -1; | |
for (t = f.createCallback(t, i, 3); ++s < r && t(e[s], s, e);) n++ | |
} else if (n = t, null == n || i) return e ? e[0] : p; | |
return d(e, 0, Vn(Gn(0, n), r)) | |
} | |
function gi(e, t, i, n) { | |
return "boolean" != typeof t && null != t && (n = i, i = "function" != typeof t && n && n[t] === e ? null : t, t = !1), null != i && (e = Zt(e, i, n)), et(e, t) | |
} | |
function Ti(t, i, n) { | |
if ("number" == typeof n) { | |
var r = t ? t.length : 0; | |
n = 0 > n ? Gn(0, r + n) : n || 0 | |
} else if (n) { | |
var s = Ei(t, i); | |
return t[s] === i ? s : -1 | |
} | |
return e(t, i, n) | |
} | |
function vi(e, t, i) { | |
var n = 0, | |
r = e ? e.length : 0; | |
if ("number" != typeof t && null != t) { | |
var s = r; | |
for (t = f.createCallback(t, i, 3); s-- && t(e[s], s, e);) n++ | |
} else n = null == t || i ? 1 : t || n; | |
return d(e, 0, Vn(Gn(0, r - n), r)) | |
} | |
function yi() { | |
for (var i = [], n = -1, r = arguments.length, o = a(), c = ct(), d = c === e, h = a(); ++n < r;) { | |
var p = arguments[n]; | |
(Jn(p) || ht(p)) && (i.push(p), o.push(d && p.length >= v && s(n ? i[n] : h))) | |
} | |
var f = i[0], | |
m = -1, | |
g = f ? f.length : 0, | |
T = []; | |
e: for (; ++m < g;) { | |
var y = o[0]; | |
if (p = f[m], (y ? t(y, p) : c(h, p)) < 0) { | |
for (n = r, (y || h).push(p); --n;) | |
if (y = o[n], (y ? t(y, p) : c(i[n], p)) < 0) continue e; | |
T.push(p) | |
} | |
} | |
for (; r--;) y = o[r], y && l(y); | |
return u(o), u(h), T | |
} | |
function Di(e, t, i) { | |
var n = 0, | |
r = e ? e.length : 0; | |
if ("number" != typeof t && null != t) { | |
var s = r; | |
for (t = f.createCallback(t, i, 3); s-- && t(e[s], s, e);) n++ | |
} else if (n = t, null == n || i) return e ? e[r - 1] : p; | |
return d(e, Gn(0, r - n)) | |
} | |
function wi(e, t, i) { | |
var n = e ? e.length : 0; | |
for ("number" == typeof i && (n = (0 > i ? Gn(0, n + i) : Vn(i, n - 1)) + 1); n--;) | |
if (e[n] === t) return n; | |
return -1 | |
} | |
function _i(e) { | |
for (var t = arguments, i = 0, n = t.length, r = e ? e.length : 0; ++i < n;) | |
for (var s = -1, o = t[i]; ++s < r;) e[s] === o && (Un.call(e, s--, 1), r--); | |
return e | |
} | |
function bi(e, t, i) { | |
e = +e || 0, i = "number" == typeof i ? i : +i || 1, null == t && (t = e, e = 0); | |
for (var n = -1, r = Gn(0, kn((t - e) / (i || 1))), s = fn(r); ++n < r;) s[n] = e, e += i; | |
return s | |
} | |
function Ci(e, t, i) { | |
var n = -1, | |
r = e ? e.length : 0, | |
s = []; | |
for (t = f.createCallback(t, i, 3); ++n < r;) { | |
var o = e[n]; | |
t(o, n, e) && (s.push(o), Un.call(e, n--, 1), r--) | |
} | |
return s | |
} | |
function Si(e, t, i) { | |
if ("number" != typeof t && null != t) { | |
var n = 0, | |
r = -1, | |
s = e ? e.length : 0; | |
for (t = f.createCallback(t, i, 3); ++r < s && t(e[r], r, e);) n++ | |
} else n = null == t || i ? 1 : Gn(0, t); | |
return d(e, n) | |
} | |
function Ei(e, t, i, n) { | |
var r = 0, | |
s = e ? e.length : r; | |
for (i = i ? f.createCallback(i, n, 1) : Xi, t = i(t); s > r;) { | |
var o = r + s >>> 1; | |
i(e[o]) < t ? r = o + 1 : s = o | |
} | |
return r | |
} | |
function Ai() { | |
return rt(et(arguments, !0, !0)) | |
} | |
function Ii(e, t, i, n) { | |
return "boolean" != typeof t && null != t && (n = i, i = "function" != typeof t && n && n[t] === e ? null : t, t = !1), null != i && (i = f.createCallback(i, n, 3)), rt(e, t, i) | |
} | |
function ki(e) { | |
return J(e, d(arguments, 1)) | |
} | |
function Mi() { | |
for (var e = -1, t = arguments.length; ++e < t;) { | |
var i = arguments[e]; | |
if (Jn(i) || ht(i)) var n = n ? rt(J(n, i).concat(J(i, n))) : i | |
} | |
return n || [] | |
} | |
function xi() { | |
for (var e = arguments.length > 1 ? arguments : arguments[0], t = -1, i = e ? ei(pr(e, "length")) : 0, n = fn(0 > i ? 0 : i); ++t < i;) n[t] = pr(e, t); | |
return n | |
} | |
function Li(e, t) { | |
var i = -1, | |
n = e ? e.length : 0, | |
r = {}; | |
for (t || !n || Jn(e[0]) || (t = []); ++i < n;) { | |
var s = e[i]; | |
t ? r[s] = t[i] : s && (r[s[0]] = s[1]) | |
} | |
return r | |
} | |
function Ri(e, t) { | |
if (!kt(t)) throw new bn; | |
return function () { | |
return --e < 1 ? t.apply(this, arguments) : void 0 | |
} | |
} | |
function Ni(e, t) { | |
return arguments.length > 2 ? ot(e, 17, d(arguments, 2), null, t) : ot(e, 1, null, null, t) | |
} | |
function Oi(e) { | |
for (var t = arguments.length > 1 ? et(arguments, !0, !1, 1) : Dt(e), i = -1, n = t.length; ++i < n;) { | |
var r = t[i]; | |
e[r] = ot(e[r], 1, null, null, e) | |
} | |
return e | |
} | |
function Fi(e, t) { | |
return arguments.length > 2 ? ot(t, 19, d(arguments, 2), null, e) : ot(t, 3, null, null, e) | |
} | |
function Ui() { | |
for (var e = arguments, t = e.length; t--;) | |
if (!kt(e[t])) throw new bn; | |
return function () { | |
for (var t = arguments, i = e.length; i--;) t = [e[i].apply(this, t)]; | |
return t[0] | |
} | |
} | |
function $i(e, t) { | |
return t = "number" == typeof t ? t : +t || e.length, ot(e, 4, null, null, null, t) | |
} | |
function Pi(e, t, i) { | |
var n, r, s, o, a, c, u, l = 0, | |
d = !1, | |
h = !0; | |
if (!kt(e)) throw new bn; | |
if (t = Gn(0, t) || 0, i === !0) { | |
var f = !0; | |
h = !1 | |
} else Mt(i) && (f = i.leading, d = "maxWait" in i && (Gn(t, i.maxWait) || 0), h = "trailing" in i ? i.trailing : h); | |
var m = function () { | |
var i = t - (mr() - o); | |
if (0 >= i) { | |
r && Mn(r); | |
var d = u; | |
r = c = u = p, d && (l = mr(), s = e.apply(a, n), c || r || (n = a = null)) | |
} else c = Fn(m, i) | |
}, | |
g = function () { | |
c && Mn(c), r = c = u = p, (h || d !== t) && (l = mr(), s = e.apply(a, n), c || r || (n = a = null)) | |
}; | |
return function () { | |
if (n = arguments, o = mr(), a = this, u = h && (c || !f), d === !1) var i = f && !c; | |
else { | |
r || f || (l = o); | |
var p = d - (o - l), | |
T = 0 >= p; | |
T ? (r && (r = Mn(r)), l = o, s = e.apply(a, n)) : r || (r = Fn(g, p)) | |
} | |
return T && c ? c = Mn(c) : c || t === d || (c = Fn(m, t)), i && (T = !0, s = e.apply(a, n)), !T || c || r || (n = a = null), s | |
} | |
} | |
function Bi(e) { | |
if (!kt(e)) throw new bn; | |
var t = d(arguments, 1); | |
return Fn(function () { | |
e.apply(p, t) | |
}, 1) | |
} | |
function ji(e, t) { | |
if (!kt(e)) throw new bn; | |
var i = d(arguments, 2); | |
return Fn(function () { | |
e.apply(p, i) | |
}, t) | |
} | |
function Hi(e, t) { | |
if (!kt(e)) throw new bn; | |
var i = function () { | |
var n = i.cache, | |
r = t ? t.apply(this, arguments) : T + arguments[0]; | |
return Nn.call(n, r) ? n[r] : n[r] = e.apply(this, arguments) | |
}; | |
return i.cache = {}, i | |
} | |
function Wi(e) { | |
var t, i; | |
if (!kt(e)) throw new bn; | |
return function () { | |
return t ? i : (t = !0, i = e.apply(this, arguments), e = null, i) | |
} | |
} | |
function Ki(e) { | |
return ot(e, 16, d(arguments, 1)) | |
} | |
function Gi(e) { | |
return ot(e, 32, null, d(arguments, 1)) | |
} | |
function Vi(e, t, i) { | |
var n = !0, | |
r = !0; | |
if (!kt(e)) throw new bn; | |
return i === !1 ? n = !1 : Mt(i) && (n = "leading" in i ? i.leading : n, r = "trailing" in i ? i.trailing : r), K.leading = n, K.maxWait = t, K.trailing = r, Pi(e, t, K) | |
} | |
function zi(e, t) { | |
return ot(t, 16, [e]) | |
} | |
function qi(e) { | |
return function () { | |
return e | |
} | |
} | |
function Yi(e, t, i) { | |
var n = typeof e; | |
if (null == e || "function" == n) return Q(e, t, i); | |
if ("object" != n) return tn(e); | |
var r = er(e), | |
s = r[0], | |
o = e[s]; | |
return 1 != r.length || o !== o || Mt(o) ? function (t) { | |
for (var i = r.length, n = !1; i-- && (n = tt(t[r[i]], e[r[i]], null, !0));); | |
return n | |
} : function (e) { | |
var t = e[s]; | |
return o === t && (0 !== o || 1 / o == 1 / t) | |
} | |
} | |
function Qi(e) { | |
return null == e ? "" : _n(e).replace(rr, at) | |
} | |
function Xi(e) { | |
return e | |
} | |
function Ji(e, t, i) { | |
var n = !0, | |
r = t && Dt(t); | |
t && (i || r.length) || (null == i && (i = t), s = m, t = e, e = f, r = Dt(t)), i === !1 ? n = !1 : Mt(i) && "chain" in i && (n = i.chain); | |
var s = e, | |
o = kt(s); | |
Qt(r, function (i) { | |
var r = e[i] = t[i]; | |
o && (s.prototype[i] = function () { | |
var t = this.__chain__, | |
i = this.__wrapped__, | |
o = [i]; | |
On.apply(o, arguments); | |
var a = r.apply(e, o); | |
if (n || t) { | |
if (i === a && Mt(a)) return this; | |
a = new s(a), a.__chain__ = t | |
} | |
return a | |
}) | |
}) | |
} | |
function Zi() { | |
return i._ = En, this | |
} | |
function en() {} | |
function tn(e) { | |
return function (t) { | |
return t[e] | |
} | |
} | |
function nn(e, t, i) { | |
var n = null == e, | |
r = null == t; | |
if (null == i && ("boolean" == typeof e && r ? (i = e, e = 1) : r || "boolean" != typeof t || (i = t, r = !0)), n && r && (t = 1), e = +e || 0, r ? (t = e, e = 0) : t = +t || 0, i || e % 1 || t % 1) { | |
var s = qn(); | |
return Vn(e + s * (t - e + parseFloat("1e-" + ((s + "").length - 1))), t) | |
} | |
return nt(e, t) | |
} | |
function rn(e, t) { | |
if (e) { | |
var i = e[t]; | |
return kt(i) ? e[t]() : i | |
} | |
} | |
function sn(e, t, i) { | |
var n = f.templateSettings; | |
e = _n(e || ""), i = or({}, i, n); | |
var r, s = or({}, i.imports, n.imports), | |
a = er(s), | |
c = Wt(s), | |
u = 0, | |
l = i.interpolate || k, | |
d = "__p += '", | |
h = wn((i.escape || k).source + "|" + l.source + "|" + (l === A ? C : k).source + "|" + (i.evaluate || k).source + "|$", "g"); | |
e.replace(h, function (t, i, n, s, a, c) { | |
return n || (n = s), d += e.slice(u, c).replace(x, o), i && (d += "' +\n__e(" + i + ") +\n'"), a && (r = !0, d += "';\n" + a + ";\n__p += '"), n && (d += "' +\n((__t = (" + n + ")) == null ? '' : __t) +\n'"), u = c + t.length, t | |
}), d += "';\n"; | |
var m = i.variable, | |
g = m; | |
g || (m = "obj", d = "with (" + m + ") {\n" + d + "\n}\n"), d = (r ? d.replace(w, "") : d).replace(_, "$1").replace(b, "$1;"), d = "function(" + m + ") {\n" + (g ? "" : m + " || (" + m + " = {});\n") + "var __t, __p = '', __e = _.escape" + (r ? ", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n" : ";\n") + d + "return __p\n}"; | |
var T = "\n/*\n//# sourceURL=" + (i.sourceURL || "/lodash/template/source[" + R+++"]") + "\n*/"; | |
try { | |
var v = Tn(a, "return " + d + T).apply(p, c) | |
} catch (y) { | |
throw y.source = d, y | |
} | |
return t ? v(t) : (v.source = d, v) | |
} | |
function on(e, t, i) { | |
e = (e = +e) > -1 ? e : 0; | |
var n = -1, | |
r = fn(e); | |
for (t = Q(t, i, 1); ++n < e;) r[n] = t(n); | |
return r | |
} | |
function an(e) { | |
return null == e ? "" : _n(e).replace(nr, dt) | |
} | |
function cn(e) { | |
var t = ++g; | |
return _n(null == e ? "" : e) + t | |
} | |
function un(e) { | |
return e = new m(e), e.__chain__ = !0, e | |
} | |
function ln(e, t) { | |
return t(e), e | |
} | |
function dn() { | |
return this.__chain__ = !0, this | |
} | |
function hn() { | |
return _n(this.__wrapped__) | |
} | |
function pn() { | |
return this.__wrapped__ | |
} | |
i = i ? Z.defaults(q.Object(), i, Z.pick(q, L)) : q; | |
var fn = i.Array, | |
mn = i.Boolean, | |
gn = i.Date, | |
Tn = i.Function, | |
vn = i.Math, | |
yn = i.Number, | |
Dn = i.Object, | |
wn = i.RegExp, | |
_n = i.String, | |
bn = i.TypeError, | |
Cn = [], | |
Sn = Dn.prototype, | |
En = i._, | |
An = Sn.toString, | |
In = wn("^" + _n(An).replace(/[.*+?^${}()|[\]\\]/g, "\\$&").replace(/toString| for [^\]]+/g, ".*?") + "$"), | |
kn = vn.ceil, | |
Mn = i.clearTimeout, | |
xn = vn.floor, | |
Ln = Tn.prototype.toString, | |
Rn = ut(Rn = Dn.getPrototypeOf) && Rn, | |
Nn = Sn.hasOwnProperty, | |
On = Cn.push, | |
Fn = i.setTimeout, | |
Un = Cn.splice, | |
$n = Cn.unshift, | |
Pn = function () { | |
try { | |
var e = {}, | |
t = ut(t = Dn.defineProperty) && t, | |
i = t(e, e, e) && t | |
} catch (n) {} | |
return i | |
}(), | |
Bn = ut(Bn = Dn.create) && Bn, | |
jn = ut(jn = fn.isArray) && jn, | |
Hn = i.isFinite, | |
Wn = i.isNaN, | |
Kn = ut(Kn = Dn.keys) && Kn, | |
Gn = vn.max, | |
Vn = vn.min, | |
zn = i.parseInt, | |
qn = vn.random, | |
Yn = {}; | |
Yn[O] = fn, Yn[F] = mn, Yn[U] = gn, Yn[$] = Tn, Yn[B] = Dn, Yn[P] = yn, Yn[j] = wn, Yn[H] = _n, m.prototype = f.prototype; | |
var Qn = f.support = {}; | |
Qn.funcDecomp = !ut(i.WinRTError) && M.test(h), Qn.funcNames = "string" == typeof Tn.name, f.templateSettings = { | |
escape: /<%-([\s\S]+?)%>/g, | |
evaluate: /<%([\s\S]+?)%>/g, | |
interpolate: A, | |
variable: "", | |
imports: { | |
_: f | |
} | |
}, Bn || (Y = function () { | |
function e() {} | |
return function (t) { | |
if (Mt(t)) { | |
e.prototype = t; | |
var n = new e; | |
e.prototype = null | |
} | |
return n || i.Object() | |
} | |
}()); | |
var Xn = Pn ? function (e, t) { | |
G.value = t, Pn(e, "__bindData__", G) | |
} : en, | |
Jn = jn || function (e) { | |
return e && "object" == typeof e && "number" == typeof e.length && An.call(e) == O || !1 | |
}, | |
Zn = function (e) { | |
var t, i = e, | |
n = []; | |
if (!i) return n; | |
if (!V[typeof e]) return n; | |
for (t in i) Nn.call(i, t) && n.push(t); | |
return n | |
}, | |
er = Kn ? function (e) { | |
return Mt(e) ? Kn(e) : [] | |
} : Zn, | |
tr = { | |
"&": "&", | |
"<": "<", | |
">": ">", | |
'"': """, | |
"'": "'" | |
}, | |
ir = _t(tr), | |
nr = wn("(" + er(ir).join("|") + ")", "g"), | |
rr = wn("[" + er(tr).join("") + "]", "g"), | |
sr = function (e, t, i) { | |
var n, r = e, | |
s = r; | |
if (!r) return s; | |
var o = arguments, | |
a = 0, | |
c = "number" == typeof i ? 2 : o.length; | |
if (c > 3 && "function" == typeof o[c - 2]) var u = Q(o[--c - 1], o[c--], 2); | |
else c > 2 && "function" == typeof o[c - 1] && (u = o[--c]); | |
for (; ++a < c;) | |
if (r = o[a], r && V[typeof r]) | |
for (var l = -1, d = V[typeof r] && er(r), h = d ? d.length : 0; ++l < h;) n = d[l], s[n] = u ? u(s[n], r[n]) : r[n]; | |
return s | |
}, | |
or = function (e, t, i) { | |
var n, r = e, | |
s = r; | |
if (!r) return s; | |
for (var o = arguments, a = 0, c = "number" == typeof i ? 2 : o.length; ++a < c;) | |
if (r = o[a], r && V[typeof r]) | |
for (var u = -1, l = V[typeof r] && er(r), d = l ? l.length : 0; ++u < d;) n = l[u], "undefined" == typeof s[n] && (s[n] = r[n]); | |
return s | |
}, | |
ar = function (e, t, i) { | |
var n, r = e, | |
s = r; | |
if (!r) return s; | |
if (!V[typeof r]) return s; | |
t = t && "undefined" == typeof i ? t : Q(t, i, 3); | |
for (n in r) | |
if (t(r[n], n, e) === !1) return s; | |
return s | |
}, | |
cr = function (e, t, i) { | |
var n, r = e, | |
s = r; | |
if (!r) return s; | |
if (!V[typeof r]) return s; | |
t = t && "undefined" == typeof i ? t : Q(t, i, 3); | |
for (var o = -1, a = V[typeof r] && er(r), c = a ? a.length : 0; ++o < c;) | |
if (n = a[o], t(r[n], n, e) === !1) return s; | |
return s | |
}, | |
ur = Rn ? function (e) { | |
if (!e || An.call(e) != B) return !1; | |
var t = e.valueOf, | |
i = ut(t) && (i = Rn(t)) && Rn(i); | |
return i ? e == i || Rn(e) == i : lt(e) | |
} : lt, | |
lr = st(function (e, t, i) { | |
Nn.call(e, i) ? e[i]++ : e[i] = 1 | |
}), | |
dr = st(function (e, t, i) { | |
(Nn.call(e, i) ? e[i] : e[i] = []).push(t) | |
}), | |
hr = st(function (e, t, i) { | |
e[i] = t | |
}), | |
pr = Zt, | |
fr = zt, | |
mr = ut(mr = gn.now) && mr || function () { | |
return (new gn).getTime() | |
}, | |
gr = 8 == zn(D + "08") ? zn : function (e, t) { | |
return zn(Ot(e) ? e.replace(I, "") : e, t || 0) | |
}; | |
return f.after = Ri, f.assign = sr, f.at = Kt, f.bind = Ni, f.bindAll = Oi, f.bindKey = Fi, f.chain = un, f.compact = di, f.compose = Ui, f.constant = qi, f.countBy = lr, f.create = mt, f.createCallback = Yi, f.curry = $i, f.debounce = Pi, f.defaults = or, f.defer = Bi, f.delay = ji, f.difference = hi, f.filter = zt, f.flatten = gi, f.forEach = Qt, f.forEachRight = Xt, f.forIn = ar, f.forInRight = vt, f.forOwn = cr, f.forOwnRight = yt, f.functions = Dt, f.groupBy = dr, f.indexBy = hr, f.initial = vi, f.intersection = yi, f.invert = _t, f.invoke = Jt, f.keys = er, f.map = Zt, f.mapValues = Ut, f.max = ei, f.memoize = Hi, f.merge = $t, f.min = ti, f.omit = Pt, f.once = Wi, f.pairs = Bt, f.partial = Ki, f.partialRight = Gi, f.pick = jt, f.pluck = pr, f.property = tn, f.pull = _i, f.range = bi, f.reject = ri, f.remove = Ci, f.rest = Si, f.shuffle = oi, f.sortBy = ui, f.tap = ln, f.throttle = Vi, f.times = on, f.toArray = li, f.transform = Ht, f.union = Ai, f.uniq = Ii, f.values = Wt, f.where = fr, f.without = ki, f.wrap = zi, f.xor = Mi, f.zip = xi, f.zipObject = Li, f.collect = Zt, f.drop = Si, f.each = Qt, f.eachRight = Xt, f.extend = sr, f.methods = Dt, f.object = Li, f.select = zt, f.tail = Si, f.unique = Ii, f.unzip = xi, Ji(f), f.clone = pt, f.cloneDeep = ft, f.contains = Gt, f.escape = Qi, f.every = Vt, f.find = qt, f.findIndex = pi, f.findKey = gt, f.findLast = Yt, f.findLastIndex = fi, f.findLastKey = Tt, f.has = wt, f.identity = Xi, f.indexOf = Ti, f.isArguments = ht, f.isArray = Jn, f.isBoolean = bt, f.isDate = Ct, f.isElement = St, f.isEmpty = Et, f.isEqual = At, f.isFinite = It, f.isFunction = kt, f.isNaN = xt, f.isNull = Lt, f.isNumber = Rt, f.isObject = Mt, f.isPlainObject = ur, f.isRegExp = Nt, f.isString = Ot, f.isUndefined = Ft, f.lastIndexOf = wi, f.mixin = Ji, f.noConflict = Zi, f.noop = en, f.now = mr, f.parseInt = gr, f.random = nn, f.reduce = ii, f.reduceRight = ni, f.result = rn, f.runInContext = h, f.size = ai, f.some = ci, f.sortedIndex = Ei, f.template = sn, f.unescape = an, f.uniqueId = cn, f.all = Vt, f.any = ci, f.detect = qt, f.findWhere = qt, f.foldl = ii, f.foldr = ni, f.include = Gt, f.inject = ii, Ji(function () { | |
var e = {}; | |
return cr(f, function (t, i) { | |
f.prototype[i] || (e[i] = t) | |
}), e | |
}(), !1), f.first = mi, f.last = Di, f.sample = si, f.take = mi, f.head = mi, cr(f, function (e, t) { | |
var i = "sample" !== t; | |
f.prototype[t] || (f.prototype[t] = function (t, n) { | |
var r = this.__chain__, | |
s = e(this.__wrapped__, t, n); | |
return r || null != t && (!n || i && "function" == typeof t) ? new m(s, r) : s | |
}) | |
}), f.VERSION = "2.4.1", f.prototype.chain = dn, f.prototype.toString = hn, f.prototype.value = pn, f.prototype.valueOf = pn, Qt(["join", "pop", "shift"], function (e) { | |
var t = Cn[e]; | |
f.prototype[e] = function () { | |
var e = this.__chain__, | |
i = t.apply(this.__wrapped__, arguments); | |
return e ? new m(i, e) : i | |
} | |
}), Qt(["push", "reverse", "sort", "unshift"], function (e) { | |
var t = Cn[e]; | |
f.prototype[e] = function () { | |
return t.apply(this.__wrapped__, arguments), this | |
} | |
}), Qt(["concat", "slice", "splice"], function (e) { | |
var t = Cn[e]; | |
f.prototype[e] = function () { | |
return new m(t.apply(this.__wrapped__, arguments), this.__chain__) | |
} | |
}), f | |
} | |
var p, f = [], | |
m = [], | |
g = 0, | |
T = +new Date + "", | |
v = 75, | |
y = 40, | |
D = " \f \n\r\u2028\u2029áš€á Žâ€€â€â€‚         âŸã€€", | |
w = /\b__p \+= '';/g, | |
_ = /\b(__p \+=) '' \+/g, | |
b = /(__e\(.*?\)|\b__t\)) \+\n'';/g, | |
C = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g, | |
S = /\w*$/, | |
E = /^\s*function[ \n\r\t]+\w/, | |
A = /<%=([\s\S]+?)%>/g, | |
I = RegExp("^[" + D + "]*0+(?=.$)"), | |
k = /($^)/, | |
M = /\bthis\b/, | |
x = /['\n\r\t\u2028\u2029\\]/g, | |
L = ["Array", "Boolean", "Date", "Function", "Math", "Number", "Object", "RegExp", "String", "_", "attachEvent", "clearTimeout", "isFinite", "isNaN", "parseInt", "setTimeout"], | |
R = 0, | |
N = "[object Arguments]", | |
O = "[object Array]", | |
F = "[object Boolean]", | |
U = "[object Date]", | |
$ = "[object Function]", | |
P = "[object Number]", | |
B = "[object Object]", | |
j = "[object RegExp]", | |
H = "[object String]", | |
W = {}; | |
W[$] = !1, W[N] = W[O] = W[F] = W[U] = W[P] = W[B] = W[j] = W[H] = !0; | |
var K = { | |
leading: !1, | |
maxWait: 0, | |
trailing: !1 | |
}, | |
G = { | |
configurable: !1, | |
enumerable: !1, | |
value: null, | |
writable: !1 | |
}, | |
V = { | |
"boolean": !1, | |
"function": !0, | |
object: !0, | |
number: !1, | |
string: !1, | |
undefined: !1 | |
}, | |
z = { | |
"\\": "\\", | |
"'": "'", | |
"\n": "n", | |
"\r": "r", | |
" ": "t", | |
"\u2028": "u2028", | |
"\u2029": "u2029" | |
}, | |
q = V[typeof window] && window || this, | |
Y = V[typeof exports] && exports && !exports.nodeType && exports, | |
Q = V[typeof module] && module && !module.nodeType && module, | |
X = Q && Q.exports === Y && Y, | |
J = V[typeof global] && global; | |
!J || J.global !== J && J.window !== J || (q = J); | |
var Z = h(); | |
"function" == typeof define && "object" == typeof define.amd && define.amd ? (q._ = Z, define(function () { | |
return Z | |
})) : Y && Q ? X ? (Q.exports = Z)._ = Z : Y._ = Z : q._ = Z | |
}.call(this), | |
function () { | |
function e(e) { | |
return e ? t.escapeRegExp(e) : "\\s" | |
} | |
var t, i = String.prototype.trim; | |
t = this._s = { | |
capitalize: function (e) { | |
return e.charAt(0).toUpperCase() + e.substring(1).toLowerCase() | |
}, | |
join: function (e) { | |
for (var t = "", i = 1; i < arguments.length; i += 1) t += String(arguments[i]), i !== arguments.length - 1 && (t += String(e)); | |
return t | |
}, | |
escapeRegExp: function (e) { | |
return e.replace(/([-.*+?^${}()|[\]\/\\])/g, "\\$1") | |
}, | |
reverse: function (e) { | |
return Array.prototype.reverse.apply(e.split("")).join("") | |
}, | |
contains: function (e, t) { | |
return -1 !== e.indexOf(t) | |
}, | |
clean: function (e) { | |
return t.strip(e.replace(/\s+/g, " ")) | |
}, | |
trim: function (t, n) { | |
return !n && i ? i.call(t) : (n = e(n), t.replace(new RegExp("^[" + n + "]+|[" + n + "]+$", "g"), "")) | |
}, | |
ltrim: function (t, i) { | |
return i = e(i), t.replace(new RegExp("^[" + i + "]+", "g"), "") | |
}, | |
rtrim: function (t, i) { | |
return i = e(i), t.replace(new RegExp("[" + i + "]+$", "g"), "") | |
}, | |
startsWith: function (e, t) { | |
return e.length >= t.length && e.substring(0, t.length) === t | |
}, | |
endsWith: function (e, t) { | |
return e.length >= t.length && e.substring(e.length - t.length) === t | |
}, | |
sprintf: function () { | |
for (var e, t, i, n, r = 0, s = arguments[r++], o = []; s;) { | |
if (t = /^[^\x25]+/.exec(s)) o.push(t[0]); | |
else if (t = /^\x25{2}/.exec(s)) o.push("%"); | |
else { | |
if (!(t = /^\x25(?:(\d+)\$)?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-fosuxX])/.exec(s))) throw "Huh ?!"; | |
if (null == (e = arguments[t[1] || r++]) || void 0 == e) throw "Too few arguments."; | |
if (/[^s]/.test(t[7]) && "number" != typeof e) throw "Expecting number but found " + typeof e; | |
switch (t[7]) { | |
case "b": | |
e = e.toString(2); | |
break; | |
case "c": | |
e = String.fromCharCode(e); | |
break; | |
case "d": | |
e = parseInt(e); | |
break; | |
case "e": | |
e = t[6] ? e.toExponential(t[6]) : e.toExponential(); | |
break; | |
case "f": | |
e = t[6] ? parseFloat(e).toFixed(t[6]) : parseFloat(e); | |
break; | |
case "o": | |
e = e.toString(8); | |
break; | |
case "s": | |
e = (e = String(e)) && t[6] ? e.substring(0, t[6]) : e; | |
break; | |
case "u": | |
e = Math.abs(e); | |
break; | |
case "x": | |
e = e.toString(16); | |
break; | |
case "X": | |
e = e.toString(16).toUpperCase() | |
} | |
if (e = /[def]/.test(t[7]) && t[2] && e >= 0 ? "+" + e : e, i = t[3] ? "0" == t[3] ? "0" : t[3].charAt(1) : " ", n = t[5] - String(e).length - 0, t[5]) { | |
n = n; | |
for (var a = []; n > 0; a[--n] = i); | |
i = a.join("") | |
} else i = ""; | |
i = i, o.push("" + (t[4] ? e + i : i + e)) | |
} | |
s = s.substring(t[0].length) | |
} | |
return o.join("") | |
} | |
}, this._s.strip = t.trim, this._s.lstrip = t.ltrim, this._s.rstrip = t.rtrim, this._ && this._.mixin(this._s) | |
}(), window.TD = window.TD || {}, TD.core = TD.core || {}, TD.core.sha1 = function (e) { | |
function t(e, t) { | |
var i = e << t | e >>> 32 - t; | |
return i | |
} | |
function i(e) { | |
var t, i, n = ""; | |
for (t = 7; t >= 0; t--) i = e >>> 4 * t & 15, n += i.toString(16); | |
return n | |
} | |
function n(e) { | |
e = e.replace(/\r\n/g, "\n"); | |
for (var t = "", i = 0; i < e.length; i++) { | |
var n = e.charCodeAt(i); | |
128 > n ? t += String.fromCharCode(n) : n > 127 && 2048 > n ? (t += String.fromCharCode(n >> 6 | 192), t += String.fromCharCode(63 & n | 128)) : (t += String.fromCharCode(n >> 12 | 224), t += String.fromCharCode(n >> 6 & 63 | 128), t += String.fromCharCode(63 & n | 128)) | |
} | |
return t | |
} | |
var r, s, o, a, c, u, l, d, h, p = new Array(80), | |
f = 1732584193, | |
m = 4023233417, | |
g = 2562383102, | |
T = 271733878, | |
v = 3285377520; | |
e = n(e); | |
var y = e.length, | |
D = new Array; | |
for (s = 0; y - 3 > s; s += 4) o = e.charCodeAt(s) << 24 | e.charCodeAt(s + 1) << 16 | e.charCodeAt(s + 2) << 8 | e.charCodeAt(s + 3), D.push(o); | |
switch (y % 4) { | |
case 0: | |
s = 2147483648; | |
break; | |
case 1: | |
s = e.charCodeAt(y - 1) << 24 | 8388608; | |
break; | |
case 2: | |
s = e.charCodeAt(y - 2) << 24 | e.charCodeAt(y - 1) << 16 | 32768; | |
break; | |
case 3: | |
s = e.charCodeAt(y - 3) << 24 | e.charCodeAt(y - 2) << 16 | e.charCodeAt(y - 1) << 8 | 128 | |
} | |
for (D.push(s); D.length % 16 != 14;) D.push(0); | |
for (D.push(y >>> 29), D.push(y << 3 & 4294967295), r = 0; r < D.length; r += 16) { | |
for (s = 0; 16 > s; s++) p[s] = D[r + s]; | |
for (s = 16; 79 >= s; s++) p[s] = t(p[s - 3] ^ p[s - 8] ^ p[s - 14] ^ p[s - 16], 1); | |
for (a = f, c = m, u = g, l = T, d = v, s = 0; 19 >= s; s++) h = t(a, 5) + (c & u | ~c & l) + d + p[s] + 1518500249 & 4294967295, d = l, l = u, u = t(c, 30), c = a, a = h; | |
for (s = 20; 39 >= s; s++) h = t(a, 5) + (c ^ u ^ l) + d + p[s] + 1859775393 & 4294967295, d = l, l = u, u = t(c, 30), c = a, a = h; | |
for (s = 40; 59 >= s; s++) h = t(a, 5) + (c & u | c & l | u & l) + d + p[s] + 2400959708 & 4294967295, d = l, l = u, u = t(c, 30), c = a, a = h; | |
for (s = 60; 79 >= s; s++) h = t(a, 5) + (c ^ u ^ l) + d + p[s] + 3395469782 & 4294967295, d = l, l = u, u = t(c, 30), c = a, a = h; | |
f = f + a & 4294967295, m = m + c & 4294967295, g = g + u & 4294967295, T = T + l & 4294967295, v = v + d & 4294967295 | |
} | |
var h = i(f) + i(m) + i(g) + i(T) + i(v); | |
return h.toLowerCase() | |
}, | |
function () { | |
var e = 8, | |
t = "=", | |
i = 0, | |
n = function (t) { | |
var i, n = [], | |
r = (1 << e) - 1, | |
s = t.length * e; | |
for (i = 0; s > i; i += e) n[i >> 5] |= (t.charCodeAt(i / e) & r) << 32 - e - i % 32; | |
return n | |
}, | |
r = function (e) { | |
var t, i, n = [], | |
r = e.length; | |
for (t = 0; r > t; t += 2) { | |
if (i = parseInt(e.substr(t, 2), 16), isNaN(i)) return "INVALID HEX STRING"; | |
n[t >> 3] |= i << 24 - 4 * (t % 8) | |
} | |
return n | |
}, | |
s = function (e) { | |
var t, n, r = i ? "0123456789ABCDEF" : "0123456789abcdef", | |
s = "", | |
o = 4 * e.length; | |
for (t = 0; o > t; t += 1) n = e[t >> 2] >> 8 * (3 - t % 4), s += r.charAt(n >> 4 & 15) + r.charAt(15 & n); | |
return s | |
}, | |
o = function (e) { | |
var i, n, r, s = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", | |
o = "", | |
a = 4 * e.length; | |
for (i = 0; a > i; i += 3) | |
for (r = (e[i >> 2] >> 8 * (3 - i % 4) & 255) << 16 | (e[i + 1 >> 2] >> 8 * (3 - (i + 1) % 4) & 255) << 8 | e[i + 2 >> 2] >> 8 * (3 - (i + 2) % 4) & 255, n = 0; 4 > n; n += 1) o += 8 * i + 6 * n <= 32 * e.length ? s.charAt(r >> 6 * (3 - n) & 63) : t; | |
return o | |
}, | |
a = function (e, t) { | |
return e >>> t | e << 32 - t | |
}, | |
c = function (e, t) { | |
return e >>> t | |
}, | |
u = function (e, t, i) { | |
return e & t ^ ~e & i | |
}, | |
l = function (e, t, i) { | |
return e & t ^ e & i ^ t & i | |
}, | |
d = function (e) { | |
return a(e, 2) ^ a(e, 13) ^ a(e, 22) | |
}, | |
h = function (e) { | |
return a(e, 6) ^ a(e, 11) ^ a(e, 25) | |
}, | |
p = function (e) { | |
return a(e, 7) ^ a(e, 18) ^ c(e, 3) | |
}, | |
f = function (e) { | |
return a(e, 17) ^ a(e, 19) ^ c(e, 10) | |
}, | |
m = function (e, t) { | |
var i = (65535 & e) + (65535 & t), | |
n = (e >>> 16) + (t >>> 16) + (i >>> 16); | |
return (65535 & n) << 16 | 65535 & i | |
}, | |
g = function (e, t, i, n) { | |
var r = (65535 & e) + (65535 & t) + (65535 & i) + (65535 & n), | |
s = (e >>> 16) + (t >>> 16) + (i >>> 16) + (n >>> 16) + (r >>> 16); | |
return (65535 & s) << 16 | 65535 & r | |
}, | |
T = function (e, t, i, n, r) { | |
var s = (65535 & e) + (65535 & t) + (65535 & i) + (65535 & n) + (65535 & r), | |
o = (e >>> 16) + (t >>> 16) + (i >>> 16) + (n >>> 16) + (r >>> 16) + (s >>> 16); | |
return (65535 & o) << 16 | 65535 & s | |
}, | |
v = function (e, t, i) { | |
var n, r, s, o, a, c, v, y, D, w, _, b, C, S, E, A, I = []; | |
for (("SHA-224" === i || "SHA-256" === i) && (b = (t + 65 >> 9 << 4) + 15, E = [1116352408, 1899447441, 3049323471, 3921009573, 961987163, 1508970993, 2453635748, 2870763221, 3624381080, 310598401, 607225278, 1426881987, 1925078388, 2162078206, 2614888103, 3248222580, 3835390401, 4022224774, 264347078, 604807628, 770255983, 1249150122, 1555081692, 1996064986, 2554220882, 2821834349, 2952996808, 3210313671, 3336571891, 3584528711, 113926993, 338241895, 666307205, 773529912, 1294757372, 1396182291, 1695183700, 1986661051, 2177026350, 2456956037, 2730485921, 2820302411, 3259730800, 3345764771, 3516065817, 3600352804, 4094571909, 275423344, 430227734, 506948616, 659060556, 883997877, 958139571, 1322822218, 1537002063, 1747873779, 1955562222, 2024104815, 2227730452, 2361852424, 2428436474, 2756734187, 3204031479, 3329325298], _ = "SHA-224" === i ? [3238371032, 914150663, 812702999, 4144912697, 4290775857, 1750603025, 1694076839, 3204075428] : [1779033703, 3144134277, 1013904242, 2773480762, 1359893119, 2600822924, 528734635, 1541459225]), e[t >> 5] |= 128 << 24 - t % 32, e[b] = t, A = e.length, C = 0; A > C; C += 16) { | |
for (n = _[0], r = _[1], s = _[2], o = _[3], a = _[4], c = _[5], v = _[6], y = _[7], S = 0; 64 > S; S += 1) I[S] = 16 > S ? e[S + C] : g(f(I[S - 2]), I[S - 7], p(I[S - 15]), I[S - 16]), D = T(y, h(a), u(a, c, v), E[S], I[S]), w = m(d(n), l(n, r, s)), y = v, v = c, c = a, a = m(o, D), o = s, s = r, r = n, n = m(D, w); | |
_[0] = m(n, _[0]), _[1] = m(r, _[1]), _[2] = m(s, _[2]), _[3] = m(o, _[3]), _[4] = m(a, _[4]), _[5] = m(c, _[5]), _[6] = m(v, _[6]), _[7] = m(y, _[7]) | |
} | |
switch (i) { | |
case "SHA-224": | |
return [_[0], _[1], _[2], _[3], _[4], _[5], _[6]]; | |
case "SHA-256": | |
return _; | |
default: | |
return [] | |
} | |
}, | |
y = function (t, i) { | |
if (this.sha224 = null, this.sha256 = null, this.strBinLen = null, this.strToHash = null, "HEX" === i) { | |
if (0 !== t.length % 2) return "TEXT MUST BE IN BYTE INCREMENTS"; | |
this.strBinLen = 4 * t.length, this.strToHash = r(t) | |
} else { | |
if ("ASCII" !== i && "undefined" != typeof i) return "UNKNOWN TEXT INPUT TYPE"; | |
this.strBinLen = t.length * e, this.strToHash = n(t) | |
} | |
}; | |
y.prototype = { | |
getHash: function (e, t) { | |
var i = null, | |
n = this.strToHash.slice(); | |
switch (t) { | |
case "HEX": | |
i = s; | |
break; | |
case "B64": | |
i = o; | |
break; | |
default: | |
return "FORMAT NOT RECOGNIZED" | |
} | |
switch (e) { | |
case "SHA-224": | |
return null === this.sha224 && (this.sha224 = v(n, this.strBinLen, e)), i(this.sha224); | |
case "SHA-256": | |
return null === this.sha256 && (this.sha256 = v(n, this.strBinLen, e)), i(this.sha256); | |
default: | |
return "HASH NOT RECOGNIZED" | |
} | |
}, | |
getHMAC: function (t, i, a, c) { | |
var u, l, d, h, p, f, m = [], | |
g = []; | |
switch (c) { | |
case "HEX": | |
u = s; | |
break; | |
case "B64": | |
u = o; | |
break; | |
default: | |
return "FORMAT NOT RECOGNIZED" | |
} | |
switch (a) { | |
case "SHA-224": | |
f = 224; | |
break; | |
case "SHA-256": | |
f = 256; | |
break; | |
default: | |
return "HASH NOT RECOGNIZED" | |
} | |
if ("HEX" === i) { | |
if (0 !== t.length % 2) return "KEY MUST BE IN BYTE INCREMENTS"; | |
l = r(t), p = 4 * t.length | |
} else { | |
if ("ASCII" !== i) return "UNKNOWN KEY INPUT TYPE"; | |
l = n(t), p = t.length * e | |
} | |
for (p / 8 > 64 ? (l = v(l, p, a), l[15] &= 4294967040) : 64 > p / 8 && (l[15] &= 4294967040), d = 0; 15 >= d; d += 1) m[d] = 909522486 ^ l[d], g[d] = 1549556828 ^ l[d]; | |
return h = v(m.concat(this.strToHash), 512 + this.strBinLen, a), h = v(g.concat(h), 512 + f, a), u(h) | |
} | |
}, window.jsSHA = y | |
}(), TD.util = function () { | |
var e, t, i, n, r, s, o, a = 0, | |
c = 1e3, | |
u = 60 * c, | |
l = 60 * u, | |
d = 24 * l, | |
h = /(.+)(?:_normal)\.(\w+)$/, | |
p = new RegExp("<(?:.|\\n)*?>", "gm"), | |
f = /\B(?=(\d{3})+(?!\d))/g, | |
m = /^[@\uff20]?/, | |
g = /^https?:\/\/twitter\.com\/([a-zA-Z0-9_-]+)(?:(?:\/status(?:es)?\/([0-9]+))?|(?:(\/(?:lists|timelines)\/)|\/)?([a-zA-Z0-9_-]+))\/?(\?.*)?$/, | |
T = /^#column=([a-zA-Z0-9+\/=]+)$/, | |
v = /^https?:\/\/tweetdeck.twitter.com\/(#[a-zA-Z0-9+\/=]+)$/, | |
y = ["404", "500", "about", "account", "help", "jobs", "privacy", "search", "search-advanced", "tos"], | |
D = document.createElement("div"), | |
w = document.createElement("div"), | |
b = !isNaN(new Date("Mon Oct 08 16:34:01 +0000 2012").getTime()); | |
return $.subscribe("/date", function (e) { | |
var t = TD.util.parseDateString(e).getTime(), | |
i = (new Date).getTime(); | |
a = t - i | |
}), { | |
ANCHOR_TAG_REGEXP: /href=/g, | |
LT_REGEXP: /</g, | |
GT_REGEXP: />/g, | |
SINGLE_QUOTE_REGEXP: /'/g, | |
QUOTE_REGEXP: /"/g, | |
TWITTER_USERNAME_REGEXP: /@([A-Za-z0-9_]+)/g, | |
parseDateString: function (e) { | |
var t; | |
return t = new Date(!b && e ? Date.parse(e.replace(/( \+)/, " UTC$1")) : e) | |
}, | |
parseISO8601: function (e) { | |
var t = e.split("+"), | |
i = t[0].split("T"), | |
n = i[0].split("-"), | |
r = i[1].split("Z"), | |
s = r[0].split(":"), | |
o = s[2].split("."), | |
a = Number(s[0]), | |
c = new Date; | |
return c.setUTCDate(1), c.setUTCMonth(0), c.setUTCFullYear(Number(n[0])), c.setUTCMonth(Number(n[1]) - 1), c.setUTCDate(Number(n[2])), c.setUTCHours(Number(a)), c.setUTCMinutes(Number(s[1])), c.setUTCSeconds(Number(o[0])), c.setUTCMilliseconds(o[1] ? Number(o[1].substring(0, 3)) : 0), c | |
}, | |
iso8601: function (e) { | |
e || (e = new Date); | |
var t = ("000" + e.getUTCFullYear()).slice(-4) + "-" + ("0" + (e.getUTCMonth() + 1)).slice(-2) + "-" + ("0" + e.getUTCDate()).slice(-2) + "T" + ("0" + e.getUTCHours()).slice(-2) + ":" + ("0" + e.getUTCMinutes()).slice(-2) + ":" + ("0" + e.getUTCSeconds()).slice(-2); | |
return e.getMilliseconds() && (t += "." + ("000" + e.getMilliseconds()).slice(-3)), t | |
}, | |
unixTime: function (e) { | |
return Math.round(e.getTime() / 1e3) | |
}, | |
prettyDate: function (e) { | |
return TD.util.timeAgo(e.getTime(), !1, !0) | |
}, | |
clean: function (e) { | |
return e ? e.replace(this.LT_REGEXP, "<").replace(this.GT_REGEXP, ">").replace(this.SINGLE_QUOTE_REGEXP, "'").replace(this.QUOTE_REGEXP, """) : e | |
}, | |
removeHTMLCodes: function (e) { | |
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, '"') | |
}, | |
stripHTMLTags: function (e) { | |
return e.replace(p, "") | |
}, | |
htmlToText: function (e) { | |
return $("<div>" + e + "</div>").text() | |
}, | |
h: function (e) { | |
var t = $("<div/>"), | |
i = function (e) { | |
return e ? t.text(e).html().replace(/\"/gi, """) : e | |
}; | |
return this.h = function (e) { | |
return i(e) | |
}, i(e) | |
}, | |
transform: function (e, t) { | |
return e ? (t = t || {}, this.updateEntities(e, t), e = this.linkify(e, t), this.emojify(e)) : "" | |
}, | |
_parseTextOnly: function (e, t) { | |
for (var i, n = e.childNodes, r = n.length, s = 0; r > s; s++) i = n[s], 3 === i.nodeType && TD.emoji.test(i.nodeValue) ? t.push(i) : i.hasChildNodes() && this._parseTextOnly(i, t) | |
}, | |
_replaceTextOnly: function (e) { | |
for (var t, i, n = e.length, r = 0; n > r; r++) { | |
for (t = e[r], w.innerHTML = TD.emoji.parse(t.nodeValue), i = document.createDocumentFragment(); w.hasChildNodes();) i.appendChild(w.firstChild); | |
t.parentNode.replaceChild(i, t) | |
} | |
}, | |
emojify: function (e) { | |
var t; | |
return TD.emoji.test(e) && (D.innerHTML = e, t = [], this._parseTextOnly(D, t), this._replaceTextOnly(t), e = D.innerHTML, D.innerHTML = ""), e | |
}, | |
updateEntities: function (e, t) { | |
var i, n, r, s, o, a, c, u = twttr.txt.modifyIndicesFromUnicodeToUTF16; | |
if (t.media && t.media.length ? u(e, t.media) : t.media = [], t.urls && t.urls.length) u(e, t.urls); | |
else { | |
for (n = this.extractURLEntities(e), c = {}, t.urls = [], r = 0; r < t.media.length; r++) c[t.media[r].url] = !0; | |
for (r = 0; r < n.length; r++) c[n[r].url] || t.urls.push(n[r]) | |
} | |
for (t.hashtags && t.hashtags.length ? u(e, t.hashtags) : t.hashtags = this.extractHashtagEntities(e), t.user_mentions && t.user_mentions.length ? u(e, t.user_mentions) : t.user_mentions = [], t.cashtags = twttr.txt.extractCashtagsWithIndices(e), i = this.extractMentionEntities(e), r = 0, s = i.length; s > r; r++) o = i[r], a = this.getEntityOverlap(o, t), a ? o.list_slug && o.indices[0] === a.indices[0] && (a.indices = o.indices, a.list_slug = o.list_slug) : t.user_mentions.push(o); | |
return t | |
}, | |
extractURLEntities: function (e) { | |
return twttr.txt.extractUrlsWithIndices(e) | |
}, | |
extractMentionEntities: function (e) { | |
var t = twttr.txt.extractMentionsOrListsWithIndices(e); | |
return _.each(t, function (e) { | |
e.screen_name = e.screenName, e.list_slug = e.listSlug, delete e.screenName, delete e.listSlug | |
}), t | |
}, | |
extractHashtagEntities: function (e) { | |
var t = twttr.txt.extractHashtagsWithIndices(e); | |
return _.each(t, function (e) { | |
e.text = e.hashtag, delete e.hashtag | |
}), t | |
}, | |
getEntityOverlap: function (e, t) { | |
var i = t.urls; | |
i = i.concat(t.media), i = i.concat(t.user_mentions), i = i.concat(t.hashtags); | |
for (var n = 0, r = i.length; r > n; n++) | |
if (e.indices[0] < i[n].indices[1] && e.indices[1] > i[n].indices[0]) return i[n]; | |
return null | |
}, | |
linkify: function (e, t) { | |
var i, n, r, s, o, a, c = "", | |
u = t.urls || []; | |
u = u.concat(t.media || []), u = u.concat(t.user_mentions || []), u = u.concat(t.hashtags || []), u = u.concat(t.cashtags || []), u.sort(function (e, t) { | |
return t.indices[0] - e.indices[0] | |
}); | |
for (var l = 0, d = u.length; d > l; l++) s = u[l], i = e.substring(0, s.indices[0]), n = e.substring(s.indices[0], s.indices[1]), r = e.substring(s.indices[1]), o = "", s.url ? o = n === s.url ? this.createUrlAnchor(s) : n : s.screen_name ? o = s.list_slug ? TD.ui.template.render("text/list_link_slug", { | |
slug: s.list_slug.substr(1), | |
user: { | |
screenName: s.screen_name | |
}, | |
fullName: "@" + s.screen_name + s.list_slug | |
}) : TD.ui.template.render("text/profile_link", { | |
user: { | |
screenName: s.screen_name | |
} | |
}) : s.text ? (a = { | |
searchTerm: s.text, | |
symbol: "#", | |
escapedSymbol: escape("#") | |
}, o = TD.ui.template.render("text/search_link", a)) : s.cashtag && (a = { | |
searchTerm: s.cashtag, | |
symbol: "$", | |
escapedSymbol: escape("$") | |
}, o = TD.ui.template.render("text/search_link", a)), c = o + this.clean(r) + c, e = i; | |
return this.clean(e) + c | |
}, | |
extractTweetIdFromPermalink: function (e) { | |
var t, i = e.trim().match(g); | |
return i && (t = i[2]), t | |
}, | |
extractTweetDeckSharedColumnFromFragment: function (e) { | |
var t = e.match(T), | |
i = t ? t[1] : ""; | |
return i | |
}, | |
createUrlAnchor: function (e) { | |
var t, i, n, r, s, o = e.url, | |
a = "url", | |
c = e.expanded_url || e.url, | |
u = c.match(g), | |
l = c.match(v), | |
d = l ? this.extractTweetDeckSharedColumnFromFragment(l[1]) : ""; | |
u && (i = u[1], n = u[2], u[3] && (r = u[3].replace(/\//g, "")), s = u[4]); | |
var h = i && s && !(n || r); | |
return (-1 !== y.indexOf(i) || h) && (i = void 0, s = void 0, n = void 0, r = void 0, d = void 0), _.startsWith(o, "https://") || _.startsWith(o, "http://") || (o = "http://" + o), t = '<a href="' + TD.util.escape(o) + '" target="_blank" class="url-ext" ', e.expanded_url && (t += 'data-full-url="' + TD.util.escape(e.expanded_url) + '" '), n ? (a = "tweet", t += 'data-tweet-id="' + n + '" ') : s ? (t += 'data-screen-name="' + i + '" ', a = "timelines" === r ? "viewCustomTimeline" : "list", t += 'data-slug="' + s + '" ') : i ? (a = "user", t += 'data-user-name="' + i + '" ') : d && (a = "importSerializedColumn", t += 'data-serialized-column="' + d + '" '), t += 'rel="' + a + '" ', e.display_url && e.expanded_url && 8230 == e.display_url.charCodeAt(e.display_url.length - 1) && (t += 'title="' + TD.util.escape(e.expanded_url) + '" '), t += ">" + TD.util.escape(e.display_url || e.url) + "</a>" | |
}, | |
pluralise: function (e, t, i) { | |
return 1 != i ? t : e | |
}, | |
atMentionify: function (e) { | |
return e.replace(m, "@") | |
}, | |
deMentionify: function (e) { | |
return e.replace(m, "") | |
}, | |
selectAttrsFrom: function (e, t) { | |
for (var i = {}, n = 0; n < t.length; n++) i[t[n]] = e[t[n]]; | |
return i | |
}, | |
values: function (e) { | |
var t = []; | |
for (var i in e) e.hasOwnProperty(i) && t.push(e[i]); | |
return t | |
}, | |
isEmpty: _.isEmpty, | |
isMacApp: function () { | |
return null == e && (e = "mac" === TD.util.getAppEnv()), e | |
}, | |
isChromeApp: function () { | |
return null == t && (t = _.startsWith(window.location.href, "chrome-extension://")), t | |
}, | |
isChrome: function () { | |
return null == i && (i = window.navigator.userAgent.indexOf("Chrome") > -1), i | |
}, | |
isWrapperApp: function () { | |
return null == r && (r = Boolean(window.deck && deck.inApp())), r | |
}, | |
visibilityChangeEventName: function () { | |
return null == n && ("undefined" != typeof document.hidden ? n = "visibilitychange" : "undefined" != typeof document.mozHidden ? n = "mozvisibilitychange" : "undefined" != typeof document.msHidden ? n = "msvisibilitychange" : "undefined" != typeof document.webkitHidden && (n = "webkitvisibilitychange")), n | |
}, | |
documentIsHidden: function () { | |
return document.hidden || document.mozHidden || document.msHidden || document.webkitHidden | |
}, | |
isTouchDevice: function () { | |
return null == s && (s = TD.config.force_touchdeck || TD.config.touchdeck && TD.util.isiOSDevice()), s | |
}, | |
isiOSDevice: _.memoize(function () { | |
return /(iPad|iPhone|iPod)/g.test(navigator.userAgent) | |
}), | |
attachFastClick: function () { | |
o = FastClick.attach(document.body) | |
}, | |
cancelFastClick: function () { | |
"undefined" != typeof o && (o.targetElement = null, o.trackingClick = !1) | |
}, | |
isUnsupportedWebWrapperVersion: function () { | |
var e, t, i = !1, | |
n = Boolean(TD.util.isWrapperApp() && deck.getWrapperVersion); | |
if (n) { | |
switch (t = deck.getWrapperVersion(), TD.util.getAppEnv()) { | |
case "mac": | |
e = TD.minWrapperVersionMac; | |
break; | |
case "win": | |
e = TD.minWrapperVersionWin | |
} | |
i = !e || !t || TD.util.versionComparator(t, e) < 0 | |
} | |
return i | |
}, | |
getFullVersionString: function () { | |
var e = { | |
version: TD.version, | |
buildIDShort: TD.buildIDShort, | |
appEnv: TD.util.getAppEnv() | |
}; | |
return TD.util.isWrapperApp() && deck.getWrapperVersion && (e.wrapperVersion = deck.getWrapperVersion()), TD.ui.template.render("version", e) | |
}, | |
isRetina: function () { | |
return window.devicePixelRatio >= 1.5 | |
}, | |
shouldStream: function () { | |
var e = new XMLHttpRequest, | |
t = "withCredentials" in e; | |
return t && TD.settings.getUseStream() && !TD.decider.get(TD.decider.DISABLE_STREAMING) && !TD.config.disable_streaming | |
}, | |
getCurrentLocation: function (e, t, i) { | |
var n, r, s, o = Number.MAX_VALUE, | |
a = navigator.geolocation, | |
c = function (e) { | |
var t = e.coords.accuracy; | |
o > t && (n = e, o = t), 50 > t && (clearTimeout(s), u()) | |
}, | |
u = function () { | |
a.clearWatch(r), n ? t(n) : i && i() | |
}; | |
s = setTimeout(u, e), r = a.watchPosition(c, i, { | |
enableHighAccuracy: !0 | |
}) | |
}, | |
openURL: function (e, t) { | |
if (_.isString(e) && (_.startsWith(e, "https://") || _.startsWith(e, "http://"))) | |
if (t && (e = TD.net.util.addURLParameters(e, t)), window.navigator.standalone) { | |
var i = document.createElement("a"); | |
i.setAttribute("href", e), i.setAttribute("target", "_blank"); | |
var n = document.createEvent("HTMLEvents"); | |
n.initEvent("click", !0, !0), i.dispatchEvent(n) | |
} else { | |
var r = window.open(e); | |
r && r.focus() | |
} | |
}, | |
maybeOpenClickExternally: function (e) { | |
var t = !1, | |
i = $(e.currentTarget), | |
n = i.prop("tagName"), | |
r = i.attr("rel"), | |
s = i.attr("target"), | |
o = e.isTrigger, | |
a = e.ctrlKey || e.shiftKey || e.altKey || e.metaKey || 0 !== e.button; | |
return "A" === n && "_blank" === s && ("url" === r || a) && (TD.util.isWrapperApp() || o ? (TD.util.openURL(i.attr("href")), e.preventDefault(), e.stopImmediatePropagation()) : e.stopImmediatePropagation(), t = !0), t | |
}, | |
openEmail: function (e, t, i) { | |
var n = "mailto:", | |
r = {}; | |
t && (r.subject = t), i && (r.body = i), e && (n += e), n = n + "?" + TD.net.util.formEncode(r), window.open(n) | |
}, | |
escape: function (e) { | |
return this.clean(e) | |
}, | |
truncateText: function (e, t, i, n, r, s) { | |
t = void 0 == t ? "…" : t, n = n || 0, s = s || 0; | |
var o; | |
if (e.length > i + n) { | |
var a = e.indexOf(" ", i - s - 1); - 1 != a && (i = Math.min(i, a + 1)), o = e.substr(0, i), r && (o = this.transform(o)), o += t | |
} | |
return o | |
}, | |
timesCached: null, | |
timeWords: function () { | |
return TD.util.timesCached || (TD.util.timesCached = { | |
longForm: { | |
singular: { | |
now: TD.i("now", null, !0), | |
seconds: TD.i("{{one}} second ago", null, !0), | |
minutes: TD.i("{{one}} minute ago", null, !0), | |
hours: TD.i("{{one}} hour ago", null, !0), | |
days: TD.i("{{one}} day ago", null, !0) | |
}, | |
plural: { | |
now: TD.i("now", null, !0), | |
seconds: TD.i("{{plural_number}} seconds ago", null, !0), | |
minutes: TD.i("{{plural_number}} minutes ago", null, !0), | |
hours: TD.i("{{plural_number}} hours ago", null, !0), | |
days: TD.i("{{plural_number}} days ago", null, !0) | |
} | |
}, | |
shortForm: { | |
singular: { | |
now: TD.i("now", null, !0), | |
seconds: TD.i("{{one}}s", null, !0), | |
minutes: TD.i("{{one}}m", null, !0), | |
hours: TD.i("{{one}}h", null, !0), | |
days: TD.i("{{one}}d", null, !0) | |
}, | |
plural: { | |
now: TD.i("now", null, !0), | |
seconds: TD.i("{{plural_number}}s", null, !0), | |
minutes: TD.i("{{plural_number}}m", null, !0), | |
hours: TD.i("{{plural_number}}h", null, !0), | |
days: TD.i("{{plural_number}}d", null, !0) | |
} | |
} | |
}), TD.util.timesCached | |
}, | |
datesCached: null, | |
dates: function () { | |
return TD.util.datesCached || (TD.util.datesCached = { | |
months: [TD.i("Jan"), TD.i("Feb"), TD.i("Mar"), TD.i("Apr"), TD.i("May"), TD.i("Jun"), TD.i("Jul"), TD.i("Aug"), TD.i("Sep"), TD.i("Oct"), TD.i("Nov"), TD.i("Dec")], | |
dates: [TD.i("1st"), TD.i("2nd"), TD.i("3rd"), TD.i("4th"), TD.i("5th"), TD.i("6th"), TD.i("7th"), TD.i("8th"), TD.i("9th"), TD.i("10th"), TD.i("11th"), TD.i("12th"), TD.i("13th"), TD.i("14th"), TD.i("15th"), TD.i("16th"), TD.i("17th"), TD.i("18th"), TD.i("19th"), TD.i("20th"), TD.i("21st"), TD.i("22nd"), TD.i("23rd"), TD.i("24th"), TD.i("25th"), TD.i("26th"), TD.i("27th"), TD.i("28th"), TD.i("29th"), TD.i("30th"), TD.i("31st")] | |
}), TD.util.datesCached | |
}, | |
timeAgo: function (e, t, i) { | |
var n, r, s, o, h = (new Date).getTime(), | |
p = new Date(e).getTime(), | |
f = TD.util.timeWords()[t ? "longForm" : "shortForm"]; | |
return i && (h += a), n = h - p, isNaN(n) || -5 * c > n ? "" : (7 * c > n ? (s = "", r = "now") : u > n ? (s = Math.floor(n / c), r = "seconds") : l > n ? (s = Math.floor(n / u), r = "minutes") : d > n ? (s = Math.floor(n / l), r = "hours") : (s = Math.floor(n / d), r = "days"), f = 1 === s ? f.singular : f.plural, o = TD.ui.template.toHtml(f[r], { | |
one: s, | |
plural_number: s | |
})) | |
}, | |
prettyTime: function (e) { | |
var t = { | |
month: TD.util.dates().months[e.getMonth()], | |
hours24: e.getHours(), | |
hours12: e.getHours() % 12 || 12, | |
minutes: TD.util.padLeadingZero(e.getMinutes()), | |
amPm: TD.i(e.getHours() < 12 ? "am" : "pm"), | |
date: TD.util.dates().dates[e.getDate() - 1], | |
day: e.getDate(), | |
year: e.getFullYear().toString().slice(2), | |
fullYear: e.getFullYear() | |
}; | |
return t | |
}, | |
prettyTimeString: function (e) { | |
return TD.i("{{hours12}}:{{minutes}}{{amPm}} · {{day}} {{month}} {{fullYear}}", TD.util.prettyTime(e)) | |
}, | |
prettyTimeOfDayString: function (e) { | |
return TD.i("{{hours12}}:{{minutes}}{{amPm}}", TD.util.prettyTime(e)) | |
}, | |
prettyDateString: function (e) { | |
return TD.i("{{day}} {{month}} {{fullYear}}", TD.util.prettyTime(e)) | |
}, | |
padLeadingZero: function (e) { | |
return e.toString().replace(/^(\d)$/, "0$1") | |
}, | |
prettyNumber: function (e) { | |
var t; | |
if ("string" == typeof e) e = parseInt(e, 10); | |
else if ("number" != typeof e || isNaN(e)) return ""; | |
return t = e.toString().split("."), t[0].replace(f, ",") | |
}, | |
chirpDescSort: function (e, t) { | |
var i = 0; | |
return e.sortIndex && t.sortIndex ? (i = t.sortIndex.length - e.sortIndex.length, i = i || (t.sortIndex > e.sortIndex) - (t.sortIndex < e.sortIndex)) : i = t.created.getTime() - e.created.getTime(), i | |
}, | |
chirpAscSort: function (e, t) { | |
return TD.util.chirpDescSort(t, e) | |
}, | |
transformTwitterAvatar: function (e, t) { | |
return e.replace(h, "$1_" + t + ".$2") | |
}, | |
getOSName: function () { | |
var e = ""; | |
return this.isWrapperApp() ? e = deck.osname() : -1 != navigator.appVersion.indexOf("Win") ? e = "windows" : -1 != navigator.appVersion.indexOf("Mac") ? e = "osx" : -1 != navigator.appVersion.indexOf("Linux") && (e = "linux"), e | |
}, | |
hasFeature: function (e) { | |
switch (e) { | |
case "file": | |
return !!window.File; | |
case "filereader": | |
return !!window.FileReader; | |
default: | |
return | |
} | |
}, | |
getAppEnv: function () { | |
var e, t = "unknown"; | |
if (this.isChromeApp()) t = "chrome"; | |
else if (this.isWrapperApp()) switch (e = this.getOSName()) { | |
case "osx": | |
t = "mac"; | |
break; | |
case "windows": | |
t = "win" | |
} else _.startsWith(window.location.href, "file://") || (t = "web"); | |
return t | |
}, | |
checkAPIRoot: function () { | |
if ("http:" === window.location.protocol || "https:" === window.location.protocol) { | |
var e = window.location.protocol + "//" + window.location.host; | |
e !== TD.config.api_root && (console.log("NOTE: overwriting api_root of", TD.config.api_root, "with", e), TD.config.api_root = e) | |
} | |
}, | |
hasFixedScrollBars: function () { | |
var e, t = $("<div>").css({ | |
width: "100px", | |
height: "100px", | |
overflow: "scroll", | |
position: "absolute", | |
top: "-9999px" | |
}); | |
return $("body").append(t), e = t[0].offsetWidth - t[0].clientWidth, t.remove(), Boolean(e) | |
}, | |
bind: function (e, t) { | |
return function () { | |
e.apply(t, arguments) | |
} | |
}, | |
random: function (e, t) { | |
return null == t && (t = e, e = 0), e + (0 | Math.random() * (t - e + 1)) | |
}, | |
extendObjectWith: function (e, t) { | |
_.each(t, function (t) { | |
e[t[0]] = t[1] | |
}) | |
}, | |
insertLogDivider: _.debounce(function () { | |
console.log(" ") | |
}, 1), | |
versionComparator: function (e, t) { | |
e = e.toString(), t = t.toString(); | |
for (var i, n, r = e.split("."), s = t.split("."), o = Math.min(r.length, s.length), a = 0; o > a; a++) { | |
if (i = parseInt(r[a], 10), n = parseInt(s[a], 10), i > n) return 1; | |
if (n > i) return -1 | |
} | |
return r.length > s.length ? 1 : r.length < s.length ? -1 : 0 | |
}, | |
getPreciseTime: function () { | |
return window.performance ? "function" == typeof window.performance.now ? window.performance.now() : "function" == typeof window.performance.webkitNow ? window.performance.webkitNow() : void 0 : Date.now() | |
}, | |
fnPerformanceWrapper: function (e, t, i) { | |
var n = Array.prototype.slice.call(arguments, 3); | |
return function () { | |
var r, s = TD.util.getPreciseTime(), | |
o = e.apply(t, n); | |
return r = TD.util.getPreciseTime(), TD.controller.stats.performance.log(i, r - s), o | |
} | |
}, | |
logTimeToRenderColumn: function (e, t) { | |
var i; | |
t > 0 && (i = e / t, TD.controller.stats.performance.log(TD.controller.stats.performance.keys.RENDER_TWEET, i)) | |
}, | |
TpmCounter: function (e, t, i) { | |
var n = 0, | |
r = 0, | |
s = 0, | |
o = [], | |
a = (new Date).getTime(), | |
c = setInterval(function () { | |
var e, c, u, l = (new Date).getTime(), | |
d = l - t; | |
for (o.push({ | |
renderedCount: s, | |
startTime: a | |
}), r += s, s = 0, a = l; o.length && o[0].startTime < d;) e = o.shift(), r -= e.renderedCount; | |
o.length && (c = l - o[0].startTime, u = 6e4 / c, n = r * u, $(document).trigger(i, { | |
itemsPerMinute: Math.round(n) | |
})) | |
}.bind(this), e); | |
this.incrementCounter = function (e) { | |
s += e | |
}, this.stop = function () { | |
clearInterval(c) | |
} | |
}, | |
deterministicObjectHash: function (e) { | |
var t = TD.util.createHashableObject(e), | |
i = JSON.stringify(t), | |
n = TD.core.sha1(i); | |
return n = n.substr(0, 10) | |
}, | |
createHashableObject: function (e) { | |
var t, i; | |
if (Array.isArray(e)) t = e.map(TD.util.createHashableObject), t.push("A"); | |
else if (e === Object(e)) { | |
t = []; | |
for (var n in e) e.hasOwnProperty(n) && (i = TD.util.createHashableObject(e[n]), t.push([n, i])); | |
t.sort(function (e, t) { | |
return e[0].localeCompare(t[0]) | |
}), t.push("O") | |
} else t = e; | |
return t | |
} | |
} | |
}(), | |
function (e, t) { | |
"function" == typeof define && define.amd ? define(["scripts/lib/bower_components/lodash/dist/lodash"], t) : e.TD.core.defer = t(_) | |
}(this, function (e) { | |
var t = {}; | |
t.NAME = "TD.core.defer", t.DEBUG_DEFERREDS = !1; | |
var i = Array.prototype.slice, | |
n = function (e) { | |
this.message = e, this.name = e | |
}; | |
n.prototype = new Error, n.prototype.toString = function () { | |
return this.message && this.message != this.name ? this.name + "(" + this.message.toString() + ")" : this.name + "()" | |
}; | |
var r = function (e, t, i) { | |
i.prototype = new n(e.NAME + "." + t), e[t] = i | |
}; | |
r(t, "AlreadyCalledError", function (e) { | |
this.deferred = e | |
}), r(t, "CancelledError", function (e) { | |
this.deferred = e | |
}), r(t, "GenericError", function (e) { | |
this.message = e | |
}), r(t, "XMLHttpRequestError", function (e, t) { | |
this.req = e, this.message = t; | |
try { | |
this.number = e.status | |
} catch (i) {} | |
if (this.req) switch (this.req.responseText) { | |
case "Item cannot be scheduled for the past.": | |
this.humanReadableMessage = TD.i("You can't schedule a Tweet for the past."); | |
break; | |
case "Item too far in the future.": | |
this.humanReadableMessage = TD.i("You can't schedule a Tweet for more than a year ahead."); | |
break; | |
case "You have too many updates scheduled.": | |
this.humanReadableMessage = TD.i("You can only save 150 scheduled Tweets at once. Please delete one or try later.") | |
} | |
}); | |
var s = function () { | |
try { | |
throw new Error("DEBUG_DEFERRED stack trace") | |
} catch (e) { | |
return e.stack | |
} | |
}; | |
return t.Deferred = function (i) { | |
this.chain = [], this.id = e.uniqueId("d:"), t.DEBUG_DEFERREDS && (this.create_stack = s()), this.fired = -1, this.paused = 0, this.results = [null, null], this.canceller = i, this.silentlyCancelled = !1, this.chained = !1 | |
}, t.Deferred.prototype = { | |
toString: function () { | |
var e; | |
return e = -1 == this.fired ? "unfired" : 0 === this.fired ? "success" : "error", "Deferred(" + this.id + ", " + e + "[" + this.chain.length + "])" | |
}, | |
cancel: function () { | |
-1 == this.fired ? (this.canceller ? this.canceller(this) : this.silentlyCancelled = !0, -1 == this.fired && this.errback(new t.CancelledError(this))) : 0 === this.fired && this.results[0] instanceof t.Deferred && this.results[0].cancel() | |
}, | |
_resback: function (e) { | |
t.DEBUG_DEFERREDS && (this.invoke_stack = s()), this.fired = e instanceof Error ? 1 : 0, this.results[this.fired] = e, this._fire() | |
}, | |
_check: function () { | |
if (-1 != this.fired) { | |
if (!this.silentlyCancelled) throw new t.AlreadyCalledError(this); | |
return void(this.silentlyCancelled = !1) | |
} | |
}, | |
callback: function (e) { | |
if (this._check(), e instanceof t.Deferred) throw new Error("Deferred instances can only be chained if they are the result of a callback"); | |
this._resback(e) | |
}, | |
errback: function (e) { | |
if (this._check(), e instanceof t.Deferred) throw new Error("Deferred instances can only be chained if they are the result of a callback"); | |
e instanceof Error || (e = new t.GenericError(e)), this._resback(e) | |
}, | |
addBoth: function (e) { | |
var t = i.call(arguments, 1); | |
return this.addCallbacks(e, e, t, t, null, null) | |
}, | |
addBothWith: function (e, t) { | |
var n = i.call(arguments, 2); | |
return this.addCallbacks(t, t, n, n, e, e) | |
}, | |
addCallback: function (e) { | |
var t = i.call(arguments, 1); | |
return this.addCallbacks(e, null, t, null, null, null) | |
}, | |
addCallbackWith: function (e, t) { | |
var n = i.call(arguments, 2); | |
return this.addCallbacks(t, null, n, null, e, null) | |
}, | |
addErrback: function (e) { | |
var t = i.call(arguments, 1); | |
return this.addCallbacks(null, e, null, t, null, null) | |
}, | |
addErrbackWith: function (e, t) { | |
var n = i.call(arguments, 2); | |
return this.addCallbacks(null, t, null, n, null, e) | |
}, | |
addCallbacks: function (e, t, i, n, r, s) { | |
if (this.chained) throw new Error("Chained Deferreds can not be re-used"); | |
return this.chain.push([e, t, i, n, r, s]), this.fired >= 0 && this._fire(), this | |
}, | |
_fire: function () { | |
for (var e, i, n = this.chain, r = this.fired, s = this.results[r], o = this, a = null, c = function (e) { | |
o._resback(e), o.paused--, 0 === o.paused && o.fired >= 0 && o._fire() | |
}; n.length > 0 && 0 === this.paused;) { | |
var u = n.shift(), | |
l = u[r]; | |
if (null !== l) try { | |
e = u[2 + r] ? [s].concat(u[2 + r]) : [s], i = u[4 + r], s = l.apply(i, e), r = s instanceof Error ? 1 : 0, s instanceof t.Deferred && (a = c, this.paused++) | |
} catch (d) { | |
r = 1, s = d instanceof Error ? d : new t.GenericError(d), s.stackTrace = s.stack && s.stack.split ? s.stack.split("\n") : [] | |
} | |
} | |
this.fired = r, this.results[r] = s, a && this.paused && (s.addBoth(a), s.chained = !0) | |
} | |
}, t.DeferredList = function (i, n, r) { | |
t.Deferred.apply(this, [r]), this.list = i; | |
var s = []; | |
this.resultList = s, this.finishedCount = 0, this.fireOnOneCallback = Boolean(n && n.fireOnOneCallback), this.fireOnOneErrback = Boolean(n && n.fireOnOneErrback), this.consumeErrors = Boolean(n && n.consumeErrors); | |
for (var o = e.bind(this._cbDeferred, this), a = 0; a < i.length; a++) { | |
var c = i[a]; | |
s.push(void 0), c.addCallback(o, a, !0), c.addErrback(o, a, !1) | |
} | |
0 !== i.length || this.fireOnOneCallback || this.callback(this.resultList) | |
}, t.DeferredList.prototype = new t.Deferred, t.DeferredList.prototype._cbDeferred = function (e, t, i) { | |
return this.resultList[t] = [i, e], this.finishedCount += 1, -1 == this.fired && (i && this.fireOnOneCallback ? this.callback([t, e]) : !i && this.fireOnOneErrback ? this.errback(e) : this.finishedCount == this.list.length && this.callback(this.resultList)), !i && this.consumeErrors && (e = null), e | |
}, t.gatherResults = function (e) { | |
var i = new t.DeferredList(e, { | |
fireOnOneErrback: !0 | |
}); | |
return i.addCallback(function (e) { | |
for (var t = [], i = 0; i < e.length; i++) t.push(e[i][1]); | |
return t | |
}), i | |
}, t.succeed = function (e) { | |
var i = new t.Deferred; | |
return i.callback.apply(i, [e]), i | |
}, t.fail = function (e) { | |
var i = new t.Deferred; | |
return i.errback.apply(i, [e]), i | |
}, t.maybeDeferred = function (e) { | |
var n; | |
try { | |
var r = e.apply(null, i.call(arguments, 1)); | |
n = r instanceof t.Deferred ? r : r instanceof Error ? t.fail(r) : t.succeed(r) | |
} catch (s) { | |
n = t.fail(s) | |
} | |
return n | |
}, t | |
}), TD.emoji = function (e) { | |
var t = />(?:\uFE0F|[\uFE00-\uFE0D])/g, | |
i = { | |
theme: "", | |
path: "/web/assets/emoji", | |
unified: {}, | |
parse: function (e) { | |
return e.replace(i.re, i.place).replace(t, ">") | |
}, | |
place: function (e, t, n) { | |
var r = n.charAt(t + 1), | |
s = "︎" !== r, | |
o = s && 1 === e.length && /([\uFE00-\uFE0F])/.test(r) ? RegExp.$1 : ""; | |
return s ? TD.ui.template.render("text/emoji", { | |
alt: e + o, | |
src: i.path + "/" + i.theme + "/" + i.unified[e] + ".png" | |
}) : e | |
}, | |
test: function (e) { | |
var t = i.re.test(e); | |
return i.re.lastIndex = 0, t | |
} | |
}; | |
return i.re = new RegExp(e.values.map(function (t, n) { | |
var r = JSON.parse('"' + t + '"'); | |
return i.unified[r] = e.keys[n], t | |
}).join("|"), "g"), $(document).one("dataSettingsValues", function () { | |
i.theme || (i.theme = TD.settings.getTheme()) | |
}), $(document).on("dataSettings", function () { | |
var e = TD.settings.getTheme(); | |
i.theme !== e && ($(".emoji").each(function (t, n) { | |
n.src = n.src.replace(i.theme, e) | |
}), i.theme = e) | |
}), i | |
}({ | |
keys: ["1f1ec-1f1e7", "1f1fa-1f1f8", "1f1e9-1f1ea", "1f1ea-1f1f8", "1f1eb-1f1f7", "1f1e8-1f1f3", "1f1ee-1f1f9", "1f1ef-1f1f5", "1f1f0-1f1f7", "1f1f7-1f1fa", "1f47a", "1f194", "1f195", "1f196", "1f197", "1f198", "1f199", "1f19a", "1f1e6", "1f1e7", "1f483", "1f1e8", "1f0cf", "1f1e9", "1f170", "1f1ea", "1f171", "1f1eb", "1f17e", "1f1ec", "1f1ed", "1f17f", "1f1ee", "1f18e", "1f1ef", "1f191", "1f1f0", "1f1f1", "1f1f2", "1f1f3", "1f1f4", "1f1f5", "1f1f6", "1f192", "1f1f7", "1f1f8", "1f1f9", "1f193", "1f1fa", "1f1fb", "1f1fc", "1f1fd", "1f1fe", "1f1ff", "1f201", "1f202", "1f21a", "1f22f", "1f232", "1f233", "1f234", "1f235", "1f236", "1f237", "1f238", "1f239", "1f23a", "1f250", "1f251", "1f300", "1f301", "1f302", "1f303", "1f304", "1f305", "1f306", "1f307", "1f308", "1f309", "1f30a", "1f30b", "1f30c", "1f30d", "1f30e", "1f30f", "1f310", "1f311", "1f312", "1f313", "1f314", "1f315", "1f316", "1f317", "1f318", "1f319", "1f31a", "1f31b", "1f31c", "1f31d", "1f31e", "1f31f", "1f320", "1f330", "1f331", "1f332", "1f333", "1f334", "1f335", "1f337", "1f338", "1f339", "1f33a", "1f33b", "1f33c", "1f33d", "1f33e", "1f33f", "1f340", "1f341", "1f342", "1f343", "1f344", "1f345", "1f346", "1f347", "1f348", "1f349", "1f34a", "1f34b", "1f34c", "1f34d", "1f34e", "1f34f", "1f350", "1f351", "1f352", "1f353", "1f354", "1f355", "1f356", "1f357", "1f358", "1f359", "1f35a", "1f35b", "1f35c", "1f35d", "1f35e", "1f35f", "1f360", "1f361", "1f362", "1f363", "1f364", "1f365", "1f366", "1f367", "1f368", "1f369", "1f36a", "1f36b", "1f36c", "1f36d", "1f36e", "1f36f", "1f370", "1f371", "1f372", "1f373", "1f374", "1f375", "1f376", "1f377", "1f378", "1f379", "1f37a", "1f37b", "1f37c", "1f380", "1f381", "1f382", "1f383", "1f384", "1f385", "1f386", "1f387", "1f388", "1f389", "1f38a", "1f38b", "1f38c", "1f38d", "1f38e", "1f38f", "1f390", "1f391", "1f392", "1f393", "1f3a0", "1f3a1", "1f3a2", "1f3a3", "1f3a4", "1f3a5", "1f3a6", "1f3a7", "1f3a8", "1f3a9", "1f3aa", "1f3ab", "1f3ac", "1f3ad", "1f3ae", "1f3af", "1f3b0", "1f3b1", "1f3b2", "1f3b3", "1f3b4", "1f3b5", "1f3b6", "1f3b7", "1f3b8", "1f3b9", "1f3ba", "1f3bb", "1f3bc", "1f3bd", "1f3be", "1f3bf", "1f3c0", "1f3c1", "1f3c2", "1f3c3", "1f3c4", "1f3c6", "1f3c7", "1f3c8", "1f3c9", "1f3ca", "1f3e0", "1f3e1", "1f3e2", "1f3e3", "1f3e4", "1f3e5", "1f3e6", "1f3e7", "1f3e8", "1f3e9", "1f3ea", "1f3eb", "1f3ec", "1f3ed", "1f3ee", "1f3ef", "1f3f0", "1f400", "1f401", "1f402", "1f403", "1f404", "1f405", "1f406", "1f407", "1f408", "1f409", "1f40a", "1f40b", "1f40c", "1f40d", "1f40e", "1f40f", "1f410", "1f411", "1f412", "1f413", "1f414", "1f415", "1f416", "1f417", "1f418", "1f419", "1f41a", "1f41b", "1f41c", "1f41d", "1f41e", "1f41f", "1f420", "1f421", "1f422", "1f423", "1f424", "1f425", "1f426", "1f427", "1f428", "1f429", "1f42a", "1f42b", "1f42c", "1f42d", "1f42e", "1f42f", "1f430", "1f431", "1f432", "1f433", "1f434", "1f435", "1f436", "1f437", "1f438", "1f439", "1f43a", "1f43b", "1f43c", "1f43d", "1f43e", "1f440", "1f442", "1f443", "1f444", "1f445", "1f446", "1f447", "1f448", "1f449", "1f44a", "1f44b", "1f44c", "1f44d", "1f44e", "1f44f", "1f450", "1f451", "1f452", "1f453", "1f454", "1f455", "1f456", "1f457", "1f458", "1f459", "1f45a", "1f45b", "1f45c", "1f45d", "1f45e", "1f45f", "1f460", "1f461", "1f462", "1f463", "1f464", "1f465", "1f466", "1f467", "1f468", "1f469", "1f46a", "1f46b", "1f46c", "1f46d", "1f46e", "1f46f", "1f470", "1f471", "1f472", "1f473", "1f474", "1f475", "1f476", "1f477", "1f478", "1f479", "1f004", "1f47b", "1f47c", "1f47d", "1f47e", "1f47f", "1f480", "1f481", "1f482", "1f484", "1f485", "1f486", "1f487", "1f488", "1f489", "1f48a", "1f48b", "1f48c", "1f48d", "1f48e", "1f48f", "1f490", "1f491", "1f492", "1f493", "1f494", "1f495", "1f496", "1f497", "1f498", "1f499", "1f49a", "1f49b", "1f49c", "1f49d", "1f49e", "1f49f", "1f4a0", "1f4a1", "1f4a2", "1f4a3", "1f4a4", "1f4a5", "1f4a6", "1f4a7", "1f4a8", "1f4a9", "1f4aa", "1f4ab", "1f4ac", "1f4ad", "1f4ae", "1f4af", "1f4b0", "1f4b1", "1f4b2", "1f4b3", "1f4b4", "1f4b5", "1f4b6", "1f4b7", "1f4b8", "1f4b9", "1f4ba", "1f4bb", "1f4bc", "1f4bd", "1f4be", "1f4bf", "1f4c0", "1f4c1", "1f4c2", "1f4c3", "1f4c4", "1f4c5", "1f4c6", "1f4c7", "1f4c8", "1f4c9", "1f4ca", "1f4cb", "1f4cc", "1f4cd", "1f4ce", "1f4cf", "1f4d0", "1f4d1", "1f4d2", "1f4d3", "1f4d4", "1f4d5", "1f4d6", "1f4d7", "1f4d8", "1f4d9", "1f4da", "1f4db", "1f4dc", "1f4dd", "1f4de", "1f4df", "1f4e0", "1f4e1", "1f4e2", "1f4e3", "1f4e4", "1f4e5", "1f4e6", "1f4e7", "1f4e8", "1f4e9", "1f4ea", "1f4eb", "1f4ec", "1f4ed", "1f4ee", "1f4ef", "1f4f0", "1f4f1", "1f4f2", "1f4f3", "1f4f4", "1f4f5", "1f4f6", "1f4f7", "1f4f9", "1f4fa", "1f4fb", "1f4fc", "1f500", "1f501", "1f502", "1f503", "1f504", "1f505", "1f506", "1f507", "1f508", "1f509", "1f50a", "1f50b", "1f50c", "1f50d", "1f50e", "1f50f", "1f510", "1f511", "1f512", "1f513", "1f514", "1f515", "1f516", "1f517", "1f518", "1f519", "1f51a", "1f51b", "1f51c", "1f51d", "1f51e", "1f51f", "1f520", "1f521", "1f522", "1f523", "1f524", "1f525", "1f526", "1f527", "1f528", "1f529", "1f52a", "1f52b", "1f52c", "1f52d", "1f52e", "1f52f", "1f530", "1f531", "1f532", "1f533", "1f534", "1f535", "1f536", "1f537", "1f538", "1f539", "1f53a", "1f53b", "1f53c", "1f53d", "1f550", "1f551", "1f552", "1f553", "1f554", "1f555", "1f556", "1f557", "1f558", "1f559", "1f55a", "1f55b", "1f55c", "1f55d", "1f55e", "1f55f", "1f560", "1f561", "1f562", "1f563", "1f564", "1f565", "1f566", "1f567", "1f5fb", "1f5fc", "1f5fd", "1f5fe", "1f5ff", "1f600", "1f601", "1f602", "1f603", "1f604", "1f605", "1f606", "1f607", "1f608", "1f609", "1f60a", "1f60b", "1f60c", "1f60d", "1f60e", "1f60f", "1f610", "1f611", "1f612", "1f613", "1f614", "1f615", "1f616", "1f617", "1f618", "1f619", "1f61a", "1f61b", "1f61c", "1f61d", "1f61e", "1f61f", "1f620", "1f621", "1f622", "1f623", "1f624", "1f625", "1f626", "1f627", "1f628", "1f629", "1f62a", "1f62b", "1f62c", "1f62d", "1f62e", "1f62f", "1f630", "1f631", "1f632", "1f633", "1f634", "1f635", "1f636", "1f637", "1f638", "1f639", "1f63a", "1f63b", "1f63c", "1f63d", "1f63e", "1f63f", "1f640", "1f645", "1f646", "1f647", "1f648", "1f649", "1f64a", "1f64b", "1f64c", "1f64d", "1f64e", "1f64f", "1f680", "1f681", "1f682", "1f683", "1f684", "1f685", "1f686", "1f687", "1f688", "1f689", "1f68a", "1f68b", "1f68c", "1f68d", "1f68e", "1f68f", "1f690", "1f691", "1f692", "1f693", "1f694", "1f695", "1f696", "1f697", "1f698", "1f699", "1f69a", "1f69b", "1f69c", "1f69d", "1f69e", "1f69f", "1f6a0", "1f6a1", "1f6a2", "1f6a3", "1f6a4", "1f6a5", "1f6a6", "1f6a7", "1f6a8", "1f6a9", "1f6aa", "1f6ab", "1f6ac", "1f6ad", "1f6ae", "1f6af", "1f6b0", "1f6b1", "1f6b2", "1f6b3", "1f6b4", "1f6b5", "1f6b6", "1f6b7", "1f6b8", "1f6b9", "1f6ba", "1f6bb", "1f6bc", "1f6bd", "1f6be", "1f6bf", "1f6c0", "1f6c1", "1f6c2", "1f6c3", "1f6c4", "1f6c5", "23-20e3", "30-20e3", "31-20e3", "32-20e3", "33-20e3", "34-20e3", "35-20e3", "36-20e3", "37-20e3", "38-20e3", "39-20e3", "2935", "3030", "3297", "3299", "2049", "2139", "2194", "2195", "2196", "2197", "2198", "2199", "2600", "2601", "2611", "2614", "2615", "2648", "2649", "2650", "2651", "2652", "2653", "2660", "2663", "2665", "2666", "2668", "2693", "2702", "2705", "2708", "2709", "2712", "2714", "2716", "2728", "2733", "2734", "2122", "203c", "21a9", "21aa", "2744", "231a", "231b", "23e9", "23ea", "23eb", "23ec", "23f0", "23f3", "24c2", "25aa", "25ab", "25b6", "25c0", "25fb", "25fc", "25fd", "25fe", "260e", "261d", "263a", "264a", "264b", "264c", "264d", "264e", "264f", "267b", "267f", "26a0", "26a1", "26aa", "26ab", "26bd", "26be", "26c4", "26c5", "26ce", "26d4", "26ea", "26f2", "26f3", "26f5", "26fa", "26fd", "270a", "270b", "270c", "270f", "274c", "274e", "27a1", "27b0", "27bf", "2b05", "2b06", "2b07", "2b1b", "2b1c", "2b50", "2b55", "2747", "303d", "2753", "2754", "2755", "2757", "2764", "2795", "2796", "2797", "2934", "a9", "ae", "e50a"], | |
values: ["\\ud83c\\uddec\\ud83c\\udde7", "\\ud83c\\uddfa\\ud83c\\uddf8", "\\ud83c\\udde9\\ud83c\\uddea", "\\ud83c\\uddea\\ud83c\\uddf8", "\\ud83c\\uddeb\\ud83c\\uddf7", "\\ud83c\\udde8\\ud83c\\uddf3", "\\ud83c\\uddee\\ud83c\\uddf9", "\\ud83c\\uddef\\ud83c\\uddf5", "\\ud83c\\uddf0\\ud83c\\uddf7", "\\ud83c\\uddf7\\ud83c\\uddfa", "\\ud83d\\udc7a", "\\ud83c\\udd94", "\\ud83c\\udd95", "\\ud83c\\udd96", "\\ud83c\\udd97", "\\ud83c\\udd98", "\\ud83c\\udd99", "\\ud83c\\udd9a", "\\ud83c\\udde6", "\\ud83c\\udde7", "\\ud83d\\udc83", "\\ud83c\\udde8", "\\ud83c\\udccf", "\\ud83c\\udde9", "\\ud83c\\udd70", "\\ud83c\\uddea", "\\ud83c\\udd71", "\\ud83c\\uddeb", "\\ud83c\\udd7e", "\\ud83c\\uddec", "\\ud83c\\udded", "\\ud83c\\udd7f", "\\ud83c\\uddee", "\\ud83c\\udd8e", "\\ud83c\\uddef", "\\ud83c\\udd91", "\\ud83c\\uddf0", "\\ud83c\\uddf1", "\\ud83c\\uddf2", "\\ud83c\\uddf3", "\\ud83c\\uddf4", "\\ud83c\\uddf5", "\\ud83c\\uddf6", "\\ud83c\\udd92", "\\ud83c\\uddf7", "\\ud83c\\uddf8", "\\ud83c\\uddf9", "\\ud83c\\udd93", "\\ud83c\\uddfa", "\\ud83c\\uddfb", "\\ud83c\\uddfc", "\\ud83c\\uddfd", "\\ud83c\\uddfe", "\\ud83c\\uddff", "\\ud83c\\ude01", "\\ud83c\\ude02", "\\ud83c\\ude1a", "\\ud83c\\ude2f", "\\ud83c\\ude32", "\\ud83c\\ude33", "\\ud83c\\ude34", "\\ud83c\\ude35", "\\ud83c\\ude36", "\\ud83c\\ude37", "\\ud83c\\ude38", "\\ud83c\\ude39", "\\ud83c\\ude3a", "\\ud83c\\ude50", "\\ud83c\\ude51", "\\ud83c\\udf00", "\\ud83c\\udf01", "\\ud83c\\udf02", "\\ud83c\\udf03", "\\ud83c\\udf04", "\\ud83c\\udf05", "\\ud83c\\udf06", "\\ud83c\\udf07", "\\ud83c\\udf08", "\\ud83c\\udf09", "\\ud83c\\udf0a", "\\ud83c\\udf0b", "\\ud83c\\udf0c", "\\ud83c\\udf0d", "\\ud83c\\udf0e", "\\ud83c\\udf0f", "\\ud83c\\udf10", "\\ud83c\\udf11", "\\ud83c\\udf12", "\\ud83c\\udf13", "\\ud83c\\udf14", "\\ud83c\\udf15", "\\ud83c\\udf16", "\\ud83c\\udf17", "\\ud83c\\udf18", "\\ud83c\\udf19", "\\ud83c\\udf1a", "\\ud83c\\udf1b", "\\ud83c\\udf1c", "\\ud83c\\udf1d", "\\ud83c\\udf1e", "\\ud83c\\udf1f", "\\ud83c\\udf20", "\\ud83c\\udf30", "\\ud83c\\udf31", "\\ud83c\\udf32", "\\ud83c\\udf33", "\\ud83c\\udf34", "\\ud83c\\udf35", "\\ud83c\\udf37", "\\ud83c\\udf38", "\\ud83c\\udf39", "\\ud83c\\udf3a", "\\ud83c\\udf3b", "\\ud83c\\udf3c", "\\ud83c\\udf3d", "\\ud83c\\udf3e", "\\ud83c\\udf3f", "\\ud83c\\udf40", "\\ud83c\\udf41", "\\ud83c\\udf42", "\\ud83c\\udf43", "\\ud83c\\udf44", "\\ud83c\\udf45", "\\ud83c\\udf46", "\\ud83c\\udf47", "\\ud83c\\udf48", "\\ud83c\\udf49", "\\ud83c\\udf4a", "\\ud83c\\udf4b", "\\ud83c\\udf4c", "\\ud83c\\udf4d", "\\ud83c\\udf4e", "\\ud83c\\udf4f", "\\ud83c\\udf50", "\\ud83c\\udf51", "\\ud83c\\udf52", "\\ud83c\\udf53", "\\ud83c\\udf54", "\\ud83c\\udf55", "\\ud83c\\udf56", "\\ud83c\\udf57", "\\ud83c\\udf58", "\\ud83c\\udf59", "\\ud83c\\udf5a", "\\ud83c\\udf5b", "\\ud83c\\udf5c", "\\ud83c\\udf5d", "\\ud83c\\udf5e", "\\ud83c\\udf5f", "\\ud83c\\udf60", "\\ud83c\\udf61", "\\ud83c\\udf62", "\\ud83c\\udf63", "\\ud83c\\udf64", "\\ud83c\\udf65", "\\ud83c\\udf66", "\\ud83c\\udf67", "\\ud83c\\udf68", "\\ud83c\\udf69", "\\ud83c\\udf6a", "\\ud83c\\udf6b", "\\ud83c\\udf6c", "\\ud83c\\udf6d", "\\ud83c\\udf6e", "\\ud83c\\udf6f", "\\ud83c\\udf70", "\\ud83c\\udf71", "\\ud83c\\udf72", "\\ud83c\\udf73", "\\ud83c\\udf74", "\\ud83c\\udf75", "\\ud83c\\udf76", "\\ud83c\\udf77", "\\ud83c\\udf78", "\\ud83c\\udf79", "\\ud83c\\udf7a", "\\ud83c\\udf7b", "\\ud83c\\udf7c", "\\ud83c\\udf80", "\\ud83c\\udf81", "\\ud83c\\udf82", "\\ud83c\\udf83", "\\ud83c\\udf84", "\\ud83c\\udf85", "\\ud83c\\udf86", "\\ud83c\\udf87", "\\ud83c\\udf88", "\\ud83c\\udf89", "\\ud83c\\udf8a", "\\ud83c\\udf8b", "\\ud83c\\udf8c", "\\ud83c\\udf8d", "\\ud83c\\udf8e", "\\ud83c\\udf8f", "\\ud83c\\udf90", "\\ud83c\\udf91", "\\ud83c\\udf92", "\\ud83c\\udf93", "\\ud83c\\udfa0", "\\ud83c\\udfa1", "\\ud83c\\udfa2", "\\ud83c\\udfa3", "\\ud83c\\udfa4", "\\ud83c\\udfa5", "\\ud83c\\udfa6", "\\ud83c\\udfa7", "\\ud83c\\udfa8", "\\ud83c\\udfa9", "\\ud83c\\udfaa", "\\ud83c\\udfab", "\\ud83c\\udfac", "\\ud83c\\udfad", "\\ud83c\\udfae", "\\ud83c\\udfaf", "\\ud83c\\udfb0", "\\ud83c\\udfb1", "\\ud83c\\udfb2", "\\ud83c\\udfb3", "\\ud83c\\udfb4", "\\ud83c\\udfb5", "\\ud83c\\udfb6", "\\ud83c\\udfb7", "\\ud83c\\udfb8", "\\ud83c\\udfb9", "\\ud83c\\udfba", "\\ud83c\\udfbb", "\\ud83c\\udfbc", "\\ud83c\\udfbd", "\\ud83c\\udfbe", "\\ud83c\\udfbf", "\\ud83c\\udfc0", "\\ud83c\\udfc1", "\\ud83c\\udfc2", "\\ud83c\\udfc3", "\\ud83c\\udfc4", "\\ud83c\\udfc6", "\\ud83c\\udfc7", "\\ud83c\\udfc8", "\\ud83c\\udfc9", "\\ud83c\\udfca", "\\ud83c\\udfe0", "\\ud83c\\udfe1", "\\ud83c\\udfe2", "\\ud83c\\udfe3", "\\ud83c\\udfe4", "\\ud83c\\udfe5", "\\ud83c\\udfe6", "\\ud83c\\udfe7", "\\ud83c\\udfe8", "\\ud83c\\udfe9", "\\ud83c\\udfea", "\\ud83c\\udfeb", "\\ud83c\\udfec", "\\ud83c\\udfed", "\\ud83c\\udfee", "\\ud83c\\udfef", "\\ud83c\\udff0", "\\ud83d\\udc00", "\\ud83d\\udc01", "\\ud83d\\udc02", "\\ud83d\\udc03", "\\ud83d\\udc04", "\\ud83d\\udc05", "\\ud83d\\udc06", "\\ud83d\\udc07", "\\ud83d\\udc08", "\\ud83d\\udc09", "\\ud83d\\udc0a", "\\ud83d\\udc0b", "\\ud83d\\udc0c", "\\ud83d\\udc0d", "\\ud83d\\udc0e", "\\ud83d\\udc0f", "\\ud83d\\udc10", "\\ud83d\\udc11", "\\ud83d\\udc12", "\\ud83d\\udc13", "\\ud83d\\udc14", "\\ud83d\\udc15", "\\ud83d\\udc16", "\\ud83d\\udc17", "\\ud83d\\udc18", "\\ud83d\\udc19", "\\ud83d\\udc1a", "\\ud83d\\udc1b", "\\ud83d\\udc1c", "\\ud83d\\udc1d", "\\ud83d\\udc1e", "\\ud83d\\udc1f", "\\ud83d\\udc20", "\\ud83d\\udc21", "\\ud83d\\udc22", "\\ud83d\\udc23", "\\ud83d\\udc24", "\\ud83d\\udc25", "\\ud83d\\udc26", "\\ud83d\\udc27", "\\ud83d\\udc28", "\\ud83d\\udc29", "\\ud83d\\udc2a", "\\ud83d\\udc2b", "\\ud83d\\udc2c", "\\ud83d\\udc2d", "\\ud83d\\udc2e", "\\ud83d\\udc2f", "\\ud83d\\udc30", "\\ud83d\\udc31", "\\ud83d\\udc32", "\\ud83d\\udc33", "\\ud83d\\udc34", "\\ud83d\\udc35", "\\ud83d\\udc36", "\\ud83d\\udc37", "\\ud83d\\udc38", "\\ud83d\\udc39", "\\ud83d\\udc3a", "\\ud83d\\udc3b", "\\ud83d\\udc3c", "\\ud83d\\udc3d", "\\ud83d\\udc3e", "\\ud83d\\udc40", "\\ud83d\\udc42", "\\ud83d\\udc43", "\\ud83d\\udc44", "\\ud83d\\udc45", "\\ud83d\\udc46", "\\ud83d\\udc47", "\\ud83d\\udc48", "\\ud83d\\udc49", "\\ud83d\\udc4a", "\\ud83d\\udc4b", "\\ud83d\\udc4c", "\\ud83d\\udc4d", "\\ud83d\\udc4e", "\\ud83d\\udc4f", "\\ud83d\\udc50", "\\ud83d\\udc51", "\\ud83d\\udc52", "\\ud83d\\udc53", "\\ud83d\\udc54", "\\ud83d\\udc55", "\\ud83d\\udc56", "\\ud83d\\udc57", "\\ud83d\\udc58", "\\ud83d\\udc59", "\\ud83d\\udc5a", "\\ud83d\\udc5b", "\\ud83d\\udc5c", "\\ud83d\\udc5d", "\\ud83d\\udc5e", "\\ud83d\\udc5f", "\\ud83d\\udc60", "\\ud83d\\udc61", "\\ud83d\\udc62", "\\ud83d\\udc63", "\\ud83d\\udc64", "\\ud83d\\udc65", "\\ud83d\\udc66", "\\ud83d\\udc67", "\\ud83d\\udc68", "\\ud83d\\udc69", "\\ud83d\\udc6a", "\\ud83d\\udc6b", "\\ud83d\\udc6c", "\\ud83d\\udc6d", "\\ud83d\\udc6e", "\\ud83d\\udc6f", "\\ud83d\\udc70", "\\ud83d\\udc71", "\\ud83d\\udc72", "\\ud83d\\udc73", "\\ud83d\\udc74", "\\ud83d\\udc75", "\\ud83d\\udc76", "\\ud83d\\udc77", "\\ud83d\\udc78", "\\ud83d\\udc79", "\\ud83c\\udc04", "\\ud83d\\udc7b", "\\ud83d\\udc7c", "\\ud83d\\udc7d", "\\ud83d\\udc7e", "\\ud83d\\udc7f", "\\ud83d\\udc80", "\\ud83d\\udc81", "\\ud83d\\udc82", "\\ud83d\\udc84", "\\ud83d\\udc85", "\\ud83d\\udc86", "\\ud83d\\udc87", "\\ud83d\\udc88", "\\ud83d\\udc89", "\\ud83d\\udc8a", "\\ud83d\\udc8b", "\\ud83d\\udc8c", "\\ud83d\\udc8d", "\\ud83d\\udc8e", "\\ud83d\\udc8f", "\\ud83d\\udc90", "\\ud83d\\udc91", "\\ud83d\\udc92", "\\ud83d\\udc93", "\\ud83d\\udc94", "\\ud83d\\udc95", "\\ud83d\\udc96", "\\ud83d\\udc97", "\\ud83d\\udc98", "\\ud83d\\udc99", "\\ud83d\\udc9a", "\\ud83d\\udc9b", "\\ud83d\\udc9c", "\\ud83d\\udc9d", "\\ud83d\\udc9e", "\\ud83d\\udc9f", "\\ud83d\\udca0", "\\ud83d\\udca1", "\\ud83d\\udca2", "\\ud83d\\udca3", "\\ud83d\\udca4", "\\ud83d\\udca5", "\\ud83d\\udca6", "\\ud83d\\udca7", "\\ud83d\\udca8", "\\ud83d\\udca9", "\\ud83d\\udcaa", "\\ud83d\\udcab", "\\ud83d\\udcac", "\\ud83d\\udcad", "\\ud83d\\udcae", "\\ud83d\\udcaf", "\\ud83d\\udcb0", "\\ud83d\\udcb1", "\\ud83d\\udcb2", "\\ud83d\\udcb3", "\\ud83d\\udcb4", "\\ud83d\\udcb5", "\\ud83d\\udcb6", "\\ud83d\\udcb7", "\\ud83d\\udcb8", "\\ud83d\\udcb9", "\\ud83d\\udcba", "\\ud83d\\udcbb", "\\ud83d\\udcbc", "\\ud83d\\udcbd", "\\ud83d\\udcbe", "\\ud83d\\udcbf", "\\ud83d\\udcc0", "\\ud83d\\udcc1", "\\ud83d\\udcc2", "\\ud83d\\udcc3", "\\ud83d\\udcc4", "\\ud83d\\udcc5", "\\ud83d\\udcc6", "\\ud83d\\udcc7", "\\ud83d\\udcc8", "\\ud83d\\udcc9", "\\ud83d\\udcca", "\\ud83d\\udccb", "\\ud83d\\udccc", "\\ud83d\\udccd", "\\ud83d\\udcce", "\\ud83d\\udccf", "\\ud83d\\udcd0", "\\ud83d\\udcd1", "\\ud83d\\udcd2", "\\ud83d\\udcd3", "\\ud83d\\udcd4", "\\ud83d\\udcd5", "\\ud83d\\udcd6", "\\ud83d\\udcd7", "\\ud83d\\udcd8", "\\ud83d\\udcd9", "\\ud83d\\udcda", "\\ud83d\\udcdb", "\\ud83d\\udcdc", "\\ud83d\\udcdd", "\\ud83d\\udcde", "\\ud83d\\udcdf", "\\ud83d\\udce0", "\\ud83d\\udce1", "\\ud83d\\udce2", "\\ud83d\\udce3", "\\ud83d\\udce4", "\\ud83d\\udce5", "\\ud83d\\udce6", "\\ud83d\\udce7", "\\ud83d\\udce8", "\\ud83d\\udce9", "\\ud83d\\udcea", "\\ud83d\\udceb", "\\ud83d\\udcec", "\\ud83d\\udced", "\\ud83d\\udcee", "\\ud83d\\udcef", "\\ud83d\\udcf0", "\\ud83d\\udcf1", "\\ud83d\\udcf2", "\\ud83d\\udcf3", "\\ud83d\\udcf4", "\\ud83d\\udcf5", "\\ud83d\\udcf6", "\\ud83d\\udcf7", "\\ud83d\\udcf9", "\\ud83d\\udcfa", "\\ud83d\\udcfb", "\\ud83d\\udcfc", "\\ud83d\\udd00", "\\ud83d\\udd01", "\\ud83d\\udd02", "\\ud83d\\udd03", "\\ud83d\\udd04", "\\ud83d\\udd05", "\\ud83d\\udd06", "\\ud83d\\udd07", "\\ud83d\\udd08", "\\ud83d\\udd09", "\\ud83d\\udd0a", "\\ud83d\\udd0b", "\\ud83d\\udd0c", "\\ud83d\\udd0d", "\\ud83d\\udd0e", "\\ud83d\\udd0f", "\\ud83d\\udd10", "\\ud83d\\udd11", "\\ud83d\\udd12", "\\ud83d\\udd13", "\\ud83d\\udd14", "\\ud83d\\udd15", "\\ud83d\\udd16", "\\ud83d\\udd17", "\\ud83d\\udd18", "\\ud83d\\udd19", "\\ud83d\\udd1a", "\\ud83d\\udd1b", "\\ud83d\\udd1c", "\\ud83d\\udd1d", "\\ud83d\\udd1e", "\\ud83d\\udd1f", "\\ud83d\\udd20", "\\ud83d\\udd21", "\\ud83d\\udd22", "\\ud83d\\udd23", "\\ud83d\\udd24", "\\ud83d\\udd25", "\\ud83d\\udd26", "\\ud83d\\udd27", "\\ud83d\\udd28", "\\ud83d\\udd29", "\\ud83d\\udd2a", "\\ud83d\\udd2b", "\\ud83d\\udd2c", "\\ud83d\\udd2d", "\\ud83d\\udd2e", "\\ud83d\\udd2f", "\\ud83d\\udd30", "\\ud83d\\udd31", "\\ud83d\\udd32", "\\ud83d\\udd33", "\\ud83d\\udd34", "\\ud83d\\udd35", "\\ud83d\\udd36", "\\ud83d\\udd37", "\\ud83d\\udd38", "\\ud83d\\udd39", "\\ud83d\\udd3a", "\\ud83d\\udd3b", "\\ud83d\\udd3c", "\\ud83d\\udd3d", "\\ud83d\\udd50", "\\ud83d\\udd51", "\\ud83d\\udd52", "\\ud83d\\udd53", "\\ud83d\\udd54", "\\ud83d\\udd55", "\\ud83d\\udd56", "\\ud83d\\udd57", "\\ud83d\\udd58", "\\ud83d\\udd59", "\\ud83d\\udd5a", "\\ud83d\\udd5b", "\\ud83d\\udd5c", "\\ud83d\\udd5d", "\\ud83d\\udd5e", "\\ud83d\\udd5f", "\\ud83d\\udd60", "\\ud83d\\udd61", "\\ud83d\\udd62", "\\ud83d\\udd63", "\\ud83d\\udd64", "\\ud83d\\udd65", "\\ud83d\\udd66", "\\ud83d\\udd67", "\\ud83d\\uddfb", "\\ud83d\\uddfc", "\\ud83d\\uddfd", "\\ud83d\\uddfe", "\\ud83d\\uddff", "\\ud83d\\ude00", "\\ud83d\\ude01", "\\ud83d\\ude02", "\\ud83d\\ude03", "\\ud83d\\ude04", "\\ud83d\\ude05", "\\ud83d\\ude06", "\\ud83d\\ude07", "\\ud83d\\ude08", "\\ud83d\\ude09", "\\ud83d\\ude0a", "\\ud83d\\ude0b", "\\ud83d\\ude0c", "\\ud83d\\ude0d", "\\ud83d\\ude0e", "\\ud83d\\ude0f", "\\ud83d\\ude10", "\\ud83d\\ude11", "\\ud83d\\ude12", "\\ud83d\\ude13", "\\ud83d\\ude14", "\\ud83d\\ude15", "\\ud83d\\ude16", "\\ud83d\\ude17", "\\ud83d\\ude18", "\\ud83d\\ude19", "\\ud83d\\ude1a", "\\ud83d\\ude1b", "\\ud83d\\ude1c", "\\ud83d\\ude1d", "\\ud83d\\ude1e", "\\ud83d\\ude1f", "\\ud83d\\ude20", "\\ud83d\\ude21", "\\ud83d\\ude22", "\\ud83d\\ude23", "\\ud83d\\ude24", "\\ud83d\\ude25", "\\ud83d\\ude26", "\\ud83d\\ude27", "\\ud83d\\ude28", "\\ud83d\\ude29", "\\ud83d\\ude2a", "\\ud83d\\ude2b", "\\ud83d\\ude2c", "\\ud83d\\ude2d", "\\ud83d\\ude2e", "\\ud83d\\ude2f", "\\ud83d\\ude30", "\\ud83d\\ude31", "\\ud83d\\ude32", "\\ud83d\\ude33", "\\ud83d\\ude34", "\\ud83d\\ude35", "\\ud83d\\ude36", "\\ud83d\\ude37", "\\ud83d\\ude38", "\\ud83d\\ude39", "\\ud83d\\ude3a", "\\ud83d\\ude3b", "\\ud83d\\ude3c", "\\ud83d\\ude3d", "\\ud83d\\ude3e", "\\ud83d\\ude3f", "\\ud83d\\ude40", "\\ud83d\\ude45", "\\ud83d\\ude46", "\\ud83d\\ude47", "\\ud83d\\ude48", "\\ud83d\\ude49", "\\ud83d\\ude4a", "\\ud83d\\ude4b", "\\ud83d\\ude4c", "\\ud83d\\ude4d", "\\ud83d\\ude4e", "\\ud83d\\ude4f", "\\ud83d\\ude80", "\\ud83d\\ude81", "\\ud83d\\ude82", "\\ud83d\\ude83", "\\ud83d\\ude84", "\\ud83d\\ude85", "\\ud83d\\ude86", "\\ud83d\\ude87", "\\ud83d\\ude88", "\\ud83d\\ude89", "\\ud83d\\ude8a", "\\ud83d\\ude8b", "\\ud83d\\ude8c", "\\ud83d\\ude8d", "\\ud83d\\ude8e", "\\ud83d\\ude8f", "\\ud83d\\ude90", "\\ud83d\\ude91", "\\ud83d\\ude92", "\\ud83d\\ude93", "\\ud83d\\ude94", "\\ud83d\\ude95", "\\ud83d\\ude96", "\\ud83d\\ude97", "\\ud83d\\ude98", "\\ud83d\\ude99", "\\ud83d\\ude9a", "\\ud83d\\ude9b", "\\ud83d\\ude9c", "\\ud83d\\ude9d", "\\ud83d\\ude9e", "\\ud83d\\ude9f", "\\ud83d\\udea0", "\\ud83d\\udea1", "\\ud83d\\udea2", "\\ud83d\\udea3", "\\ud83d\\udea4", "\\ud83d\\udea5", "\\ud83d\\udea6", "\\ud83d\\udea7", "\\ud83d\\udea8", "\\ud83d\\udea9", "\\ud83d\\udeaa", "\\ud83d\\udeab", "\\ud83d\\udeac", "\\ud83d\\udead", "\\ud83d\\udeae", "\\ud83d\\udeaf", "\\ud83d\\udeb0", "\\ud83d\\udeb1", "\\ud83d\\udeb2", "\\ud83d\\udeb3", "\\ud83d\\udeb4", "\\ud83d\\udeb5", "\\ud83d\\udeb6", "\\ud83d\\udeb7", "\\ud83d\\udeb8", "\\ud83d\\udeb9", "\\ud83d\\udeba", "\\ud83d\\udebb", "\\ud83d\\udebc", "\\ud83d\\udebd", "\\ud83d\\udebe", "\\ud83d\\udebf", "\\ud83d\\udec0", "\\ud83d\\udec1", "\\ud83d\\udec2", "\\ud83d\\udec3", "\\ud83d\\udec4", "\\ud83d\\udec5", "\\u0023\\u20e3", "\\u0030\\u20e3", "\\u0031\\u20e3", "\\u0032\\u20e3", "\\u0033\\u20e3", "\\u0034\\u20e3", "\\u0035\\u20e3", "\\u0036\\u20e3", "\\u0037\\u20e3", "\\u0038\\u20e3", "\\u0039\\u20e3", "\\u2935", "\\u3030", "\\u3297", "\\u3299", "\\u2049", "\\u2139", "\\u2194", "\\u2195", "\\u2196", "\\u2197", "\\u2198", "\\u2199", "\\u2600", "\\u2601", "\\u2611", "\\u2614", "\\u2615", "\\u2648", "\\u2649", "\\u2650", "\\u2651", "\\u2652", "\\u2653", "\\u2660", "\\u2663", "\\u2665", "\\u2666", "\\u2668", "\\u2693", "\\u2702", "\\u2705", "\\u2708", "\\u2709", "\\u2712", "\\u2714", "\\u2716", "\\u2728", "\\u2733", "\\u2734", "\\u2122", "\\u203c", "\\u21a9", "\\u21aa", "\\u2744", "\\u231a", "\\u231b", "\\u23e9", "\\u23ea", "\\u23eb", "\\u23ec", "\\u23f0", "\\u23f3", "\\u24c2", "\\u25aa", "\\u25ab", "\\u25b6", "\\u25c0", "\\u25fb", "\\u25fc", "\\u25fd", "\\u25fe", "\\u260e", "\\u261d", "\\u263a", "\\u264a", "\\u264b", "\\u264c", "\\u264d", "\\u264e", "\\u264f", "\\u267b", "\\u267f", "\\u26a0", "\\u26a1", "\\u26aa", "\\u26ab", "\\u26bd", "\\u26be", "\\u26c4", "\\u26c5", "\\u26ce", "\\u26d4", "\\u26ea", "\\u26f2", "\\u26f3", "\\u26f5", "\\u26fa", "\\u26fd", "\\u270a", "\\u270b", "\\u270c", "\\u270f", "\\u274c", "\\u274e", "\\u27a1", "\\u27b0", "\\u27bf", "\\u2b05", "\\u2b06", "\\u2b07", "\\u2b1b", "\\u2b1c", "\\u2b50", "\\u2b55", "\\u2747", "\\u303d", "\\u2753", "\\u2754", "\\u2755", "\\u2757", "\\u2764", "\\u2795", "\\u2796", "\\u2797", "\\u2934", "\\u00a9", "\\u00ae", "\\ue50a"] | |
}), | |
function (e, t) { | |
"function" == typeof define && define.amd ? define([], t) : e.TD.util.i18n = t() | |
}(this, function () { | |
var e, t = {}; | |
return t.getMessage = function (e) { | |
if ("undefined" == typeof TD_locale_messages) return void 0; | |
var t = TD_locale_messages[e]; | |
return t && t.message ? t.message : void 0 | |
}, t.getLocale = function () { | |
return e ? e : (TD.util.isChromeApp() && (e = t.getMessage("@@ui_locale")), e) | |
}, t | |
}), | |
function (e, t) { | |
"function" == typeof define && define.amd ? define(["scripts/utils/i18n"], t) : e.TD.i = t(TD.util.i18n) | |
}(this, function (e) { | |
var t = /[^A-Za-z0-9_]/g, | |
i = {}; | |
return function (n, r, s) { | |
var o, a, c, u = TD.config.i18n_test_length_ratio || .2, | |
l = TD.config.i18n_test_padding_char || "d"; | |
return "string" == typeof n && (n = { | |
text: n | |
}), "en_US" === e.getLocale() ? a = n.text : (o = i[n.text], void 0 === o && (o = n.text.replace(t, ""), i[n.text] = o), a = e.getMessage(o) || n.text), s || (a = TD.ui.template.toHtml(a, r)), TD.config.i18n_test && (c = Math.round(a.length * u), a += Array(c + 1).join(l)), a | |
} | |
}), TD.constants = { | |
keyCodes: { | |
enter: 13, | |
shift: 16, | |
escape: 27, | |
tab: 9, | |
del: 8, | |
spacebar: 32, | |
upArrow: 38, | |
downArrow: 40, | |
leftArrow: 37, | |
rightArrow: 39 | |
}, | |
charCodes: { | |
space: 32, | |
questionMark: 63 | |
}, | |
regexps: { | |
name: /\S+/, | |
username: /^[@ï¼ ]?([a-zA-Z0-9_]{1,15})$/, | |
usernameWithAt: /^[@ï¼ ]{1}([a-zA-Z0-9_]{1,15}) /, | |
usernameWithSpace: /^[@ï¼ ]{1}(\w{1,15})\s*$/, | |
email: /^[\w-]+([^@,\s\<\>\(\)]*[\w-]+)?\@[\w-]+(\.[\w-]+)*\.[a-z]{2,}$/i, | |
tokenSeparator: /[\s-_]+/ | |
}, | |
time: { | |
oneDay: 864e5, | |
oneHour: 36e5 | |
}, | |
TDApi: { | |
ERROR_ACCOUNT_DOESNT_EXIST: "Account does not exist.", | |
ERROR_BAD_PASSWORD: "BadPassword", | |
ERROR_SESSION_EXPIRED: "SessionExpired", | |
ERROR_RATE_LIMIT_EXCEEDED: "RateLimitExceeded" | |
} | |
}, TD.languages = { | |
_index: null, | |
_initialiseIndex: function () { | |
var e = TD.languages.getAllLanguages(); | |
TD.languages._index = {}, e.forEach(function (e) { | |
TD.languages._index[e.code] = e, e.actual_code && (TD.languages._index[e.actual_code] = e) | |
}) | |
}, | |
getLanguageFromISOCode: function (e) { | |
TD.languages._index || TD.languages._initialiseIndex(); | |
var t = TD.languages._index[e]; | |
return _.clone(t) | |
}, | |
getSystemLanguageCode: function (e) { | |
var t = navigator.language || navigator.userLanguage || ""; | |
return e && (t = t.replace(/-[a-z]+$/i, "")), t | |
}, | |
isSupportedTranslationSourceLanguage: function (e) { | |
var t = TD.languages.getSupportedTranslationSourceLanguages(); | |
return -1 !== t.indexOf(e.toLowerCase()) | |
}, | |
isSystemLangSupportedDestinationLanguage: function () { | |
var e = TD.languages.getSupportedTranslationDestinationLanguages(); | |
return -1 !== e.indexOf(TD.languages.getSystemLanguageCode(!0).toLowerCase()) || -1 !== e.indexOf(TD.languages.getSystemLanguageCode(!1).toLowerCase()) | |
}, | |
getSupportedDestinationSystemLanguage: function () { | |
var e = TD.languages.getSupportedTranslationDestinationLanguages(); | |
return TD.languages.getSystemLanguageCode(-1 !== e.indexOf(TD.languages.getSystemLanguageCode(!0).toLowerCase()) ? !0 : !1) | |
}, | |
getAllLanguages: function () { | |
return [{ | |
code: "am", | |
localized_name: TD.i("Amharic"), | |
name: "አማáˆáŠ›" | |
}, { | |
code: "ar", | |
localized_name: TD.i("Arabic"), | |
name: "العربية" | |
}, { | |
code: "bg", | |
localized_name: TD.i("Bulgarian"), | |
name: "БългарÑки" | |
}, { | |
code: "bn", | |
localized_name: TD.i("Bengali"), | |
name: "বাংলা" | |
}, { | |
code: "bo", | |
localized_name: TD.i("Tibetan"), | |
name: "བོད་སà¾à½‘" | |
}, { | |
code: "ca", | |
localized_name: TD.i("Catalan"), | |
name: "Català " | |
}, { | |
code: "chr", | |
localized_name: TD.i("Cherokee"), | |
name: "á£áŽ³áŽ©" | |
}, { | |
code: "cs", | |
localized_name: TD.i("Czech"), | |
name: "ÄeÅ¡tina" | |
}, { | |
code: "da", | |
localized_name: TD.i("Danish"), | |
name: "Dansk" | |
}, { | |
code: "de", | |
localized_name: TD.i("German"), | |
name: "Deutsch" | |
}, { | |
code: "dv", | |
localized_name: TD.i("Maldivian"), | |
name: "Þ‹Þ¨ÞˆÞ¬Þ€Þ¨" | |
}, { | |
code: "el", | |
localized_name: TD.i("Greek"), | |
name: "Ελληνικά" | |
}, { | |
code: "en", | |
localized_name: TD.i("English"), | |
name: "English" | |
}, { | |
code: "es", | |
localized_name: TD.i("Spanish"), | |
name: "Español" | |
}, { | |
code: "et", | |
localized_name: TD.i("Estonian"), | |
name: "eesti" | |
}, { | |
code: "fa", | |
localized_name: TD.i("Persian"), | |
name: "ÙØ§Ø±Ø³ÛŒ" | |
}, { | |
code: "fi", | |
localized_name: TD.i("Finnish"), | |
name: "Suomi" | |
}, { | |
code: "fr", | |
localized_name: TD.i("French"), | |
name: "Français" | |
}, { | |
code: "gu", | |
localized_name: TD.i("Gujarati"), | |
name: "ગà«àªœàª°àª¾àª¤à«€" | |
}, { | |
code: "iw", | |
actual_code: "he", | |
localized_name: TD.i("Hebrew"), | |
name: "עברית" | |
}, { | |
code: "hi", | |
localized_name: TD.i("Hindi"), | |
name: "हिंदी" | |
}, { | |
code: "ht", | |
localized_name: TD.i("Haitian Creole"), | |
name: "Kreyòl ayisyen" | |
}, { | |
code: "hu", | |
localized_name: TD.i("Hungarian"), | |
name: "Magyar" | |
}, { | |
code: "hy", | |
localized_name: TD.i("Armenian"), | |
name: "Õ€Õ¡ÕµÕ¥Ö€Õ¥Õ¶" | |
}, { | |
code: "in", | |
actual_code: "id", | |
localized_name: TD.i("Indonesian"), | |
name: "Bahasa Indonesia" | |
}, { | |
code: "is", | |
localized_name: TD.i("Icelandic"), | |
name: "Ãslenska" | |
}, { | |
code: "it", | |
localized_name: TD.i("Italian"), | |
name: "Italiano" | |
}, { | |
code: "iu", | |
localized_name: TD.i("Inuktitut"), | |
name: "áƒá“„ᒃᑎá‘ᑦ" | |
}, { | |
code: "ja", | |
localized_name: TD.i("Japanese"), | |
name: "日本語" | |
}, { | |
code: "ka", | |
localized_name: TD.i("Georgian"), | |
name: "ქáƒáƒ თული" | |
}, { | |
code: "km", | |
localized_name: TD.i("Khmer"), | |
name: "ážáŸ’មែរ" | |
}, { | |
code: "kn", | |
localized_name: TD.i("Kannada"), | |
name: "ಕನà³à²¨à²¡" | |
}, { | |
code: "ko", | |
localized_name: TD.i("Korean"), | |
name: "한êµì–´" | |
}, { | |
code: "lo", | |
localized_name: TD.i("Lao"), | |
name: "ລາວ" | |
}, { | |
code: "lt", | |
localized_name: TD.i("Lithuanian"), | |
name: "Lietuvių" | |
}, { | |
code: "lv", | |
localized_name: TD.i("Latvian"), | |
name: "latviešu valoda" | |
}, { | |
code: "ml", | |
localized_name: TD.i("Malayalam"), | |
name: "മലയാളം" | |
}, { | |
code: "my", | |
localized_name: TD.i("Myanmar"), | |
name: "မြန်မာဘာသာ" | |
}, { | |
code: "ne", | |
localized_name: TD.i("Nepali"), | |
name: "नेपाली" | |
}, { | |
code: "nl", | |
localized_name: TD.i("Dutch"), | |
name: "Nederlands" | |
}, { | |
code: "no", | |
localized_name: TD.i("Norwegian"), | |
name: "Norsk" | |
}, { | |
code: "or", | |
localized_name: TD.i("Oriya"), | |
name: "ଓଡ଼ିଆ" | |
}, { | |
code: "pa", | |
localized_name: TD.i("Panjabi"), | |
name: "ਪੰਜਾਬੀ" | |
}, { | |
code: "pl", | |
localized_name: TD.i("Polish"), | |
name: "Polski" | |
}, { | |
code: "pt", | |
localized_name: TD.i("Portuguese"), | |
name: "Português" | |
}, { | |
code: "ro", | |
localized_name: TD.i("Romanian"), | |
name: "limba română" | |
}, { | |
code: "ru", | |
localized_name: TD.i("Russian"), | |
name: "РуÑÑкий" | |
}, { | |
code: "si", | |
localized_name: TD.i("Sinhala"), | |
name: "සිංහල" | |
}, { | |
code: "sk", | |
localized_name: TD.i("Slovak"), | |
name: "slovenÄina" | |
}, { | |
code: "sl", | |
localized_name: TD.i("Slovene"), | |
name: "slovenski jezik" | |
}, { | |
code: "sv", | |
localized_name: TD.i("Swedish"), | |
name: "Svenska" | |
}, { | |
code: "ta", | |
localized_name: TD.i("Tamil"), | |
name: "தமிழà¯" | |
}, { | |
code: "te", | |
localized_name: TD.i("Telugu"), | |
name: "తెలà±à°—à±" | |
}, { | |
code: "th", | |
localized_name: TD.i("Thai"), | |
name: "ไทย" | |
}, { | |
code: "tl", | |
localized_name: TD.i("Tagalog"), | |
name: "Tagalog" | |
}, { | |
code: "tr", | |
localized_name: TD.i("Turkish"), | |
name: "Türkçe" | |
}, { | |
code: "uk", | |
localized_name: TD.i("Ukrainian"), | |
name: "українÑька мова" | |
}, { | |
code: "ur", | |
localized_name: TD.i("Urdu"), | |
name: "ïºïºïº©ï»" | |
}, { | |
code: "vi", | |
localized_name: TD.i("Vietnamese"), | |
name: "Tiếng Việt" | |
}, { | |
code: "zh", | |
localized_name: TD.i("Chinese"), | |
name: "䏿–‡" | |
}] | |
}, | |
getSupportedTranslationSourceLanguages: function () { | |
return ["bg", "ca", "zh", "cs", "da", "nl", "en", "et", "fi", "fr", "de", "el", "ht", "hi", "hu", "id", "in", "it", "ja", "ko", "lv", "lt", "no", "pl", "pt", "ro", "ru", "sk", "sl", "es", "sv", "th", "tr", "uk", "vi", "ar", "fa", "he"] | |
}, | |
getSupportedTranslationDestinationLanguages: function () { | |
return ["bg", "ca", "zh-cn", "zh-tw", "cs", "da", "nl", "en", "et", "fi", "fr", "de", "el", "ht", "hi", "hu", "id", "in", "it", "ja", "ko", "lv", "lt", "no", "pl", "pt", "ro", "ru", "sk", "sl", "es", "sv", "th", "tr", "uk", "vi", "ar", "fa", "he"] | |
} | |
}, TD.services.bitly = function () { | |
var e = {}, | |
t = "tweetdeckapi", | |
i = "R_b8032856b71a14fabfe64f6845689ddf", | |
n = function (e, n) { | |
var r, s = "https://api-ssl.bitly.com/v3/" + e; | |
n.login = t, n.apiKey = i, n.format = "json"; | |
var o = TD.storage.accountController.getAccountsForService("bitly"); | |
if (o.length > 0) { | |
var a = o[0]; | |
n.x_login = a.getUserID(), n.x_apiKey = a.getOAuthToken() | |
} | |
return r = TD.net.ajax.jsonp(s, n) | |
}; | |
return e.shorten = function (e) { | |
var t, i = e; | |
return _.startsWith(e, "http://") || _.startsWith(e, "https://") || (i = "http://" + e), t = n("shorten", { | |
longUrl: i | |
}), t.addCallback(function (t) { | |
var i = t.data; | |
if (!i || !i.data || !i.data.url) throw "Bit.ly shortening failed"; | |
return i.data && (i.data.long_url = e), i.data | |
}), t | |
}, e.shortenTextLinks = function (e) { | |
var t = twttr.txt.extractUrls(e), | |
i = t.map(function (e) { | |
return TD.services.bitly.shorten(e) | |
}), | |
n = new TD.core.defer.DeferredList(i); | |
return n.addCallback(function (t) { | |
return t.forEach(function (t) { | |
var i = t[0], | |
n = t[1]; | |
i && (e = e.replace(n.long_url, n.url)) | |
}), e | |
}), n | |
}, e | |
}(), ! function (e, t) { | |
"function" == typeof define ? define(t) : "undefined" != typeof module ? module.exports = t() : this[e] = t() | |
}("klass", function () { | |
function e(e) { | |
return r.call(t(e) ? e : function () {}, e, 1) | |
} | |
function t(e) { | |
return typeof e === a | |
} | |
function i(e, t, i) { | |
return function () { | |
var n = this.supr; | |
this.supr = i[u][e]; | |
var r = t.apply(this, arguments); | |
return this.supr = n, r | |
} | |
} | |
function n(e, n, r) { | |
for (var s in n) n.hasOwnProperty(s) && (e[s] = t(n[s]) && t(r[u][s]) && c.test(n[s]) ? i(s, n[s], r) : n[s]) | |
} | |
function r(e, i) { | |
function r() {} | |
function s() { | |
this.initialize ? this.initialize.apply(this, arguments) : (i || c && o.apply(this, arguments), l.apply(this, arguments)) | |
} | |
r[u] = this[u]; | |
var o = this, | |
a = new r, | |
c = t(e), | |
l = c ? e : this, | |
d = c ? {} : e; | |
return s.methods = function (e) { | |
return n(a, e, o), s[u] = a, this | |
}, s.methods.call(s, d).prototype.constructor = s, s.extend = arguments.callee, s[u].implement = s.statics = function (e, t) { | |
return e = "string" == typeof e ? function () { | |
var i = {}; | |
return i[e] = t, i | |
}() : e, n(this, e, o), this | |
}, s.mixin = function () { | |
for (var e = 0; e < arguments.length; e++) { | |
var t = arguments[e]; | |
void 0 === t ? console.warn("you have an undefined mixin coming from " + ns) : t.call(this, this) | |
} | |
return this | |
}, s | |
} | |
var s = this, | |
o = s.klass, | |
a = "function", | |
c = /xyz/.test(function () {}) ? /\bsupr\b/ : /.*/, | |
u = "prototype"; | |
return e.noConflict = function () { | |
return s.klass = o, this | |
}, s.klass = e, e | |
}), klass.mixin = function (e, t) { | |
if (_.isString(e)) { | |
for (var i = window, n = e.split("."), r = 0, s = n.length; s > r; ++r) i = i[n[r]] = i[n[r]] || (_.isUndefined(n[r + 1]) ? t : {}); | |
return i | |
} | |
_.extend(e, t) | |
}, klass.mixin("TD.mixins.caretHelper", function () { | |
return this.statics({ | |
spaceBoundary: /\s|$/, | |
wordEnd: /[^+\/.<>()|\\=\s]+$/ | |
}).methods({ | |
init: function () { | |
this.$input.bind("blur", _.bind(function () { | |
setTimeout(_.bind(function () { | |
this.hide() | |
}, this), 1e3) | |
}, this)).bind("mouseup", _.bind(function () { | |
setTimeout(_.bind(function () { | |
this.getCaret() | |
}, this), 0) | |
}, this)).bind("focus", _.bind(function () { | |
this.getCaret() | |
}, this)) | |
}, | |
getCurrentText: function () { | |
return this.$input.val() | |
}, | |
setCaretPosition: function (e) { | |
var t = this.$input[0]; | |
if (t.setSelectionRange) t.focus(), t.setSelectionRange(e, e); | |
else if (t.createTextRange) { | |
var i = t.createTextRange(); | |
i.collapse(!0), i.moveEnd("character", e), i.moveStart("character", e), i.select() | |
} | |
this.lastCaret = e | |
}, | |
getCaret: function () { | |
var e = this.$input[0], | |
t = 0; | |
if (document.selection) { | |
try { | |
e.focus() | |
} catch (i) {} | |
var n = document.selection.createRange(); | |
if (null == n) return this.lastCaret = 0, 0; | |
var r = e.createTextRange(), | |
s = r.duplicate(); | |
r.moveToBookmark(n.getBookmark()), s.setEndPoint("EndToStart", r), t = s.text.length | |
} else(e.selectionStart || "0" == e.selectionStart) && (t = e.selectionStart); | |
return this.lastCaret = t, t | |
}, | |
insertOrReplaceSelection: function (e, t) { | |
var i = this.$input[0], | |
n = this.getCaret(), | |
r = n + e.length; | |
if (document.selection) { | |
i.focus(); | |
var s = document.selection.createRange(); | |
if (s.text = e, t) { | |
var o = i.createTextRange(); | |
o.collapse(!0), o.moveEnd("character", r), o.moveStart("character", n), o.select() | |
} else this.setCaretPosition(r) | |
} else if (i.selectionStart || "0" == i.selectionStart) { | |
var a = i.selectionStart, | |
c = i.selectionEnd, | |
u = i.scrollTop; | |
i.value = i.value.substring(0, a) + e + i.value.substring(c, i.value.length), i.focus(), i.selectionStart = t ? n : r, i.selectionEnd = r, i.scrollTop = u | |
} else i.value += e, this.setCaretPosition(r), i.focus(); | |
this.lastCaret = r, this.$input.change() | |
}, | |
getCurrentWord: function (e) { | |
var t = this.getCurrentText(), | |
i = t.slice(0, e), | |
n = t.slice(e, t.length), | |
r = t.charAt(e - 1); | |
if (!r || " " === r) return ""; | |
this.leftBoundary = i.search(this.constructor.wordEnd); | |
var s = i.slice(this.leftBoundary, i.length), | |
o = n.slice(0, n.search(this.constructor.spaceBoundary)), | |
a = s.concat(o); | |
return this.rightBoundary = this.leftBoundary + a.length, a | |
}, | |
replaceCurrentWord: function (e) { | |
var t = this.getCurrentText().split(""); | |
this.oldValueArray = t; | |
var i = t.slice(0, this.leftBoundary), | |
n = t.slice(this.rightBoundary, t.length); | |
(n.length < 1 || !n[0].match(/\s/)) && (e += " "); | |
var r = (i.join("") + e).length + 1; | |
return { | |
value: i.join("") + e + n.join(""), | |
cursor: r | |
} | |
} | |
}), this | |
}), | |
function () { | |
function e(e, t) { | |
return t = t || "", "string" != typeof e && (e.global && t.indexOf("g") < 0 && (t += "g"), e.ignoreCase && t.indexOf("i") < 0 && (t += "i"), e.multiline && t.indexOf("m") < 0 && (t += "m"), e = e.source), new RegExp(e.replace(/#\{(\w+)\}/g, function (e, t) { | |
var i = s.txt.regexen[t] || ""; | |
return "string" != typeof i && (i = i.source), i | |
}), t) | |
} | |
function t(e, t) { | |
return e.replace(/#\{(\w+)\}/g, function (e, i) { | |
return t[i] || "" | |
}) | |
} | |
function i(e, t, i) { | |
var n = String.fromCharCode(t); | |
return i !== t && (n += "-" + String.fromCharCode(i)), e.push(n), e | |
} | |
function n(e) { | |
var t = {}; | |
for (var i in e) e.hasOwnProperty(i) && (t[i] = e[i]); | |
return t | |
} | |
function r(e, t, i) { | |
return i ? !e || e.match(t) && RegExp["$&"] === e : "string" == typeof e && e.match(t) && RegExp["$&"] === e | |
} | |
if ("undefined" == typeof s || null === s) var s = {}; | |
s.txt = {}, s.txt.regexen = {}; | |
var o = { | |
"&": "&", | |
">": ">", | |
"<": "<", | |
'"': """, | |
"'": "'" | |
}; | |
s.txt.htmlEscape = function (e) { | |
return e && e.replace(/[&"'><]/g, function (e) { | |
return o[e] | |
}) | |
}, s.txt.regexSupplant = e, s.txt.stringSupplant = t, s.txt.addCharsToCharClass = i; | |
var a = String.fromCharCode, | |
c = [a(32), a(133), a(160), a(5760), a(6158), a(8232), a(8233), a(8239), a(8287), a(12288)]; | |
i(c, 9, 13), i(c, 8192, 8202); | |
var u = [a(65534), a(65279), a(65535)]; | |
i(u, 8234, 8238), s.txt.regexen.spaces_group = e(c.join("")), s.txt.regexen.spaces = e("[" + c.join("") + "]"), s.txt.regexen.invalid_chars_group = e(u.join("")), s.txt.regexen.punct = /\!'#%&'\(\)*\+,\\\-\.\/:;<=>\?@\[\]\^_{|}~\$/, s.txt.regexen.rtl_chars = /[\u0600-\u06FF]|[\u0750-\u077F]|[\u0590-\u05FF]|[\uFE70-\uFEFF]/gm, s.txt.regexen.non_bmp_code_pairs = /[\uD800-\uDBFF][\uDC00-\uDFFF]/gm; | |
var l = []; | |
i(l, 1024, 1279), i(l, 1280, 1319), i(l, 11744, 11775), i(l, 42560, 42655), i(l, 1425, 1471), i(l, 1473, 1474), i(l, 1476, 1477), i(l, 1479, 1479), i(l, 1488, 1514), i(l, 1520, 1524), i(l, 64274, 64296), i(l, 64298, 64310), i(l, 64312, 64316), i(l, 64318, 64318), i(l, 64320, 64321), i(l, 64323, 64324), i(l, 64326, 64335), i(l, 1552, 1562), i(l, 1568, 1631), i(l, 1646, 1747), i(l, 1749, 1756), i(l, 1758, 1768), i(l, 1770, 1775), i(l, 1786, 1788), i(l, 1791, 1791), i(l, 1872, 1919), i(l, 2208, 2208), i(l, 2210, 2220), i(l, 2276, 2302), i(l, 64336, 64433), i(l, 64467, 64829), i(l, 64848, 64911), i(l, 64914, 64967), i(l, 65008, 65019), i(l, 65136, 65140), i(l, 65142, 65276), i(l, 8204, 8204), i(l, 3585, 3642), i(l, 3648, 3662), i(l, 4352, 4607), i(l, 12592, 12677), i(l, 43360, 43391), i(l, 44032, 55215), i(l, 55216, 55295), i(l, 65441, 65500), i(l, 12449, 12538), i(l, 12540, 12542), i(l, 65382, 65439), i(l, 65392, 65392), i(l, 65296, 65305), i(l, 65313, 65338), i(l, 65345, 65370), i(l, 12353, 12438), i(l, 12441, 12446), i(l, 13312, 19903), i(l, 19968, 40959), i(l, 173824, 177983), i(l, 177984, 178207), i(l, 194560, 195103), i(l, 12291, 12291), i(l, 12293, 12293), i(l, 12347, 12347), s.txt.regexen.nonLatinHashtagChars = e(l.join("")); | |
var d = []; | |
i(d, 192, 214), i(d, 216, 246), i(d, 248, 255), i(d, 256, 591), i(d, 595, 596), i(d, 598, 599), i(d, 601, 601), i(d, 603, 603), i(d, 611, 611), i(d, 616, 616), i(d, 623, 623), i(d, 626, 626), i(d, 649, 649), i(d, 651, 651), i(d, 699, 699), i(d, 768, 879), i(d, 7680, 7935), s.txt.regexen.latinAccentChars = e(d.join("")), s.txt.regexen.hashSigns = /[##]/, s.txt.regexen.hashtagAlpha = e(/[a-z_#{latinAccentChars}#{nonLatinHashtagChars}]/i), s.txt.regexen.hashtagAlphaNumeric = e(/[a-z0-9_#{latinAccentChars}#{nonLatinHashtagChars}]/i), s.txt.regexen.endHashtagMatch = e(/^(?:#{hashSigns}|:\/\/)/), s.txt.regexen.hashtagBoundary = e(/(?:^|$|[^&a-z0-9_#{latinAccentChars}#{nonLatinHashtagChars}])/), s.txt.regexen.validHashtag = e(/(#{hashtagBoundary})(#{hashSigns})(#{hashtagAlphaNumeric}*#{hashtagAlpha}#{hashtagAlphaNumeric}*)/gi), s.txt.regexen.validMentionPrecedingChars = /(?:^|[^a-zA-Z0-9_!#$%&*@ï¼ ]|(?:rt|RT|rT|Rt):?)/, s.txt.regexen.atSigns = /[@ï¼ ]/, s.txt.regexen.validMentionOrList = e("(#{validMentionPrecedingChars})(#{atSigns})([a-zA-Z0-9_]{1,20})(/[a-zA-Z][a-zA-Z0-9_-]{0,24})?", "g"), s.txt.regexen.validReply = e(/^(?:#{spaces})*#{atSigns}([a-zA-Z0-9_]{1,20})/), s.txt.regexen.endMentionMatch = e(/^(?:#{atSigns}|[#{latinAccentChars}]|:\/\/)/), s.txt.regexen.validUrlPrecedingChars = e(/(?:[^A-Za-z0-9@ï¼ $###{invalid_chars_group}]|^)/), s.txt.regexen.invalidUrlWithoutProtocolPrecedingChars = /[-_.\/]$/, s.txt.regexen.invalidDomainChars = t("#{punct}#{spaces_group}#{invalid_chars_group}", s.txt.regexen), s.txt.regexen.validDomainChars = e(/[^#{invalidDomainChars}]/), s.txt.regexen.validSubdomain = e(/(?:(?:#{validDomainChars}(?:[_-]|#{validDomainChars})*)?#{validDomainChars}\.)/), s.txt.regexen.validDomainName = e(/(?:(?:#{validDomainChars}(?:-|#{validDomainChars})*)?#{validDomainChars}\.)/), s.txt.regexen.validGTLD = e(/(?:(?:aero|asia|biz|cat|com|coop|edu|gov|info|int|jobs|mil|mobi|museum|name|net|org|pro|tel|travel|xxx)(?=[^0-9a-zA-Z@]|$))/), s.txt.regexen.validCCTLD = e(RegExp("(?:(?:ac|ad|ae|af|ag|ai|al|am|an|ao|aq|ar|as|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|cr|cs|cu|cv|cx|cy|cz|dd|de|dj|dk|dm|do|dz|ec|ee|eg|eh|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|in|io|iq|ir|is|it|je|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|mz|na|nc|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|ss|st|su|sv|sx|sy|sz|tc|td|tf|tg|th|tj|tk|tl|tm|tn|to|tp|tr|tt|tv|tw|tz|ua|ug|uk|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|za|zm|zw)(?=[^0-9a-zA-Z@]|$))")), s.txt.regexen.validPunycode = e(/(?:xn--[0-9a-z]+)/), s.txt.regexen.validDomain = e(/(?:#{validSubdomain}*#{validDomainName}(?:#{validGTLD}|#{validCCTLD}|#{validPunycode}))/), s.txt.regexen.validAsciiDomain = e(/(?:(?:[\-a-z0-9#{latinAccentChars}]+)\.)+(?:#{validGTLD}|#{validCCTLD}|#{validPunycode})/gi), s.txt.regexen.invalidShortDomain = e(/^#{validDomainName}#{validCCTLD}$/), s.txt.regexen.validPortNumber = e(/[0-9]+/), s.txt.regexen.validGeneralUrlPathChars = e(/[a-z0-9!\*';:=\+,\.\$\/%#\[\]\-_~@|&#{latinAccentChars}]/i), s.txt.regexen.validUrlBalancedParens = e("\\((?:#{validGeneralUrlPathChars}+|(?:#{validGeneralUrlPathChars}*\\(#{validGeneralUrlPathChars}+\\)#{validGeneralUrlPathChars}*))\\)", "i"), s.txt.regexen.validUrlPathEndingChars = e(/[\+\-a-z0-9=_#\/#{latinAccentChars}]|(?:#{validUrlBalancedParens})/i), s.txt.regexen.validUrlPath = e("(?:(?:#{validGeneralUrlPathChars}*(?:#{validUrlBalancedParens}#{validGeneralUrlPathChars}*)*#{validUrlPathEndingChars})|(?:@#{validGeneralUrlPathChars}+/))", "i"), s.txt.regexen.validUrlQueryChars = /[a-z0-9!?\*'@\(\);:&=\+\$\/%#\[\]\-_\.,~|]/i, s.txt.regexen.validUrlQueryEndingChars = /[a-z0-9_&=#\/]/i, s.txt.regexen.extractUrl = e("((#{validUrlPrecedingChars})((https?:\\/\\/)?(#{validDomain})(?::(#{validPortNumber}))?(\\/#{validUrlPath}*)?(\\?#{validUrlQueryChars}*#{validUrlQueryEndingChars})?))", "gi"), s.txt.regexen.validTcoUrl = /^https?:\/\/t\.co\/[a-z0-9]+/i, s.txt.regexen.urlHasProtocol = /^https?:\/\//i, s.txt.regexen.urlHasHttps = /^https:\/\//i, s.txt.regexen.cashtag = /[a-z]{1,6}(?:[._][a-z]{1,2})?/i, s.txt.regexen.validCashtag = e("(^|#{spaces})(\\$)(#{cashtag})(?=$|\\s|[#{punct}])", "gi"), s.txt.regexen.validateUrlUnreserved = /[a-z0-9\-._~]/i, s.txt.regexen.validateUrlPctEncoded = /(?:%[0-9a-f]{2})/i, s.txt.regexen.validateUrlSubDelims = /[!$&'()*+,;=]/i, s.txt.regexen.validateUrlPchar = e("(?:#{validateUrlUnreserved}|#{validateUrlPctEncoded}|#{validateUrlSubDelims}|[:|@])", "i"), s.txt.regexen.validateUrlScheme = /(?:[a-z][a-z0-9+\-.]*)/i, s.txt.regexen.validateUrlUserinfo = e("(?:#{validateUrlUnreserved}|#{validateUrlPctEncoded}|#{validateUrlSubDelims}|:)*", "i"), s.txt.regexen.validateUrlDecOctet = /(?:[0-9]|(?:[1-9][0-9])|(?:1[0-9]{2})|(?:2[0-4][0-9])|(?:25[0-5]))/i, s.txt.regexen.validateUrlIpv4 = e(/(?:#{validateUrlDecOctet}(?:\.#{validateUrlDecOctet}){3})/i), s.txt.regexen.validateUrlIpv6 = /(?:\[[a-f0-9:\.]+\])/i, s.txt.regexen.validateUrlIp = e("(?:#{validateUrlIpv4}|#{validateUrlIpv6})", "i"), s.txt.regexen.validateUrlSubDomainSegment = /(?:[a-z0-9](?:[a-z0-9_\-]*[a-z0-9])?)/i, s.txt.regexen.validateUrlDomainSegment = /(?:[a-z0-9](?:[a-z0-9\-]*[a-z0-9])?)/i, s.txt.regexen.validateUrlDomainTld = /(?:[a-z](?:[a-z0-9\-]*[a-z0-9])?)/i, s.txt.regexen.validateUrlDomain = e(/(?:(?:#{validateUrlSubDomainSegment]}\.)*(?:#{validateUrlDomainSegment]}\.)#{validateUrlDomainTld})/i), s.txt.regexen.validateUrlHost = e("(?:#{validateUrlIp}|#{validateUrlDomain})", "i"), s.txt.regexen.validateUrlUnicodeSubDomainSegment = /(?:(?:[a-z0-9]|[^\u0000-\u007f])(?:(?:[a-z0-9_\-]|[^\u0000-\u007f])*(?:[a-z0-9]|[^\u0000-\u007f]))?)/i, s.txt.regexen.validateUrlUnicodeDomainSegment = /(?:(?:[a-z0-9]|[^\u0000-\u007f])(?:(?:[a-z0-9\-]|[^\u0000-\u007f])*(?:[a-z0-9]|[^\u0000-\u007f]))?)/i, s.txt.regexen.validateUrlUnicodeDomainTld = /(?:(?:[a-z]|[^\u0000-\u007f])(?:(?:[a-z0-9\-]|[^\u0000-\u007f])*(?:[a-z0-9]|[^\u0000-\u007f]))?)/i, s.txt.regexen.validateUrlUnicodeDomain = e(/(?:(?:#{validateUrlUnicodeSubDomainSegment}\.)*(?:#{validateUrlUnicodeDomainSegment}\.)#{validateUrlUnicodeDomainTld})/i), s.txt.regexen.validateUrlUnicodeHost = e("(?:#{validateUrlIp}|#{validateUrlUnicodeDomain})", "i"), s.txt.regexen.validateUrlPort = /[0-9]{1,5}/, s.txt.regexen.validateUrlUnicodeAuthority = e("(?:(#{validateUrlUserinfo})@)?(#{validateUrlUnicodeHost})(?::(#{validateUrlPort}))?", "i"), s.txt.regexen.validateUrlAuthority = e("(?:(#{validateUrlUserinfo})@)?(#{validateUrlHost})(?::(#{validateUrlPort}))?", "i"), s.txt.regexen.validateUrlPath = e(/(\/#{validateUrlPchar}*)*/i), s.txt.regexen.validateUrlQuery = e(/(#{validateUrlPchar}|\/|\?)*/i), s.txt.regexen.validateUrlFragment = e(/(#{validateUrlPchar}|\/|\?)*/i), s.txt.regexen.validateUrlUnencoded = e("^(?:([^:/?#]+):\\/\\/)?([^/?#]*)([^?#]*)(?:\\?([^#]*))?(?:#(.*))?$", "i"); | |
var h = "tweet-url list-slug", | |
p = "tweet-url username", | |
f = "tweet-url hashtag", | |
m = "tweet-url cashtag", | |
g = { | |
urlClass: !0, | |
listClass: !0, | |
usernameClass: !0, | |
hashtagClass: !0, | |
cashtagClass: !0, | |
usernameUrlBase: !0, | |
listUrlBase: !0, | |
hashtagUrlBase: !0, | |
cashtagUrlBase: !0, | |
usernameUrlBlock: !0, | |
listUrlBlock: !0, | |
hashtagUrlBlock: !0, | |
linkUrlBlock: !0, | |
usernameIncludeSymbol: !0, | |
suppressLists: !0, | |
suppressNoFollow: !0, | |
targetBlank: !0, | |
suppressDataScreenName: !0, | |
urlEntities: !0, | |
symbolTag: !0, | |
textWithSymbolTag: !0, | |
urlTarget: !0, | |
invisibleTagAttrs: !0, | |
linkAttributeBlock: !0, | |
linkTextBlock: !0, | |
htmlEscapeNonEntities: !0 | |
}, | |
T = { | |
disabled: !0, | |
readonly: !0, | |
multiple: !0, | |
checked: !0 | |
}; | |
s.txt.tagAttrs = function (e) { | |
var t = ""; | |
for (var i in e) { | |
var n = e[i]; | |
T[i] && (n = n ? i : null), null != n && (t += " " + s.txt.htmlEscape(i) + '="' + s.txt.htmlEscape(n.toString()) + '"') | |
} | |
return t | |
}, s.txt.linkToText = function (e, i, n, r) { | |
r.suppressNoFollow || (n.rel = "nofollow"), r.linkAttributeBlock && r.linkAttributeBlock(e, n), r.linkTextBlock && (i = r.linkTextBlock(e, i)); | |
var o = { | |
text: i, | |
attr: s.txt.tagAttrs(n) | |
}; | |
return t("<a#{attr}>#{text}</a>", o) | |
}, s.txt.linkToTextWithSymbol = function (e, t, i, n, r) { | |
var o = r.symbolTag ? "<" + r.symbolTag + ">" + t + "</" + r.symbolTag + ">" : t; | |
i = s.txt.htmlEscape(i); | |
var a = r.textWithSymbolTag ? "<" + r.textWithSymbolTag + ">" + i + "</" + r.textWithSymbolTag + ">" : i; | |
return r.usernameIncludeSymbol || !t.match(s.txt.regexen.atSigns) ? s.txt.linkToText(e, o + a, n, r) : o + s.txt.linkToText(e, a, n, r) | |
}, s.txt.linkToHashtag = function (e, t, i) { | |
var r = t.substring(e.indices[0], e.indices[0] + 1), | |
o = s.txt.htmlEscape(e.hashtag), | |
a = n(i.htmlAttrs || {}); | |
return a.href = i.hashtagUrlBase + o, a.title = "#" + o, a["class"] = i.hashtagClass, o.charAt(0).match(s.txt.regexen.rtl_chars) && (a["class"] += " rtl"), i.targetBlank && (a.target = "_blank"), s.txt.linkToTextWithSymbol(e, r, o, a, i) | |
}, s.txt.linkToCashtag = function (e, t, i) { | |
var r = s.txt.htmlEscape(e.cashtag), | |
o = n(i.htmlAttrs || {}); | |
return o.href = i.cashtagUrlBase + r, o.title = "$" + r, o["class"] = i.cashtagClass, i.targetBlank && (o.target = "_blank"), s.txt.linkToTextWithSymbol(e, "$", r, o, i) | |
}, s.txt.linkToMentionAndList = function (e, t, i) { | |
var r = t.substring(e.indices[0], e.indices[0] + 1), | |
o = s.txt.htmlEscape(e.screenName), | |
a = s.txt.htmlEscape(e.listSlug), | |
c = e.listSlug && !i.suppressLists, | |
u = n(i.htmlAttrs || {}); | |
return u["class"] = c ? i.listClass : i.usernameClass, u.href = c ? i.listUrlBase + o + a : i.usernameUrlBase + o, c || i.suppressDataScreenName || (u["data-screen-name"] = o), i.targetBlank && (u.target = "_blank"), s.txt.linkToTextWithSymbol(e, r, c ? o + a : o, u, i) | |
}, s.txt.linkToUrl = function (e, t, i) { | |
var r = e.url, | |
o = r, | |
a = s.txt.htmlEscape(o), | |
c = i.urlEntities && i.urlEntities[r] || e; | |
c.display_url && (a = s.txt.linkTextWithEntity(c, i)); | |
var u = n(i.htmlAttrs || {}); | |
return r.match(s.txt.regexen.urlHasProtocol) || (r = "http://" + r), u.href = r, i.targetBlank && (u.target = "_blank"), i.urlClass && (u["class"] = i.urlClass), i.urlTarget && (u.target = i.urlTarget), !i.title && c.display_url && (u.title = c.expanded_url), s.txt.linkToText(e, a, u, i) | |
}, s.txt.linkTextWithEntity = function (e, i) { | |
var n = e.display_url, | |
r = e.expanded_url, | |
o = n.replace(/…/g, ""); | |
if (-1 != r.indexOf(o)) { | |
var a = r.indexOf(o), | |
c = { | |
displayUrlSansEllipses: o, | |
beforeDisplayUrl: r.substr(0, a), | |
afterDisplayUrl: r.substr(a + o.length), | |
precedingEllipsis: n.match(/^…/) ? "…" : "", | |
followingEllipsis: n.match(/…$/) ? "…" : "" | |
}; | |
for (var u in c) c.hasOwnProperty(u) && (c[u] = s.txt.htmlEscape(c[u])); | |
return c.invisible = i.invisibleTagAttrs, t("<span class='tco-ellipsis'>#{precedingEllipsis}<span #{invisible}> </span></span><span #{invisible}>#{beforeDisplayUrl}</span><span class='js-display-url'>#{displayUrlSansEllipses}</span><span #{invisible}>#{afterDisplayUrl}</span><span class='tco-ellipsis'><span #{invisible}> </span>#{followingEllipsis}</span>", c) | |
} | |
return n | |
}, s.txt.autoLinkEntities = function (e, t, i) { | |
i = n(i || {}), i.hashtagClass = i.hashtagClass || f, i.hashtagUrlBase = i.hashtagUrlBase || "https://twitter.com/#!/search?q=%23", i.cashtagClass = i.cashtagClass || m, i.cashtagUrlBase = i.cashtagUrlBase || "https://twitter.com/#!/search?q=%24", i.listClass = i.listClass || h, i.usernameClass = i.usernameClass || p, i.usernameUrlBase = i.usernameUrlBase || "https://twitter.com/", i.listUrlBase = i.listUrlBase || "https://twitter.com/", i.htmlAttrs = s.txt.extractHtmlAttrsFromOptions(i), i.invisibleTagAttrs = i.invisibleTagAttrs || "style='position:absolute;left:-9999px;'"; | |
var r, o, a; | |
if (i.urlEntities) { | |
for (r = {}, o = 0, a = i.urlEntities.length; a > o; o++) r[i.urlEntities[o].url] = i.urlEntities[o]; | |
i.urlEntities = r | |
} | |
var c = "", | |
u = 0; | |
t.sort(function (e, t) { | |
return e.indices[0] - t.indices[0] | |
}); | |
for (var l = i.htmlEscapeNonEntities ? s.txt.htmlEscape : function (e) { | |
return e | |
}, o = 0; o < t.length; o++) { | |
var d = t[o]; | |
c += l(e.substring(u, d.indices[0])), d.url ? c += s.txt.linkToUrl(d, e, i) : d.hashtag ? c += s.txt.linkToHashtag(d, e, i) : d.screenName ? c += s.txt.linkToMentionAndList(d, e, i) : d.cashtag && (c += s.txt.linkToCashtag(d, e, i)), u = d.indices[1] | |
} | |
return c += l(e.substring(u, e.length)) | |
}, s.txt.autoLinkWithJSON = function (e, t, i) { | |
var n = []; | |
for (var r in t) n = n.concat(t[r]); | |
for (var o = 0; o < n.length; o++) entity = n[o], entity.screen_name ? entity.screenName = entity.screen_name : entity.text && (entity.hashtag = entity.text); | |
return s.txt.modifyIndicesFromUnicodeToUTF16(e, n), s.txt.autoLinkEntities(e, n, i) | |
}, s.txt.extractHtmlAttrsFromOptions = function (e) { | |
var t = {}; | |
for (var i in e) { | |
var n = e[i]; | |
g[i] || (T[i] && (n = n ? i : null), null != n && (t[i] = n)) | |
} | |
return t | |
}, s.txt.autoLink = function (e, t) { | |
var i = s.txt.extractEntitiesWithIndices(e, { | |
extractUrlsWithoutProtocol: !1 | |
}); | |
return s.txt.autoLinkEntities(e, i, t) | |
}, s.txt.autoLinkUsernamesOrLists = function (e, t) { | |
var i = s.txt.extractMentionsOrListsWithIndices(e); | |
return s.txt.autoLinkEntities(e, i, t) | |
}, s.txt.autoLinkHashtags = function (e, t) { | |
var i = s.txt.extractHashtagsWithIndices(e); | |
return s.txt.autoLinkEntities(e, i, t) | |
}, s.txt.autoLinkCashtags = function (e, t) { | |
var i = s.txt.extractCashtagsWithIndices(e); | |
return s.txt.autoLinkEntities(e, i, t) | |
}, s.txt.autoLinkUrlsCustom = function (e, t) { | |
var i = s.txt.extractUrlsWithIndices(e, { | |
extractUrlsWithoutProtocol: !1 | |
}); | |
return s.txt.autoLinkEntities(e, i, t) | |
}, s.txt.removeOverlappingEntities = function (e) { | |
e.sort(function (e, t) { | |
return e.indices[0] - t.indices[0] | |
}); | |
for (var t = e[0], i = 1; i < e.length; i++) t.indices[1] > e[i].indices[0] ? (e.splice(i, 1), i--) : t = e[i] | |
}, s.txt.extractEntitiesWithIndices = function (e, t) { | |
var i = s.txt.extractUrlsWithIndices(e, t).concat(s.txt.extractMentionsOrListsWithIndices(e)).concat(s.txt.extractHashtagsWithIndices(e, { | |
checkUrlOverlap: !1 | |
})).concat(s.txt.extractCashtagsWithIndices(e)); | |
return 0 == i.length ? [] : (s.txt.removeOverlappingEntities(i), i) | |
}, s.txt.extractMentions = function (e) { | |
for (var t = [], i = s.txt.extractMentionsWithIndices(e), n = 0; n < i.length; n++) { | |
var r = i[n].screenName; | |
t.push(r) | |
} | |
return t | |
}, s.txt.extractMentionsWithIndices = function (e) { | |
for (var t, i = [], n = s.txt.extractMentionsOrListsWithIndices(e), r = 0; r < n.length; r++) t = n[r], "" == t.listSlug && i.push({ | |
screenName: t.screenName, | |
indices: t.indices | |
}); | |
return i | |
}, s.txt.extractMentionsOrListsWithIndices = function (e) { | |
if (!e || !e.match(s.txt.regexen.atSigns)) return []; | |
var t = []; | |
return e.replace(s.txt.regexen.validMentionOrList, function (e, i, n, r, o, a, c) { | |
var u = c.slice(a + e.length); | |
if (!u.match(s.txt.regexen.endMentionMatch)) { | |
o = o || ""; | |
var l = a + i.length, | |
d = l + r.length + o.length + 1; | |
t.push({ | |
screenName: r, | |
listSlug: o, | |
indices: [l, d] | |
}) | |
} | |
}), t | |
}, s.txt.extractReplies = function (e) { | |
if (!e) return null; | |
var t = e.match(s.txt.regexen.validReply); | |
return !t || RegExp.rightContext.match(s.txt.regexen.endMentionMatch) ? null : t[1] | |
}, s.txt.extractUrls = function (e, t) { | |
for (var i = [], n = s.txt.extractUrlsWithIndices(e, t), r = 0; r < n.length; r++) i.push(n[r].url); | |
return i | |
}, s.txt.extractUrlsWithIndices = function (e, t) { | |
if (t || (t = { | |
extractUrlsWithoutProtocol: !0 | |
}), !e || (t.extractUrlsWithoutProtocol ? !e.match(/\./) : !e.match(/:/))) return []; | |
for (var i = []; s.txt.regexen.extractUrl.exec(e);) { | |
var n = RegExp.$2, | |
r = RegExp.$3, | |
o = RegExp.$4, | |
a = RegExp.$5, | |
c = RegExp.$7, | |
u = s.txt.regexen.extractUrl.lastIndex, | |
l = u - r.length; | |
if (o) r.match(s.txt.regexen.validTcoUrl) && (r = RegExp.lastMatch, u = l + r.length), i.push({ | |
url: r, | |
indices: [l, u] | |
}); | |
else { | |
if (!t.extractUrlsWithoutProtocol || n.match(s.txt.regexen.invalidUrlWithoutProtocolPrecedingChars)) continue; | |
var d = null, | |
h = !1, | |
p = 0; | |
if (a.replace(s.txt.regexen.validAsciiDomain, function (e) { | |
var t = a.indexOf(e, p); | |
p = t + e.length, d = { | |
url: e, | |
indices: [l + t, l + p] | |
}, h = e.match(s.txt.regexen.invalidShortDomain), h || i.push(d) | |
}), null == d) continue; | |
c && (h && i.push(d), d.url = r.replace(a, d.url), d.indices[1] = u) | |
} | |
} | |
return i | |
}, s.txt.extractHashtags = function (e) { | |
for (var t = [], i = s.txt.extractHashtagsWithIndices(e), n = 0; n < i.length; n++) t.push(i[n].hashtag); | |
return t | |
}, s.txt.extractHashtagsWithIndices = function (e, t) { | |
if (t || (t = { | |
checkUrlOverlap: !0 | |
}), !e || !e.match(s.txt.regexen.hashSigns)) return []; | |
var i = []; | |
if (e.replace(s.txt.regexen.validHashtag, function (e, t, n, r, o, a) { | |
var c = a.slice(o + e.length); | |
if (!c.match(s.txt.regexen.endHashtagMatch)) { | |
var u = o + t.length, | |
l = u + r.length + 1; | |
i.push({ | |
hashtag: r, | |
indices: [u, l] | |
}) | |
} | |
}), t.checkUrlOverlap) { | |
var n = s.txt.extractUrlsWithIndices(e); | |
if (n.length > 0) { | |
var r = i.concat(n); | |
s.txt.removeOverlappingEntities(r), i = []; | |
for (var o = 0; o < r.length; o++) r[o].hashtag && i.push(r[o]) | |
} | |
} | |
return i | |
}, s.txt.extractCashtags = function (e) { | |
for (var t = [], i = s.txt.extractCashtagsWithIndices(e), n = 0; n < i.length; n++) t.push(i[n].cashtag); | |
return t | |
}, s.txt.extractCashtagsWithIndices = function (e) { | |
if (!e || -1 == e.indexOf("$")) return []; | |
var t = []; | |
return e.replace(s.txt.regexen.validCashtag, function (e, i, n, r, s) { | |
var o = s + i.length, | |
a = o + r.length + 1; | |
t.push({ | |
cashtag: r, | |
indices: [o, a] | |
}) | |
}), t | |
}, s.txt.modifyIndicesFromUnicodeToUTF16 = function (e, t) { | |
s.txt.convertUnicodeIndices(e, t, !1) | |
}, s.txt.modifyIndicesFromUTF16ToUnicode = function (e, t) { | |
s.txt.convertUnicodeIndices(e, t, !0) | |
}, s.txt.getUnicodeTextLength = function (e) { | |
return e.replace(s.txt.regexen.non_bmp_code_pairs, " ").length | |
}, s.txt.convertUnicodeIndices = function (e, t, i) { | |
if (0 != t.length) { | |
var n = 0, | |
r = 0; | |
t.sort(function (e, t) { | |
return e.indices[0] - t.indices[0] | |
}); | |
for (var s = 0, o = t[0]; n < e.length;) { | |
if (o.indices[0] == (i ? n : r)) { | |
var a = o.indices[1] - o.indices[0]; | |
if (o.indices[0] = i ? r : n, o.indices[1] = o.indices[0] + a, s++, s == t.length) break; | |
o = t[s] | |
} | |
var c = e.charCodeAt(n); | |
c >= 55296 && 56319 >= c && n < e.length - 1 && (c = e.charCodeAt(n + 1), c >= 56320 && 57343 >= c && n++), r++, n++ | |
} | |
} | |
}, s.txt.splitTags = function (e) { | |
for (var t, i, n = e.split("<"), r = [], s = 0; s < n.length; s += 1) | |
if (i = n[s]) { | |
t = i.split(">"); | |
for (var o = 0; o < t.length; o += 1) r.push(t[o]) | |
} else r.push(""); | |
return r | |
}, s.txt.hitHighlight = function (e, t, i) { | |
var n = "em"; | |
if (t = t || [], i = i || {}, 0 === t.length) return e; | |
var r, o, a, c, u, l, d, h = i.tag || n, | |
p = ["<" + h + ">", "</" + h + ">"], | |
f = s.txt.splitTags(e), | |
m = "", | |
g = 0, | |
T = f[0], | |
v = 0, | |
y = 0, | |
D = !1, | |
w = T, | |
_ = []; | |
for (r = 0; r < t.length; r += 1) | |
for (o = 0; o < t[r].length; o += 1) _.push(t[r][o]); | |
for (a = 0; a < _.length; a += 1) { | |
for (c = _[a], u = p[a % 2], l = !1; null != T && c >= v + T.length;) m += w.slice(y), D && c === v + w.length && (m += u, l = !0), f[g + 1] && (m += "<" + f[g + 1] + ">"), v += w.length, y = 0, g += 2, T = f[g], w = T, D = !1; | |
l || null == T ? l || (l = !0, m += u) : (d = c - v, m += w.slice(y, d) + u, y = d, D = a % 2 === 0 ? !0 : !1) | |
} | |
if (null != T) | |
for (y < w.length && (m += w.slice(y)), a = g + 1; a < f.length; a += 1) m += a % 2 === 0 ? f[a] : "<" + f[a] + ">"; | |
return m | |
}; | |
var v = 140, | |
y = [a(65534), a(65279), a(65535), a(8234), a(8235), a(8236), a(8237), a(8238)]; | |
s.txt.getTweetLength = function (e, t) { | |
t || (t = { | |
short_url_length: 22, | |
short_url_length_https: 23 | |
}); | |
var i = s.txt.getUnicodeTextLength(e), | |
n = s.txt.extractUrlsWithIndices(e); | |
s.txt.modifyIndicesFromUTF16ToUnicode(e, n); | |
for (var r = 0; r < n.length; r++) i += n[r].indices[0] - n[r].indices[1], i += n[r].url.toLowerCase().match(s.txt.regexen.urlHasHttps) ? t.short_url_length_https : t.short_url_length; | |
return i | |
}, s.txt.isInvalidTweet = function (e) { | |
if (!e) return "empty"; | |
if (s.txt.getTweetLength(e) > v) return "too_long"; | |
for (var t = 0; t < y.length; t++) | |
if (e.indexOf(y[t]) >= 0) return "invalid_characters"; | |
return !1 | |
}, s.txt.isValidTweetText = function (e) { | |
return !s.txt.isInvalidTweet(e) | |
}, s.txt.isValidUsername = function (e) { | |
if (!e) return !1; | |
var t = s.txt.extractMentions(e); | |
return 1 === t.length && t[0] === e.slice(1) | |
}; | |
var D = e(/^#{validMentionOrList}$/); | |
if (s.txt.isValidList = function (e) { | |
var t = e.match(D); | |
return !(!t || "" != t[1] || !t[4]) | |
}, s.txt.isValidHashtag = function (e) { | |
if (!e) return !1; | |
var t = s.txt.extractHashtags(e); | |
return 1 === t.length && t[0] === e.slice(1) | |
}, s.txt.isValidUrl = function (e, t, i) { | |
if (null == t && (t = !0), null == i && (i = !0), !e) return !1; | |
var n = e.match(s.txt.regexen.validateUrlUnencoded); | |
if (!n || n[0] !== e) return !1; | |
var o = n[1], | |
a = n[2], | |
c = n[3], | |
u = n[4], | |
l = n[5]; | |
return (!i || r(o, s.txt.regexen.validateUrlScheme) && o.match(/^https?$/i)) && r(c, s.txt.regexen.validateUrlPath) && r(u, s.txt.regexen.validateUrlQuery, !0) && r(l, s.txt.regexen.validateUrlFragment, !0) ? t && r(a, s.txt.regexen.validateUrlUnicodeAuthority) || !t && r(a, s.txt.regexen.validateUrlAuthority) : !1 | |
}, "undefined" != typeof module && module.exports && (module.exports = s.txt), "undefined" != typeof window) | |
if (window.twttr) | |
for (var w in s) window.twttr[w] = s[w]; | |
else window.twttr = s | |
}(), | |
function (e, t) { | |
"use strict"; | |
"function" == typeof define && define.amd ? define([], t) : _.extend(e, t()) | |
}(this, function () { | |
var e = 0, | |
t = ["ms", "moz", "webkit", "o"], | |
i = {}; | |
i = { | |
requestAnimationFrame: window.requestAnimationFrame, | |
cancelAnimationFrame: window.cancelAnimationFrame | |
}; | |
for (var n = 0; n < t.length && !i.requestAnimationFrame; n += 1) i.requestAnimationFrame = window[t[n] + "RequestAnimationFrame"], i.cancelAnimationFrame = window[t[n] + "CancelAnimationFrame"] || window[t[n] + "CancelRequestAnimationFrame"]; | |
return i.requestAnimationFrame || (i.requestAnimationFrame = function (t) { | |
var i = (new Date).getTime(), | |
n = Math.max(0, 16 - (i - e)), | |
r = window.setTimeout(function () { | |
t(i + n) | |
}, n); | |
return e = i + n, r | |
}), i.cancelAnimationFrame || (i.cancelAnimationFrame = function (e) { | |
clearTimeout(e) | |
}), i | |
}), TD.components.Base = klass(function () { | |
this.$node = $.createElement("div").addClass("js-component") | |
}).methods({ | |
$find: function () { | |
return this.$node.find.apply(this.$node, arguments) | |
}, | |
publishEvent: function (e, t) { | |
var i = { | |
data: t, | |
target: this | |
}; | |
TD.storage.notification.notify(e, i) | |
}, | |
bubbleEvent: function (e, t) { | |
var i = { | |
data: t, | |
target: this | |
}; | |
this.$node.trigger(e, [i]) | |
}, | |
destroy: function () { | |
this.$node.remove() | |
}, | |
show: function () { | |
this.$node.show() | |
}, | |
hide: function () { | |
this.$node.hide() | |
} | |
}), TD.components.Autocomplete = TD.components.Base.extend(function (e, t) { | |
var i = { | |
limit: 5, | |
dmMode: !1 | |
}; | |
this.options = _.extend(i, t), this.$input = e, this.isCompletionsOpen = !1, this.userIsInteracting = !1, this.dropdownId = _.uniqueId("autocomplete"), this.$node = $.createElement("ul").addClass("lst lst-modal typeahead").insertAfter(this.$input), this.$selectedItem = null, this._registerEvents(), this.usernameRegex = i.dmMode ? this.constructor.dmUsername : this.constructor.username, $(document).on("dataTypeaheadSuggestions", this.updateDropdown.bind(this)) | |
}).mixin(TD.mixins.caretHelper).statics({ | |
username: /^[+\/\.<>()|\\=]?[@ï¼ ]([a-zA-Z0-9_]{1,20})$/, | |
dmUsername: /(.*)/, | |
hashtag: /^[##]([a-zA-Z0-9_]+)/, | |
SELECT: "td-autocomplete-select", | |
_htmlEscapeAndStrongifyMatches: function (e, t) { | |
return TD.util.escape(e.replace(t, "<strong>$1</strong>")).replace(/<(\/?strong)>/g, "<$1>") | |
} | |
}).methods({ | |
_registerEvents: function () { | |
var e = this, | |
t = "keydown"; | |
this.$input.bind(t, _.bind(this.keypress, this)), this.$input.bind("keyup click", _.bind(this.keyup, this)), this.blurHandler = function () { | |
_.delay(function () { | |
e.hide() | |
}, 500) | |
}, this.$input.bind("blur", this.blurHandler), this.$node.delegate("li", "mouseenter", function () { | |
e.$node.find("li.s-selected").removeClass("s-selected"), $(this).addClass("s-selected") | |
}).delegate("li", "click", _.bind(function (t) { | |
e.$selectedItem = $(t.target).closest("li").addClass("s-selected"), e.$selectedItem.siblings(".s-selected").removeClass("s-selected"), this.$input.focus(), this.select() | |
}, this)) | |
}, | |
_unregisterEvents: function () { | |
var e = "keydown"; | |
this.$input.unbind(e), this.$input.unbind("keyup click keydown"), this.$input.unbind("bind", this.blurHandler) | |
}, | |
keyup: function (e) { | |
if (e.keyCode) { | |
e.stopPropagation(); | |
var t = "", | |
i = this.getCurrentText(), | |
n = this.getCaret(), | |
r = !1; | |
if (this.options.dmMode ? t = i : (t = this.getCurrentWord(n), "@" === i.charAt(n) && (t = "")), t.match(this.usernameRegex) ? (t = RegExp.$1, this.autocompleteType = "username", r = !0) : t.match(this.constructor.hashtag) && (t = RegExp.$1, this.autocompleteType = "hashtag", r = !0), t.length && r) switch (e.keyCode) { | |
case TD.constants.keyCodes.escape: | |
this.hide(), e.stopPropagation(); | |
break; | |
case TD.constants.keyCodes.shift: | |
case TD.constants.keyCodes.upArrow: | |
case TD.constants.keyCodes.downArrow: | |
break; | |
default: | |
"hashtag" == this.autocompleteType ? this.lookUpHashtag(t) : this.lookUpUser(t) | |
} else this.hide() | |
} | |
}, | |
keypress: function (e) { | |
var t; | |
switch (e.keyCode) { | |
case TD.constants.keyCodes.tab: | |
case TD.constants.keyCodes.enter: | |
t = this.$selectedItem && this.isCompletionsOpen, !e.shiftKey && t && (this.select(), e.preventDefault(), e.stopPropagation()); | |
break; | |
case TD.constants.keyCodes.escape: | |
this.isCompletionsOpen && (e.preventDefault(), e.stopPropagation()); | |
break; | |
case TD.constants.keyCodes.upArrow: | |
this.isCompletionsOpen && !e.shiftKey && (this.moveSelection("prev"), e.preventDefault(), e.stopPropagation()); | |
break; | |
case TD.constants.keyCodes.downArrow: | |
this.isCompletionsOpen && !e.shiftKey && (this.moveSelection("next"), e.preventDefault(), e.stopPropagation()); | |
break; | |
default: | |
this.$selectedItem = null, this.userIsInteracting = !1 | |
} | |
}, | |
sanitize: function (e) { | |
return e.replace(/ /g, "") | |
}, | |
moveSelection: function (e) { | |
this.userIsInteracting = !0; | |
var t = "next" == e ? "li:first" : "li:last", | |
i = this.$selectedItem || this.$node.find("li.s-selected"); | |
return i.length ? (i = i.removeClass("s-selected"), i = "next" === e ? i.nextAll("li:first") : i.prevAll("li:first"), void(this.$selectedItem = i.length ? i.addClass("s-selected") : this.$node.find(t).addClass("s-selected"))) : void(this.$selectedItem = this.$node.find(t).addClass("s-selected")) | |
}, | |
select: function () { | |
var e, t; | |
this.$selectedItem && ("username" === this.autocompleteType ? (e = this.$selectedItem.find(".js-screenname").text(), this.options.dmMode || (e = "@" + e), t = this.$selectedItem.find("img").attr("src")) : e = this.$selectedItem.find(".js-hashtag").text(), this.set(e, t)) | |
}, | |
set: function (e, t) { | |
var i = this.replaceCurrentWord(e); | |
this.$input.val(i.value), this.setCaretPosition(i.cursor), this.$input.change(), this.$node.trigger(this.constructor.SELECT, [e, t]), this.hide() | |
}, | |
show: function () { | |
this.$node.show(), this.isCompletionsOpen = !0 | |
}, | |
hide: function () { | |
this.$node.hide(), this.isCompletionsOpen = !1, this.userIsInteracting = !1, this.$node.trigger("dataTypeaheadQueryReset") | |
}, | |
lookUpHashtag: function (e) { | |
e = this.sanitize(e); | |
var t = { | |
datasources: ["topics"], | |
query: "#" + e, | |
onlyLocalData: !0, | |
dropdownId: this.dropdownId, | |
type: "compose", | |
limits: { | |
topics: 5 | |
} | |
}; | |
TD.decider.get("autocomplete_remote_sources") && (t.onlyLocalData = !1), this.$node.trigger("uiNeedsTypeaheadSuggestions", t) | |
}, | |
lookUpUser: function (e) { | |
var t = { | |
datasources: ["users"], | |
query: e, | |
onlyLocalData: !0, | |
dropdownId: this.dropdownId, | |
type: "compose", | |
limits: { | |
users: 5 | |
} | |
}; | |
TD.decider.get("autocomplete_remote_sources") && (t.onlyLocalData = !1), this.$node.trigger("uiNeedsTypeaheadSuggestions", t) | |
}, | |
updateDropdown: function (e, t) { | |
if (!this.userIsInteracting && t.dropdownId === this.dropdownId) { | |
var i, n, r = new RegExp("(" + t.query.split("").join("|") + ")", "gi"), | |
s = []; | |
"hashtag" === this.autocompleteType && t.suggestions.topics ? (n = t.suggestions.topics.slice(0, this.options.limit), s = n.map(function (e) { | |
return { | |
value: this.constructor._htmlEscapeAndStrongifyMatches(e.topic, r) | |
} | |
}, this), i = TD.ui.template.render("compose/autocomplete_hashtag", { | |
results: s | |
})) : "username" === this.autocompleteType && t.suggestions.users && (n = t.suggestions.users.slice(0, this.options.limit), s = n.map(function (e) { | |
return { | |
id: e.id, | |
screenName: this.constructor._htmlEscapeAndStrongifyMatches(e.screen_name, r), | |
name: this.constructor._htmlEscapeAndStrongifyMatches(e.name, r), | |
isVerified: e.verified, | |
pic: TD.util.transformTwitterAvatar(e.profile_image_url_https, "mini") | |
} | |
}, this), i = TD.ui.template.render("compose/autocomplete_twitter_user", { | |
results: s | |
})), this.$node.html(i), s.length ? (this.isCompletionsOpen || this.show(), this.moveSelection("next")) : this.isCompletionsOpen && this.hide() | |
} | |
}, | |
destroy: function () { | |
this._unregisterEvents(), this.$node.remove() | |
} | |
}), TD.components.Retweeters = TD.components.Base.extend(function (e) { | |
function t(e) { | |
var t, i = { | |
stats: [] | |
}; | |
if (this.tweetSummary = e, _.isString(e.retweeters_count)) t = e.retweeters_count; | |
else { | |
var s = e.retweeters_count || 0; | |
t = Math.max(s, n.length) + "" | |
} if (this.tweetSummary.retweeters_count = t, "0" !== t && e.retweeters && e.retweeters.length > 0 && i.stats.push({ | |
count: TD.util.prettyNumber(t), | |
label: TD.util.pluralise(TD.i("Retweet"), TD.i("Retweets"), t), | |
type: "retweeters" | |
}), "0" !== e.favoriters_count && e.favoriters && e.favoriters.length > 0 && i.stats.push({ | |
count: TD.util.prettyNumber(e.favoriters_count), | |
label: TD.util.pluralise(TD.i("Favorite"), TD.i("Favorites"), e.favoriters_count), | |
type: "favoriters" | |
}), i.stats.length > 0) { | |
var o = TD.ui.template.render("status/tweet_detail_socialstats", i); | |
r.$node.html(o) | |
} else r.destroy() | |
} | |
if (e instanceof TD.services.TwitterStatus && !(e instanceof TD.services.TwitterDirectMessage)) { | |
this.tweet = e.getMainTweet(); | |
var i = TD.controller.clients.getClient(this.tweet.account.getKey()), | |
n = [], | |
r = this; | |
i.getTweetSummary(this.tweet.id, t.bind(this), function () { | |
r.destroy() | |
}) | |
} | |
}), TD.components.RepliesTo = TD.components.Base.extend(function (e, t, i) { | |
this.chirp = e.getMainTweet(), this.mainTweet = this.chirp.getMainTweet(), this.repliesTo = [], this.mediaPreviewSize = t, this.wantsDragHandle = i, this.refreshPeriod = 60, this._boundHandleConversation = this._handleConversation.bind(this), this.subscriptions = {}, this.subscriptions[this.mainTweet.id] = $.subscribe("/tweets/conversation/" + this.mainTweet.id, this._boundHandleConversation), this.client = TD.controller.clients.getClient(this.chirp.account.getKey()), this.pollTaskId = TD.controller.scheduler.schedulePeriodicTask(this.refreshPeriod, function () { | |
this.client.getConversation(this.mainTweet.id) | |
}.bind(this), !0), this.$node.html(TD.ui.template.render("status/tweet_detail_repliesto")) | |
}).methods({ | |
_handleConversation: function (e) { | |
var t, i, n = {}; | |
this.repliesTo.forEach(function (e) { | |
n[e.id] = !0 | |
}), t = e.descendants.filter(function (e) { | |
return !n[e.id] | |
}), t.sort(TD.util.chirpAscSort), this.repliesTo = this.repliesTo.concat(t), t.forEach(function (e) { | |
this.subscriptions[e.id] || (this.subscriptions[e.id] = $.subscribe("/tweets/conversation/" + e.id, this._boundHandleConversation)) | |
}.bind(this)), i = t.map(function (e) { | |
return e.render({ | |
mediaPreviewSize: this.mediaPreviewSize, | |
isInConvo: !0, | |
withDragHandle: this.wantsDragHandle && !e.user.isProtected | |
}) | |
}.bind(this)).join(""), this.$find(".js-replies-to").append(i) | |
}, | |
findChirp: function (e) { | |
var t = null; | |
return this.chirp.id === e ? t = this.chirp : this.mainTweet.id === e ? t = this.mainTweet : this.repliesTo && (t = _.detect(this.repliesTo, function (t) { | |
return t.id === e | |
})), t | |
}, | |
destroy: function () { | |
for (var e in this.subscriptions) $.unsubscribe(this.subscriptions[e]); | |
TD.controller.scheduler.removePeriodicTask(this.pollTaskId), this.supr() | |
} | |
}), TD.components.InReplyTo = TD.components.Base.extend(function (e, t, i, n) { | |
var r = this; | |
this.chirp = e, this.mainTweet = this.chirp.getMainTweet(), this.$container = t, this.$detailContentContainer = this.$container.find(".js-detail-container"), this.$detailContent = this.$detailContentContainer.find(".js-detail-content"), this.mediaPreviewSize = i, this.wantsDragHandle = n, this.mainTweet.inReplyToID && (this.$node.html(TD.ui.template.render("status/tweet_detail_inreplyto")), this.$repliesContainer = this.$find(".js-replies-before"), this.$repliesText = this.$find(".in-reply-to").hide(), this.replies = null, _.defer(function () { | |
r.bubbleEvent(TD.components.InReplyTo.BEGIN) | |
}), this.subscription = $.subscribe("/tweets/conversation/" + this.mainTweet.id, _.bind(this._handleRelatedResults, this)), this.client = TD.controller.clients.getClient(this.chirp.account.getKey()), this.client.getConversation(this.mainTweet.id)) | |
}).statics({ | |
BEGIN: "td-load-convo", | |
END: "td-load-finish", | |
INREPLYTO_PADDING: 20 | |
}).methods({ | |
_handleRelatedResults: function (e) { | |
this.replies && this.replies.length > 0 || (this.replies = e.ancestors, _.isEmpty(this.replies) ? this._getTweet() : this._showReplies()) | |
}, | |
_getTweet: function () { | |
var e = this; | |
this.client.show(this.mainTweet.inReplyToID, function (t) { | |
e.replies = e.replies || [], e.replies.push(t), e._showReplies() | |
}, function () { | |
e.bubbleEvent(TD.components.InReplyTo.END) | |
}) | |
}, | |
_showReplies: function () { | |
_.defer(_.bind(this._showRepliesInternal, this)) | |
}, | |
_showRepliesInternal: function () { | |
var e, t, i, n, r, s, o; | |
this.bubbleEvent(TD.components.InReplyTo.END), _.isEmpty(this.replies) || (this.replies.sort(TD.util.chirpAscSort), t = this.mainTweet.id, this.replies = _.filter(this.replies, function (e) { | |
return e.id !== t | |
}), i = _.map(this.replies, function (e) { | |
return e.render({ | |
mediaPreviewSize: this.mediaPreviewSize, | |
isInConvo: !0, | |
withDragHandle: !this.isInOwnCustomTimeline && !e.user.isProtected | |
}) | |
}.bind(this)).join(""), n = this.$detailContentContainer.outerHeight(), r = this.$detailContent.outerHeight(), this.$repliesContainer.html(i), e = this.$node.outerHeight(), n > r && this.$detailContent.css("padding-bottom", n - r), this.replies.length <= 1 ? s = 0 : (o = this.$repliesContainer.children().last().outerHeight() + TD.components.InReplyTo.INREPLYTO_PADDING, s = e - o), this.$detailContentContainer.scrollTop(e), this.$detailContentContainer.animate({ | |
scrollTop: s | |
}, { | |
duration: "fast" | |
})) | |
}, | |
findChirp: function (e) { | |
var t = null; | |
return this.chirp.id === e ? t = this.chirp : this.mainTweet.id === e ? t = this.mainTweet : this.replies && (t = _.detect(this.replies, function (t) { | |
return t.id === e | |
})), t | |
}, | |
destroy: function () { | |
this.subscription && $.unsubscribe(this.subscription), this.supr() | |
} | |
}), TD.components.BaseModal = TD.components.Base.extend(function () { | |
this.$node = this._render(), $(document).trigger("uiCloseModal"), this.$title = this.$find(".js-header-title"), this.$closeButton = this.$find(".js-dismiss"), this.$menuContainer = this.$find(".js-mdl-content"), this.$footer = this.$find("footer"); | |
var e = _.bind(this.destroy, this); | |
this.$node.bind(TD.components.BaseModal.CLOSE_EVENT, e), this.$node.on("click", ".js-dismiss", this.destroy.bind(this)), this.boundCloseModal = this._handleCloseModal.bind(this), $(document).on("uiCloseModal", this.boundCloseModal); | |
var t = _.bind(this.handleDragStart, this), | |
i = _.bind(this.getDragDropBoundary, this); | |
this.$node.draggable({ | |
boundary: i, | |
handle: this.$find(".mdl-drag-handle") | |
}), this.$node.on("start.draggable", t), $("div.ovl.scroll-v").on("click", function (t) { | |
this === t.target && e() | |
}), TD.util.isTouchDevice() && window.navigator.standalone && ($("div.ovl.scroll-v").on("touchmove", function (e) { | |
e.preventDefault() | |
}), $("div.ovl.scroll-v").on("touchmove", ".scroll-v", function (e) { | |
e.stopPropagation() | |
})), this.hasFocus = !1, this.focusId = _.uniqueId("focus"), this._boundHandleFocus = this.handleFocus.bind(this), $(document).on("uiFocus", this._boundHandleFocus), $(document).trigger("uiFocusRequest", { | |
id: this.focusId | |
}) | |
}).statics({ | |
CLOSE_EVENT: "td-close" | |
}).methods({ | |
_render: function () { | |
return $(TD.ui.template.render("large_modal")) | |
}, | |
handleFocus: function (e, t) { | |
this.hasFocus = t.id === this.focusId ? !0 : !1 | |
}, | |
getDragDropBoundary: function () { | |
return this.$node.parent() | |
}, | |
handleDragStart: function () { | |
this.$node.css({ | |
position: "absolute", | |
top: this.$node.offset().top, | |
left: this.$node.offset().left | |
}), this.$node.parent("#open-modal").addClass("is-dragging") | |
}, | |
setAndShowContainer: function (e, t) { | |
"boolean" != typeof t && (t = !0), t && e.empty(), e.append(this.$node).show(), this._checkIfTouchModal(e) | |
}, | |
show: function () { | |
this.supr() | |
}, | |
_checkIfTouchModal: function (e) { | |
var t = $("#open-modal"); | |
TD.util.isTouchDevice() && TD.decider.get(TD.decider.TOUCHDECK_MODALS) ? (e.addClass("is-touch-modal"), t.addClass("is-touch-modal")) : (e.removeClass("is-touch-modal"), t.removeClass("is-touch-modal")) | |
}, | |
_handleCloseModal: function () { | |
this.destroy() | |
}, | |
destroy: function () { | |
this.$node.parent("#open-modal").removeClass("is-dragging"), $(document).off("uiFocus", this._boundHandleFocus), $(document).off("uiCloseModal", this.boundCloseModal), $(document).trigger("uiFocusRelease", { | |
id: this.focusId | |
}), this.supr() | |
} | |
}), TD.components.NewFeaturesSplash = TD.components.BaseModal.extend(function () { | |
this.$node.addClass("release-notes-modal"), this.$menuContainer.append(TD.ui.template.render("splash/whats_new")), this.$find(".js-mdl-content").removeClass("horizontal-flow-container"), this.bind(), this.setAndShowContainer($("#splash-modal")), TD.components.NewFeaturesSplash.updateSeenVersion() | |
}).statics({ | |
FOR_VERSION: "3.5", | |
shouldShow: function () { | |
var e = TD.components.NewFeaturesSplash.FOR_VERSION, | |
t = TD.settings.getPreviousSplashVersion(); | |
return "twitter" !== TD.storage.store.getCurrentAuthType() ? !1 : 1 !== TD.util.versionComparator(e, t) ? !1 : -1 === TD.util.versionComparator(TD.version, e) ? !1 : !0 | |
}, | |
updateSeenVersion: function () { | |
TD.settings.setPreviousSplashVersion(TD.version) | |
} | |
}).methods({ | |
destroy: function () { | |
this.supr(), $("#splash-modal").hide() | |
}, | |
bind: function () { | |
var e = this.$find(".js-done"); | |
e.click(this.destroy.bind(this)); | |
this.$find("[data-action]").click(this._handleActionClick.bind(this)) | |
}, | |
_handleActionClick: function (e) { | |
e.preventDefault(); | |
var t = e.target.dataset.action; | |
switch (t) { | |
case "signOut": | |
TD.storage.store.setCurrentAuthType("tweetdeck"), TD.controller.init.signOut(); | |
break; | |
case "openSettings": | |
$(document).trigger("uiShowAccountSettings") | |
} | |
} | |
}), TD.components.OpenColumn = TD.components.BaseModal.extend(function () { | |
var e = this; | |
this.$footer.append($(TD.ui.template.render("open_column_footer"))), this.$backButton = this.$find(".js-back"), this.$addButton = this.$find(".js-add-column"), this.history = [], this.menu = null, this.$backButton.bind("click", function (t) { | |
t.stopPropagation(), e._previous() | |
}), this.$node.on(TD.components.TemporaryColumn.DELETED_EVENT, this._reload.bind(this)) | |
}).statics({ | |
GO_URL_REGEX: /^(add|profile)$/, | |
GO_EVENT: "/go", | |
instance: null | |
}).methods({ | |
canGo: function (e) { | |
return TD.components.OpenColumn.GO_URL_REGEX.test(e) | |
}, | |
go: function (e, t, i, n) { | |
TD.components.OpenColumn.instance = this, n && (this.history = [n]), this.history.push([e, _.clone(t), i]); | |
var r = t.shift(); | |
if (this.menu && this.menu.canGo && this.menu.canGo(e, t)) return this.history.pop(), this.history[this.history.length - 1] = fullUrl, void this.menu.go(r, t, i); | |
var s, o = !1, | |
a = !1, | |
c = !1; | |
if ("add" === e) switch (r) { | |
case "home": | |
s = new TD.components.OpenColumnHome, o = !0; | |
break; | |
case "lists": | |
case "customtimelines": | |
s = new TD.components.OpenCustomTimelines(r); | |
break; | |
case "sharedcolumn": | |
s = new TD.components.OpenSharedColumn(i.state); | |
break; | |
case "trends": | |
s = new TD.components.OpenTrends; | |
break; | |
default: | |
TD.controller.columnManager.TWITTER_GENERIC[r] && (s = new TD.components.OpenTwitterGeneric(r)) | |
} | |
this._show(r, s, o, a, c), s.go && s.go(r, t, i) | |
}, | |
_show: function (e, t, i, n) { | |
this.menu && this.menu.destroy(), this.menu = t, this.$menuContainer.append(t.$node), i || this.menu.setup(this.$addButton), this.$node.toggleClass("s-nonav", i), this.$node.toggleClass("s-narrow", n), this.$backButton.toggle(this.history.length > 1).toggleClass("hide", 0 === this.history.length), this.$title.text("home" === e ? TD.i("Choose column type") : "profile" === e ? TD.i("Account profile") : "sharedcolumn" === e ? TD.i("Shared column") : TD.controller.columnManager.MENU_TITLE[e] || "") | |
}, | |
_previous: function () { | |
this.history.pop(); | |
var e = this.history.pop(); | |
e instanceof Array ? this.go.apply(this, e) : (this.destroy(), $(e.target).trigger(e.type, [e.data])) | |
}, | |
_reload: function () { | |
var e = this.history.pop(); | |
e instanceof Array && this.go.apply(this, e) | |
}, | |
destroy: function () { | |
this.menu && this.menu.destroy(), _.each(this.eventSubscriptions, function (e) { | |
$.unsubscribe(e) | |
}), this.$backButton.unbind(), $("#open-modal").hide(), TD.components.OpenColumn.instance = null, this.supr() | |
} | |
}), TD.components.OpenColumnHome = TD.components.Base.extend(function () { | |
var e = this; | |
this.singletonTypes = {}; | |
var t = {}; | |
TD.controller.columnManager.DISPLAY_ORDER_SINGLETONS.forEach(function (i) { | |
e.singletonTypes[i.type] = !0, t[i.type] = !_.isEmpty(TD.storage.columnController.getColumnsByType(i.type)) | |
}); | |
var i = TD.controller.columnManager.DISPLAY_ORDER; | |
this.$node = $(TD.ui.template.render("open_column_home", { | |
options: i, | |
isDisabled: function () { | |
return t[this.type] | |
} | |
})), this.$launchers = this.$find(".js-item-launch"), this.$launchers.bind("click", function (t) { | |
var i, n = $(t.currentTarget), | |
r = (n.data("action"), n.data("type")), | |
s = e.singletonTypes[r]; | |
n.hasClass("is-disabled") || (s ? (i = TD.controller.columnManager.makeColumnFor(r, "tweetdeck"), TD.controller.columnManager.addColumnToUI(i), e.bubbleEvent(TD.components.BaseModal.CLOSE_EVENT)) : e.publishEvent(TD.components.OpenColumn.GO_EVENT, TD.components.OpenColumnHome.URL_BASE + "/" + r)) | |
}) | |
}).statics({ | |
URL_BASE: "/add" | |
}), TD.components.SplitMenu = TD.components.Base.extend(function () { | |
this.$node = $(TD.ui.template.render("open_split_menu")), this.menuItems = [], this.rightPillarComponent = null, this.$leftPinnedContainer = this.$find(".js-left-pinned"), this.$leftPillarContainer = this.$find(".js-left-column"), this.$rightPillarContainer = this.$find(".js-right-column") | |
}).methods({ | |
appendMenuItem: function (e) { | |
this.menuItems.push(e), this.$leftPillarContainer.append(e.$node) | |
}, | |
removeMenuItem: function (e) { | |
e.destroy(), this.menuItems = _.without(this.menuItems, e) | |
}, | |
appendPinnedMenuItem: function (e) { | |
this.menuItems.push(e), this.$leftPillarContainer.addClass("s-with-pinned"), this.$leftPinnedContainer.html(e.$node) | |
}, | |
appendMenuItemElement: function (e) { | |
this.$leftPillarContainer.append(e) | |
}, | |
setRightPillar: function (e) { | |
this.rightPillarComponent && this.rightPillarComponent.destroy(), this.rightPillarComponent = e, this.$rightPillarContainer.html(e.$node) | |
}, | |
destroy: function () { | |
_.each(this.menuItems, function (e) { | |
e.destroy() | |
}), this.rightPillarComponent && this.rightPillarComponent.destroy(), this.supr() | |
} | |
}), TD.components.OpenSplitMenu = TD.components.SplitMenu.extend(function () { | |
this.$addButton = null | |
}).methods({ | |
setup: function (e) { | |
this.$addButton = e, this.$addButton.hide(), this.$addButton.click(_.bind(this._handleAddClick, this)) | |
}, | |
setChirpPillar: function (e) { | |
this.setRightPillar(e); | |
var t = this; | |
e instanceof TD.components.TemporaryColumn && _.defer(function () { | |
e.populate(), t.$addButton.show(), t.$addButton.prop("disabled", !1) | |
}) | |
}, | |
_handleAddClick: function () { | |
this.$addButton.prop("disabled") || this.makeChirpColumnPermanent() | |
}, | |
makeChirpColumnPermanent: function () { | |
this.rightPillarComponent && (this.rightPillarComponent.makePermanent(), this.$addButton.prop("disabled", !0)) | |
}, | |
destroy: function () { | |
this.$addButton.unbind("click"), this.$addButton.hide(), this.supr() | |
} | |
}), TD.components.OpenTwitterGeneric = TD.components.OpenSplitMenu.extend(function (e) { | |
if (this.type = e, this.showUserSearch = !TD.controller.columnManager.SELF_ACCOUNTS_ONLY[e], this.userSearch = null, this.helpText = TD.controller.columnManager.HELP_TEXT[e], this.placeHolder = new TD.components.OpenColumnPlaceholder(this.helpText), this.setChirpPillar(this.placeHolder), this.showUserSearch) { | |
this.userSearch = new TD.components.TwitterUserSearch, this.appendPinnedMenuItem(this.userSearch); | |
var t = this.userSearch.detachResultsContainer(); | |
this.appendMenuItemElement(t) | |
} | |
this.profileAccount = new TD.components.ProfileAccount, this.profileAccount.$node.hide(), this.appendMenuItem(this.profileAccount), this.selfAccounts = new TD.components.SelfAccounts("twitter"), this.appendMenuItem(this.selfAccounts), this.$node.bind(TD.components.MenuItemBase.BUBBLE_SELECT_EVENT, _.bind(this._handleSelect, this)) | |
}).methods({ | |
go: function (e, t, i) { | |
i.screenName ? (this.profileAccount.setUser(i.screenName), this.profileAccount.$node.show(), this.profileAccount.select()) : this.selfAccounts.selectDefault() | |
}, | |
_handleSelect: function (e, t) { | |
var i; | |
if (t.target.account) i = new TD.components.TemporaryColumn, i.genericTwitter(this.type, t.target.account, void 0); | |
else if (t.target.twitterUser) { | |
i = new TD.components.TemporaryColumn; | |
var n = this.userSearch.client.oauth.account; | |
i.genericTwitter(this.type, n, t.target.twitterUser) | |
} | |
i && (this.setChirpPillar(i), e.stopPropagation()) | |
} | |
}), TD.components.OpenCustomTimelines = TD.components.OpenSplitMenu.extend(function (e) { | |
switch (this.mode = e, this.screenName = null, this.listsComponent = null, this.newCustomTimelineButton = null, this.mode) { | |
case "lists": | |
this.helpText = TD.controller.columnManager.HELP_TEXT[TD.controller.columnManager.LISTS]; | |
break; | |
case "customtimelines": | |
this.helpText = TD.controller.columnManager.HELP_TEXT[TD.controller.columnManager.CUSTOMTIMELINES] | |
} | |
this.placeHolder = new TD.components.OpenColumnPlaceholder(this.helpText), this.removePlaceholder = new TD.components.OpenColumnPlaceholder(""), this.setChirpPillar(this.placeHolder), this.$node.bind(TD.components.MenuItemBase.BUBBLE_SELECT_EVENT, _.bind(this._handleListSelect, this)), this.$node.bind(TD.components.CustomTimelines.LOADED, _.bind(this._handleListsLoaded, this)) | |
}).methods({ | |
go: function (e, t, i) { | |
i.screenName ? (this.screenName = i.screenName, this.listsComponent = new TD.components.CustomTimelines(this.screenName, i.slug, this.mode), this.appendMenuItem(this.listsComponent)) : (this.newCustomTimelineButton = new TD.components.NewCustomTimelineButton(this.mode), this.appendPinnedMenuItem(this.newCustomTimelineButton), this.listsComponent = new TD.components.CustomTimelines(null, null, this.mode), this.appendMenuItem(this.listsComponent)) | |
}, | |
_handleListsLoaded: function (e, t) { | |
if (t.target === this.listsComponent && 0 === t.data) { | |
this.removeMenuItem(this.listsComponent); | |
var i; | |
switch (this.mode) { | |
case "lists": | |
i = TD.i(this.screenName ? "This user has no public lists" : "You are not subscribed to any lists"); | |
break; | |
case "customtimelines": | |
i = TD.i(this.screenName ? "This user has no collections" : "You do not have any collections") | |
} | |
this.listsComponent = new TD.components.OpenColumnPlaceholder(i), this.setChirpPillar(this.removePlaceholder), this.appendMenuItem(this.listsComponent) | |
} | |
}, | |
_handleListSelect: function (e, t) { | |
var i = t.target.list, | |
n = new TD.components.TemporaryColumn; | |
switch (this.mode) { | |
case "lists": | |
n.list(i); | |
break; | |
case "customtimelines": | |
n.customTimeline(i) | |
} | |
this.setChirpPillar(n), e.stopPropagation() | |
} | |
}), TD.components.OpenSharedColumn = TD.components.OpenSplitMenu.extend(function (e) { | |
this.aColumnDeferred = this._deserializeColumn(e) | |
}).methods({ | |
go: function () { | |
var e = new TD.components.TemporaryColumn; | |
this.aColumnDeferred.addCallback(function (t) { | |
e.renderColumn(t), this.setChirpPillar(e) | |
}.bind(this)), this.aColumnDeferred.addErrback(function () { | |
this.destroy(), setTimeout(function () { | |
$(document).trigger("uiCloseModal"), TD.controller.progressIndicator.addMessage(TD.i("Shared column could not be loaded")) | |
}, 0) | |
}.bind(this)), this.$leftPillarContainer.html(TD.ui.template.render("open_column_shared_help")) | |
}, | |
_selectAccountKey: function (e) { | |
var t = new TD.core.defer.Deferred, | |
i = e.accountkey, | |
n = $(document); | |
return n.one("dataAccount", function (e, i) { | |
t.callback(i.account && i.account.accountKey) | |
}), n.trigger("uiNeedsAccount", { | |
accountKey: i | |
}), t.addCallback(function (e) { | |
var t = new TD.core.defer.Deferred; | |
return e ? e : (n.one("dataDefaultAccount", function (e, i) { | |
t.callback(i.accountKey) | |
}), n.trigger("uiNeedsDefaultAccount"), t) | |
}), t | |
}, | |
_parseColumn: function (e) { | |
var t = e.feeds, | |
i = t[0], | |
n = i.type, | |
r = i.service, | |
s = i.metadata, | |
o = new TD.vo.SearchFilter(e.filters), | |
a = this._selectAccountKey(i); | |
return a.addCallback(function (e) { | |
return TD.controller.columnManager.makeOtherColumnAndFeeds(n, r, e, s, o) | |
}), a | |
}, | |
_deserializeColumn: function (e) { | |
function t(e, r) { | |
r.data === i && (n.off("dataSchemaValidation", t), r.isValid ? s.callback(r.data) : s.errback(r.validationError)) | |
} | |
var i, n = $(document); | |
try { | |
i = JSON.parse(e) | |
} catch (r) { | |
return console.warn("Invalid column data supplied: ", r), TD.core.defer.fail(r) | |
} | |
var s = new TD.core.defer.Deferred; | |
return s.addCallback(this._parseColumn.bind(this)), n.on("dataSchemaValidation", t), n.trigger("uiNeedsSchemaValidation", { | |
data: i, | |
schemaName: "sharedColumn" | |
}), s | |
} | |
}), TD.components.OpenTrends = TD.components.OpenSplitMenu.extend(function () { | |
this.trends = new TD.components.Trends, this.appendMenuItem(this.trends), this.helpText = TD.controller.columnManager.HELP_TEXT[TD.controller.columnManager.TRENDS], this.placeHolder = new TD.components.OpenColumnPlaceholder(this.helpText), this.setChirpPillar(this.placeHolder), this.$node.bind(TD.components.MenuItemBase.BUBBLE_SELECT_EVENT, _.bind(this._handleTrendSelect, this)) | |
}).methods({ | |
_handleTrendSelect: function (e, t) { | |
var i = t.target.title, | |
n = new TD.components.TemporaryColumn; | |
n.search(i), this.setChirpPillar(n), e.stopPropagation() | |
} | |
}), TD.components.OpenColumnPlaceholder = TD.components.Base.extend(function (e) { | |
this.helperText = e, this.$node = $(TD.ui.template.render("open_column_temp_help", { | |
helpText: e | |
})) | |
}), TD.components.NewCustomTimelineButton = TD.components.Base.extend(function (e) { | |
var t = this; | |
this.mode = e; | |
var i = '<button class="btn btn-positive"><i class="icon icon-plus icon-small-valigned"></i><span class="label padding-ls">{{{button_txt}}}</span></button>'; | |
switch (this.mode) { | |
case "lists": | |
this.$button = $(TD.ui.template.toHtml(i, { | |
button_txt: TD.i("Create list") | |
})); | |
break; | |
case "customtimelines": | |
this.$button = $(TD.ui.template.toHtml(i, { | |
button_txt: TD.i("Create collection") | |
})) | |
} | |
this.$button.click(function () { | |
switch (t.bubbleEvent(TD.components.BaseModal.CLOSE_EVENT), t.mode) { | |
case "lists": | |
{ | |
new TD.components.ListDetails | |
} | |
break; | |
case "customtimelines": | |
var e = TD.controller.clients.getPreferredClient(); | |
e.createCustomTimeline({}, function (e) { | |
var t = new TD.components.TemporaryColumn; | |
t.customTimeline(e), t.populate(), t.makePermanent(), setTimeout(function () { | |
t.destroy() | |
}, 0) | |
}, function (e) { | |
TD.controller.progressIndicator.addMessage(TD.i("Error creating customTimeline: {{status}}", { | |
status: e.status | |
})) | |
}) | |
} | |
}), this.$node.append(this.$button), this.$node.addClass("sch-list padding-al") | |
}), TD.components.ListDetails = TD.components.BaseModal.extend(function (e) { | |
this.theList = e, this.toAutoAdd = []; | |
var t = TD.storage.accountController.getAccountsForService("twitter"); | |
this.$editForm = $(TD.ui.template.render("lists/edit_form", { | |
accounts: t | |
})), this.$menuContainer.append(this.$editForm), this.$footer.append($(TD.ui.template.render("lists/edit_footer"))), this.setAndShowContainer($("#lists-modal")), this.$account = $("#list-account"), this.$name = $("#list-name"), this.$description = $("#list-description"), this.$modePublic = this.$find('input:radio[value="public"]'), this.$modePrivate = this.$find('input:radio[value="private"]'), this.$saveButton = this.$find(".js-save"), this.$name.focus(), this.$saveButton.click(_.bind(this._handleSaveClick, this)), e ? (this.$title.text(TD.i("Edit list")), this.$account.val(TD.storage.Account.generateKeyFor("twitter", e.user.id)), this.$account.prop("disabled", !0), this.$name.val(e.name), this.$description.val(e.description), e.isPrivate ? this.$modePrivate.prop("checked", !0) : this.$modePublic.prop("checked", !0)) : this.$title.text(TD.i("Create list")) | |
}).methods({ | |
autoAddMember: function (e) { | |
this.toAutoAdd.push(e) | |
}, | |
_handleSaveClick: function () { | |
var e = this.$account.val(), | |
t = TD.controller.clients.getClient(e), | |
i = this.$name.val(), | |
n = this.$description.val(), | |
r = this.$modePrivate.prop("checked"), | |
s = _.bind(this._handleSaveSuccess, this), | |
o = _.bind(this._handleSaveFailure, this); | |
this.$saveButton.prop("disabled", !0), this.theList ? t.updateList(this.theList.id, i, n, r, s, o) : t.createList(i, n, r, s, o) | |
}, | |
_handleSaveSuccess: function (e) { | |
this.destroy(); | |
new TD.components.ListMembers(e, this.toAutoAdd) | |
}, | |
_handleSaveFailure: function () { | |
this.$saveButton.prop("disabled", !1); | |
var e = TD.i("Problem saving list. Please check the details and try again"); | |
TD.controller.progressIndicator.addMessage(e) | |
}, | |
destroy: function () { | |
this.supr(), $("#lists-modal").hide() | |
} | |
}), TD.components.ListMembers = TD.components.BaseModal.extend(function (e, t) { | |
var i = this; | |
this.theList = e, this.membersIndex = {}, this.changed = !1, this.client = TD.controller.clients.getClient(e.account.getKey()), this.feedKey = TD.storage.Feed.generateKeyFor(this.theList.account.getKey(), "list", { | |
listId: this.theList.id, | |
ownerId: this.theList.user.id, | |
slug: this.theList.id, | |
screenName: this.theList.user.id | |
}), this.splitMenu = new TD.components.SplitMenu, this.userSearch = new TD.components.TwitterUserSearch(e.user.account, 10, TD.components.ListMember), this.suggestedUsers = new TD.components.SuggestedUsers(e.user.account, 10, TD.components.ListMember, e.name), this.loadingPane = new TD.components.OpenColumnPlaceholder(TD.i("Loading list members…")), this.memberList = new TD.components.ListMemberList, this.$title.text(TD.i("{{{1}}} by {{2}}", { | |
1: e.name, | |
2: e.user.screenName | |
})), this.$menuContainer.append(this.splitMenu.$node), this.$footer.append($(TD.ui.template.render("lists/edit_members_footer"))), this.splitMenu.appendPinnedMenuItem(this.userSearch), this.splitMenu.appendMenuItemElement(this.userSearch.detachResultsContainer()), this.splitMenu.appendMenuItem(this.suggestedUsers), this.splitMenu.setRightPillar(this.loadingPane), this.setAndShowContainer($("#lists-modal")), this.userSearch.searchInput.$inputBox.focus(), this.$memberCount = this.memberList.$find(".js-member-count"), this.$editButton = this.$find(".js-edit"), this.$deleteButton = this.$find(".js-delete"), this.$doneButton = this.$find(".js-done"), this.$addColumnOption = this.$find(".js-add-column-option"), this.$addColumnCheckbox = this.$addColumnOption.find(".js-add-column-checkbox"), 0 === TD.storage.columnController.getColumnsContainingFeed(this.feedKey).length && (this.$addColumnCheckbox.prop("checked", !0), this.$addColumnOption.removeClass("is-hidden")), this.$editButton.click(_.bind(this._editDetails, this)), this.$deleteButton.click(_.bind(this._deleteList, this)), this.$doneButton.click(_.bind(this._handleDone, this)), this.$node.bind(TD.components.ListMember.ADD_REMOVE_EVENT, _.bind(this._addRemoveMember, this)), this.$node.bind(TD.components.TwitterUserSearch.SEARCH_COMPLETE, function (e, t) { | |
var n = t.target; | |
i._checkResultsState(n), i.splitMenu.$leftPillarContainer.scrollTop(0) | |
}), this._updateMemberCount(); | |
var n = this._addMembers(t); | |
n.addBothWith(this, this._loadAllMembers), n.addCallback(function () { | |
i.suggestedUsers.render(), i._checkResultsState(i.userSearch), i._checkResultsState(i.suggestedUsers) | |
}) | |
}).methods({ | |
_addMembers: function (e) { | |
var t; | |
if (_.isEmpty(e)) t = TD.core.defer.succeed(); | |
else { | |
t = new TD.core.defer.Deferred; | |
var i = _.pluck(e, "screenName"); | |
this.client.addUsersToList(this.theList.id, i, _.bind(t.callback, t), _.bind(t.errback, t)) | |
} | |
return t | |
}, | |
_loadAllMembers: function () { | |
var e, t = this, | |
i = function (e) { | |
if (t._displayMembers(e.users, !1), e.next_cursor) { | |
var n = t._fetchMemberPage(e.next_cursor_str); | |
return n.addCallback(i), n | |
} | |
}; | |
return e = this._fetchMemberPage(-1), e.addCallback(i), e | |
}, | |
_fetchMemberPage: function (e) { | |
var t = new TD.core.defer.Deferred; | |
return this.client.getListMembers(this.theList.id, e, _.bind(t.callback, t), _.bind(t.errback, t)), t | |
}, | |
_displayMembers: function (e, t) { | |
var i = this; | |
t && e.reverse(), _.each(e, function (e) { | |
if (!i.membersIndex[e.id]) { | |
var n = new TD.components.ListMember(e); | |
i.membersIndex[n.user.id] = n, t ? i.memberList.prepend(n) : i.memberList.append(n) | |
} | |
}), this.loadingPane && (this.loadingPane.destroy(), this.loadingPane = null, this.splitMenu.setRightPillar(this.memberList)) | |
}, | |
_updateMemberCount: function () { | |
this.$memberCount.text(this.theList.memberCount) | |
}, | |
_editDetails: function () { | |
this.destroy(); | |
new TD.components.ListDetails(this.theList) | |
}, | |
_deleteList: function () { | |
var e = this, | |
t = _.uniqueId(), | |
i = { | |
id: t, | |
title: TD.i("Deleting list!"), | |
message: TD.i("Are you sure you want to delete this list?"), | |
okLabel: TD.i("Delete"), | |
cancelLabel: TD.i("Cancel") | |
}, | |
n = function (i, r) { | |
r.id === t && ($(document).off("uiConfirmationAction", n), r.result && e.client.destroyList(e.theList.id, function () { | |
e.theList = null, e.destroy() | |
})) | |
}; | |
$(document).on("uiConfirmationAction", n).trigger("uiShowConfirmationDialog", i) | |
}, | |
_addRemoveMember: function (e, t) { | |
e.stopPropagation(); | |
var i = t.target; | |
this.membersIndex[i.user.id] ? this.removeMember(i.user) : this.addMember(i.user) | |
}, | |
addMember: function (e) { | |
var t = this; | |
this._changeUserState(e.id, TD.components.ListMember.STATE_WORKING), this.client.addUserToList(this.theList.id, e.screenName, function () { | |
t._displayMembers([e], !0), t.theList.memberCount++, t._updateMemberCount(), t._changeUserState(e.id, TD.components.ListMember.STATE_MEMBER), t.changed = !0 | |
}, function () { | |
t._changeUserState(e.id, TD.components.ListMember.STATE_NON_MEMBER); | |
var i = TD.i("Problem adding {{userName}} to the list {{listName}}. Please try again", { | |
userName: e.name, | |
listName: t.theList.name | |
}); | |
TD.controller.progressIndicator.addMessage(i) | |
}) | |
}, | |
removeMember: function (e) { | |
var t = this; | |
this._changeUserState(e.id, TD.components.ListMember.STATE_WORKING), this.client.removeUserFromList(this.theList.id, e.screenName, function () { | |
var i = t.membersIndex[e.id]; | |
i.destroy(), delete t.membersIndex[e.id], t.theList.memberCount--, t._updateMemberCount(), t._changeUserState(e.id, TD.components.ListMember.STATE_NON_MEMBER), t.changed = !0 | |
}, function () { | |
t._changeUserState(e.id, TD.components.ListMember.STATE_MEMBER); | |
var i = TD.i("Problem removing {{userName}} from the list {{listName}}. Please try again", { | |
userName: e.name, | |
listName: t.theList.name | |
}); | |
TD.controller.progressIndicator.addMessage(i) | |
}) | |
}, | |
_changeUserState: function (e, t) { | |
this.membersIndex[e] && this.membersIndex[e].setState(t), t === TD.components.ListMember.STATE_MEMBER && (t = TD.components.ListMember.STATE_MEMBER_CHECKED); | |
var i = this.userSearch.items.concat(this.suggestedUsers.items); | |
_.each(i, function (i) { | |
i.user.id == e && i.setState(t) | |
}) | |
}, | |
_checkResultsState: function (e) { | |
var t = this, | |
i = e === this.suggestedUsers; | |
_.each(e.items, function (e) { | |
t.membersIndex[e.user.id] ? (e.setState(TD.components.ListMember.STATE_MEMBER_CHECKED), i && e.hide()) : (e.setState(TD.components.ListMember.STATE_NON_MEMBER), i && e.show()) | |
}) | |
}, | |
_handleDone: function () { | |
if (this.$addColumnCheckbox.prop("checked")) { | |
var e = new TD.components.TemporaryColumn; | |
e.list(this.theList), e.makePermanent() | |
} | |
this.destroy() | |
}, | |
destroy: function () { | |
if (this.changed && this.theList) { | |
TD.cache.lists.add(this.theList); | |
var e = TD.controller.feedManager.getPoller(this.feedKey); | |
e && (e.removeAll(), e.refresh()) | |
} | |
$("#lists-modal").hide(), this.splitMenu.destroy(), this.userSearch.destroy(), this.suggestedUsers.destroy(), this.memberList.destroy(), this.loadingPane && this.loadingPane.destroy(), _.each(this.membersIndex, function (e) { | |
e.destroy() | |
}), this.supr() | |
} | |
}), TD.components.ListMember = TD.components.Base.extend(function (e) { | |
this.user = e, this.state = null; | |
var t = { | |
fullname: e.name || e.screenName, | |
username: e.screenName, | |
profileImageURL: e.profileImageURL, | |
description: e.description, | |
isProtected: e.isProtected, | |
isVerified: e.isVerified | |
}; | |
this.$node = $(TD.ui.template.render("lists/member", t)), this.$addRemoveButton = this.$find(".js-add-remove"), this.$addRemoveButton.click(_.bind(this._handleAddRemoveClick, this)), this.setMember() | |
}).statics({ | |
ADD_REMOVE_EVENT: "td-add-remove", | |
STATE_MEMBER: "member", | |
STATE_MEMBER_CHECKED: "member-checked", | |
STATE_NON_MEMBER: "non-member", | |
STATE_WORKING: "working" | |
}).methods({ | |
_handleAddRemoveClick: function () { | |
this.bubbleEvent(TD.components.ListMember.ADD_REMOVE_EVENT) | |
}, | |
setState: function (e) { | |
switch (e) { | |
case TD.components.ListMember.STATE_MEMBER: | |
this.setMember(); | |
break; | |
case TD.components.ListMember.STATE_MEMBER_CHECKED: | |
this.setMemberChecked(); | |
break; | |
case TD.components.ListMember.STATE_NON_MEMBER: | |
this.setNonMember(); | |
break; | |
case TD.components.ListMember.STATE_WORKING: | |
this.setWorking() | |
} | |
}, | |
setMember: function () { | |
this.state = TD.components.ListMember.STATE_MEMBER, this.$addRemoveButton.removeClass("s-nonmember s-working s-checked").addClass("s-member"), this.$addRemoveButton.prop("disabled", !1) | |
}, | |
setMemberChecked: function () { | |
this.state = TD.components.ListMember.STATE_MEMBER_CHECKED, this.$addRemoveButton.removeClass("s-nonmember s-member s-working").addClass("s-checked"), this.$addRemoveButton.prop("disabled", !1) | |
}, | |
setNonMember: function () { | |
this.state = TD.components.ListMember.STATE_NON_MEMBER, this.$addRemoveButton.removeClass("s-member s-checked s-working").addClass("s-nonmember"), this.$addRemoveButton.prop("disabled", !1) | |
}, | |
setWorking: function () { | |
this.state = TD.components.ListMember.STATE_WORKING, this.$addRemoveButton.removeClass("s-member s-nonmember s-checked").addClass("s-working"), this.$addRemoveButton.prop("disabled", !0) | |
} | |
}), TD.components.ListMemberList = TD.components.Base.extend(function () { | |
this.$node = $(TD.ui.template.render("lists/member_list")), this.$list = this.$find(".js-member-list") | |
}).methods({ | |
append: function (e) { | |
this.$list.append(e.$node) | |
}, | |
prepend: function (e) { | |
this.$list.prepend(e.$node) | |
} | |
}), TD.components.CustomTimelines = TD.components.Base.extend(function (e, t, i) { | |
this.mode = i; | |
var n, r, s = this, | |
o = {}, | |
a = TD.storage.clientController.client.getDefaultAccount(); | |
switch (this.owners = o, this.screenName = e, e ? n = "lists" === this.mode ? TD.i("@{{screenName}}'s lists", this) : TD.i("@{{screenName}}'s collections", this) : "lists" === this.mode ? n = TD.i("Your lists") : "customtimelines" === this.mode && (n = TD.i("Your collections")), this.mode) { | |
case "lists": | |
r = [{ | |
title: n, | |
className: "js-my-custom-timelines" | |
}, { | |
title: TD.i("Subscribed to"), | |
className: "js-others-custom-timelines" | |
}]; | |
break; | |
case "customtimelines": | |
r = [{ | |
title: n, | |
className: "js-my-custom-timelines" | |
}] | |
} | |
if (this.$node = $(TD.ui.template.render("open_column_list_multi_group", { | |
groups: r | |
})), this.$myTimelines = this.$find("ul.js-my-custom-timelines"), this.$otherTimelines = this.$find("ul.js-others-custom-timelines"), this.items = [], this.menuComponents = [], this.slug = t, this.listComparator = function (e, t) { | |
var i, n, r = TD.components.CustomTimelines; | |
return o[e.user.id] && !o[t.user.id] ? -1 : !o[e.user.id] && o[t.user.id] ? 1 : o[e.user.id] && o[t.user.id] ? (i = e.account.getKey() === a, n = t.account.getKey() === a, i === n ? r.ownerNameComparator(e, t) || r.nameComparator(e, t) : i ? -1 : 1) : r.nameComparator(e, t) || r.ownerNameComparator(e, t) | |
}, e) { | |
var c = TD.cache.twitterUsers.getByScreenName(e); | |
c.addCallback(function (t) { | |
o[t.id] = !0; | |
var i = TD.controller.clients.getClientsByService("twitter"), | |
n = _.find(i, function (t) { | |
return t.oauth.account.getUsername().toLowerCase() === e.toLowerCase() ? t : void 0 | |
}); | |
switch (s.mode) { | |
case "lists": | |
n ? (s._handleLists(TD.cache.lists.getListsFor(n.oauth.account.getKey())), s.bubbleEvent(TD.components.CustomTimelines.LOADED, s.items.length)) : (n = TD.controller.clients.getPreferredClient("twitter"), n.getLists(e, function (e) { | |
s._handleLists(e), s.bubbleEvent(TD.components.CustomTimelines.LOADED, s.items.length) | |
})); | |
break; | |
case "customtimelines": | |
n = n || TD.controller.clients.getPreferredClient("twitter"), n.getCustomTimelines(t.id, null, function (e) { | |
s._handleLists(e), s.bubbleEvent(TD.components.CustomTimelines.LOADED, s.items.length) | |
}) | |
} | |
}) | |
} else { | |
var u = TD.controller.clients.getClientsByService("twitter"); | |
_.each(u, function (e) { | |
o[e.oauth.account.getUserID()] = !0 | |
}), _.each(u, function (e) { | |
"lists" === s.mode ? s._handleLists(TD.cache.lists.getListsFor(e.oauth.account.getKey())) : "customtimelines" === s.mode && s._handleLists(e.customTimelines) | |
}), this.bubbleEvent(TD.components.CustomTimelines.LOADED, s.items.length) | |
} | |
}).statics({ | |
LOADED: "td-custom-timelines-loaded", | |
nameComparator: function (e, t) { | |
var i = e.name.toLowerCase(), | |
n = t.name.toLowerCase(); | |
return (i > n) - (n > i) | |
}, | |
ownerNameComparator: function (e, t) { | |
var i = e.user.name.toLowerCase(), | |
n = t.user.name.toLowerCase(); | |
return (i > n) - (n > i) | |
} | |
}).methods({ | |
_handleLists: function (e) { | |
var t = this; | |
if (_.isArray(e) && 0 !== e.length) { | |
this.items = this.items.concat(e), "lists" == this.mode && this.items.sort(this.listComparator); | |
var i = {}; | |
this.items = _.select(this.items, function (e) { | |
var t = !i[e.id]; | |
return i[e.id] = !0, t | |
}), _.each(this.menuComponents, function (e) { | |
e.destroy() | |
}); | |
var n; | |
this.menuComponents = _.map(this.items, function (e) { | |
var i = new TD.components.MenuItem; | |
switch (this.mode) { | |
case "lists": | |
i.list(e), t.owners[e.user.id] ? (t.$myTimelines.append(i.$node), t.slug && e.slug.toLowerCase() === t.slug.toLowerCase() && e.user.screenName.toLowerCase() === t.screenName.toLowerCase() && (n = i)) : t.$otherTimelines.append(i.$node); | |
break; | |
case "customtimelines": | |
i.customTimeline(e), t.$myTimelines.append(i.$node); | |
var r = e.id.replace("custom-", ""); | |
t.slug && r.toLowerCase() === t.slug.toLowerCase() && (n = i) | |
} | |
return i | |
}.bind(this)), !n && this.screenName && this.menuComponents.length > 0 && (n = this.menuComponents[0]), n && _.defer(function () { | |
n.select() | |
}) | |
} | |
} | |
}), TD.components.SearchInput = TD.components.Base.extend(function (e) { | |
var t = this; | |
this.promptText = _.isString(e) ? e : TD.i("Enter a #hashtag or keyword"), this.$node = $(TD.ui.template.render("add_column_search_input", { | |
searchInputClassName: "js-add-column-search-input", | |
searchInputPlaceholder: this.promptText | |
})), this.$inputBox = this.$find(".js-add-column-search-input"), this.$searchButton = this.$find(".js-perform-search"), this.$spinner = this.$find(".js-spinner"), this.$clearButton = this.$find(".js-clear-search"), this.$node.submit(function (e) { | |
t._search(), e.preventDefault() | |
}), this.$clearButton.click(function (e) { | |
t._clear(), e.preventDefault() | |
}), this.$searchButton.click(function (e) { | |
t._search(), e.preventDefault() | |
}), this.boundCancelSearch = this.cancelSearch.bind(this), this.$inputBox.on("uiInputBlur", this.boundCancelSearch) | |
}).methods({ | |
cancelSearch: function () { | |
this.$inputBox.val("").blur() | |
}, | |
_search: function () { | |
var e = $.trim(this.$inputBox.val()); | |
"" === e ? this._clear() : this.prevSearchTerm !== e && (this.prevSearchTerm = e, this.bubbleEvent("td-search", this.$inputBox.val())) | |
}, | |
_clear: function () { | |
this.$inputBox.val(""), this.prevSearchTerm = "", this.$inputBox.focus(), this.bubbleEvent("td-search-clear"), this.$clearButton.hide(), this.$searchButton.show() | |
}, | |
showActivity: function () { | |
this.$searchButton.hide(), this.$clearButton.hide(), this.$spinner.show() | |
}, | |
hideActivity: function () { | |
var e = "" !== this.$inputBox.val(); | |
this.$clearButton.toggle(e), this.$searchButton.toggle(!e), this.$spinner.hide() | |
}, | |
destroy: function () { | |
$(document).off("uiSearchBlur", this.boundCancelSearch), this.$inputBox.unbind(), this.$node.remove() | |
} | |
}), TD.components.MenuItemBase = TD.components.Base.extend(function () { | |
this.eventSubscriptions = [], this.selected = !1, this.eventSubscriptions.push($.subscribe(TD.components.MenuItemBase.GLOBAL_SELECT_EVENT, _.bind(this._handleSelectionEvent, this))), _.defer(_.bind(this._addClickHandler, this)) | |
}).statics({ | |
GLOBAL_SELECT_EVENT: "/menuitem/select", | |
BUBBLE_SELECT_EVENT: "td-menuitem-select", | |
deselectAll: function () { | |
var e = { | |
target: null | |
}; | |
TD.storage.notification.notify(this.GLOBAL_SELECT_EVENT, e) | |
} | |
}).methods({ | |
_handleSelectionEvent: function (e) { | |
this.selected = e.target === this, this.$node.toggleClass("selected", this.selected) | |
}, | |
_addClickHandler: function () { | |
var e = this; | |
this.$node.bind("click", function () { | |
e.selected || e.select() | |
}) | |
}, | |
select: function () { | |
this.publishEvent(TD.components.MenuItemBase.GLOBAL_SELECT_EVENT, null), this.bubbleEvent(TD.components.MenuItemBase.BUBBLE_SELECT_EVENT) | |
}, | |
deselect: function () { | |
this.selected = !1, this.$node.removeClass("selected") | |
}, | |
destroy: function () { | |
_.each(this.eventSubscriptions, function (e) { | |
$.unsubscribe(e) | |
}), this.$node.remove() | |
} | |
}), TD.components.MenuItem = TD.components.MenuItemBase.extend(function () { | |
this.type = null | |
}).statics({ | |
BASIC: "basic", | |
SUBTITLE: "subtitle", | |
PERSON: "person", | |
LIST: "list" | |
}).methods({ | |
basic: function (e) { | |
return this.type = TD.components.MenuItem.BASIC, this.title = e, this.$node = $(TD.ui.template.render("list_module_list_item", { | |
title: this.title | |
})), this | |
}, | |
subtitle: function (e, t) { | |
this.type = TD.components.MenuItem.SUBTITLE, this.title = e, this.subtitle = t; | |
var i = { | |
title: e, | |
subtitle: t | |
}; | |
return this.$node = $(TD.ui.template.render("list_module_subtitle_item", i)), this | |
}, | |
selfAccount: function (e) { | |
this.type = TD.components.MenuItem.PERSON, this.account = e; | |
var t = (e.getType(), { | |
fullname: e.getName() || e.getUsername(), | |
username: e.getUsername(), | |
profileImageURL: e.getProfileImageURL() | |
}); | |
return this.$node = $(TD.ui.template.render("list_module_account_item", t)), this | |
}, | |
twitterUser: function (e) { | |
this.type = TD.components.MenuItem.PERSON, this.twitterUser = e; | |
var t = { | |
fullname: e.name || e.screenName, | |
username: e.screenName, | |
profileImageURL: e.profileImageURL | |
}; | |
return this.$node = $(TD.ui.template.render("list_module_account_item", t)), this | |
}, | |
list: function (e) { | |
this.type = TD.components.MenuItem.LIST, this.list = e; | |
var t = { | |
title: e.name, | |
by: TD.i("by {{1}}", { | |
1: e.user.name | |
}), | |
description: e.description, | |
subtitle: TD.i("{{1}} members", { | |
1: e.memberCount | |
}), | |
miniProfileURL: e.user.miniProfileImageURL(), | |
isPrivate: e.isPrivate | |
}; | |
return this.$node = $(TD.ui.template.render("list_module_twitter_list_item", t)), this | |
}, | |
customTimeline: function (e) { | |
this.type = TD.components.MenuItem.LIST, this.list = e; | |
var t = { | |
title: e.name, | |
description: e.description | |
}; | |
return this.$node = $(TD.ui.template.render("list_module_twitter_customtimeline_item", t)), this | |
} | |
}), TD.components.SelfAccounts = TD.components.Base.extend(function (e) { | |
var t = TD.storage.accountController.getPostingAccounts(); | |
this.titleText = TD.i("Your Accounts"), this.service = e, this.items = [], this.$node = $(TD.ui.template.render("open_column_list_with_header", { | |
title: this.titleText | |
})), this.$list = this.$find(".js-list-container"); | |
for (var i = 0; i < t.length; i++) { | |
var n = t[i], | |
r = n.getType(); | |
if (!this.service || r === this.service) { | |
var s = (new TD.components.MenuItem).selfAccount(t[i]); | |
this.items.push(s), this.$list.append(s.$node) | |
} | |
} | |
}).methods({ | |
selectDefault: function () { | |
for (var e, t = TD.storage.accountController.getDefault(), i = t.getKey(), n = 0; n < this.items.length; n++) | |
if (e = this.items[n], i === e.account.getKey()) { | |
e.select(); | |
break | |
} | |
}, | |
destroy: function () { | |
_.each(this.items, function (e) { | |
e.destroy() | |
}), this.$node.remove() | |
} | |
}), TD.components.ProfileAccount = TD.components.Base.extend(function () { | |
this.titleText = TD.i("Profile Account"), this.screenName = null, this.twitterUser = null, this.$node = $(TD.ui.template.render("open_column_list_with_header", { | |
title: this.titleText | |
})), this.$list = this.$find(".js-list-container"), this.menuItem = null | |
}).methods({ | |
setUser: function (e) { | |
this.screenName = e; | |
var t = TD.cache.twitterUsers.getByScreenName(this.screenName); | |
t.addCallbackWith(this, this._renderUser) | |
}, | |
_renderUser: function (e) { | |
this.twitterUser = e, this.menuItem = (new TD.components.MenuItem).twitterUser(e), this.$list.append(this.menuItem.$node) | |
}, | |
select: function () { | |
this.menuItem.select() | |
}, | |
destroy: function () { | |
this.menuItem && this.menuItem.destroy(), this.$node.remove() | |
} | |
}), TD.components.Trends = TD.components.Base.extend(function () { | |
var e = this; | |
this.woeid = 1, this.locationName = TD.i("Worldwide"), this.$node = $(TD.ui.template.render("list_module_trends", { | |
locationName: this.locationName | |
})), this.$trendList = this.$find(".js-trend-list"), this.trendComponents = [], this.trendLocations = null, this.$changeLocation = this.$find("#change-trends"), this.$changeLocation.bind("click", function () { | |
e._showTrendLocations() | |
}), this.account = TD.storage.accountController.getPreferredAccount("twitter"), this.client = TD.controller.clients.getClient(this.account.getKey()), e._showTrendsForLocation(this.woeid) | |
}).statics({ | |
CLICK_URL_BASE: "/open/search/tweets/" | |
}).methods({ | |
_showTrendLocations: function () { | |
var e = this; | |
$.isEmptyObject(e.trendLocations) ? this.account && this.client.getTrendLocations(_.bind(this._displayLocations, this)) : this._displayLocations(e.trendLocations.locations) | |
}, | |
_showTrendsForLocation: function (e) { | |
this.client.getTrends(e, _.bind(this._displayTrends, this)) | |
}, | |
_displayTrends: function (e) { | |
for (var t, e = e.trends, i = (e.locations, 0); i < e.length; i++) e[i].promotedContent || (t = (new TD.components.MenuItem).basic(e[i].name), this.trendComponents.push(t), this.$trendList.append(t.$node)) | |
}, | |
_displayLocations: function () {}, | |
destroy: function () { | |
_.each(this.trendComponents, function (e) { | |
e.destroy() | |
}), this.$trendList.unbind(), this.$changeLocation.unbind(), this.$node.remove() | |
} | |
}), TD.components.TwitterUserSearch = TD.components.Base.extend(function (e, t, i) { | |
e || (e = TD.storage.accountController.getPreferredAccount("twitter")), e && (this.listItemComponent = i, this.client = TD.controller.clients.getClient(e.getKey()), this.maxResults = t || TD.components.TwitterUserSearch.MAX_RESULTS, this.searchInput = new TD.components.SearchInput(TD.i("Enter a @name or full name")), this.items = [], this.resultsTitle = TD.i("Search results"), this.$searchResults = $(TD.ui.template.render("open_column_list_with_header", { | |
title: this.resultsTitle | |
})), this.$searchResults.hide(), this.$node = $(this.searchInput.$node), this.$node.append(this.$searchResults), this.$node.bind("td-search", _.bind(this._handleSearchSubmit, this)), this.$node.bind("td-search-clear", _.bind(this._handleSearchClear, this)), this.$searchResultsList = this.$find(".js-list-container")) | |
}).statics({ | |
SEARCH_COMPLETE: "td-search-complete", | |
MAX_RESULTS: 4 | |
}).methods({ | |
_handleSearchSubmit: function (e, t) { | |
this.searchInput.showActivity(); | |
var i = t.data; | |
this._search(i), e.stopPropagation() | |
}, | |
_search: function (e) { | |
e && this.client.userSearch(e, _.bind(this._handleUsers, this)) | |
}, | |
_handleSearchClear: function () { | |
_.each(this.items, function (e) { | |
e.destroy() | |
}), this.$searchResults.hide() | |
}, | |
_handleUsers: function (e) { | |
this.searchInput.hideActivity(); | |
var t, i, n; | |
for (e = _.first(e, this.maxResults), this.items = [], this.$searchResultsList.empty(), t = 0, i = e.length; i > t; t++) n = this.listItemComponent ? new this.listItemComponent(e[t]) : (new TD.components.MenuItem).twitterUser(e[t]), this.items.push(n), this.$searchResultsList.append(n.$node); | |
this.$searchResults.show(), this.bubbleEvent(TD.components.TwitterUserSearch.SEARCH_COMPLETE) | |
}, | |
detachResultsContainer: function () { | |
return this.$searchResults.detach() | |
}, | |
destroy: function () { | |
_.each(this.items, function (e) { | |
e.destroy() | |
}), this.supr() | |
} | |
}), TD.components.SuggestedUsers = TD.components.TwitterUserSearch.extend(function (e, t, i, n) { | |
this.searchTerm = n, this._ready = !1, this._userData = null, this.resultsTitle = TD.i("Suggested"), $(".js-title", this.$searchResults).text(this.resultsTitle), this.$node = this.$searchResults, this.searchInput.$node.detach(), this._search(n) | |
}).methods({ | |
_handleUsers: function (e) { | |
this._ready ? e && e.length > 0 && (this.supr(e), this._userData = null) : this._userData = e | |
}, | |
render: function () { | |
this._ready || (this._ready = !0, this._handleUsers(this._userData)) | |
} | |
}), TD.components.TemporaryColumn = TD.components.Base.extend(function () { | |
this.type = void 0, this.service = void 0, this.accountKey = void 0, this.metaString = void 0, this.column = null, this.$actionButton = null, this.destroyCallbacks = [] | |
}).statics({ | |
DELETED_EVENT: "td-column-deleted" | |
}).methods({ | |
_init: function (e, t, i, n, r) { | |
var s = TD.controller.columnManager.makeColumnFor(e, t, i, n, r); | |
this.renderColumn(s) | |
}, | |
renderColumn: function (e) { | |
this.column = e, e.visible = !0, e.temporary = !0, TD.controller.columnManager.add(this.column); | |
var t = this.column.model, | |
i = { | |
columnkey: t.getKey(), | |
columntitle: this.column.getTitleHTML(), | |
columniconclass: this.column.getIconClass(), | |
isTemporary: !0 | |
}; | |
this.$node = $(TD.ui.template.render("column", i)), TD.util.isTouchDevice() && TD.decider.get(TD.decider.TOUCHDECK_TWEETCONTROLS) && this.$node.find(".js-chirp-container").addClass("is-touch-tweet-container"), this.$actionButton = this.$find(".js-action-header-button") | |
}, | |
populate: function () { | |
TD.ui.columns.setupColumn(this.column), TD.controller.feedScheduler.addColumn(this.column, !1) | |
}, | |
makePermanent: function () { | |
var e = this.column.clone(); | |
TD.controller.columnManager.addColumnToUI(e) | |
}, | |
home: function () { | |
this._init("home", "tweetdeck") | |
}, | |
me: function () { | |
this._init("me", "tweetdeck") | |
}, | |
inbox: function () { | |
this._init("privateMe", "tweetdeck") | |
}, | |
scheduled: function () { | |
this._init("scheduled", "tweetdeck") | |
}, | |
genericTwitter: function (e, t, i) { | |
var n, r, s = "twitter", | |
o = t.getKey(), | |
a = i ? i.id : void 0; | |
i ? (n = TD.controller.columnManager.NON_SELF_FEED_TYPE[e] || e, e === TD.controller.columnManager.MENTIONS && (a = "@" + i.screenName), TD.cache.names.addScreenName(i.id, i.screenName)) : (e === TD.controller.columnManager.MENTIONS && (r = new TD.vo.SearchFilter, r.action.fromJSONObject({ | |
showMentions: !0 | |
})), e === TD.controller.columnManager.FOLLOWERS && (r = new TD.vo.SearchFilter, r.action.fromJSONObject({ | |
showFollowers: !0 | |
})), n = TD.controller.columnManager.SELF_FEED_TYPE[e] || e), this._init(n, s, o, a, r) | |
}, | |
search: function (e, t) { | |
if (!t) { | |
var i = TD.storage.accountController.getPreferredAccount("twitter"); | |
t = i.getKey() | |
} | |
this._init("search", "twitter", t, e) | |
}, | |
list: function (e) { | |
function t() { | |
if (e.isOwnList()) { | |
var t = i.$find(".js-action-header-button"); | |
t.text(TD.i("Edit")), t.removeClass("is-hidden"), t.click(function () { | |
i.bubbleEvent(TD.components.BaseModal.CLOSE_EVENT), new TD.components.ListMembers(e) | |
}) | |
} | |
} | |
var i = this, | |
n = e.user.account.getKey(), | |
r = e.user.id + "/" + e.id; | |
TD.cache.names.addScreenName(e.user.id, e.user.screenName), TD.cache.names.addListName(e.id, e.name), this._init("list", "twitter", n, r), t(); | |
var s = $(document), | |
o = function (e, n) { | |
i.column.model.privateState.key === n.columnKey && t() | |
}; | |
s.on("uiColumnTitleRefreshed", o), this.destroyCallbacks.push(s.off.bind(s, "uiColumnTitleRefreshed", o)) | |
}, | |
customTimeline: function (e) { | |
function t() { | |
if (e.isOwnCustomTimeline()) { | |
var t = i.$find(".js-action-header-button"); | |
t.text(TD.i("Delete")), t.removeClass("is-hidden"), t.addClass("btn-negative"), t.click(function () { | |
var e = _.uniqueId(), | |
t = { | |
id: e, | |
title: TD.i("Delete"), | |
message: TD.i("Are you sure you want to delete this collection?"), | |
okLabel: TD.i("Delete"), | |
cancelLabel: TD.i("Cancel") | |
}, | |
n = function (t, n) { | |
n.id === e && ($(document).off("uiConfirmationAction"), n.result && i.column.deleteCustomTimeline(function () { | |
_.defer(function () { | |
i.bubbleEvent(TD.components.TemporaryColumn.DELETED_EVENT) | |
}) | |
})) | |
}; | |
s.on("uiConfirmationAction", n), i.destroyCallbacks.push(s.off.bind(s, "uiConfirmationAction", n)), i.$node.trigger("uiShowConfirmationDialog", t) | |
}) | |
} | |
} | |
var i = this, | |
n = e.account.getKey(), | |
r = e.user.id + "/" + e.id; | |
TD.cache.names.addCustomTimelineName(e.id, e.name), TD.cache.names.addScreenName(e.user.id, e.user.screenName), this._init(TD.util.columnUtils.feedTypes.CUSTOMTIMELINE, "twitter", n, r), t(); | |
var s = $(document), | |
o = function (e, n) { | |
i.column.model.privateState.key === n.columnKey && t() | |
}; | |
$(document).on("uiColumnTitleRefreshed", o), this.destroyCallbacks.push(s.off.bind(s, "uiColumnTitleRefreshed", o)) | |
}, | |
destroy: function () { | |
this.column && this.column.temporary && TD.controller.columnManager.removeFromAppLayer(this.column.model.getKey()), this.destroyCallbacks.forEach(function (e) { | |
e.call(this) | |
}.bind(this)), this.$node.remove() | |
} | |
}), TD.components.ScheduledDatePicker = TD.components.Base.extend(function (e) { | |
var t = this; | |
this.$node = $(TD.ui.template.render("compose/schedule")), e.append(this.$node), this.$minutes = $("#scheduled-minute"), this.$hours = $("#scheduled-hour"), this.$datepicker = $("#datepicker"), this.$nextMonth = $("#next-month"), this.$prevMonth = $("#prev-month"), this.$removeDate = $(".js-remove", this.$node), this.$amToggle = $("#amPm"), this.$hours.bind("change", function () { | |
t._refreshDate(), t.publishDateChanged() | |
}), this.$minutes.bind("change", function () { | |
var e = $(this); | |
e.val(("00" + e.val()).slice(-2)), t._refreshDate(), t.publishDateChanged() | |
}), this.$datepicker = this.$datepicker.dateinput({ | |
onHide: function () { | |
return !1 | |
}, | |
change: function () { | |
t._refreshDate(), t.publishDateChanged() | |
}, | |
min: -1 | |
}), t.datePickerData = this.$datepicker.data("dateinput").show(), this.$nextMonth.bind("click", function () { | |
t.datePickerData.addMonth(1) | |
}), this.$prevMonth.bind("click", function () { | |
t.datePickerData.addMonth(-1) | |
}), this.$removeDate.bind("click", function () { | |
t.publishRemoval() | |
}), this.$amToggle.bind("click", function () { | |
var e = $(this), | |
i = e.data("value"); | |
t._setAmPm(!i) | |
}), t.setDate(new Date) | |
}).methods({ | |
_refreshDate: function () { | |
var e = this.$hours.val(), | |
t = Number(e) % 12, | |
i = Number(this.$minutes.val()); | |
if (!_.isNaN(t) && !_.isNaN(i)) { | |
var n = this.datePickerData.getValue(), | |
r = this.$amToggle.data("value"); | |
n.setHours(r ? t + 12 : t), n.setMinutes(i), this.date = n, e > 12 ? (this.$hours.val(t), this._setAmPm(!0)) : "0" === e && (this.$hours.val(12), this._setAmPm(!1)) | |
} | |
}, | |
_setAmPm: function (e) { | |
e ? (this.$amToggle.text(TD.i("PM")), this.$amToggle.data("value", !0)) : (this.$amToggle.text(TD.i("AM")), this.$amToggle.data("value", !1)), this._refreshDate(), this.publishDateChanged() | |
}, | |
setDate: function (e) { | |
if (e) { | |
var t = e.getHours() % 12 || 12, | |
i = e.getHours() > 11, | |
n = (TD.i(i ? "PM" : "AM"), e.getMinutes()); | |
this._setAmPm(i), this.datePickerData.setValue(e.getFullYear(), e.getMonth(), e.getDate()), this.$hours.val(t), this.$minutes.val(("00" + n).slice(-2)) | |
} | |
this.date = e, this.publishDateChanged() | |
}, | |
getDate: function () { | |
return this.date | |
}, | |
publishDateChanged: function (e) { | |
$.publish("/change/date", [void 0 !== e ? e : this.getDate()]) | |
}, | |
publishRemoval: function () { | |
this.date = null, this.publishDateChanged(null), $.publish("/removed/date") | |
} | |
}), TD.components.DetailView = TD.components.Base.extend(function (e, t) { | |
this.initialised = !1, this.column = e, this.$column = t, this.$detailContainer = $(".js-column-detail", this.$column), this.$columnsContainer = $("#container"), this.$column.trigger("uiDetailViewOpening", { | |
column: this.column | |
}), this.$column.on("click", ".js-column-back", this._handleHeaderClick.bind(this)), this._render(), this.$detailContainer.html(this.$node), this.column.temporary || this.$node.trigger("uiCloseModal"), this.$holder = $(".js-detail-container", this.$column), this.$header = $(".js-column-header", this.$column), TD.ui.columns.refreshTitle(this.column) | |
}).statics({ | |
RETWEETER_COUNT: 8 | |
}).methods({ | |
_render: function () { | |
throw "DetailView._render not implemented" | |
}, | |
_handleHeaderClick: function () { | |
this.destroy() | |
}, | |
changed: function () {}, | |
deleted: function (e) { | |
e.id === this.chirp.id && this.destroy() | |
}, | |
destroy: function (e) { | |
var t = this.supr.bind(this); | |
this.$detailContainer.trigger("uiDetailViewClosing"), this.$column.off("click", ".js-column-back"), this.$column.trigger("uiDetailViewClosed", { | |
column: this.column | |
}), TD.ui.main.TRANSITION_END_EVENTS ? this.$column.one(TD.ui.main.TRANSITION_END_EVENTS, function () { | |
e && e(), t() | |
}) : (e && e(), this.supr()) | |
} | |
}), TD.components.TweetDetailView = TD.components.DetailView.extend(function () {}).statics({ | |
CARD_CONTAINER: ".js-cards-container", | |
MEDIA_CONTAINER: ".js-tweet-media", | |
TWEET_STAT: ".js-tweet-stat" | |
}).methods({ | |
_render: function () { | |
this.$node = $(TD.ui.template.render("status/tweet_detail_wrapper", { | |
headerClass: "js-detail-header", | |
headerAction: "resetToTopColumn", | |
headerLinkClass: "js-column-back" | |
})) | |
}, | |
showChirp: function (e, t) { | |
if (this.chirp = e, this.parentChirp = t, this._renderChirp(), !e.cards && e.entities && e.entities.urls && e.entities.urls.length) { | |
var i = TD.controller.clients.getClient(e.account.getKey()); | |
i.show(e.id, _.bind(this._showCardsForChirp, this), _.bind(this._chirpRetrievalError, this)) | |
} else this._showCardsForChirp(e) | |
}, | |
_showCardsForChirp: function (e) { | |
var t = TD.settings.getDisplaySensitiveMedia(); | |
if (e.cards) { | |
e.cards.isPossiblySensitive = e.possiblySensitive && !t; | |
var i = TD.ui.template.render("cards/card_layouts", e.cards); | |
this.$find(TD.components.TweetDetailView.CARD_CONTAINER).html(i) | |
} | |
this.showMedia(e) | |
}, | |
showMedia: function (e) { | |
if (e.getMedia()) { | |
var t = TD.settings.getDisplaySensitiveMedia(), | |
i = e.possiblySensitive && !t; | |
e.getMedia().forEach(function (e) { | |
e.isPossiblySensitive = i | |
}); | |
var n = TD.ui.template.render("status/tweet_detail_media", e); | |
this.$find(TD.components.TweetDetailView.MEDIA_CONTAINER).html(n) | |
} | |
}, | |
_chirpRetrievalError: function () {}, | |
_renderChirp: function (e) { | |
var t = this.column.isOwnCustomTimeline(), | |
i = !this.column.temporary && !t; | |
this.$tweetDetail = $(TD.ui.template.render("status/tweet_detail", { | |
withDragHandle: i && !this.chirp.getMainUser().isProtected, | |
withRemove: t, | |
chirp: this.chirp | |
})), this.$tweetDetail.find(".tweet-location-search").on("click", function () { | |
return $(document).trigger("uiPerformSearch", { | |
query: 'near:"' + e.getLocationFullName() + '"' | |
}), !1 | |
}), this.$tweetDetail.find(".js-detail-view-inline-text").html("Reply to " + this.chirp.getReplyUsers().join(" ")), this.$find(".js-tweet-detail").html(this.$tweetDetail); | |
var n = this.$find(".spn-loading"), | |
r = this.$header, | |
s = this.$tweetDetail.find(".js-translate-call-to-action"), | |
o = this.column.getMediaPreviewSize(); | |
o !== TD.vo.Column.MEDIA_PREVIEW_OFF && (o = TD.vo.Column.MEDIA_PREVIEW_SIZE_SMALL), this.replies = new TD.components.InReplyTo(this.chirp, this.$detailContainer, o, i), this.retweeters = new TD.components.Retweeters(this.chirp, TD.components.DetailView.RETWEETER_COUNT), this.repliesTo = new TD.components.RepliesTo(this.chirp, o, i), this.$find(".js-inreplyto").replaceWith(this.replies.$node), this.$find(".js-tweet-stats").append(this.retweeters.$node), this.$find(".js-tweet-replies").append(this.repliesTo.$node), this._boundShowSocialProof = this.showSocialProof.bind(this), this.$column.on("click", TD.components.TweetDetailView.TWEET_STAT, this._boundShowSocialProof), this.replies.$node.bind(TD.components.InReplyTo.BEGIN, function () { | |
n.show() | |
}), this.replies.$node.bind(TD.components.InReplyTo.END, function () { | |
r.addClass("gradient-top"), n.hide() | |
}), s.on("click", function () { | |
this.chirp.translate() | |
}.bind(this)), this.initialised = !0, this.$tweetDetail.trigger("uiDetailViewActive", { | |
$chirp: this.$tweetDetail, | |
chirp: this.chirp, | |
parentChirp: this.parentChirp | |
}), TD.controller.stats.tweetImpression(this.chirp.getScribeItemData()) | |
}, | |
showSocialProof: function (e) { | |
var t = $(e.target).closest(TD.components.TweetDetailView.TWEET_STAT).data("type"); | |
this.$column.trigger("uiShowSocialProof", { | |
type: t, | |
tweetSummary: this.retweeters.tweetSummary, | |
$chirp: this.$tweetDetail, | |
chirp: this.chirp, | |
parentChirp: this.parentChirp | |
}) | |
}, | |
destroy: function () { | |
this.$column.off("click", this._boundShowSocialProof); | |
var e = function () { | |
this.initialised && (this.replies.destroy(), this.retweeters.destroy(), this.repliesTo.destroy()) | |
}.bind(this); | |
this.supr(e) | |
}, | |
findChirp: function (e) { | |
return this.initialised ? this.replies.findChirp(e) || this.repliesTo.findChirp(e) : void 0 | |
}, | |
getMostInteresting$Chirp: function () { | |
return this.$tweetDetail | |
} | |
}), TD.components.MessageDetailView = TD.components.DetailView.extend(function () {}).methods({ | |
_render: function () { | |
this.$node = $(TD.ui.template.render("status/message_wrapper", { | |
headerClass: "js-detail-header", | |
headerAction: "resetToTopColumn", | |
headerLinkClass: "js-column-back" | |
})) | |
}, | |
showChirp: function (e, t) { | |
var i; | |
this.chirp = e, this.parentChirp = t, this.replyBar = new TD.components.ReplyBar(this.chirp), i = this.chirp.renderThread(), this.$find(".js-message-box").replaceWith(this.replyBar.$node), this.$find(".js-message-detail").html(i), this.initialised = !0, this.chirp.markAsRead(), this.$node.trigger("uiDetailViewActive", { | |
$chirp: this.getMostInteresting$Chirp(), | |
chirp: this.chirp, | |
parentChirp: this.parentChirp | |
}) | |
}, | |
changed: function (e) { | |
if (this.initialised && e.id === this.chirp.id) { | |
var t = e.renderThread(); | |
this.$find(".js-message-detail").html(t) | |
} | |
}, | |
findChirp: function (e) { | |
return this.initialised ? this.chirp.messageIndex[e] : void 0 | |
}, | |
getMostInteresting$Chirp: function () { | |
return this.$find(".js-message-detail .js-stream-item").first() | |
}, | |
destroy: function () { | |
var e = function () { | |
this.initialised && (this.replyBar.destroy(), this.chirp.markAsRead()) | |
}.bind(this); | |
this.supr(e) | |
} | |
}), TD.components.ReplyBar = TD.components.Base.extend(function (e) { | |
if (e && e.postComment) { | |
switch (this._boundHandleGlobalKeydown = this._handleGlobalKeydown.bind(this), this._boundSend = this.send.bind(this), this._boundPopInlineToDocked = this.popInlineToDocked.bind(this), this._boundAddImage = this.addImage.bind(this), this._boundHandleDataTweetSent = this._handleDataTweetSent.bind(this), this._boundHandleDataTweetError = this._handleDataTweetError.bind(this), this.$node = $(TD.ui.template.render("status/tweet_detail_replybar", { | |
from: e.account.getUsername(), | |
avatarURL: e.account.getProfileImageURL(), | |
dmPhotosEnabled: TD.config.force_dm_photos || TD.decider.get(TD.decider.DM_PHOTO_PREVIEW) | |
})), this.chirp = e, this.$inputBox = this.$find(".js-reply-tweetbox"), this.$charCount = this.$find(".js-reply-charcount"), this.$sendButton = this.$find(".js-send"), this.$popoutButton = this.$find(".js-reply-popout"), this.$addImageButton = this.$find(".js-reply-add-image"), e.account.getType()) { | |
case "twitter": | |
this.charLimit = 140 | |
} | |
this.$sendButton.bind("click", this._boundSend), this.$popoutButton.bind("click", this._boundPopInlineToDocked), this.$addImageButton.bind("click", this._boundAddImage), $(document).on("dataTweetSent", this._boundHandleDataTweetSent), $(document).on("dataTweetError", this._boundHandleDataTweetError), this._reset() | |
} | |
}).statics({ | |
ACTIVITY_EVENTS: "click change focus blur input keydown keypress keyup mousedown mouseup paste", | |
RESET_EVENT: "td-reset", | |
REPLYING_EVENT: "td-replying", | |
OVER_CHAR_COUNT_CLASS: "over-char-count" | |
}).methods({ | |
_updateCharCount: function () { | |
var e = twttr.txt.getTweetLength(this.$inputBox.val()), | |
t = this.charLimit - e; | |
0 > t || t === this.charLimit ? this.$sendButton.prop("disabled", !0) : this.$sendButton.prop("disabled", !1), 0 > t ? this.$charCount.addClass(TD.components.ReplyBar.OVER_CHAR_COUNT_CLASS) : this.$charCount.removeClass(TD.components.ReplyBar.OVER_CHAR_COUNT_CLASS), this.$charCount.val(t) | |
}, | |
_reset: function () { | |
var e = ""; | |
if (this.chirp instanceof TD.services.TwitterStatus) { | |
var t = this.chirp.getMainTweet(); | |
e = TD.i("Reply to @{{1}}", { | |
1: t.user.screenName | |
}) | |
} else this.chirp instanceof TD.services.TwitterMessageThread && (e = TD.i("Message @{{1}}", { | |
1: this.chirp.correspondent.screenName | |
})); | |
this.$node.removeClass("s-replying"), this.$inputBox.val(e), this.$inputBox.blur().prop("disabled", !1), this.$sendButton.prop("disabled", !1), this.$inputBox.bind(TD.components.ReplyBar.ACTIVITY_EVENTS, _.bind(this._handleActivity, this)), this.bubbleEvent(TD.components.ReplyBar.RESET_EVENT, null), $(window).unbind("keydown", this._boundHandleGlobalKeydown) | |
}, | |
_handleActivity: function () { | |
var e = this; | |
this.$inputBox.unbind(), e.bubbleEvent(TD.components.ReplyBar.REPLYING_EVENT, null), this.$node.addClass("s-replying"); | |
var t = "", | |
i = []; | |
this.chirp instanceof TD.services.TwitterStatus && (i = TD.util.getReplyUsers(this.chirp)), i.length > 0 && (t = i.join(" ") + " "), this.$inputBox.val(t), this._updateCharCount(); | |
var n = t.length, | |
r = t.length; | |
i.length > 0 && (n = i[0].length + 1), this.$inputBox.bind("keydown change", _.bind(this._handleKeydown, this)), _.defer(function () { | |
e.$inputBox[0].setSelectionRange(n, r) | |
}), this.$inputBox.bind("cut paste", _.bind(this._handleCutPaste, this)), this.$inputBox.bind("keyup", _.bind(this._updateCharCount, this)) | |
}, | |
_handleCutPaste: function () { | |
_.defer(_.bind(this._updateCharCount, this)) | |
}, | |
_handleGlobalKeydown: function (e) { | |
e.which === TD.constants.keyCodes.escape && this._reset() | |
}, | |
_handleKeydown: function (e) { | |
switch (this._updateCharCount(), e.charCode || e.keyCode) { | |
case 10: | |
case 13: | |
(e.ctrlKey || e.metaKey) && (e.preventDefault(), this.send()); | |
break; | |
case TD.constants.keyCodes.escape: | |
this.$inputBox.blur(), $(window).bind("keydown", this._boundHandleGlobalKeydown) | |
} | |
}, | |
popInlineToDocked: function () { | |
$(document).trigger("uiComposeTweet", { | |
type: "message", | |
text: this.$inputBox.val(), | |
messageRecipient: { | |
screenName: this.chirp.correspondent.screenName | |
}, | |
from: TD.storage.Account.generateKeyFor("twitter", this.chirp.account.getUserID()) | |
}), this._reset() | |
}, | |
addImage: function () { | |
this._boundPopInlineToDocked(), $(document).trigger("uiComposeAddImageClick") | |
}, | |
send: function () { | |
var e = this.$inputBox.val(); | |
e && (this.$sendButton.prop("disabled", !0), this.$inputBox.prop("disabled", !0), this.$inputBox.blur(), this.progressKey = TD.controller.progressIndicator.addTask(TD.i("Sending…")), this.currentRequestId = _.uniqueId("sendTweet"), $(document).trigger("uiSendTweet", { | |
type: "message", | |
text: e, | |
from: [this.chirp.account.getKey()], | |
messageRecipient: { | |
userId: this.chirp.correspondent.id, | |
screenName: this.chirp.correspondent.screenName | |
}, | |
accountKey: this.chirp.account.getKey(), | |
requestId: this.currentRequestId | |
})) | |
}, | |
_handleDataTweetSent: function (e, t) { | |
this.currentRequestId && t.request.requestId === this.currentRequestId && (TD.controller.progressIndicator.taskComplete(this.progressKey), this._reset()) | |
}, | |
_handleDataTweetError: function (e, t) { | |
this.currentRequestId && t.request.requestId === this.currentRequestId && (TD.controller.progressIndicator.taskFailed(this.progressKey, t.response.errors[0].message), this.$sendButton.prop("disabled", !1), this.$inputBox.prop("disabled", !1), this.$inputBox.focus()) | |
}, | |
destroy: function () { | |
$(document).off("dataTweetSent", this._boundHandleDataTweetSent), $(document).off("dataTweetError", this._boundHandleDataTweetError) | |
} | |
}), TD.components.MediaGallery = TD.components.BaseModal.extend(function (e, t, i, n) { | |
var r = this; | |
this.chirp = e, this.column = n, this.clickedLink = t, this.clickedMediaEntityId = i, this.originalLinkHeight = 26, this.$node = $(TD.ui.template.render("media/media_gallery")), this.$closeButton = this.$find(".js-dismiss"), this.$prevButton = this.$find("#media-gallery-prev"), this.$nextButton = this.$find("#media-gallery-next"), this.$embed = this.$find(".js-mediaembed"), this.$tweet = this.$find(".med-tweet"), this.$mainframe = this.$find(".js-embeditem"), this._sizeMedia = this._sizeMedia.bind(this), this.sizeMediaInterval = setInterval(this._sizeMedia, 300), this.$closeButton.bind("click", function () { | |
r.destroy() | |
}), this.$prevButton.bind("click", function () { | |
r._prev() | |
}), this.$nextButton.bind("click", function () { | |
r._next() | |
}), this._loadTweet(), this.setAndShowContainer($("#open-modal"), !1), TD.util.isTouchDevice() && TD.decider.get(TD.decider.TOUCHDECK_TWEETCONTROLS) && this.$node.find(".js-med-tweet").addClass("is-touch-tweet-container"), e.hasMedia() || e.cards ? (this.media = e.getMedia().concat(e.getCardsForGallery()), this._setupEmbeds(), e.scribeMediaImpression()) : (TD.util.openURL(t), this.destroy()) | |
}).statics({ | |
MEDIA_FLAG_NSFW: ".js-media-flag-nsfw", | |
MEDIA_FLAGGED_NSFW: ".js-media-flagged-nsfw", | |
HIDDEN_CLASS: "is-hidden" | |
}).methods({ | |
_prev: function () { | |
var e = _.indexOf(this.media, this.currentMedia); | |
0 === e && (e = this.embeds.length), this.currentMedia = this.embeds[e - 1], this._renderEmbed() | |
}, | |
_next: function () { | |
var e = _.indexOf(this.media, this.currentMedia); | |
e == this.media.length - 1 && (e = -1), this.currentMedia = this.media[e + 1], this._renderEmbed() | |
}, | |
_setupEmbeds: function () { | |
if (this.media && 0 !== this.media.length) { | |
var e = this; | |
this.currentMedia = this.media[0], this.clickedLink && _.each(this.media, function (t) { | |
(e.clickedMediaEntityId && t.mediaId === e.clickedMediaEntityId || !e.clickedMediaEntityId && t.url === e.clickedLink) && (e.currentMedia = t) | |
}), this._renderEmbed() | |
} | |
}, | |
_loadTweet: function () { | |
var e = this; | |
this.$tweet.append(this.chirp.renderInMediaGallery()), this.$tweet.bind("click", function (t) { | |
$.publish("chirp/click", [t, e.tweet, e.column]) | |
}) | |
}, | |
_sizeMedia: function () { | |
var e = $("img", this.$mainframe), | |
t = this.chirp.translation ? this.$tweet.height() + this.originalLinkHeight : this.originalLinkHeight; | |
e.css({ | |
"max-width": this.$mainframe.width(), | |
"max-height": this.$mainframe.height() - t + "px" | |
}) | |
}, | |
_fadeIn: function () { | |
this.$mainframe.addClass("is-loaded"), this.$embed.fadeTo("fast", 1) | |
}, | |
_renderEmbed: function () { | |
var e, t = this.currentMedia; | |
if (t instanceof TD.services.TwitterCard && t.shouldDisable()) return TD.util.openURL(t.url), void this.destroy(); | |
e = t.renderGallery(), this.$embed.html(e), this.$embed.append(TD.ui.template.render("text/gallery_original_link", t)), t.needsSecureUrl || t.isScheduled || this.$embed.append(TD.ui.template.render("text/gallery_flag_media", { | |
flagged: t.flaggedNSFW | |
})), t.needsSecureUrl && $(document).trigger("uiNeedsSecureImageUrl", { | |
accountKey: this.chirp.account.getKey(), | |
url: t.large() | |
}); | |
var i = $("img", this.$embed); | |
0 === i.length ? _.delay(function () { | |
this._fadeIn(), this._sizeMedia() | |
}.bind(this), 1e3) : i.load(function () { | |
i.attr("data-maxwidth", i.width()), i.attr("data-maxheight", i.height()), this._sizeMedia(), this._fadeIn() | |
}.bind(this)), this.$find(TD.components.MediaGallery.MEDIA_FLAG_NSFW).click(function () { | |
var e; | |
t.flaggedNSFW = !0, this.$find(TD.components.MediaGallery.MEDIA_FLAG_NSFW).addClass(TD.components.MediaGallery.HIDDEN_CLASS), this.$find(TD.components.MediaGallery.MEDIA_FLAGGED_NSFW).removeClass(TD.components.MediaGallery.HIDDEN_CLASS), e = TD.controller.clients.getClient(this.chirp.account.getKey()), e.flagTweet(this.chirp.id, function () {}, function () { | |
var e = TD.i("Problem flagging media. Please try again"); | |
TD.controller.progressIndicator.addMessage(e), this.$find(TD.components.MediaGallery.MEDIA_FLAG_NSFW).removeClass(TD.components.MediaGallery.HIDDEN_CLASS), this.$find(TD.components.MediaGallery.MEDIA_FLAGGED_NSFW).addClass(TD.components.MediaGallery.HIDDEN_CLASS) | |
}) | |
}.bind(this)), this.media.length > 1 ? (this.$prevButton.removeClass(TD.components.MediaGallery.HIDDEN_CLASS), this.$nextButton.removeClass(TD.components.MediaGallery.HIDDEN_CLASS), this.$mainframe.addClass("s-shorter"), this.$tweet.find(".js-media").show()) : (this.$prevButton.addClass(TD.components.MediaGallery.HIDDEN_CLASS), this.$nextButton.addClass(TD.components.MediaGallery.HIDDEN_CLASS), this.$tweet.find(".js-media").hide()) | |
}, | |
destroy: function () { | |
this.$node.trigger("uiMediaGalleryClosing"), $("#open-modal").hide(), clearInterval(this.sizeMediaInterval), this.supr() | |
} | |
}), TD.components.AccountSelector = TD.components.Base.extend(function () { | |
var e = this; | |
this.$node = $.createElement("ul").addClass("accs cf js-account-selector"), this.cachedSelectedAccounts = [], this.accountIndex = {}, this.refreshPostingAccounts(), this.$node.on("click", ".js-account-item", function (t) { | |
var i = $(t.currentTarget); | |
t.stopPropagation(), t.shiftKey ? ($("li", e.$node).removeClass(TD.components.AccountSelector.SELECTED_CLASS), i.addClass(TD.components.AccountSelector.SELECTED_CLASS)) : i.toggleClass(TD.components.AccountSelector.SELECTED_CLASS), e.updateSelectedAccounts() | |
}), this.subscription = $.subscribe("/storage/client/account_whitelist_changed", _.bind(this.refreshPostingAccounts, this)) | |
}).statics({ | |
CHANGE: "td-accounts-change", | |
SELECTED_CLASS: "acc-selected" | |
}).methods({ | |
refreshPostingAccounts: function () { | |
var e, t, i, n, r = TD.storage.accountController.getPostingAccounts(), | |
s = []; | |
for (this.accountIndex = {}, e = 0; e < r.length; e++) t = r[e], i = t.getKey(), s.push(i), this.accountIndex[i] = { | |
account: i, | |
uid: i, | |
type: "account", | |
username: t.getUsername(), | |
service: t.getType(), | |
picture: t.getProfileImageURL() | |
}; | |
var o = function (e, t, i) { | |
var n = { | |
accounts: [], | |
show_acc_toggle: i | |
}; | |
return n.accounts = _.map(e, function (e) { | |
return t[e] | |
}), n | |
}; | |
s.length && (n = TD.ui.template.render("compose/accounts", o(s, this.accountIndex, !0)), this.$node.html(n)) | |
}, | |
getSelectedAccounts: function () { | |
var e, t, i = []; | |
if (this.cachedSelectedAccounts) return this.cachedSelectedAccounts.concat(); | |
e = $("." + TD.components.AccountSelector.SELECTED_CLASS, this.$node); | |
for (var n = 0; n < e.length; n++) t = e[n].attributes["data-id"].value, i.push(this.accountIndex[t]); | |
return this.cachedSelectedAccounts = i, i | |
}, | |
selectAccounts: function (e) { | |
var t, i = this.$node.find(".js-account-item"); | |
if (_.isArray(e) && (i.removeClass(TD.components.AccountSelector.SELECTED_CLASS), e && e.length)) { | |
for (t = 0; t < e.length; t++) e[t] && i.filter("li[data-id='" + e[t] + "']").addClass(TD.components.AccountSelector.SELECTED_CLASS); | |
this.updateSelectedAccounts() | |
} | |
}, | |
selectDefaultAccount: function () { | |
var e = TD.storage.accountController.getDefault(); | |
e && this.selectAccounts([e.getKey()]) | |
}, | |
updateSelectedAccounts: function () { | |
this.cachedSelectedAccounts = null; | |
var e = this.getSelectedAccounts(); | |
this.$node.trigger(TD.components.AccountSelector.CHANGE, { | |
selectedAccounts: e | |
}) | |
}, | |
destroy: function () { | |
$.unsubscribe(this.subscription), this.$node.off("click", ".js-account-item"), this.supr() | |
} | |
}), TD.components.FollowFrom = TD.components.Base.extend(function (e, t) { | |
var i = this; | |
this.userToFollow = e, this.account = t, this.isSingleAccount = 1 === TD.storage.accountController.getAccountsForService("twitter").length, this.client = TD.controller.clients.getClient(t.getKey()), this.$node = $(TD.ui.template.render("actions/follow_from", this)), this.$followButton = this.$find(".js-follow-button").click(_.bind(this.handleClick, i)), this.$followButtonHolder = this.$find(".js-action-follow"), this.state = "stranger", t.getUserID() == e.id ? (this.state = "me", this.updateButtonState()) : this.client.showFriendship(t.getUserID(), e.id, null, _.bind(this.handleFollowInfoResponse, this), _.bind(this.handleFollowInfoError, this)), this.subscriptions = [$.subscribe("/user/" + this.userToFollow.screenName + "/block", _.bind(this._handleBlock, this)), $.subscribe("/user/" + this.userToFollow.screenName + "/blocked", _.bind(this._handleBlock, this))] | |
}).methods({ | |
_handleBlock: function (e) { | |
e.getKey() === this.account.getKey() && (this.state = "blocked", this.updateButtonState()) | |
}, | |
handleFollowInfoResponse: function (e) { | |
this.state = e.relationship.source.blocking === !0 ? "blocked" : e.relationship.source.following === !0 ? "following" : "stranger", this.updateButtonState() | |
}, | |
handleFollowInfoError: function () { | |
this.following = !1, this.blocking = !1, this.updateButtonState() | |
}, | |
handleClick: function () { | |
var e = this.account; | |
if (!this.$followButton.prop("disabled")) { | |
switch (this.state) { | |
case "me": | |
TD.util.openURL("https://twitter.com/settings/profile"); | |
break; | |
case "blocked": | |
this.userToFollow.unblock(e, null, _.bind(this.unblockError, this)), this.state = "stranger"; | |
break; | |
case "pending": | |
case "following": | |
this.userToFollow.unfollow(e, null, _.bind(this.unfollowError, this)), this.state = "stranger"; | |
break; | |
case "stranger": | |
this.userToFollow.follow(e, _.bind(this.followResponse, this), _.bind(this.followError, this)), this.state = "following" | |
} | |
this.updateButtonState() | |
} | |
}, | |
followError: function () { | |
this.state = "stranger", this.updateButtonState() | |
}, | |
unfollowError: function () { | |
this.state = "following", this.updateButtonState() | |
}, | |
unblockError: function () { | |
this.state = "blocked", this.updateButtonState() | |
}, | |
followResponse: function (e) { | |
e.isProtected && (this.state = "pending", this.updateButtonState()) | |
}, | |
updateButtonState: function () { | |
switch (this.$followButton.prop("disabled", !1), this.$followButtonHolder.removeClass("s-not-following s-following s-pending s-blocking"), this.state) { | |
case "me": | |
this.$followButtonHolder.addClass("s-thats-you"); | |
break; | |
case "blocked": | |
this.$followButtonHolder.addClass("s-blocking"); | |
break; | |
case "pending": | |
this.$followButtonHolder.addClass("s-pending"); | |
break; | |
case "following": | |
this.$followButtonHolder.addClass("s-following"); | |
break; | |
case "stranger": | |
this.$followButtonHolder.addClass("s-not-following") | |
} | |
}, | |
destroy: function () { | |
_.each(this.subscriptions, function (e) { | |
$.unsubscribe(e) | |
}), this.supr() | |
} | |
}), TD.components.AddToCustomTimelineDialog = TD.components.BaseModal.extend(function (e) { | |
var t = TD.storage.accountController.getAccountsForService("twitter"); | |
return this.myCustomTimelines = [], this.tweetToAdd = e, this.tweetToAdd.user.isProtected ? void this.destroy() : (t.forEach(function (t) { | |
var i = TD.controller.clients.getClient(t.getKey()); | |
this.myCustomTimelines = this.myCustomTimelines.concat(i.customTimelines), i.getCustomTimelines(null, e.id, function (e) { | |
for (var t = 0; t < e.length; t++) this.$find('[data-id="' + e[t].id + '"]').prop("checked", !0) | |
}.bind(this)) | |
}.bind(this)), this.myCustomTimelines.sort(function (e, t) { | |
return e.name.toLowerCase() > t.name.toLowerCase() | |
}), this.$node.removeClass("s-short").addClass("s-fluid s-wide cmp"), this.$title.html(" " + TD.i("Include Tweet in:")), this.$menuContainer.html(TD.ui.template.render("actions/add_to_customtimeline_dialog", this)).addClass("with-scroll scroll-v scroll-alt").toggleClass("scroll-styled-v", TD.globalRenderOptions.styledScrollbar), this.$checkboxes = this.$find(".js-mdl-content input").click(_.bind(this._changeSubscription, this)), $(".js-dismiss", this.$node).click(_.bind(this.destroy, this)), $("#actions-modal").html(this.$node).show(), this.$checkboxes.first().focus(), this.handleHasCustomTimelines = function (e, t) { | |
t.enabled || this.destroy() | |
}.bind(this), $(document).on("uiFeatureCustomTimelines", this.handleHasCustomTimelines), void $(document).trigger("uiNeedsFeatureCustomTimelines")) | |
}).methods({ | |
_render: function () { | |
return $(TD.ui.template.render("short_modal", { | |
title: TD.i("Your collections"), | |
hasDoneButton: !0 | |
})) | |
}, | |
_changeSubscription: function (e) { | |
var t = $(e.target), | |
i = t.attr("data-id"), | |
n = "checked" === t.attr("checked"), | |
r = t.attr("data-account"), | |
s = n ? "uiAddTweetToCustomTimeline" : "uiRemoveTweetFromCustomTimeline"; | |
$(document).trigger(s, { | |
id: i, | |
account: r, | |
tweetId: this.tweetToAdd.id | |
}) | |
}, | |
destroy: function (e) { | |
$(document).off("uiHasCustomTimelines", this.handleHasCustomTimelines), this.$node.remove(), $("#actions-modal").hide(), e && e.preventDefault(), this.supr() | |
} | |
}), TD.components.AddToListsDialog = TD.components.BaseModal.extend(function (e) { | |
this.myLists = [], this.userToAdd = e, this._setupAccountHandler(), this._requestAccountData(), this.$node.removeClass("s-short").addClass("s-fluid s-wide cmp"), this.$title.html(" " + TD.i("Include {{>text/user_link_screenname}} in:", e)), this.$menuContainer.html(TD.ui.template.render("actions/add_to_list_dialog", this)).addClass("with-scroll scroll-v scroll-alt").toggleClass("scroll-styled-v", TD.globalRenderOptions.styledScrollbar), this.$find(".js-mdl-content input").click(this._changeSubscription.bind(this)), this.$createListButton = this.$find(".js-create-list"), this.$createListButton.click(_.bind(this._createList, this)), this.setAndShowContainer($("#actions-modal")) | |
}).methods({ | |
_render: function () { | |
return $(TD.ui.template.render("short_modal", { | |
title: TD.i("Your lists"), | |
hasDoneButton: !0 | |
})) | |
}, | |
_changeSubscription: function (e) { | |
var t = $(e.target), | |
i = t.attr("id"), | |
n = t.prop("checked"), | |
r = t.attr("data-account"), | |
s = TD.controller.clients.getClient(r), | |
o = TD.storage.Feed.generateKeyFor(r, "list", { | |
listId: i | |
}), | |
a = TD.controller.feedManager.getPoller(o), | |
c = this; | |
n ? s.addUserToList(i, this.userToAdd.screenName, function () { | |
a && _.delay(function () { | |
a.refresh(!0, !0) | |
}, 1e3) | |
}) : s.removeUserFromList(i, this.userToAdd.screenName, function () { | |
a && a.removeWhere(function (e) { | |
return c.userToAdd.id === e.user.id | |
}) | |
}) | |
}, | |
_createList: function () { | |
this.destroy(); | |
var e = new TD.components.ListDetails; | |
e.autoAddMember(this.userToAdd) | |
}, | |
_handleAccountsData: function (e, t) { | |
var i = this; | |
t.accounts.forEach(function (e) { | |
var t = TD.controller.clients.getClient(e.accountKey), | |
n = TD.cache.lists.getListsFor(e.accountKey).filter(function (e) { | |
return e.isOwnList() | |
}); | |
i.myLists = i.myLists.concat(n.sort(function (e, t) { | |
return e.name.toLowerCase() > t.name.toLowerCase() | |
})), t.getListMemberships(i.userToAdd.screenName, !0, function (e) { | |
e.forEach(function (e) { | |
document.getElementById(e.id).checked = !0 | |
}) | |
}) | |
}) | |
}, | |
_setupAccountHandler: function () { | |
this._boundHandleAccountsData = this._handleAccountsData.bind(this), $(document).on("dataAccounts", this._boundHandleAccountsData) | |
}, | |
_requestAccountData: function () { | |
$(document).trigger("uiNeedsAccounts") | |
}, | |
destroy: function (e) { | |
$(document).off("dataAccounts", this._boundHandleAccountsData), this.$node.remove(), $("#actions-modal").hide(), e && e.preventDefault(), this.supr() | |
} | |
}), TD.components.ActionDialog = TD.components.BaseModal.extend(function (e) { | |
this.tweet = e, this.$node.removeClass("js-modal-panel s-tall-fixed").addClass("cmp s-inreply l-no-txtarea s-fluid-height"), this.mainUser = e.getMainUser(), this.$find(".mdl-inner").replaceWith($(TD.ui.template.render("actions/action_dialog", { | |
isProtected: this.mainUser.isProtected | |
}))), this.$inreplyToHolder = this.$find(".js-inreply"), this.header = new TD.components.ActionHeader, this.header.$node.bind(TD.components.ActionHeader.CLOSE, this.destroy.bind(this)), this.$find(".mdl-header").prepend(this.header.$node), this.$buttons = this.$find(".js-action-button"), this.$buttons.click(this._handleClick.bind(this)), this.$retweetButton = this.$find(".js-retweet-button"), this._boundRetweet = this._retweet.bind(this), this._boundHandleRetweet = this._handleRetweet.bind(this), this._boundHandleRetweetFailure = this._handleRetweetFailure.bind(this), $(document).on("uiSendRetweetAction", this._boundRetweet), $(document).on("dataRetweetSuccess", this._boundHandleRetweet), $(document).on("dataRetweetError", this._boundHandleRetweetFailure), this.displayTweet(e), this.header.accountSelector.$node.on(TD.components.AccountSelector.CHANGE, this._handleAccountSelectionChange.bind(this)), this.header.accountSelector.selectAccounts([e.account.getKey()]), this.setAndShowContainer($("#actions-modal")) | |
}).methods({ | |
displayTweet: function (e) { | |
var t = e; | |
t && (t.withAvatar = !0, this.$inreplyToHolder.html(TD.ui.template.render("status/tweet_single", t)).show()) | |
}, | |
_quote: function () { | |
var e = this.header.accountSelector.getSelectedAccounts(), | |
t = e.map(function (e) { | |
return e.account | |
}); | |
$(document).trigger("uiComposeTweet", { | |
text: this.tweet.getMainTweet().getQuoteText(), | |
from: t, | |
isEditAndRetweet: !0 | |
}) | |
}, | |
_retweet: function () { | |
this.$buttons.prop("disabled", !0); | |
var e = this.header.accountSelector.getSelectedAccounts(), | |
t = e.map(function (e) { | |
return e.account | |
}); | |
$(document).trigger("uiRetweet", { | |
id: this.tweet.id, | |
from: t | |
}) | |
}, | |
_handleClick: function (e) { | |
var t = $(e.target); | |
if (t.hasClass("is-disabled")) return !1; | |
var i = t.data("action"); | |
switch (i) { | |
case "quote": | |
this._quote(), this.destroy(); | |
break; | |
case "retweet": | |
this._retweet() | |
} | |
}, | |
_handleAccountSelectionChange: function (e, t) { | |
var i = t.selectedAccounts, | |
n = i.some(function (e) { | |
var t = TD.storage.accountController.get(e.uid); | |
return t ? this.mainUser.id === "" + t.getUserID() : !1 | |
}, this), | |
r = n && 1 === i.length, | |
s = !i.length, | |
o = s || r; | |
this.$retweetButton.toggleClass("is-disabled", o), r ? (this.$retweetButton.addClass("js-show-tip"), this.$retweetButton.attr("title", TD.i("You cannot retweet your own Tweet."))) : (this.$retweetButton.removeClass("js-show-tip"), this.$retweetButton.removeAttr("title")) | |
}, | |
_handleRetweet: function () { | |
this.tweet.setRetweeted(!0), this.destroy() | |
}, | |
_handleRetweetFailure: function (e, t) { | |
var i = TD.i("Failed: Retweet"); | |
t.response.errors && t.response.errors.forEach(function (e) { | |
i += " - " + e.message | |
}), TD.controller.progressIndicator.addMessage(i), this.$buttons.prop("disabled", !1) | |
}, | |
destroy: function () { | |
$(document).off("uiSendRetweetAction", this._boundRetweet), $(document).off("dataRetweetSuccess", this._boundHandleRetweet), $(document).off("dataRetweetError", this._boundHandleRetweetFailure), this.header.accountSelector.$node.off(TD.components.AccountSelector.CHANGE), $("#actions-modal").hide(), this.header.destroy(), this.supr() | |
} | |
}), TD.components.ActionHeader = TD.components.Base.extend(function () { | |
var e = this; | |
this.accountsVisible = !1, this.$node = $.createElement("div"), this.$node.append($(TD.ui.template.render("actions/action_header"))), this.accountSelector = new TD.components.AccountSelector, this.$node.append(this.accountSelector.$node), this.$composeUsernames = this.$find("h3"), this.$actionText = this.$find("span"), this.$showAccountsToggle = this.$find(".js-accounts-toggle"), this.$showAccountsToggle.click(_.bind(this.toggleAccountsVisibility, this)), this.accountSelector.$node.bind(TD.components.AccountSelector.CHANGE, function () { | |
var t = _.map(e.accountSelector.getSelectedAccounts(), function (e) { | |
return e.username | |
}), | |
i = TD.i("From {{accounts}}", { | |
accounts: t.join(", ") | |
}); | |
e.$composeUsernames.text(i) | |
}), this.accountSelector.selectDefaultAccount(), this.toggleAccountsVisibility() | |
}).statics({ | |
CHANGE: "td-accounts-change", | |
CLOSE: "td-dialog-close" | |
}).methods({ | |
toggleAccountsVisibility: function () { | |
this.accountsVisible ? (this.$actionText.text(TD.i("Change")), this.accountSelector.hide()) : (this.$actionText.text(TD.i("Hide")), this.accountSelector.show()), this.accountsVisible = !this.accountsVisible | |
}, | |
destroy: function () { | |
this.accountSelector.destroy(), this.supr() | |
} | |
}), TD.components.GlobalSettings = TD.components.BaseModal.extend(function () { | |
var e = TD.storage.accountController.isEmpty() ? "accounts" : "general"; | |
this.$optionList = this.$find(".js-setting-list li"), $("a.list-link", this.$node).click(function (e) { | |
var t = $(e.currentTarget), | |
i = t.data("action"); | |
this.switchTab(i) | |
}.bind(this)), this.setAndShowContainer($("#settings-modal"), !1), this.switchTab(e) | |
}).methods({ | |
_render: function () { | |
return $(TD.ui.template.render("short_modal", { | |
title: TD.i("Settings"), | |
content: TD.ui.template.render("settings/global_settings_modal", this.getInfo()), | |
hasDoneButton: !0, | |
centeredFooter: !0 | |
})) | |
}, | |
getInfo: function () { | |
var e = { | |
tabs: [{ | |
title: TD.i("General"), | |
action: "general" | |
}, { | |
title: TD.i("Accounts"), | |
action: "accounts" | |
}, { | |
title: TD.i("Services"), | |
action: "services" | |
}, { | |
title: TD.i("Mute"), | |
action: "filter" | |
}] | |
}; | |
return e | |
}, | |
switchTab: function (e) { | |
if (e !== this.currentTabName) { | |
switch (this.$optionList.removeClass("selected"), this.currentTab && this.currentTab.destroy(), e) { | |
case "general": | |
this.currentTab = new TD.components.GeneralSettings; | |
break; | |
case "accounts": | |
this.currentTab = new TD.components.AccountSettings; | |
break; | |
case "services": | |
this.currentTab = new TD.components.ServicesSettings; | |
break; | |
case "filter": | |
this.currentTab = new TD.components.FilterSettings | |
} | |
this.currentTabName = e, this.$optionList.find("[data-action=" + e + "]").parent("li").addClass("selected") | |
} | |
}, | |
destroy: function (e) { | |
this.currentTab && this.currentTab.destroy(), $("#settings-modal").hide(), e && e.preventDefault(), this.supr() | |
} | |
}), TD.components.AccountSettings = TD.components.Base.extend(function () { | |
this.$node = $(TD.ui.template.render("settings/global_setting_account", { | |
withTweetdeckAccount: "tweetdeck" === TD.storage.store.getCurrentAuthType() | |
})), $("#global-settings").append(this.$node), this.$accountHolder = $(".js-account-container"), this.$resetPasswordButton = $(".js-reset-password"), this.$resetPasswordButton.click(this.handleResetTweetdeckPassword.bind(this)), this.$resetPasswordErrorMessage = this.$find(".js-reset-error"), this.$resetPasswordSuccessMessage = this.$find(".js-reset-success"), this.$resetProgressSpinner = this.$find(".js-reset-progress"), this.boundRefreshAccounts = this.refreshAccounts.bind(this), this.subscriptions = [$.subscribe("/storage/account/new", this.boundRefreshAccounts), $.subscribe("/storage/account/blacklisted", this.boundRefreshAccounts), $.subscribe("/storage/client/default_account_changed", this.setDefaultAccount.bind(this))], this.refreshAccounts(), $(".js-add-account").on("click", this.handleAddAccount.bind(this)), this.$node.on("click", ".js-remove-account", this.handleRemoveAccount.bind(this)), this.$node.on("click", ".js-set-default", this.handleSetDefaultClick.bind(this)) | |
}).methods({ | |
handleRemoveAccount: function (e) { | |
var t = $(e.target), | |
i = t.data("account"), | |
n = _.uniqueId(), | |
r = { | |
id: n, | |
title: TD.i("Removing account!"), | |
message: TD.i("Are you sure you want to remove account '{{1}}' from TweetDeck?", { | |
1: TD.storage.accountController.get(i).getUsername() | |
}), | |
okLabel: TD.i("Remove"), | |
cancelLabel: TD.i("Cancel") | |
}, | |
s = function (e, t) { | |
t.id === n && ($(document).off("uiConfirmationAction", s), t.result && TD.controller.clients.removeClient(i)) | |
}; | |
$(document).on("uiConfirmationAction", s).trigger("uiShowConfirmationDialog", r) | |
}, | |
handleAddAccount: function (e) { | |
var t = $(e.target); | |
TD.controller.clients.addClient(t.data("service")) | |
}, | |
handleSetDefaultClick: function (e) { | |
var t = $(e.target), | |
i = t.data("account"); | |
i && (TD.storage.accountController.setDefault(i), $(document).trigger("uiSelectDefaultAccount")) | |
}, | |
refreshAccounts: function () { | |
var e = TD.storage.accountController.getAccountsForService("twitter"), | |
t = ""; | |
t += TD.ui.template.render("settings/global_setting_account_row", { | |
accounts: e, | |
isTwitter: !0 | |
}), this.$accountHolder.html(t), this.setDefaultAccount(), this.setLoginAccount() | |
}, | |
setDefaultAccount: function () { | |
var e = TD.storage.accountController.getDefault(); | |
if (e) { | |
var t = $(".js-is-default-account"), | |
i = $(".js-set-default"); | |
t.addClass("is-hidden"), i.removeClass("is-hidden"), t.filter('[data-account="' + e.getKey() + '"]').removeClass("is-hidden"), i.filter('[data-account="' + e.getKey() + '"]').addClass("is-hidden") | |
} | |
}, | |
setLoginAccount: function () { | |
var e = TD.storage.store.getTwitterLoginAccount(); | |
e && $('.js-remove-account[data-account="twitter:' + e.getUserID() + '"]').removeClass("js-remove-account").addClass("is-disabled js-show-tip").attr("title", TD.i("You cannot remove the Twitter account you signed in with")) | |
}, | |
destroy: function () { | |
this.$node.remove(), _.each(this.subscriptions, function (e) { | |
$.unsubscribe(e) | |
}) | |
}, | |
handleResetTweetdeckPassword: function () { | |
var e, t; | |
this.$resetPasswordButton.prop("disabled", !0), this.$resetPasswordErrorMessage.addClass("is-hidden"), this.$resetProgressSpinner.removeClass("is-hidden"), t = TD.storage.store.getTweetdeckAccount(), e = TD.controller.clients.getTDClient().forgotPassword(t), e.addCallbackWith(this, function () { | |
this.$resetPasswordSuccessMessage.removeClass("is-hidden"), this.$resetPasswordErrorMessage.addClass("is-hidden"), this.$resetProgressSpinner.addClass("is-hidden") | |
}), e.addErrbackWith(this, function () { | |
this.$resetPasswordErrorMessage.removeClass("is-hidden"), this.$resetProgressSpinner.addClass("is-hidden"), this.$resetPasswordButton.prop("disabled", !1) | |
}) | |
} | |
}), TD.components.FilterSettings = TD.components.Base.extend(function () { | |
this.$globalSettings = $("#global-settings"), this.$globalSettings.submit(_.bind(this.handleAddFilter, this)), this.$node = $(TD.ui.template.render("settings/global_setting_filter", {})), this.$globalSettings.append(this.$node), this.$filterHolder = $("#filter-results"), this.$node.on("click", ".js-remove-filter", _.bind(this.handleRemoveFilter, this)), this.$addFilterInput = $("#filter-input"), this.$addFilterInput.keyup(_.bind(this._validateFilter, this)), this.$filterTypes = $("#filter-types"), this.$filterTypes.change(_.bind(this.handleFilterTypeChange, this)), this.$addFilterButton = $("#add-filter"), this.$addFilterButton.click(_.bind(this.handleAddFilter, this)), this.handleFilterTypeChange(), this.refreshFilters() | |
}).methods({ | |
_validateFilter: function () { | |
var e = this.$filterTypes.val(), | |
t = this.$addFilterInput.val(), | |
i = TD.controller.filterManager.validateFilter(e, t); | |
return i ? this.$addFilterButton.removeAttr("disabled") : this.$addFilterButton.attr("disabled", "disabled"), i | |
}, | |
handleAddFilter: function (e) { | |
if (e.preventDefault(), this._validateFilter()) { | |
var t = this.$filterTypes.val(), | |
i = this.$addFilterInput.val(); | |
TD.controller.filterManager.addFilter(t, i), this.refreshFilters(), this.$addFilterInput.val("") | |
} | |
}, | |
handleRemoveFilter: function (e) { | |
var t = $(e.target); | |
TD.controller.filterManager.removeFilter(t.data("id")), this.refreshFilters() | |
}, | |
handleFilterTypeChange: function () { | |
var e, t = this.$filterTypes.val(); | |
switch (t) { | |
case TD.vo.Filter.PHRASE: | |
e = TD.i("eg iPad"); | |
break; | |
case TD.vo.Filter.SENDER: | |
e = TD.i("eg @JohnDoe123"); | |
break; | |
case TD.vo.Filter.SOURCE: | |
e = TD.i("eg TweetSpamApp") | |
} | |
this.$addFilterInput.attr("placeholder", e), this._validateFilter() | |
}, | |
refreshFilters: function () { | |
var e = TD.controller.filterManager.getAll(), | |
t = ""; | |
_.each(e, function (e) { | |
t += TD.ui.template.render("settings/global_setting_filter_row", e) | |
}), this.$filterHolder.html(t), this._validateFilter() | |
}, | |
destroy: function () { | |
this.$node.off("click", ".js-remove-filter"), this.$globalSettings.unbind("submit"), this.$node.remove() | |
} | |
}), TD.components.ServicesSettings = TD.components.Base.extend(function () { | |
this.$node = $(TD.ui.template.render("settings/global_setting_services", {})); | |
var e = TD.storage.accountController.getAccountsForService("bitly"); | |
e.length > 0 && (this.bitlyAccount = e[0]), $("#global-settings").append(this.$node), this.$bitlyForm = $("#bitly-form"), this.$bitlyUsername = $("#bitly-email"), this.$bitlyKey = $("#bitly-key"), this.$linkShorteners = $("#link-shortening"), this.$linkShorteners.change(_.bind(this.handleLinkShortenerChange, this)), this.setLinkShortener() | |
}).methods({ | |
handleLinkShortenerChange: function () { | |
var e = this.$linkShorteners.val(); | |
e = e.split("-")[1], TD.settings.setLinkShortener(e), this.setLinkShortener() | |
}, | |
setLinkShortener: function () { | |
var e = TD.settings.getLinkShortener(); | |
this.$linkShorteners.val("link-" + e), "bitly" == e ? (this.$bitlyForm.show(), this.bitlyAccount && (this.$bitlyUsername.val(this.bitlyAccount.getUserID()), this.$bitlyKey.val(this.bitlyAccount.getOAuthToken()))) : this.$bitlyForm.hide() | |
}, | |
commitBitlyChanges: function (e, t) { | |
var i = this.$bitlyUsername.val(), | |
n = this.$bitlyKey.val(); | |
return e && t && TD.storage.accountController.blacklistAccount(e), !e || t ? (e = new TD.storage.Account, e.setType("bitly"), e.setOAuthToken(n), e.setUserID(i), e.computeKey(), void TD.storage.accountController.manage(e)) : void e.setOAuthToken(n) | |
}, | |
destroy: function () { | |
var e = TD.settings.getLinkShortener(); | |
if ("bitly" == e) { | |
var t = this.bitlyAccount, | |
i = this.$bitlyUsername.val(), | |
n = this.$bitlyKey.val(); | |
i && n && (!t || t.getUserID() == i && t.getOAuthToken() == n ? t || this.commitBitlyChanges() : this.commitBitlyChanges(t, t.getUserID() != i)) | |
} | |
this.$node.remove() | |
} | |
}), TD.components.GeneralSettings = TD.components.Base.extend(function () { | |
var e = { | |
version: TD.version, | |
buildIDShort: TD.buildIDShort, | |
appEnv: TD.util.getAppEnv() | |
}; | |
TD.util.isWrapperApp() && deck.getWrapperVersion && (e.wrapperVersion = deck.getWrapperVersion()), this.$node = $(TD.ui.template.render("settings/global_setting_general", e)), $("#global-settings").append(this.$node), this.$streamingForm = this.$find(".js-streaming-form"), this.$streamingUpdates = $("#streaming-updates"), this.$streamingUpdates.change(this.handleStreamingChange.bind(this)), this.setStreaming(), this.$checkForUpdatesForm = this.$find(".js-check-updates-form"), this.$checkForUpdates = $("#check-for-updates"), this.$checkForUpdates.change(this.handleCheckForUpdatesChange.bind(this)), this.setCheckForUpdates(), this.$showStartupNotifications = $("#show-startup-notifications"), this.$showStartupNotifications.change(this.handleShowStartupNotificationsChange.bind(this)), this.setShowStartupNotifications(), this.$displaySensitiveMedia = $("#display-sensitive-media"), this.$displaySensitiveMedia.change(this.handleDisplaySensitiveMediaChange.bind(this)), this.setDisplaySensitiveMedia(), this.$minimizeToTray = $("#minimize-to-tray"), TD.util.isWrapperApp() && deck.getMinimizeToTraySetting && deck.setMinimizeToTraySetting ? (this.$minimizeToTray.change(this.handleMinimizeToTrayChange.bind(this)), this.setMinimizeToTray()) : this.$minimizeToTray.closest(".js-minimize-to-tray").remove(), this.$columnSizeRadios = $(".js-column-size-radio"), this.$columnSizeRadios.change(this.handleColumnWidthChange.bind(this)), this.setColumnWidth(), this.$fontSizeRadioButtons = $(".js-font-size-radio"), this.$fontSizeRadioButtons.change(this.handleFontSizeChange.bind(this)), this.setFontSize(), this.$themeSwitcherRadios = $(".js-theme-radio"), this.$themeSwitcherRadios.change(this.handleThemeSwitcherChange.bind(this)), this.setTheme() | |
}).methods({ | |
handleStreamingChange: function () { | |
var e = this.$streamingUpdates.prop("checked"); | |
TD.settings.setUseStream(e) | |
}, | |
setStreaming: function () { | |
this.$streamingUpdates.prop("checked", TD.settings.getUseStream()) | |
}, | |
handleCheckForUpdatesChange: function () { | |
var e = this.$checkForUpdates.prop("checked"); | |
TD.settings.setCheckForUpdates(e), this.setStreaming() | |
}, | |
setCheckForUpdates: function () { | |
this.$checkForUpdatesForm.hide() | |
}, | |
handleShowStartupNotificationsChange: function () { | |
var e = this.$showStartupNotifications.prop("checked"); | |
TD.settings.setShowStartupNotifications(e) | |
}, | |
setShowStartupNotifications: function () { | |
this.$showStartupNotifications.prop("checked", TD.settings.getShowStartupNotifications()) | |
}, | |
handleDisplaySensitiveMediaChange: function () { | |
var e = this.$displaySensitiveMedia.prop("checked"); | |
TD.settings.setDisplaySensitiveMedia(e) | |
}, | |
setDisplaySensitiveMedia: function () { | |
this.$displaySensitiveMedia.prop("checked", TD.settings.getDisplaySensitiveMedia()) | |
}, | |
setFontSize: function () { | |
var e = TD.settings.getFontSize(), | |
t = $('.js-font-size-radio[value="' + e + '"]'); | |
t.prop("checked", !0) | |
}, | |
handleFontSizeChange: function (e) { | |
var t; | |
e.currentTarget.checked && (t = e.currentTarget.value, TD.settings.setFontSize(t)) | |
}, | |
setColumnWidth: function () { | |
var e = TD.settings.getColumnWidth(), | |
t = $('.js-column-size-radio[value="' + e + '"]'); | |
t.prop("checked", !0) | |
}, | |
handleColumnWidthChange: function (e) { | |
var t; | |
e.currentTarget.checked && (t = e.currentTarget.value, TD.settings.setColumnWidth(t)) | |
}, | |
handleThemeSwitcherChange: function () { | |
$(document).trigger("uiToggleTheme") | |
}, | |
setTheme: function () { | |
var e = TD.settings.getTheme(), | |
t = $('.js-theme-radio[value="' + e + '"]'); | |
t.prop("checked", !0) | |
}, | |
handleMinimizeToTrayChange: function () { | |
if (TD.util.isWrapperApp() && deck.setMinimizeToTraySetting) { | |
var e = this.$minimizeToTray.prop("checked"); | |
deck.setMinimizeToTraySetting(e) | |
} | |
}, | |
setMinimizeToTray: function () { | |
TD.util.isWrapperApp() && deck.getMinimizeToTraySetting && this.$minimizeToTray.prop("checked", deck.getMinimizeToTraySetting()) | |
} | |
}), TD.components.AccountSelector = TD.components.Base.extend(function () { | |
var e = this; | |
this.$node = $.createElement("ul").addClass("accs cf js-account-selector"), this.cachedSelectedAccounts = [], this.accountIndex = {}, this.refreshPostingAccounts(), this.$node.on("click", ".js-account-item", function (t) { | |
var i = $(t.currentTarget); | |
t.stopPropagation(), t.shiftKey ? ($("li", e.$node).removeClass(TD.components.AccountSelector.SELECTED_CLASS), i.addClass(TD.components.AccountSelector.SELECTED_CLASS)) : i.toggleClass(TD.components.AccountSelector.SELECTED_CLASS), e.updateSelectedAccounts() | |
}), this.subscription = $.subscribe("/storage/client/account_whitelist_changed", _.bind(this.refreshPostingAccounts, this)) | |
}).statics({ | |
CHANGE: "td-accounts-change", | |
SELECTED_CLASS: "acc-selected" | |
}).methods({ | |
refreshPostingAccounts: function () { | |
var e, t, i, n, r = TD.storage.accountController.getPostingAccounts(), | |
s = []; | |
for (this.accountIndex = {}, e = 0; e < r.length; e++) t = r[e], i = t.getKey(), s.push(i), this.accountIndex[i] = { | |
account: i, | |
uid: i, | |
type: "account", | |
username: t.getUsername(), | |
service: t.getType(), | |
picture: t.getProfileImageURL() | |
}; | |
var o = function (e, t, i) { | |
var n = { | |
accounts: [], | |
show_acc_toggle: i | |
}; | |
return n.accounts = _.map(e, function (e) { | |
return t[e] | |
}), n | |
}; | |
s.length && (n = TD.ui.template.render("compose/accounts", o(s, this.accountIndex, !0)), this.$node.html(n)) | |
}, | |
getSelectedAccounts: function () { | |
var e, t, i = []; | |
if (this.cachedSelectedAccounts) return this.cachedSelectedAccounts.concat(); | |
e = $("." + TD.components.AccountSelector.SELECTED_CLASS, this.$node); | |
for (var n = 0; n < e.length; n++) t = e[n].attributes["data-id"].value, i.push(this.accountIndex[t]); | |
return this.cachedSelectedAccounts = i, i | |
}, | |
selectAccounts: function (e) { | |
var t, i = this.$node.find(".js-account-item"); | |
if (_.isArray(e) && (i.removeClass(TD.components.AccountSelector.SELECTED_CLASS), e && e.length)) { | |
for (t = 0; t < e.length; t++) e[t] && i.filter("li[data-id='" + e[t] + "']").addClass(TD.components.AccountSelector.SELECTED_CLASS); | |
this.updateSelectedAccounts() | |
} | |
}, | |
selectDefaultAccount: function () { | |
var e = TD.storage.accountController.getDefault(); | |
e && this.selectAccounts([e.getKey()]) | |
}, | |
updateSelectedAccounts: function () { | |
this.cachedSelectedAccounts = null; | |
var e = this.getSelectedAccounts(); | |
this.$node.trigger(TD.components.AccountSelector.CHANGE, { | |
selectedAccounts: e | |
}) | |
}, | |
destroy: function () { | |
$.unsubscribe(this.subscription), this.$node.off("click", ".js-account-item"), this.supr() | |
} | |
}), TD.vo.Column = function (e, t) { | |
TD.sync.util.assert(e, "must provide sColumn to create aColumn"), this.model = e, TD.sync.util.assert(this.model.getKey(), "vo.Column will most likely fail if your column has no key"), this.ui = new TD.ui.Column(this.model.getKey()), this._feeds = [], this.filters = [], this.description = "", this.updateArray = [], this.updateIndex = {}, this.scribedImpressionIDs = new TD.cache.LRUQueue(200), this._isUpdating = !0, this.feedSubscriptions = {}, this.deleteSubscriptions = {}, this.visible = !0, this.visibility = { | |
columnWidth: 0, | |
visibleWidth: 0, | |
visibleHeight: 0, | |
visibleFraction: 0 | |
}, this.temporary = !1, this.detailViewComponent = null, this.feedsFetched = 0, this.isFirstFetch = !0, this.isFetchingOlderUpdates = !1, this.lastInfiniteScrollTime = null, this.isShowingLoadMore = !1, this.isExhausted = !1, this.isEmergencyPaused = !1, this.fetchesPaused = !1, this.CHIRP_BLOCK_SIZE = 20, this.COLUMN_CHIRP_LIMIT = 20, this.sortFunction = "scheduled" === this.model.getType() ? TD.util.chirpAscSort : TD.util.chirpDescSort, this.loadFeeds(), this.loadFilters(), t && this.setFeeds(t), this.isFilterable() || this.updateSearchFilter(new TD.vo.SearchFilter), this.COLUMN_MINIMALIST_TWEET_TPM_THRESHOLD = 750, this.streamRate = 0; | |
var i = this.updateStreamRate.bind(this); | |
$(document).on("dataStreamRate", i), this.tpm = 0; | |
var n = this.updateTpm.bind(this), | |
r = "dataColumn" + this.model.getKey() + "Tpm"; | |
$(document).on(r, n), this.tpmCounter = new TD.util.TpmCounter(500, 5e3, r), this.STREAM_ITEM_CONTENT_SELECTOR = ".js-stream-item-content", this.STREAM_ITEM_SELECTOR = ".js-stream-item", $.subscribe("/storage/client/settings/display_sensitive_media", this.reloadTweets.bind(this)) | |
}, TD.vo.Column.MEDIA_PREVIEW_OFF = "off", TD.vo.Column.MEDIA_PREVIEW_SIZE_SMALL = "small", TD.vo.Column.MEDIA_PREVIEW_SIZE_MEDIUM = "medium", TD.vo.Column.MEDIA_PREVIEW_SIZE_LARGE = "large", TD.vo.Column.prototype.reset = function () { | |
this.updateArray = [], this.updateIndex = {}, this.feedsFetched = 0, this.isFirstFetch = !0, this.temporary = !1, this.isFetchingOlderUpdates = !1, this.lastInfiniteScrollTime = null, this.refreshSubscriptions() | |
}, TD.vo.Column.prototype.clone = function () { | |
return TD.controller.columnManager.makeColumn(this.model.getType(), this.getFeeds(), this.model.getFilters()) | |
}, TD.vo.Column.prototype.updateStreamRate = function (e, t) { | |
this.streamRate = t.itemsPerMinute | |
}, TD.vo.Column.prototype.updateTpm = function (e, t) { | |
this.tpm = t.itemsPerMinute | |
}, TD.vo.Column.prototype.loadFeeds = function () { | |
if (this.model.managed) { | |
var e = this.model.getFeedKeys(); | |
if (_.isUndefined(e)) return void TD.sync.util.stateLog("loadFeeds() not loading feeds for", this, "given", this.model.state); | |
this._feeds = []; | |
for (var t = 0; t < e.length; t++) { | |
var i = TD.storage.feedController.get(e[t]); | |
this._feeds.push(i) | |
} | |
this.refreshSubscriptions() | |
} | |
}, TD.vo.Column.prototype.getFeeds = function () { | |
return this._feeds.concat() | |
}, TD.vo.Column.prototype.getFeedCount = function () { | |
return this._feeds.length | |
}, TD.vo.Column.prototype.getFeedsByType = function (e) { | |
return this.getFeeds().filter(function (t) { | |
return t.getType() === e | |
}) | |
}, TD.vo.Column.prototype.setFeeds = function (e) { | |
this._feeds = e; | |
for (var t = [], i = 0; i < this._feeds.length; i++) t.push(this._feeds[i].getKey()); | |
this.model.setFeedKeys(t), this.refreshSubscriptions(), this.model.managed && TD.storage.feedController.manageFeeds(this._feeds) | |
}, TD.vo.Column.prototype.addFeed = function (e) { | |
for (var t, i = [], n = 0; n < this._feeds.length; n++) { | |
if (t = _feeds[n].getKey(), t === e.getKey()) return; | |
i.push(t) | |
} | |
this._feeds.push(e), i.push(e.getKey()), this.model.setFeedKeys(i), this.refreshSubscriptions(), this.model.managed && TD.storage.feedController.manageFeeds(this._feeds) | |
}, TD.vo.Column.prototype.addFeeds = function (e) { | |
if (e && 0 !== e.length) { | |
var t, i = [], | |
n = {}; | |
for (e = this._feeds.concat(e), t = 0; t < e.length; t++) n[e[t].getKey()] || (n[e[t].getKey()] = !0, i.push(e[t])); | |
this.setFeeds(i) | |
} | |
}, TD.vo.Column.prototype.removeFeed = function (e) { | |
for (var t, i = [], n = 0, r = this._feeds.length - 1; r >= 0; r--) t = this._feeds[r].getKey(), t === e.getKey() ? (this._feeds.splice(r, 1), n++) : i.push(t); | |
return n > 0 && (this.model.setFeedKeys(i), this.refreshSubscriptions(), this.checkChirpIndex()), n | |
}, TD.vo.Column.prototype.findChirp = function (e) { | |
var t = this.updateIndex[e]; | |
return !t && this.detailViewComponent && (t = this.detailViewComponent.findChirp(e)), t | |
}, TD.vo.Column.prototype.findMostInterestingChirp = function (e) { | |
var t = this.findChirp(e); | |
return t && t instanceof TD.services.TwitterAction && (t = t.getRelatedTweet() || t), t | |
}, TD.vo.Column.prototype.checkChirpIndex = function () { | |
var e = this.model.getFeedKeys(), | |
t = _.map(e, TD.controller.feedManager.getPoller), | |
i = _.filter(this.updateArray, function (e) { | |
return !_.find(t, function (t) { | |
return t.chirpIndex[e.id] | |
}) | |
}); | |
this.removeFromIndex(null, i, !0) | |
}, TD.vo.Column.prototype.refreshSubscriptions = function () { | |
var e, t = {}, | |
i = this.model.getFeedKeys(), | |
n = this; | |
if ("me" === this.model.getType()) { | |
var r = !1, | |
s = []; | |
_.each(i, function (e) { | |
var t = TD.storage.feedController.get(e); | |
t && ("interactions" === t.getType() && (r = !0), "mentions" !== t.getType() && s.push(e)) | |
}), r && (i = s) | |
} | |
for (var o = 0; o < i.length; o++) e = i[o], t[e] = !0, this.feedSubscriptions[e] || (this.feedSubscriptions[e] = $.subscribe("/feed/" + e, function (e, t, i) { | |
n.isEmergencyPaused || n.addToIndex(e, t, i) | |
})), this.deleteSubscriptions[e] || (this.deleteSubscriptions[e] = $.subscribe("/delete/" + e, function (e, t) { | |
n.removeFromIndex(e, t, !0) | |
})); | |
for (e in this.feedSubscriptions) t[e] || ($.unsubscribe(this.feedSubscriptions[e]), delete this.feedSubscriptions[e]); | |
for (e in this.deleteSubscriptions) t[e] || ($.unsubscribe(this.deleteSubscriptions[e]), delete this.deleteSubscriptions[e]) | |
}, TD.vo.Column.prototype.removeSubscriptions = function () { | |
var e; | |
for (e in this.feedSubscriptions) $.unsubscribe(this.feedSubscriptions[e]), delete this.feedSubscriptions[e]; | |
for (e in this.deleteSubscriptions) $.unsubscribe(this.deleteSubscriptions[e]), delete this.deleteSubscriptions[e] | |
}, TD.vo.Column.prototype.fetchUpdatesFromPoller = function (e) { | |
if (!this.isFetchingOlderUpdates && !this.fetchingPaused) { | |
var t, i, n = this, | |
r = null, | |
s = this.updateArray.length, | |
o = 0, | |
a = !1, | |
c = 0, | |
u = function () { | |
var e = n.getFeeds().map(function (e) { | |
var i = TD.controller.feedManager.getPoller(e.getKey()), | |
s = i.fetchOlderChirps(t); | |
return s.addCallback(function (t) { | |
return t = t.filter(function (e) { | |
var t = !r || n.sortFunction(r, e) <= 0; | |
return t && !n.updateIndex[e.id] | |
}), a = !i.isExhausted || a, o += n.addItemsToIndex(t, !0, e, e.getLatestTime()), t.length && (c = Math.max(c, t[t.length - 1].created.getTime())), t | |
}), s | |
}); | |
return new TD.core.defer.DeferredList(e) | |
}, | |
l = function () { | |
if (n.feedsFetched = 0, t = c, c = 0, 0 === o) { | |
if (a) return u(); | |
n.isExhausted = !0 | |
} | |
}; | |
return this.updateArray.length && !e ? (n.lastInfiniteScrollTime = Date.now(), r = this.updateArray[this.updateArray.length - 1], t = r.created.getTime()) : t = Number.MAX_VALUE, this.isFetchingOlderUpdates = !0, this.ui.addInfiniteScrollSpinner(), i = u(), i.addCallback(l), i.addCallback(function () { | |
n.ui.removeInfiniteScrollSpinner(), n.isFetchingOlderUpdates = !1, n.truncate(s + n.CHIRP_BLOCK_SIZE) | |
}), i | |
} | |
}, TD.vo.Column.prototype.addToIndex = function (e, t, i) { | |
var n; | |
return this._isUpdating && (this.ui.getChirpContainer().trigger("dataColumnFeedUpdated"), this.ui.hideChirpContainer(), this.ui.hideIsUpdatingMessage(), this._isUpdating = !1), 0 === t.length ? void(0 === this.updateArray.length && this.ui.showNoResultsMessage(this.temporary, this.isOwnCustomTimeline())) : (this.ui.hideNoResultsMessage(), n = t.concat(), this.addItemsToIndex(n, this.updateArray.length, e.feed, i), void(this.isFirstFetch && (this.feedsFetched++, this.feedsFetched == this.getFeedCount() && (this.truncate(this.CHIRP_BLOCK_SIZE), this.feedsFetched = 0, this.isFirstFetch = !1)))) | |
}, TD.vo.Column.prototype.addItemsToIndex = function (e, t, i, n) { | |
var r, s, o = [], | |
a = this.updateArray.length ? this.updateArray[this.updateArray.length - 1].created.getTime() : 0, | |
c = this.model.getClearedTimestamp(), | |
u = [], | |
l = 0; | |
0 === this.updateArray.length && this.ui.removeInfiniteScrollSpinner(), e.sort(this.sortFunction), r = e.length; | |
for (var d = 0; r > d && (s = e[d], !t && s.created.getTime() < a || s.created.getTime() <= c || !s.passFilters(this.filters) || (_.isUndefined(this.updateIndex[s.id]) || (this.removeFromIndex(null, [s], !1), this.detailViewComponent && this.detailViewComponent.changed(s)), this.updateIndex[s.id] = s, o.push(s), _.isUndefined(n) || (u = u.concat(s.getUnreadChirps(n))), !(o.length > this.CHIRP_BLOCK_SIZE))); d++); | |
if (l = o.length) { | |
for (var h = "", p = [], f = this.updateArray, m = { | |
mediaPreviewSize: this.getMediaPreviewSize(), | |
isOwnCustomTimeline: this.isOwnCustomTimeline(), | |
showVerifiedBadge: this.getShowVerified(), | |
isTemporaryColumn: this.temporary | |
}; o.length > 0 || f.length > 0;) | |
if (0 === o.length) p = p.concat(f), f = []; | |
else if (0 === f.length) p = p.concat(o), this.addToView(h, o, m), o = []; | |
else { | |
for (var g = [], T = f[0], v = o[0]; this.sortFunction(T, v) > 0 && o.length > 0;) s = o.shift(), g.push(s), o.length > 0 && (v = o[0]); | |
g.length > 0 ? (this.addToView(h, g, m), p = p.concat(g)) : (s = f.shift(), p.push(s), s.passFilters(this.filters) && (h = s.id)) | |
} | |
this.updateArray = p | |
} | |
return $.publish("/notifications/new", [{ | |
column: this, | |
feed: i, | |
items: u | |
}]), this.isMessageColumn() && $(document).trigger("uiMessageUnreadCount", { | |
columnKey: this.model.getKey(), | |
count: this.unreadMessageCount() | |
}), l | |
}, TD.vo.Column.prototype.removeFromIndex = function (e, t, i) { | |
for (var n = 0; n < t.length; n++) { | |
var r = t[n]; | |
this.removeChirp(r), i && this.detailViewComponent && this.detailViewComponent.deleted(r) | |
} | |
}, TD.vo.Column.prototype.removeChirp = function (e) { | |
var t = this.updateIndex[e.id]; | |
if (t) { | |
TD.ui.columns.freezeScroll(this.model.getKey()); | |
for (var i = 0; i < this.updateArray.length; i++) | |
if (e = this.updateArray[i], e === t) { | |
this.updateArray.splice(i, 1); | |
break | |
} | |
delete this.updateIndex[e.id], this.ui.removeChirp(e.id), $(document).trigger("uiColumnChirpsChanged", { | |
id: this.model.getKey() | |
}), TD.ui.columns.unfreezeScroll(this.model.getKey()) | |
} | |
}, TD.vo.Column.prototype.clear = function () { | |
if (0 !== this.updateArray.length) { | |
var e = this.updateArray[0].created.getTime(); | |
this.model.setClearedTimestamp(e), this.truncate(0) | |
} | |
}, TD.vo.Column.prototype.truncate = function (e) { | |
var t, i, n, r, s = -1, | |
o = this.getFeeds(); | |
for (this.feedsFetched = 0, 0 === e && TD.ui.columns.unlockColumnScrolling(this.model.getKey()), t = 0; t < o.length; t++) i = TD.controller.feedManager.getPoller(o[t].getKey()), i && (n = i.getRangeStartTime(), n > s && (s = n)); | |
for (r = null, t = this.updateArray.length - 1; t >= 0; t--) | |
if (this.updateArray[t].created.getTime() >= s) { | |
r = t; | |
break | |
} | |
if (null !== r) { | |
for (r = Math.min(e, r + 1), t = this.updateArray.length - 1; t >= r; t--) this.annihilateChirp(this.updateArray[t].id.toString(), this.ui.getChirpContainer()), this.isExhausted = !1; | |
this.updateArray.splice(r, Number.MAX_VALUE) | |
} | |
}, TD.vo.Column.prototype.trimUpdates = function () { | |
var e, t, i, n; | |
if (this.lastInfiniteScrollTime) { | |
if (e = Date.now() - this.lastInfiniteScrollTime, !(e > 6e4)) return; | |
i = Math.floor((this.updateArray.length - this.COLUMN_CHIRP_LIMIT) * (1 - e / 18e4)), this.maxUpdatesPerColumn = Math.max(this.COLUMN_CHIRP_LIMIT + i, this.COLUMN_CHIRP_LIMIT) | |
} | |
if (this.maxUpdatesPerColumn = TD.ui.columns.isFrozen(this.model.getKey()) ? Math.max(this.maxUpdatesPerColumn || 100, 100) : this.COLUMN_CHIRP_LIMIT, n = Math.max(this.maxUpdatesPerColumn || this.COLUMN_CHIRP_LIMIT, this.COLUMN_CHIRP_LIMIT), !this.isEmergencyPaused && n < this.updateArray.length) | |
if (TD.decider.get(TD.decider.EMERGENCY_COLUMN_PAUSE) && this.chirpInView(this.updateArray[n])) this.enableEmergencyPause(); | |
else { | |
t = this.updateArray.splice(n, Math.max(this.updateArray.length - n, 0)); | |
for (var r = 0; r < t.length; r++) this.annihilateChirp(t[r].id.toString(), this.ui.getChirpContainer()) | |
} | |
}, TD.vo.Column.prototype.annihilateChirp = function (e) { | |
this.ui.removeChirp(e), delete this.updateIndex[e] | |
}, TD.vo.Column.prototype.chirpInView = function (e) { | |
{ | |
var t = this.ui.getChirpContainer(), | |
i = t.parents(".js-column-scroller").height(), | |
n = t.children('[data-key="' + e.id.toString() + '"]'), | |
r = n.position().top; | |
n.height() | |
} | |
return i > r | |
}, TD.vo.Column.prototype.addToView = function (e, t, i) { | |
var n, r, s, o, a, c = this.ui.getChirpContainer(), | |
u = TD.controller.columnManager.isStreaming(this.model.getKey()); | |
0 !== t.length && (0 === this.updateArray.length ? (o = TD.util.getPreciseTime(), i.doRenderMinimalist = !1, n = this.ui.renderChirps(t, i), a = TD.util.getPreciseTime(), TD.util.logTimeToRenderColumn(a - o, t.length)) : (u && this.tpmCounter.incrementCounter(t.length), i.doRenderMinimalist = this.tpm > this.COLUMN_MINIMALIST_TWEET_TPM_THRESHOLD, n = this.ui.renderChirps(t, i)), r = $(n).filter(this.STREAM_ITEM_SELECTOR), s = 0 === c.children(this.STREAM_ITEM_SELECTOR).length, "" === e ? s ? (c.html(r), this.isShowingLoadMore = !1) : (!TD.ui.columns.isFrozen(this.model.getKey()) && TD.controller.columnManager.isStreaming(this.model.getKey()) && this.trimUpdates(), c.prepend(r)) : c.children('[data-key="' + e + '"]').after(r), s ? this.ui.fadeInChirpContainer() : this.ui.slideInChirps(r, this.temporary, this.streamRate, this.tpm, this.isFetchingOlderUpdates)) | |
}, TD.vo.Column.prototype.getMediaPreviewSize = function () { | |
var e, t = this.model.getMediaPreviewSize(); | |
return t || (this.isMessageColumn() && (t = TD.vo.Column.MEDIA_PREVIEW_OFF), e = this.getSearchFilter(), t = e.content.hasActiveMediaFilter() ? TD.vo.Column.MEDIA_PREVIEW_SIZE_LARGE : this.getColumnType() === TD.util.columnUtils.columnMetaTypes.INTERACTIONS ? TD.vo.Column.MEDIA_PREVIEW_SIZE_SMALL : TD.vo.Column.MEDIA_PREVIEW_SIZE_MEDIUM), t | |
}, TD.vo.Column.prototype.setMediaPreviewSize = function (e) { | |
var t = this.getMediaPreviewSize(); | |
e !== t && this.model.setMediaPreviewSize(e), this.reloadTweets() | |
}, TD.vo.Column.prototype.getShowVerified = function () { | |
return "col_search" === this.getColumnType() && this.temporary | |
}, TD.vo.Column.prototype.enableEmergencyPause = function () { | |
this.isEmergencyPaused = !0, this.ui.getChirpContainer().trigger("uiColumnPaused"), TD.controller.stats.columnEmergencyPause(this.getColumnType()) | |
}, TD.vo.Column.prototype.disableEmergencyPause = function () { | |
this.isEmergencyPaused = !1, this.ui.getChirpContainer().trigger("uiColumnUnpaused"), TD.controller.stats.columnEmergencyPauseUnpause(this.getColumnType()) | |
}, TD.vo.Column.prototype.pauseFetching = function () { | |
this.fetchingPaused = !0 | |
}, TD.vo.Column.prototype.unpauseFetching = function () { | |
this.fetchingPaused = !1 | |
}, TD.vo.Column.prototype.getTitleHTML = function (e) { | |
return TD.util.columnUtils.getColumnTitleHTML(this, e) | |
}, TD.vo.Column.prototype.getDetailTitleHTML = function () { | |
return TD.util.columnUtils.getColumnTitleHTML(this) | |
}, TD.vo.Column.prototype.getColumnType = function () { | |
return TD.util.columnUtils.getColumnType(this) | |
}, TD.vo.Column.prototype.getIconClass = function () { | |
return TD.util.columnUtils.getColumnIconClassByColumnType(this.getColumnType()) | |
}, TD.vo.Column.prototype.getClass = function () { | |
return TD.util.columnUtils.getColumnClassByColumnType(this.getColumnType()) | |
}, TD.vo.Column.prototype.isOfType = function (e) { | |
return this.getColumnType() === e | |
}, TD.vo.Column.prototype.isMessageColumn = function () { | |
return TD.util.columnUtils.isMessageColumn(this) | |
}, TD.vo.Column.prototype.isSearchColumn = function () { | |
return this.getColumnType() === TD.util.columnUtils.columnMetaTypes.SEARCH | |
}, TD.vo.Column.prototype.isActionsColumn = function () { | |
return TD.util.columnUtils.actionColumnTypes.indexOf(this.getColumnType()) > -1 | |
}, TD.vo.Column.prototype.isSingleActionTypeColumn = function () { | |
return TD.util.columnUtils.singleActionColumnTypes.indexOf(this.getColumnType()) > -1 | |
}, TD.vo.Column.prototype.isActivityColumn = function () { | |
return this.getColumnType() === TD.util.columnUtils.columnMetaTypes.ACTIVITY | |
}, TD.vo.Column.prototype.isCustomTimeline = function () { | |
return this.isOfType(TD.util.columnUtils.columnMetaTypes.CUSTOMTIMELINE) | |
}, TD.vo.Column.prototype.isEmbeddable = function () { | |
return _.include(TD.util.columnUtils.embeddableColumnTypes, this.getColumnType()) | |
}, TD.vo.Column.prototype.isShareable = function () { | |
var e = TD.util.columnUtils, | |
t = e.shareableColumnTypes; | |
return TD.decider.get(TD.decider.SAC_SHARE) && (t = t.concat(e.columnMetaTypes.FAVORITES, e.columnMetaTypes.USERTWEETS, e.columnMetaTypes.LIST, e.columnMetaTypes.SEARCH)), _.include(t, this.getColumnType()) | |
}, TD.vo.Column.prototype.isViewable = function () { | |
return _.include(TD.util.columnUtils.viewableColumnTypes, this.getColumnType()) | |
}, TD.vo.Column.prototype.isClearable = function () { | |
var e = this.getColumnType(); | |
return e !== TD.util.columnUtils.columnMetaTypes.SCHEDULED && e !== TD.util.columnUtils.columnMetaTypes.CUSTOMTIMELINE | |
}, TD.vo.Column.prototype.isOwnList = function () { | |
var e = !1; | |
return _.find(this.getFeeds(), function (t) { | |
if ("list" === t.getType()) { | |
var i = t.getMetadata(); | |
e = TD.cache.lists.find(i.listId, i.screenName, i.slug, !0) | |
} | |
return Boolean(e) | |
}), e | |
}, TD.vo.Column.prototype.isOwnCustomTimeline = function () { | |
var e = this.getFeedsByType(TD.util.columnUtils.feedTypes.CUSTOMTIMELINE), | |
t = e.some(function (e) { | |
var t = e.getMetadata(), | |
i = TD.storage.Account.generateKeyFor("twitter", t.ownerId); | |
return i === e.getAccountKey() | |
}); | |
return t | |
}, TD.vo.Column.prototype.deleteCustomTimeline = function (e, t) { | |
var i = this.getFeedsByType(TD.util.columnUtils.feedTypes.CUSTOMTIMELINE); | |
i.forEach(function (i) { | |
var n = i.getMetadata().id, | |
r = TD.controller.clients.getClient(i.getAccountKey()), | |
s = i.getKey(); | |
r.deleteCustomTimeline(n, function () { | |
TD.controller.feedManager.deleteFeedsWhere(function (e) { | |
return e.getKey() === s | |
}), e && e() | |
}, function () { | |
TD.controller.progressIndicator.addMessage(TD.i("Error deleting collection")), t && t() | |
}) | |
}) | |
}, TD.vo.Column.prototype.getCustomTimeline = function () { | |
var e, t = this.getCustomTimelineFeed(); | |
if (t) { | |
var i = t.getMetadata().id, | |
n = TD.controller.clients.getClient(t.getAccountKey()); | |
e = n.customTimelines.filter(function (e) { | |
return e.id === i | |
})[0] | |
} | |
return e | |
}, TD.vo.Column.prototype.getCustomTimelineFeed = function () { | |
var e = this.getFeedsByType(TD.util.columnUtils.feedTypes.CUSTOMTIMELINE); | |
return e[0] | |
}, TD.vo.Column.prototype.updateMetadata = function (e) { | |
var t, i = this.getFeeds()[0]; | |
this._isUpdating = !0, this.ui.showIsUpdatingMessage(), e.term = null, t = TD.storage.feedController.getOrCreateFeed(i.getType(), i.getService(), i.getAccountKey(), e), this.ui.getChirpContainer().trigger("dataColumnUpdatingFeed", { | |
column: this, | |
oldFeed: i, | |
newFeed: t | |
}), TD.controller.feedManager.replaceFeed(i, t, [this.model.getKey()]) | |
}, TD.vo.Column.prototype.loadFilters = function () { | |
var e = new TD.vo.SearchFilter(this.model.getFilters()), | |
t = e.getFilters(); | |
_.isEqual(_.pluck(this.filters, "id"), _.pluck(t, "id")) || (this.filters = t, this.reloadTweets()) | |
}, TD.vo.Column.prototype.isFilterable = function () { | |
return -1 !== TD.util.columnUtils.filterableColumnTypes.indexOf(this.getColumnType()) | |
}, TD.vo.Column.prototype.refreshColumn = function (e) { | |
this.pauseFetching(), this.ui.showIsUpdatingMessage(), setTimeout(function () { | |
this.unpauseFetching(), this.reloadTweets() | |
}.bind(this), e || 500) | |
}, TD.vo.Column.prototype.reloadTweets = function () { | |
this._isUpdating || (this.disableEmergencyPause(), this.truncate(0), this.fetchUpdatesFromPoller(!0)) | |
}, TD.vo.Column.prototype.getBaseQuery = function () { | |
var e = null, | |
t = this.getFeeds(); | |
if (this.isSearchColumn() && t && t.length > 0) { | |
var i = t[0].getMetadata(); | |
i && (e = i.baseQuery ? i.baseQuery : i.term) | |
} | |
return e | |
}, TD.vo.Column.prototype.updateSearchFilter = function (e) { | |
var t, i, n, r, s; | |
e && (this.isSearchColumn() ? this.updateSearchFeedFilter(e) : (n = this.getFeeds()[0], n && this.isActionsColumn() && !this.isActivityColumn() && (i = n.getType(), t = TD.util.columnUtils.inferFeedTypeFromActionFilter(e.action), t !== i && (s = _.clone(n.getMetadata()), r = TD.storage.feedController.getOrCreateFeed(t, n.getService(), n.getAccountKey(), s), this.ui.getChirpContainer().trigger("dataColumnUpdatingFeed", { | |
column: this, | |
oldFeed: n, | |
newFeed: r | |
}), TD.controller.feedManager.replaceFeed(n, r, [this.model.getKey()]))), this.model.setFilters(e.toJSONObject()), this.ui.getChirpContainer().trigger("dataColumnFiltersUpdated"))) | |
}, TD.vo.Column.prototype.updateSearchFeedFilter = function (e) { | |
var t = !1, | |
i = this.getFeeds()[0], | |
n = _.clone(i.getMetadata()); | |
n.baseQuery || (n.baseQuery = n.term), e.content && e.content.matching && e.content.matching !== n.baseQuery && (t = !0, n.baseQuery = e.content.matching); | |
var r = new TD.vo.SearchFilter(n.searchFilterData); | |
(t || r.getQueryString() !== e.getQueryString()) && (n.searchFilterData = e.toJSONObject(), this.updateMetadata(n)) | |
}, TD.vo.Column.prototype.getSearchFilter = function () { | |
var e, t; | |
return this.isSearchColumn() ? (t = this.getFeeds()[0].getMetadata(), e = new TD.vo.SearchFilter(t.searchFilterData), e.content.matching || e.content.setMatching(t.baseQuery || t.term)) : e = new TD.vo.SearchFilter(this.model.getFilters()), e | |
}, TD.vo.Column.prototype.hasActiveSearchFilters = function () { | |
var e = this.getSearchFilter(), | |
t = this.hasActiveUserFilters() || this.hasActiveContentFilters() || this.hasActiveEngagementFilters() || this.hasActiveActionFilters() && !this.isSingleActionTypeColumn(); | |
return this.isSearchColumn() || (t = e.content.matching || t), Boolean(t) | |
}, TD.vo.Column.prototype.hasActiveContentFilters = function () { | |
var e, t = this.getSearchFilter(); | |
return e = this.isSearchColumn() ? t.content.getQueryString() : t.content.matching || t.content.getQueryString(), Boolean(e) | |
}, TD.vo.Column.prototype.hasActiveUserFilters = function () { | |
var e = this.getSearchFilter(), | |
t = e.user.getQueryString(); | |
return Boolean(t) | |
}, TD.vo.Column.prototype.hasActiveActionFilters = function () { | |
var e = this.getSearchFilter(), | |
t = e.action.getFilters().length; | |
return Boolean(t) | |
}, TD.vo.Column.prototype.hasActiveEngagementFilters = function () { | |
var e = this.getSearchFilter(), | |
t = e.engagement.getQueryString(); | |
return Boolean(t) | |
}, TD.vo.Column.prototype.hasFilterError = function () { | |
var e, t = this.getSearchFilter(); | |
return e = this.getColumnType() === TD.util.columnUtils.columnMetaTypes.ACTIVITY ? t.action.getFilters().length === TD.vo.ActionFilter.MAX_ACTIVITY_FILTERS : t.action.getFilters().length === TD.vo.ActionFilter.MAX_INTERACTION_FILTERS | |
}, TD.vo.Column.prototype.markAllMessagesAsRead = function () { | |
this.isMessageColumn() && this.updateArray.forEach(function (e) { | |
e instanceof TD.services.TwitterMessageThread && e.markAsRead() | |
}) | |
}, TD.vo.Column.prototype.hasUnreadMessages = function () { | |
var e = !1; | |
return this.isMessageColumn() && (e = this.updateArray.some(function (e) { | |
return e.unread | |
})), e | |
}, TD.vo.Column.prototype.unreadMessageCount = function () { | |
var e = 0; | |
return this.isMessageColumn() && this.updateArray.forEach(function (t) { | |
e += t.getUnreadChirps().length | |
}), e > 20 && (e = "20+"), e.toString() | |
}, TD.vo.Filter = function (e, t, i) { | |
switch (this.type = e, this.value = t, this.positive = i, _.isString(t) && (this.value = t.toLowerCase()), this.type) { | |
case TD.vo.Filter.PHRASE: | |
this.exact = !1; | |
break; | |
case TD.vo.Filter.SENDER: | |
this.exact = !0, this.fuzzy = !0, this.filterTarget = "parent"; | |
break; | |
case TD.vo.Filter.SOURCE: | |
this.exact = !0, this.fuzzy = !1; | |
break; | |
case TD.vo.Filter.FOLLOWERS: | |
this.exact = !1, this.range = !0; | |
break; | |
case TD.vo.Filter.IS_RETWEET: | |
this.exact = !0; | |
break; | |
case TD.vo.Filter.IS_FROM_VERIFIED: | |
this.exact = !0, this.filterTarget = "parent"; | |
break; | |
case TD.vo.Filter.CHIRP_TYPE: | |
this.exact = !0, this.filterTarget = "parent" | |
} | |
this.id = this.generateLocalID() | |
}, TD.vo.Filter.PHRASE = "phrase", TD.vo.Filter.SENDER = "sender", TD.vo.Filter.SOURCE = "source", TD.vo.Filter.FOLLOWERS = "followers", TD.vo.Filter.IS_RETWEET = "is_retweet", TD.vo.Filter.IS_MENTION = "is_mention", TD.vo.Filter.IS_FAVORITE = "is_favorite", TD.vo.Filter.IS_FOLLOW = "is_follow", TD.vo.Filter.HAS_IMAGE = "has_image", TD.vo.Filter.HAS_VIDEO = "has_video", TD.vo.Filter.HAS_MEDIA = "has_media", TD.vo.Filter.HAS_LINK = "has_link", TD.vo.Filter.IS_FROM_VERIFIED = "verified", TD.vo.Filter.CHIRP_TYPE = "chirp_type", TD.vo.Filter.prototype.id = null, TD.vo.Filter.prototype.value = null, TD.vo.Filter.prototype.type = TD.vo.Filter.PHRASE, TD.vo.Filter.prototype.positive = !0, TD.vo.Filter.prototype.exact = !0, TD.vo.Filter.prototype.fuzzy = !1, TD.vo.Filter.prototype.range = !1, TD.vo.Filter.prototype.filterTarget = "child", TD.vo.Filter.prototype.generateLocalID = function () { | |
return "filter" + TD.util.deterministicObjectHash(this.toBackendState()) | |
}, TD.vo.Filter.prototype.pass = function (e) { | |
var t = this; | |
switch (e = this._getFilterTarget(e), text = e.getFilterableText(), text = text ? text.toLowerCase() : null, senders = e.getSenders(), senders = senders ? _.map(senders, function (e) { | |
return e.toLowerCase() | |
}) : null, source = e.getSource(), source = source ? source.toLowerCase() : null, this.type) { | |
case TD.vo.Filter.PHRASE: | |
return this._testString(text); | |
case TD.vo.Filter.SENDER: | |
return this.positive ? _.any(senders, function (e) { | |
return t._testString(e) | |
}) : _.every(senders, function (e) { | |
return t._testString(e) | |
}); | |
case TD.vo.Filter.SOURCE: | |
return this._testString(source); | |
case TD.vo.Filter.FOLLOWERS: | |
return this._testNumber(followers); | |
case TD.vo.Filter.IS_RETWEET: | |
return this._testBoolean(e.isRetweetedStatus()); | |
case TD.vo.Filter.IS_FROM_VERIFIED: | |
return this._testBoolean(e.isFromVerifiedUser()); | |
case TD.vo.Filter.HAS_IMAGE: | |
return this._testBoolean(e.hasImage()); | |
case TD.vo.Filter.HAS_VIDEO: | |
return this._testBoolean(e.hasVideo()); | |
case TD.vo.Filter.HAS_MEDIA: | |
return this._testBoolean(e.hasImage() || e.hasVideo()); | |
case TD.vo.Filter.HAS_LINK: | |
return this._testBoolean(e.hasLink()); | |
case TD.vo.Filter.CHIRP_TYPE: | |
return this._testString(e.getChirpType()) | |
} | |
return !0 | |
}, TD.vo.Filter.prototype.getDisplayType = function () { | |
switch (this.type) { | |
case TD.vo.Filter.PHRASE: | |
return ""; | |
case TD.vo.Filter.SENDER: | |
return TD.i("user"); | |
case TD.vo.Filter.SOURCE: | |
return TD.i("source"); | |
case TD.vo.Filter.FOLLOWERS: | |
return TD.i("followers"); | |
case TD.vo.Filter.IS_RETWEET: | |
return TD.i("retweets"); | |
case TD.vo.Filter.HAS_MEDIA: | |
return TD.i("media"); | |
case TD.vo.Filter.HAS_LINK: | |
return TD.i("links"); | |
case TD.vo.Filter.IS_FROM_VERIFIED: | |
return TD.i("verified") | |
} | |
return "" | |
}, TD.vo.Filter.prototype._getFilterTarget = function (e) { | |
return "parent" !== this.filterTarget && e.targetTweet ? e.targetTweet : e | |
}, TD.vo.Filter.prototype._testString = function (e) { | |
if (!e || !this.value) return !0; | |
if (this.exact) { | |
if (e === this.value) return this.positive; | |
if (this.fuzzy && "@" + e === this.value) return this.positive | |
} else if (-1 !== e.indexOf(this.value)) return this.positive; | |
return !this.positive | |
}, TD.vo.Filter.prototype._testNumber = function (e) { | |
if (!_.isNumber(e) || !_.isNumber(this.value)) return !0; | |
if (this.exact) { | |
if (e === this.value) return this.positive | |
} else if (this.range && e >= this.value) return this.positive; | |
return !this.positive | |
}, TD.vo.Filter.prototype._testBoolean = function (e) { | |
return _.isBoolean(e) && _.isBoolean(this.value) ? e === this.value ? this.positive : !this.positive : !0 | |
}, TD.vo.Filter.prototype.toBackendState = function () { | |
return { | |
type: this.type, | |
value: this.value, | |
positive: this.positive, | |
exact: this.exact, | |
fuzzy: this.fuzzy, | |
range: this.range | |
} | |
}, TD.vo.Filter.prototype.fromBackendState = function (e) { | |
this.type = e.type, this.value = e.value, this.positive = e.positive, this.exact = e.exact, this.fuzzy = e.fuzzy, this.range = e.range, this.id = this.generateLocalID() | |
}, TD.vo.SearchFilter = function (e) { | |
this.fromJSONObject(e) | |
}, TD.vo.SearchFilter.prototype.action = null, TD.vo.SearchFilter.prototype.content = null, TD.vo.SearchFilter.prototype.engagement = null, TD.vo.SearchFilter.prototype.user = null, TD.vo.SearchFilter.prototype.toJSONObject = function () { | |
var e = { | |
action: this.action.toJSONObject(), | |
content: this.content.toJSONObject(), | |
engagement: this.engagement.toJSONObject(), | |
user: this.user.toJSONObject() | |
}; | |
return e | |
}, TD.vo.SearchFilter.prototype.fromJSONObject = function (e) { | |
e = e || {}, this.action = new TD.vo.ActionFilter(e.action), this.content = new TD.vo.ContentFilter(e.content), this.engagement = new TD.vo.EngagementFilter(e.engagement), this.user = new TD.vo.UserFilter(e.user) | |
}, TD.vo.SearchFilter.prototype.getQueryString = function () { | |
var e = [this.content.getQueryString(), this.engagement.getQueryString(), this.user.getQueryString()]; | |
return e.join(" ").trim() | |
}, TD.vo.SearchFilter.prototype.getFilters = function () { | |
var e = this.action.getFilters(); | |
return e = e.concat(this.content.getFilters()), e = e.concat(this.engagement.getFilters()), e = e.concat(this.user.getFilters()) | |
}, TD.vo.ActionFilter = function (e) { | |
this.fromJSONObject(e) | |
}, TD.vo.ActionFilter.prototype.showMentions = !0, TD.vo.ActionFilter.prototype.showRetweets = !0, TD.vo.ActionFilter.prototype.showFavorites = !0, TD.vo.ActionFilter.prototype.showFollowers = !0, TD.vo.ActionFilter.prototype.showLists = !0, TD.vo.ActionFilter.MAX_INTERACTION_FILTERS = 6, TD.vo.ActionFilter.MAX_ACTIVITY_FILTERS = 4, TD.vo.ActionFilter.prototype.setShowMentions = function (e) { | |
this.showMentions = Boolean(e) | |
}, TD.vo.ActionFilter.prototype.setShowRetweets = function (e) { | |
this.showRetweets = Boolean(e) | |
}, TD.vo.ActionFilter.prototype.setShowFavorites = function (e) { | |
this.showFavorites = Boolean(e) | |
}, TD.vo.ActionFilter.prototype.setShowFollowers = function (e) { | |
this.showFollowers = Boolean(e) | |
}, TD.vo.ActionFilter.prototype.setShowLists = function (e) { | |
this.showLists = Boolean(e) | |
}, TD.vo.ActionFilter.prototype.toJSONObject = function () { | |
return { | |
showMentions: this.showMentions, | |
showRetweets: this.showRetweets, | |
showFavorites: this.showFavorites, | |
showFollowers: this.showFollowers, | |
showLists: this.showLists | |
} | |
}, TD.vo.ActionFilter.prototype.fromJSONObject = function (e) { | |
e && (this.setShowMentions(e.showMentions), this.setShowRetweets(e.showRetweets), this.setShowFavorites(e.showFavorites), this.setShowFollowers(e.showFollowers), this.setShowLists(e.showLists)) | |
}, TD.vo.ActionFilter.prototype.getSummaryText = function (e) { | |
var t, i, n, r = [], | |
s = e === TD.util.columnUtils.columnMetaTypes.ACTIVITY; | |
n = s ? TD.vo.ActionFilter.MAX_ACTIVITY_FILTERS : TD.vo.ActionFilter.MAX_INTERACTION_FILTERS; | |
var o = this.getFilters(); | |
return o.length === n ? t = TD.i("Filter error") : 0 === o.length ? t = TD.i(s ? "All activity" : "All notifications") : 1 !== o.length || s ? (s || (this.showMentions && r.push(TD.i("mentions")), this.showRetweets && r.push(TD.i("retweets"))), this.showFavorites && r.push(TD.i("favorites")), this.showFollowers && r.push(TD.i("followers")), this.showLists && r.push(TD.i("lists")), i = r.pop(), o.length === n - 1 || this.showLists && o.length === n - 2 ? t = TD.i("{{actionType}} only", { | |
actionType: i | |
}) : (r = r.join(", "), t = TD.i("{{actionTypes}} and {{lastActionType}}", { | |
actionTypes: r, | |
lastActionType: i | |
}))) : this.showMentions ? this.showRetweets ? this.showFavorites ? this.showFollowers ? this.showLists || (t = TD.i("All except lists")) : t = TD.i("All except followers") : t = TD.i("All except favorites") : t = TD.i("All except retweets") : t = TD.i("All except mentions"), t | |
}, TD.vo.ActionFilter.prototype.getFilters = function () { | |
var e, t = []; | |
return this.showMentions || (e = new TD.vo.Filter(TD.vo.Filter.CHIRP_TYPE, TD.services.TwitterAction.MENTION, !1), t.push(e)), this.showRetweets || (e = new TD.vo.Filter(TD.vo.Filter.CHIRP_TYPE, TD.services.TwitterAction.RETWEET, !1), t.push(e)), this.showFavorites || (e = new TD.vo.Filter(TD.vo.Filter.CHIRP_TYPE, TD.services.TwitterAction.FAVORITE, !1), t.push(e)), this.showFollowers || (e = new TD.vo.Filter(TD.vo.Filter.CHIRP_TYPE, TD.services.TwitterAction.FOLLOW, !1), t.push(e)), this.showLists || (e = new TD.vo.Filter(TD.vo.Filter.CHIRP_TYPE, TD.services.TwitterAction.LIST_CREATED, !1), t.push(e), e = new TD.vo.Filter(TD.vo.Filter.CHIRP_TYPE, TD.services.TwitterAction.LIST_MEMBER_ADDED, !1), t.push(e)), t | |
}, TD.vo.ContentFilter = function (e) { | |
this.fromJSONObject(e) | |
}, TD.vo.ContentFilter.TYPE_ANYTHING = "anything", TD.vo.ContentFilter.TYPE_IMG = "img", TD.vo.ContentFilter.TYPE_VID = "vid", TD.vo.ContentFilter.TYPE_IMG_AND_VID = "img_vid", TD.vo.ContentFilter.TYPE_LINKS = "links", TD.vo.ContentFilter.LANG_ANY = "any", TD.vo.ContentFilter.prototype.matching = "", TD.vo.ContentFilter.prototype.excluding = "", TD.vo.ContentFilter.prototype.type = "anything", TD.vo.ContentFilter.prototype.lang = "any", TD.vo.ContentFilter.prototype.includeRTs = !0, TD.vo.ContentFilter.prototype.setMatching = function (e) { | |
this.matching = e || "" | |
}, TD.vo.ContentFilter.prototype.setExcluding = function (e) { | |
this.excluding = e || "" | |
}, TD.vo.ContentFilter.prototype.setType = function (e) { | |
this.type = e || TD.vo.ContentFilter.TYPE_ANYTHING | |
}, TD.vo.ContentFilter.prototype.setLanguage = function (e) { | |
this.lang = e || TD.vo.ContentFilter.LANG_ANY | |
}, TD.vo.ContentFilter.prototype.setIncludeRTs = function (e) { | |
this.includeRTs = void 0 === e ? !0 : Boolean(e) | |
}, TD.vo.ContentFilter.prototype.toJSONObject = function () { | |
return { | |
matching: this.matching, | |
excluding: this.excluding, | |
type: this.type, | |
lang: this.lang, | |
includeRTs: this.includeRTs | |
} | |
}, TD.vo.ContentFilter.prototype.fromJSONObject = function (e) { | |
e && (this.setMatching(e.matching), this.setExcluding(e.excluding), this.setType(e.type), this.setLanguage(e.lang), this.setIncludeRTs(e.includeRTs)) | |
}, TD.vo.ContentFilter.prototype.getQueryString = function () { | |
var e = []; | |
switch (this.type) { | |
case TD.vo.ContentFilter.TYPE_IMG: | |
e.push("(filter:images)"); | |
break; | |
case TD.vo.ContentFilter.TYPE_VID: | |
e.push("(filter:videos)"); | |
break; | |
case TD.vo.ContentFilter.TYPE_IMG_AND_VID: | |
e.push("(filter:images OR filter:videos)"); | |
break; | |
case TD.vo.ContentFilter.TYPE_LINKS: | |
e.push("filter:links") | |
} | |
return this.lang !== TD.vo.ContentFilter.LANG_ANY && e.push("lang:" + this.lang), this.includeRTs || e.push("exclude:nativeretweets exclude:retweets"), this.excluding && e.push(this.getExcludingQuery()), e.join(" ") | |
}, TD.vo.ContentFilter.prototype.getSummaryText = function () { | |
var e, t = []; | |
switch (this.type) { | |
case TD.vo.ContentFilter.TYPE_IMG: | |
t.push(TD.i("showing images")); | |
break; | |
case TD.vo.ContentFilter.TYPE_VID: | |
t.push(TD.i("showing videos")); | |
break; | |
case TD.vo.ContentFilter.TYPE_IMG_AND_VID: | |
t.push(TD.i("showing images and videos")); | |
break; | |
case TD.vo.ContentFilter.TYPE_LINKS: | |
t.push(TD.i("showing links")) | |
} | |
if (this.matching && t.push(TD.i("matching ‘{{{matching}}}’", { | |
matching: this.matching | |
})), this.excluding && t.push(TD.i("excluding ‘{{{excluding}}}’", { | |
excluding: this.excluding | |
})), this.lang !== TD.vo.ContentFilter.LANG_ANY) { | |
var i = TD.languages.getLanguageFromISOCode(this.lang); | |
t.push(TD.i("written in {{{lang}}}", { | |
lang: i.localized_name | |
})) | |
} | |
return this.includeRTs || t.push(TD.i("retweets excluded")), e = 0 === t.length ? TD.i("any") : t.join(", ") | |
}, TD.vo.ContentFilter.prototype.getExcludingQuery = function () { | |
if (!this.excluding) return ""; | |
var e = TD.services.TwitterSearchParser.extractPhrases(this.excluding, !0); | |
return e = e.map(function (e) { | |
return "-" + e | |
}), e.join(" ") | |
}, TD.vo.ContentFilter.prototype.getFilters = function () { | |
var e, t, i = []; | |
switch (this.type) { | |
case TD.vo.ContentFilter.TYPE_IMG: | |
e = new TD.vo.Filter(TD.vo.Filter.HAS_IMAGE, !0, !0), i.push(e); | |
break; | |
case TD.vo.ContentFilter.TYPE_VID: | |
e = new TD.vo.Filter(TD.vo.Filter.HAS_VIDEO, !0, !0), i.push(e); | |
break; | |
case TD.vo.ContentFilter.TYPE_IMG_AND_VID: | |
e = new TD.vo.Filter(TD.vo.Filter.HAS_MEDIA, !0, !0), i.push(e); | |
break; | |
case TD.vo.ContentFilter.TYPE_LINKS: | |
e = new TD.vo.Filter(TD.vo.Filter.HAS_LINK, !0, !0), i.push(e) | |
} | |
return this.matching && (t = TD.services.TwitterSearchParser.extractPhrases(this.matching, !1), t.forEach(function (t) { | |
e = new TD.vo.Filter(TD.vo.Filter.PHRASE, t, !0), i.push(e) | |
})), this.excluding && (t = TD.services.TwitterSearchParser.extractPhrases(this.excluding, !1), t.forEach(function (t) { | |
e = new TD.vo.Filter(TD.vo.Filter.PHRASE, t, !1), i.push(e) | |
})), this.includeRTs || (e = new TD.vo.Filter(TD.vo.Filter.IS_RETWEET, !1, !0), i.push(e)), i | |
}, TD.vo.ContentFilter.prototype.hasActiveMediaFilter = function () { | |
return [TD.vo.ContentFilter.TYPE_IMG, TD.vo.ContentFilter.TYPE_VID, TD.vo.ContentFilter.TYPE_IMG_AND_VID].indexOf(this.type) > -1 | |
}, TD.vo.EngagementFilter = function (e) { | |
this.fromJSONObject(e) | |
}, TD.vo.EngagementFilter.prototype.minReplies = 0, TD.vo.EngagementFilter.prototype.minRetweets = 0, TD.vo.EngagementFilter.prototype.minFavorites = 0, TD.vo.EngagementFilter.prototype.setMinReplies = function (e) { | |
this.minReplies = parseInt(e, 10) | |
}, TD.vo.EngagementFilter.prototype.setMinRetweets = function (e) { | |
this.minRetweets = parseInt(e, 10) | |
}, TD.vo.EngagementFilter.prototype.setMinFavorites = function (e) { | |
this.minFavorites = parseInt(e, 10) | |
}, TD.vo.EngagementFilter.prototype.toJSONObject = function () { | |
return { | |
minReplies: this.minReplies, | |
minRetweets: this.minRetweets, | |
minFavorites: this.minFavorites | |
} | |
}, TD.vo.EngagementFilter.prototype.fromJSONObject = function (e) { | |
e && (this.setMinReplies(e.minReplies), this.setMinRetweets(e.minRetweets), this.setMinFavorites(e.minFavorites)) | |
}, TD.vo.EngagementFilter.prototype.getQueryString = function () { | |
if (!TD.decider.get(TD.decider.ENGAGEMENT_FILTER)) return ""; | |
var e = []; | |
return this.minReplies > 0 && e.push("min_replies:" + this.minReplies), this.minRetweets > 0 && e.push("min_retweets:" + this.minRetweets), this.minFavorites > 0 && e.push("min_faves:" + this.minFavorites), e.join(" ") | |
}, TD.vo.EngagementFilter.prototype.getSummaryText = function () { | |
var e, t = []; | |
switch (this.minReplies > 0 && t.push({ | |
count: this.minReplies, | |
label: TD.i("replies") | |
}), this.minRetweets > 0 && t.push({ | |
count: this.minRetweets, | |
label: TD.i("retweets") | |
}), this.minFavorites > 0 && t.push({ | |
count: this.minFavorites, | |
label: TD.i("favorites") | |
}), t.length) { | |
case 0: | |
e = TD.i("any"); | |
break; | |
case 1: | |
e = TD.i("at least {{#0}}{{count}} {{label}}{{/0}}", t); | |
break; | |
case 2: | |
e = TD.i("at least {{#0}}{{count}} {{label}}{{/0}} and {{#1}}{{count}} {{label}}{{/1}}", t); | |
break; | |
case 3: | |
e = TD.i("at least {{#0}}{{count}} {{label}}{{/0}}, {{#1}}{{count}} {{label}}{{/1}} and {{#2}}{{count}} {{label}}{{/2}}", t) | |
} | |
return e | |
}, TD.vo.EngagementFilter.prototype.getFilters = function () { | |
return [] | |
}, TD.vo.UserFilter = function (e) { | |
this.fromJSONObject(e) | |
}, TD.vo.UserFilter.FROM_ALL = "all", TD.vo.UserFilter.FROM_USER = "user", TD.vo.UserFilter.FROM_VERIFIED = "verified", TD.vo.UserFilter.FROM_LIST = "list", TD.vo.UserFilter.prototype.from_type = null, TD.vo.UserFilter.prototype.from_name = null, TD.vo.UserFilter.prototype.mention_name = null, TD.vo.UserFilter.prototype.setFrom = function (e, t) { | |
t && e !== TD.vo.UserFilter.FROM_VERIFIED && e !== TD.vo.UserFilter.FROM_ALL || (t = ""), this.from_type = e, this.from_name = TD.util.deMentionify(t) | |
}, TD.vo.UserFilter.prototype.setMentioned = function (e) { | |
this.mention_name = e || "", this.mention_name = TD.util.deMentionify(this.mention_name) | |
}, TD.vo.UserFilter.prototype.toJSONObject = function () { | |
return { | |
from_type: this.from_type, | |
from_name: this.from_name, | |
mention_name: this.mention_name | |
} | |
}, TD.vo.UserFilter.prototype.fromJSONObject = function (e) { | |
e && (this.setFrom(e.from_type, e.from_name), this.setMentioned(e.mention_name)) | |
}, TD.vo.UserFilter.prototype.getQueryString = function () { | |
var e = []; | |
switch (this.from_type) { | |
case TD.vo.UserFilter.FROM_USER: | |
e.push("from:" + this.from_name); | |
break; | |
case TD.vo.UserFilter.FROM_VERIFIED: | |
e.push("filter:verified"); | |
break; | |
case TD.vo.UserFilter.FROM_LIST: | |
e.push("list:" + this.from_name) | |
} | |
return this.mention_name && e.push("@" + this.mention_name), e.join(" ") | |
}, TD.vo.UserFilter.prototype.getSummaryText = function () { | |
var e, t = []; | |
switch (this.from_type) { | |
case TD.vo.UserFilter.FROM_USER: | |
e = TD.storage.accountController.getAccountFromUsername(this.from_name).length > 0, t.push(e ? TD.i("by me (@{{{name}}})", { | |
name: this.from_name | |
}) : TD.i("by @{{{name}}}", { | |
name: this.from_name | |
})); | |
break; | |
case TD.vo.UserFilter.FROM_VERIFIED: | |
t.push(TD.i("by verified users")); | |
break; | |
case TD.vo.UserFilter.FROM_LIST: | |
t.push(TD.i("by members of @{{{name}}}", { | |
name: this.from_name | |
})) | |
} | |
return this.mention_name && (e = TD.storage.accountController.getAccountFromUsername(this.mention_name).length > 0, t.push(e ? TD.i("mentioning me (@{{{name}}})", { | |
name: this.mention_name | |
}) : TD.i("mentioning @{{{name}}}", { | |
name: this.mention_name | |
}))), 0 === t.length && t.push(TD.i("any")), t.join(", ") | |
}, TD.vo.UserFilter.prototype.getFilters = function () { | |
var e, t = []; | |
switch (this.mention_name && (e = new TD.vo.Filter(TD.vo.Filter.PHRASE, TD.util.atMentionify(this.mention_name), !0), t.push(e)), this.from_type) { | |
case TD.vo.UserFilter.FROM_USER: | |
e = new TD.vo.Filter(TD.vo.Filter.SENDER, this.from_name, !0), t.push(e); | |
break; | |
case TD.vo.UserFilter.FROM_VERIFIED: | |
e = new TD.vo.Filter(TD.vo.Filter.IS_FROM_VERIFIED, !0, !0), t.push(e) | |
} | |
return t | |
}, TD.util.columnUtils = function () { | |
var e = {}; | |
return e.storageColumnTypes = { | |
OTHER: "other", | |
HOME: "home", | |
ME: "me", | |
INBOX: "privateMe", | |
SCHEDULED: "scheduled" | |
}, e.feedTypes = { | |
HOME: "home", | |
USERTIMELINE: "usertimeline", | |
INTERACTIONS: "interactions", | |
MENTIONS: "mentions", | |
SEARCH: "search", | |
LIST: "list", | |
CUSTOMTIMELINE: "customtimeline", | |
DIRECT: "direct", | |
USERTWEETS: "usertweets", | |
FAVORITES: "favorites", | |
NETWORKACTIVITY: "networkactivity", | |
SCHEDULED: "scheduled" | |
}, e.columnMetaTypes = { | |
TIMELINE: "col_timeline", | |
INTERACTIONS: "col_interactions", | |
MENTIONS: "col_mentions", | |
FOLLOWERS: "col_followers", | |
SEARCH: "col_search", | |
LIST: "col_list", | |
CUSTOMTIMELINE: "col_customtimeline", | |
MESSAGES: "col_messages", | |
USERTWEETS: "col_usertweets", | |
FAVORITES: "col_favorites", | |
ACTIVITY: "col_activity", | |
HOME: "col_home", | |
ME: "col_me", | |
INBOX: "col_inbox", | |
SCHEDULED: "col_scheduled", | |
UNKNOWN: "col_unknown" | |
}, e.columnMetaTypeToScribeNamespace = {}, TD.util.extendObjectWith(e.columnMetaTypeToScribeNamespace, [ | |
[e.columnMetaTypes.TIMELINE, { | |
page: "home", | |
section: "" | |
}], | |
[e.columnMetaTypes.INTERACTIONS, { | |
page: "connect", | |
section: "activity" | |
}], | |
[e.columnMetaTypes.MENTIONS, { | |
page: "connect", | |
section: "mentions" | |
}], | |
[e.columnMetaTypes.SEARCH, { | |
page: "search", | |
section: "tweets" | |
}], | |
[e.columnMetaTypes.LIST, { | |
page: "list", | |
section: "tweets" | |
}], | |
[e.columnMetaTypes.USERTWEETS, { | |
page: "profile_tweets", | |
section: "" | |
}], | |
[e.columnMetaTypes.FAVORITES, { | |
page: "favorites", | |
section: "" | |
}], | |
[e.columnMetaTypes.ACTIVITY, { | |
page: "network_activity", | |
section: "" | |
}], | |
[e.columnMetaTypes.HOME, { | |
page: "home", | |
section: "" | |
}], | |
[e.columnMetaTypes.ME, { | |
page: "connect", | |
section: "mentions" | |
}] | |
]), e.columnIconClasses = { | |
TWITTER: "icon-twitter-bird", | |
HASH: "icon-hash", | |
CONTENT: "icon-content", | |
USER: "icon-user", | |
HOME: "icon-home", | |
INTERACTIONS: "icon-notifications", | |
ACTIVITY: "icon-activity", | |
MENTIONS: "icon-mention", | |
FOLLOWERS: "icon-follow", | |
MESSAGES: "icon-message", | |
SEARCH: "icon-search", | |
LIST: "icon-list", | |
TWEETS: "icon-tweets", | |
FAVORITES: "icon-favorite", | |
SCHEDULED: "icon-schedule", | |
TRENDS: "icon-trending", | |
CUSTOMTIMELINE: "icon-custom-timeline" | |
}, e.columnClasses = { | |
TWITTER: "type-twitter", | |
HOME: "column-type-home", | |
INTERACTIONS: "column-type-interactions", | |
ACTIVITY: "column-type-activity", | |
MENTIONS: "column-type-mention", | |
FOLLOWERS: "column-type-new-followers", | |
MESSAGES: "column-type-message", | |
SEARCH: "column-type-search", | |
LIST: "column-type-list", | |
CUSTOMTIMELINE: "column-type-customtimeline", | |
TWEETS: "column-type-tweets", | |
FAVORITES: "column-type-favorite", | |
SCHEDULED: "column-type-scheduled", | |
TRENDS: "column-type-trends" | |
}, e.columnMetaTypeToIconClass = {}, TD.util.extendObjectWith(e.columnMetaTypeToIconClass, [ | |
[e.columnMetaTypes.TIMELINE, e.columnIconClasses.HOME], | |
[e.columnMetaTypes.INTERACTIONS, e.columnIconClasses.INTERACTIONS], | |
[e.columnMetaTypes.MENTIONS, e.columnIconClasses.MENTIONS], | |
[e.columnMetaTypes.FOLLOWERS, e.columnIconClasses.FOLLOWERS], | |
[e.columnMetaTypes.SEARCH, e.columnIconClasses.SEARCH], | |
[e.columnMetaTypes.LIST, e.columnIconClasses.LIST], | |
[e.columnMetaTypes.CUSTOMTIMELINE, e.columnIconClasses.CUSTOMTIMELINE], | |
[e.columnMetaTypes.MESSAGES, e.columnIconClasses.MESSAGES], | |
[e.columnMetaTypes.USERTWEETS, e.columnIconClasses.USER], | |
[e.columnMetaTypes.FAVORITES, e.columnIconClasses.FAVORITES], | |
[e.columnMetaTypes.ACTIVITY, e.columnIconClasses.ACTIVITY], | |
[e.columnMetaTypes.HOME, e.columnIconClasses.HOME], | |
[e.columnMetaTypes.ME, e.columnIconClasses.MENTIONS], | |
[e.columnMetaTypes.INBOX, e.columnIconClasses.MESSAGES], | |
[e.columnMetaTypes.SCHEDULED, e.columnIconClasses.SCHEDULED], | |
[e.columnMetaTypes.UNKNOWN, e.columnIconClasses.TWITTER] | |
]), e.columnMetaTypeToClass = {}, TD.util.extendObjectWith(e.columnMetaTypeToClass, [ | |
[e.columnMetaTypes.TIMELINE, e.columnClasses.HOME], | |
[e.columnMetaTypes.INTERACTIONS, e.columnClasses.INTERACTIONS], | |
[e.columnMetaTypes.MENTIONS, e.columnClasses.MENTIONS], | |
[e.columnMetaTypes.FOLLOWERS, e.columnClasses.FOLLOWERS], | |
[e.columnMetaTypes.SEARCH, e.columnClasses.SEARCH], | |
[e.columnMetaTypes.LIST, e.columnClasses.LIST], | |
[e.columnMetaTypes.CUSTOMTIMELINE, e.columnClasses.CUSTOMTIMELINE], | |
[e.columnMetaTypes.MESSAGES, e.columnClasses.MESSAGES], | |
[e.columnMetaTypes.USERTWEETS, e.columnClasses.TWEETS], | |
[e.columnMetaTypes.FAVORITES, e.columnClasses.FAVORITES], | |
[e.columnMetaTypes.ACTIVITY, e.columnClasses.ACTIVITY], | |
[e.columnMetaTypes.HOME, e.columnClasses.HOME], | |
[e.columnMetaTypes.ME, e.columnClasses.MENTIONS], | |
[e.columnMetaTypes.INBOX, e.columnClasses.MESSAGES], | |
[e.columnMetaTypes.SCHEDULED, e.columnClasses.SCHEDULED], | |
[e.columnMetaTypes.UNKNOWN, e.columnClasses.TWITTER] | |
]), e.columnMetaTypeToTitleTemplateData = {}, TD.util.extendObjectWith(e.columnMetaTypeToTitleTemplateData, [ | |
[e.columnMetaTypes.TIMELINE, { | |
title: TD.i("Home", null, !0), | |
needsUserAttribution: !0 | |
}], | |
[e.columnMetaTypes.INTERACTIONS, { | |
title: TD.i("Notifications", null, !0), | |
needsUserAttribution: !0 | |
}], | |
[e.columnMetaTypes.MENTIONS, { | |
title: TD.i("Mentions", null, !0), | |
needsUserAttribution: !0 | |
}], | |
[e.columnMetaTypes.FOLLOWERS, { | |
title: TD.i("Followers", null, !0), | |
needsUserAttribution: !0 | |
}], | |
[e.columnMetaTypes.SEARCH, { | |
needsUserAttribution: !0 | |
}], | |
[e.columnMetaTypes.LIST, { | |
needsUserAttribution: !0 | |
}], | |
[e.columnMetaTypes.CUSTOMTIMELINE, { | |
needsUserAttribution: !0, | |
editableFieldClass: "js-customtimeline-title", | |
maxLength: 25 | |
}], | |
[e.columnMetaTypes.MESSAGES, { | |
title: TD.i("Messages", null, !0), | |
needsUserAttribution: !0 | |
}], | |
[e.columnMetaTypes.USERTWEETS, { | |
title: TD.i("User", null, !0), | |
needsUserAttribution: !0 | |
}], | |
[e.columnMetaTypes.FAVORITES, { | |
title: TD.i("Favorites", null, !0), | |
needsUserAttribution: !0 | |
}], | |
[e.columnMetaTypes.ACTIVITY, { | |
title: TD.i("Activity", null, !0), | |
needsUserAttribution: !0 | |
}], | |
[e.columnMetaTypes.HOME, { | |
title: TD.i("Home", null, !0) | |
}], | |
[e.columnMetaTypes.ME, { | |
title: TD.i("Mentions", null, !0) | |
}], | |
[e.columnMetaTypes.INBOX, { | |
title: TD.i("Messages", null, !0) | |
}], | |
[e.columnMetaTypes.SCHEDULED, { | |
title: TD.i("Scheduled", null, !0), | |
needsUserAttribution: !0 | |
}], | |
[e.columnMetaTypes.UNKNOWN, { | |
title: TD.i("Unknown Column", null, !0) | |
}] | |
]), e.embeddableColumnTypes = [e.columnMetaTypes.FAVORITES, e.columnMetaTypes.USERTWEETS, e.columnMetaTypes.SEARCH, e.columnMetaTypes.LIST, e.columnMetaTypes.CUSTOMTIMELINE], e.shareableColumnTypes = [e.columnMetaTypes.CUSTOMTIMELINE], e.viewableColumnTypes = [e.columnMetaTypes.CUSTOMTIMELINE], e.filterableColumnTypes = [e.columnMetaTypes.TIMELINE, e.columnMetaTypes.INTERACTIONS, e.columnMetaTypes.MENTIONS, e.columnMetaTypes.FOLLOWERS, e.columnMetaTypes.SEARCH, e.columnMetaTypes.LIST, e.columnMetaTypes.CUSTOMTIMELINE, e.columnMetaTypes.MESSAGES, e.columnMetaTypes.USERTWEETS, e.columnMetaTypes.FAVORITES, e.columnMetaTypes.ACTIVITY, e.columnMetaTypes.HOME, e.columnMetaTypes.ME, e.columnMetaTypes.INBOX, e.columnMetaTypes.SCHEDULED], e.actionColumnTypes = [e.columnMetaTypes.INTERACTIONS, e.columnMetaTypes.MENTIONS, e.columnMetaTypes.ACTIVITY, e.columnMetaTypes.FOLLOWERS], e.singleActionColumnTypes = [e.columnMetaTypes.MENTIONS, e.columnMetaTypes.FOLLOWERS], e.mediaPreviewableColumnTypes = [e.columnMetaTypes.TIMELINE, e.columnMetaTypes.INTERACTIONS, e.columnMetaTypes.MENTIONS, e.columnMetaTypes.SEARCH, e.columnMetaTypes.LIST, e.columnMetaTypes.CUSTOMTIMELINE, e.columnMetaTypes.USERTWEETS, e.columnMetaTypes.FAVORITES, e.columnMetaTypes.ACTIVITY, e.columnMetaTypes.HOME, e.columnMetaTypes.ME], e.getColumnType = function (t) { | |
var i = t.model.getType(), | |
n = t.getFeeds(); | |
switch (i) { | |
case e.storageColumnTypes.HOME: | |
return e.columnMetaTypes.HOME; | |
case e.storageColumnTypes.ME: | |
return e.columnMetaTypes.ME; | |
case e.storageColumnTypes.INBOX: | |
return e.columnMetaTypes.INBOX; | |
case e.storageColumnTypes.SCHEDULED: | |
return e.columnMetaTypes.SCHEDULED; | |
default: | |
return 1 === n.length ? e._inferColumnTypeFromFeed(n[0], t) : e.columnMetaTypes.UNKNOWN | |
} | |
}, e.isMessageColumn = function (t) { | |
var i = e.getColumnType(t); | |
return i === e.columnMetaTypes.MESSAGES || i === e.columnMetaTypes.INBOX | |
}, e._twitterFeedTypeToColumnMetaType = {}, TD.util.extendObjectWith(e._twitterFeedTypeToColumnMetaType, [ | |
[e.feedTypes.HOME, e.columnMetaTypes.TIMELINE], | |
[e.feedTypes.USERTIMELINE, e.columnMetaTypes.TIMELINE], | |
[e.feedTypes.INTERACTIONS, e.columnMetaTypes.INTERACTIONS], | |
[e.feedTypes.MENTIONS, e.columnMetaTypes.MENTIONS], | |
[e.feedTypes.SEARCH, e.columnMetaTypes.SEARCH], | |
[e.feedTypes.LIST, e.columnMetaTypes.LIST], | |
[e.feedTypes.CUSTOMTIMELINE, e.columnMetaTypes.CUSTOMTIMELINE], | |
[e.feedTypes.DIRECT, e.columnMetaTypes.MESSAGES], | |
[e.feedTypes.USERTWEETS, e.columnMetaTypes.USERTWEETS], | |
[e.feedTypes.FAVORITES, e.columnMetaTypes.FAVORITES], | |
[e.feedTypes.NETWORKACTIVITY, e.columnMetaTypes.ACTIVITY] | |
]), e._inferColumnTypeFromFeed = function (t, i) { | |
var n, r, s, o = t.getService(), | |
a = t.getType(), | |
c = t.getMetadata(), | |
u = e.columnMetaTypes.UNKNOWN; | |
if ("twitter" === o) switch (u = e._twitterFeedTypeToColumnMetaType[a] || u, a) { | |
case e.feedTypes.SEARCH: | |
var l = twttr.txt.extractMentionsWithIndices(c.term); | |
if (1 === l.length) { | |
var d = l[0]; | |
0 === d.indices[0] && d.indices[1] === c.term.length && (u = e.columnMetaTypes.MENTIONS) | |
} | |
break; | |
case e.feedTypes.INTERACTIONS: | |
n = i.model.getFilters(), n && (r = new TD.vo.ActionFilter(n.action), s = TD.vo.ActionFilter.MAX_INTERACTION_FILTERS, r.getFilters().length === s - 1 && r.showFollowers && (u = e.columnMetaTypes.FOLLOWERS)) | |
} | |
return u | |
}, e.getColumnIconClassByColumnType = function (t) { | |
return e.columnMetaTypeToIconClass[t] | |
}, e.getColumnClassByColumnType = function (t) { | |
return e.columnMetaTypeToClass[t] | |
}, e.getColumnTitleHTML = function (t, i) { | |
i = i || {}; | |
for (var n, r, s, o, a, c, u, l, d, h, p = !1, f = t.getColumnType(), m = t.getFeeds(), g = t.model.getTitle(), T = e.columnMetaTypeToTitleTemplateData[f], v = {}, y = 0; y < m.length; y++) { | |
if (n = m[y], r = n.getType(), s = n.getMetadata()) switch (r) { | |
case e.feedTypes.LIST: | |
c = TD.cache.names.getScreenName(s.ownerId), d = TD.cache.names.getListName(s.listId, s.ownerId), d ? v.title = d : p = !0; | |
break; | |
case e.feedTypes.CUSTOMTIMELINE: | |
c = TD.cache.names.getScreenName(s.ownerId), u = TD.storage.accountController.get(n.getAccountKey()).getProfileImageURL(), h = TD.cache.names.getCustomTimelineName(s.id), v.title = h; | |
break; | |
case e.feedTypes.SEARCH: | |
f === e.columnMetaTypes.MENTIONS ? c = s.term : l = s.baseQuery ? s.baseQuery : s.term, l ? (v.title = l, -1 === l.indexOf('"') && (v.quote = !0)) : p = !0; | |
break; | |
default: | |
s.id ? (c = TD.cache.names.getScreenName(s.id), c || (p = !0)) : f === e.columnMetaTypes.SCHEDULED && (c = TD.i("All accounts")), v.title = T.title | |
} | |
c || (o = TD.storage.accountController.get(n.getAccountKey()), a = o.getType(), "tweetdeck" !== a && (c = o.getUsername(), "twitter" === a && (c = TD.util.atMentionify(c)))) | |
} | |
return T.needsUserAttribution && (c ? (v.needsUserAttribution = T.needsUserAttribution, v.screenName = c, v.profileImageUrl = u) : p = !0), p ? TD.util.escape(g) : f === e.columnMetaTypes.UNKNOWN ? g ? TD.util.escape(g) : TD.ui.template.render("column_title", v) : i.editable ? (v.editableFieldClass = T.editableFieldClass, v.maxLength = T.maxLength, TD.ui.template.render("column_title_editable", v)) : TD.ui.template.render("column_title", v) | |
}, e.inferFeedTypeFromActionFilter = function (e) { | |
var t = this.feedTypes.INTERACTIONS; | |
return e.getFilters().length === TD.vo.ActionFilter.MAX_INTERACTION_FILTERS - 1 && e.showMentions && (t = this.feedTypes.MENTIONS), t | |
}, e | |
}(), TD.cache.lists = function () { | |
function e(e) { | |
var i = t[e] || {}; | |
return t[e] = i, i | |
} | |
var t = {}, | |
i = {}; | |
return i.add = function (t) { | |
var i = e(t.account.getKey()); | |
i[t.id] = t, TD.controller.feedManager.fixListFeeds(), TD.cache.names.updateScreenName(t.user.id, t.user.screenName), TD.cache.names.updateListName(t.id, t.name) | |
}, i.unsubscribe = function (t) { | |
var i = e(t.account.getKey()); | |
delete i[t.id] | |
}, i.purge = function (e) { | |
var i; | |
if (_.each(t, function (t) { | |
i = i || t[e], delete t[e] | |
}), i) { | |
var n = TD.storage.Feed.generateKeyFor(i.account.getKey(), "list", { | |
listId: e | |
}); | |
TD.controller.feedManager.deleteFeedsWhere(function (e) { | |
return e.getKey() === n | |
}) | |
} | |
}, i.getListsFor = function (t) { | |
return _.values(e(t)) | |
}, i.find = function (e, i, n, r, s) { | |
var o, a = void 0, | |
c = void 0; | |
return i && n && (o = "@" + i.toLowerCase() + "/" + n.toLowerCase()), _.each(t, function (t, i) { | |
s && s !== i || _.each(t, function (t) { | |
(e && t.id === e || t.fullName.toLowerCase() === o) && (t.isOwnList() ? a = t : c = t) | |
}) | |
}), r ? a : a || c | |
}, i.getAll = function () { | |
var e = {}; | |
return _.each(t, function (t) { | |
_.extend(e, t) | |
}), _.values(e) | |
}, i | |
}(), TD.cache.LRUQueue = klass(function (e) { | |
this.maxSize = e, this.length = 0, this._first = void 0, this._last = void 0, this._index = {}, this._lefts = {}, this._rights = {} | |
}).methods({ | |
enqueue: function (e, t) { | |
this.dequeue(e), 0 == this.length ? this._first = this._last = e : (this._lefts[this._first] = e, this._rights[e] = this._first, this._first = e), this._index[e] = t, this.length++, this.prune() | |
}, | |
dequeue: function (e) { | |
if (!_.isUndefined(this._index[e])) { | |
var t = this._lefts[e], | |
i = this._rights[e]; | |
t ? this._rights[t] = i : this._first = i, i ? this._lefts[i] = t : this._last = t, delete this._index[e], delete this._rights[e], delete this._lefts[e], this.length-- | |
} | |
}, | |
prune: function () { | |
for (; this.maxSize && this.length > this.maxSize;) this.dequeue(this._last) | |
}, | |
get: function (e) { | |
return this._index[e] | |
}, | |
getOrElse: function (e, t) { | |
var i = this._index[e]; | |
return void 0 === i && (i = _.isFunction(t) ? t() : t, this.enqueue(e, i)), i | |
}, | |
take: function (e) { | |
var t = [], | |
i = this._first; | |
e = Math.min(e, this.length); | |
for (var n = 0; e > n; n++) t.push(this._index[i]), i = this._rights[i]; | |
return t | |
} | |
}), TD.cache.names = function () { | |
return self = { | |
SECONDS_IN_ONE_WEEK: 604800, | |
_cache: null | |
}, self.init = function () { | |
self._cache = TD.settings.getNameCache(), self._cache.users = self._cache.users || {}, self._cache.lists = self._cache.lists || {}, self._cache.customTimelines = self._cache.customTimelines || {}, $.subscribe("/storage/client/column_order_changed", function () { | |
self.prune(), self.commit() | |
}), $.subscribe("/storage/column/feeds_changed", function (e, t, i) { | |
var n = TD.storage.columnController.get(i.getKey()); | |
n && !n.temporary && self.commit() | |
}) | |
}, self.getScreenName = function (e) { | |
var t, i, n = TD.util.unixTime(new Date), | |
r = TD.storage.Account.generateKeyFor("twitter", e), | |
s = TD.storage.accountController.get(r); | |
return s ? (i = TD.util.atMentionify(s.getUsername()), self.addScreenName(e, i)) : (t = self._cache.users[e], t && (i = t.name), (!t || t.timestamp + self.SECONDS_IN_ONE_WEEK < n) && self._fetchUser(e)), i | |
}, self.getListName = function (e, t) { | |
var i, n, r = TD.util.unixTime(new Date), | |
s = TD.cache.lists.find(e, "", ""); | |
return s ? (i = s.name, self.addListName(e, i)) : (n = self._cache.lists[e], n && (i = n.name), (!n || n.timestamp + self.SECONDS_IN_ONE_WEEK < r) && self._fetchList(e, t)), i | |
}, self.getCustomTimelineName = function (e, t) { | |
var i, n, r = TD.util.unixTime(new Date); | |
return n = self._cache.customTimelines[e], n && (i = n.name), (!n || n.timestamp + self.SECONDS_IN_ONE_WEEK < r) && self._fetchCustomTimeline(e, t), i | |
}, self.addScreenName = function (e, t) { | |
if (self._cache) { | |
var i = {}, | |
n = self._cache.users[e], | |
r = TD.util.atMentionify(t), | |
s = !n || r !== n.name; | |
i.name = r, i.timestamp = TD.util.unixTime(new Date), self._cache.users[e] = i, s && (self.commit(), TD.storage.notification.notify("/cache/names/change")) | |
} | |
}, self.addListName = function (e, t) { | |
if (self._cache) { | |
var i = {}, | |
n = self._cache.lists[e], | |
r = !n || t !== n.name; | |
i.name = t, i.timestamp = TD.util.unixTime(new Date), self._cache.lists[e] = i, r && (self.commit(), TD.storage.notification.notify("/cache/names/change")) | |
} | |
}, self.addCustomTimelineName = function (e, t) { | |
if (self._cache && t) { | |
var i = {}, | |
n = self._cache.customTimelines[e], | |
r = !n || t !== n.name; | |
i.name = t, i.timestamp = TD.util.unixTime(new Date), self._cache.customTimelines[e] = i, r && (self.commit(), TD.storage.notification.notify("/cache/names/change")) | |
} | |
}, self.updateScreenName = function (e, t) { | |
if (self._cache) { | |
var i = self._cache.users[e]; | |
i && self.addScreenName(e, t) | |
} | |
}, self.updateListName = function (e, t) { | |
if (self._cache) { | |
var i = self._cache.lists[e]; | |
i && self.addScreenName(e, t) | |
} | |
}, self.updateCustomTimelineName = function (e, t) { | |
if (self._cache) { | |
var i = self._cache.customTimelines[e]; | |
i && self.addCustomTimelineName(e, t) | |
} | |
}, self._fetchUser = function (e) { | |
var t = TD.cache.twitterUsers.getById(e); | |
t.addCallback(function (t) { | |
self.addScreenName(e, t.screenName) | |
}) | |
}, self._fetchList = function (e, t) { | |
var i = TD.storage.Account.generateKeyFor("twitter", t), | |
n = TD.controller.clients.getClient(i); | |
n = n || TD.controller.clients.getPreferredClient("twitter"), n.getList(e, null, null, function (t) { | |
self.addListName(e, t.name) | |
}) | |
}, self._fetchCustomTimeline = function (e, t) { | |
var i = TD.storage.Account.generateKeyFor("twitter", t), | |
n = TD.controller.clients.getClient(i); | |
n = n || TD.controller.clients.getPreferredClient("twitter"), n.getCustomTimeline(e, function (t) { | |
self.addCustomTimelineName(e, t.name) | |
}) | |
}, self.commit = _.debounce(function () { | |
self.prune(), TD.settings.setNameCache(self._cache) | |
}, 100), self.prune = function () { | |
self._cache = self._getPrunedCache() | |
}, self._getPrunedCache = function () { | |
var e = { | |
users: {}, | |
lists: {}, | |
customTimelines: {} | |
}, | |
t = TD.storage.feedController.getAll(); | |
return _.each(t, function (t) { | |
var i, n, r, s = t.getType(), | |
o = t.getMetadata(); | |
if (o) { | |
switch (s) { | |
case TD.util.columnUtils.feedTypes.CUSTOMTIMELINE: | |
r = o.id, i = o.ownerId; | |
break; | |
case TD.util.columnUtils.feedTypes.LIST: | |
n = o.listId, i = o.ownerId; | |
break; | |
default: | |
i = o.id | |
} | |
i && self._cache.users[i] && (e.users[i] = self._cache.users[i]), r && self._cache.customTimelines[r] && (e.customTimelines[r] = self._cache.customTimelines[r]), n && self._cache.lists[n] && (e.lists[n] = self._cache.lists[n]) | |
} | |
}), e | |
}, self | |
}(), TD.cache.twitterUsers = function () { | |
function e() { | |
_.each(s.splice(o), function (e) { | |
delete n[e.id], delete r[e.screenName.toLowerCase()] | |
}) | |
} | |
function t(e, t) { | |
var i, s, o, a; | |
return e || t ? (i = e ? n[e] : r[t.toLowerCase()], i ? a = TD.core.defer.succeed(i) : (s = TD.storage.accountController.getPreferredAccount("twitter"), o = TD.controller.clients.getClient(s.getKey()), a = new TD.core.defer.Deferred, o.showUser(e, t, function (e) { | |
a.callback(e) | |
}, function (i, n, r) { | |
a.errback(new TD.core.defer.XMLHttpRequestError(i, r)), i && i.errors && i.errors.forEach(function (i) { | |
i === o.ERRORS.SUSPENDED_USER && $.publish("/user/suspended", [e, t]) | |
}) | |
}))) : a = TD.core.defer.fail("Must provide user ID or screen name"), a | |
} | |
var i = {}, | |
n = {}, | |
r = {}, | |
s = [], | |
o = 500; | |
return i.add = function (t) { | |
var i = n[t.id]; | |
i ? delete r[i.screenName.toLowerCase()] : s.unshift(t), n[t.id] = t, r[t.screenName.toLowerCase()] = t, e() | |
}, i.getById = function (e) { | |
return t(e, null) | |
}, i.getByScreenName = function (e) { | |
return t(null, e) | |
}, i | |
}(), TD.controller.clients = function () { | |
var e = {}, | |
t = function (e, t) { | |
switch (e) { | |
case "twitter": | |
return new TD.services.TwitterClient(t); | |
case "tweetdeck": | |
return new TD.services.TweetDeckClient | |
} | |
}; | |
return { | |
init: function () { | |
$.subscribe("/storage/account/new", function () { | |
TD.controller.clients.initialiseClients() | |
}), TD.controller.clients.initialiseClients() | |
}, | |
initialiseClients: function () { | |
for (var i, n = TD.storage.accountController.getPostingAccounts(), r = 0; r < n.length; r++) i = e[n[r].getKey()], i || (i = t(n[r].getType(), n[r]), e[n[r].getKey()] = i); | |
e.tweetdeck || (e.tweetdeck = new TD.services.TweetDeckClient), TD.controller.scheduler.schedulePeriodicTask(1200, TD.controller.clients.refreshRetweetBlockLists) | |
}, | |
getClient: function (t) { | |
return e[t] | |
}, | |
getTDClient: function () { | |
return e.tweetdeck | |
}, | |
getClientsByService: function (t) { | |
var i = []; | |
for (var n in e) e[n].type == t && i.push(e[n]); | |
return i | |
}, | |
getPreferredClient: function (e) { | |
var t = TD.storage.accountController.getPreferredAccount(e); | |
return t ? this.getClient(t.getKey()) : void 0 | |
}, | |
showSharedAccountWarning: function () { | |
var e = new TD.core.defer.Deferred, | |
t = function () { | |
$(document).off("uiAccountSharedWarningContinue uiAccountSharedWarningAbort") | |
}, | |
i = function () { | |
$(document).trigger("uiShowAccountSettings") | |
}; | |
return $(document).on("uiAccountSharedWarningContinue", function () { | |
t(), i(), e.callback() | |
}).on("uiAccountSharedWarningAbort", function () { | |
t(), i(), e.cancel() | |
}).on("uiAccountSharedWarningDismiss", function () { | |
t(), e.cancel() | |
}).trigger("uiShowAccountSharedWarning"), e | |
}, | |
addClient: function (e, t, i) { | |
var n = new TD.core.defer.Deferred, | |
r = TD.settings.getSoleUserState(), | |
s = TD.storage.store.getCurrentAuthType(); | |
"twitter" === s && r.shared && (n.addCallback(this.showSharedAccountWarning.bind(this)), n.addCallback(function () { | |
r.confirmed = !0, TD.settings.setSoleUserState(r) | |
})), n.addCallback(function () { | |
this.startAddClientFlow(e, t, i) | |
}.bind(this)), n.callback() | |
}, | |
startAddClientFlow: function (e, t, i) { | |
var n, r = this, | |
s = function () { | |
TD.storage.accountController.manage(t), r.initialiseClients() | |
}, | |
o = this.getClientsByService(e).length > 0; | |
t ? i ? (n = TD.controller.auth.create(e, t), n.start(t, s, o)) : s() : (t = new TD.storage.Account, t.setType(e), n = TD.controller.auth.create(e, t), n.start(t, s, o)) | |
}, | |
removeClient: function (t) { | |
var i = TD.storage.accountController.get(t); | |
e[t] && e[t].cleanUp && e[t].cleanUp(), delete e[t], TD.controller.feedManager.deleteFeedsWhere(function (e) { | |
return e.getAccountKey() === t | |
}), TD.storage.accountController.blacklistAccount(i) | |
}, | |
refreshRetweetBlockLists: function () { | |
if (TD.util.shouldStream()) { | |
var e = TD.controller.clients.getClientsByService("twitter"); | |
_.each(e, function (e) { | |
e.populateRetweetBlockList() | |
}) | |
} | |
} | |
} | |
}(), TD.controller.scheduler = function () { | |
var e = {}; | |
return e.QUERY_INTERVAL = 10, e.SLEEP_THRESHOLD = 20, e._tickInterval, e._tasks = {}, e._lastTickTime = null, e.init = function () { | |
this._tickInterval = setInterval(this._handleTick, 1e3 * this.QUERY_INTERVAL), e._lastTickTime = Date.now(), this._jQueryCleanupTaskId = TD.controller.scheduler.schedulePeriodicTask(600, function () { | |
jQuery.fragments = {} | |
}), TD.controller.feedScheduler.init() | |
}, e._handleTick = function () { | |
var t = Date.now(), | |
i = (t - e._lastTickTime) / 1e3 - e.QUERY_INTERVAL; | |
e._lastTickTime = t, i > e.SLEEP_THRESHOLD && $(document).trigger("dataAppWokenFromSleep", { | |
lateness: i | |
}), _.each(e._tasks, function (i) { | |
var n = t - i.cycleStartTime; | |
n > i.period && (e._fireTask(i), i.cycleStartTime = Date.now()) | |
}) | |
}, e._fireTask = function (e) { | |
try { | |
e.callback() | |
} catch (t) { | |
console.log("Error in periodic task:", e, "Error:", t) | |
} | |
}, e.schedulePeriodicTask = function (e, t, i) { | |
var n = { | |
id: _.uniqueId("sched_task_"), | |
callback: t, | |
period: 1e3 * e, | |
cycleStartTime: Date.now() | |
}; | |
return i && this._fireTask(n), this._tasks[n.id] = n, n.id | |
}, e.updatePeriodicTask = function (e, t, i) { | |
var n = this._tasks[e]; | |
n && (n.period = 1e3 * t, n.callback = i || n.callback) | |
}, e.restartPeriodicTask = function (e) { | |
var t = this._tasks[e]; | |
t && (t.cycleStartTime = Date.now()) | |
}, e.removePeriodicTask = function (e) { | |
delete this._tasks[e] | |
}, e | |
}(), TD.controller.feedScheduler = function () { | |
var e = {}; | |
return e.DEFAULT_REFRESH_PERIOD = 45, e.THROTTLED_REFRESH_PERIOD = 120, e._activeColumns = {}, e._temporaryColumns = {}, e._taskIndex = {}, e.init = function () { | |
this._refreshTaskId = TD.controller.scheduler.schedulePeriodicTask(10, this._trimColumns.bind(this), !1), this._streamingTaskId = TD.controller.scheduler.schedulePeriodicTask(120, this._startStreams.bind(this), !1), $.subscribe("/storage/column/feeds_changed", function (t, i, n) { | |
var r = n.getKey(), | |
s = TD.controller.columnManager.get(r); | |
e.addColumn(s, !s.temporary) | |
}), $.subscribe("/storage/column/change", function (t) { | |
var i = t.getKey(), | |
n = TD.controller.columnManager.get(i), | |
r = n.model.getFeedKeys(), | |
s = t.getFeedKeys(); | |
_.isEqual(r, s) || e.addColumn(n, !n.temporary) | |
}), $(document).on("dataRateLimit", this._handleRateLimitData.bind(this)), $(document).on("dataThrottleFeed", this._handleThrottleFeed.bind(this)), $(document).on("dataUserStreamStatus", this._handleStreamStatus.bind(this)), $(document).on("dataAppWokenFromSleep", this._handleAppWoken.bind(this)) | |
}, e._getTask = function (e, t) { | |
return this._taskIndex[e] ? this._taskIndex[e][t] : void 0 | |
}, e._setTask = function (e, t, i) { | |
this._taskIndex[e] = this._taskIndex[e] || {}, this._taskIndex[e][t] = i | |
}, e._handleRateLimitData = function (e, t) { | |
var i = this._getTask(t.accountKey, t.feedType); | |
i && (i.rateLimitData = t.rateLimitData, this._setPeriodicTask(i)) | |
}, e._handleThrottleFeed = function (e, t) { | |
var i = this._getTask(t.accountKey, t.feedType); | |
i && i.isThrottled !== t.doThrottle && (i.isThrottled = t.doThrottle, this._setPeriodicTask(i)) | |
}, e._handleStreamStatus = function (t, i) { | |
var n = this._taskIndex[i.accountKey]; | |
_.each(n, e._setPeriodicTask.bind(this)) | |
}, e._handleAppWoken = function (e, t) { | |
_.each(this._taskIndex, function (e) { | |
_.each(e, function (e) { | |
e.doTask(!0, !0), TD.controller.scheduler.restartPeriodicTask(e.taskId) | |
}) | |
}), TD.controller.stats.appWokenFromSleep(t.lateness) | |
}, e.addColumn = function (e, t) { | |
var i, n = e.getFeeds(), | |
r = e.model.getKey(); | |
this._activeColumns[r] && this.removeColumn(r), this._activeColumns[r] = e, e.temporary && (this._temporaryColumns[r] = e); | |
for (var s = 0; s < n.length; s++) i = TD.controller.feedManager.addFeed(n[s]), i.publishChirpsOrFetch(), this._addFeed(n[s]); | |
t && this._startStreams() | |
}, e._addFeed = function (e) { | |
var t, i = e.getAccountKey(), | |
n = e.getType(), | |
r = e.getKey(); | |
t = this._getTask(i, n) || { | |
accountKey: i, | |
feedType: n, | |
feeds: {}, | |
taskId: null, | |
rateLimitData: null, | |
isThrottled: !1, | |
doTask: null | |
}, t.doTask || (t.doTask = this._doTaskFactory(t)), this._setTask(i, n, t), t.feeds[r] = e, this._setPeriodicTask(t) | |
}, e._setPeriodicTask = function (e) { | |
var t = this._calculatePeriod(e); | |
e.taskId ? TD.controller.scheduler.updatePeriodicTask(e.taskId, t) : e.taskId = TD.controller.scheduler.schedulePeriodicTask(t, e.doTask, !1) | |
}, e._doTaskFactory = function (t) { | |
return function (i, n) { | |
var r = _.map(t.feeds, function (t, r) { | |
return e._refreshFeed(r, i, n) | |
}); | |
return TD.core.defer.gatherResults(r) | |
} | |
}, e._calculatePeriod = function (t) { | |
var i, n, r, s, o, a, c, u = this.DEFAULT_REFRESH_PERIOD; | |
return t.rateLimitData && (i = t.rateLimitData.rateLimitRemaining - 10, n = t.rateLimitData.rateLimitTotal, r = t.rateLimitData.rateLimitReset + 10, s = Date.now() / 1e3, o = r - s, c = _.filter(t.feeds, function (t) { | |
var i = t.getKey(), | |
n = Boolean(_.some(e._temporaryColumns, function (e) { | |
return -1 !== e.model.getFeedKeys().indexOf(i) | |
})); | |
return n || !TD.controller.feedManager.isStreaming(i) | |
}), o > 0 && i > 0 && c.length > 0 ? (a = i / c.length, u = o / a, u = Math.min(u, o)) : u = 0 >= o ? this.DEFAULT_REFRESH_PERIOD : o), u = Math.round(u), u = Math.max(u, 10), u = Math.min(u, 900), (t.isThrottled || TD.decider.get(TD.decider.THROTTLE_POLLING_PERIOD)) && (u = Math.max(u, this.THROTTLED_REFRESH_PERIOD)), u | |
}, e._refreshFeed = function (e, t, i) { | |
var t = t || Boolean(_.some(this._temporaryColumns, function (t) { | |
return -1 !== t.model.getFeedKeys().indexOf(e) | |
})), | |
n = TD.controller.feedManager.getPoller(e); | |
return i && n.removeAll(), n.refresh(t, i) | |
}, e.removeColumn = function (e) { | |
delete this._activeColumns[e], delete this._temporaryColumns[e], this._rebuildTaskIndex(), TD.controller.feedManager.cleanupFeeds() | |
}, e._rebuildTaskIndex = function () { | |
_.each(this._taskIndex, function (e) { | |
_.each(e, function (e) { | |
e.feeds = {} | |
}) | |
}), _.each(this._activeColumns, function (t) { | |
_.each(t.getFeeds(), function (t) { | |
e._addFeed(t) | |
}) | |
}), _.each(this._taskIndex, function (e) { | |
_.each(e, function (e) { | |
_.isEmpty(e.feeds) && (TD.controller.scheduler.removePeriodicTask(e.taskId), e.taskId = null) | |
}) | |
}) | |
}, e.refreshColumn = function (e) { | |
var t, i = this._activeColumns[e]; | |
if (i) { | |
t = i.getFeeds(); | |
for (var n = 0; n < t.length; n++) this._refreshFeed(t[n].getKey()) | |
} | |
}, e.refreshAccountFeeds = function (e, t) { | |
_.each(this._taskIndex[e], function (e) { | |
e.doTask(t) | |
}) | |
}, e._startStreams = function () { | |
for (var e = TD.storage.accountController.getAccountsForService("twitter"), t = 0; t < e.length; t++) TD.controller.clients.getClient(e[t].getKey()).checkUserStream() | |
}, e._trimColumns = function () { | |
_.each(this._activeColumns, function (e) { | |
e.trimUpdates() | |
}) | |
}, e | |
}(), TD.controller.FeedPoller = function (e) { | |
this.OPTIMUM_ARRAY_LENGTH = 200, this.CLEANUP_WAIT_PERIOD = 12e4, this.TWEET_ID_QUEUE_LENGTH = 500, this.feed = e, this.mark = "", this.chirpArray = [], this.chirpIndex = {}, this.seenTweetIDs = new TD.cache.LRUQueue(this.TWEET_ID_QUEUE_LENGTH), this.refreshLock = 0, this.REFRESH_LOCK_EXPIRY = 6e4, this.isExhausted = !1, this.lastInfiniteScrollTime = 0, this.shouldSetLatestTime = !1, this._checkNotifications = function () { | |
if (this.shouldSetLatestTime = !1, "twitter" === this.feed.getService() && "direct" === this.feed.getType()) this.shouldSetLatestTime = !0; | |
else { | |
var t = TD.storage.columnController.getColumnsContainingFeed(e.getKey()); | |
this.shouldSetLatestTime = Boolean(_.find(t, function (e) { | |
return e.getHasSound() || e.getHasNotification() | |
})) | |
} | |
}; | |
var t = function (t, i, n) { | |
("has_notification" === t || "has_sound" === t) && n && _.include(n.getFeedKeys(), e.getKey()) && this._checkNotifications() | |
}; | |
this.subscription = $.subscribe("/storage/column/column_flags_changed", _.bind(t, this)), this._checkNotifications(), this.reorderChirp = function (e) { | |
var t = this.chirpIndex[e]; | |
t && (this.removeChirp(e), this.acceptChirps([t])) | |
}, this.sortFunction = function (e, t) { | |
return t.created.getTime() - e.created.getTime() | |
}, this.removeChirp = function (e) { | |
var t, i = this.chirpIndex[e]; | |
if (i) { | |
for (var n = 0; n < this.chirpArray.length; n++) | |
if (t = this.chirpArray[n], t === i) { | |
this.chirpArray.splice(n, 1); | |
break | |
} | |
delete this.chirpIndex[e], $.publish("/delete/" + this.feed.getKey(), [this, [i]]) | |
} | |
}, this.removeWhere = function (e) { | |
this.doWhere(e, function (e) { | |
this.removeChirp(e.id) | |
}.bind(this)) | |
}, this.doWhere = function (e, t) { | |
var i = this.chirpArray.filter(e); | |
i.forEach(t) | |
}, this.removeAll = function () { | |
for (var e = this.chirpArray.length; e--;) this.removeChirp(this.chirpArray[e].id) | |
}, this.getRangeStartTime = function () { | |
var e, t = (Number.MAX_VALUE, this.feed); | |
return this.isExhausted ? 0 : "twitter" === t.getService() && "direct" === t.getType() ? 0 : "tweetdeck" === t.getService() ? 0 : (e = this.getOldestChirp(), e ? e.created.getTime() : 0) | |
}, this.acceptChirps = function (t) { | |
var i; | |
if (t) { | |
i = this.addChirpsToMemCache(t), this.publishChirps(i); | |
for (var n = 0, r = 0; r < i.length; r++) n = Math.max(n, i[r].created.getTime()); | |
this.shouldSetLatestTime && e.setLatestTime(Math.max(e.getLatestTime(), n)) | |
} | |
}, this.refresh = function (e, t) { | |
var i = this, | |
n = this.feed, | |
r = (i.chirpArray, (new Date).getTime()); | |
if (this.refreshLock && !(r > this.refreshLock + this.REFRESH_LOCK_EXPIRY)) return TD.core.defer.succeed(); | |
var s = TD.controller.clients.getClient(n.getAccountKey()); | |
if (!s) return TD.core.defer.fail(); | |
this.refreshLock = r; | |
try { | |
var o = new TD.core.defer.Deferred; | |
return o.addCallback(function (e) { | |
i.refreshLock = 0, i.acceptChirps(e) | |
}), o.addErrback(function () { | |
i.refreshLock = 0 | |
}), s.refreshFeed(this, !1, _.bind(o.callback, o), _.bind(o.errback, o), e, t), o | |
} catch (a) { | |
return console.log("Error refreshing", this, ":", a), this.refreshLock = 0, TD.core.defer.fail() | |
} | |
}, this.publishChirpsOrFetch = function () { | |
this.chirpArray && this.chirpArray.length ? this.publishAll() : this.refresh() | |
}, this.getOldestChirp = function () { | |
return this.chirpArray[this.chirpArray.length - 1] | |
}, this.addChirpsToMemCache = function (e) { | |
var t, i, n, r, s, o, a = [], | |
c = []; | |
for (t = 0; t < e.length; t++) i = e[t], n = this.chirpIndex[i.id], r = this.isRepeatedRetweet(i), n ? n.update(i) && c.push(n) : r || (a.push(i), c.push(i), this.chirpIndex[i.id] = i); | |
return a.sort(TD.util.chirpDescSort), this.chirpArray.length && a.length && (s = this.chirpArray[0].created.getTime(), o = a[a.length - 1].created.getTime()), this.chirpArray = a.concat(this.chirpArray), s && o && s > o && this.chirpArray.sort(TD.util.chirpDescSort), c | |
}, this.isRepeatedRetweet = function (e) { | |
var t, i, n = !1; | |
return e instanceof TD.services.TwitterStatus && (t = e.getMainTweet().id, i = this.seenTweetIDs.get(t) || 0, n = e.isRetweetedStatus() && i > 0, this.seenTweetIDs.enqueue(t, i + 1)), n | |
}, this.fetchOlderChirps = function (e) { | |
this.lastInfiniteScrollTime = (new Date).getTime(); | |
var t = this, | |
i = t.feed, | |
n = new TD.core.defer.Deferred; | |
if (this.feed.getType() === TD.util.columnUtils.feedTypes.SCHEDULED && (this.isExhausted = !0), this.getRangeStartTime() < e) n.callback(this.chirpArray); | |
else { | |
var r = TD.controller.clients.getClient(i.getAccountKey()); | |
r.refreshFeed(this, !0, function (e) { | |
t.addChirpsToMemCache(e), 0 === e.length && (t.isExhausted = !0), n.callback(t.chirpArray) | |
}, function (e) { | |
n.errback(e) | |
}) | |
} | |
return n | |
}, this.trimChirps = function () { | |
if (!(this.chirpArray.length < this.OPTIMUM_ARRAY_LENGTH)) { | |
var e = (new Date).getTime() - this.lastInfiniteScrollTime; | |
if (!(e < this.CLEANUP_WAIT_PERIOD)) { | |
for (var t = this.chirpArray.splice(this.OPTIMUM_ARRAY_LENGTH, Number.MAX_VALUE), i = 0; i < t.length; i++) delete this.chirpIndex[t[i].id]; | |
this.isExhausted = !1 | |
} | |
} | |
}, this.addChirps = function (e) { | |
var t = this.addChirpsToMemCache(e); | |
this.publishChirps(t) | |
}, this.publishAll = function () { | |
this.publishChirps(this.chirpArray) | |
}, this.publishChirps = function (e) { | |
$.publish("/feed/" + this.feed.getKey(), [this, e, this.feed.getLatestTime()]) | |
}, this.destroy = function () { | |
var e = this.feed; | |
this.chirpArray = [], this.chirpIndex = {}, $.unsubscribeAll("/feed/" + e.getKey()), $.unsubscribeAll("/delete/" + e.getKey()), $.unsubscribe(this.subscription) | |
} | |
}, TD.controller.feedManager = function () { | |
function e() { | |
var e, t = TD.storage.accountController.getDefault(), | |
i = t.getKey(); | |
"twitter" === t.getType() && (e = TD.storage.feedController.getAll(), e = _.filter(e, function (e) { | |
return "search" === e.getType() && e.getAccountKey() !== i | |
}), _.each(e, function (e) { | |
var t = TD.storage.feedController.getOrCreateFeed(e.getType(), e.getService(), i, e.getMetadata()); | |
TD.controller.feedManager.replaceFeed(e, t) | |
})) | |
} | |
function t(e, t) { | |
var i, n = t && t.toLowerCase(); | |
i = t ? TD.i("User @{{screenName}} has been suspended", { | |
screenName: t | |
}) : TD.i("User has been suspended"), TD.controller.progressIndicator.addMessage(i), TD.controller.feedManager.deleteWhere(function (i) { | |
var r = i.getMainUser && i.getMainUser(); | |
return r ? e && e == r.id || t && n === r.screenName.toLowerCase() : !1 | |
}) | |
} | |
var i = {}, | |
n = {}; | |
return i.init = function () { | |
var i, r = TD.storage.feedController.getAll(), | |
s = this; | |
for (i = 0; i < r.length; i++) { | |
var o = r[i]; | |
n[o.getKey()] = new TD.controller.FeedPoller(o) | |
} | |
TD.controller.scheduler.schedulePeriodicTask(120, TD.controller.feedManager.trimPollers), $.subscribe("/user/removeTweets", function (e, t, i) { | |
s.deleteUserChirps(e, t, i) | |
}), $.subscribe("/user/suspended", t), $.subscribe("/storage/client/default_account_changed", e), $(document).on("dataUndoRetweetSuccess", this.handleUndoRetweetSuccess.bind(this)), $(document).on("dataUndoRetweetError", this.handleUndoRetweetError.bind(this)) | |
}, i.handleUndoRetweetSuccess = function (e, t) { | |
this.deleteWhere(function (e) { | |
return e.retweetedStatus && e.retweetedStatus.id === t.tweetId && e.creatorAccount && e.creatorAccount.getKey() === t.from | |
}), this.doWhere(function (e) { | |
var i = e.getRelatedTweet(); | |
if (!i) return !1; | |
var n = i.id === t.tweetId || i.retweetedStatus && i.retweetedStatus.id === t.tweetId, | |
r = i.account.getKey() === t.from; | |
return n && r | |
}, function (e) { | |
e.getRelatedTweet().setRetweeted(!1) | |
}) | |
}, i.handleUndoRetweetError = function () { | |
TD.controller.progressIndicator.addMessage(TD.i("Undo retweet failed")) | |
}, i.getPoller = function (e) { | |
return n[e] | |
}, i.trimPollers = function () { | |
for (var e in n) n[e].trimChirps() | |
}, i.addFeed = function (e) { | |
var t = e.getKey(), | |
i = n[t]; | |
return i ? i : (i = new TD.controller.FeedPoller(e), n[t] = i, i) | |
}, i.removeFeed = function (e) { | |
var t = e.getKey(), | |
i = n[t]; | |
delete n[t], i.destroy(), "twitter" == e.getService() && (client = TD.controller.clients.getClient(e.getAccountKey()), client && client.checkUserStream()) | |
}, i.cleanupFeeds = function () { | |
var e = TD.controller.columnManager.getAll(), | |
t = {}; | |
for (var r in e) | |
for (var s = e[r].getFeeds(), o = 0; o < s.length; o++) t[s[o].getKey()] = !0; | |
for (var a in n) | |
if (!t[a]) { | |
var c = n[a].feed; | |
i.removeFeed(c), TD.storage.feedController.remove(c.getKey()) | |
} | |
}, i.deleteChirp = function (e) { | |
i.deleteWhere(function (t) { | |
if (t.id === e) return !0; | |
if (t.getRelatedTweet) { | |
var i = t.getRelatedTweet(); | |
return i && i.id === e | |
} | |
return !1 | |
}) | |
}, i.deleteWhere = function (e, t) { | |
var i, r; | |
for (var s in n) i = n[s], r = i.feed.getType(), t && "home" !== r && "networkactivity" !== r || i.removeWhere(e) | |
}, i.doWhere = function (e, t) { | |
var i; | |
for (var r in n) i = n[r], i.doWhere(e, t) | |
}, i.deleteUserChirps = function (e, t, n) { | |
e = e.toLowerCase(); | |
var r = function (i) { | |
try { | |
var n = i.getCreator && i.getCreator(); | |
return n && n.screenName.toLowerCase() === e && i.account.getUserID() == t | |
} catch (r) {} | |
return !1 | |
}; | |
i.deleteWhere(r, n) | |
}, i.deleteFeedsWhere = function (e) { | |
var t, i, n, r, s, o = TD.storage.clientController.client.getColumnOrder(); | |
for (r = 0; r < o.length; r++) { | |
for (t = TD.controller.columnManager.get(o[r]), i = t.getFeeds(), s = i.length - 1; s >= 0; s--) n = i[s], e(n) && (TD.storage.feedController.remove(n), t.removeFeed(n)); | |
0 === t.getFeedCount() && TD.controller.columnManager.deleteColumn(t.model.getKey()) | |
} | |
}, i.replaceFeed = function (e, t, n) { | |
var r = TD.controller.columnManager.getAll(); | |
n && (r = _.filter(r, function (e) { | |
return -1 !== n.indexOf(e.model.getKey()) | |
})), _.each(r, function (i) { | |
i.removeFeed(e) > 0 && i.addFeed(t) | |
}), i.cleanupFeeds() | |
}, i.fixListFeeds = _.debounce(_.once(function () { | |
var e = function (e, t) { | |
var i = TD.storage.feedController.getOrCreateFeed(e.getType(), e.getService(), e.getAccountKey(), { | |
listId: t.id, | |
ownerId: t.user.id | |
}); | |
TD.controller.feedManager.replaceFeed(e, i) | |
}, | |
t = [], | |
i = TD.storage.feedController.getAll(); | |
i = _.filter(i, function (e) { | |
var t = (e.getType(), e.getMetadata()); | |
return "list" !== e.getType() || t.listId && t.ownerId ? !1 : !0 | |
}), _.each(i, function (i) { | |
var n = i.getMetadata(), | |
r = TD.cache.lists.find(null, n.screenName, n.slug); | |
r ? e(i, r) : t.push(i) | |
}), _.each(t, function (t) { | |
var i = TD.controller.clients.getClient(t.getAccountKey()), | |
n = t.getMetadata(), | |
r = function (i) { | |
e(t, i) | |
}, | |
s = function () {}; | |
i.getList(null, n.screenName, n.slug, r, s) | |
}) | |
}), 5e3), i.isStreaming = function (e) { | |
var t, i, n = this.getPoller(e), | |
r = !1; | |
return n && (t = n.feed, i = TD.controller.clients.getClient(t.getAccountKey()), r = i.feedIsStreaming(e)), r | |
}, i | |
}(), TD.controller.progressIndicator = function () { | |
function e() { | |
n = $(".js-progress-indicator"), n.on("click", ".js-dismiss", i) | |
} | |
function t() { | |
var t, c = null; | |
if (n && n.length || e(), h) switch (h.state) { | |
case o: | |
c = TD.i("Failed: {{1}}", { | |
1: h.message | |
}); | |
break; | |
case r: | |
c = TD.i("Success: {{1}}", { | |
1: h.message | |
}); | |
break; | |
case s: | |
case a: | |
c = h.message | |
} | |
if (c) { | |
var u = TD.ui.template.render("topbar/alert_message", { | |
message: c | |
}); | |
n.html(u); | |
var d = n.find(".js-status-message"); | |
t = l, l = d.height(), t !== l ? (t || d.css("bottom", -l), d.animate({ | |
bottom: 0 | |
}, 200)) : d.css("bottom", 0) | |
} else i() | |
} | |
function i() { | |
var e = n.find(".js-status-message"); | |
e.animate({ | |
bottom: -l | |
}, 200, function () { | |
n.empty(), h = null | |
}), l = 0 | |
} | |
var n, r = "complete", | |
s = "working", | |
o = "failed", | |
a = "message", | |
c = 7e3, | |
u = 3e3, | |
l = 0, | |
d = {}, | |
h = null; | |
return d.addTask = function (e) { | |
var i = _.uniqueId("msg_"); | |
return h = { | |
key: i, | |
message: e, | |
state: s, | |
timeout: null | |
}, t(), i | |
}, d.addMessage = function (e) { | |
var i = _.uniqueId("msg_"); | |
return h = { | |
key: i, | |
message: e, | |
state: a, | |
timeout: null | |
}, h.timeout = setTimeout(function () { | |
d.deleteTask(i) | |
}, c), t(), i | |
}, d.deleteTask = function (e) { | |
h && h.key === e && (h = null, t()) | |
}, d.taskComplete = function (e, i) { | |
h && h.key === e && (h.state = r, h.message = i || h.message, h.timeout = setTimeout(function () { | |
d.deleteTask(e) | |
}, u), t()) | |
}, d.taskFailed = function (e, i) { | |
h && h.key === e && (h.state = o, h.message = i || h.message, h.timeout = setTimeout(function () { | |
d.deleteTask(e) | |
}, c), t()) | |
}, d.changeMessage = function (e, i) { | |
h && h.key === e && (h.message = i, t()) | |
}, d | |
}(), TD.controller.notifications = function () { | |
var e, t, i, n = 500, | |
r = "/web/templates/notification.html", | |
s = "tweetdeck-notification", | |
o = {}, | |
a = !1, | |
c = [], | |
u = {}, | |
l = !1, | |
d = window.Notification, | |
h = !1, | |
p = "growl", | |
f = "w3c", | |
m = "windows", | |
g = function (r) { | |
var s = r.feed, | |
o = r.column, | |
a = r.items; | |
if (s.managed && (a = a.filter(function (e) { | |
return e.passFilters(o.filters) && !e.isOwnChirp() | |
}), 0 !== a.length)) { | |
var d = []; | |
if (o.model.getHasNotification() && h) | |
for (var g = 0; g < a.length; g++) { | |
var y = a[g], | |
D = u[y.id]; | |
if (D) v(o.type) > v(D.columnType) && (D.columnKey = o.model.getKey(), D.columnTitle = o.getTitleHTML(), D.columnType = o.model.getType(), D.accountKey = y.account.getKey()); | |
else { | |
var b = { | |
chirpID: y.messageThreadId || y.id, | |
accountKey: y.account.getKey(), | |
columnKey: o.model.getKey(), | |
columnTitle: o.getTitleHTML(), | |
columnType: o.model.getType() | |
}; | |
switch (h) { | |
case p: | |
case f: | |
var C = y.getGrowlData(); | |
if (!C) continue; | |
C.img = C.img || "/web/assets/logos/32.png", _.extend(b, C); | |
break; | |
case m: | |
if (b.html = y.renderNotification(), !b.html) continue | |
} | |
d.push(b), u[a[g].id] = b | |
} | |
} | |
t ? e.port.postMessage({ | |
updates: d | |
}) : w() ? deck.notificationWindow.acceptAction({ | |
data: { | |
updates: d | |
} | |
}) : (l = l || o.model.getHasSound(), c = c.concat(d), !i && (c.length > 0 || l) && (i = setTimeout(T, n))) | |
} | |
}, | |
T = function () { | |
var e = h === p ? c.slice(0, 5) : c; | |
i = null, l && ("win" === TD.util.getAppEnv() && deck.playSound ? deck.playSound("tweet.wav") : document.getElementById("update-sound").play(), l = !1), 0 !== e.length && h && (h !== m ? (e.forEach(function (e) { | |
var t; | |
switch (h) { | |
case p: | |
deck.doGrowl(e.title, e.text, e.img, e.chirpID, e.columnKey); | |
break; | |
case f: | |
t = new d(e.title, { | |
body: e.text, | |
icon: e.img | |
}), t.onclose = o.reset, t.onshow = function () { | |
setTimeout(function () { | |
t.close() | |
}, 5e3) | |
}, t.onclick = function () { | |
$(document).trigger("uiShowDetailView", { | |
chirpId: e.chirpID, | |
columnKey: e.columnKey | |
}), TD.util.isChromeApp() && chrome.extension.getBackgroundPage().TD.bg.utils.showTDTab() | |
} | |
} | |
}), l = !1, u = {}, c = []) : d && d.createHTMLNotification ? (t = d.createHTMLNotification(r), t.onclose = o.reset, t.show()) : TD.util.isWrapperApp() && deck.showNotification && (!deck.notificationWindow || deck.notificationWindow.closed ? (o.reset(), deck.notificationWindow = window.open(r, s), deck.notificationWindow.mainWindow = window) : o.onNotificationsReady())) | |
}, | |
v = function (e) { | |
switch (e) { | |
case "privateMe": | |
return 5; | |
case "direct": | |
return 4; | |
case "me": | |
return 3; | |
case "mentions": | |
return 2; | |
case "home": | |
return 1; | |
case "search": | |
return -1; | |
default: | |
return 0 | |
} | |
}, | |
y = function (t) { | |
var i, n, r, s = TD.controller.columnManager.get(t.info.columnKey), | |
o = !1, | |
a = !0; | |
switch (t.action) { | |
case "url": | |
TD.util.openURL(t.href), a = !1; | |
break; | |
case "user": | |
r = _.last(t.href.split("/")), $(document).trigger("uiShowProfile", { | |
id: r | |
}); | |
break; | |
case "hashtag": | |
$(document).trigger("uiPerformSearch", { | |
query: t.text | |
}); | |
break; | |
case "showColumn": | |
o = !0; | |
break; | |
case "showChirp": | |
o = !0, i = s.findMostInterestingChirp(t.info.chirpID), n = s.findChirp(t.info.chirpID), TD.ui.updates.showDetailView(s, i, n) | |
} | |
a && TD.util.isWrapperApp() && deck.showPrimaryWindow(), o && TD.ui.columns.scrollColumnToCenter(t.info.columnKey), e.port.postMessage("closeNotification"), w() && deck.notificationWindow.acceptAction({ | |
data: "closeNotification" | |
}) | |
}, | |
D = function () { | |
return TD.util.isWrapperApp() ? !0 : "granted" === d.permission | |
}, | |
w = function () { | |
return TD.util.isWrapperApp() && deck.notificationWindow && !deck.notificationWindow.closed && deck.notificationWindow.acceptAction | |
}; | |
return o.init = function () { | |
if (!TD.settings.getShowStartupNotifications()) { | |
var e = (new Date).getTime(); | |
_.each(TD.storage.feedController.getAll(), function (t) { | |
var i = TD.storage.columnController.getColumnsContainingFeed(t.getKey()), | |
n = Boolean(_.find(i, function (e) { | |
return e.getHasSound() || e.getHasNotification() | |
})); | |
n && t.setLatestTime(e) | |
}) | |
} | |
TD.util.isWrapperApp() ? deck.showNotification ? (h = m, o.setUpWorker()) : h = p : d && o.getPermission(), $.subscribe("/notifications/new", g.bind(this)) | |
}, o.hasNotifications = function () { | |
return h !== !1 | |
}, o.setUpWorker = function () { | |
e = new SharedWorker("/web/scripts/unbundled/nfn_worker.js"), e.port.addEventListener("message", function (t) { | |
"ready" === t.data ? (a = !0, e.port.postMessage({ | |
updates: c | |
}), c = []) : t.data.action && y(t.data) | |
}), e.port.start() | |
}, o.onNotificationsReady = function () { | |
w() && (deck.notificationWindow.acceptAction({ | |
data: { | |
updates: c | |
} | |
}), c = []) | |
}, o.onNotificationAction = function (e) { | |
y(e) | |
}, o.reRender = function (t) { | |
var i = u[t.id]; | |
if (i) { | |
var n = t.renderNotification(); | |
i.html = n, a && e.port.postMessage({ | |
replaceID: t.id, | |
accountKey: t.account.getKey(), | |
html: n | |
}), w() && deck.notificationWindow.acceptAction({ | |
data: { | |
replaceID: t.id, | |
accountKey: t.account.getKey(), | |
html: n | |
} | |
}) | |
} | |
}, o.getPermission = function () { | |
D() ? h = f : d.requestPermission(function (e) { | |
"permission" in d || (d.permission = e), D() && (h = f) | |
}) | |
}, o.reset = function () { | |
t = null, u = {}, l = !1 | |
}, o | |
}(), TD.controller.stats = function () { | |
var e = {}, | |
t = { | |
INIT: "init", | |
MAIN: "main_init", | |
COLUMN_MANAGER: "column_manager_init", | |
COLUMN_SCHEDULER: "column_scheduler_init", | |
NOTIFICATIONS: "notifications_init", | |
FILTER_MANAGER: "filter_manager_init", | |
RENDER_TWEET: "render_tweet" | |
}, | |
i = "twid", | |
n = "interval", | |
r = "f", | |
s = "oid", | |
o = "tw", | |
a = "is_touch_device", | |
c = 10, | |
u = {}; | |
TD.util.extendObjectWith(u, [ | |
[TD.util.columnUtils.columnMetaTypes.MENTIONS, { | |
legacyId: 2, | |
namespace: { | |
section: "twitter", | |
component: "mention" | |
} | |
}], | |
[TD.util.columnUtils.columnMetaTypes.FOLLOWERS, { | |
legacyId: 3, | |
namespace: { | |
section: "twitter", | |
component: "followers" | |
} | |
}], | |
[TD.util.columnUtils.columnMetaTypes.TIMELINE, { | |
legacyId: 3, | |
namespace: { | |
section: "twitter", | |
component: "home" | |
} | |
}], | |
[TD.util.columnUtils.columnMetaTypes.SEARCH, { | |
legacyId: 4, | |
namespace: { | |
section: "twitter", | |
component: "search" | |
} | |
}], | |
[TD.util.columnUtils.columnMetaTypes.MESSAGES, { | |
legacyId: 5, | |
namespace: { | |
section: "twitter", | |
component: "inbox" | |
} | |
}], | |
[TD.util.columnUtils.columnMetaTypes.FAVORITES, { | |
legacyId: 8, | |
namespace: { | |
section: "twitter", | |
component: "favorites" | |
} | |
}], | |
[TD.util.columnUtils.columnMetaTypes.LIST, { | |
legacyId: 22, | |
namespace: { | |
section: "twitter", | |
component: "list" | |
} | |
}], | |
[TD.util.columnUtils.columnMetaTypes.SCHEDULED, { | |
legacyId: 28, | |
namespace: { | |
section: "tweetdeck", | |
component: "scheduledupdates" | |
} | |
}], | |
[TD.util.columnUtils.columnMetaTypes.USERTWEETS, { | |
legacyId: 32, | |
namespace: { | |
section: "twitter", | |
component: "usertweets" | |
} | |
}], | |
[TD.util.columnUtils.columnMetaTypes.USERTIMELINE, { | |
legacyId: 33, | |
namespace: { | |
section: "twitter", | |
component: "usertimeline" | |
} | |
}], | |
[TD.util.columnUtils.columnMetaTypes.HOME, { | |
legacyId: 34, | |
namespace: { | |
section: "tweetdeck", | |
component: "home" | |
} | |
}], | |
[TD.util.columnUtils.columnMetaTypes.ME, { | |
legacyId: 35, | |
namespace: { | |
section: "tweetdeck", | |
component: "me" | |
} | |
}], | |
[TD.util.columnUtils.columnMetaTypes.INBOX, { | |
legacyId: 36, | |
namespace: { | |
section: "tweetdeck", | |
component: "inbox" | |
} | |
}], | |
[TD.util.columnUtils.columnMetaTypes.INTERACTIONS, { | |
legacyId: 37, | |
namespace: { | |
section: "twitter", | |
component: "interactions" | |
} | |
}], | |
[TD.util.columnUtils.columnMetaTypes.ACTIVITY, { | |
legacyId: 38, | |
namespace: { | |
section: "twitter", | |
component: "networkactivity" | |
} | |
}], | |
[TD.util.columnUtils.columnMetaTypes.CUSTOMTIMELINE, { | |
legacyId: 39, | |
namespace: { | |
section: "twitter", | |
component: "customtimeline" | |
} | |
}] | |
]); | |
var l, d, h, p, f, m, g = "Twitter-TweetDeck-{{{client_name}}}/{{{client_version}}} {{{platform}}}/{{{platform_version}}}", | |
T = "deck", | |
v = {}, | |
y = {}, | |
D = [], | |
w = function (e, t) { | |
return m && h ? (e = e || {}, t = t || {}, e.client = T, t.user_agent = p, t.guest_id = h, m.scribe(e, t), void(TD.config.scribe_debug_level > 1 && console.log("Scribing:", e, t))) : void D.push([e, t]) | |
}, | |
b = function () { | |
var e, t = {}; | |
try { | |
e = TD.storage.accountController.getPreferredAccount("twitter") | |
} catch (i) {} | |
return e && (t[o] = e.getUserID()), t | |
}; | |
return e.generateScribeUserAgent = function (e, t, i, n) { | |
var r = { | |
client_name: e, | |
client_version: t, | |
platform: i, | |
platform_version: n | |
}, | |
s = TD.ui.template.toHtml(g, r); | |
return s | |
}, e.generateScribeGuestId = function (e, t) { | |
var i = "tweetdeck:" + e + ":" + t, | |
n = TD.core.sha1(i), | |
r = parseInt(n.substr(0, 13), 16); | |
return r | |
}, e.flushScribeQueue = function () { | |
f && f.flush(f.getBuffer()) | |
}, e.updateTransportOptions = function (e) { | |
return f ? void f.updateOptions(e) : void TD.sync.util.warn("scribeTransport options not updated as controller.stats not initialised") | |
}, e.init = function () { | |
var t = TD.util.getAppEnv(); | |
l = TD.config.client_name + "-" + t, p = e.generateScribeUserAgent(l, TD.version, t, "1"); | |
var i = { | |
bufferEvents: !0, | |
useAjax: !1, | |
flushOnUnload: !0 | |
}; | |
f = new ScribeTransport(i), m = new ClientEvent(f), TD.config.scribe_debug_level > 0 && this.setupDebugMode(), TD.controller.scheduler.schedulePeriodicTask(900, e.impression, !0), TD.controller.scheduler.schedulePeriodicTask(60, TD.controller.stats.flushScribeQueue) | |
}, e.setUid = function (t) { | |
if (d = t, h = "", t) { | |
for (h = e.generateScribeGuestId(p, TD.core.sha1(t)); D.length;) { | |
var i = D.shift(); | |
w(i[0], i[1]) | |
} | |
e.impression() | |
} | |
}, e.generic = function (e, t) { | |
w(e, t) | |
}, e.setExperiments = function (e) { | |
v = e | |
}, e.getExperimentBucket = function (e) { | |
var t = v[e]; | |
return t ? t.bucket : "" | |
}, e.experimentImpression = function (e) { | |
var t, i, n = v[e]; | |
n && (e = n.experiment_key, y[e] || (t = { | |
page: "ddg", | |
section: n.experiment_key, | |
component: "", | |
element: "", | |
action: "experiment" | |
}, i = { | |
experiment_key: n.experiment_key, | |
bucket: n.bucket, | |
version: n.version | |
}, w(t, i), y[e] = !0)) | |
}, e.setupDebugMode = function () { | |
var e = !1, | |
t = {}, | |
i = function (i) { | |
var n, r = "error" === i.validationLevel && "event_namespace" === i.parentFieldName, | |
s = "scribe error", | |
o = ""; | |
if (r && e) { | |
if (n = [i.fieldName, i.fieldValue].join(" "), t[n]) return; | |
t[n] = !0 | |
} | |
"warning" === i.validationLevel && (s = "scribe warning"), r && (o = "Please add " + i.fieldName + " “" + i.fieldValue + "†to go/namespace"), console.error(s.toUpperCase(), o, i) | |
}; | |
f.updateOptions({ | |
debug: !0, | |
bufferEvents: !1, | |
useAjax: !0, | |
flushOnUnload: !0, | |
debugHandler: function (e) { | |
e && e.response && (e.response.errors.forEach(i), e.response.warnings.forEach(i)) | |
} | |
}), f.options.url = "https://twitter.com" + f.SCRIBE_API_ENDPOINT | |
}, e.checkNamespace = function (e, t) { | |
if (-1 === t.indexOf(e)) throw new Error("value must be in " + t) | |
}, e.impression = function () { | |
var e = { | |
action: "impression", | |
page: "main" | |
}, | |
t = b(); | |
t[n] = "900", t[r] = TD.controller.feather.latestFeatherId, t[a] = !1, TD.util.isTouchDevice() && (t[a] = !0), w(e, t) | |
}, e.favorite = function (e) { | |
var t = { | |
page: "column", | |
section: "tweet", | |
action: "favorite" | |
}, | |
i = { | |
items: [e] | |
}; | |
w(t, i) | |
}, e.unfavorite = function (e) { | |
var t = { | |
page: "column", | |
section: "tweet", | |
action: "unfavorite" | |
}, | |
i = { | |
items: [e] | |
}; | |
w(t, i) | |
}, e.retweet = function (e) { | |
var t = { | |
page: "column", | |
section: "tweet", | |
action: "retweet" | |
}, | |
i = { | |
items: [e] | |
}; | |
w(t, i) | |
}, e.embedTweetDialogOpen = function (e) { | |
var t = { | |
page: "main", | |
section: "embed_tweet_dialog", | |
action: "open" | |
}, | |
n = {}; | |
n[i] = e, w(t, n) | |
}, e.translate = function (e, t, n, r, a) { | |
var c = { | |
page: "column", | |
section: "tweet", | |
action: "translate" | |
}, | |
u = {}; | |
u[s] = e, u[i] = t, u[o] = n, u.dest_lang = r, u.src_lang = a, w(c, u) | |
}, e.reportUser = function (e, t) { | |
var i = { | |
page: "column", | |
section: "tweet", | |
component: "report_user", | |
element: t || "", | |
action: e | |
}; | |
w(i) | |
}, e.reportUserAbusive = function (e, t) { | |
var i = { | |
page: "column", | |
section: "tweet", | |
component: "report_user_abusive", | |
element: t || "", | |
action: e | |
}; | |
w(i) | |
}, e.reportDM = function (e) { | |
var t = { | |
page: "column", | |
section: "tweet", | |
component: "report_message", | |
element: "", | |
action: e | |
}; | |
w(t) | |
}, e.sharedAccountWarning = function (e) { | |
var t = { | |
page: "main", | |
section: "shared_account_warning", | |
action: e | |
}; | |
w(t) | |
}, e._genericColumnEvent = function (e, t, i) { | |
var n = u[e], | |
r = { | |
page: "column", | |
section: "unknown", | |
component: "unknown", | |
action: t | |
}; | |
i && (r.element = i), n && n.namespace ? _.extend(r, n.namespace) : console.log("Tracking: Unknown column type", e), w(r) | |
}, e.addColumn = function (t) { | |
e._genericColumnEvent(t, "add") | |
}, e.removeColumn = function (t) { | |
e._genericColumnEvent(t, "remove") | |
}, e.columnEmergencyPause = function (t) { | |
e._genericColumnEvent(t, "impression", "emergencypause") | |
}, e.columnEmergencyPauseUnpause = function (t) { | |
e._genericColumnEvent(t, "click", "emergencypause") | |
}, e.compose = function (e) { | |
e = e || {}; | |
var t = { | |
page: "compose", | |
component: e.component, | |
action: e.action | |
}, | |
i = { | |
with_image: Boolean(e.withImage), | |
scheduled: Boolean(e.isScheduled) | |
}; | |
e.twitterId && (i[o] = e.twitterId), e.isScheduled && (t.action += "_scheduled"), w(t, i) | |
}, e.postTweet = function (t, i, n) { | |
e.compose({ | |
action: "send_tweet", | |
twitterId: t, | |
withImage: i, | |
isScheduled: n | |
}) | |
}, e.postReply = function (t, i, n, r) { | |
e.compose({ | |
action: "send_reply", | |
component: r ? "inline_compose" : "docked_compose", | |
twitterId: t, | |
withImage: i, | |
isScheduled: n | |
}) | |
}, e.postMessage = function (t, i, n) { | |
e.compose({ | |
action: "send_dm", | |
twitterId: t, | |
withImage: i, | |
isScheduled: n | |
}) | |
}, e.composeClearReply = function () { | |
var e = { | |
page: "compose", | |
action: "clear_reply" | |
}; | |
w(e) | |
}, e.composeStackReply = function () { | |
var e = { | |
page: "compose", | |
action: "stack_reply" | |
}; | |
w(e) | |
}, e.composePopFromInline = function () { | |
var e = { | |
page: "compose", | |
component: "inline_compose", | |
element: "pop_inline_to_docked", | |
action: "click" | |
}; | |
w(e) | |
}, e.messageBannerImpression = function (e) { | |
var t = { | |
page: "main", | |
section: "message_banner", | |
action: "impression" | |
}, | |
i = { | |
message_id: e | |
}; | |
w(t, i) | |
}, e.messageBannerDismiss = function (e) { | |
var t = { | |
page: "main", | |
section: "message_banner", | |
action: "dismiss" | |
}, | |
i = { | |
message_id: e | |
}; | |
w(t, i) | |
}, e.messageBannerClick = function (e, t) { | |
var i = { | |
page: "main", | |
section: "message_banner", | |
action: "click" | |
}, | |
n = { | |
message_id: e, | |
button_id: t | |
}; | |
w(i, n) | |
}, e.searchboxFocus = function () { | |
var e = { | |
page: "main", | |
component: "search_box", | |
action: "focus_field" | |
}; | |
w(e) | |
}, e.searchboxPerformSearch = function (e) { | |
var t = { | |
page: "main", | |
component: "search_box", | |
action: "search" | |
}, | |
i = { | |
query: e | |
}; | |
w(t, i) | |
}, e.typeaheadItemSelected = function (e, t, i) { | |
var n = { | |
page: "main", | |
component: "search_box", | |
element: "typeahead", | |
action: "search" | |
}, | |
r = { | |
query: e, | |
type: t, | |
index: i | |
}; | |
w(n, r) | |
}, e.typeaheadRecentItemSelected = function (e, t, i) { | |
var n = { | |
page: "main", | |
component: "search_box", | |
element: "recent", | |
action: "search" | |
}, | |
r = { | |
query: e, | |
type: t, | |
index: i | |
}; | |
w(n, r) | |
}, e.viewedTweetSocialProof = function (e) { | |
var t = { | |
page: "column", | |
section: "social_proof", | |
component: e, | |
action: "impression" | |
}; | |
switch (e) { | |
case "retweeters": | |
t.component = "retweeted_by"; | |
break; | |
case "favoriters": | |
t.component = "favorited_by"; | |
break; | |
default: | |
throw "Social proof type “" + e + "†not recognised" | |
} | |
w(t) | |
}, e.setting = function (e, t) { | |
var i = { | |
page: "settings", | |
section: e | |
}, | |
n = { | |
section: { | |
condensed: "narrow", | |
"full-size": "wide" | |
} | |
}; | |
_.isBoolean(t) ? i.action = t ? "on" : "off" : (i.component = n.section[t] || t, i.action = "select"), w(i) | |
}, e.defaultAccountSelected = function () { | |
w({ | |
page: "settings", | |
section: "default_account", | |
action: "select" | |
}) | |
}, e.apiErrorResponse = function (e, t, i) { | |
var n = { | |
page: "api", | |
action: "request" | |
}, | |
r = { | |
status_code: e | |
}; | |
TD.util.random(0, 99) < c && (t && (r.event_info = t), i && (r.url = i), w(n, r)) | |
}, e.performance = function () { | |
var e = {}, | |
i = function () { | |
return e[t.RENDER_TWEET] && e[t.INIT] && e[t.MAIN] && e[t.COLUMN_MANAGER] && e[t.COLUMN_SCHEDULER] && e[t.FILTER_MANAGER] && e[t.NOTIFICATIONS] | |
}; | |
return { | |
log: function (t, n) { | |
e[t] = n, i() && (e = {}) | |
}, | |
keys: t | |
} | |
}(), e.advancedSearchSettings = function (e, t, i, n) { | |
var r = { | |
section: {}, | |
component: { | |
action: "interactions" | |
}, | |
element: { | |
written_in: "language" | |
} | |
}, | |
s = { | |
page: "main", | |
section: r.section[e] || e, | |
component: r.component[t] || t, | |
element: r.element[i] || i, | |
action: "change" | |
}, | |
o = { | |
value: n | |
}; | |
w(s, o) | |
}, e.actionFilterError = function () { | |
var e = { | |
page: "main", | |
section: "column_options", | |
component: "interactions", | |
action: "validation_error" | |
}, | |
t = { | |
error: "No interaction types selected" | |
}; | |
w(e, t) | |
}, e.columnActionClick = function (e, t) { | |
var i = { | |
page: "main", | |
section: "column_options", | |
element: e, | |
action: "click" | |
}; | |
t = t || {}, w(i, t) | |
}, e.unknownStreamData = function (e) { | |
var t = { | |
page: "api", | |
section: "userstream", | |
action: "unrecognized_data" | |
}; | |
w(t, e) | |
}, e.navbarListsClick = function () { | |
var e = { | |
page: "main", | |
section: "navbar", | |
element: "lists", | |
action: "click" | |
}; | |
w(e) | |
}, e.navbarAddColumnClick = function () { | |
var e = { | |
page: "main", | |
section: "navbar", | |
element: "add_column", | |
action: "click" | |
}; | |
w(e) | |
}, e.navbarPageLeft = function () { | |
var e = { | |
page: "main", | |
section: "navbar", | |
component: "column_nav", | |
element: "page_left", | |
action: "click" | |
}; | |
w(e) | |
}, e.navbarReorderColumns = function () { | |
var e = { | |
page: "main", | |
section: "navbar", | |
component: "column_nav", | |
action: "reorder" | |
}; | |
w(e) | |
}, e.navbarJumpToColumn = function () { | |
var e = { | |
page: "main", | |
section: "navbar", | |
component: "column_nav", | |
element: "column_item", | |
action: "click" | |
}; | |
w(e) | |
}, e.navbarPageRight = function () { | |
var e = { | |
page: "main", | |
section: "navbar", | |
component: "column_nav", | |
element: "page_right", | |
action: "click" | |
}; | |
w(e) | |
}, e.navbarSettingsClick = function () { | |
var e = { | |
page: "main", | |
section: "navbar", | |
element: "settings", | |
action: "click" | |
}; | |
w(e) | |
}, e.navbarMigrate = function (e) { | |
var t = ["impression", "click"]; | |
if (-1 === t.indexOf(e)) throw new Error("action must be in " + t); | |
var i = { | |
page: "main", | |
section: "navbar", | |
element: "migrate", | |
action: e | |
}; | |
w(i) | |
}, e.navbarComposeClick = function () { | |
var e = { | |
page: "main", | |
section: "navbar", | |
element: "compose", | |
action: "click" | |
}; | |
w(e) | |
}, e.tweetStreamImpression = function (e, t, i) { | |
if (!(t.length < 1)) { | |
var n = { | |
component: "stream", | |
action: "results" | |
}; | |
i && (n.element = "linger"); | |
var r = { | |
items: t | |
}, | |
s = TD.util.columnUtils.columnMetaTypeToScribeNamespace[e]; | |
s && (n = _.extend(n, s), w(n, r)) | |
} | |
}, e.tweetImpression = function (e) { | |
var t = { | |
page: "tweet", | |
component: "tweet", | |
action: "impression" | |
}, | |
i = { | |
items: [e] | |
}; | |
w(t, i) | |
}, e.mediaImpression = function (e) { | |
var t = { | |
page: "tweet", | |
component: "gallery", | |
element: "photo", | |
action: "impression" | |
}, | |
i = { | |
items: [e] | |
}; | |
w(t, i) | |
}, e.appWokenFromSleep = function (e) { | |
var t = { | |
page: "main", | |
action: "wake" | |
}, | |
i = { | |
secondsSinceSleep: e | |
}; | |
w(t, i) | |
}, e.purgedServices = function (e) { | |
e.forEach(function (e) { | |
var t = { | |
page: "main", | |
section: "service", | |
action: "remove" | |
}; | |
w(t, { | |
service: e | |
}) | |
}) | |
}, e.purgedFeed = function (e) { | |
var t = { | |
page: "main", | |
section: "feed", | |
action: "remove" | |
}; | |
w(t, e) | |
}, e.customTimelineCreated = function () { | |
var e = { | |
page: "main", | |
component: "customtimeline", | |
action: "create" | |
}; | |
w(e) | |
}, e.customTimelineUpdated = function () { | |
var e = { | |
page: "main", | |
component: "customtimeline", | |
action: "update" | |
}; | |
w(e) | |
}, e.customTimelineDeleted = function () { | |
var e = { | |
page: "main", | |
component: "customtimeline", | |
action: "delete" | |
}; | |
w(e) | |
}, e.tweetAddedToCustomTimeline = function () { | |
var e = { | |
page: "main", | |
component: "customtimeline", | |
element: "tweet", | |
action: "add" | |
}; | |
w(e) | |
}, e.tweetRemovedFromCustomTimeline = function () { | |
var e = { | |
page: "main", | |
component: "customtimeline", | |
element: "tweet", | |
action: "remove" | |
}; | |
w(e) | |
}, e.migrateAppflow = function (t, i) { | |
e.checkNamespace(t, ["migrate_education", "migrate_risk", "migrate_risk_agreement"]), e.checkNamespace(i, ["impression", "previous", "cancel", "next"]); | |
var n = { | |
page: "startflow", | |
section: t, | |
action: i | |
}; | |
w(n) | |
}, e.migrateStartflow = function (t, i, n) { | |
e.checkNamespace(t, ["migrate_tweetdeck_login", "migrate_twitter_login", "migrate_final_confirmation", "migrate_progress", "migrate_progress_success"]), e.checkNamespace(i, ["impression", "previous", "cancel", "next", "restart"]); | |
var r = { | |
page: "startflow", | |
section: t, | |
element: n ? "error" : void 0, | |
action: i | |
}; | |
w(r) | |
}, e | |
}(), TD.controller.filterManager = function () { | |
var e = {}, | |
t = [], | |
i = function () { | |
var e = []; | |
_.each(t, function (t) { | |
e.push(t.toBackendState()) | |
}), TD.settings.setGlobalFilter(e) | |
}; | |
return e.init = function () { | |
var i = TD.settings.getGlobalFilter(); | |
_.each(i, function (e) { | |
var i = new TD.vo.Filter; | |
i.fromBackendState(e), t.push(i) | |
}), e.reapplyAllFilters() | |
}, e.reapplyAllFilters = function () { | |
_.each(TD.controller.columnManager.getAll(), function (e) { | |
e.reloadTweets() | |
}) | |
}, e.pass = function (e, i) { | |
var n, r; | |
for (n = 0, r = t.length; r > n; n++) | |
if (!t[n].pass(e)) return !1; | |
if (i) | |
for (n = 0, r = i.length; r > n; n++) | |
if (!i[n].pass(e)) return !1; | |
return !0 | |
}, e.getAll = function () { | |
return t | |
}, e.addFilter = function (n, r, s) { | |
var o = new TD.vo.Filter(n, r, Boolean(s)); | |
return t.push(o), e.reapplyAllFilters(), i(), o | |
}, e.validateFilter = function (e, i) { | |
return e && i ? 0 == _.trim(i).length ? !1 : _.any(t, function (t) { | |
return t.type === e && t.value === i | |
}) ? !1 : !0 : !1 | |
}, e.removeFilter = function (n) { | |
var r; | |
_.each(t, function (e, t) { | |
e.id === n && (r = t) | |
}), t.splice(r, 1), e.reapplyAllFilters(), i() | |
}, e.hasFilterApplied = function (e, i) { | |
return t.some(function (t) { | |
return t.type === e && t.value === i | |
}) | |
}, e | |
}(), | |
function (e, t) { | |
"function" == typeof define && define.amd ? define([], t) : e.TD.decider = t() | |
}(this, function () { | |
"use strict"; | |
function e() { | |
var e = {}; | |
this.ACCOUNT_MIGRATION = "account_migration", this.ACCOUNT_MIGRATION_FOR_MAC = "account_migration_for_mac", this.DISABLE_CUSTOM_TIMELINES = "disable_custom_timelines", this.DISABLE_SCHEDULED_MESSAGES = "disable_scheduled_messages", this.DISABLE_STREAMING = "disable_streaming", this.DISABLE_TWITTER_CACHE_RELOAD = "disable_twitter_cache_reload", this.UNIVERSAL_SEARCH_TIMELINES = "universal_search_timelines", this.DM_PHOTO_PREVIEW = "dm_photo_preview", this.DM_PHOTO_SENDING = "dm_photo_sending", this.EMERGENCY_COLUMN_PAUSE = "emergency_column_pause", this.ENGAGEMENT_FILTER = "engagement_filter", this.INSTAGRAM_DISABLED = "disable_instagram", this.SCHEDULED_LOAD_TEST = "scheduled_head_load_test", this.THROTTLE_POLLING_PERIOD = "throttle_polling_period", this.TRANSLATE_TWEET = "machine_translated_tweets", this.SAC_SHARE = "sac_enable_share", this.SAC_IMPORT = "sac_enable_import", this.SCHEDULER_READ_BACKGROUND = "scheduler_read_background", this.SCHEDULER_READ_VISIBLE = "scheduler_read_visible", this.SCHEDULER_WRITE = "scheduler_write", this.SCHEDULER_WRITE_MEDIA = "scheduler_write_media", this.TOUCHDECK_COLUMN_OPTIONS = "touchdeck_column_options_v2", this.TOUCHDECK_COMPOSE = "touchdeck_compose_v2", this.TOUCHDECK_DROPDOWNS = "touchdeck_dropdowns_v2", this.TOUCHDECK_FONTSIZE = "touchdeck_font_size_v2", this.TOUCHDECK_MODALS = "touchdeck_modals_v2", this.TOUCHDECK_SEARCH = "touchdeck_search_v2", this.TOUCHDECK_SIDEBAR = "touchdeck_sidebar_v2", this.TOUCHDECK_TWEETCONTROLS = "touchdeck_tweet_controls_v3", this.accessLevels = { | |
scheduler: [{ | |
level: "READ_BACKGROUND", | |
deciderKey: this.SCHEDULER_READ_BACKGROUND | |
}, { | |
level: "READ_VISIBLE", | |
deciderKey: this.SCHEDULER_READ_VISIBLE | |
}, { | |
level: "WRITE", | |
deciderKey: this.SCHEDULER_WRITE | |
}, { | |
level: "WRITE_MEDIA", | |
deciderKey: this.SCHEDULER_WRITE_MEDIA | |
}] | |
}, this.updateFromBackend = function (t) { | |
e = t || {}, $(document).trigger("dataDeciderUpdated") | |
}, this.get = function (t) { | |
if (TD.config.decider_overlay && "undefined" != typeof TD.config.decider_overlay[t]) { | |
var i = TD.config.decider_overlay[t]; | |
return i | |
} | |
return e[t] | |
}, this.getAll = function () { | |
return _.clone(e) | |
}, this.getAllWithOverlay = function () { | |
return Object.keys(TD.config.decider_overlay || {}).reduce(function (e, t) { | |
return e[t] = this.get(t), e | |
}.bind(this), this.getAll()) | |
}, this.hasAccessLevel = function (e, t) { | |
for (var i = !1, n = this.accessLevels[e], r = 0; !i && n[r] && this.get(n[r].deciderKey);) i = t === n[r].level, r += 1; | |
return i | |
} | |
} | |
return new e | |
}), | |
function (e, t) { | |
"use strict"; | |
"function" == typeof define && define.amd ? define([], t) : e.TD.sync.util = t() | |
}(this, function () { | |
var e = {}, | |
t = 0, | |
i = 2, | |
n = 4, | |
r = 8; | |
e.maybe_log = function (e, t) { | |
var i = _.isUndefined(t) ? 1 : t; | |
TD.config.debug_level >= i && console.log(e) | |
}, e.NotJsonable = function (e) { | |
_.extend(this, e), this.___ = e.toString() | |
}, e.NotJsonable.prototype = {}; | |
var s = function (t) { | |
console.log.apply(console, _.map(t, function (t) { | |
if (!_.isUndefined(t)) try { | |
return JSON.parse(JSON.stringify(t)) | |
} catch (i) { | |
return new e.NotJsonable(t) | |
} | |
})) | |
}; | |
return e.stateLog = function () { | |
TD.config.debug_level >= i && s(arguments) | |
}, e.verboseLog = function () { | |
TD.config.debug_level >= n && s(_.toArray(arguments)) | |
}, e.warn = function () { | |
TD.config.debug_level >= t && console.log.apply(console, _.toArray(arguments)) | |
}, e.trace = function (t, i) { | |
e.maybe_log("TRACE: " + t + ": " + (i || ""), 1) | |
}, e.printStacktrace = function () { | |
if (TD.config.debug_menu) try { | |
throw new Error("stack trace or gtfo") | |
} catch (e) { | |
console.log(e.stack) | |
} | |
}, e.getStack = function () { | |
try { | |
throw new Error("stack trace or gtfo") | |
} catch (e) { | |
return TD.util.isChromeApp() ? e.stack.split("\n").slice(2).join("\n") : "" | |
} | |
}, e.errmark = function (t, i) { | |
return t || (t = i, i = "missing message"), console.log("---ERROR--->>>>>->>>>->>>->>->--" + i + "--<-<<--"), e.maybe_log(t), console.log(t.stack), t | |
}, e.assert = function (t, i, n) { | |
if (!t) throw console.log("------------------------------------------"), console.log(["ASSERT FAILURE", i, n]), e.printStacktrace(), console.log("------------------------------------------"), TD.sync.trace && TD.sync.trace.assert(i, n), "AssertionError" | |
}, e.precondition = function (t, i, n) { | |
if (!t) throw console.log("------------------------------------------"), console.log(["PRECONDITION FAILURE", i, n]), e.printStacktrace(), console.log("------------------------------------------"), TD.sync.trace && TD.sync.trace.assert("PRECONDITION " + i, n), "PreconditionAssertionError" | |
}, e._break = function () { | |
console.log("you might want to set a breakpoint here ;-)") | |
}, e.warning = function (t) { | |
data = _.toArray(arguments).slice(1), console.log(["WARNING", t, e.pformat(data)]) | |
}, e.error = function (t) { | |
data = _.toArray(arguments).slice(1), console.log(["ERROR", t, e.pformat(data)]) | |
}, e.list_to_set = function (e) { | |
var t = {}; | |
return _.each(e, function (e) { | |
t[e] = !0 | |
}), t | |
}, e.pprint = function (t) { | |
return e.maybe_log(JSON.stringify(t, null, " "), i), t | |
}, e.pformat = function (e) { | |
return JSON.stringify(e, null, " ") | |
}, e.repr = function (e) { | |
return JSON.stringify(e) | |
}, e.clone = function (t) { | |
if (null === t || _.isUndefined(t)) return t; | |
try { | |
return JSON.parse(JSON.stringify(t)) | |
} catch (i) { | |
return e.stateLog("util.clone couldn't parse object", t, i), ["<not jsonable>", t] | |
} | |
}, e.dictMap = function (e, t, i) { | |
var n = {}; | |
return _.each(_.map(e, t, i), function (e) { | |
n[e[0]] = e[1] | |
}), n | |
}, e.stall = function (e, t) { | |
_.isUndefined(t) && (t = 0); | |
var i = new TD.core.defer.Deferred; | |
return _.delay(_.bind(i.callback, i), 1e3 * t, e), i | |
}, e.autoRetry = function (e, t, i) { | |
var n = e(); | |
return t.forEach(function (t) { | |
n.addErrback(function (n) { | |
if (!i || i(n)) { | |
var r = new TD.core.defer.Deferred; | |
return r.addCallback(e), setTimeout(function () { | |
r.callback() | |
}, t), r | |
} | |
return n | |
}) | |
}), n | |
}, e.makeThingScheduler = function (t, i, n, s, o) { | |
var a = !1, | |
c = !1; | |
s = s || function () { | |
return !0 | |
}, o = _.isUndefined(o) ? 1 : o; | |
var u = [], | |
l = function () { | |
if (e.maybe_log(["_maybe_do_stuff", n, "want stuff done:", a, "am doing stuff:", c], r), !a) return void e.maybe_log("not doing stuff; someone else did stuff before us", r); | |
if (c) return void e.maybe_log("am already doing stuff", r); | |
c = !0, a = !1; | |
var s = TD.controller.progressIndicator; | |
if (i) var o = s.addTask(i); | |
var d = TD.core.defer.maybeDeferred(t); | |
d.addCallback(function (e) { | |
if (c = !1, i && s.deleteTask(o), a) l(); | |
else { | |
var t = u; | |
u = []; | |
for (var n = 0; n < t.length; n++) try { | |
t[n].callback(e) | |
} catch (r) { | |
_.defer(_.bind(t[n].errback, t[n]), r) | |
} | |
} | |
}), d.addErrback(function (r) { | |
e.errmark(r, 'do_stuff for "' + n + '" yielded error when calling; ' + t), c = !1, i && s.taskFailed(o); | |
var a = u; | |
u = []; | |
for (var l = 0; l < a.length; l++) try { | |
a[l].errback(r) | |
} catch (d) { | |
_.defer(_.bind(a[l].errback, a[l]), d) | |
} | |
}) | |
}; | |
return function (t) { | |
if (!s()) return e.maybe_log("not triggering (guarded): " + n, r), TD.core.defer.succeed(); | |
t = _.isUndefined(t) ? o : t, e.maybe_log('trigger func called "' + n + '"', r), a = !0; | |
var i = new TD.core.defer.Deferred; | |
return u.push(i), setTimeout(l, 1e3 * t), i | |
} | |
}, e | |
}), | |
function (e, t) { | |
"function" == typeof define && define.amd ? define([], t) : e.TD.storage.MemoryStorage = t() | |
}(this, function () { | |
"use strict"; | |
function e() { | |
this.data = {}, this.length = 0 | |
} | |
return e.prototype.clear = function () { | |
this.data = {}, this.length = 0 | |
}, e.prototype.getItem = function (e) { | |
var t = this.data[e]; | |
return void 0 !== t ? t : null | |
}, e.prototype.key = function () { | |
throw new Error("MemoryStore.key not implemented.") | |
}, e.prototype.removeItem = function (e) { | |
null !== this.getItem(e) && (delete this.data[e], this.length--) | |
}, e.prototype.setItem = function (e, t) { | |
null === this.getItem(e) && this.length++, this.data[e] = "" + t | |
}, e | |
}), | |
function (e, t) { | |
"use strict"; | |
"function" == typeof define && define.amd ? define(["scripts/storage/memory_storage", "scripts/sync/util"], t) : _.extend(e.TD.storage, t(e.TD.storage.MemoryStorage, e.TD.sync.util)) | |
}(this, function (e, t) { | |
"use strict"; | |
function i(t) { | |
t ? this._initBackend(t) : this._backend = new e | |
} | |
var n = "tweetdeckAccount", | |
r = "currentAuthType", | |
s = "staySignedIn", | |
o = "__hasAlreadyReloaded", | |
a = "_session", | |
c = "migrate", | |
u = "accountsLastVerified", | |
l = "__version__", | |
d = "ScribeTransport", | |
h = [d], | |
p = h.concat([l, "previousMultiUserAccount", s, r, c, d]), | |
f = { | |
local: localStorage, | |
session: sessionStorage | |
}; | |
return i.getPreviousStorage = function () { | |
var e = _.pairs(f), | |
t = _.find(e, function (e) { | |
return e[1].getItem(n) || e[1].getItem(r) || e[1].getItem(s) | |
}); | |
return t ? t[0] : null | |
}, i._testStore = function (e, n) { | |
t.stateLog("_testStore()"); | |
for (var r = !1, s = !1, o = "__test__", a = "test", c = 1024; a.length < c;) a += a; | |
try { | |
e.setItem(o, a), r = e.getItem(o) === a, e.removeItem(o) | |
} catch (u) { | |
r = !1, s = u.code === window.DOMException.QUOTA_EXCEEDED_ERR, s && 0 === e.length && TD.sync.util.warn(u, "In Safari private browsing mode") | |
} | |
if (n && s) try { | |
i.flushDataFromStore(e), r = i._testStore(e, !1) | |
} catch (u) { | |
r = !1 | |
} | |
return r | |
}, i.flushDataFromStore = function (e, t) { | |
t = (t || []).concat(p), i.wipe(e, t) | |
}, i.flushBackend = function (e, t) { | |
return i.flushDataFromStore(f[e], t) | |
}, i.wipeAll = function () { | |
[localStorage, sessionStorage].forEach(i.wipe) | |
}, i.wipe = function (e, t) { | |
var i = {}; | |
t = _.uniq((t || []).concat(h)), t.forEach(function (t) { | |
var n = e.getItem(t); | |
n && (i[t] = n) | |
}); | |
try { | |
e.clear() | |
} catch (n) { | |
console.warn("Clearing", e, "failed:", n) | |
} | |
_.each(i, function (t, i) { | |
e.setItem(i, t) | |
}) | |
}, i.shouldTryReload = function () { | |
var e; | |
try { | |
e = !!sessionStorage.getItem(o), sessionStorage.setItem(o, !0) | |
} catch (t) { | |
e = !0 | |
} | |
return !e | |
}, i.removeReloadedFlag = function () { | |
sessionStorage.removeItem(o) | |
}, i.flushWebstorage = function (e) { | |
TD.sync.util.trace("clearing web storage"); | |
try { | |
Object.keys(f).forEach(function (t) { | |
i.flushDataFromStore(f[t], e) | |
}) | |
} catch (t) { | |
console.error("Unable to clear webstorage.", t) | |
} | |
}, i.clearOtherBackends = function (e) { | |
Object.keys(f).forEach(function (t) { | |
t !== e && i.wipe(f[t]) | |
}) | |
}, i.prototype.init = function (e, n) { | |
this._initBackend(e), n && n.uid !== this.getTweetdeckAccount() && (t.stateLog("New login. Clearing previous webstorage."), i.flushBackend(e), i.clearOtherBackends(e)) | |
}, i.prototype._initBackend = function (n) { | |
this._backendType = "unknown", t.stateLog("Initializing backend with", n), _.isFunction(n.getItem) && i._testStore(n) ? this._backend = n : "local" === n && i._testStore(window.localStorage, !0) ? (this._migrateBackend(window.localStorage), this._backend = window.localStorage, this._backendType = "local") : "session" === n && i._testStore(window.sessionStorage, !0) ? (this._migrateBackend(window.sessionStorage), this._backend = window.sessionStorage, this._backendType = "session") : (t.stateLog("store._initBackend(): Falling back to MemoryStorage."), this._backend = new e, this._backendType = "memory"), this._tryUpgrade() | |
}, i.prototype._migrateBackend = function (e, t) { | |
if (t = t || this._getPersistentBackend(), t !== e) | |
for (var i in t) | |
if (t.hasOwnProperty(i)) { | |
try { | |
e.setItem(i, t.getItem(i)) | |
} catch (n) { | |
if (n.code === window.DOMException.QUOTA_EXCEEDED_ERR) return void TD.sync.util.warn("Migration failed due to quota limits.", n); | |
throw n | |
} | |
t.removeItem(i) | |
} | |
}, i.prototype._getPersistentBackend = function () { | |
return this._backend instanceof e ? localStorage : this._backend | |
}, i.prototype._tryUpgrade = function () { | |
try { | |
TD.storage.upgrade.doUpgrade(this._backend) | |
} catch (e) { | |
TD.sync.util.warn("Error during store upgrade:", e), i.flushWebstorage() | |
} | |
}, i.prototype._upgradeTweetdeckAccountSession = function () { | |
var e = this._backend.getItem("tweetdeck_account"); | |
if (e && (this._backend.setItem("tweetdeckAccount", e), this._backend.removeItem("tweetdeck_account")), e = this._backend.getItem("tweetdeckAccount"), e && "{" === e.charAt(0)) try { | |
e = JSON.parse(e).email, this._backend.setItem("tweetdeckAccount", e) | |
} catch (t) { | |
console.warn("Upgrading TweetDeck account session failed.", t) | |
} | |
}, i.prototype.getTweetdeckAccount = function () { | |
var e = this._backend.getItem(n); | |
return e ? e : void t.stateLog("store.getTweetdeckAccount(): tdacct invalid", e) | |
}, i.prototype.setTweetdeckAccount = function (e) { | |
TD.sync.util.assert(e, "user identifer must be given to set tweetdeck account"), this._backend.setItem(n, e) | |
}, i.prototype.getTwitterLoginAccount = function () { | |
var e, t; | |
return "twitter" === this.getCurrentAuthType() ? (e = this.getTweetdeckAccount(), t = TD.storage.accountController.getAccountFromId(e)) : void 0 | |
}, i.prototype.getCurrentAuthType = function () { | |
var e = this._getPersistentBackend().getItem(r) || "twitter"; | |
return "{" === e.charAt(0) && (e = "tweetdeck"), t.stateLog("getCurrentAuthType(): ", e), e | |
}, i.prototype.setCurrentAuthType = function (e) { | |
this._getPersistentBackend().setItem(r, e) | |
}, i.prototype.setStaySignedIn = function (e) { | |
this._getPersistentBackend().setItem(s, e) | |
}, i.prototype._getLastVerifiedTimestamps = function () { | |
var e = {}; | |
try { | |
e = this.getJSON(u) | |
} catch (i) { | |
t.stateLog("_getLastVerifiedTimestamps(): failed", i) | |
} | |
return e | |
}, i.prototype.getMigrateData = function () { | |
var e; | |
try { | |
e = JSON.parse(sessionStorage.getItem(c)) | |
} catch (t) {} | |
return e || {} | |
}, i.prototype.getLastVerifiedTimestamp = function (e) { | |
var t, i, n = this._getLastVerifiedTimestamps(); | |
return t = n[e.getKey()] || 0, i = e.getUpdated() || 0, Math.max(t, i) | |
}, i.prototype.setLastVerifiedTimestamp = function (e) { | |
var t = this._getLastVerifiedTimestamps(), | |
i = t[e.getKey()] || 0, | |
n = e.getUpdated() || 0, | |
r = Math.max(i, n); | |
r !== i && (t[e.getKey()] = r, this.setJSON(u, t)) | |
}, i.prototype.removeLastVerifiedTimestamp = function (e) { | |
var t = this._getLastVerifiedTimestamps(); | |
delete t[e.getKey()], this.setJSON(u, t) | |
}, i.prototype.getSessionData = function () { | |
this._upgradeTweetdeckAccountSession(); | |
var e = { | |
authType: this.getCurrentAuthType(), | |
uid: this._backend.getItem(n), | |
migrate: this.getMigrateData(), | |
session: null, | |
sessionExists: !1, | |
staySignedIn: !!this.getJSON(s) | |
}; | |
return e.uid && (e.session = this._backend.getItem(a), TD.sync.tdapi.setSession(e.session), e.sessionExists = TD.sync.tdapi.isLoggedIn()), e | |
}, i.prototype.setSessionData = function (e) { | |
this._backend.setItem(a, JSON.stringify(e)) | |
}, i.prototype.checkVersion = function (e) { | |
var t = this._backend.getItem(l); | |
if (null !== t && ~t !== ~e) throw new Error("Wrong version number in store. (saved) %s != (given) %s", t, e) | |
}, i.prototype.setVersion = function (e) { | |
this._backend.setItem(l, e) | |
}, i.prototype.getJSON = function (e) { | |
return JSON.parse(this._backend.getItem(e) || "{}") | |
}, i.prototype.setJSON = function (e, t) { | |
this._backend.setItem(e, JSON.stringify(t)) | |
}, i.prototype.setJSONCritical = function (e, t, i) { | |
try { | |
this._backend.setItem(e, JSON.stringify(t)) | |
} catch (n) { | |
if (n.code !== window.DOMException.QUOTA_EXCEEDED_ERR || i) throw n; | |
$(document).trigger("dataStorageFull"), this.setJSONCritical(e, t, !0) | |
} | |
}, { | |
Store: i, | |
store: new i | |
} | |
}), TD.sync.trace = function (e) { | |
var t = {}, | |
i = []; | |
return t.record = function () { | |
var t = (new Date).toLocaleTimeString(); | |
i.push([t].concat(_.toArray(arguments))), TD.config.debug_trace && e.stateLog.apply(null, ["-------- TRACE: " + t].concat(_.toArray(arguments))), TD.config.debug_menu || i.length > 200 && i.splice(0, 100) | |
}, t.request = function (e, i, n) { | |
t.record("request", e, n.type, i, _.clone(n)) | |
}, t.response = function (e, i, n, r) { | |
t.record("response", e, i, _.clone(n), _.clone(r)) | |
}, t.objInit = function (e, i, n) { | |
t.record("obj init", e, _.clone(i), _.clone(n)) | |
}, t.manage = function (i, n) { | |
t.record("manage", i, n, e.clone(n.getStateForLocalstorage())) | |
}, t.update = function (e, i, n) { | |
t.record("update", e, i, _.clone(n)) | |
}, t.push = function (i, n, r, s) { | |
t.record("push", i, n, _.clone(r), e.clone(s)) | |
}, t.tsResults = function (e, i, n, r, s, o) { | |
t.record("t+s results", e, _.clone(i), _.clone(n), _.clone(r), _.clone(s), o) | |
}, t.tsResult = function (e, i, n, r, s, o) { | |
t.record("t+s result", e, _.clone(i), _.clone(n), r, _.clone(s), o) | |
}, t.conflicts = function (e, i, n, r, s) { | |
t.record("conflicts", e, _.clone(i), _.clone(n), _.clone(r), s) | |
}, t.conflict = function (e, i, n, r, s) { | |
t.record("conflict", e, _.clone(i), _.clone(n), _.clone(r), s) | |
}, t.assert = function (i, n) { | |
t.record("ASSERT", i, n, e.getStack()) | |
}, t.clear = function () { | |
i = [] | |
}, t.logDump = function () { | |
var e = "-------------------------------------------------------------"; | |
console.log(e + " TRACE dump " + e), _.each(i, function (e) { | |
console.log.call(console, e) | |
}), console.log(e + " END dump " + e) | |
}, t.logSummarise = function () { | |
var t = "-------------------------------------------------------------"; | |
console.log(t + " TRACE dump " + t); | |
var n = e.list_to_set(["obj init", "update"]); | |
_.each(i, function (e) { | |
n[e[1]] || console.log.call(console, e) | |
}), console.log(t + " END dump " + t) | |
}, t | |
}(TD.sync.util), TD.sync.tdapi = function (e, t, i, n) { | |
var r = {}, | |
s = null, | |
o = null, | |
a = function (e, t) { | |
return "x-td-basic " + n.encode(e + ":" + t) | |
}, | |
c = function () { | |
if (!s) throw new Error("Not Logged In"); | |
return "X-TD-Session " + s | |
}, | |
u = function (e) { | |
return _.isUndefined(e.session) || (s = e.session), e | |
}, | |
l = function (e) { | |
return s = null, e | |
}, | |
d = function (e) { | |
try { | |
e.req.responseJSON = JSON.parse(e.req.responseText) | |
} catch (t) { | |
TD.sync.util.verboseLog("Could not parse error response JSON. Probably was none.", t) | |
} | |
return e | |
}; | |
r.login = function (e, t) { | |
var i = "/login", | |
n = { | |
type: "GET", | |
headers: { | |
Authorization: a(e, t), | |
"X-TD-Authtype": "tweetdeck" | |
} | |
}, | |
s = r.drequest(i, n, {}); | |
return s.addCallback(u), s | |
}, r.twogin = function (e, t) { | |
var i = "/login", | |
n = { | |
type: "GET", | |
headers: { | |
Authorization: a(e, t), | |
"X-TD-Authtype": "twitter" | |
} | |
}, | |
s = r.drequest(i, n, {}); | |
return s.addErrback(d), s.addCallback(u), s | |
}, r.twoginSend2FACode = function (e, t, i) { | |
var n = "/login", | |
s = { | |
login_verification_request_id: i.requestId, | |
login_verification_user_id: "" + i.userId | |
}; | |
i.code && (s.login_verification_challenge_response = i.code); | |
var o = { | |
type: "POST", | |
data: JSON.stringify(s), | |
contentType: "application/json", | |
headers: { | |
"X-TD-Authtype": "twitter" | |
} | |
}, | |
a = r.drequest(n, o, {}); | |
return a.addErrback(d), a.addCallback(u), a | |
}, r.logout = function (e) { | |
e = e || {}; | |
var t = "/logout" + (e.allSessions ? "?all_sessions=true" : ""), | |
i = r.drequest(t, r.getReq({ | |
method: "POST" | |
})); | |
return i.addCallback(l), i | |
}, r.doMigration = function (e) { | |
var i = e && e.email; | |
if (!i) return TD.core.defer.succeed(); | |
var n = new t.Deferred; | |
return $(document).one("uiMigrationLoginConfirmation", function () { | |
n.callback(e) | |
}).trigger("dataNeedsMigrateLoginConfirmation"), n.addCallback(function () { | |
var t = r.importSetup(e.email, e.passhash); | |
return t.addCallback(function (e) { | |
return $(document).trigger("uiMigrateSuccess", e), e | |
}), t | |
}), n.addCallback(function () { | |
var i = new t.Deferred; | |
return $(document).one("uiMigrateCompleteConfirmation", function () { | |
i.callback(e) | |
}).trigger("dataNeedsMigrateCompleteConfirmation"), i | |
}), n.addErrback(function (e) { | |
var i, n = new t.Deferred; | |
try { | |
i = e.req.responseJSON | |
} catch (r) { | |
i = {} | |
} | |
return $(document).trigger("uiMigrateError", { | |
message: e.message, | |
code: e.number, | |
data: _.defaults(i, { | |
error: "UnknownError" | |
}) | |
}), n | |
}), n | |
}, r.importSetup = function (e, t) { | |
return r.requestWithBody("/import", "POST", { | |
from_username: e, | |
passhash: t | |
}) | |
}, r.importPreview = function (e, t) { | |
return r.drequest("/import/preview", { | |
type: "POST", | |
headers: {}, | |
data: JSON.stringify({ | |
from_username: e, | |
passhash: t | |
}), | |
contentType: "application/json" | |
}) | |
}, r.isLoggedIn = function () { | |
return Boolean(s) | |
}, r.setSession = function (e) { | |
var t = null; | |
e && (t = JSON.parse(e)), t && (s = t) | |
}, r.saveSession = function () { | |
TD.storage.store.setSessionData(s) | |
}, r.onAuthFail = function (e) { | |
o = e | |
}, r.createAccount = function (e, t) { | |
var i = TD.util.iso8601(new Date), | |
n = "/user" + TD.config.td_create_key + i, | |
s = new window.jsSHA(n, "ASCII"), | |
o = s.getHMAC(TD.config.td_create_secret, "ASCII", "SHA-256", "B64"), | |
c = "/user", | |
l = { | |
type: "PUT", | |
headers: { | |
Authorization: a(e, t), | |
"x-td-sig": o, | |
"x-td-timestamp": i, | |
"x-td-create": TD.config.td_create_key | |
} | |
}, | |
d = r.drequest(c, l); | |
return d.addCallback(u), d | |
}, r.Conflict = function (e) { | |
this.body = e | |
}; | |
var h = new RegExp("^([^:]*): (.*)$"), | |
p = function (e, t) { | |
_.isUndefined(t) && (t = {}); | |
var i = e.getAllResponseHeaders(), | |
n = i.split("\r\n"); | |
return 1 == n.length && (n = i.split("\n")), _.each(n, function (e) { | |
var i = e.match(h); | |
i && (t[i[1].toLowerCase()] = i[2]) | |
}), t | |
}; | |
return r.drequest = function (n, s, a, c) { | |
var u = _.uniqueId(s && s.reqid ? "[" + s.reqid + "]rq:" : "rq:"); | |
if (e.stateLog("drequest", u, n, s), (null === s || _.isUndefined(s)) && (s = r.getReq()), i.request(u, n, s), "/" == n.charAt(0) && (n = TD.config.api_root + n), !_.startsWith(n, "http://") && !_.startsWith(n, "https://")) return t.fail(new Error("Malformed url")); | |
var l = function (i, n) { | |
var r = jQuery.ajax(i, n), | |
s = new t.Deferred; | |
return r.done(function (e, t, i) { | |
s.callback(i) | |
}), r.fail(function (i, n, r) { | |
409 === i.status ? (e.assert("Conflict" === r, "409 should be Conflict"), s.callback(i)) : s.errback(new t.XMLHttpRequestError(i, r)) | |
}), s | |
}, | |
d = l(n, s); | |
d.reqid = u; | |
var h = function (e) { | |
var t, i = e.req; | |
if (401 !== i.status || c) throw e; | |
if (t = p(i), "X-TD-Session" !== t["www-authenticate"]) throw e; | |
throw o && o(), e | |
}; | |
d.addErrback(h); | |
var f = function (t) { | |
var o, c = function (t) { | |
if ("" === t) return t; | |
try { | |
return JSON.parse(t) | |
} catch (i) { | |
return _.isEmpty(t) || e.warn(["failed to json parse drequest response;", t, "for request", n, s]), t | |
} | |
}; | |
return o = 409 === t.status ? new r.Conflict(c(t.responseText)) : c(t.responseText), a && p(t, a), a && a.date && TD.storage.notification.notify("/date", a.date), e.stateLog("drequest ret", u, n, o, t.getAllResponseHeaders().split("\n")), i.response(u, n, o, a), o | |
}; | |
return d.addCallback(f, u), d | |
}, r.requestWithBody = function (e, t, i, n, s, o, a) { | |
var c = r.getReq({ | |
type: t, | |
reqid: o, | |
headers: s || {}, | |
data: JSON.stringify(i), | |
contentType: "application/json" | |
}); | |
return r.drequest(e, c, n, a) | |
}, r.getReq = function (e) { | |
var t = { | |
type: "GET", | |
headers: {} | |
}; | |
for (var i in e) e.hasOwnProperty(i) && (t[i] = e[i]); | |
return t.headers.Authorization = c(), e && e.method && (t.type = e.method), t | |
}, r | |
}(TD.sync.util, TD.core.defer, TD.sync.trace, TD.core.base64), TD.storage.notification = function (e) { | |
var t = {}, | |
i = [], | |
n = function () { | |
var e = i.splice(0, i.length); | |
_.each(e, function (e) { | |
if (e.topic) try { | |
jQuery.publish(e.topic, e.args) | |
} catch (t) { | |
console.log("FAILURE publishing event", e, t) | |
} else e.d && e.d.callback() | |
}) | |
}; | |
return t.notify = function (e) { | |
var t = Array.prototype.slice.call(arguments, 1); | |
i.push({ | |
topic: e, | |
args: t | |
}), _.defer(n) | |
}, t.flush = function () { | |
var t = new e.Deferred; | |
return i.push({ | |
d: t | |
}), _.defer(n), t | |
}, t | |
}(TD.core.defer), TD.storage.StoredObj = function (e, t, i, n, r, s, o) { | |
function a(e) { | |
this.controller = e | |
} | |
return a.prototype.controller = null, a.prototype.managed = !1, a.prototype.stateCache = null, a.prototype.state = null, a.prototype.privateState = null, a.prototype.eventname = "/storage/object", a.prototype._init = function (i) { | |
i || (i = {}), o.objInit(this, i), this.state = {}, this.privateState = {}, _.isEmpty(i) ? (this.deltaQ = [], this.stateCache = null) : (this.deltaQ = [new e.StoredDelta("init", i)], this.stateCache = _.clone(i)), t.verboseLog("StoredObj.init", this, i, this.deltaQ) | |
}, a.prototype.getApiid = function () { | |
var e = this.getPrivate("apiid"); | |
return t.assert(e, "missing apiid", this), e | |
}, a.prototype.hasApiid = function () { | |
return Boolean(this.getPrivate("apiid")) | |
}, a.prototype.setApiid = function (e) { | |
return o.update("set apiid", this, [e]), this.setPrivate("apiid", e) | |
}, a.prototype.getKey = function () { | |
return this.getPrivate("key") | |
}, a.prototype.setKey = function (e) { | |
return this.setPrivate("key", e) | |
}, a.prototype._prepCache = function () { | |
return null === this.stateCache && (t.assert(0 === this.deltaQ.length, "empty stateCache must coincide with empty ΔQ"), this.stateCache = _.clone(this.state)), this.stateCache | |
}, a.prototype.set = function (i, n) { | |
return o.update("set", this, [i, n]), t.assert("columns" !== i, "you should be setting column_order, not columns"), this._prepCache(), this.deltaQ.push(new e.StoredDelta("set", i, n)), this.stateCache[i] = n, s.notify(this.eventname + "/change", this), this.controller.triggerPush() | |
}, a.prototype.setListPermutation = function (i, n) { | |
TD.config.debug_checks && this.checkCache(); | |
var a = this.get(i); | |
if (_.isEqual(n, a)) return o.update("set null list permutation", this, [i, a, n]), t.stateLog("ignoring request to change list at", i), r.succeed(); | |
o.update("set list permutation", this, [i, a, n]); | |
var c = e.StoredDelta.listPermutator(i, a, n); | |
return t.verboseLog("set list permutation", a, "→", n, "Δs:", c), this.deltaQ = this.deltaQ.concat(c), this.stateCache = e.StoredDelta.applyMultiple(this.deltaQ, this.state), TD.config.debug_checks && this.checkCache(), s.notify(this.eventname + "/change", this), this.controller.triggerPush() | |
}, a.prototype.listPrepend = function (t, i) { | |
o.update("list prepend", this, [t, i]); | |
var n = this.get(t); | |
return n || (n = []), this._prepCache(), this.deltaQ.push(new e.StoredDelta("linsert", t, i, 0)), this.stateCache[t] = [i].concat(n), s.notify(this.eventname + "/change", this), this.controller.triggerPush() | |
}, a.prototype.listAppend = function (t, i) { | |
o.update("list append", this, [t, i]); | |
var n = this.get(t); | |
return n || (n = []), this._prepCache(), this.deltaQ.push(new e.StoredDelta("linsert", t, i, n.length)), this.stateCache[t] = n.concat([i]), s.notify(this.eventname + "/change", this), this.controller.triggerPush() | |
}, a.prototype.listAdd = function (i, n) { | |
var a = this.get(i); | |
a || (a = []); | |
var c = new e.StoredDelta("ladd", i, n, a.length), | |
u = c.applyToValue(i, a); | |
return _.isEqual(u, a) ? (o.update("set null list add", this, [i, a, u]), t.stateLog("ignoring request to add to list at", i), r.succeed()) : (o.update("list add", this, [i, n]), this._prepCache(), this.deltaQ.push(c), this.stateCache[i] = u, s.notify(this.eventname + "/change", this), this.controller.triggerPush()) | |
}, a.prototype.listTruncate = function (t, i) { | |
o.update("list truncate", this, [t, i]); | |
var n = this.get(t); | |
return n || (n = []), this._prepCache(), this.deltaQ.push(new e.StoredDelta("ltrunc", t, i)), n.length > i && n.splice(i, n.length - i), this.stateCache[t] = n, s.notify(this.eventname + "/change", this), this.controller.triggerPush() | |
}, a.prototype.listRemove = function (t, i) { | |
o.update("list remove", this, [t, i]); | |
var n = this.get(t) || []; | |
return this._prepCache(), this.deltaQ.push(new e.StoredDelta("ldel", t, i)), this.stateCache[t] = _.without(n, i), s.notify(this.eventname + "/change", this), this.controller.triggerPush() | |
}, a.prototype.listDedupe = function (t) { | |
o.update("list dedupe", this, [t]); | |
var i = this.get(t) || []; | |
this._prepCache(); | |
var n = new e.StoredDelta("ldedupe", t); | |
return this.deltaQ.push(n), this.stateCache[t] = n.applyToValue(t, i), s.notify(this.eventname + "/change", this), this.controller.triggerPush() | |
}, a.prototype.dictSet = function (t, i, n) { | |
o.update("dict set", this, [t, i, n]), this._prepCache(); | |
var r = _.clone(this.get(t)); | |
return this.deltaQ.push(new e.StoredDelta("hset", t, i, n)), r || (r = {}), r[i] = n, this.stateCache[t] = r, s.notify(this.eventname + "/change", this), this.controller.triggerPush() | |
}, a.prototype.setPrivate = function (e, t) { | |
return this.privateState[e] = t, r.succeed() | |
}, a.prototype.getPrivate = function (e) { | |
return this.privateState[e] | |
}, a.prototype.immutableSet = function (e, i) { | |
var n = this.state[e]; | |
if (i != n) throw t.warn("ERROR: attempt to change", e, "of", this, "from", n, "to", i), new Error("attempt to modify immutable field " + e); | |
return r.succeed() | |
}, a.prototype.setValueIffDifferent = function (e, i, n, o) { | |
var a = this.get(e); | |
return _.isEqual(a, i) ? r.succeed(null) : (t.verboseLog(this, "setValueIffDifferent", e, "from", a, "to", i), n && s.notify(n, i, a, this), o && o(i, a), s.notify(this.eventname + "/change", this), this.set(e, i)) | |
}, a.prototype.get = function (e) { | |
return null === this.stateCache ? this.state[e] : this.stateCache[e] | |
}, a.prototype.latestDelta = function () { | |
return _.isEmpty(this.deltaQ) ? null : this.deltaQ[this.deltaQ.length - 1].id | |
}, a.prototype.getStateForBackend = function () { | |
TD.config.debug_checks && (t.precondition(this.isDirty(), "don't call getStateForBackend unless isDirty"), this.checkCache()); | |
var e = _.clone(null !== this.stateCache ? this.stateCache : this.state); | |
return !e.mtime && this.state.mtime && (e.mtime = this.state.mtime), { | |
Δ id: this.latestDelta(), state: this.transformForRemote(e, this.privateState) | |
} | |
}, a.prototype.postProcessNewRemoteState = function () {}, a.prototype.newRemoteState = function (i) { | |
o.update("new remote state", this, i), TD.config.debug_checks && (t.stateLog("checking cache"), this.checkCache()), t.verboseLog("transforming to local:", this, t.clone(i)), this.state = this.transformToLocal(i), 0 !== this.deltaQ.length ? (t.assert(null !== this.stateCache, "if we have Δs, we should have cache"), t.verboseLog("applying pending deltas", this, t.clone(this.deltaQ)), this.stateCache = e.StoredDelta.applyMultiple(this.deltaQ, this.state)) : t.assert(null === this.stateCache, "if no Δs, should have no cache"), this.postProcessNewRemoteState(), TD.config.debug_checks && (t.stateLog("checking cache"), this.checkCache()), s.notify(this.eventname + "/change", this) | |
}, a.prototype.commit = function (i, n) { | |
o.update("commit", this, [i + " : " + n]); | |
var r = _.pluck(this.deltaQ, "id").indexOf(i); | |
if (-1 === r) throw t.stateLog("asked to commit " + i + " but it doesn't exist in " + _.map(this.deltaQ, function (e) { | |
return e.toString() | |
})), new Error("invalid deltaId supplied"); | |
if (TD.config.debug_checks && this.checkCache(), r === this.deltaQ.length - 1) this.deltaQ = [], this.state = _.clone(this.stateCache), this.state.mtime = n, this.stateCache = null, TD.config.debug_checks && this.checkCache(); | |
else { | |
var s = this.deltaQ.splice(0, r + 1), | |
a = e.StoredDelta.applyMultiple(s, this.state); | |
this.state = a, this.state.mtime = n, this.stateCache.mtime = n, TD.config.debug_checks && this.checkCache(), this.controller.triggerPush() | |
} | |
}, a.prototype.checkCache = function () { | |
var i = e.StoredDelta.checkStateCache(this.state, this.deltaQ, this.stateCache); | |
t.assert(i, "cache != state+Δs") | |
}, a.prototype.checkInvariants = function () { | |
this.hasApiid() || t.assert(_.isEmpty(this.state), 'must have no "state" if no apiid'), t.assert(this.state && _.isUndefined(this.state.apiid), "apiid in non-priv state, bad"), this.isDirty() ? (t.assert(!_.isEmpty(this.deltaQ), "deltaQ must be non-empty if dirty"), t.assert(null !== this.stateCache, "cache must be present if dirty"), this.checkCache(), this.hasApiid() && t.assert(null !== this.latestDelta(), "latestDelta() must not return null for Δid for dirty object")) : (t.assert(_.isEmpty(this.deltaQ), "deltaQ must be empty if not dirty"), t.assert(null === this.stateCache, "cache must be absent if not dirty")) | |
}, a.prototype.isDirty = function () { | |
return this.hasApiid() ? 0 !== this.deltaQ.length : (t.assert(0 !== this.deltaQ.length, "should be dirty if no apiid"), !0) | |
}, a | |
}(TD.storage, TD.sync.util, TD.sync.tdapi, TD.util, TD.core.defer, TD.storage.notification, TD.sync.trace), TD.storage.StoredDelta = function (e) { | |
function t(t) { | |
this.type = t, e.assert(r[t] && i, "unknown type " + t), this.args = _.toArray(arguments).slice(1), this.id = "Δ" + (new Date).getTime() + _.uniqueId(":"), n(t, this.args), "init" === t && (e.verboseLog("initialisation delta", this.id, this.args[0]), "mtime" in this.args[0] && (e.warn("WARNING init Δ contains mtime!", e.clone(this.args[0])), e._break())) | |
} | |
var i = { | |
init: 1, | |
set: 2, | |
del: 1, | |
lmove: 3, | |
ldel: 2, | |
linsert: 3, | |
ladd: 3, | |
ltrunc: 2, | |
ldedupe: 1, | |
hset: 3, | |
other: 0 | |
}, | |
n = function (t, n) { | |
var r = i[t]; | |
switch (e.assert(n.length === r, "wrong no. args for " + t + ", expected " + r + " got " + n.length), t) { | |
case "ltrunc": | |
e.assert("number" == typeof n[1], "ltrunc: length must be number"); | |
break; | |
case "linsert": | |
case "ladd": | |
case "ldel": | |
case "lmove": | |
e.assert("string" == typeof n[1], "list elements must be strings") | |
} | |
}; | |
t.prototype.toString = function () { | |
return "StoredDelta[" + this.id + "](" + this.type + ": " + JSON.stringify(this.args) + ")" | |
}, t.prototype.serialise = function () { | |
return [this.type].concat(this.args) | |
}; | |
var r = { | |
init: function (t, i) { | |
if (!_.isEqual(t, {})) { | |
var n = e.clone(t), | |
r = e.clone(i); | |
return delete n.mtime, delete r.mtime, _.isEqual(n, r) ? (e.warn("WARNING Δ init_state === state", e.clone(t), "init:", i.mtime, "state:", t.mtime), t) : void e.warn("WARNING discarding init_state", e.clone(i), "in favour of", e.clone(t)) | |
} | |
return _.clone(i) | |
}, | |
set: function (e, t, i) { | |
return e[t] = i, e | |
}, | |
del: function (e, t) { | |
return delete e[t], e | |
}, | |
lmove: function (e, t, i, n) { | |
var r = _.clone(e[t]), | |
s = r.indexOf(i); | |
return -1 != s ? (r.splice(s, 1), r.splice(s + n, 0, i), e[t] = r, e) : void 0 | |
}, | |
ldel: function (e, t, i) { | |
var n; | |
return n = _.isUndefined(e[t]) ? [] : _.without(e[t], i), e[t] = n, e | |
}, | |
linsert: function (e, t, i, n) { | |
var r; | |
return r = _.isUndefined(e[t]) ? [] : _.clone(e[t]), r.splice(n, 0, i), e[t] = r, e | |
}, | |
ladd: function (e, t, i, n) { | |
if (_.include(e[t], i)) return e; | |
var r; | |
return r = _.isUndefined(e[t]) ? [] : _.clone(e[t]), r.splice(n, 0, i), e[t] = r, e | |
}, | |
ltrunc: function (e, t, i) { | |
var n; | |
return n = _.isUndefined(e[t]) ? [] : e[t], n.length > i && n.splice(i, n.length - i), e[t] = n, e | |
}, | |
ldedupe: function (e, t) { | |
var i; | |
return i = _.isUndefined(e[t]) ? [] : e[t], e[t] = _.uniq(i), e | |
}, | |
hset: function (e, t, i, n) { | |
var r = _.clone(e[t]); | |
return r || (r = {}), r[i] = n, e[t] = r, e | |
} | |
}; | |
t.prototype.apply = function (t) { | |
var i = _.clone(t), | |
n = r[this.type], | |
s = n.apply(this, [i].concat(this.args)); | |
return s ? s : (e.warn("WARNING: unable to apply Δ", this.toString(), "to", e.clone(t)), _.clone(t)) | |
}, t.prototype.applyToValue = function (e, t) { | |
var i = {}; | |
return i[e] = t, this.apply(i)[e] | |
}, t.listPermutator = function (i, n, r) { | |
var s = [], | |
o = _.clone(n); | |
if (e.verboseLog("StoredDelta.listPermutator", n, "→", r), n.length != _.union(n).length || r.length != _.union(r).length) throw e.stateLog("Duplicate error in listPermutator", { | |
original: n, | |
original_: _.union(n), | |
target: r, | |
targetu: _.union(r) | |
}), new TypeError("lists must not contain duplicates"); | |
_.each(_.difference(n, r), function (e) { | |
s.push(new t("ldel", i, e)), o.splice(o.indexOf(e), 1) | |
}); | |
for (var a = 0; a < r.length; a++) | |
if (o[a] != r[a]) { | |
var c = r[a], | |
u = o.indexOf(c); - 1 === u ? (s.push(new t("ladd", i, c, a)), o.splice(a, 0, c)) : (s.push(new t("lmove", i, c, a - u)), o.splice(u, 1), o.splice(a, 0, c)) | |
} | |
return s | |
}, t.applyMultiple = function (e, t) { | |
return _.reduce(e, function (e, t) { | |
return t.apply(e) | |
}, t) | |
}; | |
var s = function (e, t) { | |
function i() { | |
return e.apply(this, t) | |
} | |
return i.prototype = e.prototype, new i | |
}; | |
return t.deserialiseDeltas = function (e) { | |
return _.map(e, function (e) { | |
return s(t, e) | |
}) | |
}, t.checkStateCache = function (i, n, r) { | |
if (null === r && 0 === n.length) return !0; | |
ccache = _.clone(r), delete ccache.mtime; | |
var s = t.applyMultiple(n, _.clone(i)); | |
return delete s.mtime, _.isEqual(ccache, s) ? !0 : (e.stateLog("cache", r, "!= goal", s, "for", i, "+", n), !1) | |
}, t | |
}(TD.sync.util, TD.sync.tdapi, TD.util, TD.core.defer, TD.storage.notification), TD.storage.SobjController = function (e, t, i, n, r, s) { | |
var o = function () { | |
this._objects = null, this._objectsByApiid = null, this.reqsinflight = null, this.apiEndpoint = null, this._moduleName = null | |
}; | |
return o.prototype.toString = function () { | |
return "<SobjController[" + (this._moduleName || "unknown") + "]>" | |
}, o.prototype.triggerPush = function () { | |
throw t.printStacktrace(), new Error("NotImplemented") | |
}, o.prototype.bindTrigger = function (i) { | |
var n = t.makeThingScheduler, | |
r = e.store.getTweetdeckAccount.bind(e.store); | |
this.triggerPush = n(_.bind(this.pushDirty, this), null, i, r) | |
}, o.prototype.remove = function (e) { | |
var t = this._objects[e]; | |
t && (t.managed = !1, t.hasApiid() && delete this._objectsByApiid[t.getApiid()]), delete this._objects[e] | |
}, o.prototype.getAll = function () { | |
return _.values(this._objects) | |
}, o.prototype.getByApiid = function (e) { | |
return t.assert(e, "must provide apiid; " + t.repr(e)), t.assert("undefined" != e, "huh? where did that come from?"), this._objectsByApiid[e] | |
}, o.prototype.pushPreflight = function () { | |
return r.succeed(null) | |
}, o.prototype.pushDirty = function () { | |
TD.config.debug_checks && this.checkInvariants(); | |
var e = _.uniqueId("pD:"); | |
s.push(this, "pushDirty", null, e); | |
var t = this, | |
i = this.pushPreflight(); | |
return i.addCallback(function () { | |
var i = _.filter(t._objects, function (e) { | |
return e.isDirty() | |
}); | |
if (_.isEmpty(i)) return s.push(t, "(not dirty)", null, e), r.succeed(); | |
var n = t.pushObjects(i, e); | |
return n.addCallback(function () { | |
return t.pushDirty() | |
}), n | |
}), i | |
}, o.prototype.prePushCheckInvariants = function () {}, o.prototype.pushObjects = function (e, n) { | |
if (t.verboseLog(this.toString() + ".pushObjects()", this, e), n || (n = _.uniqueId("pO:")), s.push(this, "pushObjects", e, n), t.assert(this.apiEndpoint, "api endpoint must be set"), _.isEmpty(e)) return s.push(this, "(empty)", e, n), r.succeed([]); | |
TD.config.debug_checks && this.prePushCheckInvariants(e); | |
var o = _.map(e, function (e) { | |
return e.getStateForBackend() | |
}), | |
a = _.pluck(o, "Δid"), | |
c = _.pluck(o, "state"); | |
s.push(this, "objs+Δs", e, a, n), TD.config.debug_checks && (_.each(c, function (e) { | |
t.assert(e.mtime || !e.id, "for a test and set request, we expect (require) either mtime (modify) or absence of id (create) for every object") | |
}), _.isEmpty(this.reqsinflight) || (t.warn("WARNING! called pushObjects", e, "when already have requests in flight", t.clone(this.reqsinflight)), t._break())); | |
var u = {}, | |
l = i.requestWithBody(this.apiEndpoint, "POST", c, u, { | |
"x-td-mtime-check": "partial" | |
}, n); | |
if (TD.config.debug_checks) { | |
this.reqsinflight.push(l.reqid); | |
var d = this; | |
l.addBoth(function (e) { | |
return d.reqsinflight = _.without(d.reqsinflight, l.reqid), e | |
}) | |
} | |
return l.addCallbackWith(this, this._processTSResults, e, a, u, n), l | |
}, o.prototype._processTSResults = function (e, n, r, o, a) { | |
s.tsResults(this, e, n, r, o, a), e instanceof i.Conflict && (s.conflicts(this, e.body, n, o, a), e = e.body), t.assert(e.length == n.length, "wrong number of responses/objects!"), t.assert(e.length == r.length, "wrong number of responses/deltas!"), t.verboseLog("objects", n, "deltas", r), _.each(r, function (e) { | |
t.assert(null !== e, "Δid must not be null") | |
}); | |
var c = o["x-td-mtime"]; | |
t.assert(c, "require x-td-mtime header in object PUT"); | |
for (var u, l = this, d = function (e, i) { | |
t.verboseLog("_processTSResults:check_set_apiid", e, i), e.hasApiid() ? t.assert(e.getApiid() == i, "apiid mismatch") : (l._objectsByApiid[i] = e, e.setApiid(i)) | |
}, h = 0; h < e.length; h++) u = e[h], _.isString(u) ? (t.verboseLog("_processTSResults", n[h], e[h]), d(n[h], e[h]), n[h].commit(r[h], c)) : (s.conflict(this, u, n[h], o, a), t.verboseLog("_processTSResults: not an apiid:", u), n[h].newRemoteState(e[h])) | |
}, o.prototype.pushObject = function (e, n) { | |
t.verboseLog(this.toString() + ".pushObject()", this, e, n), s.push(this, "object", e); | |
var r = e.getStateForBackend(), | |
o = r.Δ id, | |
a = r.state; | |
t.assert(a.mtime, "for a test and set request, we expect (require) mtime"); | |
var c = {}, | |
u = i.requestWithBody(n, "PUT", a, c, { | |
"x-td-iff-mtime": a.mtime | |
}); | |
return u.addCallbackWith(this, this._processTSResult, e, o, c), u | |
}, o.prototype._processTSResult = function (e, n, r, o) { | |
s.tsResult(this, e, n, r, o), t.verboseLog("object", n, "delta", r), t.assert(null !== r, "Δid must not be null"); | |
var a; | |
if (e instanceof i.Conflict) t.verboseLog("_processTSResult: got a conflict:", e), a = n.newRemoteState(e.body); | |
else { | |
t.assert(_.isString(e), "don't know how to handle response"); | |
var c = o["x-td-mtime"]; | |
t.assert(c, "require x-td-mtime header in object PUT"), t.verboseLog("_processTSResult", n, e), a = n.commit(r, c) | |
} | |
return a | |
}, o.prototype.checkInvariants = function () { | |
var e = this; | |
_.each(this._objects, function (i) { | |
var n = i.checkInvariants; | |
n && n.call(i), i.hasApiid() && t.assert(e._objectsByApiid[i.getApiid()], "all managed objects with apiid must be in _objectsByApiid") | |
}) | |
}, o | |
}(TD.storage, TD.sync.util, TD.sync.tdapi, TD.storage.notification, TD.core.defer, TD.sync.trace), TD.storage.FeedController = function (e, t, i, n) { | |
var r = function () { | |
var i = this; | |
this.apiEndpoint = "/feeds", this._moduleName = "feeds", this.reqsinflight = [], this.bindTrigger("feedctr"), i._objects = {}, i._objectsByApiid = {}, this.toString = function () { | |
return "<FeedController>" | |
}, this.init = function () { | |
t.trace("feedController init"), TD.config.debug_checks && this.checkInvariants() | |
}, this.reset = function () { | |
this._objects = {}, this._objectsByApiid = {} | |
}, this.updateFromBackend = function (i) { | |
var r = this; | |
t.stateLog("feedController.updateFromBackend:", i), _.each(i, function (t, i) { | |
var s = r._objectsByApiid[i]; | |
s ? (s.newRemoteState(t), n.notify("/storage/feed/updated", s)) : (s = e.Feed.newFromBackendState(t), s.setApiid(i), r.manage(s), n.notify("/storage/feed/new", s)) | |
}) | |
}, this.get = function (e) { | |
return this._objects[e] | |
}, this.manage = function (e) { | |
e.managed = !0; | |
var n = this._objects[e.getKey()]; | |
return n && e === n ? i.triggerPush() : (n && (t.warn("WARNING replacing feed", n, "with", e, "please use feedController.getOrCreateFeed", [t.getStack().split("\n")]), n.getLatestTime() > e.getLatestTime() && t.warn("Warning: latestTime weirdness:", n.getLatestTime(), e.getLatestTime()), n.hasApiid() && e.setApiid(n.getApiid()), n.isDirty() && (_.isEmpty(n.deltaQ) || "init" != n.deltaQ[0].type) && t.assert(!n.isDirty(), "houston, we have a problem")), this._objects[e.getKey()] = e, e.hasApiid() && (this._objectsByApiid[e.getApiid()] = e), i.triggerPush()) | |
}, this.manageFeeds = function (e) { | |
for (var t = 0; t < e.length; t++) i.manage(e[t]) | |
}, this._selfcheckapiids = function () { | |
for (var e in this._objects) { | |
var t = this._objects[e]; | |
t.apiid && _assert(t == i.getByApiid(t.apiid), "lookup failed") | |
} | |
}, i.isEmpty = function () { | |
return _.isEmpty(this._objects) | |
}, i.getOrCreateFeed = function (t, i, n, r, s) { | |
var o, a, c; | |
if ("search" !== t || r.term || r.baseQuery && r.searchFilterData && (o = new TD.vo.SearchFilter(r.searchFilterData), r.term = [r.baseQuery, o.getQueryString()].join(" ")), c = e.Feed.generateKeyFor(n, t, r), a = this._objects[c], !a) { | |
var u = { | |
type: t, | |
service: i, | |
accountkey: n, | |
metadata: r, | |
apiid: s | |
}; | |
a = new e.Feed(u) | |
} | |
return s && (a.apiid = s, this._objectsByApiid[s] = a), a | |
} | |
}; | |
return r.prototype = new e.SobjController, e.feedController = new r, r | |
}(TD.storage, TD.sync.util, TD.sync.tdapi, TD.storage.notification, TD.core.defer), TD.storage.ColumnController = function (e, t, i, n) { | |
var r = function () { | |
var i = this; | |
this.apiEndpoint = "/columns", this._moduleName = "columns", this.reqsinflight = [], this.bindTrigger("colctr"), $.subscribe("/storage/account/new", function (e) { | |
i.addToCombinedColumns(e) | |
}), $.subscribe("/storage/client/account_whitelist_changed", function () { | |
i.rebuildScheduledColumns() | |
}), $(document).one("TD.ready", function () { | |
i.rebuildScheduledColumns() | |
}), this._objects = {}, this._objectsByApiid = {}, this.toString = function () { | |
return "<ColumnController>" | |
}, this.init = function () { | |
t.trace("columnController init"), TD.config.debug_checks && this.checkInvariants() | |
}, this.reset = function () { | |
this._objects = {}, this._objectsByApiid = {} | |
}, this.updateFromBackend = function (i) { | |
var r = this; | |
t.stateLog("columnController.updateFromBackend:", i), _.each(i, function (t, i) { | |
var s = r._objectsByApiid[i]; | |
s ? s.newRemoteState(t) : (s = e.Column.newFromBackendState(t), s.setApiid(i), r.manage(s), n.notify("/storage/column/new", s)) | |
}) | |
}, this.get = function (e) { | |
return this._objects[e] | |
}, this.getColumnsContainingFeed = function (e) { | |
var t = []; | |
return _.each(this._objects, function (i) { | |
_.each(i.getFeedKeys(), function (n) { | |
n == e && t.push(i) | |
}) | |
}), t | |
}, this.getColumnsByType = function (e) { | |
return _.filter(this._objects, function (t) { | |
return t.getType() === e | |
}) | |
}, this.manage = function (e) { | |
return e.managed = !0, t.assert(e.getKey(), "columns must have valid keys to be managed!"), this._objects[e.getKey()] = e, e.hasApiid() && (this._objectsByApiid[e.getApiid()] = e), this.triggerPush() | |
}, this.remove = function (e) { | |
var t = this._objects[e]; | |
t && (t.managed = !1), delete this._objects[e] | |
}, this.getAll = function () { | |
return _.values(this._objects) | |
}, this.getByApiid = function (e) { | |
t.assert(e, "must provide apiid; " + t.repr(e)), t.assert("undefined" !== e, "huh? where did that come from?"); | |
var i = this._objectsByApiid[e]; | |
return i || (t.warn("WARNING: col ", e, " not found in cols_by_apiid ", _.keys(this._objectsByApiid)), t.stateLog("this._objects, apiids; ", t.pformat(_.map(this._objects, function (e, t) { | |
return [t, e.getApiid()] | |
})))), i | |
}, this.isEmpty = function () { | |
return _.isEmpty(this._objects) | |
}, this._selfcheckapiids = function () { | |
for (var e in this._objects) { | |
var t = this._objects[e]; | |
t.hasApiid() && _assert(t == this.getByApiid(t.getApiid()), "lookup failed") | |
} | |
}, this.addToCombinedColumns = function (i) { | |
t.stateLog("ADDING ACCOUNT TO COMBINED COLS", i); | |
for (var n, r, s, o, a = e.clientController.client.getColumnOrder(), c = { | |
home: !0, | |
me: !0, | |
privateMe: !0 | |
}, u = function (e) { | |
return e.getKey() | |
}, l = 0; l < a.length; l++) | |
if (n = this.get(a[l])) { | |
if (r = n.getType(), c[r]) { | |
switch (s = null, r) { | |
case "me": | |
s = this.getMeFeeds([i]); | |
break; | |
case "privateMe": | |
s = this.getInboxFeeds([i]) | |
} | |
s && (o = s.map(u), n.setFeedKeys(n.getFeedKeys().concat(o)), n.managed && e.feedController.manageFeeds(s)) | |
} | |
} else t.warn("Warning: Column not found!"), t._break() | |
}, this.rebuildScheduledColumns = function () { | |
var t = e.clientController.client.getColumnOrder(), | |
i = t.map(this.get.bind(this)), | |
n = this.getScheduledFeeds(), | |
r = n.map(function (e) { | |
return e.getKey() | |
}); | |
i.forEach(function (t) { | |
"scheduled" === t.getType() && (t.setFeedKeys(r), t.managed && e.feedController.manageFeeds(n)) | |
}) | |
}; | |
var r = function (t, i) { | |
var n = e.feedController; | |
return n.getOrCreateFeed(t, i.getType(), i.getKey(), {}) | |
}; | |
this.getMeFeeds = function (e) { | |
for (var t = [], i = 0; i < e.length; i++) "twitter" === e[i].getType() && t.push(r("mentions", e[i])); | |
return t | |
}, this.getInboxFeeds = function (e) { | |
for (var t = [], i = 0; i < e.length; i++) "twitter" === e[i].getType() && t.push(r("direct", e[i])); | |
return t | |
}, this.getScheduledFeeds = function () { | |
var t = TD.storage.accountController.getAccountsForService("twitter"), | |
i = t.map(r.bind(this, TD.util.columnUtils.feedTypes.SCHEDULED)); | |
return i.push(e.feedController.getOrCreateFeed(TD.util.columnUtils.feedTypes.SCHEDULED, "tweetdeck", "tweetdeck", {})), i | |
}, this.prePushCheckInvariants = function (i) { | |
_.each(i, function (i) { | |
_.each(i.getFeedKeys(), function (i) { | |
t.assert(e.feedController.get(i), "feeds must exist + be managed in columns push; " + i), t.assert(e.feedController.get(i).hasApiid(), "feeds must all have apiid in columns push; " + i) | |
}) | |
}) | |
} | |
}; | |
return r.prototype = new e.SobjController, r.prototype.pushPreflight = function () { | |
return e.feedController.triggerPush(.05) | |
}, e.columnController = new r, r | |
}(TD.storage, TD.sync.util, TD.sync.tdapi, TD.storage.notification, TD.core.defer), TD.storage.AccountController = function (e, t, i, n, r) { | |
var s = function () { | |
var s = this; | |
this._moduleName = "accounts", this.reqsinflight = [], s.ACCEPTED_ACCOUNT_TYPES = { | |
twitter: !0, | |
bitly: !0 | |
}, this._objects = {}, this._unverified = {}, s.blacklistAccount = function (i) { | |
t.stateLog("blacklisting", i); | |
var r = i.getKey(); | |
e.clientController.client.addToAccountBlacklist(r), this._objects[r] && s.remove(r), e.clientController.client.delFromAccountWhitelist(r), n.notify("/storage/account/blacklisted", i) | |
}, s.whitelistAccounts = function (i) { | |
t.stateLog("whitelisting", i), e.clientController.client ? _.each(i, function (t) { | |
e.clientController.client.addToAccountWhitelist(t.getKey()), e.clientController.client.delFromAccountBlacklist(t.getKey()) | |
}) : t.warn("Can't update whitelist: client not initialised") | |
}, s.isEmpty = function () { | |
return _.isEmpty(this._objects) | |
}, s.isSingleUser = function () { | |
return 1 === this.getAll().length | |
}, s.getDefault = function () { | |
var t = e.clientController.client.getDefaultAccount(); | |
return t && this._objects[t] ? this._objects[t] : s.isEmpty() ? null : (s.setDefault(s.getAll()[0].getKey()), this._objects[e.clientController.client.getDefaultAccount()]) | |
}, s.getUserIdentifier = function () { | |
var t, i = e.store.getCurrentAuthType(); | |
return "twitter" === i ? (t = s.getAccountFromId(e.store.getTweetdeckAccount()), t ? t.state.username : "") : e.store.getTweetdeckAccount() | |
}, s.setDefault = function (t) { | |
e.clientController.client.setDefaultAccount(t) | |
}, s.getAccountsForService = function (e) { | |
return _.select(this._objects, function (t) { | |
return t.getType() === e | |
}) | |
}, s.getAccountFromUsername = function (e) { | |
var t = s.getAccountsForService("twitter"); | |
return e = e.toLowerCase(), _.select(t, function (t) { | |
return t.getUsername().toLowerCase() === e | |
}) | |
}, s.getAccountFromId = function (e) { | |
var t = s.getAccountsForService("twitter"); | |
return _.find(t, function (t) { | |
return "" + t.getUserID() === e | |
}) | |
}, s.getPreferredAccount = function (e) { | |
var t = s.getDefault(); | |
return !t || e && t.getType() != e ? s.getAccountsForService(e)[0] : t | |
}, this.init = function () { | |
t.trace("accountController init"), jQuery.subscribe("/storage/client/change", function (e) { | |
_.each(e.getAccountBlacklist(), function (e) { | |
s._objects[e] && s.remove(e) | |
}) | |
}) | |
}, this.reset = function () { | |
this._objects = {} | |
}, this.triggerPush = function () { | |
t.assert(!1, "triggerPush() should not be called on account controller") | |
}, this.updateFromBackend = function (i, n) { | |
t.stateLog("accountController.updateFromBackend:", i); | |
var r = t.list_to_set(n.settings.account_whitelist || []); | |
i = i || [], i = i.filter(function (t) { | |
var i = e.Account.generateKeyFor(t.service, t.uid), | |
n = r[i]; | |
return this.ACCEPTED_ACCOUNT_TYPES[t.service] ? (n || (this._unverified[i] = e.Account.newFromBackendState(t)), n) : !1 | |
}.bind(this)); | |
var s = this; | |
_.each(i, function (i) { | |
var n = e.Account.generateKeyFor(i.service, i.uid), | |
r = s._objects[n]; | |
r ? (t.stateLog("updating existing", r, "with", i), r.newRemoteState(i)) : (t.stateLog("creating new Account with", i), r = e.Account.newFromBackendState(i), s.manage(r)) | |
}) | |
}, this.get = function (e) { | |
return "tweetdeck" === e ? { | |
getKey: function () { | |
return "tweetdeck" | |
}, | |
getUserID: function () { | |
return "tweetdeck" | |
}, | |
getType: function () { | |
return "tweetdeck" | |
} | |
} : this._objects[e] | |
}, this.manage = function (t) { | |
if (!t.getKey()) throw { | |
name: "TypeError", | |
message: "account must have its .key set" | |
}; | |
return t.managed = !0, this._objects[t.getKey()] || n.notify("/storage/account/new", t), this._objects[t.getKey()] = t, this.whitelistAccounts([t]), e.store.setLastVerifiedTimestamp(t), this.pushAccount(t) | |
}, s.remove = function (t) { | |
var i = this._objects[t]; | |
return i.managed = !1, delete this._objects[t], n.notify("/storage/account/removed", i), e.store.removeLastVerifiedTimestamp(i), this.deleteAccount(i) | |
}, s.getAll = function () { | |
var e = _.values(this._objects); | |
return e.sort(s.accountComparator), e | |
}, s.getPostingAccounts = function () { | |
return _.filter(s.getAll(), function (e) { | |
return "bitly" !== e.getType() | |
}) | |
}, s.accountComparator = function (e, t) { | |
var i = e.getType ? e.getType() : e.service, | |
n = t.getType ? t.getType() : t.service, | |
r = e.getUserID ? e.getUserID() : e.uid, | |
s = t.getUserID ? t.getUserID() : t.uid, | |
o = "twitter" == i ? 2 : 1, | |
a = "twitter" == n ? 2 : 1; | |
return a > o ? 1 : o > a ? -1 : 2 == o && 2 == a ? r > s ? 1 : -1 : i > n ? 1 : -1 | |
}, s.getDefaults = function () { | |
var e = s.getAll(), | |
t = s.getDefault(), | |
i = [], | |
n = {}; | |
t && (n[t.getType()] = !0, i.push(t)); | |
for (var r = 0; r < e.length; r++) n[e[r].getType()] || (n[e[r].getType()] = !0, i.push(e[r])); | |
return i | |
}, s.loginTweetdeck = function (e, n) { | |
t.stateLog("aC.loginTweetdeck()", e, n); | |
var r = TD.core.sha1(n), | |
s = i.login(e, r); | |
return s.addCallback(function (t) { | |
return { | |
httpStatus: 200, | |
account: { | |
uid: e, | |
password: r, | |
plaintextPassword: n | |
}, | |
data: t | |
} | |
}), s.addErrback(function (e) { | |
return { | |
httpStatus: e.number, | |
message: e.message, | |
data: e.req.responseJSON | |
} | |
}), s | |
}, s.loginTwitter = function (e, n) { | |
t.stateLog("aC.loginTwitter()", e, n); | |
var r = i.twogin(e, n); | |
return r.addCallback(function (e) { | |
return { | |
httpStatus: 200, | |
account: { | |
uid: e && e.user_id, | |
password: null, | |
plaintextPassword: n | |
}, | |
data: e, | |
xAuth: e.xauth_response || {} | |
} | |
}), r.addErrback(function (e) { | |
return { | |
httpStatus: e.number, | |
message: e.message, | |
data: e.req.responseJSON, | |
xAuth: e.req.responseJSON.xauth_response || {} | |
} | |
}), r | |
}, s.loginTwitterWith2FACode = function (e, n, r) { | |
t.stateLog("aC.loginTwitterWith2FACode()", e, n, r); | |
var s = i.twoginSend2FACode(e, n, r); | |
return s.addCallback(function (e) { | |
return { | |
httpStatus: 200, | |
account: { | |
uid: e && e.user_id, | |
password: null, | |
plaintextPassword: n | |
}, | |
data: e, | |
xAuth: e.xauth_response || {} | |
} | |
}), s.addErrback(function (e) { | |
return { | |
httpStatus: e.number, | |
message: e.message, | |
data: e.req.responseJSON, | |
xAuth: e.req.responseJSON.xauth_response || {} | |
} | |
}), s | |
}, s.createTweetdeckAccount = function (e, n) { | |
t.stateLog("aC.createTweetdeckAccount()", e, n); | |
var r = TD.core.sha1(n), | |
s = i.createAccount(e, r); | |
return s.addErrback(t.errmark, "accountController.js:createTweetDeckAccount():->tdapi.createAccount()"), s.addCallback(function () { | |
return { | |
account: { | |
uid: null, | |
password: r, | |
plaintextPassword: n | |
}, | |
data: { | |
accounts: [] | |
} | |
} | |
}), s.addErrback(t.errmark, "accountController.js:createTweetDeckAccount()"), s | |
}, s.pushAccounts = function () { | |
return r.gatherResults(_.map(this._objects, function (e) { | |
return s.pushAccount(e) | |
})) | |
}, s.pushAccount = function (e) { | |
if (i.isLoggedIn()) { | |
var t = e.getKey(); | |
if (t && this._objects[t]) { | |
var n = e.getStateForBackend(), | |
r = "/accounts/" + e.getType() + "/" + e.getUserID(); | |
return i.requestWithBody(r, "POST", n) | |
} | |
} | |
}, s.deleteAccount = function (e) { | |
if (i.isLoggedIn()) { | |
t.stateLog("sync.controller.deleteAccount:", e); | |
var n = "/accounts/" + e.getType() + "/" + e.getUserID(); | |
return i.drequest(n, i.getReq({ | |
method: "DELETE" | |
})) | |
} | |
}, s._verifyAccount = function (e, t) { | |
var i = TD.controller.auth.create(e.getType(), e), | |
n = new r.Deferred; | |
return i.verifyAccount(n.callback.bind(n), n.errback.bind(n)), t && n.addErrback(function () {}), n.addCallback(function () { | |
TD.storage.accountController.manage(e) | |
}), n | |
}, s.verifyNewTwoginAccount = function () { | |
t.stateLog("verifyNewTwoginAccount"); | |
var i, n, r; | |
return "twitter" === TD.storage.store.getCurrentAuthType() && (n = e.Account.generateKeyFor("twitter", TD.storage.store.getTweetdeckAccount()), r = this._unverified[n], r && (i = this._verifyAccount(r, !0))), this._unverified = {}, i || TD.core.defer.succeed() | |
}, s.verifyStoredAccounts = function () { | |
t.stateLog("verifyStoredAccounts: starting"); | |
var i, n = [], | |
o = Date.now() - TD.constants.time.oneDay, | |
a = s.getAll(); | |
return _.each(a, function (t) { | |
(e.store.getLastVerifiedTimestamp(t) < o || !t.getProfileImageURL() || !t.getUsername() || !t.getName()) && n.push(this._verifyAccount(t, !0)) | |
}.bind(this)), i = new r.DeferredList(n), i.addCallback(function () { | |
t.stateLog("verifyStoredAccounts: done.") | |
}), i | |
} | |
}; | |
return s.prototype = new e.SobjController, e.accountController = new s, s | |
}(TD.storage, TD.sync.util, TD.sync.tdapi, TD.storage.notification, TD.core.defer), TD.storage.ClientController = function (e, t, i, n, r, s, o) { | |
var a = function () { | |
var i = this; | |
this.apiEndpoint = "/clients", _.defer(function () { | |
var n = t.makeThingScheduler, | |
r = e.store.getTweetdeckAccount.bind(e.store); | |
i.triggerPush = n(_.bind(i.pushIfDirty, i), null, "clisync", r) | |
}), this._moduleName = "clients", this.reqsinflight = [], this._objects = {}, this._objectsByApiid = this._objects, this.client = null, this.toString = function () { | |
return "<ClientController>" | |
}, this.init = function () { | |
t.stateLog("client controller init start", this.client), t.trace("clientController init"), TD.config.sync_name in this._objects ? (this.client = this._objects[TD.config.sync_name], t.assert(this.client.getName(), "need name!"), t.stateLog("client controller new client:", this.client)) : t.stateLog("no initial client state; deferring client creation"), t.stateLog("clientController.init: client: ", this.client) | |
}, this.reset = function () { | |
this.client = null | |
}, this.createNewClient = function () { | |
t.stateLog("clientController.createNewClient()"); | |
var i = this, | |
r = { | |
name: TD.config.sync_name, | |
columns: [], | |
settings: {} | |
}, | |
s = {}, | |
o = n.requestWithBody("/clients", "POST", r, s); | |
return o.addCallback(function () { | |
t.stateLog("createNewClient resp headers; ", s); | |
var n = s["x-td-mtime"]; | |
return t.assert(n, "require x-td-mtime header in client POST"), r.mtime = n, i.client = e.Client.newFromBackendState(r), t.assert(i.client.getName(), "Client should have name at this point"), i._objects[i.client.getName()] = i.client, t.stateLog("clientController.createNewClient with", i.client.state), i.triggerPush() | |
}), o | |
}, this.updateFromBackend = function (i) { | |
null === this.client ? (this.client = e.Client.newFromBackendState(i), this._objects[this.client.getName()] = this.client, t.stateLog("client controller (ufb) new client:", this.client)) : this.client.newRemoteState(i) | |
}, this.pushIfDirty = function () { | |
if (TD.config.debug_checks && this.checkInvariants(), o.push(this, "dirty", null), this.client.isDirty()) { | |
o.push(this, "dirty", this.client); | |
var i = this, | |
n = e.columnController.triggerPush(); | |
return n.addCallback(function () { | |
return t.assert(i.client.isDirty(), "?!? push dirty, but not dirty"), i.pushObject(i.client, "/clients/" + i.client.getName()) | |
}), n.addCallback(function () { | |
return i.pushIfDirty() | |
}), n | |
} | |
return o.push(this, "not dirty", null), s.succeed() | |
} | |
}; | |
return a.prototype = new e.SobjController, e.clientController = new a, a | |
}(TD.storage, TD.sync.util, TD.util, TD.sync.tdapi, TD.storage.notification, TD.core.defer, TD.sync.trace), TD.storage.Feed = function (e, t) { | |
var i = function (e, t) { | |
this._init(e), _.isUndefined(t) || (this.state = this.transformToLocal(t)), this.setKey(i.generateKeyFor(this.getAccountKey(), this.getType(), this.getMetadata())) | |
}; | |
return i.prototype = new e.StoredObj(e.feedController), i.prototype.eventname = "/storage/feed", i.generateKeyFor = function (e, i, n) { | |
n = n || {}; | |
var r = TD.util.deterministicObjectHash(n), | |
s = [e, i, r]; | |
return t.assert(e, "accountkey not set in Feed.generateKey"), t.assert(i, "type not set in Feed.generateKey"), encodeURI(s.join(":")) | |
}, i.prototype.getType = function () { | |
return this.get("type") | |
}, i.prototype.setType = function (e) { | |
return this.immutableSet("type", e) | |
}, i.prototype.getService = function () { | |
return this.get("service") | |
}, i.prototype.setService = function (e) { | |
return this.immutableSet("service", e) | |
}, i.prototype.getAccountKey = function () { | |
return this.get("accountkey") | |
}, i.prototype.setAccountKey = function (e) { | |
return this.immutableSet("accountkey", e) | |
}, i.prototype.getLatestTime = function () { | |
var e = this.get("marks"); | |
if (!e || _.isEmpty(e)) return 0; | |
var t = e[0]; | |
return t.last_notification || 0 | |
}, i.prototype.setLatestTime = function (e) { | |
var t = this.get("marks"); | |
return !t || _.isEmpty(t) ? this.set("marks", [{ | |
last_notification: e | |
}]) : (t[0].last_notification = e, this.set("marks", t)) | |
}, i.prototype.getMetadata = function () { | |
return _.clone(this.get("metadata")) | |
}, i.prototype.setMetadata = function (e) { | |
return this.immutableSet("metadata", e) | |
}, i.prototype.transformForRemote = function (i, n) { | |
var r = e.accountController.get(i.accountkey); | |
t.assert(r && r.getUserID(), "must have acct + uid for feed transform"); | |
var s = r.getUserID(), | |
o = { | |
type: i.type, | |
service: i.service, | |
account: { | |
userid: s.toString() | |
}, | |
metadata: JSON.stringify(i.metadata), | |
marks: i.marks | |
}; | |
return i.mtime && (o.mtime = i.mtime), n.apiid && (o.id = n.apiid), o | |
}, i.prototype.reprocessNotificationMarks = function (e, t) { | |
var i = null, | |
n = null; | |
if (t && t.marks && !_.isEmpty(t.marks) && (i = t.marks[0].last_notification, n = t.marks), e.marks && !_.isEmpty(e.marks)) { | |
n = e.marks; | |
var r = e.marks[0].last_notification; | |
i && r ? i = Math.max(i, r) : r && (i = r) | |
} | |
return n ? n[0].last_notification = i : n = i ? [{ | |
last_notification: i | |
}] : [], n | |
}, i.prototype.transformToLocal = function (t) { | |
var i = { | |
type: t.type, | |
service: t.service, | |
accountkey: e.Account.generateKeyFor(t.service, t.account.userid), | |
metadata: JSON.parse(t.metadata), | |
mtime: t.mtime, | |
marks: t.marks | |
}; | |
return i | |
}, i.newFromBackendState = function (e) { | |
return new i(null, e) | |
}, i | |
}(TD.storage, TD.sync.util, TD.sync.tdapi, TD.util), TD.storage.Column = function (e, t, i, n, r) { | |
var s = function (e) { | |
this._init(e), this.privateState.key || (this.privateState.key = "c" + (new Date).getTime() + _.uniqueId("s")) | |
}; | |
s.prototype = new e.StoredObj(e.columnController), s.prototype.eventname = "/storage/column", s.prototype.getTitle = function () { | |
var e = this.get("title"); | |
return _.isUndefined(e) ? "loading…" : e | |
}, s.prototype.setTitle = function (e) { | |
return this.set("title", e) | |
}, s.prototype.getDescription = function () { | |
return this.get("description") | |
}, s.prototype.setDescription = function (e) { | |
return this.set("description", e) | |
}, s.prototype.getType = function () { | |
return this.get("type") | |
}, s.prototype.setType = function (e) { | |
return this.set("type", e) | |
}, s.prototype.getFilters = function () { | |
return this.get("filters") | |
}, s.prototype.setFilters = function (e) { | |
return this.setValueIffDifferent("filters", e) | |
}, s.prototype.getHasSound = function () { | |
var e = this.get("settings"); | |
return Boolean(e && e.has_sound) | |
}, s.prototype.setHasSound = function (e) { | |
return e = Boolean(e), r.notify("/storage/column/column_flags_changed", "has_sound", e, this), this.dictSet("settings", "has_sound", e) | |
}, s.prototype.getHasNotification = function () { | |
var e = this.get("settings"); | |
return Boolean(e && e.has_notification) | |
}, s.prototype.setHasNotification = function (e) { | |
return e = Boolean(e), r.notify("/storage/column/column_flags_changed", "has_notification", e, this), this.dictSet("settings", "has_notification", e) | |
}, s.prototype.getMediaPreviewSize = function () { | |
var e = this.get("settings"); | |
return e ? e.media_preview_size : null | |
}, s.prototype.setMediaPreviewSize = function (e) { | |
return $(document).trigger("dataColumnSettings", { | |
columnKey: this.getKey(), | |
mediaPreviewSize: e | |
}), this.dictSet("settings", "media_preview_size", e) | |
}, s.prototype.getClearedTimestamp = function () { | |
var e = this.get("settings"); | |
return e && e.cleared_timestamp ? e.cleared_timestamp : 0 | |
}, s.prototype.setClearedTimestamp = function (e) { | |
return r.notify("/storage/column/column_marks_changed", "cleared_timestamp", e, this), this.dictSet("settings", "cleared_timestamp", e) | |
}, s.prototype.getFeedKeys = function () { | |
return this.get("feedkeys") | |
}, s.prototype.setFeedKeys = function (e) { | |
return this.setValueIffDifferent("feedkeys", _.isArray(e) ? _.uniq(e.sort(), !0) : e, "/storage/column/feeds_changed") | |
}; | |
var o = ["mtime", "type", "title", "description", "settings", "position", "bookmarks", "filters"]; | |
return s.prototype.transformForRemote = function (i, n) { | |
var r = function (i) { | |
var n = e.feedController.get(i); | |
return t.assert(n && n.hasApiid(), "feeds must have apiid when transforming column for remote"), n.getApiid() | |
}, | |
s = {}; | |
return _.each(o, function (e) { | |
s[e] = i[e] | |
}), s.feeds = _.map(i.feedkeys, r), i.mtime && (s.mtime = i.mtime), n.apiid && (s.id = n.apiid), s | |
}, s.prototype.transformToLocal = function (i) { | |
TD.config.debug_checks && _.each(i.feeds, function (n) { | |
t.assert(e.feedController.getByApiid(n), "feed not found by apiid in " + t.pformat(i.feeds)) | |
}); | |
var n = {}; | |
return _.each(o, function (e) { | |
n[e] = i[e] | |
}), n.feedkeys = _.map(i.feeds, function (t) { | |
return e.feedController.getByApiid(t).getKey() | |
}), n.apiid = i.id, n | |
}, s.newFromBackendState = function (e) { | |
var t = new s; | |
return t.newRemoteState(e), t | |
}, s | |
}(TD.storage, TD.sync.util, TD.sync.tdapi, TD.util, TD.storage.notification), TD.storage.Account = function (e, t, i) { | |
var n = function (i) { | |
i ? (this.state = _.clone(i), this.privateState = {}) : (this.state = {}, this.privateState = {}); | |
var n = this, | |
r = function () { | |
n.controller.pushAccount(n) | |
}, | |
s = e.store.getTweetdeckAccount.bind(e.store); | |
this.triggerPush = t.makeThingScheduler(r, null, "account", s, .2) | |
}; | |
n.prototype = new e.StoredObj(e.accountController), n.prototype.eventname = "/storage/account", n.generateKeyFor = function (e, t) { | |
return "tweetdeck" === e ? "tweetdeck" : encodeURI(e + ":" + t) | |
}, n.prototype.computeKey = function () { | |
if (!this.getType() || !this.getUserID()) throw { | |
name: "NotReadyError", | |
message: "cannot computeKey on account; insufficient data" | |
}; | |
this.setKey(n.generateKeyFor(this.getType(), this.getUserID())) | |
}, n.prototype.set = function (e, t) { | |
return this.state[e] = t, i.notify(this.eventname + "/change", this), this.triggerPush() | |
}, n.prototype.checkInvariants = function () { | |
t.assert(_.isEmpty(this.deltaQ), "Accounts must not have Δs"), t.assert(null === this.stateCache, "Accounts do not use stateCache") | |
}, n.prototype.getUsername = function () { | |
return this.get("username") | |
}, n.prototype.setUsername = function (e) { | |
return this.set("username", e) | |
}, n.prototype.getName = function () { | |
return this.get("name") | |
}, n.prototype.setName = function (e) { | |
return this.set("name", e) | |
}, n.prototype.getUserID = function () { | |
return this.get("userId") | |
}, n.prototype.setUserID = function (e) { | |
return this.set("userId", e) | |
}, n.prototype.getType = function () { | |
return this.get("type") | |
}, n.prototype.setType = function (e) { | |
return this.set("type", e) | |
}, n.prototype.getOAuthToken = function () { | |
return this.get("oauth_token") | |
}, n.prototype.setOAuthToken = function (e) { | |
return this.set("oauth_token", e) | |
}, n.prototype.getTokenSecret = function () { | |
return this.get("token_secret") | |
}, n.prototype.setTokenSecret = function (e) { | |
return this.set("token_secret", e) | |
}, n.prototype.getProfileImageURL = function () { | |
var e = this.get("profileImageURL"); | |
return e && TD.util.isRetina() && (e = e.replace(TD.services.TwitterUser.NORMAL_SUFFIX_REGEXP, TD.services.TwitterUser.BIGGER_SUFFIX)), e | |
}, n.prototype.setProfileImageURL = function (e) { | |
return this.set("profileImageURL", e) | |
}, n.prototype.getIsPrivate = function () { | |
return this.getPrivate("isPrivate") | |
}, n.prototype.setIsPrivate = function (e) { | |
return this.setPrivate("isPrivate", e) | |
}, n.prototype.getUpdated = function () { | |
return this.getPrivate("updated") | |
}, n.prototype.setUpdated = function (e) { | |
return this.setPrivate("updated", e) | |
}, n.prototype.getStateForBackend = function () { | |
var e = { | |
secret: this.getTokenSecret(), | |
screen_name: this.getUsername(), | |
name: this.getName(), | |
avatar: this.getProfileImageURL(), | |
key: this.getOAuthToken() | |
}; | |
return e | |
}; | |
var r = { | |
key: "oauth_token", | |
token: "oauth_token", | |
secret: "token_secret", | |
screen_name: "username", | |
service: "type", | |
uid: "userId", | |
avatar: "profileImageURL", | |
name: "name" | |
}; | |
return n.prototype.newRemoteState = function (e) { | |
var i = this; | |
t.stateLog(this, ".updateFromBackend(", e, ")"), _.each(r, function (t, n) { | |
e[n] && i.set(t, e[n]) | |
}) | |
}, n.newFromBackendState = function (e) { | |
var t = new n; | |
return t.newRemoteState(e), t.computeKey(), t | |
}, n.prototype.isSameUser = function (e) { | |
return this.getUsername().toLowerCase() === e.toLowerCase() | |
}, n | |
}(TD.storage, TD.sync.util, TD.storage.notification, TD.util, TD.core.base64), TD.storage.Client = function (e, t, i, n, r, s) { | |
var o = 10, | |
a = function (e) { | |
t.trace("Client constructor:"), t.stateLog("Client constructor: ", e); | |
var i = e && e.column_order; | |
i && !_.isEqual(i, _.union(i)) && (t.warn("WARNING! removing duplicates in column_order", _.clone(i)), e.column_order = _.union(i)), t.assert(!e || !e.columns, '"columns" should not be in local client state'), this._init(e), this.managed = !0, TD.config.debug_checks && this.checkInvariants() | |
}; | |
a.prototype = new e.StoredObj(e.clientController), a.prototype.eventname = "/storage/client", a.prototype.recent_searches_limit = o, a.prototype.getName = function () { | |
return this.get("name") | |
}, a.prototype.getApiid = function () { | |
return this.get("name") | |
}, a.prototype.hasApiid = function () { | |
return !0 | |
}, a.prototype.getColumnOrder = function () { | |
return _.clone(this.get("column_order") || []) | |
}, a.prototype.setColumnOrder = function (e) { | |
_.each(e, function (e) { | |
t.precondition("string" == typeof e, "must provide string column keys") | |
}); | |
this.get("column_order"); | |
if (!_.isEqual(e, _.union(e))) throw t.warn("ERROR: column_order contains duplicates:", e), new Error("column_order must not contain duplicates"); | |
return r.notify("/storage/client/column_order_changed"), this.setListPermutation("column_order", e) | |
}, a.prototype.removeColumn = function (e) { | |
return r.notify("/storage/client/column_order_changed"), this.listRemove("column_order", e) | |
}, a.prototype.appendColumn = function (e) { | |
return r.notify("/storage/client/column_order_changed"), this.listAdd("column_order", e) | |
}, a.prototype.cleanAccountLists = function () { | |
this.listDedupe("account_whitelist"), this.listDedupe("account_blacklist") | |
}, a.prototype.getAccountBlacklist = function () { | |
return _.clone(this.get("account_blacklist") || []) | |
}, a.prototype.addToAccountBlacklist = function (t) { | |
var i = this.get("account_blacklist") || []; | |
if (_.include(i, t)) return s.succeed(null); | |
var n = this.listAdd("account_blacklist", t); | |
return r.notify("/storage/client/account_blacklist_changed", i, this.get("account_blacklist"), this), e.accountController.remove(t), n | |
}, a.prototype.delFromAccountWhitelist = function (e) { | |
var t = this.get("account_whitelist") || []; | |
if (!_.include(t, e)) return s.succeed(null); | |
var i = this.listRemove("account_whitelist", e), | |
n = this.get("account_whitelist"); | |
return r.notify("/storage/client/account_whitelist_changed", t, n, this), $(document).trigger("dataAccountWhitelist", { | |
accountKeys: n | |
}), i | |
}, a.prototype.addToAccountWhitelist = function (e) { | |
var t = this.get("account_whitelist") || []; | |
if (_.include(t, e)) return s.succeed(null); | |
var i = this.listAdd("account_whitelist", e), | |
n = this.get("account_whitelist"); | |
return r.notify("/storage/client/account_whitelist_changed", t, n, this), $(document).trigger("dataAccountWhitelist", { | |
accountKeys: n | |
}), i | |
}, a.prototype.delFromAccountBlacklist = function (e) { | |
var t = this.get("account_blacklist") || []; | |
if (!_.include(t, e)) return s.succeed(null); | |
var i = this.listRemove("account_blacklist", e); | |
return r.notify("/storage/client/account_blacklist_changed", t, this.get("account_blacklist"), this), i | |
}, a.prototype.getAccountWhitelist = function () { | |
return _.clone(this.get("account_whitelist")) | |
}, a.prototype.getDefaultAccount = function () { | |
return this.get("default_account") | |
}, a.prototype.addRecentSearch = function (e) { | |
return s.gatherResults([this.listRemove("recent_searches", e), this.listPrepend("recent_searches", e), this.listTruncate("recent_searches", this.recent_searches_limit)]) | |
}, a.prototype.getRecentSearches = function () { | |
return this.get("recent_searches") || [] | |
}, a.prototype.clearRecentSearches = function () { | |
this.set("recent_searches", []) | |
}, a.prototype.postProcessNewRemoteState = function () { | |
var e = this.getColumnOrder(), | |
i = _.union(e); | |
_.isEqual(i, e) || (t.warn("WARNING! found duplicates in column order, collapsing", e), this.state.column_order = i) | |
}, a.prototype.setDefaultAccount = function (e) { | |
return t.assert(!_.isUndefined(e), "huh? you wanted to do what now?"), $(document).trigger("dataDefaultAccount", { | |
accountKey: e | |
}), this.setValueIffDifferent("default_account", e, "/storage/client/default_account_changed") | |
}; | |
var c = ["account_blacklist", "account_whitelist", "default_account", "settings", "recent_searches"]; | |
return a.prototype.transformForRemote = function (i) { | |
t.stateLog("Client.transformToLocal L", i); | |
var n = {}; | |
_.each(c, function (e) { | |
i[e] && (n[e] = i[e]) | |
}); | |
var r = { | |
settings: n, | |
name: i.name | |
}; | |
return r.columns = _.map(i.column_order || [], function (i) { | |
var n = e.columnController.get(i); | |
return t.assert(n.hasApiid(), "Column " + i + " does not have apiid", n), n.getApiid() | |
}), i.mtime && (r.mtime = i.mtime), t.stateLog("Client.transformToLocal R", r), r | |
}, a.prototype.transformToLocal = function (i) { | |
t.stateLog("Client.transformToLocal R", i); | |
var n = {}, | |
r = !1; | |
n.column_order = _.filter(_.map(i.columns, function (n) { | |
if (!n) return t.warn("WARNING: bogus data in rstate.columns!", t.pformat(i.columns)), null; | |
var s = e.columnController.getByApiid(n); | |
return s || (t.stateLog("allocating new empty local sColumn for", n), s = new e.Column, s.setApiid(n), e.columnController.manage(s), r = !0), s.getKey() | |
}), Boolean), r && TD.sync.controller.ueberpull(); | |
var s = i.settings || {}; | |
return _.each(c, function (e) { | |
s[e] && (n[e] = s[e]) | |
}), n.mtime = i.mtime, n.name = i.name, t.stateLog("Client.transformToLocal L", n), n | |
}, a.prototype.setApiid = function () { | |
t.assert(!1, "no-one should ever set apiid on Client") | |
}, a.newFromBackendState = function (e) { | |
var t = new a; | |
return t.newRemoteState(e), t | |
}, a | |
}(TD.storage, TD.sync.util, TD.sync.tdapi, TD.util, TD.storage.notification, TD.core.defer, TD.sync.trace), TD.settings = function (e, t) { | |
function i(e, i) { | |
var s = {}; | |
return t.notify(a + e, i), _.isEqual(i, n(e)) ? TD.core.defer.succeed() : (-1 === k.indexOf(e) && (_.isString(i) || _.isBoolean(i) || _.isNumber(i)) && TD.controller.stats.setting(e, i), s[e] = i, $(document).trigger("dataSettingsValues", s), r.dictSet("settings", e, i)) | |
} | |
function n(e) { | |
var t, i; | |
if (!r) throw new Error("Settings client hasn't been initialized. Call settings.init() first."); | |
return t = r.get("settings"), i = void 0, t && (i = t[e]), _.isUndefined(i) && (i = o[e]), (_.isArray(i) || _.isObject(i)) && (i = TD.sync.util.clone(i)), i | |
} | |
var r, s = {}, | |
o = {}, | |
a = "/storage/client/settings/", | |
c = "use_stream", | |
u = "use_notification_sound", | |
l = "language", | |
d = "check_for_updates", | |
h = "use_narrow_columns", | |
p = "column_width", | |
f = "font_size", | |
m = "theme", | |
g = "scheduled_col_autoadded", | |
T = "link_shortener", | |
v = "use_jmp", | |
y = "global_filter", | |
D = "previous_splash_version", | |
w = "show_startup_notifications", | |
b = "name_cache", | |
C = "seen_message_ids", | |
S = "navbar_width", | |
E = "compose_stay_open", | |
A = "display_sensitive_media", | |
I = "sole_user", | |
k = [D]; | |
return s.linkShorteners = [{ | |
id: "twitter", | |
title: "Twitter" | |
}, { | |
id: "bitly", | |
title: "Bit.ly" | |
}], s.SoleUserState = function (e) { | |
this.state = e || "sole_user_initial" | |
}, s.SoleUserState.prototype = { | |
get initial() { | |
return "sole_user_initial" === this.state | |
}, set initial(e) { | |
throw new Error("Can't transition from initial state to " + e) | |
}, get shared() { | |
return "sole_user_shared" === this.state | |
}, set shared(e) { | |
if (e) { | |
if (!this.initial) throw new Error("Must be in initial state to transition to shared."); | |
this.state = "sole_user_shared" | |
} | |
}, get confirmed() { | |
return "sole_user_confirmed" === this.state | |
}, set confirmed(e) { | |
if (e) { | |
if (!this.initial && !this.shared) throw new Error("Must be in initial or shared state to transition to confirmed."); | |
this.state = "sole_user_confirmed" | |
} | |
} | |
}, s.init = function () { | |
r = e.clientController.client, r || console.warn("Initialized settings before storage.clientController.init() was called.") | |
}, o[c] = !0, s.getUseStream = function () { | |
return Boolean(n(c)) | |
}, s.setUseStream = function (e) { | |
return i(c, Boolean(e)) | |
}, o[u] = !0, s.getUseNotificationSound = function () { | |
return Boolean(n(u)) | |
}, s.setUseNotificationSound = function (e) { | |
return i(u, Boolean(e)) | |
}, s.getLanguage = function () { | |
return String(n(l)) | |
}, s.setLanguage = function (e) { | |
return i(l, String(e)) | |
}, o[d] = !0, s.getCheckForUpdates = function () { | |
return Boolean(n(d)) | |
}, s.setCheckForUpdates = function (e) { | |
return i(d, Boolean(e)) | |
}, o[I] = 0, s.getSoleUserState = function () { | |
return new s.SoleUserState(n(I)) | |
}, s.setSoleUserState = function (e) { | |
return i(I, e.state) | |
}, o[h] = !1, o[p] = "medium", s.getColumnWidth = function () { | |
var e = n(h); | |
return _.isBoolean(e) && (i(h, null), e) ? (s.setColumnWidth("narrow"), "narrow") : n(p) | |
}, s.setColumnWidth = function (e) { | |
return i(p, e) | |
}, o[f] = "medium", s.getFontSize = function () { | |
return n(f) | |
}, s.setFontSize = function (e) { | |
return i(f, e) | |
}, o[m] = "light", s.getTheme = function () { | |
return n(m) | |
}, s.setTheme = function (e) { | |
return i(m, String(e)) | |
}, o[T] = "twitter", s.getLinkShortener = function () { | |
return String(n(T)) | |
}, s.setLinkShortener = function (e) { | |
return i(T, String(e)) | |
}, o[v] = !1, s.getUseJmp = function () { | |
return Boolean(n(v)) | |
}, s.setUseJmp = function (e) { | |
return i(v, Boolean(e)) | |
}, s.getGlobalFilter = function () { | |
return n(y) | |
}, s.setGlobalFilter = function (e) { | |
return i(y, e) | |
}, o[w] = !0, s.getShowStartupNotifications = function () { | |
return Boolean(n(w)) | |
}, s.setShowStartupNotifications = function (e) { | |
return i(w, Boolean(e)) | |
}, o[A] = !1, s.getDisplaySensitiveMedia = function () { | |
return Boolean(n(A)) | |
}, s.setDisplaySensitiveMedia = function (e) { | |
return i(A, Boolean(e)) | |
}, o[g] = !1, s.getScheduledColAdded = function () { | |
return Boolean(n(g)) | |
}, s.setScheduledColAdded = function (e) { | |
return i(g, Boolean(e)) | |
}, o[D] = "0", s.getPreviousSplashVersion = function () { | |
return n(D) | |
}, s.setPreviousSplashVersion = function (e) { | |
return i(D, String(e)) | |
}, o[b] = {}, s.getNameCache = function () { | |
return n(b) | |
}, s.setNameCache = function (e) { | |
return i(b, e) | |
}, o[C] = [], s.getIdsForSeenMessages = function () { | |
return n(C) | |
}, s.setIdsForSeenMessages = function (e) { | |
return i(C, e) | |
}, o[S] = "condensed", s.getNavbarWidth = function () { | |
return n(S) | |
}, s.setNavbarWidth = function (e) { | |
return i(S, e) | |
}, o[E] = !1, s.getComposeStayOpen = function () { | |
return Boolean(n(E)) | |
}, s.setComposeStayOpen = function (e) { | |
return i(E, Boolean(e)) | |
}, s | |
}(TD.storage, TD.storage.notification), TD.storage.upgrade = function (e) { | |
var t = {}; | |
return t.CURRENT_VERSION = 4, t.getVersion = function (e) { | |
var i = e.getItem("__version__"); | |
return null === i ? t.guessVersion(e) : Number(i) | |
}, t.guessVersion = function (e) { | |
var i = e.getItem("settings"), | |
n = e.getItem("clients"), | |
r = e.getItem("columns"); | |
if (n && !i && (n = JSON.parse(n), !_.isEmpty(n))) { | |
var s = _.values(n)[0]; | |
if ("ΔQ" in s) return 2 | |
} | |
return !n && i && r ? 0 : t.CURRENT_VERSION | |
}, t.doUpgrade = function (e) { | |
var i = t.getVersion(e); | |
(!i || 4 > i) && t._upgradeAllToV4(e) | |
}, t._upgradeAllToV4 = function (t) { | |
console.log("Upgrading store to v4"), TD.storage.Store.flushDataFromStore(t, TD.sync.controller.PERSISTENT_STORAGE_ITEMS), e.store.setVersion(4) | |
}, t | |
}(TD.storage, TD.config, TD.sync.util, TD.core.defer), TD.sync.controller = function (e, t, i) { | |
var n = {}; | |
return n.PERSISTENT_STORAGE_ITEMS = ["tweetdeckAccount", "_session", "__hasAlreadyReloaded"], n.debugFlushAndReload = function () { | |
TD.storage.Store.flushWebstorage(), TD.util.isWrapperApp() && deck.tearDown(), window.location.reload() | |
}, n.flushSyncDataAndReload = function () { | |
TD.storage.Store.flushWebstorage(n.PERSISTENT_STORAGE_ITEMS), TD.util.isWrapperApp() && deck.tearDown(), window.location.reload() | |
}, n.debugInstallOldChromeData = function () { | |
TD.storage.Store.flushWebstorage(); | |
var e = /^[a-zA-Z0-9\+\/=]*$/, | |
t = TD.debug.spoof_data; | |
t.match(e) && (t = TD.core.base64.decode(t)); | |
var i = JSON.parse(t); | |
_.each(i, function (e, t) { | |
localStorage.setItem(t, e) | |
}) | |
}, n.debugQueryRemote = function () { | |
var t = n.fetchAllBackendData(); | |
return t.addCallback(e.pprint), t | |
}, n.fetchAllBackendData = function () { | |
var n = t.drequest("/accounts"), | |
r = TD.storage.clientController, | |
s = r.client && r.client.getName() || TD.config.sync_name, | |
o = "/clients/" + s + "/all", | |
a = t.drequest(o), | |
c = !1; | |
a.addErrback(function (i) { | |
if (404 === i.number) { | |
e.stateLog("Controller.fetchAllBackendData(): client didn't exist!"); | |
var n = r.createNewClient(); | |
return n.addCallback(function () { | |
return c = !0, t.drequest(o) | |
}), n | |
} | |
return i | |
}); | |
var u = new i.gatherResults([n, a]); | |
return u.addCallback(function (e) { | |
var t; | |
return t = e[1], t.accounts = e[0], t.isNewClient = c, t | |
}), u | |
}, n.updateFromBackendData = function (e) { | |
TD.storage.accountController.updateFromBackend(e.accounts, e.client), TD.storage.feedController.updateFromBackend(e.feeds), TD.storage.columnController.updateFromBackend(e.columns), TD.storage.clientController.updateFromBackend(e.client), TD.decider.updateFromBackend(e.decider), TD.controller.stats.setExperiments(e.ddg || {}) | |
}, n.ueberpull = function () { | |
e.trace("überpull"); | |
var t = i.succeed(); | |
return t.addCallback(function () { | |
return TD.storage.columnController.triggerPush(.05) | |
}), t.addErrback(e.errmark, "d.Eb:triggerPush"), t.addCallback(function () { | |
return n.fetchAllBackendData() | |
}), t.addErrback(e.errmark, "d.Eb:fetchAllBackendData"), t.addCallback(function (e) { | |
n.updateFromBackendData(e), $(document).trigger("dataMessages", { | |
messages: e.messages | |
}) | |
}), t.addErrback(e.errmark, "d.Eb:sync.controller.updateFromBackend"), t | |
}, n.initFromTdLogin = function (t) { | |
var r = i.succeed(t), | |
s = !1; | |
return r.addCallback(n.init), r.addErrback(function (t) { | |
return e.warn("WARNING! sync.controller.init() failed", t), t | |
}), r.addCallback(n.fetchAllBackendData), r.addErrback(function (t) { | |
return e.warn("WARNING! sync.controller get all sunc data failed", t), t | |
}), r.addCallback(function (e) { | |
n.updateFromBackendData(e), s = e.isNewClient | |
}), r.addErrback(function (t) { | |
return e.warn("WARNING! sync.controller update all failed", t), t | |
}), r.addCallback(function () { | |
return { | |
isNewClient: s | |
} | |
}), r | |
}, n.debuggery = function () { | |
jQuery.subscribe("/storage/object/change", function () { | |
e.warn("ERROR; untyped StoredObj change notification", _.toArray(arguments)), e._break() | |
}) | |
}, n.checkInvariants = function () { | |
var e = [TD.storage.feedController, TD.storage.columnController, TD.storage.accountController, TD.storage.clientController]; | |
_.each(e, function (e) { | |
var t = e.checkInvariants; | |
t && t.call(e) | |
}) | |
}, n.init = function (t) { | |
e.trace("sync controller init"), n.store = t, n.debuggery(), TD.storage.feedController.init(t), TD.storage.columnController.init(t), TD.storage.accountController.init(t), TD.storage.clientController.init(t); | |
var i = TD.config.sync_period; | |
_.isUndefined(i) && (i = 600), n.loop = setInterval(n.ueberpull, 1e3 * i) | |
}, n.reset = function () { | |
n.loop && (clearInterval(n.loop), delete n.loop), TD.storage.columnController.reset(), TD.storage.feedController.reset(), TD.storage.accountController.reset(), TD.storage.clientController.reset() | |
}, n | |
}(TD.sync.util, TD.sync.tdapi, TD.core.defer), TD.sync.ui = function (e, t) { | |
var i = {}; | |
return i.dispatch_ui_event = function (i) { | |
var n = { | |
flushreload: e.debugFlushAndReload, | |
dumptrace: TD.sync.trace.logDump, | |
cleartrace: TD.sync.trace.clear, | |
queryremote: e.debugQueryRemote, | |
ueberpull: e.ueberpull, | |
junk: function () { | |
console.log("junk fondled") | |
} | |
}[i]; | |
if (n) { | |
var r; | |
try { | |
r = t.maybeDeferred(n) | |
} catch (s) { | |
return void console.log(s) | |
} | |
r.addCallback(function (e, t) { | |
util.stateLog('result for event "' + t + '": ', e) | |
}, i), r.addErrback(function (e, t) { | |
util.warn("ERROR for event", t, ": ", e), console.log(e.stack) | |
}, i) | |
} else alert('no handler for event "' + i + '"') | |
}, i | |
}(TD.sync.controller, TD.core.defer), | |
function (e, t) { | |
"function" == typeof define && define.amd ? define([], t) : e.TD.ui.template = t() | |
}(this, function () { | |
function e(e) { | |
var t; | |
try { | |
t = $.ajax(e, { | |
async: !1, | |
isLocal: "web" !== TD.util.getAppEnv() | |
}) | |
} catch (i) { | |
return null | |
} | |
return 200 !== t.status ? (TD.sync.util.trace("template", "Failed loading mustache " + e), "") : t.responseText.trim() | |
} | |
function t(e) { | |
e = e.replace(d, "/"); | |
var t = h[e]; | |
return void 0 === t && (t = l.getHogan(e), t = a.compile(t, p), h[e] = t), t | |
} | |
function i(e, i) { | |
var n = this.partials[e]; | |
return i = i || {}, i[n.name] || (i[n.name] = t(n.name)), Hogan.Template.prototype.ep.call(this, e, i) | |
} | |
function n(e, t, i) { | |
for (var n = Hogan.parse.call(this, e, t, i), s = "", o = 0; o < n.length; o++) | |
if ("_v" === n[o].tag && 0 === n[o].n.indexOf("%TRANSLATION-HINT")) { | |
var a = n.splice(o, 1)[0]; | |
o--, s = a.n.substring(a.n.indexOf("mode=") + "mode=".length) | |
} | |
return r(n, s, t, i) | |
} | |
function r(e, t, i, n) { | |
for (var a = [], c = 0; c < e.length; c++) | |
if ("#" === e[c].tag && "_i" === e[c].n) { | |
var u = o(i.substring(e[c].i, e[c].end), t); | |
"raw" === u.tag ? a.push(u) : Array.prototype.push.apply(a, Hogan.parse(Hogan.scan(u, n.delimiters), i, n)) | |
} else "#" === e[c].tag || "^" === e[c].tag || "<" === e[c].tag || "$" === e[c].tag ? (e[c].nodes = r(e[c].nodes, t, i, n), a.push(e[c])) : a.push(e[c]); | |
return s(a) | |
} | |
function s(e) { | |
if (0 === e.length) return e; | |
for (var t = [e[0]], i = 1; i < e.length; i++) | |
if ("_t" !== t[t.length - 1].tag || "\n" !== e[i].tag && "_t" !== e[i].tag) t.push(e[i]); | |
else { | |
var n = t[t.length - 1], | |
r = e[i].text; | |
void 0 === r && (r = "\n"), n.text += "" + r | |
} | |
return t | |
} | |
function o(e, t) { | |
var i; | |
return i = "" !== t ? { | |
text: e, | |
mode: t | |
} : e, TD.i(i, null, !0) | |
} | |
var a, c, u, l = {}, | |
d = /\\/g, | |
h = {}, | |
p = { | |
sectionTags: [{ | |
o: "_i", | |
c: "i" | |
}] | |
}; | |
return u = function (e, t, n, r) { | |
this.ep = i, Hogan.Template.call(this, e, t, n, r) | |
}, u.prototype = Hogan.Template.prototype, c = function () {}, c.prototype = Hogan, a = new c, a.template = u, a.parse = n, l.mustachePath = "../mustaches/", l.getHogan = function (t) { | |
var i = TD.mustaches[t + ".mustache"]; | |
return void 0 === i && (i = e(l.mustachePath + t + ".mustache"), TD.mustaches[t + ".mustache"] = i), i | |
}, l.render = function (e, i, n) { | |
var r, s = t(e), | |
o = []; | |
for (var a in TD.globalRenderOptions) i && void 0 === i[a] && (i[a] = TD.globalRenderOptions[a], o.push(a)); | |
return r = s.render(i, n), o.forEach(function (e) { | |
delete i[e] | |
}), r.trim() | |
}, l.toHtml = function (e, t, i) { | |
var n = a.compile(e, p); | |
return n.render(t, i).trim() | |
}, l | |
}), TD.net.StreamRequest = function (e, t) { | |
var i = function () { | |
console.log((new Date).toUTCString(), ">", t.getUsername(), ">", arguments) | |
}; | |
this.receivedChars = 0, this.readChars = 0; | |
var n, r, s, o, a, c = 100, | |
u = this, | |
l = !1, | |
d = function (e, t) { | |
var i = new XMLHttpRequest; | |
return "withCredentials" in i ? i.open(e, t, !0) : i = null, i | |
}, | |
h = function (e) { | |
i("Signer HTTP status:", e.xhr.status), 200 === e.xhr.status && (s = e.data.headers.Authorization, p()) | |
}, | |
p = function () { | |
return (a = d("GET", e)) ? (a.setRequestHeader("Authorization", s), a.setRequestHeader("X-User-Agent", "TweetDeck Chrome " + TD.version), a.send(), void f()) : void T("CORS not supported", 0) | |
}, | |
f = function () { | |
m(), a.readyState !== XMLHttpRequest.DONE && setTimeout(f, c) | |
}, | |
m = function () { | |
switch (a.readyState) { | |
case XMLHttpRequest.LOADING: | |
var e, t = a.responseText.lastIndexOf("\r"); | |
if (l || (i("Stream HTTP status:", a.status), l = !0), u.receivedChars = a.responseText.length, t >= u.readChars) { | |
e = a.responseText.substring(u.readChars, t + 1), u.readChars += e.length; | |
try { | |
g(e) | |
} catch (n) { | |
console.log("Callback error:", n) | |
} | |
} | |
break; | |
case XMLHttpRequest.DONE: | |
T("Stream interrupted", a.status) | |
} | |
}, | |
g = function (e) { | |
n && n(e) | |
}, | |
T = function (e, t) { | |
r && r(e, t) | |
}; | |
this.onStreaming = { | |
connect: function (e) { | |
n = e | |
}, | |
disconnect: function (e) { | |
n === e && (n = null) | |
} | |
}, this.onFailure = { | |
connect: function (e) { | |
r = e | |
}, | |
disconnect: function (e) { | |
r === e && (r = null) | |
} | |
}, this.goStreaming = function () { | |
var i = TD.net.ajax.signRequest(t, e, "GET"); | |
i.addCallback(h), i.addErrback(function () { | |
T("Failed to sign request", 0) | |
}) | |
}, this.deleteLater = function () { | |
i("Closing stream connection"), o && (o.onreadystatechange = null), a && (a.onreadystatechange = null, a.abort()), g = null, T = null | |
} | |
}, TD.net.util = function () { | |
var e = {}, | |
t = encodeURIComponent, | |
i = /[!'()]/g, | |
n = /\*/g; | |
return encodeURIComponent = function (e) { | |
return t(e).replace(i, escape).replace(n, "%2A") | |
}, e.addURLParam = function (t, i, n) { | |
var r = {}; | |
return r[i] = n, e.addURLParameters(t, r) | |
}, e.addURLParameters = function (t, i) { | |
var n = e.buildQueryString(i), | |
r = t; | |
return n ? (r += -1 === t.indexOf("?") ? "?" : "&", r + n) : t | |
}, e.buildQueryString = function (e) { | |
var t, i = []; | |
if (e) | |
for (var n in e) t = n + "=" + encodeURIComponent(e[n]), i.push(t); | |
return i.join("&") | |
}, e.formDecode = function (e) { | |
var t, i, n, r = e.split("#", 1)[0].split("&"), | |
s = {}; | |
return r.forEach(function (e) { | |
if (n = e.indexOf("="), n > 0) { | |
t = e.slice(0, n), i = e.slice(n + 1); | |
try { | |
t = decodeURIComponent(t) | |
} catch (r) {} | |
try { | |
i = decodeURIComponent(i) | |
} catch (r) {} | |
s[t] = i | |
} | |
}), s | |
}, e.decodeURL = function (t) { | |
var i = t.split("?"); | |
return i.length > 1 ? e.formDecode(i[1]) : {} | |
}, e.formEncode = function (e) { | |
var t = []; | |
for (var i in e) t.push(i + "=" + encodeURIComponent(e[i])); | |
return t.join("&") | |
}, e.getQueryStringParams = function () { | |
var e = window.location.href.split("?"); | |
if (e.length >= 2) { | |
var t = e.slice(1).join("?"); | |
return this.formDecode(t) | |
} | |
return {} | |
}, e | |
}(), TD.controller.init = function (e, t, i, n, r, s, o, a, c) { | |
"use strict"; | |
var u = {}, | |
l = !1, | |
d = !1, | |
h = 2592e3, | |
p = 3; | |
u.purgedServices = [], u.restarts = 0, u.preload = function () { | |
TD.util.isTouchDevice() && window.navigator.standalone && ($("head meta[name=viewport]").remove(), $("head").prepend('<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">')), TD.util.isTouchDevice() && ($("html").addClass("touch-device"), TD.decider.get(TD.decider.TOUCHDECK_FONTSIZE) && $("html").addClass("with-touch-font-size"), TD.util.attachFastClick()), TD.controller.stats.init() | |
}, u.start = function (t, r) { | |
var s, c = TD.core.defer.succeed(), | |
f = TD.util.getAppEnv(); | |
return "chrome" === f && chrome.extension.getViews({ | |
type: "tab" | |
}).length > 1 ? void n.warn("Duplicate Chrome App tab. Aborting init.") : (TD.util.isWrapperApp() && (TD.util.isUnsupportedWebWrapperVersion() ? (deck.closeLoadingScreen && deck.closeLoadingScreen(), window.location.assign(TD.config.api_root + "/web/deprecated.html?appenv=" + f)) : TD.controller.scheduler.schedulePeriodicTask(h, function () { | |
window.location.reload(!0) | |
})), c.addCallback(function () { | |
var e, t; | |
return "windows" === TD.util.getOSName() && $("html").addClass("os-windows"), TD.util.isChrome() && $("html").addClass("is-chrome"), s = TD.controller.feather.loadFeathers(!1), t = TD.storage.Store.getPreviousStorage(), n.stateLog("Previous storage type:", t), t && TD.storage.store.init(t), e = TD.storage.store.getSessionData(), u.doLogin(e, r) | |
}), c.addCallback(function (e) { | |
return s.addBoth(function () { | |
return e | |
}), s | |
}), l = !1, c.addCallback(function (e) { | |
return l = e.createdAccount, e | |
}), c.addCallback(m), d = !1, c.addCallback(function (e) { | |
return d = e.isNewClient, e | |
}), c.addCallback(e.notification.flush), c.addCallback(g), c.addCallback(function () { | |
return a.gatherResults([e.feedController.triggerPush(.05), e.columnController.triggerPush(.05)]) | |
}), c.addCallback(function () { | |
e.store.checkVersion(e.upgrade.CURRENT_VERSION) | |
}), c.addCallback(g), c.addCallback(function () { | |
if (l) { | |
var t = e.clientController.client, | |
n = i.upgrade.CURRENT_VERSION; | |
return console.log("freshly created account; no upgrades, recording v", n), t.dictSet("settings", "version", n) | |
} | |
return i.upgrade.doUpgrades() | |
}), c.addCallback(function () { | |
return e.accountController.verifyNewTwoginAccount() | |
}), c.addCallback(function () { | |
TD.storage.Store.removeReloadedFlag() | |
}), c.addErrback(function (e) { | |
throw TD.storage.Store.shouldTryReload() && TD.sync.controller.flushSyncDataAndReload(), e | |
}), c.addCallback(TD.settings.init), c.addCallback(function () { | |
var e = new a.Deferred; | |
return $(document).one("dataMigrateData", function (t, i) { | |
e.callback(i) | |
}).trigger("uiNeedsMigrateData"), e.addCallback(function (e) { | |
var t = TD.sync.tdapi.doMigration(e); | |
return t.addCallback(function (t) { | |
return e && e.active && (w(), TD.components.NewFeaturesSplash.updateSeenVersion()), t | |
}), t | |
}), e | |
}), c.addCallback(D), c.addCallback(b), c.addErrback(function (e) { | |
if (n.warn(e, "controller.init.start failed, restarting", e.message), e.message.soleUserDenied) return void u.signOut(); | |
if (e.stackTrace) try { | |
console.log(e.stackTrace.join("\n")) | |
} catch (t) { | |
console.log("Unable to get stackTrace to report error:", t) | |
} | |
return o.controller.reset(), u.restarts++ <= p ? u.start(null, e.message) : (alert("Fatal error: " + e.message), void TD.storage.Store.wipeAll()) | |
}), c) | |
}, u.doLogin = function (e, t) { | |
return n.stateLog("init.doLogin(sessionData=", e, "errorMsg=", t, "authType=", e.authType, ")"), TD.util.isWrapperApp() && deck.closeLoadingScreen && deck.closeLoadingScreen(), !e.uid || e.migrate.active || t ? this.showLoginScreen(e, t) : this.continueLogin(e) | |
}, u.showLoginScreen = function (e, t) { | |
var i = new a.Deferred; | |
return t && n.warn("Login failed with message: " + t), $(document).one("uiLoginAuthComplete", function (e, t) { | |
i.callback(t) | |
}), $(document).trigger("uiLoginShowLoginForm", { | |
sessionData: e, | |
errorMsg: t | |
}), i | |
}, u.continueLogin = function (e) { | |
n.trace("init.continueLogin()"); | |
var t; | |
if (e.sessionExists) { | |
var i = function () { | |
return c.drequest("/user", null, null, !0) | |
}; | |
t = TD.sync.util.autoRetry(i, [5e3, 1e4], f), t.addCallback(function () { | |
var t = { | |
account: { | |
uid: e.uid | |
}, | |
staySignedIn: e.staySignedIn | |
}; | |
return "twitter" === TD.storage.store.getCurrentAuthType() && (t.data = { | |
screen_name: e.uid | |
}), t | |
}) | |
} else t = a.fail(!1); | |
return t.addErrback(function (t) { | |
var i; | |
return n.warn("TD login of existing account/session failed", t), t.req ? f(t) ? i = TD.i("Unable to connect. Please check your network.") : 401 == t.req.status && n.trace("Session expired. Re-displaying login screen.") : i = TD.i("Sorry, something went wrong. It's not you, it's us. Please try again later."), u.showLoginScreen(e, i) | |
}), t | |
}; | |
var f = function (e) { | |
if (!e.req) throw e; | |
return 0 === e.req.status || 12007 === e.req.status | |
}, | |
m = function (t) { | |
n.trace("init.initFromLogin()"); | |
var i = t.account; | |
return e.store.init(t.staySignedIn ? "local" : "session", i), c.saveSession(), c.onAuthFail(u.abort), i.uid && e.store.setTweetdeckAccount(i.uid), o.controller.initFromTdLogin(e.store) | |
}, | |
g = function () { | |
n.trace("init.purgeDeprecatedAccounts()"), v("buzz"), v("foursquare"), v("facebook"), T(), u.purgedServices.length > 0 && TD.controller.stats.purgedServices(u.purgedServices), y(function (e) { | |
var t = "twitter" === e.getService() && "sentdirect" === e.getType(); | |
return t && TD.controller.stats.purgedFeed({ | |
service: e.getService(), | |
type: e.getType(), | |
message: "Purged sentdirect feed (no longer supported)" | |
}), t | |
}), y(function (t) { | |
var i = _.isUndefined(e.accountController.get(t.getAccountKey())); | |
return i && TD.controller.stats.purgedFeed({ | |
service: t.getService(), | |
type: t.getType(), | |
accountKey: t.getAccountKey(), | |
message: "Purged feed due to bad account key" | |
}), i | |
}) | |
}, | |
T = function () { | |
e.columnController.getAll().forEach(function (e) { | |
if (1 === e.getFeedKeys().length) switch (e.getType()) { | |
case TD.util.columnUtils.storageColumnTypes.HOME: | |
case TD.util.columnUtils.storageColumnTypes.INBOX: | |
case TD.util.columnUtils.storageColumnTypes.ME: | |
e.setType(TD.util.columnUtils.storageColumnTypes.OTHER); | |
break; | |
default: | |
return | |
} | |
}) | |
}, | |
v = function (t) { | |
var i = e.accountController.getAccountsForService(t); | |
_.isEmpty(i) || (u.purgedServices.push(t), _.each(i, function (t) { | |
e.accountController.blacklistAccount(t) | |
})), y(function (e) { | |
return e.getService() === t | |
}) | |
}, | |
y = function (t) { | |
var i, n, r, s; | |
if (i = _.filter(e.feedController.getAll(), t), n = _.map(i, function (t) { | |
var i = t.getKey(); | |
return e.feedController.remove(i), i | |
}), r = _.filter(e.columnController.getAll(), function (e) { | |
var t = _.difference(e.getFeedKeys(), n); | |
return e.setFeedKeys(t), _.isEmpty(t) | |
}), s = _.map(r, function (e) { | |
return e.getKey() | |
}), !_.isEmpty(s)) { | |
var o = e.clientController.client; | |
o.setColumnOrder(_.difference(o.getColumnOrder(), s)), _.each(s, function (t) { | |
e.columnController.remove(t) | |
}) | |
} | |
}, | |
D = function () { | |
n.trace("UI.startflow.doLoginSoleUserCheck()"); | |
var e = TD.storage.store.getCurrentAuthType(), | |
t = TD.settings.getSoleUserState(); | |
if ("tweetdeck" === e || !t.initial) return TD.core.defer.succeed(); | |
var i, r = new a.Deferred, | |
s = $(document), | |
o = TD.storage.store.getTwitterLoginAccount(); | |
return o && (i = o.getUsername()), s.on("uiLoginConfirmSoleUser", function () { | |
r.callback() | |
}).on("uiLoginDenySoleUser", function () { | |
o && TD.storage.store.setJSONCritical("previousMultiUserAccount", { | |
timestamp: Date.now(), | |
accountID: o.getUserID() | |
}), r.errback({ | |
soleUserDenied: !0 | |
}) | |
}).trigger("uiLoginShowSoleUserDialog", { | |
username: i | |
}), r.addCallback(w), r.addCallback(function () { | |
s.off("uiLoginConfirmSoleUser uiLoginDenySoleUser") | |
}), r | |
}, | |
w = function () { | |
var e = TD.settings.getSoleUserState(); | |
e.initial && (e.shared = !0, TD.settings.setSoleUserState(e)) | |
}, | |
b = function () { | |
return TD.util.fnPerformanceWrapper(C, null, i.stats.performance.keys.INIT)() | |
}, | |
C = function () { | |
n.trace("init.initControllerAndUI()"), $(document).trigger("uiNeedsSettings"), i.clients.init(), i.feedManager.init(), i.stats.setUid(TD.storage.store.getTweetdeckAccount()), TD.cache.names.init(), TD.decider.get(TD.decider.INSTAGRAM_DISABLED) && delete TD.services.TwitterMedia.SERVICES.instagram, TD.util.fnPerformanceWrapper(t.main.init, t.main, i.stats.performance.keys.MAIN)(), TD.util.fnPerformanceWrapper(i.columnManager.init, i.columnManager, i.stats.performance.keys.COLUMN_MANAGER)(), TD.util.fnPerformanceWrapper(i.scheduler.init, i.scheduler, i.stats.performance.keys.COLUMN_SCHEDULER)(), TD.util.fnPerformanceWrapper(i.notifications.init, i.notifications, i.stats.performance.keys.NOTIFICATIONS)(), TD.util.fnPerformanceWrapper(i.filterManager.init, i.filterManager.init, i.stats.performance.keys.FILTER_MANAGER)(), TD.ready = !0, n.trace("init: TD.ready"), $(document).trigger("TD.ready"), d || setTimeout(function () { | |
e.accountController.verifyStoredAccounts(), e.clientController.client.cleanAccountLists() | |
}, 2e4), -1 !== TD.controller.init.purgedServices.indexOf("facebook") && $(document).trigger("dataFacebookAccountRemoved", {}), e.accountController.isEmpty() ? ($(document).trigger("uiShowAccountSettings"), TD.components.NewFeaturesSplash.updateSeenVersion()) : TD.components.NewFeaturesSplash.shouldShow() && new TD.components.NewFeaturesSplash | |
}; | |
return u.signOut = function (e) { | |
TD.storage.Store.flushWebstorage(); | |
var t = c.logout(e); | |
return TD.util.isWrapperApp() && t.addBoth(function () { | |
deck.tearDown() | |
}), t.addBoth(function () { | |
window.location.reload() | |
}), t | |
}, u.abort = function () { | |
window.location.reload() | |
}, u | |
}(TD.storage, TD.ui, TD.controller, TD.sync.util, TD.util, TD.net.util, TD.sync, TD.core.defer, TD.sync.tdapi), TD.controller.upgrade = function (e, t, i, n) { | |
var r = {}; | |
return r.CURRENT_VERSION = 2, r.doUpgrades = function () { | |
var t = null, | |
s = e.clientController.client.get("settings"); | |
t = _.isUndefined(s) || _.isUndefined(s.version) ? 0 : Number(s.version); | |
for (var o = function (t, i) { | |
return e.clientController.client.dictSet("settings", "version", i) | |
}, a = n.succeed(), c = 1; c <= r.CURRENT_VERSION; c++) | |
if (c > t) { | |
var u = "version_" + c.toString(); | |
r.hasOwnProperty(u) && (console.log("performing upgrade to v", c, u), a.addCallback(r[u]), a.addCallback(o, c)) | |
} | |
return a.addErrback(function (e) { | |
throw i.warn("WARNING: controller.upgrade failed!!!"), console.log(e), e | |
}), a | |
}, r.version_1 = function () { | |
e.columnController.getAll().forEach(function (e) { | |
var t, i = TD.storage.feedController.get(e.getFeedKeys()[0]).getType(); | |
i === TD.util.columnUtils.feedTypes.MENTIONS && (t = new TD.vo.SearchFilter(e.getFilters()), t.action.fromJSONObject({ | |
showMentions: !0, | |
showRetweets: !1, | |
showFavorites: !1, | |
showFollowers: !1, | |
showLists: !1 | |
}), e.setFilters(t.toJSONObject())) | |
}) | |
}, r.version_2 = function () { | |
var t = TD.storage.clientController.client.get("settings").show_inline_media; | |
t === !1 && e.columnController.getAll().forEach(function (e) { | |
e.setMediaPreviewSize(TD.vo.Column.MEDIA_PREVIEW_OFF) | |
}) | |
}, r | |
}(TD.storage, TD.config, TD.sync.util, TD.core.defer), TD.controller.columnManager = function (e, t) { | |
var i = {}, | |
n = {}, | |
r = []; | |
i.TIMELINE = "timeline", i.MENTIONS = "mentions", i.FOLLOWERS = "followers", i.SEARCH = "search", i.LISTS = "lists", i.CUSTOMTIMELINES = "customtimelines", i.MESSAGES = "messages", i.TRENDS = "trends", i.TWEETS = "tweets", i.FAVORITES = "favorites", i.HOME = "home", i.ME = "me", i.INBOX = "privateMe", i.SCHEDULED = "scheduled", i.NETWORKACTIVITY = "networkactivity", i.INTERACTIONS = "interactions", i.columnTypeToIconClass = {}, TD.util.extendObjectWith(i.columnTypeToIconClass, [ | |
[i.TIMELINE, TD.util.columnUtils.columnIconClasses.HOME], | |
[i.INTERACTIONS, TD.util.columnUtils.columnIconClasses.INTERACTIONS], | |
[i.MENTIONS, TD.util.columnUtils.columnIconClasses.MENTIONS], | |
[i.FOLLOWERS, TD.util.columnUtils.columnIconClasses.FOLLOWERS], | |
[i.SEARCH, TD.util.columnUtils.columnIconClasses.SEARCH], | |
[i.LISTS, TD.util.columnUtils.columnIconClasses.LIST], | |
[i.CUSTOMTIMELINES, TD.util.columnUtils.columnIconClasses.CUSTOMTIMELINE], | |
[i.MESSAGES, TD.util.columnUtils.columnIconClasses.MESSAGES], | |
[i.TWEETS, TD.util.columnUtils.columnIconClasses.USER], | |
[i.FAVORITES, TD.util.columnUtils.columnIconClasses.FAVORITES], | |
[i.NETWORKACTIVITY, TD.util.columnUtils.columnIconClasses.ACTIVITY], | |
[i.HOME, TD.util.columnUtils.columnIconClasses.HOME], | |
[i.ME, TD.util.columnUtils.columnIconClasses.MENTIONS], | |
[i.INBOX, TD.util.columnUtils.columnIconClasses.MESSAGES], | |
[i.SCHEDULED, TD.util.columnUtils.columnIconClasses.SCHEDULED], | |
[i.TRENDS, TD.util.columnUtils.columnIconClasses.TRENDS] | |
]), i.SELF_ACCOUNTS_ONLY = {}, i.SELF_ACCOUNTS_ONLY[i.MESSAGES] = !0, i.SELF_ACCOUNTS_ONLY[i.NETWORKACTIVITY] = !0, i.SELF_ACCOUNTS_ONLY[i.INTERACTIONS] = !0, i.SELF_ACCOUNTS_ONLY[i.FOLLOWERS] = !0, i.TWITTER_GENERIC = {}, i.TWITTER_GENERIC[i.TIMELINE] = !0, i.TWITTER_GENERIC[i.MENTIONS] = !0, i.TWITTER_GENERIC[i.FOLLOWERS] = !0, i.TWITTER_GENERIC[i.MESSAGES] = !0, i.TWITTER_GENERIC[i.TWEETS] = !0, i.TWITTER_GENERIC[i.FAVORITES] = !0, i.TWITTER_GENERIC[i.NETWORKACTIVITY] = !0, i.TWITTER_GENERIC[i.INTERACTIONS] = !0, i.SELF_FEED_TYPE = {}, i.SELF_FEED_TYPE[i.TIMELINE] = "home", i.SELF_FEED_TYPE[i.MESSAGES] = "direct", i.SELF_FEED_TYPE[i.TWEETS] = "usertweets", i.SELF_FEED_TYPE[i.FOLLOWERS] = "interactions", i.NON_SELF_FEED_TYPE = {}, i.NON_SELF_FEED_TYPE[i.TIMELINE] = "usertimeline", i.NON_SELF_FEED_TYPE[i.TWEETS] = "usertweets", i.NON_SELF_FEED_TYPE[i.MENTIONS] = "search", i.MENU_TITLE = {}, i.MENU_TITLE[i.TIMELINE] = TD.i("Home"), i.MENU_TITLE[i.MENTIONS] = TD.i("Mentions"), i.MENU_TITLE[i.SEARCH] = TD.i("Search"), i.MENU_TITLE[i.FOLLOWERS] = TD.i("Followers"), i.MENU_TITLE[i.LISTS] = TD.i("Lists"), i.MENU_TITLE[i.CUSTOMTIMELINES] = TD.i("Collections"), i.MENU_TITLE[i.MESSAGES] = TD.i("Messages"), i.MENU_TITLE[i.TRENDS] = TD.i("Trending"), i.MENU_TITLE[i.TWEETS] = TD.i("User"), i.MENU_TITLE[i.FAVORITES] = TD.i("Favorites"), i.MENU_TITLE[i.ME] = TD.i("Mentions"), i.MENU_TITLE[i.INBOX] = TD.i("Messages"), i.MENU_TITLE[i.SCHEDULED] = TD.i("Scheduled"), i.MENU_TITLE[i.NETWORKACTIVITY] = TD.i("Activity"), i.MENU_TITLE[i.INTERACTIONS] = TD.i("Notifications"), i.MENU_ATTRIBUTION = {}, i.MENU_ATTRIBUTION[i.ME] = TD.i("(all accounts)"), i.MENU_ATTRIBUTION[i.INBOX] = TD.i("(all accounts)"), i.DISPLAY_ORDER = [{ | |
type: i.TIMELINE, | |
service: "twitter" | |
}, { | |
type: i.SEARCH, | |
service: "twitter" | |
}, { | |
type: i.INTERACTIONS, | |
service: "twitter" | |
}, { | |
type: i.FOLLOWERS, | |
service: "twitter" | |
}, { | |
type: i.MENTIONS, | |
service: "twitter" | |
}, { | |
type: i.MESSAGES, | |
service: "twitter" | |
}, { | |
type: i.ME | |
}, { | |
type: i.INBOX | |
}, { | |
type: i.NETWORKACTIVITY, | |
service: "twitter" | |
}, { | |
type: i.TWEETS, | |
service: "twitter" | |
}, { | |
type: i.FAVORITES, | |
service: "twitter" | |
}, { | |
type: i.TRENDS, | |
service: "twitter" | |
}, { | |
type: i.LISTS, | |
service: "twitter" | |
}, { | |
type: i.CUSTOMTIMELINES, | |
service: "twitter", | |
"class": "feature-customtimelines" | |
}, { | |
type: i.SCHEDULED | |
}], i.DISPLAY_ORDER_SINGLETONS = [{ | |
type: i.ME | |
}, { | |
type: i.INBOX | |
}, { | |
type: i.SCHEDULED | |
}], i.DISPLAY_ORDER_PROFILE = [{ | |
type: i.TWEETS, | |
service: "twitter", | |
profile: !0 | |
}, { | |
type: i.MENTIONS, | |
service: "twitter", | |
profile: !0 | |
}, { | |
type: i.LISTS, | |
service: "twitter", | |
profile: !0 | |
}, { | |
type: i.CUSTOMTIMELINES, | |
service: "twitter", | |
profile: !0, | |
"class": "feature-customtimelines" | |
}, { | |
type: i.TIMELINE, | |
service: "twitter", | |
profile: !0 | |
}, { | |
type: i.FAVORITES, | |
service: "twitter", | |
profile: !0 | |
}]; | |
var s = i.DISPLAY_ORDER.concat(i.DISPLAY_ORDER_SINGLETONS).concat(i.DISPLAY_ORDER_PROFILE); | |
_.each(s, function (e) { | |
e.title = e.title || i.MENU_TITLE[e.type], e.attribution = e.attribution || i.MENU_ATTRIBUTION[e.type], e.columnIconClass = e.columnIconClass || i.columnTypeToIconClass[e.type] | |
}), i.HELP_TEXT = {}, i.HELP_TEXT[i.TIMELINE] = TD.i("Add a Timeline column for your own accounts, or search for a user and add theirs"), i.HELP_TEXT[i.MENTIONS] = TD.i("Add a Mentions column for your own accounts, or search for a user and add theirs"), i.HELP_TEXT[i.SEARCH] = TD.i("Add a column for a saved or recent Search, or enter a new search in the box"), i.HELP_TEXT[i.LISTS] = TD.i("Create a new list, or select an existing list to edit or add a column"), i.HELP_TEXT[i.CUSTOMTIMELINES] = TD.i("Create a new collection, or select an existing timeline"), i.HELP_TEXT[i.MESSAGES] = TD.i("Add a Direct Messages column for your accounts"), i.HELP_TEXT[i.TRENDS] = TD.i("Add a column to monitor Tweets for any Trend"), i.HELP_TEXT[i.TWEETS] = TD.i("Add a column for Tweets sent from your own accounts, or search for a user and add theirs"), i.HELP_TEXT[i.FAVORITES] = TD.i("Add a Favorites column for your own accounts, or search for a user and add theirs"), i.HELP_TEXT[i.INTERACTIONS] = TD.i("Add a column to monitor your mentions, retweets, favourites, follows and list additions in real time"), i.HELP_TEXT[i.NETWORKACTIVITY] = TD.i("Add a column to view favourites, follows and list additions by your friends in real time"), i.STREAMING_FULL = "streaming_full", i.STREAMING_NONE = "streaming_none", i.STREAMING_PARTIAL = "streaming_partial", i.init = function () { | |
o(), i.checkColumns(), $.subscribe("/storage/client/column_order_changed", o), $.subscribe("/storage/client/change", o), $.subscribe("/storage/column/feeds_changed", function (e, t, n) { | |
var r = i.get(n.getKey()); | |
r && r.loadFeeds() | |
}), $.subscribe("/storage/column/change", function (e) { | |
var n = i.get(e.getKey()); | |
if (n) { | |
var r = n.model.getFeedKeys(), | |
s = e.getFeedKeys(); | |
if (_.isEqual(r, s) || n.loadFeeds(), e.managed && e.hasApiid()) { | |
var n = i.getByApiid(e.getApiid()); | |
TD.ui.columns.refreshTitle(n) | |
} | |
n.loadFilters() | |
} else t.stateLog("loading new new column", e), o() | |
}), $.subscribe("/cache/names/change", function () { | |
_.each(i.getAll(), function (e) { | |
TD.ui.columns.refreshTitle(e) | |
}) | |
}), $.subscribe("/storage/account/new", function () { | |
1 === TD.storage.accountController.getAll().length && i.checkColumns() | |
}), $(document).on("uiNeedsScheduledColumnVisible", this.handleMakeOrRefreshScheduledColumn) | |
}, i.checkColumns = function () { | |
var t = TD.storage.accountController.getPreferredAccount("twitter"); | |
0 === e.clientController.client.getColumnOrder().length && t && i.makeDefaultColumns(t) | |
}, i.get = function (e) { | |
return n[e] | |
}, i.getByApiid = function (e) { | |
return _.find(n, function (t) { | |
return t.model.hasApiid() && t.model.getApiid() === e ? t : null | |
}) | |
}, i.getAll = function () { | |
return _.clone(n) | |
}, i.getAllOrdered = function () { | |
for (var e = this.getAll(), t = [], i = 0; i < r.length; i++) t.push(e[r[i]]); | |
return t | |
}, i.add = function (e) { | |
n[e.model.getKey()] = e | |
}, i.deleteColumn = function (t) { | |
var i = n[t]; | |
i && !i.temporary && TD.controller.stats.removeColumn(i.getColumnType()); | |
e.clientController.client.removeColumn(t) | |
}, i.removeFromAppLayer = function (t) { | |
var i = n[t]; | |
i && i.removeSubscriptions(), delete n[t], e.columnController.remove(t), TD.controller.feedScheduler.removeColumn(t), TD.ui.columns.removeColumn(t) | |
}, i.move = function (e, t) { | |
var n, s, a = r.indexOf(e), | |
c = r.concat(); | |
if ("right" === t) s = Math.min(a + 1, r.length - 1); | |
else { | |
if ("left" !== t) return; | |
s = Math.max(a - 1, 0) | |
} | |
n = r[s], c[s] = c[a], c[a] = n, TD.storage.clientController.client.setColumnOrder(c), o(), i.showColumn(e) | |
}; | |
var o = function () { | |
var t = e.clientController.client.getColumnOrder(), | |
i = !_.isEqual(r, t); | |
i && a(t), $(document).trigger("dataColumnsLoaded") | |
}, | |
a = function (n) { | |
var s = _.difference(r, n), | |
o = _.difference(n, r), | |
a = []; | |
_.each(s, function (e) { | |
i.removeFromAppLayer(e), TD.ui.columns.removeColumn(e) | |
}), _.each(o, function (r) { | |
var s, o = i.get(r); | |
if (!o) { | |
if (s = e.columnController.get(r), !s) return void t.stateLog("WARNING: column not found for", r, "all columns:", e.columnController.getAll(), "in column_order", n); | |
o = new TD.vo.Column(s), i.add(o) | |
} | |
a.push(o) | |
}), TD.ui.columns.addColumnsToView(a), TD.ui.columns.reorderColumns(n), r = n, $(document).trigger("dataColumnOrder", { | |
columns: i.getAllOrdered() | |
}), _.each(o, function (e) { | |
var t = i.get(e); | |
TD.controller.feedScheduler.addColumn(t, !0) | |
}) | |
}; | |
return i.addColumnToUI = function (t) { | |
var n, r = t.model.getKey(); | |
return t.reset(), i.add(t), e.feedController.manageFeeds(t.getFeeds()), e.columnController.manage(t.model), n = e.clientController.client.appendColumn(r), o(), _.defer(i.showColumn, r), TD.controller.stats.addColumn(t.getColumnType()), n | |
}, i.makeColumnFor = function (t, n, r, s, o) { | |
var a, c, u = {}, | |
l = e.accountController.getAccountsForService("twitter"); | |
if ("tweetdeck" === n) switch (t) { | |
case "me": | |
c = e.columnController.getMeFeeds(l), a = i.makeColumn("me", c); | |
break; | |
case "privateMe": | |
c = e.columnController.getInboxFeeds(l), a = i.makeColumn("privateMe", c); | |
break; | |
case "scheduled": | |
c = e.columnController.getScheduledFeeds(), a = i.makeColumn("scheduled", c) | |
} else { | |
switch (t) { | |
case "usertimeline": | |
case "favorites": | |
case "usertweets": | |
s && (u.id = parseInt(s, 10)); | |
break; | |
case "search": | |
var o = new TD.vo.SearchFilter; | |
u.searchFilterData = o.toJSONObject(), u.baseQuery = s; | |
break; | |
case "list": | |
var d = s.split("/"); | |
TD.sync.util.assert(2 === d.length, "List meta should contain both ownerId and listId", d), u.ownerId = d[0], u.listId = d[1]; | |
break; | |
case "customtimeline": | |
var d = s.split("/"); | |
TD.sync.util.assert(2 === d.length, "Collection meta should contain both ownerId and id", d), u.ownerId = d[0], u.id = d[1] | |
} | |
a || (a = i.makeOtherColumnAndFeeds(t, n, r, u, o)) | |
} | |
return a | |
}, i.makeDefaultColumns = function (e) { | |
var t = []; | |
"twitter" === e.getType() && (t = ["home", "interactions", "direct", "networkactivity"]), _.each(t, function (t) { | |
var n = i.makeColumnFor(t, e.getType(), e.getKey()); | |
i.addColumnToUI(n) | |
}) | |
}, i.makeColumn = function (t, i, n) { | |
var r = { | |
type: t, | |
feedkeys: [], | |
settings: {} | |
}; | |
n && (r.filters = n); | |
var s = new TD.vo.Column(new e.Column(r), i); | |
return s | |
}, i.makeOtherColumnAndFeeds = function (t, n, r, s, o) { | |
var a = e.feedController, | |
c = []; | |
return c.push(a.getOrCreateFeed(t, n, r, s)), i.makeColumn("other", c, o) | |
}, i.handleMakeOrRefreshScheduledColumn = function (e, t) { | |
t = t || {}; | |
var n = TD.storage.columnController.getColumnsByType("scheduled"); | |
if (!n.length && !TD.settings.getScheduledColAdded() && t.allowAdd) { | |
var r = i.makeColumnFor("scheduled", "tweetdeck"); | |
return i.addColumnToUI(r), void TD.settings.setScheduledColAdded(!0) | |
} | |
n.forEach(function (e) { | |
try { | |
TD.controller.feedScheduler.refreshColumn(e.getKey()) | |
} catch (t) { | |
console.error("Refreshing scheduled column failed") | |
} | |
}) | |
}, i.showColumn = function (e) { | |
$(document).trigger("uiColumnFocus", { | |
columnKey: e | |
}) | |
}, i.isStreaming = function (e) { | |
var t = i.getStreamingState(e); | |
return t !== i.STREAMING_NONE | |
}, i.getStreamingState = function (e) { | |
var t, n = i.STREAMING_NONE, | |
r = i.get(e), | |
s = 0; | |
return r && (t = r.model.getFeedKeys(), _.each(t, function (e) { | |
TD.controller.feedManager.isStreaming(e) && s++ | |
}), n = 0 === s ? i.STREAMING_NONE : s === t.length ? i.STREAMING_FULL : i.STREAMING_PARTIAL), n | |
}, i.getColumnsByAccountKey = function (e) { | |
return _.values(n).filter(function (t) { | |
return t.getFeeds().some(function (t) { | |
return t.getAccountKey() === e | |
}) | |
}) | |
}, i.findChirpByAccountKey = function (e, t) { | |
for (var n, r = i.getColumnsByAccountKey(t), s = 0; s < r.length && !(n = r[s].findChirp(e)); s += 1); | |
return n | |
}, i | |
}(TD.storage, TD.sync.util, TD.core.defer), TD.controller.auth = function () { | |
var e = {}, | |
t = { | |
twitter: "TwitterAuth", | |
bitly: "BitlyValidate" | |
}; | |
return e.create = function (e, i) { | |
return TD.sync.util.assert(t[e], 'bad name for auth "' + e + '"'), new TD.controller.auth[t[e]](i) | |
}, e | |
}(), TD.controller.auth.AuthorisationProcessor = function () { | |
this.start = function (e, t, i) { | |
TD.util.isChromeApp() ? this.start_chrome(e, t, i) : TD.util.isWrapperApp() ? this.start_wrapper(e, t, i) : this.start_web(e, t, i) | |
}, this.start_wrapper = function (e, t, i) { | |
var n = deck.authenticateOn(this.getAuthURL(e, i)), | |
r = this, | |
s = function (i) { | |
var s = r.getTokenFromURL(e.getType(), i); | |
s && (s.access_token ? r.updateAccount(s.access_token, t) : r.updateAccount(s.oauth_token, s.oauth_token_secret, t), n.hide(), n.deleteLater()) | |
}; | |
n.loadedUrl.connect(s), n.show() | |
}, this.start_web = function (e, t, i) { | |
var n = window.open(this.getAuthURL(e, i), "mywindow", "width=800,height=450"), | |
r = this, | |
s = function () { | |
var i, o; | |
try { | |
n && n.location && n.location.href && (i = n.location.href) | |
} catch (a) { | |
console.log(a) | |
} | |
return i && (o = r.getTokenFromURL(e.getType(), i)) ? (o.access_token ? r.updateAccount(o.access_token, t) : r.updateAccount(o.oauth_token, o.oauth_token_secret, t), void n.close()) : void setTimeout(s, 100) | |
}; | |
setTimeout(s, 500) | |
}, this.getAuthURL = function (e, t) { | |
var i = "oauth", | |
n = e.getType(), | |
r = {}; | |
if ("twitter" === n) { | |
var s = Boolean(t), | |
o = e.getUsername(); | |
s && (r.force_login = s), o && (r.screen_name = o) | |
} | |
return TD.net.util.addURLParameters(TD.config.api_root + "/" + i + "/authorize/" + n, r) | |
}, this.getTokenFromURL = function (e, t) { | |
var i, n; | |
return (_.contains(t, "/oauth/success/" + e) || _.contains(t, "/oauth2/success/" + e)) && (n = t.split("?")[1], i = TD.net.util.formDecode(n)), i | |
}, this.start_chrome = function (e, t, i) { | |
var n, r, s = this; | |
chrome.tabs.getSelected(null, function (e) { | |
n = e.id | |
}), r = { | |
url: this.getAuthURL(e, i) | |
}, chrome.tabs.create(r, function (i) { | |
var r = i.id; | |
chrome.tabs.onUpdated.addListener(function (i, o, a) { | |
var c; | |
i === r && a.url && "complete" == a.status && (c = s.getTokenFromURL(e.getType(), a.url), c && (c.access_token ? s.updateAccount(c.access_token, t) : s.updateAccount(c.oauth_token, c.oauth_token_secret, t), chrome.tabs.update(n, { | |
selected: !0 | |
}), chrome.tabs.remove(i))) | |
}) | |
}) | |
} | |
}, TD.controller.auth.TwitterAuth = function (e) { | |
var t = this; | |
t.account = e, this.verifyAccount = function (e, i) { | |
var n = t.account, | |
r = TD.config.twitter_api_base + "/" + TD.config.twitter_api_version, | |
s = r + "/account/verify_credentials.json", | |
o = TD.net.ajax.request(s, { | |
account: n, | |
isSigned: !0 | |
}); | |
o.addCallback(function (t) { | |
var r = t.data, | |
s = n.getUserID(); | |
s && s != r.id ? (console.log("Attempting to update wrong account:", n, "Using data:", r), TD.sync.util.printStacktrace(), i()) : (n.setUsername(r.screen_name), n.setName(r.name), n.setProfileImageURL(r.profile_image_url_https), n.setUserID(r.id_str), n.setIsPrivate(r["protected"]), n.setUpdated((new Date).getTime()), n.computeKey(), e(n)) | |
}), i && o.addErrback(i) | |
}, this.updateAccount = function (e, i, n) { | |
var r = t.account; | |
r.setUsername(""), r.setUserID(""), r.setType("twitter"), r.setOAuthToken(e), r.setTokenSecret(i), this.verifyAccount(n) | |
} | |
}, TD.controller.auth.BitlyValidate = function (e) { | |
var t = this; | |
t.account = e, this.updateAccount = function (e, t) { | |
this.verifyAccount(t) | |
}, this.verifyAccount = function (e, i) { | |
var n = t.account, | |
r = "https://api-ssl.bitly.com/v3/validate", | |
s = { | |
x_login: n.get("userId"), | |
x_apiKey: n.get("oauth_token"), | |
apiKey: "R_b8032856b71a14fabfe64f6845689ddf", | |
login: "tweetdeckapi", | |
format: "json" | |
}, | |
o = TD.net.ajax.jsonp(r, s); | |
o.addCallback(function (t) { | |
var r = t.data; | |
return r.data && 1 == r.data.valid ? (n.setUpdated((new Date).getTime()), n.computeKey(), void e(n)) : void i() | |
}), o.addErrback(i) | |
} | |
}, TD.controller.auth.TwitterAuth.prototype = new TD.controller.auth.AuthorisationProcessor, TD.services.ChirpBase = function (e) { | |
this.account = e | |
}, TD.services.ChirpBase.kMEDIA_CLASS = "s-media", TD.services.ChirpBase.RETWEET_CLASS = "is-retweet", TD.services.ChirpBase.FAVORITE_CLASS = "is-favorite", TD.services.ChirpBase.UNREAD_CLASS = "is-unread", TD.services.ChirpBase.TWEET = "tweet", TD.services.ChirpBase.MESSAGE = "message", TD.services.ChirpBase.MESSAGE_THREAD = "message_thread", TD.services.ChirpBase.SCHEDULED_STATUS = "scheduled_status", TD.services.ChirpBase.SCHEDULED_GROUP = "scheduled_group", TD.services.ChirpBase.SCHEDULED_TWEET = "scheduled_tweet", TD.services.ChirpBase.SCHEDULED_TWEET_GROUP = "scheduled_tweet_group", TD.services.ChirpBase.prototype.id = "", TD.services.ChirpBase.prototype.chirpType = "unknown", TD.services.ChirpBase.prototype.text = "", TD.services.ChirpBase.prototype.created = null, TD.services.ChirpBase.prototype.htmlText = "", TD.services.ChirpBase.prototype.creatorAccount = null, TD.services.ChirpBase.prototype.embeds = null, TD.services.ChirpBase.prototype.cursor = null, TD.services.ChirpBase.prototype.sortIndex = null, TD.services.ChirpBase.prototype._hasImage = null, TD.services.ChirpBase.prototype._hasVideo = null, TD.services.ChirpBase.prototype._hasLink = null, TD.services.ChirpBase.prototype.fromJSONObject = function () { | |
throw "fromJSONObject Not Implemented" | |
}, TD.services.ChirpBase.prototype.isOwnChirp = function () { | |
throw "isOwnChirp Not Implemented" | |
}, TD.services.ChirpBase.prototype.destroy = function () { | |
throw "destroy Not Implemented" | |
}, TD.services.ChirpBase.prototype.render = function () { | |
throw "render Not Implemented" | |
}, TD.services.ChirpBase.prototype.renderNotification = function () { | |
return null | |
}, TD.services.ChirpBase.prototype.getGrowlData = function () { | |
return null | |
}, TD.services.ChirpBase.prototype.email = function () { | |
throw "email Not Implemented" | |
}, TD.services.ChirpBase.prototype.postComment = function () { | |
throw "postComment Not Implemented" | |
}, TD.services.ChirpBase.prototype.getChirpURL = function () { | |
throw "getChirpURL Not Implemented" | |
}, TD.services.ChirpBase.prototype.toHTML = function (e) { | |
return TD.util.transform(e) | |
}, TD.services.ChirpBase.prototype.isTranslatable = function () { | |
return !1 | |
}, TD.services.ChirpBase.prototype.translate = function () { | |
throw "translate Not Implemented" | |
}, TD.services.ChirpBase.prototype.getChirpType = function () { | |
return this.chirpType | |
}, TD.services.ChirpBase.prototype.getScribeItemData = function () { | |
throw "getScribeItemData not implemented" | |
}, TD.services.ChirpBase.prototype._changed = function () { | |
TD.controller.notifications.reRender(this) | |
}, TD.services.ChirpBase.prototype.getDOMChirps = function () { | |
var e = "[data-key$='" + this.id + "'][data-account-key='" + this.account.getKey() + "']"; | |
return $(e) | |
}, TD.services.ChirpBase.prototype.update = function () { | |
return !1 | |
}, TD.services.ChirpBase.prototype.passFilters = function (e) { | |
return TD.controller.filterManager.pass(this, e) | |
}, TD.services.ChirpBase.prototype._generateHTMLText = function () { | |
this.htmlText = this.toHTML(this.text) | |
}, TD.services.ChirpBase.prototype.createdPretty = function () { | |
return TD.util.prettyDate(this.created) | |
}, TD.services.ChirpBase.prototype.createdPrettyFull = function () { | |
return TD.util.prettyTimeString(this.created) | |
}, TD.services.ChirpBase.prototype.reorder = function () { | |
TD.controller.feedManager.reorderChirp(this.id) | |
}, TD.services.ChirpBase.prototype.getSinceId = function () { | |
return this.id | |
}, TD.services.ChirpBase.prototype.getUnreadChirps = function (e) { | |
return !this.isOwnChirp() && this.created.getTime() > e ? [this] : [] | |
}, TD.services.ChirpBase.prototype.getFilterableText = function () { | |
return this.text | |
}, TD.services.ChirpBase.prototype.getSenders = function () { | |
return null | |
}, TD.services.ChirpBase.prototype.getSource = function () { | |
return null | |
}, TD.services.ChirpBase.prototype.isRetweetedStatus = function () { | |
return null | |
}, TD.services.ChirpBase.prototype.getRelatedTweet = function () { | |
return null | |
}, TD.services.ChirpBase.prototype.getMedia = function () { | |
return this._media ? this._media : [] | |
}, TD.services.ChirpBase.prototype.getCardsForGallery = function () { | |
return [] | |
}, TD.services.ChirpBase.prototype.hasMedia = function () { | |
return this.getMedia().length > 0 | |
}, TD.services.ChirpBase.prototype.hasImage = function () { | |
return null === this._hasImage && (this._hasImage = this.getMedia().some(function (e) { | |
return !e.isVideo | |
})), this._hasImage | |
}, TD.services.ChirpBase.prototype.hasVideo = function () { | |
return null === this._hasVideo && (this._hasVideo = this.getMedia().some(function (e) { | |
return e.isVideo | |
})), this._hasVideo | |
}, TD.services.ChirpBase.prototype.hasLink = function () { | |
return null === this._hasLink && (this._hasLink = twttr.txt.extractUrls(this.text).length > 0), this._hasLink | |
}, TD.services.ChirpBase.prototype.isFromVerifiedUser = function () { | |
return !1 | |
}, TD.services.ChirpBase.msFudge = 0, TD.services.ChirpBase.prototype.fudgeCreatedTime = function (e) { | |
var t = TD.services.ChirpBase.msFudge; | |
e.setMilliseconds(t), t++, t %= 1e3, TD.services.ChirpBase.msFudge = t | |
}, TD.services.ChirpBase.prototype.scribeMediaImpression = function () {}, TD.services.TwitterStatus = function (e) { | |
this.account = e | |
}, TD.services.TwitterStatus.prototype = new TD.services.ChirpBase, TD.services.TwitterStatus.prototype.chirpType = TD.services.ChirpBase.TWEET, TD.services.TwitterStatus.prototype.user = null, TD.services.TwitterStatus.prototype.inReplyToID = "", TD.services.TwitterStatus.prototype.inReplyToUserID = "", TD.services.TwitterStatus.prototype.inReplyToScreenName = "", TD.services.TwitterStatus.prototype.isFavorite = !1, TD.services.TwitterStatus.prototype.isRetweeted = !1, TD.services.TwitterStatus.prototype.retweetCount = 0, TD.services.TwitterStatus.prototype.retweetedStatus = null, TD.services.TwitterStatus.prototype.entities = null, TD.services.TwitterStatus.prototype.source = "", TD.services.TwitterStatus.prototype.sourceNoHTML = "", TD.services.TwitterStatus.prototype.cards = null, TD.services.TwitterStatus.prototype._media = null, TD.services.TwitterStatus.prototype._filterableText = null, TD.services.TwitterStatus.prototype.fromJSONObject = function (e) { | |
var t, i, n = this, | |
r = !1; | |
this.id = e.id_str || e.id, e.user && (this.user = new TD.services.TwitterUser(this.account).fromJSONObject(e.user), this.creatorAccount = TD.storage.accountController.get(TD.storage.Account.generateKeyFor("twitter", this.user.id))), e.source && (i = $("<div>" + e.source + "</div>"), i.find("a").attr("rel", "url").attr("target", "_blank"), this.source = i.html(), this.sourceNoHTML = i.text()), this.inReplyToUserID = e.in_reply_to_user_id, this.inReplyToScreenName = e.in_reply_to_screen_name, this.isFavorite = e.favorited, this.isRetweeted = e.retweeted, this.retweetCount = e.retweet_count, this.currentUserRetweet = e.current_user_retweet, this.possiblySensitive = e.possibly_sensitive, this.inReplyToID = e.in_reply_to_status_id_str || e.in_reply_to_status_id, e.retweeted_status ? (this.text = e.retweeted_status.text, this.retweetedStatus = new TD.services.TwitterStatus(this.account).fromJSONObject(e.retweeted_status), this.entities = this.retweetedStatus.entities) : (this.text = e.text, this.entities = this._extractEntities(e)), this.entities = this.entities || {}, this._media = TD.services.TwitterMedia.getMediaFromEntities(this.entities); | |
var s = this.getMedia().reduce(function (e, t) { | |
return e[t.url] = (e[t.url] || 0) + 1, e | |
}, {}); | |
return e.cards && (this.cards = {}, _.each(TD.services.TwitterCard.SUPPORTED_CARD_TYPES, function (i) { | |
if (e.cards[i]) | |
for (n.cards[i] = [], t = 0; t < e.cards[i].length; t++) { | |
var o = e.cards[i][t]; | |
s[o.url] && s[o.url] > 1 || (n.cards[i].push(new TD.services.TwitterCard(n.account).fromJSONObject(o)), r = !0) | |
} | |
}), r || (this.cards = null)), this.lang = e.lang, this.place = e.place || {}, this.created = TD.util.parseDateString(e.created_at), this._generateHTMLText(), this | |
}, TD.services.TwitterStatus.prototype.toHTML = function (e) { | |
return TD.util.transform(e, this.entities) | |
}, TD.services.TwitterStatus.prototype._extractEntities = function (e) { | |
var t = e.entities; | |
return e.extended_entities && e.extended_entities.media && e.extended_entities.media.length && (t = t || {}, t.media = e.extended_entities.media), t | |
}, TD.services.TwitterStatus.prototype.getMainUser = function () { | |
return this.retweetedStatus ? this.retweetedStatus.user : this.user | |
}, TD.services.TwitterStatus.prototype.getCreator = function () { | |
return this.user | |
}, TD.services.TwitterStatus.prototype.getRelatedTweet = function () { | |
return this | |
}, TD.services.TwitterStatus.prototype.getMainTweet = function () { | |
return this.retweetedStatus ? this.retweetedStatus : this | |
}, TD.services.TwitterStatus.prototype.hasLocationData = function () { | |
var e = this.getMainTweet(); | |
return !(!e.place.full_name && !e.place.country) | |
}, TD.services.TwitterStatus.prototype.getLocationName = function () { | |
var e = this.getMainTweet(); | |
return e.place.name | |
}, TD.services.TwitterStatus.prototype.getLocationFullName = function () { | |
var e = this.getMainTweet(); | |
return e.place.full_name && e.place.country ? [e.place.full_name, e.place.country].join(", ") : e.place.country ? e.place.country : "" | |
}, TD.services.TwitterStatus.prototype.getLocationURL = function () { | |
var e, t = this.getMainTweet(); | |
switch (t.place.place_type) { | |
case "admin": | |
e = 10; | |
break; | |
case "city": | |
e = 12; | |
break; | |
case "country": | |
e = 6; | |
break; | |
case "neighbourhood": | |
e = 13; | |
break; | |
case "poi": | |
case "default": | |
e = 15 | |
} | |
return "https://maps.google.com/maps?q=" + encodeURIComponent(this.getLocationFullName()) + "&z=" + e | |
}, TD.services.TwitterStatus.prototype.getLocationSearchEncodedURL = function () { | |
return "https://twitter.com/search?q=" + encodeURIComponent('near:"' + this.getLocationFullName() + '"') | |
}, TD.services.TwitterStatus.prototype.isOwnChirp = function () { | |
return Boolean(this.creatorAccount) | |
}, TD.services.TwitterStatus.prototype.isRetweetedStatus = function () { | |
return Boolean(this.retweetedStatus) | |
}, TD.services.TwitterStatus.prototype.isTranslatable = function () { | |
var e = this.getMainTweet(); | |
return TD.decider.get(TD.decider.TRANSLATE_TWEET) && e.lang && e.lang !== TD.languages.getSystemLanguageCode(!0) && TD.languages.isSupportedTranslationSourceLanguage(e.lang) && TD.languages.isSystemLangSupportedDestinationLanguage() && !e.isOwnChirp() && !e.user.isProtected && !e.getTranslation() | |
}, TD.services.TwitterStatus.prototype.translate = function () { | |
var e = TD.controller.clients.getClient(this.account.getKey()), | |
t = this.getMainTweet().lang, | |
i = TD.languages.getSupportedDestinationSystemLanguage(), | |
n = function (e) { | |
var t, n, r, s = this.getDOMChirps().add(this.getMainTweet().getDOMChirps()), | |
o = s.find(".js-translate-call-to-action"); | |
s = s.filter(function () { | |
return 0 === $(".js-tweet-translation", this).length | |
}), this.lang = e.translated_lang || this.lang, o.remove(), e.translated_lang !== i && (e.htmltext = TD.util.transform(e.text, e.entities), e.localizedLanguageName = this.getLocalizedLanguageName(), t = s.find(".js-tweet-text"), t.after(TD.ui.template.render("status/tweet_translation", e)), n = s.find(".js-tweet-translation"), r = n.find(".js-tweet-translation-text"), t.addClass("tweet-translation-original-text margin-bn"), r.html(e.htmltext), this.setTranslation(e)) | |
}.bind(this), | |
r = function () { | |
TD.controller.progressIndicator.addMessage(TD.i("Translation failed")) | |
}.bind(this); | |
e.translateTweet(this.getMainTweet().id, i, n, r), TD.controller.stats.translate(this.getMainUser().id, this.id, this.account.getUserID(), i, t) | |
}, TD.services.TwitterStatus.prototype.setTranslation = function (e) { | |
this.getMainTweet().translation = e | |
}, TD.services.TwitterStatus.prototype.getTranslation = function () { | |
return this.getMainTweet().translation | |
}, TD.services.TwitterStatus.prototype.getChirpURL = function () { | |
var e = this.getMainTweet(); | |
return "https://twitter.com/" + e.user.screenName + "/status/" + e.id | |
}, TD.services.TwitterStatus.prototype.getLocalizedLanguageName = function () { | |
var e = TD.languages.getLanguageFromISOCode(this.getMainTweet().lang); | |
return e ? e.localized_name : "" | |
}, TD.services.TwitterStatus.prototype.destroy = function () { | |
return this.isOwnChirp() ? void this._action("delete", function (e) { | |
TD.controller.feedManager.deleteChirp(e.id) | |
}) : void TD.controller.progressIndicator.addMessage(TD.i("You don't own this account - can't delete")) | |
}, TD.services.TwitterStatus.prototype.getQuoteText = function () { | |
var e = { | |
username: this.user.screenName, | |
text: TD.util.removeHTMLCodes(this.text) | |
}; | |
return TD.ui.template.toHtml("RT @{{username}}: {{{text}}}", e) | |
}, TD.services.TwitterStatus.prototype.renderMinimalist = function (e) { | |
return e.isMinimalist = !0, this.render(e) | |
}, TD.services.TwitterStatus.prototype.render = function (e) { | |
e = e || {}; | |
var t = TD.settings.getDisplaySensitiveMedia(), | |
i = { | |
tweet: this, | |
withMediaPreview: e.mediaPreviewSize !== TD.vo.Column.MEDIA_PREVIEW_OFF, | |
isMediaPreviewSmall: e.mediaPreviewSize === TD.vo.Column.MEDIA_PREVIEW_SIZE_SMALL, | |
isMediaPreviewLarge: e.mediaPreviewSize === TD.vo.Column.MEDIA_PREVIEW_SIZE_LARGE, | |
mediaPreviewSrc: function () { | |
return this.getMediaSrcForPreviewSize(e.mediaPreviewSize) | |
}, | |
thumbSizeClass: TD.services.TwitterMedia.thumbSizeClasses[e.mediaPreviewSize], | |
isPossiblySensitive: this.possiblySensitive && !t, | |
isMinimalist: Boolean(e.isMinimalist), | |
withDragHandle: !1, | |
withRemove: !1, | |
withTweetActions: !0, | |
withFooter: !0, | |
withAvatar: !0, | |
withLinebreaks: !0 | |
}, | |
n = $.extend({}, i, e); | |
return TD.ui.template.render("status/tweet_in_stream", n) | |
}, TD.services.TwitterStatus.prototype.renderInMediaGallery = function () { | |
return TD.ui.template.render("status/tweet_in_box", { | |
tweet: this, | |
withTweetActions: !0, | |
withTweetActionsVisible: !0, | |
withFooter: !0, | |
withAvatar: !0, | |
actionsMenuPosition: "pos-l pos-t" | |
}) | |
}, TD.services.TwitterStatus.prototype.renderNotification = function () { | |
return TD.ui.template.render("status/tweet_in_box", { | |
tweet: this, | |
withAvatar: !0 | |
}) | |
}, TD.services.TwitterStatus.prototype.getGrowlData = function () { | |
var e = this.getMainTweet(), | |
t = {}; | |
return e.sender ? t.title = e.sender.screenName + " > " + e.recipient.screenName : e.user && e.user.screenName && (t.title = e.user.screenName), t.img = e.getMainUser().profileImageURL, t.text = $("<div>" + e.htmlText + "</div>").text(), t | |
}, TD.services.TwitterStatus.prototype.favorite = function (e) { | |
var t, i, n, r, s = (this.getMainUser(), this.getMainTweet(), this.isFavorite), | |
o = TD.controller.clients.getClient(this.account.getKey()); | |
this.setFavorite(!this.isFavorite), this.animateFavorite(e.element), r = function () { | |
TD.controller.progressIndicator.addMessage(TD.i(s ? "Unfavoriting failed" : "Favoriting failed")) | |
}, n = function (e) { | |
var t = TD.core.defer.fail(); | |
(403 === e.status || 404 === e.status) && (t = this.refreshFavorite(o)), t.addErrback(function () { | |
this.setFavorite(s), r() | |
}.bind(this)) | |
}.bind(this), i = function (e) { | |
e.error && n() | |
}.bind(this), s ? (o.unfavorite(this.id, i, n), t = TD.controller.stats.unfavorite) : (o.favorite(this.id, i, n), t = TD.controller.stats.favorite), t(this.getScribeItemData()) | |
}, TD.services.TwitterStatus.prototype.refreshFavorite = function (e) { | |
var t = new TD.core.defer.Deferred; | |
return e.show(this.id, t.callback.bind(t), t.errback.bind(t)), t.addCallback(function (e) { | |
this.setFavorite(e.isFavorite) | |
}.bind(this)), t | |
}, TD.services.TwitterStatus.prototype.animateFavorite = function (e) { | |
var t = "anim anim-slower anim-bounce-in"; | |
requestAnimationFrame(function () { | |
e.find('a[rel="favorite"]').toggleClass(t, this.isFavorite) | |
}.bind(this)) | |
}, TD.services.TwitterStatus.prototype.email = function () { | |
var e, t = TD.i("Tweet forwarded by @{{1}}", { | |
1: this.account.getUsername() | |
}), | |
i = []; | |
i.push(this.text), i.push(TD.i("Original Tweet: {{1}}", { | |
1: this.getChirpURL() | |
})), i.push(TD.i("Sent via TweetDeck")), e = i.join("\n\n"), TD.util.openEmail(null, t, e) | |
}, TD.services.TwitterStatus.prototype.retweet = function () { | |
new TD.components.ActionDialog(this) | |
}, TD.services.TwitterStatus.prototype.referenceTo = function () { | |
var e = this.account.getKey(); | |
$(document).trigger("uiComposeTweet", { | |
appendText: "RE " + this.getChirpURL(), | |
from: [e] | |
}) | |
}, TD.services.TwitterStatus.prototype._action = function (e, t) { | |
function i() { | |
TD.controller.progressIndicator.taskFailed(r) | |
} | |
function n(e) { | |
e.error ? (TD.controller.progressIndicator.changeMessage(r, s + " - " + e.error), i()) : (TD.controller.progressIndicator.taskComplete(r), t && t(o)) | |
} | |
var r, s, o = this, | |
a = TD.controller.clients.getClient(this.account.getKey()); | |
switch (e) { | |
case "delete": | |
s = TD.i(this.retweetedStatus ? "Undoing Retweet" : "Deleting"), a = TD.controller.clients.getClient(this.creatorAccount.getKey()), a.destroy(this.id, n, i); | |
break; | |
case "deleteDM": | |
s = TD.i("Deleting"), this.creatorAccount && (a = TD.controller.clients.getClient(this.creatorAccount.getKey())), a.destroyDM(this.id, n, i) | |
} | |
r = TD.controller.progressIndicator.addTask(s) | |
}, TD.services.TwitterStatus.prototype._entitySort = function (e, t) { | |
return t.indices[0] - e.indices[0] | |
}, TD.services.TwitterStatus.prototype.getFilterableText = function () { | |
var e, t = ""; | |
return this._filterableText ? t = this._filterableText : 0 === this.entities.urls.length && 0 === this.entities.media.length ? t = this.text : (e = [this.text], e = e.concat(_.pluck(this.entities.urls, "expanded_url")), e = e.concat(_.pluck(this.entities.media, "expanded_url")), e = _.compact(e), t = e.join(" "), this._filterableText = t), t | |
}, TD.services.TwitterStatus.prototype.getSenders = function () { | |
var e = [this.user.screenName]; | |
return this.isRetweetedStatus() && e.push(this.retweetedStatus.user.screenName), e | |
}, TD.services.TwitterStatus.prototype.getSource = function () { | |
return this.sourceNoHTML | |
}, TD.services.TwitterStatus.prototype.setRetweeted = function (e) { | |
this.isRetweeted = e, this.getDOMChirps().find(".js-tweet").toggleClass(TD.services.ChirpBase.RETWEET_CLASS, e), this._changed(), this.retweetedStatus && this.retweetedStatus.setRetweeted(e) | |
}, TD.services.TwitterStatus.prototype.setFavorite = function (e) { | |
this.isFavorite = e, this.getDOMChirps().find(".js-tweet").toggleClass(TD.services.ChirpBase.FAVORITE_CLASS, e).find('a[rel="favorite"]').attr("title", TD.ui.template.render("text/favorite_action", this)), this._changed() | |
}, TD.services.TwitterStatus.prototype.isMention = function () { | |
for (var e, t = String(this.account.getUserID()), i = this.account.getUsername().toLowerCase(), n = this.entities.user_mentions.length, r = 0; n > r; r++) | |
if (e = this.entities.user_mentions[r], e.id_str) { | |
if (e.id_str === t) return !0 | |
} else if (e.screen_name.toLowerCase() === i) return !0; | |
return !1 | |
}, TD.services.TwitterStatus.prototype.getMedia = function () { | |
return this.retweetedStatus ? this.retweetedStatus.getMedia() : this._media || [] | |
}, TD.services.TwitterStatus.prototype.getUniqueMedia = function () { | |
var e = this.getMedia(), | |
t = {}, | |
i = [], | |
n = this; | |
return this.cards && _.each(TD.services.TwitterCard.SUPPORTED_CARD_TYPES, function (e) { | |
var i = n.cards[e]; | |
i && _.each(i, function (e) { | |
t[e.url] = !0 | |
}) | |
}), _.each(e, function (e) { | |
t[e.shortUrl] || i.push(e) | |
}), i | |
}, TD.services.TwitterStatus.prototype.getReplyUsers = function () { | |
var e = this.getMainTweet(), | |
t = {}, | |
i = (this.account.getUsername().toLowerCase(), [e.user.screenName]); | |
return i = i.concat(twttr.txt.extractMentions(e.text)), this.retweetedStatus && i.push(this.user.screenName), i = i.filter(function (e) { | |
var i = e.toLowerCase(), | |
n = !t[i]; | |
return t[i] = !0, n | |
}), i = i.map(TD.util.atMentionify) | |
}, TD.services.TwitterStatus.prototype.getCardsForGallery = function () { | |
var e = this.getMedia(), | |
t = {}, | |
i = [], | |
n = this; | |
return _.each(e, function (e) { | |
t[e.shortUrl] = !0 | |
}), this.cards && _.each(["photos", "players"], function (e) { | |
var r = n.cards[e]; | |
r && _.each(r, function (e) { | |
t[e.url] || i.push(e) | |
}) | |
}), i | |
}, TD.services.TwitterStatus.prototype.hasLink = function () { | |
var e = this.entities.media || [], | |
t = this.entities.urls || []; | |
return Boolean(e.length || t.length) | |
}, TD.services.TwitterStatus.prototype.isFromVerifiedUser = function () { | |
return this.getMainTweet().user.isVerified | |
}, TD.services.TwitterStatus.prototype.hasImage = function () { | |
return null === this._hasImage && (this._hasImage = TD.services.ChirpBase.prototype.hasImage.call(this) || TD.services.TwitterMedia.entitiesContainImage(this.entities)), this._hasImage | |
}, TD.services.TwitterStatus.prototype.hasVideo = function () { | |
return null === this._hasVideo && (this._hasVideo = TD.services.ChirpBase.prototype.hasVideo.call(this) || TD.services.TwitterMedia.entitiesContainVideo(this.entities)), this._hasVideo | |
}, TD.services.TwitterStatus.prototype.getScribeItemData = function (e) { | |
var t; | |
return this.isRetweetedStatus() ? (t = this.getMainTweet().getScribeItemData(e), t.retweeting_tweet_id = this.id) : (t = { | |
item_type: 0, | |
id: this.id | |
}, e && (t.visibility_start = e.visibilityStart, t.visibility_end = e.visibilityEnd), this.cards && (this.cards.photos ? t.card_type = 2 : this.cards.players ? t.card_type = 3 : this.cards.summaries && (t.card_type = 4))), t | |
}, TD.services.TwitterStatus.prototype.scribeMediaImpression = function () { | |
TD.controller.stats.mediaImpression(this.getScribeItemData()) | |
}, TD.services.TwitterCard = function (e) { | |
this.account = e | |
}, TD.services.TwitterCard.prototype = { | |
url: null, | |
title: null, | |
description: null, | |
author: null, | |
site: null, | |
images: null, | |
players: null | |
}, TD.services.TwitterCard.SUPPORTED_CARD_TYPES = ["summaries", "photos", "players"], TD.services.TwitterCard.prototype.fromJSONObject = function (e) { | |
return this.url = e.url, this.title = e.title, this.description = e.description, e.author_user && (this.author = new TD.services.TwitterUser(this.account).fromJSONObject(e.author_user)), e.site_user && (this.site = new TD.services.TwitterUser(this.account).fromJSONObject(e.site_user)), e.images && (this.images = e.images), e.players && (this.players = e.players.filter(function (e) { | |
return e.aspectRatio = e.height / e.width * 100, "text/html" === e.source_type | |
})), this | |
}, TD.services.TwitterCard.prototype.shouldDisable = function () { | |
return TD.util.isWrapperApp() && deck.supportsPlayerCard ? !deck.supportsPlayerCard() : "win" === TD.util.getAppEnv() && this.players | |
}, TD.services.TwitterCard.prototype.renderGallery = function () { | |
var e; | |
return this.players ? e = TD.ui.template.render("cards/media_player_gallery", this) : (params = { | |
url: this.url, | |
imageSrc: this.images.web.image_url, | |
thumbClass: TD.services.TwitterMedia.IMAGE_CLASS | |
}, e = TD.ui.template.render("status/media_thumb", params)), e | |
}, TD.services.TwitterMedia = function () {}, TD.services.TwitterMedia.TWITPIC_RE = /(http:\/\/|www.)?twitpic.com\/(\w+)/, TD.services.TwitterMedia.YFROG_RE = /(http:\/\/|www.)?yfrog.com\/\w+/, TD.services.TwitterMedia.PLIXI_RE = /(http:\/\/|www.)?plixi.com\/p\/[0-9]+/, TD.services.TwitterMedia.LOCKERZ_RE = /(http:\/\/|www.)?lockerz.com\/s\/[0-9]+/, TD.services.TwitterMedia.INSTAGRAM_RE = /(http:\/\/|www.)?instagr.am\/p\/[\w-]+(\/)/, TD.services.TwitterMedia.YOUTUBE_LONG_RE = /(?:(?:https?\:\/\/)?(?:www\.)?)?youtube\.com\/watch[a-zA-Z0-9_\-\?\&\=\/]+/, TD.services.TwitterMedia.YOUTUBE_TINY_RE = /(http:\/\/|www.)?youtu\.be\/([a-zA-Z0-9_\-\?\&\=\/]+)/, TD.services.TwitterMedia.YOUTUBE_RE = new RegExp(TD.services.TwitterMedia.YOUTUBE_LONG_RE.source + "|" + TD.services.TwitterMedia.YOUTUBE_TINY_RE.source), TD.services.TwitterMedia.YOUTUBE_STARTTIME = /(?:(\d+)[h])?(?:(\d+)[m])?(?:(\d+)[s])?/, TD.services.TwitterMedia.VIMEO_RE = /https?:\/\/(www\.|player\.)?vimeo\.com\/(.+)/i, TD.services.TwitterMedia.VINE_RE = /https?:\/\/(www\.)?vine\.co\/v\/(.+)/i, TD.services.TwitterMedia.FLICKR_RE = /https?:\/\/(www\.)?(flic.kr|flickr.com\/photos)\/(.+)/i, TD.services.TwitterMedia.IMGUR_RE = /https?:\/\/([a-z0-9]+\.)?imgur.com\/(.+)/i, TD.services.TwitterMedia.PHOTOZOU_RE = /https?:\/\/photozou\.jp\/photo\/(show|photo_only)\/(.+)/i, TD.services.TwitterMedia.FILTERABLE_VIDEO_SERVICES = [TD.services.TwitterMedia.VIMEO_RE, TD.services.TwitterMedia.VINE_RE, TD.services.TwitterMedia.YOUTUBE_TINY_RE, TD.services.TwitterMedia.YOUTUBE_RE, TD.services.TwitterMedia.YOUTUBE_LONG_RE], TD.services.TwitterMedia.FILTERABLE_IMAGE_SERVICES = [TD.services.TwitterMedia.FLICKR_RE, TD.services.TwitterMedia.IMGUR_RE, TD.services.TwitterMedia.PHOTOZOU_RE], TD.services.TwitterMedia.YOUTUBE_GALLERY_WIDTH = 640, TD.services.TwitterMedia.YOUTUBE_GALLERY_HEIGHT = 390, TD.services.TwitterMedia.VINE_GALLERY_WIDTH = 540, TD.services.TwitterMedia.VINE_GALLERY_HEIGHT = 540, TD.services.TwitterMedia.MAX_THUMB_WIDTH = 90, TD.services.TwitterMedia.MAX_THUMB_HEIGHT = 65, TD.services.TwitterMedia.THUMBNAIL_CONTAINER_CLASS = "media-thumb-container", TD.services.TwitterMedia.THUMBNAIL_IMG_CLASS = "media-thumb-img", TD.services.TwitterMedia.thumbSizeClasses = { | |
off: "", | |
small: "media-size-small", | |
medium: "media-size-medium", | |
large: "media-size-large" | |
}, TD.services.TwitterMedia.IMAGE_CLASS = "media-img", TD.services.TwitterMedia.SERVICES = { | |
twitpic: TD.services.TwitterMedia.TWITPIC_RE, | |
yfrog: TD.services.TwitterMedia.YFROG_RE, | |
lockerz: TD.services.TwitterMedia.LOCKERZ_RE, | |
instagram: TD.services.TwitterMedia.INSTAGRAM_RE, | |
youtube: TD.services.TwitterMedia.YOUTUBE_RE, | |
vine: TD.services.TwitterMedia.VINE_RE | |
}, TD.services.TwitterMedia.getMediaFromEntities = function (e, t) { | |
var i = [], | |
n = {}; | |
t = t || {}, _.each(e.media, function (e) { | |
i.push((new TD.services.TwitterMedia).fromMediaEntity(e)) | |
}); | |
var r = _.map(e.urls, function (e) { | |
var t = e.expanded_url || e.url; | |
return n[t] = e.url, _.startsWith(t, "http") || (t = "http://" + t), t | |
}); | |
_.each(r, function (e) { | |
var t; | |
for (var r in TD.services.TwitterMedia.SERVICES) t = e.match(TD.services.TwitterMedia.SERVICES[r]), t && 0 === e.indexOf(t[0]) && i.push((new TD.services.TwitterMedia).fromURL(r, n[e], e, t)) | |
}), _.each(i, function (e) { | |
_.extend(e, t) | |
}); | |
var s = TD.services.TwitterMedia._entitiesContainNativeMultiPhoto(i); | |
if (s.length > 0) return s; | |
var o = TD.services.TwitterMedia._entitiesContainMultiPhoto(i); | |
if (o.length > 0) return o.pop(); | |
var a = TD.services.TwitterMedia._entitiesContainVideo(i); | |
return a.length > 0 ? [a.pop()] : i | |
}, TD.services.TwitterMedia.entitiesContainImage = function (e) { | |
return TD.services.TwitterMedia.FILTERABLE_IMAGE_SERVICES.some(function (t) { | |
return e.urls.some(function (e) { | |
return t.test(e.expanded_url) | |
}) | |
}) | |
}, TD.services.TwitterMedia.entitiesContainVideo = function (e) { | |
return TD.services.TwitterMedia.FILTERABLE_VIDEO_SERVICES.some(function (t) { | |
return e.urls.some(function (e) { | |
return t.test(e.expanded_url) | |
}) | |
}) | |
}, TD.services.TwitterMedia._entitiesContainVideo = function (e) { | |
return _.filter(e, function (e) { | |
var t; | |
return _.some(TD.services.TwitterMedia.FILTERABLE_VIDEO_SERVICES, function (i) { | |
i.test(e.url) && (t = e) | |
}), t | |
}) | |
}, TD.services.TwitterMedia._entitiesContainNativeMultiPhoto = function (e) { | |
return _.filter(e, function (e) { | |
return e.nativePhotoCapable() && e.referenced_media === !1 ? e : void 0 | |
}) | |
}, TD.services.TwitterMedia._entitiesContainMultiPhoto = function (e) { | |
var t = _.groupBy(e, function (e) { | |
return e.nativePhotoCapable() && e.referenced_media === !0 ? e.url : "__delete" | |
}); | |
delete t.__delete; | |
var i = _.values(t); | |
return i | |
}, TD.services.TwitterMedia.prototype = { | |
flaggedNSFW: !1, | |
isVideo: !1 | |
}, TD.services.TwitterMedia.prototype.nativePhotoCapable = function () { | |
return "twitter" === this.service | |
}, TD.services.TwitterMedia.prototype.nativeVideo = function () { | |
return "vine" === this.service | |
}, TD.services.TwitterMedia.prototype.fromMediaEntity = function (e) { | |
return this.entity = e, this.service = "twitter", this.url = this.shortUrl = e.url, this.sizes = e.sizes, this.needsSecureUrl = !1, this.isScheduled = !1, this.mediaId = e.id_str, this.referenced_media = e.source_status_id ? !0 : !1, this | |
}, TD.services.TwitterMedia.prototype.fromURL = function (e, t, i, n) { | |
if (this.url = i, this.urlMatches = n, this.shortUrl = t, this.service = e, "instagram" === this.service && _.endsWith(this.url, "/")) this.url = this.url.substring(0, this.url.length - 1); | |
else if ("vine" === this.service) this.isVideo = !0, this.mediaId = this.url.split("/").pop(); | |
else if ("youtube" === this.service && (this.isVideo = !0, this.mediaId = this.url.match(TD.services.TwitterMedia.YOUTUBE_LONG_RE) ? TD.net.util.decodeURL(this.url).v : this.url.split("/").pop().split("?")[0], this.startTimeInUrl = TD.net.util.decodeURL(this.url).t, this.startTimeInUrl)) { | |
var r = this.startTimeInUrl.match(TD.services.TwitterMedia.YOUTUBE_STARTTIME), | |
s = r[1] ? parseInt(3600 * r[1], 10) : 0, | |
o = r[2] ? parseInt(60 * r[2], 10) : 0, | |
a = r[3] ? parseInt(r[3], 10) : 0; | |
this.startTime = s + o + a | |
} | |
return this | |
}, TD.services.TwitterMedia.prototype.getTwitterPreviewUrl = function (e) { | |
return this.isScheduled ? this.entity.url : this.entity.media_url_https + (e || "") | |
}, TD.services.TwitterMedia.prototype.thumb = function () { | |
switch (this.service) { | |
case "twitter": | |
return this.getTwitterPreviewUrl(":thumb"); | |
case "twitpic": | |
return "https://twitpic.com/show/thumb/" + this.urlMatches[2]; | |
case "yfrog": | |
return this.url.replace("http://", "https://") + ":small"; | |
case "lockerz": | |
return "https://api.plixi.com/api/tpapi.svc/imagefromurl?size=thumbnail&url=" + this.url; | |
case "instagram": | |
return "https://instagr.am/p/" + this.url.split("/").pop() + "/media/?size=t"; | |
case "youtube": | |
return "https://img.youtube.com/vi/" + this.mediaId + "/default.jpg"; | |
case "vine": | |
return this.large() | |
} | |
}, TD.services.TwitterMedia.prototype.small = function () { | |
switch (this.service) { | |
case "twitter": | |
return this.getTwitterPreviewUrl(":small"); | |
case "twitpic": | |
case "yfrog": | |
case "lockerz": | |
case "vine": | |
return this.large(); | |
case "instagram": | |
return "https://instagr.am/p/" + this.url.split("/").pop() + "/media/?size=m"; | |
case "youtube": | |
return "https://img.youtube.com/vi/" + this.mediaId + "/mqdefault.jpg" | |
} | |
}, TD.services.TwitterMedia.prototype.medium = function () { | |
switch (this.service) { | |
case "twitter": | |
return this.getTwitterPreviewUrl(); | |
case "twitpic": | |
case "yfrog": | |
case "lockerz": | |
case "vine": | |
return this.large(); | |
case "instagram": | |
return "https://instagr.am/p/" + this.url.split("/").pop() + "/media/?size=l"; | |
case "youtube": | |
return "https://img.youtube.com/vi/" + this.mediaId + "/mqdefault.jpg" | |
} | |
}, TD.services.TwitterMedia.prototype.large = function () { | |
switch (this.service) { | |
case "twitter": | |
return this.getTwitterPreviewUrl(":large"); | |
case "twitpic": | |
return "https://twitpic.com/show/full/" + this.urlMatches[2]; | |
case "yfrog": | |
return this.url.replace("http://", "https://") + ":iphone"; | |
case "lockerz": | |
return "https://api.plixi.com/api/tpapi.svc/imagefromurl?size=medium&url=" + this.url; | |
case "instagram": | |
return "https://instagr.am/p/" + this.url.split("/").pop() + "/media/?size=l"; | |
case "youtube": | |
return "https://img.youtube.com/vi/" + this.mediaId + "/hqdefault.jpg"; | |
case "vine": | |
return "https://vine.co/v/" + this.mediaId + "/thumb" | |
} | |
}, TD.services.TwitterMedia.prototype.getMediaSrcForPreviewSize = function (e) { | |
var t = TD.util.isRetina(); | |
switch (e) { | |
case TD.vo.Column.MEDIA_PREVIEW_SIZE_SMALL: | |
return t ? this.small() : this.thumb(); | |
case TD.vo.Column.MEDIA_PREVIEW_SIZE_MEDIUM: | |
return t ? this.medium() : this.small(); | |
case TD.vo.Column.MEDIA_PREVIEW_SIZE_LARGE: | |
return t ? this.large() : this.medium() | |
} | |
}, TD.services.TwitterMedia.prototype.renderThumb = function (e) { | |
var t = { | |
url: this.url, | |
imageSrc: this.thumb(), | |
isVideo: this.isVideo, | |
thumbSizeClass: TD.services.TwitterMedia.thumbSizeClasses[e] | |
}; | |
return TD.ui.template.render("status/media_thumb", t) | |
}, TD.services.TwitterMedia.prototype.renderDetailView = function () { | |
var e, t = "narrow" === TD.settings.getColumnWidth(); | |
return "youtube" !== this.service || t ? "vine" !== this.service || t ? (e = { | |
mediaId: this.mediaId, | |
isPossiblySensitive: this.isPossiblySensitive, | |
url: this.url, | |
imageSrc: this.small(), | |
isVideo: this.isVideo, | |
thumbClass: TD.services.TwitterMedia.IMAGE_CLASS | |
}, TD.ui.template.render("status/media_thumb", e)) : (e = { | |
id: this.mediaId, | |
width: "100%", | |
height: "auto" | |
}, TD.ui.template.render("media/vine", e)) : (e = { | |
id: this.mediaId, | |
startTime: this.startTime, | |
width: "100%", | |
height: "auto" | |
}, TD.ui.template.render("media/youtube", e)) | |
}, TD.services.TwitterMedia.prototype.renderGallery = function () { | |
var e, t; | |
return "youtube" === this.service ? (e = "media/youtube", t = { | |
id: this.mediaId, | |
startTime: this.startTime, | |
width: TD.services.TwitterMedia.YOUTUBE_GALLERY_WIDTH, | |
height: TD.services.TwitterMedia.YOUTUBE_GALLERY_HEIGHT | |
}) : "vine" === this.service ? (e = "media/vine", t = { | |
id: this.mediaId, | |
width: TD.services.TwitterMedia.VINE_GALLERY_WIDTH, | |
height: TD.services.TwitterMedia.VINE_GALLERY_HEIGHT | |
}) : (e = "status/media_thumb", t = { | |
url: this.url, | |
imageSrc: this.large(), | |
thumbClass: TD.services.TwitterMedia.IMAGE_CLASS, | |
needsSecureUrl: this.needsSecureUrl | |
}), TD.ui.template.render(e, t) | |
}, TD.services.TwitterDirectMessage = function (e) { | |
this.account = e | |
}, TD.services.TwitterDirectMessage.prototype = new TD.services.TwitterStatus, TD.services.TwitterDirectMessage.prototype.chirpType = TD.services.ChirpBase.MESSAGE, TD.services.TwitterDirectMessage.prototype.messageThreadId = null, TD.services.TwitterDirectMessage.prototype.fromJSONObject = function (e) { | |
return this.id = e.id_str || String(e.id), this.text = e.text, this.sender = new TD.services.TwitterUser(this.account).fromJSONObject(e.sender), this.recipient = new TD.services.TwitterUser(this.account).fromJSONObject(e.recipient), this.creatorAccount = TD.storage.accountController.get(TD.storage.Account.generateKeyFor("twitter", this.sender.id)), this.created = TD.util.parseDateString(e.created_at), this.createdDate = TD.util.prettyDate(this.created), this.entities = e.entities || {}, this._media = TD.services.TwitterMedia.getMediaFromEntities(this.entities, { | |
needsSecureUrl: !0 | |
}), this.htmlText = TD.util.transform(this.text, this.entities), this.read = e.read || this.sender.isMe(), this | |
}, TD.services.TwitterDirectMessage.prototype.hasLocationData = function () { | |
return !1 | |
}, TD.services.TwitterDirectMessage.prototype.getMainUser = function () { | |
return this.sender | |
}, TD.services.TwitterDirectMessage.prototype.isOwnChirp = function () { | |
return Boolean(this.creatorAccount) | |
}, TD.services.TwitterDirectMessage.prototype.dm = function () { | |
var e = this.sender; | |
this.isOwnChirp() && (e = this.recipient), $(document).trigger("uiComposeTweet", { | |
type: "message", | |
from: [this.account.getKey()], | |
messageRecipient: { | |
screenName: e.screenName | |
} | |
}) | |
}, TD.services.TwitterDirectMessage.prototype.getChirpURL = function () { | |
return "" | |
}, TD.services.TwitterDirectMessage.prototype.destroy = function () { | |
var e = this; | |
this._action("deleteDM", function () { | |
var t = TD.controller.clients.getClient(e.account.getKey()); | |
t.deleteMessage(e.id) | |
}) | |
}, TD.services.TwitterDirectMessage.prototype.render = function () { | |
var e = TD.vo.Column.MEDIA_PREVIEW_SIZE_MEDIUM, | |
t = this.account.getKey(), | |
i = TD.config.force_dm_photos || TD.decider.get(TD.decider.DM_PHOTO_PREVIEW), | |
n = TD.ui.template.render("status/message_in_stream", { | |
message: this, | |
withFooter: !0, | |
withAvatar: !0, | |
withMediaPreview: i, | |
isMediaPreviewSmall: e === TD.vo.Column.MEDIA_PREVIEW_SIZE_SMALL, | |
isMediaPreviewLarge: e === TD.vo.Column.MEDIA_PREVIEW_SIZE_LARGE, | |
mediaPreviewSrc: function () { | |
var i = this.getMediaSrcForPreviewSize(e); | |
return this.needsSecureUrl && _.defer(function () { | |
$(document).trigger("uiNeedsSecureImageUrl", { | |
accountKey: t, | |
url: i | |
}) | |
}), i | |
}, | |
thumbSizeClass: TD.services.TwitterMedia.thumbSizeClasses[e], | |
accountKey: this.account.getKey() | |
}); | |
return n | |
}, TD.services.TwitterDirectMessage.prototype.renderInMediaGallery = function () { | |
return TD.ui.template.render("status/message_in_box", { | |
message: this, | |
withFooter: !0, | |
withAvatar: !0, | |
withMediaPreview: !1, | |
withTweetActions: !0, | |
withTweetActionsVisible: !0 | |
}) | |
}, TD.services.TwitterDirectMessage.prototype.renderNotification = function () { | |
return TD.ui.template.render("status/message_in_box", { | |
message: this, | |
withAvatar: !0 | |
}) | |
}, TD.services.TwitterDirectMessage.prototype.getSenders = function () { | |
return [this.sender.screenName] | |
}, TD.services.TwitterDirectMessage.prototype.getCorrespondent = function () { | |
var e = this.account.getUserID(); | |
return this.sender.id == e ? this.recipient : this.sender | |
}, TD.services.TwitterMessageThread = function (e, t) { | |
this.account = e, this.correspondent = t, this.id = "messagethread-" + e.getUserID() + "-" + t.id, this.messages = [], this.messageIndex = {} | |
}, TD.services.TwitterMessageThread.prototype = new TD.services.ChirpBase, TD.services.TwitterMessageThread.prototype.chirpType = TD.services.ChirpBase.MESSAGE_THREAD, TD.services.TwitterMessageThread.prototype.correspondent = null, TD.services.TwitterMessageThread.prototype.unread = !1, TD.services.TwitterMessageThread.prototype.replied = !1, TD.services.TwitterMessageThread.prototype.messages = null, TD.services.TwitterMessageThread.prototype.messageIndex = null, TD.services.TwitterMessageThread.prototype.addMessages = function (e) { | |
var t, i, n = !1, | |
r = this.account.getUserID(); | |
if (0 !== e.length) { | |
for (t = 0, i = e.length; i > t; t++) { | |
var s = e[t]; | |
if (!this.messageIndex[s.id]) { | |
if (n = !0, s.recipient.id == r && s.sender.id == this.correspondent.id); | |
else if (s.recipient.id != this.correspondent.id || s.sender.id != r) throw new Error("Wrong thread!"); | |
s.messageThreadId = this.id, this.messages.push(s), this.messageIndex[s.id] = s | |
} | |
} | |
return this.messages.sort(TD.util.chirpDescSort), this.calculateAttributes(), n | |
} | |
}, TD.services.TwitterMessageThread.prototype.removeMessage = function (e) { | |
var t = this.messageIndex[e]; | |
return t ? (delete this.messageIndex[e], this.messages = _.select(this.messages, function (t) { | |
return t.id !== e | |
}), this.calculateAttributes(), $(document).trigger("uiMessageThreadRead", {}), !0) : !1 | |
}, TD.services.TwitterMessageThread.prototype.getMainUser = function () { | |
return this.correspondent | |
}, TD.services.TwitterMessageThread.prototype.calculateAttributes = function () { | |
var e = this.account.getUserID(); | |
if (this.replied = !1, this.attachmentOnly = !1, this.unread = this.getUnreadChirps().length > 0, !(this.messages.length <= 0)) { | |
this.messages[0].sender.id === e && (this.replied = !0), this.created = this.messages[0].created; { | |
_.detect(this.messages, function (t) { | |
return t.recipient.id === e | |
}) | |
} | |
if (this.text = this.messages[0].text, this.htmlText = this.messages[0].htmlText, this._media = this.messages[0]._media, this._media.length) { | |
var t = this.text, | |
i = this._media.some(function (e) { | |
return e.entity && e.entity.indices && e.entity.indices[1] === this.text.length ? (t = this.text.substr(0, e.entity.indices[0]), !0) : void 0 | |
}.bind(this)); | |
i && (this.text = t.trim(), this.htmlText = TD.util.transform(this.text, this.entities)), this.text.length || (this.attachmentOnly = !0) | |
} | |
} | |
}, TD.services.TwitterMessageThread.prototype.render = function () { | |
var e = this.account.getKey(); | |
return TD.ui.template.render("status/message_thread", { | |
chirp: this, | |
withAvatar: !0, | |
mediaPreviewSrc: function () { | |
var t = this.getMediaSrcForPreviewSize("small"); | |
return this.needsSecureUrl && _.defer(function () { | |
$(document).trigger("uiNeedsSecureImageUrl", { | |
accountKey: e, | |
url: t | |
}) | |
}), t | |
} | |
}) | |
}, TD.services.TwitterMessageThread.prototype.renderThread = function () { | |
var e = []; | |
return this.messages.forEach(function (t) { | |
e.push(t.render()) | |
}), e.join("") | |
}, TD.services.TwitterMessageThread.prototype.update = function () { | |
return !0 | |
}, TD.services.TwitterMessageThread.prototype.isOwnChirp = function () { | |
return !1 | |
}, TD.services.TwitterMessageThread.prototype.getSinceId = function () { | |
for (var e = 1, t = 0; t < this.messages.length; t++) | |
if (!this.messages[t].isOwnChirp()) { | |
e = this.messages[t].getSinceId(); | |
break | |
} | |
return e | |
}, TD.services.TwitterMessageThread.prototype.getUnreadChirps = function () { | |
return this.messages.filter(function (e) { | |
return !e.read | |
}) | |
}, TD.services.TwitterMessageThread.prototype.markAsRead = function () { | |
var e = TD.controller.clients.getClient(this.account.getKey()), | |
t = this.getUnreadChirps(); | |
this.unread = !1, this.getDOMChirps().removeClass(TD.services.ChirpBase.UNREAD_CLASS); | |
var i = this.messages.some(function (e) { | |
return !e.read | |
}); | |
t.forEach(function (e) { | |
e.read = !0 | |
}), $(document).trigger("uiMessageThreadRead", {}); | |
var n = function () { | |
this.unread = !0, t.forEach(function (e) { | |
e.read = !1 | |
}), TD.controller.progressIndicator.addMessage(TD.i("Failed to mark message as read.")), this.getDOMChirps().addClass(TD.services.ChirpBase.UNREAD_CLASS), this._changed() | |
}; | |
i && (e.markMessagesAsRead(this.messages[0].id, this.correspondent.id, null, n.bind(this)), this._changed()) | |
}, TD.services.TwitterMessageThread.prototype.getSenders = function () { | |
return [this.correspondent.screenName] | |
}, TD.services.TwitterUser = function (e) { | |
this.account = e | |
}, TD.services.TwitterUser.MINI_SUFFIX = "_mini", TD.services.TwitterUser.NORMAL_SUFFIX = "_normal", TD.services.TwitterUser.BIGGER_SUFFIX = "_bigger", TD.services.TwitterUser.REASONABLY_SMALL_SUFFIX = "_reasonably_small", TD.services.TwitterUser.NORMAL_SUFFIX_REGEXP = new RegExp(TD.services.TwitterUser.NORMAL_SUFFIX + "(?!.*" + TD.services.TwitterUser.NORMAL_SUFFIX + ")"), TD.services.TwitterUser.BIGGER_SUFFIX_REGEXP = new RegExp(TD.services.TwitterUser.BIGGER_SUFFIX + "(?!.*" + TD.services.TwitterUser.BIGGER_SUFFIX + ")"), TD.services.TwitterUser.prototype.fromJSONObject = function (e) { | |
return this.id = e.id_str, this.screenName = e.screen_name, this.profileURL = "https://twitter.com/" + this.screenName, this.profileImageURL = e.profile_image_url_https, this.avatarSuffixRegex = TD.services.TwitterUser.NORMAL_SUFFIX_REGEXP, TD.util.isRetina() && (this.profileImageURL = this.profileImageURL.replace(this.avatarSuffixRegex, TD.services.TwitterUser.BIGGER_SUFFIX), this.avatarSuffixRegex = TD.services.TwitterUser.BIGGER_SUFFIX_REGEXP), this.name = e.name, this.location = e.location, this.description = e.description, this.entities = e.entities, this.friendsCount = e.friends_count, this.listedCount = e.listed_count, this.followersCount = e.followers_count, this.statusesCount = e.statuses_count, this.favoritesCount = e.favourites_count, this.listedCount = e.listed_count, this.url = e.url, this.isProtected = e["protected"], this.isVerified = e.verified, this.isTranslator = e.is_translator, this.following = e.following, this.lang = e.lang, this._profileBannerURL = e.profile_banner_url ? e.profile_banner_url + "/web" : null, TD.util.isRetina() && this._profileBannerURL && (this._profileBannerURL += "_retina"), e.status && (this.lastStatus = new TD.services.TwitterStatus(this.account).fromJSONObject(e.status), this.lastStatus.user = this), TD.cache.twitterUsers.add(this), this | |
}, TD.services.TwitterUser.prototype.isSameUser = function (e) { | |
var t; | |
return t = e instanceof TD.services.TwitterUser ? e.screenName.toLowerCase() : e.toLowerCase(), this.screenName.toLowerCase() === t | |
}, TD.services.TwitterUser.prototype.isMe = function () { | |
return this.account.getUserID() == this.id | |
}, TD.services.TwitterUser.prototype.reasonablySmallProfileImageURL = function () { | |
return this.profileImageURL.replace(this.avatarSuffixRegex, TD.services.TwitterUser.REASONABLY_SMALL_SUFFIX) | |
}, TD.services.TwitterUser.prototype.biggerProfileImageURL = function () { | |
return TD.util.isRetina() ? this.reasonablySmallProfileImageURL() : this.profileImageURL.replace(this.avatarSuffixRegex, TD.services.TwitterUser.BIGGER_SUFFIX) | |
}, TD.services.TwitterUser.prototype.miniProfileImageURL = function () { | |
return TD.util.isRetina() ? this.profileImageURL.replace(this.avatarSuffixRegex, TD.services.TwitterUser.NORMAL_SUFFIX) : this.profileImageURL.replace(this.avatarSuffixRegex, TD.services.TwitterUser.MINI_SUFFIX) | |
}, TD.services.TwitterUser.prototype.prettyFollowersCount = function () { | |
return TD.util.prettyNumber(this.followersCount) | |
}, TD.services.TwitterUser.prototype.prettyFriendsCount = function () { | |
return TD.util.prettyNumber(this.friendsCount) | |
}, TD.services.TwitterUser.prototype.prettyListedCount = function () { | |
return TD.util.prettyNumber(this.listedCount) | |
}, TD.services.TwitterUser.prototype.prettyStatusesCount = function () { | |
return TD.util.prettyNumber(this.statusesCount) | |
}, TD.services.TwitterUser.prototype.follow = function (e, t, i, n) { | |
var r, s = TD.controller.clients.getClient(e.getKey()), | |
o = this, | |
a = function (e) { | |
o.following = !0, n && (r = TD.i("Successfully followed @{{screenName}}", o), TD.controller.progressIndicator.addMessage(r)), t && t(e) | |
}, | |
c = function () { | |
n && (r = TD.i("Unable to follow @{{screenName}}", o), TD.controller.progressIndicator.addMessage(r)), i && i() | |
}; | |
s.followUser(this.screenName, a, c) | |
}, TD.services.TwitterUser.prototype.unfollow = function (e, t, i, n) { | |
var r, s = TD.controller.clients.getClient(e.getKey()), | |
o = this, | |
a = function (i) { | |
o.removeFromView(e, !0), o.following = !1, n && (r = TD.i("Successfully unfollowed @{{screenName}}", o), TD.controller.progressIndicator.addMessage(r)), t && t(i) | |
}, | |
c = function () { | |
n && (r = TD.i("Unable to unfollow @{{screenName}}", o), TD.controller.progressIndicator.addMessage(r)), i && i() | |
}; | |
s.unfollowUser(this.screenName, a, c) | |
}, TD.services.TwitterUser.prototype.unblock = function (e, t, i) { | |
var n = TD.controller.clients.getClient(e.getKey()); | |
n.unblockUser(this.screenName, t, i), $.publish("/user/" + this.screenName + "/unblock", [this.account]) | |
}, TD.services.TwitterUser.prototype.block = function (e, t, i, n) { | |
var r, s = this, | |
o = TD.controller.clients.getClient(e.getKey()), | |
a = function () { | |
TD.controller.progressIndicator.addMessage(r), s.following = !1, $.publish("/user/" + s.screenName + "/blocked", [s.account]), s.removeFromView(e, !1) | |
}; | |
$.publish("/user/" + this.screenName + "/block", [this.account]), t ? (o.blockAndReportUser(this.screenName, a, n), r = TD.i("Successfully blocked and reported @{{screenName}}", { | |
screenName: this.screenName | |
})) : (o.blockUser(this.screenName, a, n), r = TD.i("Successfully blocked @{{screenName}}", { | |
screenName: this.screenName | |
})) | |
}, TD.services.TwitterUser.prototype.removeFromView = function (e, t) { | |
$.publish("/user/removeTweets", [this.screenName, e.getUserID(), t]) | |
}, TD.services.TwitterUser.prototype.bio = function () { | |
var e = this.entities && this.entities.description || {}; | |
return TD.util.transform(this.description, e) | |
}, TD.services.TwitterUser.prototype.htmlLocation = function () { | |
var e = this.entities && this.entities.location || {}; | |
return TD.util.transform(this.location, e) | |
}, TD.services.TwitterUser.prototype.hasLocation = function () { | |
return Boolean(this.htmlLocation()) | |
}, TD.services.TwitterUser.prototype.getFollowerURL = function () { | |
return this.profileURL + "/followers" | |
}, TD.services.TwitterUser.prototype.getFriendURL = function () { | |
return this.profileURL + "/following" | |
}, TD.services.TwitterUser.prototype.getProfileURL = function () { | |
return this.profileURL | |
}, TD.services.TwitterUser.prototype.getListedURL = function () { | |
return this.profileURL + "/memberships" | |
}, TD.services.TwitterUser.prototype.getDisplayURL = function () { | |
var e = this.entities; | |
return e && e.url && e.url.urls && e.url.urls.length && e.url.urls[0].display_url ? e.url.urls[0].display_url : this.url | |
}, TD.services.TwitterUser.prototype.profileBannerURL = function () { | |
return this._profileBannerURL || "/web/assets/global/backgrounds/td_profile_empty" + (TD.util.isRetina() ? "@2x.jpg" : ".jpg") | |
}, TD.services.TrendingTopic = function () {}, TD.services.TrendingTopic.prototype.name = "", TD.services.TrendingTopic.prototype.query = "", TD.services.TrendingTopic.prototype.url = "", TD.services.TrendingTopic.prototype.description = "", TD.services.TrendingTopic.prototype.attribution = "", TD.services.TrendingTopic.prototype.created = 0, TD.services.TrendingTopic.prototype.promotedContent = null, TD.services.TrendingTopic.prototype.events = null, TD.services.TrendingTopic.prototype.fromJSONObject = function (e) { | |
return this.name = e.name, this.query = e.query, this.promotedContent = e.promoted_content, this.events = e.events, this.created = (new Date).getTime(), this.query = encodeURIComponent(this.name), this.url || (this.url = "http://search.twitter.com/search?q=" + this.query), this.promotedContent && this.promotedContent.description && (this.description = TD.util.escape(this.promotedContent.description)), this | |
}, TD.services.TrendLocation = function () {}, TD.services.TrendLocation.prototype.PLACE_TYPE_SUPERNAME = 19, TD.services.TrendLocation.prototype.PLACE_TYPE_COUNTRY = 12, TD.services.TrendLocation.prototype.PLACE_TYPE_TOWN = 7, TD.services.TrendLocation.prototype.placeType = null, TD.services.TrendLocation.prototype.name = "", TD.services.TrendLocation.prototype.woeid = -1, TD.services.TrendLocation.prototype.url = "", TD.services.TrendLocation.prototype.countryCode = "", TD.services.TrendLocation.prototype.country = "", TD.services.TrendLocation.prototype.label = "", TD.services.TrendLocation.prototype.sortString = "", TD.services.TrendLocation.prototype.isTown = !1, TD.services.TrendLocation.prototype.fromJSONObject = function (e) { | |
switch (this.name = e.name, this.woeid = e.woeid, this.url = e.url, this.countryCode = e.countryCode, this.country = e.country, this.placeType = e.placeType, this.placeType.code) { | |
case this.PLACE_TYPE_TOWN: | |
this.label = "—" + this.name, this.sortString = this.country + this.name, this.isTown = !0; | |
break; | |
case this.PLACE_TYPE_SUPERNAME: | |
this.label = this.name.toUpperCase(), this.sortString = ""; | |
break; | |
default: | |
this.label = this.name, this.sortString = this.name | |
} | |
return this | |
}, TD.services.TwitterList = function (e) { | |
this.account = e | |
}, TD.services.TwitterList.prototype.fromJSONObject = function (e) { | |
return this.id = e.id_str, this.name = e.name, this.description = e.description, this.slug = e.slug, this.fullName = e.full_name, this.memberCount = e.member_count, this.isPrivate = "private" === e.mode, this.user = new TD.services.TwitterUser(this.account).fromJSONObject(e.user), this | |
}, TD.services.TwitterList.prototype.isOwnList = function () { | |
var e = TD.storage.Account.generateKeyFor("twitter", this.user.id), | |
t = TD.storage.accountController.get(e); | |
return Boolean(t) | |
}, TD.services.CustomTimeline = function (e) { | |
this.account = e | |
}, TD.services.CustomTimeline.prototype.fromJSONObject = function (e) { | |
return this.id = e.id_str || e.id, this.name = e.name, this.description = e.description, this.url = e.url, this.user = new TD.services.TwitterUser(this.account).fromJSONObject(e.user), this | |
}, TD.services.CustomTimeline.prototype.isOwnCustomTimeline = function () { | |
return String(this.account.getUserID()) === this.user.id | |
}, TD.services.TwitterSearchParser = function (e) { | |
this.query = e, this.terms = [], this.init() | |
}, TD.services.TwitterSearchParser.PUNCT = new RegExp("[" + twttr.txt.regexen.punct.source + "]", "g"), TD.services.TwitterSearchParser.ALLOWED_CHARS = ["@", "#", '"', "-"], TD.services.TwitterSearchParser.isStreamable = function (e) { | |
var t = e.match(TD.services.TwitterSearchParser.PUNCT), | |
i = _.difference(t, TD.services.TwitterSearchParser.ALLOWED_CHARS); | |
return 0 === i.length | |
}, TD.services.TwitterSearchParser.prototype.PHRASE = "phrase", TD.services.TwitterSearchParser.prototype.NEGATIVE_PHRASE = "negPhrase", TD.services.TwitterSearchParser.prototype.AND = "and", TD.services.TwitterSearchParser.prototype.OR = "or", TD.services.TwitterSearchParser.prototype.query = "", TD.services.TwitterSearchParser.prototype.trackQuery = "", TD.services.TwitterSearchParser.prototype.thePhrase = "", TD.services.TwitterSearchParser.prototype.type = "", TD.services.TwitterSearchParser.prototype.init = function () { | |
if (!this.trackQuery) { | |
var e, t; | |
if (t = "string" == typeof this.query ? TD.services.TwitterSearchParser.extractPhrases(this.query, !1) : this.query, 0 === t.length); | |
else if (1 === t.length) this.thePhrase = t[0].toLowerCase(), "-" === this.thePhrase.charAt(0) && -1 === this.thePhrase.indexOf(" ") ? (this.type = this.NEGATIVE_PHRASE, this.thePhrase = this.thePhrase.slice(1), this.trackQuery = "") : (this.type = this.PHRASE, this.trackQuery = this.thePhrase); | |
else { | |
var i, n = [ | |
[] | |
], | |
r = !0; | |
for (i = 0; i < t.length; i++) e = t[i], "OR" !== e ? "AND" !== e && (r ? _.last(n).push(e) : n.push([e]), r = !1) : (_.last(n).push(e), r = !0); | |
if (n = _.reject(n, function (e) { | |
return _.isEmpty(e) | |
}), n.length > 1) { | |
for (this.type = this.AND, i = 0; i < n.length; i++) { | |
var s = n[i]; | |
s.length > 0 && this.terms.push(new TD.services.TwitterSearchParser(s)) | |
} | |
this.trackQuery = this.calculateANDTrackQuery(n) | |
} else | |
for (this.type = this.OR, i = 0; i < n[0].length; i++) e = n[0][i], "OR" != e && (this.terms.push(new TD.services.TwitterSearchParser([e])), "-" != e.charAt(0) && (this.trackQuery && (this.trackQuery += ","), this.trackQuery += e)) | |
} | |
} | |
}, TD.services.TwitterSearchParser.prototype.calculateANDTrackQuery = function (e) { | |
for (var t = [""], i = 0; i < e.length; i++) { | |
for (var n = e[i], r = [], s = 0; s < n.length; s++) { | |
var o = n[s]; | |
if ("OR" != o) | |
if ("-" == o.charAt(0)) r = t; | |
else | |
for (var a = 0; a < t.length; a++) { | |
var c = t[a], | |
u = c ? c + " " : ""; | |
u += o, r.push(u) | |
} | |
} | |
t = r | |
} | |
return t.join(",") | |
}, TD.services.TwitterSearchParser.extractPhrases = function (e, t) { | |
for (var i, n = [], r = e.split('"'), s = 0; s < r.length; s++) | |
if (r[s]) | |
if (s % 2 == 1 && s < r.length - 1) i = r[s].trim(), i && (t && (i = '"' + i + '"'), n.push(i)); | |
else | |
for (var o = r[s].split(" "), a = 0; a < o.length; a++) i = o[a], i = i.trim(), i && n.push(i); | |
return n | |
}, TD.services.TwitterSearchParser.prototype.match = function (e, t) { | |
var i, n, r = new RegExp("(^|[^\\w])" + _.escapeRegExp(this.thePhrase) + "($|[^\\w])"); | |
switch (t || (e = e.toLowerCase()), this.type) { | |
case this.PHRASE: | |
return -1 !== e.indexOf(this.thePhrase) && r.test(e); | |
case this.NEGATIVE_PHRASE: | |
return -1 === e.indexOf(this.thePhrase); | |
case this.AND: | |
for (i = 0; i < this.terms.length; i++) | |
if (n = this.terms[i], !n.match(e, !0)) return !1; | |
return !0; | |
case this.OR: | |
for (i = 0; i < this.terms.length; i++) | |
if (n = this.terms[i], n.match(e, !0)) return !0; | |
return !1; | |
default: | |
return !1 | |
} | |
}, TD.services.StreamEngine = klass(function (e, t) { | |
this._account = e, this._callback = t, this._url = "", this._state = TD.services.StreamEngine.DISCONNECTED, this._stream = null, this._backoffLimit = 0, this._backoffTimeout = null, this._keepaliveTimeout = null, this._handleData = TD.util.bind(this._handleData, this), this._handleStreamInterruption = TD.util.bind(this._handleStreamInterruption, this), this.connect = _.debounce(this._connect, 50) | |
}).statics({ | |
BACKOFF_PERIOD_MIN: 2e4, | |
BACKOFF_PERIOD_MAX: 24e4, | |
BACKOFF_PERIOD_MAX_EXTENDED: 72e4, | |
KEEPALIVE_PERIOD: 9e4, | |
XHR_BYTE_LIMIT: 5e7, | |
DISCONNECTED: "disconnected", | |
CONNECTING: "connecting", | |
STREAMING: "streaming", | |
DEBUG: !1 | |
}).methods({ | |
log: function () { | |
TD.services.StreamEngine.DEBUG && (console.log((new Date).toUTCString(), ">", this._account.getUsername(), ">", arguments), TD.util.insertLogDivider()) | |
}, | |
_connect: function (e) { | |
return e === this._url ? void this.log("Connect", e, "Already connecting/connected. Do nothing") : void(e ? (this.log("Connect", e), this.disconnect(), this._url = e, this._startNewStream()) : (this.log("Connect", e, "Nothing to stream. Disconnecting"), this.disconnect())) | |
}, | |
disconnect: function () { | |
this.log("Disconnect completely"), this._setState(TD.services.StreamEngine.DISCONNECTED), this._disconnectStream(), this._url = "", this._backoffLimit = 0 | |
}, | |
isStreaming: function () { | |
var e = this._state === TD.services.StreamEngine.STREAMING; | |
return this.log("isStreaming", e), e | |
}, | |
_setState: function (e) { | |
var t = this._state === TD.services.StreamEngine.STREAMING, | |
i = e === TD.services.StreamEngine.STREAMING; | |
this._state = e, t !== i && $(document).trigger("dataUserStreamStatus", { | |
accountKey: this._account.getKey(), | |
streaming: i | |
}) | |
}, | |
_startNewStream: function () { | |
this._disconnectStream(), this.log("Start stream"), this._setState(TD.services.StreamEngine.CONNECTING), this._stream = this._createStreamRequest(), this._stream.goStreaming() | |
}, | |
_disconnectStream: function () { | |
this._stream && (this.log("Disconnect stream"), this._stream.onStreaming.disconnect && (this._stream.onStreaming.disconnect(this._handleData), this._stream.onFailure.disconnect(this._handleStreamInterruption)), this._stream.deleteLater(), this._stream = null), clearTimeout(this._backoffTimeout), clearTimeout(this._keepaliveTimeout), this._backoffTimeout = null, this._keepaliveTimeout = null | |
}, | |
_handleData: function (e) { | |
var t = this; | |
switch (this._state) { | |
case TD.services.StreamEngine.DISCONNECTED: | |
return; | |
case TD.services.StreamEngine.CONNECTING: | |
this._setState(TD.services.StreamEngine.STREAMING), this._backoffLimit = 0, this.log("Stream is functioning") | |
} | |
this._processDataString(e), clearTimeout(this._keepaliveTimeout), this._keepaliveTimeout = setTimeout(function () { | |
t._handleStreamInterruption("Keepalive timeout", 0) | |
}, TD.services.StreamEngine.KEEPALIVE_PERIOD), TD.util.isWrapperApp() || this._stream.receivedChars > TD.services.StreamEngine.XHR_BYTE_LIMIT && (this.log("Reached XHR byte limit, reconnecting"), this._startNewStream()) | |
}, | |
_processDataString: function (e) { | |
var t, i, n = 0; | |
if (e) { | |
t = e.split("\r"); | |
for (var r = 0; r < t.length; r++) i = _.strip(t[r]), i.length && (n++, this._callback(JSON.parse(i))); | |
$(document).trigger("dataReceivedStreamData", { | |
numStreamItems: n | |
}) | |
} | |
}, | |
_handleStreamInterruption: function (e, t) { | |
switch (this.log("Stream interrupted", e, t), this._state) { | |
case TD.services.StreamEngine.DISCONNECTED: | |
break; | |
case TD.services.StreamEngine.CONNECTING: | |
this._disconnectStream(), this._setBackoffTimeout(t); | |
break; | |
case TD.services.StreamEngine.STREAMING: | |
this._startNewStream() | |
} | |
}, | |
_setBackoffTimeout: function (e) { | |
var t = this; | |
this._backoffLimit = Math.max(this._backoffLimit, TD.services.StreamEngine.BACKOFF_PERIOD_MIN), this._backoffLimit *= 2, this._backoffLimit = "420" === String(e) ? Math.min(this._backoffLimit, TD.services.StreamEngine.BACKOFF_PERIOD_MAX_EXTENDED) : Math.min(this._backoffLimit, TD.services.StreamEngine.BACKOFF_PERIOD_MAX); | |
var i = this._backoffLimit / 2, | |
n = i + Math.ceil(Math.random() * i); | |
this.log("Set backoff timeout", (n / 1e3).toString() + "s"), this._setState(TD.services.StreamEngine.CONNECTING), this._backoffTimeout = setTimeout(function () { | |
t.log("Backoff complete, attempting reconnect"), t._startNewStream() | |
}, n) | |
}, | |
_createStreamRequest: function () { | |
var e; | |
return e = TD.util.isWrapperApp() && deck.signedRequestFactory ? deck.signedRequestFactory("GET", this._url, "", "", "", this._account.getOAuthToken(), this._account.getTokenSecret()) : new TD.net.StreamRequest(this._url, this._account), e.onStreaming.connect(this._handleData), e.onFailure.connect(this._handleStreamInterruption), e | |
} | |
}), TD.services.TwitterAction = function (e) { | |
this.account = e | |
}, TD.services.TwitterAction.FAVORITE = "favorite", TD.services.TwitterAction.RETWEET = "retweet", TD.services.TwitterAction.MENTION = "mention", TD.services.TwitterAction.REPLY = "reply", TD.services.TwitterAction.FOLLOW = "follow", TD.services.TwitterAction.LIST_MEMBER_ADDED = "list_member_added", TD.services.TwitterAction.LIST_CREATED = "list_created", TD.services.TwitterAction.UNFAVORITE = "unfavorite", TD.services.TwitterAction.LIST_MEMBER_REMOVED = "list_member_removed", TD.services.TwitterAction.LIST_DESTROYED = "list_destroyed", TD.services.TwitterAction.UNFOLLOW = "unfollow", TD.services.TwitterAction.processStreamAction = function (e, t) { | |
var i = TD.services.TwitterAction._getActionConstructor(e.event); | |
return new i(t).fromJSONObject(e, null, !0) | |
}, TD.services.TwitterAction.processRESTAction = function (e, t) { | |
for (var i = TD.services.TwitterAction._getActionConstructor(e.action), n = e.sources, r = e.targets_size > 0 ? e.targets : [void 0], s = e.target_objects_size > 0 ? e.target_objects : [void 0], o = [], a = 0; a < n.length; a++) | |
if (e.action !== TD.services.TwitterAction.RETWEET) | |
for (var c = 0; c < r.length; c++) | |
for (var u = 0; u < s.length; u++)(e.action !== TD.services.TwitterAction.LIST_MEMBER_ADDED || n[a].id === s[u].user.id) && o.push([e, n[a], r[c], s[u]]); | |
else { | |
if (s[0].user.id != t.getUserID()) continue; | |
o.push([e, n[a], r[a], s[0]]) | |
} | |
var l = _.map(o, function (n) { | |
return new i(t).fromJSONObject(e, n, !1) | |
}); | |
return l | |
}, TD.services.TwitterAction._getActionConstructor = function (e) { | |
switch (e) { | |
case TD.services.TwitterAction.MENTION: | |
case TD.services.TwitterAction.REPLY: | |
return TD.services.TwitterActionMention; | |
case TD.services.TwitterAction.FAVORITE: | |
case TD.services.TwitterAction.UNFAVORITE: | |
return TD.services.TwitterActionFavorite; | |
case TD.services.TwitterAction.RETWEET: | |
return TD.services.TwitterActionRetweet; | |
case TD.services.TwitterAction.FOLLOW: | |
case TD.services.TwitterAction.UNFOLLOW: | |
return TD.services.TwitterActionFollow; | |
case TD.services.TwitterAction.LIST_MEMBER_ADDED: | |
case TD.services.TwitterAction.LIST_MEMBER_REMOVED: | |
return TD.services.TwitterActionListMemberAdded; | |
case TD.services.TwitterAction.LIST_CREATED: | |
case TD.services.TwitterAction.LIST_DESTROYED: | |
return TD.services.TwitterActionListCreated; | |
default: | |
return TD.services.TwitterAction | |
} | |
}, TD.services.TwitterAction.prototype = new TD.services.ChirpBase, TD.services.TwitterAction.prototype.getChirpType = function () { | |
return this.action | |
}, TD.services.TwitterAction.prototype.action = null, TD.services.TwitterAction.prototype.maxPosition = null, TD.services.TwitterAction.prototype.minPosition = null, TD.services.TwitterAction.msFudge = 0, TD.services.TwitterAction.prototype.fromJSONObject = function (e, t, i) { | |
return i ? this.fromStreamData(e) : this.fromRESTData.apply(this, t), this.created = TD.util.parseDateString(e.created_at), this.maxPosition = e.max_position || this.created.getTime().toString(), this.minPosition = e.min_position || this.created.getTime().toString(), this.generateInternalID(), this.generateText(), this | |
}, TD.services.TwitterAction.prototype.fromRESTData = function () { | |
throw "TwitterAction.fromRESTData not implemented" | |
}, TD.services.TwitterAction.prototype.fromStreamData = function () { | |
throw "TwitterAction.fromStreamData not implemented" | |
}, TD.services.TwitterAction.prototype.generateInternalID = function () { | |
throw "TwitterAction.generateInternalID not implemented" | |
}, TD.services.TwitterAction.prototype.generateText = function () {}, TD.services.TwitterAction.prototype.render = function () { | |
throw "TwitterAction.render not implemented" | |
}, TD.services.TwitterAction.prototype.renderNotification = function () { | |
throw "TwitterAction.renderNotification not implemented" | |
}, TD.services.TwitterAction.prototype.isAboutYou = function () { | |
throw "TwitterAction.isAboutYou not implemented" | |
}, TD.services.TwitterAction.prototype.isOwnChirp = function () { | |
throw "TwitterAction.isOwnChirp not implemented" | |
}, TD.services.TwitterAction.prototype.getChirpURL = function () { | |
return "https://twitter.com/activity" | |
}, TD.services.TwitterAction.prototype.getCreator = function () { | |
throw "TwitterAction.getCreator not implemented" | |
}, TD.services.TwitterAction.prototype.getSenders = function () { | |
return [this.getCreator().screenName] | |
}, TD.services.TwitterAction.prototype.isFromVerifiedUser = function () { | |
return this.getCreator().isVerified | |
}, TD.services.TwitterAction.prototype.getTargetUsers = function () { | |
throw "TwitterAction.getTargetUsers not implemented" | |
}, TD.services.TwitterActionOnTweet = function (e) { | |
this.account = e | |
}, TD.services.TwitterActionOnTweet.prototype = new TD.services.TwitterAction, TD.services.TwitterActionOnTweet.prototype.sourceUser = null, TD.services.TwitterActionOnTweet.prototype.targetTweet = null, TD.services.TwitterActionOnTweet.prototype.generateInternalID = function () { | |
this.id = [this.action, this.sourceUser.id, this.targetTweet.id].join("_") | |
}, TD.services.TwitterActionOnTweet.prototype.isAboutYou = function () { | |
return this.targetTweet.user.id == this.account.getUserID() | |
}, TD.services.TwitterActionOnTweet.prototype.isOwnChirp = function () { | |
return this.sourceUser.id == this.account.getUserID() | |
}, TD.services.TwitterActionOnTweet.prototype.getRelatedTweet = function () { | |
return this.targetTweet | |
}, TD.services.TwitterActionOnTweet.prototype.getCreator = function () { | |
return this.sourceUser | |
}, TD.services.TwitterActionOnTweet.prototype.render = function (e) { | |
e = e || {}; | |
var t = TD.settings.getDisplaySensitiveMedia(), | |
i = this.isAboutYou(), | |
n = this.action === TD.services.TwitterAction.MENTION; | |
return TD.ui.template.render("status/tweet_activity_in_stream", $.extend(e, { | |
chirp: this, | |
sourceAvatar: i ? this.sourceUser.miniProfileImageURL() : null, | |
withActivityHeader: !n, | |
withTweetActions: !0, | |
withFooter: !0, | |
withAvatar: !i || n, | |
withSourceMute: !i, | |
withContentMute: i && !n, | |
withMediaPreview: e.mediaPreviewSize !== TD.vo.Column.MEDIA_PREVIEW_OFF, | |
isMediaPreviewSmall: e.mediaPreviewSize === TD.vo.Column.MEDIA_PREVIEW_SIZE_SMALL, | |
isMediaPreviewLarge: e.mediaPreviewSize === TD.vo.Column.MEDIA_PREVIEW_SIZE_LARGE, | |
mediaPreviewSrc: function () { | |
return this.getMediaSrcForPreviewSize(e.mediaPreviewSize) | |
}, | |
thumbSizeClass: TD.services.TwitterMedia.thumbSizeClasses[e.mediaPreviewSize], | |
isPossiblySensitive: this.possiblySensitive && !t, | |
withLinebreaks: !0 | |
})) | |
}, TD.services.TwitterActionOnTweet.prototype.renderNotification = function () { | |
var e = this.isAboutYou(), | |
t = this.action === TD.services.TwitterAction.MENTION; | |
return TD.ui.template.render("status/tweet_activity_in_box", { | |
chirp: this, | |
icon: this.iconClass, | |
sourceAvatar: e ? this.sourceUser.miniProfileImageURL() : null, | |
withAvatar: !e || t, | |
withActivityHeader: !t, | |
withSourceMute: !e, | |
withContentMute: e && !t | |
}) | |
}, TD.services.TwitterActionOnTweet.prototype.getGrowlData = function () { | |
return { | |
title: this.text, | |
img: this.targetTweet.user.profileImageURL, | |
text: $("<div>" + this.targetTweet.htmlText + "</div>").text() | |
} | |
}, TD.services.TwitterActionOnTweet.prototype.getMedia = function () { | |
return this.getRelatedTweet().getMedia() | |
}, TD.services.TwitterActionOnTweet.prototype.getTargetUsers = function () { | |
return [this.targetTweet.user] | |
}, TD.services.TwitterActionRetweet = function (e) { | |
this.account = e | |
}, TD.services.TwitterActionRetweet.prototype = new TD.services.TwitterActionOnTweet, TD.services.TwitterActionRetweet.prototype.action = TD.services.TwitterAction.RETWEET, TD.services.TwitterActionRetweet.prototype.iconClass = "icon-retweet icon-retweet-color", TD.services.TwitterActionRetweet.prototype.retweet = null, TD.services.TwitterActionRetweet.prototype.fromRESTData = function (e, t, i, n) { | |
this.sourceUser = new TD.services.TwitterUser(this.account).fromJSONObject(t), this.retweet = new TD.services.TwitterStatus(this.account).fromJSONObject(i), this.targetTweet = new TD.services.TwitterStatus(this.account).fromJSONObject(n) | |
}, TD.services.TwitterActionRetweet.prototype.from |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment