Skip to content

Instantly share code, notes, and snippets.

@codemilli
Created October 18, 2016 07:44
Show Gist options
  • Save codemilli/88ece9102583b62c2989afe14fbc7ad8 to your computer and use it in GitHub Desktop.
Save codemilli/88ece9102583b62c2989afe14fbc7ad8 to your computer and use it in GitHub Desktop.
(function() {
window.UAParserBackup = window.UAParser
}).call(this),
function(t) {
"use strict";
var e = t.userAgent = function(t) {
function e(t) {
var e = {},
i = /(dolfin)[ \/]([\w.]+)/.exec(t) || /(chrome)[ \/]([\w.]+)/.exec(t) || /(opera)(?:.*version)?[ \/]([\w.]+)/.exec(t) || /(webkit)(?:.*version)?[ \/]([\w.]+)/.exec(t) || /(msie) ([\w.]+)/.exec(t) || t.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+))?/.exec(t) || ["", "unknown"];
return "webkit" === i[1] ? i = /(iphone|ipad|ipod)[\S\s]*os ([\w._\-]+) like/.exec(t) || /(android)[ \/]([\w._\-]+);/.exec(t) || [i[0], "safari", i[2]] : "mozilla" === i[1] ? /trident/.test(t) ? i[1] = "msie" : i[1] = "firefox" : /polaris|natebrowser|([010|011|016|017|018|019]{3}\d{3,4}\d{4}$)/.test(t) && (i[1] = "polaris"), e[i[1]] = !0, e.name = i[1], e.version = n(i[2]), e
}
function n(t) {
var e = {},
n = t ? t.split(/\.|-|_/) : ["0", "0", "0"];
return e.info = n.join("."), e.major = n[0] || "0", e.minor = n[1] || "0", e.patch = n[2] || "0", e
}
function i(t) {
return r(t) ? "pc" : o(t) ? "tablet" : s(t) ? "mobile" : ""
}
function r(t) {
return t.match(/linux|windows (nt|98)|macintosh/) && !t.match(/android|mobile|polaris|lgtelecom|uzard|natebrowser|ktf;|skt;/) ? !0 : !1
}
function o(t) {
return t.match(/ipad/) || t.match(/android/) && !t.match(/mobi|mini|fennec/) ? !0 : !1
}
function s(t) {
return t.match(/ip(hone|od)|android.+mobile|windows (ce|phone)|blackberry|bb10|symbian|webos|firefox.+fennec|opera m(ob|in)i|polaris|iemobile|lgtelecom|nokia|sonyericsson|dolfin|uzard|natebrowser|ktf;|skt;/) ? !0 : !1
}
function a(t) {
var e = {},
i = /(iphone|ipad|ipod)[\S\s]*os ([\w._\-]+) like/.exec(t) || /(android)[ \/]([\w._\-]+);/.exec(t) || (/android/.test(t) ? ["", "android", "0.0.0"] : !1) || (/polaris|natebrowser|([010|011|016|017|018|019]{3}\d{3,4}\d{4}$)/.test(t) ? ["", "polaris", "0.0.0"] : !1) || /(windows)(?: nt | phone(?: os){0,1} | )([\w._\-]+)/.exec(t) || (/(windows)/.test(t) ? ["", "windows", "0.0.0"] : !1) || /(mac) os x ([\w._\-]+)/.exec(t) || (/(linux)/.test(t) ? ["", "linux", "0.0.0"] : !1) || (/webos/.test(t) ? ["", "webos", "0.0.0"] : !1) || /(bada)[ \/]([\w._\-]+)/.exec(t) || (/bada/.test(t) ? ["", "bada", "0.0.0"] : !1) || (/(rim|blackberry|bb10)/.test(t) ? ["", "blackberry", "0.0.0"] : !1) || ["", "unknown", "0.0.0"];
return "iphone" === i[1] || "ipad" === i[1] || "ipod" === i[1] ? i[1] = "ios" : "windows" === i[1] && "98" === i[2] && (i[2] = "0.98.0"), e[i[1]] = !0, e.name = i[1], e.version = n(i[2]), e
}
function u(t) {
var e = {},
i = /(crios)[ \/]([\w.]+)/.exec(t) || /(daumapps)[ \/]([\w.]+)/.exec(t) || ["", ""];
return i[1] ? (e.isApp = !0, e.name = i[1], e.version = n(i[2])) : e.isApp = !1, e
}
return t = (t || window.navigator.userAgent).toString().toLowerCase(), {
ua: t,
browser: e(t),
platform: i(t),
os: a(t),
app: u(t)
}
};
"object" == typeof window && window.navigator.userAgent && (window.ua_result = e(window.navigator.userAgent) || null)
}(function() {
return "object" == typeof exports ? (exports.daumtools = exports, exports.util = exports, exports) : "object" == typeof window ? (window.daumtools = "undefined" == typeof window.daumtools ? {} : window.daumtools, window.util = "undefined" == typeof window.util ? window.daumtools : window.util, window.daumtools) : void 0
}()),
function(t) {
"use strict";
t.web2app = function() {
function t(t) {
window.location.href = t
}
function e(e) {
var r = "function" == typeof e.willInvokeApp ? e.willInvokeApp : function() {},
a = "function" == typeof e.onAppMissing ? e.onAppMissing : t,
u = "function" == typeof e.onUnsupportedEnvironment ? e.onUnsupportedEnvironment : function() {};
r(), g.android ? n() && e.intentURI && !e.useUrlScheme ? o(e.intentURI) : e.storeURL && i(e.urlScheme, e.storeURL, a) : g.ios && e.storeURL ? s(e.urlScheme, e.storeURL, a) : setTimeout(function() {
u()
}, 100)
}
function n() {
var t = v.browser.chrome && +v.browser.version.major >= 25,
e = new RegExp(_.join("|"), "i");
return t && !e.test(v.ua)
}
function i(t, e, n) {
r(m, e, n), p(t)
}
function r(t, e, n) {
var i = (new Date).getTime();
return setTimeout(function() {
var r = (new Date).getTime();
d() && t + y > r - i && n(e)
}, t)
}
function o(t) {
function e() {
top.location.href = t
}
v.browser.chrome ? e() : setTimeout(e, 100)
}
function s(t, e, n) {
var i = r(f, e, n);
parseInt(v.os.version.major, 10) < 8 ? a(i) : u(i), h() ? l(t) : p(t)
}
function a(t) {
window.addEventListener("pagehide", function e() {
d() && (clearTimeout(t), window.removeEventListener("pagehide", e))
})
}
function u(t) {
document.addEventListener("visibilitychange", function e() {
d() && (clearTimeout(t), document.removeEventListener("visibilitychange", e))
})
}
function d() {
for (var t = ["hidden", "webkitHidden"], e = 0, n = t.length; n > e; e++)
if ("undefined" !== document[t[e]]) return !document[t[e]];
return !0
}
function l(t) {
window.top.location.href = t
}
function p(t) {
setTimeout(function() {
var e = c("appLauncher");
e.src = t
}, 100)
}
function c(t) {
var e = document.createElement("iframe");
return e.id = t, e.style.border = "none", e.style.width = "0", e.style.height = "0", e.style.display = "none", e.style.overflow = "hidden", document.body.appendChild(e), e
}
function h() {
return parseInt(v.os.version.major, 10) > 8 && v.os.ios
}
var f = 2e3,
m = 300,
y = 100,
v = daumtools.userAgent(),
g = v.os,
_ = ["firefox", "opr", "fb_iab"];
return e
}()
}(window.daumtools = "undefined" == typeof window.daumtools ? {} : window.daumtools),
function(t) {
"use strict";
t.daumtools = "undefined" == typeof t.daumtools ? {} : t.daumtools, "undefined" != typeof t.daumtools.web2app && (t.daumtools.web2app.version = "1.0.9")
}(window),
function(t) {
if ("function" == typeof define && define.amd) define(t);
else if ("object" == typeof exports) module.exports = t();
else {
var e = window.Cookies,
n = window.Cookies = t();
n.noConflict = function() {
return window.Cookies = e, n
}
}
}(function() {
function t() {
for (var t = 0, e = {}; t < arguments.length; t++) {
var n = arguments[t];
for (var i in n) e[i] = n[i]
}
return e
}
function e(n) {
function i(e, r, o) {
var s;
if ("undefined" != typeof document) {
if (arguments.length > 1) {
if (o = t({
path: "/"
}, i.defaults, o), "number" == typeof o.expires) {
var a = new Date;
a.setMilliseconds(a.getMilliseconds() + 864e5 * o.expires), o.expires = a
}
try {
s = JSON.stringify(r), /^[\{\[]/.test(s) && (r = s)
} catch (u) {}
return r = n.write ? n.write(r, e) : encodeURIComponent(String(r)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g, decodeURIComponent), e = encodeURIComponent(String(e)), e = e.replace(/%(23|24|26|2B|5E|60|7C)/g, decodeURIComponent), e = e.replace(/[\(\)]/g, escape), document.cookie = [e, "=", r, o.expires ? "; expires=" + o.expires.toUTCString() : "", o.path ? "; path=" + o.path : "", o.domain ? "; domain=" + o.domain : "", o.secure ? "; secure" : ""].join("")
}
e || (s = {});
for (var d = document.cookie ? document.cookie.split("; ") : [], l = /(%[0-9A-Z]{2})+/g, p = 0; p < d.length; p++) {
var c = d[p].split("="),
h = c.slice(1).join("=");
'"' === h.charAt(0) && (h = h.slice(1, -1));
try {
var f = c[0].replace(l, decodeURIComponent);
if (h = n.read ? n.read(h, f) : n(h, f) || h.replace(l, decodeURIComponent), this.json) try {
h = JSON.parse(h)
} catch (u) {}
if (e === f) {
s = h;
break
}
e || (s[f] = h)
} catch (u) {}
}
return s
}
}
return i.set = i, i.get = function(t) {
return i(t)
}, i.getJSON = function() {
return i.apply({
json: !0
}, [].slice.call(arguments))
}, i.defaults = {}, i.remove = function(e, n) {
i(e, "", t(n, {
expires: -1
}))
}, i.withConverter = e, i
}
return e(function() {})
}),
function(t, e) {
"use strict";
var n = "0.7.10",
i = "",
r = "?",
o = "function",
s = "undefined",
a = "object",
u = "string",
d = "major",
l = "model",
p = "name",
c = "type",
h = "vendor",
f = "version",
m = "architecture",
y = "console",
v = "mobile",
g = "tablet",
_ = "smarttv",
w = "wearable",
b = "embedded",
k = {
extend: function(t, e) {
var n = {};
for (var i in t) e[i] && e[i].length % 2 === 0 ? n[i] = e[i].concat(t[i]) : n[i] = t[i];
return n
},
has: function(t, e) {
return "string" == typeof t ? -1 !== e.toLowerCase().indexOf(t.toLowerCase()) : !1
},
lowerize: function(t) {
return t.toLowerCase()
},
major: function(t) {
return typeof t === u ? t.split(".")[0] : e
}
},
P = {
rgx: function() {
for (var t, n, i, r, u, d, l, p = 0, c = arguments; p < c.length && !d;) {
var h = c[p],
f = c[p + 1];
if (typeof t === s) {
t = {};
for (r in f) f.hasOwnProperty(r) && (u = f[r], typeof u === a ? t[u[0]] = e : t[u] = e)
}
for (n = i = 0; n < h.length && !d;)
if (d = h[n++].exec(this.getUA()))
for (r = 0; r < f.length; r++) l = d[++i], u = f[r], typeof u === a && u.length > 0 ? 2 == u.length ? typeof u[1] == o ? t[u[0]] = u[1].call(this, l) : t[u[0]] = u[1] : 3 == u.length ? typeof u[1] !== o || u[1].exec && u[1].test ? t[u[0]] = l ? l.replace(u[1], u[2]) : e : t[u[0]] = l ? u[1].call(this, l, u[2]) : e : 4 == u.length && (t[u[0]] = l ? u[3].call(this, l.replace(u[1], u[2])) : e) : t[u] = l ? l : e;
p += 2
}
return t
},
str: function(t, n) {
for (var i in n)
if (typeof n[i] === a && n[i].length > 0) {
for (var o = 0; o < n[i].length; o++)
if (k.has(n[i][o], t)) return i === r ? e : i
} else if (k.has(n[i], t)) return i === r ? e : i;
return t
}
},
T = {
browser: {
oldsafari: {
version: {
"1.0": "/8",
1.2: "/1",
1.3: "/3",
"2.0": "/412",
"2.0.2": "/416",
"2.0.3": "/417",
"2.0.4": "/419",
"?": "/"
}
}
},
device: {
amazon: {
model: {
"Fire Phone": ["SD", "KF"]
}
},
sprint: {
model: {
"Evo Shift 4G": "7373KT"
},
vendor: {
HTC: "APA",
Sprint: "Sprint"
}
}
},
os: {
windows: {
version: {
ME: "4.90",
"NT 3.11": "NT3.51",
"NT 4.0": "NT4.0",
2e3: "NT 5.0",
XP: ["NT 5.1", "NT 5.2"],
Vista: "NT 6.0",
7: "NT 6.1",
8: "NT 6.2",
8.1: "NT 6.3",
10: ["NT 6.4", "NT 10.0"],
RT: "ARM"
}
}
}
},
S = {
browser: [
[/(opera\smini)\/([\w\.-]+)/i, /(opera\s[mobiletab]+).+version\/([\w\.-]+)/i, /(opera).+version\/([\w\.]+)/i, /(opera)[\/\s]+([\w\.]+)/i],
[p, f],
[/(OPiOS)[\/\s]+([\w\.]+)/i],
[
[p, "Opera Mini"], f
],
[/\s(opr)\/([\w\.]+)/i],
[
[p, "Opera"], f
],
[/(kindle)\/([\w\.]+)/i, /(lunascape|maxthon|netfront|jasmine|blazer)[\/\s]?([\w\.]+)*/i, /(avant\s|iemobile|slim|baidu)(?:browser)?[\/\s]?([\w\.]*)/i, /(?:ms|\()(ie)\s([\w\.]+)/i, /(rekonq)\/([\w\.]+)*/i, /(chromium|flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs)\/([\w\.-]+)/i],
[p, f],
[/(trident).+rv[:\s]([\w\.]+).+like\sgecko/i],
[
[p, "IE"], f
],
[/(edge)\/((\d+)?[\w\.]+)/i],
[p, f],
[/(yabrowser)\/([\w\.]+)/i],
[
[p, "Yandex"], f
],
[/(comodo_dragon)\/([\w\.]+)/i],
[
[p, /_/g, " "], f
],
[/(chrome|omniweb|arora|[tizenoka]{5}\s?browser)\/v?([\w\.]+)/i, /(qqbrowser)[\/\s]?([\w\.]+)/i],
[p, f],
[/(uc\s?browser)[\/\s]?([\w\.]+)/i, /ucweb.+(ucbrowser)[\/\s]?([\w\.]+)/i, /JUC.+(ucweb)[\/\s]?([\w\.]+)/i],
[
[p, "UCBrowser"], f
],
[/(dolfin)\/([\w\.]+)/i],
[
[p, "Dolphin"], f
],
[/((?:android.+)crmo|crios)\/([\w\.]+)/i],
[
[p, "Chrome"], f
],
[/XiaoMi\/MiuiBrowser\/([\w\.]+)/i],
[f, [p, "MIUI Browser"]],
[/android.+version\/([\w\.]+)\s+(?:mobile\s?safari|safari)/i],
[f, [p, "Android Browser"]],
[/FBAV\/([\w\.]+);/i],
[f, [p, "Facebook"]],
[/fxios\/([\w\.-]+)/i],
[f, [p, "Firefox"]],
[/version\/([\w\.]+).+?mobile\/\w+\s(safari)/i],
[f, [p, "Mobile Safari"]],
[/version\/([\w\.]+).+?(mobile\s?safari|safari)/i],
[f, p],
[/webkit.+?(mobile\s?safari|safari)(\/[\w\.]+)/i],
[p, [f, P.str, T.browser.oldsafari.version]],
[/(konqueror)\/([\w\.]+)/i, /(webkit|khtml)\/([\w\.]+)/i],
[p, f],
[/(navigator|netscape)\/([\w\.-]+)/i],
[
[p, "Netscape"], f
],
[/(swiftfox)/i, /(icedragon|iceweasel|camino|chimera|fennec|maemo\sbrowser|minimo|conkeror)[\/\s]?([\w\.\+]+)/i, /(firefox|seamonkey|k-meleon|icecat|iceape|firebird|phoenix)\/([\w\.-]+)/i, /(mozilla)\/([\w\.]+).+rv\:.+gecko\/\d+/i, /(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir)[\/\s]?([\w\.]+)/i, /(links)\s\(([\w\.]+)/i, /(gobrowser)\/?([\w\.]+)*/i, /(ice\s?browser)\/v?([\w\._]+)/i, /(mosaic)[\/\s]([\w\.]+)/i],
[p, f]
],
cpu: [
[/(?:(amd|x(?:(?:86|64)[_-])?|wow|win)64)[;\)]/i],
[
[m, "amd64"]
],
[/(ia32(?=;))/i],
[
[m, k.lowerize]
],
[/((?:i[346]|x)86)[;\)]/i],
[
[m, "ia32"]
],
[/windows\s(ce|mobile);\sppc;/i],
[
[m, "arm"]
],
[/((?:ppc|powerpc)(?:64)?)(?:\smac|;|\))/i],
[
[m, /ower/, "", k.lowerize]
],
[/(sun4\w)[;\)]/i],
[
[m, "sparc"]
],
[/((?:avr32|ia64(?=;))|68k(?=\))|arm(?:64|(?=v\d+;))|(?=atmel\s)avr|(?:irix|mips|sparc)(?:64)?(?=;)|pa-risc)/i],
[
[m, k.lowerize]
]
],
device: [
[/\((ipad|playbook);[\w\s\);-]+(rim|apple)/i],
[l, h, [c, g]],
[/applecoremedia\/[\w\.]+ \((ipad)/],
[l, [h, "Apple"],
[c, g]
],
[/(apple\s{0,1}tv)/i],
[
[l, "Apple TV"],
[h, "Apple"]
],
[/(archos)\s(gamepad2?)/i, /(hp).+(touchpad)/i, /(kindle)\/([\w\.]+)/i, /\s(nook)[\w\s]+build\/(\w+)/i, /(dell)\s(strea[kpr\s\d]*[\dko])/i],
[h, l, [c, g]],
[/(kf[A-z]+)\sbuild\/[\w\.]+.*silk\//i],
[l, [h, "Amazon"],
[c, g]
],
[/(sd|kf)[0349hijorstuw]+\sbuild\/[\w\.]+.*silk\//i],
[
[l, P.str, T.device.amazon.model],
[h, "Amazon"],
[c, v]
],
[/\((ip[honed|\s\w*]+);.+(apple)/i],
[l, h, [c, v]],
[/\((ip[honed|\s\w*]+);/i],
[l, [h, "Apple"],
[c, v]
],
[/(blackberry)[\s-]?(\w+)/i, /(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|huawei|meizu|motorola|polytron)[\s_-]?([\w-]+)*/i, /(hp)\s([\w\s]+\w)/i, /(asus)-?(\w+)/i],
[h, l, [c, v]],
[/\(bb10;\s(\w+)/i],
[l, [h, "BlackBerry"],
[c, v]
],
[/android.+(transfo[prime\s]{4,10}\s\w+|eeepc|slider\s\w+|nexus 7)/i],
[l, [h, "Asus"],
[c, g]
],
[/(sony)\s(tablet\s[ps])\sbuild\//i, /(sony)?(?:sgp.+)\sbuild\//i],
[
[h, "Sony"],
[l, "Xperia Tablet"],
[c, g]
],
[/(?:sony)?(?:(?:(?:c|d)\d{4})|(?:so[-l].+))\sbuild\//i],
[
[h, "Sony"],
[l, "Xperia Phone"],
[c, v]
],
[/\s(ouya)\s/i, /(nintendo)\s([wids3u]+)/i],
[h, l, [c, y]],
[/android.+;\s(shield)\sbuild/i],
[l, [h, "Nvidia"],
[c, y]
],
[/(playstation\s[34portablevi]+)/i],
[l, [h, "Sony"],
[c, y]
],
[/(sprint\s(\w+))/i],
[
[h, P.str, T.device.sprint.vendor],
[l, P.str, T.device.sprint.model],
[c, v]
],
[/(lenovo)\s?(S(?:5000|6000)+(?:[-][\w+]))/i],
[h, l, [c, g]],
[/(htc)[;_\s-]+([\w\s]+(?=\))|\w+)*/i, /(zte)-(\w+)*/i, /(alcatel|geeksphone|huawei|lenovo|nexian|panasonic|(?=;\s)sony)[_\s-]?([\w-]+)*/i],
[h, [l, /_/g, " "],
[c, v]
],
[/(nexus\s9)/i],
[l, [h, "HTC"],
[c, g]
],
[/[\s\(;](xbox(?:\sone)?)[\s\);]/i],
[l, [h, "Microsoft"],
[c, y]
],
[/(kin\.[onetw]{3})/i],
[
[l, /\./g, " "],
[h, "Microsoft"],
[c, v]
],
[/\s(milestone|droid(?:[2-4x]|\s(?:bionic|x2|pro|razr))?(:?\s4g)?)[\w\s]+build\//i, /mot[\s-]?(\w+)*/i, /(XT\d{3,4}) build\//i, /(nexus\s[6])/i],
[l, [h, "Motorola"],
[c, v]
],
[/android.+\s(mz60\d|xoom[\s2]{0,2})\sbuild\//i],
[l, [h, "Motorola"],
[c, g]
],
[/android.+((sch-i[89]0\d|shw-m380s|gt-p\d{4}|gt-n8000|sgh-t8[56]9|nexus 10))/i, /((SM-T\w+))/i],
[
[h, "Samsung"], l, [c, g]
],
[/((s[cgp]h-\w+|gt-\w+|galaxy\snexus|sm-n900))/i, /(sam[sung]*)[\s-]*(\w+-?[\w-]*)*/i, /sec-((sgh\w+))/i],
[
[h, "Samsung"], l, [c, v]
],
[/(samsung);smarttv/i],
[h, l, [c, _]],
[/\(dtv[\);].+(aquos)/i],
[l, [h, "Sharp"],
[c, _]
],
[/sie-(\w+)*/i],
[l, [h, "Siemens"],
[c, v]
],
[/(maemo|nokia).*(n900|lumia\s\d+)/i, /(nokia)[\s_-]?([\w-]+)*/i],
[
[h, "Nokia"], l, [c, v]
],
[/android\s3\.[\s\w;-]{10}(a\d{3})/i],
[l, [h, "Acer"],
[c, g]
],
[/android\s3\.[\s\w;-]{10}(lg?)-([06cv9]{3,4})/i],
[
[h, "LG"], l, [c, g]
],
[/(lg) netcast\.tv/i],
[h, l, [c, _]],
[/(nexus\s[45])/i, /lg[e;\s\/-]+(\w+)*/i],
[l, [h, "LG"],
[c, v]
],
[/android.+(ideatab[a-z0-9\-\s]+)/i],
[l, [h, "Lenovo"],
[c, g]
],
[/linux;.+((jolla));/i],
[h, l, [c, v]],
[/((pebble))app\/[\d\.]+\s/i],
[h, l, [c, w]],
[/android.+;\s(glass)\s\d/i],
[l, [h, "Google"],
[c, w]
],
[/android.+(\w+)\s+build\/hm\1/i, /android.+(hm[\s\-_]*note?[\s_]*(?:\d\w)?)\s+build/i, /android.+(mi[\s\-_]*(?:one|one[\s_]plus)?[\s_]*(?:\d\w)?)\s+build/i],
[
[l, /_/g, " "],
[h, "Xiaomi"],
[c, v]
],
[/\s(tablet)[;\/\s]/i, /\s(mobile)[;\/\s]/i],
[
[c, k.lowerize], h, l
]
],
engine: [
[/windows.+\sedge\/([\w\.]+)/i],
[f, [p, "EdgeHTML"]],
[/(presto)\/([\w\.]+)/i, /(webkit|trident|netfront|netsurf|amaya|lynx|w3m)\/([\w\.]+)/i, /(khtml|tasman|links)[\/\s]\(?([\w\.]+)/i, /(icab)[\/\s]([23]\.[\d\.]+)/i],
[p, f],
[/rv\:([\w\.]+).*(gecko)/i],
[f, p]
],
os: [
[/microsoft\s(windows)\s(vista|xp)/i],
[p, f],
[/(windows)\snt\s6\.2;\s(arm)/i, /(windows\sphone(?:\sos)*|windows\smobile|windows)[\s\/]?([ntce\d\.\s]+\w)/i],
[p, [f, P.str, T.os.windows.version]],
[/(win(?=3|9|n)|win\s9x\s)([nt\d\.]+)/i],
[
[p, "Windows"],
[f, P.str, T.os.windows.version]
],
[/\((bb)(10);/i],
[
[p, "BlackBerry"], f
],
[/(blackberry)\w*\/?([\w\.]+)*/i, /(tizen)[\/\s]([\w\.]+)/i, /(android|webos|palm\sos|qnx|bada|rim\stablet\sos|meego|contiki)[\/\s-]?([\w\.]+)*/i, /linux;.+(sailfish);/i],
[p, f],
[/(symbian\s?os|symbos|s60(?=;))[\/\s-]?([\w\.]+)*/i],
[
[p, "Symbian"], f
],
[/\((series40);/i],
[p],
[/mozilla.+\(mobile;.+gecko.+firefox/i],
[
[p, "Firefox OS"], f
],
[/(nintendo|playstation)\s([wids34portablevu]+)/i, /(mint)[\/\s\(]?(\w+)*/i, /(mageia|vectorlinux)[;\s]/i, /(joli|[kxln]?ubuntu|debian|[open]*suse|gentoo|(?=\s)arch|slackware|fedora|mandriva|centos|pclinuxos|redhat|zenwalk|linpus)[\/\s-]?([\w\.-]+)*/i, /(hurd|linux)\s?([\w\.]+)*/i, /(gnu)\s?([\w\.]+)*/i],
[p, f],
[/(cros)\s[\w]+\s([\w\.]+\w)/i],
[
[p, "Chromium OS"], f
],
[/(sunos)\s?([\w\.]+\d)*/i],
[
[p, "Solaris"], f
],
[/\s([frentopc-]{0,4}bsd|dragonfly)\s?([\w\.]+)*/i],
[p, f],
[/(ip[honead]+)(?:.*os\s([\w]+)*\slike\smac|;\sopera)/i],
[
[p, "iOS"],
[f, /_/g, "."]
],
[/(mac\sos\sx)\s?([\w\s\.]+\w)*/i, /(macintosh|mac(?=_powerpc)\s)/i],
[
[p, "Mac OS"],
[f, /_/g, "."]
],
[/((?:open)?solaris)[\/\s-]?([\w\.]+)*/i, /(haiku)\s(\w+)/i, /(aix)\s((\d)(?=\.|\)|\s)[\w\.]*)*/i, /(plan\s9|minix|beos|os\/2|amigaos|morphos|risc\sos|openvms)/i, /(unix)\s?([\w\.]+)*/i],
[p, f]
]
},
C = function(e, n) {
if (!(this instanceof C)) return new C(e, n).getResult();
var r = e || (t && t.navigator && t.navigator.userAgent ? t.navigator.userAgent : i),
o = n ? k.extend(S, n) : S;
return this.getBrowser = function() {
var t = P.rgx.apply(this, o.browser);
return t.major = k.major(t.version), t
}, this.getCPU = function() {
return P.rgx.apply(this, o.cpu)
}, this.getDevice = function() {
return P.rgx.apply(this, o.device)
}, this.getEngine = function() {
return P.rgx.apply(this, o.engine)
}, this.getOS = function() {
return P.rgx.apply(this, o.os)
}, this.getResult = function() {
return {
ua: this.getUA(),
browser: this.getBrowser(),
engine: this.getEngine(),
os: this.getOS(),
device: this.getDevice(),
cpu: this.getCPU()
}
}, this.getUA = function() {
return r
}, this.setUA = function(t) {
return r = t, this
}, this
};
C.VERSION = n, C.BROWSER = {
NAME: p,
MAJOR: d,
VERSION: f
}, C.CPU = {
ARCHITECTURE: m
}, C.DEVICE = {
MODEL: l,
VENDOR: h,
TYPE: c,
CONSOLE: y,
MOBILE: v,
SMARTTV: _,
TABLET: g,
WEARABLE: w,
EMBEDDED: b
}, C.ENGINE = {
NAME: p,
VERSION: f
}, C.OS = {
NAME: p,
VERSION: f
}, typeof exports !== s ? (typeof module !== s && module.exports && (exports = module.exports = C), exports.UAParser = C) : typeof define === o && define.amd ? define("ua-parser-js", [], function() {
return C
}) : t.UAParser = C;
var x = t.jQuery || t.Zepto;
if (typeof x !== s) {
var V = new C;
x.ua = V.getResult(), x.ua.get = function() {
return V.getUA()
}, x.ua.set = function(t) {
V.setUA(t);
var e = V.getResult();
for (var n in e) x.ua[n] = e[n]
}
}
}("object" == typeof window ? window : this),
function() {
window.VPCookies = Cookies.noConflict(), window.VPUAParser = window.UAParser, window.UAParser = window.UAParserBackup
}.call(this),
function() {
var t, e = [].indexOf || function(t) {
for (var e = 0, n = this.length; n > e; e++)
if (e in this && this[e] === t) return e;
return -1
};
t = function() {
function t() {}
var n, i, r, o, s, a, u, d, l, p, c, h;
return c = "init", p = "ad_opened", h = "text_ad_opened", n = "ad_opened", a = "open", r = "close", o = "no_ad", s = "no_ad_with_backup_ad", i = "ask", l = "vast", d = "text_ad_opened", u = "resize_text_ad", t.prototype.init = function(t) {
var e, n;
return this.util = new VP.Util, this.fred = new VP.Fred, this.rapsodyPlayer = new VP.RapsodyPlayer, this.cookieStore = new VP.VPCookieStore, this.passbacksHandler = new VP.PassbacksHandler(t.pageUrl, this.util), this.adRequestHistory = {}, this.noAdHistory = {}, n = !t.hybrid, e = !t.clientId, n && e ? void console.error("clientId is missing from VP.init({...})") : (this.initDone = !1, this.pendingTasks = [], this._bindMessageEvent(), this.cookieStore.init(), this.sessionCreatedDt = this.cookieStore.sessionCreatedDt, this.params = {
sdkType: VP.CONST.sdk_type,
sdkCoreType: VP.CONST.sdk_type,
sdkVersion: VP.CONST.sdk_version,
sdkCoreVersion: VP.CONST.sdk_version,
appId: this.util.getAppId(),
ua: navigator.userAgent,
deviceOs: this.util.getDeviceOs(),
deviceOsVersion: this.util.getDeviceOsVersion(),
deviceBrowser: this.util.getDeviceBrowserName(),
deviceBrowserVersion: this.util.getDeviceBrowserVersion(),
clientId: t.clientId,
session: this.cookieStore.sessionKey,
deviceId: this.cookieStore.deviceId
}, this._loadUserInfoFromCookie(), this.clickInsteadOfTouchend = t.clickInsteadOfTouchend, t.hybrid ? (this.hybrid = !0, this.vpHybridBridge = new VP.VPHybridBridge, this.vpHybridBridge.requestToInit()) : (this._ping(), this._schedulePingTimer(), this._initDone()))
}, t.prototype._loadUserInfoFromCookie = function() {
var t, e, n, i, r, o;
for (i = ["accountType", "birth", "friends", "gender", "userId", "level", "serverId"], r = [], t = 0, n = i.length; n > t; t++) e = i[t], o = this.cookieStore.getUserInfo(e), o ? r.push(this.params["userInfo_" + e] = o) : r.push(void 0);
return r
}, t.prototype._setInterstitialStyle = function(t) {
var e;
return e = t.background || "rgba(0, 0, 0, 0.7)", this.util.clearCSSRules(), this.util.addCSSRule("#" + VP.CONST.interstitial_div_id, "position:fixed; left:0; right:0; top:0; bottom:0; z-index:9999999"), this.util.addCSSRule("#" + VP.CONST.interstitial_div_id + ".displayed", "background:" + e + ";"), this.util.addCSSRule("#" + VP.CONST.interstitial_div_id + " iframe", "position:absolute !important; left:50% !important; margin-left:-160px !important; top:50% !important; margin-top:-240px !important")
}, t.prototype._schedulePingTimer = function() {
return setInterval(function(t) {
return function() {
return t._ping()
}
}(this), 11e4)
}, t.prototype._playDuration = function() {
return Math.floor(((new Date).getTime() - this.sessionCreatedDt) / 1e3)
}, t.prototype._bindMessageEvent = function() {
return this.s = new VP.WindowMessageStatusMachine(this.util, "init"), this.s.add(this.s.when(c)["if"](n).then_becomes(p).then_execute(function(t) {
return function(e, n) {
return t._adOpened(e, n)
}
}(this))), this.s.add(this.s.when(p)["if"](a).then_execute(function(t) {
return function(e, n) {
return t._trackAskAndOpenUrl(e)
}
}(this))), this.s.add(this.s.when(p)["if"](r).then_execute(function(t) {
return function(e, n) {
return t._close(e)
}
}(this))), this.s.add(this.s.when(c)["if"](s).then_execute(function(t) {
return function(e, n) {
return t._noAd(e, n)
}
}(this))), this.s.add(this.s.when(p)["if"](o).then_execute(function(t) {
return function(e, n) {
return t._noAd(e, n)
}
}(this))), this.s.add(this.s.when(p)["if"](i).then_execute(function(t) {
return function(e, n) {
return t._trackAsk(e)
}
}(this))), this.s.add(this.s.when(p)["if"](l).then_execute(function(t) {
return function(e, n) {
return t._vast(e)
}
}(this))), this.s.add(this.s.when(c)["if"](d).then_becomes(h).then_execute(function(t) {
return function(e, n) {
return t._requestToStyleAndDisplayTextAd(e, n)
}
}(this))), this.s.add(this.s.when(h)["if"](u).then_execute(function(t) {
return function(e, n) {
return t._resizeTextAd(e, n), t._adOpened(e, n)
}
}(this)))
}, t.prototype._getOpts = function(t) {
return this.adRequestHistory[t].opts || {}
}, t.prototype._resizeTextAd = function(t, e) {
var n, i;
return i = t.iframe_id, n = document.getElementById(i), n.style.width = t.width + "px", n.style.height = t.height + "px"
}, t.prototype._requestToStyleAndDisplayTextAd = function(t, e) {
var n, i, r;
return r = this._getOpts(t.iframe_id).textAdStyle || {}, n = e.source, i = e.origin, t = {
action: "style_and_display_text_ad",
style: r
}, n.postMessage(t, i)
}, t.prototype._vast = function(t) {
return this.util.loadStyleSheet(VP.CONST.rapsody_css_path, function(e) {
return function() {
var n, i, r, o, s, a, u, d, l;
return s = t.iframe_id, l = e.adRequestHistory[s].wrapperId, a = VP.util.merge(e._getOpts(s), t.opts), r = window.devicePixelRatio || 2, i = window.innerWidth || document.documentElement.clientWidth || 320, n = 1.5, u = {
w: r * i,
h: r * i / n
}, e._hideIframe(s), d = (new DOMParser).parseFromString(e.util.trim(t.vast), "application/xml"), o = VP.fred.main(l, d, u, a), VP.rapsodyPlayer.updateControls(), a = e._getOpts(s), a && a.adSizeChanged ? a.adSizeChanged(e.getWH(l, o)) : void 0
}
}(this))
}, t.prototype.getWH = function(t, e) {
var n, i, r, o, s;
return i = document.getElementById(t).getBoundingClientRect(), i ? (r = i.width, o = e.video.wh, s = e.image_banner.wh, n = function(t) {
var e;
return e = r / t.width, t.height * e
}, {
width: r,
height: n(o) + n(s)
}) : void 0
}, t.prototype._close = function(t) {
var e;
return e = document.getElementById(t.iframe_id), e.parentNode.id === VP.CONST.interstitial_div_id ? this.util.removeElement(e.parentNode) : this.util.removeElement(e)
}, t.prototype._trackAskAndOpenUrl = function(t) {
return this._trackAsk(t, function(e) {
return function() {
return e.hybrid ? e.vpHybridBridge.requestToOpenUrl(t.url, t.altUrl) : e.util.open(t)
}
}(this))
}, t.prototype._trackAsk = function(t, e) {
var n;
return (n = t.ask) ? this.hybrid ? (this.vpHybridBridge.requestToTrackAsk(n), e ? e() : void 0) : this.track({
eventName: "campaign",
ask: n
}, e) : void 0
}, t.prototype._adOpened = function(t, e) {
var n;
return n = t.iframe_id, this._getOpts(n).hideIframeDuringLoad && this._unhideIframe(n), this._centerIframe(n), this._trackVimpWhenShown(n, e.source, e.origin), this._callbackToUser(n, !0)
}, t.prototype._callbackToUser = function(t, e) {
var n;
return n = this._getOpts(t), n && n.callback ? n.callback(e) : void 0
}, t.prototype._hideIframe = function(t) {
var e, n;
return e = document.getElementById(t), n = e.parentNode, n.style.position = "absolute", n.style.left = "-100000px", n.id === VP.CONST.interstitial_div_id ? (n.style.display = "none", n.className = "") : void 0
}, t.prototype._unhideIframe = function(t) {
var e, n;
return e = document.getElementById(t), n = e.parentNode, n.style.removeProperty("position"), n.style.removeProperty("left"), n.id === VP.CONST.interstitial_div_id ? (n.style.display = "block", n.className = "displayed") : void 0
}, t.prototype._centerIframe = function(t) {
var e, n;
return n = document.getElementById(t), (e = function(t) {
return function() {
var i, r;
return r = t.util.getActualWidth(n.parentNode), isNaN(r) ? setTimeout(e, 20) : (i = Math.floor((r - t.util.getActualWidth(n)) / 2), i >= 0 ? n.style.marginLeft = i + "px" : void 0)
}
}(this))()
}, t.prototype._noAd = function(t, e) {
var n, i, r, o;
return i = t.iframe_id, this.noAdHistory[i] ? void 0 : (this.noAdHistory[i] = !0, this._hideIframe(i), r = this.adRequestHistory[i], o = r.placementWidth, n = r.placementHeight, "544b166f33a4dfa306216d0908f15f1b" === this.params.clientId && 320 === o && 300 === n && (o = 300, n = 250), this.passbacksHandler.run(r.placement, o, n, r.wrapperId, t.passbacks, r.opts, function(n) {
return function(r) {
return t.hasBackupAd ? (n._requestToResumeDisplayingAd(i, e), n._unhideIframe(i), n._adOpened(t, e)) : n._callbackToUser(i, r)
}
}(this)))
}, t.prototype._requestToResumeDisplayingAd = function(t, e) {
var n, i, r, o;
return n = document.getElementById(t), i = e.source, o = e.origin, r = {
action: "resume_displaying_ad"
}, i.postMessage(r, o)
}, t.prototype._initDone = function() {
var t, e;
for (this.initDone = !0, t = []; this.pendingTasks.length > 0;) e = this.pendingTasks.shift(), t.push(e());
return t
}, t.prototype._initDoneFromBridge = function(t) {
var e;
return e = {
sdkType: VP.CONST.sdk_type,
sdkCoreType: VP.CONST.sdk_type,
sdkVersion: VP.CONST.sdk_version,
sdkCoreVersion: VP.CONST.sdk_version
}, this.sessionCreatedDt = (new Date).getTime(), this.params = this.util.merge(t, e), this._initDone()
}, t.prototype._trackVimpWhenShown = function(t, e, n) {
var i, r, o, s, a, u;
return o = e, a = n, r = document.getElementById(t), i = {
action: "shown"
}, this.util.elementShownMoreThanHalf(r) ? o.postMessage(i, a) : (u = !1, s = function(t) {
return function() {
return t.util.elementShownMoreThanHalf(r) && !u ? (u = !0, o.postMessage(i, a), window.removeEventListener("scroll", s)) : void 0
}
}(this), this.util.addEvent(window, "scroll", s))
}, t.prototype._ping = function() {
return this.track({
action: "ping"
})
}, t.prototype._updateEventNameIfNeed = function(t) {
var n, i, r;
return n = t.eventName, r = e.call(VP.CONST.system_event, n) < 0, i = 0 === n.indexOf("u_"), r && !i && (t.eventName = "u_" + t.eventName), t
}, t.prototype._mangleParams = function(t) {
return this.util.mergeThree(this.params, {
playDuration: this._playDuration()
}, t)
}, t.prototype._queryStringForTrack = function(t) {
return t = this._mangleParams(t), t = this._updateEventNameIfNeed(t), "events=" + encodeURIComponent(JSON.stringify([t]))
}, t.prototype.track = function(t, e) {
var n, i, r, o;
return this.initDone ? (this.util.replaceParamName(t, "action", "eventName"), this.util.replaceParamName(t, "category", "eventCategory"), this.util.replaceParamName(t, "label", "eventLabel"), this.util.replaceParamName(t, "value", "eventValue"), t.eventTimestamp = this.util.getCurrentTimestamp(), this.hybrid ? (i = function() {
var e;
e = [];
for (n in t) o = t[n], e.push(n + "=" + encodeURIComponent(o));
return e
}().join("&"), this.vpHybridBridge.requestToTrack(i), e ? e() : void 0) : (r = VP.CONST.af3_path + "?" + this._queryStringForTrack(t), this.util.createHiddenIframe(r, e))) : void this.pendingTasks.push(function(n) {
return function() {
return n.track(t, e)
}
}(this))
}, t.prototype._bestInterstitialSize = function(t) {
var e, n;
return n = t.offsetWidth, e = t.offsetHeight, e > n && n >= 320 && e >= 480 ? [320, 480] : n > e && n >= 480 && e >= 320 ? [480, 320] : void 0
}, t.prototype.interstitial = function(t, e) {
var n, i, r;
return e = e || {}, this._setInterstitialStyle(e), r = document.getElementById(VP.CONST.interstitial_div_id), r && this.util.removeElement(r), r = document.createElement("div"), r.id = VP.CONST.interstitial_div_id, document.body.appendChild(r), (i = this._bestInterstitialSize(r)) ? (n = {
callback: function(t) {
return function(t) {
return t && (r.className += " displayed"), e.callback ? e.callback(t) : void 0
}
}(this)
}, this.ad(VP.CONST.interstitial_div_id, t, i[0], i[1], n)) : (console.error("[Valuepotion] Screen is too small to show interstitial ad. It should be bigger than 320x480 or 480x320."), void(e.callback && e.callback(!1)))
}, t.prototype.nativeAd = function(t, e, n) {
var i, r, o, s, a, u;
for (n || (n = {}), u = [], i = o = 0, a = t.length - 1; a >= 0 ? a >= o : o >= a; i = a >= 0 ? ++o : --o) r = t[i], s = this.util.cloneObj(n), s.rank = i + 1, u.push(this.ad(r, e, VP.CONST.native_ad_width, VP.CONST.native_ad_height, s));
return u
}, t.prototype.logVideoAd = function(t) {
return "608ac9958b92cae18592ca86c03d5302" === this.params.clientId ? (console.log("VP Video Ad Log : " + t), VP.track({
action: "video_ad_log",
label: t
})) : void 0
}, t.prototype.videoAd = function(t, e, n) {
var i, r, o, s, a;
return n = n || {}, n.videoId = t, o = {
videoOpts: n
}, i = this.util.createHiddenDiv(), s = document.getElementById(t), this.util.hasClass(s, "video-js") || this.util.addClass(s, "video-js"), a = n.width || parseInt(s.getAttribute("width")) || this.util.getActualWidth(s), r = n.height || parseInt(s.getAttribute("height")) || this.util.getActualHeight(s), VP.logVideoAd("videoAd"), this.ad(i.id, e, a, r, o)
}, t.prototype.getRecommendedAdSize = function(t, e) {
var n, i, r, o, s, a, u;
if (n = {
width: 320,
height: 50
}, a = [
[120, 600],
[160, 600],
[200, 200],
[300, 250],
[300, 600],
[320, 50],
[320, 100],
[336, 280],
[468, 60],
[728, 90],
[970, 90]
], a = a.sort(function(t, e) {
return e[0] * e[1] - t[0] * t[1]
}), u = this.util.getActualWidth(t), i = this.util.getActualHeight(t), 0 === u && 0 === i) return n;
for (e && e.maxWidth && (u = this.util.minExceptForZero(u, e.maxWidth)), e && e.maxHeight && (i = this.util.minExceptForZero(i, e.maxHeight)), r = 0, o = a.length; o > r; r++)
if (s = a[r], u >= s[0] && (0 === i || i >= s[1])) return {
width: s[0],
height: s[1]
};
return n
}, t.prototype.ad = function(t, e, n, i, r) {
return "400b9ae054fc3cc48013ada75832c905" !== this.params.clientId && "7959574283dfb0baa1f1d5c27aaa7223" !== this.params.clientId || 320 !== n || 300 !== i || (n = 300, i = 250), r = r || {}, this.initDone ? (r.swallowVASTResponse && this.setUpForSwallowingVASTResponse(), setTimeout(function(o) {
return function() {
var s, a;
return s = o.util.getAdIframe(t), a = {
placement: e,
placementWidth: n,
placementHeight: i,
ver: "3.0",
serviceHost: o.util.serviceHost(),
iframeId: s.id,
dummy: o.util.dummyNumber()
}, r.rank && (a.rank = r.rank), o.adRequestHistory[s.id] = {
placement: e,
placementWidth: n,
placementHeight: i,
wrapperId: t,
opts: r
}, s.style.display = "block", s.style.width = r.forceWidth || n + "px", s.style.height = r.forceHeight || i + "px", s.src = r.mimp_url || VP.CONST.ad_path + "?" + o.util.serialize(o._mangleParams(a)), r.hideIframeDuringLoad ? o._hideIframe(s.id) : void 0
}
}(this), 20)) : void this.pendingTasks.push(function(o) {
return function() {
return o.ad(t, e, n, i, r)
}
}(this))
}, t.prototype._setUserInfo = function(t, e) {
return this.cookieStore.setUserInfo(t, e), this.hybrid ? this.vpHybridBridge.requestToSetUserInfo(t, e) : (t = "userInfo_" + t, this.params[t] !== e ? (this.params[t] = e, this._ping()) : void 0)
}, t.prototype.setUserAccountType = function(t) {
return this._setUserInfo("accountType", t)
}, t.prototype.setUserBirth = function(t) {
return this._setUserInfo("birth", t)
}, t.prototype.setUserFriends = function(t) {
return this._setUserInfo("friends", t)
}, t.prototype.setUserGender = function(t) {
return this._setUserInfo("gender", t)
}, t.prototype.setUserId = function(t) {
return this._setUserInfo("userId", t)
}, t.prototype.setUserLevel = function(t) {
return this._setUserInfo("level", t)
}, t.prototype.setUserServerId = function(t) {
return this._setUserInfo("serverId", t)
}, t.prototype.getUserBirth = function() {
return this.params ? this.params.userInfo_birth : void 0
}, t.prototype.getUserGender = function() {
return this.params ? this.params.userInfo_gender : void 0
}, t.prototype.setUpForSwallowingVASTResponse = function() {
return this._vast = function(t) {
var e;
return e = t.iframe_id, this._hideIframe(e), this._callbackToUser(e, !1)
}
}, t
}(), window.VP || (window.VP = new t)
}.call(this),
function() {
this.VP.CONST = {
DEBUG: !1,
sdk_version: "1.1.12",
sdk_type: "mweb",
af3_path: "https://analytics.valuepotion.com/track",
ad_path: "https://imp.valuepotion.com/mimp",
adx_script_url: "//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js",
system_event: ["install", "install_referrer", "update", "session_start", "session_stop", "campaign", "push_open", "ping", "video_ad_log"],
interstitial_div_id: "vp_interstitial_wrapper",
style_id: "_vp_style",
native_ad_width: 320,
native_ad_height: 100,
session_expire_time: 12e4,
ima_js: "//imasdk.googleapis.com/js/sdkloader/ima3.js",
video_ad_js: "https://campaigns-assets-vp.daumcdn.net/websdk/videojs-ads-support-v1.1.12.min.js",
video_ad_css: "https://campaigns-assets-vp.daumcdn.net/websdk/videojs-ads-support-v1.1.12.min.css",
rapsody_css_path: "https://campaigns-assets-vp.daumcdn.net/websdk/rapsody_v1.1.12.css"
}
}.call(this),
function() {
var t;
t = function() {
function t() {}
return t.prototype.max = function(t, e) {
return t > e ? t : e
}, t.prototype.min = function(t, e) {
return e > t ? t : e
}, t.prototype.maxFromArray = function(t, e) {
var n, i, r, o, s, a;
for (o = t[0], s = e(o), i = 0, r = t.length; r > i; i++) n = t[i], a = e(n), a > s && (s = a, o = n);
return n
}, t.prototype.minExceptForZero = function(t, e) {
return 0 === t ? e : 0 === e ? t : this.min(t, e)
}, t.prototype.merge = function(t, e) {
var n, i, r;
if (i = {}, t)
for (n in t) r = t[n], i[n] = r;
if (e)
for (n in e) r = e[n], i[n] = r;
return i
}, t.prototype.mergeThree = function(t, e, n) {
return this.merge(this.merge(t, e), n)
}, t.prototype.dummyNumber = function() {
return (new Date).getTime() + Math.floor(1e6 * Math.random())
}, t.prototype.serialize = function(t) {
var e, n;
return function() {
var i;
i = [];
for (e in t) n = t[e], i.push(encodeURIComponent(e) + "=" + encodeURIComponent(n));
return i
}().join("&")
}, t.prototype.hiddenDivIdPostfix = function() {
return this.randomString(4) + (new Date).getTime()
}, t.prototype.hiddenIframeIdPostfix = function() {
return this.randomString(4) + (new Date).getTime()
}, t.prototype.adIframeIdPostfix = function() {
return this.randomString(4) + (new Date).getTime()
}, t.prototype.randomString = function(t) {
var e, n, i, r, o;
for (o = "", i = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", e = n = 1, r = t; r >= 1 ? r >= n : n >= r; e = r >= 1 ? ++n : --n) o += i.charAt(Math.floor(Math.random() * i.length));
return o
}, t.prototype.createHiddenDiv = function() {
var t, e;
return e = "valuepotion-hidden-div-" + this.hiddenDivIdPostfix(), t = document.createElement("div"), t.id = e, t.style.width = 0, t.style.height = 0, t.style.opacity = 0, t.style.position = "absolute;", t.style.margin = 0, t.style.padding = 0, t.style.border = 0, t.style.x = -1e4, t.style.y = -1e4, t.style["z-index"] = -999999, document.body.appendChild(t), t
}, t.prototype.createHiddenIframe = function(t, e) {
var n, i;
return n = "valuepotion-track-iframe-" + this.hiddenIframeIdPostfix(), i = document.createElement("iframe"), i.id = n, i.src = t, i.style.width = 0, i.style.height = 0, i.style.opacity = 0, i.style.position = "absolute;", i.style.margin = 0, i.style.padding = 0, i.style.border = 0, i.style.x = -1e4, i.style.y = -1e4, i.style["z-index"] = -999999, i.onload = function(t) {
return function() {
return e && e(), setTimeout(function() {
return i.parentNode.removeChild(i)
}, 1e3)
}
}(this), document.body.appendChild(i), i
}, t.prototype.getAdIframe = function(t) {
var e, n;
return (e = document.getElementById(t)) ? (e.innerHTML = "", n = document.createElement("iframe"), n.id = "valuepotion-ad-iframe-" + this.adIframeIdPostfix(), n.style.width = 0, n.style.height = 0, n.style.margin = 0, n.style.padding = 0, n.style.border = 0, e.appendChild(n), n) : void 0
}, t.prototype.replaceParamName = function(t, e, n) {
var i;
return t[e] && (i = t[e], delete t[e], t[n] = i), t
}, t.prototype.getDeviceOs = function() {
return (new window.VPUAParser).getResult().os.name
}, t.prototype.getDeviceOsVersion = function() {
return (new window.VPUAParser).getResult().os.version
}, t.prototype.getDeviceBrowserName = function() {
return (new window.VPUAParser).getResult().browser.name
}, t.prototype.getDeviceBrowserVersion = function() {
return (new window.VPUAParser).getResult().browser.version
}, t.prototype.elementShownMoreThanHalf = function(t) {
var e, n, i, r, o;
for (r = t.offsetTop, n = t.offsetLeft, o = t.offsetWidth, e = t.offsetHeight; t.offsetParent;) t = t.offsetParent, r += t.offsetTop, n += t.offsetLeft;
return i = r < window.pageYOffset + window.innerHeight && n < window.pageXOffset + window.innerWidth && r + e > window.pageYOffset && n + o > window.pageXOffset, !!i
}, t.prototype.addEvent = function(t, e, n, i) {
var r;
return t.addEventListener ? (t.addEventListener(e, n, i), !0) : t.attachEvent ? r = t.attachEvent("on" + e, n) : void 0
}, t.prototype.removeEvent = function(t, e, n, i) {
var r;
return t.removeEventListener ? (t.removeEventListener(e, n, i), !0) : t.detachEvent ? r = t.detachEvent("on" + e, n) : void 0
}, t.prototype.selectWebUrlBetween = function(t, e) {
var n;
return n = function(t) {
return t && (0 === t.indexOf("http://") || 0 === t.indexOf("https://"))
}, n(t) ? t : n(e) ? e : null
}, t.prototype.open = function(t) {
var e, n, i, r, o, s;
return o = t.url, e = t.altUrl, r = daumtools.userAgent(), n = "android" === r.os, i = 0 === o.indexOf("market://details?id="), n && i ? daumtools.web2app({
useUrlScheme: !0,
urlScheme: o,
storeURL: e,
onAppMissing: daumtools.moveToStore
}) : (s = this.selectWebUrlBetween(o, e), s ? location.href = s : console.log("Can't redirect", o, e))
}, t.prototype.serviceHost = function() {
return "file:" === location.protocol ? "*" : location.protocol + "//" + location.host
}, t.prototype.getAppId = function() {
return "file:" === location.protocol ? location.href : location.host
}, t.prototype.getCurrentTimestamp = function() {
var t, e, n;
return t = function(t) {
return t > 9 ? t : "0" + t
}, e = new Date, n = e.getTimezoneOffset(), n = (0 > n ? "+" : "-") + t(parseInt(Math.abs(n / 60))) + ":" + t(Math.abs(n % 60)), "" + e.getFullYear() + "-" + t(e.getMonth() + 1) + "-" + t(e.getDate()) + "T" + t(e.getHours()) + ":" + t(e.getMinutes()) + ":" + t(e.getSeconds()) + n
}, t.prototype.getStyleSheet = function() {
var t;
return this.css || (t = document.querySelector("style#" + VP.CONST.style_id), t || (t = document.createElement("style"), t.id = VP.CONST.style_id, document.head.appendChild(t)), this.css = t.sheet), this.css
}, t.prototype.addClass = function(t, e) {
return t.className += " " + e
}, t.prototype.hasClass = function(t, e) {
return (" " + t.className + " ").indexOf(" " + e + " ") > -1
}, t.prototype.addCSSRule = function(t, e, n) {
var i;
return n || (n = 0), i = this.getStyleSheet(), i.insertRule && "function" == typeof i.insertRule ? i.insertRule(t + "{" + e + "}", n) : i.addRule && "function" == typeof i.addRule ? i.addRule(t, e, n) : void 0
}, t.prototype.clearCSSRules = function() {
var t;
return this.css = void 0, t = document.querySelector("style#" + VP.CONST.style_id), t ? t.parentNode.removeChild(t) : void 0
}, t.prototype.removeElement = function(t) {
return t && t.parentNode ? t.parentNode.removeChild(t) : void 0
}, t.prototype.cloneObj = function(t) {
var e, n, i, r, o;
if (n = null, null === t || "object" != typeof t) return t;
if (t instanceof Date) return n = new Date, n.setTime(t.getTime()), n;
if (t instanceof Array) {
for (n = [], i = r = 0, o = t.length - 1; o >= 0 ? o >= r : r >= o; i = o >= 0 ? ++r : --r) n[i] = this.cloneObj(t[i]);
return n
}
if (t instanceof Object) {
n = {};
for (e in t) t.hasOwnProperty(e) && (n[e] = this.cloneObj(t[e]));
return n
}
throw new Error("Unable to copy obj! Its type isn't supported.")
}, t.prototype.currentTimeMillis = function() {
return (new Date).getTime()
}, t.prototype.getPixelValue = function(t, e) {
var n, i, r;
return n = /^\d+(px)?$/i, n.test(e) ? parseInt(e) : (r = t.style.left, i = t.runtimeStyle.left, t.runtimeStyle.left = t.currentStyle.left, t.style.left = e || 0, e = t.style.pixelLeft, t.style.left = r, t.runtimeStyle.left = i, e)
}, t.prototype.getActualWidth = function(t) {
var e;
return window.getComputedStyle ? (e = getComputedStyle(t, null), parseInt(e.width)) : this.getPixelValue(t, t.currentStyle.width)
}, t.prototype.getActualHeight = function(t) {
var e;
return window.getComputedStyle ? (e = getComputedStyle(t, null), parseInt(e.height)) : this.getPixelValue(t, t.currentStyle.height)
}, t.prototype.loadScript = function(t, e) {
var n, i, r;
return this.scriptsLoaded || (this.scriptsLoaded = []), "file:" === location.protocol && t.startsWith("//") && (t = "http:" + t), this.scriptsLoaded.indexOf(t) >= 0 ? void(e && e()) : (n = !1, i = document.createElement("script"), i.type = "text/javascript", i.src = t, i.onload = i.onreadystatechange = function(i) {
return function() {
return n || i.readyState && "complete" !== i.readyState || (n = !0, i.scriptsLoaded.push(t), !e) ? void 0 : e()
}
}(this), r = document.getElementsByTagName("script")[0], r.parentNode.insertBefore(i, r))
}, t.prototype.loadStyleSheet = function(t, e) {
var n, i, r;
return this.stylesheetsLoaded || (this.stylesheetsLoaded = []), this.stylesheetsLoaded.indexOf(t) >= 0 ? void(e && e()) : (r = document.createElement("style"), r.textContent = '@import "' + t + '"', n = setInterval(function(i) {
return function() {
var o;
try {
if (r.sheet.cssRules, clearInterval(n), i.stylesheetsLoaded.push(t), e) return e()
} catch (s) {
throw o = s
}
}
}(this), 10), i = document.getElementsByTagName("head")[0], i.appendChild(r))
}, t.prototype.asyncParallel = function(t, e) {
var n, i, r, o, s, a, u, d;
for (u = [], n = !1, s = null, o = 0, a = t.length; a > o; o++) {
if (d = t[o], n) return e(s);
r = d[0], i = d[1], r(i, function(i) {
return function(i, r) {
return i ? (n = !0, s = i) : (u.push(r), u.length === t.length ? e(null, u) : void 0)
}
}(this))
}
}, t.prototype.capitalize = function(t) {
return t[0].toUpperCase() + t.slice(1)
}, t.prototype.trim = function(t) {
return t.replace(/^\s+|\s+$/g, "")
}, t.prototype.blank = function(t) {
return /^\s+$/.test(t)
}, t
}(), this.VP.Util = t
}.call(this),
function() {
var t;
t = function() {
function t() {}
return t.prototype.get = function(t) {
return VPCookies.get(t)
}, t.prototype.set = function(t, e) {
return VPCookies.set(t, e, {
expires: 3650
})
}, t.prototype.has = function(t) {
var e;
return e = VPCookies.get(t), !!e
}, t.prototype.dontHave = function(t) {
return !this.has(t)
}, t
}(), this.VP.VPCookieUtil = t
}.call(this),
function() {
var t;
t = function() {
function t() {}
return t.prototype.init = function() {
return this.util = new VP.Util, this.cookie = new VP.VPCookieUtil, this.deviceId = this.getOrCreateDeviceId(), this.sessionKey = this.getOrCreateSessionKey(), this.sessionCreatedDt = this.getSessionCreatedDt()
}, t.prototype.getOrCreateRandomStringCookie = function(t, e) {
var n;
return n = this.cookie.get(t), n && 0 !== n.length || (n = this.util.randomString(e), this.cookie.set(t, n)), n
}, t.prototype.getOrCreateDeviceId = function() {
return this.getOrCreateRandomStringCookie("vp_device_id", 43)
}, t.prototype.getOrCreateSessionKey = function() {
return this.needToCreateSessionKey() && (this.cookie.set("vp_session_key", this.util.randomString(64)), this.cookie.set("vp_session_created_dt", this.util.currentTimeMillis())), this.cookie.set("vp_session_last_dt", this.util.currentTimeMillis()), this.cookie.get("vp_session_key")
}, t.prototype.needToCreateSessionKey = function() {
var t, e;
return (e = this.cookie.dontHave("vp_session_key") || this.cookie.dontHave("vp_session_created_dt") || this.cookie.dontHave("vp_session_last_dt")) ? !0 : (t = this.util.currentTimeMillis() - this.cookie.get("vp_session_last_dt") > VP.CONST.session_expire_time, t ? !0 : !1)
}, t.prototype.getSessionCreatedDt = function() {
return this.cookie.get("vp_session_created_dt")
}, t.prototype.setUserInfo = function(t, e) {
return this.cookie.set("userInfo_" + t, e)
}, t.prototype.getUserInfo = function(t) {
return this.cookie.get("userInfo_" + t)
}, t
}(), this.VP.VPCookieStore = t
}.call(this),
function() {
var t;
t = function() {
function t() {}
return t.prototype.requestToInit = function() {
return this.exec("requestToInit")
}, t.prototype.requestToTrackAsk = function(t) {
return this.exec("requestToTrackAsk", {
ask: t
})
}, t.prototype.requestToTrack = function(t) {
return this.exec("requestToTrack", {
p: t
})
}, t.prototype.requestToSetUserInfo = function(t, e) {
return this.exec("requestToSetUserInfo", {
key: t,
val: e
})
}, t.prototype.requestToOpenUrl = function(t, e) {
return this.exec("requestToOpenUrl", {
url: t,
altUrl: e
})
}, t.prototype.exec = function(t, e) {
var n, i, r;
return e || (e = {}), i = "vpbridge://" + t + "?" + function() {
var t;
t = [];
for (n in e) r = e[n], t.push(n + "=" + encodeURIComponent(r));
return t
}().join("&"), location.href = i
}, t
}(), this.VP.VPHybridBridge = t
}.call(this),
function() {
var t, e;
t = function() {
function t() {}
return t.prototype["if"] = function(t) {
return this.ifAction = t, this
}, t.prototype.then_becomes = function(t) {
return this.becomesState = t, this
}, t.prototype.then_execute = function(t) {
return this.callback = t, this
}, t
}(), e = function() {
function e(t, e) {
this.defaultState = e, this.rules = [], this.stateMap = {}, this.init(t)
}
return e.prototype.init = function(t) {
return t.addEvent(window, "message", function(t) {
return function(e) {
var n, i;
if (e && e.data) try {
if (n = e.data, "object" == typeof n && n.action) return t.handleAction(n.action, n.iframe_id, n, e)
} catch (r) {
throw i = r
}
}
}(this), !1)
}, e.prototype.handleAction = function(t, e, n, i) {
var r, o, s, a, u;
for (s = this.rules, a = [], r = 0, o = s.length; o > r; r++) u = s[r], u.conditionState && u.conditionState !== this.getState(e) || u.ifAction === t && (u.becomesState && this.setState(e, u.becomesState), u.callback ? a.push(u.callback(n, i)) : a.push(void 0));
return a
}, e.prototype.getState = function(t) {
return this.stateMap[t] || this.defaultState
}, e.prototype.setState = function(t, e) {
return this.stateMap[t] = e
}, e.prototype.when = function(e) {
var n;
return n = new t, n.conditionState = e, n
}, e.prototype.add = function(t) {
return this.rules.push(t)
}, e
}(), this.VP.WindowMessageStatusMachine = e
}.call(this),
function() {
var t;
t = function() {
function t(t, e) {
this.util = e, this.pageUrl = t, this.util = new VP.Util, this.pendingTasks = [], this.isLoadingAd = !1, this._bindMessageEvent()
}
return t.prototype._bindMessageEvent = function() {
return this.util.addEvent(window, "message", function(t) {
return function(e) {
var n;
if (e && e.data) try {
if (n = e.data, "string" == typeof n) {
if ("adpnt" === JSON.parse(n).googMsgType) return t.adFilled({
provider: "adx",
hideIframeDuringLoad: t.hideIframeDuringLoad
})
} else if ("object" == typeof n && "passback_no_ad" === n.action && "adx" === n.provider) return t.noAd(n)
} catch (i) {}
}
}(this), !1)
}, t.prototype.run = function(t, e, n, i, r, o, s) {
var a;
return this.isLoadingAd ? (a = !document.querySelector("#" + this.wrapperId), a ? (this.clear(), this.isLoadingAd = !0, this.runInternal(t, e, n, i, r, o, s)) : function(t) {
return function(e, n, i, r, s, a) {
return t.pendingTasks.push(function() {
return t.run(e, n, i, r, s, o, a)
})
}
}(this)(t, e, n, i, r, s)) : (this.isLoadingAd = !0, this.runInternal(t, e, n, i, r, o, s))
}, t.prototype.runInternal = function(t, e, n, i, r, o, s) {
var a, u, d, l, p;
return l = r.placement.split("/"), u = l[0], d = l[1], this.adCallback = s, this.wrapperId = i, this.hideIframeDuringLoad = o.hideIframeDuringLoad, this.util.addCSSRule("#" + i + " .adsbygoogle", "display:block;width:" + e + "px !important;height:" + n + "px !important"), a = document.createElement("ins"), a.className = "adsbygoogle", a.style.position = "relative", a.style.left = "50%", a.style["margin-left"] = "-" + Math.floor(e / 2) + "px", a.setAttribute("data-ad-client", u), a.setAttribute("data-ad-slot", d), a.setAttribute("data-page-url", this.getPageUrl()), p = document.getElementById(i), p.appendChild(a), this.util.loadScript(VP.CONST.adx_script_url, function(t) {
return function() {
var i;
try {
return (i = window.adsbygoogle || []).push({
params: {
google_ad_width: e,
google_ad_height: n
}
})
} catch (r) {
return a.style.display = "none", t.executeAndRemoveCallback(!1)
}
}
}(this))
}, t.prototype.getPageUrl = function() {
return this.pageUrl ? this.pageUrl : location.href
}, t.prototype.executeAndRemoveCallback = function(t) {
var e;
return this.adCallback && this.adCallback(t), t || (document.querySelector("#" + this.wrapperId + " .adsbygoogle").style.display = "none"), this.clear(), this.pendingTasks.length > 0 ? (e = this.pendingTasks.shift())() : void 0
}, t.prototype.clear = function() {
return this.adCallback = null, this.isLoadingAd = !1, this.wrapperId = null
}, t.prototype.adFilled = function(t) {
var e;
return t.hideIframeDuringLoad && (e = document.querySelector("#" + this.wrapperId), e.style.removeProperty("position"), e.style.removeProperty("left")), this.executeAndRemoveCallback(!0)
}, t.prototype.noAd = function(t) {
return this.executeAndRemoveCallback(!1)
}, t
}(), this.VP.AdXPassback = t
}.call(this),
function() {
var t;
t = function() {
function t(t) {
this.util = t, this.util.addCSSRule("#ima-countdown-div", "margin-left: 5px")
}
return t.prototype.run = function(t, e, n, i, r, o, s) {
return this.loadResources(function(t) {
return function() {
var i, a, u, d, l, p;
return l = o.videoOpts.videoId, t.util.addCSSRule("#" + l, "overflow: hidden; width: " + e + "px; height: " + n + "px;"), p = o.videoOpts.videojs || window.videojs, d = p(l), u = {
id: l,
adTagUrl: t.getAdTagUrl(r, o.videoOpts)
}, o.videoOpts.ad_label && (u.adLabel = o.videoOpts.ad_label), d.ima(u), VP.logVideoAd("playerSet"), i = document.getElementById(l + "_html5_api"), (navigator.userAgent.match(/iPad/i) || navigator.userAgent.match(/Android/i)) && i.hasAttribute("controls") && i.removeAttribute("controls"), a = "click", d.one(a, function() {
return VP.logVideoAd("playerClicked"), d.ima.initializeAdDisplayContainer(), d.ima.requestAds(), d.play()
}), o.videoOpts.autoplay && (VP.logVideoAd("autoplay"), d.ima.initializeAdDisplayContainer(), d.ima.requestAds(), d.play()), s(!0)
}
}(this))
}, t.prototype.loadResources = function(t) {
var e;
return e = [
[this.util.loadScript, VP.CONST.ima_js],
[this.util.loadScript, VP.CONST.video_ad_js],
[this.util.loadStyleSheet, VP.CONST.video_ad_css]
], this.util.asyncParallel(e, function(e) {
return function() {
return t ? t() : void 0
}
}(this))
}, t.prototype.getAdTagUrl = function(t, e) {
var n, i, r, o, s, a, u, d, l, p, c;
return l = "https://googleads.g.doubleclick.net/pagead/ads?", a = [], a.push(["description_url", location.href]), u = t.placement.split("/"), o = u[0], d = u[1], a.push(["client", o]), a.push(["slotname", d]), e.test === !0 && a.push(["adtest", "on"]), p = "video", c = 0, e.video_ad && (p = e.video_ad.skippable === !1 && e.video_ad.standard === !1 ? null : e.video_ad.skippable === !1 ? "standardvideo" : e.video_ad.standard === !1 ? "skippablevideo" : "video", e.video_ad.preroll === !0 ? c = 0 : e.video_ad.midroll > 0 ? c = e.video_ad.midroll : e.video_ad.postroll === !0 && (c = -1), e.video_ad.max_duration > 0 && a.push(["max_ad_duration", e.video_ad.max_duration]), e.video_ad.min_duration > 0 && a.push(["min_ad_duration", e.video_ad.min_duration]), e.video_ad.max_duration > 0 && a.push(["sdmax", e.video_ad.max_duration_for_skippable])), a.push(["ad_type", p]), a.push(["videoad_start_delay", c]), e.content && (e.content.title && a.push(["vid_t", e.content.title]), e.content.duration && a.push(["vid_d", Math.floor(e.content.duration / 1e3)]), e.content.keywords && a.push(["vid_kw", e.content.keywords.join(",")])), VP.getUserBirth() && (i = "" + VP.getUserBirth(), r = i.slice(0, 4), 4 === r.length && (n = (new Date).getFullYear() - r, n > 0 && 150 > n && a.push(["cust_age", n]))), "M" === VP.getUserGender() && a.push(["cust_gender", 1]), "F" === VP.getUserGender() && a.push(["cust_gender", 2]), l += function() {
var t, e, n;
for (n = [], t = 0, e = a.length; e > t; t++) s = a[t], n.push(s[0] + "=" + encodeURIComponent(s[1]));
return n
}().join("&")
}, t
}(), this.VP.AdXVideoPassback = t
}.call(this),
function() {
var t;
t = function() {
function t(t, e) {
this.map = {
adx: new VP.AdXPassback(t, e),
"adx/video": new VP.AdXVideoPassback(e)
}
}
return t.prototype.run = function(t, e, n, i, r, o, s) {
var a;
return s || (s = function() {}), r = r || [], (a = function(u) {
return function() {
var d, l;
return (d = r.shift()) ? (l = u.getHandler(d), l ? l.run(t, e, n, i, d, o, function(t) {
return t ? s(t) : a()
}) : a()) : s(!1)
}
}(this))()
}, t.prototype.getHandler = function(t) {
var e, n, i, r;
return i = null, "adx" === t.provider ? (r = t.placement.split("/"), e = r[0], n = r[1], i = e.startsWith("ca-video-pub-") && n.endsWith("_video") ? this.map["adx/video"] : this.map.adx) : i = this.map[t.provider], i
}, t
}(), this.VP.PassbacksHandler = t
}.call(this),
function() {
var t;
t = function() {
function t() {
this.init()
}
return t.prototype.init = function() {
return this.listeners = {}, this.emitted = {}
}, t.prototype.on = function(t, e) {
return this.listeners[t] = this.listeners[t] || [], this.listeners[t].push(e), this
}, t.prototype.emit = function() {
var t, e, n, i, r, o, s;
if (t = Array.prototype.slice.call(arguments), e = t[0], this.listeners[e]) {
for (o = this.listeners[e], s = [], n = 0, i = o.length; i > n; n++) r = o[n], s.push(r.apply(this, t));
return s
}
}, t.prototype.emit_once = function() {
var t, e, n, i, r, o, s;
if (t = Array.prototype.slice.call(arguments), e = t[0], this.listeners[e]) {
for (o = this.listeners[e], s = [], n = 0, i = o.length; i > n; n++) r = o[n], this.emitted[e] ? s.push(void 0) : (this.emitted[e] = !0, s.push(r.apply(this, t)));
return s
}
}, t
}(), this.VP.EventEmitter = t
}.call(this),
function() {
var t, e, n, i, r, o, s, a, u, d, l = {}.hasOwnProperty,
p = function(t, e) {
return function() {
return t.apply(e, arguments)
}
},
c = function(t, e) {
function n() {
this.constructor = t
}
for (var i in e) l.call(e, i) && (t[i] = e[i]);
return n.prototype = e.prototype, t.prototype = new n, t.__super__ = e.prototype, t
};
i = function() {
return VP.CONST.DEBUG ? console.log.apply(console, arguments) : void 0
}, r = function(t, e) {
if (VP.CONST.DEBUG && !t) throw Error("ensure error: " + e);
return t
}, s = function(t) {
return t
}, a = function(t) {
return VP.CONST.DEBUG && i(t), t
}, u = function(t) {
return t.replace(/^\s+|\s+$/g, "")
}, o = function(t) {
return t && !!t.childNodes
}, d = function(t) {
var e, n;
if (null === t) return t;
for (e in t) l.call(t, e) && (n = t[e], "string" == typeof n ? t[e] = u(n) : "object" != typeof n || o(n) || (t[e] = d(n)));
return t
}, n = function(t) {
function e() {
return this._buildImgBannerElement = p(this._buildImgBannerElement, this), e.__super__.constructor.apply(this, arguments)
}
return c(e, t), e.prototype.buildWithFredValue = function(t, e) {
var n, i, o, s, a, u;
for (s = r(document.getElementById(e), "placeholder should be exsits"), a = [this._buildImgBannerElement(t), VP.rapsodyPlayer.view.build(t)], u = [], i = 0, o = a.length; o > i; i++) n = a[i], n ? (s.appendChild(n), u.push(n.style.margin = "0 auto")) : u.push(void 0);
return u
}, e.prototype._buildImgBannerElement = function(t) {
var e, n, i, r, o, s, a, u;
if (t.image_banner && (n = t.image_banner.url)) {
for (i = document.createElement("img"), i.style.width = "100%", i.className = "vp-fred-img", i.src = n, i.addEventListener("click", function(t) {
return function(e) {
return t.emit("fred-img-banner-click")
}
}(this)), s = t.opts, a = ["width", "height"], e = 0, o = a.length; o > e; e++) r = a[e], u = "fredImageBanner" + VP.util.capitalize(r), s[u] && (i.style[r] = s[u]);
return i
}
}, e
}(VP.EventEmitter), e = function() {
function t() {
this.setUpTracking = p(this.setUpTracking, this), this._trackWithVastTrackingEventName = p(this._trackWithVastTrackingEventName, this), this._track = p(this._track, this), this._httpGET = p(this._httpGET, this), this._interpolate = p(this._interpolate, this), this._urlFromLinearForVastEvent = p(this._urlFromLinearForVastEvent, this)
}
return t.prototype.fredValue = function(t, e) {
var n, i, r, o, s;
return this.vastDoc = t, this.inline = r = this.firstInline(t), this.linear = o = this.firstInlineLinear(r), this.mediaFile = s = this.bestMatchInMediaFiles(this.mediaFiles(o), e), this.companion = i = this.firstCompanion(t), i && (n = {
wh: this.companion_wh(i),
url: this.imageBannerURL(i),
click_track: this.companionClickTracking(i)
}), d({
ad_title: this.adTitle(r),
viewable_impression: this.viewableImpression(r),
video: {
wh: this.wh(s),
url: this.videoURLFromAMediaFile(s),
poster: this.posterFromAMediaFile(s),
click_track: this.linearClickTracking(o),
trackings: this.linearTrackingEvents(o)
},
image_banner: n,
destination_url: this.linearClickThrough(o),
call_to_action_type: this.callToActionType(o)
})
}, t.prototype.wh = function(t) {
return {
width: t.getAttribute("width"),
height: t.getAttribute("height")
}
}, t.prototype.companion_wh = function(t) {
return {
width: t.getAttribute("expandedWidth"),
height: t.getAttribute("expandedHeight")
}
}, t.prototype._xpathEvalFirst = function(t, e) {
var n, i;
return t.ownerDocument ? (n = t.ownerDocument, i = t) : (n = t, i = (n.children || n.childNodes)[0]), n.evaluate(e, i, null, XPathResult.ANY_TYPE, null).iterateNext()
}, t.prototype.viewableImpression = function(t) {
var e;
return e = this._xpathEvalFirst(t, "ViewableImpression/Viewable"), e ? e.textContent : void 0
}, t.prototype.videoURLFromAMediaFile = function(t) {
return t.textContent
}, t.prototype.posterFromAMediaFile = function(t) {
return t.getAttribute("poster")
}, t.prototype.adTitle = function(t) {
var e;
return e = this._xpathEvalFirst(t, "AdTitle"), r(e, "no adTitle element exists").textContent
}, t.prototype.firstInline = function(t) {
var e;
return e = this._xpathEvalFirst(t, "/VAST/Ad/InLine"), r(e, "no inline element exists")
}, t.prototype.firstInlineLinear = function(t) {
var e;
return e = this._xpathEvalFirst(t, "Creatives/Creative/Linear"), r(e, "no linear element exists")
}, t.prototype.firstCompanion = function(t) {
var e;
return e = this._xpathEvalFirst(t, "//CompanionAds/Companion"), s(e)
}, t.prototype.mediaFiles = function(t) {
return t.getElementsByTagName("MediaFile")
}, t.prototype.bestMatchInMediaFiles = function(t, e) {
var n, i, r, o;
return o = function(t) {
return t && t.getAttribute("width")
}, i = function() {
var n, i, s;
for (s = [], n = 0, i = t.length; i > n; n++) r = t[n], r && o(r) < e.w && s.push(r);
return s
}(), n = VP.util.maxFromArray(i, o), n || t[0]
}, t.prototype._find = function(t, e) {
return t.querySelectorAll(e)[0]
}, t.prototype.imageBannerURL = function(t) {
var e;
return e = this._find(t, "StaticResource"), e ? e.textContent : void 0
}, t.prototype.linearClickThrough = function(t) {
return this._find(t, "ClickThrough").textContent
}, t.prototype.callToActionType = function(t) {
var e;
return e = this._find(t, "ClickThrough"), e ? e.getAttribute("type") : void 0
}, t.prototype.linearClickTracking = function(t) {
return this._find(t, "ClickTracking").textContent
}, t.prototype.companionClickTracking = function(t) {
return this._find(t, "CompanionClickTracking").textContent
}, t.prototype.linearTrackingEvents = function(t) {
return t.getElementsByTagName("Tracking")
}, t.prototype._urlFromLinearForVastEvent = function(t, e, n) {
var i;
return i = t.evaluate('TrackingEvents/Tracking[@event="' + n + '"]', e, null, XPathResult.ANY_TYPE, null).iterateNext(), r(i, "no tracking node for " + n), r(VP.util.trim(i.textContent), "url for " + n + " is empty")
}, t.prototype._interpolate = function(t, e) {
var n, i;
for (n in e) i = e[n], t = t.replace("{" + n + "}", encodeURIComponent(i));
return t
}, t.prototype._httpGET = function(t, e) {
return i("_httpGET:", t), VP.util.createHiddenIframe(t, e)
}, t.prototype._track_hash = function(t) {
return {
url: null,
vpCurrentPlayTime: parseInt(t || VP.rapsodyPlayer._video().currentTime),
vpEventTimestamp: (new Date).toISOString()
}
}, t.prototype._assoc = function(t, e, n) {
return t[e] = n, t
}, t.prototype._assoc_url = function(t, e) {
return this._assoc(t, "url", e)
}, t.prototype._track = function(t, e) {
var n;
return i("_track:", t), n = t.url, this._httpGET(this._interpolate(n, t), e)
}, t.prototype._trackWithVastTrackingEventName = function(t, e) {
var n, r;
return i("trying to track " + t), r = this._urlFromLinearForVastEvent(this.vastDoc, this.linear, t), ("function" == typeof(n = VP.util).blank ? n.blank(r) : void 0) ? void 0 : this._track(this._assoc_url(this._track_hash(), r), e)
}, t.prototype.setUpTracking = function(t) {
var e, n, i, r, o, s, a, d, l, p, c, h, f, m, y, v, g, _;
for (i = function(t) {
return t ? t.match(/(\d+:?)+/) : void 0
}, r = function(t) {
return t ? t.match(/\d+%/) : void 0
}, a = function(t) {
var e, n, i, r, o;
for (r = 0, i = t.split(":"), e = 0, n = i.length; n > e; e++) o = i[e], r = 60 * r + parseInt(o);
return r
}, s = function(t) {
var e;
return e = /(\d+)%/.exec(t), e ? parseInt(e[1]) : void 0
}, o = function(t, e, n) {
var i, r, o, s, a;
for (i = null, r = 0, o = t.length; o > r; r++) s = t[r], a = e(s), n >= a && (null === i || i && a > e(i)) && (i = s);
return i
}, n = {}, e = function(t) {
return function(t, e) {
return n[t] ? void 0 : (n[t] = !0, e())
}
}(this), c = function(t, e) {
return function() {
return t(e)
}
}, m = [
[0, "start"],
[25, "firstQuartile"],
[50, "midpoint"],
[75, "thirdQuartile"],
[100, "complete"]
], d = 0, l = m.length; l > d; d++) y = m[d], v = y[0], _ = y[1], VP.rapsodyPlayer.on("quartile_as_percent_" + v, c(this._trackWithVastTrackingEventName, _));
return g = t.video.trackings, f = function() {
var t, e, n;
for (n = [], t = 0, e = g.length; e > t; t++) v = g[t], "progress" === v.getAttribute("event") && n.push(v);
return n
}(), p = function() {
var t, e, n;
for (n = [], t = 0, e = g.length; e > t; t++) v = g[t], i(v.getAttribute("offset")) && n.push(v);
return n
}(), h = function() {
var t, e, n;
for (n = [], t = 0, e = g.length; e > t; t++) v = g[t], r(v.getAttribute("offset")) && n.push(v);
return n
}(), VP.rapsodyPlayer.on("timeupdate", function(t) {
return function(n, i, r) {
var d, l, c, f, m;
return d = function(t) {
return t.getAttribute("offset")
}, l = o(p, function(t) {
return a(d(t))
}, i), c = o(h, function(t) {
return s(d(t))
}, Math.ceil(i / r * 100)), (f = l) && (m = u(f.textContent)) && e(d(f), function() {
return t._track(t._assoc_url(t._track_hash(i), m))
}), (f = c) && (m = u(f.textContent)) ? e(d(f), function() {
return t._track(t._assoc_url(t._track_hash(i), m))
}) : void 0
}
}(this)), VP.rapsodyPlayer.on("fullscreen", function(t) {
return function() {
return t._trackWithVastTrackingEventName("fullscreen")
}
}(this)), VP.rapsodyPlayer.on("pause", function(t) {
return function() {
return t._trackWithVastTrackingEventName("pause")
}
}(this)), VP.rapsodyPlayer.on("mute", function(t) {
return function() {
return t._trackWithVastTrackingEventName("mute")
}
}(this)), VP.rapsodyPlayer.on("videoclick-for-go-to-advertiser", function(e) {
return function() {
var n;
return (n = t.video.click_track) ? e._track(e._assoc_url(e._track_hash(), n), function() {
return location.href = t.destination_url
}) : void 0
}
}(this)), VP.rapsodyPlayer.on("vimp", function(n) {
return function() {
return e("vimp", function() {
var e;
return (e = t.viewable_impression) ? n._track(n._assoc_url(n._track_hash(), e)) : void 0
})
}
}(this)), VP.fred.view.on("fred-img-banner-click", function(e) {
return function() {
var n;
return (n = t.image_banner.click_track) ? e._track(e._assoc_url(e._track_hash(), n), function() {
return location.href = t.destination_url
}) : void 0
}
}(this))
}, t
}(), t = function() {
function t() {
this.view = new n, this.vast = new e
}
return t.prototype.main = function(t, e, n, r) {
var o;
return i("Fred#main"), o = a(this.mergeWith(this.vast.fredValue(e, n), this.convOpts(r))), this.view.buildWithFredValue(o, t), this.vast.setUpTracking(o), VP.rapsodyPlayer.setupVimp(), "iOS" !== VP.util.getDeviceOs() && VP.rapsodyPlayer.setUpAutoPlayInSight(), o
}, t.prototype.convOpts = function(t) {
var e, n, i, r, o, s, a, u, d, l;
for (u = ["fredImageBanner", "rapsody"], i = 0, s = u.length; s > i; i++)
for (e = u[i], d = ["width", "height"], r = 0, a = d.length; a > r; r++) o = d[r], l = "video" + VP.util.capitalize(o), n = e + VP.util.capitalize(o), t && null != t[l] && (t[n] = t[n] || t[l]);
return t
}, t.prototype.mergeWith = function(t, e) {
var n, i, r, o, s, a, u, d, l;
for (e || (e = {}), t.opts || (t.opts = {}), d = ["fredImageBanner", "rapsody"], r = 0, a = d.length; a > r; r++)
for (n = d[r], l = ["width", "height"], o = 0, u = l.length; u > o; o++) s = l[o], i = n + VP.util.capitalize(s), t.opts[i] = e[i];
return t
}, t
}(), this.VP.Fred = t
}.call(this),
function() {
var t, e, n, i, r, o, s, a, u, d, l, p = function(t, e) {
return function() {
return t.apply(e, arguments)
}
},
c = function(t, e) {
function n() {
this.constructor = t
}
for (var i in e) h.call(e, i) && (t[i] = e[i]);
return n.prototype = e.prototype, t.prototype = new n, t.__super__ = e.prototype, t
},
h = {}.hasOwnProperty;
r = function() {
return VP.CONST.DEBUG ? console.log.apply(console, arguments) : void 0
}, o = function(t, e) {
if (VP.CONST.DEBUG && !t) throw Error("ensure error: " + e);
return t
}, d = function(t) {
return document.querySelectorAll(t)[0]
}, a = function(t, e) {
var n;
return n = t.getBoundingClientRect(), e = e || 1, n.top >= 0 && n.left >= 0 && n.top + n.height * e <= (window.innerHeight || document.documentElement.clientHeight) && n.left + n.width * e <= (window.innerWidth || document.documentElement.clientWidth) * e
}, u = function(t) {
var e;
return e = t.getBoundingClientRect(), e.top > (window.innerHeight || document.documentElement.clientHeight) || e.top + e.height < 0 || e.left + e.width < 0 || e.left > (window.innerWidth || document.documentElement.clientWidth)
}, t = function() {
function t() {
this.timer = null
}
return t.prototype.CONTROL_OFF_TIMEOUT = 5e3, t.prototype.start = function(t) {
return r("controlOffTimer.start() called"), this.clear(), this.timer = setTimeout(function(t) {
return function() {
return VP.rapsodyPlayer.transite_to(VP.rapsodyPlayer.fsm.controllOnOff, "off")
}
}(this), t || this.CONTROL_OFF_TIMEOUT)
}, t.prototype.clear = function() {
return this.timer ? (clearTimeout(this.timer), this.timer = null) : void 0
}, t
}(), e = function() {
function e() {
this.controlOffTimer = new t, this.controllOnOff = {}, this.controllOnOff.name = "FSM.controllOnOff", this.controllOnOff.current = "on", this.controllOnOff.map = {
off: {
feed_events: {
touch: function(t) {
return function() {
return VP.rapsodyPlayer.transite_to(t.controllOnOff, "on")
}
}(this)
},
transition_to: {
on: function(t) {
return function() {
return VP.rapsodyPlayer.updateControls()
}
}(this)
}
},
on: {
feed_events: {
touch: function(t) {
return function() {
return VP.rapsodyPlayer.transite_to(t.controllOnOff, "off")
}
}(this)
},
transition_to: {
off: function(t) {
return function() {
return VP.rapsodyPlayer.updateControls()
}
}(this)
}
}
}, this.player = {}, this.player.name = "FSM.player", this.player.current = "paused", this.player.ended = !1, this.player.map = {
paused: {
feed_events: {
play: function(t) {
return function() {
return t.player.ended = !1, VP.rapsodyPlayer.transite_to(t.player, "playing")
}
}(this),
pause: function(t) {
return function() {
return VP.rapsodyPlayer.transite_to(t.controllOnOff, "on"), t.controlOffTimer.clear()
}
}(this),
touch: function(t) {
return function() {
return VP.rapsodyPlayer.transite_to(t.controllOnOff, "on"), t.controlOffTimer.clear()
}
}(this),
"autoplay-in-sight": function(t) {
return function() {
return t.player.ended = !1, VP.rapsodyPlayer.autoplayMuted = !0, VP.rapsodyPlayer.mute(), VP.rapsodyPlayer.transite_to(t.player, "playing")
}
}(this)
},
transition_to: {
playing: function(t) {
return function() {
return VP.rapsodyPlayer.transite_to(t.controllOnOff, "off"), VP.rapsodyPlayer._video().play()
}
}(this)
}
},
playing: {
feed_events: {
pause: function(t) {
return function() {
return VP.rapsodyPlayer.transite_to(t.player, "paused")
}
}(this),
touch: function(t) {
return function() {
return VP.rapsodyPlayer.transite_to(t.controllOnOff, "on"), VP.rapsodyPlayer.autoplayMuted && VP.rapsodyPlayer.unmute(), t.controlOffTimer.start()
}
}(this)
},
transition_to: {
paused: function(t) {
return function() {
return VP.rapsodyPlayer.emit("pause"), VP.rapsodyPlayer.transite_to(t.controllOnOff, "on"), t.controlOffTimer.clear(), VP.rapsodyPlayer._video().pause(), VP.rapsodyPlayer.updateControls()
}
}(this)
}
}
}
}
return e
}(), l = function(t, e, n) {
var i;
return i = d(t), i && (i.style.display = e || "block", n) ? i.style.backgroundColor = n : void 0
}, s = function(t) {
var e;
return e = d(t), e ? e.style.display = "none" : void 0
}, i = function() {
function t() {
this.updateVolumeBtn = p(this.updateVolumeBtn, this), this.updateCenterBtns = p(this.updateCenterBtns, this), this.updateCenterpannelBackground = p(this.updateCenterpannelBackground, this), this.updateTimeControls = p(this.updateTimeControls, this), this.videoElStateToFSM = p(this.videoElStateToFSM, this)
}
return t.prototype.build = function(t) {
var e, n, i, r, s, a, u, d, l, p, c, h, f, m;
for (f = t.video.url, s = t.destination_url, n = t.ad_title, p = t.opts, this.rapsody_placeholder = document.createElement("div"), this.rapsody_placeholder.className = "vp-rapsody-placeholder", h = document.createElement("video"), h.src = f, h.id = "vp-rapsody-video", t.video.poster && (h.poster = t.video.poster), this.videoEl = h, this.rapsody_placeholder.appendChild(h), this.rapsody_controls = document.createElement("div"), this.rapsody_controls.className = "vp-rapsody-controls", this.rapsody_controls.innerHTML = '<div class="vp-rapsody-controls">\n <div class="vp-rapsody-center-pannel">\n <div class="vp-rapsody-play-btn"></div>\n <div class="vp-rapsody-pause-btn"></div>\n <div class="vp-rapsody-finished-pannel">\n <section class="vp-rapsody-replay-btn">\n <div class="vp-rapsody-md-replay-icon"></div>\n <label class="vp-rapsody-replay-btn-label">\ub2e4\uc2dc \ubcf4\uae30</label>\n </section>\n <section class="vp-rapsody-call-to-action-btn">\n </section>\n </div>\n </div>\n <div class="vp-rapsody-bottom-pannel">\n <div class="vp-rapsody-current-time">\n <span>0:00</span>\n </div>\n <div class="vp-rapsody-time-spliter">\n /\n </div>\n <div class="vp-rapsody-total-duration">\n <span>0:00</span>\n </div>\n <div class="vp-rapsody-progress-bar">\n <div class="vp-rapsody-progress-bar-backpannel">\n <span class="vp-rapsody-progress-bar-highlight"></span>\n </div>\n </div>\n <div class="vp-rapsody-volume-off"></div>\n <div class="vp-rapsody-volume-on"></div>\n <div class="vp-rapsody-fullscreen-btn"></div>\n </div>\n <a class="vp-rapsody-go-to-advertiser-page">\n <label></label>\n <span class="vp-rapsody-go-to-advertiser-page-icon"></span>\n </a>\n</div>',
this.rapsody_placeholder.appendChild(this.rapsody_controls), i = this.rapsody_controls.querySelector(".vp-rapsody-call-to-action-btn"), i.innerHTML = "download" === t.call_to_action_type ? '<div class="vp-rapsody-md-get-app-icon"></div>\n<label class="vp-rapsody-call-to-action-btn-label">\uc9c0\uae08 \uc124\uce58</label>' : '<div class="vp-rapsody-md-launch-icon"></div>\n<label class="vp-rapsody-call-to-action-btn-label">\ub354 \uc54c\uc544\ubcf4\uae30</label>', c = ["width", "height"], u = 0, l = c.length; l > u; u++) d = c[u], m = "rapsody" + VP.util.capitalize(d), p[m] && (h.style[d] = p[m], this.rapsody_placeholder.style[d] = p[m]);
return this.RP = o(VP.rapsodyPlayer, "RapsodyPlayer should be initialized first"), this._listen(this.rapsody_controls, "click", this.mkFnFeedEventToPlayer("touch")), this._listen(this._findByClassName("vp-rapsody-play-btn"), "click", this.mkFnFeedEventToPlayer("play")), this._listen(this._findByClassName("vp-rapsody-replay-btn"), "click", this.mkFnFeedEventToPlayer("play")), this._listen(this._findByClassName("vp-rapsody-call-to-action-btn"), "click", function(t) {
return function() {
return t.RP.emit("videoclick-for-go-to-advertiser")
}
}(this)), this._listen(this._findByClassName("vp-rapsody-pause-btn"), "click", this.mkFnFeedEventToPlayer("pause")), this._listen(this._findByClassName("vp-rapsody-fullscreen-btn"), "click", function(t) {
return function(e) {
return t.RP.emit("fullscreen"), t.videoEl.webkitRequestFullScreen()
}
}(this)), this._listen(this._findByClassName("vp-rapsody-volume-off"), "click", function(t) {
return function(e) {
return t.RP.autoplayMuted = !1, t.RP.mute()
}
}(this)), this._listen(this._findByClassName("vp-rapsody-volume-on"), "click", function(t) {
return function(e) {
return t.RP.unmute()
}
}(this)), this.videoEl.addEventListener("play", this.videoElStateToFSM), this.videoEl.addEventListener("pause", this.videoElStateToFSM), this.videoEl.addEventListener("ended", function(t) {
return function() {
return t.RP.fsm.player.ended = !0, t.RP.pause(), t.RP.updateControls()
}
}(this)), this.videoEl.addEventListener("webkitfullscreenchange", function(t) {
return function() {
return t.videoElStateToFSM(), VP.rapsodyPlayer.transite_to(t.RP.fsm.controllOnOff, "on"), VP.rapsodyPlayer.updateControls()
}
}(this)), this.videoEl.addEventListener("timeupdate", function(t) {
return function() {
return t.updateTimeControls()
}
}(this)), this.videoEl.addEventListener("timeupdate", function(t) {
return function() {
var t, e, n, i, r;
for (i = Math.ceil(h.currentTime / h.duration * 100), r = [0, 25, 50, 75, 100], e = 0, n = r.length; n > e; e++) t = r[e], i >= t && VP.rapsodyPlayer.emit_once("quartile_as_percent_" + t);
return VP.rapsodyPlayer.emit("timeupdate", h.currentTime, h.duration)
}
}(this)), this._listen(this._findByClassName("vp-rapsody-go-to-advertiser-page"), "click", function(t) {
return function() {
return t.RP.emit("videoclick-for-go-to-advertiser")
}
}(this)), r = "download" === t.call_to_action_type ? "md-get-app" : "landing-arrow", this._q(".vp-rapsody-go-to-advertiser-page label").innerHTML = n, a = this._q(".vp-rapsody-go-to-advertiser-page span"), a.className = a.className + " " + ("vp-rapsody-" + r + "-icon"), "iOS" === VP.util.getDeviceOs() && (e = function(t) {
return function(e) {
var n;
return (n = t._findByClassName(e)) ? n.parentNode.removeChild(n) : void 0
}
}(this), e("vp-rapsody-fullscreen-btn"), e("vp-rapsody-volume-off"), e("vp-rapsody-volume-on"), this._handleEventFullscreenExitsInIOSSafariUpdateFSM(h)), this.rapsody_placeholder
}, t.prototype.videoElStateToFSM = function() {
var t;
return t = this.RP._video(), t.paused ? this.RP.fsm.player.current = "paused" : this.RP.fsm.player.current = "playing"
}, t.prototype._handleEventFullscreenExitsInIOSSafariUpdateFSM = function(t) {
return t.addEventListener("pause", function() {
return VP.rapsodyPlayer.pause()
})
}, t.prototype.updateTimeControls = function() {
var t;
return t = this.videoEl, t.currentTime && (this.currentTimeLabel().innerHTML = this._fmtTm(t.currentTime)), t.duration && (this.totalDurationLabel().innerHTML = this._fmtTm(t.duration)), t.currentTime && t.duration ? this.progressBarHighlight().style.width = t.currentTime / t.duration * 100 + "%" : void 0
}, t.prototype.updateCenterpannelBackground = function(t) {
var e;
return e = d(".vp-rapsody-center-pannel"), e ? e.style.backgroundColor = t : void 0
}, t.prototype.updateCenterBtns = function(t) {
return this.updateCenterpannelBackground(""), "on" === t.controllOnOff.current ? ("playing" === t.player.current ? (l(".vp-rapsody-pause-btn"), s(".vp-rapsody-play-btn"), s(".vp-rapsody-finished-pannel")) : "paused" === t.player.current && (s(".vp-rapsody-pause-btn"), t.player.ended === !0 ? (s(".vp-rapsody-play-btn"), l(".vp-rapsody-finished-pannel", "flex"), this.updateCenterpannelBackground("rgba(0,0,0,0.5)")) : (l(".vp-rapsody-play-btn"), s(".vp-rapsody-finished-pannel"))), l(".vp-rapsody-bottom-pannel", "flex"), l(".vp-rapsody-go-to-advertiser-page")) : "off" === t.controllOnOff.current ? (s(".vp-rapsody-pause-btn"), s(".vp-rapsody-play-btn"), s(".vp-rapsody-finished-pannel"), s(".vp-rapsody-bottom-pannel", "flex"), s(".vp-rapsody-go-to-advertiser-page")) : void 0
}, t.prototype.updateVolumeBtn = function() {
var t;
return t = this.videoEl, t ? t.muted ? (l(".vp-rapsody-volume-on"), s(".vp-rapsody-volume-off")) : (s(".vp-rapsody-volume-on"), l(".vp-rapsody-volume-off")) : void 0
}, t.prototype.mkFnFeedEventToPlayer = function(t) {
return function(e) {
return function() {
return e.RP.feed_event(e.RP.fsm.player, t)
}
}(this)
}, t.prototype.currentTimeLabel = function() {
return this.rapsody_controls.querySelectorAll(".vp-rapsody-current-time > span")[0]
}, t.prototype.totalDurationLabel = function() {
return this.rapsody_controls.querySelectorAll(".vp-rapsody-total-duration > span")[0]
}, t.prototype.progressBarHighlight = function() {
return this.rapsody_controls.querySelectorAll(".vp-rapsody-progress-bar-highlight")[0]
}, t.prototype._fmtTm = function(t) {
var e, n, i;
return i = t.toFixed(), e = Math.floor(i / 60), n = i % 60, 10 > n && (n = "0" + n), e + ":" + n
}, t.prototype._listen = function(t, e, n) {
return t.addEventListener(e, function(t) {
return function(t) {
return n(), t.preventDefault(), t.stopPropagation()
}
}(this))
}, t.prototype._findByClassName = function(t) {
return this.rapsody_controls.getElementsByClassName(t)[0]
}, t.prototype._q = function(t) {
return this.rapsody_controls.querySelector(t)
}, t.prototype.updateControls = function(t) {
return r("updateControls: " + t.controllOnOff.current + ", " + t.player.current), this.updateCenterBtns(t), this.updateTimeControls(), this.updateVolumeBtn()
}, t
}(), n = function(t) {
function n() {
this.setUpAutoPlayInSight = p(this.setUpAutoPlayInSight, this), this.setupVimp = p(this.setupVimp, this), n.__super__.constructor.call(this), this.fsm = new e, this.view = new i, this.disableAutoplay = !1
}
return c(n, t), n.prototype.updateControls = function() {
return this.view.updateControls(this.fsm)
}, n.prototype.play = function() {
return this.feed_event(this.fsm.player, "play")
}, n.prototype.pause = function() {
return this.feed_event(this.fsm.player, "pause")
}, n.prototype.mute = function() {
return this.emit("mute"), this._video().muted = !0, this.updateControls()
}, n.prototype.unmute = function() {
return this._video().muted = !1, this.updateControls()
}, n.prototype.transite_to = function(t, e) {
var n;
return r("transite_to(" + t.name + ": " + t.current + " -> " + e + ")"), n = t.current, t.current = e, this._exec_transition_effects(t.map, n, e), t
}, n.prototype.feed_event = function(t, e) {
var n;
return r("feed_event( " + t.name + ": " + e + ")"), n = this.get_in(t.map, [t.current, "feed_events"])[e], n ? n() : void 0
}, n.prototype._exec_transition_effects = function(t, e, n) {
var i;
return i = this.get_in(t, [e, "transition_to"])[n], i ? i() : void 0
}, n.prototype.get_in = function(t, e) {
var n, i, r, o;
if (!t) throw "map is false-y";
for (r = t, n = 0, i = e.length; i > n; n++)
if (o = e[n], r = r[o], !r) return {};
return r
}, n.prototype._video = function() {
return this.view.videoEl
}, n.prototype.setupVimp = function() {
return a(this._video(), .5) && this.emit("vimp"), document.addEventListener("scroll", function(t) {
return function() {
return a(t._video(), .5) ? t.emit("vimp") : void 0
}
}(this))
}, n.prototype.setUpAutoPlayInSight = function() {
var t, e;
return e = a(this._video(), .5), t = function(t) {
return function(n) {
var i;
if ("vp-rapsody-play-btn" !== n.srcElement.className && "vp-rapsody-go-to-advertiser-page" !== n.srcElement.className) return i = a(t._video(), .5), e || !i || t.disableAutoplay || (t.disableAutoplay = !0, t.feed_event(t.fsm.player, "autoplay-in-sight"), t.emit("autoplay-in-sight")), "playing" === t.fsm.player.current && u(t._video()) && t.feed_event(t.fsm.player, "pause"), e = i
}
}(this), document.addEventListener("touchstart", t), document.addEventListener("touchend", t)
}, n
}(VP.EventEmitter), this.VP.RapsodyPlayer = n
}.call(this);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment