Skip to content

Instantly share code, notes, and snippets.

Created May 13, 2016 21:11
Show Gist options
  • Save anonymous/9b0aa8957240f2e9e6985cd2034e29f7 to your computer and use it in GitHub Desktop.
Save anonymous/9b0aa8957240f2e9e6985cd2034e29f7 to your computer and use it in GitHub Desktop.
Brightcove flash player
(function(e, n, r) {
var o = /\+/g;
function t(e) {
return e
}
function i(e) {
return decodeURIComponent(e.replace(o, " "))
}
var u = e.cookie = function(o, a, s) {
if (a !== r) {
s = e.extend({}, u.defaults, s);
if (a === null) {
s.expires = -1
}
if (typeof s.expires === "number") {
var p = s.expires,
c = s.expires = new Date;
c.setDate(c.getDate() + p)
}
a = u.json ? JSON.stringify(a) : String(a);
return n.cookie = [encodeURIComponent(o), "=", u.raw ? a : encodeURIComponent(a), s.expires ? "; expires=" + s.expires.toUTCString() : "", s.path ? "; path=" + s.path : "", s.domain ? "; domain=" + s.domain : "", s.secure ? "; secure" : ""].join("")
}
var f = u.raw ? t : i;
var l = n.cookie.split("; ");
for (var d = 0, m; m = l[d] && l[d].split("="); d++) {
if (f(m.shift()) === o) {
var v = f(m.join("="));
return u.json ? JSON.parse(v) : v
}
}
return null
};
u.defaults = {};
e.removeCookie = function(n, r) {
if (e.cookie(n) !== null) {
e.cookie(n, null, r);
return true
}
return false
}
})(jQuery, document);
(function(e, n) {
"use strict";
var l = typeof Element !== "undefined" && "ALLOW_KEYBOARD_INPUT" in Element,
r = function() {
var e, l;
var r = [
["requestFullscreen", "exitFullscreen", "fullscreenElement", "fullscreenEnabled", "fullscreenchange", "fullscreenerror"],
["webkitRequestFullscreen", "webkitExitFullscreen", "webkitFullscreenElement", "webkitFullscreenEnabled", "webkitfullscreenchange", "webkitfullscreenerror"],
["webkitRequestFullScreen", "webkitCancelFullScreen", "webkitCurrentFullScreenElement", "webkitCancelFullScreen", "webkitfullscreenchange", "webkitfullscreenerror"],
["mozRequestFullScreen", "mozCancelFullScreen", "mozFullScreenElement", "mozFullScreenEnabled", "mozfullscreenchange", "mozfullscreenerror"],
["msRequestFullscreen", "msExitFullscreen", "msFullscreenElement", "msFullscreenEnabled", "MSFullscreenChange", "MSFullscreenError"]
];
var t = 0;
var u = r.length;
var c = {};
for (; t < u; t++) {
e = r[t];
if (e && e[1] in n) {
for (t = 0, l = e.length; t < l; t++) {
c[r[0][t]] = e[t]
}
return c
}
}
return false
}(),
t = {
request: function(e) {
var t = r.requestFullscreen;
e = e || n.documentElement;
if (/5\.1[\.\d]* Safari/.test(navigator.userAgent)) {
e[t]()
} else {
e[t](l && Element.ALLOW_KEYBOARD_INPUT)
}
},
exit: function() {
n[r.exitFullscreen]()
},
toggle: function(e) {
if (this.isFullscreen) {
this.exit()
} else {
this.request(e)
}
},
onchange: function() {},
onerror: function() {},
raw: r
};
if (!r) {
e.screenfull = false;
return
}
Object.defineProperties(t, {
isFullscreen: {
get: function() {
return !!n[r.fullscreenElement]
}
},
element: {
enumerable: true,
get: function() {
return n[r.fullscreenElement]
}
},
enabled: {
enumerable: true,
get: function() {
return !!n[r.fullscreenEnabled]
}
}
});
n.addEventListener(r.fullscreenchange, function(e) {
t.onchange.call(t, e)
});
n.addEventListener(r.fullscreenerror, function(e) {
t.onerror.call(t, e)
});
e.screenfull = t
})(window, document);
(function(e, n) {
var t = Array.prototype.slice,
i = decodeURIComponent,
r = e.param,
a, f, u, o = e.bbq = e.bbq || {},
c, s, l, d = e.event.special,
p = "hashchange",
h = "querystring",
m = "fragment",
g = "elemUrlAttr",
v = "location",
y = "href",
b = "src",
$ = /^.*\?|#.*$/g,
x = /^.*\#/,
j, w = {};
function A(e) {
return typeof e === "string"
}
function N(e) {
var n = t.call(arguments, 1);
return function() {
return e.apply(this, n.concat(t.call(arguments)))
}
}
function S(e) {
return e.replace(/^[^#]*#?(.*)$/, "$1")
}
function q(e) {
return e.replace(/(?:^[^?#]*\?([^#]*).*$)?.*/, "$1")
}
function C(t, a, u, o, c) {
var s, l, d, p, g;
if (o !== undefined) {
d = u.match(t ? /^([^#]*)\#?(.*)$/ : /^([^#?]*)\??([^#]*)(#?.*)/);
g = d[3] || "";
if (c === 2 && A(o)) {
l = o.replace(t ? x : $, "")
} else {
p = f(d[2]);
o = A(o) ? f[t ? m : h](o) : o;
l = c === 2 ? o : c === 1 ? e.extend({}, o, p) : e.extend({}, p, o);
l = r(l);
if (t) {
l = l.replace(j, i)
}
}
s = d[1] + (t ? "#" : l || !d[1] ? "?" : "") + l + g
} else {
s = a(u !== undefined ? u : n[v][y])
}
return s
}
r[h] = N(C, 0, q);
r[m] = a = N(C, 1, S);
a.noEscape = function(n) {
n = n || "";
var t = e.map(n.split(""), encodeURIComponent);
j = new RegExp(t.join("|"), "g")
};
a.noEscape(",/");
e.deparam = f = function(n, t) {
var r = {},
a = {
"true": !0,
"false": !1,
"null": null
};
e.each(n.replace(/\+/g, " ").split("&"), function(n, f) {
var u = f.split("="),
o = i(u[0]),
c, s = r,
l = 0,
d = o.split("]["),
p = d.length - 1;
if (/\[/.test(d[0]) && /\]$/.test(d[p])) {
d[p] = d[p].replace(/\]$/, "");
d = d.shift().split("[").concat(d);
p = d.length - 1
} else {
p = 0
}
if (u.length === 2) {
c = i(u[1]);
if (t) {
c = c && !isNaN(c) ? +c : c === "undefined" ? undefined : a[c] !== undefined ? a[c] : c
}
if (p) {
for (; l <= p; l++) {
o = d[l] === "" ? s.length : d[l];
s = s[o] = l < p ? s[o] || (d[l + 1] && isNaN(d[l + 1]) ? {} : []) : c
}
} else {
if (e.isArray(r[o])) {
r[o].push(c)
} else if (r[o] !== undefined) {
r[o] = [r[o], c]
} else {
r[o] = c
}
}
} else if (o) {
r[o] = t ? undefined : ""
}
});
return r
};
function E(e, n, t) {
if (n === undefined || typeof n === "boolean") {
t = n;
n = r[e ? m : h]()
} else {
n = A(n) ? n.replace(e ? x : $, "") : n
}
return f(n, t)
}
f[h] = N(E, 0);
f[m] = u = N(E, 1);
if (!e[g]) {
e[g] = function(n) {
return e.extend(w, n)
}({
a: y,
base: y,
iframe: b,
img: b,
input: b,
form: "action",
link: y,
script: b
})
}
l = e[g];
function R(n, t, i, a) {
if (!A(i) && typeof i !== "object") {
a = i;
i = t;
t = undefined
}
return this.each(function() {
var f = e(this),
u = t || l()[(this.nodeName || "").toLowerCase()] || "",
o = u && f.attr(u) || "";
f.attr(u, r[n](o, i, a))
})
}
e.fn[h] = N(R, h);
e.fn[m] = N(R, m);
o.pushState = c = function(e, t) {
if (A(e) && /^#/.test(e) && t === undefined) {
t = 2
}
var i = e !== undefined,
r = a(n[v][y], i ? e : {}, i ? t : 2);
n[v][y] = r + (/#/.test(r) ? "" : "#")
};
o.getState = s = function(e, n) {
return e === undefined || typeof e === "boolean" ? u(e) : u(n)[e]
};
o.removeState = function(n) {
var t = {};
if (n !== undefined) {
t = s();
e.each(e.isArray(n) ? n : arguments, function(e, n) {
delete t[n]
})
}
c(t, 2)
};
d[p] = e.extend(d[p], {
add: function(n) {
var t;
function i(e) {
var n = e[m] = a();
e.getState = function(e, t) {
return e === undefined || typeof e === "boolean" ? f(n, e) : f(n, t)[e]
};
t.apply(this, arguments)
}
if (e.isFunction(n)) {
t = n;
return i
} else {
t = n.handler;
n.handler = i
}
}
})
})(jQuery, this);
(function(e, n, t) {
"$:nomunge";
var i, r = e.event.special,
a = "location",
f = "hashchange",
u = "href",
o = e.browser,
c = document.documentMode,
s = o.msie && (c === t || c < 8),
l = "on" + f in n && !s;
function d(e) {
e = e || n[a][u];
return e.replace(/^[^#]*#?(.*)$/, "$1")
}
e[f + "Delay"] = 100;
r[f] = e.extend(r[f], {
setup: function() {
if (l) {
return false
}
e(i.start)
},
teardown: function() {
if (l) {
return false
}
e(i.stop)
}
});
i = function() {
var t = {},
i, r, o, c;
function l() {
o = c = function(e) {
return e
};
if (s) {
r = e('<iframe src="javascript:0"/>').hide().insertAfter("body")[0].contentWindow;
c = function() {
return d(r.document[a][u])
};
o = function(e, n) {
if (e !== n) {
var t = r.document;
t.open().close();
t[a].hash = "#" + e
}
};
o(d())
}
}
t.start = function() {
if (i) {
return
}
var t = d();
o || l();
(function r() {
var s = d(),
l = c(t);
if (s !== t) {
o(t = s, l);
e(n).trigger(f)
} else if (l !== t) {
n[a][u] = n[a][u].replace(/#.*/, "") + "#" + l
}
i = setTimeout(r, e[f + "Delay"])
})()
};
t.stop = function() {
if (!r) {
i && clearTimeout(i);
i = 0
}
};
return t
}()
})(jQuery, this);
var Phoenix = function() {};
Phoenix._$body = $("body");
Phoenix._$window = $(window);
Phoenix._$document = $(document);
Phoenix._$messageBlock = $("#message-block");
Phoenix.setWindow = function() {
return Phoenix._$window
};
Phoenix.setDocument = function() {
return Phoenix._$document
};
Phoenix.setBody = function() {
return Phoenix._$body
};
Phoenix.setMessageBlock = function() {
return Phoenix._$messageBlock
};
Phoenix.getWindow = function() {
return Phoenix._$document
};
Phoenix.getDocument = function() {
return Phoenix._$document
};
Phoenix.getBody = function() {
return Phoenix._$body
};
Phoenix.getMessageBlock = function() {
return Phoenix._$messageBlock
};
Phoenix._uniqueIdAlphabet = "abcdefghijklmnopqrstuvwxyz0123456789";
Phoenix._uniqueIdAlphabetLength = Phoenix._uniqueIdAlphabet.length - 1;
Phoenix.makeUniqueId = function(e, n) {
var o = "";
var t = 0,
i = Phoenix._uniqueIdAlphabetLength;
var u = Phoenix._uniqueIdAlphabet;
var h, r;
if (e === undefined) {
e = ""
}
for (h = 0, r; h < n; h++) {
r = Math.floor(Math.random() * (i - t + 1)) + t;
o += u[r]
}
return e + o
};
Phoenix.userLoggedIn = function() {
return $("meta[name=userAuthState]").attr("content") === "loggedIn"
};
(function(n) {
"use strict";
var i = "CampaignParams";
var e = n.Phoenix || {};
var t = ["ftag", "socc", "ttag", "utm_source", "utm_medium", "utm_campaign", "vndid"];
var r = ["ftag", "vndid"];
var a = function(n) {
var i, e, t, r, a, f;
if (n.length > 0 && n.indexOf("=") > 0) {
e = n.split("&");
for (f = 0; f < e.length; f++) {
t = e[f];
if (t.indexOf("=") > 0) {
t = t.split("=");
r = t[0];
a = t[1];
if (r && a) {
if (!i) {
i = {}
}
i[r] = a
}
}
}
}
return i
};
var f = function(n, i) {
var e, t, r, a;
if (n) {
for (a = 0; a < i.length; a++) {
t = i[a];
r = n[t];
if (!!r) {
if (undefined === e) {
e = {}
}
e[t] = r
}
}
}
if (undefined === e) {
e = null
}
return e
};
var u = function(n, i) {
var e;
return function() {
if (undefined === e) {
e = f(a(window.location[n].substring(1)), i)
}
return e
}
};
e[i] = {
getParams: function() {
var n;
return function() {
if (undefined === n) {
var i = this,
e = i.getHashParams(),
t = i.getQueryParams();
if (t) {
n = $.extend({}, t)
}
if (e) {
if (n) {
n = $.extend(n, e)
} else {
n = $.extend({}, e)
}
}
if (undefined === n) {
n = null
}
}
return n
}
}(),
getHashParams: u("hash", r),
getQueryParams: u("search", t)
};
n.Phoenix = e
})(this);
Phoenix.jQuery = function(e, n) {
"use strict";
var t = {};
var r = {
setWindow: function() {
t.win = $(e);
return t.win
},
setDocument: function() {
t.doc = $(n);
return t.doc
},
setHtml: function() {
t.html = $("html");
return t.html
},
setBody: function() {
t.body = $("body");
return t.body
},
setWrapper: function() {
t.wrapper = $("#wrapper");
return t.wrapper
},
setMessageBlock: function() {
t.messageBlock = $("#message-block");
return t.messageBlock
},
setLoadingScreen: function(e) {
if (!e) {
e = "Very busy&hellip;"
}
t.loadingScreen = $('<div class="modal-backdrop"></div><div class="loading-global">' + e + "</div>").data("msg", e);
return t.loadingScreen
}
};
var o = {
getWindow: function() {
return t.win || r.setWindow()
},
getDocument: function() {
return t.doc || r.setDocument()
},
getHtml: function() {
return t.html || r.setHtml()
},
getBody: function() {
return t.body || r.setBody()
},
getWrapper: function() {
return t.wrapper || r.setWrapper()
},
getMessageBlock: function() {
return t.messageBlock || r.setMessageBlock()
},
getLoadingScreen: function(e, n) {
return t.loadingScreen && (t.loadingScreen.data("msg") === e || n) ? t.loadingScreen : r.setLoadingScreen(e)
},
getEvents: function(n) {
var t = function() {
var n = $(this);
var r = n.data("events");
if (r === undefined) {
return
}
e.console.log(n, r);
if (n.children().length !== 0) {
t(n.children())
}
};
var r = n.data("events");
if (r !== undefined) {
e.console.log(n, n.data("events"))
}
n.children().each(t)
}
};
return o
}(this, this.document);
var AjaxApiRequest = function() {
"use strict";
var e = {
makeApiRequest: function(e, t, a, i, r) {
if (typeof t == "undefined" || typeof a == "undefined") {
throw "Must specify params, and post or get for makeApiRequest"
}
return n(e, t, a, i, r)
},
makeGetApiRequest: function(e, t, a, i) {
if (typeof t == "function") {
i = a;
a = t;
t = null
}
return n(e, t, false, a, i)
},
makePostApiRequest: function(e, t, a, i) {
if (typeof t == "function") {
i = a;
a = t;
t = null
}
return n(e, t, true, a, i)
},
makeAppropriateApiRequest: function(e, t, a, i) {
if (typeof t == "function") {
i = a;
a = t;
t = null
}
var r = JSON.stringify(t);
if (r.length > 1800) {
return n(e, t, true, a, i)
} else {
return n(e, t, false, a, i)
}
},
eoo: null
};
(function() {
$(document).ready(function() {
$(".js-ajax-api-request").click(function(e) {
e.preventDefault();
var t = $(this);
var a = "";
var i = t.attr("data-api-url-from");
if (typeof i != "undefined") {
a = $(i).val()
} else {
a = t.attr("href")
}
if (t.data("add-class")) {
n(a, null, true, function() {
t.toggleClass(t.data("add-class"));
t.attr("href", "#null")
})
} else {
n(a, null, true)
}
});
$(".js-ajax-api-request-select").change(function() {
n($(this).val())
});
$(".js-ajax-api-track-anchor").click(function(e) {
var n = $(this);
if (n.data("api_anchor_event_called") === true) {
return
}
var a = n.attr("data-tracking-token");
if (t(a)) {
n.data("api_anchor_event_called", true);
Phoenix.getDocument().trigger("api_anchor_event", a);
var i = n.attr("href");
if (i.charAt(0) != "#") {
e.preventDefault();
var r = n.attr("target");
setTimeout(function() {
n.data("api_anchor_event_called", false);
if (!r || r === "") {
window.location = i
} else {
window.open(i, r)
}
}, 1e3)
} else {
n.data("api_anchor_event_called", false)
}
}
});
$(".js-ajax-api-track-form-submit").click(function(e) {
var n = $(this);
var a = n.attr("data-tracking-token");
if (!t(a)) {
return
}
if (n.data().formPostLatch === undefined) {
e.preventDefault();
Phoenix.getDocument().trigger("api_result_event", a);
n.prop("disabled", true);
n.data().formPostLatch = true;
setTimeout(function() {
n.prop("disabled", false);
if (navigator.userAgent.search("Firefox") == -1) {
n.trigger("click")
} else {
var e = n.parents("form");
if (e[0]) {
if (typeof tinymce != "undefined") {
tinymce.triggerSave()
}
e.submit()
}
}
}, 250)
} else {
delete n.data().formPostLatch
}
})
})
})();
function t(e) {
return typeof e != "undefined" && e && e !== ""
}
function n(e, t, n, a, i) {
if (typeof n == "undefined") {
n = false
}
if (typeof a == "undefined") {
a = function() {}
}
if (typeof i == "undefined") {
i = function() {}
}
var r = n ? $.post : $.get;
var f = r(e, t, function(e, t, n) {
if (typeof e != "undefined" && e && typeof e.trackingToken != "undefined") {
Phoenix.getDocument().trigger("api_result_event", [e])
}
a(e, t, n)
}).error(function(e, t, n) {
i(n, e)
}).statusCode({
0: function(e) {},
303: function(e) {},
302: function(e) {}
});
return f
}
return e
}();
$(document).ready(function() {
"use strict";
var e = ".js-time-countdown";
var t = "hide";
var a = "time-unit--singular";
var n = "has-ms";
var i = "countdown-id";
var r = "target-date";
var o = "tick";
var u = 1e3;
var s = u * 60;
var f = s * 60;
var l = f * 24;
var d = l / 1e3;
var v = d / 100;
var c = 0;
var m = {};
var h = false;
var w = null;
var g = {};
var p = function(e) {
return (e < 10 ? "0" : "") + e
};
var N = function(e, t) {
var a = "";
if (undefined === t) {
t = "in "
}
if (e.swatch) {
a += "<em>@</em>" + e.swatch + " <em>.beats</em>"
} else {
if (e.days > 0) {
a += e.days + "<em>d</em> "
}
a += p(e.hours) + "<em>h</em> ";
a += p(e.minutes) + "<em>m</em> ";
a += p(e.seconds) + "<em>s</em>"
}
return t + a
};
var y = function(e) {
var t = Date.now(),
a = e - t;
if (a <= 0) {
a = null
}
return a
};
var C = function(e, t) {
if (h) {
var a = Math.floor(e / v) / 100;
if (isNaN(a)) {
a = 0
}
if (a > 0) {
a = a.toFixed(2)
}
return {
swatch: a
}
}
var n = {},
i, r, o, d, c = $.isEmptyObject(t);
if (c || t.days) {
i = Math.floor(e / l);
e -= i * l;
n.days = isNaN(i) ? 0 : i
}
if (c || t.hours) {
r = Math.floor(e / f);
e -= r * f;
n.hours = isNaN(r) ? 0 : r
}
if (c || t.minutes) {
o = Math.floor(e / s);
e -= o * s;
n.minutes = isNaN(o) ? 0 : o
}
if (c || t.seconds) {
d = Math.floor(e / u);
e -= d * u;
n.seconds = isNaN(d) ? 0 : d
}
if (!c && t.milliseconds) {
n.milliseconds = isNaN(e) ? 0 : e
}
return n
};
var j = function(e) {
var t = e.data(i);
if (!t) {
c++;
t = c;
e.data(i, t)
}
return t
};
var x = function(e, t) {
m[e] = t
};
var I = function(e) {
var t = j(e),
a = m[t],
n;
if (undefined === a) {
a = {};
n = e.find(".js-time-unit");
if (!n || 0 === n.length) {
a = null
} else {
n.each(function() {
var e = $(this),
t = e.find(".js-time-value"),
n = e.data("unit");
if (!!n) {
a[n] = {
$element: e,
$value: t
}
}
})
}
m[t] = a
}
return a
};
var M = function(e, n) {
var i = j(e),
r = I(e),
o = 0,
u = false,
s = !!e.data("show-lead-zero"),
f = C(n, r),
l = 0;
if (null !== r) {
$.each(f, function(e, n) {
var i = r[e];
if (!i) {
return
}
var f = n.toString(),
d = i.$element,
v = i.$value,
c = !!d.data("remove-on-zero"),
m = !!d.data("show-on-zero-previous");
if (d) {
if (m === false || 1 > l) {
d.removeClass(t)
}
if (true === c && 1 > n && 1 > l) {
d.remove();
delete r[e];
u = true
} else {
if (n === 1) {
d.addClass(a)
} else {
d.removeClass(a)
}
if (true === s) {
f = p(n)
}
if (!!v && 0 < v.length) {
v.text(f)
} else {
d.text(f)
}
o++
}
}
l += n
})
}
if (0 === o) {
if (!$.isEmptyObject(r)) {
r = null;
x(i, r)
}
if (!f.seconds) {
f = C(n, r)
}
e.html(N(f))
}
if (u) {
x(i, r)
}
};
var T = function(e) {
var t = e.data(n) || null,
a;
if (null === t) {
a = I(e);
if (null !== a && a.milliseconds) {
t = true
}
e.data(n, t)
}
return t
};
var k = function() {
if (null === w) {
w = u;
if (h) {
w = v
}
}
return w
};
var O = function(e, t) {
var a = e,
n;
if (false === t) {
n = Date.now();
a = n % a
}
return a
};
var b = function(e) {
clearTimeout(e.timeoutId);
e.timeoutId = null
};
var z = function(e) {
var t = e.data("live-msg"),
a, n;
e.trigger("complete");
e.data("complete", true);
if (null === t || undefined === t) {
t = "is Live!"
}
e.html(t);
a = g[e.data(o)];
n = a.$countdowns;
n = n.not(e);
a.$countdowns = n
};
var D = function() {
var e = $(this),
t = e.data(r),
a = y(t);
if (a < 3e4 && !e.data("almostComplete")) {
e.trigger("almostComplete");
e.data("almostComplete", true)
}
if (!a) {
z(e);
return
}
M(e, a)
};
var E = function(e, t) {
var a = t.hasTicked,
n = t.$countdowns,
i;
b(t);
if (n.length > 0) {
i = O(e, a);
n.each(D);
if (false === a) {
t.hasTicked = true
}
t.timeoutId = setTimeout(function() {
E(e, t)
}, i)
}
};
var P = function() {
var e, t;
for (e in g) {
if (g.hasOwnProperty(e)) {
t = g[e];
E(e, t)
}
}
};
var q = function() {
var e = this,
t = $(e),
a = t.data("timestamp") || t.text(),
n = parseInt(a, 10) * 1e3,
i;
t.data(r, n);
j(t);
if (!h && T(t)) {
i = 1
} else {
i = k()
}
t.data(o, i);
if (undefined === g[i]) {
g[i] = []
}
g[i].push(e)
};
var F = function(e) {
var a = $.deparam.querystring(),
n, i;
if (a.swatch) {
h = true
}
e.each(q);
e.removeClass(t);
e.addClass("is-counting");
for (n in g) {
if (g.hasOwnProperty(n)) {
i = g[n];
if (typeof i["$countdowns"] === "undefined") {
g[n] = {
timeoutId: null,
hasTicked: false,
$countdowns: $(i)
}
}
}
}
P()
};
(function() {
var t = $(e);
if (!t || t.length === 0) {
return
}
F(t)
})();
$(document).ajaxComplete(function() {
w++;
var t = $(e).not(".is-counting");
if (!t || t.length === 0) {
return
}
F(t)
})
});
var ajax = new XMLHttpRequest;
ajax.open("GET", "/bundles/phoenixsite/images/core/sprites/icons/svg/icons-sprite-min.svg", true);
ajax.send();
ajax.onload = function(e) {
var t = document.createElement("div");
t.innerHTML = ajax.responseText;
t.setAttribute("id", "js-svgDef-icons");
t.setAttribute("style", "displaY: none");
document.body.insertBefore(t, document.body.lastChild.nextSibling)
};
(function(t, n, e) {
var i = "hashchange",
o = document,
r, c = t.event.special,
a = o.documentMode,
f = "on" + i in n && (a === e || a > 7);
function u(t) {
t = t || location.href;
return "#" + t.replace(/^[^#]*#?(.*)$/, "$1")
}
t.fn[i] = function(t) {
return t ? this.bind(i, t) : this.trigger(i)
};
t.fn[i].delay = 50;
c[i] = t.extend(c[i], {
setup: function() {
if (f) {
return false
}
t(r.start)
},
teardown: function() {
if (f) {
return false
}
t(r.stop)
}
});
r = function() {
var r = {},
c, a = u(),
s = function(t) {
return t
},
l = s,
d = s;
r.start = function() {
c || p()
};
r.stop = function() {
c && clearTimeout(c);
c = e
};
function p() {
var e = u(),
o = d(a);
if (e !== a) {
l(a = e, o);
t(n).trigger(i)
} else {
if (o !== a) {
location.href = location.href.replace(/#.*/, "") + o
}
}
c = setTimeout(p, t.fn[i].delay)
}
t.browser.msie && !f && function() {
var n, e;
r.start = function() {
if (!n) {
e = t.fn[i].src;
e = e && e + u();
n = t('<iframe tabindex="-1" title="empty"/>').hide().one("load", function() {
e || l(u());
p()
}).attr("src", e || "javascript:0").insertAfter("body")[0].contentWindow;
o.onpropertychange = function() {
try {
if (event.propertyName === "title") {
n.document.title = o.title
}
} catch (t) {}
}
}
};
r.stop = s;
d = function() {
return u(n.location.href)
};
l = function(e, r) {
var c = n.document,
a = t.fn[i].domain;
if (e !== r) {
c.title = o.title;
c.open();
a && c.write('<script>document.domain="' + a + '"</script>');
c.close();
n.location.hash = e
}
}
}();
return r
}()
})(jQuery, this);
(function() {
"use strict";
window.PhoenixUtils = {
getHtmlTemplate: function(n) {
var r = $('script[type="text/template/' + n + '"]');
if (!r.length) {
return ""
}
return r.html().trim()
},
cloneObject: function(n) {
try {
return JSON.parse(JSON.stringify(n))
} catch (r) {
return null
}
},
fromJson: function(n) {
try {
return JSON.parse(n)
} catch (r) {
return null
}
},
toJson: function(n) {
try {
return JSON.stringify(n)
} catch (r) {
return null
}
},
capitalizeString: function(n) {
return n.charAt(0).toUpperCase() + n.slice(1)
},
getBrowser: function() {
if (typeof navigator.userAgent == "undefined") {
return "unknown"
}
if (navigator.userAgent.search("Chrome") != -1) {
return "chrome"
}
if (navigator.userAgent.search("Firefox") != -1) {
return "firefox"
}
if (navigator.userAgent.search("Safari") != -1) {
return "safari"
}
if (navigator.userAgent.search("MSIE") != -1) {
return "ie"
}
return "unknown"
},
getIEVersion: function() {
return parseFloat(navigator.appVersion.split("MSIE")[1])
},
getOS: function() {
var n = navigator.appVersion;
if (n.indexOf("Windows") != -1) {
var r = n.indexOf("Windows NT");
if (r == -1) {
return "Windows9x"
}
var i = n.substr(r + 11, 3);
if (i == "6.2") {
return "Windows8"
}
if (i == "6.1") {
return "Windows7"
}
if (i == "6.0") {
return "WindowsVista"
}
if (i == "5.1") {
return "WindowsXP"
}
if (i == "5.0") {
return "Windows2K"
}
return "WindowsNT"
}
if (n.indexOf("iPad") != -1) {
return "iOS-iPad"
}
if (n.indexOf("iPhone") != -1) {
return "iOS-iPhone"
}
if (n.indexOf("iPod") != -1) {
return "iOS-iPod"
}
if (n.indexOf("Android") != -1) {
return "Android"
}
if (n.indexOf("Mac") != -1) {
return "MacOS"
}
if (n.indexOf("X11") != -1) {
return "UNIX"
}
if (n.indexOf("Linux") != -1) {
return "Linux"
}
return "Unknown"
},
eoo: null
}
})();
var UrlMaster = function() {
"use strict";
var n = {
setOrigin: function(n) {
e = n
},
setPath: function(n) {
t = n
},
addParam: function(n, e) {
r[n] = e
},
removeParam: function(n) {
if (typeof(r[n] != "undefined")) {
delete r[n]
}
},
hasParam: function(n) {
return r.hasOwnProperty(n)
},
getParam: function(n, e) {
if (typeof e == "undefined") {
e = null
}
if (!r.hasOwnProperty(n)) {
return e
}
if (typeof r[n] == "undefined") {
return true
} else {
return decodeURIComponent(r[n])
}
},
getAllParams: function() {
return r
},
clearParams: function() {
r = {}
},
paramExists: function(n) {
return typeof(r[n] != "undefined")
},
setHash: function(n) {
a = n
},
getHash: function() {
return a
},
setHashLive: function(n, e, t) {
if (typeof e == "undefined") {
e = false
}
if (typeof t == "undefined") {
t = false
}
f = e;
window.location.hash = n;
if (t) {
a = n
}
},
getHashLive: function() {
var n = window.location.hash;
if (n === "") {
return ""
}
return decodeURI(n.toLowerCase()).substr(1)
},
getHashParams: function(n) {
if (typeof n == "undefined") {
n = {}
}
var e = window.location.hash;
if (e === "") {
return {}
}
var t = s(e.substr(1));
$.extend(n, t);
return n
},
setHashParams: function(e, t) {
var a = "";
for (var r in e) {
if (e.hasOwnProperty(r)) {
a += r + ":" + e[r] + ";"
}
}
a = encodeURI(a.substr(0, a.length - 1));
n.setHash(a, t)
},
updateHashParams: function(e, t) {
var a = n.getHashParams();
for (var r in e) {
if (e.hasOwnProperty(r)) {
a[r] = e[r]
}
}
n.setHashParams(a, t)
},
bindHashChange: function(n, e) {
if (!i) {
throw "Hash change support not available."
}
if (o.indexOf(n) != -1) {
return
}
o.push(n);
if (typeof e != "undefined" && e) {
n()
}
},
unbindHashChange: function(n) {
if (!i) {
throw "Hash change support not available."
}
var e = o.indexOf(n);
if (e == -1) {
return
}
o.splice(e, 1)
},
generateUrl: function(n) {
var i = "";
if (!n) {
if (e !== "") {
i = e
} else {
i = window.location.protocol + "//" + window.location.hostname
}
if (window.location.port.length) {
i += ":" + window.location.port
}
}
if (t !== "") {
i += t
} else {
i += window.location.pathname
}
if (Object.keys(r).length) {
i += "?";
for (var o in r) {
if (r.hasOwnProperty(o)) {
i += o + "=" + encodeURIComponent(r[o]) + "&"
}
}
i = i.substr(0, i.length - 1)
}
if (a !== "") {
i += "#" + a
}
return i
},
eoo: null
};
var e = "";
var t = "";
var a = "";
var r = {};
var i = false;
var o = [];
var f = false;
(function() {
var n = window.location.search;
if (n !== "") {
n = n.substr(1);
n.split("&").forEach(function(n) {
var e = n.split("=");
r[e[0]] = e[1]
})
}
a = window.location.hash;
if (a != "") {
a = a.substr(1)
}
var e = $(window);
if (e.hashchange) {
i = true;
e.hashchange(function() {
if (f) {
f = false;
return
}
o.forEach(function(n) {
n()
})
})
}
})();
function s(n) {
var e = {};
if (typeof n == "undefined" || !n) {
return e
}
try {
n.split(";").forEach(function(n) {
var t = n.split(":");
if (t.length == 2) {
var a = t[0].replace(/\s/g, "");
e[a] = t[1].replace(/^[ \t]+|[ \t]+$ /, "")
} else {
e[t[0]] = null
}
})
} catch (t) {
return []
}
return e
}
return n
};
var PostRender = function() {
var e = null;
var r = "";
var n = [];
var t = function() {
var t = {};
$("[data-post-render-param]").each(function(e, r) {
var n = $(r);
var o = n.attr("data-post-render-param");
var a = n.attr("data-post-render-value");
var i = o.endsWith("[]");
if (i) {
o = o.substr(0, o.length - 2)
}
var u = o.split(".");
if (typeof t[u[0]] == "undefined") {
t[u[0]] = {}
}
if (i) {
if (typeof t[u[0]][u[1]] == "undefined") {
t[u[0]][u[1]] = [a]
} else {
t[u[0]][u[1]].push(a)
}
} else {
t[u[0]][u[1]] = a
}
});
var o = new UrlMaster;
var a = "to",
u = "ll",
f = "ca",
d = "an",
s = "Ph",
l = "ph";
var p = {
pjs: window[f + u + s + d + a + "m"] || window["_" + l + d + a + "m"] ? true : false
};
var v = {
page: o.generateUrl(true),
params: t,
signature: p
};
var c = o.getParam("ip_override", null);
if (c) {
v.ip_override = c
}
AjaxApiRequest.makePostApiRequest("/postRender", v, function(n) {
if (n.result != "ok") {
e = "error";
r = "server error: " + n.error
} else {
e = n.data
}
h()
}, function(n) {
e = "error";
r = "network error: " + n;
h()
});
function h() {
n.forEach(function(e) {
i(e.bundle, e.completionFn, e.errorFn)
})
}
};
var o = {
getPostRenderData: function(r, t, o) {
if (e) {
setTimeout(function() {
i(r, t, o)
}, 0)
} else {
n.push({
bundle: r,
completionFn: t,
errorFn: o
})
}
},
executePostRender: function() {
e = null;
r = "";
n = [];
t()
},
eoo: null
};
var a = true;
$(document).ready(function() {
if (a) {
t()
}
a = false
});
function i(n, t, o) {
if (e === "error") {
if (typeof o == "function") {
o(r)
}
return
}
if (n && typeof e[n] == "undefined") {
if (typeof o == "function") {
o("bundle does not provide post render data")
}
return
}
t(e._common, n ? e[n] : undefined)
}
return o
}();
if (!String.prototype.endsWith) {
Object.defineProperty(String.prototype, "endsWith", {
value: function(e, r) {
var n = this.toString();
if (r === undefined || r > n.length) {
r = n.length
}
r -= e.length;
var t = n.indexOf(e, r);
return t !== -1 && t === r
}
})
}
(function(e, t, i) {
var a = "object",
n = true;
function r(e, t) {
var i = (e[0] || 0) - (t[0] || 0);
return i > 0 || !i && e.length > 0 && r(e.slice(1), t.slice(1))
}
function s(e) {
if (typeof e != a) {
return e
}
var t = [],
i = "";
for (var r in e) {
if (typeof e[r] == a) {
i = s(e[r])
} else {
i = [r, n ? encodeURI(e[r]) : e[r]].join("=")
}
t.push(i)
}
return t.join("&")
}
function o(e) {
var t = [];
for (var i in e) {
if (e[i]) {
t.push([i, '="', e[i], '"'].join(""))
}
}
return t.join(" ")
}
function l(e) {
var t = [];
for (var i in e) {
t.push(['<param name="', i, '" value="', s(e[i]), '" />'].join(""))
}
return t.join("")
}
var c;
try {
c = i.description || function() {
return new i("ShockwaveFlash.ShockwaveFlash").GetVariable("$version")
}()
} catch (f) {
c = "Unavailable"
}
var h = c.match(/\d+/g) || [0];
e[t] = {
available: h[0] > 0,
activeX: i && !i.name,
version: {
original: c,
array: h,
string: h.join("."),
major: parseInt(h[0], 10) || 0,
minor: parseInt(h[1], 10) || 0,
release: parseInt(h[2], 10) || 0
},
hasVersion: function(e) {
var t = /string|number/.test(typeof e) ? e.toString().split(".") : /object/.test(typeof e) ? [e.major, e.minor] : e || [0, 0];
return r(h, t)
},
encodeParams: true,
expressInstall: "expressInstall.swf",
expressInstallIsActive: false,
create: function(e) {
var t = this;
if (!e.swf || t.expressInstallIsActive || !t.available && !e.hasVersionFail) {
return false
}
if (!t.hasVersion(e.hasVersion || 1)) {
t.expressInstallIsActive = true;
if (typeof e.hasVersionFail == "function") {
if (!e.hasVersionFail.apply(e)) {
return false
}
}
e = {
swf: e.expressInstall || t.expressInstall,
height: 137,
width: 214,
flashvars: {
MMredirectURL: location.href,
MMplayerType: t.activeX ? "ActiveX" : "PlugIn",
MMdoctitle: document.title.slice(0, 47) + " - Flash Player Installation"
}
}
}
attrs = {
data: e.swf,
type: "application/x-shockwave-flash",
id: e.id || "flash_" + Math.floor(Math.random() * 999999999),
width: e.width || 320,
height: e.height || 180,
style: e.style || ""
};
n = typeof e.useEncode !== "undefined" ? e.useEncode : t.encodeParams;
e.movie = e.swf;
e.wmode = e.wmode || "opaque";
delete e.fallback;
delete e.hasVersion;
delete e.hasVersionFail;
delete e.height;
delete e.id;
delete e.swf;
delete e.useEncode;
delete e.width;
var i = document.createElement("div");
i.innerHTML = ["<object ", o(attrs), ">", l(e), "</object>"].join("");
return i.firstChild
}
};
e.fn[t] = function(i) {
var n = this.find(a).andSelf().filter(a);
if (/string|object/.test(typeof i)) {
this.each(function() {
var n = e(this),
r;
i = typeof i == a ? i : {
swf: i
};
i.fallback = this;
r = e[t].create(i);
if (r) {
n.children().remove();
n.html(r)
}
})
}
if (typeof i == "function") {
n.each(function() {
var a = this,
n = "jsInteractionTimeoutMs";
a[n] = a[n] || 0;
if (a[n] < 660) {
if (a.clientWidth || a.clientHeight) {
i.call(a)
} else {
setTimeout(function() {
e(a)[t](i)
}, a[n] + 66)
}
}
})
}
return n
}
})(jQuery, "flash", navigator.plugins["Shockwave Flash"] || window.ActiveXObject);
(function(e) {
"use strict";
var a = $(document);
var i = ".js-video-player";
var n = "video";
var t = "states";
var o = 5;
var r = {};
var d = function(e) {
var a = e.data(t),
i = a.videoId,
o = r[i],
d;
if (undefined === o) {
d = e.data(n);
o = d.savePosition;
if (undefined === o) {
o = null
} else {
o["videoId"] = i
}
r[i] = o
}
return o
};
var v = function(e) {
if (!e.api) {
return
}
$.ajax({
type: "POST",
url: e.api.deleteSavedTime,
data: {
video_id: e.videoId
}
})
};
var u = function(e, a) {
if (!e.api) {
return
}
$.ajax({
type: "POST",
url: e.api.setSavedTime,
data: {
video_id: e.videoId,
time_to_save: a
},
async: false
})
};
var f = function(e) {
$.removeCookie(e.cookieName, {
path: "/"
})
};
var c = function(e, a) {
$.cookie(e.cookieName, a, {
path: "/",
expires: o
})
};
var s = function(e) {
v(e);
f(e)
};
var l = function(e, a) {
var i = a.currentTime,
n = Math.floor(i) >= Math.floor(a.duration);
if (n) {
s(e)
} else {
u(e, i);
c(e, i)
}
};
var p = function(e, a) {
var i = $(this),
n = i.data(t),
o = d(i);
if (!o) {
return
}
if (n.adPlaying || !(n.playing || n.paused)) {
return
}
if (a) {
n.currentTime = a
}
l(o, n)
};
a.on("videoPlayerReady", function(e, t) {
var o = t.data(n);
if (!o || !o.savePosition) {
return
}
a.on("contentEnd contentPause contentSeek unloadVideoplayer", i, p)
})
})(this);
(function(e) {
"use strict";
var t = {
version: "v.2013.07.31",
ageMessage: "Sorry you cannot access this content."
};
var i = ".metisVideoPlayer";
var a, n, r, s;
var o = function() {
var t;
return function() {
if (a === t) {
t = e.Phoenix || {}
}
return t
}
}();
var l = function() {
if (a === s) {
var e = o();
if (!!e.jQuery && !!e.jQuery.getWindow) {
s = e.jQuery.getWindow()
} else {
s = $(window)
}
}
return s
};
var u = function() {
if (a === n) {
var e = o();
if (!!e.jQuery && !!e.jQuery.getDocument) {
n = e.jQuery.getDocument()
} else {
n = $(document)
}
}
return n
};
var d = function() {
if (a === r) {
r = $("html, body")
}
return r
};
var f = function(e) {
if (!!e) {
if (!!e.preventDefault) {
e.preventDefault()
}
}
};
var c = function(e) {
var t, i = false;
if (!!JSON && !!JSON.stringify) {
try {
t = JSON.stringify(e);
i = true
} catch (a) {
i = false
}
}
if (!i) {
t = false
}
return t
};
var v = function(e) {
var t = o();
if (!!t.Ui && !!t.Ui.showSuccessMessage) {
t.Ui.showSuccessMessage(e)
}
};
var p = function(e, t) {
if (!e || !t) {
return
}
var i = 0,
a = t.width(),
n = t.offset(),
r = e.pageX - n.left,
s;
if (r < i) {
r = i
} else if (r > a) {
r = a
}
s = r / a;
return s
};
var y = function(e) {
var t = (100 * e).toFixed(2),
i = t.indexOf(".00");
if (i > 0) {
t = t.substr(0, i)
}
return t + "%"
};
var g = 60,
h = 60,
m = 3600,
S = "0",
k = ":";
var C = function(e) {
var t, i, a, n = "",
r = "",
s = "";
if (!e) {
e = 0
}
if (e < 0 || isNaN(e)) {
e = 0
}
t = Math.floor(e % g);
i = Math.floor(e / g % h);
a = Math.floor(e / m);
if (t < 10) {
n = S
}
if (i < 10) {
r = S
}
s = r + i.toString() + k + n + t.toString();
if (e >= m) {
s = a.toString() + k + s
}
return s
};
var P = false;
var T = false,
A = [],
w = function() {
var e = A.push;
if (!!e.apply) {
e.apply(A, [arguments])
} else {
e(Array.prototype.slice.call([arguments]))
}
};
var b = function() {
var t = e.console || {},
i = A,
a;
T = true;
if (!!t.log) {
A = {
push: function() {
var e = t.log,
i = "",
a = "",
n = arguments[0],
r = n[0];
if ("error" === r || "warn" === r || "info" === r) {
i = r;
if (!!t[i]) {
e = t[i]
} else {
a = i.toUpperCase() + ": "
}
n[0] = a
}
n[0] = "[METIS] " + n[0];
if (!!e.apply) {
e.apply(t, n)
} else {
e(Array.prototype.slice.call(n))
}
}
};
w("Enable metis logging");
for (a = 0; a < i.length; a++) {
A.push(i[a])
}
}
};
if (true === T) {
b()
}
var E = "is-vid-disabled";
var D, I = "10",
O = "js-vid-flash",
j = function() {
if (undefined === D) {
if (!swfobject || !swfobject.hasFlashPlayerVersion || !swfobject.hasFlashPlayerVersion(I)) {
D = false
} else {
D = true
}
w("Browser supports flash? " + (D ? "yes" : "no"))
}
return D
},
L = function(e) {
var t;
if (false === j()) {
t = e.find("." + O);
t.remove()
}
};
var N, R = ".js-vid-m3u8",
M = "application/vnd.apple.mpegURL",
V = function() {
if (undefined === N) {
var e = $("<video>")[0];
if (e.canPlayType && e.canPlayType(M) !== "") {
N = true
} else {
N = false
}
w("Browser supports m3u8? " + (N ? "yes" : "no"))
}
return N
},
x = function(e) {
var t = e.find(R);
if (true === V()) {
ge(t)
} else {
t.remove()
}
};
var U, _, B = "js-vid-h264",
q = "." + B,
J = "js-vid-volume-control",
F = "." + J,
G = function() {
if (undefined === U) {
U = false;
if (!!Modernizr) {
if (!!Modernizr.video && Modernizr.video.h264) {
U = true
}
w("Browser supports H264? " + (U ? "yes" : "no"))
} else {
w("error", "hasH264Support(): Modernizr not found")
}
}
return U
},
z = function(e) {
var t = e.find(q);
if (false === G()) {
t.remove()
}
if (!t || t.length < 1) {
U = false
}
},
Q = function() {
if (undefined === _) {
var e = new Audio;
e.volume = .5;
_ = e.volume === .5;
w("Browser supports volume control? " + (_ ? "yes" : "no"))
}
return _
},
W = function(e) {
if (false === Q()) {
e.find(F).remove()
}
},
H = function(e) {
var t = X($(".js-video-player"));
if (!!Modernizr && !!Modernizr.video && Modernizr.video.h264 && t.youtubeKey && t.youtubeID) {
return true
}
return false
};
var Y, K = function() {
if (undefined === Y) {
if (navigator.appName.indexOf("Microsoft") !== -1) {
Y = window
} else {
Y = document
}
}
return Y
};
var X = function(e) {
var t = e.data("video");
if (!t) {
return
}
w("getMetisVideoJSON() videoJSON:\n", $.extend({}, t));
return t
};
var Z = function() {
var e = "[AD CALL] ";
var t = function(t) {
var i = o(),
a = i.CampaignParams && i.CampaignParams.getParams && i.CampaignParams.getParams() || null;
if (t && a) {
w(e + "campaignParams: ", c(a));
t = $.extend(t, a);
w(e + "updated custParams: ", c(t))
}
return t
};
var i = function(e) {
var t;
try {
t = window.self !== window.top
} catch (i) {
t = true
}
if (t) {
try {
e.ptype = window.top.document.getElementById("tracking-om").getAttribute("data-post-render-value")
} catch (i) {}
}
return e
};
return function() {
var a = re.video,
n = a.states.adPlayed,
r = a.videoJSON.adCall,
s = {},
o = {},
l, u;
if (!r || true === n) {
return
}
w(e + "Get adCallUrl");
r = decodeURIComponent(r);
w(e + "Initial adCallUrl: ", r);
l = r.split("?");
if (l.length > 1) {
r = l[0];
s = $.deparam(l[1]);
if (s.cust_params) {
o = i($.deparam(s.cust_params));
w(e + "custParams: ", c(o))
}
}
u = $.cookie("AD_SESSION");
if (!!u) {
if (o.session) {
o.session = u
} else {
o = $.extend({
session: u
}, o)
}
}
o = t(o);
if (!$.isEmptyObject(o)) {
s.cust_params = $.param(o)
}
if (!$.isEmptyObject(s)) {
r = r + "?" + $.param(s)
}
w(e + "Final adCallUrl: ", r);
return r
}
}();
var ee = {
name: "basePlayer",
logPrefix: "",
initialized: false,
playerReady: false,
contentLoading: false,
load: function() {},
init: function() {
this.initialized = true
},
detach: function() {},
play: function() {},
pause: function() {},
resume: function() {},
stop: function() {},
mute: function() {},
unmute: function() {},
setVolume: function() {},
seekTo: function() {},
seekToLive: function() {},
getCurrentTime: function() {
return 0
},
getDuration: function() {},
isInitialized: function() {
return this.initialized
},
isReady: function(e) {
return this.playerReady
},
setPlayerReady: function(e) {
var t = this,
i = t.logPrefix;
if (t.playerReady !== e) {
w(i + "Set playerReady to [" + (e ? "TRUE" : "FALSE") + "]");
t.playerReady = e
}
if (e) {
re.onPlayerReady()
}
},
isContentLoading: function() {
return this.contentLoading
},
setContentLoading: function(e) {
var t = this,
i = t.logPrefix;
if (t.contentLoading !== e) {
w(i + "set contentLoading to [" + (e ? "TRUE" : "FALSE") + "]");
t.contentLoading = e;
re.contentLoading(e)
}
if (!e) {
re.onPlayerReady()
}
},
getAdCall: Z
};
var te = function(e) {
return $.extend({}, ee, e)
};
var ie = function() {
var t = "flash";
var i = "[FLASH] ";
var a = "gamesVideoSwf_";
var n = "__gamesVideoPlayer";
var r = "object";
var s;
var o = function() {
return s
};
var l = function(e) {
s = e
};
var u = {
flashPlayerStarted: function() {
w(i + " flashPlayerStarted()");
p(true)
},
adError: function(e) {
w("error", i + "AD ERROR: " + e)
},
adInfo: function(e) {
w("info", i + "AD : " + e)
},
adProgress: function() {
var e = v(y.playerApiId);
re.videoProgress({
currentTime: e.getCurrentTime_js(),
duration: e.getDuration_js()
});
y.setContentLoading(false)
},
contentProgress: function() {
var e = v(y.playerApiId),
t = {
currentTime: e.getCurrentTime_js(),
duration: e.getDuration_js(),
bytesLoaded: e.bytesLoaded_js(),
bytesTotal: e.bytesTotal_js()
};
y.setContentLoading(false);
re.videoProgress(t)
},
loadMinder: function() {},
onAdStart_flash: function() {
w(i + "onAdStart_flash()");
re.adStart()
},
onAdEnd_flash: function() {
w(i + "onAdEnd_flash()");
re.adEnd()
},
onCBSIPlayerReady: function() {
w(i + "onCBSIPlayerReady()")
},
onContentEnd_flash: function() {
var e = v(y.playerApiId);
if (e.getIsLive_js()) {
var a = e.getCurrentTime_js();
w(i + "attempt to recover the stream", a)
} else {
w(i + "onContentEnd_flash()");
w(i + "currentTime: ", e.getCurrentTime_js());
re.contentEnd(t)
}
},
onContentStart_flash: function() {
w(i + "onContentStart_flash() ===== ");
re.contentStart()
},
onPlaylistEnd: function() {
w(i + "onPlaylistEnd() =====>");
re.playlistEnd(t)
},
onPlaylistStart: function() {
w(i + "onPlaylistStart() =====>")
},
userPause: function() {
w(i + "userPause() =====>");
re.toggleUiPlayPause()
},
videoHasEnded: function() {
w(i + "VIDEO END =====>")
}
};
var d = function(e) {
var t = e.playerId,
i, n = e.videoJSON;
var r = {
uvpUri: n.uvp,
uvpThird: n.uvpThird,
imaUri: n.ima3,
uvpcUri: n.uvpc
};
i = {
id: a + t,
swf: n.swfLocation,
width: "100%",
height: "100%",
allowFullScreen: true,
allowScriptAccess: "always",
flashvars: {
autoPlay: "true",
config: c(r),
duration: n.lengthSeconds,
guid: n.guid,
id: n.id,
mapp: n.mapp,
partner: n.adPartner,
title: n.title
}
};
if (n.diagnosticsUniqueKey) {
i.flashvars.viewerDiagnosticId = n.diagnosticsUniqueKey
}
return i
};
var f = function(e) {
w(i + "BEG initFlashUvpObject() =====>");
var a, n;
if (!!e) {
y.setContentLoading(true);
a = re.getVideoContainer(t);
n = a.find(r);
if (n.length <= 0) {
w(i + "initFlashUvpObject(): Build new flash object tag");
a.flash(d(e));
n = a.find(r);
if (n.length <= 0) {
n = undefined;
w("error", i + "initFlashUvpObject(): unable to create video embed")
}
}
} else {
w("error", i + "initFlashUvpObject(): undefined video")
}
w(i + "END initFlashUvpObject() =====>");
l(n);
return n
};
var v = function(e) {
var t, i = K();
t = i[e];
return t
};
var p = function() {
var e = 1e3;
var t = null;
return function(a) {
var n = true,
r = v(y.playerApiId);
if (null !== t) {
w(i + "isApiAlive() > clear timeout id: ", t);
clearTimeout(t);
t = null
}
try {
w(i + "isApiAlive()?");
n = r.isAPIAlive_js();
if (false === y.playerReady) {
w(i + "isApiAlive > setPlayerReady(true)");
y.setPlayerReady(true)
}
} catch (s) {
w("error", i + s.message);
n = false;
if (true === y.playerReady) {
w(i + "isApiAlive > setPlayerReady(false)");
y.setPlayerReady(false)
}
}
if (false === n && true === a) {
w(i + "isApiAlive > NO -- check again in " + e + "ms");
t = setTimeout(function() {
p(true)
}, e);
w(i + "isApiAlive() > timeout id: ", t)
}
if (true === n) {
w(i + "isApiAlive > YES")
}
return n
}
}();
var y = te({
name: "flashPlayer",
logPrefix: i,
playerApi: null,
playerApiId: null,
load: function() {
if (!e[n]) {
e[n] = u
}
},
init: function() {
var e = this,
t = re.getVideoUi(),
a = o(),
n;
if (e.isInitialized()) {
return
}
w(i + "Init Player API");
if (!!t) {
if (!a) {
a = f(t)
}
if (undefined !== a) {
e.initialized = true;
n = a.attr("id");
if (n !== e.playerApiId) {
e.playerApiId = n;
e.playerApi = v(n)
}
}
} else {
w(i + "Player API init failed :: no video")
}
},
loadVideo: function() {
var e = this,
t = re.getVideoUi(),
a = t.states,
n, r, s, o;
e.setContentLoading(true);
n = {
playback: a.playback,
streamToPlay: t.getVideoUrl(),
mute: a.mute,
volume: a.volume
};
s = e.getAdCall();
o = t.getCuePoints();
if (s) {
n.adCall = s;
n.cuePoints = o
}
r = c(n);
w(i + "loadVideo() params: ", n);
e.playerApi.newContentRequest_js(r)
},
mute: function() {
w(i + "mute()");
this.playerApi.mute_js()
},
pause: function() {
w(i + "pause()");
this.playerApi.pauseButton_js()
},
play: function() {
var e = this,
t = re.getVideoUi(),
i = false;
if (!t) {
return
}
i = e.isInitialized();
if (true === i) {
e.loadVideo()
}
},
replay: function() {
w(i + "replay()");
this.playerApi.replay_js()
},
resume: function() {
w(i + "resume()");
this.playerApi.playButton_js()
},
setVolume: function(e) {
w(i + "setVolume(" + e + ")");
this.playerApi.setVolume_js(e)
},
seekTo: function(e) {
w(i + "seekTo: " + e);
this.setContentLoading(true);
this.playerApi.seekTo_js(e)
},
seekToLive: function() {
w(i + "seekToLive");
this.setContentLoading(true);
this.playerApi.seekToLive_js()
},
stop: function() {
w(i + "stopVideo");
this.setContentLoading(false);
this.playerApi.stopVideo_js()
},
unmute: function() {
w(i + "unMute()");
this.playerApi.unMute_js()
},
fullscreenOn: function() {
w(i + "fullscreenOn");
this.playerApi.userFullscreen_js(1)
},
fullscreenOff: function() {
w(i + "fullscreenOff");
this.playerApi.userFullscreen_js(0)
},
getCurrentTime: function() {
var e = this,
t;
t = e.playerApi.getCurrentTime_js();
return t
},
getDuration: function() {
var e = this,
t;
t = e.playerApi.getDuration_js();
return t
},
isLive: function() {
var e = this,
t = e.playerApi.getIsLive_js();
return t
},
detach: function() {
var e = this;
if (!!e.playerApi) {
w("stop flash player");
e.stop()
}
},
isReady: function() {
var e = this,
t = p();
return t && e.playerReady
}
});
return y
}();
var ae = function() {
var t = "html5";
var i = "[HI5] ";
var a = false;
var n = false;
var r = false;
var s = false;
var o = "click.hi5Player";
var l;
var u = function(e) {
l = e
};
var d = function() {
var e = re.video.els.$imaAdDiv,
t;
if (e) {
t = e.find("video");
if (!t || t.length < 1) {
t = undefined
}
}
return t
};
var f = {
isAd: false,
profile: "prog",
startTime: 0,
endTime: -1,
mapp: "Hi5",
contentVO: {
chapterStartTimes: [],
assetURLs: []
}
};
var c, v = function(e) {
c = e
},
p = function() {
return c
};
var y = {
onPlayerLoaded_cbsi: function() {
var e = re.getVideoUi(),
a = re.getVideoContainer(t),
n = a.find("video"),
r = e.videoJSON;
if (!e || !r) {
return
}
n.removeAttr("controls");
w(i + "PLAYER LOADED =====>\n", n)
},
onPlayerDataLoaded_cbsi: function() {
w(i + "PLAYER DATA LOADED =====>")
},
onPlaylistStart_cbsi: function() {
w(i + "PLAYLIST START =====>")
},
onPlayListEnd_cbsi: function() {
w(i + "PLAYLIST END =====>");
re.playlistEnd(t)
},
onContentStart_cbsi: function() {
w(i + "CONTENT START =====>");
re.contentStart()
},
onContentEnd_cbsi: function() {
w(i + "CONTENT END =====>");
re.contentEnd(t)
},
onAdSlotStart_cbsi: function() {
w(i + "AD SLOT START =====>")
},
onAdStart_cbsi: function() {
w(i + "AD START =====>");
s = false;
re.adStart()
},
onAdEnd_cbsi: function() {
w(i + "AD END =====>");
re.adEnd();
T.setContentLoading(true);
c.showIMAadAndEventCatcherDivs(false)
},
onVideoProgress: function(e) {
if (true === re.isAdPlaying() || true === re.isContentStarted()) {
T.setContentLoading(false)
}
re.videoProgress({
currentTime: e.getCurrentTime(),
duration: e.getDuration()
})
},
onVideoDone: function() {
w(i + "VIDEO DONE =====>")
},
onNoAdContent: function() {
w(i + "NO AD CONTENT =====>")
}
};
var g = {
jsReady: false,
setJSReady: function() {
this.jsReady = true
},
isJSReady: function() {
return this.jsReady
},
onCBSIPlayerReady: function(e) {
var t;
if (!e) {
return
}
w(i + "onCBSIPlayerReady!");
v(e);
t = p();
$.each(y, function(e, i) {
t.addEventJSCallback(e, i)
});
T.setPlayerReady(true);
$(document).trigger("cbsiplayer_ready")
}
};
var h = function() {
w("hi5 video click > togglePlay");
re.toggleUiPlayPause()
};
var m = function() {
var e = p(),
a = re.video,
n, l, d, f, c, v = re.getVideoContainer(t),
y, g, m;
if (!!e && !!v) {
m = v.find("video");
if (m.length <= 0) {
l = v.attr("id");
if (r) {
c = v.parent();
n = c.attr("id");
if (!n) {
n = l + "-wrap";
c.attr("id", n)
}
y = a.els.$imaAdDiv;
if (y) {
d = y.attr("id")
}
g = a.els.$imaAdClickthru;
if (g) {
f = g.attr("id")
}
}
if (d) {
w(i + "Initialize UVP_IMA >\n- videoDivId: " + l + "\n- containerDivId: " + n + "\n- imaAdDivId: " + d + "\n- imaAdClickthruId: " + f);
e.initialize(l, n, d, f)
} else {
w(i + "Initialize basic UVP > \nvideoDivId: ", l);
e.initialize(l)
}
m = v.find("video");
m.attr("poster", "/bundles/phoenixsite/images/core/loose/clear.gif");
m.on(o, h);
if (g) {
g.on(o, function() {
s = true;
w(i + "Clicked IMA Ad Clickthru")
})
}
u(m)
}
}
};
var S = function(e) {
var t, i = e.nativeControls || false,
a = e.autoHide || false;
t = {
partner: e.partner,
nativeControls: i,
autoHide: a,
uvpc: e.uvpc,
loadAnimation: "",
logWindow: P
};
return t
};
var k = function(t) {
w("!!!!!!!!!! SETTING GLOBAL uvp_sOpts AS: ", t);
e.uvp_sOpts = t
};
var C = function(e) {
var t = S(e);
k(t)
};
var T = te({
name: "html5Player",
logPrefix: i,
load: function(t) {
var s = this,
o = t.videoJSON,
l = o.uvpHi5,
u = o.uvpHi5Ima;
if (true === a || true === n) {
if (true === a) {
w(i + "already loaded")
} else if (true === n) {
w(i + "already loading")
}
return
}
n = true;
C(o);
$.each(g, function(t, i) {
if (undefined === e[t]) {
e[t] = i
}
});
if (t.els.$imaAdDiv && u) {
w(i + "Load IMA js");
$.ajax({
url: u,
dataType: "script",
error: function() {
w(i + "IMA script failed to load")
},
success: function() {
w(i + "IMA script successfully loaded");
r = true
}
})
}
w(i + "Load hi5 js: " + l);
$.ajax({
url: l,
dataType: "script",
beforeSend: function() {
w(i + "load start: ", l)
},
complete: function() {
w(i + "load complete");
n = false
},
error: function() {
w("error", i + "load failure");
s.playerApi = false
},
success: function() {
w(i + "load success");
a = true
}
})
},
init: function() {
var e = this;
if (e.isInitialized()) {
return
}
m();
e.playerApi = p();
e.initialized = true
},
play: function() {
var e = this,
t = re.getVideoUi(),
a = false,
n, r, s, o, l, u;
if (!t) {
return
}
a = e.isInitialized();
if (!a) {
w(i + "player is not initialized, quitting");
return
}
w(i + "BEG play() =====>");
n = p();
r = t.videoJSON;
s = t.getVideoUrl();
if (undefined === s) {
return
}
o = $.extend({}, f, {
partner: r.partner,
mediaId: r.id,
cmsRefId: r.guid,
videoTitle: decodeURIComponent(r.title),
assetURL: s
});
w("- Video Url: ", s);
e.setContentLoading(true);
u = e.getAdCall();
if (undefined === u) {
w("- load video url");
n.loadVideoByUrl(s, o);
n.playVideo()
} else {
l = {
pre_0: u
};
w("- loadContentWithAds: ", l);
n.loadContentWithAds(l, o)
}
w(i + "END play() =====>")
},
pause: function() {
var e = this;
w(i + "pause video");
e.playerApi.pauseVideo();
w(i + "paused video")
},
resume: function() {
w(i + "resume video");
this.playerApi.playVideo()
},
replay: function() {
w("seek to 0");
this.playerApi.seekTo(0);
w("replay video");
this.playerApi.playVideo()
},
stop: function() {
this.playerApi.stopVideo()
},
mute: function() {
w(i + "fire playerApi.mute()");
this.playerApi.mute()
},
unmute: function() {
w(i + "fire playerApi.unMute()");
this.playerApi.unMute()
},
setVolume: function(e) {
w("setting html volume");
this.playerApi.setVolume(e)
},
seekTo: function(e) {
this.setContentLoading(true);
this.playerApi.seekTo(e)
},
seekToLive: function() {},
getCurrentTime: function() {
return this.playerApi.getCurrentTime()
},
getDuration: function() {
return this.playerApi.getDuration()
},
detach: function() {
w(i + "stop player");
this.stop()
}
});
return T
}();
var ne = function() {
var e = "[YT]";
var t;
var i = "<iframe webkitAllowFullScreen mozallowfullscreen allowFullScreen/>";
var a = "http://www.youtube.com/embed/";
var n = {
wmode: "transparent",
autoplay: "1"
};
var r = "https://www.googleapis.com/youtube/v3/videos?part=id&id=",
s = "&key=",
o = ".js-vid-youtube";
var l = function() {
var e = function(e, t) {
w("error", "Invalid youtubeID");
if (e && e.length) {
e.remove()
}
if (t) {
t()
}
};
return function(t, i, a) {
var n = i.youtubeID,
o = i.youtubeKey,
l, u;
a = a || {};
l = a.error;
if (undefined === t) {
n = null
}
if (!n) {
e(t, l)
} else {
u = {
url: r + n + s + o,
beforeSend: function() {
w("Checking youtubeID " + n + " against API")
},
error: function(a, n) {
if ("error" === n) {
i.youtubeID = null;
e(t, l)
}
},
success: function(e) {
if (e.pageInfo.totalResults >= 1) {
if (a.success) {
a.success()
}
} else {
u.error(null, "error")
}
}
};
$.ajax(u)
}
}
}();
var u = function(e) {
var t;
if (!e) {
return
}
t = a + e + "?" + $.param(n, true);
w("youtube embed url: ", t);
return t
};
var d = function() {
if (undefined === t) {
t = $(i, {
frameborder: "0"
})
}
return t
};
var f = te({
name: "youtubePlayer",
logPrefix: e,
playerApi: null,
load: function(t) {
var i = this,
a = t.els,
n = a.$playbackButtons,
r, s;
i.setPlayerReady(false);
if (n) {
r = n.filter(o)
}
if (r.length) {
s = {
error: function() {
var a = ce(n);
w(e + "youtubeCheck error");
t.setPlayback(a.data(se));
i.setPlayerReady(true);
if (a.hasClass("js-vid-youtube")) {
Ee()
}
},
success: function() {
w(e + "youtubeCheck success");
i.setPlayerReady(true)
}
};
l(r, t.videoJSON, s)
}
},
play: function() {
var t = re.getVideoContainer("youtube"),
i = d(),
a = re.getVideoUi(),
n, r;
if (a && a.videoJSON) {
r = a.videoJSON.youtubeID
}
if (!r) {
return
}
w(this.name + " > play");
w(e + "play() > videoId: " + r);
n = u(r);
w(e + "play() > embedUrl: " + n);
i.attr("src", n);
t.append(i);
re.contentStart()
},
detach: function() {
var e = d();
e.attr("src", "").detach()
},
isContentLoading: function() {
return true
}
});
return f
}();
var re = function() {
var e = "[SWITCH] ";
var t = {
flash: ie,
html5: ae,
youtube: ne
};
w(e + "playerTypes: ", t);
var i = false;
var a = function(e, t) {
var i = false;
if (!!e) {
i = e.videoJSON.id === t.videoJSON.id
}
return i
};
var n = function() {
var e = "[RELAY] ";
var t = {};
var i = [],
a = [];
var n = "pause",
s = "play",
o = "resume",
l = "stop",
u = "mute",
d = "unmute";
var f = [s, l];
var c = function(e) {
return 0 <= $.inArray(e, f)
};
var v;
var p = function(e) {
v = e
};
var y = function() {
return r.player
};
var g = function(t, i) {
var a = y();
if (!a) {
w(e + "runPlayerMethod() failed :: undefined player");
return
}
try {
w(e + "runPlayerMethod() >\n- methodName: " + t + "\n- methodArgs: ", i);
if (!!i && i.length > 0) {
a[t](i)
} else {
a[t]()
}
} catch (n) {
w("error", e + "runPlayerMethod(): ", n.message)
}
};
var h = function(t) {
var n, r = e + "Use ";
if (c(t)) {
r += "preContentReadyQueue";
n = i
} else {
r += "contentReadyQueue";
n = a
}
r += " for [" + t + "]";
return n
};
var m = function() {
return 0 < i.length || 0 < a.length
};
var S = function(i) {
var a = h(i),
n = $.inArray(i, a),
r = false;
if (n >= 0) {
a.splice(n, 1);
if (t[i]) {
delete t[i]
}
w(e + "removeQueueMethod() methodName removed: ", i);
r = true
}
return r
};
var k = function() {
var i = Array.prototype.slice.call(arguments),
a = i.shift(),
r, l = false,
f;
if (a.length === 0) {
return
}
r = a.shift(a);
f = h(r);
w(e + "BEG queuePlayerMethod() queued methods: ", f.join(", "));
switch (r) {
case s:
S(o);
S(n);
break;
case o:
S(n);
l = true;
break;
case n:
S(o);
break;
case u:
S(d);
break;
case d:
S(u);
l = true;
break
}
S(r);
if (false === l) {
f.push(r);
if (a.length > 0) {
t[r] = a
}
w(e + "queuePlayerMethod() new queued method: ", r)
}
w(e + "END queuePlayerMethod() queued methods: ", f.join(", "))
};
var C = function() {
var n = y(),
r = i.length,
s = a.length,
o = 0,
l, u, d;
if (!n) {
w(e + "runQueue() failed :: undefined player");
return
}
if (r > 0) {
o = r;
l = i
} else if (s > 0) {
if (n.isContentLoading()) {
w(e + "runQueue() prevented :: content is still loading");
return
} else {
o = s;
l = a
}
}
w(e + "BEG runQueue() >\n- preContentReadyQueueLength: " + r + "\n- contentReadyQueueLength: " + s + "\n- queueLength: " + o + "\n- queueToRun: ", l);
if (o > 0) {
while (o > 0) {
u = l.shift();
d = t[u];
o = l.length;
g(u, d)
}
}
w(e + "END runQueue()")
};
var P = {
setPlayer: function(e) {
p(e)
},
run: function() {
var t = y(),
i = Array.prototype.slice.call(arguments),
a = 0 < i.length,
n = false,
r, s, o;
if (!t) {
return
}
w(e + "BEG run() >\n- arguments: ", arguments);
if (!t.isInitialized()) {
w(e + "player.init()");
t.init()
}
o = t.isReady();
w(e + "run() >\nisReady: " + o + "\nhasQueuedMethods: " + m() + "\nhasArguments: " + a);
if (true === o && false === m() && true === a) {
r = i.shift();
s = i;
w(e + "Player API is ready without any queued methods");
if (c(r) || !t.isContentLoading()) {
w(e + "Running [" + r + "] player method.");
g(r, s);
n = true
} else {
w(e + "Restore args with [" + r + "] for queuing.");
i.unshift(r)
}
}
if (!n) {
if (true === a) {
w(e + "Queuing player method: ", i);
k(i)
}
w(e + "player API is" + (o ? "" : " not") + " ready, " + (o ? "" : " don't ") + "run the queue");
w(e + "isReady: " + o);
if (true === o) {
C()
}
}
w(e + "END run()")
},
clear: function() {
i = [];
a = [];
t = {}
},
hasQueuedMethods: function() {
return m()
}
};
return P
}();
var r = {
player: null,
video: null,
states: {},
loadPlayerTypes: function(a, n) {
if (true === i || !a || a.length < 1) {
return
}
var r, s, o;
w(e + "Load Player Types: ", a);
for (r = 0; r < a.length; r++) {
s = a[r];
o = t[s];
if (!!o && !!o.load) {
o.load(n)
}
}
i = true
},
isPlaying: function() {
var e = this.video,
t = false;
if (!!e) {
t = e.states.playing
}
return t
},
getPlayer: function(i) {
var a = this,
n = i.states,
r = n.playerType,
s = t[r],
o, l = false,
u = false;
w(e + "getPlayer() playerType: " + r);
if (undefined === s) {
w("error", e + "Undefined player type [" + r + "]")
}
o = a.player || {};
u = !!o.name;
if (o.name !== s.name) {
l = true
}
if (true === l) {
w(e + "newPlayer: ", s.name);
w(e + "currentPlayer: ", o.name);
if (true === u) {
w(e + "Switch to [" + r + "] player");
a.setPlayer(o, s)
} else {
a.player = s;
w(e + "new player: ", s)
}
} else {
w(e + "player is [" + r + "]")
}
},
setPlayer: function(i, a) {
var n = this;
if (n.video) {
var r = n.video.states,
s = r.playerType,
o = t[s];
w(e + "setPlayer()");
w(e + "currentPlayer: ", i);
w(e + "newPlayer: ", a);
if (!i) {
i = n.player;
w(e + "Using self.player as currentPlayer: ", i)
}
if (!a) {
a = o;
w(e + "Using playerTypes[playerType] as newPlayer: ", a)
}
if (a) {
if (i) {
w(e + "UNSET CURRENT PLAYER");
i.detach()
}
w(e + "SET NEW PLAYER");
n.player = a;
w(e + "Updated player to [" + a.name + "]");
n.video.setStowControls(false)
}
return true
}
return false
},
changePlayerState: function(t, i) {
var n = this,
r = n.video,
s = n.states,
o = t.states,
l = true,
u, d, f = 0,
c = {},
v = false;
if (false === a(r, t)) {
v = true;
if (false === o.playing) {
l = false
}
}
if (false === l) {
return
}
w(e + "!!!!! CHANGE PLAYER STATE !!!!!\n", t.states);
if (!i) {
i = []
} else {
w(e + "forcing state updates for: " + i.join(", "))
}
for (u in o) {
if (o.hasOwnProperty(u)) {
d = o[u];
if (d !== s[u] || 0 <= $.inArray(u, i)) {
f += 1;
c[u] = d
}
}
}
if (c.playerType) {
w(e + "changedStates.playerType > getPlayer");
n.getPlayer(t)
}
if (c.volume) {
w(e + "changedStates.volume > setVolume");
n.setVolume(c.volume)
}
if (c.mute === true) {
w(e + "changedStates.mute > mute");
n.mute()
} else if (c.mute === false) {
w(e + "changedStates.mute > unmute");
n.unmute()
}
if (0 < f) {
w("changedStates: ", c);
$.extend(n.states, o)
}
},
play: function(e) {
var t = this,
i = t.video || {},
a, r = false,
s;
w("playerManager.play()");
if (!e) {
w("error", "playerManager.play() > undefined video")
}
if (null === t.player) {
w("playerManager.play() > BEFORE get player");
t.getPlayer(e);
w("playerManager.play() > AFTER get player")
}
s = t.player;
t.video = e;
e.setVideoProgress("", "0%");
if (i.playerId !== e.playerId) {
r = true
}
n.run("play");
w("playerManager.play() > update states: ", a);
t.changePlayerState(e, ["volume", "mute"])
},
pause: function() {
n.run("pause")
},
resume: function() {
n.run("resume")
},
replay: function() {
n.run("replay")
},
mute: function() {
n.run("mute")
},
unmute: function() {
n.run("unmute")
},
setVolume: function(e) {
n.run("setVolume", e)
},
seekTo: function(e) {
n.run("seekTo", e)
},
seekToLive: function() {
n.run("seekToLive")
},
onPlayerReady: function() {
if (n.hasQueuedMethods()) {
n.run()
}
},
getCurrentTime: function() {
var e = this.player,
t = 0;
if (!!e) {
t = e.getCurrentTime()
}
return t
},
getDuration: function() {
var e = this.player,
t;
if (!!e) {
t = e.getDuration()
}
return t
},
savePosition: function(e) {
var t = this.video;
if (!!t && !!t.savePosition) {
t.savePosition(e)
}
},
getVideoUi: function() {
return this.video
},
getVideoContainer: function(e, t) {
var i = this,
a;
if (!t) {
t = i.video
}
if (t) {
a = t.getVideoContainer(e);
return a
} else {
w("error", "unable to run getVideoContainer on undefined video")
}
},
isAdPlaying: function() {
var e = this,
t = false;
if (e.video && e.video.states) {
t = !!e.video.states.adPlaying
}
return t
},
isContentStarted: function() {
var e = this,
t = false;
if (e.video && e.video.states) {
t = !!e.video.states.contentStarted
}
return t
},
isActivePlayerType: function(e) {
var t = this,
i = t.video,
a = false,
n;
if (i) {
n = i.states;
a = e === n.playerType
}
return a
},
adEnd: function() {
var e = this;
if (e.video) {
e.video.adEnd()
}
},
adStart: function() {
var e = this;
if (e.video) {
e.video.adStart()
}
},
contentEnd: function(t) {
var i = this;
if (i.isActivePlayerType(t)) {
i.video.contentEnd()
} else {
w(e + "contentEnd ignored :: playerType is not active")
}
},
contentLoading: function(e) {
var t = this;
if (t.video) {
t.video.contentLoading(e)
}
},
contentStart: function() {
var e = this;
if (e.video) {
e.video.contentStart();
if (e.player === t.youtube) {
e.video.setStowControls(true, 3e3)
}
}
},
playlistEnd: function(t) {
var i = this;
if (i.isActivePlayerType(t)) {
i.video.playlistEnd()
} else {
w(e + "playlistEnd ignored :: playerType is not active")
}
},
toggleUiPlayPause: function() {
var t = this,
i;
if (t.video) {
w(e + "play/pause from player api");
i = t.video.els.$playPauseButtons;
i.first().trigger("click")
}
},
videoProgress: function(e) {
var t = this;
if (t.video) {
t.video.videoProgress(e)
}
}
};
return r
}();
window.playerManager = re;
var se = "cmd-value",
oe = "dn",
le = "on";
var ue = function(e) {
return !!e && e.length > 0 && e.closest("html").length > 0 && !e.hasClass(oe)
};
var de = function(e) {
return !!e && e.hasClass(le)
};
var fe = function(e, t) {
return e.data(se) === t
};
var ce = function(e) {
var t = e.filter(".js-vid-default"),
i;
t = t.not("." + oe);
i = t.first();
if (i.length < 1 || i.closest("body").length < 1) {
i = e.first()
}
return i
};
var ve = function(e, t) {
var i = e.filter(function() {
var e = $(this);
return true === ue(e) && true === fe(e, t)
});
return i
};
var pe = function(e, t, i) {
if (!e || 0 === e.length) {
return
}
if (true === t) {
e.addClass(i)
} else if (false === t) {
e.removeClass(i)
}
};
var ye = function(e) {
me(e);
pe(e, true, oe)
};
var ge = function(e) {
pe(e, false, oe)
};
var he = function(e) {
pe(e, true, le)
};
var me = function(e) {
pe(e, false, le)
};
var Se = function() {
var e = "[UI CORE] ";
var t = {
$videoPlayerDiv: null,
$videoContainer: {
selector: ".js-vid-player-holder"
},
$playerChrome: {
selector: ".js-vid-player-chrome"
},
$ageGate: {
selector: ".js-vid-age-gate"
},
$ageMonth: {
selector: ".js-vid-age-gate-month"
},
$ageDay: {
selector: ".js-vid-age-gate-day"
},
$ageYear: {
selector: ".js-vid-age-gate-year"
},
$ageDate: {
selector: ".js-vid-age-gate-date"
},
$playPauseButtons: {
selector: ".js-vid-play, .js-vid-play-pause",
events: {
click: "togglePlay"
}
},
$qualityButtons: {
selector: ".js-vid-quality",
events: {
click: "setQuality"
},
cookieType: "state",
state: "quality"
},
$timeDisplay: {
selector: ".js-vid-time"
},
$kubrickLead: {
selector: "#kubrick-lead",
unique: true
},
$countdown: {
selector: ".js-vid-countdown"
},
$imaAdDiv: {
selector: ".js-vid-ima-ad"
},
$imaAdClickthru: {
selector: ".js-vid-ima-clickthru"
},
$volume: {
selector: ".js-vid-volume"
},
$volumeBar: {
selector: ".js-vid-volume-bar",
events: {
mousedown: "volumeChange",
"mousedown.volumeSlide": "volumeSlideStart",
"mouseup.volumeSlide": "volumeSlideStop"
}
},
$volumeHandle: {
selector: ".js-vid-volume-handle"
},
$muteButton: {
selector: ".js-vid-mute",
events: {
click: "toggleMute"
},
cookieType: "state",
state: "mute"
},
$fullscreenButton: {
selector: ".js-vid-fullscreen",
events: {
click: "toggleFullscreen"
}
},
$fullWinButton: {
selector: ".js-vid-windowed",
events: {
click: "toggleWindowed"
}
},
$reportSuckButton: {
selector: ".js-vid-report-suck-btn",
events: {
click: "reportSuck"
}
},
$playbackButtons: {
selector: ".js-vid-playback",
events: {
click: "setPlayback"
},
cookieType: "state",
state: "playback"
},
$videoMaxWidth: {
selector: ".js-vid-max-width"
},
$seeker: {
selector: ".js-vid-buffer",
cookieType: "position",
events: {
click: "seekTo",
mouseenter: "seekDisplayStart",
mouseleave: "seekDisplayStop"
}
},
$seekDisplay: {
selector: ".js-vid-seek-display"
},
$seekText: {
selector: ".js-vid-seek-text"
},
$seekPointer: {
selector: ".js-vid-seek-pointer"
},
$seekToLive: {
selector: ".js-vid-seektolive",
events: {
click: "seekToLive"
}
},
$progress: {
selector: ".js-vid-position"
},
$loader: {
selector: ".js-vid-loaded"
}
};
var a = {
type: "wtfbbq",
playerId: null,
videoJSON: null,
html5Player: false,
adMessagePrefix: "This ad ends in: ",
els: {},
stateJSON: {},
states: {
videoId: null,
playback: null,
playerType: null,
quality: null,
adPlayed: false,
contentLoading: false,
contentStarted: false,
played: false,
paused: false,
started: false,
ended: false,
contentEndTimeoutId: null,
counting: false,
adPlaying: false,
gated: false,
hasGate: false,
showAgeGate: false,
loading: true,
playing: false,
volume: 1,
embiggened: false,
mute: false,
share: false,
stickied: false,
fullscreen: false,
windowed: false,
currentTime: 0,
duration: 0,
hasTimeChange: false,
isAtEndTime: false,
isLive: false,
isOffAir: false,
isRewound: false,
isSeekDisabled: true,
customStartTime: 0,
restoredFromSavedTime: false,
liveStartTime: 0,
liveSeekDelay: 10,
liveSeekDelayLeft: null,
stowControls: false
},
classNames: {
contentLoading: "is-vid-content-loading",
contentStarted: "is-vid-content-started",
played: "is-vid-played",
started: "is-vid-started",
ended: "is-vid-ended",
counting: "has-vid-countdown",
adPlaying: "is-vid-ad-playing",
gated: "has-vid-invalid-age",
hasGate: "has-vid-age-gated",
showAgeGate: "is-vid-age-gate",
disabled: "is-vid-disabled",
loading: "is-vid-loading",
playing: "is-vid-playing",
embiggened: "is-vid-embiggened",
mute: "is-vid-muted",
share: "has-vid-share",
stickied: "is-vid-stickied",
fullscreen: "is-vid-fullscreen",
windowed: "is-vid-fullscreen",
isLive: "is-vid-live",
isOffAir: "is-vid-offair",
isRewound: "is-vid-rewound",
isSeekDisabled: "is-vid-noseek",
stowControls: "is-vid-stow-controls"
},
kubrickClassNames: {
played: "video-active",
playing: "video-playing"
}
};
a.initialize = function(t) {
var i = this,
a = i.els;
w("Player type: " + i.type);
i.playerId = t.playerId;
i.videoJSON = t.videoJSON;
i.states.videoId = t.videoJSON.id;
if (!!t.els) {
$.extend(a, t.els)
}
if (false === i.isOfAge()) {
i.gate();
return
}
i.initElements();
if (undefined === a.$playerChrome) {
w(e + "Quitting -- player chrome is missing.");
return
}
i.initStates();
i.initComplete()
};
a.initElements = function() {
var e = this,
t = e.getUiMap(),
i = e.els,
a, n, r;
for (n in t) {
if (t.hasOwnProperty(n)) {
a = undefined;
r = t[n];
if (!!r) {
a = e.getUiElement(n, r)
}
w("UI Elements [" + n + "]: ", !!a ? a.length : 0);
if (undefined !== a) {
i[n] = a;
if (!!r.events) {
e.addElementEvents(a, r)
}
}
}
}
e.initCountdown()
};
a.initStates = function() {};
a.initComplete = function() {
var t = this,
i = t.videoJSON;
w(e + "initComplete");
if (t.html5Player) {
$(document).on("cbsiplayer_ready", function() {
t.setStates({
loading: false
})
})
} else {
t.setStates({
loading: false
})
}
if (i.startTime) {
t.setStates({
customStartTime: i.startTime,
restoredFromSavedTime: i.restoredFromSavedTime ? true : false
})
}
if (i.startVolume) {
t.setVolume(i.startVolume)
}
};
a.getUiMap = function() {
return $.extend({}, t)
};
a.getUiElement = function(e, t) {
var i = this,
a = i.els,
n = i.playerId,
r = t.selector,
s = "",
o;
o = a[e];
if (undefined === o) {
if (!!r && r.indexOf("#") === 0 && !t.unique) {
s = n
}
if (!!r) {
if ("" !== s) {
r += s
}
if (r.indexOf("#") === 0) {
o = $(r)
} else {
o = a.$videoPlayerDiv.find(r)
}
}
}
if (!o || o.length < 1) {
o = undefined
}
return o
};
a.handleUserAction = function() {};
a.getEventFunction = function(e, t, i, a) {
if (!e || e.length <= 0 || !t) {
return
}
var n = this,
r, s;
if (i) {
s = n[i]
}
if (!s) {
w("Unable to find callback for [" + i + "]");
return
}
if ("click" === t) {
r = function(e) {
var t = $(this),
i = false,
r = t.data(se);
f(e);
i = s.call(n, r);
if (true === i) {
w("CHANGED!!!\n", n.states);
n.handleUserAction(t, a);
if (true === n.states.started) {
w("!!! Change occured during playback !!!");
re.changePlayerState(n)
}
}
}
} else {
r = function(e) {
s.call(n, e, $(this).data(se))
}
}
return r
};
a.addElementEvents = function(e, t) {
var i = this,
a = t.events,
n, r, s, o = {},
l = false;
if (!e || e.length <= 0 || !a) {
return
}
for (n in a) {
if (a.hasOwnProperty(n)) {
r = a[n];
if (!!r) {
s = i.getEventFunction(e, n, r, t);
if (undefined !== s) {
o[n] = s;
l = true
}
}
}
}
if (true === l) {
w("- adding eventsMap: ", o);
e.on(o)
}
};
a.initCountdown = function() {
var e = this,
t = e.videoJSON,
i = Date.now(),
a = parseInt(t.countdownTime, 10) * 1e3,
n = e.els.$countdown,
r = false;
if (!n) {
w("No countdown");
return n
}
w("Initializing countdown");
r = !n.data("complete") && (a > 0 && i < a);
if (r) {
n.on("complete", function() {
e.els.$videoPlayerDiv.find("iframe").remove();
e.setStates({
counting: false
})
});
n.on("almostComplete", function() {
e.els.$videoPlayerDiv.addClass("countdown-almost-complete")
});
e.setStates({
counting: true
})
}
return n
};
a.getVideoContainer = function(e) {
var t = this,
i = t.els.$videoContainer,
a = i.attr("id");
if (!a) {
i.attr("id", "js-vid-" + e + "-player" + t.playerId)
}
return i
};
a.togglePlay = function() {
var t = this,
i = t.states,
a = i.playing,
n = false;
w(e + "togglePlay > states: ", i);
if (true === a) {
n = t.pause()
} else if (true === i.started) {
n = t.resume()
} else {
n = t.play()
}
if (true === n) {
i.playing = !a
}
return n
};
var n = function(e) {
var t = e.watchedCookieName,
i;
if (!t) {
return
}
i = $.parseJSON($.cookie(t));
if (!i) {
i = []
}
return i
};
var r = function(e) {
var t = e.id,
i = e.watchedCookieName,
a = e.watchedCookieDays,
r = n(e);
if (undefined === r) {
return
}
if (0 > $.inArray(t, r)) {
r.push(t)
}
$.cookie(i, c(r), {
path: "/",
expires: a
})
};
var s = function(t) {
var i = !!$("#VideoDisableTracking").attr("content"),
a = t.id;
w(e + "Disable Tracking? ", i);
if (i || !a) {
return
}
$.ajax({
url: "/api/video/played/" + a + "/",
type: "GET",
success: function(t) {
if (t.success === 0) {
w(e + "Error logging view")
} else if (t.success === 1) {
w(e + "View logged successfully")
}
}
});
r(t)
};
a.play = function() {
var t = this,
i = t.states,
a = t.isAgeGated(),
n = false,
r = t.videoJSON,
o = r["id"];
w("[UI] ui.play");
if (true === a) {
t.gate()
} else if (false !== a && "string" === typeof a) {
if ("prompt" === a) {
t.promptAgeGate()
} else {
alert(a)
}
} else {
n = true;
if (false === i.playing) {
w(e + "video is not playing > play")
}
if (false === i.played && !!o) {
w(e + "video has not played > log view");
s(r)
}
if (false === i.started) {
t.els.$videoPlayerDiv.trigger("videoStart")
}
if (true === i.ended) {
t.els.$videoPlayerDiv.trigger("videoReplay")
}
t.setStates({
played: true,
playing: true,
paused: false,
started: true,
ended: false
});
re.play(t);
u().trigger("video_play")
}
};
a.pause = function() {
var t = this;
t.setStates({
paused: true,
playing: false
});
w(e + "Tell playerManager to pause");
re.pause(t);
t.els.$videoPlayerDiv.trigger("contentPause");
return true
};
a.resume = function() {
var e = this;
e.setStates({
paused: false,
playing: true
});
re.resume(e);
e.els.$videoPlayerDiv.trigger("contentResume");
return true
};
a.replay = function() {
var e = this;
e.setStates({
playing: true,
started: true,
ended: false
});
re.replay(e)
};
a.seekToCustomStartTime = function() {
var e = this,
t = e.states,
i = t.customStartTime,
a = t.restoredFromSavedTime,
n = e.videoJSON,
r = n.seekablePlaybacks,
s;
if (!t.adPlaying && t.started && 0 < i) {
s = re.getDuration();
if (undefined === s || 0 === s || true === isNaN(s)) {
w("wait until we have a legit duration");
return
}
e.setStates({
customStartTime: 0,
restoredFromSavedTime: false
});
if (0 > $.inArray(t.playback, r)) {
return
}
if (Math.floor(i) < Math.floor(s)) {
re.seekTo(i);
if (a) {
v("Resuming video from saved position")
}
}
}
};
a.adStart = function() {
w(e + "start video ad");
var t = this,
i = t.states,
a = i.paused;
t.cancelConfirmContentEnd();
t.setStates({
adPlayed: true,
adPlaying: true,
paused: a,
playing: !a,
started: true,
ended: false
})
};
a.adEnd = function() {
var t = this;
w(e + "end video ad");
t.setStates({
adPlaying: false
})
};
a.contentStart = function() {
var e = this,
t = e.states,
i = t.paused;
e.cancelConfirmContentEnd();
e.setStates({
adPlaying: false,
paused: i,
playing: !i,
started: true,
ended: false,
contentStarted: true
})
};
a.contentEnd = function() {
var t = this,
i = t.states,
a = {
contentStarted: false
},
n = i.isLive,
r = false,
s = Math.floor(i.currentTime),
o = Math.floor(i.duration),
l = Math.abs(o - s);
if (1 >= l || s >= o) {
r = true
}
a.isAtEndTime = r;
w(e + "[CONTENT END]");
w("- isLive: " + (n ? "yes" : "no"));
w("- isAtEndTime: " + (r ? "yes" : "no"));
if (!n && r) {
a.playing = false;
a.started = false;
a.ended = true;
w(e + "We are contentEnd!");
t.els.$videoPlayerDiv.trigger("contentEnd")
}
this.setStates(a);
if (i.playing) {
w(e + "contentEnd was ignored, check again in a second");
t.confirmContentEnd()
}
};
a.confirmContentEnd = function() {
var t = this,
i = 4e3,
a = t.states,
n;
t.cancelConfirmContentEnd();
if (true === a.isLive) {
i = 1e4
}
n = setTimeout(function() {
w(e + "confirmContentEnd");
t.setStates({
isLive: false,
currentTime: a.duration
});
t.cancelConfirmContentEnd();
t.contentEnd()
}, i);
a.contentEndTimeoutId = n
};
a.cancelConfirmContentEnd = function() {
var t = this.states,
i = t.contentEndTimeoutId;
if (i) {
w(e + "clear confirmContentEnd timeout");
clearTimeout(i);
t.contentEndTimeoutId = null
}
};
a.playlistEnd = function() {
this.setStates({
contentStarted: false,
playing: false,
started: false,
ended: true
})
};
var o = [],
l = 4,
g = true,
h = function(e) {
o.push(e);
if (o.length === l) {
if (o[0] === o[l - 1]) {
g = false
} else {
g = true
}
o = o.slice(l - 1)
}
return g
};
a.liveStreamCheck = function(e) {
var t = this,
i = t.states,
a = false,
n = false,
r = false,
s = e.currentTime,
o = e.duration,
l = i.liveSeekDelay,
u = i.liveSeekDelayLeft,
d, f;
if (!t.videoJSON.isLiveStream) {
return
}
if (i.duration === 0) {
return
}
if (i.currentTime === s) {
return
}
d = h(o);
if (u === null) {
i.liveStartTime = s
}
if (u !== false) {
f = i.liveStartTime;
u = l - s + f
}
if (u > 0) {
i.liveSeekDelayLeft = u;
e.isSeekDisabled = true;
return
} else if (false !== i.liveSeekDelayLeft) {
i.liveSeekDelayLeft = false;
e.isSeekDisabled = false
}
if (true === d) {
if (s < o - 2) {
r = true
} else {
n = true
}
} else {
a = true
}
if (i.isOffAir !== a) {
e.isOffAir = a
}
if (i.isLive !== n) {
e.isLive = n
}
if (i.isRewound !== r) {
e.isRewound = r
}
};
a.coreVideoProgress = function(e) {
var t = this,
i = t.states,
a = false;
t.cancelConfirmContentEnd();
if (false === i.adPlaying) {
if (true === t.videoJSON.isLiveStream) {
t.liveStreamCheck(e)
} else {
if (false !== i.isSeekDisabled) {
e.isSeekDisabled = false
}
if (t.states.customStartTime) {
t.seekToCustomStartTime()
}
}
if (Math.floor(e.currentTime) !== Math.floor(t.states.currentTime)) {
a = true
}
e.hasTimeChange = a;
t.setStates(e);
if (a) {
t.els.$videoPlayerDiv.trigger("contentProgress", i)
}
}
};
a.getCuePoints = function() {
var e = this,
t = e.videoJSON,
i;
i = t.cuePoints;
return i
};
a.getVideoUrl = function() {
var t = this,
i = t.states.quality,
a = t.videoJSON,
n;
n = a.videoStreams[i];
w(e + "getVideoUrl() =====>" + n);
if (!n) {
w("error", e + "Playback quality unavailable: ", i)
}
return n
};
a.setStates = function(t) {
var i = this,
a = i.els.$videoPlayerDiv,
n = i.classNames,
r = [],
s = [],
o = i.els.$kubrickLead,
l = i.kubrickClassNames,
u = [],
d = [],
f, c;
$.each(t, function(e, t) {
f = n[e];
if (e === "playerType" && t !== i.states[e]) {
f = "is-vid-" + t + "-player";
if (i.states[e]) {
c = "is-vid-" + i.states[e] + "-player";
if (c) {
s.push(c)
}
}
t = true
}
if (undefined !== f) {
if (true === t) {
r.push(f)
} else {
s.push(f)
}
}
if (o) {
f = l[e];
if (undefined !== f) {
if (true === t) {
u.push(f)
} else {
d.push(f)
}
}
}
});
$.extend(i.states, t);
a.data("states", i.states);
if (r.length > 0) {
r = r.join(" ");
w(e + "setStates addClass: ", r);
a.addClass(r)
}
if (s.length > 0) {
s = s.join(" ");
w(e + "setStates removeClass: ", s);
a.removeClass(s)
}
if (u.length > 0) {
u = u.join(" ");
w(e + "setStates $kubrickLead.addClass: ", u);
o.addClass(u)
}
if (d.length > 0) {
d = d.join(" ");
w(e + "setStates $kubrickLead.removeClass: ", d);
o.removeClass(d)
}
};
a.setControl = function(t, i) {
var a = false,
n;
n = ve(t, i);
if (n.length > 0 && false === de(n)) {
w(e + "New Value Control for [" + i + "]: ", n);
a = true;
he(n);
me(t.not(n))
}
return a
};
a.setQuality = function(t, i) {
var a = this,
n = a.states,
r = a.els.$qualityButtons,
s = a.setControl(r, t);
if (true === s) {
w(e + "setQuality newValue: " + t);
n.quality = t;
if (n.started && !i) {
a.play()
}
}
return s
};
a.setVideoProgress = function() {};
a.contentLoading = function(e) {
this.setStates({
contentLoading: e
})
};
(function() {
a.isOfAge = function(e) {
var t = this.videoJSON,
i = t.contentRating,
a;
if (!i) {
a = true
} else {
if (!e) {
e = $.cookie(t.ageGateCookieName)
}
if (e) {
var n = new Date,
r = e.split("-"),
s, o;
try {
s = new Date(r[0], r[1], r[2]);
if (isNaN(s.getTime())) {
s = n
}
} catch (l) {
s = n
}
o = Math.floor((n - s) / 31536e6);
if (o >= i) {
a = true
} else {
a = false
}
}
}
return a
};
a.hasAgeGate = function() {
var e = this,
t = e.els.$ageGate,
i = e.videoJSON,
a = i.contentRating,
n = true;
if (!t || !a || true === e.isOfAge()) {
w("[AGE GATE] not gated");
n = false
} else {
w("[AGE GATE] gated")
}
return n
};
a.promptAgeGate = function() {
this.setStates({
showAgeGate: true
})
};
a.isAgeGated = function() {
var e = this,
t = e.els,
i = t.$ageGate,
a = t.$ageYear,
n = e.videoJSON,
r = n.ageGateCookieName,
s, o, l, u, d = false;
w("[AGE GATE] Checking...");
if (true === e.hasAgeGate()) {
if (false === e.isOfAge()) {
d = true
} else if (false === e.states.showAgeGate) {
d = "prompt"
} else {
u = a.val();
w("[AGE GATE] Year selected: " + u);
if ("year" === u) {
w("warning", "[AGE GATE] missing year value");
d = "Please select a year value to validate your age!"
} else {
l = t.$ageMonth.val();
o = t.$ageDay.val();
s = [u, l, o].join("-");
if (!!r) {
$.cookie(r, s, {
path: "/",
expires: 2e3
})
}
if (!e.isOfAge(s)) {
w("[AGE GATE] User is not old enough");
d = true
}
}
}
}
if (false === d) {
w("[AGE GATE] User is old enough");
e.setStates({
hasGate: false,
showAgeGate: false
});
if (!!i && i.length > 0) {
i.remove();
delete t.$ageGate
}
}
return d
};
a.gate = function() {
var e = this,
t = e.els,
a = t.$videoPlayerDiv;
e.setStates({
disabled: true,
gated: true
});
t.$playerChrome.remove();
a.off(i)
}
})();
a.toggleState = function(t) {
var i = this,
a = false,
n = i.stateJSON,
r = i.getStateKey(t),
s, o;
switch (t) {
case "embiggen":
o = i.setEmbiggen;
break;
case "mute":
o = i.setMute;
break;
case "sticky":
o = i.setSticky;
break
}
if (!!o) {
s = n[r];
w(e + "toggleState stateJSON stateValue: ", s);
if (undefined === s) {
s = true
} else {
s = !s
}
a = o.call(i, s);
w(e + "Toggle " + t + ": ", s)
}
return a
};
(function() {
var t = "body-fullscreen",
n = "body-fauxscreen",
r = "keyup" + i,
s = 27;
a.isFullscreen = function() {
var e = this,
t = e.states;
return true === t.windowed || true === t.fullscreen
};
a.exitFullscreen = function() {
var t = this,
i = u();
if (t.isFullscreen()) {
w(e + "exit full screen");
i.off(r);
t.setStowControls(false);
t.setFullscreen(false);
t.setWindowed(false)
}
};
a.enterFullscreen = function(t) {
var i = this,
a = u(),
n = function(t) {
w(e + "exit fullscreen callback");
if (t.keyCode === s) {
i.exitFullscreen()
}
};
if (false === i.isFullscreen()) {
i.setStowControls(true);
switch (t) {
case "fullscreen":
i.setFullscreen(true);
break;
case "windowed":
w(e + "attach esc from fullscreen event listener");
a.on(r, n);
i.setWindowed(true);
break
}
}
};
a.setFullscreen = function(i) {
var a = false,
n = this,
r = n.els.$videoPlayerDiv[0],
s = n.states.fullscreen || false,
o = d(),
l = function() {
w(e + "[FULLSCREEN CHANGE HANDLER]");
if (false === screenfull.isFullscreen) {
w(e + "screenfull.isFullscreen is false, exit");
n.exitFullscreen(false);
screenfull.onchange = function() {};
w(e + "[FULLSCREEN EXIT] adjustWidth");
n.adjustWidth()
}
};
w(e + "ui.setFullscreen newState: ", i);
w(e + "- documentContentRoots: ", o);
if (!screenfull) {
return n.setWindowed(i, true)
}
if (s !== i) {
a = true;
n.setWindowed(false);
if (true === i) {
screenfull.onchange = l;
screenfull.request(r);
o.addClass(t)
} else {
o.removeClass(t);
screenfull.exit()
}
n.setStates({
fullscreen: i
})
}
return a
};
a.setWindowed = function(t, i) {
var a = false,
r = this,
s = r.states.windowed || false,
o = d();
if (s !== t) {
a = true;
if (!!screenfull) {
r.setFullscreen(false)
}
if (true === t) {
o.addClass(n)
} else {
o.removeClass(n)
}
if (!i) {
w(e + "ui.setWindowed adjustWidth");
r.adjustWidth()
}
r.setStates({
windowed: t
})
}
return a
};
a.toggleFullscreen = function() {
var e = this;
if (true === e.isFullscreen()) {
e.exitFullscreen()
} else {
e.enterFullscreen("fullscreen")
}
};
a.toggleWindowed = function() {
var e = this,
t = !e.states.windowed;
if (true === t) {
e.enterFullscreen("windowed")
} else {
e.exitFullscreen()
}
};
a.reportSuck = function() {
var e = this;
if (!confirm("This will send us a report that we will use to diagnose video playback issues. Are you sure you want to send us a report?\r\rPLEASE only do this if the video quality is bad or the video is broken in some way.\r\rAbusers will get banned.")) {
return
}
var t = e.els.$reportSuckButton;
AjaxApiRequest.makeGetApiRequest("/videos/report/suck", {
uniqueKey: t.data("unique-key"),
videoId: t.data("video-id")
}, function(e) {
if (e.success) {
alert("Thanks, we're sorry you're having problems. This report will help us fix them. Please only send one report per video")
}
})
}
})();
(function() {
var t = "mouseleave.volumeSlide",
i = "mousemove.volumeSlide";
a.setVolume = function(t) {
var i = this,
a = i.els,
n = a.$volumeHandle;
w(e + "setVolume: ", t);
w(e + "states: ", i.states);
i.moveVolumeHandle(t);
n.data(se, t);
if (0 >= t) {
i.setMute(true)
} else if (true === i.states.mute) {
w(e + "setVolume states muted > unmute");
i.setMute(false)
}
i.saveState("volume", t);
i.setStates({
volume: t
});
re.changePlayerState(i);
if (true === i.states.playing) {
re.setVolume(t)
}
};
a.setMute = function(t, i) {
var a = false,
n = this,
r = n.els,
s = r.$muteButton,
o = r.$volumeHandle,
l = s.data(se) || false,
u = o.data(se);
if (l !== t) {
a = true;
w(e + "setMute > hasChange!");
if (true === t) {
u = 0
} else {
if (u === 0 || u === "0.00") {
w(e + "setMute > volume is 0, do not unmute");
return
}
}
n.moveVolumeHandle(u);
s.data(se, t);
n.setStates({
mute: t
});
if (!i) {
n.saveState("mute", t)
}
if (true === n.states.playing) {
if (true === t) {
re.mute()
} else {
re.unmute()
}
}
}
return a
};
a.toggleMute = function() {
w(e + "toggle mute!");
return this.toggleState("mute")
};
a.moveVolumeHandle = function(e) {
e = Math.round(e * 100).toString() + "%";
this.els.$volumeHandle.css("left", e)
};
a.volumeChange = function(e) {
var t = this,
i = t.els.$volumeBar,
a = p(e, i);
t.setVolume(a.toFixed(2))
};
a.volumeSlideStart = function() {
var e = this,
a = e.els;
a.$volume.on(t, function() {
e.volumeSlideStop()
});
a.$volumeBar.on(i, function(t) {
e.volumeChange(t)
})
};
a.volumeSlideStop = function() {
var e = this.els;
e.$volume.off(t);
e.$volumeBar.off(i)
}
})();
a.setStowControls = function() {};
(function() {
var t = ["sticky", "embiggen"];
var i = "frontdoor",
n = "frontDoor";
var r = function(e, t) {
return e + t.slice(0, 1).toUpperCase() + t.slice(1)
};
var s = function() {
return location.pathname === "/"
};
a.getStateKey = function(e) {
if (0 <= $.inArray(e, t) && true === s()) {
e = r(i, e)
}
return e
};
var o = function(t, a) {
var r = a[t],
s = false,
o = false;
w(e + "[CHECK SAVED STATE] " + t + " is " + r);
if (undefined !== r && ("sticky" === t || 0 < t.indexOf("Sticky"))) {
o = playerUiMap_Desktop.$stickyPinButton.cookieType !== undefined;
if (!o) {
r = ""
}
}
if (0 === t.indexOf(n)) {
delete a[t];
t = t.replace(n, i)
}
if ("" === r) {
delete a[t];
r = undefined;
s = true
} else if (!(undefined === r || true === r)) {
r = true;
s = true
}
if (true === s && undefined !== r) {
a[t] = r
}
if (s) {
w(e + "[CORRECTED STATE] " + t + " as " + r)
}
return s
};
var l = function(a) {
var s = false;
w(e + "[CHECK SAVE STATES] original states: \n" + c(a));
w(e + "states to check: ", t);
$.each(t, function(e, t) {
s = o(t, a) || s;
s = o(r(n, t), a) || s;
s = o(r(i, t), a) || s
});
if (a.playback === "html5Progressive") {
a.playback = "html5";
s = true
}
w(e + "[CHECK SAVE STATES] corrected states: \n" + c(a));
w(e + " hasInvalidSavedStates: ", s);
return s
};
var u = "__gamesVideoPlayer";
var d = function(t) {
var i = c(t);
w(e + "Save state cookie value: " + i);
$.cookie(u, i, {
path: "/",
expires: 30
})
};
a.loadSavedState = function() {
var t = this,
i = $.cookie(u),
a, n, r, s = null,
o, f, c, v;
if (i) {
a = $.parseJSON(i)
}
if (undefined === a) {
return
}
v = l(a);
if (v) {
d(a);
v = false
}
n = a.playback;
if (!!n) {
r = t.playbacks[n] || {};
s = !!r.isAvailable;
if (s) {
c = r.qualities
}
}
f = a.quality;
if (undefined === c) {
o = ce(t.els.$playbackButtons);
n = o.data(se);
r = t.playbacks[n];
c = r.qualities;
if (!!a.playback) {
if (null === s) {
v = true;
delete a.playback
}
}
}
if (f && 0 > $.inArray(f, c)) {
v = true;
delete a.quality
}
if (v) {
d(a)
}
t.stateJSON = $.extend({}, a);
w(e + "[LOADED SAVED STATES]:", a)
};
a.saveState = function(t, i) {
var a = this,
n = a.getStateKey(t),
r = a.stateJSON;
if (!i) {
w(e + "Delete state for: " + n);
delete r[n]
} else {
r[n] = i
}
d(r)
}
})();
a.adjustWidth = function() {
w(e + "========== BEG ui.adjustWidth ==========");
var t = this,
i = t.els,
a = i.$videoPlayerDiv,
n = i.$videoMaxWidth,
r = i.$videoContainer,
s = 16 / 9,
o = "100%",
l = "width",
u, d;
n.css(l, o);
u = a.height();
d = r.height();
w(e + "viewport height: ", u);
w(e + "player height: ", d);
if (u < d) {
o = s * u
}
w(e + "adjust max width to: ", o);
w(e + "maxWidth.css(width): ", n.css(l));
n.css(l, o);
w(e + "========== END ui.adjustWidth ==========")
};
a.videoProgress = function(e) {
var t = this,
i = t.states,
a = i.adPlaying,
n = i.contentStarted,
r = t.videoJSON.isLiveStream,
s = y(0),
o = s,
l = s,
u = "",
d, f, c, v, p, g, h, m;
Se.coreVideoProgress.call(t, e);
if (!e.hasTimeChange) {
return
}
d = Math.floor(e.currentTime);
f = Math.floor(e.duration);
c = e.bytesLoaded || 0;
v = e.bytesTotal || 0;
p = i.isLive;
g = i.isOffAir;
h = i.isRewound;
if (true === a) {
u = t.adMessagePrefix + C(f - d)
} else if (true === n) {
u = C(d);
o = y(d / f);
if (0 <= c && 0 < v) {
l = y(c / v)
}
if (!p) {
u += " / " + C(f)
}
if (true === r) {
if (!p && !g && !h) {
u = "Loading stream data";
for (m = 0; m <= (d + 1) % 3; m++) {
u += "."
}
o = s
}
if (p) {
o = y(1)
}
}
}
t.setVideoProgress(u, o, l)
};
a.setVideoProgress = function(e, t, i) {
var a = this.els,
n = a.$timeDisplay,
r = a.$progress,
s = a.$loader,
o, l, u;
if (!!n) {
o = n.data("progress-msg");
if (o !== e) {
n.html(e);
n.data("progress-msg", e)
}
}
if (undefined !== t && !!r) {
l = r.data("width");
if (l !== t) {
r.css("width", t);
r.data("width", t)
}
}
if (!!i && !!s) {
u = s.data("width");
if (u !== i) {
s.css("width", i);
s.data("width", i)
}
}
};
var m = "mousemove.seekDisplay",
S = "left",
k = "position";
var P = function(e, t) {
var i, a = 0;
i = e.offset();
i.right = i.left + e.outerWidth();
if (i.left < t.left) {
a = t.left - i.left
} else if (i.right > t.right) {
a = t.right - i.right
}
return a
};
var T = function(e, t) {
var i, a;
e.css("left", "-50%");
i = e.position();
a = P(e, t);
if (a !== 0) {
e.css(S, i.left + a)
}
};
var A = function(e, t) {
var i = e.data(k),
a = e.data("limitClass"),
n, r, s = {},
o = {};
if (undefined === i) {
i = e.position();
i.width = e.outerWidth();
e.data(k, i)
}
s = {
left: i.left,
width: i.width
};
e.css(s);
if (!!a) {
e.removeClass(a)
}
n = P(e, t);
if (n > 0) {
r = "left"
} else if (n < 0) {
r = "right"
}
if (n !== 0) {
o["width"] = i.width - Math.abs(n);
if (n > 0) {
o["left"] = i.left + n
}
a = "limit-" + r;
e.addClass(a);
e.data("limitClass", a);
e.css(o)
}
};
a.seekTo = function() {
var t = this,
i = t.states,
a = t.seekTime,
n = false;
if (true === i.started && false === i.adPlaying) {
w(e + "seekTo: ", a);
n = true;
re.seekTo(a);
t.els.$videoPlayerDiv.trigger("contentSeek", [a])
} else {
n = true;
t.setStates({
customStartTime: a,
restoredFromSavedTime: true
})
}
if (false === i.playing) {
w(e + "not playing, so don't let seekto play");
re.pause();
t.videoProgress({
currentTime: a,
duration: re.getDuration()
})
}
t.seekTime = 0;
return n
};
a.seekToLive = function() {
var t = this,
i = t.states,
a = false;
if (true === i.started && false === i.adPlaying) {
w(e + "seekToLive()");
a = true;
re.seekToLive();
if (false === i.playing) {
w(e + "not playing, so don't let seekToLive play");
re.pause();
t.videoProgress({
currentTime: re.getDuration(),
duration: re.getDuration()
})
}
}
return a
};
a.updateSeekDisplay = function(e, t) {
var i = this,
a = i.els,
n = a.$videoPlayerDiv,
r = a.$seekText,
s = a.$seekPointer,
o;
if (!e) {
e = "loading..."
}
r.text(e);
a.$seekDisplay.css(S, t);
o = n.offset();
o.right = o.left + n.width();
T(r, o);
A(s, o)
};
a.setSeekDisplay = function(e) {
var t = this,
i = t.els,
a = i.$seekText,
n = p(e, i.$seeker),
r = re.getDuration(),
s = 0,
o = 0,
l = "";
if (undefined === r) {
r = 0
}
if (0 <= n && 0 < r) {
s = Math.round(n * r);
l = C(s);
o = y(s / r)
}
if (s !== t.seekTime || l !== a.text()) {
t.seekTime = s;
t.updateSeekDisplay(l, o)
}
};
a.seekDisplayStart = function() {
var e = this,
t = e.states;
if (true === t.started && false === t.adPlaying) {
e.els.$seeker.on(m, function(t) {
e.setSeekDisplay(t)
})
}
};
a.seekDisplayStop = function() {
this.els.$seeker.off(m)
};
return a
}();
var ke = function() {
var e = "[UI MOBILE] ";
var t = {
$deviceAdMessage: {
selector: ".js-vid-ad-message"
}
};
var i = {
type: "mobile",
states: {
playback: "html5",
playerType: "html5",
quality: null
}
};
i = $.extend(true, {}, Se, i);
i.initialize = function(e) {
var t = e.videoJSON;
t.nativeControls = t.nativeControls || false;
$.extend(t, {
autoHide: true
});
Se.initialize.call(this, e)
};
i.initStates = function() {
var t = this;
w(e + "initStates");
if (t.els.$qualityButtons) {
var i = ce(t.els.$qualityButtons);
var a = i.data(se);
t.setQuality(a)
}
};
i.initComplete = function() {
var e = this;
re.loadPlayerTypes([e.states.playerType], e);
if (e.states.playerType === "html5") {
e.html5Player = true
}
Se.initComplete.call(e)
};
i.getUiMap = function() {
var e = $.extend(true, Se.getUiMap(), t);
return e
};
return i
}();
var Ce = function() {
var e = "[UI DESKTOP] ";
var t = {
$videoPlayerDiv: {
events: {
keydown: "spacebarToggle",
selectstart: "stopSelect"
}
},
$avBox: {
selector: ".js-vid-box"
},
$kubrickLead: {
external: true,
parentOf: "$videoPlayerDiv"
},
$kubrickInfo: {
selector: ".kubrick-info",
external: true,
childOf: "$kubrickLead"
},
$kubrickInfoParent: {
selector: ".row",
external: true,
childOf: "$kubrickLead"
},
$kubrickRelated: {
selector: "#js-kubrick-pod",
external: true,
childOf: "$kubrickLead"
},
$embiggenContainer: {
selector: ".js-video-embiggen",
external: true,
parentOf: "$videoPlayerDiv"
},
$embiggenVidSize: {
selector: ".js-video-size",
external: true,
parentOf: "$videoPlayerDiv"
},
$stickyContainer: {
selector: ".js-video-sticky",
external: true,
parentOf: "$videoPlayerDiv"
},
$videoSpacer: {
selector: "#video-spacer",
external: true,
dependsOn: "$kubrickLead"
},
$embiggenButtonContainer: {
selector: ".js-vid-embiggen-wrap",
dependsOn: "$embiggenVidSize"
},
$embiggenButton: {
selector: ".js-vid-embiggen",
events: {
click: "toggleEmbiggen"
},
cookieType: "state",
state: "embiggen",
dependsOn: "$embiggenVidSize"
},
$stickyPinButtonContainer: {
selector: ".js-vid-pin-wrap",
dependsOn: "$stickyContainer"
},
$stickyPinButton: {
selector: ".js-vid-pin",
events: {
click: "toggleSticky"
},
state: "sticky",
dependsOn: "$stickyContainer"
},
$shareButton: {
selector: ".js-vid-share",
events: {
click: "toggleShare"
}
},
$shareModal: {
selector: ".js-vid-modal-share",
ui: {
sizes: ".js-vid-share-sizes",
markup: ".js-vid-share-size-markup"
}
}
};
var a = {
state: "saveState",
position: "savePosition"
};
var n = {
type: "desktop",
seekTime: 0,
playbacks: null
};
n = $.extend(true, {}, Se, n);
n.initStates = function() {
var t = this,
i;
i = t.initPlaybackQualities();
w(e + "hasPlaybacks? ", i);
if (!i) {
w(e + "no playbacks");
return
}
t.loadSavedState()
};
n.initPlaybackQualities = function() {
var t = this,
i = t.els.$playbackButtons,
a = t.els.$qualityButtons,
n = {},
r = {},
s, o = false,
l = [];
if (a) {
w(e + "$qualities: ", a);
a.each(function() {
var e = $(this),
t = e.data(se);
r[t] = this
})
} else {
w("error", e + "No qualities defined!");
i = undefined
}
if (!!i) {
i.each(function() {
var i = $(this),
a = i.data(se),
o = ue(i),
u = i.data("qualities").split(","),
d = [],
f, c = [],
v;
for (s = 0; s < u.length; s++) {
f = r[u[s]];
if (undefined !== f) {
c.push(f);
d.push(u[s])
}
}
v = i.data("player");
if (v === "html5") {
t.html5Player = true
}
if (0 > $.inArray(v, l)) {
l.push(v)
}
n[a] = {
isAvailable: o,
playerType: v,
qualities: d,
$button: i,
$qualities: $(c)
};
w(e + "Playback Quality Elements for [" + a + "]: ", n[a])
});
if (l.length > 0) {
t.playbacks = n;
o = true;
re.loadPlayerTypes(l, t)
}
}
return o
};
n.initShareModal = function() {
var i = this,
a = i.els.$shareModal,
n = t.$shareModal.ui,
r, s, o = {},
l;
if (!a) {
return
}
r = a.find(n.sizes);
s = a.find(n.markup);
l = s.data("size");
w(e + "===== BEG ui.initShareModal =====>");
w(e + "Default share size is: ", l);
s.each(function() {
var e = $(this);
o[e.data("size")] = e
});
ge(o[l]);
r.on("change", function() {
var e = this,
t = $(e),
i = t.data("size") || l,
a = e[e.selectedIndex].value || l;
if (i !== a) {
t.data("size", a);
ye(o[i]);
ge(o[a])
}
});
w(e + "===== END ui.initShareModal =====>")
};
n.initComplete = function() {
var t = this,
i = t.stateJSON,
a = i.playback,
n = i[t.getStateKey("sticky")],
r = i[t.getStateKey("embiggen")],
s = i["volume"],
o = i["mute"],
u = l(),
d = t.els,
f = d.$playbackButtons,
c;
t.initShareModal();
c = ve(f, a);
if (0 === c.length) {
w(e + "invalid playback [" + a + "]");
a = undefined
}
if (undefined === a) {
c = ce(f);
a = c.data(se);
w(e + "using default playback [" + a + "]")
}
t.setPlayback(a);
if (!!d.$stickyPinButton && true === n) {
t.setSticky(true)
}
if (!!d.$embiggenButton && true === r) {
t.setEmbiggen(true)
}
if (undefined !== s) {
t.setVolume(s, true)
}
if (true === o) {
t.setMute(true)
} else if (this.getQuerySetting("mute") === "true") {
t.setMute(true, true)
}
t.adjustWidth();
u.on("resize", function() {
t.adjustWidth()
});
Se.initComplete.call(t);
if (t.hasAutoplay()) {
t.autoplay()
}
};
n.getUiMap = function() {
var i = $.extend(true, Se.getUiMap(), t);
w(e + "uiMap: ", i);
return i
};
n.getUiElement = function(t, i) {
var a = this,
n = a.els,
r = i.selector,
s, o, l, u;
if (!!i.external) {
if (!!i.parentOf) {
s = i.parentOf;
o = "parents"
} else if (!!i.childOf) {
s = i.childOf;
o = "find"
}
if (!!s) {
l = n[s]
}
if (!!l && !!o) {
u = l[o](r)
} else if (r.indexOf("#") === 0) {
u = $(r)
}
if (!u || u.length < 1) {
u = undefined
}
w(e + "external element [" + t + "]: ", u)
} else {
u = Se.getUiElement.call(a, t, i)
}
if (!!i.dependsOn && !!u) {
l = n[i.dependsOn];
if (undefined === l) {
w("warn", e + "- [" + t + "] depends on an element that does not exist. Removing from player.");
u.remove();
u = undefined
}
}
return u
};
n.initCountdown = function() {
var e = this,
t = Se.initCountdown.call(e);
if (t && t.length) {
t.on("complete", function() {
if (e.hasAutoplay()) {
e.autoplay()
}
})
}
return t
};
n.handleUserAction = function(t, i) {
w(e + "handleUserAction > elementData: ", i);
var n = this,
r = i.cookieType,
s = n[a[r]],
o;
if (!s) {
w("warn", e + "Not a cookie action");
return
}
switch (r) {
case "state":
o = i.state;
if (!!o) {
s.call(n, o, t.data(se))
} else {
w(e + "Invalid data detected, not saving.")
}
break;
default:
break
}
};
n.getVideoContainer = function(e) {
var t = this,
i = t.els.containers,
a = t.els.$videoContainer,
n;
if (!i) {
t.els.containers = i = {}
}
n = i[e];
if (!n) {
n = $('<div id="js-vid-' + e + "-player" + t.playerId + '" class="av-player-type-holder av-' + e + '-player-holder"/>');
a.append(n);
i[e] = n
}
return n
};
n.spacebarToggle = function(e) {
if (e.which === 32) {
e.preventDefault();
this.togglePlay()
}
};
n.stopSelect = function(e) {
if (!$(e.target).data("enable-select")) {
f(e)
}
return false
};
n.hasAutoplay = function() {
var e = this;
return e.videoJSON.autoplay && !e.states.counting
};
n.autoplay = function() {
var e = this;
if (!e.states.playing) {
w("!!! AUTOPLAY !!!");
e.els.$playPauseButtons.first().trigger("click")
}
};
n.getCurrentTime = function() {
var e = this,
t = e.states,
i = 0;
if (!e.videoJSON.isLiveStream && 0 === t.customStartTime && t.started) {
try {
i = re.getCurrentTime()
} catch (a) {}
}
return i
};
n.getQuerySetting = function(e) {
var t = new RegExp("[\\?&]" + e + "=([^&#]*)"),
i = t.exec(location.search);
return i === null ? "" : decodeURIComponent(i[1].replace(/\+/g, " "))
};
n.stashCurrentTime = function() {
var t = this,
i = t.states,
a = {},
n;
if (!t.videoJSON.isLiveStream && 0 === i.customStartTime && i.started) {
try {
n = re.getCurrentTime()
} catch (r) {
n = 0
}
a.customStartTime = n;
w(e + "stashCurrentTime() time: " + n);
if (true === i.restoredFromSavedTime) {
a.restoredFromSavedTime = false
}
t.setStates(a)
}
};
n.setPlayback = function(t) {
var i = this,
a = i.els,
n = a.$qualityButtons,
r = i.setControl(a.$playbackButtons, t),
s, o, l, u, d = i.stateJSON.quality,
f = i.states,
c = false;
var v = i.playbacks[t];
if (true === r) {
w(e + "setPlayback to: ", t);
i.setStates({
playback: t,
playerType: v.playerType
});
$(document).trigger("pre_page_event", ["pageLoad", {
om: {
video_player_type: v.playerType
}
}, true]);
$(document).trigger("remove_page_event");
i.stashCurrentTime();
o = v["$qualities"];
l = n.not(o);
ye(l);
ge(o);
s = v["qualities"];
w(e + "> available qualities for playback: ", s);
w(e + "> current activeQuality: ", d);
if (!d || 0 > $.inArray(d, s)) {
w(e + "> activeQuality not found for playback");
u = ce(o);
d = u.data(se);
w(e + "> setting new activeQuality to: ", d)
}
if (f.started) {
i.pause();
c = re.setPlayer()
}
i.setQuality(d, true);
if (c && f.started) {
w(e + "> player has started, play video with new player");
i.play()
}
}
return r
};
n.setQuality = function(e, t) {
var i = this,
a = i.states,
n = Se.setQuality.call(i, e, true);
if (n) {
i.stashCurrentTime();
if (a.started && !t) {
i.play()
}
}
return n
};
n.adStart = function() {
var e = this;
Se.adStart.call(e);
e.setVideoProgress("A word from our sponsors...")
};
n.contentEnd = function() {
var t = this,
i = t.states,
a = i.isLive,
n;
Se.contentEnd.call(t);
n = i.isAtEndTime;
if (!a && n) {
w(e + "reset progress width to 0");
t.setVideoProgress("", 0)
}
};
n.toggleShare = function() {
var e = this,
t = !e.states.share;
e.setStates({
share: t
})
};
(function() {
var i = "sticky",
a = {
zIndex: 5000050,
noStop: true,
unstickyOnAjax: false
},
r = function(t, a) {
var n = t.$stickyContainer,
r = t.$videoSpacer,
s = !!r;
if (true === a) {
w(e + "add sticky");
n.addClass(i);
if (s) {
r.height(n.outerHeight(true))
}
} else {
w(e + "remove sticky");
n.removeClass(i);
if (s) {
r.height("auto")
}
}
};
n.setSticky = function(e) {
var t = false,
i = this,
n = i.els,
s = n.$stickyContainer,
o = n.$stickyPinButton,
l = o.data(se) || false;
if (!!s && l !== e) {
t = true;
if (true === e) {
$.sticky(s, a, function() {
r(n, true)
}, function() {
r(n, false)
})
} else {
$.destroySticky(s);
r(n, false)
}
o.data(se, e);
i.setStates({
stickied: e
})
}
return t
};
n.toggleSticky = function() {
w(e + "toggle sticky!");
var i = this,
a = t.$stickyPinButton.cookieType,
n, r;
if (undefined === a) {
n = !i.els.$stickyPinButton.data(se);
r = i.setSticky(n)
} else {
r = i.toggleState("sticky")
}
return r
}
})();
(function() {
var e = false,
t = "pod-recirc--horizontal",
i = ["align-vertical--child", "align-vertical--contain"],
a, r, s, o = [];
var u = function(n, l) {
var u = n.$kubrickRelated;
if (!u) {
return
}
if (false === e) {
e = true;
a = u.data("embiggen-class");
r = u.data("debiggen-class");
s = u.find(".pod");
$.each(i, function(e, t) {
o.push(s.find("." + t))
})
}
if (l) {
u.addClass(a).removeClass(r);
s.addClass(t);
$.each(o, function(e, t) {
t.removeClass(i[e])
})
} else {
u.addClass(r).removeClass(a);
s.removeClass(t);
$.each(o, function(e, t) {
t.addClass(i[e])
})
}
};
n.setEmbiggen = function(e) {
var t = false,
i = this,
a = i.els,
n = a.$embiggenContainer,
r = a.$embiggenButton,
s = a.$embiggenVidSize,
o = a.$kubrickInfo,
d = a.$kubrickInfoParent,
f = a.$videoSpacer,
c = r.data(se) || false,
v = ".container",
p = '<div class="container"></div>',
y = "no-sticky",
g, h, m = s.data("embiggen-class"),
S = s.data("debiggen-class");
if (c !== e) {
t = true;
if (true === e) {
s.removeClass(S).addClass(m);
n.addClass("large").removeClass("small medium");
if (!!o) {
o.children().wrap(p);
o.addClass(y);
if (!!f) {
f.after(o)
}
}
} else {
s.removeClass(m).addClass(S);
n.addClass("small").removeClass("medium large");
if (!!o) {
h = o.find(v);
g = h.children();
if (h.length > 0) {
g.unwrap()
}
o.removeClass(y);
d.prepend(o)
}
}
u(a, e);
l().trigger("resize");
r.data(se, e);
i.setStates({
embiggened: e
})
}
return t
};
n.toggleEmbiggen = function() {
return this.toggleState("embiggen")
}
})();
(function() {
var t = "mouseenter" + i,
a = "mousemove" + i,
r = "mouseleave" + i,
s = null,
o = null,
l = 1500,
u = null,
d = null;
var f = function(e) {
if (e.clientX === u && e.clientY === d) {
return false
}
u = e.clientX;
d = e.clientY;
return true
};
var c = function(e, i) {
i.on(t, function(t) {
e.toggleStowControls(false)
});
i.on(a, function(t) {
if (f(t)) {
e.delayStowControls()
}
});
i.on(r, function() {
e.toggleStowControls(true)
})
};
var v = function(e) {
e.off(t);
e.off(a);
e.off(r)
};
n.toggleStowControls = function(e) {
var t = this;
if (null !== s) {
clearTimeout(s);
s = null
}
if (t.states.stowControls !== e) {
t.setStates({
stowControls: e
})
}
};
n.cancelStowControls = function() {
this.toggleStowControls(false)
};
n.delayStowControls = function() {
var e = this;
e.cancelStowControls();
s = setTimeout(function() {
e.toggleStowControls(true)
}, l)
};
n.setStowControls = function(t, i) {
var a = this,
n = a.els.$videoPlayerDiv;
w(e + "===== setStowControls: ", t);
a.cancelStowControls();
clearTimeout(o);
if (true === t) {
if (i) {
o = setTimeout(function() {
a.toggleStowControls(true);
c(a, n)
}, i)
} else {
c(a, n)
}
} else {
a.toggleStowControls(false);
u = null;
d = null;
v(n)
}
}
})();
return n
}();
var Pe = function() {
var e = "[UPDATE PLAYER] ",
t, i;
var a = function(t) {
var a = window.location.pathname;
var n = {
async: true,
data: {
updatePlayer: 1
},
dataType: "json",
cache: true,
type: "GET",
url: a,
beforeSend: function() {
w(e + "sending request for player update")
},
success: function(a) {
w(e + "Success data: ", a);
if (undefined === t) {
w(e + "Unable to find player to update");
return
}
if (undefined === a || undefined === a.html) {
w(e + "No player update provided");
return
}
if (undefined === i) {
i = $("<div/>")
}
var n;
i.html(a.html);
n = i.children();
t.replaceWith(n);
we.call(n[0]);
Te(n);
Ae(n)
},
error: function() {
w(e + "player update request failed")
}
};
w(e + "updatePlayer settings: ", n);
return n
};
return function(i) {
if (undefined === i) {
return
}
if (undefined !== t) {
w(e + "abort previous player update request");
t.abort()
}
t = $.ajax(a(i));
w(e + "request sent: ", t)
}
}();
var Te = function(e) {
u().trigger("videoPlayerReady", [e])
};
var Ae = function(e) {
l().on("unload", function() {
e.trigger("unloadVideoplayer")
})
};
var $e = function() {
var e;
return function(t) {
if (undefined === e || true === t) {
e = $(".js-video-player")
}
return e
}
}();
var we = function() {
var e = $(this),
t = e.data("id"),
i, a, n, r;
if (!t) {
return null
}
i = X(e);
w(i);
if (!i) {
w("error", "Video JSON missing for: ", e);
return null
}
if (i.isDevice) {
a = ke
} else {
a = Ce
}
n = {
playerId: t,
videoJSON: i,
els: {
$videoPlayerDiv: e
}
};
r = $.extend(true, {}, a);
r.initialize(n);
if (!r.els.$playerChrome && r.els.$countdown) {
r.els.$countdown.on("complete", function() {
Pe(e)
})
}
return r
};
var be = function() {
var e = $e(true),
i;
if (!!e.data("debug")) {
b()
}
w("Initializing metis version: ", t.version);
L(e);
z(e);
x(e);
W(e);
i = e.find(".js-vid-invalid-reqs");
if (j() != true && G() != true && H(e) != true) {
Ee(e)
} else {
var a = [];
e.each(function(e, t) {
a.push(we.apply(t))
});
i.hide();
Te(e);
De(a)
}
Ae(e)
};
var Ee = function(e) {
if (!e) {
var e = $e()
}
e.addClass(E + " has-vid-invalid-reqs");
e.find(".js-vid-player-chrome").remove();
e.find(".js-vid-invalid-reqs").show()
};
var De = function(e) {
var t = {};
var i = {
start: {
fn: r
},
getPlayerInfo: {
fn: s
},
play: {
fn: o,
params: ["videoId"]
},
pause: {
fn: l,
params: ["videoId"]
},
resume: {
fn: u,
params: ["videoId"]
},
isPlaying: {
fn: d,
params: ["videoId"]
},
getCurrentTimeStamp: {
fn: f,
params: ["videoId"]
},
setCurrentTimeStamp: {
fn: c,
params: ["videoId", "timestamp"]
},
ended: {
fn: v,
async: true,
params: ["videoId", "wait"]
}
};
(function() {
if (window.onmessage) {
console.log("Awesome, some bad ad provider is stepping on window.onmessage. Its probably going to have a broken ad")
}
e.forEach(function(e) {
t[e.videoJSON.id] = e
});
window.onmessage = a;
setInterval(function() {
if (window.onmessage != a) {
console.log("Awesome, some bad ad provider is stepping on window.onmessage. Its probably going to have a broken ad");
bindDispatch()
}
}, 1e3)
})();
function a(e) {
var t = e.data.request;
if (!t) {
return
}
if (!i.hasOwnProperty(t)) {
e.ports[0].postMessage({
msg: "error",
info: "unknown request"
});
return
}
var a = null;
function r(e) {
a = e
}
var s = [];
if (i[t].params) {
i[t].params.some(function(t) {
if (!e.data.hasOwnProperty(t)) {
a = "Missing param " + t;
return true
}
s.push(e.data[t])
})
}
if (i[t].async) {
s.push(n(e))
}
s.push(r);
var o = null;
if (!a) {
o = i[t].fn.apply(this, s)
}
if (!i[t].async || a) {
if (a) {
e.ports[0].postMessage({
result: "error",
data: a
})
} else {
e.ports[0].postMessage({
result: "ok",
data: o
})
}
}
}
function n(e) {
return function(t, i) {
if (i) {
e.ports[0].postMessage({
result: "error",
data: i
})
} else {
e.ports[0].postMessage({
result: "ok",
data: t
})
}
}
}
function r() {
var e = {
apiVersion: "0.01",
userLoggedIn: $("meta[name=userAuthState]").attr("content") == "loggedIn",
userIsPremium: $("meta[name=userIsPremium]").attr("content") == "premium",
edgework: "sucks"
};
return e
}
function s() {
var e = [];
for (var i in t) {
if (!t.hasOwnProperty(i)) {
continue
}
var a = t[i];
var n = {
id: i,
title: a.title,
premium: a.videoJSON.premium
};
e.push(n)
}
return e
}
function o(e, i) {
if (!t.hasOwnProperty(e)) {
return i("No such video player")
}
var a = t[e];
a.play()
}
function l(e, i) {
if (!t.hasOwnProperty(e)) {
return i("No such video player");
}
var a = t[e];
a.pause()
}
function u(e, i) {
if (!t.hasOwnProperty(e)) {
return i("No such video player")
}
var a = t[e];
a.resume()
}
function d(e, i) {
if (!t.hasOwnProperty(e)) {
return i("No such video player")
}
var a = t[e];
return a.states.playing
}
function f(e, i) {
if (!t.hasOwnProperty(e)) {
return i("No such video player")
}
var a = t[e];
return a.getCurrentTime()
}
function c(e, i, a) {
if (!t.hasOwnProperty(e)) {
return a("No such video player")
}
var n = t[e];
n.seekTime = i;
return n.seekTo()
}
function v(e, i, a, n) {
if (!t.hasOwnProperty(e)) {
return n("No such video player")
}
var r = t[e];
var s = !r.states.playing && Math.ceil(r.states.currentTime) >= r.states.duration;
if (i && !s) {
p(r, a, n)
} else {
a(s)
}
}
function p(e, t, i) {
var a = setInterval(function() {
if (!e.states.playing && Math.ceil(e.states.currentTime) >= e.states.duration) {
clearInterval(a);
t()
}
}, 1e3)
}
};
(function() {
var e = $e();
if (!e || e.length < 1) {
return
}
var t = u();
var i = $(".ad-settings"),
a = $("#ad-service-client");
var n = false;
var r = false;
var s = false;
var o = e.data("initOnAdRender");
var l = "[DEPENDENCIES] ";
var d = function() {
if (n && r && !s) {
w(l + "[" + (Date.now() - f) + "ms] INIT PLAYER");
be();
s = true
}
};
var f = Date.now(),
c, v, p = "g" + "u" + "il" + "t" + "_d" + "ete" + "cte" + "d";
w(l + "VIDEO PLAYER JS READY");
var y = {
tracking_initialized: function() {
w(l + "[" + (Date.now() - f) + "ms] PAGE TRACKING INITIALIZED");
r = true;
d()
}
};
var g = function() {
n = true;
d()
};
if (i && i.length > 0) {
y.ads_initialized = function() {
c = Date.now();
w(l + "[" + (c - f) + "ms] DISPLAY ADS JS INITIALIZED");
if (!o) {
g()
}
};
y[p] = function() {
v = Date.now();
w(l + "[" + (Date.now() - f) + "ms] GUILT DETECTED");
t.off(p, y[p])
};
if (o) {
y.ad_rendered = function() {
var e = $e(true);
v = Date.now();
w(l + "[" + (v - f) + "ms] DISPLAY AD RENDER DETECTED [" + (v - c) + "ms] after ADS JS INITIALIZED");
t.off("ad_rendered", y.ad_rendered);
if (e && e.length > 0) {
g()
} else {
w(l + "VIDEO PLAYER HAS BEEN REMOVED")
}
}
}
if (a && a.length > 0) {
if (a.data("isSpof")) {
g()
} else {
a.one("error", function() {
g()
})
}
}
} else {
n = true;
w(l + "[" + (Date.now() - f) + "ms] NO VIDEO PLAYER AD DEPENDENCIES")
}
t.on(y)
})()
})(this);
(function() {
"use strict";
var e = function() {
var e = /\-([a-z])/g,
t = function(e, t) {
return t.toUpperCase()
};
return function(r) {
return r.replace(e, t)
}
}();
var t = function(t, r) {
var i, o, n, s, a, l;
if (window.getComputedStyle) {
i = window.getComputedStyle(t, null).getPropertyValue(r)
} else {
o = e(r);
if (t.currentStyle) {
i = t.currentStyle[o]
} else {
i = t.style[o]
}
}
if (r === "cursor") {
if (!i || i === "auto") {
n = t.tagName.toLowerCase();
s = ["a"];
for (a = 0, l = s.length; a < l; a++) {
if (n === s[a]) {
return "pointer"
}
}
}
}
return i
};
var r = function(e) {
if (!h.prototype._singleton) return;
if (!e) {
e = window.event
}
var t;
if (this !== window) {
t = this
} else if (e.target) {
t = e.target
} else if (e.srcElement) {
t = e.srcElement
}
h.prototype._singleton.setCurrent(t)
};
var i = function(e, t, r) {
if (e.addEventListener) {
e.addEventListener(t, r, false)
} else if (e.attachEvent) {
e.attachEvent("on" + t, r)
}
};
var o = function(e, t, r) {
if (e.removeEventListener) {
e.removeEventListener(t, r, false)
} else if (e.detachEvent) {
e.detachEvent("on" + t, r)
}
};
var n = function(e, t) {
if (e.addClass) {
e.addClass(t);
return e
}
if (t && typeof t === "string") {
var r = (t || "").split(/\s+/);
if (e.nodeType === 1) {
if (!e.className) {
e.className = t
} else {
var i = " " + e.className + " ",
o = e.className;
for (var n = 0, s = r.length; n < s; n++) {
if (i.indexOf(" " + r[n] + " ") < 0) {
o += " " + r[n]
}
}
e.className = o.replace(/^\s+|\s+$/g, "")
}
}
}
return e
};
var s = function(e, t) {
if (e.removeClass) {
e.removeClass(t);
return e
}
if (t && typeof t === "string" || t === undefined) {
var r = (t || "").split(/\s+/);
if (e.nodeType === 1 && e.className) {
if (t) {
var i = (" " + e.className + " ").replace(/[\n\t]/g, " ");
for (var o = 0, n = r.length; o < n; o++) {
i = i.replace(" " + r[o] + " ", " ")
}
e.className = i.replace(/^\s+|\s+$/g, "")
} else {
e.className = ""
}
}
}
return e
};
var a = function() {
var e, t, r, i = 1;
if (typeof document.body.getBoundingClientRect === "function") {
e = document.body.getBoundingClientRect();
t = e.right - e.left;
r = document.body.offsetWidth;
i = Math.round(t / r * 100) / 100
}
return i
};
var l = function(e) {
var r = {
left: 0,
top: 0,
width: 0,
height: 0,
zIndex: 999999999
};
var i = t(e, "z-index");
if (i && i !== "auto") {
r.zIndex = parseInt(i, 10)
}
if (e.getBoundingClientRect) {
var o = e.getBoundingClientRect();
var n, s, l;
if ("pageXOffset" in window && "pageYOffset" in window) {
n = window.pageXOffset;
s = window.pageYOffset
} else {
l = a();
n = Math.round(document.documentElement.scrollLeft / l);
s = Math.round(document.documentElement.scrollTop / l)
}
var d = document.documentElement.clientLeft || 0;
var u = document.documentElement.clientTop || 0;
r.left = o.left + n - d;
r.top = o.top + s - u;
r.width = "width" in o ? o.width : o.right - o.left;
r.height = "height" in o ? o.height : o.bottom - o.top
}
return r
};
var d = function(e, t) {
var r = !(t && t.useNoCache === false);
if (r) {
return (e.indexOf("?") === -1 ? "?" : "&") + "nocache=" + (new Date).getTime()
} else {
return ""
}
};
var u = function(e) {
var t = [];
var r = [];
if (e.trustedOrigins) {
if (typeof e.trustedOrigins === "string") {
r.push(e.trustedOrigins)
} else if (typeof e.trustedOrigins === "object" && "length" in e.trustedOrigins) {
r = r.concat(e.trustedOrigins)
}
}
if (e.trustedDomains) {
if (typeof e.trustedDomains === "string") {
r.push(e.trustedDomains)
} else if (typeof e.trustedDomains === "object" && "length" in e.trustedDomains) {
r = r.concat(e.trustedDomains)
}
}
if (r.length) {
t.push("trustedOrigins=" + encodeURIComponent(r.join(",")))
}
if (typeof e.amdModuleId === "string" && e.amdModuleId) {
t.push("amdModuleId=" + encodeURIComponent(e.amdModuleId))
}
if (typeof e.cjsModuleId === "string" && e.cjsModuleId) {
t.push("cjsModuleId=" + encodeURIComponent(e.cjsModuleId))
}
return t.join("&")
};
var f = function(e, t) {
if (t.indexOf) {
return t.indexOf(e)
}
for (var r = 0, i = t.length; r < i; r++) {
if (t[r] === e) {
return r
}
}
return -1
};
var p = function(e) {
if (typeof e === "string") throw new TypeError("ZeroClipboard doesn't accept query strings.");
if (!e.length) return [e];
return e
};
var c = function(e, t, r, i, o) {
if (o) {
window.setTimeout(function() {
e.call(t, r, i)
}, 0)
} else {
e.call(t, r, i)
}
};
var h = function(e, t) {
if (e)(h.prototype._singleton || this).glue(e);
if (h.prototype._singleton) return h.prototype._singleton;
h.prototype._singleton = this;
this.options = {};
for (var r in y) this.options[r] = y[r];
for (var i in t) this.options[i] = t[i];
this.handlers = {};
if (h.detectFlashSupport()) C()
};
var v, m = [];
h.prototype.setCurrent = function(e) {
v = e;
this.reposition();
var r = e.getAttribute("title");
if (r) {
this.setTitle(r)
}
var i = this.options.forceHandCursor === true || t(e, "cursor") === "pointer";
g.call(this, i);
return this
};
h.prototype.setText = function(e) {
if (e && e !== "") {
this.options.text = e;
if (this.ready()) this.flashBridge.setText(e)
}
return this
};
h.prototype.setTitle = function(e) {
if (e && e !== "") this.htmlBridge.setAttribute("title", e);
return this
};
h.prototype.setSize = function(e, t) {
if (this.ready()) this.flashBridge.setSize(e, t);
return this
};
h.prototype.setHandCursor = function(e) {
e = typeof e === "boolean" ? e : !!e;
g.call(this, e);
this.options.forceHandCursor = e;
return this
};
var g = function(e) {
if (this.ready()) this.flashBridge.setHandCursor(e)
};
h.version = "1.2.1";
var y = {
moviePath: "ZeroClipboard.swf",
trustedOrigins: null,
text: null,
hoverClass: "zeroclipboard-is-hover",
activeClass: "zeroclipboard-is-active",
allowScriptAccess: "sameDomain",
useNoCache: true,
forceHandCursor: false
};
h.setDefaults = function(e) {
for (var t in e) y[t] = e[t]
};
h.destroy = function() {
h.prototype._singleton.unglue(m);
var e = h.prototype._singleton.htmlBridge;
e.parentNode.removeChild(e);
delete h.prototype._singleton
};
h.detectFlashSupport = function() {
var e = false;
if (typeof ActiveXObject === "function") {
try {
if (new ActiveXObject("ShockwaveFlash.ShockwaveFlash")) {
e = true
}
} catch (t) {}
}
if (!e && navigator.mimeTypes["application/x-shockwave-flash"]) {
e = true
}
return e
};
var b = null;
var w = null;
var C = function() {
var e = h.prototype._singleton;
var t = document.getElementById("global-zeroclipboard-html-bridge");
if (!t) {
var r = {};
for (var i in e.options) r[i] = e.options[i];
r.amdModuleId = b;
r.cjsModuleId = w;
var o = u(r);
var n = ' <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" id="global-zeroclipboard-flash-bridge" width="100%" height="100%"> <param name="movie" value="' + e.options.moviePath + d(e.options.moviePath, e.options) + '"/> <param name="allowScriptAccess" value="' + e.options.allowScriptAccess + '"/> <param name="scale" value="exactfit"/> <param name="loop" value="false"/> <param name="menu" value="false"/> <param name="quality" value="best" /> <param name="bgcolor" value="#ffffff"/> <param name="wmode" value="transparent"/> <param name="flashvars" value="' + o + '"/> <embed src="' + e.options.moviePath + d(e.options.moviePath, e.options) + '" loop="false" menu="false" quality="best" bgcolor="#ffffff" width="100%" height="100%" name="global-zeroclipboard-flash-bridge" allowScriptAccess="always" allowFullScreen="false" type="application/x-shockwave-flash" wmode="transparent" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="' + o + '" scale="exactfit"> </embed> </object>';
t = document.createElement("div");
t.id = "global-zeroclipboard-html-bridge";
t.setAttribute("class", "global-zeroclipboard-container");
t.setAttribute("data-clipboard-ready", false);
t.style.position = "absolute";
t.style.left = "-9999px";
t.style.top = "-9999px";
t.style.width = "15px";
t.style.height = "15px";
t.style.zIndex = "9999";
t.innerHTML = n;
document.body.appendChild(t)
}
e.htmlBridge = t;
e.flashBridge = document["global-zeroclipboard-flash-bridge"] || t.children[0].lastElementChild
};
h.prototype.resetBridge = function() {
this.htmlBridge.style.left = "-9999px";
this.htmlBridge.style.top = "-9999px";
this.htmlBridge.removeAttribute("title");
this.htmlBridge.removeAttribute("data-clipboard-text");
s(v, this.options.activeClass);
v = null;
this.options.text = null;
return this
};
h.prototype.ready = function() {
var e = this.htmlBridge.getAttribute("data-clipboard-ready");
return e === "true" || e === true
};
h.prototype.reposition = function() {
if (!v) return false;
var e = l(v);
this.htmlBridge.style.top = e.top + "px";
this.htmlBridge.style.left = e.left + "px";
this.htmlBridge.style.width = e.width + "px";
this.htmlBridge.style.height = e.height + "px";
this.htmlBridge.style.zIndex = e.zIndex + 1;
this.setSize(e.width, e.height);
return this
};
h.dispatch = function(e, t) {
h.prototype._singleton.receiveEvent(e, t)
};
h.prototype.on = function(e, t) {
var r = e.toString().split(/\s/g);
for (var i = 0; i < r.length; i++) {
e = r[i].toLowerCase().replace(/^on/, "");
if (!this.handlers[e]) this.handlers[e] = t
}
if (this.handlers.noflash && !h.detectFlashSupport()) {
this.receiveEvent("onNoFlash", null)
}
return this
};
h.prototype.addEventListener = h.prototype.on;
h.prototype.off = function(e, t) {
var r = e.toString().split(/\s/g);
for (var i = 0; i < r.length; i++) {
e = r[i].toLowerCase().replace(/^on/, "");
for (var o in this.handlers) {
if (o === e && this.handlers[o] === t) {
delete this.handlers[o]
}
}
}
return this
};
h.prototype.removeEventListener = h.prototype.off;
h.prototype.receiveEvent = function(e, t) {
e = e.toString().toLowerCase().replace(/^on/, "");
var r = v;
var i = true;
switch (e) {
case "load":
if (t && parseFloat(t.flashVersion.replace(",", ".").replace(/[^0-9\.]/gi, "")) < 10) {
this.receiveEvent("onWrongFlash", {
flashVersion: t.flashVersion
});
return
}
this.htmlBridge.setAttribute("data-clipboard-ready", true);
break;
case "mouseover":
n(r, this.options.hoverClass);
break;
case "mouseout":
s(r, this.options.hoverClass);
this.resetBridge();
break;
case "mousedown":
n(r, this.options.activeClass);
break;
case "mouseup":
s(r, this.options.activeClass);
break;
case "datarequested":
var o = r.getAttribute("data-clipboard-target"),
a = !o ? null : document.getElementById(o);
if (a) {
var l = a.value || a.textContent || a.innerText;
if (l) this.setText(l)
} else {
var d = r.getAttribute("data-clipboard-text");
if (d) this.setText(d)
}
i = false;
break;
case "complete":
this.options.text = null;
break
}
if (this.handlers[e]) {
var u = this.handlers[e];
if (typeof u === "string" && typeof window[u] === "function") {
u = window[u]
}
if (typeof u === "function") {
c(u, r, this, t, i)
}
}
};
h.prototype.glue = function(e) {
e = p(e);
for (var t = 0; t < e.length; t++) {
if (f(e[t], m) == -1) {
m.push(e[t]);
i(e[t], "mouseover", r)
}
}
return this
};
h.prototype.unglue = function(e) {
e = p(e);
for (var t = 0; t < e.length; t++) {
o(e[t], "mouseover", r);
var i = f(e[t], m);
if (i != -1) m.splice(i, 1)
}
return this
};
if (typeof define === "function" && define.amd) {
define(["require", "exports", "module"], function(e, t, r) {
b = r && r.id || null;
return h
})
} else if (typeof module === "object" && module && typeof module.exports === "object" && module.exports) {
w = module.id || null;
module.exports = h
} else {
window.ZeroClipboard = h
}
})();
(function(t) {
"use strict";
var a = ".js-clipboard-set";
var i = ".js-clipboard-btn";
var e = ".js-clipboard-target";
var o = "is-clipboard-copied";
var r = 0;
var d = 2e3;
var c = "clipboard-copied-delay";
var s = "clipboard-copied-msg";
var n = function() {
var t = $(a);
t.each(function() {
var t = $(this),
a = t.find(e).first(),
o = t.find(i).first(),
d;
if (0 === a.length || 0 === o.length) {
return
}
d = a.attr("id");
if (!d) {
r += 1;
d = "js-clipboard-target-" + r;
a.attr("id", d)
}
o.attr("data-clipboard-target", d)
})
};
var l = function() {
var t = $(this),
a = t.data(c) || d,
i = t.data(s),
e = t.data("copiedTimeoutId");
if (!!i) {
Phoenix.Ui.showSuccessMessage(i)
}
if (!!e) {
clearTimeout(e);
t.data("copiedTimeoutId", false)
}
t.addClass(o);
e = setTimeout(function() {
t.removeClass(o);
t.data("copiedTimeoutId", false)
}, a);
t.data("copiedTimeoutId", e)
};
var f = function() {
var a = $(i),
e = t.ZeroClipboard,
o = $("meta#ZeroClipBoardSwf").attr("content"),
r = "function" === typeof e,
d, c = window.location;
if (!r || !o || 0 === a.length) {
if (0 < a.length) {
a.remove()
}
return
}
n();
e.setDefaults({
allowScriptAccess: "always",
moviePath: o,
trustedOrigins: [c.protocol + "//" + c.host]
});
d = new e(a);
d.on("complete", l)
};
$(window).on("load", f)
})(this);
(function(t) {
"use strict";
var e = $(document);
var a = ".js-video-player";
var n = ".js-vid-postplay";
var o = ".js-vid-postplay-countdown";
var r = ".js-vid-postplay-timer";
var i = ".js-vid-postplay-close";
var d = ".js-vid-postplay-stop";
var s = ".js-vid-postplay-next";
var f = ".js-vid-postplay-action";
var u = ".js-vid-postplay-videos";
var l = ".js-vid-postplay-video";
var c = "is-postplay-counting";
var v = "is-postplay-complete";
var p = "is-vid-postplay";
var y = "is-countdown-stopped";
var w = "is-countdown-disabled";
var h = "countdown-timeout-id";
var m = "postplay-started";
var g = "postplay-id";
var x = "redir-tracking";
var C = "event-tracking";
var j = "enterViewport";
var k = 10;
var V = 1e3;
var P = 10;
var T = 500;
var S = 0;
var N = {
videoTimeRemaining: 0,
countdown: {
timeValue: 0,
delayStart: 0,
delayOverride: 0
},
deferred: false,
canceled: false,
paused: false,
noCountdown: false
};
var O = {};
var D;
var R = function() {
var t, e, a, n, o, r, i, d, s, f;
var c = function() {
var t = f.watchedCookieName,
e;
if (!t) {
return
}
e = $.parseJSON($.cookie(t));
if (!e) {
e = []
}
d = e
};
var v = function() {
var t = f.watchedCookieName,
e = f.watchedCookieDays,
a;
if (undefined === d) {
return
}
try {
a = JSON.stringify(d)
} catch (n) {
a = false
}
$.cookie(t, a, {
path: "/",
expires: e
})
};
var p = function() {
var t = [],
e, a;
for (a = 0; a < d.length; a++) {
e = d[a];
if (0 > $.inArray(e, s)) {
t.push(e)
}
}
d = t
};
var y = function() {
var t = e[0].querySelectorAll(l),
a, n, o;
for (o = 0; o < t.length; o++) {
a = $(t[o]);
n = a.data("id");
if (!r) {
r = a
}
if (0 <= d.indexOf(n)) {
s.push(n)
} else {
i = a;
break
}
}
};
var w = function() {
var n, d = t.$timer,
s;
if (r !== i) {
o = e.find(u);
o.prepend(i)
}
n = i.find("a");
if (false === $.contains(i[0], d[0])) {
n.append(d)
}
s = n.text();
a.text("Next up: " + s);
a.attr({
href: n.attr("href"),
title: s
})
};
return function(o, d) {
f = o.data("video");
t = d;
e = t.$postPlay;
a = t.$nextControl;
n = t.$countdown;
c();
r = i = null;
s = [];
y();
if (null === i) {
i = r;
p();
v()
}
w();
d.$nextVideo = i
}
}();
var H = function(t, e) {
var a = e.find(n),
u = a.find(s),
l = a.find(f),
v = a.find([i, d].join(",")),
p = $.extend({}, N, {
$player: e,
$postPlay: a,
$countdown: a.find(o),
$nextControl: u,
$nextVideo: null,
$timer: a.find(r),
watcher: scrollMonitor.create(e),
noCountdown: a.data("no-countdown") ? true : false,
noNext: a.data("no-next") ? true : false
});
p.enterViewportHandler = function() {
J(p)
};
if (v && v.length > 0) {
v.on("click", function(t) {
var e = $(this);
if (a.hasClass(c)) {
t.stopPropagation();
t.preventDefault();
if (e.is(i)) {
L(p)
} else {
I(p)
}
}
})
}
u.on("click", function() {
F(p)
});
l.on("click", function() {
var t = $(this).closest(p.$nextVideo);
if (t.length > 0) {
F(p)
} else {
I(p)
}
});
l.each(function(t) {
var e = $(this),
a = e.data(C);
if (a) {
a += "|" + (t + 1);
e.data(C, a)
}
});
if (p.noNext === false) {
R(e, p)
}
O[t] = p
};
var M = function(t) {
var e = t.data(g);
if (!e) {
S++;
e = S;
t.data(g, e);
H(e, t)
}
return O[e]
};
var b = function(t) {
var e = t.$nextControl,
a = e.data(x);
if (a) {
e.data(C, a);
e.trigger("customEventTracking")
}
window.location = e.attr("href")
};
var A = function(t) {
var e = t.data(h);
clearTimeout(e);
e = null;
t.data(h, e)
};
var E = function(t, e, a) {
var n = t.$countdown,
o = t.videoTimeRemaining,
r, i;
A(n);
if (Math.floor(o) > e) {
e = Math.floor(o);
a = (o - e) * V + P
}
r = e - 1;
n.text(e);
t.countdown = {
timeValue: e,
delayStart: Date.now(),
delayOverride: null
};
if (t.paused) {
return
}
if (a) {}
if (0 >= e) {
setTimeout(function() {
F(t, true)
}, T)
} else {
i = setTimeout(function() {
E(t, r)
}, a || V);
n.data(h, i)
}
};
var J = function(t) {
var e = t.$countdown,
a;
A(t.$countdown);
B(t);
t.$postPlay.removeClass(v).addClass(c);
t.$timer.removeClass(y);
a = setTimeout(function() {
E(t, k)
}, P);
e.data(h, a)
};
var q = function(t) {
if (!t.deferred) {
t.deferred = true;
t.watcher.on(j, t.enterViewportHandler)
}
};
var B = function(t) {
if (t.deferred) {
t.deferred = false;
t.watcher.off(j, t.enterViewportHandler)
}
};
var I = function(t) {
$.extend(t, N);
A(t.$countdown);
B(t);
t.$postPlay.removeClass(c);
t.$timer.addClass(y)
};
var W = function(t) {
if (!t.paused && t.countdown.timeValue > 0) {
var e = Date.now(),
a = e - t.countdown.delayStart;
A(t.$countdown);
B(t);
t.paused = true;
t.countdown.delayOverride = a
}
};
var z = function(t) {
if (t.paused) {
t.paused = false;
E(t, t.countdown.timeValue, t.countdown.delayOverride)
}
};
var F = function(t, e) {
I(t);
t.$postPlay.addClass(v);
if (e) {
b(t)
}
};
var G = function(t) {
I(t);
t.$player.removeClass(p)
};
var K = function(t) {
t.$player.addClass(p)
};
var L = function(t) {
G(t);
t.canceled = true
};
var Q = function(t) {
var e;
if (true === t.data(m)) {
return
}
t.trigger("postPlayStart");
D = e = M(t);
t.data(m, true);
K(e);
if (e) {
e.canceled = false;
if (e.countdown && !e.noCountdown) {
if (e.watcher.isInViewport) {
J(e)
} else {
q(e)
}
} else {
e.$timer.addClass(w)
}
}
};
var U = function(t) {
var e;
if (!t.data(m)) {
return
}
e = M(t);
t.data(m, false);
if (e) {
G(e)
}
};
var X = function() {
e.on({
contentPause: function() {
W(M($(this)))
},
contentProgress: function(t, e) {
if (e) {
var a = $(this),
n = M(a),
o = e.duration - e.currentTime;
n.videoTimeRemaining = o;
if (k < o) {
U(a)
} else {
if (false === e.adPlaying && true === e.playing) {
Q(a, e)
}
}
}
},
contentResume: function() {
var t = M($(this));
if (t.paused) {
z(t)
}
}
}, a)
};
var Y = function() {
e.on({
contentEnd: function() {
Q($(this))
},
videoStart: function() {
U($(this))
}
}, a)
};
var Z = function(t) {
var a = t.data("postplay-start");
if (0 === a) {
Y()
} else {
X()
}
e.on({
rteBlur: function() {
if (D && !D.canceled) {
q(D)
}
},
rteTyping: function() {
if (D) {
I(D)
}
}
}, ".js-editor-textarea")
};
e.on("ready", function() {
var t = $(n);
if (t && 0 < t.length) {
Z(t)
}
$(".js-preshow-iframe").load(function() {
this.contentWindow.$(".js-video-player").on("postPlayStart", function() {
$(".js-preshow-title").remove()
})
})
})
})(this);
(function(t) {
if (typeof define !== "undefined" && define.amd) {
define([], t)
} else if (typeof module !== "undefined" && module.exports) {
module.exports = t()
} else {
window.scrollMonitor = t()
}
})(function() {
var t = function() {
return window.pageYOffset || document.documentElement && document.documentElement.scrollTop || document.body.scrollTop
};
var i = {};
var e = [];
var o = "visibilityChange";
var s = "enterViewport";
var n = "fullyEnterViewport";
var r = "exitViewport";
var h = "partiallyExitViewport";
var l = "locationChange";
var c = "stateChange";
var a = [o, s, n, r, h, l, c];
var p = {
top: 0,
bottom: 0
};
var u = function() {
return window.innerHeight || document.documentElement.clientHeight
};
var w = function() {
return Math.max(document.body.scrollHeight, document.documentElement.scrollHeight, document.body.offsetHeight, document.documentElement.offsetHeight, document.documentElement.clientHeight)
};
i.viewportTop = null;
i.viewportBottom = null;
i.documentHeight = null;
i.viewportHeight = u();
var f;
var m;
var d;
function v() {
i.viewportTop = t();
i.viewportBottom = i.viewportTop + i.viewportHeight;
i.documentHeight = w();
if (i.documentHeight !== f) {
d = e.length;
while (d--) {
e[d].recalculateLocation()
}
f = i.documentHeight
}
}
function b() {
i.viewportHeight = u();
v();
I()
}
var g;
function V() {
clearTimeout(g);
g = setTimeout(b, 100)
}
var y;
function I() {
y = e.length;
while (y--) {
e[y].update()
}
y = e.length;
while (y--) {
e[y].triggerCallbacks()
}
}
function k(t, e) {
var u = this;
this.watchItem = t;
if (!e) {
this.offsets = p
} else if (e === +e) {
this.offsets = {
top: e,
bottom: e
}
} else {
this.offsets = {
top: e.top || p.top,
bottom: e.bottom || p.bottom
}
}
this.callbacks = {};
for (var w = 0, f = a.length; w < f; w++) {
u.callbacks[a[w]] = []
}
this.locked = false;
var d;
var v;
var b;
var g;
var V;
var y;
function I(t) {
if (t.length === 0) {
return
}
V = t.length;
while (V--) {
y = t[V];
y.callback.call(u, m);
if (y.isOne) {
t.splice(V, 1)
}
}
}
this.triggerCallbacks = function k() {
if (this.isInViewport && !d) {
I(this.callbacks[s])
}
if (this.isFullyInViewport && !v) {
I(this.callbacks[n])
}
if (this.isAboveViewport !== b && this.isBelowViewport !== g) {
I(this.callbacks[o]);
if (!v && !this.isFullyInViewport) {
I(this.callbacks[n]);
I(this.callbacks[h])
}
if (!d && !this.isInViewport) {
I(this.callbacks[s]);
I(this.callbacks[r])
}
}
if (!this.isFullyInViewport && v) {
I(this.callbacks[h])
}
if (!this.isInViewport && d) {
I(this.callbacks[r])
}
if (this.isInViewport !== d) {
I(this.callbacks[o])
}
switch (true) {
case d !== this.isInViewport:
case v !== this.isFullyInViewport:
case b !== this.isAboveViewport:
case g !== this.isBelowViewport:
I(this.callbacks[c])
}
d = this.isInViewport;
v = this.isFullyInViewport;
b = this.isAboveViewport;
g = this.isBelowViewport
};
this.recalculateLocation = function() {
if (this.locked) {
return
}
var t = this.top;
var e = this.bottom;
if (this.watchItem.nodeName) {
var o = this.watchItem.style.display;
if (o === "none") {
this.watchItem.style.display = ""
}
var s = this.watchItem.getBoundingClientRect();
this.top = s.top + i.viewportTop;
this.bottom = s.bottom + i.viewportTop;
if (o === "none") {
this.watchItem.style.display = o
}
} else if (this.watchItem === +this.watchItem) {
if (this.watchItem > 0) {
this.top = this.bottom = this.watchItem
} else {
this.top = this.bottom = i.documentHeight - this.watchItem
}
} else {
this.top = this.watchItem.top;
this.bottom = this.watchItem.bottom
}
this.top -= this.offsets.top;
this.bottom += this.offsets.bottom;
this.height = this.bottom - this.top;
if ((t !== undefined || e !== undefined) && (this.top !== t || this.bottom !== e)) {
I(this.callbacks[l])
}
};
this.recalculateLocation();
this.update();
d = this.isInViewport;
v = this.isFullyInViewport;
b = this.isAboveViewport;
g = this.isBelowViewport
}
k.prototype = {
on: function(t, i, e) {
switch (true) {
case t === o && !this.isInViewport && this.isAboveViewport:
case t === s && this.isInViewport:
case t === n && this.isFullyInViewport:
case t === r && this.isAboveViewport && !this.isInViewport:
case t === h && this.isAboveViewport:
i.call(this, m);
if (e) {
return
}
}
if (this.callbacks[t]) {
this.callbacks[t].push({
callback: i,
isOne: e || false
})
} else {
throw new Error("Tried to add a scroll monitor listener of type " + t + ". Your options are: " + a.join(", "))
}
},
off: function(t, i) {
if (this.callbacks[t]) {
for (var e = 0, o; o = this.callbacks[t][e]; e++) {
if (o.callback === i) {
this.callbacks[t].splice(e, 1);
break
}
}
} else {
throw new Error("Tried to remove a scroll monitor listener of type " + t + ". Your options are: " + a.join(", "))
}
},
one: function(t, i) {
this.on(t, i, true)
},
recalculateSize: function() {
this.height = this.watchItem.offsetHeight + this.offsets.top + this.offsets.bottom;
this.bottom = this.top + this.height
},
update: function() {
this.isAboveViewport = this.top < i.viewportTop;
this.isBelowViewport = this.bottom > i.viewportBottom;
this.isInViewport = this.top <= i.viewportBottom && this.bottom >= i.viewportTop;
this.isFullyInViewport = this.top >= i.viewportTop && this.bottom <= i.viewportBottom || this.isAboveViewport && this.isBelowViewport
},
destroy: function() {
var t = e.indexOf(this),
i = this;
e.splice(t, 1);
for (var o = 0, s = a.length; o < s; o++) {
i.callbacks[a[o]].length = 0
}
},
lock: function() {
this.locked = true
},
unlock: function() {
this.locked = false
}
};
var H = function(t) {
return function(i, e) {
this.on.call(this, t, i, e)
}
};
for (var E = 0, T = a.length; E < T; E++) {
var B = a[E];
k.prototype[B] = H(B)
}
try {
v()
} catch (A) {
try {
window.$(v)
} catch (A) {
throw new Error("If you must put scrollMonitor in the <head>, you must use jQuery.")
}
}
function F(t) {
m = t;
v();
I()
}
if (window.addEventListener) {
window.addEventListener("scroll", F);
window.addEventListener("resize", V)
} else {
window.attachEvent("onscroll", F);
window.attachEvent("onresize", V)
}
i.beget = i.create = function(t, i) {
if (typeof t === "string") {
t = document.querySelector(t)
} else if (t && t.length > 0) {
t = t[0]
}
var o = new k(t, i);
e.push(o);
o.update();
return o
};
i.update = function() {
m = null;
v();
I()
};
i.recalculateLocations = function() {
i.documentHeight = 0;
i.update()
};
return i
});
(function(e) {
"use strict";
var s = e.Phoenix,
r = e.setTimeout,
n = e.clearTimeout,
t = 5e3,
o = 400,
i = s.jQuery.getMessageBlock(),
a = " ",
c = "in",
f = "message-success",
u = "message-danger",
g = "message-info",
l = "transitioning",
m = [l, u, g, f],
d = "successReferrer",
h = "successMessage",
M = "errorReferrer",
v = "errorMessage",
S = "error",
w = "notification",
I = "success",
p = false,
k = null;
var y = function(e) {
i.text("").removeClass(m.join(a));
if (!!e) {
try {
e()
} catch (s) {}
}
};
var j = function(e, s, m) {
var j, z, P, b, N, Q = "",
T = [],
L = false,
U = false;
if (k) {
n(k);
k = null
}
switch (s) {
case S:
T.push(u);
L = M;
U = v;
break;
case w:
T.push(g);
break;
case I:
T.push(f);
L = d;
U = h;
break;
default:
break
}
if (T.length > 0) {
T.push(c);
Q = T.join(a)
} else {
Q = c
}
m = m || {};
j = m.callback;
z = m.afterPost || false;
P = m.permanent || false;
b = m.hideDelay || t;
N = m.hideDuration || o;
if (!!window.Modernizr && Modernizr.sessionstorage && z === true && !!L && !!U) {
sessionStorage.setItem(L, location.href);
sessionStorage.setItem(U, e)
} else {
if (p) {
Ui.clearPermanentMessage()
}
i.addClass(Q).addClass(l).html(e).fadeIn();
if (P === false) {
k = r(function() {
n(k);
k = null;
i.fadeOut(N, function() {
y(j)
})
}, b)
} else {
p = true
}
}
};
s.Ui = {
showSuccessMessage: function(e, s) {
j(e, I, s)
},
showMessageBar: function(e) {
j(e)
},
showErrorMessage: function(e, s) {
j(e, S, s)
},
showNotificationMessage: function(e, s) {
j(e, w, s)
},
showPermanentMessage: function(e) {
j(e, w, {
permanent: true
})
},
checkSuccessMessages: function() {
if (!window.Modernizr || !Modernizr.sessionstorage) return;
var e = sessionStorage.getItem(d);
if (e) {
if (e === document.referrer) {
var s = sessionStorage.getItem(h);
j(s, I)
}
sessionStorage.removeItem(h);
sessionStorage.removeItem(d)
}
},
removePermanentMessage: function(e) {
i.fadeOut(o, function() {
y(e)
})
},
clearPermanentMessage: function() {
i.hide();
y()
},
checkErrorMessages: function() {
if (!window.Modernizr || !Modernizr.sessionstorage) return;
var e = sessionStorage.getItem(M);
if (e) {
if (e === document.referrer) {
var s = sessionStorage.getItem(v);
j(s, S)
}
sessionStorage.removeItem(v);
sessionStorage.removeItem(M)
}
},
showLoadingScreen: function(e) {
var r = s.jQuery.getLoadingScreen(e);
s.jQuery.getBody().append(r)
},
hideLoadingScreen: function() {
var e = s.jQuery.getLoadingScreen(null, true);
e.remove()
},
convertTime: function(e, s) {
if (!e) {
e = 0
} else if (e < 0 || isNaN(e)) {
if (e.split(":").length > 0) {
return e
} else {
e = 0
}
}
var r = Math.floor(e / 60 % 60);
var n = Math.floor(e / 60 / 60);
var t = Math.floor(e % 60);
if (t < 10) {
t = "0" + t
}
if (r < 10) {
r = "0" + r
}
if (e > 3600 || s === true) {
return n + ":" + r + ":" + t
} else {
return r + ":" + t
}
},
convertTimeToSeconds: function(e) {
if (e) {
var s = e.split(":");
if (s.length >= 3) {
return +s[0] * 60 * 60 + +s[1] * 60 + +s[2]
} else if (!isNaN(e)) {
return parseInt(e)
}
}
return 0
}
};
s.jQuery.getDocument().ready(function() {
s.Ui.checkSuccessMessages();
s.Ui.checkErrorMessages()
})
})(this);
$(document).ready(function() {
"use strict";
var e = function(e) {
if (e.attr("data-remove-parent")) {
e.closest(e.attr("data-remove-parent")).remove();
return
}
var t = e.children("i.icon");
var a = e.attr("data-toggle-value");
e.attr("data-toggle-value", e.text());
e.text(a);
e.prepend(t);
if (e.attr("data-toogle-tooltip")) {
var i = e.attr("data-tooltip-toggle-value");
var r = e.attr("data-tooltip-title");
e.attr("data-tooltip-toggle-value", r);
e.attr("data-tooltip-title", i);
e.data("tooltip").options.title = i;
e.attr("data-original-title", i)
}
};
var t = function() {
var e = "event-tracking";
return function(t, a) {
var i = t.data(e),
r;
if ("string" === typeof i) {
r = i;
i = undefined
}
if (undefined === i) {
i = {};
if (r) {
i.event_hierarchy = r
}
if (a.eventTracking) {
$.extend(i, a.eventTracking)
}
if (!$.isEmptyObject(i)) {
t.data(e, i)
}
}
if (undefined !== i && !$.isEmptyObject(i)) {
t.trigger("followEventTracking")
}
}
}();
var a = function() {
$(".btn-toggle").each(function() {
var a = $(this);
if (a.data("btn-toggle-initialized")) {
return
}
a.on("click", function(a) {
if ($(this).is("a") === true && $(this).attr("href") !== "") {
var i = $(this),
r;
if (i.hasClass("super-action")) {
i.siblings(".super-action").toggleClass("active", false);
i.siblings(".sub-action:not('." + i.attr("rel") + "')").toggleClass("hide", true);
i.toggleClass("active");
r = i.siblings("." + i.attr("rel")).toggleClass("hide");
$("body").bind("click", function(e) {
if (!$.contains(r.get(0), e.target)) {
i.removeClass("active");
r.addClass("hide");
$(this).unbind(e)
}
});
return false
} else if (i.hasClass("has-input") && i.attr("rel").length && i.siblings(":input[name='" + i.attr("rel") + "']").val().length) {
i.attr("href", jQuery.param.querystring(i.attr("href"), "reason=" + encodeURIComponent(i.siblings(":input[name='" + i.attr("rel") + "']").val())))
} else if (i.parents(".sub-action").find("a:contains('Flagged')").length > 0) {
return false
}
var n = i.attr("data-verify-statement");
if (typeof n != "undefined" && n) {
if (!confirm(n)) {
return false
}
}
AjaxApiRequest.makeApiRequest($(this).attr("href"), null, true, function(a) {
var r = [];
if (a.hasOwnProperty("hideDelay")) {
r["hideDelay"] = a.hideDelay
}
if (a.hasOwnProperty("redirect")) {
Phoenix.Ui.showErrorMessage(a.error, r);
window.location.href = a.redirect + "?redirect_url=" + document.URL
} else if (a.hasOwnProperty("success") && !a.success) {
var n = a.message || a.reason || a.error || "Feature broken. Do not worry. Fix in pipeline.";
Phoenix.Ui.showErrorMessage(a.message, r)
} else {
if (a.success === 1) {
t(i, a)
}
var n = a.message || "Setting saved.";
Phoenix.Ui.showSuccessMessage(n, r);
e(i)
}
}, function() {
Phoenix.Ui.showErrorMessage("Woops! Something happened and we are working on it!")
});
a.preventDefault()
}
});
a.data("btn-toggle-initialized", true)
});
$(".js-form-toggle").each(function() {
var e = $(this),
a;
if (e.data("btn-toggle-initialized")) {
return
}
e.find('[type="submit"]').on("click", function(e) {
a = $(this)
});
e.on("submit", function(i) {
AjaxApiRequest.makeApiRequest(e.attr("action"), e.serialize() + "&" + a.attr("name") + "=" + a.attr("value"), e.attr("method") === "post" ? true : false, function(a) {
var i = [];
if (a.hasOwnProperty("hideDelay")) {
i["hideDelay"] = a.hideDelay
}
if (a.hasOwnProperty("redirect")) {
Phoenix.Ui.showErrorMessage(a.error, i);
window.location.href = a.redirect + "?redirect_url=" + document.URL
} else if (a.hasOwnProperty("success") && !a.success) {
var r = a.message || a.reason || a.error || "Feature broken. Do not worry. Fix in pipeline.";
Phoenix.Ui.showErrorMessage(a.message, i)
} else {
t(e, a);
var r = a.message || "Setting saved.";
Phoenix.Ui.showSuccessMessage(r, i)
}
if (a.hasOwnProperty("html")) {
e.replaceWith(a.html)
}
}, function() {
Phoenix.Ui.showErrorMessage("Woops! Something happened and we are working on it!")
});
i.preventDefault()
});
e.data("btn-toggle-initialized", true)
})
};
a();
$(document).ajaxSuccess(function() {
a()
})
});
(function() {
"use strict";
var e = "xD" + "UwN" + "zE" + "zY" + "j";
var r = $(".js-brightcove-video-player");
if (!r || r.length < 1) {
return
}
var t = false;
var a = false;
var n = false;
var o = $(document);
var i = function() {
return window.s
};
var s = function() {
var e = false;
var r = [6, 10, 15, 20, 24, 30, 44, 64, 66];
return function(t) {
if (true === e) {
return
}
var a = i(),
n, o, s;
if (undefined === a || !t) {
return
}
e = true;
var u = {
UMBEPARAMcc: "USD"
};
if (document.referrer) {
u.UMBEPARAMr = document.referrer
}
if (a.products) {
u.UMBEPARAMproducts = a.products
}
if (a.list3) {
u.UMBEPARAMl3 = a.list3
}
for (s = 0; s < r.length; s++) {
o = r[s];
n = a["eVar" + o];
if (n) {
u["UMBEPARAMv" + o] = n
}
}
u["UMBEPARAMv65"] = "Brightcove";
var f = t.metadataUri;
f += "?" + $.param(u);
t.metadataUri = f
}
}();
var u = function() {
var o = false;
var i = function(e) {
var r;
var t = {
start: {
fn: o
},
getPlayerInfo: {
fn: i
},
play: {
fn: s,
params: ["videoId"]
},
pause: {
fn: u,
params: ["videoId"]
},
resume: {
fn: f,
params: ["videoId"]
},
isPlaying: {
fn: d,
params: ["videoId"]
},
getCurrentTimeStamp: {
fn: c,
params: ["videoId"]
},
setCurrentTimeStamp: {
fn: p,
params: ["videoId", "timestamp"]
},
ended: {
fn: v,
async: true,
params: ["videoId", "wait"]
}
};
(function() {
r = e;
window.onmessage = a;
setInterval(function() {
if (window.onmessage != a) {
console.log("Awesome, some bad ad provider is stepping on window.onmessage. Its probably going to have a broken ad");
bindDispatch()
}
}, 1e3)
})();
function a(e) {
var r = e.data.request;
if (!r) {
return
}
if (!t.hasOwnProperty(r)) {
e.ports[0].postMessage({
msg: "error",
info: "unknown request"
});
return
}
var a = null;
function o(e) {
a = e
}
var i = [];
if (t[r].params) {
t[r].params.some(function(r) {
if (!e.data.hasOwnProperty(r)) {
a = "Missing param " + r;
return true
}
i.push(e.data[r])
})
}
if (t[r].async) {
i.push(n(e))
}
i.push(o);
var s = null;
if (!a) {
s = t[r].fn.apply(this, i)
}
if (!t[r].async || a) {
if (a) {
e.ports[0].postMessage({
result: "error",
data: a
})
} else {
e.ports[0].postMessage({
result: "ok",
data: s
})
}
}
}
function n(e) {
return function(r, t) {
if (t) {
e.ports[0].postMessage({
result: "error",
data: t
})
} else {
e.ports[0].postMessage({
result: "ok",
data: r
})
}
}
}
function o() {
var e = {
apiVersion: "0.01",
userLoggedIn: $("meta[name=userAuthState]").attr("content") == "loggedIn",
userIsPremium: $("meta[name=userIsPremium]").attr("content") == "premium",
edgework: "sucks"
};
return e
}
function i() {
var e = [];
var r = {
id: "not supported",
title: "not supported",
premium: "not supported"
};
e.push(r);
return e
}
function s(e, t) {
r.play()
}
function u(e, t) {
r.pause()
}
function f(e, t) {
r.play()
}
function d(e, t) {
return !r.paused()
}
function c(e, t) {
return r.currentTime()
}
function p(e, t, a) {
return r.currentTime(t)
}
function v(e, t, a, n) {
var o = r.ended();
if (t && !o) {
l(r, a, n)
} else {
a(o)
}
}
function l(e, r, t) {
var a = setInterval(function() {
if (e.ended()) {
clearInterval(a);
r()
}
}, 1e3)
}
};
return function() {
if (o || !t || !a) {
return
}
o = true;
var u = window.videojs;
if (undefined === u || "function" !== typeof u) {
return
}
var f = u("brightcovePlayer");
var d = r.data("onceux-options");
s(d);
f.errors({
errors: {
0: {
headline: "Adblock disables our video player!",
type: "Adblock",
message: "Recent changes to ad blocking software disables our video player. Please whitelist GameSpot in order to see this video."
}
}
});
f.on("error", function() {
$(".vjs-big-play-button").hide();
$.removeCookie(e, {
path: "/"
})
});
f.onceux(d);
f.poster(r.data("poster"));
f.controls(true);
if (true === n) {
f.autoplay(n)
}
i(f);
window.bcplayer = f
}
}();
var f = function() {
var e = false,
r = false,
t = [];
var n = function() {
if (false === r) {
t = [];
var e = $(".js-brightcove-src-url");
if (!e || e.length < 0) {
return false
}
e.each(function() {
var e = $(this).attr("content");
if ($.inArray(e, t) < 0) {
t.push(e)
}
});
r = true
}
};
var o = function() {
if (0 === t.length) {
e = true
}
if (true === e) {
a = true;
u();
return
}
var r = t.shift();
$.ajax({
url: r,
dataType: "script",
success: o,
error: function() {},
complete: function() {}
})
};
return function() {
n();
o()
}
}();
var d = ".loadBrightcove";
var c = "g" + "ui" + "l" + "t_" + "d" + "e" + "tec" + "ted";
var p = function() {
var e = "x" + "DU" + "wNz" + "Ez" + "Yj",
t = $.cookie(e),
i = true;
if (t === "1" || t === 1) {
i = false
}
if (i || true === a) {
return
}
o.off(d);
$(".js-video-player").remove();
r.removeClass("hide");
var s = $('<video id="brightcovePlayer"></video>');
s.attr(r.data("brightcove"));
if (s.attr("autoplay")) {
n = true;
s.removeAttr("autoplay")
}
r.append(s);
f()
};
o.on(["ready", c].join(d + " ") + d, p).one("tracking_initialized", function() {
t = true;
u()
})
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment