Created
January 27, 2014 22:40
-
-
Save miketaylr/8658799 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.Modernizr = function (t, u, v) { | |
function ad(J) { | |
C.cssText = J | |
} | |
function b(J, K) { | |
return ad(F.join(J + ";") + (K || "")) | |
} | |
function f(J, K) { | |
return typeof J === K | |
} | |
function h(J, K) { | |
return !!~("" + J).indexOf(K) | |
} | |
function j(L, M) { | |
for (var J in L) { | |
var K = L[J]; | |
if (!h(K, "-") && C[K] !== v) { | |
return M == "pfx" ? K : !0 | |
} | |
} | |
return !1 | |
} | |
function l(M, N, J) { | |
for (var K in M) { | |
var L = N[M[K]]; | |
if (L !== v) { | |
return J === !1 ? M[K] : f(L, "function") ? L.bind(J || N) : L | |
} | |
} | |
return !1 | |
} | |
function n(M, N, J) { | |
var K = M.charAt(0).toUpperCase() + M.slice(1), | |
L = (M + " " + H.join(K + " ") + K).split(" "); | |
return f(N, "string") || f(N, "undefined") ? j(L, N) : (L = (M + " " + I.join(K + " ") + K).split(" "), l(L, N, J)) | |
} | |
var w = "2.6.2", | |
x = {}, y = !0, | |
z = u.documentElement, | |
A = "modernizr", | |
B = u.createElement(A), | |
C = B.style, | |
D, E = {}.toString, | |
F = " -webkit- -moz- -o- -ms- ".split(" "), | |
G = "Webkit Moz O ms", | |
H = G.split(" "), | |
I = G.toLowerCase().split(" "), | |
a = { | |
svg: "http://www.w3.org/2000/svg" | |
}, c = {}, g = {}, i = {}, k = [], | |
m = k.slice, | |
o, p = function (Q, R, S, T) { | |
var J, K, L, M, N = u.createElement("div"), | |
O = u.body, | |
P = O || u.createElement("body"); | |
if (parseInt(S, 10)) { | |
while (S--) { | |
L = u.createElement("div"), L.id = T ? T[S] : A + (S + 1), N.appendChild(L) | |
} | |
} | |
return J = ["­", '<style id="s', A, '">', Q, "</style>"].join(""), N.id = A, (O ? N : P).innerHTML += J, P.appendChild(N), O || (P.style.background = "", P.style.overflow = "hidden", M = z.style.overflow, z.style.overflow = "hidden", z.appendChild(P)), K = R(N, Q), O ? N.parentNode.removeChild(N) : (P.parentNode.removeChild(P), z.style.overflow = M), !! K | |
}, r = function () { | |
function K(M, N) { | |
N = N || u.createElement(J[M] || "div"), M = "on" + M; | |
var L = M in N; | |
return L || (N.setAttribute || (N = u.createElement("div")), N.setAttribute && N.removeAttribute && (N.setAttribute(M, ""), L = f(N[M], "function"), f(N[M], "undefined") || (N[M] = v), N.removeAttribute(M))), N = null, L | |
} | |
var J = { | |
select: "input", | |
change: "input", | |
submit: "form", | |
reset: "form", | |
error: "img", | |
load: "img", | |
abort: "img" | |
}; | |
return K | |
}(), | |
s = {}.hasOwnProperty, | |
ac; | |
!f(s, "undefined") && !f(s.call, "undefined") ? ac = function (J, K) { | |
return s.call(J, K) | |
} : ac = function (J, K) { | |
return K in J && f(J.constructor.prototype[K], "undefined") | |
}, Function.prototype.bind || (Function.prototype.bind = function (J) { | |
var K = this; | |
if (typeof K != "function") { | |
throw new TypeError | |
} | |
var L = m.call(arguments, 1), | |
M = function () { | |
if (this instanceof M) { | |
var N = function () {}; | |
N.prototype = K.prototype; | |
var O = new N, | |
P = K.apply(O, L.concat(m.call(arguments))); | |
return Object(P) === P ? P : O | |
} | |
return K.apply(J, L.concat(m.call(arguments))) | |
}; | |
return M | |
}), c.flexbox = function () { | |
return n("flexWrap") | |
}, c.flexboxlegacy = function () { | |
return n("boxDirection") | |
}, c.touch = function () { | |
var J; | |
return "ontouchstart" in t || t.DocumentTouch && u instanceof DocumentTouch ? J = !0 : p(["@media (", F.join("touch-enabled),("), A, ")", "{#modernizr{top:9px;position:absolute}}"].join(""), function (K) { | |
J = K.offsetTop === 9 | |
}), J | |
}, c.postmessage = function () { | |
return !!t.postMessage | |
}, c.hashchange = function () { | |
return r("hashchange", t) && (u.documentMode === v || u.documentMode > 7) | |
}, c.rgba = function () { | |
return ad("background-color:rgba(150,255,150,.5)"), h(C.backgroundColor, "rgba") | |
}, c.borderradius = function () { | |
return n("borderRadius") | |
}, c.opacity = function () { | |
return b("opacity:.55"), /^0.55$/.test(C.opacity) | |
}, c.video = function () { | |
var J = u.createElement("video"), | |
K = !1; | |
try { | |
if (K = !! J.canPlayType) { | |
K = new Boolean(K), K.ogg = J.canPlayType('video/ogg; codecs="theora"').replace(/^no$/, ""), K.h264 = J.canPlayType('video/mp4; codecs="avc1.42E01E"').replace(/^no$/, ""), K.webm = J.canPlayType('video/webm; codecs="vp8, vorbis"').replace(/^no$/, "") | |
} | |
} catch (L) {} | |
return K | |
}, c.svg = function () { | |
return !!u.createElementNS && !! u.createElementNS(a.svg, "svg").createSVGRect | |
}; | |
for (var q in c) { | |
ac(c, q) && (o = q.toLowerCase(), x[o] = c[q](), k.push((x[o] ? "" : "no-") + o)) | |
} | |
return x.addTest = function (K, L) { | |
if (typeof K == "object") { | |
for (var J in K) { | |
ac(K, J) && x.addTest(J, K[J]) | |
} | |
} else { | |
K = K.toLowerCase(); | |
if (x[K] !== v) { | |
return x | |
} | |
L = typeof L == "function" ? L() : L, typeof y != "undefined" && y && (z.className += " " + (L ? "" : "no-") + K), x[K] = L | |
} | |
return x | |
}, ad(""), B = D = null, x._version = w, x._prefixes = F, x._domPrefixes = I, x._cssomPrefixes = H, x.hasEvent = r, x.testProp = function (J) { | |
return j([J]) | |
}, x.testAllProps = n, x.testStyles = p, x.prefixed = function (K, L, J) { | |
return L ? n(K, L, J) : n(K, "pfx") | |
}, z.className = z.className.replace(/(^|\s)no-js(\s|$)/, "$1$2") + (y ? " js " + k.join(" ") : ""), x | |
}(this, this.document); | |
(function () { | |
var b = navigator.userAgent; | |
Modernizr.addTest("sessionstorage", function () { | |
try { | |
if (sessionStorage.getItem) { | |
sessionStorage.getItem("test"); | |
return true | |
} | |
} catch (a) { | |
return false | |
} | |
}); | |
Modernizr.addTest("flash", function () { | |
if (b.match(/iPhone(?: Simulator)?;|iPod|iPad|WebOS|Blackberry|Symbian|Android|Bada/i)) { | |
return false | |
} | |
if (navigator.mimeTypes && navigator.mimeTypes.length && navigator.mimeTypes["application/x-shockwave-flash"]) { | |
return !!navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin | |
} else { | |
try { | |
return !!new ActiveXObject("ShockwaveFlash.ShockwaveFlash") | |
} catch (a) { | |
return false | |
} | |
} | |
}); | |
Modernizr.addTest("hls", function () { | |
if (b.match(/iPhone|iPod|iPad|Android 4/i)) { | |
return true | |
} | |
var a = document.createElement("video"); | |
try { | |
return a && a.canPlayType && !! a.canPlayType('application/x-mpegURL; codecs="avc1.42E01E, mp4a.40.2"') | |
} catch (f) { | |
return false | |
} | |
}); | |
Modernizr.addTest("video-inline", function () { | |
return !b.match(/iPhone(?: Simulator)?;|iPod|Android 2/) | |
}); | |
Modernizr.addTest("utf8-play", function () { | |
if (b.match(/Android/)) { | |
return false | |
} | |
return b.match(/Safari|MSIE|Firefox|Chrome/) | |
}); | |
Modernizr.addTest("mobile", function () { | |
return window.innerWidth < (500 * (window.devicePixelRatio || 1)) && (Modernizr.touch || b.match(/Blackberry|Symbian/)) | |
}); | |
Modernizr.addTest("tablet", function () { | |
return Modernizr.touch && window.innerWidth > (500 * (window.devicePixelRatio || 1)) | |
}); | |
Modernizr.addTest("ios", function () { | |
return b.match(/iPhone(?: Simulator)?;|iPod|iPad;/) | |
}); | |
Modernizr.addTest("ipad", function () { | |
return b.match(/iPad/) | |
}); | |
Modernizr.addTest("iphone", function () { | |
return b.match(/iPhone(?: Simulator)?;|iPod/) | |
}); | |
Modernizr.addTest("chrome", function () { | |
return b.match(/Chrome/) | |
}); | |
Modernizr.addTest("firefox", function () { | |
return b.match(/Firefox/) | |
}); | |
Modernizr.addTest("android", function () { | |
return b.match(/Android/) | |
}); | |
Modernizr.addTest("androidMobile", function () { | |
return b.match(/Android.*Mobile Safari/) | |
}); | |
Modernizr.addTest("ua_mobile", function () { | |
return b.match(/iPhone|iPod|CFNetwork|Android.*Mobile Safari|Windows Phone|IEMobile\/(?:9|1\d)|tizen|(Blackberry|BB10|BBOS; Touch).*Version\/10|Android; Mobile;.*Firefox|Mozilla\/\S+ \(Mobile;/i) | |
}); | |
Modernizr.addTest("ua_tablet", function () { | |
return b.match(/iPad|Tablet|B?G[TP]-P\d+|Droidx|Xoom|playbook|kindle|(SCH|SPH|SCS|SHW|SGH)-\w+|a\d{3}|dell streak|hp-tablet|Touchpad|Slider|Transformer( Prime)?|silk|Android; Tablet;.*Firefox/i) | |
}); | |
Modernizr.addTest("ua_desktop", function () { | |
return b.match(/Mac OS|Macintosh|Safari|Windows|Microsoft/i) | |
}); | |
Modernizr.addTest("ua_tv", function () { | |
return b.match(/AppleTV|GoogleTV|Opera.*Presto|Opera.*TV|SMART.TV/i) | |
}); | |
Modernizr.addTest("ua_bot", function () { | |
return b.match(/spider|crawl|slurp|bot/) | |
}); | |
Modernizr.addTest("ua_windowsphone", function () { | |
return b.match(/Windows Phone(?: OS)? [1-7]/i) | |
}); | |
Modernizr.addTest("ua_windows8", function () { | |
return b.match(/Windows Phone(?: OS)? 8/i) | |
}); | |
Modernizr.addTest("ua_blackberry", function () { | |
return b.match(/Blackberry/) | |
}); | |
Modernizr.addTest("ua_google_preview_bot", function () { | |
return (/Google Web Preview/).test(b) | |
}); | |
if (!Function.prototype.bind) { | |
Function.prototype.bind = function (i) { | |
if (typeof this !== "function") { | |
throw new TypeError("Bind must be called on a function") | |
} | |
var j = [].slice, | |
l = j.call(arguments, 1), | |
a = this, | |
k = function () { | |
return a.apply(this instanceof h ? this : (i || {}), l.concat(j.call(arguments))) | |
}; | |
function h() {} | |
h.prototype = a.prototype; | |
k.prototype = new h(); | |
return k | |
} | |
} | |
})(); | |
(function () { | |
var a = [].slice; | |
(function (f) { | |
var c, b; | |
c = f.DM || {}; | |
c.events = {}; | |
c.Events = (function () { | |
function g() {} | |
g.prototype.on = function (h, i) { | |
if (!this.listeners) { | |
this.listeners = {} | |
} | |
if (!this.listeners[h]) { | |
this.listeners[h] = [] | |
} | |
this.listeners[h].push(i); | |
return this | |
}; | |
g.prototype.off = function (h) { | |
return this.listeners[h] = [] | |
}; | |
g.prototype.trigger = function () { | |
var l, i, k, n, j, m, h; | |
k = arguments[0], l = 2 <= arguments.length ? a.call(arguments, 1) : []; | |
if (!((m = this.listeners) != null ? m[k] : void 0)) { | |
return | |
} | |
h = this.listeners[k]; | |
for (n = 0, j = h.length; n < j; n++) { | |
i = h[n]; | |
if (i.apply(null, l) === false) { | |
return | |
} | |
} | |
}; | |
return g | |
})(); | |
c.observer = new c.Events; | |
b = {}; | |
c.config = function (g, h) { | |
if (h == null) { | |
return b[g] || null | |
} else { | |
return b[g] = h | |
} | |
}; | |
c.View = (function () { | |
function g() {} | |
g.prototype._compile = function (k, n) { | |
var o, m, h, j, l, i; | |
j = k; | |
if (!(h = k.match(/{{([^}]*)}}/g))) { | |
return j | |
} | |
for (l = 0, i = h.length; l < i; l++) { | |
m = h[l]; | |
j = j.replace(m, (o = n[m.slice(2, -2)]) ? o : "") | |
} | |
return j | |
}; | |
g.prototype._createElement = function (h, i) { | |
var j; | |
if (i == null) { | |
i = {} | |
} | |
j = document.createElement("div"); | |
j.innerHTML = this._compile(h, i); | |
return j.firstChild | |
}; | |
g.prototype._empty = function (i) { | |
var j, h; | |
h = []; | |
while (j = i.firstChild) { | |
h.push(i.removeChild(j)) | |
} | |
return h | |
}; | |
return g | |
})(); | |
c.plugin = function (h, s, l) { | |
var q, o, k, i, j, m, p, g, n, r; | |
if (!s) { | |
return l && l() | |
} | |
m = c.config("plugins"); | |
if (m == null) { | |
console.error("plugins are not defined"); | |
return | |
} | |
j = m != null ? m[h] : void 0; | |
if (j == null) { | |
console.error("Unknown plugin: " + h); | |
return | |
} | |
if (j === true) { | |
return l && l() | |
} | |
if (typeof j === "string") { | |
j = [j] | |
} | |
p = []; | |
i = /^.*\.js(:?\.v[0-9a-f]+)?$/; | |
o = /^.*\.css(:?\.v[0-9a-f]+)?$/; | |
for (n = 0, r = j.length; n < r; n++) { | |
g = j[n]; | |
if (i.test(g)) { | |
k = $.ajax({ | |
url: g, | |
cache: true, | |
context: this, | |
dataType: "script" | |
}); | |
p.push(k) | |
} else { | |
if (o.test(g)) { | |
q = document.createElement("link"); | |
q.rel = "stylesheet"; | |
q.href = g; | |
document.head.appendChild(q) | |
} | |
} | |
} | |
return $.when(p).then(function () { | |
m[h] = true; | |
c.config("plugins", m); | |
l && l() | |
}) | |
}; | |
c.extend = function () { | |
var h, g, l, m, k, j; | |
for (h = k = 1, j = arguments.length; 1 <= j ? k <= j : k >= j; h = 1 <= j ? ++k : --k) { | |
l = arguments[h]; | |
for (g in l) { | |
m = l[g]; | |
if (l.hasOwnProperty(g)) { | |
arguments[0][g] = m | |
} | |
} | |
} | |
return arguments[0] | |
}; | |
c.external = !/^https?:\/\/([^\/]+)?\.dailymotion\.[a-z]{2,}/.test(document.referrer); | |
return f.DM = c | |
})(window) | |
}).call(this); | |
(function () { | |
var a = {}.hasOwnProperty, | |
b = function (i, g) { | |
for (var f in g) { | |
if (a.call(g, f)) { | |
i[f] = g[f] | |
} | |
} | |
function h() { | |
this.constructor = i | |
} | |
h.prototype = g.prototype; | |
i.prototype = new h(); | |
i.__super__ = g.prototype; | |
return i | |
}, c = [].slice; | |
(function (i) { | |
var g, h, f, j; | |
h = i.DM || {}; | |
h.utils = h.utils || {}; | |
h.logger = (function () { | |
var p, m, k, l, o; | |
o = function () {}; | |
if (!("console" in window)) { | |
window.console = {} | |
} | |
if (!("log" in console)) { | |
window.console.log = o | |
} | |
if (!("warn" in console)) { | |
window.console.warn = o | |
} | |
if (!("error" in console)) { | |
window.console.error = o | |
} | |
if (!("group" in console)) { | |
window.console.group = o | |
} | |
if (!("groupCollapsed" in console)) { | |
window.console.groupCollapsed = o | |
} | |
if (!("groupEnd" in console)) { | |
window.console.groupEnd = o | |
} | |
p = { | |
log: o, | |
warn: o, | |
error: o, | |
group: o, | |
groupCollapsed: o, | |
groupEnd: o | |
}; | |
if ((ENV === "dev" && document.referrer === "") || window.location.search.indexOf("logger=1") !== -1) { | |
p = window.console | |
} | |
k = function (q, t) { | |
var u, r; | |
if (t == null) { | |
t = "" | |
} | |
u = "%c[" + q + "]"; | |
r = t; | |
if (!Function.prototype.bind) { | |
return p | |
} | |
return { | |
log: q ? p.log.bind(p, u, r) : p.log.bind(p), | |
warn: q ? p.warn.bind(p, u, r) : p.warn.bind(p), | |
error: q ? p.error.bind(p, u, r) : p.error.bind(p), | |
group: q ? p.group.bind(p, u, r) : p.group.bind(p), | |
groupCollapsed: q ? p.groupCollapsed.bind(p, u, r) : p.groupCollapsed.bind(p), | |
groupEnd: q ? p.groupEnd.bind(p, u, r) : p.groupEnd.bind(p) | |
} | |
}; | |
try { | |
k().log() | |
} catch (n) { | |
m = n; | |
k = function () { | |
return p | |
} | |
} | |
l = k(); | |
l.getLogger = k; | |
return l | |
})(); | |
f = (function () { | |
function k(r, o, m, l, q, n, p) { | |
this.protocol = r; | |
this.host = o; | |
this.hostname = m; | |
this.port = l; | |
this.pathname = q != null ? q : ""; | |
this.search = n != null ? n : ""; | |
this.hash = p != null ? p : ""; | |
this.href = r ? this.protocol + "//" + this.host + this.pathname + this.search + this.hash : o ? "//" + this.host + this.pathname + this.search + this.hash : this.pathname + this.search + this.hash | |
} | |
k.prototype.params = function (l) { | |
if (this._params == null) { | |
this._params = k.parseQueryString(this.search) | |
} | |
if (l) { | |
if (this._params[l]) { | |
return this._params[l][0] | |
} else { | |
return null | |
} | |
} else { | |
return this._params | |
} | |
}; | |
k.regexp = /^(?:(https?:)\/\/(([^:\/]+)(:[^\/]+)?))?([^#?]*)(\\?[^#]*)?(#.*)?$/; | |
k.parse = function (m) { | |
var l; | |
if (l = m.match(this.regexp)) { | |
return (function (q, o, p) { | |
p.prototype = q.prototype; | |
var r = new p, | |
n = q.apply(r, o); | |
return Object(n) === n ? n : r | |
})(k, l.slice(1), function () {}) | |
} else { | |
return null | |
} | |
}; | |
k.parseQueryString = function (s) { | |
var m, r, o, q, p, n, l; | |
q = {}; | |
if (s === "") { | |
return q | |
} | |
o = s.substring(1).split(/[;&]/); | |
for (n = 0, l = o.length; n < l; n++) { | |
r = o[n]; | |
r = r.split("="); | |
m = decodeURIComponent(r[0]); | |
p = decodeURIComponent(r[1]); | |
if (!q[m]) { | |
q[m] = [] | |
} | |
q[m].push(p) | |
} | |
return q | |
}; | |
return k | |
})(); | |
h.utils.Location = f; | |
g = (function (l) { | |
b(k, l); | |
function k() { | |
j = k.__super__.constructor.apply(this, arguments); | |
return j | |
} | |
k.prototype.params = function (n) { | |
var m; | |
m = function (w, t) { | |
var v, r, o, q, p, s, u; | |
if (t == null) { | |
t = /[&]/ | |
} | |
q = {}; | |
o = w.split(t); | |
for (s = 0, u = o.length; s < u; s++) { | |
r = o[s]; | |
r = r.split("="); | |
v = decodeURIComponent(r[0]); | |
if (r.length <= 2) { | |
p = decodeURIComponent(r[1]) | |
} else { | |
p = m(r.slice(1).join("="), /[;]/) | |
} if (!q[v]) { | |
q[v] = [] | |
} | |
q[v].push(p) | |
} | |
return q | |
}; | |
if (!this._params) { | |
return this._params = m(this.search.substring(1)) | |
} else { | |
return k.__super__.params.call(this, n) | |
} | |
}; | |
k.parse = function (n) { | |
var m; | |
if (m = n.match(this.regexp)) { | |
return (function (r, p, q) { | |
q.prototype = r.prototype; | |
var s = new q, | |
o = r.apply(s, p); | |
return Object(o) === o ? o : s | |
})(k, m.slice(1), function () {}) | |
} else { | |
return null | |
} | |
}; | |
return k | |
})(f); | |
h.utils.AuditudeLocation = g; | |
h.utils.CDNResolver = (function () { | |
var l, k; | |
k = {}; | |
l = h.logger.getLogger("CDNResolver", "color: green; font-weight: bold; font-size: 1.1em;"); | |
return { | |
clear: function () { | |
return k = {} | |
}, | |
resolve: function (m) { | |
var n; | |
if (!(m in k)) { | |
k[m] = { | |
deferred: n = $.Deferred(), | |
promise: n.promise() | |
}; | |
k[m].promise.resolved = function (o) { | |
n.onResolved = o; | |
return this | |
}; | |
k[m].deferred.customResolve = function () { | |
var o; | |
o = 1 <= arguments.length ? c.call(arguments, 0) : []; | |
l.log("Resolved URL to", o[0]); | |
if (n.onResolved) { | |
n.onResolved.apply(k[m].promise, o) | |
} | |
return n.resolve.apply(n, o) | |
}; | |
l.log("Resolving URL", m); | |
$.get(m).done(k[m].deferred.customResolve).fail(function () { | |
var p, o; | |
p = 1 <= arguments.length ? c.call(arguments, 0) : []; | |
l.error("failed to resolve URL :", p); | |
return (o = k[m].deferred).reject.apply(o, p) | |
}) | |
} | |
return k[m].promise | |
} | |
} | |
})(); | |
h.utils.extend = h.extend; | |
return i.DM = h | |
})(window) | |
}).call(this); | |
(function () { | |
var a = {}.hasOwnProperty, | |
b = function (h, f) { | |
for (var c in f) { | |
if (a.call(f, c)) { | |
h[c] = f[c] | |
} | |
} | |
function g() { | |
this.constructor = h | |
} | |
g.prototype = f.prototype; | |
h.prototype = new g(); | |
h.__super__ = f.prototype; | |
return h | |
}; | |
(function (h) { | |
var f, g, c; | |
f = h.DM || {}; | |
f.models = f.models || {}; | |
c = null; | |
g = (function (j) { | |
b(i, j); | |
function i() { | |
this.video = { | |
id: null | |
} | |
} | |
i.prototype.setVideo = function (k) { | |
if (c === null) { | |
c = f.logger.getLogger("VideoModel", "color: blue; font-weight: bold;") | |
} | |
if ((k.id != null) && k.id !== this.video.id) { | |
this.video = k; | |
c.groupCollapsed("defined video object"); | |
c.log("video:", this.video); | |
this.trigger("change", this.video); | |
c.groupEnd(); | |
return true | |
} | |
return false | |
}; | |
return i | |
})(f.Events); | |
f.models.videoModel = new g; | |
return h.DM = f | |
})(window) | |
}).call(this); | |
(function () { | |
(function (b) { | |
var a, f, c; | |
a = b.DM || {}; | |
f = null; | |
c = { | |
init: function () { | |
f = a.config("labels"); | |
if (f == null) { | |
return console.warn("Player labels definition is missing!!") | |
} | |
}, | |
get: function (g) { | |
if (f.hasOwnProperty(g)) { | |
return f[g] | |
} | |
} | |
}; | |
a.playerLabels = c; | |
return b.DM = a | |
})(window) | |
}).call(this); | |
(function () { | |
(function (a) { | |
var l, f, j, g, i, h, b, k, c; | |
l = a.DM || {}; | |
b = Modernizr; | |
k = null; | |
g = { | |
start: null, | |
api: false, | |
id: null, | |
network: "dsl", | |
startscreen: "html", | |
controls: "html", | |
fullscreen: "auto", | |
info: true, | |
related: true, | |
reporting: true, | |
logo: true | |
}; | |
i = { | |
wmode: "transparent", | |
isInIframe: 1 | |
}; | |
f = ["info", "html", "playsinline", "fullscreen", "startuploaderonly", "quality", "hls", "hls_default_quality", "whitemark", "is_secure"]; | |
h = function () { | |
return !k.html && b.flash | |
}; | |
j = function (n, m) { | |
if (m == null) { | |
m = false | |
} | |
if (n == null) { | |
return m | |
} | |
if (!n || n === "0") { | |
return false | |
} | |
if (typeof n === "string" && n.match(/^(?:false|no|off|nil)$/i)) { | |
return false | |
} | |
return true | |
}; | |
c = { | |
init: function () { | |
var r, o, m, p, n, q; | |
m = l.utils.Location.parseQueryString(window.location.search); | |
for (o in m) { | |
n = m[o]; | |
if (m.hasOwnProperty(o)) { | |
m[o] = n[0] | |
} | |
} | |
r = l.config("options"); | |
k = l.extend({}, g, r, m); | |
if (["postMessage", "xdcom", "fragment", "location"].indexOf(k.api) === -1) { | |
k.api = g.api | |
} | |
k.autoplay = j(k.autoplay, j(k.autoPlay, g.autoplay)); | |
k.info = j(k.info, !j(k.hideInfos, g.info)); | |
k.html = j(k.html, g.html); | |
k.reporting = j(k.reporting, g.reporting); | |
k.startscreen = (function () { | |
switch (k.startscreen) { | |
case "flash": | |
return "flash"; | |
case "html": | |
case "auto": | |
return "html"; | |
default: | |
console.warn("Unsupported startscreen mode: " + k.startscreen + ". Fallback to '" + g.startscreen + "'"); | |
return g.startscreen | |
} | |
})(); | |
k.controls = (function () { | |
switch (k.controls) { | |
case "none": | |
case "0": | |
case 0: | |
return "none"; | |
case "flash": | |
return "flash"; | |
case "native": | |
return "native"; | |
case "html": | |
case "auto": | |
return "html"; | |
default: | |
console.warn("Unsupported controls mode: " + k.controls + ". Fallback to '" + g.controls + "'"); | |
return g.controls | |
} | |
})(); | |
k.playsinline = j(k.playsinline, j(k["webkit-playsinline"], g.playsinline)); | |
k.fullscreen = j(k.fullscreen, g.fullscreen); | |
k.related = j(k.related, g.related); | |
k.hls = j(k.hls, g.hls); | |
k.gifloader = j(k.gifloader, g.gifloader); | |
g.quality = k.networks === "cellular" ? 240 : 380; | |
p = parseInt(k.quality, 10); | |
if (p && [240, 380, 480, 720, 1080].indexOf(p) !== -1) { | |
k.quality = p | |
} else { | |
k.quality = g.quality | |
} | |
k.hls_default_quality = parseInt(k.hls_default_quality, 10); | |
k.whitemark = j(k.whitemark, g.whitemark); | |
k.chromeless = j(k.chromeless, g.chromeless); | |
k.logo = j(k.logo, g.logo); | |
k.referer = k.webapp_referer || k.referer || null; | |
k.is_secure = j(k.is_secure, g.is_secure); | |
if (k.autoplay && (b.mobile || b.tablet)) { | |
k.autoplay = false; | |
k.chromeless = (k.api !== false) && k.chromeless | |
} | |
k.startuploaderonly = j(b.android && !b.chrome); | |
if (h()) { | |
if (!b.opacity || !b.rgba || !b.borderradius) { | |
k.startscreen = "flash" | |
} | |
if ("animatedTitle" in k || "skin" in k) { | |
k.startscreen = "flash" | |
} | |
k.controls = "flash" | |
} else { | |
if (k.startscreen === "flash") { | |
k.startscreen = "html" | |
} | |
if (k.controls === "flash") { | |
k.controls = "html" | |
} | |
} | |
q = l.models.videoModel; | |
if (q.video.audience_url && !k.api) { | |
k.api = true | |
} | |
q.on("change", function (s) { | |
if (s.audience_url && !k.api) { | |
return k.api = true | |
} | |
}); | |
return this | |
}, | |
get: function (m) { | |
if (k.hasOwnProperty(m)) { | |
return k[m] | |
} | |
}, | |
statsEnabled: function () { | |
return ("DM_Stats" in window) && k.reporting && !h() | |
}, | |
flashRequired: function () { | |
var n, o, m; | |
o = l.playerLabels; | |
n = o.get("flash_warning"); | |
if (!b.flash && !(b.video || b.video.h264) && screen.width >= 800 && n && !b.ua_google_preview_bot) { | |
return { | |
partner_player: false, | |
title: n[0], | |
message: n[1] | |
} | |
} else { | |
if (k.is_partner_player && !b.flash) { | |
m = o.get("partner_player_warning"); | |
return { | |
partner_player: true, | |
title: m[0], | |
message: m[1] | |
} | |
} else { | |
return false | |
} | |
} | |
}, | |
flashPlayer: function () { | |
return h() | |
}, | |
htmlPlayer: function () { | |
return !h() | |
}, | |
flashControls: function () { | |
return k.controls === "flash" | |
}, | |
htmlControls: function () { | |
return k.controls === "html" | |
}, | |
nativeControls: function () { | |
return k.controls === "native" | |
}, | |
noControls: function () { | |
return k.controls === "none" | |
}, | |
flashStartscreen: function () { | |
return k.startscreen === "flash" | |
}, | |
htmlStartscreen: function () { | |
return k.startscreen === "html" | |
}, | |
exportFlashPlayerOptions: function () { | |
var p, o, n, m; | |
o = l.extend({}, i, k); | |
if (["opaque", "transparent", "direct", "window"].indexOf(o.wmode) === -1) { | |
o.wmode = i.wmode | |
} | |
o.forcedQuality = (function () { | |
switch (o.quality) { | |
case 240: | |
return "ld"; | |
case 480: | |
return "hq"; | |
case 720: | |
return "hd720"; | |
case 1080: | |
return "hd1080"; | |
default: | |
return "sd" | |
} | |
})(); | |
o.autoplay = o.autoplay ? 1 : 0; | |
o.hideInfos = o.info ? 0 : 1; | |
o.related = o.related ? 1 : 0; | |
o.chromeless = o.chromeless ? 1 : 0; | |
o.reporting = o.reporting ? 1 : 0; | |
o.enableApi = o.api ? 1 : 0; | |
o.logo = o.logo ? 1 : 0; | |
o.isInIframe = i.isInIframe; | |
o.metaAutoplay = o.autoplay; | |
if (o.startscreen !== "flash") { | |
o.autoplay = 1 | |
} | |
if (document.referrer) { | |
o.referer = o.parentURL = document.referrer | |
} | |
o.enableApi = 1; | |
for (n = 0, m = f.length; n < m; n++) { | |
p = f[n]; | |
if (typeof o[p] !== "undefined") { | |
delete o[p] | |
} | |
} | |
return o | |
} | |
}; | |
l.playerOptions = c; | |
return a.DM = l | |
})(window) | |
}).call(this); | |
(function () { | |
(function (b) { | |
var a; | |
a = b.DM || {}; | |
a.templates = a.templates || {}; | |
a.templates.ads = { | |
root: '<div class="ad-ui">\n <div class="ad-target-clicksurface"></div>\n <div class="ad-countdown">\n <span class="ad-countdown-text"></span>\n </div>\n</div>', | |
closeBtn: '<div class="ad-close-button">\n <span class="countdown">{{time}}</span>\n <span class="cross">×</span>\n</div>' | |
}; | |
return b.DM = a | |
})(window) | |
}).call(this); | |
(function () { | |
(function (b) { | |
var a; | |
a = b.DM || {}; | |
a.templates = a.templates || {}; | |
a.templates.social = { | |
button: "<a target=\"_blank\" href=\"{{link}}\" class='btn smooth-hover btn-icon btn-squared {{btnType}}' rel='external'> <i class='icon icon-{{className}}'></i> <span>{{label}}</span></a>" | |
}; | |
return b.DM = a | |
})(window) | |
}).call(this); | |
(function () { | |
var a = {}.hasOwnProperty, | |
b = function (h, f) { | |
for (var c in f) { | |
if (a.call(f, c)) { | |
h[c] = f[c] | |
} | |
} | |
function g() { | |
this.constructor = h | |
} | |
g.prototype = f.prototype; | |
h.prototype = new g(); | |
h.__super__ = f.prototype; | |
return h | |
}; | |
(function (f) { | |
var c, g; | |
c = f.DM || {}; | |
c.social = c.social || {}; | |
c.models = c.models || {}; | |
g = c.models.videoModel; | |
c.models.SocialLinksModel = (function (h) { | |
var k, j, i; | |
b(l, h); | |
j = { | |
facebookURL: { | |
label: "Facebook", | |
className: "facebook" | |
}, | |
twitterURL: { | |
label: "Twitter", | |
className: "twitter" | |
}, | |
vkURL: { | |
label: "Vkontakte", | |
className: "vk" | |
}, | |
naszaklasaURL: { | |
label: "Nk", | |
className: "nk" | |
}, | |
zingmeURL: { | |
label: "Zing", | |
className: "zing" | |
} | |
}; | |
k = "facebookURL"; | |
i = function (o) { | |
var p, n, q, m; | |
m = function (r) { | |
return c.utils.extend({ | |
link: o[r] | |
}, j[r]) | |
}; | |
p = false; | |
n = {}; | |
for (q in o) { | |
if (!o.hasOwnProperty(q)) { | |
continue | |
} | |
if (q === k) { | |
p = true; | |
continue | |
} | |
n[q] = m(q) | |
} | |
if (p) { | |
n[k] = m(k) | |
} | |
return n | |
}; | |
function l() { | |
var m, n = this; | |
if (!m) { | |
m = c.social.logger | |
} | |
this.sharingURLs = i(g.video.sharing_urls); | |
g.on("change", function (o) { | |
n.sharingURLs = i(o.sharing_urls, n.params); | |
m.log("[SocialLinksModel] videoModel changed:", n.sharingURLs); | |
return n.trigger("change", n.sharingURLs) | |
}); | |
m.log("[SocialLinksModel] constructor:", this.sharingURLs) | |
} | |
return l | |
})(c.Events); | |
return f.DM = c | |
})(window) | |
}).call(this); | |
(function () { | |
var a = {}.hasOwnProperty, | |
b = function (h, f) { | |
for (var c in f) { | |
if (a.call(f, c)) { | |
h[c] = f[c] | |
} | |
} | |
function g() { | |
this.constructor = h | |
} | |
g.prototype = f.prototype; | |
h.prototype = new g(); | |
h.__super__ = f.prototype; | |
return h | |
}; | |
(function (h) { | |
var f, g, c; | |
f = h.DM || {}; | |
f.models = f.models || {}; | |
c = null; | |
g = f.events.ads; | |
f.models.AdsUIModel = (function (i) { | |
b(j, i); | |
j.prototype.adDuration = 15; | |
j.prototype.countdown = -1; | |
function j() { | |
if (!c) { | |
c = f.ads.logger | |
} | |
c.log("[AdsUIModel] constructor") | |
} | |
j.prototype.set = function (p) { | |
var o, l, n, k, m; | |
o = false; | |
m = ["adDuration", "adCurrentTime", "adCountdown", "skipCountdown"]; | |
for (n = 0, k = m.length; n < k; n++) { | |
l = m[n]; | |
if ((p[l] != null) && (l === "adCountdown" || l === "skipCountdown")) { | |
p[l] = p[l] | 0 | |
} | |
if ((p[l] != null) && p[l] !== this[l]) { | |
this[l] = p[l]; | |
o = true | |
} | |
} | |
if (o) { | |
return this.trigger("change") | |
} | |
}; | |
return j | |
})(f.Events); | |
return h.DM = f | |
})(window) | |
}).call(this); | |
(function () { | |
var a = {}.hasOwnProperty, | |
b = function (h, f) { | |
for (var c in f) { | |
if (a.call(f, c)) { | |
h[c] = f[c] | |
} | |
} | |
function g() { | |
this.constructor = h | |
} | |
g.prototype = f.prototype; | |
h.prototype = new g(); | |
h.__super__ = f.prototype; | |
return h | |
}; | |
(function (g) { | |
var f, c; | |
f = g.DM || {}; | |
f.social = f.social || {}; | |
f.views = f.views || {}; | |
c = null; | |
f.views.SocialButtonsView = (function (j) { | |
var h; | |
b(i, j); | |
h = f.templates.social.button; | |
function i(l, k, m) { | |
var n = this; | |
this.model = l; | |
this.rootNode = k; | |
this.params = m != null ? m : {}; | |
if (!c) { | |
c = f.social.logger | |
} | |
c.log("[SocialButtonsView] constructor:", this); | |
this.btns = []; | |
this.render(); | |
this.model.on("change", function (o) { | |
return n.render() | |
}) | |
} | |
i.prototype.render = function () { | |
var m, l, t, n, p, s, q, o, r = this; | |
c.log("[SocialButtonsView] render", this.rootNode); | |
q = this.btns; | |
for (p = 0, s = q.length; p < s; p++) { | |
m = q[p]; | |
this.rootNode.removeChild(m) | |
} | |
this.btns = []; | |
o = this.model.sharingURLs; | |
for (n in o) { | |
t = o[n]; | |
l = f.utils.extend({ | |
btnType: this.params.smallIcons ? "btn-small" : "" | |
}, t); | |
m = this._createElement(h, l); | |
$(m).on("click", function (k) { | |
k.stopPropagation(); | |
f.observer.trigger(f.events.social.BTN_CLICK, t) | |
}); | |
this.btns.push(m); | |
this.rootNode.appendChild(m) | |
} | |
return this | |
}; | |
return i | |
})(f.View); | |
return g.DM = f | |
})(window) | |
}).call(this); | |
(function () { | |
var a = {}.hasOwnProperty, | |
b = function (h, f) { | |
for (var c in f) { | |
if (a.call(f, c)) { | |
h[c] = f[c] | |
} | |
} | |
function g() { | |
this.constructor = h | |
} | |
g.prototype = f.prototype; | |
h.prototype = new g(); | |
h.__super__ = f.prototype; | |
return h | |
}; | |
(function (j) { | |
var k, h, f, g, i, c; | |
f = j.DM || {}; | |
f.views = f.views || {}; | |
c = null; | |
g = null; | |
i = null; | |
f.views.AdsUIView = (function (n) { | |
var m; | |
b(l, n); | |
m = f.templates.ads.root; | |
l.prototype.container = null; | |
function l(p, o) { | |
var q = this; | |
this.model = p; | |
this.rootNode = o; | |
if (!c) { | |
c = f.ads.logger | |
} | |
g = f.events.ads; | |
i = f.playerLabels.get("ads")["video-countdown"]; | |
c.log("[AdsUIView] constructor:", this); | |
this.cdResolver = new h; | |
this.model.on("change", function (r) { | |
return q.update() | |
}); | |
this.render() | |
} | |
l.prototype.update = function () { | |
var o = this; | |
this.cdResolver.countdown = this.model.adCountdown; | |
this.cdResolver.resolveCountDown(function () { | |
if ((o.model.adCountdown | 0) === 0) { | |
return o.countdownLabel.style.display = "none" | |
} else { | |
o.countdownLabel.style.display = "inline-block"; | |
return o.countdownLabel.textContent = i.replace("%d", o.model.adCountdown | 0) | |
} | |
}) | |
}; | |
l.prototype.render = function () { | |
var o = this; | |
if (this.container !== null) { | |
return | |
} | |
c.log("[AdsUIView] render"); | |
this.container = this._createElement(m); | |
this.closeBtn = new k(this.model, this.container); | |
this.clickSurface = $(this.container.querySelector(".ad-target-clicksurface")); | |
this.clickSurface.on("click touchend", function (p) { | |
c.log("Sending " + g.AD_UI_CLICK + " event"); | |
f.observer.trigger(g.AD_UI_CLICK); | |
return false | |
}); | |
this.countdownLabel = this.container.querySelector(".ad-countdown-text"); | |
this.update(); | |
this.rootNode.appendChild(this.container); | |
return this | |
}; | |
l.prototype.destroy = function () { | |
this.clickSurface.off("click touchend"); | |
this.closeBtn.destroy(); | |
this.rootNode.removeChild(this.container) | |
}; | |
return l | |
})(f.View); | |
h = (function () { | |
function l() {} | |
l.prototype.countdown = 15; | |
l.prototype.countdownDone = false; | |
l.prototype.resolveCountDown = function (m) { | |
if (this.countdownDone === true || this.countdown === -1) { | |
return | |
} | |
if (this.countdown === 0) { | |
this.countdownDone = true | |
} | |
if (this.countdown === 0 || this.countdown > 1) { | |
m() | |
} else { | |
setTimeout(m, this.countdown) | |
} | |
}; | |
return l | |
})(); | |
k = (function (m) { | |
var l; | |
b(n, m); | |
l = f.templates.ads.closeBtn; | |
n.prototype.el = null; | |
function n(p, o) { | |
var q = this; | |
this.model = p; | |
this.rootNode = o; | |
c.log("[CloseBtnView] constructor:", this); | |
this.cdResolver = new h; | |
this.render(); | |
this.model.on("change", function () { | |
return q.update() | |
}) | |
} | |
n.prototype.update = function () { | |
var o = this; | |
this.cdResolver.countdown = this.model.skipCountdown; | |
this.cdResolver.resolveCountDown(function () { | |
if (o.model.skipCountdown === 0) { | |
o.countdownNode.style.display = "none"; | |
o.crossNode.style.display = "block"; | |
return $(o.el).on("click touchend", function (p) { | |
c.log("Sending " + g.AD_UI_SKIP + " event"); | |
f.observer.trigger(g.AD_UI_SKIP); | |
return false | |
}) | |
} else { | |
if (typeof o.model.skipCountdown === "number") { | |
o.countdownNode.style.display = "block"; | |
o.crossNode.style.display = "none"; | |
return o.countdownNode.textContent = o.model.skipCountdown | |
} else { | |
o.countdownNode.style.display = "none"; | |
return o.crossNode.style.display = "none" | |
} | |
} | |
}) | |
}; | |
n.prototype.render = function () { | |
if (this.el !== null) { | |
return | |
} | |
c.log("[CloseBtnView] render"); | |
this.el = this._createElement(l, { | |
time: this.model.skipCountdown | |
}); | |
this.countdownNode = this.el.querySelector(".countdown"); | |
this.crossNode = this.el.querySelector(".cross"); | |
this.rootNode.appendChild(this.el); | |
this.update(); | |
return this | |
}; | |
n.prototype.destroy = function () { | |
$(this.el).off("click touchend"); | |
return this.rootNode.removeChild(this.el) | |
}; | |
return n | |
})(f.View); | |
return j.DM = f | |
})(window) | |
}).call(this); | |
(function () { | |
(function (f) { | |
var g, b, c, a; | |
b = f.DM || {}; | |
b.social = b.social || {}; | |
b.controllers = b.controllers || {}; | |
b.social.logger = b.logger.getLogger("social", "color: orange; font-weight: bold;"); | |
b.events.social = { | |
BTN_CLICK: "DM.social.BTN_CLICK" | |
}; | |
a = b.social.logger; | |
c = b.models.SocialLinksModel; | |
g = b.views.SocialButtonsView; | |
b.controllers.SocialButtons = (function () { | |
function h(i, k) { | |
var j; | |
a.groupCollapsed("SocialButtons constructor:", this); | |
this.socialLinksModel = new c; | |
j = new g(this.socialLinksModel, i, k); | |
a.groupEnd() | |
} | |
return h | |
})(); | |
return f.DM = b | |
})(window) | |
}).call(this); | |
(function () { | |
var a = {}.hasOwnProperty, | |
b = function (h, f) { | |
for (var c in f) { | |
if (a.call(f, c)) { | |
h[c] = f[c] | |
} | |
} | |
function g() { | |
this.constructor = h | |
} | |
g.prototype = f.prototype; | |
h.prototype = new g(); | |
h.__super__ = f.prototype; | |
return h | |
}; | |
(function (h) { | |
var i, c, g, f; | |
g = h.DM || {}; | |
g.ads = g.ads || {}; | |
g.controllers = g.controllers || {}; | |
g.ads.logger = g.logger.getLogger("Ads UI", "color: brown; font-weight: bold;"); | |
g.events.ads = { | |
AD_UI_SKIP: "AD_UI_SKIP", | |
AD_UI_CLICK: "AD_UI_CLICK" | |
}; | |
f = g.ads.logger; | |
c = g.views.AdsUIView; | |
i = g.models.AdsUIModel; | |
g.controllers.AdsUI = (function (k) { | |
b(j, k); | |
j.prototype.adsUIView = null; | |
function j(l, m) { | |
this.rootNode = l; | |
this.player = m | |
} | |
j.prototype.create = function () { | |
var l, m, n = this; | |
if (!Modernizr.ipad) { | |
return | |
} | |
f.groupCollapsed("creating Ads UI"); | |
this.adsUIModel = new i; | |
m = this.player.backend; | |
l = $(m); | |
l.one("loadedmetadata.ad-ui", function (o) { | |
n.adsUIView = new c(n.adsUIModel, n.rootNode); | |
n.adsUIModel.set({ | |
adDuration: n.player.backend.player.duration | |
}) | |
}); | |
l.on("timeupdate.ad-ui", function (q) { | |
var o, p; | |
o = m.currentTime(); | |
p = n.adsUIModel.adDuration; | |
return n.adsUIModel.set({ | |
adCountdown: p - o | |
}) | |
}); | |
return f.groupEnd() | |
}; | |
j.prototype.setSkipCountDown = function (m) { | |
var l; | |
return (l = this.adsUIModel) != null ? l.set({ | |
skipCountdown: m | |
}) : void 0 | |
}; | |
j.prototype.destroy = function () { | |
var l, m; | |
if (!Modernizr.ipad) { | |
return | |
} | |
if ((m = this.adsUIView) != null) { | |
m.destroy() | |
} | |
l = this.backend && $(l).off(".ad-ui") | |
}; | |
return j | |
})(g.Events); | |
return h.DM = g | |
})(window) | |
}).call(this); | |
window.DMInstream = { | |
type: { | |
preroll: 0, | |
postroll: 1 | |
}, | |
status: { | |
fail: 417, | |
processing: 102, | |
timeout: 408, | |
success: 201, | |
plugin_timeout: 4081, | |
media_timeout: 4082, | |
ads_disabled: 5050 | |
} | |
}; | |
function DailymotionPlayer(m, q, j) { | |
var o = this, | |
k = Modernizr, | |
l; | |
DM.playerLabels.init(); | |
var p = DM.playerOptions.init(); | |
this.fields = j; | |
this.info = m; | |
this.messageQueue = []; | |
this.ui = new DailymotionPlayerUI(q); | |
if (p.statsEnabled()) { | |
this.stats = DM_Stats.getInstance() | |
} else { | |
window.DM_Stats = {}; | |
this.stats = { | |
enable: function () {}, | |
disable: function () {}, | |
trigger: function () {} | |
} | |
} if (m) { | |
l = (!m.url) ? m.url = location.href : m.url | |
} else { | |
l = location.href | |
} | |
var n = p.flashRequired(); | |
if (n) { | |
this.ui.error({ | |
title: n.title, | |
message: n.message | |
}); | |
this.stats.trigger(DM_Stats.ERROR, { | |
type: "player", | |
label: (n.partner_player ? "Partner Player - " : "") + "Flash Player Needed", | |
src: l | |
}); | |
return | |
} | |
if (p.flashPlayer()) { | |
this.setImplem(new DailymotionPlayerFlash(this.ui)) | |
} else { | |
this.setImplem(new DailymotionPlayerInstream(new DailymotionPlayerHTML(this.ui))) | |
} | |
this.muted = false; | |
this.volume = 1; | |
this.paused = true; | |
this.ended = false; | |
if (p.get("api")) { | |
this.initAPI() | |
} | |
if (m) { | |
this.initWithVideoInfo(true); | |
DM.models.videoModel.setVideo(this.info) | |
} else { | |
if (p.get("startscreen") == "flash") { | |
this.load() | |
} | |
} | |
} | |
DailymotionPlayer.prototype = { | |
setImplem: function (A) { | |
var m = this, | |
x = DM.playerOptions, | |
y = Modernizr; | |
function t(b, c) { | |
var f, a, g = []; | |
for (f = 0, a = b.length; f < a; f++) { | |
e = b[f]; | |
g.push("" + e + ".implem") | |
} | |
return g.join(" ") | |
} | |
function B(b, a) { | |
$(m.ui.events).triggerHandler(b.type, a) | |
} | |
function q(b, a) { | |
m.api(b.type, a) | |
} | |
function w(b, a) { | |
switch (b.type) { | |
case "volumechange": | |
m.volume = a.volume; | |
m.muted = a.muted; | |
break; | |
case "play": | |
case "playing": | |
m.paused = false; | |
m.ended = false; | |
break; | |
case "canplay": | |
case "pause": | |
m.paused = true; | |
case "ended": | |
m.ended = true; | |
break | |
} | |
} | |
function u(b, f) { | |
var a = "event=" + b.type; | |
if (x.get("id")) { | |
a += "&id=" + x.get("id") | |
} | |
if (f) { | |
a += "&" + $.param(f) | |
} | |
var c = x.get("api"); | |
if (c == "postMessage") { | |
window.parent.postMessage(a, "*") | |
} else { | |
if (c == "xdcom" && m.xdcom) { | |
m.xdcom.postMessage(x.get("xdcomId"), a) | |
} else { | |
if (c == "fragment" || c == "location") { | |
m.sendMessage(a) | |
} | |
} | |
} | |
} | |
if (this.implem != null) { | |
$(this.implem).unbind(".implem") | |
} | |
this.implem = A; | |
var s = t(["playing", "play", "pause", "seeking", "seeked", "waiting", "durationchange", "timeupdate", "progress"], "implem"); | |
var C = t(["check", "play", "pause", "toggle-play", "seek", "fullscreen", "watch-on-site"], "implem"); | |
var v = t(["volumechange", "play", "playing", "canplay", "ended", "pause"], "implem"); | |
var r = t(["apiready", "play", "playing", "canplay", "canplaythrough", "loadedmetadata", "timeupdate", "progress", "seeking", "seeked", "volumechange", "durationchange", "pause", "ended", "error", "fullscreenchange", "ad_start", "ad_timeupdate", "ad_play", "ad_pause", "ad_end"], "implem"); | |
$(this.implem).bind(s, B); | |
$(this.ui).bind(C, q); | |
$(this.implem).bind(v, w); | |
if (x.get("api")) { | |
$(this.implem).bind(r, u) | |
} | |
$(this.implem).bind("error.implem", function (b, a) { | |
if (m.info.empty === true && a.code == "src_not_supported") { | |
return | |
} | |
m.ui.error(a); | |
m.ended = true; | |
if (x.get("controls") == "html" && !m.retried && a.code == "src_not_supported") { | |
m.retried = true; | |
m.loadId(m.info.id, null, true) | |
} else { | |
$(m.ui.events).triggerHandler(b.type, a) | |
} | |
}); | |
function z() { | |
var f; | |
var g = DM.playerOptions; | |
var c = t(["play", "playing"], "audience"); | |
var h = t(["pause", "ended", "unload"], "audience"); | |
function i() { | |
if (f) { | |
return | |
} | |
f = $.audience(j).progress(function (k) { | |
m.implem.setAudience(k) | |
}) | |
} | |
function a() { | |
if (f) { | |
f.close(); | |
f = null | |
} | |
} | |
function b() { | |
$(m.implem).unbind(".audience"); | |
a() | |
} | |
b(); | |
if (!g.flashControls() && m.info.audience_url) { | |
var j = m.info.audience_url; | |
DM.plugin("audience", true, function () { | |
$(m.implem).bind(c, i); | |
$(m.implem).bind(h, a); | |
$(m.implem).one("unload", b) | |
}) | |
} | |
} | |
if (this.info) { | |
z() | |
} | |
DM.models.videoModel.on("change", z) | |
}, | |
api: function (h, g) { | |
var f = DM.playerOptions; | |
switch (h) { | |
case "check": | |
$(this.implem).triggerHandler("apiready"); | |
return; | |
case "load": | |
if (!f.flashControls() && this.paused) { | |
this.started = false | |
} | |
this.retried = false; | |
this.loadId(g); | |
return; | |
case "toggle-play": | |
if (!this.started) { | |
this.api("play") | |
} else { | |
if (this.paused) { | |
this.implem.play() | |
} else { | |
this.implem.pause() | |
} | |
} | |
return; | |
case "toggle-muted": | |
case "toggle-mute": | |
this.implem.muted(!this.muted); | |
return; | |
case "mute": | |
this.implem.muted(true); | |
return; | |
case "unmute": | |
this.implem.muted(false); | |
return; | |
case "watch-on-site": | |
var i = this.implem.currentTime(); | |
top.location.href = this.info.url + (i ? "?start=" + Math.round(i) : "") + "#from=embediframe"; | |
return | |
} | |
if ($.inArray(h, ["play", "pause", "volume", "muted", "seek", "fullscreen"]) == -1) { | |
console.error("Trying to call invalid API method: " + h); | |
return | |
} | |
if (h == "volume" || h == "seek") { | |
g = parseFloat(g) | |
} | |
if (h == "fullscreen" || h == "muted") { | |
g = g !== "0" && g != "false" | |
} | |
if (!this.implem[h]) { | |
console.error("Trying to call unimplemented API method: " + h); | |
return | |
} | |
if (this.started) { | |
this.implem[h].call(this.implem, g) | |
} else { | |
if (h == "play") { | |
this.load() | |
} else { | |
console.error("Player not ready for " + h) | |
} | |
} | |
}, | |
initAPI: function () { | |
var l = this, | |
m = DM.playerOptions, | |
i = Modernizr; | |
if (m.get("api")) { | |
$(window).bind("message hashchange", function (a, b) { | |
if (!b) { | |
b = a.type == "message" ? a.originalEvent.data : location.hash.substring(1) | |
} | |
if (!b || b.match(/^event=/)) { | |
return | |
} | |
var c = b.split("="); | |
l.api(c[0], c[1]) | |
}); | |
switch (m.get("api")) { | |
case "xdcom": | |
window.onDMXDComMessage = function (a) { | |
$(window).triggerHandler("message", a) | |
}; | |
window.onDMXDComReady = function () { | |
l.xdcom = $("#xdcom").get(0); | |
l.xdcom.addListener("onDMXDComMessage"); | |
$(l.implem).triggerHandler("apiready") | |
}; | |
var k = this.ui.getSWFHtml("//api.dmcdn.net/xdcom.swf", { | |
allowscriptaccess: "always", | |
flashvars: $.param({ | |
id: m.get("id") | |
}) | |
}, "xdcom"), | |
h = document.createElement("div"), | |
j = h.style; | |
j.position = "absolute"; | |
j.top = "-10000px"; | |
j.width = j.height = 0; | |
document.body.appendChild(h); | |
h.innerHTML = k; | |
break; | |
case "hashchange": | |
DM.plugin("hashchange", !i.hashchange, function () { | |
$(l.implem).triggerHandler("apiready") | |
}); | |
break; | |
default: | |
$(this.implem).triggerHandler("apiready") | |
} | |
} | |
}, | |
initWithVideoInfo: function (h) { | |
var g = Modernizr, | |
f = DM.playerOptions; | |
if (!this.initializedWithVideoInfo && h) { | |
this.initializedWithVideoInfo = false | |
} | |
if (!this.info || this.initializedWithVideoInfo) { | |
return | |
} | |
this.initializedWithVideoInfo = true; | |
if (f.htmlPlayer()) { | |
this.stats.trigger(DM_Stats.VIDEO_INFOS, this.info) | |
} | |
if (this.info.error) { | |
$(this.implem).triggerHandler("error", this.info.error); | |
this.stats.enabled = false | |
} else { | |
if (g.sessionstorage && sessionStorage.dmPlayedVideoId && sessionStorage.dmPlayedVideoId == this.info.id) { | |
this.ui.startscreen(this.info); | |
$(this.implem).triggerHandler("ended"); | |
$(this.implem).triggerHandler("fullscreenchange", { | |
fullscreen: false | |
}); | |
sessionStorage.removeItem("dmPlayedVideoId") | |
} else { | |
if (f.get("autoplay")) { | |
this.api("play") | |
} else { | |
if (f.htmlStartscreen()) { | |
this.ui.startscreen(this.info); | |
DM.plugin("gestures", g.touch && screen.width > 500) | |
} else { | |
this.load() | |
} if (this.implem.preload) { | |
this.implem.preload(this.info) | |
} | |
} | |
} | |
} | |
}, | |
loadId: function (j, h, i) { | |
if (!j) { | |
return | |
} | |
var g = DM.playerOptions; | |
if (g.flashStartscreen() || (g.flashControls() && this.started)) { | |
if (this.started) { | |
this.implem.load({ | |
id: j | |
}) | |
} else { | |
this.load() | |
} | |
return | |
} | |
if (i !== true && this.info && this.info.id == j) { | |
return | |
} | |
var k = this; | |
this.api("pause"); | |
this.info = { | |
empty: true | |
}; | |
this.load(); | |
this.ui.loading(true); | |
this.ui.empty(); | |
fields = (function (b) { | |
var a; | |
(a = b.split(",")).splice(a.indexOf("sharing_urls"), 1); | |
return a.join(",") | |
})(this.fields); | |
$.ajax("/json/video/" + j + "?fields=" + fields, { | |
success: function (a) { | |
k.ui.relatedEndScreen(false); | |
k.info = a; | |
DM.models.videoModel.setVideo(k.info); | |
if (k.initializedWithVideoInfo) { | |
if (g.htmlPlayer()) { | |
k.stats.trigger(DM_Stats.VIDEO_INFOS, k.info) | |
} | |
} | |
if (k.started) { | |
k.load() | |
} else { | |
if (!k.initializedWithVideoInfo) { | |
k.initWithVideoInfo() | |
} else { | |
k.ui.startscreen(k.info) | |
} | |
} if (k.ended) { | |
k.api("play") | |
} | |
}, | |
error: function (a, c, b) { | |
k.info = { | |
id: j, | |
error: { | |
code: c, | |
title: b, | |
message: null | |
} | |
}; | |
$(k.implem).triggerHandler("error", k.info.error) | |
} | |
}) | |
}, | |
load: function () { | |
if (!this.info) { | |
return | |
} | |
var f = DM.playerOptions; | |
if (this.info && "error" in this.info && f.htmlStartscreen()) { | |
this.stats.trigger(DM_Stats.ERROR, { | |
type: "api", | |
label: this.info.error.title, | |
src: this.info.url | |
}); | |
this.ui.error(this.info.error) | |
} else { | |
var c = this; | |
this.ui.loading(true); | |
if (f.htmlControls()) { | |
DM.plugin("gestures", Modernizr.touch, function () { | |
c.ui.controls(c.info) | |
}) | |
} else { | |
if (f.noControls()) { | |
c.ui.controls("none") | |
} | |
} | |
this.implem.load(this.info, function () { | |
c.ui.loading(false) | |
}, c.retried); | |
this.started = true | |
} | |
}, | |
sendMessage: function (c) { | |
this.messageQueue.push(c); | |
if (!this.messageQueueTimer) { | |
var f = this; | |
this.messageQueueTimer = setInterval(function () { | |
f.unqueueMessage() | |
}, 0) | |
} | |
}, | |
unqueueMessage: function () { | |
var f = DM.playerOptions, | |
c = this.messageQueue.shift(); | |
if (this.messageQueue.length === 0) { | |
this.messageQueueTimer = clearInterval(this.messageQueueTimer) | |
} | |
switch (f.get("api")) { | |
case "location": | |
location.href = "dmevent://none?" + c; | |
break; | |
case "fragment": | |
location.hash = c; | |
break | |
} | |
} | |
}; | |
if (!("console" in window)) { | |
console = {} | |
} | |
if (!("log" in console)) { | |
console.log = function () {} | |
} | |
if (!("warn" in console)) { | |
console.warn = function () {} | |
} | |
if (!("error" in console)) { | |
console.error = function () {} | |
} | |
if (!("group" in console)) { | |
console.group = function () {} | |
} | |
if (!("groupCollapsed" in console)) { | |
console.groupCollapsed = function () {} | |
} | |
if (!("groupEnd" in console)) { | |
console.groupEnd = function () {} | |
} | |
function DailymotionPlayerUI(g) { | |
var h = this; | |
var f = DM.playerOptions; | |
this.root = g; | |
this.assets = DM.config("assets"); | |
this.widthBreakpoints = [160, 250, 350]; | |
this.detectWidthBreakpoint(); | |
$(this.root).attr("id", "player").addClass("paused").resize(function () { | |
h.detectWidthBreakpoint() | |
}); | |
this.events = {}; | |
$(this.events).bind("play", function () { | |
$("#player").removeClass("paused"); | |
$("#player").addClass("started") | |
}); | |
$(this.events).bind("pause ended", function () { | |
$("#player").addClass("paused"); | |
$("#player").removeClass("started") | |
}); | |
$(this.events).bind("error", function (a, b) { | |
h.error(b) | |
}); | |
$("#player").toggleClass("hideinfo", !f.get("info")); | |
this.webkitForceInline = f.get("playsinline"); | |
this.whitemark = f.get("whitemark"); | |
this.chromeless = f.get("chromeless"); | |
this.enableLogo = f.get("logo", true); | |
this.startuploaderonly = f.get("startuploaderonly"); | |
this.loaderFallback = f.get("gifloader"); | |
this.enableControls = !f.noControls(); | |
this.$videoFrame = $("#video-frame") | |
} | |
DailymotionPlayerUI.prototype = { | |
set: function (b) { | |
$(this.root).empty().html(b) | |
}, | |
startscreen: function (m) { | |
if (!m) { | |
return | |
} | |
if (m.hasOwnProperty("error")) { | |
return this.error(m.error) | |
} else { | |
this.error(false) | |
} | |
this.$videoFrame.hide(); | |
var i = this, | |
j = $("#startscreen"); | |
if (j.length === 0 && this.enableControls && !this.chromeless) { | |
$("#controls").remove(); | |
j = $('<div id="startscreen" class="ff"/>').click(function () { | |
$(i).triggerHandler("play"); | |
return false | |
}).appendTo(this.root); | |
var h = $('<div class="background"/>').appendTo($('<div class="bar">').appendTo(j)); | |
$('<div class="play button"><div class="inner"><div class="play-icon">\u25ba</div><div class="icon"/></div></div>').click(function () { | |
$(i).triggerHandler("play") | |
}).appendTo(h); | |
$('<div class="info"><div class="title"/><div class="owner"/><div class="duration"/></div>').click(false).appendTo(h); | |
if (!this.whitemark) { | |
$(".info", h).delegate("a", "click", function () { | |
top.location.href = $(this).attr("href"); | |
return false | |
}) | |
} | |
this.logo(j) | |
} | |
this.customLogo(); | |
this.thumb(m); | |
var k = !this.whitemark ? m.url + "#from=embediframe" : "javascript:void(0);return false;", | |
l = m.owner_url + "#from=embediframe"; | |
$(".info .title", j).html('<a href="' + k + '" target="_top">' + m.title + "</a>"); | |
if (!this.whitemark) { | |
var n = "<span> </span>"; | |
if (m.owner_url && m.owner_screenname) { | |
n = '<a href="' + l + '" target="_top">' + m.owner_screenname + "</a>" | |
} else { | |
if (m.owner_screenname) { | |
n = "<span>" + m.owner_screenname + "</span>" | |
} | |
} | |
$(".info .owner", j).html(n) | |
} | |
$(".info .duration", j).html(this.timeFormated(m.duration)); | |
this.loading(false) | |
}, | |
thumbSrc: function (l) { | |
if (!this.thumbSrcs) { | |
return | |
} | |
if (l && l.error) { | |
return this.thumbSrcs[380] | |
} | |
var h = 0, | |
m = this.thumbSrcs[0], | |
j = -1, | |
i = $("#thumb").attr("src"); | |
currentWidth = $(this.root).width(); | |
for (var n in this.thumbSrcs) { | |
var k = this.thumbSrcs[n]; | |
if (!k) { | |
continue | |
} | |
if (k == i) { | |
j = n | |
} | |
if (currentWidth >= n && n > h) { | |
h = n; | |
m = k | |
} | |
} | |
return h > j ? m : i | |
}, | |
thumb: function (f) { | |
var h = $("#thumb"); | |
if (!f || f.empty === true) { | |
h.attr("src", ""); | |
return | |
} | |
this.thumbSrcs = { | |
380: f.thumbnail_url, | |
160: f.thumbnail_large_url, | |
0: f.thumbnail_medium_url | |
}; | |
var g = this, | |
i = this.thumbSrc(f); | |
if (!i) { | |
return | |
} | |
if (h.length === 0) { | |
h = $('<img id=thumb style="position: absolute; display: block; width: 100%; opacity: .1">'); | |
h.attr("src", i).load(function () { | |
var n = { | |
opacity: 1, | |
top: 0, | |
left: 0, | |
width: "auto", | |
height: "auto" | |
}, o = $(this), | |
p = o.width(), | |
c = o.height(), | |
b = o.parent(), | |
m = b.width(), | |
a = b.height(); | |
if (p * c * m * a === 0) { | |
return | |
} | |
if (m / a > p / c) { | |
n.width = "100%"; | |
n.top = (a - c) / 2 | |
} else { | |
n.height = "100%"; | |
n.left = (m - p) / 2 | |
} if (f.error) { | |
n.webkitFilter = n.mozFilter = n.filter = "blur(5px)"; | |
n.opacity = 0.6; | |
n.msFilter = "progid:DXImageTransform.Microsoft.MotionBlur(strength=40)" | |
} | |
o.css(n) | |
}).appendTo($("<div class=ff/>").prependTo(this.root)).triggerHandler("load"); | |
if (!this.thumbinited) { | |
$(window).bind("resize load", function () { | |
h.triggerHandler("load") | |
}); | |
$(document.body).bind("load", function () { | |
h.triggerHandler("load") | |
}); | |
$(window).resize(function () { | |
h.attr("src", g.thumbSrc()) | |
}); | |
this.thumbinited = true | |
} | |
} else { | |
h.attr("src", i) | |
} | |
}, | |
logo: function (f) { | |
if (this.chromeless || this.whitemark || !this.enableLogo) { | |
return | |
} | |
var c = this; | |
if ($(".logo", f).length === 0 && (this.assets.logo_svg || this.assets.logo_png)) { | |
$('<img class="logo" class="button" width=97 height=16>').attr("src", Modernizr.svg ? this.assets.logo_svg : this.assets.logo_png).click(function () { | |
$(c).triggerHandler("watch-on-site") | |
}).hover(function () { | |
$("#player .bar").toggleClass("hover") | |
}).appendTo(f) | |
} | |
if ($("#player").hasClass("live") && $(".live-logo", f).length === 0) { | |
$('<img class="live-logo" width=79 height=16>').attr("src", this.assets.liveshow_logo_svg).appendTo(f) | |
} | |
}, | |
customLogo: function () { | |
var g = this; | |
if ($(".custom-logo", this.root).length === 0 && this.assets.custom_logo_url) { | |
var h = this.assets.custom_logo_origin.toLowerCase(); | |
var f = {}; | |
f[h.indexOf("top") !== -1 ? "top" : "bottom"] = Math.abs(this.assets.custom_logo_offset_y) + "px"; | |
f[h.indexOf("left") !== -1 ? "left" : "right"] = Math.abs(this.assets.custom_logo_offset_x) + "px"; | |
$('<img class="custom-logo">').attr("src", this.assets.custom_logo_url).css(f).click(function () { | |
$(g).triggerHandler("toggle-play") | |
}).appendTo(this.root) | |
} | |
}, | |
videoFrame: function () { | |
if (this.$videoFrame.length === 0) { | |
$controls = $("#controls"); | |
if ($controls.length === 0) { | |
this.$videoFrame = $('<div id="video-frame" class=ff></div>').appendTo(this.root) | |
} else { | |
this.$videoFrame = $('<div id="video-frame" class=ff></div>').insertBefore($controls) | |
} | |
} | |
return this.$videoFrame.get(0) | |
}, | |
controls: function (i) { | |
if (typeof i === "boolean") { | |
var l = document.getElementById("controls"); | |
if (l) { | |
l.style.display = i ? "" : "none" | |
} | |
return | |
} | |
if (i.hasOwnProperty("error")) { | |
return this.error(i.error) | |
} else { | |
this.error(false) | |
} | |
this.$videoFrame.show(); | |
if (this.chromeless || i === "none") { | |
return | |
} | |
this.duration = null; | |
this.seeking = false; | |
var g = $("#controls"); | |
if (g.length === 0) { | |
var h = this; | |
$("#loader").css("margin-top", "-22px"); | |
$("#startscreen").remove(); | |
g = $('<div id=controls class="ff" style="z-index: 1000"/>').appendTo(this.root); | |
if (Modernizr.touch && (screen.width > 500 || this.webkitForceInline)) { | |
g.click(function () { | |
h.autohide(true) | |
}); | |
g.bind("touchmove", function () { | |
h.autohide() | |
}); | |
g.bind("pinchopen", function () { | |
$(h).triggerHandler("fullscreen") | |
}); | |
g.bind("touchmove", function (a) { | |
return a.originalEvent.targetTouches.length != 2 | |
}) | |
} else { | |
g.click(function () { | |
$(h).triggerHandler("toggle-play") | |
}); | |
g.bind("touchstart touchmove touchend click", function () { | |
h.autohide() | |
}) | |
} | |
var j = $("<div class=background/>").appendTo($("<div class=bar>").appendTo(g)).click(false); | |
$('<div class="play button"><div class=inner><div class="play-icon smooth-hover">\u25ba</div><div class=icon/><div class=icon2/></div></div>').click(function () { | |
$(h).triggerHandler("toggle-play") | |
}).appendTo(j); | |
$('<div class="progress-bar"><div class="buffer smooth-width force-transform"/><div class=border/><div class="progress smooth-width force-transform"><div class=indicator><div class=inner><span>00:00</span><div class=arrow-border/><div class=arrow/></div></div><div class="handle force-transform"><div class="inner "><div class=handle-hole/></div></div></div></div>').appendTo(j); | |
$('<div class="progress-bar-interaction"/>').bind("mousedown touchstart", function () { | |
h.seeking = true | |
}).bind("mouseout", function () { | |
h.seeking = false | |
}).bind("mousemove touchmove mouseup touchend", function (b) { | |
if (!h.seeking || !h.duration) { | |
return | |
} | |
var f = $(b.target).width(), | |
a; | |
if (b.type.match(/touch/)) { | |
a = b.originalEvent.changedTouches[0].clientX - $(b.target).offset().left - 8 | |
} else { | |
a = ("offsetX" in b && typeof b.offsetX === "number") ? b.offsetX : b.originalEvent.layerX | |
} if (a > f) { | |
a = f | |
} | |
var c = Math.floor(h.duration * (a / f)); | |
if (c < 0) { | |
c = 0 | |
} | |
if (c > h.duration) { | |
c = duration | |
} | |
$("#controls .progress-bar .indicator .inner span").html(h.timeFormated(c)); | |
$("#controls .progress-bar .progress").css("width", a + "px"); | |
if (b.type == "mouseup" || b.type == "touchend") { | |
h.seeking = false; | |
$(h).triggerHandler("seek", c) | |
} | |
h.autohide(); | |
return false | |
}).appendTo(j); | |
$("<div class=duration>--:--</div>").appendTo(j); | |
$('<div class="fullscreen button smooth-hover"/>').click(function () { | |
$(h).triggerHandler("fullscreen") | |
}).appendTo(j); | |
this.logo(g); | |
if (!this.controlsinitted) { | |
$(this.events).bind("durationchange", function (a, b) { | |
h.duration = b.duration; | |
$("#controls .duration").html(h.timeFormated(b.duration)) | |
}); | |
$(this.events).bind("timeupdate", function (a, b) { | |
if (h.duration && !h.seeking) { | |
$("#controls .progress-bar .indicator .inner span").html(h.timeFormated(b.time)); | |
var c = (b.time / h.duration * 100) + "%"; | |
$("#controls .progress-bar .progress").css("width", c) | |
} | |
}); | |
$(this.events).bind("progress", function (a, b) { | |
if (h.duration) { | |
var c = (b.time / h.duration * 100) + "%"; | |
$("#controls .progress-bar .buffer").css("width", c) | |
} | |
}); | |
this.controlsinitted = true | |
} | |
} | |
if (this.whitemark || (!this.assets.logo_svg && !this.assets.logo_png)) { | |
$("#controls").addClass("whitemark") | |
} | |
this.customLogo(); | |
this.thumb(i); | |
this.topbar(g); | |
this.duration = i.duration; | |
$("#controls .duration").html(this.timeFormated(i.duration)); | |
$("#player").toggleClass("live", i.mode == "live"); | |
this.autohide(); | |
if (Modernizr.touch) { | |
var k = { | |
WebkitTransition: "webkitTransitionEnd", | |
MozTransition: "transitionend", | |
OTransition: "oTransitionEnd otransitionend", | |
msTransition: "MSTransitionEnd", | |
transition: "transitionend" | |
}; | |
$(".bar, #topbar", g).on(k[Modernizr.prefixed("transition")], function (a) { | |
var b = $(this); | |
if (a.originalEvent.propertyName === "opacity" && b.css("opacity") === "0") { | |
b.hide() | |
} | |
}) | |
} | |
}, | |
topbar: function (g) { | |
var f = this; | |
var h; | |
if (typeof g === "boolean") { | |
h = document.getElementById("topbar"); | |
if (h) { | |
h.style.display = g ? "" : "none" | |
} | |
return | |
} | |
var i = $("#topbar", g); | |
if (i.length === 0) { | |
i = $("<div id=topbar/>").appendTo(g) | |
} | |
h = i[0]; | |
if (!this.socialBtns) { | |
this.socialBtns = new DM.controllers.SocialButtons(h); | |
DM.observer.on(DM.events.social.BTN_CLICK, function (a) { | |
$(f).triggerHandler("pause") | |
}) | |
} | |
}, | |
relatedEndScreen: function (h) { | |
if (!DM.controllers.RelatedEndScreen) { | |
return | |
} | |
var f = this; | |
if (typeof h === "boolean") { | |
if (!this.related) { | |
return | |
} | |
if (h) { | |
this.related.show() | |
} else { | |
this.related.hide() | |
} | |
return | |
} | |
var g = this.$videoFrame; | |
if (Modernizr.android) { | |
setTimeout(function () { | |
g.hide() | |
}, 1500) | |
} else { | |
g.hide() | |
} | |
$("#controls").hide(); | |
if (!this.related) { | |
$relatedScreen = $('<div id=related-sreen class="ff"/>').appendTo(this.root); | |
this.related = new DM.controllers.RelatedEndScreen($relatedScreen[0], this.socialBtns.socialLinksModel); | |
DM.observer.on(DM.events.related.REPLAY, function (a) { | |
f.related.hide(); | |
g.show(); | |
$("#controls").show(); | |
setTimeout(function () { | |
$(f).triggerHandler("play") | |
}, 100) | |
}); | |
DM.observer.on(DM.events.related.FETCH_ERROR, function (a) { | |
f.related.hide(); | |
g.show(); | |
$("#controls").show() | |
}) | |
} else { | |
this.related.show() | |
} | |
}, | |
initLoader: function () { | |
var b = this; | |
this.seeked = false; | |
if (!this.startuploaderonly) { | |
$(this.events).bind("seeked", function (f, a) { | |
setTimeout(function () { | |
if (this.seeked) { | |
b.loading(true) | |
} | |
}, 200) | |
}); | |
$(this.events).bind("pause ended", function (f, a) { | |
b.loading(false) | |
}); | |
$(this.events).bind("timeupdate", function (f, a) { | |
b.seeked = false; | |
b.loading(false) | |
}); | |
if (!this.loaderFallback) { | |
$(this.events).bind("waiting", function (a) { | |
b.loading(true) | |
}) | |
} else { | |
$(this.events).bind("canplaythrough", function (a) { | |
b.started = true | |
}) | |
} | |
} else { | |
$(this.events).bind("timeupdate", function (f, a) { | |
b.loading(false) | |
}) | |
} | |
}, | |
autohide: function (b) { | |
$controls = $("#controls"); | |
$(".bar, #topbar", $controls).show(); | |
if (b === true && $controls.hasClass("visible")) { | |
$controls.removeClass("visible"); | |
clearTimeout(this.autohideTimeout); | |
this.autohideTimeout = null; | |
return | |
} | |
$controls.addClass("visible"); | |
if (this.autohideTimeout) { | |
clearTimeout(this.autohideTimeout); | |
this.autohideTimeout = null | |
} | |
this.autohideTimeout = setTimeout(function () { | |
$controls.removeClass("visible") | |
}, 3000) | |
}, | |
error: function (b) { | |
if (b) { | |
this.loading(false); | |
this.thumb(info); | |
if ($("#error", this.root).length === 0) { | |
$('<div id="error" class="ff"><div class="' + (b.dmCode ? "error-" + b.dmCode : "") + '"><h2 class="error-title">' + (b.title ? b.title : "") + '</h2><span class="error-message">' + (b.message ? b.message : "") + "</span></div></div>").appendTo(this.root); | |
$("#startscreen .play").hide() | |
} | |
} else { | |
$("#error", this.root).remove() | |
} | |
}, | |
loading: function (b) { | |
if (b != this._loading) { | |
$("#player").toggleClass("loading", b); | |
if (b) { | |
this.error(false); | |
startLoader(); | |
if (this.loaderFallback) { | |
this.$videoFrame.hide() | |
} | |
} else { | |
stopLoader(); | |
if (this.loaderFallback && this.started) { | |
this.$videoFrame.show() | |
} | |
} | |
this._loading = b | |
} | |
}, | |
empty: function () { | |
this.started = false; | |
this.thumb(false) | |
}, | |
detectWidthBreakpoint: function () { | |
var i = $(this.root).width(), | |
l = "min-width-", | |
n = "max-width-", | |
j = [], | |
m = [], | |
k = "px", | |
h; | |
$(this.root).removeClass(this.widthBreakpoints.join(k + " " + l) + k + " " + n + this.widthBreakpoints.join(k + " " + n) + k); | |
$.each(this.widthBreakpoints, function (b, a) { | |
if (i >= a) { | |
j.push(l + a + k) | |
} | |
if (i <= a) { | |
m.push(n + a + k) | |
} | |
}); | |
if (j.length) { | |
h = j.join(" ") | |
} | |
if (m.length) { | |
h += " " + m.join(" ") | |
} | |
$(this.root).addClass(h) | |
}, | |
timeFormated: function (h) { | |
if (isNaN(h) || !isFinite(h)) { | |
return "--:--" | |
} | |
h = Math.round(h); | |
var g = (g = Math.floor(h / 3600)) < 10 ? "0" + g : g, | |
f = (f = Math.floor(h / 60) % 60) < 10 ? "0" + f : f, | |
i = (i = h % 60) < 10 ? "0" + i : i; | |
return h < 3600 ? f + ":" + i : g + "h" + f | |
}, | |
getSWFHtml: function (j, g, h) { | |
var f; | |
if (navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length) { | |
g.type = "application/x-shockwave-flash"; | |
g.src = j; | |
g.id = h; | |
f = $("<embed>").attr(g).get(0) | |
} else { | |
var i = ['<param name="movie" value="' + j + '"></param>']; | |
$.each(g, function (b, a) { | |
i.push('<param name="' + b + '" value="' + a + '"></param>') | |
}); | |
f = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="' + h + '">' + i.join("") + "</object>" | |
} | |
return f | |
} | |
}; | |
function DailymotionPlayerFlash(b) { | |
this.ui = b; | |
this.out = this; | |
this.params = DM.playerOptions.exportFlashPlayerOptions(); | |
this.wmode = this.params.wmode | |
} | |
DailymotionPlayerFlash.prototype = { | |
event: function (f, c) { | |
$(this.out).triggerHandler(f, c) | |
}, | |
init: function (l) { | |
if (this.params.enableApi) { | |
var h = this, | |
k = { | |
"0": "ended", | |
"1": ["play", "playing"], | |
"2": "pause", | |
"3": "canplay", | |
"5": "canplaythrough" | |
}, j = null, | |
n = null, | |
m = null; | |
window.onDailymotionPlayerReady = function () { | |
var a = h.player = $("#iframe-embed").get(0); | |
a.addEventListener("onStateChange", "dmStateChange"); | |
a.addEventListener("onVideoMetadata", "dmMetadata"); | |
a.addEventListener("onVideoProgress", "dmProgress"); | |
a.addEventListener("onError", "dmError"); | |
a.addEventListener("onSeek", "dmSeek"); | |
a.addEventListener("onVolumeChange", "dmVolumeChange") | |
}; | |
window.dmStateChange = function (a) { | |
if (a in k) { | |
$($.type(k[a]) == "array" ? k[a] : [k[a]]).each(function () { | |
h.event("" + this) | |
}) | |
} | |
j = h.player.getDuration() | |
}; | |
window.dmMetadata = function (a) { | |
h.event("loadedmetadata"); | |
h.event("durationchange", { | |
duration: a.videoDuration | |
}) | |
}; | |
window.dmProgress = function (a) { | |
if (a.mediaTime !== n) { | |
h.event("timeupdate", { | |
time: a.mediaTime | |
}); | |
n = a.mediaTime | |
} | |
if (a.mediaBytesReceived !== m) { | |
h.event("progress", { | |
time: a.mediaBytesReceived / a.mediaBytesTotal * j | |
}); | |
m = a.mediaBytesReceived | |
} | |
}; | |
window.dmError = function (c) { | |
var a, b; | |
switch (c) { | |
case "stream_not_found": | |
a = "Not Found"; | |
b = "The video may have been deleted by its author."; | |
break; | |
case "stream_rejected": | |
a = "Authorization Error"; | |
b = "The authorization token is invalid or has expired, please try again."; | |
break; | |
case "stream_error": | |
a = "Stream Error"; | |
b = "An error occurred while decoding the video stream."; | |
break | |
} | |
h.event("error", { | |
code: c, | |
title: a, | |
message: b | |
}) | |
}; | |
window.dmSeek = function (a) { | |
h.event("seeked", { | |
time: a | |
}) | |
}; | |
window.dmVolumeChange = function (a) { | |
h.event("volumechange", { | |
volume: a.volume, | |
muted: a.muted | |
}) | |
} | |
} | |
var i = $(this.ui.getSWFHtml(l, { | |
allowFullScreen: "true", | |
allowScriptAccess: "always", | |
wmode: this.wmode | |
}, "iframe-embed")); | |
this.ui.set(i); | |
i.addClass("ff").css({ | |
width: "100%", | |
height: "100%" | |
}) | |
}, | |
load: function (c, f) { | |
if (this.video_id) { | |
$(this).triggerHandler("unload", this.video_id) | |
} | |
if (!c) { | |
c = { | |
id: null, | |
swf_url: "../swf" | |
} | |
} | |
$(this).triggerHandler("load", c.id); | |
this.video_id = c.id; | |
if (!this.inited) { | |
this.init(c.swf_url + (c.swf_url.indexOf("?") === -1 ? "?" : "&") + $.param(this.params) + "&_="); | |
this.inited = true | |
} else { | |
if (this.player) { | |
this.player.loadVideoById(c.id) | |
} else { | |
this.event("error", { | |
code: "not_ready", | |
title: "Not Ready", | |
message: "Cannot talk to player" | |
}) | |
} | |
} if (f) { | |
f() | |
} | |
}, | |
setAudience: function (b) { | |
this.player.setAudience(b) | |
}, | |
paused: function () { | |
return this.player && this.player.getPlayerState() == 2 | |
}, | |
play: function () { | |
this.player.playVideo() | |
}, | |
pause: function () { | |
this.player.pauseVideo() | |
}, | |
seek: function (b) { | |
this.player.seekTo(b); | |
this.event("seeking", { | |
time: b | |
}) | |
}, | |
currentTime: function () { | |
return this.player ? this.player.getCurrentTime() : 0 | |
}, | |
muted: function (b) { | |
if (b) { | |
this.player.mute() | |
} else { | |
this.player.unMute() | |
} | |
this.event("volumechange", { | |
volume: this.player.getVolume() / 100, | |
muted: b | |
}) | |
}, | |
volume: function (b) { | |
this.player.setVolume(b * 100); | |
this.event("volumechange", { | |
volume: b, | |
muted: this.player.isMuted() | |
}) | |
} | |
}; | |
function DailymotionPlayerHTML(h) { | |
var g = DM.playerOptions; | |
this.ui = h; | |
this.out = this; | |
this.html5 = true; | |
this.resolveCDN = false; | |
this.nativeControls = g.nativeControls(); | |
this.start = g.get("start"); | |
this.webkitForceInline = g.get("playsinline"); | |
this.autoplay = g.get("autoplay"); | |
this.forceFullscreen = g.get("fullscreen"); | |
this.showRelatedEndScreen = g.get("related"); | |
this.startuploaderonly = g.get("startuploaderonly"); | |
this.quality = g.get("quality"); | |
this.hls = false; | |
if (g.get("hls")) { | |
this.hls = {}; | |
var i = g.get("hls_default_quality"); | |
if (i) { | |
this.hls.default_quality = i | |
} | |
} | |
this.m = Modernizr; | |
if (g.statsEnabled()) { | |
this.stats = DM_Stats.getInstance() | |
} else { | |
this.stats = { | |
enable: function () {}, | |
disable: function () {}, | |
trigger: function () {} | |
} | |
} | |
this.ui.videoFrame().innerHTML = '<video src="" height="100%" width="100%" class="ff force-transform" style="background: #000" x-webkit-airplay="allow" ' + (this.webkitForceInline ? "webkit-playsinline" : "") + "></video>"; | |
var f = this.player = document.querySelector("video"); | |
if (!f) { | |
return this.fallback() | |
} | |
if (!this.m["video-inline"] && !this.webkitForceInline) { | |
$(f).css({ | |
opacity: 0, | |
width: "1px", | |
height: "1px", | |
top: "50%", | |
left: "50%" | |
}) | |
} | |
if (this.m.ipad) { | |
$(f).css({ | |
top: "-10000px" | |
}) | |
} | |
} | |
DailymotionPlayerHTML.prototype = { | |
event: function (f, c) { | |
$(this.out).triggerHandler(f, c) | |
}, | |
init: function () { | |
var h = this; | |
var m = this.player; | |
$(m).bind("canplay", function (a) { | |
if (h.m.ipad) { | |
$(m).css({ | |
top: 0 | |
}) | |
} | |
if (h.start) { | |
a.target.currentTime = h.start; | |
h.start = null | |
} | |
}); | |
$(m).bind("click", function (a) { | |
h.play() | |
}); | |
$(m).bind("playing", function () { | |
h.logView() | |
}); | |
$(m).bind("error", function (c) { | |
var a, b, f, g = c.target.error; | |
switch (g.code) { | |
case g.MEDIA_ERR_ABORTED: | |
f = "aborted"; | |
b = "Aborted"; | |
a = "You aborted the video playback."; | |
break; | |
case g.MEDIA_ERR_NETWORK: | |
f = "network"; | |
b = "Network Error"; | |
a = "A network error caused the video download to fail part-way."; | |
break; | |
case g.MEDIA_ERR_DECODE: | |
f = "decode"; | |
b = "Media Error"; | |
a = "The video playback was aborted due to a corruption problem or because the video used features your browser did not support."; | |
break; | |
case g.MEDIA_ERR_SRC_NOT_SUPPORTED: | |
f = "src_not_supported"; | |
b = "Media Not Supported"; | |
a = "The video could not be loaded, either because the server or network failed or because the format is not supported."; | |
break; | |
default: | |
a = "An unknown error occurred."; | |
break | |
} | |
h.stats.trigger(DM_Stats.ERROR, { | |
type: "player", | |
label: b ? b : "Unknow", | |
src: m.src | |
}); | |
h.event("error", { | |
code: f, | |
title: b, | |
message: a | |
}); | |
h.cancelFurtherLogView() | |
}); | |
$(m).bind("volumechange", function (a) { | |
h.event(a.type, { | |
volume: a.target.volume, | |
muted: a.target.muted | |
}) | |
}); | |
$(m).bind("durationchange", function (a) { | |
h.event(a.type, { | |
duration: a.target.duration | |
}) | |
}); | |
$(m).bind("ended play pause canplay canplaythrough loadedmetadata playing", function (a) { | |
h.event(a.type) | |
}); | |
$(m).bind("timeupdate seeking seeked", function (a) { | |
h.event(a.type, { | |
time: a.target.currentTime | |
}) | |
}); | |
$(m).bind("progress", function (a) { | |
if (a.target.buffered.length === 0) { | |
return | |
} | |
h.event(a.type, { | |
time: a.target.buffered.end(a.target.buffered.length - 1) | |
}); | |
h.stats.trigger(DM_Stats.VIDEO_PROGRESS, { | |
time: a.target.buffered.end(a.target.buffered.length - 1) | |
}) | |
}); | |
$(m).bind("webkitbeginfullscreen", function () { | |
h.event("fullscreenchange", { | |
fullscreen: true | |
}) | |
}); | |
$(m).bind("webkitendfullscreen", function () { | |
h.event("fullscreenchange", { | |
fullscreen: false | |
}) | |
}); | |
this.lastTime = 0; | |
var k; | |
function i() { | |
clearInterval(k); | |
k = null | |
} | |
function n(a) { | |
if (a.target.currentTime !== h.lastTime) { | |
if (!a.target.paused) { | |
h.stats.trigger(DM_Stats.VIDEO_TIME_UPDATE, { | |
currentTime: m.currentTime | |
}) | |
} | |
if (!k && !m.paused) { | |
h.lastTime = a.target.currentTime; | |
k = setInterval(function () { | |
if (m.currentTime === h.lastTime) { | |
h.event("waiting"); | |
h.stats.trigger(DM_Stats.VIDEO_WAITING, { | |
currentTime: m.currentTime | |
}); | |
i() | |
} else { | |
h.lastTime = m.currentTime | |
} | |
}, 600) | |
} | |
} | |
} | |
if (!this.startuploaderonly) { | |
$(m).bind("timeupdate", n); | |
$(m).bind("pause ended", i) | |
} | |
$(window).on("beforeunload", function () { | |
h.stats.trigger(DM_Stats.EXIT) | |
}); | |
if (this.m.android) { | |
$(m).bind("timeupdate", function (a) { | |
if (a.target.currentTime === 0 && h.lastTimeUpdate > 0) { | |
h.event("pause") | |
} | |
h.lastTimeUpdate = a.target.currentTime | |
}) | |
} | |
try { | |
m.load(); | |
if (this.nativeControls) { | |
m.controls = 1 | |
} | |
} catch (j) {} | |
try { | |
this.play() | |
} catch (l) {} | |
}, | |
load: function (q, D) { | |
var B = Modernizr, | |
G = this, | |
m = $(this.player), | |
i = G.stats, | |
x = !DM.playerOptions.statsEnabled() || q.ad === true || q.stats === false || q.empty === true; | |
if (q.ad === true) { | |
i.filter("adsonly") | |
} else { | |
if (x) { | |
i.disable() | |
} else { | |
i.enable() | |
} | |
} if (q.paywall) { | |
this.event("error", { | |
code: "device_not_supported", | |
title: "Device Not Supported", | |
message: "This device is not supported for premium videos. Please try on a flash enabled device." | |
}); | |
i.trigger(DM_Stats.ERROR, { | |
type: "api", | |
title: "Device Not Supported", | |
src: q.url | |
}); | |
return | |
} | |
if (q.id) { | |
if (this.video_id) { | |
this.event("unload", q.id) | |
} | |
this.event("load", q.id) | |
} | |
q.protocol = "progressive"; | |
this.video_id = q.id; | |
this.log_urls = x ? null : (q.log_view_urls ? q.log_view_urls : q.log_external_view_urls); | |
this.video_url = null; | |
this.resolveCDN = false; | |
if (q.stream_h264_url && this.quality != 240) { | |
this.video_url = q.stream_h264_url | |
} else { | |
if (q.stream_h264_ld_url) { | |
this.video_url = q.stream_h264_ld_url | |
} | |
} | |
var C = { | |
"240": "stream_h264_ld_url", | |
"380": "stream_h264_url", | |
"480": "stream_h264_hq_url", | |
"720": "stream_h264_hd_url", | |
"1080": "stream_h264_hd1080_url" | |
}; | |
var I = document.createElement("a"); | |
if (this.quality) { | |
var F, z, J, M, A; | |
z = Object.keys(C); | |
M = z.indexOf("" + this.quality); | |
for (A = M; A >= 0; A--) { | |
J = z[A]; | |
F = C[J]; | |
if (q[F]) { | |
this.video_url = q[F]; | |
break | |
} | |
} | |
} | |
if (this.video_url && this.video_url.match(/dailymotion\.com\/cdn\//)) { | |
I.href = this.video_url; | |
this.video_url += (I.search.length ? "&" : "?") + "helper=0" | |
} | |
if (q.mode == "live" && q.onair) { | |
m.one("progress.live", function () { | |
G.ui.loading(false) | |
}); | |
if (this.m.hls && q.stream_live_hls_url) { | |
q.protocol = "hls"; | |
this.video_url = q.stream_live_hls_url | |
} else { | |
if (q.stream_live_rtsp_url && this.m.android) { | |
q.protocol = "rtsp"; | |
this.video_url = q.stream_live_rtsp_url; | |
this.html5 = false; | |
this.resolveCDN = true | |
} else { | |
this.event("error", { | |
code: "device_not_supported", | |
title: "Device Not Supported", | |
message: "This device is not supported for this live event." | |
}); | |
i.trigger(DM_Stats.ERROR, { | |
type: "api", | |
title: "Device Not Supported", | |
src: q.url | |
}); | |
return | |
} | |
} | |
} else { | |
if (this.hls !== false && q.stream_hls_url) { | |
q.protocol = "hls"; | |
this.video_url = q.stream_hls_url; | |
var E = (this.quality || this.hls.default_quality); | |
I.href = this.video_url; | |
if (E) { | |
this.video_url += ((I.search.length ? "&" : "?") + "default=" + E) | |
} | |
} | |
} if (!this.video_url && q.empty !== true) { | |
this.event("error", { | |
code: "stream_not_found", | |
title: "Not Found", | |
message: "The video may have been deleted by its author." | |
}); | |
i.trigger(DM_Stats.ERROR, { | |
type: "api", | |
title: "Stream Not Found", | |
src: q.url | |
}); | |
return | |
} else { | |
if (q.empty === true) { | |
this.video_url = "" | |
} else { | |
I.href = this.video_url; | |
if (B.android) { | |
this.video_url += ((I.search.length ? "&" : "?") + (q.protocol === "hls" ? "v.m3u8" : "v.mp4")) | |
} | |
} | |
} if (!this.resolveCDN) { | |
this.resolveCDN = (q.protocol != "hls" && this.video_url && !! this.video_url.match(/dailymotion\.com\/cdn\//)) | |
} | |
if (x) { | |
this.resolveCDN = false | |
} | |
if (B.android && !(B.chrome || B.firefox)) { | |
this.resolveCDN = false | |
} | |
this.stats.trigger(DM_Stats.VIDEO_LOAD, [{ | |
category: "Video Infos", | |
action: "Protocol", | |
label: q.protocol | |
}]); | |
if (navigator.userAgent.match(/iPhone OS 3_/)) { | |
this.html5 = false | |
} | |
if (!this.html5) { | |
this.play() | |
} else { | |
if (this.m.ipad) { | |
m.css({ | |
top: "-10000px" | |
}) | |
} | |
m.attr("type", q.protocol === "hls" ? "application/vnd.apple.mpegurl" : "video/mp4").attr("src", this.video_url); | |
if (!this.inited) { | |
this.init(); | |
this.inited = true | |
} | |
} if (this.player) { | |
var L = (Modernizr.mobile || Modernizr.tablet) && !Modernizr.ios; | |
if ((this.forceFullscreen === "auto" || this.forceFullscreen === true) && this.player.webkitSupportsFullscreen && L) { | |
var H = $(window).width(), | |
y = $(window).height(), | |
K = (H > y) ? y : H; | |
if (this.forceFullscreen === true || K < 400) { | |
this.player.webkitEnterFullscreen() | |
} | |
} | |
m.one("playing.removeloading canplaythrough.removeloading", function (a) { | |
$(a.target).unbind(".removeloading"); | |
G.ui.initLoader(); | |
if (D) { | |
D() | |
} | |
}) | |
} | |
function N(a, b) { | |
if (a.target.currentTime > 0.3) { | |
i.trigger(DM_Stats.VIDEO_PLAYING, { | |
resolvedCDN: b.resolveCDN | |
}); | |
$(b.player).off("timeupdate.stats playing.stats") | |
} | |
} | |
i.trigger(DM_Stats.DIMENSIONS, { | |
width: window.innerWidth, | |
height: window.innerHeight | |
}); | |
i.trigger(DM_Stats.EMBEDDER, document.referrer); | |
m.off(".stats").one("play.stats", function () { | |
i.trigger(DM_Stats.VIDEO_START, { | |
resolvedCDN: G.resolveCDN | |
}) | |
}).on("play.stats", function (a) { | |
i.trigger(DM_Stats.CONTROLS_PLAY, { | |
currentTime: a.target.currentTime | |
}) | |
}).on("pause.stats", function (a) { | |
i.trigger(DM_Stats.CONTROLS_PAUSE, { | |
currentTime: a.target.currentTime | |
}) | |
}).on("playing.stats", function (a) { | |
N(a, G) | |
}).on("timeupdate.stats", function (a) { | |
N(a, G) | |
}).on("ended.stats", function () { | |
var a = G.currentTime(); | |
i.trigger(DM_Stats.VIDEO_END, { | |
currentTime: a | |
}); | |
i.trigger(DM_Stats.VIDEO_COMPLETED, { | |
currentTime: a | |
}) | |
}).on("seeking.stats", function (a) { | |
var b = { | |
currentTime: a.target.currentTime | |
}; | |
if (G.lastTime) { | |
b.lastTime = G.lastTime | |
} | |
i.trigger(DM_Stats.CONTROLS_SEEK, b) | |
}); | |
if (this.showRelatedEndScreen) { | |
this.ui.relatedEndScreen(false); | |
m.off(".related"); | |
if (!x) { | |
m.on("playing.related", function (a, b) { | |
m.off("playing.related"); | |
G.ui.relatedEndScreen(false); | |
setTimeout(function () { | |
DM.plugin("related", true) | |
}, 3000) | |
}); | |
m.on("ended.related", function (a, b) { | |
DM.plugin("related", true, function () { | |
G.ui.relatedEndScreen(q) | |
}) | |
}) | |
} | |
} | |
return this | |
}, | |
setAudience: function (b) {}, | |
logView: function () { | |
if (this.log_urls) { | |
for (var c in this.log_urls) { | |
if (c.match(/@/)) { | |
continue | |
} | |
var f = new Image(); | |
f.src = this.log_urls[c] | |
} | |
this.cancelFurtherLogView() | |
} | |
return this | |
}, | |
cancelFurtherLogView: function () { | |
this.log_urls = null | |
}, | |
fallback: function () { | |
this.html5 = false; | |
this.play() | |
}, | |
paused: function () { | |
return this.player && this.player.paused | |
}, | |
play: function () { | |
var f = this, | |
g = Modernizr; | |
function h() { | |
if (this.video_url === "" && this.player.src === "") { | |
return | |
} | |
this.player.play(); | |
if (g.ios && navigator.userAgent.match(/OS (?:[123]_|4_[01])/)) { | |
var b = $('<a href="#"></a>').click(function (c) { | |
if (f.player.src !== "") { | |
f.player.play() | |
} | |
c.preventDefault() | |
}).appendTo(this.ui.videoFrame()), | |
a = document.createEvent("MouseEvents"); | |
a.initMouseEvent("click", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null); | |
b.get(0).dispatchEvent(a); | |
b.remove() | |
} | |
setTimeout(function () { | |
f.logView() | |
}, 5000) | |
} | |
if (this.html5) { | |
if (this.resolveCDN) { | |
DM.utils.CDNResolver.resolve(this.video_url + "&redirect=0").resolved(function (a) { | |
f.stats.trigger(DM_Stats.VIDEO_RESOLVED_CDN, a); | |
f.player.src = a.split("#")[0] | |
}).always(function () { | |
h.bind(f)() | |
}) | |
} else { | |
h.bind(this)() | |
} | |
} else { | |
this.logView(); | |
this.event("play"); | |
if (g.sessionstorage) { | |
sessionStorage.dmPlayedVideoId = this.video_id | |
} | |
if (this.resolveCDN) { | |
$.ajax(this.video_url + "&redirect=0", { | |
success: function (a) { | |
window.top.location.href = a | |
} | |
}) | |
} else { | |
window.top.location.href = this.video_url | |
} | |
} | |
return this | |
}, | |
pause: function () { | |
if (!this.html5) { | |
return | |
} | |
if (!this.player) { | |
return | |
} | |
this.player.pause(); | |
return this | |
}, | |
seek: function (b) { | |
this.player.currentTime = b; | |
return this | |
}, | |
currentTime: function () { | |
return this.player ? this.player.currentTime : 0 | |
}, | |
fullscreen: function () { | |
if (this.player.webkitSupportsFullscreen) { | |
this.stats.trigger(DM_Stats.CONTROLS_FULLSCREEN); | |
this.player.webkitEnterFullScreen() | |
} | |
return this | |
}, | |
muted: function (b) { | |
this.player.muted = b; | |
this.stats.trigger(DM_Stats.CONTROLS_MUTED, b) | |
}, | |
volume: function (b) { | |
this.player.volume = b; | |
this.stats.trigger(DM_Stats.CONTROLS_VOLUME, b); | |
return this | |
} | |
}; | |
(function () { | |
var p, m, a, g, c, k, f, l, b, i, o, h, n = {}.hasOwnProperty, | |
j = function (t, r) { | |
for (var q in r) { | |
if (n.call(r, q)) { | |
t[q] = r[q] | |
} | |
} | |
function s() { | |
this.constructor = t | |
} | |
s.prototype = r.prototype; | |
t.prototype = new s(); | |
t.__super__ = r.prototype; | |
return t | |
}; | |
p = (function () { | |
q.setEvents = function (s) { | |
var u, t, r; | |
for (t = 0, r = s.length; t < r; t++) { | |
u = s[t]; | |
this[u] = u | |
} | |
}; | |
q.getInstance = function () { | |
return { | |
trigger: function () {} | |
} | |
}; | |
function q(r) { | |
q.setEvents(["SESSION_START", "SESSION_END", "EXIT"]); | |
q.setEvents(r); | |
this.managers = []; | |
this.filters = {}; | |
this.inited = false | |
} | |
q.prototype.register = function (r) { | |
this.managers.push(r) | |
}; | |
q.prototype.reset = function () { | |
this.map(function (r) { | |
r.reset() | |
}) | |
}; | |
q.prototype.defineInclusiveFilter = function (s, r) { | |
return this.filters[s] = { | |
inclusive: true, | |
events: r | |
} | |
}; | |
q.prototype.defineExclusiveFilter = function (s, r) { | |
return this.filters[s] = { | |
inclusive: false, | |
events: r | |
} | |
}; | |
q.prototype.trigger = function (s, r) { | |
if (!this.activeFilter || (this.activeFilter.inclusive === (this.activeFilter.events.indexOf(s) !== -1))) { | |
this.map(function (t) { | |
t.trigger(s, r) | |
}) | |
} | |
}; | |
q.prototype.enable = function () { | |
this.filter(null); | |
this.map(function (r) { | |
r.enabled = true | |
}) | |
}; | |
q.prototype.disable = function (r) { | |
this.filter(null); | |
this.map(function (s) { | |
s.enabled = false | |
}) | |
}; | |
q.prototype.filter = function (r) { | |
this.activeFilter = this.filters[r] || null | |
}; | |
q.prototype.map = function (r) { | |
var v, u, s, t; | |
t = this.managers; | |
for (u = 0, s = t.length; u < s; u++) { | |
v = t[u]; | |
r(v) | |
} | |
}; | |
return q | |
})(); | |
h = function (q) { | |
if (!q) { | |
return | |
} | |
return q.replace(/^\s+/g, "").replace(/\s+$/g, "") | |
}; | |
o = function (s) { | |
var r, u, t, x, w, v, q; | |
r = document.cookie.split(";"); | |
for (v = 0, q = r.length; v < q; v++) { | |
x = r[v]; | |
t = x.split("="); | |
u = h(t[0]); | |
w = h(t[1]); | |
if (u === s) { | |
return w | |
} | |
} | |
return null | |
}; | |
k = (function () { | |
function q() { | |
this.history = []; | |
this.data = {} | |
} | |
q.prototype.log = function () { | |
this.history.push(JSON.stringify(arguments)) | |
}; | |
q.prototype.hasLog = function (v) { | |
var s, u, r, t; | |
t = this.history; | |
for (u = 0, r = t.length; u < r; u++) { | |
s = t[u]; | |
if (~s.indexOf('"' + v + '"')) { | |
return true | |
} | |
} | |
return false | |
}; | |
q.prototype.save = function (r, s) { | |
this.data[r] = s | |
}; | |
q.prototype.get = function (r) { | |
if (r in this.data) { | |
return this.data[r] | |
} else { | |
return false | |
} | |
}; | |
q.prototype.has = function (r) { | |
return r in this.data | |
}; | |
return q | |
})(); | |
m = (function () { | |
function q() { | |
this._eventReceiver = document.createElement("a"); | |
this._measureTimeCounter = 0; | |
this._waitCounter = 0; | |
this._history = []; | |
this._lock = []; | |
this.session = new k(); | |
this.enabled = true | |
} | |
q.prototype.init = function () { | |
this.trigger(p.SESSION_START); | |
this.on(p.EXIT, function () { | |
this.trigger(p.SESSION_END) | |
}); | |
return this | |
}; | |
q.prototype.reset = function () { | |
var t, r, u, s; | |
if (this.session) { | |
this.trigger(p.SESSION_END) | |
} | |
this._eventReceiver = document.createElement("a"); | |
r = this._history; | |
for (u = 0, s = r.length; u < s; u++) { | |
t = r[u]; | |
if (t.once) { | |
this.one(t.events, t.callback) | |
} else { | |
this.on(t.events, t.callback) | |
} | |
} | |
this._history = []; | |
this.init(); | |
return this | |
}; | |
q.prototype.getSampling = function () { | |
this.sampling || (this.sampling = Math.floor(Math.random() * 100)); | |
return this.sampling | |
}; | |
q.prototype.isSampled = function (s, r) { | |
return this.getSampling() > parseInt(s, 10) | |
}; | |
q.prototype.setSampling = function (r) { | |
this.enabled = !this.isSampled(r); | |
return this | |
}; | |
q.prototype.on = function (v, s, y) { | |
var x, r, t, u, w = this; | |
if (typeof s === "function") { | |
y = s; | |
s = null | |
} | |
if (!y) { | |
return | |
} | |
r = $.isArray(v) ? v : [v]; | |
x = function () { | |
$(w._eventReceiver).on(r.join(" "), $.proxy(y, w)) | |
}; | |
if (s === null) { | |
x() | |
} else { | |
t = "sampling" in s && typeof s.sampling === "number" && this.isSampled(s.sampling); | |
u = "waitFor" in s; | |
if (u && !t) { | |
$(this._eventReceiver).one(s.waitFor, function () { | |
x() | |
}) | |
} | |
if (!t) { | |
x() | |
} | |
} | |
this._history.push({ | |
events: r, | |
callback: y | |
}); | |
return this | |
}; | |
q.prototype.one = function (t, s, u) { | |
var r; | |
r = $.isArray(t) ? t : [t]; | |
$(this._eventReceiver).one(r.join(" "), $.proxy(u, this)); | |
this._history.push({ | |
events: r, | |
callback: u, | |
once: true | |
}); | |
return this | |
}; | |
q.prototype.off = function (w, x) { | |
var t, s, v, r, u; | |
$(this._eventReceiver).off(w, x); | |
u = this._history; | |
for (t = v = 0, r = u.length; v < r; t = ++v) { | |
s = u[t]; | |
if (s.events === w && s.callback === x) { | |
this._history.splice(t, 1); | |
break | |
} | |
} | |
return this | |
}; | |
q.prototype.lock = function (r) { | |
this._lock.push(r) | |
}; | |
q.prototype.unlock = function (s) { | |
var r; | |
r = this._lock.indexOf(s); | |
if (~r) { | |
this._lock.splice(r, 1) | |
} | |
}; | |
q.prototype.trigger = function (t, s) { | |
var r; | |
r = ~this._lock.indexOf(t); | |
if (this.enabled && !r) { | |
try { | |
$(this._eventReceiver).triggerHandler(t, s) | |
} catch (u) { | |
t = u; | |
((typeof DM !== "undefined" && DM !== null ? DM.logger : void 0) || console || { | |
error: function () {} | |
}).error("" + t.name + ": " + t.message) | |
} | |
} | |
if (this.session) { | |
this.session.log(t, s) | |
} | |
return this | |
}; | |
q.prototype.onLoad = function (r) { | |
this.on(p.SESSION_START, r); | |
return this | |
}; | |
q.prototype.onUnload = function (r) { | |
this.on(p.SESSION_END, r); | |
return this | |
}; | |
q.prototype.measureTime = function (w, E, D, r) { | |
var u, x, B, A, t, C, s, z, v, y = this; | |
if (r == null) { | |
r = false | |
} | |
s = z = null; | |
x = B = null; | |
t = null; | |
A = "mt_" + this._measureTimeCounter++; | |
v = function (F) { | |
return ($.isArray(F) ? F : [F]).map(function (G) { | |
return "" + G + "." + A | |
}) | |
}; | |
C = v(w); | |
u = v(E); | |
this.on(C, function (G, F) { | |
if (!z) { | |
s = +new Date(); | |
z = true; | |
t = F | |
} | |
}); | |
this.on(u, function (H, F) { | |
var G; | |
if (!B) { | |
x = +new Date(); | |
G = x - s; | |
D.call(y, G, [t, F]); | |
if (!r) { | |
y.off("." + A) | |
} | |
B = true | |
} | |
}); | |
return this | |
}; | |
q.prototype.wait = function (s, v) { | |
var r, t, u = this; | |
t = "wait_" + this._waitCounter++; | |
s = s.map(function (w) { | |
return "" + w + "." + t | |
}); | |
r = s.length; | |
this.on(s, function () { | |
if (--r === 0) { | |
v.call(u); | |
u.off("." + t) | |
} | |
}) | |
}; | |
q.prototype.loadPlugin = function (w, x) { | |
var v, t, u, r; | |
t = false; | |
r = this; | |
v = document.createElement("script"); | |
v.type = "text/javascript"; | |
v.async = true; | |
v.src = w; | |
v.onload = v.onreadystatechange = function () { | |
var s = this; | |
if (!t && (!this.readyState || this.readyState === "loaded" || this.readyState === "complete")) { | |
t = true; | |
setTimeout(function () { | |
if (typeof x === "function") { | |
x() | |
} | |
return r.init() | |
}, 50); | |
v.onload = v.onreadystatechange = null; | |
if (v.parentNode) { | |
v.parentNode.removeChild(v) | |
} | |
} | |
}; | |
v.onerror = function () { | |
r.enabled = false | |
}; | |
u = document.getElementsByTagName("script")[0]; | |
u.parentNode.insertBefore(v, u) | |
}; | |
q._is_https = document.location.protocol === "https:"; | |
return q | |
})(); | |
g = (function () { | |
var q, r; | |
function s(t) { | |
if (!("account" in t)) { | |
return | |
} | |
if ( !! t.universal) { | |
return new r(t) | |
} else { | |
return new q(t) | |
} | |
} | |
q = (function (u) { | |
j(t, u); | |
function t(z) { | |
var x, y, w; | |
t.__super__.constructor.call(this); | |
for (x in z) { | |
w = z[x]; | |
this[x] = w | |
} | |
this._gaq = window._gaq || []; | |
if (!("_gaq" in window)) { | |
y = (this._is_https ? "https://ssl" : "http://www") + ".google-analytics.com/ga.js"; | |
this.loadPlugin(y) | |
} | |
this.track(["_setAccount", this.account]); | |
if (this.domain) { | |
this.track(["_setDomainName", this.domain]) | |
} | |
} | |
t.prototype.track = function (v) { | |
this._gaq.push(v); | |
return this | |
}; | |
t.prototype.setCustomVar = function (x, w, y, v) { | |
var z; | |
z = ["_setCustomVar", x, w, y]; | |
if (v) { | |
z.push(v) | |
} | |
this.track(z); | |
return this | |
}; | |
t.prototype.trackEvent = function (x, y, A, w, v) { | |
var z; | |
z = ["_trackEvent", x, y]; | |
if (A) { | |
z.push(A) | |
} | |
if (w) { | |
z.push(w) | |
} | |
if (v) { | |
z.push({ | |
nonInteraction: 1 | |
}) | |
} | |
this.track(z); | |
return this | |
}; | |
t.prototype.trackTiming = function (x, w, y, A, v) { | |
var z; | |
if ((0 < y && y < (1000 * 60 * 60))) { | |
z = ["_trackTiming", x, w, y]; | |
if (A) { | |
z.push(A) | |
} | |
if (v) { | |
z.push(v) | |
} | |
this.track(z) | |
} | |
return this | |
}; | |
t.prototype.trackPageview = function () { | |
this.track(["_trackPageview"]); | |
return this | |
}; | |
return t | |
})(m); | |
r = (function (u) { | |
j(t, u); | |
function t(y) { | |
var z, x, w; | |
t.__super__.constructor.call(this); | |
for (x in y) { | |
w = y[x]; | |
this[x] = w | |
} | |
if (!("ga" in window)) { | |
(function (B, C, F, E, D, A, v) { | |
B.GoogleAnalyticsObject = D; | |
B[D] = B[D] || function () { | |
(B[D].q = B[D].q || []).push(arguments) | |
}; | |
B[D].l = 1 * new Date(); | |
A = C.createElement(F); | |
v = C.getElementsByTagName(F)[0]; | |
A.async = 1; | |
A.src = E; | |
v.parentNode.insertBefore(A, v) | |
})(window, document, "script", "//www.google-analytics.com/analytics.js", "ga") | |
} | |
z = ["create", this.account]; | |
if ("sampleRate" in this) { | |
z.push({ | |
sampleRate: parseFloat(this.sampleRate, 10) | |
}) | |
} | |
this.track(z); | |
this.trackPageview() | |
} | |
t.prototype.track = function (v) { | |
window.ga.apply(window, v); | |
return this | |
}; | |
t.prototype.setCustomVar = function () { | |
return this | |
}; | |
t.prototype.trackEvent = function (x, y, A, w, v) { | |
var z; | |
z = ["send", "event", x, y]; | |
if (A) { | |
z.push(A) | |
} | |
if (w) { | |
z.push(w) | |
} | |
if (v) { | |
z.push({ | |
nonInteraction: 1 | |
}) | |
} | |
this.track(z); | |
return this | |
}; | |
t.prototype.trackTiming = function (x, w, y, A, v) { | |
var z; | |
if ((0 < y && y < (1000 * 60 * 60))) { | |
z = ["send", "timing", x, w, y]; | |
if (A) { | |
z.push(A) | |
} | |
if (v) { | |
z.push(v) | |
} | |
this.track(z) | |
} | |
return this | |
}; | |
t.prototype.trackPageview = function () { | |
this.track(["send", "pageview", { | |
hitCallback: function () {} | |
}]); | |
return this | |
}; | |
return t | |
})(m); | |
return s | |
})(); | |
f = (function (r) { | |
var s, q; | |
j(t, r); | |
function t(u) { | |
var v, w = this; | |
t.__super__.constructor.call(this); | |
v = "SiteCatalyst" in window; | |
if (!v) { | |
this.loadPlugin(u, function () { | |
if (window.SiteCatalyst) { | |
w.s = window.SiteCatalyst.getInstance() | |
} else { | |
w.enabled = false | |
} | |
}) | |
} else { | |
this.s = window.SiteCatalyst.getInstance() | |
} | |
this.queue = v ? false : []; | |
this.tempS = v ? false : {}; | |
this.media = (function (y) { | |
var x; | |
x = []; | |
return { | |
open: function (B, A, z) { | |
if (y.queue === false) { | |
y.s.Media.open(B, A, z) | |
} else { | |
x.push({ | |
action: "open", | |
args: [B, A, z] | |
}) | |
} | |
}, | |
play: function (A, z) { | |
if (y.queue === false) { | |
y.s.Media.play(A, z) | |
} else { | |
x.push({ | |
action: "play", | |
args: [A, z] | |
}) | |
} | |
}, | |
stop: function (A, z) { | |
if (y.queue === false) { | |
y.s.Media.stop(A, z) | |
} else { | |
x.push({ | |
action: "stop", | |
args: [A, z] | |
}) | |
} | |
}, | |
close: function (z) { | |
if (y.queue === false) { | |
y.s.Media.close(z) | |
} else { | |
x.push({ | |
action: "close", | |
args: [z] | |
}) | |
} | |
}, | |
flushQueue: function () { | |
var A, C, z, B; | |
v = y.s; | |
B = v.Media; | |
for (C = 0, z = x.length; C < z; C++) { | |
A = x[C]; | |
B[A.action].apply(B, A.args) | |
} | |
} | |
} | |
})(this) | |
} | |
t.prototype.init = function () { | |
t.__super__.init.call(this); | |
if (this.enabled) { | |
this.flushQueue(); | |
this.media.flushQueue() | |
} | |
}; | |
t.prototype.setRSID = function (u) { | |
if (!"SiteCatalyst" in window) { | |
return | |
} | |
this.s.un = u | |
}; | |
t.prototype.getSampling = function () { | |
var u; | |
u = o("ts"); | |
if (u !== null) { | |
this.sampling = +u.slice(2, 4) | |
} else { | |
this.sampling || (this.sampling = Math.floor(Math.random() * 100)) | |
} | |
return this.sampling | |
}; | |
t.prototype.set = function (u) { | |
$.extend((this.tempS ? this.tempS : this.s), u); | |
return this | |
}; | |
t.prototype.track = function (u) { | |
u || (u = {}); | |
if (this.queue === false) { | |
s.call(this, u) | |
} else { | |
this.queue.push({ | |
type: null, | |
data: u | |
}) | |
} | |
}; | |
t.prototype.trackEvent = function (u, v) { | |
u || (u = {}); | |
if (this.queue === false) { | |
q.call(this, u) | |
} else { | |
this.queue.push({ | |
type: "event", | |
data: u, | |
title: v | |
}) | |
} | |
}; | |
t.prototype.flushQueue = function () { | |
var w, v, y, u, x; | |
x = this.queue; | |
for (y = 0, u = x.length; y < u; y++) { | |
v = x[y]; | |
w = v.type !== "event" ? s : q; | |
w.call(this, v.data, v.title) | |
} | |
if (this.tempS) { | |
$.extend(this.s, this.tempS) | |
} | |
this.tempS = false; | |
this.queue = false; | |
return this | |
}; | |
t.prototype.reset = function () { | |
var u, w, v; | |
v = {}; | |
for (u = w = 1; w <= 75; u = ++w) { | |
v["prop" + u] = ""; | |
v["eVar" + u] = "" | |
} | |
this.set(v); | |
return this | |
}; | |
s = function (u) { | |
if (u) { | |
this.set(u) | |
} | |
this.s.t(); | |
this.reset() | |
}; | |
q = function (u, v) { | |
if (u) { | |
this.set(u) | |
} | |
this.s.tl(this.s, "o", v); | |
this.reset() | |
}; | |
return t | |
})(m); | |
l = (function (q) { | |
var s; | |
j(r, q); | |
function r() { | |
r.__super__.constructor.call(this); | |
this.queue = []; | |
this.global = { | |
log: 1 | |
} | |
} | |
r.prototype.extend = function (t) { | |
$.extend(this.global, t); | |
return this | |
}; | |
r.prototype.track = function (t) { | |
if (this.queue === false) { | |
s.call(this, t) | |
} else { | |
this.queue.push(t) | |
} | |
return this | |
}; | |
r.prototype.flushQueue = function () { | |
var u, w, t, v; | |
v = this.queue; | |
for (w = 0, t = v.length; w < t; w++) { | |
u = v[w]; | |
s.call(this, u) | |
} | |
this.queue = false; | |
return this | |
}; | |
s = function (u) { | |
var t; | |
$.extend(u, this.global); | |
u.cb = new Date().getTime(); | |
t = new Image(); | |
t.src = "http://www.dailymotion.com/sense/images/vs/tag.gif?" + $.param(u) | |
}; | |
return r | |
})(m); | |
a = (function (r) { | |
var s; | |
j(q, r); | |
q.prototype._pluginUrl = (q._is_https ? "https://sb" : "http://b") + ".scorecardresearch.com/beacon.js"; | |
function q(t, u) { | |
var w, v = this; | |
this.defaultData = t; | |
q.__super__.constructor.call(this); | |
u = u || this._pluginUrl; | |
w = window.COMSCORE; | |
this.queue = w ? false : []; | |
if (!w) { | |
this.loadPlugin(u, function () { | |
if (window.COMSCORE) { | |
v.flushQueue() | |
} | |
}) | |
} | |
} | |
q.prototype.track = function (t) { | |
var u; | |
u = t || "default"; | |
if (this.queue === false) { | |
s.call(this, u) | |
} else { | |
this.queue.push(u) | |
} | |
return this | |
}; | |
q.prototype.flushQueue = function () { | |
var x, w, u, z, t, y; | |
y = this.queue; | |
for (z = 0, t = y.length; z < t; z++) { | |
w = y[z]; | |
for (x in w) { | |
u = w[x]; | |
s.call(this, u) | |
} | |
} | |
this.queue = false; | |
return this | |
}; | |
s = function (u) { | |
var t, v = this; | |
t = window.COMSCORE.beacon; | |
if (u === "default") { | |
t(this.defaultData) | |
} else { | |
$.get("/comscore_video", { | |
video: u.id | |
}, function (w) { | |
if (w) { | |
t(w) | |
} | |
}) | |
} | |
}; | |
return q | |
})(m); | |
c = (function (s) { | |
var q, u, t; | |
j(r, s); | |
if (typeof DM !== "undefined" && DM !== null ? (u = DM.logger) != null ? u.getLogger : void 0 : void 0) { | |
q = DM.logger.getLogger("Pinba-Tracker", "color: green; font-weight: bold; font-size: 1.1em;") | |
} else { | |
if (console) { | |
q = console | |
} | |
} | |
function r() { | |
r.__super__.constructor.call(this); | |
this.queue = []; | |
this.params = { | |
xid: "undefined", | |
country: (typeof userEnv !== "undefined" && userEnv !== null ? userEnv.cc : void 0) ? userEnv.cc : "undefined", | |
as: (typeof userEnv !== "undefined" && userEnv !== null ? userEnv.as : void 0) ? userEnv.as : "undefined", | |
cell: "undefined", | |
proxy: "undefined", | |
comment: "undefined" | |
} | |
} | |
r.prototype.setVideoInfo = function (v) { | |
q.log("received video params :", v); | |
if (v.mode) { | |
this.mode = v.mode | |
} | |
if (v.xid) { | |
this.params.xid = v.xid | |
} | |
if (v.cell) { | |
this.params.cell = v.cell | |
} | |
if (v.proxy) { | |
this.params.proxy = v.proxy | |
} | |
if (v.comment) { | |
this.params.comment = v.comment | |
} | |
if (this.params.xid && this.mode) { | |
this.flushQueue() | |
} | |
}; | |
r.prototype.track = function (v) { | |
q.log("tracking :", v, "(queue is " + (this.queue ? "on" : "off") + ")"); | |
if (!$.isArray(v)) { | |
v = [v] | |
} | |
if (this.queue === false) { | |
t.call(this, v) | |
} else { | |
this.queue.push(v) | |
} | |
return this | |
}; | |
r.prototype.flushQueue = function () { | |
var x, y, w, v; | |
if (this.queue && this.queue.length) { | |
return this | |
} | |
q.log("Flushing queue, queue status :", this.queue); | |
v = this.queue; | |
for (y = 0, w = v.length; y < w; y++) { | |
x = v[y]; | |
t.call(this, x) | |
} | |
this.queue = false; | |
return this | |
}; | |
r.prototype.trackTiming = function (v, w) { | |
if ((0 < w && w < (1000 * 60 * 60))) { | |
this.track([v, w / 1000]) | |
} | |
return this | |
}; | |
t = function (y) { | |
var w, A, x, z, v; | |
w = y[0]; | |
z = y.length > 1 ? y[1] : void 0; | |
x = this.mode === "live" ? "live.html" : "vod.html"; | |
v = "http://www.dailymotion.com/track/" + x + "." + w; | |
A = z ? $.extend({}, this.params, { | |
t: z | |
}) : this.params; | |
$.extend(A, { | |
_n: Math.round(Math.random() * 100000000) | |
}); | |
$.get(v, A).fail(function () { | |
return q.warn("error", arguments) | |
}) | |
}; | |
return r | |
})(m); | |
i = (function (s) { | |
var r, u, t; | |
j(q, s); | |
if (typeof DM !== "undefined" && DM !== null ? (u = DM.logger) != null ? u.getLogger : void 0 : void 0) { | |
r = DM.logger.getLogger("eStats", "color: green; font-weight: bold; font-size: 1.1em;") | |
} else { | |
if (console) { | |
r = console | |
} | |
} | |
window._PJS = 0; | |
window._cmsJS = 0; | |
window._eStatDS = 1; | |
function q() { | |
q.__super__.constructor.call(this); | |
this.queue = []; | |
this.liveMode = false; | |
this.player = null; | |
this.info = null | |
} | |
q.prototype.setVideoInfo = function (z, x) { | |
var B, y, w, v, A = this; | |
this.info = z; | |
this.player = x; | |
if (!((v = this.info) != null ? v.serial : void 0)) { | |
this.info = null; | |
this.player = null; | |
return | |
} | |
if (typeof eStat_id === "undefined") { | |
window.eStat_PJS = function () { | |
r.log("eStat_PJS"); | |
if ((A.info != null) && (A.player != null)) { | |
return A.setVideoInfo(A.info, A.player) | |
} | |
}; | |
return | |
} | |
window.eStat_PJS = function () { | |
return r.log("eStat_PJS (empty)") | |
}; | |
eStat_id.serial(this.info.serial); | |
this.liveMode = this.info.mode === "live" && this.info.onair; | |
this.firstPlay = true; | |
this.ended = false; | |
r.log("got video info", this.info.serial, this.liveMode); | |
w = function () { | |
r.log("initEStat"); | |
eStat_ms.referenceUI(A.player, "DS", A.info.title, (0 < A.info.tags.length ? A.info.tags[0] : ""), (1 < A.info.tags.length ? A.info.tags[1] : ""), (2 < A.info.tags.length ? A.info.tags[2] : ""), (3 < A.info.tags.length ? A.info.tags[3] : ""), (4 < A.info.tags.length ? A.info.tags[4] : ""), A.info.channel, "", (function () { | |
return A.player.currentTime | |
})); | |
eStat_ms.TagDS(A.player).setUrl(A.info.url); | |
eStat_ms.TagDS(A.player).setPlayerNameVersion("DailymotionPlayer"); | |
eStat_ms.TagDS(A.player).setDuration(A.info.duration); | |
return A.flushQueue() | |
}; | |
if (window._cmsJS && window.DS) { | |
return w() | |
} else { | |
y = 0; | |
return B = setInterval((function () { | |
if (window._cmsJS && window.DS) { | |
w(); | |
return clearInterval(B) | |
} else { | |
if (y > 50) { | |
r.log("Cancel eStat load."); | |
return clearInterval(B) | |
} else { | |
r.log("can't init eStat yet..."); | |
return y += 1 | |
} | |
} | |
}), 50) | |
} | |
}; | |
q.prototype.track = function (w) { | |
var v; | |
if (!((v = this.info) != null ? v.serial : void 0)) { | |
return | |
} | |
if (this.queue === false) { | |
t.call(this, w) | |
} else { | |
this.queue.push(w) | |
} | |
return this | |
}; | |
q.prototype.flushQueue = function () { | |
var x, y, w, v; | |
if (this.queue === false) { | |
return this | |
} | |
r.log("Flushing queue, queue status :", this.queue); | |
v = this.queue; | |
for (y = 0, w = v.length; y < w; y++) { | |
x = v[y]; | |
t.call(this, x) | |
} | |
this.queue = false; | |
return this | |
}; | |
q.prototype.stopTracking = function () { | |
var v; | |
if (!((v = this.info) != null ? v.serial : void 0)) { | |
return | |
} | |
return typeof eStat_ms !== "undefined" && eStat_ms !== null ? eStat_ms.StopMeasurement(this.player) : void 0 | |
}; | |
t = function (w) { | |
var v; | |
v = null; | |
switch (w.state) { | |
case "play": | |
if (this.firstPlay) { | |
this.firstPlay = false | |
} else { | |
if (this.liveMode || this.ended) { | |
r.log("" + (this.liveMode ? "Live Mode" : "Video ended") + " : creating new eStat session"); | |
eStat_ms.newStreamUI(this.player, this.info.title, (0 < this.info.tags.length ? this.info.tags[0] : ""), (1 < this.info.tags.length ? this.info.tags[1] : ""), (2 < this.info.tags.length ? this.info.tags[2] : ""), (3 < this.info.tags.length ? this.info.tags[3] : ""), (4 < this.info.tags.length ? this.info.tags[4] : ""), this.liveMode ? "Live" : this.info.channel); | |
this.ended = false | |
} | |
} | |
v = eStatPlayState.Play; | |
break; | |
case "pause": | |
v = this.liveMode ? eStatPlayState.Stop : eStatPlayState.Pause; | |
break; | |
case "stop": | |
this.ended = true; | |
v = eStatPlayState.Stop | |
} | |
if (!w.pos) { | |
w.pos = this.player.currentTime | |
} | |
r.log("track :", ((function () { | |
switch (v) { | |
case eStatPlayState.Stop: | |
return "stop"; | |
case eStatPlayState.Pause: | |
return "pause"; | |
case eStatPlayState.Play: | |
return "play" | |
} | |
})()), w.pos); | |
return eStat_ms.TagDS(this.player).sendEvent(v, w.pos) | |
}; | |
return q | |
})(m); | |
b = (function (s) { | |
var q, t; | |
j(r, s); | |
if (typeof DM !== "undefined" && DM !== null ? (t = DM.logger) != null ? t.getLogger : void 0 : void 0) { | |
q = DM.logger.getLogger("Xiti", "color: green; font-weight: bold; font-size: 1.1em;") | |
} else { | |
if (console) { | |
q = console | |
} | |
} | |
function r() { | |
r.__super__.constructor.call(this); | |
this.queue = []; | |
this.config = null; | |
this.mediaControl = null; | |
this.videoElement = null | |
} | |
r.prototype.fire = function () { | |
var u; | |
u = this; | |
return function (v) { | |
if (u.enabled === false) { | |
return | |
} | |
q.log("fire", v); | |
return u.mediaControl.fire.call(this, v) | |
} | |
}; | |
r.prototype.seek = function () { | |
var u; | |
u = this; | |
return function (v) { | |
if (u.enabled === false) { | |
return | |
} | |
q.log("seek", v); | |
return u.mediaControl.seek.call(this, v) | |
} | |
}; | |
r.prototype.setVideoInfo = function (v, z, y) { | |
var B, x, w, u, A = this; | |
q.log("received video params :", z); | |
if ((typeof ATMedia === "undefined" || ATMedia === null) || !ATMedia.init) { | |
window.ATMediaReady = function () { | |
q.log("ATMediaReady! Calling setVideoInfo again"); | |
A.setVideoInfo(v, z, y) | |
}; | |
return | |
} | |
window.ATMediaReady = void 0; | |
x = this.fire(); | |
w = this.seek(); | |
B = function () { | |
var E, D, F, C; | |
E = ["playing", "pause", "ended"]; | |
for (F = 0, C = E.length; F < C; F++) { | |
D = E[F]; | |
A.videoElement.addEventListener(D, x, false) | |
} | |
return A.videoElement.addEventListener("seeked", w, false) | |
}; | |
u = function () { | |
var E, D, F, C; | |
E = ["playing", "pause", "ended"]; | |
for (F = 0, C = E.length; F < C; F++) { | |
D = E[F]; | |
A.videoElement.removeEventListener(D, x, false) | |
} | |
return A.videoElement.removeEventListener("seeked", w, false) | |
}; | |
if (this.config === null) { | |
this.config = v; | |
ATMedia.init(this.config) | |
} | |
if (this.mediaControl !== null && this.videoElement !== null) { | |
this.unbindEvents(); | |
ATMedia.removeMediaControl(this.mediaControl) | |
} | |
this.videoElement = y; | |
this.mediaControl = ATMedia.addMediaControl(this.videoElement, z); | |
B() | |
}; | |
return r | |
})(m); | |
window.DM_Stats = p; | |
window.DM_Stats_GoogleAnalytics = g; | |
window.DM_Stats_SiteCatalyst = f; | |
window.DM_Stats_VisualScience = l; | |
window.DM_Stats_ComScore = a; | |
window.DM_Stats_Pinba = c; | |
window.DM_Stats_eStats = i; | |
window.DM_Stats_Xiti = b | |
}).call(this); | |
(function (p) { | |
if (!("DM_Stats" in p)) { | |
return | |
} | |
var m = p.DM_Stats, | |
t = p.DM_Stats_GoogleAnalytics, | |
v = p.DM_Stats_SiteCatalyst, | |
w = p.DM_Stats_Pinba, | |
o = p.DM_Stats_ATInternet, | |
s = p.DM_Stats_eStats, | |
n = DM.logger.getLogger("Pinba-Events", "color: green; font-weight: bold; font-size: 1.1em;"); | |
var q = DM.utils.Location; | |
function u() { | |
var N, l; | |
N = ["CONTROLS_PLAY", "CONTROLS_PAUSE", "CONTROLS_FULLSCREEN", "CONTROLS_VOLUME", "CONTROLS_SEEK", "CONTROLS_MUTED", "CONTROLS_QUALITY", "CONTROLS_SHARE", "VIDEO_LOAD", "VIDEO_INFOS", "VIDEO_RESOLVED_CDN", "VIDEO_OPEN", "VIDEO_START", "VIDEO_PLAYING", "VIDEO_TIME_UPDATE", "VIDEO_PROGRESS", "VIDEO_WAITING", "VIDEO_END", "VIDEO_COMPLETED", "ERROR", "DIMENSIONS", "EMBEDDER", "AD_CALL_START", "AD_CALL_END", "AD_CALL_FAIL", "AD_INSTREAM_PLAY", "AD_INSTREAM_PLAYING", "AD_INSTREAM_SKIP", "AD_INSTREAM_CLICK", "AD_INSTREAM_ERROR", "AD_INSTREAM_TIMEOUT"]; | |
l = new m(N); | |
l.defineInclusiveFilter("adsonly", ["AD_CALL_START", "AD_CALL_END", "AD_CALL_FAIL", "AD_INSTREAM_PLAY", "AD_INSTREAM_PLAYING", "AD_INSTREAM_SKIP", "AD_INSTREAM_CLICK"]); | |
var L = new s(), | |
P = true; | |
L.on(m.VIDEO_INFOS, function (x, y) { | |
P = true; | |
var z = this; | |
DM.plugin("estat", (y.analytics && y.analytics.estat), function () { | |
z.setVideoInfo({ | |
serial: (y.analytics && y.analytics.estat) ? y.analytics.estat : undefined, | |
title: y.title, | |
tags: y.tags, | |
channel: y.channel, | |
duration: y.duration, | |
url: y.url | |
}, document.querySelector("video")) | |
}) | |
}); | |
L.on(m.VIDEO_TIME_UPDATE, function (x, y) { | |
if (P) { | |
P = false; | |
this.track({ | |
state: "play", | |
pos: y.currentTime | |
}) | |
} | |
}); | |
L.on([m.CONTROLS_PAUSE, m.CONTROLS_SEEK, m.VIDEO_WAITING], function (x, y) { | |
if (!P) { | |
P = true; | |
this.track({ | |
state: "pause", | |
pos: y.lastTime ? y.lastTime : y.currentTime | |
}) | |
} | |
}); | |
L.on(m.VIDEO_END, function (x, y) { | |
P = true; | |
this.track({ | |
state: "stop", | |
pos: y.currentTime | |
}); | |
this.stopTracking() | |
}); | |
l.register(L); | |
function O(A) { | |
var x = q.parse(A); | |
var y = q.parseQueryString(x.hash); | |
for (var B in y) { | |
var z; | |
if (y.hasOwnProperty(B) && Array.isArray(z = y[B])) { | |
y[B] = z[0] | |
} | |
} | |
y.proxy = x.hostname; | |
return y | |
} | |
var k = new w(); | |
k.on(m.VIDEO_INFOS, function (x, y) { | |
this.setVideoInfo({ | |
xid: y.id, | |
mode: y.mode | |
}) | |
}); | |
k.on(m.VIDEO_RESOLVED_CDN, function (y, z) { | |
var x = O(z); | |
this.setVideoInfo(x) | |
}); | |
k.measureTime(m.CONTROLS_PLAY, m.VIDEO_RESOLVED_CDN, function (x) { | |
this.trackTiming("stream.resolve", x) | |
}); | |
k.measureTime(m.AD_CALL_START, m.AD_CALL_END, function (x) { | |
this.trackTiming("adcall", x) | |
}); | |
k.on(m.AD_CALL_FAIL, function (x, y) { | |
this.track("adcall.failed") | |
}); | |
k.measureTime(m.AD_INSTREAM_PLAY, m.AD_INSTREAM_PLAYING, function (x) { | |
this.trackTiming("preroll", x) | |
}); | |
k.on(m.AD_INSTREAM_TIMEOUT, function (x, y) { | |
this.track("preroll.timeout") | |
}); | |
k.measureTime(m.VIDEO_START, m.VIDEO_PLAYING, function (x, y) { | |
if (Array.isArray(y) && y.length > 0 && typeof (d = y[1]).resolvedCDN === "boolean" && d.resolvedCDN) { | |
this.trackTiming("stream.play", x) | |
} else { | |
this.trackTiming("stream.resolveandplay", x) | |
} | |
}); | |
var I = (function () { | |
var T = 200, | |
E = 2 * 1000, | |
D = 0.5 * 1000, | |
x = null, | |
z = false, | |
C = false, | |
B = null, | |
y = null, | |
F = null; | |
function A() { | |
var Q = +(Date.now()); | |
if (!B) { | |
return | |
} | |
if (!z) { | |
if (y - Math.max(F, B) < E) { | |
n.log("Watcher: Steady Play not reached yet: ignoring"); | |
return | |
} | |
n.log("Watcher: Reached steady play : Start Tracking!"); | |
z = true; | |
return | |
} | |
if (!F) { | |
F = B | |
} | |
if (F > y && Q > F + D) { | |
n.log("Watcher: Got rebuffering!! Track this!"); | |
k.track("stream.rebuffering"); | |
U(); | |
C = true | |
} | |
} | |
function S(Q, R) { | |
if (x === null) { | |
n.log("Watcher: Starting rebuffering watcher"); | |
x = setInterval(A.bind(this), T); | |
C = false | |
} | |
} | |
function U(Q, R) { | |
if (x !== null) { | |
n.log("Watcher: Stoping rebuffering watcher"); | |
clearInterval(x); | |
x = null; | |
z = false; | |
B = null; | |
F = null; | |
y = null | |
} | |
} | |
return { | |
startWatch: function (Q, R) { | |
C = true | |
}, | |
stopWatch: function (Q, R) { | |
C = false; | |
U(Q, R) | |
}, | |
onTimeUpdate: function (Q, R) { | |
if (C) { | |
S(Q, R) | |
} | |
if (x === null) { | |
return | |
} | |
var V = +(Date.now()); | |
if (!B) { | |
B = V | |
} | |
y = V | |
}, | |
onWaiting: function (Q, R) { | |
F = +(Date.now()) | |
}, | |
onSeek: function (Q, R) { | |
C = true; | |
this.stopWatch(Q, R) | |
} | |
} | |
})(); | |
k.on([m.CONTROLS_PAUSE, m.VIDEO_END, m.VIDEO_LOAD], I.stopWatch.bind(I)); | |
k.on(m.CONTROLS_SEEK, I.onSeek.bind(I)); | |
k.on([m.VIDEO_PLAY, m.CONTROLS_PLAY, m.VIDEO_START], I.startWatch.bind(I)); | |
k.on(m.VIDEO_TIME_UPDATE, I.onTimeUpdate.bind(I)); | |
k.on(m.VIDEO_WAITING, I.onWaiting.bind(I)); | |
l.register(k); | |
var i = new t({ | |
universal: true, | |
account: "UA-36954025-4", | |
domain: "dailymotion.com", | |
sampleRate: 1 | |
}); | |
i.on(m.VIDEO_INFOS, function (x, y) { | |
this.session.save("video:duration", y.duration); | |
this.trackEvent("Video Infos", "Channel", y.channel, null, true).trackEvent("Video Infos", "Mode", y.mode, null, true).trackEvent("User Infos", "Time", (new Date().toTimeString()), null, true) | |
}); | |
i.on(m.VIDEO_LOAD, function (x, y) { | |
var z, A, B; | |
B = this; | |
for (z in y) { | |
A = y[z]; | |
this.trackEvent("Video Infos", z, A) | |
} | |
}); | |
i.measureTime(m.VIDEO_START, m.VIDEO_PLAYING, function (x) { | |
this.trackTiming("Video", "Loading time", x) | |
}); | |
i.measureTime(m.VIDEO_START, [m.VIDEO_END, m.SESSION_END, m.EXIT], function (x) { | |
var z = +this.session.get("video:duration") * 1000, | |
y = (x / z) * 100; | |
if (!y || y < 0) { | |
y = 0 | |
} else { | |
if (y > 100) { | |
y = 100 | |
} | |
} | |
this.trackTiming("Video", "Viewing time", y >> 0) | |
}); | |
i.one(m.CONTROLS_PLAY, function (x, y) { | |
this.trackEvent("Controls", "Play") | |
}); | |
i.one(m.VIDEO_PLAYING, function (x, y) { | |
this.trackEvent("Video Player", "Playing") | |
}); | |
i.one(m.VIDEO_COMPLETED, function (x, y) { | |
this.trackEvent("Video Player", "Completed") | |
}); | |
i.on(m.ERROR, function (y, z) { | |
var A, x; | |
if ("type" in z) { | |
A = z.type == "player" ? "Error Player" : "Error API"; | |
x = z.src.split("?")[0]; | |
this.trackEvent(A, z.label, x) | |
} | |
}); | |
l.register(i); | |
var J = function (x) { | |
if (!x) { | |
return | |
} | |
return x.replace(/^\s+/g, "").replace(/\s+$/g, "") | |
}; | |
var G = function (A) { | |
var B, y, z, D, E, x, C; | |
B = document.cookie.split(";"); | |
for (x = 0, C = B.length; x < C; x++) { | |
D = B[x]; | |
z = D.split("="); | |
y = J(z[0]); | |
E = J(z[1]); | |
if (y === A) { | |
return E | |
} | |
} | |
return null | |
}; | |
var c = function (x) { | |
var y; | |
y = G("ts"); | |
if (y !== null) { | |
return +y.slice(2, 4) < x | |
} | |
return false | |
}; | |
var g = document.referrer, | |
h = g.match(/https?:\/\/([^\/]+)\.dailymotion\.com/), | |
H = !h, | |
b = (h && h.length > 1) ? (h[1].search("touch") === 0) : (Modernizr.ua_mobile || Modernizr.ua_tablet), | |
K = b ? "dailymotionmobilevid" : "dailymotionoffsite", | |
M, j; | |
if (!H) { | |
var a = c(25); | |
if (b) { | |
K = a ? "dailymotionmobile" : "dailymotionmobilevid" | |
} else { | |
K = a ? "dailymotionweb" : "dailymotionwebvid" | |
} | |
} | |
K += p.ENV; | |
p.s_account = K; | |
M = H ? 0 : 25; | |
j = DM.config("stats"); | |
var f = new v(j.s_account_url); | |
f.on(m.VIDEO_INFOS, function (E, V) { | |
var C, Y, Z, z, B, F, X, D, A; | |
X = V.available_formats || ["sd"]; | |
Y = []; | |
Y.push("ads:" + (V.ads ? "y" : "n")); | |
Y.push("auditude:" + (this.session.has("auditude") ? "y" : "n")); | |
Y.push("encoding:" + X.pop()); | |
Y.push("explicit:" + (V.explicit ? "y" : "n")); | |
Y.push("vod:" + (V.mode === "vod" ? "y" : "n")); | |
Z = []; | |
Z.push("isrc:" + (V.isrc ? V.isrc : "n")); | |
Z.push("muyap:" + (V.muyap ? V.muyap : "n")); | |
var W = +new Date(), | |
aa = new Date(V.created_time * 1000), | |
x = new Date(W - aa).getTime() / (1000 * 60 * 60 * 24); | |
var y = (function (S) { | |
var T = S.referrer, | |
R = S.createElement("a"), | |
Q = [T]; | |
R.href = T; | |
Q.push(R.protocol + "//" + R.hostname); | |
return Q.join(" | ") | |
}(document)); | |
A = j.userEnv; | |
this.set({ | |
prop3: A.version, | |
eVar3: "D=c3", | |
prop4: A.cc, | |
eVar4: "D=c4", | |
eVar7: j.s_server_time, | |
prop9: "Video", | |
eVar10: "D=c9", | |
prop12: H ? "external" : "internal", | |
eVar15: "D=c12", | |
prop13: y, | |
eVar16: "D=c13", | |
prop14: V.channel, | |
eVar17: "D=c14", | |
prop15: "[syndication]", | |
eVar18: "D=c15", | |
prop16: "[parent account]", | |
eVar19: "D=c16", | |
prop17: V.mode, | |
eVar20: "D=c17", | |
prop18: V.owner_username, | |
eVar21: "D=c18", | |
prop19: V["owner.type"], | |
eVar22: "D=c19", | |
prop20: V.type, | |
eVar23: "D=c20", | |
prop21: V.id, | |
eVar24: "D=c21", | |
prop22: V.title, | |
eVar25: "D=c22", | |
prop23: H ? "HTML5 | Iframe" : "HTML5", | |
eVar26: "D=c23", | |
prop24: Y.join("|"), | |
eVar27: "D=c24", | |
prop25: Z.join("|"), | |
eVar28: "D=c25", | |
prop27: H ? "Offsite/Player" : "video page", | |
eVar30: "D=c27", | |
prop28: V.language, | |
eVar31: "D=c28", | |
prop29: null, | |
eVar32: "D=c29", | |
prop30: V["private"] ? "private" : "public", | |
eVar33: "D=c3", | |
prop45: x | 0, | |
eVar63: "D=c45", | |
prop46: V.duration, | |
eVar64: "D=c46" | |
}); | |
this.session.save("video:title", V.title); | |
this.session.save("video:infos", V) | |
}); | |
f.on(m.VIDEO_LOAD, function (x, y) { | |
var z, A, B; | |
B = this; | |
for (z in y) { | |
A = y[z]; | |
this.session.save(z, A) | |
} | |
}); | |
f.on(m.VIDEO_START, function (x, y) { | |
var z = this.session.get("video:infos"); | |
this.media.open(z.title, z.duration, "Dailymotion Video Player"); | |
this.media.play(this.session.get("video:title"), 0) | |
}); | |
f.on(m.CONTROLS_PLAY, { | |
waitFor: m.VIDEO_START, | |
sampling: M | |
}, function (x, y) { | |
this.media.play(this.session.get("video:title"), Math.round(y.currentTime)) | |
}); | |
f.on([m.CONTROLS_PAUSE, m.VIDEO_END], { | |
sampling: M | |
}, function (x, y) { | |
this.media.stop(this.session.get("video:title"), Math.round(y.currentTime)) | |
}); | |
f.on(m.CONTROLS_FULLSCREEN, function (x, y) { | |
this.session.save("controls:fullscreen", 1) | |
}); | |
f.on(m.CONTROLS_VOLUME, function (x, y) { | |
this.session.save("controls:volume", y) | |
}); | |
f.on(m.CONTROLS_QUALITY, function (y, x) { | |
this.session.save("controls:quality", x) | |
}); | |
f.on(m.VIDEO_COMPLETED, { | |
sampling: M | |
}, function (B, D) { | |
var A = this.session, | |
F, y, z, E, C, x, Q; | |
F = []; | |
y = A.has("controls:fullscreen") ? "y" : "n"; | |
F.push("fullscreen:" + y); | |
z = A.has("controls:quality") ? "y" : "n"; | |
F.push("quality:" + z); | |
E = "n"; | |
F.push("export:" + E); | |
C = "n"; | |
F.push("subtitles:" + C); | |
x = A.has("controls:volume") ? "y" : "n"; | |
F.push("volume:" + x); | |
Q = A.has("controls:share") ? "y" : "n"; | |
F.push("share:" + Q); | |
this.set({ | |
prop26: F.join("|"), | |
eVar29: "D=c26" | |
}); | |
this.media.close(A.get("video:title")) | |
}); | |
l.register(f); | |
dm_xiti = new DM_Stats_Xiti(); | |
dm_xiti.on(m.VIDEO_INFOS, function (x, y) { | |
if (!y.analytics || !y.analytics.xiti) { | |
return | |
} | |
var B = this, | |
z = y.analytics.xiti, | |
A = DM.playerOptions.get("id"); | |
if (!A) { | |
A = undefined | |
} | |
DM.plugin("xiti", true, function () { | |
var C = { | |
xtsite: z.website_id, | |
xtsd: z.subdomain.replace(/https?:\/\//, ""), | |
xtn2: z.second_level_id, | |
xtinternaldom: z.internal_domain.split("|"), | |
refresh: 10 | |
}; | |
var D = { | |
xttype: "video", | |
xtplayer: A, | |
xtrichname: y.id + "_" + y.title, | |
xtduration: y.duration, | |
xtmode: y.mode === "live" ? "live" : "clip", | |
xtquality: "", | |
xtstream: "", | |
xtextension: "9" | |
}; | |
B.setVideoInfo(C, D, document.querySelector("video")) | |
}) | |
}); | |
l.register(dm_xiti); | |
return l | |
} | |
m.getInstance = function r() { | |
if (!this.instance) { | |
this.instance = u() | |
} | |
return this.instance | |
} | |
})(window); | |
(function (b) { | |
if ("function" == typeof bootstrap) { | |
bootstrap("dmvast", b) | |
} else { | |
if ("object" == typeof exports) { | |
module.exports = b() | |
} else { | |
if ("function" == typeof define && define.amd) { | |
define(b) | |
} else { | |
if ("undefined" != typeof ses) { | |
if (!ses.ok()) { | |
return | |
} | |
ses.makeDMVAST = b | |
} else { | |
"undefined" != typeof window ? window.DMVAST = b() : global.DMVAST = b() | |
} | |
} | |
} | |
} | |
})(function () { | |
var h, g, i, j, f; | |
return (function (b, n, a) { | |
function o(r, k) { | |
if (!n[r]) { | |
if (!b[r]) { | |
var s = typeof require == "function" && require; | |
if (!k && s) { | |
return s(r, !0) | |
} | |
if (c) { | |
return c(r, !0) | |
} | |
throw new Error("Cannot find module '" + r + "'") | |
} | |
var l = n[r] = { | |
exports: {} | |
}; | |
b[r][0].call(l.exports, function (q) { | |
var p = b[r][1][q]; | |
return o(p ? p : q) | |
}, l, l.exports) | |
} | |
return n[r].exports | |
} | |
var c = typeof require == "function" && require; | |
for (var m = 0; m < a.length; m++) { | |
o(a[m]) | |
} | |
return o | |
})({ | |
1: [ | |
function (b, a, c) { | |
a.exports = { | |
client: b("./client.coffee"), | |
tracker: b("./tracker.coffee"), | |
parser: b("./parser.coffee"), | |
util: b("./util.coffee") | |
} | |
}, { | |
"./client.coffee": 2, | |
"./tracker.coffee": 3, | |
"./parser.coffee": 4, | |
"./util.coffee": 5 | |
} | |
], | |
2: [ | |
function (l, c, m) { | |
var n, b, a; | |
b = l("./parser.coffee"); | |
a = l("./util.coffee"); | |
n = (function () { | |
function k() {} | |
k.cappingFreeLunch = 0; | |
k.cappingMinimumTimeInterval = 0; | |
k.timeout = 0; | |
k.get = function (s, q) { | |
var t, r = this; | |
t = +new Date(); | |
if (this.totalCallsTimeout < t) { | |
this.totalCalls = 1; | |
this.totalCallsTimeout = t + (60 * 60 * 1000) | |
} else { | |
this.totalCalls++ | |
} if (this.cappingFreeLunch >= this.totalCalls) { | |
q(null); | |
return | |
} | |
if (t - this.lastSuccessfullAd < this.cappingMinimumTimeInterval) { | |
q(null); | |
return | |
} | |
return b.parse(s, function (o) { | |
return q(o) | |
}) | |
}; | |
(function () { | |
var o, p; | |
p = a.storage; | |
o = Object.defineProperty; | |
["lastSuccessfullAd", "totalCalls", "totalCallsTimeout"].forEach(function (q) { | |
o(k, q, { | |
get: function () { | |
return p.getItem(q) | |
}, | |
set: function (r) { | |
return p.setItem(q, r) | |
}, | |
configurable: false, | |
enumerable: true | |
}) | |
}); | |
if (k.totalCalls == null) { | |
k.totalCalls = 0 | |
} | |
if (k.totalCallsTimeout == null) { | |
k.totalCallsTimeout = 0 | |
} | |
})(); | |
return k | |
})(); | |
c.exports = n | |
}, { | |
"./parser.coffee": 4, | |
"./util.coffee": 5 | |
} | |
], | |
5: [ | |
function (c, b, k) { | |
var a; | |
a = (function () { | |
function l() {} | |
l.track = function (w, v) { | |
var u, z, y, x, s, t; | |
z = this.resolveURLTemplates(w, v); | |
t = []; | |
for (x = 0, s = z.length; x < s; x++) { | |
u = z[x]; | |
if (typeof window !== "undefined" && window !== null) { | |
y = new Image(); | |
t.push(y.src = u) | |
} else {} | |
} | |
return t | |
}; | |
l.resolveURLTemplates = function (C, F) { | |
var G, B, A, D, y, H, x, z, I, E, J; | |
B = []; | |
if (F == null) { | |
F = {} | |
} | |
if (!("CACHEBUSTING" in F)) { | |
F.CACHEBUSTING = Math.round(Math.random() * 10000000000) | |
} | |
F.random = F.CACHEBUSTING; | |
for (x = 0, I = C.length; x < I; x++) { | |
G = C[x]; | |
y = G; | |
J = ["CACHEBUSTING", "random", "CONTENTPLAYHEAD", "ASSETURI", "ERRORCODE"]; | |
for (z = 0, E = J.length; z < E; z++) { | |
D = J[z]; | |
A = "[" + D + "]"; | |
H = F[D]; | |
y = y.replace(A, H) | |
} | |
B.push(y) | |
} | |
return B | |
}; | |
l.storage = (function () { | |
var o, q, r; | |
try { | |
r = typeof window !== "undefined" && window !== null ? window.localStorage || window.sessionStorage : null | |
} catch (p) { | |
r = null | |
} | |
q = function (s) { | |
var m; | |
try { | |
m = "__VASTUtil__"; | |
s.setItem(m, m); | |
if (s.getItem(m) !== m) { | |
return true | |
} | |
} catch (n) { | |
return true | |
} | |
return false | |
}; | |
if (!(r != null) || q(r)) { | |
o = {}; | |
r = { | |
length: 0, | |
getItem: function (m) { | |
return o[m] | |
}, | |
setItem: function (n, m) { | |
o[n] = m; | |
this.length = Object.keys(o).length | |
}, | |
removeItem: function (m) { | |
delete o[m]; | |
this.length = Object.keys(o).length | |
}, | |
clear: function () { | |
o = {}; | |
this.length = 0 | |
} | |
} | |
} | |
return r | |
})(); | |
return l | |
})(); | |
b.exports = a | |
}, {} | |
], | |
3: [ | |
function (t, u, r) { | |
var a, p, v, q, b, c = Object.prototype.hasOwnProperty, | |
s = function (k, m) { | |
for (var n in m) { | |
if (c.call(m, n)) { | |
k[n] = m[n] | |
} | |
} | |
function l() { | |
this.constructor = k | |
} | |
l.prototype = m.prototype; | |
k.prototype = new l; | |
k.__super__ = m.prototype; | |
return k | |
}; | |
p = t("./client.coffee"); | |
b = t("./util.coffee"); | |
v = t("./creative.coffee").VASTCreativeLinear; | |
a = t("events").EventEmitter; | |
q = (function (k) { | |
s(l, k); | |
function l(n, x) { | |
var w, o, m; | |
this.ad = n; | |
this.creative = x; | |
this.muted = false; | |
this.impressed = false; | |
this.skipable = false; | |
this.skipDelayDefault = -1; | |
this.trackingEvents = {}; | |
m = x.trackingEvents; | |
for (w in m) { | |
o = m[w]; | |
this.trackingEvents[w] = o.slice(0) | |
} | |
if (x instanceof v) { | |
this.assetDuration = x.duration; | |
this.skipDelay = x.skipDelay; | |
this.linear = true; | |
this.clickThroughURLTemplate = x.videoClickThroughURLTemplate; | |
this.clickTrackingURLTemplate = x.videoClickTrackingURLTemplate | |
} else { | |
this.skipDelay = -1; | |
this.linear = false | |
} | |
this.on("start", function () { | |
p.lastSuccessfullAd = +new Date() | |
}) | |
} | |
l.prototype.setProgress = function (z) { | |
var A, y, o, m, n, B; | |
m = this.skipDelay === null ? this.skipDelayDefault : this.skipDelay; | |
if (m !== -1 && !this.skipable) { | |
if (m > z) { | |
this.emit("skip-countdown", m - z) | |
} else { | |
this.skipable = true; | |
this.emit("skip-countdown", 0) | |
} | |
} | |
if (this.linear && this.assetDuration > 0) { | |
y = []; | |
if (z > 0) { | |
y.push("start"); | |
o = Math.round(z / this.assetDuration * 100); | |
y.push("progress-" + o + "%"); | |
if (o >= 25) { | |
y.push("firstQuartile") | |
} | |
if (o >= 50) { | |
y.push("midpoint") | |
} | |
if (o >= 75) { | |
y.push("thirdQuartile") | |
} | |
if (o >= 100) { | |
y.push("complete") | |
} | |
} | |
for (n = 0, B = y.length; n < B; n++) { | |
A = y[n]; | |
this.track(A); | |
delete this.trackingEvents[A] | |
} | |
if (z < this.progress) { | |
this.track("rewind") | |
} | |
} | |
return this.progress = z | |
}; | |
l.prototype.setMuted = function (m) { | |
if (this.muted !== m) { | |
this.track(m ? "muted" : "unmuted") | |
} | |
return this.muted = m | |
}; | |
l.prototype.setPaused = function (m) { | |
if (this.paused !== m) { | |
this.track(m ? "pause" : "resume") | |
} | |
return this.paused = m | |
}; | |
l.prototype.setFullscreen = function (m) { | |
if (this.fullscreen !== m) { | |
this.track(m ? "fullscreen" : "exitFullscreen") | |
} | |
return this.fullscreen = m | |
}; | |
l.prototype.setSkipDelay = function (m) { | |
if (typeof m === "number") { | |
return this.skipDelay = m | |
} | |
}; | |
l.prototype.load = function () { | |
if (!this.impressed) { | |
this.impressed = true; | |
this.trackURLs(this.ad.impressionURLTemplates); | |
return this.track("creativeView") | |
} | |
}; | |
l.prototype.errorWithCode = function (m) { | |
return this.trackURLs(this.ad.errorURLTemplates, { | |
ERRORCODE: m | |
}) | |
}; | |
l.prototype.stop = function () { | |
return this.track(this.linear ? "cloaseLinear" : "close") | |
}; | |
l.prototype.skip = function () { | |
this.track("skip"); | |
return this.trackingEvents = [] | |
}; | |
l.prototype.click = function () { | |
var n, m; | |
if (this.clickTrackingURLTemplate != null) { | |
this.trackURLs(this.clickTrackingURLTemplate) | |
} | |
if (this.clickThroughURLTemplate != null) { | |
if (this.linear) { | |
m = { | |
CONTENTPLAYHEAD: this.progressFormated() | |
} | |
} | |
n = b.resolveURLTemplates([this.clickThroughURLTemplate], m)[0]; | |
return this.emit("clickthrough", n) | |
} | |
}; | |
l.prototype.track = function (m) { | |
var n; | |
n = this.trackingEvents[m]; | |
if (n != null) { | |
this.emit(m, ""); | |
return this.trackURLs(n) | |
} | |
}; | |
l.prototype.trackURLs = function (n, m) { | |
if (m == null) { | |
m = {} | |
} | |
if (this.linear) { | |
m.CONTENTPLAYHEAD = this.progressFormated() | |
} | |
return b.track(n, m) | |
}; | |
l.prototype.progressFormated = function () { | |
var n, y, x, o, m; | |
m = parseInt(this.progress); | |
n = m / (60 * 60); | |
if (n.length < 2) { | |
n = "0" + n | |
} | |
y = m / 60 % 60; | |
if (y.length < 2) { | |
y = "0" + y | |
} | |
o = m % 60; | |
if (o.length < 2) { | |
o = "0" + y | |
} | |
x = parseInt((this.progress - m) * 100); | |
return "" + n + ":" + y + ":" + o + "." + x | |
}; | |
return l | |
})(a); | |
u.exports = q | |
}, { | |
events: 6, | |
"./client.coffee": 2, | |
"./util.coffee": 5, | |
"./creative.coffee": 7 | |
} | |
], | |
8: [ | |
function (c, b, k) { | |
var a = b.exports = {}; | |
a.nextTick = (function () { | |
var p = typeof window !== "undefined" && window.setImmediate; | |
var n = typeof window !== "undefined" && window.postMessage && window.addEventListener; | |
if (p) { | |
return function (l) { | |
return window.setImmediate(l) | |
} | |
} | |
if (n) { | |
var q = []; | |
window.addEventListener("message", function (l) { | |
if (l.source === window && l.data === "process-tick") { | |
l.stopPropagation(); | |
if (q.length > 0) { | |
var m = q.shift(); | |
m() | |
} | |
} | |
}, true); | |
return function o(l) { | |
q.push(l); | |
window.postMessage("process-tick", "*") | |
} | |
} | |
return function o(l) { | |
setTimeout(l, 0) | |
} | |
})(); | |
a.title = "browser"; | |
a.browser = true; | |
a.env = {}; | |
a.argv = []; | |
a.binding = function (l) { | |
throw new Error("process.binding is not supported") | |
}; | |
a.cwd = function () { | |
return "/" | |
}; | |
a.chdir = function (l) { | |
throw new Error("process.chdir is not supported") | |
} | |
}, {} | |
], | |
6: [ | |
function (b, a, c) { | |
(function (n) { | |
if (!n.EventEmitter) { | |
n.EventEmitter = function () {} | |
} | |
var o = c.EventEmitter = n.EventEmitter; | |
var r = typeof Array.isArray === "function" ? Array.isArray : function (k) { | |
return Object.prototype.toString.call(k) === "[object Array]" | |
}; | |
function p(l, m) { | |
if (l.indexOf) { | |
return l.indexOf(m) | |
} | |
for (var k = 0; k < l.length; k++) { | |
if (m === l[k]) { | |
return k | |
} | |
} | |
return -1 | |
} | |
var q = 10; | |
o.prototype.setMaxListeners = function (k) { | |
if (!this._events) { | |
this._events = {} | |
} | |
this._events.maxListeners = k | |
}; | |
o.prototype.emit = function (k) { | |
if (k === "error") { | |
if (!this._events || !this._events.error || (r(this._events.error) && !this._events.error.length)) { | |
if (arguments[1] instanceof Error) { | |
throw arguments[1] | |
} else { | |
throw new Error("Uncaught, unspecified 'error' event.") | |
} | |
return false | |
} | |
} | |
if (!this._events) { | |
return false | |
} | |
var l = this._events[k]; | |
if (!l) { | |
return false | |
} | |
if (typeof l == "function") { | |
switch (arguments.length) { | |
case 1: | |
l.call(this); | |
break; | |
case 2: | |
l.call(this, arguments[1]); | |
break; | |
case 3: | |
l.call(this, arguments[1], arguments[2]); | |
break; | |
default: | |
var u = Array.prototype.slice.call(arguments, 1); | |
l.apply(this, u) | |
} | |
return true | |
} else { | |
if (r(l)) { | |
var u = Array.prototype.slice.call(arguments, 1); | |
var m = l.slice(); | |
for (var t = 0, v = m.length; t < v; t++) { | |
m[t].apply(this, u) | |
} | |
return true | |
} else { | |
return false | |
} | |
} | |
}; | |
o.prototype.addListener = function (l, k) { | |
if ("function" !== typeof k) { | |
throw new Error("addListener only takes instances of Function") | |
} | |
if (!this._events) { | |
this._events = {} | |
} | |
this.emit("newListener", l, k); | |
if (!this._events[l]) { | |
this._events[l] = k | |
} else { | |
if (r(this._events[l])) { | |
if (!this._events[l].warned) { | |
var m; | |
if (this._events.maxListeners !== undefined) { | |
m = this._events.maxListeners | |
} else { | |
m = q | |
} if (m && m > 0 && this._events[l].length > m) { | |
this._events[l].warned = true; | |
console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.", this._events[l].length); | |
console.trace() | |
} | |
} | |
this._events[l].push(k) | |
} else { | |
this._events[l] = [this._events[l], k] | |
} | |
} | |
return this | |
}; | |
o.prototype.on = o.prototype.addListener; | |
o.prototype.once = function (m, k) { | |
var s = this; | |
s.on(m, function l() { | |
s.removeListener(m, l); | |
k.apply(this, arguments) | |
}); | |
return this | |
}; | |
o.prototype.removeListener = function (m, k) { | |
if ("function" !== typeof k) { | |
throw new Error("removeListener only takes instances of Function") | |
} | |
if (!this._events || !this._events[m]) { | |
return this | |
} | |
var l = this._events[m]; | |
if (r(l)) { | |
var s = p(l, k); | |
if (s < 0) { | |
return this | |
} | |
l.splice(s, 1); | |
if (l.length == 0) { | |
delete this._events[m] | |
} | |
} else { | |
if (this._events[m] === k) { | |
delete this._events[m] | |
} | |
} | |
return this | |
}; | |
o.prototype.removeAllListeners = function (k) { | |
if (arguments.length === 0) { | |
this._events = {}; | |
return this | |
} | |
if (k && this._events && this._events[k]) { | |
this._events[k] = null | |
} | |
return this | |
}; | |
o.prototype.listeners = function (k) { | |
if (!this._events) { | |
this._events = {} | |
} | |
if (!this._events[k]) { | |
this._events[k] = [] | |
} | |
if (!r(this._events[k])) { | |
this._events[k] = [this._events[k]] | |
} | |
return this._events[k] | |
} | |
})(b("__browserify_process")) | |
}, { | |
__browserify_process: 8 | |
} | |
], | |
4: [ | |
function (t, u, r) { | |
var v, q, w, x, s, b, c, a = Array.prototype.indexOf || function (k) { | |
for (var l = 0, m = this.length; l < m; l++) { | |
if (l in this && this[l] === k) { | |
return l | |
} | |
} | |
return -1 | |
}; | |
v = t("./urlhandler.coffee"); | |
b = t("./response.coffee"); | |
q = t("./ad.coffee"); | |
c = t("./util.coffee"); | |
w = t("./creative.coffee").VASTCreativeLinear; | |
x = t("./mediafile.coffee"); | |
s = (function () { | |
var l; | |
function k() {} | |
l = []; | |
k.addURLTemplateFilter = function (m) { | |
if (typeof m === "function") { | |
l.push(m) | |
} | |
}; | |
k.removeURLTemplateFilter = function () { | |
return l.pop() | |
}; | |
k.countURLTemplateFilters = function () { | |
return l.length | |
}; | |
k.clearUrlTemplateFilters = function () { | |
return l = [] | |
}; | |
k.parse = function (m, n) { | |
return this._parse(m, null, function (o, p) { | |
return n(p) | |
}) | |
}; | |
k._parse = function (o, z, A) { | |
var n, m, p, B = this; | |
for (m = 0, p = l.length; m < p; m++) { | |
n = l[m]; | |
o = n(o) | |
} | |
if (z == null) { | |
z = [] | |
} | |
z.push(o); | |
return v.get(o, function (W, S) { | |
var Q, N, R, M, U, V, X, O, P, T, y; | |
if (W != null) { | |
return A(W) | |
} | |
U = new b(); | |
if (!(((S != null ? S.documentElement : void 0) != null) && S.documentElement.nodeName === "VAST")) { | |
return A() | |
} | |
T = S.documentElement.childNodes; | |
for (V = 0, O = T.length; V < O; V++) { | |
M = T[V]; | |
if (M.nodeName === "Error") { | |
U.errorURLTemplates.push(M.textContent) | |
} | |
} | |
y = S.documentElement.childNodes; | |
for (X = 0, P = y.length; X < P; X++) { | |
M = y[X]; | |
if (M.nodeName === "Ad") { | |
Q = B.parseAdElement(M); | |
if (Q != null) { | |
U.ads.push(Q) | |
} else { | |
c.track(U.errorURLTemplates, { | |
ERRORCODE: 101 | |
}) | |
} | |
} | |
} | |
N = function () { | |
var E, F, C, D; | |
if (!U) { | |
return | |
} | |
D = U.ads; | |
for (F = 0, C = D.length; F < C; F++) { | |
E = D[F]; | |
if (E.nextWrapperURL != null) { | |
return | |
} | |
} | |
if (U.ads.length === 0) { | |
c.track(U.errorURLTemplates, { | |
ERRORCODE: 303 | |
}); | |
U = null | |
} | |
return A(null, U) | |
}; | |
R = U.ads.length; | |
while (R--) { | |
Q = U.ads[R]; | |
if (Q.nextWrapperURL == null) { | |
continue | |
}(function (E) { | |
var D, C; | |
if (z.length >= 10 || (C = E.nextWrapperURL, a.call(z, C) >= 0)) { | |
c.track(E.errorURLTemplates, { | |
ERRORCODE: 302 | |
}); | |
U.ads.splice(U.ads.indexOf(E), 1); | |
N(); | |
return | |
} | |
if (E.nextWrapperURL.indexOf("://") === -1) { | |
D = o.slice(0, o.lastIndexOf("/")); | |
E.nextWrapperURL = "" + D + "/" + E.nextWrapperURL | |
} | |
return B._parse(E.nextWrapperURL, z, function (J, K) { | |
var F, I, G, H, am, L, aj, ak, al, aa, ag, af, ah, ai; | |
if (J != null) { | |
c.track(E.errorURLTemplates, { | |
ERRORCODE: 301 | |
}); | |
U.ads.splice(U.ads.indexOf(E), 1) | |
} else { | |
if (!(K != null)) { | |
c.track(E.errorURLTemplates, { | |
ERRORCODE: 303 | |
}); | |
U.ads.splice(U.ads.indexOf(E), 1) | |
} else { | |
U.errorURLTemplates = U.errorURLTemplates.concat(K.errorURLTemplates); | |
G = U.ads.indexOf(E); | |
U.ads.splice(G, 1); | |
af = K.ads; | |
for (L = 0, aj = af.length; L < aj; L++) { | |
H = af[L]; | |
H.errorURLTemplates = E.errorURLTemplates.concat(H.errorURLTemplates); | |
H.impressionURLTemplates = E.impressionURLTemplates.concat(H.impressionURLTemplates); | |
if (E.trackingEvents != null) { | |
ah = H.creatives; | |
for (aa = 0, ak = ah.length; aa < ak; aa++) { | |
F = ah[aa]; | |
ai = Object.keys(E.trackingEvents); | |
for (ag = 0, al = ai.length; ag < al; ag++) { | |
I = ai[ag]; | |
(am = F.trackingEvents)[I] || (am[I] = []); | |
F.trackingEvents[I] = F.trackingEvents[I].concat(E.trackingEvents[I]) | |
} | |
} | |
} | |
U.ads.splice(G, 0, H) | |
} | |
} | |
} | |
delete E.nextWrapperURL; | |
return N() | |
}) | |
})(Q) | |
} | |
return N() | |
}) | |
}; | |
k.childByName = function (p, y) { | |
var m, n, z, o; | |
o = p.childNodes; | |
for (n = 0, z = o.length; n < z; n++) { | |
m = o[n]; | |
if (m.nodeName === y) { | |
return m | |
} | |
} | |
}; | |
k.childsByName = function (p, z) { | |
var B, m, n, A, o; | |
m = []; | |
o = p.childNodes; | |
for (n = 0, A = o.length; n < A; n++) { | |
B = o[n]; | |
if (B.nodeName === z) { | |
m.push(B) | |
} | |
} | |
return m | |
}; | |
k.parseAdElement = function (n) { | |
var m, o, y, p; | |
p = n.childNodes; | |
for (o = 0, y = p.length; o < y; o++) { | |
m = p[o]; | |
if (m.nodeName === "Wrapper") { | |
return this.parseWrapperElement(m) | |
} else { | |
if (m.nodeName === "InLine") { | |
return this.parseInLineElement(m) | |
} | |
} | |
} | |
}; | |
k.parseWrapperElement = function (p) { | |
var o, m, n; | |
o = this.parseInLineElement(p); | |
n = this.childByName(p, "VASTAdTagURI"); | |
if (n != null) { | |
o.nextWrapperURL = n.textContent | |
} | |
m = o.creatives[0]; | |
if ((m != null) && (m.trackingEvents != null)) { | |
o.trackingEvents = m.trackingEvents | |
} | |
if (o.nextWrapperURL != null) { | |
return o | |
} | |
}; | |
k.parseInLineElement = function (o) { | |
var N, n, R, P, L, H, I, J, m, O, Q, p, K, M; | |
N = new q(); | |
p = o.childNodes; | |
for (H = 0, m = p.length; H < m; H++) { | |
L = p[H]; | |
switch (L.nodeName) { | |
case "Error": | |
N.errorURLTemplates.push(L.textContent); | |
break; | |
case "Impression": | |
N.impressionURLTemplates.push(L.textContent); | |
break; | |
case "Creatives": | |
K = this.childsByName(L, "Creative"); | |
for (I = 0, O = K.length; I < O; I++) { | |
R = K[I]; | |
M = R.childNodes; | |
for (J = 0, Q = M.length; J < Q; J++) { | |
P = M[J]; | |
switch (P.nodeName) { | |
case "Linear": | |
n = this.parseCreativeLinearElement(P); | |
if (n) { | |
N.creatives.push(n) | |
} | |
} | |
} | |
} | |
} | |
} | |
return N | |
}; | |
k.parseCreativeLinearElement = function (ai) { | |
var Y, ad, W, ao, aj, ag, ab, V, ae, af, X, U, ap, ar, ac, ak, n, m, o, p, aa, am, aq, Z, ah, al, an; | |
Y = new w(); | |
Y.duration = this.parseDuration((aa = this.childByName(ai, "Duration")) != null ? aa.textContent : void 0); | |
if (Y.duration === -1 && ai.parentNode.parentNode.parentNode.nodeName !== "Wrapper") { | |
return null | |
} | |
ab = ai.getAttribute("skipoffset"); | |
if (!(ab != null)) { | |
Y.skipDelay = null | |
} else { | |
if (ab.charAt(ab.length - 1) === "%") { | |
ag = parseInt(ab, 10); | |
Y.skipDelay = Y.duration * (ag / 100) | |
} else { | |
Y.skipDelay = this.parseDuration(ab) | |
} | |
} | |
X = this.childByName(ai, "VideoClicks"); | |
if (X != null) { | |
Y.videoClickThroughURLTemplate = (am = this.childByName(X, "ClickThrough")) != null ? am.textContent : void 0; | |
Y.videoClickTrackingURLTemplate = (aq = this.childByName(X, "ClickTracking")) != null ? aq.textContent : void 0 | |
} | |
Z = this.childsByName(ai, "TrackingEvents"); | |
for (ap = 0, n = Z.length; ap < n; ap++) { | |
ae = Z[ap]; | |
ah = this.childsByName(ae, "Tracking"); | |
for (ar = 0, m = ah.length; ar < m; ar++) { | |
V = ah[ar]; | |
ad = V.getAttribute("event"); | |
af = V.textContent; | |
if ((ad != null) && (af != null)) { | |
if ((U = Y.trackingEvents)[ad] == null) { | |
U[ad] = [] | |
} | |
Y.trackingEvents[ad].push(af) | |
} | |
} | |
} | |
al = this.childsByName(ai, "MediaFiles"); | |
for (ac = 0, o = al.length; ac < o; ac++) { | |
aj = al[ac]; | |
an = this.childsByName(aj, "MediaFile"); | |
for (ak = 0, p = an.length; ak < p; ak++) { | |
ao = an[ak]; | |
W = new x(); | |
W.fileURL = ao.textContent; | |
W.deliveryType = ao.getAttribute("delivery"); | |
W.codec = ao.getAttribute("codec"); | |
W.mimeType = ao.getAttribute("type"); | |
W.bitrate = parseInt(ao.getAttribute("bitrate") || 0); | |
W.minBitrate = parseInt(ao.getAttribute("minBitrate") || 0); | |
W.maxBitrate = parseInt(ao.getAttribute("maxBitrate") || 0); | |
W.width = parseInt(ao.getAttribute("width") || 0); | |
W.height = parseInt(ao.getAttribute("height") || 0); | |
Y.mediaFiles.push(W) | |
} | |
} | |
return Y | |
}; | |
k.parseDuration = function (m) { | |
var o, z, p, n, y; | |
if (!(m != null)) { | |
return -1 | |
} | |
o = m.split(":"); | |
if (o.length !== 3) { | |
return -1 | |
} | |
y = o[2].split("."); | |
n = parseInt(y[0]); | |
if (y.length === 2) { | |
n += parseFloat("0." + y[1]) | |
} | |
p = parseInt(o[1] * 60); | |
z = parseInt(o[0] * 60 * 60); | |
if (isNaN(z || isNaN(p || isNaN(n || p > 60 * 60 || n > 60)))) { | |
return -1 | |
} | |
return z + p + n | |
}; | |
return k | |
})(); | |
u.exports = s | |
}, { | |
"./urlhandler.coffee": 9, | |
"./response.coffee": 10, | |
"./ad.coffee": 11, | |
"./util.coffee": 5, | |
"./creative.coffee": 7, | |
"./mediafile.coffee": 12 | |
} | |
], | |
7: [ | |
function (q, r, c) { | |
var t, a, s, p, b = Object.prototype.hasOwnProperty, | |
o = function (k, m) { | |
for (var n in m) { | |
if (b.call(m, n)) { | |
k[n] = m[n] | |
} | |
} | |
function l() { | |
this.constructor = k | |
} | |
l.prototype = m.prototype; | |
k.prototype = new l; | |
k.__super__ = m.prototype; | |
return k | |
}; | |
t = (function () { | |
function k() { | |
this.trackingEvents = {} | |
} | |
return k | |
})(); | |
s = (function (k) { | |
o(l, k); | |
function l() { | |
l.__super__.constructor.apply(this, arguments); | |
this.type = "linear"; | |
this.duration = 0; | |
this.skipDelay = null; | |
this.mediaFiles = []; | |
this.videoClickThroughURLTemplate = null; | |
this.videoClickTrackingURLTemplate = null | |
} | |
return l | |
})(t); | |
p = (function (k) { | |
o(l, k); | |
function l() { | |
l.__super__.constructor.apply(this, arguments) | |
} | |
return l | |
})(t); | |
a = (function (k) { | |
o(l, k); | |
function l() { | |
l.__super__.constructor.apply(this, arguments) | |
} | |
return l | |
})(t); | |
r.exports = { | |
VASTCreativeLinear: s, | |
VASTCreativeNonLinear: p, | |
VASTCreativeCompanion: a | |
} | |
}, {} | |
], | |
10: [ | |
function (b, a, c) { | |
var k; | |
k = (function () { | |
function l() { | |
this.ads = []; | |
this.errorURLTemplates = [] | |
} | |
return l | |
})(); | |
a.exports = k | |
}, {} | |
], | |
9: [ | |
function (l, c, n) { | |
var b, m, a; | |
a = l("./urlhandlers/xmlhttprequest.coffee"); | |
m = l("./urlhandlers/flash.coffee"); | |
b = (function () { | |
function k() {} | |
k.get = function (p, o) { | |
if (!(typeof window !== "undefined" && window !== null)) { | |
return l("./urlhandlers/node.coffee").get(p, o) | |
} else { | |
if (a.supported()) { | |
return a.get(p, o) | |
} else { | |
return m.get(p, o) | |
} | |
} | |
}; | |
return k | |
})(); | |
c.exports = b | |
}, { | |
"./urlhandlers/xmlhttprequest.coffee": 13, | |
"./urlhandlers/flash.coffee": 14 | |
} | |
], | |
11: [ | |
function (b, a, k) { | |
var c; | |
c = (function () { | |
function l() { | |
this.errorURLTemplates = []; | |
this.impressionURLTemplates = []; | |
this.creatives = [] | |
} | |
return l | |
})(); | |
a.exports = c | |
}, {} | |
], | |
12: [ | |
function (b, a, k) { | |
var c; | |
c = (function () { | |
function l() { | |
this.fileURL = null; | |
this.deliveryType = "progressive"; | |
this.mimeType = null; | |
this.codec = null; | |
this.bitrate = 0; | |
this.minBitrate = 0; | |
this.maxBitrate = 0; | |
this.width = 0; | |
this.height = 0 | |
} | |
return l | |
})(); | |
a.exports = c | |
}, {} | |
], | |
14: [ | |
function (b, a, c) { | |
var k; | |
k = (function () { | |
function l() {} | |
l.get = function (m, n) { | |
return n("not supported") | |
}; | |
return l | |
})(); | |
a.exports = k | |
}, {} | |
], | |
13: [ | |
function (c, a, k) { | |
var b; | |
b = (function () { | |
function l() {} | |
l.xhr = function () { | |
var m; | |
m = new window.XMLHttpRequest(); | |
if ("withCredentials" in m) { | |
return m | |
} | |
}; | |
l.supported = function () { | |
return !!this.xhr() | |
}; | |
l.get = function (o, p) { | |
var n; | |
n = this.xhr(); | |
n.open("GET", o); | |
n.send(); | |
return n.onreadystatechange = function () { | |
if (n.readyState === 4) { | |
return p(null, n.responseXML) | |
} | |
} | |
}; | |
return l | |
})(); | |
a.exports = b | |
}, {} | |
] | |
}, {}, [1])(1) | |
}); | |
(function () { | |
var a, b, c = [].slice; | |
a = "AAAAIGZ0eXBNNFZQAAAAAU00VlBNNEEgbXA0Mmlzb20AAALabW9vdgAAAGxtdmhkAAAAAM3XktzN15LcAAACWAAAAGQAAQAAAQAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAmZ0cmFrAAAAXHRraGQAAAABzdeS3M3XktwAAAABAAAAAAAAAGQAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAABAAAAAAeAAAAEQAAAAAAAkZWR0cwAAABxlbHN0AAAAAAAAAAEAAABkAAAAAAABAAAAAAHebWRpYQAAACBtZGhkAAAAAM3XktzN15LcAAALtQAAAfQVxwAAAAAAOmhkbHIAAAAAAAAAAHZpZGUAAAAAAAAAAAAAAABBcHBsZSBWaWRlbyBNZWRpYSBIYW5kbGVyAAAAAXxtaW5mAAAAFHZtaGQAAAABAAAAAAAAAAAAAAAkZGluZgAAABxkcmVmAAAAAAAAAAEAAAAMdXJsIAAAAAEAAAE8c3RibAAAALBzdHNkAAAAAAAAAAEAAACgYXZjMQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAHgARAASAAAAEgAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABj//wAAAC5hdmNDAULgFf8BABcnQuAVqRg8EdgDUGAQY3oA9ID1XvfAQAEABCjeCYgAAAAcdXVpZGtoQPJfJE/FujmlG88DI/MAAAABAAAAGHN0dHMAAAAAAAAAAQAAAAUAAABkAAAAFHN0c3MAAAAAAAAAAQAAAAEAAAAcc3RzYwAAAAAAAAABAAAAAQAAAAUAAAABAAAAKHN0c3oAAAAAAAAAAAAAAAUAAAHRAAAALwAAADEAAAAxAAAAMQAAABRzdGNvAAAAAAAAAAEAAAMiAAAACGZyZWUAAAAIZnJlZQAAAqttZGF0AAAACHdpZGUAAAAAbWRhdAAAAAwGAAeDYesAAAMAQIAAAAAVBgURA4f0Ts0KS9yhlDrD1JsXHwOAAAAAyyW4ICP//8PRQABAf999999999999999999999999999999ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddeAAAA1SUAgDggI///w9FAAEB/33333333333333///w9FAAEB/333333333333331111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111114AAAABUGBREDh/ROzQpL3KGUOsPUmxcfA4AAAAAGIeEFDAIBAAAACCEAgGEFDAIBAAAAFQYFEQOH9E7NCkvcoZQ6w9SbFx8DgAAAAAch4gkHAIBAAAAACSEAgGIJBwCAQAAAABUGBREDh/ROzQpL3KGUOsPUmxcfA4AAAAAHIeMNAsAgEAAAAAkhAIBjDQLAIBAAAAAVBgURA4f0Ts0KS9yhlDrD1JsXHwOAAAAAByHkEQPAIBAAAAAJIQCAZBEDwCAQ"; | |
if (!String.prototype.trim) { | |
String.prototype.trim = function () { | |
return this.replace(/^\s+|\s+$/g, "") | |
} | |
} | |
b = (function () { | |
var h, q, j, g, t, k, i, m, p, l, o, n, s, r, u; | |
g = null; | |
o = null; | |
l = false; | |
m = null; | |
p = 3000; | |
k = null; | |
i = 8000; | |
j = 3 * 60 * 1000; | |
t = null; | |
r = false; | |
u = navigator.userAgent; | |
n = /iPad;.*OS [^0-5]_/.test(u); | |
s = /\b(?:bing\.com|google|yahoo|ask\.com|yandex\.ru|naver\.com|voila\.fr|stumbleupon\.com|reddit\.com)\b/i; | |
h = { | |
MEDIAFILE_NOT_FOUND: 401, | |
MEDIAFILE_TIMEOUT: 402, | |
MEDIAFILE_NOT_SUPPORTED: 403, | |
MEDIAFILE_PLAYBACK_ERROR: 405 | |
}; | |
q = { | |
global: { | |
closeButtonDisplayDelay: 0, | |
countdownMessageVisibility: 1 | |
}, | |
country: { | |
FR: { | |
closeButtonDisplayDelay: 5 | |
}, | |
US: { | |
closeButtonDisplayDelay: -1 | |
}, | |
NO: { | |
closeButtonDisplayDelay: -1 | |
}, | |
SE: { | |
closeButtonDisplayDelay: -1 | |
}, | |
DK: { | |
closeButtonDisplayDelay: -1 | |
}, | |
FI: { | |
closeButtonDisplayDelay: -1 | |
} | |
}, | |
freelunch: ["US", "TR"] | |
}; | |
function f(y) { | |
var x, A, z, w, v, B, C = this; | |
this.backend = y; | |
A = $(this); | |
x = $(this.backend); | |
v = DM.playerOptions; | |
y.out = this; | |
this.countryCode = w = v.get("country"); | |
B = v.get("referer"); | |
if ((B && B.match(s)) || !! ~q.freelunch.indexOf(w)) { | |
DMVAST.client.cappingFreeLunch = 1 | |
} | |
this.rules = jQuery.extend({}, q.global, q.country[w]); | |
this.adsUI = z = new DM.controllers.AdsUI(document.body, this); | |
DM.observer.on(DM.events.ads.AD_UI_SKIP, function () { | |
C.vastTracker.skip(); | |
A.triggerHandler("@AD_SKIP", "instream skipped"); | |
return false | |
}); | |
DM.observer.on(DM.events.ads.AD_UI_CLICK, function () { | |
C.vastTracker.click(); | |
return false | |
}); | |
A.on("@VAST_SUCCESS", function (E, D) { | |
o = "success"; | |
y.out = y; | |
t = { | |
ad: true, | |
stream_h264_url: D.fileURL.trim() | |
}; | |
z.create(); | |
if (r) { | |
C.playAd() | |
} | |
}); | |
A.on("@VAST_ERROR @AD_END @AD_SKIP @AD_CLICKTHROUGH", function (E, D) { | |
l = false; | |
y.out = C; | |
if (k != null) { | |
clearTimeout(k) | |
} | |
if (m != null) { | |
clearTimeout(m) | |
} | |
A.triggerHandler("ad_end"); | |
z.destroy(); | |
A.one("playing", function () { | |
A.triggerHandler("play"); | |
y.ui.controls(true); | |
return y.ui.autohide() | |
}); | |
if (E.type === "@AD_CLICKTHROUGH") { | |
setTimeout(function () { | |
y.ui.loading(true); | |
A.one("playing", function (F) { | |
y.ui.loading(false); | |
return C.pause() | |
}); | |
return C.loadAndPlay(C.contentInfo) | |
}, 500); | |
return | |
} else { | |
A.one("canplay", function () { | |
return this.play() | |
}) | |
} if (E.type === "@VAST_ERROR") { | |
o = "error" | |
} | |
if (r) { | |
C.loadAndPlay(C.contentInfo); | |
if (E.type === "@AD_SKIP" || D === "Media timeout") { | |
$(y.player).triggerHandler("play") | |
} | |
} | |
}); | |
if (y.player.webkitExitFullScreen) { | |
A.on("ended", function (D) { | |
return y.player.webkitExitFullScreen() | |
}) | |
} | |
} | |
f.prototype.createTracker = function (v, w) { | |
this.vastTracker = new DMVAST.tracker(v, w); | |
return this.vastTracker | |
}; | |
f.prototype.listenTracker = function () { | |
var x, v, w, y = this; | |
x = $(this); | |
w = this.vastTracker; | |
w.on("clickthrough", function (z) { | |
window.open(z); | |
x.triggerHandler("@AD_CLICKTHROUGH", "user click-through") | |
}); | |
v = function (z) { | |
if (z <= 1) { | |
w.removeListener("skip-countdown", v); | |
setTimeout((function () { | |
return y.adsUI.setSkipCountDown(0) | |
}), z) | |
} else { | |
y.adsUI.setSkipCountDown(z) | |
} | |
}; | |
if (w.skipDelay === null) { | |
if (this.rules.closeButtonDisplayDelay === 0) { | |
return this.adsUI.setSkipCountDown(0) | |
} else { | |
if (this.rules.closeButtonDisplayDelay !== -1) { | |
w.setSkipDelay(this.rules.closeButtonDisplayDelay); | |
return w.on("skip-countdown", v) | |
} | |
} | |
} else { | |
if (w.skipDelay !== -1) { | |
return w.on("skip-countdown", v) | |
} | |
} | |
}; | |
f.prototype.listenBackend = function () { | |
var w, C, x, E, B, v, D, A, F, y, z = this; | |
F = this; | |
C = $(this); | |
B = this.backend; | |
w = $(B); | |
y = this.vastTracker; | |
E = y.ad; | |
D = "instream-vast-" + (+new Date()); | |
A = function (G) { | |
C.triggerHandler("@AD_END", "instream playback ended") | |
}; | |
w.on("canplay." + D, function (G) { | |
if (k) { | |
clearTimeout(k) | |
} | |
B.ui.loading(false); | |
y.load(); | |
C.triggerHandler("ad_start") | |
}); | |
w.on("playing." + D, function (H) { | |
var G; | |
C.triggerHandler("ad_playing"); | |
if ((G = B.stats) != null) { | |
G.trigger(DM_Stats.AD_INSTREAM_PLAYING, {}, true) | |
} | |
}); | |
w.on("timeupdate." + D, function (H) { | |
var G; | |
G = this.currentTime(); | |
y.setProgress(G); | |
C.triggerHandler("ad_timeupdate", G) | |
}); | |
w.on("play." + D, function (H) { | |
var G; | |
y.setPaused(false); | |
C.triggerHandler("ad_play"); | |
if ((G = B.stats) != null) { | |
G.trigger(DM_Stats.AD_INSTREAM_PLAY, {}, true) | |
} | |
}); | |
w.on("pause." + D, function (G) { | |
y.setPaused(true); | |
C.triggerHandler("ad_pause") | |
}); | |
x = $(B.ui.videoFrame()); | |
v = function (G) { | |
return z.play() | |
}; | |
w.on("fullscreenchange." + D, function (H, G) { | |
B.ui.controls(!G.fullscreen); | |
if (G.fullscreen === true) { | |
x.on("click." + D + " touchend." + D, v) | |
} else { | |
x.off("click." + D + " touchend." + D, v) | |
} | |
}); | |
C.on("@VAST_ERROR @AD_END @AD_SKIP", function () { | |
w.off("." + D); | |
B.ui.loading(true) | |
}); | |
w.on("error", function (G) { | |
A(); | |
DMVAST.util.track(E.errorURLTemplates, { | |
ERRORCODE: h.MEDIAFILE_PLAYBACK_ERROR | |
}) | |
}); | |
w.on("ended." + D, A); | |
return y | |
}; | |
f.prototype.validateMediaFile = function (v) { | |
if (("" + v.mimeType) === "video/mp4") { | |
return true | |
} | |
return false | |
}; | |
f.prototype.callVAST = function (y) { | |
var x, w, v, z = this; | |
x = $(this); | |
if (!y) { | |
x.triggerHandler("@VAST_ERROR", "callVAST(): field info.vast_url_template is empty"); | |
return | |
} | |
if (!this.urlTemplateFilter) { | |
this.urlTemplateFilter = new DM.VAST.URLTemplateFilter(this.contentInfo); | |
DMVAST.parser.addURLTemplateFilter(function (A) { | |
return z.urlTemplateFilter.filter(A) | |
}) | |
} | |
o = "loading"; | |
l = true; | |
m = setTimeout(function () { | |
z.backend.stats.trigger(DM_Stats.AD_CALL_FAIL, {}); | |
x.triggerHandler("@VAST_ERROR", "vast call timeout") | |
}, p); | |
if ((w = this.backend) != null) { | |
if ((v = w.stats) != null) { | |
v.trigger(DM_Stats.AD_CALL_START, {}) | |
} | |
} | |
DMVAST.client.get(y, function (J) { | |
var P, L, Q, N, M, K, I, H, O, C, A, G, F, E, D, B; | |
if (o !== "loading") { | |
return | |
} | |
if ((G = z.backend) != null) { | |
if ((F = G.stats) != null) { | |
F.trigger(DM_Stats.AD_CALL_END, {}) | |
} | |
} | |
if (m) { | |
clearTimeout(m) | |
} | |
if (J == null) { | |
if (r) { | |
x.triggerHandler("@VAST_ERROR", "Response null") | |
} else { | |
o = "error" | |
} | |
z.backend.stats.trigger(DM_Stats.AD_CALL_FAIL, {}); | |
return | |
} | |
if (J) { | |
E = J.ads; | |
for (K = 0, O = E.length; K < O; K++) { | |
P = E[K]; | |
D = P.creatives; | |
for (I = 0, C = D.length; I < C; I++) { | |
Q = D[I]; | |
if (("" + Q.type) !== "linear") { | |
continue | |
} | |
B = Q.mediaFiles; | |
for (H = 0, A = B.length; H < A; H++) { | |
N = B[H]; | |
if (!z.validateMediaFile(N)) { | |
continue | |
} | |
M = z.createTracker(P, Q); | |
x.triggerHandler("@VAST_SUCCESS", N); | |
break | |
} | |
if (M) { | |
break | |
} | |
} | |
if (M) { | |
break | |
} else { | |
x.triggerHandler("@VAST_ERROR", "No suitable mediaFile for this ad"); | |
if (P && (L = P.errorURLTemplates)) { | |
DMVAST.util.track(L, { | |
ERRORCODE: h.MEDIAFILE_NOT_SUPPORTED | |
}) | |
} | |
} | |
} | |
} | |
if (!M) { | |
console.warn("[PlayerInstream] VAST response> end of response: no preroll found"); | |
x.triggerHandler("@VAST_ERROR", "Empty response or unable to find a valid ad"); | |
if (L) { | |
DMVAST.util.track(L, { | |
ERRORCODE: h.MEDIAFILE_NOT_FOUND | |
}) | |
} | |
} | |
}) | |
}; | |
f.prototype.canPlayAd = function (y) { | |
var z, w, v, x; | |
if (y == null) { | |
y = this.contentInfo | |
} | |
v = DM.playerOptions.get("is_secure"); | |
w = y.mode === "live" && y.onair; | |
z = /Android 4/.test(u); | |
x = /(iPod|iPhone|iPad);.*OS [^0-5]_/.test(u); | |
g = !v && !w && x; | |
return g | |
}; | |
f.prototype.playAd = function () { | |
var y, w, v, x, z = this; | |
y = $(this); | |
w = this.backend; | |
v = this.vastTracker; | |
k = setTimeout(function () { | |
var A; | |
y.triggerHandler("@VAST_ERROR", "Media timeout"); | |
if ((A = w.stats) != null) { | |
A.trigger(DM_Stats.AD_INSTREAM_TIMEOUT, {}) | |
} | |
DMVAST.util.track(v.ad.errorURLTemplates, { | |
ERRORCODE: h.MEDIAFILE_TIMEOUT | |
}) | |
}, i); | |
w.ui.controls(false); | |
this.listenTracker(); | |
this.listenBackend(); | |
this.loadAndPlay(t, null); | |
if ((x = w.stats) != null) { | |
x.trigger(DM_Stats.AD_INSTREAM_PLAY, {}) | |
} | |
return this | |
}; | |
f.prototype.playContent = function () { | |
this.loadAndPlay(this.contentInfo, this.contentCallback); | |
return this | |
}; | |
f.prototype.playB64 = function () { | |
var v; | |
if (Modernizr.ios && g) { | |
if (/(iPod|iPhone|iPad);.*OS 7_/.test(u)) { | |
v = DM.config("assets")["blank_video"]; | |
this.loadAndPlay({ | |
stats: false, | |
stream_h264_url: v | |
}, null).pause() | |
} else { | |
this.loadAndPlay({ | |
stats: false, | |
stream_h264_url: "data:video/mp4;base64," + a | |
}, null).pause() | |
} | |
} | |
return this | |
}; | |
f.prototype.loadAndPlay = function () { | |
var w, v, x; | |
w = 1 <= arguments.length ? c.call(arguments, 0) : []; | |
if (v = (x = this.backend).load.apply(x, w)) { | |
return v.play() | |
} else { | |
return v | |
} | |
}; | |
f.prototype.preload = function (v) { | |
this.contentInfo = v; | |
if (this.urlTemplateFilter) { | |
this.urlTemplateFilter.updateInfo(this.contentInfo) | |
} | |
}; | |
f.prototype.load = function (v, w) { | |
var z, x, y; | |
this.contentInfo = v; | |
this.contentCallback = w; | |
z = $(this); | |
x = this.backend; | |
x.out = x; | |
if (this.urlTemplateFilter) { | |
this.urlTemplateFilter.updateInfo(this.contentInfo) | |
} | |
try { | |
DMVAST.client.cappingMinimumTimeInterval = DM.external ? 0 : j; | |
r && (o = null); | |
r = true; | |
if ((typeof g === "boolean" && !g) || !this.canPlayAd(this.contentInfo)) { | |
throw "Ads disabled for this content" | |
} | |
if (o === "error") { | |
throw "Previous ad call returned an error" | |
} | |
if (o === null) { | |
this.callVAST(this.contentInfo.vast_url_template) | |
} | |
if (o === "loading") { | |
this.playB64() | |
} else { | |
if (o === "success" && t) { | |
this.playAd() | |
} else { | |
throw "adStatus: " + o | |
} | |
} | |
} catch (A) { | |
y = A; | |
console.warn("[PlayerInstream] Load() > catched an error:", y.message || y); | |
z.triggerHandler("@VAST_ERROR", y.message || y) | |
} | |
g = null; | |
return this | |
}; | |
f.prototype.setAudience = function (v) { | |
this.backend.setAudience(v); | |
return this | |
}; | |
f.prototype.paused = function () { | |
if (l) { | |
return true | |
} else { | |
return this.backend.paused() | |
} | |
}; | |
f.prototype.play = function () { | |
this.backend.play(); | |
return this | |
}; | |
f.prototype.pause = function () { | |
this.backend.pause(); | |
return this | |
}; | |
f.prototype.seek = function (v) { | |
if (!l) { | |
this.backend.seek(v) | |
} | |
return this | |
}; | |
f.prototype.currentTime = function () { | |
if (l) { | |
return 0 | |
} else { | |
return this.backend.currentTime() | |
} | |
}; | |
f.prototype.fullscreen = function () { | |
if (!l) { | |
this.backend.fullscreen() | |
} | |
return this | |
}; | |
f.prototype.muted = function (v) { | |
if (!l) { | |
this.backend.muted(v) | |
} | |
return this | |
}; | |
f.prototype.volume = function (v) { | |
if (!l) { | |
this.backend.volume(v) | |
} | |
return this | |
}; | |
return f | |
})(); | |
window.DailymotionPlayerInstream = b | |
}).call(this); | |
(function () { | |
(function (b) { | |
var h, s, j, f, p, o, l, i, a, q, g, k, n, c, r; | |
s = b.DM || {}; | |
s.VAST = s.VAST || {}; | |
r = navigator.userAgent; | |
n = document.referrer; | |
g = Modernizr; | |
q = s.logger; | |
l = s.utils.extend; | |
j = s.utils.Location; | |
h = s.utils.AuditudeLocation; | |
p = /^https?\:\/\/([^\/?#]+)(?:[\/?#]|$)/i; | |
i = { | |
"[DMPLATFORM]": "DMPLATFORM", | |
"[DMDEVICETYPE]": "DMDEVICETYPE", | |
"[DMPLAYERTYPE]": "DMPLAYERTYPE", | |
"[DMEXT]": "DMEXT", | |
"[DMREFERER]": "DMREFERER", | |
"[DMHOST]": "DMHOST", | |
"[DMTYPE]": "DMTYPE", | |
"[DMCATEGORY]": "DMCATEGORY", | |
"[DMOWNER]": "DMOWNER", | |
"[DMVIDEOTYPE]": "DMVIDEOTYPE", | |
"[DMVIDEO]": "DMVIDEO", | |
"[DMLANG]": "DMLANG" | |
}; | |
a = l({}, i, { | |
"[ext]": i["[DMEXT]"], | |
"[external]": i["[DMEXT]"], | |
"[playertype]": i["[DMPLAYERTYPE]"], | |
"[embedder]": i["[DMREFERER]"], | |
"[referrer]": i["[DMREFERER]"], | |
"[referer]": i["[DMREFERER]"], | |
"[embedder.host]": i["[DMHOST]"], | |
"[referrer.host]": i["[DMHOST]"], | |
"[referer.host]": i["[DMHOST]"], | |
"[TIMESTAMP]": "TIMESTAMP", | |
"[ts]": "TIMESTAMP", | |
"[timestamp]": "TIMESTAMP", | |
"[DATE]": "DATE", | |
"[USER_AGENT]": "USER_AGENT", | |
"[ua]": "USER_AGENT", | |
"[user-agent]": "USER_AGENT", | |
"[OUECHMAGUEULE]": "OUECHMAGUEULE" | |
}); | |
o = { | |
matcher: /\[([a-zA-Z._-]+)\]/gi, | |
extractables: i, | |
injectables: a | |
}; | |
k = {}; | |
c = function (m, t) { | |
return (m instanceof RegExp) && (t instanceof RegExp) && (m.source === t.source) && (m.global === t.global) && (m.ignoreCase === t.ignoreCase) && (m.multiline === t.multiline) | |
}; | |
f = (function () { | |
var m; | |
m = function (v) { | |
var u; | |
u = function (w) { | |
if (w < 10) { | |
return "0" + w | |
} else { | |
return w | |
} | |
}; | |
return "" + v.getFullYear() + u(v.getMonth() + 1) + u(v.getDate()) + u(v.getHours()) + u(v.getMinutes()) + u(v.getSeconds()) | |
}; | |
function t(u) { | |
this.videoInfo = u | |
} | |
t.prototype.updateInfo = function (u) { | |
this.videoInfo = u; | |
return delete this.extractedValues | |
}; | |
t.prototype.getValueForKey = function (u) { | |
if (!(u in this.extractedValues)) { | |
this.extractedValues[u] = this.computeValueForKey(u) | |
} | |
return this.extractedValues[u] | |
}; | |
t.prototype.computeValueForKey = function (x) { | |
var u, v, w; | |
switch (x) { | |
case a["[DMPLATFORM]"]: | |
if (g.ua_mobile) { | |
return "phone" | |
} else { | |
if (g.ua_tablet) { | |
return "tablet" | |
} else { | |
if (g.ua_tv) { | |
return "tv" | |
} else { | |
return "desktop" | |
} | |
} | |
} | |
break; | |
case a["[DMDEVICETYPE]"]: | |
if (g.ios) { | |
return "ios" | |
} else { | |
if (g.android) { | |
return "android" | |
} else { | |
if (g.ua_windowsphone) { | |
return "windowsphone" | |
} else { | |
if (g.ua_windows8) { | |
return "windows8" | |
} else { | |
if (g.ua_blackberry) { | |
return "blackberry" | |
} | |
} | |
} | |
} | |
} | |
break; | |
case a["[DMEXT]"]: | |
if (s.external) { | |
return 1 | |
} else { | |
return 0 | |
} | |
break; | |
case a["[DMHOST]"]: | |
u = n != null ? n.match(p) : void 0; | |
return w = u && u.length > 1 ? u[1] : 0; | |
case a["[DMTYPE]"]: | |
if (v = location.host.match(/([^.]+)\.dailymotion\.com/)) { | |
if (v[1] === "www") { | |
return "prod" | |
} else { | |
return v[1] | |
} | |
} else { | |
return 0 | |
} | |
break; | |
case a["[DMREFERER]"]: | |
return n || 0; | |
case a["[DMPLAYERTYPE]"]: | |
return "html"; | |
case a["[DMCATEGORY]"]: | |
return this.videoInfo.channel || ""; | |
case a["[DMOWNER]"]: | |
return this.videoInfo.owner_username || ""; | |
case a["[DMVIDEOTYPE]"]: | |
return this.videoInfo.type || ""; | |
case a["[DMVIDEO]"]: | |
return this.videoInfo.id || ""; | |
case a["[DMLANG]"]: | |
return this.videoInfo.language || ""; | |
case a["[TIMESTAMP]"]: | |
return function () { | |
return +(new Date) | |
}; | |
case a["[DATE]"]: | |
return function () { | |
return m(new Date) | |
}; | |
case a["[USER_AGENT]"]: | |
return r; | |
default: | |
return 0 | |
} | |
}; | |
t.prototype.getProcessor = function (x) { | |
var w, y, u; | |
y = {}; | |
for (w in k) { | |
u = k[w]; | |
if (x.indexOf(w) !== -1) { | |
y = u; | |
break | |
} | |
} | |
return { | |
extractables: l({}, o.extractables, y.extractables), | |
injectables: l({}, o.injectables, y.injectables), | |
matchers: y.matcher && !c(y.matcher, o.matcher) ? [o.matcher, y.matcher] : [o.matcher] | |
} | |
}; | |
t.prototype.extractValuesFromTemplate = function (x, v) { | |
var w, u, y = this; | |
w = x.params(); | |
this.extractedValues = {}; | |
q.groupCollapsed("Searching for extractables..."); | |
q.log("extractValuesFromTemplate: input", w); | |
u = function (A) { | |
var E, H, D, F, z, B, G, C; | |
for (D in A) { | |
F = A[D]; | |
for (B = 0, G = F.length; B < G; B++) { | |
z = F[B]; | |
if (typeof z === "object") { | |
u(z) | |
} else { | |
if (y.getInjectableKey(z, v) === null) { | |
C = v.extractables; | |
for (E in C) { | |
H = C[E]; | |
if (D === H) { | |
y.extractedValues[D] = z | |
} | |
} | |
} | |
} | |
} | |
} | |
}; | |
u(w); | |
q.log("Found extracted values:", this.extractedValues); | |
q.groupEnd(); | |
return this.extractedValues | |
}; | |
t.prototype.getInjectableKey = function (y, w) { | |
var v, u, x; | |
x = w.injectables; | |
for (u in x) { | |
v = x[u]; | |
if (y.indexOf(u) !== -1) { | |
return v | |
} | |
} | |
return null | |
}; | |
t.prototype.filter = function (u) { | |
var C, E, I, F, w, z, H, x, B, A, y, J, v, D, G = this; | |
B = u.match(/auditude\.com/) ? h.parse(u) : j.parse(u); | |
q.groupCollapsed("[DMURLTemplateFilter] filtering url [", B.host, "]"); | |
q.log("%cInput:", "font-weight:bold;", u); | |
q.groupCollapsed("filtering..."); | |
q.log("Converted input to Location", B); | |
x = this.getProcessor(u); | |
q.log("Got processor for url", x); | |
if (!this.extractedValues) { | |
this.extractValuesFromTemplate(B, x) | |
} | |
H = []; | |
D = x.matchers; | |
for (A = 0, J = D.length; A < J; A++) { | |
F = D[A]; | |
if (w = u.match(F)) { | |
H = H.concat(w) | |
} | |
} | |
if (!H) { | |
return u | |
} | |
C = function (L) { | |
var K; | |
K = G.getValueForKey(L); | |
if (typeof K === "function") { | |
return K() | |
} else { | |
return K | |
} | |
}; | |
q.groupCollapsed("Injecting values in url..."); | |
for (y = 0, v = H.length; y < v; y++) { | |
z = H[y]; | |
if (E = this.getInjectableKey(z, x)) { | |
I = encodeURIComponent(C(E)); | |
u = u.replace(z, I); | |
q.log("Replaced placeholder", z, "with value :", I) | |
} | |
} | |
q.groupEnd(); | |
q.groupEnd(); | |
q.log("%cOutput:", "font-weight:bold;", u); | |
q.groupEnd(); | |
return u | |
}; | |
return t | |
})(); | |
s.VAST.URLTemplateFilter = f; | |
return b.DM = s | |
})(window) | |
}).call(this); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment