Created
January 31, 2014 19:57
-
-
Save miketaylr/8741760 to your computer and use it in GitHub Desktop.
app.nytimes.com
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var requirejs, require, define; | |
!function(e) { | |
function t(e, t) { | |
return v.call(e, t); | |
} | |
function n(e, t) { | |
var n, r, i, o, s, a, u, l, c, d, p = t && t.split("/"), h = m.map, f = h && h["*"] || {}; | |
if (e && "." === e.charAt(0)) if (t) { | |
for (p = p.slice(0, p.length - 1), e = p.concat(e.split("/")), l = 0; l < e.length; l += 1) if (d = e[l], | |
"." === d) e.splice(l, 1), l -= 1; else if (".." === d) { | |
if (1 === l && (".." === e[2] || ".." === e[0])) break; | |
l > 0 && (e.splice(l - 1, 2), l -= 2); | |
} | |
e = e.join("/"); | |
} else 0 === e.indexOf("./") && (e = e.substring(2)); | |
if ((p || f) && h) { | |
for (n = e.split("/"), l = n.length; l > 0; l -= 1) { | |
if (r = n.slice(0, l).join("/"), p) for (c = p.length; c > 0; c -= 1) if (i = h[p.slice(0, c).join("/")], | |
i && (i = i[r])) { | |
o = i, s = l; | |
break; | |
} | |
if (o) break; | |
!a && f && f[r] && (a = f[r], u = l); | |
} | |
!o && a && (o = a, s = u), o && (n.splice(0, s, o), e = n.join("/")); | |
} | |
return e; | |
} | |
function r(t, n) { | |
return function() { | |
return c.apply(e, y.call(arguments, 0).concat([ t, n ])); | |
}; | |
} | |
function i(e) { | |
return function(t) { | |
return n(t, e); | |
}; | |
} | |
function o(e) { | |
return function(t) { | |
h[e] = t; | |
}; | |
} | |
function s(n) { | |
if (t(f, n)) { | |
var r = f[n]; | |
delete f[n], g[n] = !0, l.apply(e, r); | |
} | |
if (!t(h, n) && !t(g, n)) throw new Error("No " + n); | |
return h[n]; | |
} | |
function a(e) { | |
var t, n = e ? e.indexOf("!") : -1; | |
return n > -1 && (t = e.substring(0, n), e = e.substring(n + 1, e.length)), [ t, e ]; | |
} | |
function u(e) { | |
return function() { | |
return m && m.config && m.config[e] || {}; | |
}; | |
} | |
var l, c, d, p, h = {}, f = {}, m = {}, g = {}, v = Object.prototype.hasOwnProperty, y = [].slice; | |
d = function(e, t) { | |
var r, o = a(e), u = o[0]; | |
return e = o[1], u && (u = n(u, t), r = s(u)), u ? e = r && r.normalize ? r.normalize(e, i(t)) : n(e, t) : (e = n(e, t), | |
o = a(e), u = o[0], e = o[1], u && (r = s(u))), { | |
f: u ? u + "!" + e : e, | |
n: e, | |
pr: u, | |
p: r | |
}; | |
}, p = { | |
require: function(e) { | |
return r(e); | |
}, | |
exports: function(e) { | |
var t = h[e]; | |
return "undefined" != typeof t ? t : h[e] = {}; | |
}, | |
module: function(e) { | |
return { | |
id: e, | |
uri: "", | |
exports: h[e], | |
config: u(e) | |
}; | |
} | |
}, l = function(n, i, a, u) { | |
var l, c, m, v, y, w, b = [], _ = typeof a; | |
if (u = u || n, "undefined" === _ || "function" === _) { | |
for (i = !i.length && a.length ? [ "require", "exports", "module" ] : i, y = 0; y < i.length; y += 1) if (v = d(i[y], u), | |
c = v.f, "require" === c) b[y] = p.require(n); else if ("exports" === c) b[y] = p.exports(n), | |
w = !0; else if ("module" === c) l = b[y] = p.module(n); else if (t(h, c) || t(f, c) || t(g, c)) b[y] = s(c); else { | |
if (!v.p) throw new Error(n + " missing " + c); | |
v.p.load(v.n, r(u, !0), o(c), {}), b[y] = h[c]; | |
} | |
m = a ? a.apply(h[n], b) : void 0, n && (l && l.exports !== e && l.exports !== h[n] ? h[n] = l.exports : m === e && w || (h[n] = m)); | |
} else n && (h[n] = a); | |
}, requirejs = require = c = function(t, n, r, i, o) { | |
return "string" == typeof t ? p[t] ? p[t](n) : s(d(t, n).f) : (t.splice || (m = t, | |
n.splice ? (t = n, n = r, r = null) : t = e), n = n || function() {}, "function" == typeof r && (r = i, | |
i = o), i ? l(e, t, n, r) : setTimeout(function() { | |
l(e, t, n, r); | |
}, 4), c); | |
}, c.config = function(e) { | |
return m = e, m.deps && c(m.deps, m.callback), c; | |
}, requirejs._defined = h, define = function(e, n, r) { | |
n.splice || (r = n, n = []), t(h, e) || t(f, e) || (f[e] = [ e, n, r ]); | |
}, define.amd = { | |
jQuery: !0 | |
}; | |
}(), define("components/almond/almond", function() {}), function() { | |
define("config", [ "require", "exports", "module" ], function(e, t, n) { | |
var r, i; | |
return r = 1048576, i = navigator.userAgent.indexOf("PhantomJS") > -1, n.exports = { | |
DB_SIZE: i ? 5 * r : /(iPad|iPhone|iPod).*OS 7_/.test(navigator.userAgent) ? 1 * r : 50 * r, | |
LOG_LEVEL: "DEBUG" | |
}; | |
}); | |
}.call(this), function(e, t) { | |
function n(e) { | |
var t = e.length, n = ot.type(e); | |
return ot.isWindow(e) ? !1 : 1 === e.nodeType && t ? !0 : "array" === n || "function" !== n && (0 === t || "number" == typeof t && t > 0 && t - 1 in e); | |
} | |
function r(e) { | |
var t = ft[e] = {}; | |
return ot.each(e.match(at) || [], function(e, n) { | |
t[n] = !0; | |
}), t; | |
} | |
function i() { | |
Object.defineProperty(this.cache = {}, 0, { | |
get: function() { | |
return {}; | |
} | |
}), this.expando = ot.expando + Math.random(); | |
} | |
function o(e, n, r) { | |
var i; | |
if (r === t && 1 === e.nodeType) if (i = "data-" + n.replace(yt, "-$1").toLowerCase(), | |
r = e.getAttribute(i), "string" == typeof r) { | |
try { | |
r = "true" === r ? !0 : "false" === r ? !1 : "null" === r ? null : +r + "" === r ? +r : vt.test(r) ? JSON.parse(r) : r; | |
} catch (o) {} | |
mt.set(e, n, r); | |
} else r = t; | |
return r; | |
} | |
function s() { | |
return !0; | |
} | |
function a() { | |
return !1; | |
} | |
function u() { | |
try { | |
return z.activeElement; | |
} catch (e) {} | |
} | |
function l(e, t) { | |
for (;(e = e[t]) && 1 !== e.nodeType; ) ; | |
return e; | |
} | |
function c(e, t, n) { | |
if (ot.isFunction(t)) return ot.grep(e, function(e, r) { | |
return !!t.call(e, r, e) !== n; | |
}); | |
if (t.nodeType) return ot.grep(e, function(e) { | |
return e === t !== n; | |
}); | |
if ("string" == typeof t) { | |
if (At.test(t)) return ot.filter(t, e, n); | |
t = ot.filter(t, e); | |
} | |
return ot.grep(e, function(e) { | |
return tt.call(t, e) >= 0 !== n; | |
}); | |
} | |
function d(e, t) { | |
return ot.nodeName(e, "table") && ot.nodeName(1 === 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 h(e) { | |
var t = Vt.exec(e.type); | |
return t ? e.type = t[1] : e.removeAttribute("type"), e; | |
} | |
function f(e, t) { | |
for (var n = e.length, r = 0; n > r; r++) gt.set(e[r], "globalEval", !t || gt.get(t[r], "globalEval")); | |
} | |
function m(e, t) { | |
var n, r, i, o, s, a, u, l; | |
if (1 === t.nodeType) { | |
if (gt.hasData(e) && (o = gt.access(e), s = gt.set(t, o), l = o.events)) { | |
delete s.handle, s.events = {}; | |
for (i in l) for (n = 0, r = l[i].length; r > n; n++) ot.event.add(t, i, l[i][n]); | |
} | |
mt.hasData(e) && (a = mt.access(e), u = ot.extend({}, a), mt.set(t, u)); | |
} | |
} | |
function g(e, n) { | |
var r = e.getElementsByTagName ? e.getElementsByTagName(n || "*") : e.querySelectorAll ? e.querySelectorAll(n || "*") : []; | |
return n === t || n && ot.nodeName(e, n) ? ot.merge([ e ], r) : r; | |
} | |
function v(e, t) { | |
var n = t.nodeName.toLowerCase(); | |
"input" === n && Rt.test(e.type) ? t.checked = e.checked : ("input" === n || "textarea" === n) && (t.defaultValue = e.defaultValue); | |
} | |
function y(e, t) { | |
if (t in e) return t; | |
for (var n = t.charAt(0).toUpperCase() + t.slice(1), r = t, i = Zt.length; i--; ) if (t = Zt[i] + n, | |
t in e) return t; | |
return r; | |
} | |
function w(e, t) { | |
return e = t || e, "none" === ot.css(e, "display") || !ot.contains(e.ownerDocument, e); | |
} | |
function b(t) { | |
return e.getComputedStyle(t, null); | |
} | |
function _(e, t) { | |
for (var n, r, i, o = [], s = 0, a = e.length; a > s; s++) r = e[s], r.style && (o[s] = gt.get(r, "olddisplay"), | |
n = r.style.display, t ? (o[s] || "none" !== n || (r.style.display = ""), "" === r.style.display && w(r) && (o[s] = gt.access(r, "olddisplay", S(r.nodeName)))) : o[s] || (i = w(r), | |
(n && "none" !== n || !i) && gt.set(r, "olddisplay", i ? n : ot.css(r, "display")))); | |
for (s = 0; a > s; s++) r = e[s], r.style && (t && "none" !== r.style.display && "" !== r.style.display || (r.style.display = t ? o[s] || "" : "none")); | |
return e; | |
} | |
function x(e, t, n) { | |
var r = Yt.exec(t); | |
return r ? Math.max(0, r[1] - (n || 0)) + (r[2] || "px") : t; | |
} | |
function E(e, t, n, r, i) { | |
for (var o = n === (r ? "border" : "content") ? 4 : "width" === t ? 1 : 0, s = 0; 4 > o; o += 2) "margin" === n && (s += ot.css(e, n + Qt[o], !0, i)), | |
r ? ("content" === n && (s -= ot.css(e, "padding" + Qt[o], !0, i)), "margin" !== n && (s -= ot.css(e, "border" + Qt[o] + "Width", !0, i))) : (s += ot.css(e, "padding" + Qt[o], !0, i), | |
"padding" !== n && (s += ot.css(e, "border" + Qt[o] + "Width", !0, i))); | |
return s; | |
} | |
function k(e, t, n) { | |
var r = !0, i = "width" === t ? e.offsetWidth : e.offsetHeight, o = b(e), s = ot.support.boxSizing && "border-box" === ot.css(e, "boxSizing", !1, o); | |
if (0 >= i || null == i) { | |
if (i = Ft(e, t, o), (0 > i || null == i) && (i = e.style[t]), Wt.test(i)) return i; | |
r = s && (ot.support.boxSizingReliable || i === e.style[t]), i = parseFloat(i) || 0; | |
} | |
return i + E(e, t, n || (s ? "border" : "content"), r, o) + "px"; | |
} | |
function S(e) { | |
var t = z, n = Gt[e]; | |
return n || (n = T(e, t), "none" !== n && n || (Ht = (Ht || ot("<iframe frameborder='0' width='0' height='0'/>").css("cssText", "display:block !important")).appendTo(t.documentElement), | |
t = (Ht[0].contentWindow || Ht[0].contentDocument).document, t.write("<!doctype html><html><body>"), | |
t.close(), n = T(e, t), Ht.detach()), Gt[e] = n), n; | |
} | |
function T(e, t) { | |
var n = ot(t.createElement(e)).appendTo(t.body), r = ot.css(n[0], "display"); | |
return n.remove(), r; | |
} | |
function C(e, t, n, r) { | |
var i; | |
if (ot.isArray(t)) ot.each(t, function(t, i) { | |
n || tn.test(e) ? r(e, i) : C(e + "[" + ("object" == typeof i ? t : "") + "]", i, n, r); | |
}); else if (n || "object" !== ot.type(t)) r(e, t); else for (i in t) C(e + "[" + i + "]", t[i], n, r); | |
} | |
function A(e) { | |
return function(t, n) { | |
"string" != typeof t && (n = t, t = "*"); | |
var r, i = 0, o = t.toLowerCase().match(at) || []; | |
if (ot.isFunction(n)) for (;r = o[i++]; ) "+" === r[0] ? (r = r.slice(1) || "*", | |
(e[r] = e[r] || []).unshift(n)) : (e[r] = e[r] || []).push(n); | |
}; | |
} | |
function D(e, t, n, r) { | |
function i(a) { | |
var u; | |
return o[a] = !0, ot.each(e[a] || [], function(e, a) { | |
var l = a(t, n, r); | |
return "string" != typeof l || s || o[l] ? s ? !(u = l) : void 0 : (t.dataTypes.unshift(l), | |
i(l), !1); | |
}), u; | |
} | |
var o = {}, s = e === wn; | |
return i(t.dataTypes[0]) || !o["*"] && i("*"); | |
} | |
function N(e, n) { | |
var r, i, o = ot.ajaxSettings.flatOptions || {}; | |
for (r in n) n[r] !== t && ((o[r] ? e : i || (i = {}))[r] = n[r]); | |
return i && ot.extend(!0, e, i), e; | |
} | |
function O(e, n, r) { | |
for (var i, o, s, a, u = e.contents, l = e.dataTypes; "*" === l[0]; ) l.shift(), | |
i === t && (i = e.mimeType || n.getResponseHeader("Content-Type")); | |
if (i) for (o in u) if (u[o] && u[o].test(i)) { | |
l.unshift(o); | |
break; | |
} | |
if (l[0] in r) s = l[0]; else { | |
for (o in r) { | |
if (!l[0] || e.converters[o + " " + l[0]]) { | |
s = o; | |
break; | |
} | |
a || (a = o); | |
} | |
s = s || a; | |
} | |
return s ? (s !== l[0] && l.unshift(s), r[s]) : void 0; | |
} | |
function M(e, t, n, r) { | |
var i, o, s, a, u, l = {}, c = e.dataTypes.slice(); | |
if (c[1]) for (s in e.converters) l[s.toLowerCase()] = e.converters[s]; | |
for (o = c.shift(); o; ) if (e.responseFields[o] && (n[e.responseFields[o]] = t), | |
!u && r && e.dataFilter && (t = e.dataFilter(t, e.dataType)), u = o, o = c.shift()) if ("*" === o) o = u; else if ("*" !== u && u !== o) { | |
if (s = l[u + " " + o] || l["* " + o], !s) for (i in l) if (a = i.split(" "), a[1] === o && (s = l[u + " " + a[0]] || l["* " + a[0]])) { | |
s === !0 ? s = l[i] : l[i] !== !0 && (o = a[0], c.unshift(a[1])); | |
break; | |
} | |
if (s !== !0) if (s && e["throws"]) t = s(t); else try { | |
t = s(t); | |
} catch (d) { | |
return { | |
state: "parsererror", | |
error: s ? d : "No conversion from " + u + " to " + o | |
}; | |
} | |
} | |
return { | |
state: "success", | |
data: t | |
}; | |
} | |
function j() { | |
return setTimeout(function() { | |
An = t; | |
}), An = ot.now(); | |
} | |
function I(e, t, n) { | |
for (var r, i = (In[t] || []).concat(In["*"]), o = 0, s = i.length; s > o; o++) if (r = i[o].call(n, t, e)) return r; | |
} | |
function P(e, t, n) { | |
var r, i, o = 0, s = jn.length, a = ot.Deferred().always(function() { | |
delete u.elem; | |
}), u = function() { | |
if (i) return !1; | |
for (var t = An || j(), n = Math.max(0, l.startTime + l.duration - t), r = n / l.duration || 0, o = 1 - r, s = 0, u = l.tweens.length; u > s; s++) l.tweens[s].run(o); | |
return a.notifyWith(e, [ l, o, n ]), 1 > o && u ? n : (a.resolveWith(e, [ l ]), | |
!1); | |
}, l = a.promise({ | |
elem: e, | |
props: ot.extend({}, t), | |
opts: ot.extend(!0, { | |
specialEasing: {} | |
}, n), | |
originalProperties: t, | |
originalOptions: n, | |
startTime: An || j(), | |
duration: n.duration, | |
tweens: [], | |
createTween: function(t, n) { | |
var r = ot.Tween(e, l.opts, t, n, l.opts.specialEasing[t] || l.opts.easing); | |
return l.tweens.push(r), r; | |
}, | |
stop: function(t) { | |
var n = 0, r = t ? l.tweens.length : 0; | |
if (i) return this; | |
for (i = !0; r > n; n++) l.tweens[n].run(1); | |
return t ? a.resolveWith(e, [ l, t ]) : a.rejectWith(e, [ l, t ]), this; | |
} | |
}), c = l.props; | |
for (R(c, l.opts.specialEasing); s > o; o++) if (r = jn[o].call(l, e, c, l.opts)) return r; | |
return ot.map(c, I, l), ot.isFunction(l.opts.start) && l.opts.start.call(e, l), | |
ot.fx.timer(ot.extend(u, { | |
elem: e, | |
anim: l, | |
queue: l.opts.queue | |
})), l.progress(l.opts.progress).done(l.opts.done, l.opts.complete).fail(l.opts.fail).always(l.opts.always); | |
} | |
function R(e, t) { | |
var n, r, i, o, s; | |
for (n in e) if (r = ot.camelCase(n), i = t[r], o = e[n], ot.isArray(o) && (i = o[1], | |
o = e[n] = o[0]), n !== r && (e[r] = o, delete e[n]), s = ot.cssHooks[r], s && "expand" in s) { | |
o = s.expand(o), delete e[r]; | |
for (n in o) n in e || (e[n] = o[n], t[n] = i); | |
} else t[r] = i; | |
} | |
function $(e, n, r) { | |
var i, o, s, a, u, l, c = this, d = {}, p = e.style, h = e.nodeType && w(e), f = gt.get(e, "fxshow"); | |
r.queue || (u = ot._queueHooks(e, "fx"), null == u.unqueued && (u.unqueued = 0, | |
l = u.empty.fire, u.empty.fire = function() { | |
u.unqueued || l(); | |
}), u.unqueued++, c.always(function() { | |
c.always(function() { | |
u.unqueued--, ot.queue(e, "fx").length || u.empty.fire(); | |
}); | |
})), 1 === e.nodeType && ("height" in n || "width" in n) && (r.overflow = [ p.overflow, p.overflowX, p.overflowY ], | |
"inline" === ot.css(e, "display") && "none" === ot.css(e, "float") && (p.display = "inline-block")), | |
r.overflow && (p.overflow = "hidden", c.always(function() { | |
p.overflow = r.overflow[0], p.overflowX = r.overflow[1], p.overflowY = r.overflow[2]; | |
})); | |
for (i in n) if (o = n[i], Nn.exec(o)) { | |
if (delete n[i], s = s || "toggle" === o, o === (h ? "hide" : "show")) { | |
if ("show" !== o || !f || f[i] === t) continue; | |
h = !0; | |
} | |
d[i] = f && f[i] || ot.style(e, i); | |
} | |
if (!ot.isEmptyObject(d)) { | |
f ? "hidden" in f && (h = f.hidden) : f = gt.access(e, "fxshow", {}), s && (f.hidden = !h), | |
h ? ot(e).show() : c.done(function() { | |
ot(e).hide(); | |
}), c.done(function() { | |
var t; | |
gt.remove(e, "fxshow"); | |
for (t in d) ot.style(e, t, d[t]); | |
}); | |
for (i in d) a = I(h ? f[i] : 0, i, c), i in f || (f[i] = a.start, h && (a.end = a.start, | |
a.start = "width" === i || "height" === i ? 1 : 0)); | |
} | |
} | |
function L(e, t, n, r, i) { | |
return new L.prototype.init(e, t, n, r, i); | |
} | |
function V(e, t) { | |
var n, r = { | |
height: e | |
}, i = 0; | |
for (t = t ? 1 : 0; 4 > i; i += 2 - t) n = Qt[i], r["margin" + n] = r["padding" + n] = e; | |
return t && (r.opacity = r.width = e), r; | |
} | |
function q(e) { | |
return ot.isWindow(e) ? e : 9 === e.nodeType && e.defaultView; | |
} | |
var U, F, H = typeof t, B = e.location, z = e.document, Y = z.documentElement, W = e.jQuery, X = e.$, G = {}, J = [], K = "2.0.3", Q = J.concat, Z = J.push, et = J.slice, tt = J.indexOf, nt = G.toString, rt = G.hasOwnProperty, it = K.trim, ot = function(e, t) { | |
return new ot.fn.init(e, t, U); | |
}, st = /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source, at = /\S+/g, ut = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/, lt = /^<(\w+)\s*\/?>(?:<\/\1>|)$/, ct = /^-ms-/, dt = /-([\da-z])/gi, pt = function(e, t) { | |
return t.toUpperCase(); | |
}, ht = function() { | |
z.removeEventListener("DOMContentLoaded", ht, !1), e.removeEventListener("load", ht, !1), | |
ot.ready(); | |
}; | |
ot.fn = ot.prototype = { | |
jquery: K, | |
constructor: ot, | |
init: function(e, n, r) { | |
var i, o; | |
if (!e) return this; | |
if ("string" == typeof e) { | |
if (i = "<" === e.charAt(0) && ">" === e.charAt(e.length - 1) && e.length >= 3 ? [ null, e, null ] : ut.exec(e), | |
!i || !i[1] && n) return !n || n.jquery ? (n || r).find(e) : this.constructor(n).find(e); | |
if (i[1]) { | |
if (n = n instanceof ot ? n[0] : n, ot.merge(this, ot.parseHTML(i[1], n && n.nodeType ? n.ownerDocument || n : z, !0)), | |
lt.test(i[1]) && ot.isPlainObject(n)) for (i in n) ot.isFunction(this[i]) ? this[i](n[i]) : this.attr(i, n[i]); | |
return this; | |
} | |
return o = z.getElementById(i[2]), o && o.parentNode && (this.length = 1, this[0] = o), | |
this.context = z, this.selector = e, this; | |
} | |
return e.nodeType ? (this.context = this[0] = e, this.length = 1, this) : ot.isFunction(e) ? r.ready(e) : (e.selector !== t && (this.selector = e.selector, | |
this.context = e.context), ot.makeArray(e, this)); | |
}, | |
selector: "", | |
length: 0, | |
toArray: function() { | |
return et.call(this); | |
}, | |
get: function(e) { | |
return null == e ? this.toArray() : 0 > e ? this[this.length + e] : this[e]; | |
}, | |
pushStack: function(e) { | |
var t = ot.merge(this.constructor(), e); | |
return t.prevObject = this, t.context = this.context, t; | |
}, | |
each: function(e, t) { | |
return ot.each(this, e, t); | |
}, | |
ready: function(e) { | |
return ot.ready.promise().done(e), this; | |
}, | |
slice: function() { | |
return this.pushStack(et.apply(this, arguments)); | |
}, | |
first: function() { | |
return this.eq(0); | |
}, | |
last: function() { | |
return this.eq(-1); | |
}, | |
eq: function(e) { | |
var t = this.length, n = +e + (0 > e ? t : 0); | |
return this.pushStack(n >= 0 && t > n ? [ this[n] ] : []); | |
}, | |
map: function(e) { | |
return this.pushStack(ot.map(this, function(t, n) { | |
return e.call(t, n, t); | |
})); | |
}, | |
end: function() { | |
return this.prevObject || this.constructor(null); | |
}, | |
push: Z, | |
sort: [].sort, | |
splice: [].splice | |
}, ot.fn.init.prototype = ot.fn, ot.extend = ot.fn.extend = function() { | |
var e, n, r, i, o, s, a = arguments[0] || {}, u = 1, l = arguments.length, c = !1; | |
for ("boolean" == typeof a && (c = a, a = arguments[1] || {}, u = 2), "object" == typeof a || ot.isFunction(a) || (a = {}), | |
l === u && (a = this, --u); l > u; u++) if (null != (e = arguments[u])) for (n in e) r = a[n], | |
i = e[n], a !== i && (c && i && (ot.isPlainObject(i) || (o = ot.isArray(i))) ? (o ? (o = !1, | |
s = r && ot.isArray(r) ? r : []) : s = r && ot.isPlainObject(r) ? r : {}, a[n] = ot.extend(c, s, i)) : i !== t && (a[n] = i)); | |
return a; | |
}, ot.extend({ | |
expando: "jQuery" + (K + Math.random()).replace(/\D/g, ""), | |
noConflict: function(t) { | |
return e.$ === ot && (e.$ = X), t && e.jQuery === ot && (e.jQuery = W), ot; | |
}, | |
isReady: !1, | |
readyWait: 1, | |
holdReady: function(e) { | |
e ? ot.readyWait++ : ot.ready(!0); | |
}, | |
ready: function(e) { | |
(e === !0 ? --ot.readyWait : ot.isReady) || (ot.isReady = !0, e !== !0 && --ot.readyWait > 0 || (F.resolveWith(z, [ ot ]), | |
ot.fn.trigger && ot(z).trigger("ready").off("ready"))); | |
}, | |
isFunction: function(e) { | |
return "function" === ot.type(e); | |
}, | |
isArray: Array.isArray, | |
isWindow: function(e) { | |
return null != e && e === e.window; | |
}, | |
isNumeric: function(e) { | |
return !isNaN(parseFloat(e)) && isFinite(e); | |
}, | |
type: function(e) { | |
return null == e ? String(e) : "object" == typeof e || "function" == typeof e ? G[nt.call(e)] || "object" : typeof e; | |
}, | |
isPlainObject: function(e) { | |
if ("object" !== ot.type(e) || e.nodeType || ot.isWindow(e)) return !1; | |
try { | |
if (e.constructor && !rt.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; | |
}, | |
error: function(e) { | |
throw new Error(e); | |
}, | |
parseHTML: function(e, t, n) { | |
if (!e || "string" != typeof e) return null; | |
"boolean" == typeof t && (n = t, t = !1), t = t || z; | |
var r = lt.exec(e), i = !n && []; | |
return r ? [ t.createElement(r[1]) ] : (r = ot.buildFragment([ e ], t, i), i && ot(i).remove(), | |
ot.merge([], r.childNodes)); | |
}, | |
parseJSON: JSON.parse, | |
parseXML: function(e) { | |
var n, r; | |
if (!e || "string" != typeof e) return null; | |
try { | |
r = new DOMParser(), n = r.parseFromString(e, "text/xml"); | |
} catch (i) { | |
n = t; | |
} | |
return (!n || n.getElementsByTagName("parsererror").length) && ot.error("Invalid XML: " + e), | |
n; | |
}, | |
noop: function() {}, | |
globalEval: function(e) { | |
var t, n = eval; | |
e = ot.trim(e), e && (1 === e.indexOf("use strict") ? (t = z.createElement("script"), | |
t.text = e, z.head.appendChild(t).parentNode.removeChild(t)) : n(e)); | |
}, | |
camelCase: function(e) { | |
return e.replace(ct, "ms-").replace(dt, pt); | |
}, | |
nodeName: function(e, t) { | |
return e.nodeName && e.nodeName.toLowerCase() === t.toLowerCase(); | |
}, | |
each: function(e, t, r) { | |
var i, o = 0, s = e.length, a = n(e); | |
if (r) { | |
if (a) for (;s > o && (i = t.apply(e[o], r), i !== !1); o++) ; else for (o in e) if (i = t.apply(e[o], r), | |
i === !1) break; | |
} else if (a) for (;s > o && (i = t.call(e[o], o, e[o]), i !== !1); o++) ; else for (o in e) if (i = t.call(e[o], o, e[o]), | |
i === !1) break; | |
return e; | |
}, | |
trim: function(e) { | |
return null == e ? "" : it.call(e); | |
}, | |
makeArray: function(e, t) { | |
var r = t || []; | |
return null != e && (n(Object(e)) ? ot.merge(r, "string" == typeof e ? [ e ] : e) : Z.call(r, e)), | |
r; | |
}, | |
inArray: function(e, t, n) { | |
return null == t ? -1 : tt.call(t, e, n); | |
}, | |
merge: function(e, n) { | |
var r = n.length, i = e.length, o = 0; | |
if ("number" == typeof r) for (;r > o; o++) e[i++] = n[o]; else for (;n[o] !== t; ) e[i++] = n[o++]; | |
return e.length = i, e; | |
}, | |
grep: function(e, t, n) { | |
var r, i = [], o = 0, s = e.length; | |
for (n = !!n; s > o; o++) r = !!t(e[o], o), n !== r && i.push(e[o]); | |
return i; | |
}, | |
map: function(e, t, r) { | |
var i, o = 0, s = e.length, a = n(e), u = []; | |
if (a) for (;s > o; o++) i = t(e[o], o, r), null != i && (u[u.length] = i); else for (o in e) i = t(e[o], o, r), | |
null != i && (u[u.length] = i); | |
return Q.apply([], u); | |
}, | |
guid: 1, | |
proxy: function(e, n) { | |
var r, i, o; | |
return "string" == typeof n && (r = e[n], n = e, e = r), ot.isFunction(e) ? (i = et.call(arguments, 2), | |
o = function() { | |
return e.apply(n || this, i.concat(et.call(arguments))); | |
}, o.guid = e.guid = e.guid || ot.guid++, o) : t; | |
}, | |
access: function(e, n, r, i, o, s, a) { | |
var u = 0, l = e.length, c = null == r; | |
if ("object" === ot.type(r)) { | |
o = !0; | |
for (u in r) ot.access(e, n, u, r[u], !0, s, a); | |
} else if (i !== t && (o = !0, ot.isFunction(i) || (a = !0), c && (a ? (n.call(e, i), | |
n = null) : (c = n, n = function(e, t, n) { | |
return c.call(ot(e), n); | |
})), n)) for (;l > u; u++) n(e[u], r, a ? i : i.call(e[u], u, n(e[u], r))); | |
return o ? e : c ? n.call(e) : l ? n(e[0], r) : s; | |
}, | |
now: Date.now, | |
swap: function(e, t, n, r) { | |
var i, o, s = {}; | |
for (o in t) s[o] = e.style[o], e.style[o] = t[o]; | |
i = n.apply(e, r || []); | |
for (o in t) e.style[o] = s[o]; | |
return i; | |
} | |
}), ot.ready.promise = function(t) { | |
return F || (F = ot.Deferred(), "complete" === z.readyState ? setTimeout(ot.ready) : (z.addEventListener("DOMContentLoaded", ht, !1), | |
e.addEventListener("load", ht, !1))), F.promise(t); | |
}, ot.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(e, t) { | |
G["[object " + t + "]"] = t.toLowerCase(); | |
}), U = ot(z), function(e, t) { | |
function n(e, t, n, r) { | |
var i, o, s, a, u, l, c, d, f, m; | |
if ((t ? t.ownerDocument || t : q) !== M && O(t), t = t || M, n = n || [], !e || "string" != typeof e) return n; | |
if (1 !== (a = t.nodeType) && 9 !== a) return []; | |
if (I && !r) { | |
if (i = wt.exec(e)) if (s = i[1]) { | |
if (9 === a) { | |
if (o = t.getElementById(s), !o || !o.parentNode) return n; | |
if (o.id === s) return n.push(o), n; | |
} else if (t.ownerDocument && (o = t.ownerDocument.getElementById(s)) && L(t, o) && o.id === s) return n.push(o), | |
n; | |
} else { | |
if (i[2]) return et.apply(n, t.getElementsByTagName(e)), n; | |
if ((s = i[3]) && E.getElementsByClassName && t.getElementsByClassName) return et.apply(n, t.getElementsByClassName(s)), | |
n; | |
} | |
if (E.qsa && (!P || !P.test(e))) { | |
if (d = c = V, f = t, m = 9 === a && e, 1 === a && "object" !== t.nodeName.toLowerCase()) { | |
for (l = p(e), (c = t.getAttribute("id")) ? d = c.replace(xt, "\\$&") : t.setAttribute("id", d), | |
d = "[id='" + d + "'] ", u = l.length; u--; ) l[u] = d + h(l[u]); | |
f = ht.test(e) && t.parentNode || t, m = l.join(","); | |
} | |
if (m) try { | |
return et.apply(n, f.querySelectorAll(m)), n; | |
} catch (g) {} finally { | |
c || t.removeAttribute("id"); | |
} | |
} | |
} | |
return _(e.replace(ct, "$1"), t, n, r); | |
} | |
function r() { | |
function e(n, r) { | |
return t.push(n += " ") > S.cacheLength && delete e[t.shift()], e[n] = r; | |
} | |
var t = []; | |
return e; | |
} | |
function i(e) { | |
return e[V] = !0, e; | |
} | |
function o(e) { | |
var t = M.createElement("div"); | |
try { | |
return !!e(t); | |
} catch (n) { | |
return !1; | |
} finally { | |
t.parentNode && t.parentNode.removeChild(t), t = null; | |
} | |
} | |
function s(e, t) { | |
for (var n = e.split("|"), r = e.length; r--; ) S.attrHandle[n[r]] = t; | |
} | |
function a(e, t) { | |
var n = t && e, r = n && 1 === e.nodeType && 1 === t.nodeType && (~t.sourceIndex || G) - (~e.sourceIndex || G); | |
if (r) return r; | |
if (n) for (;n = n.nextSibling; ) if (n === t) return -1; | |
return e ? 1 : -1; | |
} | |
function u(e) { | |
return function(t) { | |
var n = t.nodeName.toLowerCase(); | |
return "input" === n && t.type === e; | |
}; | |
} | |
function l(e) { | |
return function(t) { | |
var n = t.nodeName.toLowerCase(); | |
return ("input" === n || "button" === n) && t.type === e; | |
}; | |
} | |
function c(e) { | |
return i(function(t) { | |
return t = +t, i(function(n, r) { | |
for (var i, o = e([], n.length, t), s = o.length; s--; ) n[i = o[s]] && (n[i] = !(r[i] = n[i])); | |
}); | |
}); | |
} | |
function d() {} | |
function p(e, t) { | |
var r, i, o, s, a, u, l, c = B[e + " "]; | |
if (c) return t ? 0 : c.slice(0); | |
for (a = e, u = [], l = S.preFilter; a; ) { | |
(!r || (i = dt.exec(a))) && (i && (a = a.slice(i[0].length) || a), u.push(o = [])), | |
r = !1, (i = pt.exec(a)) && (r = i.shift(), o.push({ | |
value: r, | |
type: i[0].replace(ct, " ") | |
}), a = a.slice(r.length)); | |
for (s in S.filter) !(i = vt[s].exec(a)) || l[s] && !(i = l[s](i)) || (r = i.shift(), | |
o.push({ | |
value: r, | |
type: s, | |
matches: i | |
}), a = a.slice(r.length)); | |
if (!r) break; | |
} | |
return t ? a.length : a ? n.error(e) : B(e, u).slice(0); | |
} | |
function h(e) { | |
for (var t = 0, n = e.length, r = ""; n > t; t++) r += e[t].value; | |
return r; | |
} | |
function f(e, t, n) { | |
var r = t.dir, i = n && "parentNode" === r, o = F++; | |
return t.first ? function(t, n, o) { | |
for (;t = t[r]; ) if (1 === t.nodeType || i) return e(t, n, o); | |
} : function(t, n, s) { | |
var a, u, l, c = U + " " + o; | |
if (s) { | |
for (;t = t[r]; ) if ((1 === t.nodeType || i) && e(t, n, s)) return !0; | |
} else for (;t = t[r]; ) if (1 === t.nodeType || i) if (l = t[V] || (t[V] = {}), | |
(u = l[r]) && u[0] === c) { | |
if ((a = u[1]) === !0 || a === k) return a === !0; | |
} else if (u = l[r] = [ c ], u[1] = e(t, n, s) || k, u[1] === !0) return !0; | |
}; | |
} | |
function m(e) { | |
return e.length > 1 ? function(t, n, r) { | |
for (var i = e.length; i--; ) if (!e[i](t, n, r)) return !1; | |
return !0; | |
} : e[0]; | |
} | |
function g(e, t, n, r, i) { | |
for (var o, s = [], a = 0, u = e.length, l = null != t; u > a; a++) (o = e[a]) && (!n || n(o, r, i)) && (s.push(o), | |
l && t.push(a)); | |
return s; | |
} | |
function v(e, t, n, r, o, s) { | |
return r && !r[V] && (r = v(r)), o && !o[V] && (o = v(o, s)), i(function(i, s, a, u) { | |
var l, c, d, p = [], h = [], f = s.length, m = i || b(t || "*", a.nodeType ? [ a ] : a, []), v = !e || !i && t ? m : g(m, p, e, a, u), y = n ? o || (i ? e : f || r) ? [] : s : v; | |
if (n && n(v, y, a, u), r) for (l = g(y, h), r(l, [], a, u), c = l.length; c--; ) (d = l[c]) && (y[h[c]] = !(v[h[c]] = d)); | |
if (i) { | |
if (o || e) { | |
if (o) { | |
for (l = [], c = y.length; c--; ) (d = y[c]) && l.push(v[c] = d); | |
o(null, y = [], l, u); | |
} | |
for (c = y.length; c--; ) (d = y[c]) && (l = o ? nt.call(i, d) : p[c]) > -1 && (i[l] = !(s[l] = d)); | |
} | |
} else y = g(y === s ? y.splice(f, y.length) : y), o ? o(null, s, y, u) : et.apply(s, y); | |
}); | |
} | |
function y(e) { | |
for (var t, n, r, i = e.length, o = S.relative[e[0].type], s = o || S.relative[" "], a = o ? 1 : 0, u = f(function(e) { | |
return e === t; | |
}, s, !0), l = f(function(e) { | |
return nt.call(t, e) > -1; | |
}, s, !0), c = [ function(e, n, r) { | |
return !o && (r || n !== D) || ((t = n).nodeType ? u(e, n, r) : l(e, n, r)); | |
} ]; i > a; a++) if (n = S.relative[e[a].type]) c = [ f(m(c), n) ]; else { | |
if (n = S.filter[e[a].type].apply(null, e[a].matches), n[V]) { | |
for (r = ++a; i > r && !S.relative[e[r].type]; r++) ; | |
return v(a > 1 && m(c), a > 1 && h(e.slice(0, a - 1).concat({ | |
value: " " === e[a - 2].type ? "*" : "" | |
})).replace(ct, "$1"), n, r > a && y(e.slice(a, r)), i > r && y(e = e.slice(r)), i > r && h(e)); | |
} | |
c.push(n); | |
} | |
return m(c); | |
} | |
function w(e, t) { | |
var r = 0, o = t.length > 0, s = e.length > 0, a = function(i, a, u, l, c) { | |
var d, p, h, f = [], m = 0, v = "0", y = i && [], w = null != c, b = D, _ = i || s && S.find.TAG("*", c && a.parentNode || a), x = U += null == b ? 1 : Math.random() || .1; | |
for (w && (D = a !== M && a, k = r); null != (d = _[v]); v++) { | |
if (s && d) { | |
for (p = 0; h = e[p++]; ) if (h(d, a, u)) { | |
l.push(d); | |
break; | |
} | |
w && (U = x, k = ++r); | |
} | |
o && ((d = !h && d) && m--, i && y.push(d)); | |
} | |
if (m += v, o && v !== m) { | |
for (p = 0; h = t[p++]; ) h(y, f, a, u); | |
if (i) { | |
if (m > 0) for (;v--; ) y[v] || f[v] || (f[v] = Q.call(l)); | |
f = g(f); | |
} | |
et.apply(l, f), w && !i && f.length > 0 && m + t.length > 1 && n.uniqueSort(l); | |
} | |
return w && (U = x, D = b), y; | |
}; | |
return o ? i(a) : a; | |
} | |
function b(e, t, r) { | |
for (var i = 0, o = t.length; o > i; i++) n(e, t[i], r); | |
return r; | |
} | |
function _(e, t, n, r) { | |
var i, o, s, a, u, l = p(e); | |
if (!r && 1 === l.length) { | |
if (o = l[0] = l[0].slice(0), o.length > 2 && "ID" === (s = o[0]).type && E.getById && 9 === t.nodeType && I && S.relative[o[1].type]) { | |
if (t = (S.find.ID(s.matches[0].replace(Et, kt), t) || [])[0], !t) return n; | |
e = e.slice(o.shift().value.length); | |
} | |
for (i = vt.needsContext.test(e) ? 0 : o.length; i-- && (s = o[i], !S.relative[a = s.type]); ) if ((u = S.find[a]) && (r = u(s.matches[0].replace(Et, kt), ht.test(o[0].type) && t.parentNode || t))) { | |
if (o.splice(i, 1), e = r.length && h(o), !e) return et.apply(n, r), n; | |
break; | |
} | |
} | |
return A(e, l)(r, t, !I, n, ht.test(e)), n; | |
} | |
var x, E, k, S, T, C, A, D, N, O, M, j, I, P, R, $, L, V = "sizzle" + -new Date(), q = e.document, U = 0, F = 0, H = r(), B = r(), z = r(), Y = !1, W = function(e, t) { | |
return e === t ? (Y = !0, 0) : 0; | |
}, X = typeof t, G = 1 << 31, J = {}.hasOwnProperty, K = [], Q = K.pop, Z = K.push, et = K.push, tt = K.slice, nt = K.indexOf || function(e) { | |
for (var t = 0, n = this.length; n > t; t++) if (this[t] === e) return t; | |
return -1; | |
}, rt = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped", it = "[\\x20\\t\\r\\n\\f]", st = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+", at = st.replace("w", "w#"), ut = "\\[" + it + "*(" + st + ")" + it + "*(?:([*^$|!~]?=)" + it + "*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|(" + at + ")|)|)" + it + "*\\]", lt = ":(" + st + ")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|" + ut.replace(3, 8) + ")*)|.*)\\)|)", ct = new RegExp("^" + it + "+|((?:^|[^\\\\])(?:\\\\.)*)" + it + "+$", "g"), dt = new RegExp("^" + it + "*," + it + "*"), pt = new RegExp("^" + it + "*([>+~]|" + it + ")" + it + "*"), ht = new RegExp(it + "*[+~]"), ft = new RegExp("=" + it + "*([^\\]'\"]*)" + it + "*\\]", "g"), mt = new RegExp(lt), gt = new RegExp("^" + at + "$"), vt = { | |
ID: new RegExp("^#(" + st + ")"), | |
CLASS: new RegExp("^\\.(" + st + ")"), | |
TAG: new RegExp("^(" + st.replace("w", "w*") + ")"), | |
ATTR: new RegExp("^" + ut), | |
PSEUDO: new RegExp("^" + lt), | |
CHILD: new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + it + "*(even|odd|(([+-]|)(\\d*)n|)" + it + "*(?:([+-]|)" + it + "*(\\d+)|))" + it + "*\\)|)", "i"), | |
bool: new RegExp("^(?:" + rt + ")$", "i"), | |
needsContext: new RegExp("^" + it + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + it + "*((?:-\\d)?\\d*)" + it + "*\\)|)(?=[^-]|$)", "i") | |
}, yt = /^[^{]+\{\s*\[native \w/, wt = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, bt = /^(?:input|select|textarea|button)$/i, _t = /^h\d$/i, xt = /'|\\/g, Et = new RegExp("\\\\([\\da-f]{1,6}" + it + "?|(" + it + ")|.)", "ig"), kt = function(e, t, n) { | |
var r = "0x" + t - 65536; | |
return r !== r || n ? t : 0 > r ? String.fromCharCode(r + 65536) : String.fromCharCode(55296 | r >> 10, 56320 | 1023 & r); | |
}; | |
try { | |
et.apply(K = tt.call(q.childNodes), q.childNodes), K[q.childNodes.length].nodeType; | |
} catch (St) { | |
et = { | |
apply: K.length ? function(e, t) { | |
Z.apply(e, tt.call(t)); | |
} : function(e, t) { | |
for (var n = e.length, r = 0; e[n++] = t[r++]; ) ; | |
e.length = n - 1; | |
} | |
}; | |
} | |
C = n.isXML = function(e) { | |
var t = e && (e.ownerDocument || e).documentElement; | |
return t ? "HTML" !== t.nodeName : !1; | |
}, E = n.support = {}, O = n.setDocument = function(e) { | |
var t = e ? e.ownerDocument || e : q, n = t.defaultView; | |
return t !== M && 9 === t.nodeType && t.documentElement ? (M = t, j = t.documentElement, | |
I = !C(t), n && n.attachEvent && n !== n.top && n.attachEvent("onbeforeunload", function() { | |
O(); | |
}), E.attributes = o(function(e) { | |
return e.className = "i", !e.getAttribute("className"); | |
}), E.getElementsByTagName = o(function(e) { | |
return e.appendChild(t.createComment("")), !e.getElementsByTagName("*").length; | |
}), E.getElementsByClassName = o(function(e) { | |
return e.innerHTML = "<div class='a'></div><div class='a i'></div>", e.firstChild.className = "i", | |
2 === e.getElementsByClassName("i").length; | |
}), E.getById = o(function(e) { | |
return j.appendChild(e).id = V, !t.getElementsByName || !t.getElementsByName(V).length; | |
}), E.getById ? (S.find.ID = function(e, t) { | |
if (typeof t.getElementById !== X && I) { | |
var n = t.getElementById(e); | |
return n && n.parentNode ? [ n ] : []; | |
} | |
}, S.filter.ID = function(e) { | |
var t = e.replace(Et, kt); | |
return function(e) { | |
return e.getAttribute("id") === t; | |
}; | |
}) : (delete S.find.ID, S.filter.ID = function(e) { | |
var t = e.replace(Et, kt); | |
return function(e) { | |
var n = typeof e.getAttributeNode !== X && e.getAttributeNode("id"); | |
return n && n.value === t; | |
}; | |
}), S.find.TAG = E.getElementsByTagName ? function(e, t) { | |
return typeof t.getElementsByTagName !== X ? t.getElementsByTagName(e) : void 0; | |
} : function(e, t) { | |
var n, r = [], i = 0, o = t.getElementsByTagName(e); | |
if ("*" === e) { | |
for (;n = o[i++]; ) 1 === n.nodeType && r.push(n); | |
return r; | |
} | |
return o; | |
}, S.find.CLASS = E.getElementsByClassName && function(e, t) { | |
return typeof t.getElementsByClassName !== X && I ? t.getElementsByClassName(e) : void 0; | |
}, R = [], P = [], (E.qsa = yt.test(t.querySelectorAll)) && (o(function(e) { | |
e.innerHTML = "<select><option selected=''></option></select>", e.querySelectorAll("[selected]").length || P.push("\\[" + it + "*(?:value|" + rt + ")"), | |
e.querySelectorAll(":checked").length || P.push(":checked"); | |
}), o(function(e) { | |
var n = t.createElement("input"); | |
n.setAttribute("type", "hidden"), e.appendChild(n).setAttribute("t", ""), e.querySelectorAll("[t^='']").length && P.push("[*^$]=" + it + "*(?:''|\"\")"), | |
e.querySelectorAll(":enabled").length || P.push(":enabled", ":disabled"), e.querySelectorAll("*,:x"), | |
P.push(",.*:"); | |
})), (E.matchesSelector = yt.test($ = j.webkitMatchesSelector || j.mozMatchesSelector || j.oMatchesSelector || j.msMatchesSelector)) && o(function(e) { | |
E.disconnectedMatch = $.call(e, "div"), $.call(e, "[s!='']:x"), R.push("!=", lt); | |
}), P = P.length && new RegExp(P.join("|")), R = R.length && new RegExp(R.join("|")), | |
L = yt.test(j.contains) || j.compareDocumentPosition ? function(e, t) { | |
var n = 9 === e.nodeType ? e.documentElement : e, r = t && t.parentNode; | |
return e === r || !(!r || 1 !== r.nodeType || !(n.contains ? n.contains(r) : e.compareDocumentPosition && 16 & e.compareDocumentPosition(r))); | |
} : function(e, t) { | |
if (t) for (;t = t.parentNode; ) if (t === e) return !0; | |
return !1; | |
}, W = j.compareDocumentPosition ? function(e, n) { | |
if (e === n) return Y = !0, 0; | |
var r = n.compareDocumentPosition && e.compareDocumentPosition && e.compareDocumentPosition(n); | |
return r ? 1 & r || !E.sortDetached && n.compareDocumentPosition(e) === r ? e === t || L(q, e) ? -1 : n === t || L(q, n) ? 1 : N ? nt.call(N, e) - nt.call(N, n) : 0 : 4 & r ? -1 : 1 : e.compareDocumentPosition ? -1 : 1; | |
} : function(e, n) { | |
var r, i = 0, o = e.parentNode, s = n.parentNode, u = [ e ], l = [ n ]; | |
if (e === n) return Y = !0, 0; | |
if (!o || !s) return e === t ? -1 : n === t ? 1 : o ? -1 : s ? 1 : N ? nt.call(N, e) - nt.call(N, n) : 0; | |
if (o === s) return a(e, n); | |
for (r = e; r = r.parentNode; ) u.unshift(r); | |
for (r = n; r = r.parentNode; ) l.unshift(r); | |
for (;u[i] === l[i]; ) i++; | |
return i ? a(u[i], l[i]) : u[i] === q ? -1 : l[i] === q ? 1 : 0; | |
}, t) : M; | |
}, n.matches = function(e, t) { | |
return n(e, null, null, t); | |
}, n.matchesSelector = function(e, t) { | |
if ((e.ownerDocument || e) !== M && O(e), t = t.replace(ft, "='$1']"), !(!E.matchesSelector || !I || R && R.test(t) || P && P.test(t))) try { | |
var r = $.call(e, t); | |
if (r || E.disconnectedMatch || e.document && 11 !== e.document.nodeType) return r; | |
} catch (i) {} | |
return n(t, M, null, [ e ]).length > 0; | |
}, n.contains = function(e, t) { | |
return (e.ownerDocument || e) !== M && O(e), L(e, t); | |
}, n.attr = function(e, n) { | |
(e.ownerDocument || e) !== M && O(e); | |
var r = S.attrHandle[n.toLowerCase()], i = r && J.call(S.attrHandle, n.toLowerCase()) ? r(e, n, !I) : t; | |
return i === t ? E.attributes || !I ? e.getAttribute(n) : (i = e.getAttributeNode(n)) && i.specified ? i.value : null : i; | |
}, n.error = function(e) { | |
throw new Error("Syntax error, unrecognized expression: " + e); | |
}, n.uniqueSort = function(e) { | |
var t, n = [], r = 0, i = 0; | |
if (Y = !E.detectDuplicates, N = !E.sortStable && e.slice(0), e.sort(W), Y) { | |
for (;t = e[i++]; ) t === e[i] && (r = n.push(i)); | |
for (;r--; ) e.splice(n[r], 1); | |
} | |
return e; | |
}, T = n.getText = function(e) { | |
var t, n = "", r = 0, i = e.nodeType; | |
if (i) { | |
if (1 === i || 9 === i || 11 === i) { | |
if ("string" == typeof e.textContent) return e.textContent; | |
for (e = e.firstChild; e; e = e.nextSibling) n += T(e); | |
} else if (3 === i || 4 === i) return e.nodeValue; | |
} else for (;t = e[r]; r++) n += T(t); | |
return n; | |
}, S = n.selectors = { | |
cacheLength: 50, | |
createPseudo: i, | |
match: vt, | |
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(Et, kt), e[3] = (e[4] || e[5] || "").replace(Et, kt), | |
"~=" === 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] || n.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] && n.error(e[0]), | |
e; | |
}, | |
PSEUDO: function(e) { | |
var n, r = !e[5] && e[2]; | |
return vt.CHILD.test(e[0]) ? null : (e[3] && e[4] !== t ? e[2] = e[4] : r && mt.test(r) && (n = p(r, !0)) && (n = r.indexOf(")", r.length - n) - r.length) && (e[0] = e[0].slice(0, n), | |
e[2] = r.slice(0, n)), e.slice(0, 3)); | |
} | |
}, | |
filter: { | |
TAG: function(e) { | |
var t = e.replace(Et, kt).toLowerCase(); | |
return "*" === e ? function() { | |
return !0; | |
} : function(e) { | |
return e.nodeName && e.nodeName.toLowerCase() === t; | |
}; | |
}, | |
CLASS: function(e) { | |
var t = H[e + " "]; | |
return t || (t = new RegExp("(^|" + it + ")" + e + "(" + it + "|$)")) && H(e, function(e) { | |
return t.test("string" == typeof e.className && e.className || typeof e.getAttribute !== X && e.getAttribute("class") || ""); | |
}); | |
}, | |
ATTR: function(e, t, r) { | |
return function(i) { | |
var o = n.attr(i, e); | |
return null == o ? "!=" === t : t ? (o += "", "=" === t ? o === r : "!=" === t ? o !== r : "^=" === t ? r && 0 === o.indexOf(r) : "*=" === t ? r && o.indexOf(r) > -1 : "$=" === t ? r && o.slice(-r.length) === r : "~=" === t ? (" " + o + " ").indexOf(r) > -1 : "|=" === t ? o === r || o.slice(0, r.length + 1) === r + "-" : !1) : !0; | |
}; | |
}, | |
CHILD: function(e, t, n, r, i) { | |
var o = "nth" !== e.slice(0, 3), s = "last" !== e.slice(-4), a = "of-type" === t; | |
return 1 === r && 0 === i ? function(e) { | |
return !!e.parentNode; | |
} : function(t, n, u) { | |
var l, c, d, p, h, f, m = o !== s ? "nextSibling" : "previousSibling", g = t.parentNode, v = a && t.nodeName.toLowerCase(), y = !u && !a; | |
if (g) { | |
if (o) { | |
for (;m; ) { | |
for (d = t; d = d[m]; ) if (a ? d.nodeName.toLowerCase() === v : 1 === d.nodeType) return !1; | |
f = m = "only" === e && !f && "nextSibling"; | |
} | |
return !0; | |
} | |
if (f = [ s ? g.firstChild : g.lastChild ], s && y) { | |
for (c = g[V] || (g[V] = {}), l = c[e] || [], h = l[0] === U && l[1], p = l[0] === U && l[2], | |
d = h && g.childNodes[h]; d = ++h && d && d[m] || (p = h = 0) || f.pop(); ) if (1 === d.nodeType && ++p && d === t) { | |
c[e] = [ U, h, p ]; | |
break; | |
} | |
} else if (y && (l = (t[V] || (t[V] = {}))[e]) && l[0] === U) p = l[1]; else for (;(d = ++h && d && d[m] || (p = h = 0) || f.pop()) && ((a ? d.nodeName.toLowerCase() !== v : 1 !== d.nodeType) || !++p || (y && ((d[V] || (d[V] = {}))[e] = [ U, p ]), | |
d !== t)); ) ; | |
return p -= i, p === r || 0 === p % r && p / r >= 0; | |
} | |
}; | |
}, | |
PSEUDO: function(e, t) { | |
var r, o = S.pseudos[e] || S.setFilters[e.toLowerCase()] || n.error("unsupported pseudo: " + e); | |
return o[V] ? o(t) : o.length > 1 ? (r = [ e, e, "", t ], S.setFilters.hasOwnProperty(e.toLowerCase()) ? i(function(e, n) { | |
for (var r, i = o(e, t), s = i.length; s--; ) r = nt.call(e, i[s]), e[r] = !(n[r] = i[s]); | |
}) : function(e) { | |
return o(e, 0, r); | |
}) : o; | |
} | |
}, | |
pseudos: { | |
not: i(function(e) { | |
var t = [], n = [], r = A(e.replace(ct, "$1")); | |
return r[V] ? i(function(e, t, n, i) { | |
for (var o, s = r(e, null, i, []), a = e.length; a--; ) (o = s[a]) && (e[a] = !(t[a] = o)); | |
}) : function(e, i, o) { | |
return t[0] = e, r(t, null, o, n), !n.pop(); | |
}; | |
}), | |
has: i(function(e) { | |
return function(t) { | |
return n(e, t).length > 0; | |
}; | |
}), | |
contains: i(function(e) { | |
return function(t) { | |
return (t.textContent || t.innerText || T(t)).indexOf(e) > -1; | |
}; | |
}), | |
lang: i(function(e) { | |
return gt.test(e || "") || n.error("unsupported lang: " + e), e = e.replace(Et, kt).toLowerCase(), | |
function(t) { | |
var n; | |
do if (n = I ? t.lang : t.getAttribute("xml:lang") || t.getAttribute("lang")) return n = n.toLowerCase(), | |
n === e || 0 === n.indexOf(e + "-"); while ((t = t.parentNode) && 1 === t.nodeType); | |
return !1; | |
}; | |
}), | |
target: function(t) { | |
var n = e.location && e.location.hash; | |
return n && n.slice(1) === t.id; | |
}, | |
root: function(e) { | |
return e === j; | |
}, | |
focus: function(e) { | |
return e === M.activeElement && (!M.hasFocus || M.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.nodeName > "@" || 3 === e.nodeType || 4 === e.nodeType) return !1; | |
return !0; | |
}, | |
parent: function(e) { | |
return !S.pseudos.empty(e); | |
}, | |
header: function(e) { | |
return _t.test(e.nodeName); | |
}, | |
input: function(e) { | |
return bt.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")) || t.toLowerCase() === e.type); | |
}, | |
first: c(function() { | |
return [ 0 ]; | |
}), | |
last: c(function(e, t) { | |
return [ t - 1 ]; | |
}), | |
eq: c(function(e, t, n) { | |
return [ 0 > n ? n + t : n ]; | |
}), | |
even: c(function(e, t) { | |
for (var n = 0; t > n; n += 2) e.push(n); | |
return e; | |
}), | |
odd: c(function(e, t) { | |
for (var n = 1; t > n; n += 2) e.push(n); | |
return e; | |
}), | |
lt: c(function(e, t, n) { | |
for (var r = 0 > n ? n + t : n; --r >= 0; ) e.push(r); | |
return e; | |
}), | |
gt: c(function(e, t, n) { | |
for (var r = 0 > n ? n + t : n; ++r < t; ) e.push(r); | |
return e; | |
}) | |
} | |
}, S.pseudos.nth = S.pseudos.eq; | |
for (x in { | |
radio: !0, | |
checkbox: !0, | |
file: !0, | |
password: !0, | |
image: !0 | |
}) S.pseudos[x] = u(x); | |
for (x in { | |
submit: !0, | |
reset: !0 | |
}) S.pseudos[x] = l(x); | |
d.prototype = S.filters = S.pseudos, S.setFilters = new d(), A = n.compile = function(e, t) { | |
var n, r = [], i = [], o = z[e + " "]; | |
if (!o) { | |
for (t || (t = p(e)), n = t.length; n--; ) o = y(t[n]), o[V] ? r.push(o) : i.push(o); | |
o = z(e, w(i, r)); | |
} | |
return o; | |
}, E.sortStable = V.split("").sort(W).join("") === V, E.detectDuplicates = Y, O(), | |
E.sortDetached = o(function(e) { | |
return 1 & e.compareDocumentPosition(M.createElement("div")); | |
}), o(function(e) { | |
return e.innerHTML = "<a href='#'></a>", "#" === e.firstChild.getAttribute("href"); | |
}) || s("type|href|height|width", function(e, t, n) { | |
return n ? void 0 : e.getAttribute(t, "type" === t.toLowerCase() ? 1 : 2); | |
}), E.attributes && o(function(e) { | |
return e.innerHTML = "<input/>", e.firstChild.setAttribute("value", ""), "" === e.firstChild.getAttribute("value"); | |
}) || s("value", function(e, t, n) { | |
return n || "input" !== e.nodeName.toLowerCase() ? void 0 : e.defaultValue; | |
}), o(function(e) { | |
return null == e.getAttribute("disabled"); | |
}) || s(rt, function(e, t, n) { | |
var r; | |
return n ? void 0 : (r = e.getAttributeNode(t)) && r.specified ? r.value : e[t] === !0 ? t.toLowerCase() : null; | |
}), ot.find = n, ot.expr = n.selectors, ot.expr[":"] = ot.expr.pseudos, ot.unique = n.uniqueSort, | |
ot.text = n.getText, ot.isXMLDoc = n.isXML, ot.contains = n.contains; | |
}(e); | |
var ft = {}; | |
ot.Callbacks = function(e) { | |
e = "string" == typeof e ? ft[e] || r(e) : ot.extend({}, e); | |
var n, i, o, s, a, u, l = [], c = !e.once && [], d = function(t) { | |
for (n = e.memory && t, i = !0, u = s || 0, s = 0, a = l.length, o = !0; l && a > u; u++) if (l[u].apply(t[0], t[1]) === !1 && e.stopOnFalse) { | |
n = !1; | |
break; | |
} | |
o = !1, l && (c ? c.length && d(c.shift()) : n ? l = [] : p.disable()); | |
}, p = { | |
add: function() { | |
if (l) { | |
var t = l.length; | |
!function r(t) { | |
ot.each(t, function(t, n) { | |
var i = ot.type(n); | |
"function" === i ? e.unique && p.has(n) || l.push(n) : n && n.length && "string" !== i && r(n); | |
}); | |
}(arguments), o ? a = l.length : n && (s = t, d(n)); | |
} | |
return this; | |
}, | |
remove: function() { | |
return l && ot.each(arguments, function(e, t) { | |
for (var n; (n = ot.inArray(t, l, n)) > -1; ) l.splice(n, 1), o && (a >= n && a--, | |
u >= n && u--); | |
}), this; | |
}, | |
has: function(e) { | |
return e ? ot.inArray(e, l) > -1 : !(!l || !l.length); | |
}, | |
empty: function() { | |
return l = [], a = 0, this; | |
}, | |
disable: function() { | |
return l = c = n = t, this; | |
}, | |
disabled: function() { | |
return !l; | |
}, | |
lock: function() { | |
return c = t, n || p.disable(), this; | |
}, | |
locked: function() { | |
return !c; | |
}, | |
fireWith: function(e, t) { | |
return !l || i && !c || (t = t || [], t = [ e, t.slice ? t.slice() : t ], o ? c.push(t) : d(t)), | |
this; | |
}, | |
fire: function() { | |
return p.fireWith(this, arguments), this; | |
}, | |
fired: function() { | |
return !!i; | |
} | |
}; | |
return p; | |
}, ot.extend({ | |
Deferred: function(e) { | |
var t = [ [ "resolve", "done", ot.Callbacks("once memory"), "resolved" ], [ "reject", "fail", ot.Callbacks("once memory"), "rejected" ], [ "notify", "progress", ot.Callbacks("memory") ] ], n = "pending", r = { | |
state: function() { | |
return n; | |
}, | |
always: function() { | |
return i.done(arguments).fail(arguments), this; | |
}, | |
then: function() { | |
var e = arguments; | |
return ot.Deferred(function(n) { | |
ot.each(t, function(t, o) { | |
var s = o[0], a = ot.isFunction(e[t]) && e[t]; | |
i[o[1]](function() { | |
var e = a && a.apply(this, arguments); | |
e && ot.isFunction(e.promise) ? e.promise().done(n.resolve).fail(n.reject).progress(n.notify) : n[s + "With"](this === r ? n.promise() : this, a ? [ e ] : arguments); | |
}); | |
}), e = null; | |
}).promise(); | |
}, | |
promise: function(e) { | |
return null != e ? ot.extend(e, r) : r; | |
} | |
}, i = {}; | |
return r.pipe = r.then, ot.each(t, function(e, o) { | |
var s = o[2], a = o[3]; | |
r[o[1]] = s.add, a && s.add(function() { | |
n = a; | |
}, t[1 ^ e][2].disable, t[2][2].lock), i[o[0]] = function() { | |
return i[o[0] + "With"](this === i ? r : this, arguments), this; | |
}, i[o[0] + "With"] = s.fireWith; | |
}), r.promise(i), e && e.call(i, i), i; | |
}, | |
when: function(e) { | |
var t, n, r, i = 0, o = et.call(arguments), s = o.length, a = 1 !== s || e && ot.isFunction(e.promise) ? s : 0, u = 1 === a ? e : ot.Deferred(), l = function(e, n, r) { | |
return function(i) { | |
n[e] = this, r[e] = arguments.length > 1 ? et.call(arguments) : i, r === t ? u.notifyWith(n, r) : --a || u.resolveWith(n, r); | |
}; | |
}; | |
if (s > 1) for (t = new Array(s), n = new Array(s), r = new Array(s); s > i; i++) o[i] && ot.isFunction(o[i].promise) ? o[i].promise().done(l(i, r, o)).fail(u.reject).progress(l(i, n, t)) : --a; | |
return a || u.resolveWith(r, o), u.promise(); | |
} | |
}), ot.support = function(t) { | |
var n = z.createElement("input"), r = z.createDocumentFragment(), i = z.createElement("div"), o = z.createElement("select"), s = o.appendChild(z.createElement("option")); | |
return n.type ? (n.type = "checkbox", t.checkOn = "" !== n.value, t.optSelected = s.selected, | |
t.reliableMarginRight = !0, t.boxSizingReliable = !0, t.pixelPosition = !1, n.checked = !0, | |
t.noCloneChecked = n.cloneNode(!0).checked, o.disabled = !0, t.optDisabled = !s.disabled, | |
n = z.createElement("input"), n.value = "t", n.type = "radio", t.radioValue = "t" === n.value, | |
n.setAttribute("checked", "t"), n.setAttribute("name", "t"), r.appendChild(n), t.checkClone = r.cloneNode(!0).cloneNode(!0).lastChild.checked, | |
t.focusinBubbles = "onfocusin" in e, i.style.backgroundClip = "content-box", i.cloneNode(!0).style.backgroundClip = "", | |
t.clearCloneStyle = "content-box" === i.style.backgroundClip, ot(function() { | |
var n, r, o = "padding:0;margin:0;border:0;display:block;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box", s = z.getElementsByTagName("body")[0]; | |
s && (n = z.createElement("div"), n.style.cssText = "border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px", | |
s.appendChild(n).appendChild(i), i.innerHTML = "", i.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%", | |
ot.swap(s, null != s.style.zoom ? { | |
zoom: 1 | |
} : {}, function() { | |
t.boxSizing = 4 === i.offsetWidth; | |
}), e.getComputedStyle && (t.pixelPosition = "1%" !== (e.getComputedStyle(i, null) || {}).top, | |
t.boxSizingReliable = "4px" === (e.getComputedStyle(i, null) || { | |
width: "4px" | |
}).width, r = i.appendChild(z.createElement("div")), r.style.cssText = i.style.cssText = o, | |
r.style.marginRight = r.style.width = "0", i.style.width = "1px", t.reliableMarginRight = !parseFloat((e.getComputedStyle(r, null) || {}).marginRight)), | |
s.removeChild(n)); | |
}), t) : t; | |
}({}); | |
var mt, gt, vt = /(?:\{[\s\S]*\}|\[[\s\S]*\])$/, yt = /([A-Z])/g; | |
i.uid = 1, i.accepts = function(e) { | |
return e.nodeType ? 1 === e.nodeType || 9 === e.nodeType : !0; | |
}, i.prototype = { | |
key: function(e) { | |
if (!i.accepts(e)) return 0; | |
var t = {}, n = e[this.expando]; | |
if (!n) { | |
n = i.uid++; | |
try { | |
t[this.expando] = { | |
value: n | |
}, Object.defineProperties(e, t); | |
} catch (r) { | |
t[this.expando] = n, ot.extend(e, t); | |
} | |
} | |
return this.cache[n] || (this.cache[n] = {}), n; | |
}, | |
set: function(e, t, n) { | |
var r, i = this.key(e), o = this.cache[i]; | |
if ("string" == typeof t) o[t] = n; else if (ot.isEmptyObject(o)) ot.extend(this.cache[i], t); else for (r in t) o[r] = t[r]; | |
return o; | |
}, | |
get: function(e, n) { | |
var r = this.cache[this.key(e)]; | |
return n === t ? r : r[n]; | |
}, | |
access: function(e, n, r) { | |
var i; | |
return n === t || n && "string" == typeof n && r === t ? (i = this.get(e, n), i !== t ? i : this.get(e, ot.camelCase(n))) : (this.set(e, n, r), | |
r !== t ? r : n); | |
}, | |
remove: function(e, n) { | |
var r, i, o, s = this.key(e), a = this.cache[s]; | |
if (n === t) this.cache[s] = {}; else { | |
ot.isArray(n) ? i = n.concat(n.map(ot.camelCase)) : (o = ot.camelCase(n), n in a ? i = [ n, o ] : (i = o, | |
i = i in a ? [ i ] : i.match(at) || [])), r = i.length; | |
for (;r--; ) delete a[i[r]]; | |
} | |
}, | |
hasData: function(e) { | |
return !ot.isEmptyObject(this.cache[e[this.expando]] || {}); | |
}, | |
discard: function(e) { | |
e[this.expando] && delete this.cache[e[this.expando]]; | |
} | |
}, mt = new i(), gt = new i(), ot.extend({ | |
acceptData: i.accepts, | |
hasData: function(e) { | |
return mt.hasData(e) || gt.hasData(e); | |
}, | |
data: function(e, t, n) { | |
return mt.access(e, t, n); | |
}, | |
removeData: function(e, t) { | |
mt.remove(e, t); | |
}, | |
_data: function(e, t, n) { | |
return gt.access(e, t, n); | |
}, | |
_removeData: function(e, t) { | |
gt.remove(e, t); | |
} | |
}), ot.fn.extend({ | |
data: function(e, n) { | |
var r, i, s = this[0], a = 0, u = null; | |
if (e === t) { | |
if (this.length && (u = mt.get(s), 1 === s.nodeType && !gt.get(s, "hasDataAttrs"))) { | |
for (r = s.attributes; a < r.length; a++) i = r[a].name, 0 === i.indexOf("data-") && (i = ot.camelCase(i.slice(5)), | |
o(s, i, u[i])); | |
gt.set(s, "hasDataAttrs", !0); | |
} | |
return u; | |
} | |
return "object" == typeof e ? this.each(function() { | |
mt.set(this, e); | |
}) : ot.access(this, function(n) { | |
var r, i = ot.camelCase(e); | |
if (s && n === t) { | |
if (r = mt.get(s, e), r !== t) return r; | |
if (r = mt.get(s, i), r !== t) return r; | |
if (r = o(s, i, t), r !== t) return r; | |
} else this.each(function() { | |
var r = mt.get(this, i); | |
mt.set(this, i, n), -1 !== e.indexOf("-") && r !== t && mt.set(this, e, n); | |
}); | |
}, null, n, arguments.length > 1, null, !0); | |
}, | |
removeData: function(e) { | |
return this.each(function() { | |
mt.remove(this, e); | |
}); | |
} | |
}), ot.extend({ | |
queue: function(e, t, n) { | |
var r; | |
return e ? (t = (t || "fx") + "queue", r = gt.get(e, t), n && (!r || ot.isArray(n) ? r = gt.access(e, t, ot.makeArray(n)) : r.push(n)), | |
r || []) : void 0; | |
}, | |
dequeue: function(e, t) { | |
t = t || "fx"; | |
var n = ot.queue(e, t), r = n.length, i = n.shift(), o = ot._queueHooks(e, t), s = function() { | |
ot.dequeue(e, t); | |
}; | |
"inprogress" === i && (i = n.shift(), r--), i && ("fx" === t && n.unshift("inprogress"), | |
delete o.stop, i.call(e, s, o)), !r && o && o.empty.fire(); | |
}, | |
_queueHooks: function(e, t) { | |
var n = t + "queueHooks"; | |
return gt.get(e, n) || gt.access(e, n, { | |
empty: ot.Callbacks("once memory").add(function() { | |
gt.remove(e, [ t + "queue", n ]); | |
}) | |
}); | |
} | |
}), ot.fn.extend({ | |
queue: function(e, n) { | |
var r = 2; | |
return "string" != typeof e && (n = e, e = "fx", r--), arguments.length < r ? ot.queue(this[0], e) : n === t ? this : this.each(function() { | |
var t = ot.queue(this, e, n); | |
ot._queueHooks(this, e), "fx" === e && "inprogress" !== t[0] && ot.dequeue(this, e); | |
}); | |
}, | |
dequeue: function(e) { | |
return this.each(function() { | |
ot.dequeue(this, e); | |
}); | |
}, | |
delay: function(e, t) { | |
return e = ot.fx ? ot.fx.speeds[e] || e : e, t = t || "fx", this.queue(t, function(t, n) { | |
var r = setTimeout(t, e); | |
n.stop = function() { | |
clearTimeout(r); | |
}; | |
}); | |
}, | |
clearQueue: function(e) { | |
return this.queue(e || "fx", []); | |
}, | |
promise: function(e, n) { | |
var r, i = 1, o = ot.Deferred(), s = this, a = this.length, u = function() { | |
--i || o.resolveWith(s, [ s ]); | |
}; | |
for ("string" != typeof e && (n = e, e = t), e = e || "fx"; a--; ) r = gt.get(s[a], e + "queueHooks"), | |
r && r.empty && (i++, r.empty.add(u)); | |
return u(), o.promise(n); | |
} | |
}); | |
var wt, bt, _t = /[\t\r\n\f]/g, xt = /\r/g, Et = /^(?:input|select|textarea|button)$/i; | |
ot.fn.extend({ | |
attr: function(e, t) { | |
return ot.access(this, ot.attr, e, t, arguments.length > 1); | |
}, | |
removeAttr: function(e) { | |
return this.each(function() { | |
ot.removeAttr(this, e); | |
}); | |
}, | |
prop: function(e, t) { | |
return ot.access(this, ot.prop, e, t, arguments.length > 1); | |
}, | |
removeProp: function(e) { | |
return this.each(function() { | |
delete this[ot.propFix[e] || e]; | |
}); | |
}, | |
addClass: function(e) { | |
var t, n, r, i, o, s = 0, a = this.length, u = "string" == typeof e && e; | |
if (ot.isFunction(e)) return this.each(function(t) { | |
ot(this).addClass(e.call(this, t, this.className)); | |
}); | |
if (u) for (t = (e || "").match(at) || []; a > s; s++) if (n = this[s], r = 1 === n.nodeType && (n.className ? (" " + n.className + " ").replace(_t, " ") : " ")) { | |
for (o = 0; i = t[o++]; ) r.indexOf(" " + i + " ") < 0 && (r += i + " "); | |
n.className = ot.trim(r); | |
} | |
return this; | |
}, | |
removeClass: function(e) { | |
var t, n, r, i, o, s = 0, a = this.length, u = 0 === arguments.length || "string" == typeof e && e; | |
if (ot.isFunction(e)) return this.each(function(t) { | |
ot(this).removeClass(e.call(this, t, this.className)); | |
}); | |
if (u) for (t = (e || "").match(at) || []; a > s; s++) if (n = this[s], r = 1 === n.nodeType && (n.className ? (" " + n.className + " ").replace(_t, " ") : "")) { | |
for (o = 0; i = t[o++]; ) for (;r.indexOf(" " + i + " ") >= 0; ) r = r.replace(" " + i + " ", " "); | |
n.className = e ? ot.trim(r) : ""; | |
} | |
return this; | |
}, | |
toggleClass: function(e, t) { | |
var n = typeof e; | |
return "boolean" == typeof t && "string" === n ? t ? this.addClass(e) : this.removeClass(e) : ot.isFunction(e) ? this.each(function(n) { | |
ot(this).toggleClass(e.call(this, n, this.className, t), t); | |
}) : this.each(function() { | |
if ("string" === n) for (var t, r = 0, i = ot(this), o = e.match(at) || []; t = o[r++]; ) i.hasClass(t) ? i.removeClass(t) : i.addClass(t); else (n === H || "boolean" === n) && (this.className && gt.set(this, "__className__", this.className), | |
this.className = this.className || e === !1 ? "" : gt.get(this, "__className__") || ""); | |
}); | |
}, | |
hasClass: function(e) { | |
for (var t = " " + e + " ", n = 0, r = this.length; r > n; n++) if (1 === this[n].nodeType && (" " + this[n].className + " ").replace(_t, " ").indexOf(t) >= 0) return !0; | |
return !1; | |
}, | |
val: function(e) { | |
var n, r, i, o = this[0]; | |
{ | |
if (arguments.length) return i = ot.isFunction(e), this.each(function(r) { | |
var o; | |
1 === this.nodeType && (o = i ? e.call(this, r, ot(this).val()) : e, null == o ? o = "" : "number" == typeof o ? o += "" : ot.isArray(o) && (o = ot.map(o, function(e) { | |
return null == e ? "" : e + ""; | |
})), n = ot.valHooks[this.type] || ot.valHooks[this.nodeName.toLowerCase()], n && "set" in n && n.set(this, o, "value") !== t || (this.value = o)); | |
}); | |
if (o) return n = ot.valHooks[o.type] || ot.valHooks[o.nodeName.toLowerCase()], | |
n && "get" in n && (r = n.get(o, "value")) !== t ? r : (r = o.value, "string" == typeof r ? r.replace(xt, "") : null == r ? "" : r); | |
} | |
} | |
}), ot.extend({ | |
valHooks: { | |
option: { | |
get: function(e) { | |
var t = e.attributes.value; | |
return !t || t.specified ? e.value : e.text; | |
} | |
}, | |
select: { | |
get: function(e) { | |
for (var t, n, r = e.options, i = e.selectedIndex, o = "select-one" === e.type || 0 > i, s = o ? null : [], a = o ? i + 1 : r.length, u = 0 > i ? a : o ? i : 0; a > u; u++) if (n = r[u], | |
!(!n.selected && u !== i || (ot.support.optDisabled ? n.disabled : null !== n.getAttribute("disabled")) || n.parentNode.disabled && ot.nodeName(n.parentNode, "optgroup"))) { | |
if (t = ot(n).val(), o) return t; | |
s.push(t); | |
} | |
return s; | |
}, | |
set: function(e, t) { | |
for (var n, r, i = e.options, o = ot.makeArray(t), s = i.length; s--; ) r = i[s], | |
(r.selected = ot.inArray(ot(r).val(), o) >= 0) && (n = !0); | |
return n || (e.selectedIndex = -1), o; | |
} | |
} | |
}, | |
attr: function(e, n, r) { | |
var i, o, s = e.nodeType; | |
if (e && 3 !== s && 8 !== s && 2 !== s) return typeof e.getAttribute === H ? ot.prop(e, n, r) : (1 === s && ot.isXMLDoc(e) || (n = n.toLowerCase(), | |
i = ot.attrHooks[n] || (ot.expr.match.bool.test(n) ? bt : wt)), r === t ? i && "get" in i && null !== (o = i.get(e, n)) ? o : (o = ot.find.attr(e, n), | |
null == o ? t : o) : null !== r ? i && "set" in i && (o = i.set(e, r, n)) !== t ? o : (e.setAttribute(n, r + ""), | |
r) : (ot.removeAttr(e, n), void 0)); | |
}, | |
removeAttr: function(e, t) { | |
var n, r, i = 0, o = t && t.match(at); | |
if (o && 1 === e.nodeType) for (;n = o[i++]; ) r = ot.propFix[n] || n, ot.expr.match.bool.test(n) && (e[r] = !1), | |
e.removeAttribute(n); | |
}, | |
attrHooks: { | |
type: { | |
set: function(e, t) { | |
if (!ot.support.radioValue && "radio" === t && ot.nodeName(e, "input")) { | |
var n = e.value; | |
return e.setAttribute("type", t), n && (e.value = n), t; | |
} | |
} | |
} | |
}, | |
propFix: { | |
"for": "htmlFor", | |
"class": "className" | |
}, | |
prop: function(e, n, r) { | |
var i, o, s, a = e.nodeType; | |
if (e && 3 !== a && 8 !== a && 2 !== a) return s = 1 !== a || !ot.isXMLDoc(e), s && (n = ot.propFix[n] || n, | |
o = ot.propHooks[n]), r !== t ? o && "set" in o && (i = o.set(e, r, n)) !== t ? i : e[n] = r : o && "get" in o && null !== (i = o.get(e, n)) ? i : e[n]; | |
}, | |
propHooks: { | |
tabIndex: { | |
get: function(e) { | |
return e.hasAttribute("tabindex") || Et.test(e.nodeName) || e.href ? e.tabIndex : -1; | |
} | |
} | |
} | |
}), bt = { | |
set: function(e, t, n) { | |
return t === !1 ? ot.removeAttr(e, n) : e.setAttribute(n, n), n; | |
} | |
}, ot.each(ot.expr.match.bool.source.match(/\w+/g), function(e, n) { | |
var r = ot.expr.attrHandle[n] || ot.find.attr; | |
ot.expr.attrHandle[n] = function(e, n, i) { | |
var o = ot.expr.attrHandle[n], s = i ? t : (ot.expr.attrHandle[n] = t) != r(e, n, i) ? n.toLowerCase() : null; | |
return ot.expr.attrHandle[n] = o, s; | |
}; | |
}), ot.support.optSelected || (ot.propHooks.selected = { | |
get: function(e) { | |
var t = e.parentNode; | |
return t && t.parentNode && t.parentNode.selectedIndex, null; | |
} | |
}), ot.each([ "tabIndex", "readOnly", "maxLength", "cellSpacing", "cellPadding", "rowSpan", "colSpan", "useMap", "frameBorder", "contentEditable" ], function() { | |
ot.propFix[this.toLowerCase()] = this; | |
}), ot.each([ "radio", "checkbox" ], function() { | |
ot.valHooks[this] = { | |
set: function(e, t) { | |
return ot.isArray(t) ? e.checked = ot.inArray(ot(e).val(), t) >= 0 : void 0; | |
} | |
}, ot.support.checkOn || (ot.valHooks[this].get = function(e) { | |
return null === e.getAttribute("value") ? "on" : e.value; | |
}); | |
}); | |
var kt = /^key/, St = /^(?:mouse|contextmenu)|click/, Tt = /^(?:focusinfocus|focusoutblur)$/, Ct = /^([^.]*)(?:\.(.+)|)$/; | |
ot.event = { | |
global: {}, | |
add: function(e, n, r, i, o) { | |
var s, a, u, l, c, d, p, h, f, m, g, v = gt.get(e); | |
if (v) { | |
for (r.handler && (s = r, r = s.handler, o = s.selector), r.guid || (r.guid = ot.guid++), | |
(l = v.events) || (l = v.events = {}), (a = v.handle) || (a = v.handle = function(e) { | |
return typeof ot === H || e && ot.event.triggered === e.type ? t : ot.event.dispatch.apply(a.elem, arguments); | |
}, a.elem = e), n = (n || "").match(at) || [ "" ], c = n.length; c--; ) u = Ct.exec(n[c]) || [], | |
f = g = u[1], m = (u[2] || "").split(".").sort(), f && (p = ot.event.special[f] || {}, | |
f = (o ? p.delegateType : p.bindType) || f, p = ot.event.special[f] || {}, d = ot.extend({ | |
type: f, | |
origType: g, | |
data: i, | |
handler: r, | |
guid: r.guid, | |
selector: o, | |
needsContext: o && ot.expr.match.needsContext.test(o), | |
namespace: m.join(".") | |
}, s), (h = l[f]) || (h = l[f] = [], h.delegateCount = 0, p.setup && p.setup.call(e, i, m, a) !== !1 || e.addEventListener && e.addEventListener(f, a, !1)), | |
p.add && (p.add.call(e, d), d.handler.guid || (d.handler.guid = r.guid)), o ? h.splice(h.delegateCount++, 0, d) : h.push(d), | |
ot.event.global[f] = !0); | |
e = null; | |
} | |
}, | |
remove: function(e, t, n, r, i) { | |
var o, s, a, u, l, c, d, p, h, f, m, g = gt.hasData(e) && gt.get(e); | |
if (g && (u = g.events)) { | |
for (t = (t || "").match(at) || [ "" ], l = t.length; l--; ) if (a = Ct.exec(t[l]) || [], | |
h = m = a[1], f = (a[2] || "").split(".").sort(), h) { | |
for (d = ot.event.special[h] || {}, h = (r ? d.delegateType : d.bindType) || h, | |
p = u[h] || [], a = a[2] && new RegExp("(^|\\.)" + f.join("\\.(?:.*\\.|)") + "(\\.|$)"), | |
s = o = p.length; o--; ) c = p[o], !i && m !== c.origType || n && n.guid !== c.guid || a && !a.test(c.namespace) || r && r !== c.selector && ("**" !== r || !c.selector) || (p.splice(o, 1), | |
c.selector && p.delegateCount--, d.remove && d.remove.call(e, c)); | |
s && !p.length && (d.teardown && d.teardown.call(e, f, g.handle) !== !1 || ot.removeEvent(e, h, g.handle), | |
delete u[h]); | |
} else for (h in u) ot.event.remove(e, h + t[l], n, r, !0); | |
ot.isEmptyObject(u) && (delete g.handle, gt.remove(e, "events")); | |
} | |
}, | |
trigger: function(n, r, i, o) { | |
var s, a, u, l, c, d, p, h = [ i || z ], f = rt.call(n, "type") ? n.type : n, m = rt.call(n, "namespace") ? n.namespace.split(".") : []; | |
if (a = u = i = i || z, 3 !== i.nodeType && 8 !== i.nodeType && !Tt.test(f + ot.event.triggered) && (f.indexOf(".") >= 0 && (m = f.split("."), | |
f = m.shift(), m.sort()), c = f.indexOf(":") < 0 && "on" + f, n = n[ot.expando] ? n : new ot.Event(f, "object" == typeof n && n), | |
n.isTrigger = o ? 2 : 3, n.namespace = m.join("."), n.namespace_re = n.namespace ? new RegExp("(^|\\.)" + m.join("\\.(?:.*\\.|)") + "(\\.|$)") : null, | |
n.result = t, n.target || (n.target = i), r = null == r ? [ n ] : ot.makeArray(r, [ n ]), | |
p = ot.event.special[f] || {}, o || !p.trigger || p.trigger.apply(i, r) !== !1)) { | |
if (!o && !p.noBubble && !ot.isWindow(i)) { | |
for (l = p.delegateType || f, Tt.test(l + f) || (a = a.parentNode); a; a = a.parentNode) h.push(a), | |
u = a; | |
u === (i.ownerDocument || z) && h.push(u.defaultView || u.parentWindow || e); | |
} | |
for (s = 0; (a = h[s++]) && !n.isPropagationStopped(); ) n.type = s > 1 ? l : p.bindType || f, | |
d = (gt.get(a, "events") || {})[n.type] && gt.get(a, "handle"), d && d.apply(a, r), | |
d = c && a[c], d && ot.acceptData(a) && d.apply && d.apply(a, r) === !1 && n.preventDefault(); | |
return n.type = f, o || n.isDefaultPrevented() || p._default && p._default.apply(h.pop(), r) !== !1 || !ot.acceptData(i) || c && ot.isFunction(i[f]) && !ot.isWindow(i) && (u = i[c], | |
u && (i[c] = null), ot.event.triggered = f, i[f](), ot.event.triggered = t, u && (i[c] = u)), | |
n.result; | |
} | |
}, | |
dispatch: function(e) { | |
e = ot.event.fix(e); | |
var n, r, i, o, s, a = [], u = et.call(arguments), l = (gt.get(this, "events") || {})[e.type] || [], c = ot.event.special[e.type] || {}; | |
if (u[0] = e, e.delegateTarget = this, !c.preDispatch || c.preDispatch.call(this, e) !== !1) { | |
for (a = ot.event.handlers.call(this, e, l), n = 0; (o = a[n++]) && !e.isPropagationStopped(); ) for (e.currentTarget = o.elem, | |
r = 0; (s = o.handlers[r++]) && !e.isImmediatePropagationStopped(); ) (!e.namespace_re || e.namespace_re.test(s.namespace)) && (e.handleObj = s, | |
e.data = s.data, i = ((ot.event.special[s.origType] || {}).handle || s.handler).apply(o.elem, u), | |
i !== t && (e.result = i) === !1 && (e.preventDefault(), e.stopPropagation())); | |
return c.postDispatch && c.postDispatch.call(this, e), e.result; | |
} | |
}, | |
handlers: function(e, n) { | |
var r, i, o, s, a = [], u = n.delegateCount, l = e.target; | |
if (u && l.nodeType && (!e.button || "click" !== e.type)) for (;l !== this; l = l.parentNode || this) if (l.disabled !== !0 || "click" !== e.type) { | |
for (i = [], r = 0; u > r; r++) s = n[r], o = s.selector + " ", i[o] === t && (i[o] = s.needsContext ? ot(o, this).index(l) >= 0 : ot.find(o, this, null, [ l ]).length), | |
i[o] && i.push(s); | |
i.length && a.push({ | |
elem: l, | |
handlers: i | |
}); | |
} | |
return u < n.length && a.push({ | |
elem: this, | |
handlers: n.slice(u) | |
}), a; | |
}, | |
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, n) { | |
var r, i, o, s = n.button; | |
return null == e.pageX && null != n.clientX && (r = e.target.ownerDocument || z, | |
i = r.documentElement, o = r.body, e.pageX = n.clientX + (i && i.scrollLeft || o && o.scrollLeft || 0) - (i && i.clientLeft || o && o.clientLeft || 0), | |
e.pageY = n.clientY + (i && i.scrollTop || o && o.scrollTop || 0) - (i && i.clientTop || o && o.clientTop || 0)), | |
e.which || s === t || (e.which = 1 & s ? 1 : 2 & s ? 3 : 4 & s ? 2 : 0), e; | |
} | |
}, | |
fix: function(e) { | |
if (e[ot.expando]) return e; | |
var t, n, r, i = e.type, o = e, s = this.fixHooks[i]; | |
for (s || (this.fixHooks[i] = s = St.test(i) ? this.mouseHooks : kt.test(i) ? this.keyHooks : {}), | |
r = s.props ? this.props.concat(s.props) : this.props, e = new ot.Event(o), t = r.length; t--; ) n = r[t], | |
e[n] = o[n]; | |
return e.target || (e.target = z), 3 === e.target.nodeType && (e.target = e.target.parentNode), | |
s.filter ? s.filter(e, o) : e; | |
}, | |
special: { | |
load: { | |
noBubble: !0 | |
}, | |
focus: { | |
trigger: function() { | |
return this !== u() && this.focus ? (this.focus(), !1) : void 0; | |
}, | |
delegateType: "focusin" | |
}, | |
blur: { | |
trigger: function() { | |
return this === u() && this.blur ? (this.blur(), !1) : void 0; | |
}, | |
delegateType: "focusout" | |
}, | |
click: { | |
trigger: function() { | |
return "checkbox" === this.type && this.click && ot.nodeName(this, "input") ? (this.click(), | |
!1) : void 0; | |
}, | |
_default: function(e) { | |
return ot.nodeName(e.target, "a"); | |
} | |
}, | |
beforeunload: { | |
postDispatch: function(e) { | |
e.result !== t && (e.originalEvent.returnValue = e.result); | |
} | |
} | |
}, | |
simulate: function(e, t, n, r) { | |
var i = ot.extend(new ot.Event(), n, { | |
type: e, | |
isSimulated: !0, | |
originalEvent: {} | |
}); | |
r ? ot.event.trigger(i, null, t) : ot.event.dispatch.call(t, i), i.isDefaultPrevented() && n.preventDefault(); | |
} | |
}, ot.removeEvent = function(e, t, n) { | |
e.removeEventListener && e.removeEventListener(t, n, !1); | |
}, ot.Event = function(e, t) { | |
return this instanceof ot.Event ? (e && e.type ? (this.originalEvent = e, this.type = e.type, | |
this.isDefaultPrevented = e.defaultPrevented || e.getPreventDefault && e.getPreventDefault() ? s : a) : this.type = e, | |
t && ot.extend(this, t), this.timeStamp = e && e.timeStamp || ot.now(), this[ot.expando] = !0, | |
void 0) : new ot.Event(e, t); | |
}, ot.Event.prototype = { | |
isDefaultPrevented: a, | |
isPropagationStopped: a, | |
isImmediatePropagationStopped: a, | |
preventDefault: function() { | |
var e = this.originalEvent; | |
this.isDefaultPrevented = s, e && e.preventDefault && e.preventDefault(); | |
}, | |
stopPropagation: function() { | |
var e = this.originalEvent; | |
this.isPropagationStopped = s, e && e.stopPropagation && e.stopPropagation(); | |
}, | |
stopImmediatePropagation: function() { | |
this.isImmediatePropagationStopped = s, this.stopPropagation(); | |
} | |
}, ot.each({ | |
mouseenter: "mouseover", | |
mouseleave: "mouseout" | |
}, function(e, t) { | |
ot.event.special[e] = { | |
delegateType: t, | |
bindType: t, | |
handle: function(e) { | |
var n, r = this, i = e.relatedTarget, o = e.handleObj; | |
return (!i || i !== r && !ot.contains(r, i)) && (e.type = o.origType, n = o.handler.apply(this, arguments), | |
e.type = t), n; | |
} | |
}; | |
}), ot.support.focusinBubbles || ot.each({ | |
focus: "focusin", | |
blur: "focusout" | |
}, function(e, t) { | |
var n = 0, r = function(e) { | |
ot.event.simulate(t, e.target, ot.event.fix(e), !0); | |
}; | |
ot.event.special[t] = { | |
setup: function() { | |
0 === n++ && z.addEventListener(e, r, !0); | |
}, | |
teardown: function() { | |
0 === --n && z.removeEventListener(e, r, !0); | |
} | |
}; | |
}), ot.fn.extend({ | |
on: function(e, n, r, i, o) { | |
var s, u; | |
if ("object" == typeof e) { | |
"string" != typeof n && (r = r || n, n = t); | |
for (u in e) this.on(u, n, r, e[u], o); | |
return this; | |
} | |
if (null == r && null == i ? (i = n, r = n = t) : null == i && ("string" == typeof n ? (i = r, | |
r = t) : (i = r, r = n, n = t)), i === !1) i = a; else if (!i) return this; | |
return 1 === o && (s = i, i = function(e) { | |
return ot().off(e), s.apply(this, arguments); | |
}, i.guid = s.guid || (s.guid = ot.guid++)), this.each(function() { | |
ot.event.add(this, e, i, r, n); | |
}); | |
}, | |
one: function(e, t, n, r) { | |
return this.on(e, t, n, r, 1); | |
}, | |
off: function(e, n, r) { | |
var i, o; | |
if (e && e.preventDefault && e.handleObj) return i = e.handleObj, ot(e.delegateTarget).off(i.namespace ? i.origType + "." + i.namespace : i.origType, i.selector, i.handler), | |
this; | |
if ("object" == typeof e) { | |
for (o in e) this.off(o, n, e[o]); | |
return this; | |
} | |
return (n === !1 || "function" == typeof n) && (r = n, n = t), r === !1 && (r = a), | |
this.each(function() { | |
ot.event.remove(this, e, r, n); | |
}); | |
}, | |
trigger: function(e, t) { | |
return this.each(function() { | |
ot.event.trigger(e, t, this); | |
}); | |
}, | |
triggerHandler: function(e, t) { | |
var n = this[0]; | |
return n ? ot.event.trigger(e, t, n, !0) : void 0; | |
} | |
}); | |
var At = /^.[^:#\[\.,]*$/, Dt = /^(?:parents|prev(?:Until|All))/, Nt = ot.expr.match.needsContext, Ot = { | |
children: !0, | |
contents: !0, | |
next: !0, | |
prev: !0 | |
}; | |
ot.fn.extend({ | |
find: function(e) { | |
var t, n = [], r = this, i = r.length; | |
if ("string" != typeof e) return this.pushStack(ot(e).filter(function() { | |
for (t = 0; i > t; t++) if (ot.contains(r[t], this)) return !0; | |
})); | |
for (t = 0; i > t; t++) ot.find(e, r[t], n); | |
return n = this.pushStack(i > 1 ? ot.unique(n) : n), n.selector = this.selector ? this.selector + " " + e : e, | |
n; | |
}, | |
has: function(e) { | |
var t = ot(e, this), n = t.length; | |
return this.filter(function() { | |
for (var e = 0; n > e; e++) if (ot.contains(this, t[e])) return !0; | |
}); | |
}, | |
not: function(e) { | |
return this.pushStack(c(this, e || [], !0)); | |
}, | |
filter: function(e) { | |
return this.pushStack(c(this, e || [], !1)); | |
}, | |
is: function(e) { | |
return !!c(this, "string" == typeof e && Nt.test(e) ? ot(e) : e || [], !1).length; | |
}, | |
closest: function(e, t) { | |
for (var n, r = 0, i = this.length, o = [], s = Nt.test(e) || "string" != typeof e ? ot(e, t || this.context) : 0; i > r; r++) for (n = this[r]; n && n !== t; n = n.parentNode) if (n.nodeType < 11 && (s ? s.index(n) > -1 : 1 === n.nodeType && ot.find.matchesSelector(n, e))) { | |
n = o.push(n); | |
break; | |
} | |
return this.pushStack(o.length > 1 ? ot.unique(o) : o); | |
}, | |
index: function(e) { | |
return e ? "string" == typeof e ? tt.call(ot(e), this[0]) : tt.call(this, e.jquery ? e[0] : e) : this[0] && this[0].parentNode ? this.first().prevAll().length : -1; | |
}, | |
add: function(e, t) { | |
var n = "string" == typeof e ? ot(e, t) : ot.makeArray(e && e.nodeType ? [ e ] : e), r = ot.merge(this.get(), n); | |
return this.pushStack(ot.unique(r)); | |
}, | |
addBack: function(e) { | |
return this.add(null == e ? this.prevObject : this.prevObject.filter(e)); | |
} | |
}), ot.each({ | |
parent: function(e) { | |
var t = e.parentNode; | |
return t && 11 !== t.nodeType ? t : null; | |
}, | |
parents: function(e) { | |
return ot.dir(e, "parentNode"); | |
}, | |
parentsUntil: function(e, t, n) { | |
return ot.dir(e, "parentNode", n); | |
}, | |
next: function(e) { | |
return l(e, "nextSibling"); | |
}, | |
prev: function(e) { | |
return l(e, "previousSibling"); | |
}, | |
nextAll: function(e) { | |
return ot.dir(e, "nextSibling"); | |
}, | |
prevAll: function(e) { | |
return ot.dir(e, "previousSibling"); | |
}, | |
nextUntil: function(e, t, n) { | |
return ot.dir(e, "nextSibling", n); | |
}, | |
prevUntil: function(e, t, n) { | |
return ot.dir(e, "previousSibling", n); | |
}, | |
siblings: function(e) { | |
return ot.sibling((e.parentNode || {}).firstChild, e); | |
}, | |
children: function(e) { | |
return ot.sibling(e.firstChild); | |
}, | |
contents: function(e) { | |
return e.contentDocument || ot.merge([], e.childNodes); | |
} | |
}, function(e, t) { | |
ot.fn[e] = function(n, r) { | |
var i = ot.map(this, t, n); | |
return "Until" !== e.slice(-5) && (r = n), r && "string" == typeof r && (i = ot.filter(r, i)), | |
this.length > 1 && (Ot[e] || ot.unique(i), Dt.test(e) && i.reverse()), this.pushStack(i); | |
}; | |
}), ot.extend({ | |
filter: function(e, t, n) { | |
var r = t[0]; | |
return n && (e = ":not(" + e + ")"), 1 === t.length && 1 === r.nodeType ? ot.find.matchesSelector(r, e) ? [ r ] : [] : ot.find.matches(e, ot.grep(t, function(e) { | |
return 1 === e.nodeType; | |
})); | |
}, | |
dir: function(e, n, r) { | |
for (var i = [], o = r !== t; (e = e[n]) && 9 !== e.nodeType; ) if (1 === e.nodeType) { | |
if (o && ot(e).is(r)) break; | |
i.push(e); | |
} | |
return i; | |
}, | |
sibling: function(e, t) { | |
for (var n = []; e; e = e.nextSibling) 1 === e.nodeType && e !== t && n.push(e); | |
return n; | |
} | |
}); | |
var Mt = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi, jt = /<([\w:]+)/, It = /<|&#?\w+;/, Pt = /<(?:script|style|link)/i, Rt = /^(?:checkbox|radio)$/i, $t = /checked\s*(?:[^=]|=\s*.checked.)/i, Lt = /^$|\/(?:java|ecma)script/i, Vt = /^true\/(.*)/, qt = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g, Ut = { | |
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, "", "" ] | |
}; | |
Ut.optgroup = Ut.option, Ut.tbody = Ut.tfoot = Ut.colgroup = Ut.caption = Ut.thead, | |
Ut.th = Ut.td, ot.fn.extend({ | |
text: function(e) { | |
return ot.access(this, function(e) { | |
return e === t ? ot.text(this) : this.empty().append((this[0] && this[0].ownerDocument || z).createTextNode(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 = d(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 = d(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 n, r = e ? ot.filter(e, this) : this, i = 0; null != (n = r[i]); i++) t || 1 !== n.nodeType || ot.cleanData(g(n)), | |
n.parentNode && (t && ot.contains(n.ownerDocument, n) && f(g(n, "script")), n.parentNode.removeChild(n)); | |
return this; | |
}, | |
empty: function() { | |
for (var e, t = 0; null != (e = this[t]); t++) 1 === e.nodeType && (ot.cleanData(g(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 ot.clone(this, e, t); | |
}); | |
}, | |
html: function(e) { | |
return ot.access(this, function(e) { | |
var n = this[0] || {}, r = 0, i = this.length; | |
if (e === t && 1 === n.nodeType) return n.innerHTML; | |
if ("string" == typeof e && !Pt.test(e) && !Ut[(jt.exec(e) || [ "", "" ])[1].toLowerCase()]) { | |
e = e.replace(Mt, "<$1></$2>"); | |
try { | |
for (;i > r; r++) n = this[r] || {}, 1 === n.nodeType && (ot.cleanData(g(n, !1)), | |
n.innerHTML = e); | |
n = 0; | |
} catch (o) {} | |
} | |
n && this.empty().append(e); | |
}, null, e, arguments.length); | |
}, | |
replaceWith: function() { | |
var e = ot.map(this, function(e) { | |
return [ e.nextSibling, e.parentNode ]; | |
}), t = 0; | |
return this.domManip(arguments, function(n) { | |
var r = e[t++], i = e[t++]; | |
i && (r && r.parentNode !== i && (r = this.nextSibling), ot(this).remove(), i.insertBefore(n, r)); | |
}, !0), t ? this : this.remove(); | |
}, | |
detach: function(e) { | |
return this.remove(e, !0); | |
}, | |
domManip: function(e, t, n) { | |
e = Q.apply([], e); | |
var r, i, o, s, a, u, l = 0, c = this.length, d = this, f = c - 1, m = e[0], v = ot.isFunction(m); | |
if (v || !(1 >= c || "string" != typeof m || ot.support.checkClone) && $t.test(m)) return this.each(function(r) { | |
var i = d.eq(r); | |
v && (e[0] = m.call(this, r, i.html())), i.domManip(e, t, n); | |
}); | |
if (c && (r = ot.buildFragment(e, this[0].ownerDocument, !1, !n && this), i = r.firstChild, | |
1 === r.childNodes.length && (r = i), i)) { | |
for (o = ot.map(g(r, "script"), p), s = o.length; c > l; l++) a = r, l !== f && (a = ot.clone(a, !0, !0), | |
s && ot.merge(o, g(a, "script"))), t.call(this[l], a, l); | |
if (s) for (u = o[o.length - 1].ownerDocument, ot.map(o, h), l = 0; s > l; l++) a = o[l], | |
Lt.test(a.type || "") && !gt.access(a, "globalEval") && ot.contains(u, a) && (a.src ? ot._evalUrl(a.src) : ot.globalEval(a.textContent.replace(qt, ""))); | |
} | |
return this; | |
} | |
}), ot.each({ | |
appendTo: "append", | |
prependTo: "prepend", | |
insertBefore: "before", | |
insertAfter: "after", | |
replaceAll: "replaceWith" | |
}, function(e, t) { | |
ot.fn[e] = function(e) { | |
for (var n, r = [], i = ot(e), o = i.length - 1, s = 0; o >= s; s++) n = s === o ? this : this.clone(!0), | |
ot(i[s])[t](n), Z.apply(r, n.get()); | |
return this.pushStack(r); | |
}; | |
}), ot.extend({ | |
clone: function(e, t, n) { | |
var r, i, o, s, a = e.cloneNode(!0), u = ot.contains(e.ownerDocument, e); | |
if (!(ot.support.noCloneChecked || 1 !== e.nodeType && 11 !== e.nodeType || ot.isXMLDoc(e))) for (s = g(a), | |
o = g(e), r = 0, i = o.length; i > r; r++) v(o[r], s[r]); | |
if (t) if (n) for (o = o || g(e), s = s || g(a), r = 0, i = o.length; i > r; r++) m(o[r], s[r]); else m(e, a); | |
return s = g(a, "script"), s.length > 0 && f(s, !u && g(e, "script")), a; | |
}, | |
buildFragment: function(e, t, n, r) { | |
for (var i, o, s, a, u, l, c = 0, d = e.length, p = t.createDocumentFragment(), h = []; d > c; c++) if (i = e[c], | |
i || 0 === i) if ("object" === ot.type(i)) ot.merge(h, i.nodeType ? [ i ] : i); else if (It.test(i)) { | |
for (o = o || p.appendChild(t.createElement("div")), s = (jt.exec(i) || [ "", "" ])[1].toLowerCase(), | |
a = Ut[s] || Ut._default, o.innerHTML = a[1] + i.replace(Mt, "<$1></$2>") + a[2], | |
l = a[0]; l--; ) o = o.lastChild; | |
ot.merge(h, o.childNodes), o = p.firstChild, o.textContent = ""; | |
} else h.push(t.createTextNode(i)); | |
for (p.textContent = "", c = 0; i = h[c++]; ) if ((!r || -1 === ot.inArray(i, r)) && (u = ot.contains(i.ownerDocument, i), | |
o = g(p.appendChild(i), "script"), u && f(o), n)) for (l = 0; i = o[l++]; ) Lt.test(i.type || "") && n.push(i); | |
return p; | |
}, | |
cleanData: function(e) { | |
for (var n, r, o, s, a, u, l = ot.event.special, c = 0; (r = e[c]) !== t; c++) { | |
if (i.accepts(r) && (a = r[gt.expando], a && (n = gt.cache[a]))) { | |
if (o = Object.keys(n.events || {}), o.length) for (u = 0; (s = o[u]) !== t; u++) l[s] ? ot.event.remove(r, s) : ot.removeEvent(r, s, n.handle); | |
gt.cache[a] && delete gt.cache[a]; | |
} | |
delete mt.cache[r[mt.expando]]; | |
} | |
}, | |
_evalUrl: function(e) { | |
return ot.ajax({ | |
url: e, | |
type: "GET", | |
dataType: "script", | |
async: !1, | |
global: !1, | |
"throws": !0 | |
}); | |
} | |
}), ot.fn.extend({ | |
wrapAll: function(e) { | |
var t; | |
return ot.isFunction(e) ? this.each(function(t) { | |
ot(this).wrapAll(e.call(this, t)); | |
}) : (this[0] && (t = ot(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 ot.isFunction(e) ? this.each(function(t) { | |
ot(this).wrapInner(e.call(this, t)); | |
}) : this.each(function() { | |
var t = ot(this), n = t.contents(); | |
n.length ? n.wrapAll(e) : t.append(e); | |
}); | |
}, | |
wrap: function(e) { | |
var t = ot.isFunction(e); | |
return this.each(function(n) { | |
ot(this).wrapAll(t ? e.call(this, n) : e); | |
}); | |
}, | |
unwrap: function() { | |
return this.parent().each(function() { | |
ot.nodeName(this, "body") || ot(this).replaceWith(this.childNodes); | |
}).end(); | |
} | |
}); | |
var Ft, Ht, Bt = /^(none|table(?!-c[ea]).+)/, zt = /^margin/, Yt = new RegExp("^(" + st + ")(.*)$", "i"), Wt = new RegExp("^(" + st + ")(?!px)[a-z%]+$", "i"), Xt = new RegExp("^([+-])=(" + st + ")", "i"), Gt = { | |
BODY: "block" | |
}, Jt = { | |
position: "absolute", | |
visibility: "hidden", | |
display: "block" | |
}, Kt = { | |
letterSpacing: 0, | |
fontWeight: 400 | |
}, Qt = [ "Top", "Right", "Bottom", "Left" ], Zt = [ "Webkit", "O", "Moz", "ms" ]; | |
ot.fn.extend({ | |
css: function(e, n) { | |
return ot.access(this, function(e, n, r) { | |
var i, o, s = {}, a = 0; | |
if (ot.isArray(n)) { | |
for (i = b(e), o = n.length; o > a; a++) s[n[a]] = ot.css(e, n[a], !1, i); | |
return s; | |
} | |
return r !== t ? ot.style(e, n, r) : ot.css(e, n); | |
}, e, n, arguments.length > 1); | |
}, | |
show: function() { | |
return _(this, !0); | |
}, | |
hide: function() { | |
return _(this); | |
}, | |
toggle: function(e) { | |
return "boolean" == typeof e ? e ? this.show() : this.hide() : this.each(function() { | |
w(this) ? ot(this).show() : ot(this).hide(); | |
}); | |
} | |
}), ot.extend({ | |
cssHooks: { | |
opacity: { | |
get: function(e, t) { | |
if (t) { | |
var n = Ft(e, "opacity"); | |
return "" === n ? "1" : n; | |
} | |
} | |
} | |
}, | |
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, n, r, i) { | |
if (e && 3 !== e.nodeType && 8 !== e.nodeType && e.style) { | |
var o, s, a, u = ot.camelCase(n), l = e.style; | |
return n = ot.cssProps[u] || (ot.cssProps[u] = y(l, u)), a = ot.cssHooks[n] || ot.cssHooks[u], | |
r === t ? a && "get" in a && (o = a.get(e, !1, i)) !== t ? o : l[n] : (s = typeof r, | |
"string" === s && (o = Xt.exec(r)) && (r = (o[1] + 1) * o[2] + parseFloat(ot.css(e, n)), | |
s = "number"), null == r || "number" === s && isNaN(r) || ("number" !== s || ot.cssNumber[u] || (r += "px"), | |
ot.support.clearCloneStyle || "" !== r || 0 !== n.indexOf("background") || (l[n] = "inherit"), | |
a && "set" in a && (r = a.set(e, r, i)) === t || (l[n] = r)), void 0); | |
} | |
}, | |
css: function(e, n, r, i) { | |
var o, s, a, u = ot.camelCase(n); | |
return n = ot.cssProps[u] || (ot.cssProps[u] = y(e.style, u)), a = ot.cssHooks[n] || ot.cssHooks[u], | |
a && "get" in a && (o = a.get(e, !0, r)), o === t && (o = Ft(e, n, i)), "normal" === o && n in Kt && (o = Kt[n]), | |
"" === r || r ? (s = parseFloat(o), r === !0 || ot.isNumeric(s) ? s || 0 : o) : o; | |
} | |
}), Ft = function(e, n, r) { | |
var i, o, s, a = r || b(e), u = a ? a.getPropertyValue(n) || a[n] : t, l = e.style; | |
return a && ("" !== u || ot.contains(e.ownerDocument, e) || (u = ot.style(e, n)), | |
Wt.test(u) && zt.test(n) && (i = l.width, o = l.minWidth, s = l.maxWidth, l.minWidth = l.maxWidth = l.width = u, | |
u = a.width, l.width = i, l.minWidth = o, l.maxWidth = s)), u; | |
}, ot.each([ "height", "width" ], function(e, t) { | |
ot.cssHooks[t] = { | |
get: function(e, n, r) { | |
return n ? 0 === e.offsetWidth && Bt.test(ot.css(e, "display")) ? ot.swap(e, Jt, function() { | |
return k(e, t, r); | |
}) : k(e, t, r) : void 0; | |
}, | |
set: function(e, n, r) { | |
var i = r && b(e); | |
return x(e, n, r ? E(e, t, r, ot.support.boxSizing && "border-box" === ot.css(e, "boxSizing", !1, i), i) : 0); | |
} | |
}; | |
}), ot(function() { | |
ot.support.reliableMarginRight || (ot.cssHooks.marginRight = { | |
get: function(e, t) { | |
return t ? ot.swap(e, { | |
display: "inline-block" | |
}, Ft, [ e, "marginRight" ]) : void 0; | |
} | |
}), !ot.support.pixelPosition && ot.fn.position && ot.each([ "top", "left" ], function(e, t) { | |
ot.cssHooks[t] = { | |
get: function(e, n) { | |
return n ? (n = Ft(e, t), Wt.test(n) ? ot(e).position()[t] + "px" : n) : void 0; | |
} | |
}; | |
}); | |
}), ot.expr && ot.expr.filters && (ot.expr.filters.hidden = function(e) { | |
return e.offsetWidth <= 0 && e.offsetHeight <= 0; | |
}, ot.expr.filters.visible = function(e) { | |
return !ot.expr.filters.hidden(e); | |
}), ot.each({ | |
margin: "", | |
padding: "", | |
border: "Width" | |
}, function(e, t) { | |
ot.cssHooks[e + t] = { | |
expand: function(n) { | |
for (var r = 0, i = {}, o = "string" == typeof n ? n.split(" ") : [ n ]; 4 > r; r++) i[e + Qt[r] + t] = o[r] || o[r - 2] || o[0]; | |
return i; | |
} | |
}, zt.test(e) || (ot.cssHooks[e + t].set = x); | |
}); | |
var en = /%20/g, tn = /\[\]$/, nn = /\r?\n/g, rn = /^(?:submit|button|image|reset|file)$/i, on = /^(?:input|select|textarea|keygen)/i; | |
ot.fn.extend({ | |
serialize: function() { | |
return ot.param(this.serializeArray()); | |
}, | |
serializeArray: function() { | |
return this.map(function() { | |
var e = ot.prop(this, "elements"); | |
return e ? ot.makeArray(e) : this; | |
}).filter(function() { | |
var e = this.type; | |
return this.name && !ot(this).is(":disabled") && on.test(this.nodeName) && !rn.test(e) && (this.checked || !Rt.test(e)); | |
}).map(function(e, t) { | |
var n = ot(this).val(); | |
return null == n ? null : ot.isArray(n) ? ot.map(n, function(e) { | |
return { | |
name: t.name, | |
value: e.replace(nn, "\r\n") | |
}; | |
}) : { | |
name: t.name, | |
value: n.replace(nn, "\r\n") | |
}; | |
}).get(); | |
} | |
}), ot.param = function(e, n) { | |
var r, i = [], o = function(e, t) { | |
t = ot.isFunction(t) ? t() : null == t ? "" : t, i[i.length] = encodeURIComponent(e) + "=" + encodeURIComponent(t); | |
}; | |
if (n === t && (n = ot.ajaxSettings && ot.ajaxSettings.traditional), ot.isArray(e) || e.jquery && !ot.isPlainObject(e)) ot.each(e, function() { | |
o(this.name, this.value); | |
}); else for (r in e) C(r, e[r], n, o); | |
return i.join("&").replace(en, "+"); | |
}, ot.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) { | |
ot.fn[t] = function(e, n) { | |
return arguments.length > 0 ? this.on(t, null, e, n) : this.trigger(t); | |
}; | |
}), ot.fn.extend({ | |
hover: function(e, t) { | |
return this.mouseenter(e).mouseleave(t || e); | |
}, | |
bind: function(e, t, n) { | |
return this.on(e, null, t, n); | |
}, | |
unbind: function(e, t) { | |
return this.off(e, null, t); | |
}, | |
delegate: function(e, t, n, r) { | |
return this.on(t, e, n, r); | |
}, | |
undelegate: function(e, t, n) { | |
return 1 === arguments.length ? this.off(e, "**") : this.off(t, e || "**", n); | |
} | |
}); | |
var sn, an, un = ot.now(), ln = /\?/, cn = /#.*$/, dn = /([?&])_=[^&]*/, pn = /^(.*?):[ \t]*([^\r\n]*)$/gm, hn = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/, fn = /^(?:GET|HEAD)$/, mn = /^\/\//, gn = /^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/, vn = ot.fn.load, yn = {}, wn = {}, bn = "*/".concat("*"); | |
try { | |
an = B.href; | |
} catch (_n) { | |
an = z.createElement("a"), an.href = "", an = an.href; | |
} | |
sn = gn.exec(an.toLowerCase()) || [], ot.fn.load = function(e, n, r) { | |
if ("string" != typeof e && vn) return vn.apply(this, arguments); | |
var i, o, s, a = this, u = e.indexOf(" "); | |
return u >= 0 && (i = e.slice(u), e = e.slice(0, u)), ot.isFunction(n) ? (r = n, | |
n = t) : n && "object" == typeof n && (o = "POST"), a.length > 0 && ot.ajax({ | |
url: e, | |
type: o, | |
dataType: "html", | |
data: n | |
}).done(function(e) { | |
s = arguments, a.html(i ? ot("<div>").append(ot.parseHTML(e)).find(i) : e); | |
}).complete(r && function(e, t) { | |
a.each(r, s || [ e.responseText, t, e ]); | |
}), this; | |
}, ot.each([ "ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend" ], function(e, t) { | |
ot.fn[t] = function(e) { | |
return this.on(t, e); | |
}; | |
}), ot.extend({ | |
active: 0, | |
lastModified: {}, | |
etag: {}, | |
ajaxSettings: { | |
url: an, | |
type: "GET", | |
isLocal: hn.test(sn[1]), | |
global: !0, | |
processData: !0, | |
async: !0, | |
contentType: "application/x-www-form-urlencoded; charset=UTF-8", | |
accepts: { | |
"*": bn, | |
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": ot.parseJSON, | |
"text xml": ot.parseXML | |
}, | |
flatOptions: { | |
url: !0, | |
context: !0 | |
} | |
}, | |
ajaxSetup: function(e, t) { | |
return t ? N(N(e, ot.ajaxSettings), t) : N(ot.ajaxSettings, e); | |
}, | |
ajaxPrefilter: A(yn), | |
ajaxTransport: A(wn), | |
ajax: function(e, n) { | |
function r(e, n, r, a) { | |
var l, d, y, w, _, E = n; | |
2 !== b && (b = 2, u && clearTimeout(u), i = t, s = a || "", x.readyState = e > 0 ? 4 : 0, | |
l = e >= 200 && 300 > e || 304 === e, r && (w = O(p, x, r)), w = M(p, w, x, l), | |
l ? (p.ifModified && (_ = x.getResponseHeader("Last-Modified"), _ && (ot.lastModified[o] = _), | |
_ = x.getResponseHeader("etag"), _ && (ot.etag[o] = _)), 204 === e || "HEAD" === p.type ? E = "nocontent" : 304 === e ? E = "notmodified" : (E = w.state, | |
d = w.data, y = w.error, l = !y)) : (y = E, (e || !E) && (E = "error", 0 > e && (e = 0))), | |
x.status = e, x.statusText = (n || E) + "", l ? m.resolveWith(h, [ d, E, x ]) : m.rejectWith(h, [ x, E, y ]), | |
x.statusCode(v), v = t, c && f.trigger(l ? "ajaxSuccess" : "ajaxError", [ x, p, l ? d : y ]), | |
g.fireWith(h, [ x, E ]), c && (f.trigger("ajaxComplete", [ x, p ]), --ot.active || ot.event.trigger("ajaxStop"))); | |
} | |
"object" == typeof e && (n = e, e = t), n = n || {}; | |
var i, o, s, a, u, l, c, d, p = ot.ajaxSetup({}, n), h = p.context || p, f = p.context && (h.nodeType || h.jquery) ? ot(h) : ot.event, m = ot.Deferred(), g = ot.Callbacks("once memory"), v = p.statusCode || {}, y = {}, w = {}, b = 0, _ = "canceled", x = { | |
readyState: 0, | |
getResponseHeader: function(e) { | |
var t; | |
if (2 === b) { | |
if (!a) for (a = {}; t = pn.exec(s); ) a[t[1].toLowerCase()] = t[2]; | |
t = a[e.toLowerCase()]; | |
} | |
return null == t ? null : t; | |
}, | |
getAllResponseHeaders: function() { | |
return 2 === b ? s : null; | |
}, | |
setRequestHeader: function(e, t) { | |
var n = e.toLowerCase(); | |
return b || (e = w[n] = w[n] || e, y[e] = t), this; | |
}, | |
overrideMimeType: function(e) { | |
return b || (p.mimeType = e), this; | |
}, | |
statusCode: function(e) { | |
var t; | |
if (e) if (2 > b) for (t in e) v[t] = [ v[t], e[t] ]; else x.always(e[x.status]); | |
return this; | |
}, | |
abort: function(e) { | |
var t = e || _; | |
return i && i.abort(t), r(0, t), this; | |
} | |
}; | |
if (m.promise(x).complete = g.add, x.success = x.done, x.error = x.fail, p.url = ((e || p.url || an) + "").replace(cn, "").replace(mn, sn[1] + "//"), | |
p.type = n.method || n.type || p.method || p.type, p.dataTypes = ot.trim(p.dataType || "*").toLowerCase().match(at) || [ "" ], | |
null == p.crossDomain && (l = gn.exec(p.url.toLowerCase()), p.crossDomain = !(!l || l[1] === sn[1] && l[2] === sn[2] && (l[3] || ("http:" === l[1] ? "80" : "443")) === (sn[3] || ("http:" === sn[1] ? "80" : "443")))), | |
p.data && p.processData && "string" != typeof p.data && (p.data = ot.param(p.data, p.traditional)), | |
D(yn, p, n, x), 2 === b) return x; | |
c = p.global, c && 0 === ot.active++ && ot.event.trigger("ajaxStart"), p.type = p.type.toUpperCase(), | |
p.hasContent = !fn.test(p.type), o = p.url, p.hasContent || (p.data && (o = p.url += (ln.test(o) ? "&" : "?") + p.data, | |
delete p.data), p.cache === !1 && (p.url = dn.test(o) ? o.replace(dn, "$1_=" + un++) : o + (ln.test(o) ? "&" : "?") + "_=" + un++)), | |
p.ifModified && (ot.lastModified[o] && x.setRequestHeader("If-Modified-Since", ot.lastModified[o]), | |
ot.etag[o] && x.setRequestHeader("If-None-Match", ot.etag[o])), (p.data && p.hasContent && p.contentType !== !1 || n.contentType) && x.setRequestHeader("Content-Type", p.contentType), | |
x.setRequestHeader("Accept", p.dataTypes[0] && p.accepts[p.dataTypes[0]] ? p.accepts[p.dataTypes[0]] + ("*" !== p.dataTypes[0] ? ", " + bn + "; q=0.01" : "") : p.accepts["*"]); | |
for (d in p.headers) x.setRequestHeader(d, p.headers[d]); | |
if (p.beforeSend && (p.beforeSend.call(h, x, p) === !1 || 2 === b)) return x.abort(); | |
_ = "abort"; | |
for (d in { | |
success: 1, | |
error: 1, | |
complete: 1 | |
}) x[d](p[d]); | |
if (i = D(wn, p, n, x)) { | |
x.readyState = 1, c && f.trigger("ajaxSend", [ x, p ]), p.async && p.timeout > 0 && (u = setTimeout(function() { | |
x.abort("timeout"); | |
}, p.timeout)); | |
try { | |
b = 1, i.send(y, r); | |
} catch (E) { | |
if (!(2 > b)) throw E; | |
r(-1, E); | |
} | |
} else r(-1, "No Transport"); | |
return x; | |
}, | |
getJSON: function(e, t, n) { | |
return ot.get(e, t, n, "json"); | |
}, | |
getScript: function(e, n) { | |
return ot.get(e, t, n, "script"); | |
} | |
}), ot.each([ "get", "post" ], function(e, n) { | |
ot[n] = function(e, r, i, o) { | |
return ot.isFunction(r) && (o = o || i, i = r, r = t), ot.ajax({ | |
url: e, | |
type: n, | |
dataType: o, | |
data: r, | |
success: i | |
}); | |
}; | |
}), ot.ajaxSetup({ | |
accepts: { | |
script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript" | |
}, | |
contents: { | |
script: /(?:java|ecma)script/ | |
}, | |
converters: { | |
"text script": function(e) { | |
return ot.globalEval(e), e; | |
} | |
} | |
}), ot.ajaxPrefilter("script", function(e) { | |
e.cache === t && (e.cache = !1), e.crossDomain && (e.type = "GET"); | |
}), ot.ajaxTransport("script", function(e) { | |
if (e.crossDomain) { | |
var t, n; | |
return { | |
send: function(r, i) { | |
t = ot("<script>").prop({ | |
async: !0, | |
charset: e.scriptCharset, | |
src: e.url | |
}).on("load error", n = function(e) { | |
t.remove(), n = null, e && i("error" === e.type ? 404 : 200, e.type); | |
}), z.head.appendChild(t[0]); | |
}, | |
abort: function() { | |
n && n(); | |
} | |
}; | |
} | |
}); | |
var xn = [], En = /(=)\?(?=&|$)|\?\?/; | |
ot.ajaxSetup({ | |
jsonp: "callback", | |
jsonpCallback: function() { | |
var e = xn.pop() || ot.expando + "_" + un++; | |
return this[e] = !0, e; | |
} | |
}), ot.ajaxPrefilter("json jsonp", function(n, r, i) { | |
var o, s, a, u = n.jsonp !== !1 && (En.test(n.url) ? "url" : "string" == typeof n.data && !(n.contentType || "").indexOf("application/x-www-form-urlencoded") && En.test(n.data) && "data"); | |
return u || "jsonp" === n.dataTypes[0] ? (o = n.jsonpCallback = ot.isFunction(n.jsonpCallback) ? n.jsonpCallback() : n.jsonpCallback, | |
u ? n[u] = n[u].replace(En, "$1" + o) : n.jsonp !== !1 && (n.url += (ln.test(n.url) ? "&" : "?") + n.jsonp + "=" + o), | |
n.converters["script json"] = function() { | |
return a || ot.error(o + " was not called"), a[0]; | |
}, n.dataTypes[0] = "json", s = e[o], e[o] = function() { | |
a = arguments; | |
}, i.always(function() { | |
e[o] = s, n[o] && (n.jsonpCallback = r.jsonpCallback, xn.push(o)), a && ot.isFunction(s) && s(a[0]), | |
a = s = t; | |
}), "script") : void 0; | |
}), ot.ajaxSettings.xhr = function() { | |
try { | |
return new XMLHttpRequest(); | |
} catch (e) {} | |
}; | |
var kn = ot.ajaxSettings.xhr(), Sn = { | |
0: 200, | |
1223: 204 | |
}, Tn = 0, Cn = {}; | |
e.ActiveXObject && ot(e).on("unload", function() { | |
for (var e in Cn) Cn[e](); | |
Cn = t; | |
}), ot.support.cors = !!kn && "withCredentials" in kn, ot.support.ajax = kn = !!kn, | |
ot.ajaxTransport(function(e) { | |
var n; | |
return ot.support.cors || kn && !e.crossDomain ? { | |
send: function(r, i) { | |
var o, s, a = e.xhr(); | |
if (a.open(e.type, e.url, e.async, e.username, e.password), e.xhrFields) for (o in e.xhrFields) a[o] = e.xhrFields[o]; | |
e.mimeType && a.overrideMimeType && a.overrideMimeType(e.mimeType), e.crossDomain || r["X-Requested-With"] || (r["X-Requested-With"] = "XMLHttpRequest"); | |
for (o in r) a.setRequestHeader(o, r[o]); | |
n = function(e) { | |
return function() { | |
n && (delete Cn[s], n = a.onload = a.onerror = null, "abort" === e ? a.abort() : "error" === e ? i(a.status || 404, a.statusText) : i(Sn[a.status] || a.status, a.statusText, "string" == typeof a.responseText ? { | |
text: a.responseText | |
} : t, a.getAllResponseHeaders())); | |
}; | |
}, a.onload = n(), a.onerror = n("error"), n = Cn[s = Tn++] = n("abort"), a.send(e.hasContent && e.data || null); | |
}, | |
abort: function() { | |
n && n(); | |
} | |
} : void 0; | |
}); | |
var An, Dn, Nn = /^(?:toggle|show|hide)$/, On = new RegExp("^(?:([+-])=|)(" + st + ")([a-z%]*)$", "i"), Mn = /queueHooks$/, jn = [ $ ], In = { | |
"*": [ function(e, t) { | |
var n = this.createTween(e, t), r = n.cur(), i = On.exec(t), o = i && i[3] || (ot.cssNumber[e] ? "" : "px"), s = (ot.cssNumber[e] || "px" !== o && +r) && On.exec(ot.css(n.elem, e)), a = 1, u = 20; | |
if (s && s[3] !== o) { | |
o = o || s[3], i = i || [], s = +r || 1; | |
do a = a || ".5", s /= a, ot.style(n.elem, e, s + o); while (a !== (a = n.cur() / r) && 1 !== a && --u); | |
} | |
return i && (s = n.start = +s || +r || 0, n.unit = o, n.end = i[1] ? s + (i[1] + 1) * i[2] : +i[2]), | |
n; | |
} ] | |
}; | |
ot.Animation = ot.extend(P, { | |
tweener: function(e, t) { | |
ot.isFunction(e) ? (t = e, e = [ "*" ]) : e = e.split(" "); | |
for (var n, r = 0, i = e.length; i > r; r++) n = e[r], In[n] = In[n] || [], In[n].unshift(t); | |
}, | |
prefilter: function(e, t) { | |
t ? jn.unshift(e) : jn.push(e); | |
} | |
}), ot.Tween = L, L.prototype = { | |
constructor: L, | |
init: function(e, t, n, r, i, o) { | |
this.elem = e, this.prop = n, this.easing = i || "swing", this.options = t, this.start = this.now = this.cur(), | |
this.end = r, this.unit = o || (ot.cssNumber[n] ? "" : "px"); | |
}, | |
cur: function() { | |
var e = L.propHooks[this.prop]; | |
return e && e.get ? e.get(this) : L.propHooks._default.get(this); | |
}, | |
run: function(e) { | |
var t, n = L.propHooks[this.prop]; | |
return this.pos = t = this.options.duration ? ot.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), | |
n && n.set ? n.set(this) : L.propHooks._default.set(this), this; | |
} | |
}, L.prototype.init.prototype = L.prototype, L.propHooks = { | |
_default: { | |
get: function(e) { | |
var t; | |
return null == e.elem[e.prop] || e.elem.style && null != e.elem.style[e.prop] ? (t = ot.css(e.elem, e.prop, ""), | |
t && "auto" !== t ? t : 0) : e.elem[e.prop]; | |
}, | |
set: function(e) { | |
ot.fx.step[e.prop] ? ot.fx.step[e.prop](e) : e.elem.style && (null != e.elem.style[ot.cssProps[e.prop]] || ot.cssHooks[e.prop]) ? ot.style(e.elem, e.prop, e.now + e.unit) : e.elem[e.prop] = e.now; | |
} | |
} | |
}, L.propHooks.scrollTop = L.propHooks.scrollLeft = { | |
set: function(e) { | |
e.elem.nodeType && e.elem.parentNode && (e.elem[e.prop] = e.now); | |
} | |
}, ot.each([ "toggle", "show", "hide" ], function(e, t) { | |
var n = ot.fn[t]; | |
ot.fn[t] = function(e, r, i) { | |
return null == e || "boolean" == typeof e ? n.apply(this, arguments) : this.animate(V(t, !0), e, r, i); | |
}; | |
}), ot.fn.extend({ | |
fadeTo: function(e, t, n, r) { | |
return this.filter(w).css("opacity", 0).show().end().animate({ | |
opacity: t | |
}, e, n, r); | |
}, | |
animate: function(e, t, n, r) { | |
var i = ot.isEmptyObject(e), o = ot.speed(t, n, r), s = function() { | |
var t = P(this, ot.extend({}, e), o); | |
(i || gt.get(this, "finish")) && t.stop(!0); | |
}; | |
return s.finish = s, i || o.queue === !1 ? this.each(s) : this.queue(o.queue, s); | |
}, | |
stop: function(e, n, r) { | |
var i = function(e) { | |
var t = e.stop; | |
delete e.stop, t(r); | |
}; | |
return "string" != typeof e && (r = n, n = e, e = t), n && e !== !1 && this.queue(e || "fx", []), | |
this.each(function() { | |
var t = !0, n = null != e && e + "queueHooks", o = ot.timers, s = gt.get(this); | |
if (n) s[n] && s[n].stop && i(s[n]); else for (n in s) s[n] && s[n].stop && Mn.test(n) && i(s[n]); | |
for (n = o.length; n--; ) o[n].elem !== this || null != e && o[n].queue !== e || (o[n].anim.stop(r), | |
t = !1, o.splice(n, 1)); | |
(t || !r) && ot.dequeue(this, e); | |
}); | |
}, | |
finish: function(e) { | |
return e !== !1 && (e = e || "fx"), this.each(function() { | |
var t, n = gt.get(this), r = n[e + "queue"], i = n[e + "queueHooks"], o = ot.timers, s = r ? r.length : 0; | |
for (n.finish = !0, ot.queue(this, e, []), i && i.stop && i.stop.call(this, !0), | |
t = o.length; t--; ) o[t].elem === this && o[t].queue === e && (o[t].anim.stop(!0), | |
o.splice(t, 1)); | |
for (t = 0; s > t; t++) r[t] && r[t].finish && r[t].finish.call(this); | |
delete n.finish; | |
}); | |
} | |
}), ot.each({ | |
slideDown: V("show"), | |
slideUp: V("hide"), | |
slideToggle: V("toggle"), | |
fadeIn: { | |
opacity: "show" | |
}, | |
fadeOut: { | |
opacity: "hide" | |
}, | |
fadeToggle: { | |
opacity: "toggle" | |
} | |
}, function(e, t) { | |
ot.fn[e] = function(e, n, r) { | |
return this.animate(t, e, n, r); | |
}; | |
}), ot.speed = function(e, t, n) { | |
var r = e && "object" == typeof e ? ot.extend({}, e) : { | |
complete: n || !n && t || ot.isFunction(e) && e, | |
duration: e, | |
easing: n && t || t && !ot.isFunction(t) && t | |
}; | |
return r.duration = ot.fx.off ? 0 : "number" == typeof r.duration ? r.duration : r.duration in ot.fx.speeds ? ot.fx.speeds[r.duration] : ot.fx.speeds._default, | |
(null == r.queue || r.queue === !0) && (r.queue = "fx"), r.old = r.complete, r.complete = function() { | |
ot.isFunction(r.old) && r.old.call(this), r.queue && ot.dequeue(this, r.queue); | |
}, r; | |
}, ot.easing = { | |
linear: function(e) { | |
return e; | |
}, | |
swing: function(e) { | |
return .5 - Math.cos(e * Math.PI) / 2; | |
} | |
}, ot.timers = [], ot.fx = L.prototype.init, ot.fx.tick = function() { | |
var e, n = ot.timers, r = 0; | |
for (An = ot.now(); r < n.length; r++) e = n[r], e() || n[r] !== e || n.splice(r--, 1); | |
n.length || ot.fx.stop(), An = t; | |
}, ot.fx.timer = function(e) { | |
e() && ot.timers.push(e) && ot.fx.start(); | |
}, ot.fx.interval = 13, ot.fx.start = function() { | |
Dn || (Dn = setInterval(ot.fx.tick, ot.fx.interval)); | |
}, ot.fx.stop = function() { | |
clearInterval(Dn), Dn = null; | |
}, ot.fx.speeds = { | |
slow: 600, | |
fast: 200, | |
_default: 400 | |
}, ot.fx.step = {}, ot.expr && ot.expr.filters && (ot.expr.filters.animated = function(e) { | |
return ot.grep(ot.timers, function(t) { | |
return e === t.elem; | |
}).length; | |
}), ot.fn.offset = function(e) { | |
if (arguments.length) return e === t ? this : this.each(function(t) { | |
ot.offset.setOffset(this, e, t); | |
}); | |
var n, r, i = this[0], o = { | |
top: 0, | |
left: 0 | |
}, s = i && i.ownerDocument; | |
if (s) return n = s.documentElement, ot.contains(n, i) ? (typeof i.getBoundingClientRect !== H && (o = i.getBoundingClientRect()), | |
r = q(s), { | |
top: o.top + r.pageYOffset - n.clientTop, | |
left: o.left + r.pageXOffset - n.clientLeft | |
}) : o; | |
}, ot.offset = { | |
setOffset: function(e, t, n) { | |
var r, i, o, s, a, u, l, c = ot.css(e, "position"), d = ot(e), p = {}; | |
"static" === c && (e.style.position = "relative"), a = d.offset(), o = ot.css(e, "top"), | |
u = ot.css(e, "left"), l = ("absolute" === c || "fixed" === c) && (o + u).indexOf("auto") > -1, | |
l ? (r = d.position(), s = r.top, i = r.left) : (s = parseFloat(o) || 0, i = parseFloat(u) || 0), | |
ot.isFunction(t) && (t = t.call(e, n, a)), null != t.top && (p.top = t.top - a.top + s), | |
null != t.left && (p.left = t.left - a.left + i), "using" in t ? t.using.call(e, p) : d.css(p); | |
} | |
}, ot.fn.extend({ | |
position: function() { | |
if (this[0]) { | |
var e, t, n = this[0], r = { | |
top: 0, | |
left: 0 | |
}; | |
return "fixed" === ot.css(n, "position") ? t = n.getBoundingClientRect() : (e = this.offsetParent(), | |
t = this.offset(), ot.nodeName(e[0], "html") || (r = e.offset()), r.top += ot.css(e[0], "borderTopWidth", !0), | |
r.left += ot.css(e[0], "borderLeftWidth", !0)), { | |
top: t.top - r.top - ot.css(n, "marginTop", !0), | |
left: t.left - r.left - ot.css(n, "marginLeft", !0) | |
}; | |
} | |
}, | |
offsetParent: function() { | |
return this.map(function() { | |
for (var e = this.offsetParent || Y; e && !ot.nodeName(e, "html") && "static" === ot.css(e, "position"); ) e = e.offsetParent; | |
return e || Y; | |
}); | |
} | |
}), ot.each({ | |
scrollLeft: "pageXOffset", | |
scrollTop: "pageYOffset" | |
}, function(n, r) { | |
var i = "pageYOffset" === r; | |
ot.fn[n] = function(o) { | |
return ot.access(this, function(n, o, s) { | |
var a = q(n); | |
return s === t ? a ? a[r] : n[o] : (a ? a.scrollTo(i ? e.pageXOffset : s, i ? s : e.pageYOffset) : n[o] = s, | |
void 0); | |
}, n, o, arguments.length, null); | |
}; | |
}), ot.each({ | |
Height: "height", | |
Width: "width" | |
}, function(e, n) { | |
ot.each({ | |
padding: "inner" + e, | |
content: n, | |
"": "outer" + e | |
}, function(r, i) { | |
ot.fn[i] = function(i, o) { | |
var s = arguments.length && (r || "boolean" != typeof i), a = r || (i === !0 || o === !0 ? "margin" : "border"); | |
return ot.access(this, function(n, r, i) { | |
var o; | |
return ot.isWindow(n) ? n.document.documentElement["client" + e] : 9 === n.nodeType ? (o = n.documentElement, | |
Math.max(n.body["scroll" + e], o["scroll" + e], n.body["offset" + e], o["offset" + e], o["client" + e])) : i === t ? ot.css(n, r, a) : ot.style(n, r, i, a); | |
}, n, s ? i : t, s, null); | |
}; | |
}); | |
}), ot.fn.size = function() { | |
return this.length; | |
}, ot.fn.andSelf = ot.fn.addBack, "object" == typeof module && module && "object" == typeof module.exports ? module.exports = ot : "function" == typeof define && define.amd && define("jquery", [], function() { | |
return ot; | |
}), "object" == typeof e && "object" == typeof e.document && (e.jQuery = e.$ = ot); | |
}(window), function() { | |
var e = this, t = e._, n = {}, r = Array.prototype, i = Object.prototype, o = Function.prototype, s = r.push, a = r.slice, u = r.concat, l = i.toString, c = i.hasOwnProperty, d = r.forEach, p = r.map, h = r.reduce, f = r.reduceRight, m = r.filter, g = r.every, v = r.some, y = r.indexOf, w = r.lastIndexOf, b = Array.isArray, _ = Object.keys, x = o.bind, E = function(e) { | |
return e instanceof E ? e : this instanceof E ? (this._wrapped = e, void 0) : new E(e); | |
}; | |
"undefined" != typeof exports ? ("undefined" != typeof module && module.exports && (exports = module.exports = E), | |
exports._ = E) : e._ = E, E.VERSION = "1.4.4"; | |
var k = E.each = E.forEach = function(e, t, r) { | |
if (null != e) if (d && e.forEach === d) e.forEach(t, r); else if (e.length === +e.length) { | |
for (var i = 0, o = e.length; o > i; i++) if (t.call(r, e[i], i, e) === n) return; | |
} else for (var s in e) if (E.has(e, s) && t.call(r, e[s], s, e) === n) return; | |
}; | |
E.map = E.collect = function(e, t, n) { | |
var r = []; | |
return null == e ? r : p && e.map === p ? e.map(t, n) : (k(e, function(e, i, o) { | |
r[r.length] = t.call(n, e, i, o); | |
}), r); | |
}; | |
var S = "Reduce of empty array with no initial value"; | |
E.reduce = E.foldl = E.inject = function(e, t, n, r) { | |
var i = arguments.length > 2; | |
if (null == e && (e = []), h && e.reduce === h) return r && (t = E.bind(t, r)), | |
i ? e.reduce(t, n) : e.reduce(t); | |
if (k(e, function(e, o, s) { | |
i ? n = t.call(r, n, e, o, s) : (n = e, i = !0); | |
}), !i) throw new TypeError(S); | |
return n; | |
}, E.reduceRight = E.foldr = function(e, t, n, r) { | |
var i = arguments.length > 2; | |
if (null == e && (e = []), f && e.reduceRight === f) return r && (t = E.bind(t, r)), | |
i ? e.reduceRight(t, n) : e.reduceRight(t); | |
var o = e.length; | |
if (o !== +o) { | |
var s = E.keys(e); | |
o = s.length; | |
} | |
if (k(e, function(a, u, l) { | |
u = s ? s[--o] : --o, i ? n = t.call(r, n, e[u], u, l) : (n = e[u], i = !0); | |
}), !i) throw new TypeError(S); | |
return n; | |
}, E.find = E.detect = function(e, t, n) { | |
var r; | |
return T(e, function(e, i, o) { | |
return t.call(n, e, i, o) ? (r = e, !0) : void 0; | |
}), r; | |
}, E.filter = E.select = function(e, t, n) { | |
var r = []; | |
return null == e ? r : m && e.filter === m ? e.filter(t, n) : (k(e, function(e, i, o) { | |
t.call(n, e, i, o) && (r[r.length] = e); | |
}), r); | |
}, E.reject = function(e, t, n) { | |
return E.filter(e, function(e, r, i) { | |
return !t.call(n, e, r, i); | |
}, n); | |
}, E.every = E.all = function(e, t, r) { | |
t || (t = E.identity); | |
var i = !0; | |
return null == e ? i : g && e.every === g ? e.every(t, r) : (k(e, function(e, o, s) { | |
return (i = i && t.call(r, e, o, s)) ? void 0 : n; | |
}), !!i); | |
}; | |
var T = E.some = E.any = function(e, t, r) { | |
t || (t = E.identity); | |
var i = !1; | |
return null == e ? i : v && e.some === v ? e.some(t, r) : (k(e, function(e, o, s) { | |
return i || (i = t.call(r, e, o, s)) ? n : void 0; | |
}), !!i); | |
}; | |
E.contains = E.include = function(e, t) { | |
return null == e ? !1 : y && e.indexOf === y ? -1 != e.indexOf(t) : T(e, function(e) { | |
return e === t; | |
}); | |
}, E.invoke = function(e, t) { | |
var n = a.call(arguments, 2), r = E.isFunction(t); | |
return E.map(e, function(e) { | |
return (r ? t : e[t]).apply(e, n); | |
}); | |
}, E.pluck = function(e, t) { | |
return E.map(e, function(e) { | |
return e[t]; | |
}); | |
}, E.where = function(e, t, n) { | |
return E.isEmpty(t) ? n ? null : [] : E[n ? "find" : "filter"](e, function(e) { | |
for (var n in t) if (t[n] !== e[n]) return !1; | |
return !0; | |
}); | |
}, E.findWhere = function(e, t) { | |
return E.where(e, t, !0); | |
}, E.max = function(e, t, n) { | |
if (!t && E.isArray(e) && e[0] === +e[0] && e.length < 65535) return Math.max.apply(Math, e); | |
if (!t && E.isEmpty(e)) return -1 / 0; | |
var r = { | |
computed: -1 / 0, | |
value: -1 / 0 | |
}; | |
return k(e, function(e, i, o) { | |
var s = t ? t.call(n, e, i, o) : e; | |
s >= r.computed && (r = { | |
value: e, | |
computed: s | |
}); | |
}), r.value; | |
}, E.min = function(e, t, n) { | |
if (!t && E.isArray(e) && e[0] === +e[0] && e.length < 65535) return Math.min.apply(Math, e); | |
if (!t && E.isEmpty(e)) return 1 / 0; | |
var r = { | |
computed: 1 / 0, | |
value: 1 / 0 | |
}; | |
return k(e, function(e, i, o) { | |
var s = t ? t.call(n, e, i, o) : e; | |
s < r.computed && (r = { | |
value: e, | |
computed: s | |
}); | |
}), r.value; | |
}, E.shuffle = function(e) { | |
var t, n = 0, r = []; | |
return k(e, function(e) { | |
t = E.random(n++), r[n - 1] = r[t], r[t] = e; | |
}), r; | |
}; | |
var C = function(e) { | |
return E.isFunction(e) ? e : function(t) { | |
return t[e]; | |
}; | |
}; | |
E.sortBy = function(e, t, n) { | |
var r = C(t); | |
return E.pluck(E.map(e, function(e, t, i) { | |
return { | |
value: e, | |
index: t, | |
criteria: r.call(n, e, t, i) | |
}; | |
}).sort(function(e, t) { | |
var n = e.criteria, r = t.criteria; | |
if (n !== r) { | |
if (n > r || void 0 === n) return 1; | |
if (r > n || void 0 === r) return -1; | |
} | |
return e.index < t.index ? -1 : 1; | |
}), "value"); | |
}; | |
var A = function(e, t, n, r) { | |
var i = {}, o = C(t || E.identity); | |
return k(e, function(t, s) { | |
var a = o.call(n, t, s, e); | |
r(i, a, t); | |
}), i; | |
}; | |
E.groupBy = function(e, t, n) { | |
return A(e, t, n, function(e, t, n) { | |
(E.has(e, t) ? e[t] : e[t] = []).push(n); | |
}); | |
}, E.countBy = function(e, t, n) { | |
return A(e, t, n, function(e, t) { | |
E.has(e, t) || (e[t] = 0), e[t]++; | |
}); | |
}, E.sortedIndex = function(e, t, n, r) { | |
n = null == n ? E.identity : C(n); | |
for (var i = n.call(r, t), o = 0, s = e.length; s > o; ) { | |
var a = o + s >>> 1; | |
n.call(r, e[a]) < i ? o = a + 1 : s = a; | |
} | |
return o; | |
}, E.toArray = function(e) { | |
return e ? E.isArray(e) ? a.call(e) : e.length === +e.length ? E.map(e, E.identity) : E.values(e) : []; | |
}, E.size = function(e) { | |
return null == e ? 0 : e.length === +e.length ? e.length : E.keys(e).length; | |
}, E.first = E.head = E.take = function(e, t, n) { | |
return null == e ? void 0 : null == t || n ? e[0] : a.call(e, 0, t); | |
}, E.initial = function(e, t, n) { | |
return a.call(e, 0, e.length - (null == t || n ? 1 : t)); | |
}, E.last = function(e, t, n) { | |
return null == e ? void 0 : null == t || n ? e[e.length - 1] : a.call(e, Math.max(e.length - t, 0)); | |
}, E.rest = E.tail = E.drop = function(e, t, n) { | |
return a.call(e, null == t || n ? 1 : t); | |
}, E.compact = function(e) { | |
return E.filter(e, E.identity); | |
}; | |
var D = function(e, t, n) { | |
return k(e, function(e) { | |
E.isArray(e) ? t ? s.apply(n, e) : D(e, t, n) : n.push(e); | |
}), n; | |
}; | |
E.flatten = function(e, t) { | |
return D(e, t, []); | |
}, E.without = function(e) { | |
return E.difference(e, a.call(arguments, 1)); | |
}, E.uniq = E.unique = function(e, t, n, r) { | |
E.isFunction(t) && (r = n, n = t, t = !1); | |
var i = n ? E.map(e, n, r) : e, o = [], s = []; | |
return k(i, function(n, r) { | |
(t ? r && s[s.length - 1] === n : E.contains(s, n)) || (s.push(n), o.push(e[r])); | |
}), o; | |
}, E.union = function() { | |
return E.uniq(u.apply(r, arguments)); | |
}, E.intersection = function(e) { | |
var t = a.call(arguments, 1); | |
return E.filter(E.uniq(e), function(e) { | |
return E.every(t, function(t) { | |
return E.indexOf(t, e) >= 0; | |
}); | |
}); | |
}, E.difference = function(e) { | |
var t = u.apply(r, a.call(arguments, 1)); | |
return E.filter(e, function(e) { | |
return !E.contains(t, e); | |
}); | |
}, E.zip = function() { | |
for (var e = a.call(arguments), t = E.max(E.pluck(e, "length")), n = new Array(t), r = 0; t > r; r++) n[r] = E.pluck(e, "" + r); | |
return n; | |
}, E.object = function(e, t) { | |
if (null == e) return {}; | |
for (var n = {}, r = 0, i = e.length; i > r; r++) t ? n[e[r]] = t[r] : n[e[r][0]] = e[r][1]; | |
return n; | |
}, E.indexOf = function(e, t, n) { | |
if (null == e) return -1; | |
var r = 0, i = e.length; | |
if (n) { | |
if ("number" != typeof n) return r = E.sortedIndex(e, t), e[r] === t ? r : -1; | |
r = 0 > n ? Math.max(0, i + n) : n; | |
} | |
if (y && e.indexOf === y) return e.indexOf(t, n); | |
for (;i > r; r++) if (e[r] === t) return r; | |
return -1; | |
}, E.lastIndexOf = function(e, t, n) { | |
if (null == e) return -1; | |
var r = null != n; | |
if (w && e.lastIndexOf === w) return r ? e.lastIndexOf(t, n) : e.lastIndexOf(t); | |
for (var i = r ? n : e.length; i--; ) if (e[i] === t) return i; | |
return -1; | |
}, E.range = function(e, t, n) { | |
arguments.length <= 1 && (t = e || 0, e = 0), n = arguments[2] || 1; | |
for (var r = Math.max(Math.ceil((t - e) / n), 0), i = 0, o = new Array(r); r > i; ) o[i++] = e, | |
e += n; | |
return o; | |
}, E.bind = function(e, t) { | |
if (e.bind === x && x) return x.apply(e, a.call(arguments, 1)); | |
var n = a.call(arguments, 2); | |
return function() { | |
return e.apply(t, n.concat(a.call(arguments))); | |
}; | |
}, E.partial = function(e) { | |
var t = a.call(arguments, 1); | |
return function() { | |
return e.apply(this, t.concat(a.call(arguments))); | |
}; | |
}, E.bindAll = function(e) { | |
var t = a.call(arguments, 1); | |
return 0 === t.length && (t = E.functions(e)), k(t, function(t) { | |
e[t] = E.bind(e[t], e); | |
}), e; | |
}, E.memoize = function(e, t) { | |
var n = {}; | |
return t || (t = E.identity), function() { | |
var r = t.apply(this, arguments); | |
return E.has(n, r) ? n[r] : n[r] = e.apply(this, arguments); | |
}; | |
}, E.delay = function(e, t) { | |
var n = a.call(arguments, 2); | |
return setTimeout(function() { | |
return e.apply(null, n); | |
}, t); | |
}, E.defer = function(e) { | |
return E.delay.apply(E, [ e, 1 ].concat(a.call(arguments, 1))); | |
}, E.throttle = function(e, t) { | |
var n, r, i, o, s = 0, a = function() { | |
s = new Date(), i = null, o = e.apply(n, r); | |
}; | |
return function() { | |
var u = new Date(), l = t - (u - s); | |
return n = this, r = arguments, 0 >= l ? (clearTimeout(i), i = null, s = u, o = e.apply(n, r)) : i || (i = setTimeout(a, l)), | |
o; | |
}; | |
}, E.debounce = function(e, t, n) { | |
var r, i; | |
return function() { | |
var o = this, s = arguments, a = function() { | |
r = null, n || (i = e.apply(o, s)); | |
}, u = n && !r; | |
return clearTimeout(r), r = setTimeout(a, t), u && (i = e.apply(o, s)), i; | |
}; | |
}, E.once = function(e) { | |
var t, n = !1; | |
return function() { | |
return n ? t : (n = !0, t = e.apply(this, arguments), e = null, t); | |
}; | |
}, E.wrap = function(e, t) { | |
return function() { | |
var n = [ e ]; | |
return s.apply(n, arguments), t.apply(this, n); | |
}; | |
}, E.compose = function() { | |
var e = arguments; | |
return function() { | |
for (var t = arguments, n = e.length - 1; n >= 0; n--) t = [ e[n].apply(this, t) ]; | |
return t[0]; | |
}; | |
}, E.after = function(e, t) { | |
return 0 >= e ? t() : function() { | |
return --e < 1 ? t.apply(this, arguments) : void 0; | |
}; | |
}, E.keys = _ || function(e) { | |
if (e !== Object(e)) throw new TypeError("Invalid object"); | |
var t = []; | |
for (var n in e) E.has(e, n) && (t[t.length] = n); | |
return t; | |
}, E.values = function(e) { | |
var t = []; | |
for (var n in e) E.has(e, n) && t.push(e[n]); | |
return t; | |
}, E.pairs = function(e) { | |
var t = []; | |
for (var n in e) E.has(e, n) && t.push([ n, e[n] ]); | |
return t; | |
}, E.invert = function(e) { | |
var t = {}; | |
for (var n in e) E.has(e, n) && (t[e[n]] = n); | |
return t; | |
}, E.functions = E.methods = function(e) { | |
var t = []; | |
for (var n in e) E.isFunction(e[n]) && t.push(n); | |
return t.sort(); | |
}, E.extend = function(e) { | |
return k(a.call(arguments, 1), function(t) { | |
if (t) for (var n in t) e[n] = t[n]; | |
}), e; | |
}, E.pick = function(e) { | |
var t = {}, n = u.apply(r, a.call(arguments, 1)); | |
return k(n, function(n) { | |
n in e && (t[n] = e[n]); | |
}), t; | |
}, E.omit = function(e) { | |
var t = {}, n = u.apply(r, a.call(arguments, 1)); | |
for (var i in e) E.contains(n, i) || (t[i] = e[i]); | |
return t; | |
}, E.defaults = function(e) { | |
return k(a.call(arguments, 1), function(t) { | |
if (t) for (var n in t) null == e[n] && (e[n] = t[n]); | |
}), e; | |
}, E.clone = function(e) { | |
return E.isObject(e) ? E.isArray(e) ? e.slice() : E.extend({}, e) : e; | |
}, E.tap = function(e, t) { | |
return t(e), e; | |
}; | |
var N = function(e, t, n, r) { | |
if (e === t) return 0 !== e || 1 / e == 1 / t; | |
if (null == e || null == t) return e === t; | |
e instanceof E && (e = e._wrapped), t instanceof E && (t = t._wrapped); | |
var i = l.call(e); | |
if (i != l.call(t)) return !1; | |
switch (i) { | |
case "[object String]": | |
return e == String(t); | |
case "[object Number]": | |
return e != +e ? t != +t : 0 == e ? 1 / e == 1 / t : e == +t; | |
case "[object Date]": | |
case "[object Boolean]": | |
return +e == +t; | |
case "[object RegExp]": | |
return e.source == t.source && e.global == t.global && e.multiline == t.multiline && e.ignoreCase == t.ignoreCase; | |
} | |
if ("object" != typeof e || "object" != typeof t) return !1; | |
for (var o = n.length; o--; ) if (n[o] == e) return r[o] == t; | |
n.push(e), r.push(t); | |
var s = 0, a = !0; | |
if ("[object Array]" == i) { | |
if (s = e.length, a = s == t.length) for (;s-- && (a = N(e[s], t[s], n, r)); ) ; | |
} else { | |
var u = e.constructor, c = t.constructor; | |
if (u !== c && !(E.isFunction(u) && u instanceof u && E.isFunction(c) && c instanceof c)) return !1; | |
for (var d in e) if (E.has(e, d) && (s++, !(a = E.has(t, d) && N(e[d], t[d], n, r)))) break; | |
if (a) { | |
for (d in t) if (E.has(t, d) && !s--) break; | |
a = !s; | |
} | |
} | |
return n.pop(), r.pop(), a; | |
}; | |
E.isEqual = function(e, t) { | |
return N(e, t, [], []); | |
}, E.isEmpty = function(e) { | |
if (null == e) return !0; | |
if (E.isArray(e) || E.isString(e)) return 0 === e.length; | |
for (var t in e) if (E.has(e, t)) return !1; | |
return !0; | |
}, E.isElement = function(e) { | |
return !(!e || 1 !== e.nodeType); | |
}, E.isArray = b || function(e) { | |
return "[object Array]" == l.call(e); | |
}, E.isObject = function(e) { | |
return e === Object(e); | |
}, k([ "Arguments", "Function", "String", "Number", "Date", "RegExp" ], function(e) { | |
E["is" + e] = function(t) { | |
return l.call(t) == "[object " + e + "]"; | |
}; | |
}), E.isArguments(arguments) || (E.isArguments = function(e) { | |
return !(!e || !E.has(e, "callee")); | |
}), "function" != typeof /./ && (E.isFunction = function(e) { | |
return "function" == typeof e; | |
}), E.isFinite = function(e) { | |
return isFinite(e) && !isNaN(parseFloat(e)); | |
}, E.isNaN = function(e) { | |
return E.isNumber(e) && e != +e; | |
}, E.isBoolean = function(e) { | |
return e === !0 || e === !1 || "[object Boolean]" == l.call(e); | |
}, E.isNull = function(e) { | |
return null === e; | |
}, E.isUndefined = function(e) { | |
return void 0 === e; | |
}, E.has = function(e, t) { | |
return c.call(e, t); | |
}, E.noConflict = function() { | |
return e._ = t, this; | |
}, E.identity = function(e) { | |
return e; | |
}, E.times = function(e, t, n) { | |
for (var r = Array(e), i = 0; e > i; i++) r[i] = t.call(n, i); | |
return r; | |
}, E.random = function(e, t) { | |
return null == t && (t = e, e = 0), e + Math.floor(Math.random() * (t - e + 1)); | |
}; | |
var O = { | |
escape: { | |
"&": "&", | |
"<": "<", | |
">": ">", | |
'"': """, | |
"'": "'", | |
"/": "/" | |
} | |
}; | |
O.unescape = E.invert(O.escape); | |
var M = { | |
escape: new RegExp("[" + E.keys(O.escape).join("") + "]", "g"), | |
unescape: new RegExp("(" + E.keys(O.unescape).join("|") + ")", "g") | |
}; | |
E.each([ "escape", "unescape" ], function(e) { | |
E[e] = function(t) { | |
return null == t ? "" : ("" + t).replace(M[e], function(t) { | |
return O[e][t]; | |
}); | |
}; | |
}), E.result = function(e, t) { | |
if (null == e) return null; | |
var n = e[t]; | |
return E.isFunction(n) ? n.call(e) : n; | |
}, E.mixin = function(e) { | |
k(E.functions(e), function(t) { | |
var n = E[t] = e[t]; | |
E.prototype[t] = function() { | |
var e = [ this._wrapped ]; | |
return s.apply(e, arguments), $.call(this, n.apply(E, e)); | |
}; | |
}); | |
}; | |
var j = 0; | |
E.uniqueId = function(e) { | |
var t = ++j + ""; | |
return e ? e + t : t; | |
}, E.templateSettings = { | |
evaluate: /<%([\s\S]+?)%>/g, | |
interpolate: /<%=([\s\S]+?)%>/g, | |
escape: /<%-([\s\S]+?)%>/g | |
}; | |
var I = /(.)^/, P = { | |
"'": "'", | |
"\\": "\\", | |
"\r": "r", | |
"\n": "n", | |
" ": "t", | |
"\u2028": "u2028", | |
"\u2029": "u2029" | |
}, R = /\\|'|\r|\n|\t|\u2028|\u2029/g; | |
E.template = function(e, t, n) { | |
var r; | |
n = E.defaults({}, n, E.templateSettings); | |
var i = new RegExp([ (n.escape || I).source, (n.interpolate || I).source, (n.evaluate || I).source ].join("|") + "|$", "g"), o = 0, s = "__p+='"; | |
e.replace(i, function(t, n, r, i, a) { | |
return s += e.slice(o, a).replace(R, function(e) { | |
return "\\" + P[e]; | |
}), n && (s += "'+\n((__t=(" + n + "))==null?'':_.escape(__t))+\n'"), r && (s += "'+\n((__t=(" + r + "))==null?'':__t)+\n'"), | |
i && (s += "';\n" + i + "\n__p+='"), o = a + t.length, t; | |
}), s += "';\n", n.variable || (s = "with(obj||{}){\n" + s + "}\n"), s = "var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n" + s + "return __p;\n"; | |
try { | |
r = new Function(n.variable || "obj", "_", s); | |
} catch (a) { | |
throw a.source = s, a; | |
} | |
if (t) return r(t, E); | |
var u = function(e) { | |
return r.call(this, e, E); | |
}; | |
return u.source = "function(" + (n.variable || "obj") + "){\n" + s + "}", u; | |
}, E.chain = function(e) { | |
return E(e).chain(); | |
}; | |
var $ = function(e) { | |
return this._chain ? E(e).chain() : e; | |
}; | |
E.mixin(E), k([ "pop", "push", "reverse", "shift", "sort", "splice", "unshift" ], function(e) { | |
var t = r[e]; | |
E.prototype[e] = function() { | |
var n = this._wrapped; | |
return t.apply(n, arguments), "shift" != e && "splice" != e || 0 !== n.length || delete n[0], | |
$.call(this, n); | |
}; | |
}), k([ "concat", "join", "slice" ], function(e) { | |
var t = r[e]; | |
E.prototype[e] = function() { | |
return $.call(this, t.apply(this._wrapped, arguments)); | |
}; | |
}), E.extend(E.prototype, { | |
chain: function() { | |
return this._chain = !0, this; | |
}, | |
value: function() { | |
return this._wrapped; | |
} | |
}); | |
}.call(this), define("underscore", function(e) { | |
return function() { | |
var t, n; | |
return n = function() { | |
return this._.noConflict(); | |
}, t = n.apply(e, arguments), t || e._; | |
}; | |
}(this)), function() { | |
var e, t = this, n = t.Backbone, r = [], i = r.push, o = r.slice, s = r.splice; | |
e = "undefined" != typeof exports ? exports : t.Backbone = {}, e.VERSION = "1.0.0"; | |
var a = t._; | |
a || "undefined" == typeof require || (a = require("underscore")), e.$ = t.jQuery || t.Zepto || t.ender || t.$, | |
e.noConflict = function() { | |
return t.Backbone = n, this; | |
}, e.emulateHTTP = !1, e.emulateJSON = !1; | |
var u = e.Events = { | |
on: function(e, t, n) { | |
if (!c(this, "on", e, [ t, n ]) || !t) return this; | |
this._events || (this._events = {}); | |
var r = this._events[e] || (this._events[e] = []); | |
return r.push({ | |
callback: t, | |
context: n, | |
ctx: n || this | |
}), this; | |
}, | |
once: function(e, t, n) { | |
if (!c(this, "once", e, [ t, n ]) || !t) return this; | |
var r = this, i = a.once(function() { | |
r.off(e, i), t.apply(this, arguments); | |
}); | |
return i._callback = t, this.on(e, i, n); | |
}, | |
off: function(e, t, n) { | |
var r, i, o, s, u, l, d, p; | |
if (!this._events || !c(this, "off", e, [ t, n ])) return this; | |
if (!e && !t && !n) return this._events = {}, this; | |
for (s = e ? [ e ] : a.keys(this._events), u = 0, l = s.length; l > u; u++) if (e = s[u], | |
o = this._events[e]) { | |
if (this._events[e] = r = [], t || n) for (d = 0, p = o.length; p > d; d++) i = o[d], | |
(t && t !== i.callback && t !== i.callback._callback || n && n !== i.context) && r.push(i); | |
r.length || delete this._events[e]; | |
} | |
return this; | |
}, | |
trigger: function(e) { | |
if (!this._events) return this; | |
var t = o.call(arguments, 1); | |
if (!c(this, "trigger", e, t)) return this; | |
var n = this._events[e], r = this._events.all; | |
return n && d(n, t), r && d(r, arguments), this; | |
}, | |
stopListening: function(e, t, n) { | |
var r = this._listeners; | |
if (!r) return this; | |
var i = !t && !n; | |
"object" == typeof t && (n = this), e && ((r = {})[e._listenerId] = e); | |
for (var o in r) r[o].off(t, n, this), i && delete this._listeners[o]; | |
return this; | |
} | |
}, l = /\s+/, c = function(e, t, n, r) { | |
if (!n) return !0; | |
if ("object" == typeof n) { | |
for (var i in n) e[t].apply(e, [ i, n[i] ].concat(r)); | |
return !1; | |
} | |
if (l.test(n)) { | |
for (var o = n.split(l), s = 0, a = o.length; a > s; s++) e[t].apply(e, [ o[s] ].concat(r)); | |
return !1; | |
} | |
return !0; | |
}, d = function(e, t) { | |
var n, r = -1, i = e.length, o = t[0], s = t[1], a = t[2]; | |
switch (t.length) { | |
case 0: | |
for (;++r < i; ) (n = e[r]).callback.call(n.ctx); | |
return; | |
case 1: | |
for (;++r < i; ) (n = e[r]).callback.call(n.ctx, o); | |
return; | |
case 2: | |
for (;++r < i; ) (n = e[r]).callback.call(n.ctx, o, s); | |
return; | |
case 3: | |
for (;++r < i; ) (n = e[r]).callback.call(n.ctx, o, s, a); | |
return; | |
default: | |
for (;++r < i; ) (n = e[r]).callback.apply(n.ctx, t); | |
} | |
}, p = { | |
listenTo: "on", | |
listenToOnce: "once" | |
}; | |
a.each(p, function(e, t) { | |
u[t] = function(t, n, r) { | |
var i = this._listeners || (this._listeners = {}), o = t._listenerId || (t._listenerId = a.uniqueId("l")); | |
return i[o] = t, "object" == typeof n && (r = this), t[e](n, r, this), this; | |
}; | |
}), u.bind = u.on, u.unbind = u.off, a.extend(e, u); | |
var h = e.Model = function(e, t) { | |
var n, r = e || {}; | |
t || (t = {}), this.cid = a.uniqueId("c"), this.attributes = {}, a.extend(this, a.pick(t, f)), | |
t.parse && (r = this.parse(r, t) || {}), (n = a.result(this, "defaults")) && (r = a.defaults({}, r, n)), | |
this.set(r, t), this.changed = {}, this.initialize.apply(this, arguments); | |
}, f = [ "url", "urlRoot", "collection" ]; | |
a.extend(h.prototype, u, { | |
changed: null, | |
validationError: null, | |
idAttribute: "id", | |
initialize: function() {}, | |
toJSON: function() { | |
return a.clone(this.attributes); | |
}, | |
sync: function() { | |
return e.sync.apply(this, arguments); | |
}, | |
get: function(e) { | |
return this.attributes[e]; | |
}, | |
escape: function(e) { | |
return a.escape(this.get(e)); | |
}, | |
has: function(e) { | |
return null != this.get(e); | |
}, | |
set: function(e, t, n) { | |
var r, i, o, s, u, l, c, d; | |
if (null == e) return this; | |
if ("object" == typeof e ? (i = e, n = t) : (i = {})[e] = t, n || (n = {}), !this._validate(i, n)) return !1; | |
o = n.unset, u = n.silent, s = [], l = this._changing, this._changing = !0, l || (this._previousAttributes = a.clone(this.attributes), | |
this.changed = {}), d = this.attributes, c = this._previousAttributes, this.idAttribute in i && (this.id = i[this.idAttribute]); | |
for (r in i) t = i[r], a.isEqual(d[r], t) || s.push(r), a.isEqual(c[r], t) ? delete this.changed[r] : this.changed[r] = t, | |
o ? delete d[r] : d[r] = t; | |
if (!u) { | |
s.length && (this._pending = !0); | |
for (var p = 0, h = s.length; h > p; p++) this.trigger("change:" + s[p], this, d[s[p]], n); | |
} | |
if (l) return this; | |
if (!u) for (;this._pending; ) this._pending = !1, this.trigger("change", this, n); | |
return this._pending = !1, this._changing = !1, this; | |
}, | |
unset: function(e, t) { | |
return this.set(e, void 0, a.extend({}, t, { | |
unset: !0 | |
})); | |
}, | |
clear: function(e) { | |
var t = {}; | |
for (var n in this.attributes) t[n] = void 0; | |
return this.set(t, a.extend({}, e, { | |
unset: !0 | |
})); | |
}, | |
hasChanged: function(e) { | |
return null == e ? !a.isEmpty(this.changed) : a.has(this.changed, e); | |
}, | |
changedAttributes: function(e) { | |
if (!e) return this.hasChanged() ? a.clone(this.changed) : !1; | |
var t, n = !1, r = this._changing ? this._previousAttributes : this.attributes; | |
for (var i in e) a.isEqual(r[i], t = e[i]) || ((n || (n = {}))[i] = t); | |
return n; | |
}, | |
previous: function(e) { | |
return null != e && this._previousAttributes ? this._previousAttributes[e] : null; | |
}, | |
previousAttributes: function() { | |
return a.clone(this._previousAttributes); | |
}, | |
fetch: function(e) { | |
e = e ? a.clone(e) : {}, void 0 === e.parse && (e.parse = !0); | |
var t = this, n = e.success; | |
return e.success = function(r) { | |
return t.set(t.parse(r, e), e) ? (n && n(t, r, e), t.trigger("sync", t, r, e), void 0) : !1; | |
}, $(this, e), this.sync("read", this, e); | |
}, | |
save: function(e, t, n) { | |
var r, i, o, s = this.attributes; | |
if (null == e || "object" == typeof e ? (r = e, n = t) : (r = {})[e] = t, !(!r || n && n.wait || this.set(r, n))) return !1; | |
if (n = a.extend({ | |
validate: !0 | |
}, n), !this._validate(r, n)) return !1; | |
r && n.wait && (this.attributes = a.extend({}, s, r)), void 0 === n.parse && (n.parse = !0); | |
var u = this, l = n.success; | |
return n.success = function(e) { | |
u.attributes = s; | |
var t = u.parse(e, n); | |
return n.wait && (t = a.extend(r || {}, t)), a.isObject(t) && !u.set(t, n) ? !1 : (l && l(u, e, n), | |
u.trigger("sync", u, e, n), void 0); | |
}, $(this, n), i = this.isNew() ? "create" : n.patch ? "patch" : "update", "patch" === i && (n.attrs = r), | |
o = this.sync(i, this, n), r && n.wait && (this.attributes = s), o; | |
}, | |
destroy: function(e) { | |
e = e ? a.clone(e) : {}; | |
var t = this, n = e.success, r = function() { | |
t.trigger("destroy", t, t.collection, e); | |
}; | |
if (e.success = function(i) { | |
(e.wait || t.isNew()) && r(), n && n(t, i, e), t.isNew() || t.trigger("sync", t, i, e); | |
}, this.isNew()) return e.success(), !1; | |
$(this, e); | |
var i = this.sync("delete", this, e); | |
return e.wait || r(), i; | |
}, | |
url: function() { | |
var e = a.result(this, "urlRoot") || a.result(this.collection, "url") || R(); | |
return this.isNew() ? e : e + ("/" === e.charAt(e.length - 1) ? "" : "/") + encodeURIComponent(this.id); | |
}, | |
parse: function(e) { | |
return e; | |
}, | |
clone: function() { | |
return new this.constructor(this.attributes); | |
}, | |
isNew: function() { | |
return null == this.id; | |
}, | |
isValid: function(e) { | |
return this._validate({}, a.extend(e || {}, { | |
validate: !0 | |
})); | |
}, | |
_validate: function(e, t) { | |
if (!t.validate || !this.validate) return !0; | |
e = a.extend({}, this.attributes, e); | |
var n = this.validationError = this.validate(e, t) || null; | |
return n ? (this.trigger("invalid", this, n, a.extend(t || {}, { | |
validationError: n | |
})), !1) : !0; | |
} | |
}); | |
var m = [ "keys", "values", "pairs", "invert", "pick", "omit" ]; | |
a.each(m, function(e) { | |
h.prototype[e] = function() { | |
var t = o.call(arguments); | |
return t.unshift(this.attributes), a[e].apply(a, t); | |
}; | |
}); | |
var g = e.Collection = function(e, t) { | |
t || (t = {}), t.url && (this.url = t.url), t.model && (this.model = t.model), void 0 !== t.comparator && (this.comparator = t.comparator), | |
this._reset(), this.initialize.apply(this, arguments), e && this.reset(e, a.extend({ | |
silent: !0 | |
}, t)); | |
}, v = { | |
add: !0, | |
remove: !0, | |
merge: !0 | |
}, y = { | |
add: !0, | |
merge: !1, | |
remove: !1 | |
}; | |
a.extend(g.prototype, u, { | |
model: h, | |
initialize: function() {}, | |
toJSON: function(e) { | |
return this.map(function(t) { | |
return t.toJSON(e); | |
}); | |
}, | |
sync: function() { | |
return e.sync.apply(this, arguments); | |
}, | |
add: function(e, t) { | |
return this.set(e, a.defaults(t || {}, y)); | |
}, | |
remove: function(e, t) { | |
e = a.isArray(e) ? e.slice() : [ e ], t || (t = {}); | |
var n, r, i, o; | |
for (n = 0, r = e.length; r > n; n++) o = this.get(e[n]), o && (delete this._byId[o.id], | |
delete this._byId[o.cid], i = this.indexOf(o), this.models.splice(i, 1), this.length--, | |
t.silent || (t.index = i, o.trigger("remove", o, this, t)), this._removeReference(o)); | |
return this; | |
}, | |
set: function(e, t) { | |
t = a.defaults(t || {}, v), t.parse && (e = this.parse(e, t)), a.isArray(e) || (e = e ? [ e ] : []); | |
var n, r, o, u, l, c = t.at, d = this.comparator && null == c && t.sort !== !1, p = a.isString(this.comparator) ? this.comparator : null, h = [], f = [], m = {}; | |
for (n = 0, r = e.length; r > n; n++) (o = this._prepareModel(e[n], t)) && ((u = this.get(o)) ? (t.remove && (m[u.cid] = !0), | |
t.merge && (u.set(o.attributes, t), d && !l && u.hasChanged(p) && (l = !0))) : t.add && (h.push(o), | |
o.on("all", this._onModelEvent, this), this._byId[o.cid] = o, null != o.id && (this._byId[o.id] = o))); | |
if (t.remove) { | |
for (n = 0, r = this.length; r > n; ++n) m[(o = this.models[n]).cid] || f.push(o); | |
f.length && this.remove(f, t); | |
} | |
if (h.length && (d && (l = !0), this.length += h.length, null != c ? s.apply(this.models, [ c, 0 ].concat(h)) : i.apply(this.models, h)), | |
l && this.sort({ | |
silent: !0 | |
}), t.silent) return this; | |
for (n = 0, r = h.length; r > n; n++) (o = h[n]).trigger("add", o, this, t); | |
return l && this.trigger("sort", this, t), this; | |
}, | |
reset: function(e, t) { | |
t || (t = {}); | |
for (var n = 0, r = this.models.length; r > n; n++) this._removeReference(this.models[n]); | |
return t.previousModels = this.models, this._reset(), this.add(e, a.extend({ | |
silent: !0 | |
}, t)), t.silent || this.trigger("reset", this, t), this; | |
}, | |
push: function(e, t) { | |
return e = this._prepareModel(e, t), this.add(e, a.extend({ | |
at: this.length | |
}, t)), e; | |
}, | |
pop: function(e) { | |
var t = this.at(this.length - 1); | |
return this.remove(t, e), t; | |
}, | |
unshift: function(e, t) { | |
return e = this._prepareModel(e, t), this.add(e, a.extend({ | |
at: 0 | |
}, t)), e; | |
}, | |
shift: function(e) { | |
var t = this.at(0); | |
return this.remove(t, e), t; | |
}, | |
slice: function(e, t) { | |
return this.models.slice(e, t); | |
}, | |
get: function(e) { | |
return null == e ? void 0 : this._byId[null != e.id ? e.id : e.cid || e]; | |
}, | |
at: function(e) { | |
return this.models[e]; | |
}, | |
where: function(e, t) { | |
return a.isEmpty(e) ? t ? void 0 : [] : this[t ? "find" : "filter"](function(t) { | |
for (var n in e) if (e[n] !== t.get(n)) return !1; | |
return !0; | |
}); | |
}, | |
findWhere: function(e) { | |
return this.where(e, !0); | |
}, | |
sort: function(e) { | |
if (!this.comparator) throw new Error("Cannot sort a set without a comparator"); | |
return e || (e = {}), a.isString(this.comparator) || 1 === this.comparator.length ? this.models = this.sortBy(this.comparator, this) : this.models.sort(a.bind(this.comparator, this)), | |
e.silent || this.trigger("sort", this, e), this; | |
}, | |
sortedIndex: function(e, t, n) { | |
t || (t = this.comparator); | |
var r = a.isFunction(t) ? t : function(e) { | |
return e.get(t); | |
}; | |
return a.sortedIndex(this.models, e, r, n); | |
}, | |
pluck: function(e) { | |
return a.invoke(this.models, "get", e); | |
}, | |
fetch: function(e) { | |
e = e ? a.clone(e) : {}, void 0 === e.parse && (e.parse = !0); | |
var t = e.success, n = this; | |
return e.success = function(r) { | |
var i = e.reset ? "reset" : "set"; | |
n[i](r, e), t && t(n, r, e), n.trigger("sync", n, r, e); | |
}, $(this, e), this.sync("read", this, e); | |
}, | |
create: function(e, t) { | |
if (t = t ? a.clone(t) : {}, !(e = this._prepareModel(e, t))) return !1; | |
t.wait || this.add(e, t); | |
var n = this, r = t.success; | |
return t.success = function(i) { | |
t.wait && n.add(e, t), r && r(e, i, t); | |
}, e.save(null, t), e; | |
}, | |
parse: function(e) { | |
return e; | |
}, | |
clone: function() { | |
return new this.constructor(this.models); | |
}, | |
_reset: function() { | |
this.length = 0, this.models = [], this._byId = {}; | |
}, | |
_prepareModel: function(e, t) { | |
if (e instanceof h) return e.collection || (e.collection = this), e; | |
t || (t = {}), t.collection = this; | |
var n = new this.model(e, t); | |
return n._validate(e, t) ? n : (this.trigger("invalid", this, e, t), !1); | |
}, | |
_removeReference: function(e) { | |
this === e.collection && delete e.collection, e.off("all", this._onModelEvent, this); | |
}, | |
_onModelEvent: function(e, t, n, r) { | |
("add" !== e && "remove" !== e || n === this) && ("destroy" === e && this.remove(t, r), | |
t && e === "change:" + t.idAttribute && (delete this._byId[t.previous(t.idAttribute)], | |
null != t.id && (this._byId[t.id] = t)), this.trigger.apply(this, arguments)); | |
} | |
}); | |
var w = [ "forEach", "each", "map", "collect", "reduce", "foldl", "inject", "reduceRight", "foldr", "find", "detect", "filter", "select", "reject", "every", "all", "some", "any", "include", "contains", "invoke", "max", "min", "toArray", "size", "first", "head", "take", "initial", "rest", "tail", "drop", "last", "without", "indexOf", "shuffle", "lastIndexOf", "isEmpty", "chain" ]; | |
a.each(w, function(e) { | |
g.prototype[e] = function() { | |
var t = o.call(arguments); | |
return t.unshift(this.models), a[e].apply(a, t); | |
}; | |
}); | |
var b = [ "groupBy", "countBy", "sortBy" ]; | |
a.each(b, function(e) { | |
g.prototype[e] = function(t, n) { | |
var r = a.isFunction(t) ? t : function(e) { | |
return e.get(t); | |
}; | |
return a[e](this.models, r, n); | |
}; | |
}); | |
var _ = e.View = function(e) { | |
this.cid = a.uniqueId("view"), this._configure(e || {}), this._ensureElement(), | |
this.initialize.apply(this, arguments), this.delegateEvents(); | |
}, x = /^(\S+)\s*(.*)$/, E = [ "model", "collection", "el", "id", "attributes", "className", "tagName", "events" ]; | |
a.extend(_.prototype, u, { | |
tagName: "div", | |
$: function(e) { | |
return this.$el.find(e); | |
}, | |
initialize: function() {}, | |
render: function() { | |
return this; | |
}, | |
remove: function() { | |
return this.$el.remove(), this.stopListening(), this; | |
}, | |
setElement: function(t, n) { | |
return this.$el && this.undelegateEvents(), this.$el = t instanceof e.$ ? t : e.$(t), | |
this.el = this.$el[0], n !== !1 && this.delegateEvents(), this; | |
}, | |
delegateEvents: function(e) { | |
if (!e && !(e = a.result(this, "events"))) return this; | |
this.undelegateEvents(); | |
for (var t in e) { | |
var n = e[t]; | |
if (a.isFunction(n) || (n = this[e[t]]), n) { | |
var r = t.match(x), i = r[1], o = r[2]; | |
n = a.bind(n, this), i += ".delegateEvents" + this.cid, "" === o ? this.$el.on(i, n) : this.$el.on(i, o, n); | |
} | |
} | |
return this; | |
}, | |
undelegateEvents: function() { | |
return this.$el.off(".delegateEvents" + this.cid), this; | |
}, | |
_configure: function(e) { | |
this.options && (e = a.extend({}, a.result(this, "options"), e)), a.extend(this, a.pick(e, E)), | |
this.options = e; | |
}, | |
_ensureElement: function() { | |
if (this.el) this.setElement(a.result(this, "el"), !1); else { | |
var t = a.extend({}, a.result(this, "attributes")); | |
this.id && (t.id = a.result(this, "id")), this.className && (t["class"] = a.result(this, "className")); | |
var n = e.$("<" + a.result(this, "tagName") + ">").attr(t); | |
this.setElement(n, !1); | |
} | |
} | |
}), e.sync = function(t, n, r) { | |
var i = k[t]; | |
a.defaults(r || (r = {}), { | |
emulateHTTP: e.emulateHTTP, | |
emulateJSON: e.emulateJSON | |
}); | |
var o = { | |
type: i, | |
dataType: "json" | |
}; | |
if (r.url || (o.url = a.result(n, "url") || R()), null != r.data || !n || "create" !== t && "update" !== t && "patch" !== t || (o.contentType = "application/json", | |
o.data = JSON.stringify(r.attrs || n.toJSON(r))), r.emulateJSON && (o.contentType = "application/x-www-form-urlencoded", | |
o.data = o.data ? { | |
model: o.data | |
} : {}), r.emulateHTTP && ("PUT" === i || "DELETE" === i || "PATCH" === i)) { | |
o.type = "POST", r.emulateJSON && (o.data._method = i); | |
var s = r.beforeSend; | |
r.beforeSend = function(e) { | |
return e.setRequestHeader("X-HTTP-Method-Override", i), s ? s.apply(this, arguments) : void 0; | |
}; | |
} | |
"GET" === o.type || r.emulateJSON || (o.processData = !1), "PATCH" !== o.type || !window.ActiveXObject || window.external && window.external.msActiveXFilteringEnabled || (o.xhr = function() { | |
return new ActiveXObject("Microsoft.XMLHTTP"); | |
}); | |
var u = r.xhr = e.ajax(a.extend(o, r)); | |
return n.trigger("request", n, u, r), u; | |
}; | |
var k = { | |
create: "POST", | |
update: "PUT", | |
patch: "PATCH", | |
"delete": "DELETE", | |
read: "GET" | |
}; | |
e.ajax = function() { | |
return e.$.ajax.apply(e.$, arguments); | |
}; | |
var S = e.Router = function(e) { | |
e || (e = {}), e.routes && (this.routes = e.routes), this._bindRoutes(), this.initialize.apply(this, arguments); | |
}, T = /\((.*?)\)/g, C = /(\(\?)?:\w+/g, A = /\*\w+/g, D = /[\-{}\[\]+?.,\\\^$|#\s]/g; | |
a.extend(S.prototype, u, { | |
initialize: function() {}, | |
route: function(t, n, r) { | |
a.isRegExp(t) || (t = this._routeToRegExp(t)), a.isFunction(n) && (r = n, n = ""), | |
r || (r = this[n]); | |
var i = this; | |
return e.history.route(t, function(o) { | |
var s = i._extractParameters(t, o); | |
r && r.apply(i, s), i.trigger.apply(i, [ "route:" + n ].concat(s)), i.trigger("route", n, s), | |
e.history.trigger("route", i, n, s); | |
}), this; | |
}, | |
navigate: function(t, n) { | |
return e.history.navigate(t, n), this; | |
}, | |
_bindRoutes: function() { | |
if (this.routes) { | |
this.routes = a.result(this, "routes"); | |
for (var e, t = a.keys(this.routes); null != (e = t.pop()); ) this.route(e, this.routes[e]); | |
} | |
}, | |
_routeToRegExp: function(e) { | |
return e = e.replace(D, "\\$&").replace(T, "(?:$1)?").replace(C, function(e, t) { | |
return t ? e : "([^/]+)"; | |
}).replace(A, "(.*?)"), new RegExp("^" + e + "$"); | |
}, | |
_extractParameters: function(e, t) { | |
var n = e.exec(t).slice(1); | |
return a.map(n, function(e) { | |
return e ? decodeURIComponent(e) : null; | |
}); | |
} | |
}); | |
var N = e.History = function() { | |
this.handlers = [], a.bindAll(this, "checkUrl"), "undefined" != typeof window && (this.location = window.location, | |
this.history = window.history); | |
}, O = /^[#\/]|\s+$/g, M = /^\/+|\/+$/g, j = /msie [\w.]+/, I = /\/$/; | |
N.started = !1, a.extend(N.prototype, u, { | |
interval: 50, | |
getHash: function(e) { | |
var t = (e || this).location.href.match(/#(.*)$/); | |
return t ? t[1] : ""; | |
}, | |
getFragment: function(e, t) { | |
if (null == e) if (this._hasPushState || !this._wantsHashChange || t) { | |
e = this.location.pathname; | |
var n = this.root.replace(I, ""); | |
e.indexOf(n) || (e = e.substr(n.length)); | |
} else e = this.getHash(); | |
return e.replace(O, ""); | |
}, | |
start: function(t) { | |
if (N.started) throw new Error("Backbone.history has already been started"); | |
N.started = !0, this.options = a.extend({}, { | |
root: "/" | |
}, this.options, t), this.root = this.options.root, this._wantsHashChange = this.options.hashChange !== !1, | |
this._wantsPushState = !!this.options.pushState, this._hasPushState = !!(this.options.pushState && this.history && this.history.pushState); | |
var n = this.getFragment(), r = document.documentMode, i = j.exec(navigator.userAgent.toLowerCase()) && (!r || 7 >= r); | |
this.root = ("/" + this.root + "/").replace(M, "/"), i && this._wantsHashChange && (this.iframe = e.$('<iframe src="javascript:0" tabindex="-1" />').hide().appendTo("body")[0].contentWindow, | |
this.navigate(n)), this._hasPushState ? e.$(window).on("popstate", this.checkUrl) : this._wantsHashChange && "onhashchange" in window && !i ? e.$(window).on("hashchange", this.checkUrl) : this._wantsHashChange && (this._checkUrlInterval = setInterval(this.checkUrl, this.interval)), | |
this.fragment = n; | |
var o = this.location, s = o.pathname.replace(/[^\/]$/, "$&/") === this.root; | |
return this._wantsHashChange && this._wantsPushState && !this._hasPushState && !s ? (this.fragment = this.getFragment(null, !0), | |
this.location.replace(this.root + this.location.search + "#" + this.fragment), !0) : (this._wantsPushState && this._hasPushState && s && o.hash && (this.fragment = this.getHash().replace(O, ""), | |
this.history.replaceState({}, document.title, this.root + this.fragment + o.search)), | |
this.options.silent ? void 0 : this.loadUrl()); | |
}, | |
stop: function() { | |
e.$(window).off("popstate", this.checkUrl).off("hashchange", this.checkUrl), clearInterval(this._checkUrlInterval), | |
N.started = !1; | |
}, | |
route: function(e, t) { | |
this.handlers.unshift({ | |
route: e, | |
callback: t | |
}); | |
}, | |
checkUrl: function() { | |
var e = this.getFragment(); | |
return e === this.fragment && this.iframe && (e = this.getFragment(this.getHash(this.iframe))), | |
e === this.fragment ? !1 : (this.iframe && this.navigate(e), this.loadUrl() || this.loadUrl(this.getHash()), | |
void 0); | |
}, | |
loadUrl: function(e) { | |
var t = this.fragment = this.getFragment(e), n = a.any(this.handlers, function(e) { | |
return e.route.test(t) ? (e.callback(t), !0) : void 0; | |
}); | |
return n; | |
}, | |
navigate: function(e, t) { | |
if (!N.started) return !1; | |
if (t && t !== !0 || (t = { | |
trigger: t | |
}), e = this.getFragment(e || ""), this.fragment !== e) { | |
this.fragment = e; | |
var n = this.root + e; | |
if (this._hasPushState) this.history[t.replace ? "replaceState" : "pushState"]({}, document.title, n); else { | |
if (!this._wantsHashChange) return this.location.assign(n); | |
this._updateHash(this.location, e, t.replace), this.iframe && e !== this.getFragment(this.getHash(this.iframe)) && (t.replace || this.iframe.document.open().close(), | |
this._updateHash(this.iframe.location, e, t.replace)); | |
} | |
t.trigger && this.loadUrl(e); | |
} | |
}, | |
_updateHash: function(e, t, n) { | |
if (n) { | |
var r = e.href.replace(/(javascript:|#).*$/, ""); | |
e.replace(r + "#" + t); | |
} else e.hash = "#" + t; | |
} | |
}), e.history = new N(); | |
var P = function(e, t) { | |
var n, r = this; | |
n = e && a.has(e, "constructor") ? e.constructor : function() { | |
return r.apply(this, arguments); | |
}, a.extend(n, r, t); | |
var i = function() { | |
this.constructor = n; | |
}; | |
return i.prototype = r.prototype, n.prototype = new i(), e && a.extend(n.prototype, e), | |
n.__super__ = r.prototype, n; | |
}; | |
h.extend = g.extend = S.extend = _.extend = N.extend = P; | |
var R = function() { | |
throw new Error('A "url" property or function must be specified'); | |
}, $ = function(e, t) { | |
var n = t.error; | |
t.error = function(r) { | |
n && n(e, r, t), e.trigger("error", e, r, t); | |
}; | |
}; | |
}.call(this), define("backbone", [ "jquery", "underscore" ], function(e) { | |
return function() { | |
var t, n; | |
return n = function() { | |
return this.Backbone.noConflict(); | |
}, t = n.apply(e, arguments), t || e.Backbone; | |
}; | |
}(this)), function(e) { | |
var t = {}; | |
t.VERSION = "0.9.3"; | |
var n, r = {}, i = function(e, t) { | |
return function() { | |
return t.apply(e, arguments); | |
}; | |
}, o = function() { | |
var e, t, n = arguments, r = n[0]; | |
for (t = 1; t < n.length; t++) for (e in n[t]) e in r || !n[t].hasOwnProperty(e) || (r[e] = n[t][e]); | |
return r; | |
}, s = function(e, t) { | |
return { | |
value: e, | |
name: t | |
}; | |
}; | |
t.TRACE = s(0, "TRACE"), t.DEBUG = s(1, "DEBUG"), t.INFO = s(2, "INFO"), t.WARN = s(4, "WARN"), | |
t.ERROR = s(8, "ERROR"), t.OFF = s(99, "OFF"); | |
var a = function(e) { | |
this.context = e, this.setLevel(e.filterLevel), this.log = this.info; | |
}; | |
a.prototype = { | |
setLevel: function(e) { | |
e && "value" in e && (this.context.filterLevel = e); | |
}, | |
enabledFor: function(e) { | |
var t = this.context.filterLevel; | |
return e.value >= t.value; | |
}, | |
trace: function() { | |
this.invoke(t.TRACE, arguments); | |
}, | |
debug: function() { | |
this.invoke(t.DEBUG, arguments); | |
}, | |
info: function() { | |
this.invoke(t.INFO, arguments); | |
}, | |
warn: function() { | |
this.invoke(t.WARN, arguments); | |
}, | |
error: function() { | |
this.invoke(t.ERROR, arguments); | |
}, | |
invoke: function(e, t) { | |
n && this.enabledFor(e) && n(t, o({ | |
level: e | |
}, this.context)); | |
} | |
}; | |
var u = new a({ | |
filterLevel: t.OFF | |
}); | |
!function() { | |
var e = t; | |
e.enabledFor = i(u, u.enabledFor), e.trace = i(u, u.trace), e.debug = i(u, u.debug), | |
e.info = i(u, u.info), e.warn = i(u, u.warn), e.error = i(u, u.error), e.log = e.info; | |
}(), t.setHandler = function(e) { | |
n = e; | |
}, t.setLevel = function(e) { | |
u.setLevel(e); | |
for (var t in r) r.hasOwnProperty(t) && r[t].setLevel(e); | |
}, t.get = function(e) { | |
return r[e] || (r[e] = new a(o({ | |
name: e | |
}, u.context))); | |
}, t.useDefaults = function(n) { | |
"console" in e && (t.setLevel(n || t.TRACE), t.setHandler(function(n, r) { | |
var i = e.console, o = i.log; | |
r.name && (n[0] = "[" + r.name + "] " + n[0]), r.level === t.WARN && i.warn ? o = i.warn : r.level === t.ERROR && i.error ? o = i.error : r.level === t.INFO && i.info && (o = i.info), | |
o.apply(i, n); | |
})); | |
}, "function" == typeof define && define.amd ? define("logger", t) : "undefined" != typeof module && module.exports ? module.exports = t : e.Logger = t; | |
}(window), function(e, t) { | |
e("when/when", [], function() { | |
function e(e, t, n, i) { | |
return r(e).then(t, n, i); | |
} | |
function n(e, t) { | |
this.then = e, this.inspect = t; | |
} | |
function r(e) { | |
return s(function(t) { | |
t(e); | |
}); | |
} | |
function i(t) { | |
return e(t, c); | |
} | |
function o() { | |
function e(e, o, s) { | |
t.resolve = t.resolver.resolve = function(t) { | |
return i ? r(t) : (i = !0, e(t), n); | |
}, t.reject = t.resolver.reject = function(e) { | |
return i ? r(c(e)) : (i = !0, o(e), n); | |
}, t.notify = t.resolver.notify = function(e) { | |
return s(e), e; | |
}; | |
} | |
var t, n, i; | |
return t = { | |
promise: L, | |
resolve: L, | |
reject: L, | |
notify: L, | |
resolver: { | |
resolve: L, | |
reject: L, | |
notify: L | |
} | |
}, t.promise = n = s(e), t; | |
} | |
function s(e) { | |
return a(e, $.PromiseStatus && $.PromiseStatus()); | |
} | |
function a(e, t) { | |
function r(e, n, r) { | |
var i = a(function(t, i, o) { | |
function s(s) { | |
s.then(e, n, r).then(t, i, o); | |
} | |
m ? m.push(s) : S(function() { | |
s(f); | |
}); | |
}, t && t.observed()); | |
return i; | |
} | |
function i() { | |
return f ? f.inspect() : k(); | |
} | |
function o(e) { | |
m && (f = u(e), p(m, f), m = L, t && f.then(function() { | |
t.fulfilled(); | |
}, function(e) { | |
t.rejected(e); | |
})); | |
} | |
function s(e) { | |
o(c(e)); | |
} | |
function l(e) { | |
m && p(m, d(e)); | |
} | |
var h, f, m = []; | |
h = new n(r, i); | |
try { | |
e(o, s, l); | |
} catch (g) { | |
s(g); | |
} | |
return h; | |
} | |
function u(e) { | |
return e instanceof n ? e : e === Object(e) && "then" in e ? s(function(t, n, r) { | |
S(function() { | |
try { | |
var i = e.then; | |
"function" == typeof i ? N(i, e, t, n, r) : t(l(e)); | |
} catch (o) { | |
n(o); | |
} | |
}); | |
}) : l(e); | |
} | |
function l(e) { | |
var t = new n(function(n) { | |
try { | |
return "function" == typeof n ? u(n(e)) : t; | |
} catch (r) { | |
return c(r); | |
} | |
}, function() { | |
return x(e); | |
}); | |
return t; | |
} | |
function c(e) { | |
var t = new n(function(n, r) { | |
try { | |
return "function" == typeof r ? u(r(e)) : t; | |
} catch (i) { | |
return c(i); | |
} | |
}, function() { | |
return E(e); | |
}); | |
return t; | |
} | |
function d(e) { | |
var t = new n(function(n, r, i) { | |
try { | |
return "function" == typeof i ? d(i(e)) : t; | |
} catch (o) { | |
return d(o); | |
} | |
}); | |
return t; | |
} | |
function p(e, t) { | |
S(function() { | |
for (var n, r = 0; n = e[r++]; ) n(t); | |
}); | |
} | |
function h(e) { | |
return e && "function" == typeof e.then; | |
} | |
function f(t, n, r, i, o) { | |
return e(t, function(t) { | |
function a(r, i, o) { | |
function s(e) { | |
h(e); | |
} | |
function a(e) { | |
p(e); | |
} | |
var u, l, c, d, p, h, f, m; | |
if (f = t.length >>> 0, u = Math.max(0, Math.min(n, f)), c = [], l = f - u + 1, | |
d = [], u) for (h = function(e) { | |
d.push(e), --l || (p = h = C, i(d)); | |
}, p = function(e) { | |
c.push(e), --u || (p = h = C, r(c)); | |
}, m = 0; f > m; ++m) m in t && e(t[m], a, s, o); else r(c); | |
} | |
return s(a).then(r, i, o); | |
}); | |
} | |
function m(e, t, n, r) { | |
function i(e) { | |
return t ? t(e[0]) : e[0]; | |
} | |
return f(e, 1, i, n, r); | |
} | |
function g(e, t, n, r) { | |
return b(e, C).then(t, n, r); | |
} | |
function v() { | |
return b(arguments, C); | |
} | |
function y(e) { | |
return b(e, x, E); | |
} | |
function w(e, t) { | |
return b(e, t); | |
} | |
function b(t, n, r) { | |
return e(t, function(t) { | |
function i(i, o, s) { | |
function a(t, a) { | |
e(t, n, r).then(function(e) { | |
u[a] = e, --c || i(u); | |
}, o, s); | |
} | |
var u, l, c, d; | |
if (c = l = t.length >>> 0, u = [], !c) return i(u), void 0; | |
for (d = 0; l > d; d++) d in t ? a(t[d], d) : --c; | |
} | |
return s(i); | |
}); | |
} | |
function _(t, n) { | |
var r = N(D, arguments, 1); | |
return e(t, function(t) { | |
var i; | |
return i = t.length, r[0] = function(t, r, o) { | |
return e(t, function(t) { | |
return e(r, function(e) { | |
return n(t, e, o, i); | |
}); | |
}); | |
}, A.apply(t, r); | |
}); | |
} | |
function x(e) { | |
return { | |
state: "fulfilled", | |
value: e | |
}; | |
} | |
function E(e) { | |
return { | |
state: "rejected", | |
reason: e | |
}; | |
} | |
function k() { | |
return { | |
state: "pending" | |
}; | |
} | |
function S(e) { | |
1 === M.push(e) && O(T); | |
} | |
function T() { | |
for (var e, t = 0; e = M[t++]; ) e(); | |
M = []; | |
} | |
function C(e) { | |
return e; | |
} | |
e.promise = s, e.resolve = r, e.reject = i, e.defer = o, e.join = v, e.all = g, | |
e.map = w, e.reduce = _, e.settle = y, e.any = m, e.some = f, e.isPromise = h, n.prototype = { | |
otherwise: function(e) { | |
return this.then(L, e); | |
}, | |
ensure: function(e) { | |
function t() { | |
return r(e()); | |
} | |
return this.then(t, t).yield(this); | |
}, | |
"yield": function(e) { | |
return this.then(function() { | |
return e; | |
}); | |
}, | |
spread: function(e) { | |
return this.then(function(t) { | |
return g(t, function(t) { | |
return e.apply(L, t); | |
}); | |
}); | |
}, | |
always: function(e, t) { | |
return this.then(e, e, t); | |
} | |
}; | |
var A, D, N, O, M, j, I, P, R, $, L; | |
return M = [], $ = "undefined" != typeof console ? console : e, j = t.setTimeout, | |
O = "function" == typeof setImmediate ? setImmediate.bind(t) : "object" == typeof process && process.nextTick ? process.nextTick : "object" == typeof vertx ? vertx.runOnLoop : function(e) { | |
j(e, 0); | |
}, I = Function.prototype, P = I.call, N = I.bind ? P.bind(P) : function(e, t) { | |
return e.apply(t, D.call(arguments, 2)); | |
}, R = [], D = R.slice, A = R.reduce || function(e) { | |
var t, n, r, i, o; | |
if (o = 0, t = Object(this), i = t.length >>> 0, n = arguments, n.length <= 1) for (;;) { | |
if (o in t) { | |
r = t[o++]; | |
break; | |
} | |
if (++o >= i) throw new TypeError(); | |
} else r = n[1]; | |
for (;i > o; ++o) o in t && (r = e(r, t[o], o, t)); | |
return r; | |
}, e; | |
}); | |
}("function" == typeof define && define.amd ? define : function(e) { | |
module.exports = e(); | |
}, this), define("when", [ "when/when" ], function(e) { | |
return e; | |
}), function(e) { | |
var t = function(e, n, r) { | |
return 1 === arguments.length ? t.get(e) : t.set(e, n, r); | |
}; | |
t._document = document, t._navigator = navigator, t.defaults = { | |
path: "/" | |
}, t.get = function(e) { | |
return t._cachedDocumentCookie !== t._document.cookie && t._renewCache(), t._cache[e]; | |
}, t.set = function(n, r, i) { | |
return i = t._getExtendedOptions(i), i.expires = t._getExpiresDate(r === e ? -1 : i.expires), | |
t._document.cookie = t._generateCookieString(n, r, i), t; | |
}, t.expire = function(n, r) { | |
return t.set(n, e, r); | |
}, t._getExtendedOptions = function(n) { | |
return { | |
path: n && n.path || t.defaults.path, | |
domain: n && n.domain || t.defaults.domain, | |
expires: n && n.expires || t.defaults.expires, | |
secure: n && n.secure !== e ? n.secure : t.defaults.secure | |
}; | |
}, t._isValidDate = function(e) { | |
return "[object Date]" === Object.prototype.toString.call(e) && !isNaN(e.getTime()); | |
}, t._getExpiresDate = function(e, n) { | |
switch (n = n || new Date(), typeof e) { | |
case "number": | |
e = new Date(n.getTime() + 1e3 * e); | |
break; | |
case "string": | |
e = new Date(e); | |
} | |
if (e && !t._isValidDate(e)) throw new Error("`expires` parameter cannot be converted to a valid Date instance"); | |
return e; | |
}, t._generateCookieString = function(e, t, n) { | |
e = encodeURIComponent(e), t = (t + "").replace(/[^!#$&-+\--:<-\[\]-~]/g, encodeURIComponent), | |
n = n || {}; | |
var r = e + "=" + t; | |
return r += n.path ? ";path=" + n.path : "", r += n.domain ? ";domain=" + n.domain : "", | |
r += n.expires ? ";expires=" + n.expires.toGMTString() : "", r += n.secure ? ";secure" : ""; | |
}, t._getCookieObjectFromString = function(n) { | |
for (var r = {}, i = n ? n.split("; ") : [], o = 0; o < i.length; o++) { | |
var s = t._getKeyValuePairFromCookieString(i[o]); | |
r[s.key] === e && (r[s.key] = s.value); | |
} | |
return r; | |
}, t._getKeyValuePairFromCookieString = function(e) { | |
var t = e.indexOf("="); | |
return t = 0 > t ? e.length : t, { | |
key: decodeURIComponent(e.substr(0, t)), | |
value: decodeURIComponent(e.substr(t + 1)) | |
}; | |
}, t._renewCache = function() { | |
t._cache = t._getCookieObjectFromString(t._document.cookie), t._cachedDocumentCookie = t._document.cookie; | |
}, t._areEnabled = function() { | |
return t._navigator.cookieEnabled || "1" === t.set("cookies.js", 1).get("cookies.js"); | |
}, t.enabled = t._areEnabled(), "function" == typeof define && define.amd ? define("cookies", [], function() { | |
return t; | |
}) : "undefined" != typeof exports ? ("undefined" != typeof module && module.exports && (exports = module.exports = t), | |
exports.Cookies = t) : window.Cookies = t; | |
}(), function() { | |
define("utils/report-error", [ "require", "exports", "module", "logger" ], function(e, t, n) { | |
var r; | |
return r = e("logger"), n.exports = function(e, t) { | |
var n, i, o; | |
if (null == t && (t = "error"), null != e && (e instanceof Array && (e = 1 === e.length ? e[0] : "[reportError received multiple objects]"), | |
function() { | |
try { | |
return e.message; | |
} catch (t) { | |
return null; | |
} | |
}() ? (n = e.message + "\n\n" + e.stack, e.stack && (n += "\n\n" + e.stack)) : function() { | |
var t; | |
try { | |
return null != (t = e.error) ? t.message : void 0; | |
} catch (n) { | |
return null; | |
} | |
}() ? (n = e.error.message, e.error.stack && (n += "\n\n" + e.error.stack)) : function() { | |
var t, n; | |
try { | |
return null != (t = e.target) ? null != (n = t.error) ? n.message : void 0 : void 0; | |
} catch (r) { | |
return null; | |
} | |
}() ? (n = e.target.error.message, e.target.error.stack && (n += "\n\n" + e.target.error.stack)) : n = function() { | |
try { | |
return null != e.status && null != e.statusText; | |
} catch (t) { | |
return null; | |
} | |
}() ? "status " + e.status + ", statusText " + e.statusText : function() { | |
var t, n; | |
try { | |
return null != (null != (t = e.target) ? t.status : void 0) && null != (null != (n = e.target) ? n.statusText : void 0); | |
} catch (r) { | |
return null; | |
} | |
}() ? "status " + e.target.status + ", statusText " + e.target.statusText : function() { | |
try { | |
return "obj as json: " + JSON.stringify(e); | |
} catch (t) { | |
return "obj.toString(): " + e.toString(); | |
} | |
}()), r.error(t, n, e), "development" === window.ENV && navigator.userAgent.match(/iPad|iPhone|iPod|Android|WebOS|phone|mobile/i) || /[?&]debug\b/.test(window.location.search)) { | |
if (t += ": " + n + "\n\n", !window.appVersion) try { | |
i = new XMLHttpRequest(), i.open("GET", "/version.txt", !1), i.send(null), window.appVersion = 200 === i.status ? null != (o = i.responseText) ? o.replace(/^\s+|\s+$/g, "") : void 0 : "?"; | |
} catch (s) { | |
window.appVersion = "?"; | |
} | |
return "?" !== window.appVersion && (t += "version " + window.appVersion + "\n"), | |
t += "(will be silent in production)", window.alert(t); | |
} | |
}; | |
}); | |
}.call(this), function() { | |
define("utils/when-ajax", [ "jquery", "when" ], function(e, t) { | |
return function(n, r) { | |
return null == r && (r = {}), null == r.timeout && (r.timeout = 3e4), t.promise(function(t, i) { | |
return e.ajax(n, r).done(function(e) { | |
return t(e); | |
}).fail(function(e, t, n) { | |
return i(n || new Error("ajax error")); | |
}); | |
}); | |
}; | |
}); | |
}.call(this), function() { | |
var e = {}.hasOwnProperty, t = function(t, n) { | |
function r() { | |
this.constructor = t; | |
} | |
for (var i in n) e.call(n, i) && (t[i] = n[i]); | |
return r.prototype = n.prototype, t.prototype = new r(), t.__super__ = n.prototype, | |
t; | |
}; | |
define("models/base.model", [ "require", "exports", "module", "underscore", "backbone", "logger" ], function(e, n, r) { | |
var i, o, s, a, u; | |
return a = e("underscore"), i = e("backbone"), s = e("logger"), r.exports = o = function(e) { | |
function n() { | |
return u = n.__super__.constructor.apply(this, arguments); | |
} | |
return t(n, e), n.sugarAttributes = function(e) { | |
var t, n, r, i, o, u = this; | |
for (null == e && (e = {}), n = a.without(Object.keys(this.prototype.defaults()), "id"), | |
o = [], r = 0, i = n.length; i > r; r++) t = n[r], t in this.prototype ? s.debug("declining to sugar Backbone attribute '" + t + "' over existing property of same name") : o.push(function(t) { | |
var n, r; | |
return (n = null != (r = e.collections) ? r[t] : void 0) && (u.prototype[n] = function(e) { | |
var n; | |
return null != (n = this.get(t)) ? n.get(e) : void 0; | |
}), Object.defineProperty(u.prototype, t, { | |
enumerable: !0, | |
get: function() { | |
return this.get(t); | |
}, | |
set: function(e) { | |
return this.set(t, e); | |
} | |
}); | |
}(t)); | |
return o; | |
}, n; | |
}(i.Model); | |
}); | |
}.call(this), function(e, t) { | |
"function" == typeof define && define.amd ? define("utils/arraybuffer-helpers", t) : e.AbHelpers = t(); | |
}(this, function() { | |
var e = { | |
bufferToBase64: function(t) { | |
return e.u8aToBase64(new Uint8Array(t)); | |
}, | |
base64ToBuffer: function(t) { | |
return e.base64ToU8a(t).buffer; | |
}, | |
u8aToBase64: function(e) { | |
var t, n = e.byteLength, r = ""; | |
for (t = 0; n > t; t++) r += String.fromCharCode(e[t]); | |
return window.btoa(r); | |
}, | |
base64ToU8a: function(e) { | |
var t, n = window.atob(e), r = n.length, i = new Uint8Array(r); | |
for (t = 0; r > t; t++) i[t] = n.charCodeAt(t); | |
return i; | |
}, | |
bufferToBinstr: function(e) { | |
var t, n, r, i, o, s, a; | |
for (n = "", i = Math.floor(e.byteLength / 2), t = new Uint16Array(e, 0, i), r = 0; i > r; r++) n += String.fromCharCode(t[r]); | |
return 0 === e.byteLength % 2 ? n += String.fromCharCode(0) : (o = new Uint8Array(e), | |
s = new Uint8Array([ o[o.length - 1], 1 ]), a = new Uint16Array(s.buffer), n += String.fromCharCode(a[0])), | |
n; | |
}, | |
binstrToBuffer: function(e) { | |
var t, n, r, i, o, s, a, u; | |
for (n = 0 === e.charCodeAt(e.length - 1) ? 2 * e.length - 2 : 2 * e.length - 1, | |
t = new ArrayBuffer(n), o = Math.floor(n / 2), r = new Uint16Array(t, 0, o), i = 0; o > i; i++) r[i] = e.charCodeAt(i); | |
return 0 !== n % 2 && (s = new Uint16Array([ e.charCodeAt(e.length - 1) ]), a = new Uint8Array(s.buffer), | |
u = new Uint8Array(t), u[n - 1] = a[0]), t; | |
}, | |
bufferToHex: function(e) { | |
var t, n, r = new DataView(e), i = "", o = e.byteLength - e.byteLength % 4; | |
for (n = 0; o > n; n += 4) { | |
for (t = r.getUint32(n).toString(16); t.length < 8; ) t = "0" + t; | |
i += t; | |
} | |
for (n = o, o = e.byteLength; o > n; n++) t = r.getUint8(n).toString(16), t.length < 2 && (t = "0" + t), | |
i += t; | |
return i; | |
}, | |
hexToBuffer: function(e) { | |
var t, n, r = e.length / 2, i = new ArrayBuffer(r), o = new DataView(i); | |
for (t = 0, n = r - r % 4; n > t; t += 4) o.setUint32(t, parseInt(e.substr(2 * t, 8), 16)); | |
for (t = n; r > t; t++) o.setUint8(t, parseInt(e.substr(2 * t, 2), 16)); | |
return i; | |
} | |
}; | |
return e; | |
}), function() { | |
define("utils/typed-arraybuffer", [ "require", "exports", "module" ], function(e, t, n) { | |
var r; | |
return n.exports = r = function() { | |
function e(e) { | |
var t; | |
t = null != e ? e : {}, this.contentType = t.contentType, this.buffer = t.buffer; | |
} | |
return e; | |
}(); | |
}); | |
}.call(this), function() { | |
!function(e, t) { | |
return "function" == typeof define && define.amd ? define("utils/local-kvs-schema", [], t) : e.LocalKvsSchema = t(); | |
}(this, function() { | |
return { | |
DB_NAME: "top", | |
DB_VERSION: 29, | |
STORE_NAMES: [ "article_body", "edition_structure", "image_data", "video_poster_image_data", "edition_selector", "www_image", "frontpageimage_data", "test" ], | |
OBS_STORE_NAMES: [ "editions", "articles", "article_bodies", "image_data_ct", "es_frontpage_thumb_data", "video_poster_data", "undefined", "images", "image_data_content_type", "video_poster_data_content_type", "es_frontpage_data_content_type" ] | |
}; | |
}); | |
}.call(this), window.Modernizr = function(e, t, n) { | |
function r(e) { | |
w.cssText = e; | |
} | |
function i(e, t) { | |
return r(E.join(e + ";") + (t || "")); | |
} | |
function o(e, t) { | |
return typeof e === t; | |
} | |
function s(e, t) { | |
return !!~("" + e).indexOf(t); | |
} | |
function a(e, t) { | |
for (var r in e) { | |
var i = e[r]; | |
if (!s(i, "-") && w[i] !== n) return "pfx" == t ? i : !0; | |
} | |
return !1; | |
} | |
function u(e, t, r) { | |
for (var i in e) { | |
var s = t[e[i]]; | |
if (s !== n) return r === !1 ? e[i] : o(s, "function") ? s.bind(r || t) : s; | |
} | |
return !1; | |
} | |
function l(e, t, n) { | |
var r = e.charAt(0).toUpperCase() + e.slice(1), i = (e + " " + S.join(r + " ") + r).split(" "); | |
return o(t, "string") || o(t, "undefined") ? a(i, t) : (i = (e + " " + T.join(r + " ") + r).split(" "), | |
u(i, t, n)); | |
} | |
function c() { | |
f.input = function(n) { | |
for (var r = 0, i = n.length; i > r; r++) N[n[r]] = !!(n[r] in b); | |
return N.list && (N.list = !(!t.createElement("datalist") || !e.HTMLDataListElement)), | |
N; | |
}("autocomplete autofocus list placeholder max min multiple pattern required step".split(" ")), | |
f.inputtypes = function(e) { | |
for (var r, i, o, s = 0, a = e.length; a > s; s++) b.setAttribute("type", i = e[s]), | |
r = "text" !== b.type, r && (b.value = _, b.style.cssText = "position:absolute;visibility:hidden;", | |
/^range$/.test(i) && b.style.WebkitAppearance !== n ? (g.appendChild(b), o = t.defaultView, | |
r = o.getComputedStyle && "textfield" !== o.getComputedStyle(b, null).WebkitAppearance && 0 !== b.offsetHeight, | |
g.removeChild(b)) : /^(search|tel)$/.test(i) || (r = /^(url|email)$/.test(i) ? b.checkValidity && b.checkValidity() === !1 : b.value != _)), | |
D[e[s]] = !!r; | |
return D; | |
}("search tel url email datetime date month week time datetime-local number range color".split(" ")); | |
} | |
var d, p, h = "2.6.3", f = {}, m = !0, g = t.documentElement, v = "modernizr", y = t.createElement(v), w = y.style, b = t.createElement("input"), _ = ":)", x = {}.toString, E = " -webkit- -moz- -o- -ms- ".split(" "), k = "Webkit Moz O ms", S = k.split(" "), T = k.toLowerCase().split(" "), C = { | |
svg: "http://www.w3.org/2000/svg" | |
}, A = {}, D = {}, N = {}, O = [], M = O.slice, j = function(e, n, r, i) { | |
var o, s, a, u, l = t.createElement("div"), c = t.body, d = c || t.createElement("body"); | |
if (parseInt(r, 10)) for (;r--; ) a = t.createElement("div"), a.id = i ? i[r] : v + (r + 1), | |
l.appendChild(a); | |
return o = [ "­", '<style id="s', v, '">', e, "</style>" ].join(""), l.id = v, | |
(c ? l : d).innerHTML += o, d.appendChild(l), c || (d.style.background = "", d.style.overflow = "hidden", | |
u = g.style.overflow, g.style.overflow = "hidden", g.appendChild(d)), s = n(l, e), | |
c ? l.parentNode.removeChild(l) : (d.parentNode.removeChild(d), g.style.overflow = u), | |
!!s; | |
}, I = function(t) { | |
var n = e.matchMedia || e.msMatchMedia; | |
if (n) return n(t).matches; | |
var r; | |
return j("@media " + t + " { #" + v + " { position: absolute; } }", function(t) { | |
r = "absolute" == (e.getComputedStyle ? getComputedStyle(t, null) : t.currentStyle).position; | |
}), r; | |
}, P = function() { | |
function e(e, i) { | |
i = i || t.createElement(r[e] || "div"), e = "on" + e; | |
var s = e in i; | |
return s || (i.setAttribute || (i = t.createElement("div")), i.setAttribute && i.removeAttribute && (i.setAttribute(e, ""), | |
s = o(i[e], "function"), o(i[e], "undefined") || (i[e] = n), i.removeAttribute(e))), | |
i = null, s; | |
} | |
var r = { | |
select: "input", | |
change: "input", | |
submit: "form", | |
reset: "form", | |
error: "img", | |
load: "img", | |
abort: "img" | |
}; | |
return e; | |
}(), R = {}.hasOwnProperty; | |
p = o(R, "undefined") || o(R.call, "undefined") ? function(e, t) { | |
return t in e && o(e.constructor.prototype[t], "undefined"); | |
} : function(e, t) { | |
return R.call(e, t); | |
}, Function.prototype.bind || (Function.prototype.bind = function(e) { | |
var t = this; | |
if ("function" != typeof t) throw new TypeError(); | |
var n = M.call(arguments, 1), r = function() { | |
if (this instanceof r) { | |
var i = function() {}; | |
i.prototype = t.prototype; | |
var o = new i(), s = t.apply(o, n.concat(M.call(arguments))); | |
return Object(s) === s ? s : o; | |
} | |
return t.apply(e, n.concat(M.call(arguments))); | |
}; | |
return r; | |
}), A.flexbox = function() { | |
return l("flexWrap"); | |
}, A.flexboxlegacy = function() { | |
return l("boxDirection"); | |
}, A.canvas = function() { | |
var e = t.createElement("canvas"); | |
return !(!e.getContext || !e.getContext("2d")); | |
}, A.canvastext = function() { | |
return !(!f.canvas || !o(t.createElement("canvas").getContext("2d").fillText, "function")); | |
}, A.webgl = function() { | |
return !!e.WebGLRenderingContext; | |
}, A.touch = function() { | |
var n; | |
return "ontouchstart" in e || e.DocumentTouch && t instanceof DocumentTouch ? n = !0 : j([ "@media (", E.join("touch-enabled),("), v, ")", "{#modernizr{top:9px;position:absolute}}" ].join(""), function(e) { | |
n = 9 === e.offsetTop; | |
}), n; | |
}, A.geolocation = function() { | |
return "geolocation" in navigator; | |
}, A.postmessage = function() { | |
return !!e.postMessage; | |
}, A.websqldatabase = function() { | |
return !!e.openDatabase; | |
}, A.indexedDB = function() { | |
return !!l("indexedDB", e); | |
}, A.hashchange = function() { | |
return P("hashchange", e) && (t.documentMode === n || t.documentMode > 7); | |
}, A.history = function() { | |
return !(!e.history || !history.pushState); | |
}, A.draganddrop = function() { | |
var e = t.createElement("div"); | |
return "draggable" in e || "ondragstart" in e && "ondrop" in e; | |
}, A.websockets = function() { | |
return "WebSocket" in e || "MozWebSocket" in e; | |
}, A.rgba = function() { | |
return r("background-color:rgba(150,255,150,.5)"), s(w.backgroundColor, "rgba"); | |
}, A.hsla = function() { | |
return r("background-color:hsla(120,40%,100%,.5)"), s(w.backgroundColor, "rgba") || s(w.backgroundColor, "hsla"); | |
}, A.multiplebgs = function() { | |
return r("background:url(https://),url(https://),red url(https://)"), /(url\s*\(.*?){3}/.test(w.background); | |
}, A.backgroundsize = function() { | |
return l("backgroundSize"); | |
}, A.borderimage = function() { | |
return l("borderImage"); | |
}, A.borderradius = function() { | |
return l("borderRadius"); | |
}, A.boxshadow = function() { | |
return l("boxShadow"); | |
}, A.textshadow = function() { | |
return "" === t.createElement("div").style.textShadow; | |
}, A.opacity = function() { | |
return i("opacity:.55"), /^0.55$/.test(w.opacity); | |
}, A.cssanimations = function() { | |
return l("animationName"); | |
}, A.csscolumns = function() { | |
return l("columnCount"); | |
}, A.cssgradients = function() { | |
var e = "background-image:", t = "gradient(linear,left top,right bottom,from(#9f9),to(white));", n = "linear-gradient(left top,#9f9, white);"; | |
return r((e + "-webkit- ".split(" ").join(t + e) + E.join(n + e)).slice(0, -e.length)), | |
s(w.backgroundImage, "gradient"); | |
}, A.cssreflections = function() { | |
return l("boxReflect"); | |
}, A.csstransforms = function() { | |
return !!l("transform"); | |
}, A.csstransforms3d = function() { | |
var e = !!l("perspective"); | |
return e && "webkitPerspective" in g.style && j("@media (transform-3d),(-webkit-transform-3d){#modernizr{left:9px;position:absolute;height:3px;}}", function(t) { | |
e = 9 === t.offsetLeft && 3 === t.offsetHeight; | |
}), e; | |
}, A.csstransitions = function() { | |
return l("transition"); | |
}, A.fontface = function() { | |
var e; | |
return j('@font-face {font-family:"font";src:url("https://")}', function(n, r) { | |
var i = t.getElementById("smodernizr"), o = i.sheet || i.styleSheet, s = o ? o.cssRules && o.cssRules[0] ? o.cssRules[0].cssText : o.cssText || "" : ""; | |
e = /src/i.test(s) && 0 === s.indexOf(r.split(" ")[0]); | |
}), e; | |
}, A.generatedcontent = function() { | |
var e; | |
return j([ "#", v, "{font:0/0 a}#", v, ':after{content:"', _, '";visibility:hidden;font:3px/1 a}' ].join(""), function(t) { | |
e = t.offsetHeight >= 3; | |
}), e; | |
}, A.video = function() { | |
var e = t.createElement("video"), n = !1; | |
try { | |
(n = !!e.canPlayType) && (n = new Boolean(n), n.ogg = e.canPlayType('video/ogg; codecs="theora"').replace(/^no$/, ""), | |
n.h264 = e.canPlayType('video/mp4; codecs="avc1.42E01E"').replace(/^no$/, ""), n.webm = e.canPlayType('video/webm; codecs="vp8, vorbis"').replace(/^no$/, "")); | |
} catch (r) {} | |
return n; | |
}, A.audio = function() { | |
var e = t.createElement("audio"), n = !1; | |
try { | |
(n = !!e.canPlayType) && (n = new Boolean(n), n.ogg = e.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/, ""), | |
n.mp3 = e.canPlayType("audio/mpeg;").replace(/^no$/, ""), n.wav = e.canPlayType('audio/wav; codecs="1"').replace(/^no$/, ""), | |
n.m4a = (e.canPlayType("audio/x-m4a;") || e.canPlayType("audio/aac;")).replace(/^no$/, "")); | |
} catch (r) {} | |
return n; | |
}, A.localstorage = function() { | |
try { | |
return localStorage.setItem(v, v), localStorage.removeItem(v), !0; | |
} catch (e) { | |
return !1; | |
} | |
}, A.sessionstorage = function() { | |
try { | |
return sessionStorage.setItem(v, v), sessionStorage.removeItem(v), !0; | |
} catch (e) { | |
return !1; | |
} | |
}, A.webworkers = function() { | |
return !!e.Worker; | |
}, A.applicationcache = function() { | |
return !!e.applicationCache; | |
}, A.svg = function() { | |
return !!t.createElementNS && !!t.createElementNS(C.svg, "svg").createSVGRect; | |
}, A.inlinesvg = function() { | |
var e = t.createElement("div"); | |
return e.innerHTML = "<svg/>", (e.firstChild && e.firstChild.namespaceURI) == C.svg; | |
}, A.smil = function() { | |
return !!t.createElementNS && /SVGAnimate/.test(x.call(t.createElementNS(C.svg, "animate"))); | |
}, A.svgclippaths = function() { | |
return !!t.createElementNS && /SVGClipPath/.test(x.call(t.createElementNS(C.svg, "clipPath"))); | |
}; | |
for (var $ in A) p(A, $) && (d = $.toLowerCase(), f[d] = A[$](), O.push((f[d] ? "" : "no-") + d)); | |
return f.input || c(), f.addTest = function(e, t) { | |
if ("object" == typeof e) for (var r in e) p(e, r) && f.addTest(r, e[r]); else { | |
if (e = e.toLowerCase(), f[e] !== n) return f; | |
t = "function" == typeof t ? t() : t, "undefined" != typeof m && m && (g.className += " " + (t ? "" : "no-") + e), | |
f[e] = t; | |
} | |
return f; | |
}, r(""), y = b = null, function(e, t) { | |
function n(e, t) { | |
var n = e.createElement("p"), r = e.getElementsByTagName("head")[0] || e.documentElement; | |
return n.innerHTML = "x<style>" + t + "</style>", r.insertBefore(n.lastChild, r.firstChild); | |
} | |
function r() { | |
var e = v.elements; | |
return "string" == typeof e ? e.split(" ") : e; | |
} | |
function i(e) { | |
var t = g[e[f]]; | |
return t || (t = {}, m++, e[f] = m, g[m] = t), t; | |
} | |
function o(e, n, r) { | |
if (n || (n = t), c) return n.createElement(e); | |
r || (r = i(n)); | |
var o; | |
return o = r.cache[e] ? r.cache[e].cloneNode() : h.test(e) ? (r.cache[e] = r.createElem(e)).cloneNode() : r.createElem(e), | |
o.canHaveChildren && !p.test(e) ? r.frag.appendChild(o) : o; | |
} | |
function s(e, n) { | |
if (e || (e = t), c) return e.createDocumentFragment(); | |
n = n || i(e); | |
for (var o = n.frag.cloneNode(), s = 0, a = r(), u = a.length; u > s; s++) o.createElement(a[s]); | |
return o; | |
} | |
function a(e, t) { | |
t.cache || (t.cache = {}, t.createElem = e.createElement, t.createFrag = e.createDocumentFragment, | |
t.frag = t.createFrag()), e.createElement = function(n) { | |
return v.shivMethods ? o(n, e, t) : t.createElem(n); | |
}, e.createDocumentFragment = Function("h,f", "return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&(" + r().join().replace(/\w+/g, function(e) { | |
return t.createElem(e), t.frag.createElement(e), 'c("' + e + '")'; | |
}) + ");return n}")(v, t.frag); | |
} | |
function u(e) { | |
e || (e = t); | |
var r = i(e); | |
return !v.shivCSS || l || r.hasCSS || (r.hasCSS = !!n(e, "article,aside,figcaption,figure,footer,header,hgroup,nav,section{display:block}mark{background:#FF0;color:#000}")), | |
c || a(e, r), e; | |
} | |
var l, c, d = e.html5 || {}, p = /^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i, h = /^(?: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, f = "_html5shiv", m = 0, g = {}; | |
!function() { | |
try { | |
var e = t.createElement("a"); | |
e.innerHTML = "<xyz></xyz>", l = "hidden" in e, c = 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 (n) { | |
l = !0, c = !0; | |
} | |
}(); | |
var v = { | |
elements: d.elements || "abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video", | |
shivCSS: d.shivCSS !== !1, | |
supportsUnknownElements: c, | |
shivMethods: d.shivMethods !== !1, | |
type: "default", | |
shivDocument: u, | |
createElement: o, | |
createDocumentFragment: s | |
}; | |
e.html5 = v, u(t); | |
}(this, t), f._version = h, f._prefixes = E, f._domPrefixes = T, f._cssomPrefixes = S, | |
f.mq = I, f.hasEvent = P, f.testProp = function(e) { | |
return a([ e ]); | |
}, f.testAllProps = l, f.testStyles = j, f.prefixed = function(e, t, n) { | |
return t ? l(e, t, n) : l(e, "pfx"); | |
}, g.className = g.className.replace(/(^|\s)no-js(\s|$)/, "$1$2") + (m ? " js " + O.join(" ") : ""), | |
f; | |
}(this, this.document), define("modernizr", function(e) { | |
return function() { | |
var t; | |
return t || e.Modernizr; | |
}; | |
}(this)), function() { | |
define("utils/device", [ "require", "exports", "module", "modernizr" ], function(e, t, n) { | |
var r, i, o; | |
return r = e("modernizr"), i = function(e) { | |
return e ? { | |
Silk: /Silk\//.test(e), | |
iOSDevice: /(iPod|iPhone|iPad).*AppleWebKit/.test(e), | |
iPadiOS7: /iPad;.*CPU.*OS 7_\d/i.test(e), | |
MSWindows: /Win/i.test(navigator.platform), | |
Safari: /Version\/.*Safari/i.test(e) && !/CriOS/i.test(e) && !/Android/i.test(e), | |
Android: /Android/.test(e), | |
Chrome: /(Chrome|CriOS)\//.test(e), | |
isStandalone: function() { | |
var t; | |
return navigator.standalone ? !0 : (null != (t = e.match(/\bAndroid\b.*\bChrome\/(\d+)/)) ? t[1] : void 0) >= 31 && window.screen.availHeight - window.innerHeight <= 25 ? !0 : !1; | |
}(), | |
ie: /(Trident|MSIE)/.test(e), | |
ie8: /MSIE 8\.0/.test(e), | |
ie7: /MSIE 7\.0/.test(e), | |
ie9: /MSIE 9\.0/.test(e), | |
isDesktopDevice: function() { | |
return r.touch ? !e.match(/(iPhone|iPod|iPad|Android|BlackBerry|IEMobile)/) : !0; | |
}, | |
isSafariPrivateBrowsing: function() { | |
var e, t, n, r; | |
try { | |
null != (t = window.sessionStorage) && t.setItem("test", "1"), null != (n = window.sessionStorage) && n.removeItem("test"); | |
} catch (i) { | |
return e = i, 22 === e.code && 0 === (null != (r = window.sessionStorage) ? r.length : void 0); | |
} | |
return !1; | |
} | |
} : null; | |
}, o = i(navigator.userAgent), o.customUserAgent = i, n.exports = o; | |
}); | |
}.call(this), function() { | |
define("utils/capitalize", [ "require", "exports", "module", "underscore" ], function(e, t, n) { | |
var r; | |
return r = e("underscore"), n.exports = function(e) { | |
if (!r.isString(e)) throw TypeError("" + e + " is not of type string"); | |
return e.charAt(0).toUpperCase() + e.slice(1); | |
}; | |
}); | |
}.call(this), function() { | |
define("common/lifecycle.mixin", [ "require", "exports", "module", "underscore", "backbone", "when", "utils/capitalize" ], function(e, t) { | |
var n, r, i, o, s, a, u, l, c; | |
return a = function() {}, u = e("underscore"), n = e("backbone"), o = e("when").isPromise, | |
i = e("utils/capitalize"), c = function(e, t, n) { | |
return e["_" + t + "Sync"] = function(e) { | |
return e instanceof Error ? (this.trigger("error", e), this.onerror(e), void 0) : (this.trigger("will" + n), | |
this["_" + t](), this.trigger("" + t), this["did" + n](), this.trigger("did" + n), | |
this); | |
}; | |
}, l = function(e, t, n) { | |
return e["_" + t + "Async"] = function(e) { | |
var r = this; | |
return e.then(function() { | |
return r.trigger("will" + n), r["_" + t](), r.trigger("" + t), r["did" + n](), r.trigger("did" + n); | |
}).otherwise(function(e) { | |
return r.trigger("error", e), r.onerror(e); | |
}), this; | |
}; | |
}, s = function(e, t) { | |
var n; | |
return n = i(t), u.each([ "did" + n, "will" + n, "_" + t, "onerror" ], function(t) { | |
return e[t] ? void 0 : e[t] = a; | |
}), e[t] = function() { | |
var e; | |
return e = this["will" + n](), o(e) ? this["_" + t + "Async"](e) : this["_" + t + "Sync"](e); | |
}, c(e, t, n), l(e, t, n); | |
}, r = { | |
extend: function(e, t) { | |
var r, i, o; | |
for (i = 0, o = t.length; o > i; i++) r = t[i], s(e, r); | |
return u.isFunction(e.listenTo) ? e : u.extend(e, n.Events); | |
} | |
}, t.exports = r; | |
}); | |
}.call(this), function() { | |
var e = function(e, t) { | |
return function() { | |
return e.apply(t, arguments); | |
}; | |
}, t = {}.hasOwnProperty, n = function(e, n) { | |
function r() { | |
this.constructor = e; | |
} | |
for (var i in n) t.call(n, i) && (e[i] = n[i]); | |
return r.prototype = n.prototype, e.prototype = new r(), e.__super__ = n.prototype, | |
e; | |
}; | |
define("views/base.view", [ "require", "exports", "module", "backbone", "underscore", "jquery", "common/lifecycle.mixin", "logger" ], function(r) { | |
var i, o, s, a, u, l, c, d; | |
return o = r("backbone"), c = r("underscore"), i = r("jquery"), a = r("common/lifecycle.mixin"), | |
u = r("logger"), l = {}, s = function(r) { | |
function o() { | |
return this.renderNested = e(this.renderNested, this), this._render = e(this._render, this), | |
d = o.__super__.constructor.apply(this, arguments); | |
} | |
return n(o, r), o.prototype.$window = i(window), o.prototype.$doc = i(document), | |
o.prototype.$body = i("body"), o.prototype.tmpl = "", o.prototype._getClassObj = function() { | |
var e; | |
return e = this.collection || this.model || {}, c.isFunction(e.toJSON) || (e.toJSON = function() { | |
return {}; | |
}), e; | |
}, o.prototype._render = function() { | |
var e, t, n; | |
n = this._getClassObj(); | |
try { | |
e = this.templify()(n.toJSON()); | |
} catch (r) { | |
t = r, u.error("RENDERING ERROR (" + this.constructor.name + ")", t), e = "development" === window.ENV ? '<div style="background: red; color: white; font-weight: bold; padding: 5em">\n RENDERING ERROR (' + this.constructor.name + ")<br>" + i("<div/>").text(t.message).html() + "\n</div>" : ""; | |
} | |
return this.el.innerHTML = e, this.bindUI(); | |
}, o.prototype.templify = function() { | |
var e; | |
return e = l[this.tmpl], null != e ? e : l[this.tmpl] = c.template(this.tmpl); | |
}, o.prototype.renderNested = function(e, t) { | |
var n; | |
if ((null != this._subviews ? this._subviews : this._subviews = []).push(e), n = t instanceof i ? t : this.$(t), | |
1 !== n.length) throw u.trace("$el cannot be set", e.el, t), new Error("Cannot render nested element for selector: " + t); | |
return e.setElement(n).render(), e; | |
}, o.prototype.appendTo = function(e) { | |
return this.$el.appendTo(e), this; | |
}, o.prototype.prependTo = function(e) { | |
return this.$el.prependTo(e), this; | |
}, o.prototype.bindUI = function() { | |
var e, n, r; | |
if (null == this.ui) return this; | |
if (!c.isObject(this.ui)) throw TypeError("Expected @ui to be an object"); | |
null == this._ui && (this._ui = this.ui), this.ui = {}, r = this._ui; | |
for (e in r) t.call(r, e) && (n = r[e], this.ui[e] = this.$(n)); | |
return this; | |
}, o.prototype.unbindUI = function() { | |
var e, n, r; | |
if (null == this.ui) return this; | |
if (!c.isObject(this.ui)) throw TypeError("Expected @ui to be an object"); | |
r = this._ui; | |
for (e in r) t.call(r, e) && (n = r[e], delete this.ui[e]); | |
return this.ui = this._ui, delete this._ui, this; | |
}, o.prototype._destroy = function() { | |
var e, t, n, r, i; | |
if (this.isDestroyed) return this; | |
for (this.isDestroyed = !0, i = null != (r = this._subviews) ? r : [], t = 0, n = i.length; n > t; t++) e = i[t], | |
e.destroy(); | |
return this.unbindUI(), this.remove(), this; | |
}, o.prototype.getRect = function() { | |
return this.el.getBoundingClientRect(); | |
}, o.prototype.isInViewport = function(e) { | |
var t, n, r, i, o, s, a, u; | |
return u = null != e ? e : {}, o = u.extendTop, n = u.extendBottom, r = u.extendLeft, | |
i = u.extendRight, a = window.innerWidth || document.documentElement.clientWidth, | |
s = window.innerHeight || document.documentElement.clientHeight, t = this.el.getBoundingClientRect(), | |
!(0 === t.height || 0 === t.width || t.top - (o || 0) > s || t.bottom + (n || 0) <= 50 || t.right + (i || 0) < 0 || t.left - (r || 0) > a); | |
}, o.prototype.isVisibleInViewport = function() { | |
var e; | |
return e = this.getRect(), e.top >= 0 || e.bottom >= 0; | |
}, o.prototype.isAboveViewport = function() { | |
var e; | |
return e = this.getRect(), e.bottom < 0; | |
}, o.prototype.isBelowViewport = function() { | |
return this.$el.offset().top >= this.$window.height(); | |
}, o.prototype.isInDOM = function() { | |
return this.$body[0].contains(this.el); | |
}, o.prototype.isAtTop = function() { | |
var e; | |
return e = this.getRect(), 0 === this.$el.outerHeight() - e.bottom; | |
}, o; | |
}(o.View), a.extend(s.prototype, [ "render", "destroy" ]), s; | |
}); | |
}.call(this), define("text", [ "module" ], function(e) { | |
var t, n, r, i, o = [ "Msxml2.XMLHTTP", "Microsoft.XMLHTTP", "Msxml2.XMLHTTP.4.0" ], s = /^\s*<\?xml(\s)+version=[\'\"](\d)*.(\d)*[\'\"](\s)*\?>/im, a = /<body[^>]*>\s*([\s\S]+)\s*<\/body>/im, u = "undefined" != typeof location && location.href, l = u && location.protocol && location.protocol.replace(/\:/, ""), c = u && location.hostname, d = u && (location.port || void 0), p = {}, h = e.config && e.config() || {}; | |
return t = { | |
version: "2.0.7", | |
strip: function(e) { | |
if (e) { | |
e = e.replace(s, ""); | |
var t = e.match(a); | |
t && (e = t[1]); | |
} else e = ""; | |
return e; | |
}, | |
jsEscape: function(e) { | |
return e.replace(/(['\\])/g, "\\$1").replace(/[\f]/g, "\\f").replace(/[\b]/g, "\\b").replace(/[\n]/g, "\\n").replace(/[\t]/g, "\\t").replace(/[\r]/g, "\\r").replace(/[\u2028]/g, "\\u2028").replace(/[\u2029]/g, "\\u2029"); | |
}, | |
createXhr: h.createXhr || function() { | |
var e, t, n; | |
if ("undefined" != typeof XMLHttpRequest) return new XMLHttpRequest(); | |
if ("undefined" != typeof ActiveXObject) for (t = 0; 3 > t; t += 1) { | |
n = o[t]; | |
try { | |
e = new ActiveXObject(n); | |
} catch (r) {} | |
if (e) { | |
o = [ n ]; | |
break; | |
} | |
} | |
return e; | |
}, | |
parseName: function(e) { | |
var t, n, r, i = !1, o = e.indexOf("."), s = 0 === e.indexOf("./") || 0 === e.indexOf("../"); | |
return -1 !== o && (!s || o > 1) ? (t = e.substring(0, o), n = e.substring(o + 1, e.length)) : t = e, | |
r = n || t, o = r.indexOf("!"), -1 !== o && (i = "strip" === r.substring(o + 1), | |
r = r.substring(0, o), n ? n = r : t = r), { | |
moduleName: t, | |
ext: n, | |
strip: i | |
}; | |
}, | |
xdRegExp: /^((\w+)\:)?\/\/([^\/\\]+)/, | |
useXhr: function(e, n, r, i) { | |
var o, s, a, u = t.xdRegExp.exec(e); | |
return u ? (o = u[2], s = u[3], s = s.split(":"), a = s[1], s = s[0], !(o && o !== n || s && s.toLowerCase() !== r.toLowerCase() || (a || s) && a !== i)) : !0; | |
}, | |
finishLoad: function(e, n, r, i) { | |
r = n ? t.strip(r) : r, h.isBuild && (p[e] = r), i(r); | |
}, | |
load: function(e, n, r, i) { | |
if (i.isBuild && !i.inlineText) return r(), void 0; | |
h.isBuild = i.isBuild; | |
var o = t.parseName(e), s = o.moduleName + (o.ext ? "." + o.ext : ""), a = n.toUrl(s), p = h.useXhr || t.useXhr; | |
!u || p(a, l, c, d) ? t.get(a, function(n) { | |
t.finishLoad(e, o.strip, n, r); | |
}, function(e) { | |
r.error && r.error(e); | |
}) : n([ s ], function(e) { | |
t.finishLoad(o.moduleName + "." + o.ext, o.strip, e, r); | |
}); | |
}, | |
write: function(e, n, r) { | |
if (p.hasOwnProperty(n)) { | |
var i = t.jsEscape(p[n]); | |
r.asModule(e + "!" + n, "define(function () { return '" + i + "';});\n"); | |
} | |
}, | |
writeFile: function(e, n, r, i, o) { | |
var s = t.parseName(n), a = s.ext ? "." + s.ext : "", u = s.moduleName + a, l = r.toUrl(s.moduleName + a) + ".js"; | |
t.load(u, r, function() { | |
var n = function(e) { | |
return i(l, e); | |
}; | |
n.asModule = function(e, t) { | |
return i.asModule(e, l, t); | |
}, t.write(e, u, n, o); | |
}, o); | |
} | |
}, "node" === h.env || !h.env && "undefined" != typeof process && process.versions && process.versions.node ? (n = require.nodeRequire("fs"), | |
t.get = function(e, t, r) { | |
try { | |
var i = n.readFileSync(e, "utf8"); | |
0 === i.indexOf("") && (i = i.substring(1)), t(i); | |
} catch (o) { | |
r(o); | |
} | |
}) : "xhr" === h.env || !h.env && t.createXhr() ? t.get = function(e, n, r, i) { | |
var o, s = t.createXhr(); | |
if (s.open("GET", e, !0), i) for (o in i) i.hasOwnProperty(o) && s.setRequestHeader(o.toLowerCase(), i[o]); | |
h.onXhr && h.onXhr(s, e), s.onreadystatechange = function() { | |
var t, i; | |
4 === s.readyState && (t = s.status, t > 399 && 600 > t ? (i = new Error(e + " HTTP status: " + t), | |
i.xhr = s, r(i)) : n(s.responseText), h.onXhrComplete && h.onXhrComplete(s, e)); | |
}, s.send(null); | |
} : "rhino" === h.env || !h.env && "undefined" != typeof Packages && "undefined" != typeof java ? t.get = function(e, t) { | |
var n, r, i = "utf-8", o = new java.io.File(e), s = java.lang.System.getProperty("line.separator"), a = new java.io.BufferedReader(new java.io.InputStreamReader(new java.io.FileInputStream(o), i)), u = ""; | |
try { | |
for (n = new java.lang.StringBuffer(), r = a.readLine(), r && r.length() && 65279 === r.charAt(0) && (r = r.substring(1)), | |
null !== r && n.append(r); null !== (r = a.readLine()); ) n.append(s), n.append(r); | |
u = String(n.toString()); | |
} finally { | |
a.close(); | |
} | |
t(u); | |
} : ("xpconnect" === h.env || !h.env && "undefined" != typeof Components && Components.classes && Components.interfaces) && (r = Components.classes, | |
i = Components.interfaces, Components.utils["import"]("resource://gre/modules/FileUtils.jsm"), | |
t.get = function(e, t) { | |
var n, o, s = {}, a = new FileUtils.File(e); | |
try { | |
n = r["@mozilla.org/network/file-input-stream;1"].createInstance(i.nsIFileInputStream), | |
n.init(a, 1, 0, !1), o = r["@mozilla.org/intl/converter-input-stream;1"].createInstance(i.nsIConverterInputStream), | |
o.init(n, "utf-8", n.available(), i.nsIConverterInputStream.DEFAULT_REPLACEMENT_CHARACTER), | |
o.readString(n.available(), s), o.close(), n.close(), t(s.value); | |
} catch (u) { | |
throw new Error((a && a.path || "") + ": " + u); | |
} | |
}), t; | |
}), define("text!tmpl/modal.html", [], function() { | |
return '<div class="modal-blanket"></div>\n<div class="modal-container">\n <div class="close">Close</div>\n <div class="content">loading</div>\n</div>\n\n'; | |
}), function() { | |
var e = function(e, t) { | |
return function() { | |
return e.apply(t, arguments); | |
}; | |
}, t = {}.hasOwnProperty, n = function(e, n) { | |
function r() { | |
this.constructor = e; | |
} | |
for (var i in n) t.call(n, i) && (e[i] = n[i]); | |
return r.prototype = n.prototype, e.prototype = new r(), e.__super__ = n.prototype, | |
e; | |
}; | |
define("views/modal.view", [ "require", "exports", "module", "views/base.view", "text!tmpl/modal.html" ], function(t, r, i) { | |
var o, s, a, u; | |
return o = t("views/base.view"), s = t("text!tmpl/modal.html"), i.exports = a = function(t) { | |
function r() { | |
return this.destroy = e(this.destroy, this), this.onClickClose = e(this.onClickClose, this), | |
this.handleKeypress = e(this.handleKeypress, this), this.toggleInfo = e(this.toggleInfo, this), | |
u = r.__super__.constructor.apply(this, arguments); | |
} | |
return n(r, t), r.prototype.tmpl = s, r.prototype.id = "modal", r.prototype.ui = { | |
$close: ".close", | |
$content: ".content", | |
$blanket: ".modal-blanket", | |
$container: ".modal-container" | |
}, r.prototype.defaultOptions = { | |
targetContainer: "#app" | |
}, r.prototype.initialize = function(e) { | |
var t; | |
return t = null != e ? e : {}, this.nestView = t.nestView, this.targetContainer = t.targetContainer, | |
this.disallowClose = t.disallowClose, null == this.targetContainer && (this.targetContainer = $(this.defaultOptions.targetContainer)), | |
this.disallowClose ? void 0 : this.$body.on("keyup.modal", this.handleKeypress); | |
}, r.prototype.didRender = function() { | |
return this.disallowClose && this.$el.addClass("no-close"), this.trigger("modalOpen"), | |
this.$el.appendTo(this.targetContainer), this.modalContent = this.nestView ? this.renderNested(this.nestView, this.ui.$content) : void 0, | |
this.listenTo(this.modalContent, "imageclick slideshowclick", this.toggleInfo), | |
this.disallowClose || this.listenTo(this.modalContent, "pinchin", this.destroy), | |
this.disallowClose ? this.ui.$close.remove() : (this.ui.$close.on("click", this.onClickClose), | |
this.ui.$blanket.on("click", this.onClickClose)); | |
}, r.prototype.toggleInfo = function() { | |
return this.$el.toggleClass("sparse"); | |
}, r.prototype.handleKeypress = function(e) { | |
var t; | |
return 27 === e.keyCode ? (this.destroy(), null != (t = this.nestView) ? t.destroy() : void 0) : void 0; | |
}, r.prototype.onClickClose = function(e) { | |
var t; | |
this.disallowClose || (this.destroy(), null != (t = e.gesture) && t.preventDefault()); | |
}, r.prototype.destroy = function() { | |
return this.$body.off(".modal"), this.trigger("modalClose"), r.__super__.destroy.apply(this, arguments); | |
}, r; | |
}(o); | |
}); | |
}.call(this), define("text!tmpl/alert.html", [], function() { | |
return '<div class="text"><%= text %></div>\n<div class="buttons">\n <%\n for (i = 0; i < buttons.length; i++) {\n button = buttons[i];\n %>\n <div class="button" id="button<%=i%>">\n <%= button%>\n </div>\n <% } %>\n </div>\n'; | |
}), function() { | |
var e = {}.hasOwnProperty, t = function(t, n) { | |
function r() { | |
this.constructor = t; | |
} | |
for (var i in n) e.call(n, i) && (t[i] = n[i]); | |
return r.prototype = n.prototype, t.prototype = new r(), t.__super__ = n.prototype, | |
t; | |
}; | |
define("views/alert.view", [ "require", "exports", "module", "views/base.view", "models/base.model", "text!tmpl/alert.html" ], function(e, n, r) { | |
var i, o, s, a, u; | |
return s = e("views/base.view"), o = e("models/base.model"), a = e("text!tmpl/alert.html"), | |
r.exports = i = function(e) { | |
function n() { | |
return u = n.__super__.constructor.apply(this, arguments); | |
} | |
return t(n, e), n.prototype.tmpl = a, n.prototype.events = { | |
"click .button": "buttonClick" | |
}, n.prototype.initialize = function(e) { | |
return this.alertModel = (null != e ? e : {}).alertModel, this.model = new o(this.alertModel); | |
}, n.prototype.buttonClick = function(e) { | |
return this.trigger(e.currentTarget.id); | |
}, n; | |
}(s); | |
}); | |
}.call(this), function() { | |
var e = [].slice; | |
define("utils/websql-kvs", [ "require", "exports", "module", "when", "utils/arraybuffer-helpers", "config", "utils/typed-arraybuffer", "logger", "utils/local-kvs-schema", "utils/report-error", "utils/device", "views/modal.view", "views/alert.view" ], function(t, n, r) { | |
var i, o, s, a, u, l, c, d, p, h, f, m, g, v, y, w, b, _, x, E; | |
return p = t("when"), i = t("utils/arraybuffer-helpers"), s = t("config").DB_SIZE, | |
c = t("utils/typed-arraybuffer"), g = t("logger"), u = t("utils/local-kvs-schema"), | |
v = t("utils/report-error"), a = t("utils/device"), l = t("views/modal.view"), o = t("views/alert.view"), | |
f = function() { | |
var e; | |
return g.log("clearing legacy nyt-data-cache"), e = window.openDatabase("nyt-data-cache", "1.0", "Offline section & article storage", 0), | |
e.transaction(function(e) { | |
return e.executeSql("DROP TABLE IF EXISTS version", []), e.executeSql("DROP TABLE IF EXISTS sections", []), | |
e.executeSql("DROP TABLE IF EXISTS images", []); | |
}, function(e) { | |
return v(e); | |
}, function() { | |
return g.log("clearing legacy nyt-data-cache: success"); | |
}); | |
}, b = null, m = function() { | |
return null != b ? b : b = p.promise(function(t, n) { | |
var r; | |
return g.debug("WebSqlKvs: calling window.openDatabase"), r = window.openDatabase(u.DB_NAME, "1.0", u.DB_NAME, s), | |
g.debug("WebSqlKvs: called window.openDatabase"), r.transaction(function(i) { | |
return i.executeSql('CREATE TABLE IF NOT EXISTS "DB_VERSION" (one INT PRIMARY KEY, ver INT)', [], null, function(e, t) { | |
return v(t), n(new Error("db error")); | |
}), i.executeSql('SELECT ver FROM "DB_VERSION"', [], function(i, o) { | |
var s, a, l, c, d, p, h, m, y, w; | |
if ((null != o ? null != (h = o.rows) ? h.length : void 0 : void 0) > 1) return n(new Error("db error")); | |
if (a = (null != o ? null != (m = o.rows) ? m.length : void 0 : void 0) ? o.rows.item(0).ver : void 0, | |
a === u.DB_VERSION) return g.log("WebSqlKvs: schema version " + a), t(r); | |
for (g.log("WebSqlKvs: upgrading schema from version " + a + " (javascript is at " + u.DB_VERSION + ")"), | |
f(), y = e.call(u.STORE_NAMES).concat(e.call(u.OBS_STORE_NAMES)), l = 0, d = y.length; d > l; l++) s = y[l], | |
i.executeSql('DROP TABLE IF EXISTS "' + s + '"', [], null, function(e, t) { | |
return v(t), n(new Error("db error")); | |
}); | |
for (w = u.STORE_NAMES, c = 0, p = w.length; p > c; c++) s = w[c], i.executeSql('CREATE TABLE IF NOT EXISTS "' + s + '" (k TEXT PRIMARY KEY, t TEXT, v BLOB)', [], null, function(e, t) { | |
return v(t), n(new Error("db error")); | |
}); | |
return i.executeSql('INSERT OR REPLACE INTO "DB_VERSION" (one, ver) VALUES (1, ?)', [ u.DB_VERSION ], function() { | |
return t(r); | |
}, function(e, t) { | |
return v(t), n(new Error("db error")); | |
}); | |
}, function(e, t) { | |
return v(t), n(new Error("db error")); | |
}); | |
}); | |
}); | |
}, _ = !1, x = !1, E = [], h = function(e, t) { | |
x && !e ? E.push(t) : t(); | |
}, y = function(e, t, n, r) { | |
return null == n && (n = []), p.promise(function(i, o) { | |
return _ && !e ? o(new Error("quota denied")) : m().then(function(s) { | |
var u; | |
return u = void 0, h(r, function() { | |
return s[e ? "readTransaction" : "transaction"](function(s) { | |
if (!e) { | |
if (_) return o(new Error("quota denied")); | |
if (x && !r) return i(y(!1, t, n, !1)); | |
} | |
return s.executeSql(t, n, function(e, t) { | |
return u = t; | |
}, function(e, t) { | |
return v(t), o(new Error("db error")); | |
}); | |
}, function(s) { | |
return 4 === (null != s ? s.code : void 0) ? a.iOSDevice && !r ? x ? i(y(e, t, n, !1)) : (x = !0, | |
i(y(e, t, n, !0).ensure(function() { | |
var e, t, n; | |
for (x = !1, t = 0, n = E.length; n > t; t++) e = E[t], e(); | |
return E.length = 0; | |
}))) : (v(s), _ || (_ = !0, w()), o(new Error("quota denied"))) : (v(s), o(new Error("db error"))); | |
}, function() { | |
return i(u); | |
}); | |
}); | |
}, function(e) { | |
return v(e), o(new Error("db error")); | |
}); | |
}); | |
}, w = function() { | |
var e, t; | |
return e = new o({ | |
alertModel: { | |
text: 'To read Today’s Paper, you must allow it to save data on your device.\nToday’s Paper will never save more than 100 MB for offline reading.<br>\n<br>\nFor more information, please <a\nhref="http://www.nytimes.com/content/help/mobile/todays-paper/todays-paper.html"\ntarget="_blank">visit our FAQ</a>.', | |
buttons: [ "Reload" ] | |
} | |
}), t = new l({ | |
nestView: e, | |
className: "alert", | |
disallowClose: !0 | |
}), t.render(), e.once("button0", function() { | |
return e.off(), window.location.reload(!0); | |
}); | |
}, d = function() { | |
function e(e) { | |
if (this.storeName = e, -1 === u.STORE_NAMES.indexOf(this.storeName)) throw new Error("requested store '" + this.storeName + "' is not in schema"); | |
} | |
return e.prototype.set = function(e, t) { | |
var n = this; | |
return p(function() { | |
var r, o; | |
if (e = e.toString(), t instanceof ArrayBuffer) return r = i.bufferToHex(t), y(!1, 'INSERT OR REPLACE INTO "' + n.storeName + "\"\n(k, t, v) VALUES (?, 'ab:', x'" + r + "')", [ e ]); | |
if (t instanceof c) return r = i.bufferToHex(t.buffer), y(!1, 'INSERT OR REPLACE INTO "' + n.storeName + "\"\n(k, t, v) VALUES (?, 'ab:" + t.contentType + "', x'" + r + "')", [ e ]); | |
if (o = typeof t, "undefined" === o) return y(!1, 'DELETE FROM "' + n.storeName + '" WHERE k = ?', [ e ]); | |
switch (o) { | |
case "object": | |
t = JSON.stringify(t); | |
break; | |
case "string": | |
case "number": | |
case "boolean": | |
t = t.toString(); | |
break; | |
default: | |
throw new Error("can't store a " + o); | |
} | |
return y(!1, 'INSERT OR REPLACE INTO "' + n.storeName + '" (k, t, v) VALUES (?, ?, ?)', [ e, o, t ]); | |
}()).then(function() {}); | |
}, e.prototype.get = function(e) { | |
var t = this; | |
return p(function() { | |
return e = e.toString(), y(!0, "SELECT t,\n CASE WHEN t LIKE 'ab:%' THEN HEX(v) ELSE v END AS v\nFROM \"" + t.storeName + '" WHERE k = ?', [ e ]); | |
}()).then(function(e) { | |
var t, n, r, o, s; | |
if (1 !== e.rows.length) return void 0; | |
switch (o = e.rows.item(0), n = o.t, r = o.v, !1) { | |
case "ab:" !== n: | |
return i.hexToBuffer(r); | |
case !(t = null != (s = n.match(/^ab:(.*)$/)) ? s[1] : void 0): | |
return new c({ | |
contentType: t, | |
buffer: i.hexToBuffer(r) | |
}); | |
case "object" !== n: | |
return JSON.parse(r); | |
case "string" !== n: | |
return r; | |
case "number" !== n: | |
return Number(r); | |
case "boolean" !== n: | |
return "true" === r; | |
default: | |
throw new Error("can't figure out what " + n + " is"); | |
} | |
}); | |
}, e.prototype.has = function(e) { | |
var t = this; | |
return p(function() { | |
return e = e.toString(), y(!0, 'SELECT 1 FROM "' + t.storeName + '" WHERE k = ?', [ e ]); | |
}()).then(function(e) { | |
return 0 !== e.rows.length; | |
}); | |
}, e.prototype["delete"] = function(e) { | |
var t = this; | |
return p(function() { | |
return e = e.toString(), y(!1, 'DELETE FROM "' + t.storeName + '" WHERE k = ?', [ e ]); | |
}()).then(function() {}); | |
}, e.prototype.keys = function() { | |
var e = this; | |
return p(function() { | |
return y(!0, 'SELECT k FROM "' + e.storeName + '"'); | |
}()).then(function(e) { | |
var t; | |
return function() { | |
var n, r, i; | |
for (i = [], t = n = 0, r = e.rows.length; r > n; t = n += 1) i.push(e.rows.item(t).k); | |
return i; | |
}(); | |
}); | |
}, e.prototype.nuke = function() { | |
var e = this; | |
return p(function() { | |
return y(!1, 'DELETE FROM "' + e.storeName + '"'); | |
}()).then(function() {}); | |
}, e; | |
}(), r.exports = d; | |
}); | |
}.call(this), function() { | |
var e = [].slice; | |
define("utils/indexeddb-kvs", [ "require", "exports", "module", "when", "utils/arraybuffer-helpers", "config", "utils/typed-arraybuffer", "utils/report-error", "utils/local-kvs-schema", "logger" ], function(t, n, r) { | |
var i, o, s, a, u, l, c, d, p, h, f, m, g, v; | |
return c = t("when"), i = t("utils/arraybuffer-helpers"), o = t("config").DB_SIZE, | |
l = t("utils/typed-arraybuffer"), f = t("utils/report-error"), u = t("utils/local-kvs-schema"), | |
h = t("logger"), g = null, d = window.indexedDB || window.webkitIndexedDB || window.mozIndexedDB, | |
s = window.IDBTransaction || window.webkitIDBTransaction, m = function(t) { | |
var n, r, i, o, s, a, l, c; | |
for (h.debug("IndexedDbKvs: upgrading schema"), a = e.call(u.STORE_NAMES).concat(e.call(u.OBS_STORE_NAMES)), | |
r = 0, o = a.length; o > r; r++) n = a[r], h.debug("IndexedDbKvs upgradeSchema: deleting store " + n), | |
t.objectStoreNames.contains(n) && t.deleteObjectStore(n); | |
for (l = u.STORE_NAMES, c = [], i = 0, s = l.length; s > i; i++) n = l[i], h.debug("IndexedDbKvs upgradeSchema: creating store " + n), | |
c.push(t.createObjectStore(n)); | |
return c; | |
}, v = null, p = function() { | |
return null != g ? g : null != v ? v : v = c.promise(function(e, t) { | |
var n; | |
return h.debug("IndexedDbKvs initDb: calling indexedDB.open(" + u.DB_NAME + ", " + u.DB_VERSION + ")"), | |
n = d.open(u.DB_NAME, u.DB_VERSION), n.onfailure = n.onerror = function(e) { | |
var n; | |
return f(e), n = function() { | |
var t, n; | |
try { | |
return "InvalidStateError" === (null != e ? null != (t = e.target) ? null != (n = t.error) ? n.name : void 0 : void 0 : void 0); | |
} catch (r) { | |
return !1; | |
} | |
}(), n ? t(new Error("db InvalidStateError")) : t(new Error("db error")); | |
}, n.onsuccess = function(n) { | |
var r, i, o, s; | |
try { | |
return r = n.target.result, s = String(u.DB_VERSION), r.setVersion && s !== r.version ? (o = r.setVersion(u.DB_VERSION), | |
o.onfailure = function(e) { | |
return f(e), t(new Error("db error")); | |
}, o.onsuccess = function() { | |
var n; | |
try { | |
return m(r), o.result.oncomplete = function() { | |
return h.debug("IndexedDbKvs initDb: successfully inited db"), e(g = r); | |
}; | |
} catch (i) { | |
return n = i, f(n), t(new Error("db error")); | |
} | |
}) : (h.debug("IndexedDbKvs initDb: successfully inited db"), e(g = r)); | |
} catch (a) { | |
return i = a, f(i), t(new Error("db error")); | |
} | |
}, n.onblocked = function(e) { | |
return f(e), t(new Error("db init blocked")); | |
}, n.onupgradeneeded = function(e) { | |
var n; | |
try { | |
return m(e.target.result); | |
} catch (r) { | |
return n = r, f(n), t(new Error("db error")); | |
} | |
}; | |
}).then(function(e) { | |
return e; | |
}).ensure(function() { | |
return v = void 0; | |
}); | |
}, r.exports = a = function() { | |
function e(e) { | |
if (this.storeName = e, -1 === u.STORE_NAMES.indexOf(this.storeName)) throw new Error("requested store '" + this.storeName + "' is not in schema"); | |
} | |
return e.prototype.set = function(e, t) { | |
var n = this; | |
return c(function() { | |
return p(); | |
}()).then(function(r) { | |
return c.promise(function(i, o) { | |
var a, u, l; | |
return l = r.transaction([ n.storeName ], s.READ_WRITE || "readwrite"), l.onerror = function(e) { | |
return o(e); | |
}, u = l.objectStore(n.storeName), a = u.put(t, e), a.onerror = function(e) { | |
return o(e); | |
}, a.onsuccess = function() { | |
return i(); | |
}; | |
}); | |
}); | |
}, e.prototype.get = function(e) { | |
var t = this; | |
return c(function() { | |
return p(); | |
}()).then(function(n) { | |
return c.promise(function(r, i) { | |
var o, a, u; | |
return u = n.transaction([ t.storeName ], s.READ_ONLY || "readonly"), u.onerror = function(e) { | |
return i(e); | |
}, a = u.objectStore(t.storeName), o = a.get(e), o.onerror = function(e) { | |
return i(e); | |
}, o.onsuccess = function(e) { | |
var t; | |
return t = e.target.result, null != t && "object" == typeof t && null != t.contentType && t.buffer && (t = new l({ | |
contentType: t.contentType, | |
buffer: t.buffer | |
})), r(t); | |
}; | |
}); | |
}); | |
}, e.prototype.has = function(e) { | |
var t = this; | |
return c(function() { | |
return p(); | |
}()).then(function(n) { | |
return c.promise(function(r, i) { | |
var o, a, u; | |
return u = n.transaction([ t.storeName ], s.READ_ONLY || "readonly"), u.onerror = function(e) { | |
return i(e); | |
}, a = u.objectStore(t.storeName), o = "function" == typeof a.count ? a.count(e) : a.get(e), | |
o.onerror = function(e) { | |
return i(e); | |
}, o.onsuccess = function(e) { | |
return r(!!e.target.result); | |
}; | |
}); | |
}); | |
}, e.prototype["delete"] = function(e) { | |
var t = this; | |
return c(function() { | |
return p(); | |
}()).then(function(n) { | |
return c.promise(function(r, i) { | |
var o, a, u; | |
return u = n.transaction([ t.storeName ], s.READ_WRITE || "readwrite"), u.onerror = function(e) { | |
return i(e); | |
}, a = u.objectStore(t.storeName), o = a["delete"](e), o.onerror = function(e) { | |
return i(e); | |
}, o.onsuccess = function() { | |
return r(); | |
}; | |
}); | |
}); | |
}, e.prototype.keys = function() { | |
var e = this; | |
return c(function() { | |
return p(); | |
}()).then(function(t) { | |
return c.promise(function(n, r) { | |
var i, o, a, u; | |
return u = t.transaction([ e.storeName ], s.READ_WRITE || "readwrite"), u.onerror = function(e) { | |
return r(e); | |
}, a = u.objectStore(e.storeName), i = [], o = a.openCursor(), o.onerror = function(e) { | |
return r(e); | |
}, o.onsuccess = function(e) { | |
var t; | |
return t = e.target.result, t ? (i.push(t.key), t["continue"]()) : n(i); | |
}; | |
}); | |
}); | |
}, e.prototype.nuke = function() { | |
var e = this; | |
return c(function() { | |
return p(); | |
}()).then(function(t) { | |
return c.promise(function(n, r) { | |
var i, o, a, u; | |
try { | |
return u = t.transaction([ e.storeName ], s.READ_WRITE || "readwrite"), u.onerror = function(e) { | |
return r(e); | |
}, a = u.objectStore(e.storeName), o = a.clear(), o.onerror = function(e) { | |
return r(e); | |
}, o.onsuccess = function() { | |
return n(); | |
}; | |
} catch (l) { | |
return i = l, n(); | |
} | |
}); | |
}); | |
}, e; | |
}(); | |
}); | |
}.call(this), function() { | |
define("utils/local-kvs", [ "require", "exports", "module", "utils/websql-kvs", "utils/indexeddb-kvs" ], function(e, t, n) { | |
var r, i, o, s; | |
return o = e("utils/websql-kvs"), r = e("utils/indexeddb-kvs"), s = {}, n.exports = i = function() { | |
function e(e) { | |
if (!/^[a-zA-Z][a-zA-Z0-9_]*$/.test(e)) throw new Error("invalid store name " + e); | |
return null != s[e] ? s[e] : s[e] = function() { | |
if (window.indexedDB) return new r(e); | |
if (window.openDatabase) return new o(e); | |
throw new Error("client supports neither IndexedDB nor WebSQL"); | |
}(); | |
} | |
return e; | |
}(); | |
}); | |
}.call(this), function() { | |
var e = [].slice; | |
define("utils/defer-coalescing-any", [ "when" ], function(t) { | |
var n; | |
return n = function() { | |
function n() { | |
var n; | |
n = 1 <= arguments.length ? e.call(arguments, 0) : [], this._deferred = t.defer(), | |
this._promiseTrackers = [], this.promise = this._deferred.promise, this._state = void 0, | |
this._reason = void 0, this._value = void 0, this.add.apply(this, n); | |
} | |
return n.prototype.has = function(e) { | |
return this._promiseTrackers.some(function(t) { | |
return t.promise === e; | |
}); | |
}, n.prototype.add = function() { | |
var n, r, i, o, s = this; | |
if (n = 1 <= arguments.length ? e.call(arguments, 0) : [], this._state) throw new Error("can't add more promises after we've already resolved or rejected"); | |
for (i = 0, o = n.length; o > i; i++) r = n[i], t.isPromise(r) && !this.has(r) && !function(e) { | |
var t; | |
return s._promiseTrackers.push(t = { | |
promise: e, | |
state: void 0, | |
value: void 0, | |
reason: void 0 | |
}), e.then(function(e) { | |
t.state = "resolved", t.value = e, s._state || (s._state = "resolved", s._value = e, | |
s._deferred.resolve(s._value)); | |
}, function(e) { | |
var n; | |
t.state = "rejected", t.reason = e, s._state || s._promiseTrackers.every(function(e) { | |
return "rejected" === e.state; | |
}) && (s._state = "rejected", s._reason = function() { | |
var e, t, r, i; | |
for (r = this._promiseTrackers, i = [], e = 0, t = r.length; t > e; e++) n = r[e], | |
i.push(n.reason); | |
return i; | |
}.call(s), s._deferred.reject(s._reason)); | |
}); | |
}(r); | |
}, n; | |
}(); | |
}); | |
}.call(this), function() { | |
var e = {}.hasOwnProperty, t = function(t, n) { | |
function r() { | |
this.constructor = t; | |
} | |
for (var i in n) e.call(n, i) && (t[i] = n[i]); | |
return r.prototype = n.prototype, t.prototype = new r(), t.__super__ = n.prototype, | |
t; | |
}, n = [].slice; | |
define("models/storable.model", [ "require", "exports", "module", "models/base.model", "when", "utils/when-ajax", "underscore", "utils/defer-coalescing-any", "logger" ], function(e, r, i) { | |
var o, s, a, u, l, c, d, p, h; | |
return o = e("models/base.model"), u = e("when"), l = e("utils/when-ajax"), d = e("underscore"), | |
s = e("utils/defer-coalescing-any"), c = e("logger"), i.exports = a = function(e) { | |
function r() { | |
return p = r.__super__.constructor.apply(this, arguments); | |
} | |
return t(r, e), r.prototype._store = null, r.prototype._getAjaxData = function() { | |
var e = this; | |
return l(d.result(this, "url")).then(function(t) { | |
return t[e.id]; | |
}); | |
}, r.prototype._setModel = function(e) { | |
return this.set(e); | |
}, r.prototype._unsetModel = function() { | |
return this.clear({ | |
silent: !0 | |
}); | |
}, r.prototype._getDataFromBatchAjax = function(e) { | |
var t = this; | |
return e.then(function(e) { | |
return e[t.id]; | |
}); | |
}, r.batchAjax = function() { | |
var e; | |
return e = 1 <= arguments.length ? n.call(arguments, 0) : [], l(d.result(this.prototype, "url")).then(function(e) { | |
return e; | |
}); | |
}, r.prototype.fetch = function() { | |
return h.fetch.apply(this, arguments); | |
}, r.prototype.store = function() { | |
return h.store.apply(this, arguments); | |
}, r.prototype.unfetch = function() { | |
return h.unfetch.apply(this, arguments); | |
}, r.prototype.deleteLocal = function() { | |
return h.deleteLocal.apply(this, arguments); | |
}, r.prototype.isFetched = function() { | |
return h.isFetched.apply(this, arguments); | |
}, r.prototype.isStored = function() { | |
return h.isStored.apply(this, arguments); | |
}, r.fetchBatch = function() { | |
return h.fetchBatch.apply(this, arguments); | |
}, r.storeBatch = function() { | |
return h.storeBatch.apply(this, arguments); | |
}, r; | |
}(o), h = { | |
fetch: function(e, t) { | |
var n = this; | |
return null == e && (e = {}), null == t && (t = null), u(function() { | |
return n._fetchCount = (n._fetchCount || 0) + 1, !n._isVivified || e.forceRefresh || e.store ? u(function() { | |
return e.forceRefresh ? void 0 : null != n._getFromStoreDebounced ? n._getFromStoreDebounced : n._getFromStoreDebounced = (c.trace("" + n.constructor.name + " " + n.id + ": looking for model data in store"), | |
n._store.get(n.id)).ensure(function() { | |
return n._getFromStoreDebounced = void 0; | |
}); | |
}()).then(function(r) { | |
return null == r ? (null != t && h._coalesceAjaxData.call(n, n._getDataFromBatchAjax(t)), | |
(e.precedeBatch || null == t) && h._coalesceAjaxData.call(n, h._getSoloAjaxDataDebounced.call(n)), | |
h._processAjax.call(n, { | |
vivify: !(n._isVivified && !e.forceRefresh), | |
options: e, | |
store: e.store | |
})) : n._isVivified ? void 0 : (c.trace("" + n.constructor.name + " " + n.id + ": vivifying from store"), | |
n._setModel(r, e)); | |
}).then(function() { | |
return n._isVivified = !0, c.trace("" + n.constructor.name + " " + n.id + ": fetch complete"), | |
n; | |
}) : n; | |
}()); | |
}, | |
store: function(e, t) { | |
var n = this; | |
return null == e && (e = {}), null == t && (t = null), u(function() { | |
return e.forceRefresh ? void 0 : null != n._checkStoreDebounced ? n._checkStoreDebounced : n._checkStoreDebounced = (c.trace("" + n.constructor.name + " " + n.id + ": checking whether model already stored"), | |
n._store.has(n.id)).ensure(function() { | |
return n._checkStoreDebounced = void 0; | |
}); | |
}()).then(function(r) { | |
return r ? void 0 : (null != t && h._coalesceAjaxData.call(n, n._getDataFromBatchAjax(t)), | |
(e.precedeBatch || null == t) && h._coalesceAjaxData.call(n, h._getSoloAjaxDataDebounced.call(n)), | |
h._processAjax.call(n, { | |
vivify: !1, | |
store: !0 | |
})); | |
}).then(function() { | |
return c.trace("" + n.constructor.name + " " + n.id + ": store complete"), n; | |
}); | |
}, | |
unfetch: function() { | |
return this._fetchCount ? (this._fetchCount -= 1, this._fetchCount > 0 || (this._isVivified = void 0, | |
this._unsetModel()), void 0) : (c.warn("" + this.constructor.name + " " + this.id + ": excessive unfetch() (no corresponding fetch())"), | |
void 0); | |
}, | |
deleteLocal: function() { | |
var e = this; | |
return this._store["delete"](this.id).then(function() { | |
return e; | |
}); | |
}, | |
isFetched: function() { | |
return this._isVivified; | |
}, | |
isStored: function() { | |
return this._store.has(this.id); | |
}, | |
fetchBatch: function(e, t, n) { | |
var r; | |
return null == e && (e = {}), null == n && (n = this.batchAjax.apply(this, t)), | |
u.all(function() { | |
var i, o, s; | |
for (s = [], i = 0, o = t.length; o > i; i++) r = t[i], s.push(function(t) { | |
return t.fetch(e, n); | |
}(r)); | |
return s; | |
}()); | |
}, | |
storeBatch: function(e, t, n) { | |
var r; | |
return null == e && (e = {}), null == n && (n = this.batchAjax.apply(this, t)), | |
d.extend(e, { | |
forceRefresh: !0 | |
}), u.all(function() { | |
var i, o, s; | |
for (s = [], i = 0, o = t.length; o > i; i++) r = t[i], s.push(function(t) { | |
return t.store(e, n); | |
}(r)); | |
return s; | |
}()); | |
}, | |
_processAjax: function(e) { | |
var t, n, r, i = this; | |
return r = e.vivify, n = e.store, t = e.options, u.join(r ? null != this._vivifyDebounced ? this._vivifyDebounced : this._vivifyDebounced = h._getCoalescingAjax.call(this).then(function(e) { | |
return c.trace("" + i.constructor.name + " " + i.id + ": vivifying from ajax"), | |
i._setModel(e, t); | |
}).ensure(function() { | |
return i._vivifyDebounced = void 0; | |
}) : void 0, n ? null != this._storeDebounced ? this._storeDebounced : this._storeDebounced = h._getCoalescingAjax.call(this).then(function(e) { | |
var t, n, r; | |
return c.trace("" + i.constructor.name + " " + i.id + ": saving " + (null != (t = null != (n = null != e ? e.byteLength : void 0) ? n : null != e ? null != (r = e.buffer) ? r.byteLength : void 0 : void 0) ? t : "string" == typeof e ? 2 * e.length : void 0) + " bytes to store"), | |
i._store.set(i.id, e); | |
}).ensure(function() { | |
return i._storeDebounced = void 0; | |
}) : void 0); | |
}, | |
_coalesceAjaxData: function(e) { | |
var t = this; | |
null == this._coalescingAjaxDeferred ? (this._coalescingAjaxDeferred = new s(e), | |
this._coalescingAjaxDeferred.promise.ensure(function() { | |
return t._coalescingAjaxDeferred = void 0; | |
}).otherwise(function() {})) : (this._coalescingAjaxDeferred.has(e) || c.trace("" + this.constructor.name + " " + this.id + ": coalescing " + "ajax request into already-pending request"), | |
this._coalescingAjaxDeferred.add(e)); | |
}, | |
_getSoloAjaxDataDebounced: function() { | |
var e = this; | |
return null != this._soloAjaxDebounced ? this._soloAjaxDebounced : this._soloAjaxDebounced = (c.trace("" + this.constructor.name + " " + this.id + ": sending new solo request"), | |
this._getAjaxData()).ensure(function() { | |
return e._soloAjaxDebounced = void 0; | |
}); | |
}, | |
_getCoalescingAjax: function() { | |
if (null == this._coalescingAjaxDeferred) throw new Error("attempted to getCoalescingAjax(), but no ajaxes are currently coalesced"); | |
return this._coalescingAjaxDeferred.promise; | |
} | |
}; | |
}); | |
}.call(this), function() { | |
var e = {}.hasOwnProperty, t = function(t, n) { | |
function r() { | |
this.constructor = t; | |
} | |
for (var i in n) e.call(n, i) && (t[i] = n[i]); | |
return r.prototype = n.prototype, t.prototype = new r(), t.__super__ = n.prototype, | |
t; | |
}; | |
define("collections/base.coll", [ "require", "exports", "module", "backbone", "when" ], function(e, n, r) { | |
var i, o, s, a; | |
return i = e("backbone"), s = e("when"), r.exports = o = function(e) { | |
function n() { | |
return a = n.__super__.constructor.apply(this, arguments); | |
} | |
return t(n, e), n.prototype.fetch = function() { | |
return s.all(this.map(function(e) { | |
return e.fetch(); | |
})); | |
}, n.prototype.unfetch = function() { | |
return s.all(this.map(function(e) { | |
return e.unfetch(); | |
})); | |
}, n; | |
}(i.Collection); | |
}); | |
}.call(this), function() { | |
var e = {}.hasOwnProperty, t = function(t, n) { | |
function r() { | |
this.constructor = t; | |
} | |
for (var i in n) e.call(n, i) && (t[i] = n[i]); | |
return r.prototype = n.prototype, t.prototype = new r(), t.__super__ = n.prototype, | |
t; | |
}, n = [].slice; | |
define("models/article.model", [ "require", "exports", "module", "models/storable.model", "when", "utils/arraybuffer-helpers", "utils/local-kvs", "utils/when-ajax", "underscore" ], function(e, r, i) { | |
var o, s, a, u, l, c, d, p; | |
return u = e("models/storable.model"), l = e("when"), o = e("utils/arraybuffer-helpers"), | |
a = e("utils/local-kvs"), c = e("utils/when-ajax"), d = e("underscore"), i.exports = s = function(e) { | |
function r() { | |
return p = r.__super__.constructor.apply(this, arguments); | |
} | |
return t(r, e), r.prototype._store = new a("article_body"), r.prototype.defaults = function() { | |
return { | |
kicker: null, | |
headline: null, | |
byline: null, | |
authors: null, | |
body: null, | |
wwwUrl: null, | |
tinyUrl: null, | |
slug: null, | |
printPage: null, | |
relatedAssets: null, | |
spanImage: null, | |
tone: null, | |
route: null, | |
edition: null | |
}; | |
}, r.sugarAttributes({ | |
collections: { | |
relatedAssets: "relatedAsset" | |
} | |
}), r.prototype._getAjaxData = function() { | |
return c("" + this.edition.editionUrlBase() + "/article-body?id=" + this.id, { | |
dataType: "text" | |
}); | |
}, r.prototype._getDataFromBatchAjax = function(e) { | |
var t = this; | |
return l(function() { | |
return e; | |
}()).then(function(e) { | |
return e[t.id]; | |
}); | |
}, r.prototype._setModel = function(e, t) { | |
var n = this; | |
return l(function() { | |
return n.set({ | |
body: e | |
}, t); | |
}()); | |
}, r.prototype._unsetModel = function() { | |
return this.unset("body", { | |
silent: !0 | |
}); | |
}, r.batchAjax = function() { | |
var e, t, r, i; | |
if (t = 1 <= arguments.length ? n.call(arguments, 0) : [], 1 === t.length && Array.isArray(t[0]) && (t = t[0]), | |
r = null != t ? t[0].edition : void 0, i = function() { | |
var n, i, o; | |
for (o = [], n = 0, i = t.length; i > n; n++) e = t[n], e.edition === r && o.push(e.id); | |
return o; | |
}(), i.length !== t.length) throw new Error("batch fetching articles from multiple different editions not implemented"); | |
return c("" + r.editionUrlBase() + "/article-bodies?ids=" + encodeURIComponent(i.join(","))); | |
}, r; | |
}(u); | |
}); | |
}.call(this), function(e) { | |
function t(e, t) { | |
return void 0 === t ? "" + t : "number" != typeof t || !isNaN(t) && isFinite(t) ? "function" == typeof t || t instanceof RegExp ? t.toString() : t : t.toString(); | |
} | |
function n(e, t) { | |
return "string" == typeof e ? e.length < t ? e : e.slice(0, t) : e; | |
} | |
function r(e, t, n, r, i) { | |
throw new f.AssertionError({ | |
message: n, | |
actual: e, | |
expected: t, | |
operator: r, | |
stackStartFunction: i | |
}); | |
} | |
function i(e, t) { | |
e || r(e, !0, t, "==", f.ok); | |
} | |
function o(e, t) { | |
return e === t ? !0 : e instanceof Date && t instanceof Date ? e.getTime() === t.getTime() : e instanceof RegExp && t instanceof RegExp ? e.source === t.source && e.global === t.global && e.multiline === t.multiline && e.lastIndex === t.lastIndex && e.ignoreCase === t.ignoreCase : "object" != typeof e && "object" != typeof t ? e == t : u(e, t); | |
} | |
function s(e) { | |
return null === e || void 0 === e; | |
} | |
function a(e) { | |
return "[object Arguments]" == Object.prototype.toString.call(e); | |
} | |
function u(e, t) { | |
if (s(e) || s(t)) return !1; | |
if (e.prototype !== t.prototype) return !1; | |
if (a(e)) return a(t) ? (e = h.call(e), t = h.call(t), o(e, t)) : !1; | |
try { | |
var n, r, i = Object.keys(e), u = Object.keys(t); | |
} catch (l) { | |
return !1; | |
} | |
if (i.length != u.length) return !1; | |
for (i.sort(), u.sort(), r = i.length - 1; r >= 0; r--) if (i[r] != u[r]) return !1; | |
for (r = i.length - 1; r >= 0; r--) if (n = i[r], !o(e[n], t[n])) return !1; | |
return !0; | |
} | |
function l(e, t) { | |
return e && t ? t instanceof RegExp ? t.test(e) : e instanceof t ? !0 : t.call({}, e) === !0 ? !0 : !1 : !1; | |
} | |
function c(e, t, n, i) { | |
var o; | |
"string" == typeof n && (i = n, n = null); | |
try { | |
t(); | |
} catch (s) { | |
o = s; | |
} | |
if (i = (n && n.name ? " (" + n.name + ")." : ".") + (i ? " " + i : "."), e && !o && r("Missing expected exception" + i), | |
!e && l(o, n) && r("Got unwanted exception" + i), e && o && n && !l(o, n) || !e && o) throw o; | |
} | |
var d = Object.create || function(e) { | |
function t() {} | |
if (!e) throw Error("no type"); | |
return t.prototype = e, new t(); | |
}, p = { | |
inherits: function(e, t) { | |
e.super_ = t, e.prototype = d(t.prototype, { | |
constructor: { | |
value: e, | |
enumerable: !1, | |
writable: !0, | |
configurable: !0 | |
} | |
}); | |
} | |
}, h = Array.prototype.slice, f = i; | |
e.assert = f, "object" == typeof module && "object" == typeof module.exports && (module.exports = f), | |
f.AssertionError = function(e) { | |
this.name = "AssertionError", this.message = e.message, this.actual = e.actual, | |
this.expected = e.expected, this.operator = e.operator; | |
var t = e.stackStartFunction || r; | |
Error.captureStackTrace && Error.captureStackTrace(this, t); | |
}, p.inherits(f.AssertionError, Error), f.AssertionError.prototype.toString = function() { | |
return this.message ? [ this.name + ":", this.message ].join(" ") : [ this.name + ":", n(JSON.stringify(this.actual, t), 128), this.operator, n(JSON.stringify(this.expected, t), 128) ].join(" "); | |
}, f.AssertionError.__proto__ = Error.prototype, f.fail = r, f.ok = i, f.equal = function(e, t, n) { | |
e != t && r(e, t, n, "==", f.equal); | |
}, f.notEqual = function(e, t, n) { | |
e == t && r(e, t, n, "!=", f.notEqual); | |
}, f.deepEqual = function(e, t, n) { | |
o(e, t) || r(e, t, n, "deepEqual", f.deepEqual); | |
}, f.notDeepEqual = function(e, t, n) { | |
o(e, t) && r(e, t, n, "notDeepEqual", f.notDeepEqual); | |
}, f.strictEqual = function(e, t, n) { | |
e !== t && r(e, t, n, "===", f.strictEqual); | |
}, f.notStrictEqual = function(e, t, n) { | |
e === t && r(e, t, n, "!==", f.notStrictEqual); | |
}, f.throws = function() { | |
c.apply(this, [ !0 ].concat(h.call(arguments))); | |
}, f.doesNotThrow = function() { | |
c.apply(this, [ !1 ].concat(h.call(arguments))); | |
}, f.ifError = function(e) { | |
if (e) throw e; | |
}; | |
}(this), define("assert", function(e) { | |
return function() { | |
var t; | |
return t || e.assert; | |
}; | |
}(this)), function() { | |
var e = {}.hasOwnProperty, t = function(t, n) { | |
function r() { | |
this.constructor = t; | |
} | |
for (var i in n) e.call(n, i) && (t[i] = n[i]); | |
return r.prototype = n.prototype, t.prototype = new r(), t.__super__ = n.prototype, | |
t; | |
}; | |
define("collections/articles.coll", [ "require", "exports", "module", "collections/base.coll", "models/article.model", "assert" ], function(e, n, r) { | |
var i, o, s, a, u; | |
return s = e("collections/base.coll"), i = e("models/article.model"), a = e("assert"), | |
o = function(e) { | |
function n() { | |
return u = n.__super__.constructor.apply(this, arguments); | |
} | |
return t(n, e), n.prototype.model = i, n.prototype.bifurcate = function(e) { | |
var t, n; | |
return a("number" == typeof e), n = this.toArray(), t = n.splice(0, e), [ t, n ]; | |
}, n; | |
}(s), r.exports = o; | |
}); | |
}.call(this), function() { | |
var e = {}.hasOwnProperty, t = function(t, n) { | |
function r() { | |
this.constructor = t; | |
} | |
for (var i in n) e.call(n, i) && (t[i] = n[i]); | |
return r.prototype = n.prototype, t.prototype = new r(), t.__super__ = n.prototype, | |
t; | |
}; | |
define("models/section.model", [ "require", "exports", "module", "models/base.model", "collections/articles.coll" ], function(e, n, r) { | |
var i, o, s, a; | |
return o = e("models/base.model"), i = e("collections/articles.coll"), r.exports = s = function(e) { | |
function n() { | |
return a = n.__super__.constructor.apply(this, arguments); | |
} | |
return t(n, e), n.prototype.idAttribute = "internalName", n.prototype.defaults = function() { | |
return { | |
friendlyName: null, | |
internalName: null, | |
articles: null, | |
route: null, | |
edition: null, | |
thumb: null | |
}; | |
}, n.sugarAttributes({ | |
collections: { | |
articles: "article" | |
} | |
}), n.prototype.fetch = function() {}, n.prototype.sync = function() { | |
throw new Error("can't sync a SectionModel independently of its EditionModel"); | |
}, n.prototype.toJSON = function() { | |
var e, t; | |
return t = o.prototype.toJSON, e = t.call(this), e.articles = e.articles.toJSON(), | |
e; | |
}, n; | |
}(o); | |
}); | |
}.call(this), function() { | |
define("utils/binary-ajax", [ "require", "exports", "module", "when", "utils/typed-arraybuffer" ], function(e, t, n) { | |
var r, i; | |
return i = e("when"), r = e("utils/typed-arraybuffer"), n.exports = { | |
ajax: function(e) { | |
return i.promise(function(t, n) { | |
var i; | |
return i = new XMLHttpRequest(), i.open("GET", e), i.responseType = "arraybuffer", | |
i.onload = function(e) { | |
var i; | |
return i = e.target.response, null == i ? n(new Error("response is missing buffer")) : 200 !== e.target.status ? n(new Error("status " + e.target.status)) : t(new r({ | |
buffer: i, | |
contentType: e.target.getResponseHeader("Content-Type") | |
})); | |
}, i.onerror = function(e) { | |
return n(e); | |
}, i.send(); | |
}); | |
} | |
}; | |
}); | |
}.call(this), function() { | |
var e = {}.hasOwnProperty, t = function(t, n) { | |
function r() { | |
this.constructor = t; | |
} | |
for (var i in n) e.call(n, i) && (t[i] = n[i]); | |
return r.prototype = n.prototype, t.prototype = new r(), t.__super__ = n.prototype, | |
t; | |
}; | |
define("models/image.model", [ "require", "exports", "module", "underscore", "models/storable.model", "utils/binary-ajax", "utils/local-kvs", "when", "utils/arraybuffer-helpers", "logger" ], function(e, n, r) { | |
var i, o, s, a, u, l, c, d, p; | |
return d = e("underscore"), u = e("models/storable.model"), o = e("utils/binary-ajax"), | |
a = e("utils/local-kvs"), l = e("when"), i = e("utils/arraybuffer-helpers"), c = e("logger"), | |
window.URL = window.URL || window.webkitURL, r.exports = s = function(e) { | |
function n() { | |
return p = n.__super__.constructor.apply(this, arguments); | |
} | |
return t(n, e), n.prototype._store = new a("image_data"), n.prototype.defaults = function() { | |
return { | |
id: null, | |
caption: null, | |
credit: null, | |
aspectRatio: null, | |
proportion: null, | |
width: null, | |
height: null, | |
wwwUrl: null, | |
imgSrcUrl: null, | |
edition: null | |
}; | |
}, n.sugarAttributes(), n.prototype.fetch = function() { | |
var e = this; | |
return n.__super__.fetch.apply(this, arguments).otherwise(function() { | |
return e.set("imgSrcUrl", e.wwwUrl); | |
}); | |
}, n.prototype._getAjaxData = function() { | |
return o.ajax(this.wwwUrl); | |
}, n.prototype._setModel = function(e) { | |
return this.imgSrcUrl ? void 0 : (this.set("imgSrcUrl", URL.createObjectURL(new Blob([ e.buffer ], { | |
type: e.contentType | |
}))), "development" === window.ENV ? (null != window.blobs ? window.blobs : window.blobs = {})[this.imgSrcUrl] = 1 : void 0); | |
}, n.prototype._unsetModel = function() { | |
return this.imgSrcUrl ? ("development" === window.ENV && delete (null != window.blobs ? window.blobs : window.blobs = {})[this.imgSrcUrl], | |
URL.revokeObjectURL(this.imgSrcUrl), this.unset("imgSrcUrl", { | |
silent: !0 | |
})) : void 0; | |
}, n; | |
}(u); | |
}); | |
}.call(this), function() { | |
var e = {}.hasOwnProperty, t = function(t, n) { | |
function r() { | |
this.constructor = t; | |
} | |
for (var i in n) e.call(n, i) && (t[i] = n[i]); | |
return r.prototype = n.prototype, t.prototype = new r(), t.__super__ = n.prototype, | |
t; | |
}; | |
define("models/slideshow.model", [ "require", "exports", "module", "models/base.model", "utils/local-kvs" ], function(e, n, r) { | |
var i, o, s, a; | |
return i = e("models/base.model"), o = e("utils/local-kvs"), r.exports = s = function(e) { | |
function n() { | |
return a = n.__super__.constructor.apply(this, arguments); | |
} | |
return t(n, e), n._store = new o("image_data"), n.prototype.defaults = function() { | |
return { | |
id: null, | |
title: null, | |
summary: null, | |
wwwUrl: null, | |
thumbnailWide: null, | |
thumbImage: null, | |
slides: null, | |
slideImages: null | |
}; | |
}, n.sugarAttributes(), n; | |
}(i); | |
}); | |
}.call(this), function() { | |
var e = function(e, t) { | |
return function() { | |
return e.apply(t, arguments); | |
}; | |
}, t = {}.hasOwnProperty, n = function(e, n) { | |
function r() { | |
this.constructor = e; | |
} | |
for (var i in n) t.call(n, i) && (e[i] = n[i]); | |
return r.prototype = n.prototype, e.prototype = new r(), e.__super__ = n.prototype, | |
e; | |
}; | |
define("models/video.model", [ "require", "exports", "module", "models/storable.model", "utils/binary-ajax", "utils/local-kvs", "utils/arraybuffer-helpers" ], function(t) { | |
var r, i, o, s, a, u; | |
return s = t("models/storable.model"), i = t("utils/binary-ajax"), o = t("utils/local-kvs"), | |
r = t("utils/arraybuffer-helpers"), window.URL = window.URL || window.webkitURL, | |
a = function(t) { | |
function s() { | |
return this._unsetModel = e(this._unsetModel, this), this._setModel = e(this._setModel, this), | |
this._getAjaxData = e(this._getAjaxData, this), this.fetch = e(this.fetch, this), | |
u = s.__super__.constructor.apply(this, arguments); | |
} | |
return n(s, t), s.prototype._store = new o("video_poster_image_data"), s.prototype.defaults = function() { | |
return { | |
id: null, | |
title: null, | |
wwwUrl: null, | |
kicker: null, | |
caption: null, | |
credit: null, | |
posterUrl: null, | |
posterWwwUrl: null, | |
encoding: null, | |
edition: null | |
}; | |
}, s.sugarAttributes(), s.prototype.fetch = function() { | |
var e = this; | |
return s.__super__.fetch.apply(this, arguments).otherwise(function() { | |
return e.set("posterUrl", "posterWwwUrl"); | |
}); | |
}, s.prototype._getAjaxData = function() { | |
return i.ajax(this.posterWwwUrl); | |
}, s.prototype._setModel = function(e) { | |
var t; | |
return this.posterUrl && this._unsetModel(), t = r.bufferToBase64(e.buffer), this.set("posterUrl", "data:" + e.contentType + ";base64," + t); | |
}, s.prototype._unsetModel = function() { | |
return this.posterUrl ? this.unset("posterUrl", { | |
silent: !0 | |
}) : void 0; | |
}, s; | |
}(s); | |
}); | |
}.call(this), function() { | |
var e = {}.hasOwnProperty, t = function(t, n) { | |
function r() { | |
this.constructor = t; | |
} | |
for (var i in n) e.call(n, i) && (t[i] = n[i]); | |
return r.prototype = n.prototype, t.prototype = new r(), t.__super__ = n.prototype, | |
t; | |
}; | |
define("collections/sections.coll", [ "require", "exports", "module", "collections/base.coll", "models/section.model" ], function(e, n, r) { | |
var i, o, s, a; | |
return i = e("collections/base.coll"), o = e("models/section.model"), r.exports = s = function(e) { | |
function n() { | |
return a = n.__super__.constructor.apply(this, arguments); | |
} | |
return t(n, e), n.prototype.model = o, n; | |
}(i); | |
}); | |
}.call(this), function() { | |
var e = {}.hasOwnProperty, t = function(t, n) { | |
function r() { | |
this.constructor = t; | |
} | |
for (var i in n) e.call(n, i) && (t[i] = n[i]); | |
return r.prototype = n.prototype, t.prototype = new r(), t.__super__ = n.prototype, | |
t; | |
}; | |
define("collections/assets.coll", [ "require", "exports", "module", "collections/base.coll", "models/image.model", "models/slideshow.model", "models/video.model" ], function(e, n, r) { | |
var i, o, s, a, u, l; | |
return o = e("collections/base.coll"), s = e("models/image.model"), a = e("models/slideshow.model"), | |
u = e("models/video.model"), r.exports = i = function(e) { | |
function n() { | |
return l = n.__super__.constructor.apply(this, arguments); | |
} | |
return t(n, e), n; | |
}(o); | |
}); | |
}.call(this), function() { | |
var e = {}.hasOwnProperty, t = function(t, n) { | |
function r() { | |
this.constructor = t; | |
} | |
for (var i in n) e.call(n, i) && (t[i] = n[i]); | |
return r.prototype = n.prototype, t.prototype = new r(), t.__super__ = n.prototype, | |
t; | |
}; | |
define("collections/images.coll", [ "require", "exports", "module", "collections/base.coll", "models/image.model" ], function(e, n, r) { | |
var i, o, s, a; | |
return i = e("collections/base.coll"), o = e("models/image.model"), r.exports = s = function(e) { | |
function n() { | |
return a = n.__super__.constructor.apply(this, arguments); | |
} | |
return t(n, e), n.prototype.model = o, n; | |
}(i); | |
}); | |
}.call(this), function() { | |
var e = {}.hasOwnProperty, t = function(t, n) { | |
function r() { | |
this.constructor = t; | |
} | |
for (var i in n) e.call(n, i) && (t[i] = n[i]); | |
return r.prototype = n.prototype, t.prototype = new r(), t.__super__ = n.prototype, | |
t; | |
}; | |
define("collections/slideshows.coll", [ "require", "exports", "module", "collections/base.coll", "models/slideshow.model" ], function(e, n, r) { | |
var i, o, s, a; | |
return i = e("collections/base.coll"), o = e("models/slideshow.model"), r.exports = s = function(e) { | |
function n() { | |
return a = n.__super__.constructor.apply(this, arguments); | |
} | |
return t(n, e), n.prototype.model = o, n; | |
}(i); | |
}); | |
}.call(this), function() { | |
var e = {}.hasOwnProperty, t = function(t, n) { | |
function r() { | |
this.constructor = t; | |
} | |
for (var i in n) e.call(n, i) && (t[i] = n[i]); | |
return r.prototype = n.prototype, t.prototype = new r(), t.__super__ = n.prototype, | |
t; | |
}; | |
define("collections/videos.coll", [ "require", "exports", "module", "collections/base.coll", "models/video.model" ], function(e, n, r) { | |
var i, o, s, a; | |
return i = e("collections/base.coll"), o = e("models/video.model"), r.exports = s = function(e) { | |
function n() { | |
return a = n.__super__.constructor.apply(this, arguments); | |
} | |
return t(n, e), n.prototype.model = o, n; | |
}(i); | |
}); | |
}.call(this), function() { | |
var e = {}.hasOwnProperty, t = function(t, n) { | |
function r() { | |
this.constructor = t; | |
} | |
for (var i in n) e.call(n, i) && (t[i] = n[i]); | |
return r.prototype = n.prototype, t.prototype = new r(), t.__super__ = n.prototype, | |
t; | |
}; | |
define("models/www-image.model", [ "require", "exports", "module", "models/storable.model", "utils/binary-ajax", "utils/local-kvs", "utils/arraybuffer-helpers" ], function(e, n, r) { | |
var i, o, s, a, u, l; | |
return a = e("models/storable.model"), o = e("utils/binary-ajax"), s = e("utils/local-kvs"), | |
i = e("utils/arraybuffer-helpers"), window.URL = window.URL || window.webkitURL, | |
r.exports = u = function(e) { | |
function n() { | |
return l = n.__super__.constructor.apply(this, arguments); | |
} | |
return t(n, e), n.prototype._store = new s("www_image"), n.prototype.defaults = function() { | |
return { | |
id: null, | |
aspectRatio: null, | |
wwwUrl: null, | |
imgSrcUrl: null | |
}; | |
}, n.sugarAttributes(), n.prototype.fetch = function() { | |
var e = this; | |
return n.__super__.fetch.apply(this, arguments).otherwise(function() { | |
return e.set("imgSrcUrl", e.wwwUrl); | |
}); | |
}, n.prototype._getAjaxData = function() { | |
if (!this.wwwUrl) throw new Error("no url provided for WwwImage"); | |
return o.ajax(this.wwwUrl); | |
}, n.prototype._setModel = function(e) { | |
return this.imgSrcUrl && this._unsetModel(), this.set("imgSrcUrl", URL.createObjectURL(new Blob([ e.buffer ], { | |
type: e.contentType | |
}))), "development" === window.ENV ? (null != window.blobs ? window.blobs : window.blobs = {})[this.imgSrcUrl] = 1 : void 0; | |
}, n.prototype._unsetModel = function() { | |
return this.imgSrcUrl ? ("development" === window.ENV && delete (null != window.blobs ? window.blobs : window.blobs = {})[this.imgSrcUrl], | |
URL.revokeObjectURL(this.imgSrcUrl), this.unset("imgSrcUrl", { | |
silent: !0 | |
})) : void 0; | |
}, n; | |
}(a); | |
}); | |
}.call(this), function(e) { | |
function t(e, t) { | |
return function(n) { | |
return u(e.call(this, n), t); | |
}; | |
} | |
function n(e, t) { | |
return function(n) { | |
return this.lang().ordinal(e.call(this, n), t); | |
}; | |
} | |
function r() {} | |
function i(e) { | |
s(this, e); | |
} | |
function o(e) { | |
var t = e.years || e.year || e.y || 0, n = e.months || e.month || e.M || 0, r = e.weeks || e.week || e.w || 0, i = e.days || e.day || e.d || 0, o = e.hours || e.hour || e.h || 0, s = e.minutes || e.minute || e.m || 0, a = e.seconds || e.second || e.s || 0, u = e.milliseconds || e.millisecond || e.ms || 0; | |
this._input = e, this._milliseconds = +u + 1e3 * a + 6e4 * s + 36e5 * o, this._days = +i + 7 * r, | |
this._months = +n + 12 * t, this._data = {}, this._bubble(); | |
} | |
function s(e, t) { | |
for (var n in t) t.hasOwnProperty(n) && (e[n] = t[n]); | |
return e; | |
} | |
function a(e) { | |
return 0 > e ? Math.ceil(e) : Math.floor(e); | |
} | |
function u(e, t) { | |
for (var n = e + ""; n.length < t; ) n = "0" + n; | |
return n; | |
} | |
function l(e, t, n, r) { | |
var i, o, s = t._milliseconds, a = t._days, u = t._months; | |
s && e._d.setTime(+e._d + s * n), (a || u) && (i = e.minute(), o = e.hour()), a && e.date(e.date() + a * n), | |
u && e.month(e.month() + u * n), s && !r && $.updateOffset(e), (a || u) && (e.minute(i), | |
e.hour(o)); | |
} | |
function c(e) { | |
return "[object Array]" === Object.prototype.toString.call(e); | |
} | |
function d(e, t) { | |
var n, r = Math.min(e.length, t.length), i = Math.abs(e.length - t.length), o = 0; | |
for (n = 0; r > n; n++) ~~e[n] !== ~~t[n] && o++; | |
return o + i; | |
} | |
function p(e) { | |
return e ? ut[e] || e.toLowerCase().replace(/(.)s$/, "$1") : e; | |
} | |
function h(e, t) { | |
return t.abbr = e, U[e] || (U[e] = new r()), U[e].set(t), U[e]; | |
} | |
function f(e) { | |
delete U[e]; | |
} | |
function m(e) { | |
if (!e) return $.fn._lang; | |
if (!U[e] && F) try { | |
require("./lang/" + e); | |
} catch (t) { | |
return $.fn._lang; | |
} | |
return U[e] || $.fn._lang; | |
} | |
function g(e) { | |
return e.match(/\[.*\]/) ? e.replace(/^\[|\]$/g, "") : e.replace(/\\/g, ""); | |
} | |
function v(e) { | |
var t, n, r = e.match(z); | |
for (t = 0, n = r.length; n > t; t++) r[t] = pt[r[t]] ? pt[r[t]] : g(r[t]); | |
return function(i) { | |
var o = ""; | |
for (t = 0; n > t; t++) o += r[t] instanceof Function ? r[t].call(i, e) : r[t]; | |
return o; | |
}; | |
} | |
function y(e, t) { | |
return t = w(t, e.lang()), lt[t] || (lt[t] = v(t)), lt[t](e); | |
} | |
function w(e, t) { | |
function n(e) { | |
return t.longDateFormat(e) || e; | |
} | |
for (var r = 5; r-- && (Y.lastIndex = 0, Y.test(e)); ) e = e.replace(Y, n); | |
return e; | |
} | |
function b(e, t) { | |
switch (e) { | |
case "DDDD": | |
return G; | |
case "YYYY": | |
return J; | |
case "YYYYY": | |
return K; | |
case "S": | |
case "SS": | |
case "SSS": | |
case "DDD": | |
return X; | |
case "MMM": | |
case "MMMM": | |
case "dd": | |
case "ddd": | |
case "dddd": | |
return Q; | |
case "a": | |
case "A": | |
return m(t._l)._meridiemParse; | |
case "X": | |
return tt; | |
case "Z": | |
case "ZZ": | |
return Z; | |
case "T": | |
return et; | |
case "MM": | |
case "DD": | |
case "YY": | |
case "HH": | |
case "hh": | |
case "mm": | |
case "ss": | |
case "M": | |
case "D": | |
case "d": | |
case "H": | |
case "h": | |
case "m": | |
case "s": | |
return W; | |
default: | |
return new RegExp(e.replace("\\", "")); | |
} | |
} | |
function _(e) { | |
var t = (Z.exec(e) || [])[0], n = (t + "").match(ot) || [ "-", 0, 0 ], r = +(60 * n[1]) + ~~n[2]; | |
return "+" === n[0] ? -r : r; | |
} | |
function x(e, t, n) { | |
var r, i = n._a; | |
switch (e) { | |
case "M": | |
case "MM": | |
null != t && (i[1] = ~~t - 1); | |
break; | |
case "MMM": | |
case "MMMM": | |
r = m(n._l).monthsParse(t), null != r ? i[1] = r : n._isValid = !1; | |
break; | |
case "D": | |
case "DD": | |
null != t && (i[2] = ~~t); | |
break; | |
case "DDD": | |
case "DDDD": | |
null != t && (i[1] = 0, i[2] = ~~t); | |
break; | |
case "YY": | |
i[0] = ~~t + (~~t > 68 ? 1900 : 2e3); | |
break; | |
case "YYYY": | |
case "YYYYY": | |
i[0] = ~~t; | |
break; | |
case "a": | |
case "A": | |
n._isPm = m(n._l).isPM(t); | |
break; | |
case "H": | |
case "HH": | |
case "h": | |
case "hh": | |
i[3] = ~~t; | |
break; | |
case "m": | |
case "mm": | |
i[4] = ~~t; | |
break; | |
case "s": | |
case "ss": | |
i[5] = ~~t; | |
break; | |
case "S": | |
case "SS": | |
case "SSS": | |
i[6] = ~~(1e3 * ("0." + t)); | |
break; | |
case "X": | |
n._d = new Date(1e3 * parseFloat(t)); | |
break; | |
case "Z": | |
case "ZZ": | |
n._useUTC = !0, n._tzm = _(t); | |
} | |
null == t && (n._isValid = !1); | |
} | |
function E(e) { | |
var t, n, r, i = []; | |
if (!e._d) { | |
for (r = S(e), t = 0; 3 > t && null == e._a[t]; ++t) e._a[t] = i[t] = r[t]; | |
for (;7 > t; t++) e._a[t] = i[t] = null == e._a[t] ? 2 === t ? 1 : 0 : e._a[t]; | |
i[3] += ~~((e._tzm || 0) / 60), i[4] += ~~((e._tzm || 0) % 60), n = new Date(0), | |
e._useUTC ? (n.setUTCFullYear(i[0], i[1], i[2]), n.setUTCHours(i[3], i[4], i[5], i[6])) : (n.setFullYear(i[0], i[1], i[2]), | |
n.setHours(i[3], i[4], i[5], i[6])), e._d = n; | |
} | |
} | |
function k(e) { | |
var t = e._i; | |
e._d || (e._a = [ t.years || t.year || t.y, t.months || t.month || t.M, t.days || t.day || t.d, t.hours || t.hour || t.h, t.minutes || t.minute || t.m, t.seconds || t.second || t.s, t.milliseconds || t.millisecond || t.ms ], | |
E(e)); | |
} | |
function S(e) { | |
var t = new Date(); | |
return e._useUTC ? [ t.getUTCFullYear(), t.getUTCMonth(), t.getUTCDate() ] : [ t.getFullYear(), t.getMonth(), t.getDate() ]; | |
} | |
function T(e) { | |
var t, n, r, i = m(e._l), o = "" + e._i; | |
for (r = w(e._f, i).match(z), e._a = [], t = 0; t < r.length; t++) n = (b(r[t], e).exec(o) || [])[0], | |
n && (o = o.slice(o.indexOf(n) + n.length)), pt[r[t]] && x(r[t], n, e); | |
o && (e._il = o), e._isPm && e._a[3] < 12 && (e._a[3] += 12), e._isPm === !1 && 12 === e._a[3] && (e._a[3] = 0), | |
E(e); | |
} | |
function C(e) { | |
var t, n, r, o, a, u = 99; | |
for (o = 0; o < e._f.length; o++) t = s({}, e), t._f = e._f[o], T(t), n = new i(t), | |
a = d(t._a, n.toArray()), n._il && (a += n._il.length), u > a && (u = a, r = n); | |
s(e, r); | |
} | |
function A(e) { | |
var t, n = e._i, r = nt.exec(n); | |
if (r) { | |
for (e._f = "YYYY-MM-DD" + (r[2] || " "), t = 0; 4 > t; t++) if (it[t][1].exec(n)) { | |
e._f += it[t][0]; | |
break; | |
} | |
Z.exec(n) && (e._f += " Z"), T(e); | |
} else e._d = new Date(n); | |
} | |
function D(t) { | |
var n = t._i, r = H.exec(n); | |
n === e ? t._d = new Date() : r ? t._d = new Date(+r[1]) : "string" == typeof n ? A(t) : c(n) ? (t._a = n.slice(0), | |
E(t)) : n instanceof Date ? t._d = new Date(+n) : "object" == typeof n ? k(t) : t._d = new Date(n); | |
} | |
function N(e, t, n, r, i) { | |
return i.relativeTime(t || 1, !!n, e, r); | |
} | |
function O(e, t, n) { | |
var r = q(Math.abs(e) / 1e3), i = q(r / 60), o = q(i / 60), s = q(o / 24), a = q(s / 365), u = 45 > r && [ "s", r ] || 1 === i && [ "m" ] || 45 > i && [ "mm", i ] || 1 === o && [ "h" ] || 22 > o && [ "hh", o ] || 1 === s && [ "d" ] || 25 >= s && [ "dd", s ] || 45 >= s && [ "M" ] || 345 > s && [ "MM", q(s / 30) ] || 1 === a && [ "y" ] || [ "yy", a ]; | |
return u[2] = t, u[3] = e > 0, u[4] = n, N.apply({}, u); | |
} | |
function M(e, t, n) { | |
var r, i = n - t, o = n - e.day(); | |
return o > i && (o -= 7), i - 7 > o && (o += 7), r = $(e).add("d", o), { | |
week: Math.ceil(r.dayOfYear() / 7), | |
year: r.year() | |
}; | |
} | |
function j(e) { | |
var t = e._i, n = e._f; | |
return null === t || "" === t ? null : ("string" == typeof t && (e._i = t = m().preparse(t)), | |
$.isMoment(t) ? (e = s({}, t), e._d = new Date(+t._d)) : n ? c(n) ? C(e) : T(e) : D(e), | |
new i(e)); | |
} | |
function I(e, t) { | |
$.fn[e] = $.fn[e + "s"] = function(e) { | |
var n = this._isUTC ? "UTC" : ""; | |
return null != e ? (this._d["set" + n + t](e), $.updateOffset(this), this) : this._d["get" + n + t](); | |
}; | |
} | |
function P(e) { | |
$.duration.fn[e] = function() { | |
return this._data[e]; | |
}; | |
} | |
function R(e, t) { | |
$.duration.fn["as" + e] = function() { | |
return +this / t; | |
}; | |
} | |
for (var $, L, V = "2.2.1", q = Math.round, U = {}, F = "undefined" != typeof module && module.exports, H = /^\/?Date\((\-?\d+)/i, B = /(\-)?(?:(\d*)\.)?(\d+)\:(\d+)\:(\d+)\.?(\d{3})?/, z = /(\[[^\[]*\])|(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|mm?|ss?|SS?S?|X|zz?|ZZ?|.)/g, Y = /(\[[^\[]*\])|(\\)?(LT|LL?L?L?|l{1,4})/g, W = /\d\d?/, X = /\d{1,3}/, G = /\d{3}/, J = /\d{1,4}/, K = /[+\-]?\d{1,6}/, Q = /[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i, Z = /Z|[\+\-]\d\d:?\d\d/i, et = /T/i, tt = /[\+\-]?\d+(\.\d{1,3})?/, nt = /^\s*\d{4}-\d\d-\d\d((T| )(\d\d(:\d\d(:\d\d(\.\d\d?\d?)?)?)?)?([\+\-]\d\d:?\d\d)?)?/, rt = "YYYY-MM-DDTHH:mm:ssZ", it = [ [ "HH:mm:ss.S", /(T| )\d\d:\d\d:\d\d\.\d{1,3}/ ], [ "HH:mm:ss", /(T| )\d\d:\d\d:\d\d/ ], [ "HH:mm", /(T| )\d\d:\d\d/ ], [ "HH", /(T| )\d\d/ ] ], ot = /([\+\-]|\d\d)/gi, st = "Date|Hours|Minutes|Seconds|Milliseconds".split("|"), at = { | |
Milliseconds: 1, | |
Seconds: 1e3, | |
Minutes: 6e4, | |
Hours: 36e5, | |
Days: 864e5, | |
Months: 2592e6, | |
Years: 31536e6 | |
}, ut = { | |
ms: "millisecond", | |
s: "second", | |
m: "minute", | |
h: "hour", | |
d: "day", | |
w: "week", | |
W: "isoweek", | |
M: "month", | |
y: "year" | |
}, lt = {}, ct = "DDD w W M D d".split(" "), dt = "M D H h m s w W".split(" "), pt = { | |
M: function() { | |
return this.month() + 1; | |
}, | |
MMM: function(e) { | |
return this.lang().monthsShort(this, e); | |
}, | |
MMMM: function(e) { | |
return this.lang().months(this, e); | |
}, | |
D: function() { | |
return this.date(); | |
}, | |
DDD: function() { | |
return this.dayOfYear(); | |
}, | |
d: function() { | |
return this.day(); | |
}, | |
dd: function(e) { | |
return this.lang().weekdaysMin(this, e); | |
}, | |
ddd: function(e) { | |
return this.lang().weekdaysShort(this, e); | |
}, | |
dddd: function(e) { | |
return this.lang().weekdays(this, e); | |
}, | |
w: function() { | |
return this.week(); | |
}, | |
W: function() { | |
return this.isoWeek(); | |
}, | |
YY: function() { | |
return u(this.year() % 100, 2); | |
}, | |
YYYY: function() { | |
return u(this.year(), 4); | |
}, | |
YYYYY: function() { | |
return u(this.year(), 5); | |
}, | |
gg: function() { | |
return u(this.weekYear() % 100, 2); | |
}, | |
gggg: function() { | |
return this.weekYear(); | |
}, | |
ggggg: function() { | |
return u(this.weekYear(), 5); | |
}, | |
GG: function() { | |
return u(this.isoWeekYear() % 100, 2); | |
}, | |
GGGG: function() { | |
return this.isoWeekYear(); | |
}, | |
GGGGG: function() { | |
return u(this.isoWeekYear(), 5); | |
}, | |
e: function() { | |
return this.weekday(); | |
}, | |
E: function() { | |
return this.isoWeekday(); | |
}, | |
a: function() { | |
return this.lang().meridiem(this.hours(), this.minutes(), !0); | |
}, | |
A: function() { | |
return this.lang().meridiem(this.hours(), this.minutes(), !1); | |
}, | |
H: function() { | |
return this.hours(); | |
}, | |
h: function() { | |
return this.hours() % 12 || 12; | |
}, | |
m: function() { | |
return this.minutes(); | |
}, | |
s: function() { | |
return this.seconds(); | |
}, | |
S: function() { | |
return ~~(this.milliseconds() / 100); | |
}, | |
SS: function() { | |
return u(~~(this.milliseconds() / 10), 2); | |
}, | |
SSS: function() { | |
return u(this.milliseconds(), 3); | |
}, | |
Z: function() { | |
var e = -this.zone(), t = "+"; | |
return 0 > e && (e = -e, t = "-"), t + u(~~(e / 60), 2) + ":" + u(~~e % 60, 2); | |
}, | |
ZZ: function() { | |
var e = -this.zone(), t = "+"; | |
return 0 > e && (e = -e, t = "-"), t + u(~~(10 * e / 6), 4); | |
}, | |
z: function() { | |
return this.zoneAbbr(); | |
}, | |
zz: function() { | |
return this.zoneName(); | |
}, | |
X: function() { | |
return this.unix(); | |
} | |
}; ct.length; ) L = ct.pop(), pt[L + "o"] = n(pt[L], L); | |
for (;dt.length; ) L = dt.pop(), pt[L + L] = t(pt[L], 2); | |
for (pt.DDDD = t(pt.DDD, 3), s(r.prototype, { | |
set: function(e) { | |
var t, n; | |
for (n in e) t = e[n], "function" == typeof t ? this[n] = t : this["_" + n] = t; | |
}, | |
_months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), | |
months: function(e) { | |
return this._months[e.month()]; | |
}, | |
_monthsShort: "Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"), | |
monthsShort: function(e) { | |
return this._monthsShort[e.month()]; | |
}, | |
monthsParse: function(e) { | |
var t, n, r; | |
for (this._monthsParse || (this._monthsParse = []), t = 0; 12 > t; t++) if (this._monthsParse[t] || (n = $.utc([ 2e3, t ]), | |
r = "^" + this.months(n, "") + "|^" + this.monthsShort(n, ""), this._monthsParse[t] = new RegExp(r.replace(".", ""), "i")), | |
this._monthsParse[t].test(e)) return t; | |
}, | |
_weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), | |
weekdays: function(e) { | |
return this._weekdays[e.day()]; | |
}, | |
_weekdaysShort: "Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"), | |
weekdaysShort: function(e) { | |
return this._weekdaysShort[e.day()]; | |
}, | |
_weekdaysMin: "Su_Mo_Tu_We_Th_Fr_Sa".split("_"), | |
weekdaysMin: function(e) { | |
return this._weekdaysMin[e.day()]; | |
}, | |
weekdaysParse: function(e) { | |
var t, n, r; | |
for (this._weekdaysParse || (this._weekdaysParse = []), t = 0; 7 > t; t++) if (this._weekdaysParse[t] || (n = $([ 2e3, 1 ]).day(t), | |
r = "^" + this.weekdays(n, "") + "|^" + this.weekdaysShort(n, "") + "|^" + this.weekdaysMin(n, ""), | |
this._weekdaysParse[t] = new RegExp(r.replace(".", ""), "i")), this._weekdaysParse[t].test(e)) return t; | |
}, | |
_longDateFormat: { | |
LT: "h:mm A", | |
L: "MM/DD/YYYY", | |
LL: "MMMM D YYYY", | |
LLL: "MMMM D YYYY LT", | |
LLLL: "dddd, MMMM D YYYY LT" | |
}, | |
longDateFormat: function(e) { | |
var t = this._longDateFormat[e]; | |
return !t && this._longDateFormat[e.toUpperCase()] && (t = this._longDateFormat[e.toUpperCase()].replace(/MMMM|MM|DD|dddd/g, function(e) { | |
return e.slice(1); | |
}), this._longDateFormat[e] = t), t; | |
}, | |
isPM: function(e) { | |
return "p" === (e + "").toLowerCase().charAt(0); | |
}, | |
_meridiemParse: /[ap]\.?m?\.?/i, | |
meridiem: function(e, t, n) { | |
return e > 11 ? n ? "pm" : "PM" : n ? "am" : "AM"; | |
}, | |
_calendar: { | |
sameDay: "[Today at] LT", | |
nextDay: "[Tomorrow at] LT", | |
nextWeek: "dddd [at] LT", | |
lastDay: "[Yesterday at] LT", | |
lastWeek: "[Last] dddd [at] LT", | |
sameElse: "L" | |
}, | |
calendar: function(e, t) { | |
var n = this._calendar[e]; | |
return "function" == typeof n ? n.apply(t) : n; | |
}, | |
_relativeTime: { | |
future: "in %s", | |
past: "%s ago", | |
s: "a few seconds", | |
m: "a minute", | |
mm: "%d minutes", | |
h: "an hour", | |
hh: "%d hours", | |
d: "a day", | |
dd: "%d days", | |
M: "a month", | |
MM: "%d months", | |
y: "a year", | |
yy: "%d years" | |
}, | |
relativeTime: function(e, t, n, r) { | |
var i = this._relativeTime[n]; | |
return "function" == typeof i ? i(e, t, n, r) : i.replace(/%d/i, e); | |
}, | |
pastFuture: function(e, t) { | |
var n = this._relativeTime[e > 0 ? "future" : "past"]; | |
return "function" == typeof n ? n(t) : n.replace(/%s/i, t); | |
}, | |
ordinal: function(e) { | |
return this._ordinal.replace("%d", e); | |
}, | |
_ordinal: "%d", | |
preparse: function(e) { | |
return e; | |
}, | |
postformat: function(e) { | |
return e; | |
}, | |
week: function(e) { | |
return M(e, this._week.dow, this._week.doy).week; | |
}, | |
_week: { | |
dow: 0, | |
doy: 6 | |
} | |
}), $ = function(e, t, n) { | |
return j({ | |
_i: e, | |
_f: t, | |
_l: n, | |
_isUTC: !1 | |
}); | |
}, $.utc = function(e, t, n) { | |
return j({ | |
_useUTC: !0, | |
_isUTC: !0, | |
_l: n, | |
_i: e, | |
_f: t | |
}).utc(); | |
}, $.unix = function(e) { | |
return $(1e3 * e); | |
}, $.duration = function(e, t) { | |
var n, r, i = $.isDuration(e), s = "number" == typeof e, a = i ? e._input : s ? {} : e, u = B.exec(e); | |
return s ? t ? a[t] = e : a.milliseconds = e : u && (n = "-" === u[1] ? -1 : 1, | |
a = { | |
y: 0, | |
d: ~~u[2] * n, | |
h: ~~u[3] * n, | |
m: ~~u[4] * n, | |
s: ~~u[5] * n, | |
ms: ~~u[6] * n | |
}), r = new o(a), i && e.hasOwnProperty("_lang") && (r._lang = e._lang), r; | |
}, $.version = V, $.defaultFormat = rt, $.updateOffset = function() {}, $.lang = function(e, t) { | |
return e ? (e = e.toLowerCase(), e = e.replace("_", "-"), t ? h(e, t) : null === t ? (f(e), | |
e = "en") : U[e] || m(e), $.duration.fn._lang = $.fn._lang = m(e), void 0) : $.fn._lang._abbr; | |
}, $.langData = function(e) { | |
return e && e._lang && e._lang._abbr && (e = e._lang._abbr), m(e); | |
}, $.isMoment = function(e) { | |
return e instanceof i; | |
}, $.isDuration = function(e) { | |
return e instanceof o; | |
}, s($.fn = i.prototype, { | |
clone: function() { | |
return $(this); | |
}, | |
valueOf: function() { | |
return +this._d + 6e4 * (this._offset || 0); | |
}, | |
unix: function() { | |
return Math.floor(+this / 1e3); | |
}, | |
toString: function() { | |
return this.format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ"); | |
}, | |
toDate: function() { | |
return this._offset ? new Date(+this) : this._d; | |
}, | |
toISOString: function() { | |
return y($(this).utc(), "YYYY-MM-DD[T]HH:mm:ss.SSS[Z]"); | |
}, | |
toArray: function() { | |
var e = this; | |
return [ e.year(), e.month(), e.date(), e.hours(), e.minutes(), e.seconds(), e.milliseconds() ]; | |
}, | |
isValid: function() { | |
return null == this._isValid && (this._isValid = this._a ? !d(this._a, (this._isUTC ? $.utc(this._a) : $(this._a)).toArray()) : !isNaN(this._d.getTime())), | |
!!this._isValid; | |
}, | |
invalidAt: function() { | |
var e, t = this._a, n = (this._isUTC ? $.utc(this._a) : $(this._a)).toArray(); | |
for (e = 6; e >= 0 && t[e] === n[e]; --e) ; | |
return e; | |
}, | |
utc: function() { | |
return this.zone(0); | |
}, | |
local: function() { | |
return this.zone(0), this._isUTC = !1, this; | |
}, | |
format: function(e) { | |
var t = y(this, e || $.defaultFormat); | |
return this.lang().postformat(t); | |
}, | |
add: function(e, t) { | |
var n; | |
return n = "string" == typeof e ? $.duration(+t, e) : $.duration(e, t), l(this, n, 1), | |
this; | |
}, | |
subtract: function(e, t) { | |
var n; | |
return n = "string" == typeof e ? $.duration(+t, e) : $.duration(e, t), l(this, n, -1), | |
this; | |
}, | |
diff: function(e, t, n) { | |
var r, i, o = this._isUTC ? $(e).zone(this._offset || 0) : $(e).local(), s = 6e4 * (this.zone() - o.zone()); | |
return t = p(t), "year" === t || "month" === t ? (r = 432e5 * (this.daysInMonth() + o.daysInMonth()), | |
i = 12 * (this.year() - o.year()) + (this.month() - o.month()), i += (this - $(this).startOf("month") - (o - $(o).startOf("month"))) / r, | |
i -= 6e4 * (this.zone() - $(this).startOf("month").zone() - (o.zone() - $(o).startOf("month").zone())) / r, | |
"year" === t && (i /= 12)) : (r = this - o, i = "second" === t ? r / 1e3 : "minute" === t ? r / 6e4 : "hour" === t ? r / 36e5 : "day" === t ? (r - s) / 864e5 : "week" === t ? (r - s) / 6048e5 : r), | |
n ? i : a(i); | |
}, | |
from: function(e, t) { | |
return $.duration(this.diff(e)).lang(this.lang()._abbr).humanize(!t); | |
}, | |
fromNow: function(e) { | |
return this.from($(), e); | |
}, | |
calendar: function() { | |
var e = this.diff($().zone(this.zone()).startOf("day"), "days", !0), t = -6 > e ? "sameElse" : -1 > e ? "lastWeek" : 0 > e ? "lastDay" : 1 > e ? "sameDay" : 2 > e ? "nextDay" : 7 > e ? "nextWeek" : "sameElse"; | |
return this.format(this.lang().calendar(t, this)); | |
}, | |
isLeapYear: function() { | |
var e = this.year(); | |
return 0 === e % 4 && 0 !== e % 100 || 0 === e % 400; | |
}, | |
isDST: function() { | |
return this.zone() < this.clone().month(0).zone() || this.zone() < this.clone().month(5).zone(); | |
}, | |
day: function(e) { | |
var t = this._isUTC ? this._d.getUTCDay() : this._d.getDay(); | |
return null != e ? "string" == typeof e && (e = this.lang().weekdaysParse(e), "number" != typeof e) ? this : this.add({ | |
d: e - t | |
}) : t; | |
}, | |
month: function(e) { | |
var t, n = this._isUTC ? "UTC" : ""; | |
return null != e ? "string" == typeof e && (e = this.lang().monthsParse(e), "number" != typeof e) ? this : (t = this.date(), | |
this.date(1), this._d["set" + n + "Month"](e), this.date(Math.min(t, this.daysInMonth())), | |
$.updateOffset(this), this) : this._d["get" + n + "Month"](); | |
}, | |
startOf: function(e) { | |
switch (e = p(e)) { | |
case "year": | |
this.month(0); | |
case "month": | |
this.date(1); | |
case "week": | |
case "isoweek": | |
case "day": | |
this.hours(0); | |
case "hour": | |
this.minutes(0); | |
case "minute": | |
this.seconds(0); | |
case "second": | |
this.milliseconds(0); | |
} | |
return "week" === e ? this.weekday(0) : "isoweek" === e && this.isoWeekday(1), this; | |
}, | |
endOf: function(e) { | |
return e = p(e), this.startOf(e).add("isoweek" === e ? "week" : e, 1).subtract("ms", 1); | |
}, | |
isAfter: function(e, t) { | |
return t = "undefined" != typeof t ? t : "millisecond", +this.clone().startOf(t) > +$(e).startOf(t); | |
}, | |
isBefore: function(e, t) { | |
return t = "undefined" != typeof t ? t : "millisecond", +this.clone().startOf(t) < +$(e).startOf(t); | |
}, | |
isSame: function(e, t) { | |
return t = "undefined" != typeof t ? t : "millisecond", +this.clone().startOf(t) === +$(e).startOf(t); | |
}, | |
min: function(e) { | |
return e = $.apply(null, arguments), this > e ? this : e; | |
}, | |
max: function(e) { | |
return e = $.apply(null, arguments), e > this ? this : e; | |
}, | |
zone: function(e) { | |
var t = this._offset || 0; | |
return null == e ? this._isUTC ? t : this._d.getTimezoneOffset() : ("string" == typeof e && (e = _(e)), | |
Math.abs(e) < 16 && (e = 60 * e), this._offset = e, this._isUTC = !0, t !== e && l(this, $.duration(t - e, "m"), 1, !0), | |
this); | |
}, | |
zoneAbbr: function() { | |
return this._isUTC ? "UTC" : ""; | |
}, | |
zoneName: function() { | |
return this._isUTC ? "Coordinated Universal Time" : ""; | |
}, | |
hasAlignedHourOffset: function(e) { | |
return e = e ? $(e).zone() : 0, 0 === (this.zone() - e) % 60; | |
}, | |
daysInMonth: function() { | |
return $.utc([ this.year(), this.month() + 1, 0 ]).date(); | |
}, | |
dayOfYear: function(e) { | |
var t = q(($(this).startOf("day") - $(this).startOf("year")) / 864e5) + 1; | |
return null == e ? t : this.add("d", e - t); | |
}, | |
weekYear: function(e) { | |
var t = M(this, this.lang()._week.dow, this.lang()._week.doy).year; | |
return null == e ? t : this.add("y", e - t); | |
}, | |
isoWeekYear: function(e) { | |
var t = M(this, 1, 4).year; | |
return null == e ? t : this.add("y", e - t); | |
}, | |
week: function(e) { | |
var t = this.lang().week(this); | |
return null == e ? t : this.add("d", 7 * (e - t)); | |
}, | |
isoWeek: function(e) { | |
var t = M(this, 1, 4).week; | |
return null == e ? t : this.add("d", 7 * (e - t)); | |
}, | |
weekday: function(e) { | |
var t = (this._d.getDay() + 7 - this.lang()._week.dow) % 7; | |
return null == e ? t : this.add("d", e - t); | |
}, | |
isoWeekday: function(e) { | |
return null == e ? this.day() || 7 : this.day(this.day() % 7 ? e : e - 7); | |
}, | |
get: function(e) { | |
return e = p(e), this[e.toLowerCase()](); | |
}, | |
set: function(e, t) { | |
e = p(e), this[e.toLowerCase()](t); | |
}, | |
lang: function(t) { | |
return t === e ? this._lang : (this._lang = m(t), this); | |
} | |
}), L = 0; L < st.length; L++) I(st[L].toLowerCase().replace(/s$/, ""), st[L]); | |
I("year", "FullYear"), $.fn.days = $.fn.day, $.fn.months = $.fn.month, $.fn.weeks = $.fn.week, | |
$.fn.isoWeeks = $.fn.isoWeek, $.fn.toJSON = $.fn.toISOString, s($.duration.fn = o.prototype, { | |
_bubble: function() { | |
var e, t, n, r, i = this._milliseconds, o = this._days, s = this._months, u = this._data; | |
u.milliseconds = i % 1e3, e = a(i / 1e3), u.seconds = e % 60, t = a(e / 60), u.minutes = t % 60, | |
n = a(t / 60), u.hours = n % 24, o += a(n / 24), u.days = o % 30, s += a(o / 30), | |
u.months = s % 12, r = a(s / 12), u.years = r; | |
}, | |
weeks: function() { | |
return a(this.days() / 7); | |
}, | |
valueOf: function() { | |
return this._milliseconds + 864e5 * this._days + 2592e6 * (this._months % 12) + 31536e6 * ~~(this._months / 12); | |
}, | |
humanize: function(e) { | |
var t = +this, n = O(t, !e, this.lang()); | |
return e && (n = this.lang().pastFuture(t, n)), this.lang().postformat(n); | |
}, | |
add: function(e, t) { | |
var n = $.duration(e, t); | |
return this._milliseconds += n._milliseconds, this._days += n._days, this._months += n._months, | |
this._bubble(), this; | |
}, | |
subtract: function(e, t) { | |
var n = $.duration(e, t); | |
return this._milliseconds -= n._milliseconds, this._days -= n._days, this._months -= n._months, | |
this._bubble(), this; | |
}, | |
get: function(e) { | |
return e = p(e), this[e.toLowerCase() + "s"](); | |
}, | |
as: function(e) { | |
return e = p(e), this["as" + e.charAt(0).toUpperCase() + e.slice(1) + "s"](); | |
}, | |
lang: $.fn.lang | |
}); | |
for (L in at) at.hasOwnProperty(L) && (R(L, at[L]), P(L.toLowerCase())); | |
R("Weeks", 6048e5), $.duration.fn.asMonths = function() { | |
return (+this - 31536e6 * this.years()) / 2592e6 + 12 * this.years(); | |
}, $.lang("en", { | |
ordinal: function(e) { | |
var t = e % 10, n = 1 === ~~(e % 100 / 10) ? "th" : 1 === t ? "st" : 2 === t ? "nd" : 3 === t ? "rd" : "th"; | |
return e + n; | |
} | |
}), F && (module.exports = $), "undefined" == typeof ender && (this.moment = $), | |
"function" == typeof define && define.amd && define("moment", [], function() { | |
return $; | |
}); | |
}.call(this), function() { | |
var e = {}.hasOwnProperty, t = function(t, n) { | |
function r() { | |
this.constructor = t; | |
} | |
for (var i in n) e.call(n, i) && (t[i] = n[i]); | |
return r.prototype = n.prototype, t.prototype = new r(), t.__super__ = n.prototype, | |
t; | |
}; | |
define("models/edition.model", [ "require", "exports", "module", "underscore", "utils/when-ajax", "models/storable.model", "when", "utils/local-kvs", "utils/arraybuffer-helpers", "models/section.model", "models/article.model", "models/image.model", "models/slideshow.model", "models/video.model", "collections/sections.coll", "collections/articles.coll", "collections/assets.coll", "collections/images.coll", "collections/slideshows.coll", "collections/videos.coll", "models/article.model", "collections/articles.coll", "assert", "models/www-image.model", "moment", "logger" ], function(e, n, r) { | |
var i, o, s, a, u, l, c, d, p, h, f, m, g, v, y, w, b, _, x, E, k, S, T, C, A, D; | |
return D = e("underscore"), x = e("utils/when-ajax"), y = e("models/storable.model"), | |
_ = e("when"), h = e("utils/local-kvs"), i = e("utils/arraybuffer-helpers"), f = e("models/section.model"), | |
o = e("models/article.model"), d = e("models/image.model"), g = e("models/slideshow.model"), | |
w = e("models/video.model"), m = e("collections/sections.coll"), u = e("collections/articles.coll"), | |
l = e("collections/assets.coll"), p = e("collections/images.coll"), v = e("collections/slideshows.coll"), | |
b = e("collections/videos.coll"), a = e("models/article.model"), s = e("collections/articles.coll"), | |
k = e("assert"), E = e("models/www-image.model"), C = e("moment"), T = e("logger"), | |
S = new h("edition_structure"), A = null, r.exports = c = function(e) { | |
function n() { | |
n.__super__.constructor.apply(this, arguments), this.assetsById = {}, this.articlesById = {}, | |
this.articlesBySectionAndSlug = {}; | |
} | |
return t(n, e), n.prototype._store = S, n.prototype.defaults = function() { | |
return { | |
year: null, | |
month: null, | |
day: null, | |
region: null, | |
sections: null, | |
date: null, | |
friendlyDate: null, | |
dayOfWeek: null, | |
simpleDate: null, | |
fpImageUrl: null, | |
route: null | |
}; | |
}, n.sugarAttributes({ | |
collections: { | |
sections: "section" | |
} | |
}), n.prototype.getDate = function() { | |
var e, t, n, r, i, o; | |
return r = /(\d{4}).(\d{2}).(\d{2})/, o = this.get("date").match(r), e = o[0], i = o[1], | |
n = o[2], t = o[3], new Date(i, n - 1, t); | |
}, n.prototype.getFirstArticle = function() { | |
return this.sections.first().articles.first(); | |
}, n.prototype.getNextArticleColl = function(e) { | |
var t, n, r, i, o, a; | |
if (k(e instanceof s, "Expected an `articleColl` to be passed in"), n = this.sections.last().articles, | |
n === e) return null; | |
for (t = !1, a = this.sections.toArray(), i = 0, o = a.length; o > i; i++) if (r = a[i], | |
r.articles === e) t = !0; else if (t) return r.articles; | |
return null; | |
}, n.prototype.hasNextArticleColl = function(e) { | |
return null !== this.getNextArticleColl(e); | |
}, n.prototype.getNextArticle = function(e) { | |
var t, n; | |
return k(e instanceof a, "Expected an `article` to be passed to in"), k(null != e.collection, "Expected `article` to be apart of a collection"), | |
e === e.collection.last() ? (n = this.getNextArticleColl(e.collection), null != n ? n.first() : null) : (t = e.collection.indexOf(e) + 1, | |
e.collection.at(t)); | |
}, n.prototype.getPrevArticleColl = function(e) { | |
var t, n, r, i, o, a; | |
if (k(e instanceof s, "Expected an `articleColl` to be passed in"), t = this.sections.first().articles, | |
t === e) return null; | |
for (n = !1, a = this.sections.toArray().reverse(), i = 0, o = a.length; o > i; i++) if (r = a[i], | |
r.articles === e) n = !0; else if (n) return r.articles; | |
return null; | |
}, n.prototype.hasPrevArticleColl = function(e) { | |
return null !== this.getPrevArticleColl(e); | |
}, n.prototype.getPrevArticle = function(e) { | |
var t, n; | |
return k(e instanceof a, "Expected an `article` to be passed to in"), k(null != e.collection, "Expected `article` to be apart of a collection"), | |
e === e.collection.first() ? (n = this.getPrevArticleColl(e.collection), null != n ? n.last() : null) : (t = e.collection.indexOf(e) - 1, | |
e.collection.at(t)); | |
}, n.prototype.editionUrlBase = function() { | |
if (null == this.year || null == this.month || null == this.day) throw new Error("can't determine API url"); | |
return "/data/" + this.year + "/" + ("0" + this.month).substr(-2) + "/" + ("0" + this.day).substr(-2); | |
}, n.prototype.storeEdition = function() { | |
var e, t = this; | |
return null != this._storeEditionDebounced ? this._storeEditionDebounced : this._storeEditionDebounced = (e = A = D.uniqueId(), | |
_(function() { | |
return t.store(); | |
}()).then(function() { | |
return e === A ? S.keys().then(function(e) { | |
var n; | |
return console.log("editions in store", e), e.length > 1 ? (T.debug("storeEdition: nuking other editions and all data..."), | |
_.join(_.all(function() { | |
var t, r, i; | |
for (i = [], t = 0, r = e.length; r > t; t++) n = e[t], n !== this.id && i.push(S["delete"](n)); | |
return i; | |
}.call(t)), new h("article_body").nuke(), new h("image_data").nuke(), new h("video_poster_image_data").nuke(), new h("www_image").nuke())) : void 0; | |
}) : void 0; | |
}).then(function() { | |
return e === A ? (T.debug("storeEdition: fetching..."), _(function() { | |
return t.fetch(); | |
}()).then(function() { | |
var n; | |
if (e === A) return n = [], t.sections.at(0).articles.each(function(e) { | |
return n.push(e); | |
}), o.storeBatch({}, n); | |
}).ensure(function() { | |
var n; | |
if (e === A) return n = [], t.sections.each(function(e, t) { | |
return 0 !== t ? e.articles.each(function(e) { | |
return n.push(e); | |
}) : void 0; | |
}), o.storeBatch({}, n); | |
}).ensure(function() { | |
var n; | |
if (e === A) return n = [], t.sections.each(function(e, t) { | |
return 0 !== t ? e.articles.each(function(e, t) { | |
return 2 > t ? void 0 : n.push(e); | |
}) : void 0; | |
}), o.storeBatch({}, n); | |
}).ensure(function() { | |
var n, r, i, o; | |
return n = [], t.sections.each(function(e) { | |
return e.articles.each(function(e) { | |
return null != e.spanImage ? n.push(e.spanImage) : void 0; | |
}); | |
}), o = Math.floor(n.length / 2), r = n.slice(0, o), i = n.slice(o, n.length), _.join(r.reduce(function(t, n) { | |
return t.ensure(function() { | |
return e === A ? n.store() : void 0; | |
}); | |
}, _(null)), i.reduce(function(t, n) { | |
return t.ensure(function() { | |
return e === A ? n.store() : void 0; | |
}); | |
}, _(null))); | |
}).then(function() { | |
return t; | |
})) : void 0; | |
})).ensure(function() { | |
return t._storeEditionDebounced = void 0; | |
}); | |
}, n.prototype._getAjaxData = function() { | |
return x("" + this.editionUrlBase() + "/structure", { | |
dataType: "text" | |
}); | |
}, n.prototype._setModel = function(e, t) { | |
var n = this; | |
return _(function() { | |
var r; | |
return r = JSON.parse(e), n.set(n.parse(r, t), t) ? n.trigger("sync", n, r, t) : !1; | |
}()); | |
}, n.prototype._unsetModel = function() { | |
return this.unset("sections", { | |
silent: !0 | |
}), this.articlesBySectionAndSlug = {}, this.articlesById = {}, this.assetsById = {}, | |
this.arts = []; | |
}, n.prototype.parse = function(e) { | |
var t, n, r, i, o, s, a, c, p, h, f, v, y, b, _, x, k, S, T, A, D, N, O, M, j, I, P, R, $, L = this; | |
for (e.route = "" + new Date(Date.UTC(e.year, e.month - 1, e.day)).toISOString().replace(/T.*$/, "").replace(/-/g, "/"), | |
console.log("route: " + e.route), i = C([ e.year, e.month - 1, e.day ]), e.friendlyDate = i.format("dddd, MMMM D, YYYY"), | |
e.dayOfWeek = i.format("dddd"), e.simpleDate = i.format("MMMM D, YYYY"), this.articlesById = {}, | |
this.articlesBySectionAndSlug = {}, this.assetsById = {}, N = null != (D = e.assets) ? D : [], | |
f = 0, _ = N.length; _ > f; f++) switch (n = N[f], n.edition = this, n.type) { | |
case "image": | |
this.assetsById[n.id] = new d(n); | |
break; | |
case "video": | |
this.assetsById[n.id] = new w(n); | |
break; | |
case "slideshow": | |
for (c = [], O = n.slides, v = 0, x = O.length; x > v; v++) a = O[v], a.edition = this, | |
p = new d(a), c.push(p), h = a.wwwUrl; | |
n.thumbIndex > -1 && (n.thumbImage = c[n.thumbIndex], this.assetsById[n.thumbImage.get("id")] = n.thumbImage), | |
n.slideImages = c, this.assetsById[n.id] = new g(n); | |
} | |
for (j = null != (M = e.sections) ? M : [], y = 0, k = j.length; k > y; y++) { | |
for (s = j[y], s.edition = this, s.route = "" + e.route + "/" + s.internalName, | |
s.thumb = new E({ | |
id: "section-thumb:" + this.id + "-" + s.internalName, | |
wwwUrl: s.thumbWwwUrl, | |
aspectRatio: 512 / 380 | |
}), P = null != (I = s.articles) ? I : [], b = 0, S = P.length; S > b; b++) { | |
for (t = P[b], t.edition = this, t.route = "" + s.route + "/" + t.slug, t.sectionName = s.friendlyName, | |
t.sectionId = s.internalName, o = [], $ = null != (R = t.relatedAssetIds) ? R : [], | |
A = 0, T = $.length; T > A; A++) r = $[A], o.push(this.assetsById[r]); | |
t.relatedAssets = new l(o), t.spanImage = this.assetsById[t.spanImageId], delete t.relatedAssetIds, | |
delete t.spanImageId; | |
} | |
s.articles = new u(s.articles), s.articles.each(function(e) { | |
return L.articlesById[e.id] = e, L.articlesBySectionAndSlug["" + s.internalName + "/" + e.slug] = e; | |
}); | |
} | |
return e.sections = new m(e.sections), delete e.assets, e; | |
}, n.get = function(e, t, n, r) { | |
var i, o; | |
return null == r && (r = "us"), i = new Date(Date.UTC(e, t - 1, n)).toISOString().replace(/T.*$/, ""), | |
o = "" + i + "." + r, new this({ | |
year: e, | |
month: t, | |
day: n, | |
id: o, | |
date: i | |
}); | |
}, n.getStoredKeys = function() { | |
return _(function() { | |
return S.keys(); | |
}()); | |
}, n.abortInProgressStore = function() { | |
return A = null; | |
}, n; | |
}(y); | |
}); | |
}.call(this), function() { | |
var e = {}.hasOwnProperty, t = function(t, n) { | |
function r() { | |
this.constructor = t; | |
} | |
for (var i in n) e.call(n, i) && (t[i] = n[i]); | |
return r.prototype = n.prototype, t.prototype = new r(), t.__super__ = n.prototype, | |
t; | |
}; | |
define("views/layout.view", [ "require", "exports", "module", "views/base.view", "common/lifecycle.mixin" ], function(e, n, r) { | |
var i, o, s, a; | |
return i = e("views/base.view"), s = e("common/lifecycle.mixin"), o = function(e) { | |
function n() { | |
return a = n.__super__.constructor.apply(this, arguments); | |
} | |
return t(n, e), n; | |
}(i), s.extend(o.prototype, [ "show", "hide" ]), r.exports = o; | |
}); | |
}.call(this), define("text!core-app/tmpl/layout.html", [], function() { | |
return '<!-- created by view: div id="edition-layout" -->\n <div id="toolbar">\n <h1>The New York Times</h1>\n <div id="edition-selector-button" data-el="edition-selector-button"></div>\n <div class="settings"></div>\n </div>\n\n <div id="accordion-container">\n <div id="accordion-scroller">\n <div id="accordion" data-el="accordion"></div>\n </div>\n </div>\n\n <div id="content">\n <div id="article-river" data-el="article-river"></div>\n </div>\n<!-- /div -->\n'; | |
}), function(e, t) { | |
function n() { | |
r.READY || (r.event.determineEventTypes(), r.utils.each(r.gestures, function(e) { | |
r.detection.register(e); | |
}), r.event.onTouch(r.DOCUMENT, r.EVENT_MOVE, r.detection.detect), r.event.onTouch(r.DOCUMENT, r.EVENT_END, r.detection.detect), | |
r.READY = !0); | |
} | |
var r = function(e, t) { | |
return new r.Instance(e, t || {}); | |
}; | |
r.defaults = { | |
stop_browser_behavior: { | |
userSelect: "none", | |
touchAction: "none", | |
touchCallout: "none", | |
contentZooming: "none", | |
userDrag: "none", | |
tapHighlightColor: "rgba(0,0,0,0)" | |
} | |
}, r.HAS_POINTEREVENTS = e.navigator.pointerEnabled || e.navigator.msPointerEnabled, | |
r.HAS_TOUCHEVENTS = "ontouchstart" in e, r.MOBILE_REGEX = /mobile|tablet|ip(ad|hone|od)|android|silk/i, | |
r.NO_MOUSEEVENTS = r.HAS_TOUCHEVENTS && e.navigator.userAgent.match(r.MOBILE_REGEX), | |
r.EVENT_TYPES = {}, r.DIRECTION_DOWN = "down", r.DIRECTION_LEFT = "left", r.DIRECTION_UP = "up", | |
r.DIRECTION_RIGHT = "right", r.POINTER_MOUSE = "mouse", r.POINTER_TOUCH = "touch", | |
r.POINTER_PEN = "pen", r.EVENT_START = "start", r.EVENT_MOVE = "move", r.EVENT_END = "end", | |
r.DOCUMENT = e.document, r.plugins = r.plugins || {}, r.gestures = r.gestures || {}, | |
r.READY = !1, r.utils = { | |
extend: function(e, n, r) { | |
for (var i in n) e[i] !== t && r || (e[i] = n[i]); | |
return e; | |
}, | |
each: function(e, n, r) { | |
if ("forEach" in e) e.forEach(n, r); else if (e.length != t) { | |
for (var i = 0, o = e.length; o > i; i++) if (n.call(r, e[i], i, e) === !1) return; | |
} else for (var i in e) if (e.hasOwnProperty(i) && n.call(r, e[i], i, e) === !1) return; | |
}, | |
hasParent: function(e, t) { | |
for (;e; ) { | |
if (e == t) return !0; | |
e = e.parentNode; | |
} | |
return !1; | |
}, | |
getCenter: function(e) { | |
var t = [], n = []; | |
return r.utils.each(e, function(e) { | |
t.push("undefined" != typeof e.clientX ? e.clientX : e.pageX), n.push("undefined" != typeof e.clientY ? e.clientY : e.pageY); | |
}), { | |
pageX: (Math.min.apply(Math, t) + Math.max.apply(Math, t)) / 2, | |
pageY: (Math.min.apply(Math, n) + Math.max.apply(Math, n)) / 2 | |
}; | |
}, | |
getVelocity: function(e, t, n) { | |
return { | |
x: Math.abs(t / e) || 0, | |
y: Math.abs(n / e) || 0 | |
}; | |
}, | |
getAngle: function(e, t) { | |
var n = t.pageY - e.pageY, r = t.pageX - e.pageX; | |
return 180 * Math.atan2(n, r) / Math.PI; | |
}, | |
getDirection: function(e, t) { | |
var n = Math.abs(e.pageX - t.pageX), i = Math.abs(e.pageY - t.pageY); | |
return n >= i ? e.pageX - t.pageX > 0 ? r.DIRECTION_LEFT : r.DIRECTION_RIGHT : e.pageY - t.pageY > 0 ? r.DIRECTION_UP : r.DIRECTION_DOWN; | |
}, | |
getDistance: function(e, t) { | |
var n = t.pageX - e.pageX, r = t.pageY - e.pageY; | |
return Math.sqrt(n * n + r * r); | |
}, | |
getScale: function(e, t) { | |
return e.length >= 2 && t.length >= 2 ? this.getDistance(t[0], t[1]) / this.getDistance(e[0], e[1]) : 1; | |
}, | |
getRotation: function(e, t) { | |
return e.length >= 2 && t.length >= 2 ? this.getAngle(t[1], t[0]) - this.getAngle(e[1], e[0]) : 0; | |
}, | |
isVertical: function(e) { | |
return e == r.DIRECTION_UP || e == r.DIRECTION_DOWN; | |
}, | |
stopDefaultBrowserBehavior: function(e, t) { | |
var n = [ "webkit", "khtml", "moz", "Moz", "ms", "o", "" ]; | |
t && e && e.style && (r.utils.each(n, function(i) { | |
r.utils.each(t, function(t) { | |
i && (t = n + t.substring(0, 1).toUpperCase() + t.substring(1)), t in e.style && (e.style[t] = t); | |
}); | |
}), "none" == t.userSelect && (e.onselectstart = function() { | |
return !1; | |
}), "none" == t.userDrag && (e.ondragstart = function() { | |
return !1; | |
})); | |
} | |
}, r.Instance = function(e, t) { | |
var i = this; | |
return n(), this.element = e, this.enabled = !0, this.options = r.utils.extend(r.utils.extend({}, r.defaults), t || {}), | |
this.options.stop_browser_behavior && r.utils.stopDefaultBrowserBehavior(this.element, this.options.stop_browser_behavior), | |
r.event.onTouch(e, r.EVENT_START, function(e) { | |
i.enabled && r.detection.startDetect(i, e); | |
}), this; | |
}, r.Instance.prototype = { | |
on: function(e, t) { | |
var n = e.split(" "); | |
return r.utils.each(n, function(e) { | |
this.element.addEventListener(e, t, !1); | |
}, this), this; | |
}, | |
off: function(e, t) { | |
var n = e.split(" "); | |
return r.utils.each(n, function(e) { | |
this.element.removeEventListener(e, t, !1); | |
}, this), this; | |
}, | |
trigger: function(e, t) { | |
t || (t = {}); | |
var n = r.DOCUMENT.createEvent("Event"); | |
n.initEvent(e, !0, !0), n.gesture = t; | |
var i = this.element; | |
return r.utils.hasParent(t.target, i) && (i = t.target), i.dispatchEvent(n), this; | |
}, | |
enable: function(e) { | |
return this.enabled = e, this; | |
} | |
}; | |
var i = null, o = !1, s = !1; | |
r.event = { | |
bindDom: function(e, t, n) { | |
var i = t.split(" "); | |
r.utils.each(i, function(t) { | |
e.addEventListener(t, n, !1); | |
}); | |
}, | |
onTouch: function(e, t, n) { | |
var a = this; | |
this.bindDom(e, r.EVENT_TYPES[t], function(u) { | |
var l = u.type.toLowerCase(); | |
if (!l.match(/mouse/) || !s) { | |
l.match(/touch/) || l.match(/pointerdown/) || l.match(/mouse/) && 1 === u.which ? o = !0 : l.match(/mouse/) && !u.which && (o = !1), | |
l.match(/touch|pointer/) && (s = !0); | |
var c = 0; | |
o && (r.HAS_POINTEREVENTS && t != r.EVENT_END ? c = r.PointerEvent.updatePointer(t, u) : l.match(/touch/) ? c = u.touches.length : s || (c = l.match(/up/) ? 0 : 1), | |
c > 0 && t == r.EVENT_END ? t = r.EVENT_MOVE : c || (t = r.EVENT_END), (c || null === i) && (i = u), | |
n.call(r.detection, a.collectEventData(e, t, a.getTouchList(i, t), u)), r.HAS_POINTEREVENTS && t == r.EVENT_END && (c = r.PointerEvent.updatePointer(t, u))), | |
c || (i = null, o = !1, s = !1, r.PointerEvent.reset()); | |
} | |
}); | |
}, | |
determineEventTypes: function() { | |
var e; | |
e = r.HAS_POINTEREVENTS ? r.PointerEvent.getEvents() : r.NO_MOUSEEVENTS ? [ "touchstart", "touchmove", "touchend touchcancel" ] : [ "touchstart mousedown", "touchmove mousemove", "touchend touchcancel mouseup" ], | |
r.EVENT_TYPES[r.EVENT_START] = e[0], r.EVENT_TYPES[r.EVENT_MOVE] = e[1], r.EVENT_TYPES[r.EVENT_END] = e[2]; | |
}, | |
getTouchList: function(e) { | |
return r.HAS_POINTEREVENTS ? r.PointerEvent.getTouchList() : e.touches ? e.touches : (e.indentifier = 1, | |
[ e ]); | |
}, | |
collectEventData: function(e, t, n, i) { | |
var o = r.POINTER_TOUCH; | |
return (i.type.match(/mouse/) || r.PointerEvent.matchType(r.POINTER_MOUSE, i)) && (o = r.POINTER_MOUSE), | |
{ | |
center: r.utils.getCenter(n), | |
timeStamp: new Date().getTime(), | |
target: i.target, | |
touches: n, | |
eventType: t, | |
pointerType: o, | |
srcEvent: i, | |
preventDefault: function() { | |
this.srcEvent.preventManipulation && this.srcEvent.preventManipulation(), this.srcEvent.preventDefault && this.srcEvent.preventDefault(); | |
}, | |
stopPropagation: function() { | |
this.srcEvent.stopPropagation(); | |
}, | |
stopDetect: function() { | |
return r.detection.stopDetect(); | |
} | |
}; | |
} | |
}, r.PointerEvent = { | |
pointers: {}, | |
getTouchList: function() { | |
var e = this, t = []; | |
return r.utils.each(e.pointers, function(e) { | |
t.push(e); | |
}), t; | |
}, | |
updatePointer: function(e, t) { | |
return e == r.EVENT_END ? this.pointers = {} : (t.identifier = t.pointerId, this.pointers[t.pointerId] = t), | |
Object.keys(this.pointers).length; | |
}, | |
matchType: function(e, t) { | |
if (!t.pointerType) return !1; | |
var n = t.pointerType, i = {}; | |
return i[r.POINTER_MOUSE] = n === t.MSPOINTER_TYPE_MOUSE || n === r.POINTER_MOUSE, | |
i[r.POINTER_TOUCH] = n === t.MSPOINTER_TYPE_TOUCH || n === r.POINTER_TOUCH, i[r.POINTER_PEN] = n === t.MSPOINTER_TYPE_PEN || n === r.POINTER_PEN, | |
i[e]; | |
}, | |
getEvents: function() { | |
return [ "pointerdown MSPointerDown", "pointermove MSPointerMove", "pointerup pointercancel MSPointerUp MSPointerCancel" ]; | |
}, | |
reset: function() { | |
this.pointers = {}; | |
} | |
}, r.detection = { | |
gestures: [], | |
current: null, | |
previous: null, | |
stopped: !1, | |
startDetect: function(e, t) { | |
this.current || (this.stopped = !1, this.current = { | |
inst: e, | |
startEvent: r.utils.extend({}, t), | |
lastEvent: !1, | |
name: "" | |
}, this.detect(t)); | |
}, | |
detect: function(e) { | |
if (this.current && !this.stopped) { | |
e = this.extendEventData(e); | |
var t = this.current.inst.options; | |
return r.utils.each(this.gestures, function(n) { | |
return this.stopped || t[n.name] === !1 || n.handler.call(n, e, this.current.inst) !== !1 ? void 0 : (this.stopDetect(), | |
!1); | |
}, this), this.current && (this.current.lastEvent = e), e.eventType == r.EVENT_END && !e.touches.length - 1 && this.stopDetect(), | |
e; | |
} | |
}, | |
stopDetect: function() { | |
this.previous = r.utils.extend({}, this.current), this.current = null, this.stopped = !0; | |
}, | |
extendEventData: function(e) { | |
var t = this.current.startEvent; | |
!t || e.touches.length == t.touches.length && e.touches !== t.touches || (t.touches = [], | |
r.utils.each(e.touches, function(e) { | |
t.touches.push(r.utils.extend({}, e)); | |
})); | |
var n, i, o = e.timeStamp - t.timeStamp, s = e.center.pageX - t.center.pageX, a = e.center.pageY - t.center.pageY, u = r.utils.getVelocity(o, s, a); | |
return "end" === e.eventType ? (n = this.current.lastEvent && this.current.lastEvent.interimAngle, | |
i = this.current.lastEvent && this.current.lastEvent.interimDirection) : (n = this.current.lastEvent && r.utils.getAngle(this.current.lastEvent.center, e.center), | |
i = this.current.lastEvent && r.utils.getDirection(this.current.lastEvent.center, e.center)), | |
r.utils.extend(e, { | |
deltaTime: o, | |
deltaX: s, | |
deltaY: a, | |
velocityX: u.x, | |
velocityY: u.y, | |
distance: r.utils.getDistance(t.center, e.center), | |
angle: r.utils.getAngle(t.center, e.center), | |
interimAngle: n, | |
direction: r.utils.getDirection(t.center, e.center), | |
interimDirection: i, | |
scale: r.utils.getScale(t.touches, e.touches), | |
rotation: r.utils.getRotation(t.touches, e.touches), | |
startEvent: t | |
}), e; | |
}, | |
register: function(e) { | |
var n = e.defaults || {}; | |
return n[e.name] === t && (n[e.name] = !0), r.utils.extend(r.defaults, n, !0), e.index = e.index || 1e3, | |
this.gestures.push(e), this.gestures.sort(function(e, t) { | |
return e.index < t.index ? -1 : e.index > t.index ? 1 : 0; | |
}), this.gestures; | |
} | |
}, r.gestures.Drag = { | |
name: "drag", | |
index: 50, | |
defaults: { | |
drag_min_distance: 10, | |
correct_for_drag_min_distance: !0, | |
drag_max_touches: 1, | |
drag_block_horizontal: !1, | |
drag_block_vertical: !1, | |
drag_lock_to_axis: !1, | |
drag_lock_min_distance: 25 | |
}, | |
triggered: !1, | |
handler: function(e, t) { | |
if (r.detection.current.name != this.name && this.triggered) return t.trigger(this.name + "end", e), | |
this.triggered = !1, void 0; | |
if (!(t.options.drag_max_touches > 0 && e.touches.length > t.options.drag_max_touches)) switch (e.eventType) { | |
case r.EVENT_START: | |
this.triggered = !1; | |
break; | |
case r.EVENT_MOVE: | |
if (e.distance < t.options.drag_min_distance && r.detection.current.name != this.name) return; | |
if (r.detection.current.name != this.name && (r.detection.current.name = this.name, | |
t.options.correct_for_drag_min_distance && e.distance > 0)) { | |
var n = Math.abs(t.options.drag_min_distance / e.distance); | |
r.detection.current.startEvent.center.pageX += e.deltaX * n, r.detection.current.startEvent.center.pageY += e.deltaY * n, | |
e = r.detection.extendEventData(e); | |
} | |
(r.detection.current.lastEvent.drag_locked_to_axis || t.options.drag_lock_to_axis && t.options.drag_lock_min_distance <= e.distance) && (e.drag_locked_to_axis = !0); | |
var i = r.detection.current.lastEvent.direction; | |
e.drag_locked_to_axis && i !== e.direction && (e.direction = r.utils.isVertical(i) ? e.deltaY < 0 ? r.DIRECTION_UP : r.DIRECTION_DOWN : e.deltaX < 0 ? r.DIRECTION_LEFT : r.DIRECTION_RIGHT), | |
this.triggered || (t.trigger(this.name + "start", e), this.triggered = !0), t.trigger(this.name, e), | |
t.trigger(this.name + e.direction, e), (t.options.drag_block_vertical && r.utils.isVertical(e.direction) || t.options.drag_block_horizontal && !r.utils.isVertical(e.direction)) && e.preventDefault(); | |
break; | |
case r.EVENT_END: | |
this.triggered && t.trigger(this.name + "end", e), this.triggered = !1; | |
} | |
} | |
}, r.gestures.Hold = { | |
name: "hold", | |
index: 10, | |
defaults: { | |
hold_timeout: 500, | |
hold_threshold: 1 | |
}, | |
timer: null, | |
handler: function(e, t) { | |
switch (e.eventType) { | |
case r.EVENT_START: | |
clearTimeout(this.timer), r.detection.current.name = this.name, this.timer = setTimeout(function() { | |
"hold" == r.detection.current.name && t.trigger("hold", e); | |
}, t.options.hold_timeout); | |
break; | |
case r.EVENT_MOVE: | |
e.distance > t.options.hold_threshold && clearTimeout(this.timer); | |
break; | |
case r.EVENT_END: | |
clearTimeout(this.timer); | |
} | |
} | |
}, r.gestures.Release = { | |
name: "release", | |
index: 1 / 0, | |
handler: function(e, t) { | |
e.eventType == r.EVENT_END && t.trigger(this.name, e); | |
} | |
}, r.gestures.Swipe = { | |
name: "swipe", | |
index: 40, | |
defaults: { | |
swipe_min_touches: 1, | |
swipe_max_touches: 1, | |
swipe_velocity: .7 | |
}, | |
handler: function(e, t) { | |
if (e.eventType == r.EVENT_END) { | |
if (t.options.swipe_max_touches > 0 && e.touches.length < t.options.swipe_min_touches && e.touches.length > t.options.swipe_max_touches) return; | |
(e.velocityX > t.options.swipe_velocity || e.velocityY > t.options.swipe_velocity) && (t.trigger(this.name, e), | |
t.trigger(this.name + e.direction, e)); | |
} | |
} | |
}, r.gestures.Tap = { | |
name: "tap", | |
index: 100, | |
defaults: { | |
tap_max_touchtime: 250, | |
tap_max_distance: 10, | |
tap_always: !0, | |
doubletap_distance: 20, | |
doubletap_interval: 300 | |
}, | |
handler: function(e, t) { | |
if (e.eventType == r.EVENT_END && "touchcancel" != e.srcEvent.type) { | |
var n = r.detection.previous, i = !1; | |
if (e.deltaTime > t.options.tap_max_touchtime || e.distance > t.options.tap_max_distance) return; | |
n && "tap" == n.name && e.timeStamp - n.lastEvent.timeStamp < t.options.doubletap_interval && e.distance < t.options.doubletap_distance && (t.trigger("doubletap", e), | |
i = !0), (!i || t.options.tap_always) && (r.detection.current.name = "tap", t.trigger(r.detection.current.name, e)); | |
} | |
} | |
}, r.gestures.Touch = { | |
name: "touch", | |
index: -1 / 0, | |
defaults: { | |
prevent_default: !1, | |
prevent_mouseevents: !1 | |
}, | |
handler: function(e, t) { | |
return t.options.prevent_mouseevents && e.pointerType == r.POINTER_MOUSE ? (e.stopDetect(), | |
void 0) : (t.options.prevent_default && e.preventDefault(), e.eventType == r.EVENT_START && t.trigger(this.name, e), | |
void 0); | |
} | |
}, r.gestures.Transform = { | |
name: "transform", | |
index: 45, | |
defaults: { | |
transform_min_scale: .01, | |
transform_min_rotation: 1, | |
transform_always_block: !1 | |
}, | |
triggered: !1, | |
handler: function(e, t) { | |
if (r.detection.current.name != this.name && this.triggered) return t.trigger(this.name + "end", e), | |
this.triggered = !1, void 0; | |
if (!(e.touches.length < 2)) switch (t.options.transform_always_block && e.preventDefault(), | |
e.eventType) { | |
case r.EVENT_START: | |
this.triggered = !1; | |
break; | |
case r.EVENT_MOVE: | |
var n = Math.abs(1 - e.scale), i = Math.abs(e.rotation); | |
if (n < t.options.transform_min_scale && i < t.options.transform_min_rotation) return; | |
r.detection.current.name = this.name, this.triggered || (t.trigger(this.name + "start", e), | |
this.triggered = !0), t.trigger(this.name, e), i > t.options.transform_min_rotation && t.trigger("rotate", e), | |
n > t.options.transform_min_scale && (t.trigger("pinch", e), t.trigger("pinch" + (e.scale < 1 ? "in" : "out"), e)); | |
break; | |
case r.EVENT_END: | |
this.triggered && t.trigger(this.name + "end", e), this.triggered = !1; | |
} | |
} | |
}, "function" == typeof define && "object" == typeof define.amd && define.amd ? define("hammer", [], function() { | |
return r; | |
}) : "object" == typeof module && "object" == typeof module.exports ? module.exports = r : e.Hammer = r; | |
}(this), function(e, t) { | |
function n(e, n) { | |
e.event.bindDom = function(e, r, i) { | |
n(e).on(r, function(e) { | |
var n = e.originalEvent || e; | |
n.pageX === t && (n.pageX = e.pageX, n.pageY = e.pageY), n.target || (n.target = e.target), | |
n.which === t && (n.which = n.button), n.preventDefault || (n.preventDefault = e.preventDefault), | |
n.stopPropagation || (n.stopPropagation = e.stopPropagation), i.call(this, n); | |
}); | |
}, e.Instance.prototype.on = function(e, t) { | |
return n(this.element).on(e, t); | |
}, e.Instance.prototype.off = function(e, t) { | |
return n(this.element).off(e, t); | |
}, e.Instance.prototype.trigger = function(e, t) { | |
var r = n(this.element); | |
return r.has(t.target).length && (r = n(t.target)), r.trigger({ | |
type: e, | |
gesture: t | |
}); | |
}, n.fn.hammer = function(t) { | |
return this.each(function() { | |
var r = n(this), i = r.data("hammer"); | |
i ? i && t && e.utils.extend(i.options, t) : r.data("hammer", new e(this, t || {})); | |
}); | |
}; | |
} | |
"function" == typeof define && "object" == typeof define.amd && define.amd ? define("jquery-hammerjs", [ "hammer", "jquery" ], n) : n(e.Hammer, e.jQuery || e.Zepto); | |
}(this), function() { | |
var e = {}.hasOwnProperty, t = function(t, n) { | |
function r() { | |
this.constructor = t; | |
} | |
for (var i in n) e.call(n, i) && (t[i] = n[i]); | |
return r.prototype = n.prototype, t.prototype = new r(), t.__super__ = n.prototype, | |
t; | |
}; | |
define("views/list.view", [ "require", "exports", "module", "views/base.view", "assert", "underscore" ], function(e, n, r) { | |
var i, o, s, a, u, l; | |
return i = e("views/base.view"), s = e("assert"), u = e("underscore"), a = function() { | |
return {}; | |
}, r.exports = o = function(e) { | |
function n() { | |
return l = n.__super__.constructor.apply(this, arguments); | |
} | |
return t(n, e), n.prototype.tagName = "ul", n.prototype.Child = null, n.prototype.autoRenderChildren = !0, | |
n.prototype.initialize = function() { | |
var e = this; | |
return s(null !== this.Child, "Expect a Child to be set on the prototype"), null != this.collection ? this.collection.each(function(t) { | |
return e.listenTo(t, "change reset", e.render); | |
}) : void 0; | |
}, n.prototype.createChildView = function(e) { | |
var t; | |
return t = (null != e ? e : {}).model, new this.Child({ | |
model: t | |
}); | |
}, n.prototype._render = function() { | |
var e, t, n, r, i = this; | |
r = this.model || { | |
toJSON: a | |
}, this.tmpl && (t = this.templify()(r.toJSON()), this.el.innerHTML = t, this.bindUI()), | |
n = document.createDocumentFragment(), null != this.collection && (this.views = this.collection.map(function(e) { | |
var t; | |
return t = i.createChildView({ | |
model: e | |
}), i.autoRenderChildren && t.render(), n.appendChild(t.el), t; | |
})), e = this.$("[data-placeholder]"), 1 === e.length && this.tmpl ? (this.el.insertBefore(n, e[0]), | |
e.remove()) : this.$el.html(n), this.trigger("rendered"); | |
}, n.prototype.last = function() { | |
if (!this.views || !this.views.length) throw logger.debug("No views in list", this), | |
new Error("Cannot get last view because no views are rendered in list"); | |
return u.last(this.views); | |
}, n.prototype.lastHeight = function() { | |
return this.last().$el.outerHeight(); | |
}, n.prototype.first = function() { | |
if (!this.views || !this.views.length) throw logger.debug("No views in list", this), | |
new Error("Cannot get first view because no views are rendered in list"); | |
return u.first(this.views); | |
}, n.prototype.getViewById = function(e) { | |
return u.find(this.views, function(t) { | |
return t.model.id === e; | |
}); | |
}, n.prototype.getViewByModel = function(e) { | |
return u.find(this.views, function(t) { | |
return t.model === e; | |
}); | |
}, n; | |
}(i); | |
}); | |
}.call(this), define("text!edition-app/tmpl/accordion-section.html", [], function() { | |
return '\n<div class="accordion-section-header">\n <div class="accordion-section-header-thumb">\n <div class="accordion-section-header-thumb-img"></div>\n <div class="accordion-section-header-thumb-overlay"></div>\n </div>\n <div class="accordion-section-header-text"><span class=\'title\'><%= friendlyName %></span></div>\n</div>\n<div class=\'accordion-section-holder\'>\n<ol class="accordion-section-articles">\n <%\n // maybe can refactor as a ListView subview\n\n for (i = 0; i < articles.length; i++) {\n article = articles[i];\n\n %>\n <li class="accordion-article-item" data-subview="accordion-article" data-article-id="<%= article.id %>">\n <a href="#<%=article.route %>">\n <div class="accordion-article">\n <% if (article.kicker){ %><div class="kicker"><%=article.kicker %></div><%}%>\n <div class="headline"><%= article.headline %></div>\n </div>\n </a>\n </li>\n <%\n }\n %>\n</ol>\n</div>\n'; | |
}); | |
var LocalyticsSession = function(e, t) { | |
t = t ? t : {}; | |
var n = null == t.namespace ? "" : t.namespace + "_"; | |
return function(r, i) { | |
var o, s, a, u, l, c, d, p, h, f, m, g, v, y, w, b, _, x, E, k, S = 'window.__localytics_callbacks__["' + n + '"]', T = "html5_2.6", C = 64e3, A = [ "open", "close", "tagEvent", "tagScreen", "tagEvent", "upload", "setIdentifier", "setCustomerEmail", "setCustomerId", "setCustomerName" ], D = 30, N = 1e4, O = 3e4, M = !1, j = 1e5, I = {}, P = "__ll_" + n + "iu", R = "__ll_" + n + "es", $ = "__ll_" + n + "ch", L = "__ll_" + n + "pa", V = "__ll_" + n + "csu", q = "__ll_" + n + "cst", U = "__ll_" + n + "csi", F = "__ll_" + n + "csq", H = "__ll_" + n + "cso", B = "__ll_" + n + "ub", z = "__ll_" + n + "lot", Y = "__ll_" + n + "lct", W = "__ll_" + n + "chs", X = "__ll_" + n + "fl", G = "__ll_" + n + "cd", J = "__ll_" + n + "ids", K = [ P, R, $, L, V, q, U, F, H, B, Y, W, X, G, J ], Q = /loaded|complete/, Z = function() {}, et = function() { | |
return console && console.log ? function(e) { | |
console.log(e); | |
} : Z; | |
}(), tt = Z; | |
I._switchLogger = function(e) { | |
tt = e ? et : Z; | |
}; | |
try { | |
localStorage.getItem && (k = r.localStorage); | |
} catch (nt) { | |
tt("Local Storage not supported!"); | |
} | |
var rt = navigator.userAgent, it = function() { | |
return "undefined" != typeof WinJS && "function" == typeof WinJS.xhr; | |
}(); | |
I._getStore = function(e, t) { | |
if (k) { | |
var n, r = k.getItem(e); | |
if (null != r) try { | |
n = t ? JSON.parse(r) : r; | |
} catch (i) { | |
tt("Error parsing JSON from localStorage." + e); | |
} | |
return n; | |
} | |
}; | |
var ot = function(e) { | |
var t = (I._getStore(W, !1) || "").length, n = ("" + e).length, r = n - t; | |
e += r; | |
try { | |
return k.setItem(W, e), w = e, e; | |
} catch (o) { | |
return i; | |
} | |
}, st = function() { | |
w = ct(), ot(w); | |
}; | |
I._writeStore = function(e, t) { | |
if (k) { | |
var n, r, o, s, a; | |
w === i && (w = I._getStore(W, !0), w || st()), n = I._getStore(e, !1), n = n ? n.length : 0; | |
try { | |
if (null == t) ot(w - n), k.removeItem(e); else if (s = JSON.stringify(t), r = s.length, | |
o = r - n) if (a = w + o, 0 > o) { | |
if (ot(a) === i) return tt("Write aborted: delta was negative, but unable to update storage"), | |
i; | |
k.setItem(e, s); | |
} else { | |
if (a += ("" + a).length - ("" + w).length, !(j > a && ot(a) !== i)) return tt("Write aborted: writing would exceed storage limits"), | |
i; | |
k.setItem(e, s); | |
} else k.setItem(e, s); | |
return t; | |
} catch (u) { | |
return tt("Write to localStorage failed by exception."), i; | |
} | |
} | |
}; | |
var at = function(e) { | |
u || (tt("No event store found, searching localStorage"), u = I._getStore(R, !0), | |
u || (tt("No event storage in localStorage found, creating an empty array"), u = [])), | |
tt("Pushing event to event store"), u.push(e), I._writeStore(R, u); | |
}, ut = function(t) { | |
var n = "http:" + I.__url__ + "api/v2/applications/" + encodeURIComponent(e) + "/uploads"; | |
WinJS.xhr({ | |
url: n, | |
type: "POST", | |
data: t, | |
headers: { | |
"Content-Type": "application/json", | |
"x-upload-time": pt() | |
} | |
}).done(Rt, Rt); | |
}, lt = function(t) { | |
var n = document.createElement("script"), r = document.head || document.getElementsByTagName("head")[0] || document.documentElement, o = "http:" + I.__url__ + "api/v2/applications/" + encodeURIComponent(e) + "/uploads?callback=" + S + "&client_date=" + pt() + "&data=" + encodeURIComponent(t); | |
return tt("Uploading blob: \n" + t), tt("Request length: " + o.length), o.length > C ? (tt("Upload length exceeds maximum supported length. Deleting data without uploading."), | |
I._clearStoredUploads(), void 0) : (n.async = "async", n.src = o, n.onload = function() { | |
(!n.readyState || Q.test(n.readyState)) && (tt("Unloading script tag from header"), | |
n.onload = null, r && n.parentNode && r.removeChild(n), n = i); | |
}, r.insertBefore(n, r.firstChild), void 0); | |
}; | |
I._send = function() { | |
return it ? function(e) { | |
ut(e); | |
} : function(e) { | |
lt(e); | |
}; | |
}(); | |
var ct = function() { | |
var e, t, n, r = 0; | |
for (e = 0, t = K.length; t > e; e += 1) n = I._getStore(K[e], !1), n && n.length && (r += n.length); | |
return r; | |
}, dt = function() { | |
var e = function() { | |
return (0 | 65536 * (1 + Math.random())).toString(16).substring(1); | |
}; | |
return e() + e() + "-" + e() + "-" + e() + "-" + e() + "-" + e() + e() + e(); | |
}, pt = function() { | |
return 0 | new Date().getTime() / 1e3; | |
}, ht = function() { | |
return new Date().getTime(); | |
}, ft = function() { | |
return !1; | |
}, mt = function() { | |
return []; | |
}, gt = function() { | |
return ""; | |
}, vt = function() { | |
return 0; | |
}, yt = function() { | |
return {}; | |
}; | |
I._getOrCreateProperty = function(e, t, n, r) { | |
return r ? (e = n(), I._writeStore(t, e)) : null == e && (e = I._getStore(t, !0), | |
e || (e = n(), I._writeStore(t, e))), e; | |
}; | |
var wt = function() { | |
var e = I._getStore(J, !0); | |
return null == e && (tt("No identifiers in localStorage found, creating an empty map"), | |
e = yt()), e; | |
}, bt = function() { | |
return a = I._getOrCreateProperty(a, P, dt, !1); | |
}, _t = function(e) { | |
return d = I._getOrCreateProperty(d, V, dt, e); | |
}, xt = function(e) { | |
return p = I._getOrCreateProperty(p, q, pt, e); | |
}, Et = function() { | |
return c = I._getOrCreateProperty(c, L, pt, !1); | |
}; | |
I._getSessionIndex = function() { | |
return h = I._getOrCreateProperty(h, U, vt, !1); | |
}; | |
var kt = function() { | |
return I._getSessionIndex(), h += 1, I._writeStore(U, h), h; | |
}, St = function() { | |
return f = I._getOrCreateProperty(f, F, vt, !1), f += 1, I._writeStore(F, f), f; | |
}, Tt = function() { | |
return m = I._getOrCreateProperty(m, H, ft, !1); | |
}; | |
I._getOSVersion = function(e) { | |
var t, n, r, i, o, s, a = e.split(/[)]?\s[(]?/), u = a.length, l = a[1]; | |
if (e.match(/iPhone|iPad|iPod/)) i = e.match(/OS (\d+)\D(\d+)/), i && 3 === i.length && (r = "iOS " + i[1] + "." + i[2]); else if (l && l.match(/Macintosh/)) { | |
for (t = 2; u > t; t++) if ("OS" == a[t]) { | |
var c = t - 1, d = t + 2; | |
for (n = t - 1; n > 1; n--) if (";" === a[n].substr(-1) || "Intel" === a[n] || "CPU" === a[n]) { | |
c = n + 1; | |
break; | |
} | |
for (n = t + 1; t + 4 > n; n++) { | |
if (";" === a[n].substr(-1)) { | |
d = n; | |
break; | |
} | |
if ("like" === a[n]) { | |
d = n - 1; | |
break; | |
} | |
} | |
r = a.splice(c, d - (c - 1)).join(" "), r = r.replace(";", "").replace("_", ".").replace(/_\d$/, "").replace("Mac ", ""); | |
break; | |
} | |
} else /^Android/.test(a[3]) ? r = (a[3] + " " + a[4]).replace(";", "") : (i = e.match(/Windows NT (\d)\.(\d)/)) ? i.length > 2 && (o = i[1], | |
s = i[2], "6" === o && "2" === s ? r = "Windows 8" : "6" === o && "1" === s ? r = "Windows 7" : "6" === o && "0" === s ? r = "Windows Vista" : "5" === o && "1" === s ? r = "Windows XP" : "5" === o && "0" === s ? r = "Windows 2000" : "5" === o && "2" === s && (r = "Windows Server 2003")) : e.match(/SymbOS/) ? r = "SymbOS" : e.match(/BlackBerry/) && (i = e.match(/Version\/(\d+)\./)) && (r = "BlackBerry " + i[1]); | |
return r; | |
}, I._generateHeader = function() { | |
tt("Generating a new header"); | |
var t, n = (navigator.language || navigator.userLanguage || "").toUpperCase(); | |
if (n) if (n.match(/-/)) { | |
var r = n.split(/-/); | |
n = r[0], t = r[1]; | |
} else t = rt.match(new RegExp("^.*?\\(.*?" + n + "-(\\w\\w).*?\\).*?$", "i")), | |
t = t && t[1]; | |
var i = navigator.platform, a = navigator.vendor, u = navigator.platform, l = { | |
dt: "h", | |
pa: Et(), | |
seq: St(), | |
u: dt() | |
}, c = { | |
dt: "a", | |
au: e, | |
iu: bt(), | |
lv: T, | |
ua: rt | |
}; | |
u && (c.dmo = u), i && (c.dp = i), n && (c.dll = n); | |
var d = I._getOSVersion(rt); | |
return d && (c.dov = d), o && (c.av = o), s && (c.nc = s), t && (c.dc = t.toUpperCase()), | |
a && (c.dma = a), l.attrs = c, 0 == $t(wt()) && (l.ids = wt()), l; | |
}; | |
var Ct = function(e) { | |
return l = I._getOrCreateProperty(l, $, I._generateHeader, e); | |
}, At = function() { | |
x ? tt("Already polling.") : (tt("Beginning to poll for closes"), x = r.setTimeout(Nt, N)); | |
}, Dt = function() { | |
x ? (tt("Stopping close polling"), r.clearTimeout(x), x = null) : tt("No polling to stop"); | |
}, Nt = function() { | |
I._markNewClose(), x = r.setTimeout(Nt, N); | |
}; | |
I._markNewClose = function() { | |
return tt("Marking a new close."), v = ht(), I._writeStore(Y, v); | |
}; | |
var Ot = function() { | |
v = I._getOrCreateProperty(v, Y, ht, !1), b = I._getOrCreateProperty(b, X, mt, !1); | |
var e = 0 | v / 1e3, t = xt(), n = e - t, r = { | |
dt: "c", | |
u: dt(), | |
ss: t, | |
su: _t(), | |
ct: e, | |
ctl: n, | |
cta: n | |
}; | |
return b.length > 0 && (r.fl = b), It(r, I._getOrCreateProperty(_, G, mt, !1)), | |
r; | |
}, Mt = function() { | |
tt("Finalizing close with last polled close"), Dt(), at(Ot()), b = [], I._writeStore(X, b), | |
I._writeStore(H, !1); | |
}; | |
I._finalizeClose = Mt, I._clearStoredUploads = function() { | |
g = null, I._writeStore(B, g); | |
}; | |
var jt = function(e) { | |
var t; | |
if (null != e.polling && (N = e.polling ? +e.polling : 0), e.uploadTimeout && (O = e.uploadTimeout), | |
e.appVersion) o = "" + e.appVersion; else if (e.version) tt("'version' is deprecated, please use 'appVersion' instead."), | |
o = "" + e.version; else if ("undefined" != typeof Windows) try { | |
t = Windows.ApplicationModel.Package.current.id.version, o = [ t.major, t.minor, t.build, t.revision ].join("."); | |
} catch (i) {} | |
e.carrier && (s = "" + e.carrier), null != e.sessionTimeoutSeconds ? D = e.sessionTimeoutSeconds ? +e.sessionTimeoutSeconds : 0 : null != e.timeout && (tt("'timeout' is deprecated, please use 'sessionTimeoutSeconds' instead."), | |
D = e.timeout ? +e.timeout / 1e3 : 0), null != e.storage && (j = e.storage ? +e.storage : 0), | |
null != e.logger && (M = !!e.logger), I._switchLogger(M), st(), it || (r.__localytics_callbacks__ = r.__localytics_callbacks__ || {}, | |
r.__localytics_callbacks__[n] = Rt), Ct(!0), tt("LocalyticsSession successfully initialized"); | |
}, It = function(e, t) { | |
var n; | |
if (t && Pt(t)) for (n = 0; 4 > n; n += 1) t[n] && (e["c" + n] = "" + t[n]); | |
}, Pt = Array.isArray || function(e) { | |
return "[object Array]" === Object.prototype.toString.call(e); | |
}; | |
I._open = function(e) { | |
var t; | |
if (v = I._getStore(Y, !0) || 0, ht() - v < 1e3 * D) tt("Open called within timeout, resuming last session."); else { | |
Tt() && Mt(), kt(); | |
var n = xt(!0); | |
if (t = { | |
dt: "s", | |
ct: n, | |
u: _t(!0), | |
nth: I._getSessionIndex() | |
}, y = y || I._getStore(z, !0) || 0, y && 0 != y) { | |
var r = n - y; | |
r >= 1 && (t.sl = Math.round(r)); | |
} | |
y = I._writeStore(z, n), e && (_ = I._writeStore(G, e.slice(0)), It(t, e)), at(t), | |
m = !0, I._writeStore(H, m), tt("Appended open tag to event store"); | |
} | |
N ? At() : tt("Polling timeout was set to 0; no close polling will be done."); | |
}, I._tagEvent = function(e, t, n, r) { | |
if (!Tt()) return tt("Cannot tag event: either no session was opened, or it was already closed"), | |
void 0; | |
isNaN(r) ? (tt("Customer value increase not a number, setting to 0."), r = 0) : parseFloat(r) != parseInt(r) && tt("Customer value increase passed as floating point number."); | |
var i, o, s = { | |
dt: "e", | |
ct: pt(), | |
u: dt(), | |
su: _t(), | |
n: "" + e, | |
v: r | |
}; | |
if (!n && Pt(t) && (n = t, t = null), t) { | |
o = {}; | |
for (i in t) t.hasOwnProperty(i) && (o[i] = "" + t[i]); | |
s.attrs = o; | |
} | |
It(s, n), at(s), tt("Tagged event: '" + e + "' with attributes (JSON): '" + JSON.stringify(o) + "'"); | |
}, I._tagScreen = function(e) { | |
if (!Tt()) return tt("Cannot tag screen: either no session was opened, or it was already closed"), | |
void 0; | |
b = I._getOrCreateProperty(b, X, mt, !1); | |
var t = b.length || 0, n = "" + e; | |
b[t - 1] !== n && (b.push(n), I._writeStore(X, b)); | |
}, I._close = function() { | |
return Tt() ? (Dt(), I._markNewClose(), void 0) : (tt("Cannot close session: either no session was opened, or it was already closed"), | |
void 0); | |
}, I._upload = function() { | |
if (null != E && ht() - E < O) return tt("Upload in progress, returning"), void 0; | |
if (u = I._getOrCreateProperty(u, R, mt, !1), g = I._getOrCreateProperty(g, B, gt, !1), | |
!(u && 0 !== u.length || g)) return tt("Nothing to upload, returning."), void 0; | |
var e, t, n = u.splice(0), r = ""; | |
for (n.unshift(Ct(!1)), e = 0, t = n.length; t > e; e += 1) r += JSON.stringify(n[e]) + "\n"; | |
g += r, I._writeStore(B, g), u = null, I._writeStore(R, u), I._send(g), E = ht(), | |
Ct(!0); | |
}; | |
var Rt = function(e) { | |
var t = +(e.response_code || e.status); | |
E = null, tt("Callback called with response:"), t && (tt("Response code: " + t), | |
202 === t || 200 === t ? (tt("Upload succeeded, clearing uploaded items."), I._clearStoredUploads()) : t >= 400 && t > 500 ? (tt("Response was 4XX, clearing items"), | |
I._clearStoredUploads()) : e.message && (tt("Upload failed with message:"), tt(e.message))); | |
}, $t = function(e) { | |
for (var t in e) if (e.hasOwnProperty(t)) return !1; | |
return !0; | |
}, Lt = function(e, t) { | |
e += "", t += ""; | |
var n = wt(); | |
tt("Adding identifier:" + e + " to identifiers map"), n[e] = t, I._writeStore(J, n); | |
}, Vt = function(e) { | |
e += ""; | |
var t = wt(); | |
tt("Deleting value for key:" + e), delete t[e], I._writeStore(J, t); | |
}; | |
I._setIdentifier = function(e, t) { | |
null != e && 0 != e.length && (null == t ? Vt(e) : 0 == t.length ? Vt(e) : Lt(e, t)); | |
}, I._setCustomerName = function(e) { | |
I.setIdentifier("customer_name", e); | |
}, I._setCustomerId = function(e) { | |
I.setIdentifier("customer_id", e); | |
}, I._setCustomerEmail = function(e) { | |
I.setIdentifier("customer_email", e); | |
}, I.__url__ = "//analytics.localytics.com/"; | |
var qt = function(e, t) { | |
console.log("> Call to Localytics client library failed ."), console.log("> localyticsSession." + e + " failed ."), | |
console.log("> " + t), console.log(t); | |
for (var e in A) I[e] = Z; | |
}; | |
return function() { | |
var e, n, r = A.length; | |
for (e = 0; r > e; e++) n = A[e], I[n] = function(e) { | |
return function() { | |
try { | |
I["_" + e].apply(I, arguments); | |
} catch (t) { | |
qt(e, t); | |
} | |
}; | |
}(n); | |
jt(t); | |
}(), I; | |
}(window); | |
}; | |
define("localytics", function(e) { | |
return function() { | |
var t, n; | |
return n = function() { | |
var e, t; | |
return e = "production" === window.ENV ? "8cd7264cce4430ce05df0e3-5b54dc22-4c78-11e3-91fc-005cf8cbabd8" : "3151b0fe1fe878f949b5a30-696ad81c-4c78-11e3-91fc-005cf8cbabd8", | |
t = LocalyticsSession(e), t.open(), t.upload(), t; | |
}, t = n.apply(e, arguments), t || e.LocalyticsSession; | |
}; | |
}(this)), function() { | |
define("utils/tracking", [ "require", "exports", "module", "localytics" ], function(e, t, n) { | |
var r; | |
return r = e("localytics"), n.exports = { | |
trackEvent: function(e, t, n) { | |
var i; | |
return null == n && (n = "interaction"), r.tagEvent(e, t), r.upload(), null != (i = window.TAGX) ? i.EventProxy.trigger(e, t, n) : void 0; | |
} | |
}; | |
}); | |
}.call(this), function() { | |
define("route-mediator", [ "require", "exports", "module", "underscore", "router", "backbone", "underscore", "models/article.model", "assert", "localytics", "utils/tracking", "moment" ], function(e, t, n) { | |
var r, i, o, s, a, u, l, c, d; | |
return d = e("underscore"), o = e("router"), i = e("backbone").Events, d = e("underscore"), | |
r = e("models/article.model"), a = e("assert"), u = e("localytics"), c = e("utils/tracking"), | |
l = e("moment"), s = { | |
setRouter: function(e) { | |
return a(null == this.router, "Expected router to be unset"), this.router = e; | |
}, | |
routeToArticle: function(e, t) { | |
var n, i, o; | |
return null == t && (t = {}), a(null != this.router, "Expected a router to be set on the mediator"), | |
a(e instanceof r, "Expected an Article model"), n = e.route, a(d.isString(n, "Expected the `route` property to be set")), | |
d.defaults(t, { | |
replace: !1, | |
trigger: !1, | |
name: "change" | |
}), i = $("<div />").html(e.get("headline")).text(), document.title = "" + i + " - Today’s Paper", | |
o = { | |
"Reffering Source": t.navigationMethod, | |
url: e.wwwUrl, | |
slug: e.slug, | |
editionDate: e.edition.date, | |
dayOfWeek: e.edition.dayOfWeek, | |
date: l().format("YYYY-MM-DD") | |
}, c.trackEvent("Article View", o, "pageview"), this.router.navigate(n, t), this.trigger(t.name, e, n); | |
} | |
}, n.exports = d.extend(s, i); | |
}); | |
}.call(this), define("text!tmpl/www-image.html", [], function() { | |
return '<% // TODO: determine if this stays: if (typeof wwwUrl !== \'undefined\' && wwwUrl) { /* if there\'s no wwwUrl, just don\'t bother rendering anything */ %>\n <% if (typeof imgSrcUrl !== \'undefined\' && imgSrcUrl) { %>\n <div class="www-image loaded" style="background-image: url(<%=imgSrcUrl%>); padding-bottom: <%=(100 / aspectRatio)%>%; width: 100%; background-size: 100%;"></div>\n <% } else { %>\n <div class="www-image unloaded" style="padding-bottom: <%=(100 / aspectRatio)%>%; width: 100%;"></div>\n <% } %>\n<% // } %>\n'; | |
}), function() { | |
var e = {}.hasOwnProperty, t = function(t, n) { | |
function r() { | |
this.constructor = t; | |
} | |
for (var i in n) e.call(n, i) && (t[i] = n[i]); | |
return r.prototype = n.prototype, t.prototype = new r(), t.__super__ = n.prototype, | |
t; | |
}; | |
define("views/www-image.view", [ "require", "exports", "module", "views/base.view", "text!tmpl/www-image.html", "jquery" ], function(e, n, r) { | |
var i, o, s, a, u; | |
return o = e("views/base.view"), a = e("text!tmpl/www-image.html"), i = e("jquery"), | |
r.exports = s = function(e) { | |
function n() { | |
return u = n.__super__.constructor.apply(this, arguments); | |
} | |
return t(n, e), n.prototype.tmpl = a, n.prototype.initialize = function() { | |
return this.listenTo(this.model, "change:imgSrcUrl", this.render); | |
}, n.prototype.didRender = function() { | |
var e, t = this; | |
return this.model.imgSrcUrl ? (e = new Image(), i(e).one("load", function() { | |
return setTimeout(function() { | |
return t.model.unfetch(); | |
}, 0); | |
}), e.src = this.model.imgSrcUrl) : void 0; | |
}, n; | |
}(o); | |
}); | |
}.call(this), function() { | |
define("utils/cssprefix", [], function() { | |
switch (Modernizr.prefixed("transform")) { | |
case "MozTransform": | |
return "-moz-"; | |
case "WebkitTransform": | |
return "-webkit-"; | |
default: | |
return ""; | |
} | |
}); | |
}.call(this), function() { | |
var e = function(e, t) { | |
return function() { | |
return e.apply(t, arguments); | |
}; | |
}, t = {}.hasOwnProperty, n = function(e, n) { | |
function r() { | |
this.constructor = e; | |
} | |
for (var i in n) t.call(n, i) && (e[i] = n[i]); | |
return r.prototype = n.prototype, e.prototype = new r(), e.__super__ = n.prototype, | |
e; | |
}; | |
define("edition-app/views/accordion-section.view", [ "require", "exports", "module", "jquery-hammerjs", "text!edition-app/tmpl/accordion-section.html", "views/base.view", "route-mediator", "views/www-image.view", "utils/device", "utils/cssprefix" ], function(t, r, i) { | |
var o, s, a, u, l, c, d, p; | |
return t("jquery-hammerjs"), d = t("text!edition-app/tmpl/accordion-section.html"), | |
s = t("views/base.view"), u = t("route-mediator"), l = t("views/www-image.view"), | |
a = t("utils/device"), c = t("utils/cssprefix"), i.exports = o = function(t) { | |
function r() { | |
return this.linkTapped = e(this.linkTapped, this), this.expand = e(this.expand, this), | |
this.expandOrCollapse = e(this.expandOrCollapse, this), this.setZIndex = e(this.setZIndex, this), | |
this.makeInactive = e(this.makeInactive, this), this.getActive = e(this.getActive, this), | |
this.makeActive = e(this.makeActive, this), this.setHeight = e(this.setHeight, this), | |
p = r.__super__.constructor.apply(this, arguments); | |
} | |
return n(r, t), r.prototype.tmpl = d, r.prototype.className = "accordion-section", | |
r.prototype.ui = { | |
$thumbImg: ".accordion-section-header-thumb-img" | |
}, r.prototype.initialize = function() { | |
var e; | |
return this.currentY = 0, this.listenTo(this, "contentChanged", this.setHeight), | |
this.respondTo = a.iOSDevice || a.ie ? "click" : "tap", e = this, this.$el.hammer().on("tap", "a", function(t) { | |
return "tap" === e.respondTo ? e.linkTapped(t, $(this)) : void 0; | |
}), this.$el.on("click", "a", function(t) { | |
return t.preventDefault(), "click" === e.respondTo ? e.linkTapped(t, $(this)) : void 0; | |
}), this.$el.hammer().on("tap", ".accordion-section-header", function() { | |
return "tap" === e.respondTo ? e.expandOrCollapse() : void 0; | |
}), this.$el.on("click", ".accordion-section-header", function() { | |
return "click" === e.respondTo ? e.expandOrCollapse() : void 0; | |
}), this.$el.on("transitionend", "a", function(e) { | |
return e.stopPropagation(); | |
}); | |
}, r.prototype.setHeight = function() { | |
return this.height = this.$articleList.outerHeight(), this.thumbHeight = this.thumb.outerHeight(), | |
this.titleHeight = this.$(".accordion-section-header-text .title").outerHeight(); | |
}, r.prototype.didRender = function() { | |
var e; | |
return this.$articleList = this.$("ol"), this.thumb = this.$("div.accordion-section-header"), | |
e = new l({ | |
model: this.model.thumb | |
}), this.renderNested(e, this.ui.$thumbImg), this; | |
}, r.prototype.makeActive = function(e) { | |
var t; | |
return this.makeInactive(), t = e.get("route"), this.currentActiveLink = this.$el.find("a[href='#" + t + "']"), | |
this.currentActiveLink.addClass("active"), this.currentActiveLink; | |
}, r.prototype.getActive = function() { | |
return this.currentActiveLink || this.$el.find("a").first(); | |
}, r.prototype.makeInactive = function() { | |
var e; | |
return null != (e = this.currentActiveLink) ? e.removeClass("active") : void 0; | |
}, r.prototype.setZIndex = function(e) { | |
return this.$el.css("z-index", e); | |
}, r.prototype.expandOrCollapse = function() { | |
var e; | |
return e = 300, this.expand(e); | |
}, r.prototype.expand = function(e, t) { | |
var n; | |
return this.open = !0, this.trigger("expand", this, e), t ? void 0 : (n = this.model.get("articles").first(), | |
u.routeToArticle(n, { | |
navigationMethod: "section" | |
})); | |
}, r.prototype.transitionComplete = function() { | |
return this.trigger(this.open ? "expanded" : "collapsed"); | |
}, r.prototype.setDuration = function(e) { | |
var t = this; | |
return this.$el.one("transitionend", function(e) { | |
return e.stopPropagation(), t.$el.css("transition", ""), t.$articleList.css("transition", ""), | |
t.transitionComplete(); | |
}), this.$el.css({ | |
transition: "" + c + "transform " + e / 1e3 + "s ease-in" | |
}), this.$articleList.css({ | |
transition: "" + c + "transform " + e / 1e3 + "s ease-in" | |
}); | |
}, r.prototype.slideTo = function(e, t) { | |
return this.setDuration(t), this.$el.css("" + c + "transform", e ? "translate3d(0," + e + "px,0)" : ""); | |
}, r.prototype.linkTapped = function(e, t) { | |
var n, r; | |
return e.preventDefault(), n = t.attr("href").substr(1), r = this.model.get("articles").find(function(e) { | |
return e.route === n; | |
}), u.routeToArticle(r, { | |
navigationMethod: "tap" | |
}); | |
}, r; | |
}(s); | |
}); | |
}.call(this), function() { | |
define("utils/scrollfix", [ "jquery" ], function(e) { | |
var t; | |
return t = function() { | |
function t(e) { | |
var t; | |
t = this, console.log("Created scroll fixer"), e.on("scroll", this.scrollFunc), | |
e.on("touchmove", function(e) { | |
return t.moveFunc(e, this); | |
}), 0 === e.scrollTop() && e.scrollTop(1); | |
} | |
return t.prototype.scrollFunc = function() { | |
return console.log(e(this).scrollTop()), 0 === e(this).scrollTop() ? e(this).scrollTop(1) : e(this).scrollTop() + e(this).height() === this.scrollHeight ? e(this).scrollTop(e(this).scrollTop() - 1) : void 0; | |
}, t.prototype.moveFunc = function(t, n) { | |
return n.scrollHeight === e(n).height() ? (t.preventDefault(), t.stopPropagation(), | |
!1) : void 0; | |
}, t; | |
}(); | |
}); | |
}.call(this), function() { | |
var e = function(e, t) { | |
return function() { | |
return e.apply(t, arguments); | |
}; | |
}, t = {}.hasOwnProperty, n = function(e, n) { | |
function r() { | |
this.constructor = e; | |
} | |
for (var i in n) t.call(n, i) && (e[i] = n[i]); | |
return r.prototype = n.prototype, e.prototype = new r(), e.__super__ = n.prototype, | |
e; | |
}; | |
define("edition-app/views/accordion.view", [ "require", "exports", "module", "jquery-hammerjs", "jquery", "underscore", "logger", "views/list.view", "edition-app/views/accordion-section.view", "route-mediator", "utils/device", "utils/scrollfix", "utils/cssprefix" ], function(t, r, i) { | |
var o, s, a, u, l, c, d, p, h, f, m; | |
return t("jquery-hammerjs"), o = t("jquery"), f = t("underscore"), p = t("logger"), | |
l = t("views/list.view"), s = t("edition-app/views/accordion-section.view"), h = t("route-mediator"), | |
u = t("utils/device"), c = t("utils/scrollfix"), d = t("utils/cssprefix"), i.exports = a = function(t) { | |
function r() { | |
return this.updateSticky = e(this.updateSticky, this), this.setHeight = e(this.setHeight, this), | |
this.resized = e(this.resized, this), this.viewExpanding = e(this.viewExpanding, this), | |
this.setLinkScrollFocus = e(this.setLinkScrollFocus, this), this.articleChanged = e(this.articleChanged, this), | |
this.initialize = e(this.initialize, this), m = r.__super__.constructor.apply(this, arguments); | |
} | |
var i; | |
return n(r, t), r.prototype.tagName = "div", r.prototype.Child = s, r.prototype.initialize = function(e) { | |
var t = this; | |
return this.$holder = o(e.holder), this.listenTo(this, "rendered", function() { | |
return this.views.forEach(function(e, t) { | |
return e.setZIndex(t), e.setHeight(); | |
}), this.initStickies(), this.collapsedHeight = this.$el.height(); | |
}), this.listenTo(h, "change change:section:article", this.articleChanged), o(window).on("resize", this.resized), | |
u.iOSDevice ? new c(this.$holder) : u.ie || (this.$holder.hammer().on("dragdown", function(e) { | |
return t.$holder.scrollTop() > 1 ? !0 : (e.gesture.preventDefault(), e.gesture.stopPropagation()); | |
}), this.$holder.hammer().on("dragup", function(e) { | |
return t.$holder.scrollTop() + t.$holder.height() < t.$holder[0].scrollHeight ? !0 : (e.gesture.preventDefault(), | |
e.gesture.stopPropagation()); | |
})), o("body").on("touchstart", function() {}), this.$holder.on("wheel mousewheel", function(e) { | |
var n, r, i, o; | |
return n = t.$holder[0], r = null != (i = null != (o = e.originalEvent.wheelDeltaY) ? o : e.originalEvent.wheelDelta) ? i : -1 * e.originalEvent.deltaY, | |
r > 0 && 0 === n.scrollTop ? e.preventDefault() : 0 > r && n.scrollTop + n.clientHeight === n.scrollHeight ? e.preventDefault() : void 0; | |
}); | |
}, r.prototype.render = function() { | |
var e = this; | |
return r.__super__.render.call(this), this.views.forEach(function(t) { | |
return e.listenTo(t, "expand", e.viewExpanding), e.listenTo(t, "expanded collapsed", f.throttle(e.updateSticky, 100)), | |
t.setHeight(); | |
}); | |
}, r.prototype.articleChanged = function(e) { | |
return this.activeArticle !== e ? (this.currentActiveSection && this.currentActiveSection.makeInactive(), | |
this.setLinkScrollFocus(e), this.activeArticle = e) : void 0; | |
}, r.prototype.setLinkScrollFocus = function(e, t) { | |
var n, r, i, o, s, a, u, l, c, d, p, h, m, g; | |
if (e) { | |
for ("undefined" == typeof t && (t = 300), r = f.find(this.views, function(t) { | |
return t.model.get("internalName") === e.get("sectionId"); | |
}), o = this.currentActiveSection !== r, o && (this.currentActiveSection = r, this.currentActiveSection.expand(t, !0)), | |
n = this.currentActiveSection.makeActive(e), d = 0, g = this.views, h = 0, m = g.length; m > h && (p = g[h], | |
p !== this.currentActiveSection); h++) d += p.thumbHeight; | |
return u = d + this.currentActiveSection.thumbHeight + n.position().top, !o && u < this.$holder.scrollTop() ? (c = u - 5, | |
c -= this.currentActiveSection.titleHeight + 36, this.hdAcceleratedScrollTo(c, t)) : (s = u + n.outerHeight() + 5, | |
l = this.$holder.scrollTop() + this.$holder.height(), i = s - l, i > 0 ? this.hdAcceleratedScrollTo(this.$holder.scrollTop() + i, t) : o ? (a = this.currentActiveSection.thumbHeight + n.position().top + n.outerHeight(), | |
d + this.$holder.height() > this.collapsedHeight + this.currentActiveSection.height && (d = this.collapsedHeight + this.currentActiveSection.height - this.$holder.height()), | |
this.hdAcceleratedScrollTo(d, t)) : void 0); | |
} | |
}, r.prototype.viewExpanding = function(e, t) { | |
var n, r, i, o, s, a, u = this; | |
if (this.expandedView !== e) return r = this.expandedView, this.expandedView = e, | |
null != e && null != (s = e.$el) && s.addClass("expanded"), null != r && null != (a = r.$el) && a.removeClass("expanded"), | |
!r || this.expandedView.height > r.height ? this.setHeight() : this.listenToOnce(this, "scrollComplete", this.setHeight), | |
n = this.views.indexOf(e), i = this.views.indexOf(r), o = 0, this.views.forEach(function(s, a) { | |
return r && n > i && a === i && n < u.views.length - 1 ? (o += s.thumbHeight, s.slideTo(-s.height, t), | |
u.listenToOnce(u, "scrollComplete", function() { | |
return r.slideTo(0, 0); | |
})) : n > a ? (o += s.thumbHeight, s.slideTo(0, t)) : a === n ? s.slideTo(0, t) : a > n ? s.slideTo(e.height, t) : void 0; | |
}), this.unstickSticky(); | |
}, r.prototype.resized = function() { | |
var e, t, n, r, i, o = this; | |
for (this.views.forEach(function(e) { | |
return e.setHeight(); | |
}), this.collapsedHeight = 0, this.views.forEach(function(e) { | |
return o.collapsedHeight += e.thumbHeight; | |
}), t = this.views.indexOf(this.expandedView), e = n = r = t + 1, i = this.views.length; i >= r ? i > n : n > i; e = i >= r ? ++n : --n) this.views[e].slideTo(this.expandedView.height, 0); | |
return this.setHeight(), this.setLinkScrollFocus(this.activeEl, 0); | |
}, r.prototype.setHeight = function() { | |
return this.$el.css("height", this.collapsedHeight + this.expandedView.height); | |
}, r.prototype.hdAcceleratedScrollTo = function(e, t) { | |
var n, r, i, o, s, a = this; | |
return r = this.$holder.scrollTop(), o = e - r, i = function(e) { | |
return e.preventDefault(), e.stopPropagation(), !1; | |
}, n = function() { | |
var t; | |
return t = { | |
transition: "" | |
}, t["" + d + "transform"] = "translate3d(0,0,0)", a.$el.css(t), a.$holder.scrollTop(e), | |
a.trigger("scrollComplete"), a.$el.off("touchstart", i), a.isScrolling = !1; | |
}, this.isScrolling = !0, 0 === t ? n() : (this.$el.on("touchstart", i), s = { | |
transition: "" + d + "transform " + t / 1e3 + "s ease-in" | |
}, s["" + d + "transform"] = "translate3d(0," + -o + "px,0)", this.$el.css(s), this.$el.one("-webkit-" === d ? "webkitTransitionEnd" : "transitionend", function() { | |
n(); | |
})); | |
}, r.prototype.destroy = function() { | |
return r.__super__.destroy.apply(this, arguments), o(window).off("resize", this.updateSticky), | |
this.$holder.off("scroll", this.updateSticky), this.$holder.off("wheel mousewheel"); | |
}, r.prototype.initStickies = function() { | |
var e; | |
if (this.$holder.length && !u.iOSDevice) return this.sections = function() { | |
var t, n, r, i; | |
for (r = this.$(".accordion-section"), i = [], t = 0, n = r.length; n > t; t++) e = r[t], | |
i.push({ | |
$section: o(e), | |
$header: o(".accordion-section-header", e), | |
$headerText: o(".accordion-section-header-text", e) | |
}); | |
return i; | |
}.call(this), o(window).on("resize", this.updateSticky), this.$holder.on("scroll", this.updateSticky), | |
this.updateSticky(), this.isStickied = !0; | |
}, i = 19, r.prototype.updateSticky = function() { | |
var e, t, n, r, o, s, a, u, l, c, d, p, h; | |
if ((null != (d = this.$holder) ? d.length : void 0) && (null != (p = this.sections) ? p.length : void 0)) { | |
for (o = this.$holder.offset(), t = this.$el.offset().top, h = this.sections, s = l = 0, | |
c = h.length; c > l; s = ++l) if (e = h[s].$section, e.offset().top - o.top > 0) { | |
0 !== s && (a = this.sections[s - 1], u = this.sections[s].$section.offset().top); | |
break; | |
} | |
if (null != a) return n = a.$headerText.offset().top - i, r = a.$headerText.outerHeight() + i, | |
n - o.top > 0 ? this.unstickSticky() : u - o.top > r ? this.stickSticky(a, "fixed", { | |
top: 0 - a.$header.height() + r, | |
left: 0, | |
width: a.$header.outerWidth() | |
}) : u !== n + r ? this.stickSticky(a, "absolute", { | |
top: u - t - a.$header.outerHeight(), | |
left: 0, | |
width: a.$header.outerWidth() | |
}) : void 0; | |
} | |
}, r.prototype.stickSticky = function(e, t, n) { | |
if (this.stickySection !== e && this.unstickSticky(), this.$sticky || (this.$sticky = e.$header.clone().addClass("stuck"), | |
this.stickySection = e, this.stickyState = null), this.stickyState !== t) { | |
switch (this.stickyState = t, t) { | |
case "fixed": | |
this.$sticky.appendTo(this.$holder.parent()); | |
break; | |
case "absolute": | |
this.$sticky.appendTo(this.$holder); | |
} | |
if (n) return this.$sticky.css(n); | |
} | |
}, r.prototype.unstickSticky = function() { | |
return this.$sticky ? (this.$sticky.remove(), this.$sticky = this.stickyState = this.stickySection = null) : void 0; | |
}, r; | |
}(l); | |
}); | |
}.call(this), define("text!tmpl/image.html", [], function() { | |
return '<figure class="image <%=proportion%>" style="max-width: <%=width%>px">\n <div class="image-holder" style="padding-bottom: <%=(100/aspectRatio)%>%;">\n <% if (typeof imgSrcUrl !== "undefined" && imgSrcUrl) { %><img src="<%=imgSrcUrl%>" class="image-view"><% } %>\n <div class="icon"></div>\n </div>\n <figcaption>\n <% if (typeof caption !== "undefined" && caption) { %><div class="caption"><%=caption%></div><% } %>\n <% if (typeof credit !== "undefined" && credit) { %><div class="credit"><%=credit%></div><% } %>\n </figcaption>\n</figure>\n'; | |
}), define("text!tmpl/image-modal.html", [], function() { | |
return '<div class="title-bar"></div>\n<figure class="image full-width <%=proportion%>">\n <div class="image-holder">\n <% if (typeof imgSrcUrl !== "undefined" && imgSrcUrl) { %><img src="<%=imgSrcUrl%>" class="image-view" style="max-width: <%=width%>px; max-height: <%=height%>px;"><% } %>\n </div>\n <figcaption>\n <% if (caption) { %><div class="caption"><%=caption%></div><% } %>\n <% if (credit) { %><div class="credit"><%=credit%></div><% } %>\n </figcaption>\n</figure>\n'; | |
}), function() { | |
var e = function(e, t) { | |
return function() { | |
return e.apply(t, arguments); | |
}; | |
}, t = {}.hasOwnProperty, n = function(e, n) { | |
function r() { | |
this.constructor = e; | |
} | |
for (var i in n) t.call(n, i) && (e[i] = n[i]); | |
return r.prototype = n.prototype, e.prototype = new r(), e.__super__ = n.prototype, | |
e; | |
}; | |
define("views/image.view", [ "require", "exports", "module", "views/base.view", "text!tmpl/image.html", "text!tmpl/image-modal.html", "utils/device", "underscore", "jquery", "logger" ], function(t) { | |
var r, i, o, s, a, u, l, c, d, p; | |
return s = 1500, i = t("views/base.view"), a = t("text!tmpl/image.html"), c = t("text!tmpl/image-modal.html"), | |
o = t("utils/device"), d = t("underscore"), r = t("jquery"), l = t("logger"), u = function(t) { | |
function i() { | |
return this.checkPosition = e(this.checkPosition, this), this.imagePinch = e(this.imagePinch, this), | |
this.imageClick = e(this.imageClick, this), this.initialize = e(this.initialize, this), | |
p = i.__super__.constructor.apply(this, arguments); | |
} | |
return n(i, t), i.prototype.tmpl = a, i.prototype.ui = { | |
$figure: "figure" | |
}, i.prototype.initialize = function(e) { | |
var t, n, r = this; | |
return n = null != e ? e : {}, t = n.isModalView, this.scrollContainer = n.scrollContainer, | |
this.listenTo(this.model, "change reset", function() { | |
return r.model.get("imgSrcUrl") ? (r.stopListening(r.model, "change reset"), r.render()) : void 0; | |
}), t && (this.tmpl = c, this.modalView = !0), this.scrollContainer ? this.listenTo(this.scrollContainer, "viewportChanged", this.checkPosition) : this.model.fetch(); | |
}, i.prototype.destroy = function() { | |
return l.trace("destroy", this), this.stopListening(this.scrollContainer), i.__super__.destroy.apply(this, arguments); | |
}, i.prototype.didRender = function() { | |
var e, t = this; | |
return this.ui.$figure.hammer().on(o.ie ? "click" : "tap", this.imageClick), this.ui.$figure.on("pinchin", this.imagePinch), | |
this.model.imgSrcUrl ? (e = new Image(), r(e).one("load", function() { | |
return setTimeout(function() { | |
return t.model.unfetch(); | |
}, 0); | |
}), e.src = this.model.imgSrcUrl) : void 0; | |
}, i.prototype.imageClick = function(e) { | |
var t; | |
this.trigger("imageclick", this), null != (t = e.gesture) && t.preventDefault(); | |
}, i.prototype.imagePinch = function() { | |
this.modalView && this.trigger("pinchin", this); | |
}, i.prototype.checkPosition = function() { | |
return this.isInViewport({ | |
extendTop: s | |
}) ? (l.trace("loading image", this), this.model.fetch().otherwise(function() { | |
return l.warn("image failed to load", this); | |
}), this.stopListening(this.scrollContainer)) : void 0; | |
}, i; | |
}(i); | |
}); | |
}.call(this), define("text!edition-app/tmpl/article-slideshow.html", [], function() { | |
return '<div class="related-slideshow">\n <div class="jumbo-thumb" data-glass-id="<%=thumbImage.id%>"></div>\n <div class="summary"><span class="title">Slide Show | <%=title%></span> <%=summary%></div>\n</div>\n\n'; | |
}), function() { | |
var e = function(e, t) { | |
return function() { | |
return e.apply(t, arguments); | |
}; | |
}, t = {}.hasOwnProperty, n = function(e, n) { | |
function r() { | |
this.constructor = e; | |
} | |
for (var i in n) t.call(n, i) && (e[i] = n[i]); | |
return r.prototype = n.prototype, e.prototype = new r(), e.__super__ = n.prototype, | |
e; | |
}; | |
define("edition-app/views/article-slideshow.view", [ "require", "exports", "module", "views/base.view", "views/image.view", "text!edition-app/tmpl/article-slideshow.html", "utils/device" ], function(t, r, i) { | |
var o, s, a, u, l, c; | |
return s = t("views/base.view"), u = t("views/image.view"), l = t("text!edition-app/tmpl/article-slideshow.html"), | |
a = t("utils/device"), i.exports = o = function(t) { | |
function r() { | |
return this.slideshowClick = e(this.slideshowClick, this), this.initialize = e(this.initialize, this), | |
c = r.__super__.constructor.apply(this, arguments); | |
} | |
return n(r, t), r.prototype.tmpl = l, r.prototype.ui = { | |
$jumboThumb: ".jumbo-thumb" | |
}, r.prototype.initialize = function(e) { | |
return this.river = (null != e ? e : {}).river, this.listenTo(this.model, "change reset", this.render); | |
}, r.prototype.slideshowClick = function() { | |
return this.trigger("slideshowclick", this); | |
}, r.prototype.didRender = function() { | |
var e; | |
return this.model.thumbImage && (e = this.model.thumbImage, this.renderNested(new u({ | |
model: e, | |
scrollContainer: this.river | |
}), this.ui.$jumboThumb)), this.$el.hammer().on(a.ie ? "click" : "tap", ".jumbo-thumb", this.slideshowClick); | |
}, r; | |
}(s); | |
}); | |
}.call(this), define("text!edition-app/tmpl/article-video.html", [], function() { | |
return '<figure class="video horizontal">\n <div class="image-holder" style="padding-bottom: <%= (100 / encoding.aspectRatio) %>%">\n <video preload="none" <% if (typeof posterUrl !== \'undefined\' && posterUrl) { %> poster="<%= posterUrl %>" <% } %> controls>\n <source type="video/mp4" src="<%= encoding.url %>">\n </video>\n <div class="icon"></div>\n </div>\n <figcaption>\n <div class="title">Video | <%=title%></div>\n <div class="caption"><%=caption%></div>\n </figcaption>\n</figure>\n'; | |
}), function() { | |
var e = function(e, t) { | |
return function() { | |
return e.apply(t, arguments); | |
}; | |
}, t = {}.hasOwnProperty, n = function(e, n) { | |
function r() { | |
this.constructor = e; | |
} | |
for (var i in n) t.call(n, i) && (e[i] = n[i]); | |
return r.prototype = n.prototype, e.prototype = new r(), e.__super__ = n.prototype, | |
e; | |
}; | |
define("edition-app/views/article-video.view", [ "require", "exports", "module", "views/base.view", "text!edition-app/tmpl/article-video.html" ], function(t, r, i) { | |
var o, s, a, u; | |
return o = t("views/base.view"), a = t("text!edition-app/tmpl/article-video.html"), | |
i.exports = s = function(t) { | |
function r() { | |
return this.initialize = e(this.initialize, this), u = r.__super__.constructor.apply(this, arguments); | |
} | |
return n(r, t), r.prototype.tmpl = a, r.prototype.ui = { | |
$video: "video" | |
}, r.prototype.initialize = function() { | |
var e = this; | |
return this.listenTo(this.model, "change:posterUrl reset", function() { | |
return e.model.posterUrl ? e.ui.$video.attr("poster", e.model.posterUrl) : void 0; | |
}); | |
}, r.prototype.didRender = function() { | |
var e = this; | |
return this.video = this.ui.$video.get(0), this.ui.$video.on("play", function() { | |
return e.trigger("videoPlayStart", e.model.id); | |
}); | |
}, r.prototype.stopPlaying = function() { | |
return this.video.paused ? void 0 : this.video.pause(); | |
}, r; | |
}(o); | |
}); | |
}.call(this), define("text!edition-app/tmpl/slideshow.html", [], function() { | |
return '<div class="slideshow">\n <div class="prev control inactive"></div>\n <div class="next control"></div>\n <div class="title-bar">\n <div class="title"><%=title%></div>\n </div>\n <div class="slides">\n <% _.each(slides, function(slide, index) { %>\n <div class="slide">\n <figure class="image full-width <%=slide.proportion %>">\n <div class="image-holder">\n <img src="<%=slide.wwwUrl %>" style="max-width: <%=slide.width%>px; max-height: <%=slide.height%>px;"/>\n </div>\n <figcaption>\n <% if (slide.caption) { %><div class="caption"><%= slide.caption %></div><% } %>\n <% if (slide.credit) { %><div class="credit"><%= slide.credit %></div><% } %>\n </figcaption>\n </figure>\n </div>\n <% }); %>\n </div>\n <div class="pagination">\n <ul class="pg-dots-row">\n <% _.each(slides, function(slide, index) { %>\n <li <%if (index === 0) { %>class="active"<%}%>>\n <span class="dot"></span>\n </li>\n <% }); %>\n </ul>\n </div>\n</div>\n\n'; | |
}), function() { | |
var e = function(e, t) { | |
return function() { | |
return e.apply(t, arguments); | |
}; | |
}, t = {}.hasOwnProperty, n = function(e, n) { | |
function r() { | |
this.constructor = e; | |
} | |
for (var i in n) t.call(n, i) && (e[i] = n[i]); | |
return r.prototype = n.prototype, e.prototype = new r(), e.__super__ = n.prototype, | |
e; | |
}; | |
define("edition-app/views/slideshow.view", [ "require", "exports", "module", "jquery-hammerjs", "views/base.view", "views/image.view", "text!edition-app/tmpl/slideshow.html", "hammer", "modernizr", "utils/device", "underscore" ], function(t, r, i) { | |
var o, s, a, u, l, c, d, p, h; | |
return t("jquery-hammerjs"), o = t("views/base.view"), u = t("views/image.view"), | |
d = t("text!edition-app/tmpl/slideshow.html"), a = t("hammer"), l = t("modernizr"), | |
s = t("utils/device"), p = t("underscore"), i.exports = c = function(t) { | |
function r() { | |
return this.handleHammer = e(this.handleHammer, this), this.setPaneDimensions = e(this.setPaneDimensions, this), | |
this.handleKeypress = e(this.handleKeypress, this), h = r.__super__.constructor.apply(this, arguments); | |
} | |
return n(r, t), r.prototype.tmpl = d, r.prototype.ui = { | |
$prev: ".prev", | |
$next: ".next", | |
$control: ".control", | |
$slideshow: ".slideshow", | |
$slides: ".slides", | |
$slide: ".slide", | |
$pagination: ".pagination", | |
$dots: ".pagination ul li" | |
}, r.prototype.attributes = { | |
"class": "slideshow" | |
}, r.prototype.initialize = function() { | |
return this.$body.on("keyup.slideshow", this.handleKeypress), this.$window.on("load.slideshow resize.slideshow orientationchange.slideshow", this.setPaneDimensions); | |
}, r.prototype.destroy = function() { | |
return this.$body.off(".slideshow"), this.$window.off(".slideshow"), this.element.length && this.element.off(".hammergesture"), | |
r.__super__.destroy.apply(this, arguments); | |
}, r.prototype.handleKeypress = function(e) { | |
return 37 === e.keyCode ? this.showPrevious() : 39 === e.keyCode ? this.showNext() : void 0; | |
}, r.prototype.didRender = function() { | |
return this.setUpCarousel(), this.setPaneDimensions(); | |
}, r.prototype.dotClick = function(e) { | |
var t, n; | |
t = e, n = this.ui.$dots.index(t), n > -1 && this.showPane(n); | |
}, r.prototype.setUpCarousel = function() { | |
return this.element = this.ui.$slideshow, this.container = this.ui.$slides, this.pagination = this.ui.$pagination, | |
this.pagination_dots = this.ui.$dots, this.panes = this.ui.$slide, this.pane_width = 0, | |
this.pane_count = this.ui.$slide.length, this.current_pane = 0, this.element.length ? this.element.hammer({ | |
drag_lock_to_axis: !0 | |
}).on("release.hammergesture dragleft.hammergesture dragright.hammergesture swipeleft.hammergesture swiperight.hammergesture pinchin.hammergesture tap.hammergesture", this.handleHammer) : void 0; | |
}, r.prototype.setPaneDimensions = function() { | |
var e, t, n, r; | |
for (this.pane_width = this.element.width(), r = this.panes, t = 0, n = r.length; n > t; t++) e = r[t], | |
$(e).width(this.pane_width); | |
return this.container.width(this.pane_width * this.pane_count); | |
}, r.prototype.showPane = function(e) { | |
var t; | |
return e = Math.max(0, Math.min(e, this.pane_count - 1)), this.current_pane = e, | |
t = -(100 / this.pane_count * this.current_pane), this.setContainerOffset(t, !0), | |
this.ui.$control.removeClass("inactive"), e + 1 === this.pane_count && this.ui.$next.addClass("inactive"), | |
0 === e && this.ui.$prev.addClass("inactive"), this.ui.$dots.length ? (this.ui.$dots.removeClass("active"), | |
$(this.ui.$dots[e]).addClass("active")) : void 0; | |
}, r.prototype.setContainerOffset = function(e, t) { | |
var n, r; | |
return this.container.removeClass("animate"), t && this.container.addClass("animate"), | |
l.csstransforms3d ? (n = "translate3d(" + e + "%,0,0) scale3d(1,1,1)", this.container.css("transform", n)) : l.csstransforms ? this.container.css("transform", "translate(" + e + "%,0)") : (r = this.pane_width * this.pane_count / 100 * e, | |
this.container.css("left", "" + r + "px")); | |
}, r.prototype.showNext = function() { | |
return this.showPane(this.current_pane + 1, !0), this; | |
}, r.prototype.showPrevious = function() { | |
return this.showPane(this.current_pane - 1, !0), this; | |
}, r.prototype.handleHammer = function(e) { | |
var t; | |
return e.gesture && (e.gesture.preventDefault(), t = this["_" + e.type], p.isFunction(t)) ? t.call(this, e) : void 0; | |
}, r.prototype._dragright = function(e) { | |
var t, n; | |
return n = -(100 / this.pane_count) * this.current_pane, t = 100 / this.pane_width * e.gesture.deltaX / this.pane_count, | |
(0 === this.current_pane && e.gesture.direction === a.DIRECTION_RIGHT || this.current_pane === this.pane_count - 1 && e.gesture.direction === a.DIRECTION_LEFT) && (t *= .4), | |
this.setContainerOffset(t + n); | |
}, r.prototype._dragleft = function(e) { | |
return this._dragright(e); | |
}, r.prototype._swipeleft = function(e) { | |
return this.showNext(), e.gesture.stopDetect(); | |
}, r.prototype._swiperight = function(e) { | |
return this.showPrevious(), e.gesture.stopDetect(); | |
}, r.prototype._release = function(e) { | |
return Math.abs(e.gesture.deltaX) > this.pane_width / 2 ? "right" === e.gesture.direction ? this.showPrevious() : this.showNext() : this.showPane(this.current_pane, !0); | |
}, r.prototype._pinchin = function() { | |
return this.trigger("pinchin", this); | |
}, r.prototype._tap = function(e) { | |
var t, n; | |
n = $(e.target).parents(), n.is(this.pagination) ? ($(e.target).is(this.pagination_dots) ? t = $(e.target) : $(e.target.parentElement).is(this.pagination_dots) && (t = $(e.target.parentElement)), | |
t && this.dotClick(t)) : this.ui.$prev.is(e.target) ? this.showPrevious() : this.ui.$next.is(e.target) ? this.showNext() : this.trigger("slideshowclick", this); | |
}, r; | |
}(o); | |
}); | |
}.call(this), function() { | |
var e = {}.hasOwnProperty, t = function(t, n) { | |
function r() { | |
this.constructor = t; | |
} | |
for (var i in n) e.call(n, i) && (t[i] = n[i]); | |
return r.prototype = n.prototype, t.prototype = new r(), t.__super__ = n.prototype, | |
t; | |
}; | |
define("models/ad.model", [ "require", "exports", "module", "underscore", "utils/when-ajax", "models/base.model", "assert" ], function(e, n, r) { | |
var i, o, s, a, u, l; | |
return u = e("underscore"), s = e("utils/when-ajax"), o = e("models/base.model"), | |
a = e("assert"), r.exports = i = function(e) { | |
function n() { | |
return l = n.__super__.constructor.apply(this, arguments); | |
} | |
return t(n, e), n.prototype.defaults = function() { | |
return { | |
page: "", | |
position: "", | |
ads: null | |
}; | |
}, n.sugarAttributes(), n.prototype.url = "production" !== window.ENV ? "http://www.stg.nytimes.com/adx/bin/adxrun.html?v=3&cpp=1" : "http://www.nytimes.com/adx/bin/adxrun.html?v=3&cpp=1", | |
n.prototype.fetch = function() { | |
var e, t = this; | |
return e = this.url + "&page=" + this.page + "&positions=" + this.position, s(e, { | |
dataType: "jsonp", | |
jsonp: "jsonp" | |
}).then(function(e) { | |
return t.set(e); | |
}, function() { | |
return t.set(null); | |
}); | |
}, n; | |
}(o); | |
}); | |
}.call(this), function() { | |
define("utils/generateIframe", [], function() { | |
return { | |
init: function(e, t) { | |
var n, r; | |
return n = $(r = document.createElement("iframe")), r.src = null != (null != t ? t.src : void 0) ? t.src : /\bMSIE\b/i.test(navigator.userAgent) ? 'javascript:document.write("<head><script>document.domain=' + ('\\"' + document.domain + '\\";</script></head><body></body>")') : "about:blank", | |
(null != t ? t.prepend : void 0) ? e.prepend(n) : e.append(n), n; | |
} | |
}; | |
}); | |
}.call(this), function() { | |
var e = function(e, t) { | |
return function() { | |
return e.apply(t, arguments); | |
}; | |
}, t = {}.hasOwnProperty, n = function(e, n) { | |
function r() { | |
this.constructor = e; | |
} | |
for (var i in n) t.call(n, i) && (e[i] = n[i]); | |
return r.prototype = n.prototype, e.prototype = new r(), e.__super__ = n.prototype, | |
e; | |
}; | |
define("edition-app/views/ad.view", [ "require", "exports", "module", "views/base.view", "models/ad.model", "utils/generateIframe", "jquery" ], function(t, r, i) { | |
var o, s, a, u, l, c, d, p, h, f, m; | |
return s = 0, l = t("views/base.view"), a = t("models/ad.model"), d = t("utils/generateIframe"), | |
o = t("jquery"), p = 0, c = 3, h = "todayspaper.nytimes.com", f = "TopAd,mobilebanner", | |
i.exports = u = function(t) { | |
function r() { | |
return this.checkPosition = e(this.checkPosition, this), m = r.__super__.constructor.apply(this, arguments); | |
} | |
return n(r, t), r.prototype.confirmationPixel = null, r.prototype.initialize = function(e) { | |
var t; | |
t = null != e ? e : {}, this.article = t.article, this.scrollContainer = t.scrollContainer; | |
}, r.prototype.destroy = function() { | |
return this.stopListening(this.scrollContainer), r.__super__.destroy.apply(this, arguments); | |
}, r.prototype.shouldDisplayAd = function() { | |
return 0 === p % c; | |
}, r.prototype.checkPosition = function() { | |
return null != this.confirmationPixel && this.isInViewport({ | |
extendTop: s | |
}) ? (this.$el.append('<img class="confirmation" style="display:none" src="' + this.confirmationPixel + '">'), | |
this.stopListening(this.scrollContainer)) : void 0; | |
}, r.prototype.render = function() { | |
var e = this; | |
return this.shouldDisplayAd() && (this.model = new a({ | |
page: h, | |
position: f | |
}), this.model.fetch().then(function() { | |
var t, n, r; | |
if (null != e.model.ads) { | |
if (t = e.$el.width(), 1 * (null != (n = e.model.ads.TopAd) ? n.width : void 0) < t) return e.wrapAndDisplayAd(e.model.ads.TopAd); | |
if (1 * (null != (r = e.model.ads.mobilebanner) ? r.width : void 0) < t) return e.wrapAndDisplayAd(e.model.ads.mobilebanner); | |
} | |
})), p++; | |
}, r.prototype.wrapAndDisplayAd = function(e) { | |
var t, n; | |
return null != e && null != e.creative && null != e["confirmation-url"] && null != e.height && null != e.width ? (t = d.init(this.$el), | |
t.attr("id", "preview-iframe").attr("frameborder", 0).attr("scrolling", "no").css({ | |
display: "block", | |
height: e.height, | |
width: e.width, | |
border: "none", | |
overflow: "hidden" | |
}), n = t[0].contentWindow.document, n.open(), n.write('<html><head><base target="_blank"></head>\n<body style="padding:0;margin:0;border:0;text-align:center;overflow:hidden">\n' + e.creative + "\n</body></html>"), | |
n.close(), this.$el.addClass("full"), this.confirmationPixel = e["confirmation-url"], | |
this.listenTo(this.scrollContainer, "viewportChanged", this.checkPosition)) : void 0; | |
}, r; | |
}(l), i.exports.resetArticlesRendered = function() { | |
return p = 0; | |
}; | |
}); | |
}.call(this), define("text!edition-app/tmpl/article.html", [], function() { | |
return '<div class=\'article-holder\'>\n <div class="article-content">\n\n <div class="header <% if (tone) {%>tone-<%= tone%><% } %>">\n\n <div class="kicker-area">\n <% if (sectionName != "Front Page") { %>\n <span class="section-name"><%= sectionName %></span>\n <% } %>\n\n <% if (sectionName != "Front Page" && kicker) { %>\n <span class="pipe">|</span>\n <% } %>\n\n <% if (kicker != null) { %>\n <span class="kicker"><%= kicker %></span>\n <% } %>\n </div>\n\n <h2><%= headline %></h2>\n\n </div>\n\n <% if (spanImage != null && spanImage.proportion != "vertical") { %>\n <div class="main-asset">\n </div>\n <% } %>\n\n <% if (byline != null) { %>\n <div class="byline"><%= byline %></div>\n <% } %>\n\n <!--<div class="published"><%\n if (sectionName == "Front Page"){\n %>Published on the <%= sectionName %><%\n } else {\n %>Published in <%= sectionName %>, page <%= printPage %><% }\n %></div>-->\n\n <div data-body class="body"><%= body %></div>\n\n <div class="article-tools footer"><!--\n .--><label>Share:</label><!--\n .--><ul><!--\n .--><li class="www-link"><input type="text" value="<%= tinyUrl %>" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck="false" readonly /></li><!--\n .--><li class="email">Email</li><!--\n .--></ul><!--\n .--></div><!--\n .--><div style="line-height: 0"> </div><!-- hack to force iOS tap-hold on last word of .www-link to select just that, no more no less-->\n </div>\n\n <div class="ad-space">\n <div class="ad-container"></div>\n </div>\n\n</div>\n'; | |
}), function() { | |
var e = function(e, t) { | |
return function() { | |
return e.apply(t, arguments); | |
}; | |
}, t = {}.hasOwnProperty, n = function(e, n) { | |
function r() { | |
this.constructor = e; | |
} | |
for (var i in n) t.call(n, i) && (e[i] = n[i]); | |
return r.prototype = n.prototype, e.prototype = new r(), e.__super__ = n.prototype, | |
e; | |
}; | |
define("edition-app/views/article.view", [ "require", "exports", "module", "views/base.view", "views/image.view", "edition-app/views/article-slideshow.view", "edition-app/views/article-video.view", "views/modal.view", "views/alert.view", "edition-app/views/slideshow.view", "edition-app/views/ad.view", "models/ad.model", "text!edition-app/tmpl/article.html", "utils/device", "jquery", "logger" ], function(t, r, i) { | |
var o, s, a, u, l, c, d, p, h, f, m, g, v, y, w, b; | |
return h = t("views/base.view"), g = t("views/image.view"), c = t("edition-app/views/article-slideshow.view"), | |
d = t("edition-app/views/article-video.view"), v = t("views/modal.view"), u = t("views/alert.view"), | |
y = t("edition-app/views/slideshow.view"), a = t("edition-app/views/ad.view"), s = t("models/ad.model"), | |
l = t("text!edition-app/tmpl/article.html"), f = t("utils/device"), o = t("jquery"), | |
w = t("logger"), m = 10, i.exports = p = function(t) { | |
function r() { | |
return this.launchEmail = e(this.launchEmail, this), this.launchSlideshowModal = e(this.launchSlideshowModal, this), | |
this.launchImageModal = e(this.launchImageModal, this), b = r.__super__.constructor.apply(this, arguments); | |
} | |
return n(r, t), r.prototype.className = "article", r.prototype.tmpl = l, r.prototype.ui = { | |
$body: "[data-body]", | |
$mainAsset: ".main-asset", | |
$transitionAd: ".ad-container" | |
}, r.prototype.events = { | |
"click .article-tools .email": "launchEmail", | |
"click p a": "leaveAlert" | |
}, r.prototype.initialize = function(e) { | |
var t; | |
return t = null != e ? e : {}, this.hasAd = t.hasAd, this.river = t.river, this.$el.attr("data-article-route", this.model.get("route")), | |
this.videoViews = []; | |
}, r.prototype.beforeRender = function() { | |
return this.model.fetch(); | |
}, r.prototype.didRender = function() { | |
var e, t; | |
return this.isRendered = !0, this.sfAsset = null, "vertical" !== (null != (t = this.model.spanImage) ? t.proportion : void 0) && (this.sfAsset = this.model.spanImage), | |
f.iOSDevice && this.$(".www-link input").prop("readonly", !1), this.$(".www-link input").on("click touchend focus", function() { | |
var e = this; | |
return setTimeout(function() { | |
return e.setSelectionRange(0, 9999); | |
}, 0); | |
}), null != this.sfAsset && (e = this.renderNested(new g({ | |
model: this.sfAsset, | |
scrollContainer: this.river | |
}), this.ui.$mainAsset), e.on("imageclick", this.launchImageModal)), this.model.get("body") && this.updateBody(), | |
this.requestAd(), this; | |
}, r.prototype.requestAd = function() { | |
return this.renderNested(new a({ | |
article: this.model.get("id"), | |
scrollContainer: this.river | |
}), this.ui.$transitionAd); | |
}, r.prototype.updateBody = function() { | |
var e; | |
if (!this.isRendered) throw new Error("View is not rendered yet"); | |
return e = this.sprinkleAssets(), this.ui.$body.html(e), this.ui.$body.find("a").attr("target", "_blank"), | |
this.trigger("render:body", this.elHeight); | |
}, r.prototype.setHeight = function() { | |
return this.elHeight = this.$el.height(); | |
}, r.prototype.getHeight = function() { | |
return this.elHeight = this.$el.height(); | |
}, r.prototype.top = function() { | |
return this.$el.offset().top; | |
}, r.prototype.destroy = function() { | |
return r.__super__.destroy.apply(this, arguments), this.removeAllModals(); | |
}, r.prototype.renderAsset = function(e) { | |
if (!e || !e.get("type")) return ""; | |
switch (e.get("type")) { | |
case "image": | |
return this.renderImage(e).el; | |
case "slideshow": | |
return this.renderSlideshow(e).el; | |
case "video": | |
return this.renderVideo(e).el; | |
} | |
}, r.prototype.createAssetContainer = function(e) { | |
var t; | |
return t = o('<div class="asset"></div>'), (null != e ? e.get("placement") : void 0) && t.addClass("lead"), | |
t; | |
}, r.prototype.renderImage = function(e) { | |
var t, n, r, i, o, s, a; | |
return t = this.createAssetContainer(e), t.addClass(e.get("proportion")), s = e.get("width"), | |
o = e.get("height"), r = e.get("placement") ? 500 : 390, i = s / o * r, t.css("max-width", Math.min(i, s)), | |
n = new g({ | |
model: e, | |
scrollContainer: this.river | |
}), a = this.renderNested(n, t), this.listenTo(a, "imageclick", this.launchImageModal), | |
a; | |
}, r.prototype.renderSlideshow = function(e) { | |
var t, n, r; | |
return t = this.createAssetContainer(e), t.addClass(null != (r = e.thumbImage) ? r.proportion : void 0), | |
n = this.renderNested(new c({ | |
model: e, | |
river: this.river | |
}), t), this.listenTo(n, "slideshowclick", this.launchSlideshowModal), n; | |
}, r.prototype.renderVideo = function(e) { | |
var t, n; | |
return t = this.createAssetContainer(e), t.addClass("horizontal"), e.fetch().otherwise(function() { | |
return w.warn("video fetch failed", e); | |
}), n = this.renderNested(new d({ | |
model: e | |
}), t), this.videoViews.push(n), this.listenTo(n, "videoPlayStart", function(e) { | |
return this.trigger("videoPlayStart", e); | |
}), n; | |
}, r.prototype.sprinkleAssets = function() { | |
var e, t, n, r, i, s, a, u, l, c, d, p, h, f, m = this; | |
if (r = document.createDocumentFragment(), n = this.model.body, null != (f = this.model.relatedAssets) ? f.length : void 0) { | |
if (a = o("<div/>").append(n).find("p"), e = [], this.model.relatedAssets.each(function(t) { | |
return m.sfAsset && t.id === m.sfAsset.id ? void 0 : e.push(t); | |
}), this.leadAsset = !this.sfAsset && (null != e ? e.length : void 0) ? e[0].set("placement", "leadAsset") : null, | |
t = 0, l = 6, u = this.leadAsset ? -1 : 0, null != a) for (i = p = 0, h = a.length; h > p; i = ++p) s = a[i], | |
(this.leadAsset && 0 === i || null != e && 0 === (i + 1 + u) % l && t < e.length) && (r.appendChild(o('<div class="pre-asset"></div>')[0]), | |
r.appendChild(this.renderAsset(e[t])), t += 1), r.appendChild(a[i]); else d = o("<div/>"), | |
d.html(n), d.children().each(function(e, t) { | |
return r.appendChild(t); | |
}); | |
if (null != e) { | |
for (c = o('<div class="thumbnails"></div>')[0]; t < e.length; ) "video" !== e[t].get("type") && c.appendChild(this.renderAsset(e[t])), | |
t += 1; | |
r.appendChild(o('<div class="pre-asset"></div>')[0]), r.appendChild(c); | |
} | |
} else d = o("<div/>"), d.html(n), d.children().each(function(e, t) { | |
return r.appendChild(t); | |
}); | |
return r; | |
}, r.prototype.stopVideos = function(e) { | |
var t, n, r, i, o; | |
for (i = this.videoViews, o = [], n = 0, r = i.length; r > n; n++) t = i[n], e && t.model.id === e ? o.push(void 0) : o.push(t.stopPlaying()); | |
return o; | |
}, r.prototype.launchImageModal = function(e) { | |
var t, n; | |
return t = e.model, this.removeAllModals(), t ? (n = new g({ | |
model: t, | |
isModalView: !0 | |
}), this.modalImage = new v({ | |
nestView: n, | |
className: "fullScreen", | |
targetContainer: o("#app") | |
}), this.listenTo(this.modalImage, "modalOpen", this.modalOpen), this.modalImage.render()) : void 0; | |
}, r.prototype.launchSlideshowModal = function(e) { | |
var t, n; | |
return t = e.model, this.removeAllModals(), t ? (n = new y({ | |
model: t | |
}), this.modalSlideshow = new v({ | |
nestView: n, | |
className: "fullScreen", | |
targetContainer: o("#app") | |
}), this.listenTo(this.modalSlideshow, "modalOpen", this.modalOpen), this.modalSlideshow.render()) : void 0; | |
}, r.prototype.removeAllModals = function() { | |
return this.modalSlideshow && (this.modalSlideshow.destroy(), this.modalSlideshow = null), | |
this.modalImage ? (this.modalImage.destroy(), this.modalImage = null) : void 0; | |
}, r.prototype.modalOpen = function() { | |
return this.trigger("modalOpen"); | |
}, r.prototype.launchEmail = function() { | |
var e, t, n; | |
return n = "NYTimes: " + this.model.headline, e = "From The New York Times:\n\n" + this.model.headline + "\n\n" + (this.model.tinyUrl || this.model.wwwUrl), | |
t = "mailto:?subject=" + encodeURIComponent(n) + "&body=" + encodeURIComponent(e), | |
window.location.href = t; | |
}, r.prototype.leaveAlert = function(e) { | |
return f.iOSDevice && f.isStandalone && !confirm("You are leaving Today's Paper. When you return, you can pick up where you left off.") ? e.preventDefault() : void 0; | |
}, r.prototype.onClickWwwLink = function(e) { | |
return setTimeout(function() { | |
var t, n, r; | |
return t = e.target, r = window.getSelection(), n = document.createRange(), n.selectNodeContents(t), | |
r.removeAllRanges(), r.addRange(n); | |
}, 0); | |
}, r; | |
}(h); | |
}); | |
}.call(this), define("text!edition-app/tmpl/section.html", [], function() { | |
return '<% if (prev) { %>\n<header class="section-head">\n <div class="section-button">\n <a href="#<%= prev.route %>" data-nav="section" data-direction="backwards">\n <h4>Previous Section: <%= prev.sectionName %></h4>\n </a>\n </div>\n</header>\n<% } %>\n<div data-placeholder></div>\n<% if (next) { %>\n<footer class="section-foot">\n <div class="section-button">\n <a href="#<%= next.route %>" data-nav="section" data-direction="forward">\n <h4>Next Section: <%= next.sectionName %></h4>\n </a>\n </div>\n</footer>\n<% } %>\n'; | |
}), function() { | |
var e = function(e, t) { | |
return function() { | |
return e.apply(t, arguments); | |
}; | |
}, t = {}.hasOwnProperty, n = function(e, n) { | |
function r() { | |
this.constructor = e; | |
} | |
for (var i in n) t.call(n, i) && (e[i] = n[i]); | |
return r.prototype = n.prototype, e.prototype = new r(), e.__super__ = n.prototype, | |
e; | |
}; | |
define("edition-app/views/section.view", [ "require", "exports", "module", "logger", "when", "underscore", "backbone", "jquery-hammerjs", "views/base.view", "views/list.view", "edition-app/views/article.view", "text!edition-app/tmpl/section.html", "collections/articles.coll", "models/edition.model", "route-mediator" ], function(t, r, i) { | |
var o, s, a, u, l, c, d, p, h, f, m, g, v; | |
return h = t("logger"), p = t("when"), g = t("underscore"), u = t("backbone"), t("jquery-hammerjs"), | |
l = t("views/base.view"), d = t("views/list.view"), a = t("edition-app/views/article.view"), | |
m = t("text!edition-app/tmpl/section.html"), o = t("collections/articles.coll"), | |
c = t("models/edition.model"), f = t("route-mediator"), i.exports = s = function(t) { | |
function r() { | |
return this.updateViewForArticle = e(this.updateViewForArticle, this), this.handleSectionNav = e(this.handleSectionNav, this), | |
this.createModel = e(this.createModel, this), v = r.__super__.constructor.apply(this, arguments); | |
} | |
return n(r, t), r.prototype.tagName = "div", r.prototype.tmpl = m, r.prototype.Child = a, | |
r.prototype.autoRenderChildren = !1, r.prototype.ui = { | |
$header: "header", | |
$footer: "footer", | |
$headerBtn: "header .section-button", | |
$footerBtn: "footer .section-button", | |
$navButtons: "[data-nav='section']" | |
}, r.prototype.createChildView = function(e) { | |
var t; | |
return t = (null != e ? e : {}).model, new this.Child({ | |
model: t, | |
river: this.river | |
}); | |
}, r.prototype.initialize = function(e) { | |
var t; | |
if (t = null != e ? e : {}, this.river = t.river, this.edition = t.edition, !(this.river instanceof u.View)) throw Error("$river must be set in " + this.constructor.name); | |
if (!(this.collection instanceof o)) throw new TypeError("Article Collection must be set in " + this.constructor.name); | |
if (!(this.edition instanceof c)) throw new Error("Expected an instance of edition in " + this.constructor.name); | |
return this.model = this.createModel(), this.focusedView = null, this.toolbarHeight = $("#toolbar").outerHeight(), | |
this.riverTop = 0, this.listenTo(this.river, "viewportChanged", this.onViewportChanged), | |
this.listenTo(this.river, "windowResized", this.onWindowResized), this.listenTo(f, "change", this.updateViewForArticle); | |
}, r.prototype.createModel = function() { | |
var e, t, n; | |
return t = { | |
prev: null, | |
next: null | |
}, e = this.edition.getNextArticleColl(this.collection), null !== e && (this.nextCollectionArticle = e.first(), | |
this.nextCollectionArticle && (t.next = this.nextCollectionArticle.toJSON())), n = this.edition.getPrevArticleColl(this.collection), | |
null !== n && (this.prevCollectionArticle = n.first(), this.prevCollectionArticle && (t.prev = this.prevCollectionArticle.toJSON())), | |
{ | |
toJSON: function() { | |
return t; | |
} | |
}; | |
}, r.prototype.willRender = function() { | |
return this.$el.empty(), this.$el.html("Loading..."), this.isRendering = !0, this.collection.fetch(); | |
}, r.prototype.didRender = function() { | |
var e, t = this; | |
return e = this, this.views.forEach(function(e, n) { | |
return e.hasAd = 0 === n % 2, e.render(), t.listenTo(e, "videoPlayStart", function(e) { | |
return this.stopVideos(e); | |
}), t.listenTo(e, "modalOpen", function() { | |
return this.stopVideos(); | |
}); | |
}), this.isRendered = !0, this.ui.$headerBtn.hammer().on("tap", function() { | |
return t.ui.$header.addClass("active"); | |
}), this.ui.$footerBtn.hammer().on("tap", function() { | |
return t.ui.$footer.addClass("active"); | |
}), this.ui.$navButtons.on("click", function(e) { | |
return e.preventDefault(); | |
}), this.ui.$navButtons.hammer().on("tap", function(t) { | |
return e.handleSectionNav(t, $(this)); | |
}); | |
}, r.prototype.handleSectionNav = function(e, t) { | |
var n, r; | |
return e.gesture.preventDefault(), n = t.attr("data-direction"), r = "forward" === n ? this.nextCollectionArticle : this.prevCollectionArticle, | |
f.routeToArticle(r, { | |
name: "change", | |
navigationMethod: "section-nav-" + n | |
}); | |
}, r.prototype.stopVideos = function(e) { | |
var t; | |
return null != (t = this.views) ? t.forEach(function(t) { | |
return t.stopVideos(e); | |
}) : void 0; | |
}, r.prototype.getViewByArticle = function(e) { | |
return this.getViewByModel(e); | |
}, r.prototype.getViewAtViewportY = function(e) { | |
var t, n, r, i, o, s, a, u, l; | |
if (u = null != e ? e : { | |
frac: .5 | |
}, n = u.frac, r = u.px, !this.views) return null; | |
for (o = window.innerHeight || document.documentElement.clientHeight, l = this.views, | |
s = 0, a = l.length; a > s; s++) if (i = l[s], t = i.$(".ad-container")[0].getBoundingClientRect().bottom || i.$(".article-content")[0].getBoundingClientRect().bottom, | |
t - 50 > (null != n ? (o - 50) * n : o - 50 + r)) return i; | |
}, r.prototype.onWindowResized = function() { | |
var e, t; | |
return e = this.getViewAtViewportY({ | |
frac: .5 | |
}), e !== this.focusedView ? (t = this.getViewPosition(this.focusedView), $(window).scrollTop(t)) : void 0; | |
}, r.prototype.onViewportChanged = function() { | |
var e, t, n, r, i, o, s; | |
if (n = this.getViewAtViewportY({ | |
frac: .5 | |
}), n !== this.focusedView && f.routeToArticle(n.model, { | |
name: "change:section:article", | |
navigationMethod: "scroll" | |
}), this.setFocusedView(n), !Modernizr.touch && (e = this.getViewAtViewportY({ | |
px: -200 | |
}))) { | |
for (s = [], t = r = 0, i = this.views.indexOf(e); i >= r; t = r += 1) s.push(null != (o = this.views[t].$el) ? o.addClass("active") : void 0); | |
return s; | |
} | |
}, r.prototype.setFocusedView = function(e) { | |
return e !== this.focusedView ? this.focusedView = e : void 0; | |
}, r.prototype.updateViewForArticle = function(e) { | |
var t; | |
return t = this.getViewById(e.id), t && this.focusedView !== t ? (this.setFocusedView(t), | |
t) : void 0; | |
}, r.prototype.getViewPosition = function(e) { | |
var t, n, r, i, o; | |
if (!this.getViewByArticle(e.model)) throw new Error("view does not exist in sectionview"); | |
for (t = this.ui.$header.outerHeight() + this.riverTop, o = this.views, r = 0, i = o.length; i > r; r++) { | |
n = o[r]; | |
{ | |
if (n === e) return t; | |
t += n.$el.outerHeight(); | |
} | |
} | |
return t; | |
}, r.prototype.destroy = function() { | |
var e, t, n, i; | |
for (i = this.views, t = 0, n = i.length; n > t; t++) e = i[t], e.destroy(); | |
return r.__super__.destroy.apply(this, arguments); | |
}, r.prototype.didDestroy = function() { | |
return this.collection.unfetch(); | |
}, r; | |
}(d); | |
}); | |
}.call(this), function(e, t) { | |
var n = "ui-effects-"; | |
e.effects = { | |
effect: {} | |
}, function(e, t) { | |
function n(e, t, n) { | |
var r = d[t.type] || {}; | |
return null == e ? n || !t.def ? null : t.def : (e = r.floor ? ~~e : parseFloat(e), | |
isNaN(e) ? t.def : r.mod ? (e + r.mod) % r.mod : 0 > e ? 0 : r.max < e ? r.max : e); | |
} | |
function r(t) { | |
var n = l(), r = n._rgba = []; | |
return t = t.toLowerCase(), f(u, function(e, i) { | |
var o, s = i.re.exec(t), a = s && i.parse(s), u = i.space || "rgba"; | |
return a ? (o = n[u](a), n[c[u].cache] = o[c[u].cache], r = n._rgba = o._rgba, !1) : void 0; | |
}), r.length ? ("0,0,0,0" === r.join() && e.extend(r, o.transparent), n) : o[t]; | |
} | |
function i(e, t, n) { | |
return n = (n + 1) % 1, 1 > 6 * n ? e + 6 * (t - e) * n : 1 > 2 * n ? t : 2 > 3 * n ? e + 6 * (t - e) * (2 / 3 - n) : e; | |
} | |
var o, s = "backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor", a = /^([\-+])=\s*(\d+\.?\d*)/, u = [ { | |
re: /rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/, | |
parse: function(e) { | |
return [ e[1], e[2], e[3], e[4] ]; | |
} | |
}, { | |
re: /rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/, | |
parse: function(e) { | |
return [ 2.55 * e[1], 2.55 * e[2], 2.55 * e[3], e[4] ]; | |
} | |
}, { | |
re: /#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/, | |
parse: function(e) { | |
return [ parseInt(e[1], 16), parseInt(e[2], 16), parseInt(e[3], 16) ]; | |
} | |
}, { | |
re: /#([a-f0-9])([a-f0-9])([a-f0-9])/, | |
parse: function(e) { | |
return [ parseInt(e[1] + e[1], 16), parseInt(e[2] + e[2], 16), parseInt(e[3] + e[3], 16) ]; | |
} | |
}, { | |
re: /hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/, | |
space: "hsla", | |
parse: function(e) { | |
return [ e[1], e[2] / 100, e[3] / 100, e[4] ]; | |
} | |
} ], l = e.Color = function(t, n, r, i) { | |
return new e.Color.fn.parse(t, n, r, i); | |
}, c = { | |
rgba: { | |
props: { | |
red: { | |
idx: 0, | |
type: "byte" | |
}, | |
green: { | |
idx: 1, | |
type: "byte" | |
}, | |
blue: { | |
idx: 2, | |
type: "byte" | |
} | |
} | |
}, | |
hsla: { | |
props: { | |
hue: { | |
idx: 0, | |
type: "degrees" | |
}, | |
saturation: { | |
idx: 1, | |
type: "percent" | |
}, | |
lightness: { | |
idx: 2, | |
type: "percent" | |
} | |
} | |
} | |
}, d = { | |
"byte": { | |
floor: !0, | |
max: 255 | |
}, | |
percent: { | |
max: 1 | |
}, | |
degrees: { | |
mod: 360, | |
floor: !0 | |
} | |
}, p = l.support = {}, h = e("<p>")[0], f = e.each; | |
h.style.cssText = "background-color:rgba(1,1,1,.5)", p.rgba = h.style.backgroundColor.indexOf("rgba") > -1, | |
f(c, function(e, t) { | |
t.cache = "_" + e, t.props.alpha = { | |
idx: 3, | |
type: "percent", | |
def: 1 | |
}; | |
}), l.fn = e.extend(l.prototype, { | |
parse: function(i, s, a, u) { | |
if (i === t) return this._rgba = [ null, null, null, null ], this; | |
(i.jquery || i.nodeType) && (i = e(i).css(s), s = t); | |
var d = this, p = e.type(i), h = this._rgba = []; | |
return s !== t && (i = [ i, s, a, u ], p = "array"), "string" === p ? this.parse(r(i) || o._default) : "array" === p ? (f(c.rgba.props, function(e, t) { | |
h[t.idx] = n(i[t.idx], t); | |
}), this) : "object" === p ? (i instanceof l ? f(c, function(e, t) { | |
i[t.cache] && (d[t.cache] = i[t.cache].slice()); | |
}) : f(c, function(t, r) { | |
var o = r.cache; | |
f(r.props, function(e, t) { | |
if (!d[o] && r.to) { | |
if ("alpha" === e || null == i[e]) return; | |
d[o] = r.to(d._rgba); | |
} | |
d[o][t.idx] = n(i[e], t, !0); | |
}), d[o] && e.inArray(null, d[o].slice(0, 3)) < 0 && (d[o][3] = 1, r.from && (d._rgba = r.from(d[o]))); | |
}), this) : void 0; | |
}, | |
is: function(e) { | |
var t = l(e), n = !0, r = this; | |
return f(c, function(e, i) { | |
var o, s = t[i.cache]; | |
return s && (o = r[i.cache] || i.to && i.to(r._rgba) || [], f(i.props, function(e, t) { | |
return null != s[t.idx] ? n = s[t.idx] === o[t.idx] : void 0; | |
})), n; | |
}), n; | |
}, | |
_space: function() { | |
var e = [], t = this; | |
return f(c, function(n, r) { | |
t[r.cache] && e.push(n); | |
}), e.pop(); | |
}, | |
transition: function(e, t) { | |
var r = l(e), i = r._space(), o = c[i], s = 0 === this.alpha() ? l("transparent") : this, a = s[o.cache] || o.to(s._rgba), u = a.slice(); | |
return r = r[o.cache], f(o.props, function(e, i) { | |
var o = i.idx, s = a[o], l = r[o], c = d[i.type] || {}; | |
null !== l && (null === s ? u[o] = l : (c.mod && (l - s > c.mod / 2 ? s += c.mod : s - l > c.mod / 2 && (s -= c.mod)), | |
u[o] = n((l - s) * t + s, i))); | |
}), this[i](u); | |
}, | |
blend: function(t) { | |
if (1 === this._rgba[3]) return this; | |
var n = this._rgba.slice(), r = n.pop(), i = l(t)._rgba; | |
return l(e.map(n, function(e, t) { | |
return (1 - r) * i[t] + r * e; | |
})); | |
}, | |
toRgbaString: function() { | |
var t = "rgba(", n = e.map(this._rgba, function(e, t) { | |
return null == e ? t > 2 ? 1 : 0 : e; | |
}); | |
return 1 === n[3] && (n.pop(), t = "rgb("), t + n.join() + ")"; | |
}, | |
toHslaString: function() { | |
var t = "hsla(", n = e.map(this.hsla(), function(e, t) { | |
return null == e && (e = t > 2 ? 1 : 0), t && 3 > t && (e = Math.round(100 * e) + "%"), | |
e; | |
}); | |
return 1 === n[3] && (n.pop(), t = "hsl("), t + n.join() + ")"; | |
}, | |
toHexString: function(t) { | |
var n = this._rgba.slice(), r = n.pop(); | |
return t && n.push(~~(255 * r)), "#" + e.map(n, function(e) { | |
return e = (e || 0).toString(16), 1 === e.length ? "0" + e : e; | |
}).join(""); | |
}, | |
toString: function() { | |
return 0 === this._rgba[3] ? "transparent" : this.toRgbaString(); | |
} | |
}), l.fn.parse.prototype = l.fn, c.hsla.to = function(e) { | |
if (null == e[0] || null == e[1] || null == e[2]) return [ null, null, null, e[3] ]; | |
var t, n, r = e[0] / 255, i = e[1] / 255, o = e[2] / 255, s = e[3], a = Math.max(r, i, o), u = Math.min(r, i, o), l = a - u, c = a + u, d = .5 * c; | |
return t = u === a ? 0 : r === a ? 60 * (i - o) / l + 360 : i === a ? 60 * (o - r) / l + 120 : 60 * (r - i) / l + 240, | |
n = 0 === l ? 0 : .5 >= d ? l / c : l / (2 - c), [ Math.round(t) % 360, n, d, null == s ? 1 : s ]; | |
}, c.hsla.from = function(e) { | |
if (null == e[0] || null == e[1] || null == e[2]) return [ null, null, null, e[3] ]; | |
var t = e[0] / 360, n = e[1], r = e[2], o = e[3], s = .5 >= r ? r * (1 + n) : r + n - r * n, a = 2 * r - s; | |
return [ Math.round(255 * i(a, s, t + 1 / 3)), Math.round(255 * i(a, s, t)), Math.round(255 * i(a, s, t - 1 / 3)), o ]; | |
}, f(c, function(r, i) { | |
var o = i.props, s = i.cache, u = i.to, c = i.from; | |
l.fn[r] = function(r) { | |
if (u && !this[s] && (this[s] = u(this._rgba)), r === t) return this[s].slice(); | |
var i, a = e.type(r), d = "array" === a || "object" === a ? r : arguments, p = this[s].slice(); | |
return f(o, function(e, t) { | |
var r = d["object" === a ? e : t.idx]; | |
null == r && (r = p[t.idx]), p[t.idx] = n(r, t); | |
}), c ? (i = l(c(p)), i[s] = p, i) : l(p); | |
}, f(o, function(t, n) { | |
l.fn[t] || (l.fn[t] = function(i) { | |
var o, s = e.type(i), u = "alpha" === t ? this._hsla ? "hsla" : "rgba" : r, l = this[u](), c = l[n.idx]; | |
return "undefined" === s ? c : ("function" === s && (i = i.call(this, c), s = e.type(i)), | |
null == i && n.empty ? this : ("string" === s && (o = a.exec(i), o && (i = c + parseFloat(o[2]) * ("+" === o[1] ? 1 : -1))), | |
l[n.idx] = i, this[u](l))); | |
}); | |
}); | |
}), l.hook = function(t) { | |
var n = t.split(" "); | |
f(n, function(t, n) { | |
e.cssHooks[n] = { | |
set: function(t, i) { | |
var o, s, a = ""; | |
if ("transparent" !== i && ("string" !== e.type(i) || (o = r(i)))) { | |
if (i = l(o || i), !p.rgba && 1 !== i._rgba[3]) { | |
for (s = "backgroundColor" === n ? t.parentNode : t; ("" === a || "transparent" === a) && s && s.style; ) try { | |
a = e.css(s, "backgroundColor"), s = s.parentNode; | |
} catch (u) {} | |
i = i.blend(a && "transparent" !== a ? a : "_default"); | |
} | |
i = i.toRgbaString(); | |
} | |
try { | |
t.style[n] = i; | |
} catch (u) {} | |
} | |
}, e.fx.step[n] = function(t) { | |
t.colorInit || (t.start = l(t.elem, n), t.end = l(t.end), t.colorInit = !0), e.cssHooks[n].set(t.elem, t.start.transition(t.end, t.pos)); | |
}; | |
}); | |
}, l.hook(s), e.cssHooks.borderColor = { | |
expand: function(e) { | |
var t = {}; | |
return f([ "Top", "Right", "Bottom", "Left" ], function(n, r) { | |
t["border" + r + "Color"] = e; | |
}), t; | |
} | |
}, o = e.Color.names = { | |
aqua: "#00ffff", | |
black: "#000000", | |
blue: "#0000ff", | |
fuchsia: "#ff00ff", | |
gray: "#808080", | |
green: "#008000", | |
lime: "#00ff00", | |
maroon: "#800000", | |
navy: "#000080", | |
olive: "#808000", | |
purple: "#800080", | |
red: "#ff0000", | |
silver: "#c0c0c0", | |
teal: "#008080", | |
white: "#ffffff", | |
yellow: "#ffff00", | |
transparent: [ null, null, null, 0 ], | |
_default: "#ffffff" | |
}; | |
}(jQuery), function() { | |
function n(t) { | |
var n, r, i = t.ownerDocument.defaultView ? t.ownerDocument.defaultView.getComputedStyle(t, null) : t.currentStyle, o = {}; | |
if (i && i.length && i[0] && i[i[0]]) for (r = i.length; r--; ) n = i[r], "string" == typeof i[n] && (o[e.camelCase(n)] = i[n]); else for (n in i) "string" == typeof i[n] && (o[n] = i[n]); | |
return o; | |
} | |
function r(t, n) { | |
var r, i, s = {}; | |
for (r in n) i = n[r], t[r] !== i && (o[r] || (e.fx.step[r] || !isNaN(parseFloat(i))) && (s[r] = i)); | |
return s; | |
} | |
var i = [ "add", "remove", "toggle" ], o = { | |
border: 1, | |
borderBottom: 1, | |
borderColor: 1, | |
borderLeft: 1, | |
borderRight: 1, | |
borderTop: 1, | |
borderWidth: 1, | |
margin: 1, | |
padding: 1 | |
}; | |
e.each([ "borderLeftStyle", "borderRightStyle", "borderBottomStyle", "borderTopStyle" ], function(t, n) { | |
e.fx.step[n] = function(e) { | |
("none" !== e.end && !e.setAttr || 1 === e.pos && !e.setAttr) && (jQuery.style(e.elem, n, e.end), | |
e.setAttr = !0); | |
}; | |
}), e.fn.addBack || (e.fn.addBack = function(e) { | |
return this.add(null == e ? this.prevObject : this.prevObject.filter(e)); | |
}), e.effects.animateClass = function(t, o, s, a) { | |
var u = e.speed(o, s, a); | |
return this.queue(function() { | |
var o, s = e(this), a = s.attr("class") || "", l = u.children ? s.find("*").addBack() : s; | |
l = l.map(function() { | |
var t = e(this); | |
return { | |
el: t, | |
start: n(this) | |
}; | |
}), o = function() { | |
e.each(i, function(e, n) { | |
t[n] && s[n + "Class"](t[n]); | |
}); | |
}, o(), l = l.map(function() { | |
return this.end = n(this.el[0]), this.diff = r(this.start, this.end), this; | |
}), s.attr("class", a), l = l.map(function() { | |
var t = this, n = e.Deferred(), r = e.extend({}, u, { | |
queue: !1, | |
complete: function() { | |
n.resolve(t); | |
} | |
}); | |
return this.el.animate(this.diff, r), n.promise(); | |
}), e.when.apply(e, l.get()).done(function() { | |
o(), e.each(arguments, function() { | |
var t = this.el; | |
e.each(this.diff, function(e) { | |
t.css(e, ""); | |
}); | |
}), u.complete.call(s[0]); | |
}); | |
}); | |
}, e.fn.extend({ | |
addClass: function(t) { | |
return function(n, r, i, o) { | |
return r ? e.effects.animateClass.call(this, { | |
add: n | |
}, r, i, o) : t.apply(this, arguments); | |
}; | |
}(e.fn.addClass), | |
removeClass: function(t) { | |
return function(n, r, i, o) { | |
return arguments.length > 1 ? e.effects.animateClass.call(this, { | |
remove: n | |
}, r, i, o) : t.apply(this, arguments); | |
}; | |
}(e.fn.removeClass), | |
toggleClass: function(n) { | |
return function(r, i, o, s, a) { | |
return "boolean" == typeof i || i === t ? o ? e.effects.animateClass.call(this, i ? { | |
add: r | |
} : { | |
remove: r | |
}, o, s, a) : n.apply(this, arguments) : e.effects.animateClass.call(this, { | |
toggle: r | |
}, i, o, s); | |
}; | |
}(e.fn.toggleClass), | |
switchClass: function(t, n, r, i, o) { | |
return e.effects.animateClass.call(this, { | |
add: n, | |
remove: t | |
}, r, i, o); | |
} | |
}); | |
}(), function() { | |
function r(t, n, r, i) { | |
return e.isPlainObject(t) && (n = t, t = t.effect), t = { | |
effect: t | |
}, null == n && (n = {}), e.isFunction(n) && (i = n, r = null, n = {}), ("number" == typeof n || e.fx.speeds[n]) && (i = r, | |
r = n, n = {}), e.isFunction(r) && (i = r, r = null), n && e.extend(t, n), r = r || n.duration, | |
t.duration = e.fx.off ? 0 : "number" == typeof r ? r : r in e.fx.speeds ? e.fx.speeds[r] : e.fx.speeds._default, | |
t.complete = i || n.complete, t; | |
} | |
function i(t) { | |
return !t || "number" == typeof t || e.fx.speeds[t] ? !0 : "string" != typeof t || e.effects.effect[t] ? e.isFunction(t) ? !0 : "object" != typeof t || t.effect ? !1 : !0 : !0; | |
} | |
e.extend(e.effects, { | |
version: "1.10.3", | |
save: function(e, t) { | |
for (var r = 0; r < t.length; r++) null !== t[r] && e.data(n + t[r], e[0].style[t[r]]); | |
}, | |
restore: function(e, r) { | |
var i, o; | |
for (o = 0; o < r.length; o++) null !== r[o] && (i = e.data(n + r[o]), i === t && (i = ""), | |
e.css(r[o], i)); | |
}, | |
setMode: function(e, t) { | |
return "toggle" === t && (t = e.is(":hidden") ? "show" : "hide"), t; | |
}, | |
getBaseline: function(e, t) { | |
var n, r; | |
switch (e[0]) { | |
case "top": | |
n = 0; | |
break; | |
case "middle": | |
n = .5; | |
break; | |
case "bottom": | |
n = 1; | |
break; | |
default: | |
n = e[0] / t.height; | |
} | |
switch (e[1]) { | |
case "left": | |
r = 0; | |
break; | |
case "center": | |
r = .5; | |
break; | |
case "right": | |
r = 1; | |
break; | |
default: | |
r = e[1] / t.width; | |
} | |
return { | |
x: r, | |
y: n | |
}; | |
}, | |
createWrapper: function(t) { | |
if (t.parent().is(".ui-effects-wrapper")) return t.parent(); | |
var n = { | |
width: t.outerWidth(!0), | |
height: t.outerHeight(!0), | |
"float": t.css("float") | |
}, r = e("<div></div>").addClass("ui-effects-wrapper").css({ | |
fontSize: "100%", | |
background: "transparent", | |
border: "none", | |
margin: 0, | |
padding: 0 | |
}), i = { | |
width: t.width(), | |
height: t.height() | |
}, o = document.activeElement; | |
try { | |
o.id; | |
} catch (s) { | |
o = document.body; | |
} | |
return t.wrap(r), (t[0] === o || e.contains(t[0], o)) && e(o).focus(), r = t.parent(), | |
"static" === t.css("position") ? (r.css({ | |
position: "relative" | |
}), t.css({ | |
position: "relative" | |
})) : (e.extend(n, { | |
position: t.css("position"), | |
zIndex: t.css("z-index") | |
}), e.each([ "top", "left", "bottom", "right" ], function(e, r) { | |
n[r] = t.css(r), isNaN(parseInt(n[r], 10)) && (n[r] = "auto"); | |
}), t.css({ | |
position: "relative", | |
top: 0, | |
left: 0, | |
right: "auto", | |
bottom: "auto" | |
})), t.css(i), r.css(n).show(); | |
}, | |
removeWrapper: function(t) { | |
var n = document.activeElement; | |
return t.parent().is(".ui-effects-wrapper") && (t.parent().replaceWith(t), (t[0] === n || e.contains(t[0], n)) && e(n).focus()), | |
t; | |
}, | |
setTransition: function(t, n, r, i) { | |
return i = i || {}, e.each(n, function(e, n) { | |
var o = t.cssUnit(n); | |
o[0] > 0 && (i[n] = o[0] * r + o[1]); | |
}), i; | |
} | |
}), e.fn.extend({ | |
effect: function() { | |
function t(t) { | |
function r() { | |
e.isFunction(o) && o.call(i[0]), e.isFunction(t) && t(); | |
} | |
var i = e(this), o = n.complete, a = n.mode; | |
(i.is(":hidden") ? "hide" === a : "show" === a) ? (i[a](), r()) : s.call(i[0], n, r); | |
} | |
var n = r.apply(this, arguments), i = n.mode, o = n.queue, s = e.effects.effect[n.effect]; | |
return e.fx.off || !s ? i ? this[i](n.duration, n.complete) : this.each(function() { | |
n.complete && n.complete.call(this); | |
}) : o === !1 ? this.each(t) : this.queue(o || "fx", t); | |
}, | |
show: function(e) { | |
return function(t) { | |
if (i(t)) return e.apply(this, arguments); | |
var n = r.apply(this, arguments); | |
return n.mode = "show", this.effect.call(this, n); | |
}; | |
}(e.fn.show), | |
hide: function(e) { | |
return function(t) { | |
if (i(t)) return e.apply(this, arguments); | |
var n = r.apply(this, arguments); | |
return n.mode = "hide", this.effect.call(this, n); | |
}; | |
}(e.fn.hide), | |
toggle: function(e) { | |
return function(t) { | |
if (i(t) || "boolean" == typeof t) return e.apply(this, arguments); | |
var n = r.apply(this, arguments); | |
return n.mode = "toggle", this.effect.call(this, n); | |
}; | |
}(e.fn.toggle), | |
cssUnit: function(t) { | |
var n = this.css(t), r = []; | |
return e.each([ "em", "px", "%", "pt" ], function(e, t) { | |
n.indexOf(t) > 0 && (r = [ parseFloat(n), t ]); | |
}), r; | |
} | |
}); | |
}(), function() { | |
var t = {}; | |
e.each([ "Quad", "Cubic", "Quart", "Quint", "Expo" ], function(e, n) { | |
t[n] = function(t) { | |
return Math.pow(t, e + 2); | |
}; | |
}), e.extend(t, { | |
Sine: function(e) { | |
return 1 - Math.cos(e * Math.PI / 2); | |
}, | |
Circ: function(e) { | |
return 1 - Math.sqrt(1 - e * e); | |
}, | |
Elastic: function(e) { | |
return 0 === e || 1 === e ? e : -Math.pow(2, 8 * (e - 1)) * Math.sin((80 * (e - 1) - 7.5) * Math.PI / 15); | |
}, | |
Back: function(e) { | |
return e * e * (3 * e - 2); | |
}, | |
Bounce: function(e) { | |
for (var t, n = 4; e < ((t = Math.pow(2, --n)) - 1) / 11; ) ; | |
return 1 / Math.pow(4, 3 - n) - 7.5625 * Math.pow((3 * t - 2) / 22 - e, 2); | |
} | |
}), e.each(t, function(t, n) { | |
e.easing["easeIn" + t] = n, e.easing["easeOut" + t] = function(e) { | |
return 1 - n(1 - e); | |
}, e.easing["easeInOut" + t] = function(e) { | |
return .5 > e ? n(2 * e) / 2 : 1 - n(-2 * e + 2) / 2; | |
}; | |
}); | |
}(); | |
}(jQuery), define("jquery-ui-effect", [ "jquery" ], function() {}), function() { | |
var e = function(e, t) { | |
return function() { | |
return e.apply(t, arguments); | |
}; | |
}, t = {}.hasOwnProperty, n = function(e, n) { | |
function r() { | |
this.constructor = e; | |
} | |
for (var i in n) t.call(n, i) && (e[i] = n[i]); | |
return r.prototype = n.prototype, e.prototype = new r(), e.__super__ = n.prototype, | |
e; | |
}; | |
define("edition-app/views/article-river.view", [ "require", "exports", "module", "views/base.view", "edition-app/views/section.view", "route-mediator", "utils/device", "jquery", "underscore", "logger", "jquery-ui-effect" ], function(t, r, i) { | |
var o, s, a, u, l, c, d, p, h; | |
return u = t("views/base.view"), s = t("edition-app/views/section.view"), d = t("route-mediator"), | |
l = t("utils/device"), o = t("jquery"), p = t("underscore"), c = t("logger"), t("jquery-ui-effect"), | |
i.exports = a = function(t) { | |
function r() { | |
return this.catchScrolling = e(this.catchScrolling, this), this.onRouteChanged = e(this.onRouteChanged, this), | |
this.fireViewportChanged = e(this.fireViewportChanged, this), this.showArticle = e(this.showArticle, this), | |
this.windowResize = e(this.windowResize, this), h = r.__super__.constructor.apply(this, arguments); | |
} | |
return n(r, t), r.prototype.initialize = function() { | |
return this.riverHeight = this.$el.height(), this.listenTo(d, "change", this.onRouteChanged), | |
this.windowResize(); | |
}, r.prototype.windowResize = function() { | |
return this.trigger("windowResized"); | |
}, r.prototype.didRender = function() { | |
return this.$window.on("resize", this.windowResize), this._isScrolling || this.$window.on("scroll resize", this.fireViewportChanged), | |
this.$window.on("keydown", this.catchScrolling); | |
}, r.prototype.stopVideos = function() { | |
var e; | |
return null != (e = this.currentView) ? e.stopVideos() : void 0; | |
}, r.prototype.showArticle = function(e) { | |
var t, n, r, i = this; | |
return this.currentView && this.currentView.collection === e.collection ? (r = this.currentView.getViewById(e.id), | |
this.currentView.setFocusedView(r), setTimeout(function() { | |
return i.scrollTo(r, !0); | |
}, 0)) : (n = !this.currentView, this.destroyViews(), this.currentView = new s({ | |
collection: e.collection, | |
river: this, | |
edition: this.model | |
}), this.$el.empty(), t = o('<div id="river-loading-spinner" class="loading-spinner">Loading...</div>').appendTo("#app"), | |
this.listenToOnce(this.currentView, "rendered", function() { | |
return r = i.currentView.getViewById(e.id), n && d.routeToArticle(e, { | |
name: "change:section:article", | |
navigationMethod: "start" | |
}), i.currentView.setFocusedView(r), i.$el.html(i.currentView.el), t.remove(), setTimeout(function() { | |
return i.scrollTo(r, !1), i.fireViewportChanged(); | |
}, 0); | |
}), this.currentView.render()); | |
}, r.prototype.fireViewportChanged = function() { | |
var e = this; | |
return c.trace("fireViewportChanged()"), (null != this._fireVpChangedThrottle ? this._fireVpChangedThrottle : this._fireVpChangedThrottle = p.throttle(function() { | |
return e.trigger("viewportChanged", window); | |
}, 100))(); | |
}, r.prototype.onRouteChanged = function(e) { | |
var t; | |
return c.log("Route has changed to: ", e), t = this.currentView.getViewById(e.id), | |
t ? this.scrollTo(t, !0) : this.showArticle(e); | |
}, r.prototype.scrollTo = function(e, t) { | |
var n, r, i, s, a, u, c, d = this; | |
if (!e) throw new TypeError("Expected a view to be passed in"); | |
if (i = this.currentView.getViewPosition(e) + 1, !Modernizr.touch) { | |
if (s = this.currentView.views.indexOf(e), s > -1) for (r = a = 0; s > a; r = a += 1) null != (u = this.currentView.views[r].$el) && u.addClass("active immediate-transition"); | |
null != (c = e.$el) && c.addClass("active immediate-transition"); | |
} | |
return this.$window.off("scroll resize", this.fireViewportChanged), t && !l.iOSDevice ? (n = this.$window.scrollTop(), | |
i - n > 1e3 ? this.$window.scrollTop(i - 1e3) : -1e3 > i - n && this.$window.scrollTop(i + 1e3), | |
this._isScrolling = !0, o("html,body").animate({ | |
scrollTop: i | |
}, 500, "easeOutCubic", function() { | |
return d.$window.on("scroll resize", d.fireViewportChanged), d.fireViewportChanged(), | |
d._isScrolling = !1; | |
})) : (this.$window.scrollTop(i - 1), this.$window.scrollTop(i), this.$window.on("scroll resize", this.fireViewportChanged), | |
this.fireViewportChanged()); | |
}, r.prototype.height = function() { | |
return this.$el.offset().top + this.$el.outerHeight(); | |
}, r.prototype.destroyViews = function() { | |
return this.currentView && (this.currentView.destroy(), this.currentView = null), | |
this.windowResize(); | |
}, r.prototype.destroy = function() { | |
return this.$window.off("resize", this.windowResize), this.$window.off("scroll resize", this.fireViewportChanged), | |
this.$window.off("keydown", this.catchScrolling), this.destroyViews(), r.__super__.destroy.apply(this, arguments); | |
}, r.prototype.catchScrolling = function(e) { | |
var t, n, r, i = this; | |
return 32 !== (r = e.keyCode) && 33 !== r && 34 !== r ? console.log("no key") : (e.preventDefault(), | |
e.stopPropagation(), t = 34 === e.keyCode || 32 === e.keyCode && !e.shiftKey ? 1 : -1, | |
n = o(window).scrollTop() + t * (o(window).height() - 55), this.isAnimating && o("html,body").stop(), | |
this.isAnimating = !0, o("html,body").animate({ | |
scrollTop: n | |
}, 200, function() { | |
return i.isAnimating = !1; | |
})); | |
}, r; | |
}(u); | |
}); | |
}.call(this), function() { | |
var e = {}.hasOwnProperty, t = function(t, n) { | |
function r() { | |
this.constructor = t; | |
} | |
for (var i in n) e.call(n, i) && (t[i] = n[i]); | |
return r.prototype = n.prototype, t.prototype = new r(), t.__super__ = n.prototype, | |
t; | |
}; | |
define("edition-app/views/edition-date.view", [ "require", "exports", "module", "views/base.view" ], function(e, n, r) { | |
var i, o, s; | |
return i = e("views/base.view"), r.exports = o = function(e) { | |
function n() { | |
return s = n.__super__.constructor.apply(this, arguments); | |
} | |
return t(n, e), n.prototype.tmpl = '<div class="edition-date"><span class="day-name"><%= dayOfWeek %>, </span><%= simpleDate %></div><div class="icon"></div>', | |
n.prototype.events = { | |
click: "openModal" | |
}, n.prototype.openModal = function() { | |
return this.trigger("dateclick", this); | |
}, n; | |
}(i); | |
}); | |
}.call(this), define("text!core-app/tmpl/settings-menu.html", [], function() { | |
return '<div class="flyout-blanket"></div>\n<div class="flyout" id="settings-menu">\n <div class="pointer"></div>\n <section>\n <h2>Account</h2>\n <div class="button">Log Out</div>\n </section>\n <section class="fontsize">\n <h2>Type Size</h2>\n <ol>\n <li class="x-small"><span>A</span></li>\n <li class="small"><span>A</span></li>\n <li class="medium"><span>A</span></li>\n <li class="large"><span>A</span></li>\n </ol>\n </section>\n <section class="support">\n <h2>Support</h2>\n <ul>\n <li><a class="external-link" href="http://www.nytimes.com/content/help/mobile/todays-paper/todays-paper.html" target="_blank">FAQ</a></li>\n <li><a class="feedback-link external-link" href="mailto:[email protected]" target="_blank">Send Feedback</a></li>\n <li><a class="external-link" href="http://www.nytimes.com/content/help/rights/terms/terms-of-service.html" target="_blank">Terms of Service</a></li>\n <li><a class="external-link" href="http://www.nytimes.com/content/help/rights/privacy/policy/privacy-policy.html" target="_blank">Privacy Policy</a></li>\n <li><div class="nonlink">Application Version <span class="version"><%= appVersion %></span></div></li>\n </ul>\n </section>\n <section>\n <h2>About</h2>\n <p>Today\'s Paper is a digital version of the daily printed New York Times. Visit <a class="external-link" href="http://www.nytimes.com" target="_blank">NYTimes.com</a> for updates.</p>\n </section>\n</div>\n'; | |
}), function() { | |
var e = {}.hasOwnProperty, t = function(t, n) { | |
function r() { | |
this.constructor = t; | |
} | |
for (var i in n) e.call(n, i) && (t[i] = n[i]); | |
return r.prototype = n.prototype, t.prototype = new r(), t.__super__ = n.prototype, | |
t; | |
}; | |
define("core-app/views/settings-menu.view", [ "require", "exports", "module", "views/base.view", "text!core-app/tmpl/settings-menu.html", "models/base.model", "config" ], function(e, n, r) { | |
var i, o, s, a, u, l; | |
return o = e("views/base.view"), u = e("text!core-app/tmpl/settings-menu.html"), | |
i = e("models/base.model"), a = e("config"), r.exports = s = function(e) { | |
function n() { | |
return l = n.__super__.constructor.apply(this, arguments); | |
} | |
return t(n, e), n.prototype.tmpl = u, n.prototype.ui = { | |
$button: ".button", | |
$pointer: ".pointer", | |
$feedbackLink: ".feedback-link" | |
}, n.prototype.events = { | |
"click .button": "logout", | |
"click .pointer": "pointerClick", | |
"click a.external-link": "externalLinkClick", | |
"click .flyout-blanket": "destroy" | |
}, n.prototype.initialize = function(e) { | |
return this.targetContainer = (null != e ? e : {}).targetContainer, this.model || (this.model = new i()), | |
this.appVersion = window.APP_VERSION, this.model.set("appVersion", this.appVersion); | |
}, n.prototype.pointerClick = function() { | |
return this.destroy(); | |
}, n.prototype.didRender = function() { | |
return this.rendered = !0, this.$el.appendTo(this.targetContainer), this.$el.on("click", "section.fontsize li", this.adjustFontSize), | |
this.updateFeedbackLink(); | |
}, n.prototype.updateFeedbackLink = function() { | |
var e, t, n, r; | |
return t = document.cookie.indexOf("NYT-S=") > -1 ? "Yes" : "No", r = "NYT Today's Paper Feedback", | |
e = "?subject=" + encodeURIComponent(r) + "&body=" + encodeURIComponent("\n\n\n\n\n------------------------------\n\n" + ("User Agent: " + navigator.userAgent + "\n") + ("URL: " + document.location.href + "\n") + ("Application Version: " + this.appVersion + "\n") + ("Referring URL: " + document.referrer + "\n") + ("Logged in: " + t + "\n") + "* If you're reporting technical issues, the above information about your device is very useful to us. But feel free to delete it, if you like."), | |
n = "[email protected]", this.ui.$feedbackLink.attr("href", "mailto:" + n + e); | |
}, n.prototype.externalLinkClick = function() { | |
return this.destroy(); | |
}, n.prototype.adjustFontSize = function() { | |
var e, t; | |
return e = $(this), t = "small", e.hasClass("x-small") ? t = "x-small" : e.hasClass("medium") ? t = "medium" : e.hasClass("large") && (t = "large"), | |
window.localStorage.setItem("font-size", t), $("body").removeClass("font-x-small font-small font-medium font-large").addClass("font-" + t); | |
}, n.prototype.didDestroy = function() { | |
return this.rendered = !1; | |
}, n.prototype.logout = function() { | |
return APP.logout().ensure(function() { | |
return APP.router.navigate("", { | |
trigger: !1 | |
}), window.location.reload(!0); | |
}); | |
}, n; | |
}(o); | |
}); | |
}.call(this), function() { | |
var e = function(e, t) { | |
return function() { | |
return e.apply(t, arguments); | |
}; | |
}, t = {}.hasOwnProperty, n = function(e, n) { | |
function r() { | |
this.constructor = e; | |
} | |
for (var i in n) t.call(n, i) && (e[i] = n[i]); | |
return r.prototype = n.prototype, e.prototype = new r(), e.__super__ = n.prototype, | |
e; | |
}; | |
define("core-app/views/settings-icon.view", [ "require", "exports", "module", "views/base.view", "core-app/views/settings-menu.view" ], function(t, r, i) { | |
var o, s, a, u; | |
return o = t("views/base.view"), a = t("core-app/views/settings-menu.view"), i.exports = s = function(t) { | |
function r() { | |
return this.createSettingsMenu = e(this.createSettingsMenu, this), this.toggleSettingsMenu = e(this.toggleSettingsMenu, this), | |
u = r.__super__.constructor.apply(this, arguments); | |
} | |
return n(r, t), r.prototype.tmpl = '<div class="settings-button"></div><div class="settings-holder"></div>', | |
r.prototype.ui = { | |
$settingsButton: ".settings-button", | |
$settingsHolder: ".settings-holder" | |
}, r.prototype.events = { | |
"click .settings-button": "toggleSettingsMenu" | |
}, r.prototype.toggleSettingsMenu = function() { | |
var e, t; | |
return (null != (e = this.settingsMenu) ? e.rendered : void 0) && !(null != (t = this.settingsMenu) ? t.isDestroyed : void 0) ? this.settingsMenu.destroy() : this.createSettingsMenu(); | |
}, r.prototype.createSettingsMenu = function() { | |
return this.settingsMenu = new a({ | |
targetContainer: this.ui.$settingsHolder | |
}), this.settingsMenu.render(); | |
}, r; | |
}(o); | |
}); | |
}.call(this), define("text!core-app/tmpl/addToHomescreen.html", [], function() { | |
return '<div class="add-to-homescreen <%=className%>">\n <section>\n <div class="number">1.</div>\n <p>To add this to your home screen, tap the <span class="bookmark-icon"></span> button at the top left of the screen.</p>\n <div class="image navbar"></div>\n <p>Then press <strong>Add to Home Screen</strong></p>\n </section>\n <section>\n <div class="number">2.</div>\n <p>Access the app from your Home Screen for an optimal viewing experience.</p>\n <div class="image homescreen"></div>\n <div class="note">This will <strong>not replace</strong> the NYTimes app in your Newsstand.</div>\n </section>\n\n</div>\n\n'; | |
}), function() { | |
var e = {}.hasOwnProperty, t = function(t, n) { | |
function r() { | |
this.constructor = t; | |
} | |
for (var i in n) e.call(n, i) && (t[i] = n[i]); | |
return r.prototype = n.prototype, t.prototype = new r(), t.__super__ = n.prototype, | |
t; | |
}; | |
define("core-app/views/add-to-homescreen.view", [ "require", "exports", "module", "views/base.view", "models/base.model", "text!core-app/tmpl/addToHomescreen.html" ], function(e, n, r) { | |
var i, o, s, a, u; | |
return s = e("views/base.view"), o = e("models/base.model"), a = e("text!core-app/tmpl/addToHomescreen.html"), | |
r.exports = i = function(e) { | |
function n() { | |
return u = n.__super__.constructor.apply(this, arguments); | |
} | |
return t(n, e), n.prototype.tmpl = a, n.prototype.initialize = function(e) { | |
return this.className = (null != e ? e : {}).className, this.model = new o({ | |
className: this.className | |
}); | |
}, n; | |
}(s); | |
}); | |
}.call(this), define("text!tmpl/reset-app.html", [], function() { | |
return 'An error occured <br>\n<a href="/">Refresh</a> | <a href="/#reset">Clear Data</a>\n'; | |
}), Modernizr.addTest("csscalc", function() { | |
var e = "width:", t = "calc(10px);", n = document.createElement("div"); | |
return n.style.cssText = e + Modernizr._prefixes.join(t + e), !!n.style.length; | |
}), define("modernizrCssCalc", [ "modernizr" ], function(e) { | |
return function() { | |
var t; | |
return t || e.Modernizr; | |
}; | |
}(this)), function() { | |
var e = {}.hasOwnProperty, t = function(t, n) { | |
function r() { | |
this.constructor = t; | |
} | |
for (var i in n) e.call(n, i) && (t[i] = n[i]); | |
return r.prototype = n.prototype, t.prototype = new r(), t.__super__ = n.prototype, | |
t; | |
}; | |
define("core-app/views/core-layout.view", [ "require", "exports", "module", "views/layout.view", "text!core-app/tmpl/layout.html", "edition-app/views/accordion.view", "edition-app/views/article-river.view", "edition-app/views/edition-date.view", "core-app/views/settings-icon.view", "views/modal.view", "core-app/views/add-to-homescreen.view", "edition-app/views/article.view", "utils/device", "text!tmpl/reset-app.html", "modernizrCssCalc" ], function(e, n) { | |
var r, i, o, s, a, u, l, c, d, p, h, f, m; | |
return d = e("views/layout.view"), c = e("text!core-app/tmpl/layout.html"), r = e("edition-app/views/accordion.view"), | |
o = e("edition-app/views/article-river.view"), l = e("edition-app/views/edition-date.view"), | |
h = e("core-app/views/settings-icon.view"), p = e("views/modal.view"), i = e("core-app/views/add-to-homescreen.view"), | |
s = e("edition-app/views/article.view"), u = e("utils/device"), f = e("text!tmpl/reset-app.html"), | |
e("modernizrCssCalc"), n.exports = a = function(e) { | |
function n() { | |
return m = n.__super__.constructor.apply(this, arguments); | |
} | |
return t(n, e), n.prototype.tmpl = c, n.prototype.id = "edition-layout", n.prototype.ui = { | |
$editionSelector: "#edition-selector-button", | |
$accordion: "#accordion", | |
$accordionHolder: "#accordion-scroller", | |
$articleRiver: "#article-river", | |
$settingsHolder: ".settings" | |
}, n.prototype.willRender = function() { | |
return this.model ? void 0 : new Error("Expected a model to be set"); | |
}, n.prototype.didRender = function() { | |
var e, t, n, i, s, a = this; | |
return null != (t = this.editionDateView) && t.destroy(), this.editionDateView = new l({ | |
el: this.ui.$editionSelector[0], | |
model: this.model | |
}), null != (n = this.settingsIconView) && n.destroy(), this.settingsIconView = new h({ | |
el: this.ui.$settingsHolder[0] | |
}), null != (i = this.accordionView) && i.destroy(), this.accordionView = new r({ | |
holder: this.ui.$accordionHolder[0], | |
el: this.ui.$accordion[0], | |
collection: this.model.sections.filter(function(e) { | |
return e.get("articles").length > 0; | |
}) | |
}), null != (s = this.articleRiverView) && s.destroy(), this.articleRiverView = new o({ | |
el: this.ui.$articleRiver[0], | |
model: this.model | |
}), this.listenTo(this.articleRiverView, "didrender", function() { | |
return a.checkForHomescreen(); | |
}), this.listenTo(this.editionDateView, "dateclick", function() { | |
return this.trigger("editionDateClick", this.model.id); | |
}), this.editionDateView.render(), this.settingsIconView.render(), this.accordionView.render(), | |
this.articleRiverView.render(), !u.iPadiOS7 || u.isStandalone || u.Chrome || this.$el.addClass("iPadiOS7"), | |
u.MSWindows && $("html").addClass("ms-windows"), u.iOSDevice && u.isStandalone && $(window).on("resize", function() { | |
return setTimeout(function() { | |
return window.scrollBy(0, 0); | |
}, 0); | |
}), e = window.localStorage.getItem("font-size") || "small", $("body").addClass("font-" + e), | |
this.checkForHomescreen(); | |
}, n.prototype.checkForHomescreen = function() { | |
var e, t, n; | |
if (!u.isStandalone && u.iOSDevice && u.Safari) return t = parseInt(null != (n = localStorage.homescreenModalViewed) ? n : 0), | |
3 > t ? (e = u.iPadiOS7 ? "iOS7" : "iOS6", this.addToHomescreen = new i({ | |
className: e | |
}), this.homescreenModal = new p({ | |
nestView: this.addToHomescreen, | |
className: "alert homescreen" | |
}), this.homescreenModal.render(), localStorage.homescreenModalViewed = t + 1) : void 0; | |
}, n.prototype.hideDateView = function() { | |
return this.editionDateView ? $(this.editionDateView.el).hide() : void 0; | |
}, n.prototype.showDateView = function() { | |
return this.editionDateView ? $(this.editionDateView.el).show() : void 0; | |
}, n.prototype.stopVideos = function() { | |
var e; | |
return null != (e = this.articleRiverView) ? e.stopVideos() : void 0; | |
}, n.prototype.showArticle = function(e) { | |
return assert(null != e, "Expected an article to be passed in"), this.articleRiverView.showArticle(e), | |
this.accordionView.setLinkScrollFocus(e, 0); | |
}, n.prototype.showResetApp = function() { | |
return this.$body.empty(), this.$el.appendTo(document.body), this.$el.empty().html(f); | |
}, n.prototype.destroy = function() { | |
return this.editionDateView.destroy(), this.settingsIconView.destroy(), this.accordionView.destroy(), | |
this.articleRiverView.destroy(), n.__super__.destroy.apply(this, arguments); | |
}, n; | |
}(d); | |
}); | |
}.call(this), define("text!core-app/tmpl/login-screen.html", [], function() { | |
return '<div id="login">\n <header>\n <!-- div class="sponsor">\n <span class="presenting">Sponsored By</span>\n <img class="sponsorlogo" src="/images/ads/sponsor.png" />\n </div-->\n <div class="container">\n <div class="title">\n <h1><img src="images/full-images/NYTLogoLarge.png" alt="The New York Times" class="logo" wi> <span class="webapp">Today’s Paper<span></h1>\n <p class="subtitle">\n View all the articles from the printed Times, organized just as they are in the newspaper.\n </p>\n </div>\n </div>\n </header>\n\n <section>\n <div class="container">\n <div class="center">\n <div class="features">\n <div class="feature-img-div"></div>\n </div>\n <div class="login-right-side">\n <% if (wasUnentitled) { %>\n <div class="entitilement-fail"><a href="http://www.nytimes.com/content/help/mobile/web-app/web-app.html" target="_blank">Your subscription package doesn’t include Today’s Paper. More Information»</a></div>\n <% } %>\n <div class="login-form">\n <iframe name="newLogin" id="newLogin" src="https://myaccount.nytimes.com/mobile/login/iframe/index.html?EXIT_URI=<%=encodeURIComponent(exitURI)%>"></iframe>\n </div>\n\n </div>\n </div>\n </div>\n\n </section>\n\n <footer>\n <div class="container">\n <p>\n The NYTimes Today\'s Paper App is available exclusively to NYTimes.com and Home Delivery subscribers. Not a subscriber? <a href=\'http://www.nytimes.com/subscriptions/Multiproduct/lp5558.html?campaignId=3LR84\' class="subscribe-link">Subscribe now.</a>\n </p>\n <ul>\n <li><a href="http://www.nytimes.com/content/help/mobile/todays-paper/todays-paper.html" target="_blank">FAQ</a></li>\n <li><a href="http://www.nytimes.com/content/help/rights/terms/terms-of-service.html" target="_blank">Terms of Service</a></li>\n <li><a href="http://www.nytimes.com/content/help/rights/privacy/highlights/privacy-highlights.html" target="_blank">Privacy Policy</a></li>\n <li class="copyright">©2013 The New York Times Company</li>\n </ul>\n </div>\n </footer>\n</div>\n\n'; | |
}), function() { | |
var e = {}.hasOwnProperty, t = function(t, n) { | |
function r() { | |
this.constructor = t; | |
} | |
for (var i in n) e.call(n, i) && (t[i] = n[i]); | |
return r.prototype = n.prototype, t.prototype = new r(), t.__super__ = n.prototype, | |
t; | |
}; | |
define("core-app/views/login-screen.view", [ "require", "exports", "module", "views/layout.view", "text!core-app/tmpl/login-screen.html", "views/alert.view", "views/modal.view", "utils/device" ], function(e, n, r) { | |
var i, o, s, a, u, l, c; | |
return s = e("views/layout.view"), u = e("text!core-app/tmpl/login-screen.html"), | |
i = e("views/alert.view"), l = e("views/modal.view"), o = e("utils/device"), r.exports = a = function(e) { | |
function n() { | |
return c = n.__super__.constructor.apply(this, arguments); | |
} | |
return t(n, e), n.prototype.tmpl = u, n.prototype.className = "login-screen", n.prototype.iosErrorMessage = "Sorry, your browser is not supported — to log in or install this app, we recommend\nyou use your native Safari browser. For more details on\nsupported devices and browsers, please visit our FAQ (<a\nhref='http://www.nytimes.com/content/help/mobile/todays-paper/todays-paper.html'>www.nytimes.com/content/help/mobile/todays-paper/todays-paper.html</a>)", | |
n.prototype.androidErrorMessage = "Your browser is not supported – to log in or install this app, we recommend you download the\nlatest version of Chrome. For more details on supported devices and browsers, please visit our\nFAQ (<a href='http://www.nytimes.com/content/help/mobile/todays-paper/todays-paper.html'>\nwww.nytimes.com/content/help/mobile/todays-paper/todays-paper.html</a>)", | |
n.prototype.ieErrorMessage = "Your browser is not supported – to log in or install this app, we recommend you use Safari\nif you are on a Mac and Chrome if you are on a PC. For more details on supported devices\nand browsers, please visit our FAQ (<a\nhref='http://www.nytimes.com/content/help/mobile/todays-paper/todays-paper.html'>www.nytimes.com/content/help/mobile/todays-paper/todays-paper.html</a>)", | |
n.prototype.universalErrorMessage = "Sorry your device and/or browser is not supported – to log in or install this app, we recommend the following:\n<ul>\n<li>Safari or Chrome for iPad users</li>\n<li>Chrome for Android tablet users</li>\n<li>IE for Windows Surface users</li>\n<li>Chrome for PC and Mac desktop users</li>\n<li>Safari for Mac desktop users, and</li>\n<li>IE for PC.</li>\n</ul>\n", | |
n.prototype.silkErrorMessage = "Your browser is not supported. To access content found in the print edition of The New York Times,\nplease visit: <a href='http://www.nytimes.com/todayspaper/'>www.nytimes.com/todayspaper/</a> To see a full list of supported devices and browsers,\nvisit our FAQ: (<a href='http://www.nytimes.com/content/help/mobile/todays-paper/todays-paper.html'>www.nytimes.com/content/help/mobile/todays-paper/todays-paper.html</a>)\n", | |
n.prototype.didRender = function() { | |
var e, t; | |
if (o.Silk || o.Android && !o.Chrome || o.ie7 || o.ie8 || o.ie9) return o.Silk ? e = this.universalErrorMessage : o.Android && !o.Chrome && (e = this.androidErrorMessage), | |
e = o.Silk ? this.silkErrorMessage : this.ieErrorMessage, t = new i({ | |
alertModel: { | |
text: e, | |
buttons: [] | |
} | |
}), this.alertModal = new l({ | |
nestView: t, | |
className: "alert", | |
disallowClose: !0 | |
}), this.alertModal.render(); | |
}, n; | |
}(s); | |
}); | |
}.call(this), define("text!core-app/tmpl/edition-selector.html", [], function() { | |
return '<div class="loading-spinner">Loading....</div>\n<div class="settings"></div>\n<div class="carousel-prev"></div>\n<div class="carousel-next"></div>\n<div class="edition-selector-carousel carousel">\n <div class="frontpages carousel-items">\n </div>\n</div>\n\n'; | |
}), function() { | |
var e = {}.hasOwnProperty, t = function(t, n) { | |
function r() { | |
this.constructor = t; | |
} | |
for (var i in n) e.call(n, i) && (t[i] = n[i]); | |
return r.prototype = n.prototype, t.prototype = new r(), t.__super__ = n.prototype, | |
t; | |
}; | |
define("models/frontpage.model", [ "require", "exports", "module", "underscore", "models/storable.model", "utils/binary-ajax", "utils/local-kvs", "when", "utils/arraybuffer-helpers", "moment" ], function(e, n, r) { | |
var i, o, s, a, u, l, c, d, p; | |
return d = e("underscore"), u = e("models/storable.model"), o = e("utils/binary-ajax"), | |
a = e("utils/local-kvs"), l = e("when"), i = e("utils/arraybuffer-helpers"), c = e("moment"), | |
r.exports = s = function(e) { | |
function n() { | |
return p = n.__super__.constructor.apply(this, arguments); | |
} | |
return t(n, e), n.prototype._store = new a("frontpageimage_data"), n.prototype.defaults = function() { | |
return { | |
id: null, | |
region: null, | |
date: null, | |
year: null, | |
month: null, | |
day: null, | |
fpImageUrl: null, | |
imgSrcUrl: null, | |
friendlyDate: null, | |
today: null, | |
downloaded: !1, | |
loading: !1, | |
dayOfWeek: null | |
}; | |
}, n.sugarAttributes(), n.prototype.fetch = function() { | |
var e = this; | |
return n.__super__.fetch.apply(this, arguments).otherwise(function() { | |
return e.set("imgSrcUrl", e.fpImageUrl); | |
}); | |
}, n.prototype.initialize = function() { | |
return this.setFriendlyDate(); | |
}, n.prototype._getAjaxData = function() { | |
return o.ajax(this.fpImageUrl); | |
}, n.prototype._setModel = function(e) { | |
return this.imgSrcUrl && this._unsetModel(), this.set("imgSrcUrl", URL.createObjectURL(new Blob([ e.buffer ], { | |
type: e.contentType | |
}))), "development" === window.ENV ? (null != window.blobs ? window.blobs : window.blobs = {})[this.imgSrcUrl] = 1 : void 0; | |
}, n.prototype._unsetModel = function() { | |
return this.imgSrcUrl ? ("development" === window.ENV && delete (null != window.blobs ? window.blobs : window.blobs = {})[this.imgSrcUrl], | |
URL.revokeObjectURL(this.imgSrcUrl), this.unset("imgSrcUrl", { | |
silent: !0 | |
})) : void 0; | |
}, n.prototype.setFriendlyDate = function() { | |
return this.friendlyDate = c(this.date, "YYYY-MM-DD").format("dddd, MMMM D, YYYY"); | |
}, n; | |
}(u); | |
}); | |
}.call(this), function() { | |
var e = {}.hasOwnProperty, t = function(t, n) { | |
function r() { | |
this.constructor = t; | |
} | |
for (var i in n) e.call(n, i) && (t[i] = n[i]); | |
return r.prototype = n.prototype, t.prototype = new r(), t.__super__ = n.prototype, | |
t; | |
}; | |
define("models/edition-selector.model", [ "require", "exports", "module", "underscore", "utils/when-ajax", "models/storable.model", "models/base.model", "when", "utils/local-kvs", "utils/arraybuffer-helpers", "models/frontpage.model", "assert" ], function(e, n, r) { | |
var i, o, s, a, u, l, c, d, p, h, f, m, g; | |
return m = e("underscore"), d = e("utils/when-ajax"), l = e("models/storable.model"), | |
o = e("models/base.model"), c = e("when"), u = e("utils/local-kvs"), i = e("utils/arraybuffer-helpers"), | |
a = e("models/frontpage.model"), p = e("assert"), h = new u("edition_selector"), | |
f = new u("frontpageimage_data"), r.exports = s = function(e) { | |
function n() { | |
return g = n.__super__.constructor.apply(this, arguments); | |
} | |
return t(n, e), n.prototype._store = h, n.prototype.defaults = function() { | |
return { | |
id: null, | |
editions: null, | |
activeEdition: null, | |
loadingEdition: null | |
}; | |
}, n.prototype.url = "/data/editions", n.prototype.fetch = function() { | |
var e = this; | |
return d(this.url).then(function(t) { | |
var n; | |
return n = e.set(e.parse(t)), h.set(e.id, t).then(function() { | |
return e.removeOldFrontPages(); | |
}); | |
}); | |
}, n.prototype.parse = function(e) { | |
var t, n, r, i, o, s; | |
for (this.activeEdition = this.get("activeEdition"), this.loadingEdition = this.get("loadingEdition"), | |
n = { | |
editions: [] | |
}, i = o = 0, s = e.length; s > o; i = ++o) t = e[i], 0 === i && (t.today = !0), | |
t.id === this.loadingEdition && (t.loading = !0), t.id === this.activeEdition && t.id !== this.loadingEdition && (t.downloaded = !0), | |
r = new a(t), n.editions.push(r); | |
return n; | |
}, n.prototype.removeOldFrontPages = function() { | |
var e, t, n, r, i; | |
for (e = [], i = this.get("editions"), n = 0, r = i.length; r > n; n++) t = i[n], | |
e.push(t.id); | |
return f.keys().then(function(t) { | |
var n, r, i, o; | |
for (o = [], r = 0, i = t.length; i > r; r++) n = t[r], -1 === e.indexOf(n) ? o.push(f["delete"](n)) : o.push(void 0); | |
return o; | |
}); | |
}, n; | |
}(o); | |
}); | |
}.call(this), define("text!core-app/tmpl/edition-selector-item.html", [], function() { | |
return '<div class="edition-text">\n <p class="edition-note"><%if (today) { %>Today<%}%></p>\n <p class="edition-date"><%=friendlyDate%></p>\n</div>\n <div class="imagewrap"><!--\n --><% if(typeof(imgSrcUrl) != "undefined" && imgSrcUrl != null) { %><!--\n --><img src="<%=imgSrcUrl%>" /><!--\n --><% } %><!--\n --></div>\n <div class="overlay">\n\n </div>\n'; | |
}), define("text!core-app/tmpl/edition-selector-item-overlay.html", [], function() { | |
return " <% if (downloaded && !loading) { %>\n <h1>Downloaded</h1>\n <% if (typeof Modernizr == 'undefined' || Modernizr == null || Modernizr.touch) { %>\n <h2>Tap to Read</h2>\n <% } else { %>\n <h2>Click to Read</h2>\n <% } %>\n <% } else if (!downloaded && !loading) { %>\n <% if (typeof Modernizr == 'undefined' || Modernizr == null || Modernizr.touch) { %>\n <h1>Tap to Download</h1>\n <% } else { %>\n <h1>Click to Download</h1>\n <% } %>\n <% } else if (loading) { %>\n <div class=\"loading\"></div>\n <h1>Downloading</h1>\n <% } %>\n"; | |
}), function() { | |
var e = {}.hasOwnProperty, t = function(t, n) { | |
function r() { | |
this.constructor = t; | |
} | |
for (var i in n) e.call(n, i) && (t[i] = n[i]); | |
return r.prototype = n.prototype, t.prototype = new r(), t.__super__ = n.prototype, | |
t; | |
}; | |
define("core-app/views/edition-selector-item-overlay.view", [ "require", "exports", "module", "views/base.view", "text!core-app/tmpl/edition-selector-item-overlay.html" ], function(e, n, r) { | |
var i, o, s, a; | |
return i = e("views/base.view"), s = e("text!core-app/tmpl/edition-selector-item-overlay.html"), | |
r.exports = o = function(e) { | |
function n() { | |
return a = n.__super__.constructor.apply(this, arguments); | |
} | |
return t(n, e), n.prototype.tmpl = s, n; | |
}(i); | |
}); | |
}.call(this), function() { | |
var e = function(e, t) { | |
return function() { | |
return e.apply(t, arguments); | |
}; | |
}, t = {}.hasOwnProperty, n = function(e, n) { | |
function r() { | |
this.constructor = e; | |
} | |
for (var i in n) t.call(n, i) && (e[i] = n[i]); | |
return r.prototype = n.prototype, e.prototype = new r(), e.__super__ = n.prototype, | |
e; | |
}; | |
define("core-app/views/edition-selector-item.view", [ "require", "exports", "module", "jquery-hammerjs", "views/base.view", "text!core-app/tmpl/edition-selector-item.html", "core-app/views/edition-selector-item-overlay.view" ], function(t, r, i) { | |
var o, s, a, u, l; | |
return t("jquery-hammerjs"), o = t("views/base.view"), u = t("text!core-app/tmpl/edition-selector-item.html"), | |
a = t("core-app/views/edition-selector-item-overlay.view"), i.exports = s = function(t) { | |
function r() { | |
return this.imageClick = e(this.imageClick, this), this.overlayClick = e(this.overlayClick, this), | |
l = r.__super__.constructor.apply(this, arguments); | |
} | |
return n(r, t), r.prototype.tmpl = u, r.prototype.ui = { | |
$overlay: ".overlay", | |
$imagewrap: ".imagewrap", | |
$image: "img" | |
}, r.prototype.initialize = function() { | |
var e = this; | |
return this.listenTo(this.model, "change:imgSrcUrl", this.renderImage), this.listenTo(this.model, "change:downloaded", this.renderOverlay), | |
this.listenTo(this.model, "change:loading", this.renderOverlay), this.model.fetch({ | |
store: !0 | |
}).otherwise(function() { | |
return e.model.imgSrcUrl = "/images/front-page-default.png"; | |
}); | |
}, r.prototype.overlayClick = function() { | |
return this.trigger("overlayClick", this.model); | |
}, r.prototype.imageClick = function() { | |
return this.trigger("imageClick", this.model); | |
}, r.prototype.didRender = function() { | |
var e = this; | |
return this.renderImage(), this.renderOverlay(), this.ui.$imagewrap.hammer({ | |
tap_max_distance: 5 | |
}).on("tap", function() { | |
return e.imageClick(); | |
}), this.ui.$overlay.hammer({ | |
tap_max_distance: 5 | |
}).on("tap", function() { | |
return e.overlayClick(); | |
}); | |
}, r.prototype.renderImage = function() { | |
var e, t = this; | |
return this.model.imgSrcUrl ? (e = new Image(), $(e).one("load", function() { | |
return setTimeout(function() { | |
return t.model.unfetch(); | |
}, 0); | |
}), this.ui.$imagewrap.append($(e)), e.src = this.model.imgSrcUrl) : void 0; | |
}, r.prototype.renderOverlay = function() { | |
var e; | |
return e = new a({ | |
model: this.model | |
}), this.renderNested(e, this.ui.$overlay); | |
}, r; | |
}(o); | |
}); | |
}.call(this), function() { | |
var e = function(e, t) { | |
return function() { | |
return e.apply(t, arguments); | |
}; | |
}, t = {}.hasOwnProperty, n = function(e, n) { | |
function r() { | |
this.constructor = e; | |
} | |
for (var i in n) t.call(n, i) && (e[i] = n[i]); | |
return r.prototype = n.prototype, e.prototype = new r(), e.__super__ = n.prototype, | |
e; | |
}; | |
define("views/carousel.view", [ "require", "exports", "module", "jquery-hammerjs", "views/base.view", "views/image.view", "text!edition-app/tmpl/slideshow.html", "hammer", "modernizr", "underscore" ], function(t, r, i) { | |
var o, s, a, u, l, c, d, p; | |
return t("jquery-hammerjs"), o = t("views/base.view"), u = t("views/image.view"), | |
c = t("text!edition-app/tmpl/slideshow.html"), a = t("hammer"), l = t("modernizr"), | |
d = t("underscore"), i.exports = s = function(t) { | |
function r() { | |
return this.handleHammer = e(this.handleHammer, this), this.setPaneDimensions = e(this.setPaneDimensions, this), | |
this._render = e(this._render, this), this.handleKeypress = e(this.handleKeypress, this), | |
p = r.__super__.constructor.apply(this, arguments); | |
} | |
return n(r, t), r.prototype.ui = { | |
$prev: ".carousel-prev", | |
$next: ".carousel-next", | |
$carousel: ".carousel", | |
$container: ".carousel-items", | |
$panes: ".carousel-item", | |
$pagination: ".carousel-pagination", | |
$dots: ".carousel-pagination ul li" | |
}, r.prototype.events = { | |
"tap .carousel-prev": "showPrevious", | |
"tap .carousel-next": "showNext" | |
}, r.prototype.initialize = function(e) { | |
var t; | |
return t = null != e ? e : {}, this.startSlide = t.startSlide, this.pane_width = t.pane_width, | |
this.$body.on("keyup.carousel", this.handleKeypress), this.$window.on("load.carousel resize.carousel orientationchange.carousel", this.setPaneDimensions), | |
this.$el.hammer(); | |
}, r.prototype.destroy = function() { | |
return this.$body.off(".carousel"), this.$window.off(".carousel"), this.ui.$carousel.length && this.ui.$carousel.off(".hammergesture"), | |
r.__super__.destroy.apply(this, arguments); | |
}, r.prototype.handleKeypress = function(e) { | |
return 37 === e.keyCode ? this.showPrevious() : 39 === e.keyCode ? this.showNext() : void 0; | |
}, r.prototype._render = function() { | |
return this.bindUI(); | |
}, r.prototype.didRender = function() { | |
return this.setUpCarousel(), this.setPaneDimensions(), this.startSlide ? this.showPane(this.startSlide, !1) : this.showPane(0, !1), | |
this.$el.on("touchstart touchmove", function(e) { | |
return $(e.target.parentNode).hasClass("frontpage") ? void 0 : (e.stopPropagation(), | |
e.preventDefault()); | |
}); | |
}, r.prototype.dotClick = function(e) { | |
var t, n; | |
t = e, n = this.ui.$dots.index(t), n > -1 && this.showPane(n, !1); | |
}, r.prototype.setUpCarousel = function() { | |
return this.pane_width || (this.pane_width = 0), this.pane_count = this.ui.$panes.length, | |
this.current_pane = 0, this.ui.$carousel.length ? this.ui.$carousel.hammer({ | |
drag_lock_to_axis: !0 | |
}).on("release.hammergesture dragleft.hammergesture dragright.hammergesture swipeleft.hammergesture swiperight.hammergesture pinchin.hammergesture tap.hammergesture", this.handleHammer) : void 0; | |
}, r.prototype.setPaneDimensions = function() { | |
var e, t, n, r; | |
for (0 === this.pane_width && (this.pane_width = this.ui.$carousel.width()), r = this.ui.$panes, | |
t = 0, n = r.length; n > t; t++) e = r[t], $(e).width(this.pane_width); | |
return this.ui.$container.width(this.pane_width * this.pane_count); | |
}, r.prototype.showPane = function(e, t) { | |
var n; | |
return e = Math.max(0, Math.min(e, this.pane_count - 1)), this.current_pane = e, | |
n = -(100 / this.pane_count * this.current_pane), this.setContainerOffset(n, t), | |
this.ui.$prev.addClass("active"), this.ui.$next.addClass("active"), e + 1 === this.pane_count && this.ui.$next.removeClass("active"), | |
0 === e && this.ui.$prev.removeClass("active"), this.ui.$dots.length && (this.ui.$dots.removeClass("active"), | |
$(this.ui.$dots[e]).addClass("active")), this.ui.$panes.removeClass("active"), $(this.ui.$panes[e]).addClass("active"); | |
}, r.prototype.setContainerOffset = function(e, t) { | |
var n; | |
return this.ui.$container.removeClass("animate"), t && this.ui.$container.addClass("animate"), | |
n = "translate3d(" + e + "%,0,0) scale3d(1,1,1)", this.ui.$container.css("transform", n); | |
}, r.prototype.showNext = function() { | |
return this.showPane(this.current_pane + 1, !0), this; | |
}, r.prototype.showPrevious = function() { | |
return this.showPane(this.current_pane - 1, !0), this; | |
}, r.prototype.handleHammer = function(e) { | |
var t; | |
return e.gesture && (e.gesture.preventDefault(), t = this["_" + e.type], d.isFunction(t)) ? t.call(this, e) : void 0; | |
}, r.prototype._dragright = function(e) { | |
var t, n; | |
return n = -(100 / this.pane_count) * this.current_pane, t = 100 / this.pane_width * e.gesture.deltaX / this.pane_count, | |
(0 === this.current_pane && e.gesture.direction === a.DIRECTION_RIGHT || this.current_pane === this.pane_count - 1 && e.gesture.direction === a.DIRECTION_LEFT) && (t *= .4), | |
this.setContainerOffset(t + n); | |
}, r.prototype._dragleft = function(e) { | |
return this._dragright(e); | |
}, r.prototype._swipeleft = function(e) { | |
return this.showNext(), e.gesture.stopDetect(); | |
}, r.prototype._swiperight = function(e) { | |
return this.showPrevious(), e.gesture.stopDetect(); | |
}, r.prototype._release = function(e) { | |
return Math.abs(e.gesture.deltaX) > this.pane_width / 2 ? "right" === e.gesture.direction ? this.showPrevious() : this.showNext() : this.showPane(this.current_pane, !0); | |
}, r.prototype._pinchin = function() { | |
return this.trigger("pinchin", this); | |
}, r.prototype._tap = function(e) { | |
var t, n; | |
n = $(e.target).parents(), n.is(this.ui.$pagination) ? ($(e.target).is(this.ui.$dots) ? t = $(e.target) : $(e.target.parentElement).is(this.ui.$dots) && (t = $(e.target.parentElement)), | |
t && this.dotClick(t)) : this.trigger("carouselclick", this); | |
}, r; | |
}(o); | |
}); | |
}.call(this), function() { | |
var e = {}.hasOwnProperty, t = function(t, n) { | |
function r() { | |
this.constructor = t; | |
} | |
for (var i in n) e.call(n, i) && (t[i] = n[i]); | |
return r.prototype = n.prototype, t.prototype = new r(), t.__super__ = n.prototype, | |
t; | |
}; | |
define("core-app/views/edition-selector.view", [ "require", "exports", "module", "views/base.view", "text!core-app/tmpl/edition-selector.html", "models/edition-selector.model", "core-app/views/edition-selector-item.view", "views/carousel.view", "core-app/views/settings-icon.view", "utils/report-error", "views/modal.view", "views/alert.view", "utils/tracking", "moment" ], function(e, n, r) { | |
var i, o, s, a, u, l, c, d, p, h, f, m, g; | |
return o = e("views/base.view"), a = e("text!core-app/tmpl/edition-selector.html"), | |
l = e("models/edition-selector.model"), u = e("core-app/views/edition-selector-item.view"), | |
s = e("views/carousel.view"), p = e("core-app/views/settings-icon.view"), f = e("utils/report-error"), | |
d = e("views/modal.view"), i = e("views/alert.view"), m = e("utils/tracking"), h = e("moment"), | |
r.exports = c = function(e) { | |
function n() { | |
return g = n.__super__.constructor.apply(this, arguments); | |
} | |
return t(n, e), n.prototype.tmpl = a, n.prototype.ui = { | |
$frontpages: ".frontpages", | |
$loading: ".loading-spinner", | |
$settingsHolder: ".settings" | |
}, n.prototype.initialize = function(e) { | |
var t, n = this; | |
return t = null != e ? e : {}, this.activeEdition = t.activeEdition, this.loadingEdition = t.loadingEdition, | |
this.isLaunchView = t.isLaunchView, this.model = new l({ | |
id: "editionselector", | |
activeEdition: this.activeEdition, | |
loadingEdition: this.loadingEdition | |
}), this.model.fetch().then(function() { | |
return n.renderEditions(), n.createCarousel(); | |
}).otherwise(function(e) { | |
var t; | |
return f(e), t = { | |
text: 'You are currently in offline mode. Please make sure you are connected to the\nInternet and try again. For more information, please <a\nhref="http://www.nytimes.com/content/help/mobile/todays-paper/todays-paper.html"\ntarget="_blank">visit our FAQ</a>.', | |
buttons: [ "Cancel" ] | |
}, n.alert = new i({ | |
alertModel: t | |
}), n.alertModal = new d({ | |
nestView: n.alert, | |
className: "alert", | |
disallowClose: !0 | |
}), n.listenTo(n.alert, "button0", function() { | |
return n.alertModal.destroy(), n.trigger("currentEditionSelected"); | |
}), n.alertModal.render(); | |
}); | |
}, n.prototype.didRender = function() { | |
var e; | |
return null != (e = this.settingsIconView) && e.destroy(), this.settingsIconView = new p({ | |
el: this.ui.$settingsHolder[0] | |
}), this.settingsIconView.render(); | |
}, n.prototype.renderEditions = function() { | |
var e, t, n, r, i, o; | |
for (this.editions = this.model.get("editions"), this.activeIndex = this.editions.length - 1, | |
i = this.editions, o = [], t = n = 0, r = i.length; r > n; t = ++n) e = i[t], o.push(this.renderFrontPage(e, t)); | |
return o; | |
}, n.prototype.renderFrontPage = function(e, t) { | |
var n, r = this; | |
return e.id === this.activeEdition && (this.activeIndex = t), n = this.createFPContainer(), | |
e.frontpageItem = this.renderNested(new u({ | |
model: e | |
}), n), this.listenTo(e.frontpageItem, "imageClick overlayClick", function(e) { | |
var n; | |
return r.carousel.showPane(6 - t, !0), n = { | |
date: h().format("YYYY-MM-DD"), | |
editionOffset: t, | |
editionDate: e.date, | |
dayOfWeek: e.dayOfWeek | |
}, m.trackEvent("Edition Selected", n, "interaction"), e.downloaded ? r.trigger("currentEditionSelected") : e.downloaded ? void 0 : (r.trigger("newEditionSelected", e), | |
e.set("loading", !0)); | |
}); | |
}, n.prototype.createFPContainer = function() { | |
var e; | |
return e = $('<div class="frontpage carousel-item" />'), this.ui.$frontpages.prepend(e), | |
e; | |
}, n.prototype.createCarousel = function() { | |
var e; | |
return e = this.editions.length - this.activeIndex - 1, this.carousel = new s({ | |
el: this.el, | |
startSlide: e | |
}).render(), this.ui.$loading.remove(); | |
}, n.prototype.destroy = function() { | |
return this.settingsIconView.destroy(), n.__super__.destroy.apply(this, arguments); | |
}, n; | |
}(o); | |
}); | |
}.call(this), function() { | |
var e = [].slice; | |
define("core.app", [ "require", "exports", "module", "logger", "when", "cookies", "jquery", "utils/report-error", "utils/when-ajax", "models/base.model", "utils/local-kvs", "utils/local-kvs-schema", "models/edition.model", "common/lifecycle.mixin", "core-app/views/core-layout.view", "edition-app/views/article.view", "core-app/views/login-screen.view", "core-app/views/edition-selector.view", "views/modal.view", "edition-app/views/ad.view", "views/alert.view", "utils/device" ], function(t, n, r) { | |
var i, o, s, a, u, l, c, d, p, h, f, m, g, v, y, w, b, _, x, E; | |
x = t("logger"), y = t("when"), b = window.cookies = t("cookies"), i = t("jquery"), | |
E = t("utils/report-error"), w = t("utils/when-ajax"), u = t("models/base.model"), | |
f = t("utils/local-kvs"), m = t("utils/local-kvs-schema"), p = t("models/edition.model"), | |
_ = t("common/lifecycle.mixin"), c = t("core-app/views/core-layout.view"), a = t("edition-app/views/article.view"), | |
g = t("core-app/views/login-screen.view"), h = t("core-app/views/edition-selector.view"), | |
v = t("views/modal.view"), o = t("edition-app/views/ad.view"), s = t("views/alert.view"), | |
d = t("utils/device"), r.exports = l = function() { | |
function t(e) { | |
this.router = (null != e ? e : {}).router, assert(null != this.router, "Expected router to be set on `CoreApp` instance"); | |
} | |
return t.prototype.showEditionSelector = function(e) { | |
var t, n, r, o; | |
return o = null != e ? e : {}, r = o.modelId, n = o.loadingId, t = o.isLaunchView, | |
this.editionSelectorContent = new h({ | |
activeEdition: r, | |
loadingEdition: n, | |
isLaunchView: t | |
}), this.editionSelectorModal = new v({ | |
targetContainer: i("#app"), | |
nestView: this.editionSelectorContent, | |
className: "fullScreen edition-selector" + (t ? " ed-selector-at-launch" : "") | |
}), this.listenToOnce(this.editionSelectorContent, "newEditionSelected", function(e) { | |
return this._uninstallEdition(), this.loadEdition(e.get("year"), e.get("month"), e.get("day")); | |
}), this.listenToOnce(this.editionSelectorContent, "currentEditionSelected", function() { | |
return this.editionSelectorModal.destroy(); | |
}), this.listenTo(this.editionSelectorModal, "modalOpen", function() { | |
return this.layout ? (this.layout.hideDateView(), this.layout.stopVideos()) : void 0; | |
}), this.listenTo(this.editionSelectorModal, "modalClose", function() { | |
return this.layout ? this.layout.showDateView() : void 0; | |
}), this.editionSelectorModal.render(); | |
}, t.prototype.setEdition = function(t, n, r) { | |
return x.debug.apply(x, [ "CoreApp setEdition" ].concat(e.call(arguments))), this.edition = p.get(t, n, r); | |
}, t.prototype.setArticle = function(t, n) { | |
return x.debug.apply(x, [ "CoreApp setArticle" ].concat(e.call(arguments))), this.article = this.edition.articlesBySectionAndSlug["" + t + "/" + n], | |
this.article ? void 0 : (x.debug("No article found for " + t + "/" + n), this.article = this.edition.getFirstArticle()); | |
}, t.prototype.loadEdition = function(t, n, r, i, s) { | |
var a, u = this; | |
return x.debug.apply(x, [ "CoreApp loadEdition" ].concat(e.call(arguments))), this.isEditionInstalled && (null != (a = this.edition) ? a.year : void 0) === t && ("undefined" != typeof edition && null !== edition ? edition.day : void 0) === r && ("undefined" != typeof edition && null !== edition ? edition.month : void 0) === n ? this.showArticle(t, n, r, i, s) : (o.resetArticlesRendered(), | |
this.isEditionInstalled = !1, this.edition = null, this.once("didInstallEdition", function() { | |
return u._onDidInstallEdition(t, n, r, i, s); | |
}, this), this.setEdition(t, n, r), this.installEdition()); | |
}, t.prototype.willInstallEdition = function() { | |
var t = this; | |
return x.debug.apply(x, [ "CoreApp willInstallEdition" ].concat(e.call(arguments))), | |
assert(null != this.edition, "Expected edition to be set"), this.isEditionInstalled ? new Error("Edition already installed") : y(function() { | |
return x.debug("calling @edition.storeEdition() and @edition.fetch()"), t.edition.storeEdition().then(function() { | |
return x.debug("@edition.storeEdition() successful"); | |
}, function(e) { | |
return E(e, "couldn't store edition for offline reading"); | |
}), t.edition.fetch().then(function(e) { | |
return x.debug("@edition.fetch() successful"), e; | |
}); | |
}()).otherwise(function(e) { | |
var n, r; | |
return E(e, "error caught by CoreApp willInstallEdition"), "db init blocked" === (r = null != e ? e.message : void 0) || "db error" === r || "db InvalidStateError" === r ? (n = new s({ | |
alertModel: { | |
text: d.isSafariPrivateBrowsing() ? 'Unable to load Today’s Paper in private browsing mode. Please turn\noff private browsing and try again. For more information, please <a\nhref="http://www.nytimes.com/content/help/mobile/todays-paper/todays-paper.html"\ntarget="_blank">visit our FAQ</a>.' : "db InvalidStateError" === (null != e ? e.message : void 0) ? 'Unable to load Today’s Paper. Please note that Today’s Paper cannot\nrun in private browsing mode. Make sure private browsing is disabled\nand try again. For more information, please <a\nhref="http://www.nytimes.com/content/help/mobile/todays-paper/todays-paper.html"\ntarget="_blank">visit our FAQ</a>.' : 'Unable to load Today’s Paper. Please close any copies of Today’s Paper\nin other tabs or windows and try again. For more information, please <a\nhref="http://www.nytimes.com/content/help/mobile/todays-paper/todays-paper.html"\ntarget="_blank">visit our FAQ</a>.', | |
buttons: [ "Refresh" ] | |
} | |
}), n.once("button0", function() { | |
return window.location.reload(!0); | |
})) : (n = new s({ | |
alertModel: { | |
text: 'Unable to load Today\'s Paper. Please make sure you are connected to the\nInternet and try again. For more information, please <a\nhref="http://www.nytimes.com/content/help/mobile/todays-paper/todays-paper.html"\ntarget="_blank">visit our FAQ</a>.', | |
buttons: null != t.layout ? [ "Refresh", "Cancel" ] : [ "Refresh" ] | |
} | |
}), n.once("button0", function() { | |
return n.off(), window.location.reload(!0); | |
}), n.once("button1", function() { | |
var e; | |
return n.off(), t.alertModal.destroy(), null != (e = t.editionSelectorModal) ? e.destroy() : void 0; | |
})), t.alertModal = new v({ | |
nestView: n, | |
className: "alert", | |
disallowClose: !0 | |
}), t.alertModal.render(); | |
}); | |
}, t.prototype._installEdition = function() { | |
return x.debug.apply(x, [ "CoreApp _installEdition" ].concat(e.call(arguments))), | |
this.isEditionInstalled = !0; | |
}, t.prototype._uninstallEdition = function() { | |
return x.debug.apply(x, [ "CoreApp _uninstallEdition" ].concat(e.call(arguments))), | |
this.isEditionInstalled = !1; | |
}, t.prototype.didInstallEdition = function() { | |
return x.debug.apply(x, [ "CoreApp didInstallEdition" ].concat(e.call(arguments))), | |
this.edition.sections.each(function(e) { | |
return e.thumb.wwwUrl ? e.thumb.fetch({ | |
store: !0 | |
}).otherwise(function() { | |
return e.thumb.imgSrcUrl = "/images/section-front-default.png"; | |
}) : void 0; | |
}); | |
}, t.prototype._onDidInstallEdition = function(t, n, r, o, s) { | |
var a; | |
return x.debug.apply(x, [ "CoreApp _onDidInstallEdition" ].concat(e.call(arguments))), | |
this.layout ? this.layout.destroy() : i("#initial-loading").remove(), this.layout = new c({ | |
model: this.edition | |
}), this.layout.appendTo(i("#app")), this.layout.render(), null != (a = this.editionSelectorModal) && a.destroy(), | |
this.trigger("layoutReady"), this.listenTo(this.layout, "editionDateClick", function(e) { | |
return this.showEditionSelector({ | |
modelId: e | |
}); | |
}), o && s ? this.showArticle(t, n, r, o, s) : this.router.navigate(this.edition.getFirstArticle().route, { | |
trigger: !0, | |
replace: !0 | |
}); | |
}, t.prototype.showArticle = function(t, n, r, i, o) { | |
return x.debug.apply(x, [ "CoreApp showArticle" ].concat(e.call(arguments))), this.isEditionInstalled ? (this.setArticle(i, o), | |
this.layout.showArticle(this.article)) : this.loadEdition(t, n, r, i, o); | |
}, t.prototype.readerLogin = function(t) { | |
var n, r = this; | |
return n = (null != t ? t : { | |
wasUnentitled: !1 | |
}).wasUnentitled, x.debug.apply(x, [ "CoreApp readerLogin" ].concat(e.call(arguments))), | |
y(function() { | |
return !b.get("NYT-S") || n ? null != r.loginDebounced ? r.loginDebounced : r.loginDebounced = y(function() { | |
var e, t, i, o, s; | |
return t = null != (i = window.location.origin) ? i : "" + window.location.protocol + "//" + window.location.host, | |
e = new g({ | |
model: new u({ | |
exitURI: "" + t + "/loginReturn", | |
wasUnentitled: n | |
}) | |
}), e.render(), null != (o = r.layout) && null != (s = o.$el) && s.hide(), e.appendTo(document.body), | |
y.promise(function(t) { | |
return window.loginReturn = function() { | |
var n, i; | |
return delete window.loginReturn, e.remove(), null != (n = r.layout) && null != (i = n.$el) && i.show(), | |
t(); | |
}; | |
}); | |
}()).ensure(function() { | |
return r.loginDebounced = void 0; | |
}) : void 0; | |
}()).then(function() { | |
return w("https://www.nytimes.com/svc/profile/user/ping.json", { | |
dataType: "jsonp", | |
timeout: 0 | |
}); | |
}).then(function(e) { | |
return r.isEntitled(null != e ? e.entitlements : void 0) ? !0 : r.readerLogin({ | |
wasUnentitled: !0 | |
}); | |
}).otherwise(function(e) { | |
return x.error(e), r.readerLogin({ | |
wasUnentitled: !0 | |
}); | |
}); | |
}, t.prototype.isEntitled = function(e) { | |
var t, n, r; | |
return t = e.MM, n = e.MTD, r = new Date(), d.isDesktopDevice() ? !!(t && r.getTime() < this.parseEntitlementDate(t).getTime()) : !!(n && r.getTime() < this.parseEntitlementDate(n).getTime()); | |
}, t.prototype.parseEntitlementDate = function(e) { | |
var t, n, r, i, o, s, a; | |
return a = e.split(/[^0-9]/), s = a[0], i = a[1], t = a[2], n = a[3], r = a[4], | |
o = a[5], new Date(Date.UTC(s, i - 1, t, null != n ? n : 0, null != r ? r : 0, null != o ? o : 0)); | |
}, t.prototype.showResetApp = function() { | |
return this.layout = new c(), this.layout.showResetApp(); | |
}, t.prototype.logout = function() { | |
var e, t, n, r, i; | |
p.abortInProgressStore(); | |
try { | |
null != (n = this.layout) && n.destroy(), this.layout = null, null != (r = this.editionSelectorContent) && r.destroy(), | |
this.editionSelectorContent = null, null != (i = this.editionSelectorModal) && i.destroy(), | |
this.editionSelectorModal = null; | |
} catch (o) {} | |
return window.localStorage.hash = "", b.expire("NYT-S", { | |
domain: "nytimes.com" | |
}), this.edition = null, e = function() { | |
var e, n, r, i; | |
for (r = m.STORE_NAMES, i = [], e = 0, n = r.length; n > e; e++) t = r[e], i.push(new f(t).nuke()); | |
return i; | |
}(), y.all(e); | |
}, t.prototype.reset = function() { | |
return window.sessionStorage.clear(), window.localStorage.clear(), this.logout(); | |
}, t; | |
}(), _.extend(l.prototype, [ "installEdition", "destroyEdition" ]); | |
}); | |
}.call(this), function() { | |
var e = {}.hasOwnProperty, t = function(t, n) { | |
function r() { | |
this.constructor = t; | |
} | |
for (var i in n) e.call(n, i) && (t[i] = n[i]); | |
return r.prototype = n.prototype, t.prototype = new r(), t.__super__ = n.prototype, | |
t; | |
}, n = [].slice; | |
define("router", [ "require", "exports", "module", "backbone", "core.app", "when", "utils/when-ajax", "logger", "utils/report-error", "views/modal.view", "views/alert.view" ], function(e, r, i) { | |
var o, s, a, u, l, c, d, p, h, f; | |
return s = e("backbone"), a = e("core.app"), c = e("when"), d = e("utils/when-ajax"), | |
p = e("logger"), h = e("utils/report-error"), u = e("views/modal.view"), o = e("views/alert.view"), | |
i.exports = l = function(e) { | |
function r() { | |
return f = r.__super__.constructor.apply(this, arguments); | |
} | |
return t(r, e), r.prototype.routes = { | |
":year/:month/:day": "loadEdition", | |
":year/:month/:day/:section/:article": "showArticle", | |
reset: "resetApp", | |
logout: "logout", | |
"*default": "defaultRoute" | |
}, r.prototype.initialize = function() { | |
return window.APP = this.coreApp = new a({ | |
router: this | |
}), this.isEntitled = !1; | |
}, r.prototype.navigate = function(e) { | |
return window.localStorage.hash = e, p.info("localStorage['hash'] set to '" + e + "'"), | |
r.__super__.navigate.apply(this, arguments); | |
}, r.prototype.loadEdition = function(e, t, r) { | |
var i = this; | |
return p.debug.apply(p, [ "Router loadEdition" ].concat(n.call(arguments))), c(function() { | |
return i.verifyEntitlement(); | |
}()).then(function() { | |
return i.coreApp.loadEdition(e, t, r); | |
}).otherwise(function(e) { | |
var t, n, r; | |
return h(e, "error caught by Router loadEdition"), n = { | |
text: "An error occurred. Please make sure your Internet connection is online and reload this page.", | |
buttons: [ "Reload" ] | |
}, t = new o({ | |
alertModel: n | |
}), r = new u({ | |
nestView: t, | |
className: "alert", | |
disallowClose: !0 | |
}), t.once("button0", function() { | |
return window.location.reload(!0); | |
}), r.render(); | |
}); | |
}, r.prototype.showArticle = function(e, t, r, i, s) { | |
var a = this; | |
return p.debug.apply(p, [ "Router showArticle" ].concat(n.call(arguments))), c(function() { | |
return a.verifyEntitlement(); | |
}()).then(function() { | |
return a.coreApp.showArticle(e, t, r, i, s); | |
}).otherwise(function(e) { | |
var t, n, r; | |
return h(e, "error caught by Router showArticle"), n = { | |
text: "An error occurred. Please make sure your Internet connection is online and reload this page.", | |
buttons: [ "Reload" ] | |
}, t = new o({ | |
alertModel: n | |
}), r = new u({ | |
nestView: t, | |
className: "alert", | |
disallowClose: !0 | |
}), t.once("button0", function() { | |
return window.location.reload(!0); | |
}), r.render(); | |
}); | |
}, r.prototype.verifyEntitlement = function() { | |
var e = this; | |
return !this.isEntitled && navigator.onLine && /\bnytimes.com$/.test(window.location.hostname) ? (p.debug("Router: checking entitlements..."), | |
c(function() { | |
return e.coreApp.readerLogin(); | |
}()).then(function() { | |
return p.debug("Router: user is entitled"), e.isEntitled = !0, window.setInterval(function() { | |
return navigator.onLine ? d("https://www.nytimes.com/svc/profile/user/ping.json", { | |
dataType: "jsonp" | |
}) : void 0; | |
}, 18e5), !0; | |
})) : !0; | |
}, r.prototype.logout = function() { | |
var e = this; | |
return this.coreApp.logout().then(function() { | |
return e.navigate("", { | |
trigger: !1 | |
}), window.location.reload(!0); | |
}).otherwise(function(e) { | |
return h(e), this.coreApp.showResetApp(); | |
}); | |
}, r.prototype.resetApp = function() { | |
var e = this; | |
return this.coreApp.reset().then(function() { | |
return e.navigate("", { | |
trigger: !1 | |
}), window.location.reload(!0); | |
}).otherwise(function(e) { | |
return h(e), this.coreApp.showResetApp(); | |
}); | |
}, r.prototype.defaultRoute = function() { | |
var e, t, n = this; | |
return e = new o({ | |
alertModel: { | |
text: "An error occurred: unrecognized route.", | |
buttons: [ "Reload" ] | |
} | |
}), e.once("button0", function() { | |
return localStorage.hash = "", n.navigate("", { | |
trigger: !1 | |
}), window.location.reload(!0); | |
}), t = new u({ | |
nestView: e, | |
className: "alert", | |
disallowClose: !0 | |
}), t.render(); | |
}, r; | |
}(s.Router); | |
}); | |
}.call(this), function() { | |
define("device-alert", [ "require", "exports", "module", "views/alert.view", "views/modal.view", "utils/device" ], function(e) { | |
return function() { | |
var t, n, r, i, o, s, a, u, l, c, d; | |
return t = e("views/alert.view"), r = e("views/modal.view"), n = e("utils/device"), | |
l = "Sorry, your browser is not supported — to log in or install this app, we recommend\nyou use your native Safari browser. For more details on\nsupported devices and browsers, please visit our\n<a href='http://www.nytimes.com/content/help/mobile/todays-paper/todays-paper.html'>FAQ</a>.", | |
s = "Your browser is not supported – to log in or install this app, we recommend you download the\nlatest version of Chrome. For more details on supported devices and browsers, please visit our\n<a href='http://www.nytimes.com/content/help/mobile/todays-paper/todays-paper.html'>FAQ</a>.", | |
u = "Your browser is not supported – to log in or install this app, we recommend you use Safari\nif you are on a Mac and Chrome if you are on a PC. For more details on supported devices\nand browsers, please visit our\n<a href='http://www.nytimes.com/content/help/mobile/todays-paper/todays-paper.html'>FAQ</a>.", | |
d = "Sorry your device and/or browser is not supported – to log in or install this app, we recommend the following:\n<ul>\n<li>Safari or Chrome for iPad users</li>\n<li>Chrome for Android tablet users</li>\n<li>IE for Windows Surface users</li>\n<li>Chrome for PC and Mac desktop users</li>\n<li>Safari for Mac desktop users, and</li>\n<li>IE for PC.</li>\n</ul>\n", | |
c = "Your browser is not supported. To access content found in the print edition of The New York Times,\nplease visit: <a href='http://www.nytimes.com/todayspaper/'>www.nytimes.com/todayspaper/</a> To see\na full list of supported devices and browsers, visit our\n<a href='http://www.nytimes.com/content/help/mobile/todays-paper/todays-paper.html'>FAQ</a>.\n", | |
n.Silk || n.Android && !n.Chrome || n.ie7 || n.ie8 || n.ie9 ? (o = n.Android && !n.Chrome ? s : n.Silk ? c : u, | |
a = new t({ | |
alertModel: { | |
text: o, | |
buttons: [] | |
} | |
}), i = new r({ | |
nestView: a, | |
className: "alert", | |
disallowClose: !0 | |
}), i.render(), !0) : !1; | |
}; | |
}); | |
}.call(this), function(e) { | |
e("components/when/monitor/aggregator", [], function() { | |
return function(e) { | |
function t(e) { | |
if (!(this instanceof t)) return new t(e); | |
var n; | |
try { | |
throw new Error(); | |
} catch (r) { | |
n = r; | |
} | |
this.key = s++, o[this.key] = this, this.parent = e, this.timestamp = +new Date(), | |
this.createdAt = n; | |
} | |
function n(e) { | |
return e.PromiseStatus = t, e.reportUnhandled = r, e.resetUnhandled = i, e; | |
} | |
function r() { | |
return e(o); | |
} | |
function i() { | |
s = 0, o = {}; | |
} | |
var o, s; | |
return t.prototype = { | |
observed: function() { | |
return this.key in o && (delete o[this.key], r()), new t(this); | |
}, | |
fulfilled: function() { | |
this.key in o && (delete o[this.key], r()); | |
}, | |
rejected: function(e) { | |
var t; | |
if (this.key in o) { | |
try { | |
throw new Error(e && e.message || e); | |
} catch (n) { | |
t = n; | |
} | |
this.reason = e, this.rejectedAt = t, r(); | |
} | |
} | |
}, i(), n({ | |
publish: n | |
}); | |
}; | |
}); | |
}("function" == typeof define && define.amd ? define : function(e) { | |
module.exports = e(); | |
}), function(e) { | |
e("components/when/monitor/throttledReporter", [], function() { | |
return function(e, t) { | |
var n, r; | |
return function(i) { | |
r = i, null == n && (n = setTimeout(function() { | |
n = null, t(r); | |
}, e)); | |
}; | |
}; | |
}); | |
}("function" == typeof define && define.amd ? define : function(e) { | |
module.exports = e(); | |
}), function(e) { | |
e("components/when/monitor/simpleReporter", [], function() { | |
function e(e, t) { | |
var n, r, i; | |
i = []; | |
for (n in t) r = t[n], r.rejectedAt && i.push(e(r)); | |
return i; | |
} | |
return function(t, n) { | |
var r = 0; | |
return function(i) { | |
if (i = e(t, i), 0 !== r || 0 !== i.length) try { | |
n(i); | |
} finally { | |
r = i.length; | |
} | |
}; | |
}; | |
}); | |
}("function" == typeof define && define.amd ? define : function(e) { | |
module.exports = e(); | |
}), function(e) { | |
e("components/when/monitor/simpleFormatter", [], function() { | |
var e; | |
try { | |
throw new Error(); | |
} catch (t) { | |
e = !!t.stack; | |
} | |
return function(t, n, r) { | |
function i(e) { | |
var t = []; | |
for (e = e.parent; e; ) t.push(o(e)), e = e.parent; | |
return t; | |
} | |
function o(e) { | |
return t(a(e.createdAt.stack).slice(1)); | |
} | |
function s(e, i, o) { | |
return e = t(a(e)).slice(1), o = t(a(o)), [ n ].concat(e, i, r, o); | |
} | |
function a(e) { | |
return e ? e.split("\n") : []; | |
} | |
return function(t) { | |
var n, r; | |
if (r = { | |
reason: t.reason, | |
message: t.reason && t.reason.toString() | |
}, e) { | |
n = t.reason && t.reason.stack, n || (n = t.rejectedAt && t.rejectedAt.stack); | |
var o = i(t); | |
r.stack = s(t.createdAt.stack, o, n); | |
} | |
return r; | |
}; | |
}; | |
}); | |
}("function" == typeof define && define.amd ? define : function(e) { | |
module.exports = e(); | |
}), function(e) { | |
e("components/when/monitor/array", [], function() { | |
function e(e, t) { | |
if ("function" == typeof e.forEach) return e.forEach(t); | |
var n, r; | |
for (n = -1, r = e.length; ++n < r; ) t(e[n], n, e); | |
} | |
function t(e, t, n) { | |
if ("function" == typeof e.reduce) return e.reduce(n, t); | |
var r, i, o; | |
for (r = -1, i = e.length, o = t; ++r < i; ) o = n(o, e[r], r, e); | |
return o; | |
} | |
return { | |
forEach: e, | |
reduce: t | |
}; | |
}); | |
}("function" == typeof define && define.amd ? define : function(e) { | |
module.exports = e(); | |
}), function(e) { | |
e("components/when/monitor/stackFilter", [ "require", "./array" ], function(e) { | |
var t = e("./array"); | |
return function(e, n) { | |
return function(r) { | |
var i; | |
return r && r.length ? (i = [], t.reduce(r, [], function(t, r) { | |
var o; | |
return o = e(r), o ? (i || (i = []), i.push(r)) : (i && t.length > 1 && (t = t.concat(n(i)), | |
i = null), t.push(r)), t; | |
})) : []; | |
}; | |
}; | |
}); | |
}("function" == typeof define && define.amd ? define : function(e) { | |
module.exports = e(require); | |
}), function(e) { | |
e("components/when/monitor/logger/consoleGroup", [ "require", "../array" ], function(e) { | |
function t() {} | |
var n, r, i, o; | |
return n = e("../array"), "undefined" == typeof console ? o = t : (console.warn && console.dir ? r = function(e) { | |
console.warn(e); | |
} : console.log && "undefined" != typeof JSON && (r = function(e) { | |
console.log("string" == typeof e ? e : JSON.stringify(e)); | |
}), r ? (i = console.groupCollapsed ? function(e, t) { | |
console.groupCollapsed(e); | |
try { | |
n.forEach(t, r); | |
} finally { | |
console.groupEnd(); | |
} | |
} : function(e, t) { | |
r(e), r(t); | |
}, o = function(e) { | |
e.length ? i("[promises] Unhandled rejections: " + e.length, e) : r("[promises] All previously unhandled rejections have now been handled"); | |
}) : o = t), o; | |
}); | |
}("function" == typeof define && define.amd ? define : function(e) { | |
module.exports = e(require); | |
}), function(e) { | |
e("components/when/monitor/console", [ "require", "./aggregator", "./throttledReporter", "./simpleReporter", "./simpleFormatter", "./stackFilter", "./logger/consoleGroup" ], function(e) { | |
function t() { | |
return m; | |
} | |
function n(e) { | |
var t = g.promiseStackFilter || l; | |
return t.test(e); | |
} | |
var r, i, o, s, a, u, l, c, d, p, h, f, m, g; | |
return r = e("./aggregator"), i = e("./throttledReporter"), o = e("./simpleReporter"), | |
a = e("./simpleFormatter"), u = e("./stackFilter"), p = e("./logger/consoleGroup"), | |
h = "--- Unhandled rejection escaped at ---", f = "--- Caused by reason ---", m = " ...[filtered frames]...", | |
l = /when\.js|when\/monitor\//i, c = u(n, t), d = o(a(c, h, f), p), s = r(i(250, d)), | |
g = "undefined" != typeof console ? s.publish(console) : s, s; | |
}); | |
}("function" == typeof define && define.amd ? define : function(e) { | |
module.exports = e(require); | |
}), function() { | |
define("utils/global-events", [ "require", "exports", "module", "backbone", "underscore" ], function(e, t, n) { | |
var r, i; | |
return r = e("backbone").Events, i = e("underscore").extend, n.exports = i({}, r); | |
}); | |
}.call(this), function() { | |
define("utils/manifest", [ "require", "exports", "module", "utils/global-events" ], function(e, t, n) { | |
var r, i = this; | |
return r = e("utils/global-events"), n.exports = { | |
appCache: window.applicationCache, | |
listen: function() { | |
return this.appCache.addEventListener("downloading", this._downloading, !1), this.appCache.addEventListener("checking", this._checking, !1), | |
this.appCache.addEventListener("updateready", this._updateReady, !1), this.appCache.addEventListener("updateready", this._updated, !1); | |
}, | |
stopListening: function() { | |
return this.appCache.removeEventListener("downloading", this._downloading, !1), | |
this.appCache.removeEventListener("checking", this._checking, !1), this.appCache.removeEventListener("updateready", this._updateReady, !1), | |
this.appCache.removeEventListener("updateready", this._updated, !1); | |
}, | |
_downloading: function() { | |
return r.trigger("manifest:downloading"); | |
}, | |
_checking: function() { | |
return r.trigger("manifest:checking"); | |
}, | |
_updateReady: function() { | |
return r.trigger("manifest:updateReady"); | |
}, | |
_updated: function() { | |
return i.appCache.status === i.appCache.UPDATEREADY ? r.trigger("manifest:updated") : void 0; | |
} | |
}; | |
}); | |
}.call(this), function() { | |
var e, t, n = [].slice; | |
require.config({ | |
packages: [ { | |
name: "when", | |
location: "components/when", | |
main: "when" | |
} ], | |
paths: { | |
jquery: "components/jquery/jquery", | |
hammer: "components/hammerjs/hammer", | |
"jquery-hammerjs": "components/jquery-hammerjs/jquery.hammer", | |
modernizr: "components/modernizr/modernizr", | |
modernizrCssCalc: "components/modernizr/feature-detects/css-calc", | |
moment: "components/momentjs/moment", | |
underscore: "components/underscore/underscore", | |
backbone: "components/backbone/backbone", | |
assert: "components/assert/assert", | |
logger: "components/js-logger/src/logger", | |
cookies: "components/Cookies/src/cookies", | |
"jquery-ui-effect": "components/jquery-ui/ui/jquery.ui.effect", | |
localytics: "vendor/localytics" | |
}, | |
shim: { | |
backbone: { | |
deps: [ "jquery", "underscore" ], | |
exports: "Backbone", | |
init: function() { | |
return this.Backbone.noConflict(); | |
} | |
}, | |
jquery: { | |
exports: "$", | |
init: function() { | |
return this.jQuery.noConflict(); | |
} | |
}, | |
"jquery-ui-effect": { | |
deps: [ "jquery" ] | |
}, | |
underscore: { | |
exports: "_", | |
init: function() { | |
return this._.noConflict(); | |
} | |
}, | |
assert: { | |
exports: "assert" | |
}, | |
hammer: { | |
exports: "Hammer", | |
deps: [ "jquery" ] | |
}, | |
moment: { | |
exports: "moment" | |
}, | |
modernizr: { | |
exports: "Modernizr" | |
}, | |
modernizrCssCalc: { | |
exports: "Modernizr", | |
deps: [ "modernizr" ] | |
}, | |
localytics: { | |
exports: "LocalyticsSession", | |
init: function() { | |
var e, t; | |
return e = "production" === window.ENV ? "8cd7264cce4430ce05df0e3-5b54dc22-4c78-11e3-91fc-005cf8cbabd8" : "3151b0fe1fe878f949b5a30-696ad81c-4c78-11e3-91fc-005cf8cbabd8", | |
t = LocalyticsSession(e), t.open(), t.upload(), t; | |
} | |
} | |
}, | |
priority: [ "jquery", "underscore", "backbone" ] | |
}), "undefined" != typeof console && null !== console && console.log("app is loading..."), | |
e = function() { | |
return require([ "config", "backbone", "router", "logger", "route-mediator", "jquery", "utils/when-ajax", "utils/device", "utils/report-error", "views/modal.view", "views/alert.view", "localytics", "device-alert" ], function(e, t, n, r, i, o, s, a, u, l, c, d, p) { | |
var h, f, m, g, v, y; | |
return screen.width < 500 || screen.deviceXDPI && window.innerWidth < 600 ? (o("body").addClass("isSmartphone"), | |
o("#smartphoneAlert").css("margin-top", o("#smartphoneAlert").height() / -2), void 0) : (r.debug("app is alive"), | |
r.useDefaults(), m = null != (g = window.location.search.match(/[?&]logLevel=(.*?)(?:[?&]|$)/i)) ? null != (v = g[1]) ? v.toUpperCase() : void 0 : void 0, | |
r.setLevel(r[m || e.LOG_LEVEL]), f = null != (y = window.localStorage.hash) ? y : "", | |
r.debug("last hash '" + f + "'"), h = s("/data/editions"), o(function() { | |
var e, o, s; | |
if (!p()) return o = new n(), i.setRouter(o), "#reset" === (s = window.location.hash) || "#logout" === s ? (t.history.start(), | |
void 0) : (t.history.start({ | |
silent: !0 | |
}), e = function(e) { | |
return t.history.navigate(e, { | |
trigger: !1, | |
replace: !0 | |
}), t.history.loadUrl(); | |
}, h.then(function(t) { | |
var n, i, s, a; | |
i = t[0], f && i.date === (null != (s = f.match(/^(\d\d\d\d\/\d\d\/\d\d)\b/)) ? null != (a = s[1]) ? a.replace(/\//g, "-") : void 0 : void 0) ? (r.log("return to last article read: " + f), | |
e(f)) : (n = i.date.replace(/-/g, "/"), r.log("show edition selector, with today's date preloaded: " + n), | |
e(n), o.coreApp.once("layoutReady", function() { | |
return o.coreApp.showEditionSelector({ | |
modelId: i.id, | |
isLaunchView: !0 | |
}); | |
})); | |
}, function() { | |
if (!f) throw new Error("offline with no saved data"); | |
return r.log("offline, go to last hash: " + f), e(f); | |
}).otherwise(function(e) { | |
var t, n; | |
return u(e), t = new c({ | |
alertModel: { | |
text: 'Unable to load Today’s Paper. Please make sure you are connected to the\nInternet and try again. For more information, please <a\nhref="http://www.nytimes.com/content/help/mobile/todays-paper/todays-paper.html"\ntarget="_blank">visit our FAQ</a>.', | |
buttons: [ "Refresh" ] | |
} | |
}), t.once("button0", function() { | |
return window.location.reload(!0); | |
}), n = new l({ | |
nestView: t, | |
className: "alert", | |
disallowClose: !0 | |
}), n.render(); | |
})); | |
})); | |
}); | |
}, "production" === (t = window.ENV) || "staging" === t ? e() : require([ "components/when/monitor/console" ], function() { | |
return e(), require([ "models/edition.model", "models/section.model", "models/article.model", "models/image.model", "utils/arraybuffer-helpers", "utils/local-kvs", "when", "backbone", "logger", "core.app", "utils/typed-arraybuffer", "utils/binary-ajax", "utils/local-kvs-schema", "utils/when-ajax", "utils/manifest", "utils/global-events" ], function(e, t, r, i, o, s, a, u, l, c, d, p, h, f, m, g) { | |
var v, y; | |
return m.listen(), g.on("manifest:downloading", function() { | |
return l.debug("Manifest is downloading..."); | |
}), g.on("manifest:checking", function() { | |
return l.debug("Manifest is being checked..."); | |
}), g.on("manifest:updateReady", function() { | |
return l.debug("Manifest is updating"); | |
}), g.on("manifest:updated", function() { | |
return l.debug("Manifest is updated"); | |
}), window.cb = v = function() { | |
var e; | |
return e = 1 <= arguments.length ? n.call(arguments, 0) : [], console.log.apply(console, [ "cb" ].concat(n.call(e))), | |
window.cb_args = e; | |
}, window.cb2 = y = function() { | |
var e; | |
return e = 1 <= arguments.length ? n.call(arguments, 0) : [], console.log.apply(console, [ "cb2" ].concat(n.call(e))), | |
window.cb2_args = e; | |
}, window.Edition = e, window.Section = t, window.Article = r, window.ArticleImage = i, | |
window.nukeDBs = function() { | |
var e; | |
return a.settle(function() { | |
var t, n, r, i; | |
for (r = h.STORE_NAMES, i = [], t = 0, n = r.length; n > t; t++) e = r[t], i.push(new s(e).nuke()); | |
return i; | |
}()); | |
}, window.AbHelpers = o, window.LocalKvs = s, window.When = a, window.Backbone = u, | |
window.CoreApp = c, window.logger = l, window.TypedArrayBuffer = d, window.BinaryAjax = p; | |
}); | |
}); | |
}.call(this), define("main", function() {}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment