Файловый менеджер - Редактировать - /home/jogoso94/public_html/jogos/downhill_ski/js/main.js
�азад
/* Platform.js <https://mths.be/platform> Copyright 2014-2018 Benjamin Tan <https://bnjmnt4n.now.sh/> Copyright 2011-2013 John-David Dalton Available under MIT license <https://mths.be/mit> */ (function() { var a = "undefined" !== typeof window && "undefined" !== typeof window.document ? window.document : {}, d = "undefined" !== typeof module && module.exports, c = function() { for (var g, l = ["requestFullscreen exitFullscreen fullscreenElement fullscreenEnabled fullscreenchange fullscreenerror".split(" "), "webkitRequestFullscreen webkitExitFullscreen webkitFullscreenElement webkitFullscreenEnabled webkitfullscreenchange webkitfullscreenerror".split(" "), "webkitRequestFullScreen webkitCancelFullScreen webkitCurrentFullScreenElement webkitCancelFullScreen webkitfullscreenchange webkitfullscreenerror".split(" "), "mozRequestFullScreen mozCancelFullScreen mozFullScreenElement mozFullScreenEnabled mozfullscreenchange mozfullscreenerror".split(" "), "msRequestFullscreen msExitFullscreen msFullscreenElement msFullscreenEnabled MSFullscreenChange MSFullscreenError".split(" ") ], e = 0, n = l.length, b = {}; e < n; e++) if ((g = l[e]) && g[1] in a) { for (e = 0; e < g.length; e++) b[l[0][e]] = g[e]; return b } return !1 }(), f = { change: c.fullscreenchange, error: c.fullscreenerror }, m = { request: function(g) { return new Promise(function(l, e) { var n = function() { this.off("change", n); l() }.bind(this); this.on("change", n); g = g || a.documentElement; Promise.resolve(g[c.requestFullscreen]())["catch"](e) }.bind(this)) }, exit: function() { return new Promise(function(g, l) { if (this.isFullscreen) { var e = function() { this.off("change", e); g() }.bind(this); this.on("change", e); Promise.resolve(a[c.exitFullscreen]())["catch"](l) } else g() }.bind(this)) }, toggle: function(g) { return this.isFullscreen ? this.exit() : this.request(g) }, onchange: function(g) { this.on("change", g) }, onerror: function(g) { this.on("error", g) }, on: function(g, l) { var e = f[g]; e && a.addEventListener(e, l, !1) }, off: function(g, l) { var e = f[g]; e && a.removeEventListener(e, l, !1) }, raw: c }; c ? (Object.defineProperties(m, { isFullscreen: { get: function() { return !!a[c.fullscreenElement] } }, element: { enumerable: !0, get: function() { return a[c.fullscreenElement] } }, isEnabled: { enumerable: !0, get: function() { return !!a[c.fullscreenEnabled] } } }), d ? module.exports = m : window.screenfull = m) : d ? module.exports = { isEnabled: !1 } : window.screenfull = { isEnabled: !1 } })(); (function() { function a(h) { h = String(h); return h.charAt(0).toUpperCase() + h.slice(1) } function d(h, B) { var C = -1, z = h ? h.length : 0; if ("number" == typeof z && -1 < z && z <= r) for (; ++C < z;) B(h[C], C, h); else f(h, B) } function c(h) { h = String(h).replace(/^ +| +$/g, ""); return /^(?:webOS|i(?:OS|P))/.test(h) ? h : a(h) } function f(h, B) { for (var C in h) y.call(h, C) && B(h[C], C, h) } function m(h) { return null == h ? a(h) : u.call(h).slice(8, -1) } function g(h, B) { var C = null != h ? typeof h[B] : "number"; return !/^(?:boolean|number|string|undefined)$/.test(C) && ("object" == C ? !!h[B] : !0) } function l(h) { return String(h).replace(/([ -])(?!$)/g, "$1?") } function e(h, B) { var C = null; d(h, function(z, x) { C = B(C, z, x, h) }); return C } function n(h) { function B(S) { return e(S, function(O, M) { var V = M.pattern || l(M); !O && (O = RegExp("\\b" + V + " *\\d+[.\\w_]*", "i").exec(h) || RegExp("\\b" + V + " *\\w+-[\\w]*", "i").exec(h) || RegExp("\\b" + V + "(?:; *(?:[a-z]+[_-])?[a-z]+\\d+|[^ ();-]*)", "i").exec(h)) && ((O = String(M.label && !RegExp(V, "i").test(M.label) ? M.label : O).split("/"))[1] && !/[\d.]+/.test(O[0]) && (O[0] += " " + O[1]), M = M.label || M, O = c(O[0].replace(RegExp(V, "i"), M).replace(RegExp("; *(?:" + M + "[_-])?", "i"), " ").replace(RegExp("(" + M + ")[-_.]?(\\w)", "i"), "$1 $2"))); return O }) } function C(S) { return e(S, function(O, M) { return O || (RegExp(M + "(?:-[\\d.]+/|(?: for [\\w-]+)?[ /-])([\\d.]+[^ ();/_-]*)", "i").exec(h) || 0)[1] || null }) } var z = v, x = h && "object" == typeof h && "String" != m(h); x && (z = h, h = null); var G = z.navigator || {}, t = G.userAgent || ""; h || (h = t); var I = x ? !!G.likeChrome : /\bChrome\b/.test(h) && !/internal|\n/i.test(u.toString()), H = x ? "Object" : "ScriptBridgingProxyObject", Q = x ? "Object" : "Environment", E = x && z.java ? "JavaPackage" : m(z.java), P = x ? "Object" : "RuntimeObject"; Q = (E = /\bJava/.test(E) && z.java) && m(z.environment) == Q; var N = E ? "a" : "\u03b1", T = E ? "b" : "\u03b2", R = z.document || {}, U = z.operamini || z.opera, J = w.test(J = x && U ? U["[[Class]]"] : m(U)) ? J : U = null, p, X = h; x = []; var aa = null, Z = h == t; t = Z && U && "function" == typeof U.version && U.version(); var K = function(S) { return e(S, function(O, M) { return O || RegExp("\\b" + (M.pattern || l(M)) + "\\b", "i").exec(h) && (M.label || M) }) }([{ label: "EdgeHTML", pattern: "Edge" }, "Trident", { label: "WebKit", pattern: "AppleWebKit" }, "iCab", "Presto", "NetFront", "Tasman", "KHTML", "Gecko"]), D = function(S) { return e(S, function(O, M) { return O || RegExp("\\b" + (M.pattern || l(M)) + "\\b", "i").exec(h) && (M.label || M) }) }(["Adobe AIR", "Arora", "Avant Browser", "Breach", "Camino", "Electron", "Epiphany", "Fennec", "Flock", "Galeon", "GreenBrowser", "iCab", "Iceweasel", "K-Meleon", "Konqueror", "Lunascape", "Maxthon", { label: "Microsoft Edge", pattern: "Edge" }, "Midori", "Nook Browser", "PaleMoon", "PhantomJS", "Raven", "Rekonq", "RockMelt", { label: "Samsung Internet", pattern: "SamsungBrowser" }, "SeaMonkey", { label: "Silk", pattern: "(?:Cloud9|Silk-Accelerated)" }, "Sleipnir", "SlimBrowser", { label: "SRWare Iron", pattern: "Iron" }, "Sunrise", "Swiftfox", "Waterfox", "WebPositive", "Opera Mini", { label: "Opera Mini", pattern: "OPiOS" }, "Opera", { label: "Opera", pattern: "OPR" }, "Chrome", { label: "Chrome Mobile", pattern: "(?:CriOS|CrMo)" }, { label: "Firefox", pattern: "(?:Firefox|Minefield)" }, { label: "Firefox for iOS", pattern: "FxiOS" }, { label: "IE", pattern: "IEMobile" }, { label: "IE", pattern: "MSIE" }, "Safari" ]), L = B([{ label: "BlackBerry", pattern: "BB10" }, "BlackBerry", { label: "Galaxy S", pattern: "GT-I9000" }, { label: "Galaxy S2", pattern: "GT-I9100" }, { label: "Galaxy S3", pattern: "GT-I9300" }, { label: "Galaxy S4", pattern: "GT-I9500" }, { label: "Galaxy S5", pattern: "SM-G900" }, { label: "Galaxy S6", pattern: "SM-G920" }, { label: "Galaxy S6 Edge", pattern: "SM-G925" }, { label: "Galaxy S7", pattern: "SM-G930" }, { label: "Galaxy S7 Edge", pattern: "SM-G935" }, "Google TV", "Lumia", "iPad", "iPod", "iPhone", "Kindle", { label: "Kindle Fire", pattern: "(?:Cloud9|Silk-Accelerated)" }, "Nexus", "Nook", "PlayBook", "PlayStation Vita", "PlayStation", "TouchPad", "Transformer", { label: "Wii U", pattern: "WiiU" }, "Wii", "Xbox One", { label: "Xbox 360", pattern: "Xbox" }, "Xoom" ]), W = function(S) { return e(S, function(O, M, V) { return O || (M[L] || M[/^[a-z]+(?: +[a-z]+\b)*/i.exec(L)] || RegExp("\\b" + l(V) + "(?:\\b|\\w*\\d)", "i").exec(h)) && V }) }({ Apple: { iPad: 1, iPhone: 1, iPod: 1 }, Archos: {}, Amazon: { Kindle: 1, "Kindle Fire": 1 }, Asus: { Transformer: 1 }, "Barnes & Noble": { Nook: 1 }, BlackBerry: { PlayBook: 1 }, Google: { "Google TV": 1, Nexus: 1 }, HP: { TouchPad: 1 }, HTC: {}, LG: {}, Microsoft: { Xbox: 1, "Xbox One": 1 }, Motorola: { Xoom: 1 }, Nintendo: { "Wii U": 1, Wii: 1 }, Nokia: { Lumia: 1 }, Samsung: { "Galaxy S": 1, "Galaxy S2": 1, "Galaxy S3": 1, "Galaxy S4": 1 }, Sony: { PlayStation: 1, "PlayStation Vita": 1 } }), F = function(S) { return e(S, function(O, M) { var V = M.pattern || l(M); if (!O && (O = RegExp("\\b" + V + "(?:/[\\d.]+|[ \\w.]*)", "i").exec(h))) { var Y = O, ba = M.label || M, ca = { "10.0": "10", "6.4": "10 Technical Preview", "6.3": "8.1", "6.2": "8", "6.1": "Server 2008 R2 / 7", "6.0": "Server 2008 / Vista", "5.2": "Server 2003 / XP 64-bit", "5.1": "XP", "5.01": "2000 SP1", "5.0": "2000", "4.0": "NT", "4.90": "ME" }; V && ba && /^Win/i.test(Y) && !/^Windows Phone /i.test(Y) && (ca = ca[/[\d.]+$/.exec(Y)]) && (Y = "Windows " + ca); Y = String(Y); V && ba && (Y = Y.replace(RegExp(V, "i"), ba)); O = Y = c(Y.replace(/ ce$/i, " CE").replace(/\bhpw/i, "web").replace(/\bMacintosh\b/, "Mac OS").replace(/_PowerPC\b/i, " OS").replace(/\b(OS X) [^ \d]+/i, "$1").replace(/\bMac (OS X)\b/, "$1").replace(/\/(\d)/, " $1").replace(/_/g, ".").replace(/(?: BePC|[ .]*fc[ \d.]+)$/i, "").replace(/\bx86\.64\b/gi, "x86_64").replace(/\b(Windows Phone) OS\b/, "$1").replace(/\b(Chrome OS \w+) [\d.]+\b/, "$1").split(" on ")[0]) } return O }) }(["Windows Phone", "Android", "CentOS", { label: "Chrome OS", pattern: "CrOS" }, "Debian", "Fedora", "FreeBSD", "Gentoo", "Haiku", "Kubuntu", "Linux Mint", "OpenBSD", "Red Hat", "SuSE", "Ubuntu", "Xubuntu", "Cygwin", "Symbian OS", "hpwOS", "webOS ", "webOS", "Tablet OS", "Tizen", "Linux", "Mac OS X", "Macintosh", "Mac", "Windows 98;", "Windows " ]); K && (K = [K]); W && !L && (L = B([W])); if (p = /\bGoogle TV\b/.exec(L)) L = p[0]; /\bSimulator\b/i.test(h) && (L = (L ? L + " " : "") + "Simulator"); "Opera Mini" == D && /\bOPiOS\b/.test(h) && x.push("running in Turbo/Uncompressed mode"); "IE" == D && /\blike iPhone OS\b/.test(h) ? (p = n(h.replace(/like iPhone OS/, "")), W = p.manufacturer, L = p.product) : /^iP/.test(L) ? (D || (D = "Safari"), F = "iOS" + ((p = / OS ([\d_]+)/i.exec(h)) ? " " + p[1].replace(/_/g, ".") : "")) : "Konqueror" != D || /buntu/i.test(F) ? W && "Google" != W && (/Chrome/.test(D) && !/\bMobile Safari\b/i.test(h) || /\bVita\b/.test(L)) || /\bAndroid\b/.test(F) && /^Chrome/.test(D) && /\bVersion\//i.test(h) ? (D = "Android Browser", F = /\bAndroid\b/.test(F) ? F : "Android") : "Silk" == D ? (/\bMobi/i.test(h) || (F = "Android", x.unshift("desktop mode")), /Accelerated *= *true/i.test(h) && x.unshift("accelerated")) : "PaleMoon" == D && (p = /\bFirefox\/([\d.]+)\b/.exec(h)) ? x.push("identifying as Firefox " + p[1]) : "Firefox" == D && (p = /\b(Mobile|Tablet|TV)\b/i.exec(h)) ? (F || (F = "Firefox OS"), L || (L = p[1])) : !D || (p = !/\bMinefield\b/i.test(h) && /\b(?:Firefox|Safari)\b/.exec(D)) ? (D && !L && /[\/,]|^[^(]+?\)/.test(h.slice(h.indexOf(p + "/") + 8)) && (D = null), (p = L || W || F) && (L || W || /\b(?:Android|Symbian OS|Tablet OS|webOS)\b/.test(F)) && (D = /[a-z]+(?: Hat)?/i.exec(/\bAndroid\b/.test(F) ? F : p) + " Browser")) : "Electron" == D && (p = (/\bChrome\/([\d.]+)\b/.exec(h) || 0)[1]) && x.push("Chromium " + p) : F = "Kubuntu"; t || (t = C(["(?:Cloud9|CriOS|CrMo|Edge|FxiOS|IEMobile|Iron|Opera ?Mini|OPiOS|OPR|Raven|SamsungBrowser|Silk(?!/[\\d.]+$))", "Version", l(D), "(?:Firefox|Minefield|NetFront)" ])); if (p = "iCab" == K && 3 < parseFloat(t) && "WebKit" || /\bOpera\b/.test(D) && (/\bOPR\b/.test(h) ? "Blink" : "Presto") || /\b(?:Midori|Nook|Safari)\b/i.test(h) && !/^(?:Trident|EdgeHTML)$/.test(K) && "WebKit" || !K && /\bMSIE\b/i.test(h) && ("Mac OS" == F ? "Tasman" : "Trident") || "WebKit" == K && /\bPlayStation\b(?! Vita\b)/i.test(D) && "NetFront") K = [p]; "IE" == D && (p = (/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(h) || 0)[1]) ? (D += " Mobile", F = "Windows Phone " + (/\+$/.test(p) ? p : p + ".x"), x.unshift("desktop mode")) : /\bWPDesktop\b/i.test(h) ? (D = "IE Mobile", F = "Windows Phone 8.x", x.unshift("desktop mode"), t || (t = (/\brv:([\d.]+)/.exec(h) || 0)[1])) : "IE" != D && "Trident" == K && (p = /\brv:([\d.]+)/.exec(h)) && (D && x.push("identifying as " + D + (t ? " " + t : "")), D = "IE", t = p[1]); if (Z) { if (g(z, "global")) if (E && (p = E.lang.System, X = p.getProperty("os.arch"), F = F || p.getProperty("os.name") + " " + p.getProperty("os.version")), Q) { try { t = z.require("ringo/engine").version.join("."), D = "RingoJS" } catch (S) { (p = z.system) && p.global.system == z.system && (D = "Narwhal", F || (F = p[0].os || null)) } D || (D = "Rhino") } else "object" == typeof z.process && !z.process.browser && (p = z.process) && ("object" == typeof p.versions && ("string" == typeof p.versions.electron ? (x.push("Node " + p.versions.node), D = "Electron", t = p.versions.electron) : "string" == typeof p.versions.nw && (x.push("Chromium " + t, "Node " + p.versions.node), D = "NW.js", t = p.versions.nw)), D || (D = "Node.js", X = p.arch, F = p.platform, t = (t = /[\d.]+/.exec(p.version)) ? t[0] : null)); else m(p = z.runtime) == H ? (D = "Adobe AIR", F = p.flash.system.Capabilities.os) : m(p = z.phantom) == P ? (D = "PhantomJS", t = (p = p.version || null) && p.major + "." + p.minor + "." + p.patch) : "number" == typeof R.documentMode && (p = /\bTrident\/(\d+)/i.exec(h)) ? (t = [t, R.documentMode], (p = +p[1] + 4) != t[1] && (x.push("IE " + t[1] + " mode"), K && (K[1] = ""), t[1] = p), t = "IE" == D ? String(t[1].toFixed(1)) : t[0]) : "number" == typeof R.documentMode && /^(?:Chrome|Firefox)\b/.test(D) && (x.push("masking as " + D + " " + t), D = "IE", t = "11.0", K = ["Trident"], F = "Windows"); F = F && c(F) } t && (p = /(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(t) || /(?:alpha|beta)(?: ?\d)?/i.exec(h + ";" + (Z && G.appMinorVersion)) || /\bMinefield\b/i.test(h) && "a") && (aa = /b/i.test(p) ? "beta" : "alpha", t = t.replace(RegExp(p + "\\+?$"), "") + ("beta" == aa ? T : N) + (/\d+\+?/.exec(p) || "")); if ("Fennec" == D || "Firefox" == D && /\b(?:Android|Firefox OS)\b/.test(F)) D = "Firefox Mobile"; else if ("Maxthon" == D && t) t = t.replace(/\.[\d.]+/, ".x"); else if (/\bXbox\b/i.test(L)) "Xbox 360" == L && (F = null), "Xbox 360" == L && /\bIEMobile\b/.test(h) && x.unshift("mobile mode"); else if (!/^(?:Chrome|IE|Opera)$/.test(D) && (!D || L || /Browser|Mobi/.test(D)) || "Windows CE" != F && !/Mobi/i.test(h)) if ("IE" == D && Z) try { null === z.external && x.unshift("platform preview") } catch (S) { x.unshift("embedded") } else(/\bBlackBerry\b/.test(L) || /\bBB10\b/.test(h)) && (p = (RegExp(L.replace(/ +/g, " *") + "/([.\\d]+)", "i").exec(h) || 0)[1] || t) ? (p = [p, /BB10/.test(h)], F = (p[1] ? (L = null, W = "BlackBerry") : "Device Software") + " " + p[0], t = null) : this != f && "Wii" != L && (Z && U || /Opera/.test(D) && /\b(?:MSIE|Firefox)\b/i.test(h) || "Firefox" == D && /\bOS X (?:\d+\.){2,}/.test(F) || "IE" == D && (F && !/^Win/.test(F) && 5.5 < t || /\bWindows XP\b/.test(F) && 8 < t || 8 == t && !/\bTrident\b/.test(h))) && !w.test(p = n.call(f, h.replace(w, "") + ";")) && p.name && (p = "ing as " + p.name + ((p = p.version) ? " " + p : ""), w.test(D) ? (/\bIE\b/.test(p) && "Mac OS" == F && (F = null), p = "identify" + p) : (p = "mask" + p, D = J ? c(J.replace(/([a-z])([A-Z])/g, "$1 $2")) : "Opera", /\bIE\b/.test(p) && (F = null), Z || (t = null)), K = ["Presto"], x.push(p)); else D += " Mobile"; if (p = (/\bAppleWebKit\/([\d.]+\+?)/i.exec(h) || 0)[1]) { p = [parseFloat(p.replace(/\.(\d)$/, ".0$1")), p]; if ("Safari" == D && "+" == p[1].slice(-1)) D = "WebKit Nightly", aa = "alpha", t = p[1].slice(0, -1); else if (t == p[1] || t == (p[2] = (/\bSafari\/([\d.]+\+?)/i.exec(h) || 0)[1])) t = null; p[1] = (/\bChrome\/([\d.]+)/i.exec(h) || 0)[1]; 537.36 == p[0] && 537.36 == p[2] && 28 <= parseFloat(p[1]) && "WebKit" == K && (K = ["Blink"]); Z && (I || p[1]) ? (K && (K[1] = "like Chrome"), p = p[1] || (p = p[0], 530 > p ? 1 : 532 > p ? 2 : 532.05 > p ? 3 : 533 > p ? 4 : 534.03 > p ? 5 : 534.07 > p ? 6 : 534.1 > p ? 7 : 534.13 > p ? 8 : 534.16 > p ? 9 : 534.24 > p ? 10 : 534.3 > p ? 11 : 535.01 > p ? 12 : 535.02 > p ? "13+" : 535.07 > p ? 15 : 535.11 > p ? 16 : 535.19 > p ? 17 : 536.05 > p ? 18 : 536.1 > p ? 19 : 537.01 > p ? 20 : 537.11 > p ? "21+" : 537.13 > p ? 23 : 537.18 > p ? 24 : 537.24 > p ? 25 : 537.36 > p ? 26 : "Blink" != K ? "27" : "28")) : (K && (K[1] = "like Safari"), p = (p = p[0], 400 > p ? 1 : 500 > p ? 2 : 526 > p ? 3 : 533 > p ? 4 : 534 > p ? "4+" : 535 > p ? 5 : 537 > p ? 6 : 538 > p ? 7 : 601 > p ? 8 : "8")); K && (K[1] += " " + (p += "number" == typeof p ? ".x" : /[.+]/.test(p) ? "" : "+")); "Safari" == D && (!t || 45 < parseInt(t)) && (t = p) } "Opera" == D && (p = /\bzbov|zvav$/.exec(F)) ? (D += " ", x.unshift("desktop mode"), "zvav" == p ? (D += "Mini", t = null) : D += "Mobile", F = F.replace(RegExp(" *" + p + "$"), "")) : "Safari" == D && /\bChrome\b/.exec(K && K[1]) && (x.unshift("desktop mode"), D = "Chrome Mobile", t = null, /\bOS X\b/.test(F) ? (W = "Apple", F = "iOS 4.3+") : F = null); t && 0 == t.indexOf(p = /[\d.]+$/.exec(F)) && -1 < h.indexOf("/" + p + "-") && (F = String(F.replace(p, "")).replace(/^ +| +$/g, "")); K && !/\b(?:Avant|Nook)\b/.test(D) && (/Browser|Lunascape|Maxthon/.test(D) || "Safari" != D && /^iOS/.test(F) && /\bSafari\b/.test(K[1]) || /^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|Web)/.test(D) && K[1]) && (p = K[K.length - 1]) && x.push(p); x.length && (x = ["(" + x.join("; ") + ")"]); W && L && 0 > L.indexOf(W) && x.push("on " + W); L && x.push((/^on /.test(x[x.length - 1]) ? "" : "on ") + L); if (F) { var da = (p = / ([\d.+]+)$/.exec(F)) && "/" == F.charAt(F.length - p[0].length - 1); F = { architecture: 32, family: p && !da ? F.replace(p[0], "") : F, version: p ? p[1] : null, toString: function() { var S = this.version; return this.family + (S && !da ? " " + S : "") + (64 == this.architecture ? " 64-bit" : "") } } }(p = /\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(X)) && !/\bi686\b/i.test(X) ? (F && (F.architecture = 64, F.family = F.family.replace(RegExp(" *" + p), "")), D && (/\bWOW64\b/i.test(h) || Z && /\w(?:86|32)$/.test(G.cpuClass || G.platform) && !/\bWin64; x64\b/i.test(h)) && x.unshift("32-bit")) : F && /^OS X/.test(F.family) && "Chrome" == D && 39 <= parseFloat(t) && (F.architecture = 64); h || (h = null); z = {}; z.description = h; z.layout = K && K[0]; z.manufacturer = W; z.name = D; z.prerelease = aa; z.product = L; z.ua = h; z.version = D && t; z.os = F || { architecture: null, family: null, version: null, toString: function() { return "null" } }; z.parse = n; z.toString = function() { return this.description || "" }; z.version && x.unshift(t); z.name && x.unshift(D); F && D && (F != String(F).split(" ")[0] || F != D.split(" ")[0] && !L) && x.push(L ? "(" + F + ")" : "on " + F); x.length && (z.description = x.join(" ")); return z } var b = { "function": !0, object: !0 }, v = b[typeof window] && window || this, q = b[typeof exports] && exports; b = b[typeof module] && module && !module.nodeType && module; var k = q && b && "object" == typeof global && global; !k || k.global !== k && k.window !== k && k.self !== k || (v = k); var r = Math.pow(2, 53) - 1, w = /\bOpera/; k = Object.prototype; var y = k.hasOwnProperty, u = k.toString, A = n(); "function" == typeof define && "object" == typeof define.amd && define.amd ? (v.platform = A, define(function() { return A })) : q && b ? f(A, function(h, B) { q[B] = h }) : v.platform = A }).call(this); function buildIOSMeta() { for (var a = [{ name: "viewport", content: "width=device-width, height=device-height, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no" }, { name: "apple-mobile-web-app-capable", content: "yes" }, { name: "apple-mobile-web-app-status-bar-style", content: "black" }], d = 0; d < a.length; d++) { var c = document.createElement("meta"); c.name = a[d].name; c.content = a[d].content; var f = window.document.head.querySelector('meta[name="' + c.name + '"]'); f && f.parentNode.removeChild(f); window.document.head.appendChild(c) } } function hideIOSFullscreenPanel() { document.querySelector(".xxx-ios-fullscreen-message").style.display = "none"; document.querySelector(".xxx-ios-fullscreen-scroll").style.display = "none"; document.querySelector(".xxx-game-iframe-full").classList.remove("xxx-game-iframe-iphone-se") } function buildIOSFullscreenPanel() { document.body.insertAdjacentHTML("beforeend", '<div class="xxx-ios-fullscreen-message"><div class="xxx-ios-fullscreen-swipe"></div></div><div class="xxx-ios-fullscreen-scroll"></div>') } function showIOSFullscreenPanel() { document.querySelector(".xxx-ios-fullscreen-message").style.display = "none"; document.querySelector(".xxx-ios-fullscreen-scroll").style.display = "none" } function __iosResize() { window.scrollTo(0, 0); console.log(window.devicePixelRatio); console.log(window.innerWidth); console.log(window.innerHeight); if ("iPhone" === platform.product) switch (window.devicePixelRatio) { case 2: switch (window.innerWidth) { case 568: 320 !== window.innerHeight && document.querySelector(".xxx-game-iframe-full").classList.add("xxx-game-iframe-iphone-se"); break; case 667: 375 === window.innerHeight ? hideIOSFullscreenPanel() : showIOSFullscreenPanel(); break; case 808: 414 === window.innerHeight ? hideIOSFullscreenPanel() : showIOSFullscreenPanel(); break; default: hideIOSFullscreenPanel() } break; case 3: switch (window.innerWidth) { case 736: 414 === window.innerHeight ? hideIOSFullscreenPanel() : showIOSFullscreenPanel(); break; case 724: 375 === window.innerHeight ? hideIOSFullscreenPanel() : showIOSFullscreenPanel(); break; case 808: 414 === window.innerHeight ? hideIOSFullscreenPanel() : showIOSFullscreenPanel(); break; default: hideIOSFullscreenPanel() } break; default: hideIOSFullscreenPanel() } } function iosResize() { __iosResize(); setTimeout(function() { __iosResize() }, 500) } function iosInIframe() { try { return window.self !== window.top } catch (a) { return !0 } } function isIOSLessThen13() { var a = platform.os, d = a.family.toLowerCase(); a = parseFloat(a.version); return "ios" === d && 13 > a ? !0 : !1 } document.addEventListener("DOMContentLoaded", function() { platform && "iPhone" === platform.product && "safari" === platform.name.toLowerCase() && isIOSLessThen13() && !iosInIframe() && (buildIOSFullscreenPanel(), buildIOSMeta()) }); window.addEventListener("resize", function(a) { platform && "iPhone" === platform.product && "safari" === platform.name.toLowerCase() && isIOSLessThen13() && !iosInIframe() && iosResize() }); var s_iScaleFactor = 1, s_oCanvasLeft, s_oCanvasTop, s_bIsIphone, s_bFocus = !0, browserName = function(a) { switch (!0) { case -1 < a.indexOf("edge"): return "MS Edge"; case -1 < a.indexOf("edg/"): return "Edge ( chromium based)"; case -1 < a.indexOf("opr") && !!window.opr: return "Opera"; case -1 < a.indexOf("chrome") && !!window.chrome: return "Chrome"; case -1 < a.indexOf("trident"): return "MS IE"; case -1 < a.indexOf("firefox"): return "Mozilla Firefox"; case -1 < a.indexOf("safari"): return "Safari"; default: return "other" } }(window.navigator.userAgent.toLowerCase()); window.addEventListener("resize", function(a) { sizeHandler() }, !0); function trace(a) { console.log(a) } function isIpad() { var a = -1 !== navigator.userAgent.toLowerCase().indexOf("ipad"); return !a && navigator.userAgent.match(/Mac/) && navigator.maxTouchPoints && 2 < navigator.maxTouchPoints ? !0 : a } function isMobile() { return isIpad() ? !0 : navigator.userAgent.match(/Android/i) || navigator.userAgent.match(/webOS/i) || navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/iPad/i) || navigator.userAgent.match(/iPod/i) || navigator.userAgent.match(/BlackBerry/i) || navigator.userAgent.match(/Windows Phone/i) ? !0 : !1 } function isIOS() { for (var a = "iPad Simulator;iPhone Simulator;iPod Simulator;iPad;iPhone;iPod".split(";"); a.length;) if (navigator.platform === a.pop()) return s_bIsIphone = !0; return s_bIsIphone = !1 } function getSize(a) { var d = a.toLowerCase(), c = window.document, f = c.documentElement; if (void 0 === window["inner" + a]) a = f["client" + a]; else if (window["inner" + a] != f["client" + a]) { var m = c.createElement("body"); m.id = "vpw-test-b"; m.style.cssText = "overflow:scroll"; var g = c.createElement("div"); g.id = "vpw-test-d"; g.style.cssText = "position:absolute;top:-1000px"; g.innerHTML = "<style>@media(" + d + ":" + f["client" + a] + "px){body#vpw-test-b div#vpw-test-d{" + d + ":7px!important}}</style>"; m.appendChild(g); f.insertBefore(m, c.head); a = 7 == g["offset" + a] ? f["client" + a] : window["inner" + a]; f.removeChild(m) } else a = window["inner" + a]; return a } window.addEventListener("orientationchange", onOrientationChange); function onOrientationChange() { window.matchMedia("(orientation: portrait)").matches && sizeHandler(); window.matchMedia("(orientation: landscape)").matches && sizeHandler() } function getIOSWindowHeight() { return document.documentElement.clientWidth / window.innerWidth * window.innerHeight } function getHeightOfIOSToolbars() { var a = (0 === window.orientation ? screen.height : screen.width) - getIOSWindowHeight(); return 1 < a ? a : 0 } function sizeHandler() { window.scrollTo(0, 1); if (document.querySelector("#canvas")) { var a = null !== platform.name && "safari" === platform.name.toLowerCase() ? getIOSWindowHeight() : getSize("Height"); var d = getSize("Width"); s_bFocus && _checkOrientation(d, a); var c = Math.min(a / CANVAS_HEIGHT, d / CANVAS_WIDTH), f = Math.round(CANVAS_WIDTH * c); c = Math.round(CANVAS_HEIGHT * c); if (c < a) { var m = a - c; c += m; f += CANVAS_WIDTH / CANVAS_HEIGHT * m } else f < d && (m = d - f, f += m, c += CANVAS_HEIGHT / CANVAS_WIDTH * m); m = a / 2 - c / 2; var g = d / 2 - f / 2, l = CANVAS_WIDTH / f; if (g * l < -EDGEBOARD_X || m * l < -EDGEBOARD_Y) c = Math.min(a / (CANVAS_HEIGHT - 2 * EDGEBOARD_Y), d / (CANVAS_WIDTH - 2 * EDGEBOARD_X)), f = Math.round(CANVAS_WIDTH * c), c = Math.round(CANVAS_HEIGHT * c), m = (a - c) / 2, g = (d - f) / 2, l = CANVAS_WIDTH / f; s_iOffsetX = -1 * g * l; s_iOffsetY = -1 * m * l; 0 <= m && (s_iOffsetY = 0); 0 <= g && (s_iOffsetX = 0); null !== s_oGame && s_oGame.refreshButtonPos(); null !== s_oMenu && s_oMenu.refreshButtonPos(); null !== s_oLevelMenu && s_oLevelMenu.refreshButtonPos(); s_bMobile ? (document.querySelector("#canvas").style.width = f + "px", document.querySelector("#canvas").style.height = c + "px") : s_oStage && (s_oStage.canvas.width = f, s_oStage.canvas.height = c, s_iScaleFactor = Math.min(f / CANVAS_WIDTH, c / CANVAS_HEIGHT), s_oStage.scaleX = s_oStage.scaleY = s_iScaleFactor); 0 <= m && (m = (a - c) / 2); document.querySelector("#canvas").style.top = m + "px"; document.querySelector("#canvas").style.left = g + "px"; fullscreenHandler() } } function _checkOrientation(a, d) { s_bMobile && ENABLE_CHECK_ORIENTATION && (a > d ? "landscape" === document.querySelector(".orientation-msg-container").getAttribute("data-orientation") ? (document.querySelector(".orientation-msg-container").style.display = "none", s_oMain.startUpdate()) : (document.querySelector(".orientation-msg-container").style.display = "block", s_oMain.stopUpdate()) : "portrait" === document.querySelector(".orientation-msg-container").getAttribute("data-orientation") ? (document.querySelector(".orientation-msg-container").style.display = "none", s_oMain.startUpdate()) : (document.querySelector(".orientation-msg-container").style.display = "block", s_oMain.stopUpdate())) } function createBitmap(a, d, c) { var f = new createjs.Bitmap(a), m = new createjs.Shape; d && c ? m.graphics.beginFill("#fff").drawRect(0, 0, d, c) : m.graphics.beginFill("#ff0").drawRect(0, 0, a.width, a.height); f.hitArea = m; return f } function createSprite(a, d, c, f, m, g) { a = null !== d ? new createjs.Sprite(a, d) : new createjs.Sprite(a); d = new createjs.Shape; d.graphics.beginFill("#000000").drawRect(-c, -f, m, g); a.hitArea = d; return a } function randomFloatBetween(a, d, c) { "undefined" === typeof c && (c = 2); return parseFloat(Math.min(a + Math.random() * (d - a), d).toFixed(c)) } function shuffle(a) { for (var d = a.length, c, f; 0 !== d;) f = Math.floor(Math.random() * d), --d, c = a[d], a[d] = a[f], a[f] = c; return a } function formatTime(a) { a /= 1E3; var d = Math.floor(a / 60); a = parseFloat(a - 60 * d).toFixed(1); var c = ""; c = 10 > d ? c + ("0" + d + ":") : c + (d + ":"); return 10 > a ? c + ("0" + a) : c + a } function NoClickDelay(a) { this.element = a; window.Touch && this.element.addEventListener("touchstart", this, !1) } function shuffle(a) { for (var d = a.length, c, f; 0 < d;) f = Math.floor(Math.random() * d), d--, c = a[d], a[d] = a[f], a[f] = c; return a } NoClickDelay.prototype = { handleEvent: function(a) { switch (a.type) { case "touchstart": this.onTouchStart(a); break; case "touchmove": this.onTouchMove(a); break; case "touchend": this.onTouchEnd(a) } }, onTouchStart: function(a) { a.preventDefault(); this.moved = !1; this.element.addEventListener("touchmove", this, !1); this.element.addEventListener("touchend", this, !1) }, onTouchMove: function(a) { this.moved = !0 }, onTouchEnd: function(a) { this.element.removeEventListener("touchmove", this, !1); this.element.removeEventListener("touchend", this, !1); if (!this.moved) { a = document.elementFromPoint(a.changedTouches[0].clientX, a.changedTouches[0].clientY); 3 == a.nodeType && (a = a.parentNode); var d = document.createEvent("MouseEvents"); d.initEvent("click", !0, !0); a.dispatchEvent(d) } } }; (function() { function a(c) { var f = { focus: "visible", focusin: "visible", pageshow: "visible", blur: "hidden", focusout: "hidden", pagehide: "hidden" }; c = c || window.event; c.type in f ? document.body.className = f[c.type] : (document.body.className = this[d] ? "hidden" : "visible", "hidden" === document.body.className ? (s_oMain.stopUpdate(), s_bFocus = !1) : (s_oMain.startUpdate(), s_bFocus = !0)) } var d = "hidden"; d in document ? document.addEventListener("visibilitychange", a) : (d = "mozHidden") in document ? document.addEventListener("mozvisibilitychange", a) : (d = "webkitHidden") in document ? document.addEventListener("webkitvisibilitychange", a) : (d = "msHidden") in document ? document.addEventListener("msvisibilitychange", a) : "onfocusin" in document ? document.onfocusin = document.onfocusout = a : window.onpageshow = window.onpagehide = window.onfocus = window.onblur = a })(); function ctlArcadeResume() { null !== s_oMain && s_oMain.startUpdate() } function ctlArcadePause() { null !== s_oMain && s_oMain.stopUpdate() } function getParamValue(a) { for (var d = window.location.search.substring(1).split("&"), c = 0; c < d.length; c++) { var f = d[c].split("="); if (f[0] == a) return f[1] } } function playSound(a, d, c) { return !1 === DISABLE_SOUND_MOBILE || !1 === s_bMobile ? (s_aSounds[a].play(), s_aSounds[a].volume(d), s_aSounds[a].loop(c), s_aSounds[a]) : null } function stopSound(a) { !1 !== DISABLE_SOUND_MOBILE && !1 !== s_bMobile || s_aSounds[a].stop() } function setVolume(a, d) { !1 !== DISABLE_SOUND_MOBILE && !1 !== s_bMobile || s_aSounds[a].volume(d) } function setMute(a, d) { !1 !== DISABLE_SOUND_MOBILE && !1 !== s_bMobile || s_aSounds[a].mute(d) } function isSoundPlaying(a) { return s_aSounds[a].playing() } function saveItem(a, d) { s_bStorageAvailable && localStorage.setItem(a, d) } function getItem(a) { return s_bStorageAvailable ? localStorage.getItem(a) : null } function fullscreenHandler() { ENABLE_FULLSCREEN && !1 !== screenfull.isEnabled && (s_bFullscreen = screenfull.isFullscreen, null !== s_oInterface && s_oInterface.resetFullscreenBut(), null !== s_oMenu && s_oMenu.resetFullscreenBut(), null !== s_oLevelMenu && s_oLevelMenu.resetFullscreenBut()) } if (screenfull.isEnabled) screenfull.on("change", function() { s_bFullscreen = screenfull.isFullscreen; null !== s_oInterface && s_oInterface.resetFullscreenBut(); null !== s_oMenu && s_oMenu.resetFullscreenBut(); null !== s_oLevelMenu && s_oLevelMenu.resetFullscreenBut() }); function CSpriteLibrary() { var a = {}, d, c, f, m, g, l; this.init = function(e, n, b) { d = {}; f = c = 0; m = e; g = n; l = b }; this.addSprite = function(e, n) { if (!a.hasOwnProperty(e)) { var b = new Image; a[e] = d[e] = { szPath: n, oSprite: b, bLoaded: !1 }; c++ } }; this.getSprite = function(e) { return a.hasOwnProperty(e) ? a[e].oSprite : null }; this._onSpritesLoaded = function() { c = 0; g.call(l) }; this._onSpriteLoaded = function() { m.call(l); ++f === c && this._onSpritesLoaded() }; this.loadSprites = function() { for (var e in d) d[e].oSprite.oSpriteLibrary = this, d[e].oSprite.szKey = e, d[e].oSprite.onload = function() { this.oSpriteLibrary.setLoaded(this.szKey); this.oSpriteLibrary._onSpriteLoaded(this.szKey) }, d[e].oSprite.onerror = function(n) { var b = n.currentTarget; setTimeout(function() { d[b.szKey].oSprite.src = d[b.szKey].szPath }, 500) }, d[e].oSprite.src = d[e].szPath }; this.setLoaded = function(e) { a[e].bLoaded = !0 }; this.isLoaded = function(e) { return a[e].bLoaded }; this.getNumSprites = function() { return c } } var CANVAS_WIDTH = 1500, CANVAS_HEIGHT = 768, EDGEBOARD_X = 180, EDGEBOARD_Y = 20, FPS = 30, FPS_TIME = 1E3 / FPS, DISABLE_SOUND_MOBILE = !1, FONT_GAME = "TradeGothic", STATE_LOADING = 0, STATE_MENU = 1, STATE_MENU_LEVEL = 2, STATE_GAME = 3, ON_MOUSE_DOWN = 0, ON_MOUSE_UP = 1, ON_MOUSE_OVER = 2, ON_MOUSE_OUT = 3, ON_DRAG_START = 4, ON_DRAG_END = 5, ON_BUT_YES_DOWN = 6, ON_PLAYER_ARRIVAL = 7, ON_PLAYER_FALL = 8, ON_OPPONENT_HIDE = 9, ON_OPPONENT_CHECK_COLLISION = 10, ON_READY_FOR_PLAYER_ARRIVAL = 11, ON_BACK_MENU = 12, ON_RESTART = 13, ON_NEXT_LEVEL = 14, ON_BUT_END_TWEEN_X = 15, ON_END_COUNTDOWN = 16, PLAYER_ANIM_RUN = 0, PLAYER_ANIM_FALL = 1, PLAYER_ANIM_ARRIVAL = 2, PLAYER_ANIM_LEFT = 3, PLAYER_ANIM_LEFT_OUT = 4, PLAYER_ANIM_RIGHT = 5, PLAYER_ANIM_RIGHT_OUT = 6, STARTING_STANDS_SCALE_BONUS = .74, NUM_LEVELS, OPPONENT_FINAL_Y = 1200, TIME_OPPONENT_RUN_0 = 2600, TIME_OPPONENT_RUN_1 = 800, TIME_OPPONENT_RUN = 3E3, HERO_ACCELERATION, HERO_FRICTION, MAX_HERO_SPEED, MIN_START_X = CANVAS_WIDTH / 2 - 50, MAX_START_X = CANVAS_WIDTH / 2 + 50, MIN_ARRIVAL_X = -300, START_X_INTERVAL = MAX_START_X - MIN_START_X, MAX_ARRIVAL_X = CANVAS_WIDTH + 300, ARRIVAL_X_INTERVAL = MAX_ARRIVAL_X - MIN_ARRIVAL_X, MIN_PLAYER_X = 180, MAX_PLAYER_X = CANVAS_WIDTH - 180, NUM_COLS_PAGE_LEVEL = 6, NUM_ROWS_PAGE_LEVEL = 2, GAME_NAME = "downhill_ski", SOUNDTRACK_VOLUME_IN_GAME = .4, ENABLE_FULLSCREEN, ENABLE_CHECK_ORIENTATION; function CPreloader() { var a, d, c, f, m, g, l, e, n; this._init = function() { s_oSpriteLibrary.init(this._onImagesLoaded, this._onAllImagesLoaded, this); s_oSpriteLibrary.addSprite("progress_bar", "./sprites/progress_bar.png"); s_oSpriteLibrary.addSprite("200x200", "./sprites/200x200.jpg"); s_oSpriteLibrary.loadSprites(); n = new createjs.Container; s_oStage.addChild(n) }; this.unload = function() { n.removeAllChildren() }; this._onImagesLoaded = function() {}; this._onAllImagesLoaded = function() { this.attachSprites(); s_oMain.preloaderReady() }; this.attachSprites = function() { var b = new createjs.Shape; b.graphics.beginFill("black").drawRect(0, 0, CANVAS_WIDTH, CANVAS_HEIGHT); n.addChild(b); b = s_oSpriteLibrary.getSprite("200x200"); l = createBitmap(b); l.regX = .5 * b.width; l.regY = .5 * b.height; l.x = CANVAS_WIDTH / 2; l.y = CANVAS_HEIGHT / 2 - 80; n.addChild(l); e = new createjs.Shape; e.graphics.beginFill("rgba(0,0,0,0.01)").drawRoundRect(l.x - 100, l.y - 100, 200, 200, 10); n.addChild(e); l.mask = e; b = s_oSpriteLibrary.getSprite("progress_bar"); f = createBitmap(b); f.x = CANVAS_WIDTH / 2 - b.width / 2; f.y = CANVAS_HEIGHT / 2 + 70; n.addChild(f); a = b.width; d = b.height; m = new createjs.Shape; m.graphics.beginFill("rgba(0,0,0,0.01)").drawRect(f.x, f.y, 1, d); n.addChild(m); f.mask = m; c = new createjs.Text("", "30px " + FONT_GAME, "#fff"); c.x = CANVAS_WIDTH / 2; c.y = CANVAS_HEIGHT / 2 + 120; c.textBaseline = "alphabetic"; c.textAlign = "center"; n.addChild(c); g = new createjs.Shape; g.graphics.beginFill("black").drawRect(0, 0, CANVAS_WIDTH, CANVAS_HEIGHT); n.addChild(g); createjs.Tween.get(g).to({ alpha: 0 }, 500).call(function() { createjs.Tween.removeTweens(g); n.removeChild(g) }) }; this.refreshLoader = function(b) { c.text = b + "%"; 100 === b && (s_oMain._allResourcesLoaded(), c.visible = !1, f.visible = !1); m.graphics.clear(); b = Math.floor(b * a / 100); m.graphics.beginFill("rgba(0,0,0,0.01)").drawRect(f.x, f.y, b, d) }; this._init() } function CMain(a) { var d, c, f = 0, m = 0, g = STATE_LOADING, l, e, n; this.initContainer = function() { var b = document.getElementById("canvas"); s_oStage = new createjs.Stage(b); s_oStage.preventSelection = !1; s_bMobile = isMobile(); !1 === s_bMobile ? s_oStage.enableMouseOver(20) : createjs.Touch.enable(s_oStage, !0); s_iPrevTime = (new Date).getTime(); createjs.Ticker.framerate = FPS; createjs.Ticker.on("tick", this._update); navigator.userAgent.match(/Windows Phone/i) && (DISABLE_SOUND_MOBILE = !0); s_oSpriteLibrary = new CSpriteLibrary; s_oLevelSettings = new CLevelSettings; l = new CPreloader; }; this.setLocalStorageLevel = function(b) { var v = getItem(GAME_NAME + "_level"); if (null === v || v < b) s_iLastLevel = b, saveItem(GAME_NAME + "_level", s_iLastLevel) }; this.setLocalStorageScore = function(b, v) { saveItem(GAME_NAME + "_score_level_" + v, b) }; this.clearLocalStorage = function() { s_iLastLevel = 1; if (s_bStorageAvailable) for (var b = 0; b < localStorage.length;) { var v = localStorage.key(b); - 1 !== v.indexOf(GAME_NAME) ? localStorage.removeItem(v) : b++ } }; this.getScoreTillLevel = function(b) { if (!s_bStorageAvailable) return 0; for (var v = 0, q = 0; q < b - 1; q++) v += parseInt(getItem(GAME_NAME + "_score_level_" + (q + 1))); return v }; this.getScoreLevel = function(b) { return getItem(GAME_NAME + "_score_level_" + (b + 1)) }; this.getSavedLevel = function() { if (!s_bStorageAvailable) return 1; var b = getItem(GAME_NAME + "_level"); return null === b ? 1 : b }; this.preloaderReady = function() { !1 !== DISABLE_SOUND_MOBILE && !1 !== s_bMobile || this._initSounds(); this._loadImages(); d = c = !0 }; this.soundLoaded = function() { f++; l.refreshLoader(Math.floor(f / m * 100)) }; this._initSounds = function() { Howler.mute(!s_bAudioActive); s_aSoundsInfo = []; s_aSoundsInfo.push({ path: "./sounds/", filename: "click", loop: !1, volume: 1, ingamename: "click" }); s_aSoundsInfo.push({ path: "./sounds/", filename: "level_win", loop: !1, volume: 1, ingamename: "level_win" }); s_aSoundsInfo.push({ path: "./sounds/", filename: "game_over", loop: !1, volume: 1, ingamename: "game_over" }); s_aSoundsInfo.push({ path: "./sounds/", filename: "crowd_idle", loop: !1, volume: 1, ingamename: "crowd_idle" }); s_aSoundsInfo.push({ path: "./sounds/", filename: "skiing_direction", loop: !1, volume: 1, ingamename: "skiing_direction" }); s_aSoundsInfo.push({ path: "./sounds/", filename: "falling", loop: !1, volume: 1, ingamename: "falling" }); s_aSoundsInfo.push({ path: "./sounds/", filename: "countdown", loop: !1, volume: 1, ingamename: "countdown" }); s_aSoundsInfo.push({ path: "./sounds/", filename: "go", loop: !1, volume: 1, ingamename: "go" }); s_aSoundsInfo.push({ path: "./sounds/", filename: "arrival", loop: !1, volume: 1, ingamename: "arrival" }); s_aSoundsInfo.push({ path: "./sounds/", filename: "soundtrack", loop: !0, volume: 1, ingamename: "soundtrack" }); m += s_aSoundsInfo.length; s_aSounds = []; for (var b = 0; b < s_aSoundsInfo.length; b++) this.tryToLoadSound(s_aSoundsInfo[b], !1) }; this.tryToLoadSound = function(b, v) { setTimeout(function() { s_aSounds[b.ingamename] = new Howl({ src: [b.path + b.filename + ".mp3"], autoplay: !1, preload: !0, loop: b.loop, volume: b.volume, onload: s_oMain.soundLoaded, onloaderror: function(q, k) { for (var r = 0; r < s_aSoundsInfo.length; r++) if (q === s_aSounds[s_aSoundsInfo[r].ingamename]._sounds[0]._id) { s_oMain.tryToLoadSound(s_aSoundsInfo[r], !0); break } }, onplayerror: function(q) { for (var k = 0; k < s_aSoundsInfo.length; k++) if (q === s_aSounds[s_aSoundsInfo[k].ingamename]._sounds[0]._id) { s_aSounds[s_aSoundsInfo[k].ingamename].once("unlock", function() { s_aSounds[s_aSoundsInfo[k].ingamename].play(); "soundtrack" === s_aSoundsInfo[k].ingamename && null !== s_oGame && setVolume("soundtrack", SOUNDTRACK_VOLUME_IN_GAME) }); break } } }) }, v ? 200 : 0) }; this._loadImages = function() { s_oSpriteLibrary.init(this._onImagesLoaded, this._onAllImagesLoaded, this); s_oSpriteLibrary.addSprite("but_play", "./sprites/but_play.png"); s_oSpriteLibrary.addSprite("but_next", "./sprites/but_next.png"); s_oSpriteLibrary.addSprite("but_exit", "./sprites/but_exit.png"); s_oSpriteLibrary.addSprite("bg_menu", "./sprites/bg_menu.jpg"); s_oSpriteLibrary.addSprite("audio_icon", "./sprites/audio_icon.png"); s_oSpriteLibrary.addSprite("msg_box_wide", "./sprites/msg_box_wide.png"); s_oSpriteLibrary.addSprite("msg_box_small", "./sprites/msg_box_small.png"); s_oSpriteLibrary.addSprite("bg_game", "./sprites/bg_game.jpg"); s_oSpriteLibrary.addSprite("logo_ctl", "./sprites/logo_ctl.png"); s_oSpriteLibrary.addSprite("but_credits", "./sprites/but_credits.png"); s_oSpriteLibrary.addSprite("but_yes", "./sprites/but_yes.png"); s_oSpriteLibrary.addSprite("but_no", "./sprites/but_no.png"); s_oSpriteLibrary.addSprite("but_fullscreen", "./sprites/but_fullscreen.png"); s_oSpriteLibrary.addSprite("but_settings", "./sprites/but_settings.png"); s_oSpriteLibrary.addSprite("but_home", "./sprites/but_home.png"); s_oSpriteLibrary.addSprite("but_restart", "./sprites/but_restart.png"); s_oSpriteLibrary.addSprite("but_pause", "./sprites/but_pause.png"); s_oSpriteLibrary.addSprite("key_0", "./sprites/key_0.png"); s_oSpriteLibrary.addSprite("key_1", "./sprites/key_1.png"); s_oSpriteLibrary.addSprite("but_left", "./sprites/but_left.png"); s_oSpriteLibrary.addSprite("but_right", "./sprites/but_right.png"); s_oSpriteLibrary.addSprite("but_level", "./sprites/but_level.png"); s_oSpriteLibrary.addSprite("logo_menu", "./sprites/logo_menu.png"); s_oSpriteLibrary.addSprite("item_0", "./sprites/item_0.png"); s_oSpriteLibrary.addSprite("item_1", "./sprites/item_1.png"); s_oSpriteLibrary.addSprite("item_2", "./sprites/item_2.png"); s_oSpriteLibrary.addSprite("score_panel", "./sprites/score_panel.png"); s_oSpriteLibrary.addSprite("sponsor", "./sprites/sponsor.png"); s_oSpriteLibrary.addSprite("countdown_0", "./sprites/countdown_0.png"); s_oSpriteLibrary.addSprite("countdown_1", "./sprites/countdown_1.png"); s_oSpriteLibrary.addSprite("countdown_2", "./sprites/countdown_2.png"); s_oSpriteLibrary.addSprite("countdown_3", "./sprites/countdown_3.png"); s_oSpriteLibrary.addSprite("icon_score", "./sprites/icon_score.png"); s_oSpriteLibrary.addSprite("but_clear_save", "./sprites/but_clear_save.png"); for (var b = 0; 87 > b; b++) s_oSpriteLibrary.addSprite("field_loop_" + b, "./sprites/field_loop/field_loop_" + b + ".png"); for (b = 0; 42 > b; b++) s_oSpriteLibrary.addSprite("arrive_" + b, "./sprites/arrive/arrive_" + b + ".png"); for (b = 0; 30 > b; b++) s_oSpriteLibrary.addSprite("player_falling_" + b, "./sprites/player/falling/player_falling_" + b + ".png"); for (b = 0; 70 > b; b++) s_oSpriteLibrary.addSprite("player_arrival_" + b, "./sprites/player/arrival/player_arrival_" + b + ".png"); for (b = 0; 19 > b; b++) s_oSpriteLibrary.addSprite("player_running_" + b, "./sprites/player/running/player_running_" + b + ".png"); for (b = 0; 8 > b; b++) s_oSpriteLibrary.addSprite("player_left_" + b, "./sprites/player/turn_left/player_left_" + b + ".png"), s_oSpriteLibrary.addSprite("player_right_" + b, "./sprites/player/turn_right/player_right_" + b + ".png"); for (b = 0; 7 > b; b++) s_oSpriteLibrary.addSprite("player_left_out_" + b, "./sprites/player/turn_left_out/player_left_out_" + b + ".png"), s_oSpriteLibrary.addSprite("player_right_out_" + b, "./sprites/player/turn_right_out/player_right_out_" + b + ".png"); for (b = 0; 45 > b; b++) s_oSpriteLibrary.addSprite("tutorial_" + b, "./sprites/help/tutorial_" + b + ".jpg"); m += s_oSpriteLibrary.getNumSprites(); s_oSpriteLibrary.loadSprites() }; this._onImagesLoaded = function() { f++; l.refreshLoader(Math.floor(f / m * 100)) }; this._onAllImagesLoaded = function() {}; this._allResourcesLoaded = function() { l.unload(); try { saveItem("ls_available", "ok"), s_iLastLevel = this.getSavedLevel() } catch (b) { s_bStorageAvailable = !1 } playSound("soundtrack", 1, !0); s_oMain.gotoMenu() }; this.gotoMenu = function() { new CMenu; g = STATE_MENU }; this.gotoLevelMenu = function() { e = new CLevelMenu; g = STATE_MENU_LEVEL }; this.gotoSelectCar = function() { new CMenuSelectCar; g = STATE_MENU_SELECT_CAR }; this.gotoGame = function() { n = new CGame; g = STATE_GAME }; this.levelSelected = function(b) { s_iLevelSelected = b; e.unload(); b >= s_iLastLevel && (s_iLastLevel = b); s_oMain.gotoGame() }; this.stopUpdateNoBlockAndTick = function() { c = !1 }; this.startUpdateNoBlockAndTick = function() { c = !0 }; this.stopUpdateNoBlock = function() { d = !1; createjs.Ticker.paused = !0 }; this.startUpdateNoBlock = function() { s_iPrevTime = (new Date).getTime(); d = !0; createjs.Ticker.paused = !1 }; this.stopUpdate = function() { d = !1; createjs.Ticker.paused = !0; document.querySelector("#block_game").style.display = "block"; !1 !== DISABLE_SOUND_MOBILE && !1 !== s_bMobile || Howler.mute(!0) }; this.startUpdate = function() { s_iPrevTime = (new Date).getTime(); d = !0; createjs.Ticker.paused = !1; document.querySelector("#block_game").style.display = "none"; (!1 === DISABLE_SOUND_MOBILE || !1 === s_bMobile) && s_bAudioActive && Howler.mute(!1) }; this.isUpdating = function() { return d }; this._update = function(b) { if (!1 !== d) { var v = (new Date).getTime(); s_iTimeElaps = v - s_iPrevTime; s_iCntTime += s_iTimeElaps; s_iCntFps++; s_iPrevTime = v; 1E3 <= s_iCntTime && (s_iCurFps = s_iCntFps, s_iCntTime -= 1E3, s_iCntFps = 0); g === STATE_GAME && c && n.update(); void 0 !== s_oStage && s_oStage.update(b) } }; s_oMain = this; HERO_ACCELERATION = a.hero_acceleration; HERO_FRICTION = a.hero_friction; MAX_HERO_SPEED = a.max_hero_speed; ENABLE_FULLSCREEN = a.fullscreen; ENABLE_CHECK_ORIENTATION = a.check_orientation; this.initContainer() } var s_bMobile, s_bAudioActive = !1, s_iCntTime = 0, s_iTimeElaps = 0, s_iPrevTime = 0, s_iCntFps = 0, s_iCurFps = 0, s_oDrawLayer, s_oStage, s_oMain = null, s_oSpriteLibrary, s_oLevelSettings, s_iLastLevel, s_iLevelSelected = 1, s_bFullscreen = !1, s_bStorageAvailable = !0, s_aSoundsInfo; function CTextButton(a, d, c, f, m, g, l, e) { var n, b, v, q, k, r, w, y, u, A, h; this._init = function(B, C, z, x, G, t, I, H) { n = !1; q = []; k = []; h = createBitmap(z); b = z.width; v = z.height; A = new createjs.Text(x, I + "px " + G, t); A.textAlign = "center"; A.textBaseline = "alphabetic"; A.lineWidth = .9 * b; A.x = z.width / 2; A.y = Math.floor(z.height / 2) + 15; u = new createjs.Container; u.x = B; u.y = C; u.regX = z.width / 2; u.regY = z.height / 2; s_bMobile || (u.cursor = "pointer"); u.addChild(h, A); !1 !== H && s_oStage.addChild(u); this._initListener() }; this.unload = function() { u.off("mousedown", r); u.off("pressup", w); s_oStage.removeChild(u) }; this.setVisible = function(B) { u.visible = B }; this.setAlign = function(B) { A.textAlign = B }; this.enable = function() { n = !1; h.filters = []; h.cache(0, 0, b, v) }; this.disable = function() { n = !0; var B = (new createjs.ColorMatrix).adjustSaturation(-100).adjustBrightness(40); h.filters = [new createjs.ColorMatrixFilter(B)]; h.cache(0, 0, b, v) }; this._initListener = function() { r = u.on("mousedown", this.buttonDown); w = u.on("pressup", this.buttonRelease) }; this.addEventListener = function(B, C, z) { q[B] = C; k[B] = z }; this.addEventListenerWithParams = function(B, C, z, x) { q[B] = C; k[B] = z; y = x }; this.buttonRelease = function() { n || (playSound("click", 1, !1), u.scaleX = 1, u.scaleY = 1, q[ON_MOUSE_UP] && q[ON_MOUSE_UP].call(k[ON_MOUSE_UP], y)) }; this.buttonDown = function() { n || (u.scaleX = .9, u.scaleY = .9, q[ON_MOUSE_DOWN] && q[ON_MOUSE_DOWN].call(k[ON_MOUSE_DOWN])) }; this.setPosition = function(B, C) { u.x = B; u.y = C }; this.changeText = function(B) { A.text = B }; this.setX = function(B) { u.x = B }; this.setY = function(B) { u.y = B }; this.getButtonImage = function() { return u }; this.getX = function() { return u.x }; this.getY = function() { return u.y }; this.getSprite = function() { return u }; this._init(a, d, c, f, m, g, l, e); return this } function CGfxButton(a, d, c, f) { var m, g, l, e, n = [], b, v, q; this._init = function(k, r, w) { m = !1; g = 1; l = []; e = []; q = createBitmap(w); q.x = k; q.y = r; q.regX = w.width / 2; q.regY = w.height / 2; q.cursor = "pointer"; f.addChild(q); this._initListener() }; this.unload = function() { q.off("mousedown", b); q.off("pressup", v); f.removeChild(q) }; this.setVisible = function(k) { q.visible = k }; this._initListener = function() { b = q.on("mousedown", this.buttonDown); v = q.on("pressup", this.buttonRelease) }; this.addEventListener = function(k, r, w) { l[k] = r; e[k] = w }; this.addEventListenerWithParams = function(k, r, w, y) { l[k] = r; e[k] = w; n = y }; this.enable = function() { m = !1 }; this.disable = function() { m = !0 }; this.buttonRelease = function() { m || (playSound("click", 1, !1), q.scaleX = g, q.scaleY = g, l[ON_MOUSE_UP] && l[ON_MOUSE_UP].call(e[ON_MOUSE_UP], n)) }; this.buttonDown = function() { m || (q.scaleX = .9 * g, q.scaleY = .9 * g, l[ON_MOUSE_DOWN] && l[ON_MOUSE_DOWN].call(e[ON_MOUSE_DOWN], n)) }; this.setPosition = function(k, r) { q.x = k; q.y = r }; this.setX = function(k) { q.x = k }; this.setY = function(k) { q.y = k }; this.setScale = function(k) { g = k; q.scaleX = q.scaleY = k }; this.getButtonImage = function() { return q }; this.getX = function() { return q.x }; this.getY = function() { return q.y }; this._init(a, d, c) } function CSideGfxButton(a, d, c, f, m) { var g, l = d, e, n, b, v, q = [], k, r, w; this._init = function(y, u, A, h) { g = !1; b = []; v = []; w = createBitmap(h); w.y = A; n = h.width; y ? (w.x = -h.width, w.regX = 0) : (w.x = CANVAS_WIDTH + h.width, w.regX = h.width); e = w.x; w.regY = h.height / 2; w.cursor = "pointer"; m.addChild(w); this._initListener() }; this.unload = function() { w.off("mousedown", k); w.off("pressup", r); m.removeChild(w) }; this.setVisible = function(y) { w.visible = y }; this._initListener = function() { k = w.on("mousedown", this.buttonDown); r = w.on("pressup", this.buttonRelease) }; this.addEventListener = function(y, u, A) { b[y] = u; v[y] = A }; this.addEventListenerWithParams = function(y, u, A, h) { b[y] = u; v[y] = A; q = h }; this.enable = function() { g = !1 }; this.disable = function() { g = !0 }; this.buttonRelease = function() { g || (playSound("click", 1, !1), w.scaleX = 1, w.scaleY = 1, b[ON_MOUSE_UP] && b[ON_MOUSE_UP].call(v[ON_MOUSE_UP], q)) }; this.buttonDown = function() { g || (w.scaleX = .9, w.scaleY = .9, b[ON_MOUSE_DOWN] && b[ON_MOUSE_DOWN].call(v[ON_MOUSE_DOWN], q)) }; this.setPosition = function(y, u) { w.x = y; w.y = u }; this.setX = function(y) { w.x = y }; this.setY = function(y) { w.y = y }; this.resetX = function() { w.x = a ? -n : CANVAS_WIDTH + n }; this.setFinalX = function(y) { l = y; e = a ? l - n : l + n }; this.tweenFinalX = function() { createjs.Tween.get(w).to({ x: l }, 300, createjs.Ease.quartOut).call(function() { b[ON_BUT_END_TWEEN_X] && b[ON_BUT_END_TWEEN_X].call(v[ON_BUT_END_TWEEN_X]) }) }; this.tweenStartX = function(y) { createjs.Tween.get(w).wait(y).to({ x: e }, 300, createjs.Ease.quartOut) }; this.getButtonImage = function() { return w }; this.getX = function() { return w.x }; this.getY = function() { return w.y }; this._init(a, d, c, f); return this } function CSideToggle(a, d, c, f, m, g, l) { var e, n = c, b, v, q, k; this._init = function(r, w, y, u, A) { v = []; q = []; w = 0; !1 === r && (w = u.width / 2); var h = new createjs.SpriteSheet({ images: [u], frames: { width: u.width / 2, height: u.height, regX: w, regY: u.height / 2 }, animations: { state_true: [0], state_false: [1] } }); e = A; k = createSprite(h, "state_" + e, w, u.height / 2, u.width / 2, u.height); k.x = r ? -u.width / 2 : CANVAS_WIDTH + u.width / 2; b = k.x; k.y = y; k.stop(); k.cursor = "pointer"; l.addChild(k); this._initListener() }; this.unload = function() { k.off("mousedown", this.buttonDown); k.off("pressup", this.buttonRelease); l.removeChild(k) }; this._initListener = function() { k.on("mousedown", this.buttonDown); k.on("pressup", this.buttonRelease) }; this.addEventListener = function(r, w, y) { v[r] = w; q[r] = y }; this.setActive = function(r) { e = r; k.gotoAndStop("state_" + e) }; this.buttonRelease = function() { k.scaleX = 1; k.scaleY = 1; playSound("click", 1, !1); e = !e; k.gotoAndStop("state_" + e); v[ON_MOUSE_UP] && v[ON_MOUSE_UP].call(q[ON_MOUSE_UP], e) }; this.buttonDown = function() { k.scaleX = .9; k.scaleY = .9; v[ON_MOUSE_DOWN] && v[ON_MOUSE_DOWN].call(q[ON_MOUSE_DOWN]) }; this.setPosition = function(r, w) { k.x = r; k.y = w }; this.setY = function(r) { k.y = r }; this.setFinalX = function(r) { n = r }; this.tweenFinalX = function() { createjs.Tween.get(k).wait(d).to({ x: n }, 300, createjs.Ease.quartOut).call(function() { v[ON_BUT_END_TWEEN_X] && v[ON_BUT_END_TWEEN_X].call(q[ON_BUT_END_TWEEN_X]) }) }; this.tweenStartX = function(r) { createjs.Tween.get(k).wait(r).to({ x: b }, 300, createjs.Ease.quartOut) }; this.getButtonImage = function() { return k }; this._init(a, c, f, m, g) } function CMenu() { var a, d, c, f, m, g, l, e, n, b, v, q, k, r, w, y, u, A = null, h = null; this._init = function() { n = !0; b = createBitmap(s_oSpriteLibrary.getSprite("bg_menu")); s_oStage.addChild(b); v = new CGfxButton(CANVAS_WIDTH / 2 + 250, CANVAS_HEIGHT / 2 + 90, s_oSpriteLibrary.getSprite("but_play"), s_oStage); v.addEventListener(ON_MOUSE_UP, this._onButPlaySingle, this); if (!1 === DISABLE_SOUND_MOBILE || !1 === s_bMobile) { var B = s_oSpriteLibrary.getSprite("audio_icon"); l = CANVAS_WIDTH; e = B.height / 2 + 10; q = new CSideToggle(!1, 0, l - s_iOffsetX, e + s_iOffsetY, B, s_bAudioActive, s_oStage); q.addEventListener(ON_MOUSE_UP, this._onAudioToggle, this); c = CANVAS_WIDTH; f = e + B.height + 10; q.tweenFinalX() } else c = CANVAS_WIDTH, f = B.height / 2 + 10; B = s_oSpriteLibrary.getSprite("but_credits"); m = 0; g = B.height / 2 + 10; k = new CSideGfxButton(!0, m + s_iOffsetX, g + s_iOffsetY, B, s_oStage); k.addEventListener(ON_MOUSE_UP, this._onButCreditsRelease, this); k.addEventListener(ON_BUT_END_TWEEN_X, this._onButEndTween, this); a = 0; d = CANVAS_HEIGHT - B.height / 2 - 10; r = new CSideGfxButton(!0, a + s_iOffsetX, d - s_iOffsetY, s_oSpriteLibrary.getSprite("but_clear_save"), s_oStage); r.addEventListener(ON_MOUSE_UP, this._onButClearRelease, this); B = window.document; var C = B.documentElement; A = C.requestFullscreen || C.mozRequestFullScreen || C.webkitRequestFullScreen || C.msRequestFullscreen; h = B.exitFullscreen || B.mozCancelFullScreen || B.webkitExitFullscreen || B.msExitFullscreen; !1 === ENABLE_FULLSCREEN && (A = !1); A && screenfull.isEnabled && (B = s_oSpriteLibrary.getSprite("but_fullscreen"), y = new CSideToggle(!1, 200, c - s_iOffsetX, f + s_iOffsetY, B, s_bFullscreen, s_oStage), y.addEventListener(ON_MOUSE_UP, this._onFullscreenRelease, this), y.tweenFinalX()); B = createBitmap(s_oSpriteLibrary.getSprite("logo_menu")); B.x = 450; B.y = 60; s_oStage.addChild(B); u = new CAreYouSurePanel; u.addEventListener(ON_BUT_YES_DOWN, this._onConfirmClear, this); s_bStorageAvailable || new CAlertSavingBox(TEXT_ERR_LS, s_oStage); w = new createjs.Shape; w.graphics.beginFill("black").drawRect(0, 0, CANVAS_WIDTH, CANVAS_HEIGHT); s_oStage.addChild(w); createjs.Tween.get(w).to({ alpha: 0 }, 400).call(function() { w.visible = !1 }); k.tweenFinalX(); r.tweenFinalX(); setVolume("soundtrack", 1) }; this.unload = function() { v.unload(); k.unload(); r.unload(); if (!1 === DISABLE_SOUND_MOBILE || !1 === s_bMobile) q.unload(), q = null; A && screenfull.isEnabled && y.unload(); s_oStage.removeAllChildren(); s_oMenu = null }; this.refreshButtonPos = function() { n || (!1 !== DISABLE_SOUND_MOBILE && !1 !== s_bMobile || q.setPosition(l - s_iOffsetX, s_iOffsetY + e), A && screenfull.isEnabled && y.setPosition(c - s_iOffsetX, f + s_iOffsetY), k.setPosition(m + s_iOffsetX, g + s_iOffsetY), r.setPosition(a + s_iOffsetX, d - s_iOffsetY)) }; this._onButPlaySingle = function() { s_oMenu.unload(); s_oMain.gotoLevelMenu(); document.dispatchEvent(new CustomEvent("start_session")) }; this._onButCreditsRelease = function() { new CCreditsPanel }; this._onButClearRelease = function() { u.show(TEXT_CONFIRM_CLEAR_SAVINGS) }; this._onButEndTween = function() { n = !1 }; this._onAudioToggle = function() { Howler.mute(s_bAudioActive); s_bAudioActive = !s_bAudioActive }; this.resetFullscreenBut = function() { A && screenfull.isEnabled && y.setActive(s_bFullscreen) }; this._onFullscreenRelease = function() { s_bFullscreen ? h.call(window.document) : A.call(window.document.documentElement); sizeHandler() }; this._onConfirmClear = function() { s_oMain.clearLocalStorage() }; s_oMenu = this; this._init() } var s_oMenu = null; function CGame() { var a = !1, d, c, f, m, g, l, e, n, b, v, q, k, r, w, y, u, A, h, B, C, z, x, G, t, I, H, Q; this._init = function() { n = s_iLevelSelected; l = s_oMain.getScoreTillLevel(n); A = [{ x: 10, y: 0 }, { x: -20, y: 0 }, { x: 10, y: -10 }, { x: 0, y: 20 }, { x: 10, y: -10 }, { x: -10, y: 0 }, { x: 10, y: 0 }, { x: -20, y: 0 }, { x: 10, y: -10 }, { x: 0, y: 20 }, { x: 10, y: -10 }, { x: -10, y: 0 }]; var E = s_oSpriteLibrary.getSprite("bg_game"); z = new createjs.Container; z.x = E.width / 2; z.y = CANVAS_HEIGHT / 2; z.regX = E.width / 2; z.regY = 424; s_oStage.addChild(z); h = createBitmap(E); h.x = -50; z.addChild(h); B = new CField(-50, 220, z); B.addEventListener(ON_READY_FOR_PLAYER_ARRIVAL, this.playArrival, this); x = new createjs.Container; z.addChild(x); t = new CPlayer(CANVAS_WIDTH / 2, 850, x); t.addEventListener(ON_PLAYER_ARRIVAL, this._onWinLevel, this); t.addEventListener(ON_PLAYER_FALL, this._onEndLevel, this); G = new CCountdownController(CANVAS_WIDTH / 2, CANVAS_HEIGHT / 2 - 150, s_oStage); G.addEventListener(ON_END_COUNTDOWN, this.startRace, this); C = new CInterface(l); this.reset(); I = new CHelpPanel; I.show(); H = new CEndPanel; H.addEventListener(ON_RESTART, this.restart, this); H.addEventListener(ON_BACK_MENU, this.onExit, this); Q = new CNextLevelPanel; Q.addEventListener(ON_RESTART, this.restart, this); Q.addEventListener(ON_BACK_MENU, this.onExit, this); Q.addEventListener(ON_NEXT_LEVEL, this._onNextLevel, this) }; this.unload = function() { a = !1; stopSound("countdown"); createjs.Tween.removeAllTweens(); C.unload(); s_oStage.removeAllChildren(); s_oGame = null }; this.reset = function() { d = g = f = c = m = !1; b = e = 0; y = []; v = s_oLevelSettings.getEnemiesSpawn(n); q = s_oLevelSettings.getStartingEnemySpawn(n); s_oLevelSettings.getEnemySpawnNumber(n); l = s_oMain.getScoreTillLevel(n); k = parseFloat((-334 / v).toFixed(2)); h.y = 0; t.reset(); C.reset(l, n); G.reset(); B.reset(); setVolume("soundtrack", SOUNDTRACK_VOLUME_IN_GAME); document.dispatchEvent(new CustomEvent("start_level", { detail: { level: n } })) }; this.restart = function() { document.dispatchEvent(new CustomEvent("restart_level", { detail: { level: n } })); for (var E = 0; E < y.length; E++) y[E].unload(); this.reset(); this.startCountdown() }; this.refreshButtonPos = function() { C.refreshButtonPos() }; this.onKeyDown = function(E) { if (!a || g || t.getCurAnim() === PLAYER_ANIM_ARRIVAL) return E.preventDefault(), !1; E || (E = window.event); switch (E.keyCode) { case 37: f && (f = !1, t.moveRight(!1)); c = !0; t.moveLeft(!0); break; case 39: c && (c = !1, t.moveLeft(!1)), f = !0, t.moveRight(!0) } E.preventDefault(); return !1 }; this.onKeyUp = function(E) { if (!a || g || t.getCurAnim() === PLAYER_ANIM_ARRIVAL) return E.preventDefault(), !1; E || (E = window.event); f = c = !1; switch (E.keyCode) { case 37: t.moveLeft(!1); break; case 39: t.moveRight(!1) } E.preventDefault(); return !1 }; this.moveLeft = function(E) { !a || E && c || g || t.getCurAnim() === PLAYER_ANIM_ARRIVAL || (c = E, t.moveLeft(E)) }; this.moveRight = function(E) { !a || E && f || g || t.getCurAnim() === PLAYER_ANIM_ARRIVAL || (f = E, t.moveRight(E)) }; this.startCountdown = function() { t.show(); B.show(); G.start(); a = !0 }; this.startRace = function() { this._spawnEnemy() }; this._createSpawnArray = function() { u = []; for (var E = ARRIVAL_X_INTERVAL / 5, P = MIN_ARRIVAL_X, N = 0; 6 > N; N++) u.push(P), P += E; u = shuffle(u) }; this.onExitFromHelp = function() { this.startCountdown() }; this._spawnEnemy = function() { d = !0; if (0 !== v) { v--; var E = !1; 0 === v ? m = E = !0 : 2 === v && B.prepareSponsorsForStop(); var P = Math.floor(3 * Math.random()); if (.3 < Math.random()) var N = t.getX() - CANVAS_WIDTH / 2 + t.getX(); else this._createSpawnArray(), N = u.pop(); E = new COpponent(E, (N - MIN_ARRIVAL_X) / ARRIVAL_X_INTERVAL * START_X_INTERVAL + MIN_START_X, 500, N, P, x); E.addEventListener(ON_OPPONENT_HIDE, this.checkArrival, this); E.addEventListener(ON_OPPONENT_CHECK_COLLISION, this.checkCollision, this); y.push(E); E = h.y + k; (new createjs.Tween.get(h)).to({ y: E }, q) } }; this.checkArrival = function(E) { E && !g && (B.readyForArrival(), playSound("crowd_idle", 1, !1)) }; this.checkCollision = function(E, P) { if (!g) { var N = t.getRect(), T = Math.abs(E.x - N.x); if (N.intersects(E)) { g = !0; r = 0; var R = this; w = setInterval(function() { R.tremble() }, 20); t.changeAnim(PLAYER_ANIM_FALL) } else this.refreshScore(Math.floor(T / 200)); x.swapChildren(P, t.getContainer()) } }; this.tremble = function() { var E = A[r]; z.x += E.x; z.y += E.y; r++; r === A.length && (r = 0, clearInterval(w)) }; this.refreshScore = function(E) { e += E; l += E; C.refreshScore(l) }; this.playArrival = function() { f = c = !1; t.changeAnim(PLAYER_ANIM_ARRIVAL) }; this._manageOpponentDepth = function() { x.sortChildren(function(E, P, N) { return E.y > P.y ? 1 : E.y < P.y ? -1 : 0 }) }; this._onEndLevel = function() { document.dispatchEvent(new CustomEvent("end_level", { detail: { level: n } })); B.stopAnim(); for (var E = 0; E < y.length; E++) y[E].stopUpdate(); setTimeout(function() { H.show(0, TEXT_GAME_OVER) }, 500) }; this._onWinLevel = function() { document.dispatchEvent(new CustomEvent("end_level", { detail: { level: n } })); document.dispatchEvent(new CustomEvent("save_score", { detail: { score: l } })); n === NUM_LEVELS ? setTimeout(function() { H.show(l, TEXT_CONGRATS) }, 500) : (s_oMain.setLocalStorageLevel(n + 1), setTimeout(function() { Q.show(e, l, n) }, 500)); s_oMain.setLocalStorageScore(e, n) }; this._onNextLevel = function() { n++; this.reset(); this.startCountdown() }; this.onExit = function() { this.unload(); s_oMain.gotoMenu(); document.dispatchEvent(new CustomEvent("show_interlevel_ad")); document.dispatchEvent(new CustomEvent("end_session")); document.dispatchEvent(new CustomEvent("share_event", { detail: { score: l } })) }; this.getPlayerX = function() { return t.getX() }; this.update = function() { I.isVisible() && I.update(); if (!1 !== a) { c && -4 < z.rotation ? z.rotation -= .5 : f && 4 > z.rotation ? z.rotation += .5 : !1 === c && !1 === f && (0 < z.rotation ? z.rotation -= .5 : 0 > z.rotation && (z.rotation += .5)); t.update(); B.update(); this._manageOpponentDepth(); for (var E = 0; E < y.length; E++) y[E].update(); !g && d && (b += s_iTimeElaps, !m && b > q && (b = 0, this._spawnEnemy())) } }; s_oGame = this; this._init() } var s_oGame = null; function CInterface(a) { var d, c, f, m, g, l, e, n, b, v, q, k, r, w, y, u, A, h, B, C, z, x, G, t, I, H, Q = null, E = null, P, N, T, R; this._init = function(U) { if (s_bMobile) { var J = s_oSpriteLibrary.getSprite("but_left"); g = J.width / 2 + 150; l = CANVAS_HEIGHT - J.height / 2 - 50; I = new CGfxButton(g, l, J, s_oStage); I.addEventListener(ON_MOUSE_DOWN, this._onLeftDown, this); I.addEventListener(ON_MOUSE_UP, this._onLeftUp, this); J = s_oSpriteLibrary.getSprite("but_right"); f = CANVAS_WIDTH - J.width / 2 - 150; m = CANVAS_HEIGHT - J.height / 2 - 50; H = new CGfxButton(f, m, J, s_oStage); H.addEventListener(ON_MOUSE_DOWN, this._onRightDown, this); H.addEventListener(ON_MOUSE_UP, this._onRightUp, this) } else document.onkeydown = s_oGame.onKeyDown, document.onkeyup = s_oGame.onKeyUp; J = s_oSpriteLibrary.getSprite("but_settings"); var p = CANVAS_WIDTH, X = J.height / 2 + 10; P = new CGUIExpandible(p, X, J, s_oStage); J = s_oSpriteLibrary.getSprite("but_exit"); r = p; w = X + J.height + 10; z = new CSideGfxButton(!1, r - s_iOffsetX, w, J, s_oStage); z.addEventListener(ON_MOUSE_UP, this._onExit, this); J = s_oSpriteLibrary.getSprite("but_pause"); d = CANVAS_WIDTH; c = w + J.height + 10; t = new CSideGfxButton(!1, d - s_iOffsetX, c, J, s_oStage); t.addEventListener(ON_MOUSE_UP, this._onPause, this); p = 100; !1 === DISABLE_SOUND_MOBILE || !1 === s_bMobile ? (J = s_oSpriteLibrary.getSprite("audio_icon"), y = CANVAS_WIDTH, u = c + J.height + 10, x = new CSideToggle(!1, p, y - s_iOffsetX, u, J, s_bAudioActive, s_oStage), x.addEventListener(ON_MOUSE_UP, this._onAudioToggle, this), e = CANVAS_WIDTH, n = u + J.height + 10, p += 100) : (e = CANVAS_WIDTH, n = c + J.height + 10); J = window.document; X = J.documentElement; Q = X.requestFullscreen || X.mozRequestFullScreen || X.webkitRequestFullScreen || X.msRequestFullscreen; E = J.exitFullscreen || J.mozCancelFullScreen || J.webkitExitFullscreen || J.msExitFullscreen; !1 === ENABLE_FULLSCREEN && (Q = !1); Q && screenfull.isEnabled && (J = s_oSpriteLibrary.getSprite("but_fullscreen"), G = new CSideToggle(!1, p, e - s_iOffsetX, n + s_iOffsetY, J, s_bFullscreen, s_oStage), G.addEventListener(ON_MOUSE_UP, this._onFullscreenRelease, this)); P.addButton(z); P.addButton(t); !1 !== DISABLE_SOUND_MOBILE && !1 !== s_bMobile || P.addButton(x); Q && screenfull.isEnabled && P.addButton(G); J = s_oSpriteLibrary.getSprite("score_panel"); q = 0; k = 10; T = new createjs.Container; T.x = q; T.y = k; s_oStage.addChild(T); p = createBitmap(J); T.addChild(p); B = new CTLText(T, 10, 0, J.width - 10, J.height, 40, "left", "#ffffff", FONT_GAME, 1.1, 0, 0, TEXT_SCORE, !0, !0, !0, !1); h = new CTLText(T, B.getX() + B.getBounds().width + 20, B.getY(), 140, J.height, 40, "left", "#ffffff", FONT_GAME, 1.1, 0, 0, U, !0, !0, !0, !1); b = 0; v = CANVAS_HEIGHT - J.height - 10; R = new createjs.Container; R.x = b; R.y = v; s_oStage.addChild(R); U = createBitmap(J); R.addChild(U); C = new CTLText(R, 10, 0, J.width - 10, J.height, 40, "left", "#ffffff", FONT_GAME, 1.1, 0, 0, TEXT_LEVEL + " " + s_iLevelSelected, !0, !0, !0, !1); N = new CAreYouSurePanel; N.addEventListener(ON_BUT_YES_DOWN, this._onExitYes, this); A = new CRollingScore; this.refreshButtonPos() }; this.unload = function() { z.unload(); z = null; P.unload(); N.unload(); !1 === DISABLE_SOUND_MOBILE && (x.unload(), x = null); Q && screenfull.isEnabled && G.unload(); s_bMobile ? (I.unload(), H.unload()) : (document.onkeydown = null, document.onkeyup = null); s_oStage.removeAllChildren(); s_oInterface = null }; this.reset = function(U, J) { h.refreshText(U); C.refreshText(TEXT_LEVEL + " " + J) }; this.refreshButtonPos = function() { T.x = q + s_iOffsetX; T.y = k + s_iOffsetY; R.x = b + s_iOffsetX; R.y = v - s_iOffsetY; P.refreshPos(); P.isExpanded() ? (!1 !== DISABLE_SOUND_MOBILE && !1 !== s_bMobile || x.setPosition(y - s_iOffsetX, s_iOffsetY + u), Q && screenfull.isEnabled && G.setPosition(e - s_iOffsetX, n + s_iOffsetY), z.setPosition(r - s_iOffsetX, w + s_iOffsetY), t.setPosition(d - s_iOffsetX, c + s_iOffsetY)) : (!1 !== DISABLE_SOUND_MOBILE && !1 !== s_bMobile || x.setY(s_iOffsetY + u), Q && screenfull.isEnabled && G.setY(n + s_iOffsetY), z.setY(w + s_iOffsetY), t.setY(c + s_iOffsetY), z.resetX(), t.resetX()); s_bMobile && (I.setPosition(g + s_iOffsetX, l - s_iOffsetY), H.setPosition(f - s_iOffsetX, m - s_iOffsetY)) }; this.refreshScore = function(U) { A.rolling(h, null, U) }; this._onLeftDown = function() { s_oGame.moveLeft(!0) }; this._onRightDown = function() { s_oGame.moveRight(!0) }; this._onLeftUp = function() { s_oGame.moveLeft(!1) }; this._onRightUp = function() { s_oGame.moveRight(!1) }; this._onExit = function() { N.show(TEXT_ARE_SURE) }; this._onAudioToggle = function() { Howler.mute(s_bAudioActive); s_bAudioActive = !s_bAudioActive }; this._onPause = function() { s_oMain.isUpdating() ? s_oMain.stopUpdateNoBlock() : s_oMain.startUpdateNoBlock() }; this.resetFullscreenBut = function() { Q && screenfull.isEnabled && G.setActive(s_bFullscreen) }; this._onFullscreenRelease = function() { !1 === s_oMain.isUpdating() && s_oMain.startUpdateNoBlock(); s_bFullscreen ? E.call(window.document) : Q.call(window.document.documentElement); sizeHandler() }; this._onExitYes = function() { s_oGame.onExit() }; s_oInterface = this; this._init(a); return this } var s_oInterface = null; function CHelpPanel() { var a, d, c, f, m, g, l, e, n, b = this; this._init = function() { n = new createjs.Container; n.visible = !1; s_oStage.addChild(n); f = new createjs.Shape; f.graphics.beginFill("rgba(0,0,0,0.7)").drawRect(0, 0, CANVAS_WIDTH, CANVAS_HEIGHT); c = f.on("click", function() {}); n.addChild(f); var v = s_oSpriteLibrary.getSprite("msg_box_wide"), q = createBitmap(v); q.regX = v.width / 2; q.regY = v.height / 2; q.x = CANVAS_WIDTH / 2; q.y = CANVAS_HEIGHT / 2; n.addChild(q); v = []; for (q = 0; 45 > q; q++) v.push(s_oSpriteLibrary.getSprite("tutorial_" + q)); q = v[0].width; var k = v[0].height; v = new createjs.SpriteSheet({ images: v, framerate: 15, frames: { width: q, height: k, regX: q / 2 }, animations: { start: 0, anim: [0, v.length - 1] } }); l = createSprite(v, "start", q / 2, 0, q, k); l.x = CANVAS_WIDTH / 2; l.y = 130; n.addChild(l); d = []; s_bMobile ? (v = s_oSpriteLibrary.getSprite("but_left"), q = s_oSpriteLibrary.getSprite("but_right")) : (v = s_oSpriteLibrary.getSprite("key_0"), q = s_oSpriteLibrary.getSprite("key_1")); m = createBitmap(v); m.regX = v.width / 2; m.regY = v.height / 2; m.x = CANVAS_WIDTH / 2 - 240; m.y = CANVAS_HEIGHT / 2 + 40; n.addChild(m); d.push(m); g = createBitmap(q); g.regX = q.width / 2; g.regY = q.height / 2; g.x = CANVAS_WIDTH / 2 + 240; g.y = CANVAS_HEIGHT / 2 + 40; n.addChild(g); d.push(g); e = new CGfxButton(CANVAS_WIDTH / 2, CANVAS_HEIGHT / 2 + 180, s_oSpriteLibrary.getSprite("but_next"), n); e.addEventListener(ON_MOUSE_UP, this._onStart, this) }; this.unload = function() { f.off("click", c) }; this.show = function() { a = 0; g.scaleX = g.scaleY = .9; l.gotoAndPlay("anim"); n.alpha = 0; n.visible = !0; createjs.Tween.get(n).to({ alpha: 1 }, 500) }; this.hide = function() { createjs.Tween.get(n).to({ alpha: 0 }, 500, createjs.Ease.cubicOut).call(function() { n.visible = !1 }) }; this._attachPlayer = function(v, q, k, r) { k = []; for (var w = 0; 18 > w; w++) k.push(s_oSpriteLibrary.getSprite("player_running_" + w)); w = k[0].width; var y = k[0].height; k = new createjs.SpriteSheet({ images: k, frames: { width: w, height: y, regX: w / 2, regY: y }, animations: { start: 0, anim: [0, k.length - 1, r] } }); k = createSprite(k, "start", w / 2, y, w, y); k.scaleX = k.scaleY = .7; k.x = v; k.y = q; n.addChild(k); return k }; this._toggleKeyAnims = function() { .9 === g.scaleX ? (g.scaleX = g.scaleY = 1, m.scaleX = m.scaleY = .9) : (m.scaleX = m.scaleY = 1, g.scaleX = g.scaleY = .9) }; this._onStart = function() { e.disable(); b.hide(); s_oGame.onExitFromHelp() }; this.isVisible = function() { return n.visible }; this.update = function() { a += s_iTimeElaps; 1500 < a && (a = 0, this._toggleKeyAnims()) }; this._init() } function CLevelSettings() { var a, d, c; this._init = function() { a = [20, 30, 40, 50, 60, 70, 80, 80, 90, 90, 100, 100]; d = [1300, 1100, 900, 800, 800, 700, 700, 600, 600, 500, 500, 400]; c = [1, 1, 1, 2, 2, 2, 2, 3, 3, 2, 2, 2]; NUM_LEVELS = a.length }; this.getEnemiesSpawn = function(f) { return a[f - 1] }; this.getStartingEnemySpawn = function(f) { return d[f - 1] }; this.getEnemySpawnNumber = function(f) { return c[f - 1] }; this._init() } function CLevelMenu() { var a, d, c, f, m, g, l, e, n, b, v, q, k, r, w, y, u, A, h, B, C = null, z = null; this._init = function() { l = !0; e = 0; h = new createjs.Container; s_oStage.addChild(h); var x = createBitmap(s_oSpriteLibrary.getSprite("bg_menu")); h.addChild(x); w = new createjs.Shape; w.graphics.beginFill("black").drawRect(0, 0, CANVAS_WIDTH, CANVAS_HEIGHT); w.alpha = .5; h.addChild(w); y = new createjs.Container; y.x = CANVAS_WIDTH / 2; h.addChild(y); r = s_oSpriteLibrary.getSprite("msg_box_wide"); x = createBitmap(r); y.addChild(x); new CTLText(y, 0, 40, r.width, 90, 80, "center", "#ffffff", FONT_GAME, 1, 20, 5, TEXT_SELECT_LEVEL, !0, !0, !0, !1); var G = s_oSpriteLibrary.getSprite("but_exit"); m = CANVAS_WIDTH; g = G.height / 2 + 10; u = new CSideGfxButton(!1, m - s_iOffsetX, g + s_iOffsetY, G, s_oStage); u.addEventListener(ON_MOUSE_UP, this._onExit, this); u.addEventListener(ON_BUT_END_TWEEN_X, this._onButEndTween, this); y.regX = r.width / 2; y.regY = r.height / 2; n = -r.height / 2; b = G.height; x = 100; !1 === DISABLE_SOUND_MOBILE || !1 === s_bMobile ? (G = s_oSpriteLibrary.getSprite("audio_icon"), c = CANVAS_WIDTH, f = g + G.height + 10, A = new CSideToggle(!1, x, c - s_iOffsetX, f + s_iOffsetY, G, s_bAudioActive, s_oStage), A.addEventListener(ON_MOUSE_UP, this._onAudioToggle, this), a = CANVAS_WIDTH, d = f + G.height + 10, x += 100, A.tweenFinalX()) : (a = CANVAS_WIDTH, d = g + G.height + 10); G = window.document; var t = G.documentElement; C = t.requestFullscreen || t.mozRequestFullScreen || t.webkitRequestFullScreen || t.msRequestFullscreen; z = G.exitFullscreen || G.mozCancelFullScreen || G.webkitExitFullscreen || G.msExitFullscreen; !1 === ENABLE_FULLSCREEN && (C = !1); C && screenfull.isEnabled && (G = s_oSpriteLibrary.getSprite("but_fullscreen"), B = new CSideToggle(!1, x, a - s_iOffsetX, d + s_iOffsetY, G, s_bFullscreen, s_oStage), B.addEventListener(ON_MOUSE_UP, this._onFullscreenRelease, this), B.tweenFinalX()); this._checkBoundLimits(); q = []; x = Math.floor((r.width - 100) / NUM_COLS_PAGE_LEVEL) / 2; for (t = G = 0; t < NUM_COLS_PAGE_LEVEL; t++) q.push(G), G += 2 * x; k = []; this._createNewLevelPage(0, NUM_LEVELS); this.refreshButtonPos(); w.alpha = 0; y.y = n; h.visible = !0; u.tweenFinalX(); createjs.Tween.get(w).to({ alpha: .7 }, 500); createjs.Tween.get(y).to({ y: CANVAS_HEIGHT / 2 }, 500, createjs.Ease.quartOut) }; this.unload = function() { for (var x = 0; x < v.length; x++) v[x].unload(); !1 !== DISABLE_SOUND_MOBILE && !1 !== s_bMobile || A.unload(); C && screenfull.isEnabled && B.unload(); u.unload(); s_oStage.removeAllChildren(); s_oLevelMenu = null }; this.refreshButtonPos = function() { l || (u.setPosition(m - s_iOffsetX, g + s_iOffsetY), !1 !== DISABLE_SOUND_MOBILE && !1 !== s_bMobile || A.setPosition(c - s_iOffsetX, s_iOffsetY + f), C && screenfull.isEnabled && B.setPosition(a - s_iOffsetX, d + s_iOffsetY)) }; this._checkBoundLimits = function() { for (var x = s_oSpriteLibrary.getSprite("but_level"), G = 0, t = CANVAS_HEIGHT - 2 * EDGEBOARD_Y - 2 * b, I = 0; G < t;) G += x.height + 20, I++; NUM_ROWS_PAGE_LEVEL > I && (NUM_ROWS_PAGE_LEVEL = I); t = G = 0; I = CANVAS_WIDTH - 2 * EDGEBOARD_X; for (x = s_oSpriteLibrary.getSprite("but_level"); t < I;) t += x.width / 2 + 5, G++; NUM_COLS_PAGE_LEVEL > G && (NUM_COLS_PAGE_LEVEL = G) }; this._createNewLevelPage = function(x, G) { var t = new createjs.Container; y.addChild(t); k.push(t); v = []; for (var I = 0, H = 0, Q = 1, E = !1, P = s_oSpriteLibrary.getSprite("but_level"), N = x; N < G; N++) { var T = null; if (N + 1 > s_iLastLevel) var R = !1; else R = !0, T = s_oMain.getScoreLevel(N); R = new CLevelBut(q[I] + P.width / 4, H + P.height / 2, N + 1, T, P, R, t); R.addEventListenerWithParams(ON_MOUSE_UP, this._onButLevelRelease, this, N); v.push(R); I++; if (I === q.length && (I = 0, H += P.height + 70, Q++, Q > NUM_ROWS_PAGE_LEVEL && N !== G - 1)) { E = !0; break } } t.x = r.width / 2; t.y = r.height / 2; t.regX = t.getBounds().width / 2; t.regY = t.getBounds().height / 2; E && this._createNewLevelPage(N + 1, G) }; this._onRight = function() { k[e].visible = !1; e++; e >= k.length && (e = 0); k[e].visible = !0 }; this._onLeft = function() { k[e].visible = !1; e--; 0 > e && (e = k.length - 1); k[e].visible = !0 }; this._onButLevelRelease = function(x) { s_oLevelMenu.unload(); s_oMain.levelSelected(x + 1) }; this._onAudioToggle = function() { Howler.mute(s_bAudioActive); s_bAudioActive = !s_bAudioActive }; this.resetFullscreenBut = function() { C && screenfull.isEnabled && B.setActive(s_bFullscreen) }; this._onFullscreenRelease = function() { s_bFullscreen ? z.call(window.document) : C.call(window.document.documentElement); sizeHandler() }; this._onButEndTween = function() { l = !1 }; this._onExit = function() { s_oLevelMenu.unload(); s_oMain.gotoMenu() }; s_oLevelMenu = this; this._init() } var s_oLevelMenu = null; function CLevelBut(a, d, c, f, m, g, l) { var e, n, b, v = [], q = [], k, r, w, y; this._init = function(A, h, B, C, z, x) { n = []; b = []; y = new createjs.Container; u.addChild(y); var G = new createjs.SpriteSheet({ images: [z], frames: { width: z.width / 2, height: z.height, regX: z.width / 2 / 2, regY: z.height / 2 }, animations: { state_true: [0], state_false: [1] } }); e = x; w = createSprite(G, "state_" + e, z.width / 2 / 2, z.height / 2, z.width / 2, z.height); w.mouseEnabled = x; w.x = A; w.y = h; w.stop(); s_bMobile || (y.cursor = "pointer"); y.addChild(w); v.push(w); k = new createjs.Text(B, "50px " + FONT_GAME, "#fff"); k.x = A; k.y = h + 2; k.textAlign = "center"; k.textBaseline = "alphabetic"; y.addChild(k); B = s_oSpriteLibrary.getSprite("icon_score"); B = createBitmap(B); B.x = A - 40; B.y = h + 22; y.addChild(B); null === C && (C = 0); r = new createjs.Text(C, "20px " + FONT_GAME, "#fff"); r.x = A + 40; r.y = h + 37; r.textAlign = "right"; r.textBaseline = "alphabetic"; y.addChild(r); x || (k.color = "#b4b4b4"); this._initListener() }; this.unload = function() { y.off("mousedown", this.buttonDown); y.off("pressup", this.buttonRelease); y.removeChild(w) }; this._initListener = function() { y.on("mousedown", this.buttonDown); y.on("pressup", this.buttonRelease) }; this.viewBut = function(A) { y.addChild(A) }; this.addEventListener = function(A, h, B) { n[A] = h; b[A] = B }; this.addEventListenerWithParams = function(A, h, B, C) { n[A] = h; b[A] = B; q = C }; this.ifClickable = function() { return !0 === y.mouseEnabled ? 1 : 0 }; this.setActive = function(A, h) { e = h; v[A].gotoAndStop("state_" + e); v[A].mouseEnabled = !0; k.color = e ? "#00397a" : "#b4b4b4" }; this.buttonRelease = function() { e && (playSound("click", 1, !1), n[ON_MOUSE_UP] && n[ON_MOUSE_UP].call(b[ON_MOUSE_UP], q)) }; this.buttonDown = function() { n[ON_MOUSE_DOWN] && n[ON_MOUSE_DOWN].call(b[ON_MOUSE_DOWN], q) }; this.setPosition = function(A, h) { y.x = A; y.y = h }; this.setVisible = function(A) { y.visible = A }; var u = l; this._init(a, d, c, f, m, g, l) } function CCreditsPanel() { var a, d, c, f, m, g, l; this._init = function() { l = new createjs.Container; s_oStage.addChild(l); var e = new createjs.Shape; e.graphics.beginFill("rgba(0,0,0,0.7)").drawRect(0, 0, CANVAS_WIDTH, CANVAS_HEIGHT); l.addChild(e); e = s_oSpriteLibrary.getSprite("msg_box_small"); a = createBitmap(e); a.regX = e.width / 2; a.regY = e.height / 2; a.x = CANVAS_WIDTH / 2; a.y = CANVAS_HEIGHT / 2; l.addChild(a); m = new createjs.Shape; m.graphics.beginFill("#0f0f0f").drawRect(0, 0, CANVAS_WIDTH, CANVAS_HEIGHT); m.alpha = .01; m.on("click", this._onLogoButRelease); l.addChild(m); e = s_oSpriteLibrary.getSprite("but_no"); c = new CGfxButton(980, 246, e, l); c.setScale(.6); c.addEventListener(ON_MOUSE_UP, this.unload, this); f = new createjs.Text(TEXT_CREDITS_DEVELOPED, "26px " + FONT_GAME, "#fff"); f.textAlign = "center"; f.textBaseline = "alphabetic"; f.x = CANVAS_WIDTH / 2; f.y = 330; l.addChild(f); e = s_oSpriteLibrary.getSprite("logo_ctl"); d = createBitmap(e); d.regX = e.width / 2; d.regY = e.height / 2; d.x = CANVAS_WIDTH / 2; d.y = CANVAS_HEIGHT / 2; l.addChild(d); g = new createjs.Text("www.codethislab.com", "26px " + FONT_GAME, "#fff"); g.textAlign = "center"; g.textBaseline = "alphabetic"; g.x = CANVAS_WIDTH / 2; g.y = 550; l.addChild(g) }; this.unload = function() { m.off("click", this._onLogoButRelease); c.unload(); c = null; s_oStage.removeChild(l) }; this._onLogoButRelease = function() { window.open("https://www.codethislab.com/", "_blank") }; this._init() } function CAlertSavingBox(a, d) { var c, f; this._init = function(l) { f = new createjs.Container; g.addChild(f); var e = new createjs.Shape; e.graphics.beginFill("black").drawRect(0, 0, CANVAS_WIDTH, CANVAS_HEIGHT); e.alpha = .5; e.on("click", function() {}); f.addChild(e); e = s_oSpriteLibrary.getSprite("msg_box_small"); var n = createBitmap(e); n.x = .5 * CANVAS_WIDTH; n.y = .5 * CANVAS_HEIGHT; n.regX = .5 * e.width; n.regY = .5 * e.height; f.addChild(n); new CTLText(f, CANVAS_WIDTH / 2 - e.width / 2, CANVAS_HEIGHT / 2 - 90, e.width, 200, 40, "center", "#ffffff", FONT_GAME, 1, 20, 10, l, !0, !0, !0, !1); c = new CSideGfxButton(!1, 1024, 250, s_oSpriteLibrary.getSprite("but_exit"), f); c.addEventListener(ON_MOUSE_UP, this._onButOk, this); c.setX(1024) }; this._onButOk = function() { m.unload() }; this.unload = function() { c.unload(); g.removeChild(f) }; var m = this; var g = d; this._init(a) } function CAreYouSurePanel() { var a, d, c, f, m, g, l, e, n = this; this._init = function() { a = []; d = []; l = new createjs.Container; l.visible = !1; s_oStage.addChild(l); e = new createjs.Shape; e.graphics.beginFill("black").drawRect(0, 0, CANVAS_WIDTH, CANVAS_HEIGHT); e.alpha = .5; e.on("click", function() {}); l.addChild(e); var b = s_oSpriteLibrary.getSprite("msg_box_small"); c = createBitmap(b); c.x = CANVAS_WIDTH / 2; c.y = CANVAS_HEIGHT / 2; c.regX = .5 * b.width; c.regY = .5 * b.height; l.addChild(c); f = new CTLText(l, CANVAS_WIDTH / 2 - b.width / 2, CANVAS_HEIGHT / 2 - b.height / 2, b.width, 200, 70, "center", "#ffffff", FONT_GAME, 1, 40, 10, TEXT_ARE_SURE, !0, !0, !0, !1); m = new CGfxButton(CANVAS_WIDTH / 2 + 150, .5 * CANVAS_HEIGHT + 70, s_oSpriteLibrary.getSprite("but_yes"), l); m.addEventListener(ON_MOUSE_UP, this._onButYes, this); g = new CGfxButton(CANVAS_WIDTH / 2 - 150, .5 * CANVAS_HEIGHT + 70, s_oSpriteLibrary.getSprite("but_no"), l); g.addEventListener(ON_MOUSE_UP, this._onButNo, this) }; this.addEventListener = function(b, v, q) { a[b] = v; d[b] = q }; this.show = function(b) { f.refreshText(b); l.alpha = 0; l.visible = !0; createjs.Tween.get(l).to({ alpha: 1 }, 300, createjs.Ease.quartOut).call(function() { s_oMain.stopUpdateNoBlock() }) }; this.hide = function() { s_oMain.startUpdateNoBlock(); createjs.Tween.get(l).to({ alpha: 0 }, 500, createjs.Ease.quartOut).call(function() { l.visible = !1 }) }; this.unload = function() { g.unload(); m.unload() }; this._onButYes = function() { n.hide(); a[ON_BUT_YES_DOWN] && a[ON_BUT_YES_DOWN].call(d[ON_BUT_YES_DOWN]) }; this._onButNo = function() { n.hide() }; this._init() } function CGUIExpandible(a, d, c, f) { var m, g, l, e, n; this._init = function(v, q, k, r) { g = []; e = new createjs.Container; e.x = v; e.y = q; r.addChild(e); n = new createjs.Container; e.addChild(n); m = !1; l = new CSideGfxButton(!1, 0, 0, k, n); l.addEventListener(ON_MOUSE_UP, this._onMenu, this); l.tweenFinalX() }; this.unload = function() { l.unload(); f.removeChild(e) }; this.refreshPos = function() { e.x = a - s_iOffsetX; e.y = d + s_iOffsetY; for (var v = 0; v < g.length; v++) g[v].setFinalX(e.x) }; this.addButton = function(v) { g.push(v) }; this._onMenu = function() { (m = !m) ? b._expand(): b._collapse() }; this._expand = function() { for (var v = 0; v < g.length; v++) g[v].tweenFinalX() }; this._collapse = function() { for (var v = 100 * g.length, q = 0; q < g.length; q++) g[q].tweenStartX(v), v -= 100 }; this.isExpanded = function() { return m }; var b = this; this._init(a, d, c, f) } function CField(a, d, c) { var f, m, g, l, e, n, b, v, q, k, r, w, y = this; this._init = function(A, h) { v = []; q = []; k = new createjs.Container; k.x = A; k.y = h; u.addChild(k); for (var B = [], C = 0; 87 > C; C++) { var z = s_oSpriteLibrary.getSprite("field_loop_" + C); B.push(z) } z = { images: B, framerate: 20, frames: { width: 1600, height: 631 }, animations: { start: 0, anim: [0, 29, "anim"], arrival: [30, 86, "end"], end: 86 } }; z = new createjs.SpriteSheet(z); w = createSprite(z, "start", 0, 0, 1600, 631); w.on("animationend", this._onAnimEnd, this); w.on("change", this._onAnimChange, this); k.addChild(w); B = []; for (C = 0; 42 > C; C++) z = s_oSpriteLibrary.getSprite("arrive_" + C), B.push(z); n = []; b = []; for (C = 0; 2 > C; C++) z = new CSponsor(510, 256, !0, k), n.push(z), z = new CSponsor(1070, 256, !1, k), b.push(z); z = { images: B, framerate: 15, frames: { width: 1600, height: 539 }, animations: { start: 0, anim: [0, 41, "end"], end: 42 } }; z = new createjs.SpriteSheet(z); r = createSprite(z, "start", 0, 0, 1600, 539); r.visible = !1; r.y = -h - 18; k.addChild(r) }; this.reset = function() { m = !1; for (var A = 0; A < n.length; A++) n[A].reset(), b[A].reset(); g = r.visible = !1; e = l = 0 }; this.show = function() { f = !1; w.gotoAndPlay("anim"); g = !0 }; this.hide = function() { w.gotoAndStop("start"); k.visible = !1 }; this.addEventListener = function(A, h, B) { v[A] = h; q[A] = B }; this.readyForArrival = function() { f = !0 }; this._playArrival = function() { w.framerate = 15; w.gotoAndPlay("arrival") }; this.stopAnim = function() { w.stop(); this.stopSponsors() }; this.prepareSponsorsForStop = function() { for (var A = 0; A < n.length; A++) n[A].readyForRemoval(), b[A].readyForRemoval() }; this.stopSponsors = function() { for (var A = 0; A < n.length; A++) n[A].stopTween(), b[A].stopTween() }; this._onAnimEnd = function(A) { "anim" === A.currentTarget.currentAnimation && f && (f = !1, y._playArrival()) }; this._onAnimChange = function(A) { "arrival" === A.currentTarget.currentAnimation && (75 <= A.currentTarget.currentFrame && !m ? (m = !0, v[ON_READY_FOR_PLAYER_ARRIVAL] && v[ON_READY_FOR_PLAYER_ARRIVAL].call(q[ON_READY_FOR_PLAYER_ARRIVAL])) : 31 <= A.currentTarget.currentFrame && !1 === r.visible && (r.gotoAndPlay("anim"), r.visible = !0)) }; this.update = function() { g && (l += s_iTimeElaps, 2E3 < l && (l = 0, n[e].startAnim(), b[e].startAnim(), e++, e === n.length && (g = !1))) }; var u = c; this._init(a, d) } function CPlayer(a, d, c) { var f = !1, m = !1, g = !1, l, e, n, b, v, q, k, r, w, y, u, A, h, B, C; this._init = function(x, G) { b = x; v = G; r = 0; q = HERO_ACCELERATION; k = MAX_HERO_SPEED; h = []; B = []; C = new createjs.Container; C.x = x; C.y = G; z.addChild(C); A = []; A[PLAYER_ANIM_RUN] = 19; A[PLAYER_ANIM_FALL] = 30; A[PLAYER_ANIM_ARRIVAL] = 70; A[PLAYER_ANIM_LEFT] = 8; A[PLAYER_ANIM_RIGHT] = 8; A[PLAYER_ANIM_LEFT_OUT] = 7; A[PLAYER_ANIM_RIGHT_OUT] = 7; u = []; u[PLAYER_ANIM_RUN] = []; for (var t = 0; t < A[PLAYER_ANIM_RUN]; t++) { var I = s_oSpriteLibrary.getSprite("player_running_" + t), H = createBitmap(I); H.visible = !1; H.regX = I.width / 2; H.regY = I.height; C.addChild(H); u[PLAYER_ANIM_RUN].push(H) } u[PLAYER_ANIM_FALL] = []; for (t = 0; t < A[PLAYER_ANIM_FALL]; t++) I = s_oSpriteLibrary.getSprite("player_falling_" + t), H = createBitmap(I), H.visible = !1, H.regX = I.width / 2, H.regY = I.height, C.addChild(H), u[PLAYER_ANIM_FALL].push(H); u[PLAYER_ANIM_ARRIVAL] = []; for (t = 0; t < A[PLAYER_ANIM_ARRIVAL]; t++) I = s_oSpriteLibrary.getSprite("player_arrival_" + t), H = createBitmap(I), H.visible = !1, H.regX = I.width / 2, H.regY = I.height, C.addChild(H), u[PLAYER_ANIM_ARRIVAL].push(H); u[PLAYER_ANIM_LEFT] = []; for (t = 0; t < A[PLAYER_ANIM_LEFT]; t++) I = s_oSpriteLibrary.getSprite("player_left_" + t), H = createBitmap(I), H.visible = !1, H.regX = I.width / 2, H.regY = I.height, C.addChild(H), u[PLAYER_ANIM_LEFT].push(H); u[PLAYER_ANIM_RIGHT] = []; for (t = 0; t < A[PLAYER_ANIM_RIGHT]; t++) I = s_oSpriteLibrary.getSprite("player_right_" + t), H = createBitmap(I), H.visible = !1, H.regX = I.width / 2, H.regY = I.height, C.addChild(H), u[PLAYER_ANIM_RIGHT].push(H); u[PLAYER_ANIM_LEFT_OUT] = []; for (t = 0; t < A[PLAYER_ANIM_LEFT_OUT]; t++) I = s_oSpriteLibrary.getSprite("player_left_out_" + t), H = createBitmap(I), H.visible = !1, H.regX = I.width / 2, H.regY = I.height, C.addChild(H), u[PLAYER_ANIM_LEFT_OUT].push(H); u[PLAYER_ANIM_RIGHT_OUT] = []; for (t = 0; t < A[PLAYER_ANIM_RIGHT_OUT]; t++) I = s_oSpriteLibrary.getSprite("player_right_out_" + t), H = createBitmap(I), H.visible = !1, H.regX = I.width / 2, H.regY = I.height, C.addChild(H), u[PLAYER_ANIM_RIGHT_OUT].push(H); l = PLAYER_ANIM_RUN }; this.addEventListener = function(x, G, t) { h[x] = G; B[x] = t }; this.show = function() { e = A[l]; u[l][0].visible = !0; n = 0; C.visible = !0; w = C.getBounds().width - 400; y = C.getBounds().height - 200; f = !0 }; this.hide = function() { f = !1; C.visible = !1 }; this.reset = function() { g = m = f = !1; r = 0; q = HERO_ACCELERATION; k = MAX_HERO_SPEED; C.alpha = 1; C.x = b; C.y = v; for (var x = 0; x < A[PLAYER_ANIM_RUN]; x++) u[PLAYER_ANIM_RUN][x].visible = !1; for (x = 0; x < A[PLAYER_ANIM_FALL]; x++) u[PLAYER_ANIM_FALL][x].visible = !1; for (x = 0; x < A[PLAYER_ANIM_ARRIVAL]; x++) u[PLAYER_ANIM_ARRIVAL][x].visible = !1; for (x = 0; x < A[PLAYER_ANIM_LEFT]; x++) u[PLAYER_ANIM_LEFT][x].visible = !1; for (x = 0; x < A[PLAYER_ANIM_RIGHT]; x++) u[PLAYER_ANIM_RIGHT][x].visible = !1; l = PLAYER_ANIM_RUN }; this.changeAnim = function(x) { x !== l && (f = !1, u[l][n].visible = !1, l = x, u[l][0].visible = !0, n = 0, e = A[l], f = !0, x === PLAYER_ANIM_LEFT || x === PLAYER_ANIM_RIGHT ? playSound("skiing_direction", 1, !1) : x === PLAYER_ANIM_FALL ? playSound("falling", 1, !1) : x === PLAYER_ANIM_ARRIVAL && playSound("arrival", 1, !1)) }; this.playToFrame = function(x) { u[l][n].visible = !1; n = x; u[l][n].visible = !0 }; this.nextFrame = function() { u[l][n].visible = !1; n++; u[l][n].visible = !0 }; this.moveLeft = function(x) { C.x === MIN_PLAYER_X ? (m = !1, r = 0) : (x ? this.changeAnim(PLAYER_ANIM_LEFT) : this.changeAnim(PLAYER_ANIM_LEFT_OUT), m = x) }; this.moveRight = function(x) { C.x === MAX_PLAYER_X ? (g = !1, r = 0) : (x ? this.changeAnim(PLAYER_ANIM_RIGHT) : this.changeAnim(PLAYER_ANIM_RIGHT_OUT), g = x) }; this.setAcceleration = function(x, G) { q = x; k = G }; this.setY = function(x) { C.y = x }; this.getRect = function() { return new createjs.Rectangle(C.x - w / 2, C.y - y, w, y) }; this.getCurAnim = function() { return l }; this.getX = function() { return C.x }; this.getContainer = function() { return C }; this._updateMove = function() { l !== PLAYER_ANIM_FALL && l !== PLAYER_ANIM_ARRIVAL && (m && (r -= q), g && (r += q), C.x += r, r *= HERO_FRICTION, r > k && (r = k), r < -k && (r = -k), .1 > Math.abs(r) && (r = 0), C.x + r >= MAX_PLAYER_X ? (C.x = MAX_PLAYER_X, l === PLAYER_ANIM_RIGHT && this.changeAnim(PLAYER_ANIM_RIGHT_OUT)) : C.x - r <= MIN_PLAYER_X && (C.x = MIN_PLAYER_X, l === PLAYER_ANIM_LEFT && this.changeAnim(PLAYER_ANIM_LEFT_OUT)), C.y = v - Math.abs((C.x - CANVAS_WIDTH / 2) / 10), C.setTransform(C.x, C.y, 1, 1, 0, -(C.x - CANVAS_WIDTH / 2) / 50)) }; this.update = function() { if (!1 !== f) if (this._updateMove(), n === e - 1) switch (l) { case PLAYER_ANIM_RUN: this.playToFrame(0); break; case PLAYER_ANIM_FALL: this.hide(); h[ON_PLAYER_FALL] && h[ON_PLAYER_FALL].call(B[ON_PLAYER_FALL]); break; case PLAYER_ANIM_ARRIVAL: f = !1; h[ON_PLAYER_ARRIVAL] && h[ON_PLAYER_ARRIVAL].call(B[ON_PLAYER_ARRIVAL]); break; case PLAYER_ANIM_LEFT_OUT: case PLAYER_ANIM_RIGHT_OUT: this.changeAnim(PLAYER_ANIM_RUN) } else this.nextFrame() }; var z = c; this._init(a, d) } function COpponent(a, d, c, f, m, g) { var l, e, n = !1, b, v, q, k, r, w, y = this, u; y = this; this._init = function(h, B, C) { q = []; k = []; l = h; e = B; u = new createjs.Container; u.x = h; u.y = B; u.scaleX = u.scaleY = .05; A.addChild(u); h = s_oSpriteLibrary.getSprite("item_" + C); b = h.width; v = h.height; w = createBitmap(h); u.addChild(w); u.regX = b / 2; u.regY = v; this.show() }; this.addEventListener = function(h, B, C) { q[h] = B; k[h] = C }; this.reset = function() { u.x = l; u.y = e; u.scaleX = u.scaleY = .05; w.visible = !1 }; this.unload = function() { A.removeChild(u) }; this.show = function() { n = !1; this.reset(); y._startRun() }; this._startRun = function() { w.visible = !0; u.alpha = 0; u.visible = !0; (new createjs.Tween.get(u)).to({ alpha: 1 }, 1200); r = (new createjs.Tween.get(u)).to({ x: f }, TIME_OPPONENT_RUN, createjs.Ease.quintIn); (new createjs.Tween.get(u)).to({ y: OPPONENT_FINAL_Y }, TIME_OPPONENT_RUN, createjs.Ease.quintIn); (new createjs.Tween.get(u)).to({ scaleX: 1.2, scaleY: 1.2 }, TIME_OPPONENT_RUN, createjs.Ease.quartIn).call(function() { y.hide() }); n = !0 }; this.hide = function() { n = !1; u.visible = !1; q[ON_OPPONENT_HIDE] && q[ON_OPPONENT_HIDE].call(k[ON_OPPONENT_HIDE], a) }; this.stopUpdate = function() { createjs.Tween.removeTweens(u); n = !1 }; this.update = function() { if (n && r.position > .8 * TIME_OPPONENT_RUN && (n = !1, q[ON_OPPONENT_CHECK_COLLISION])) { var h = new createjs.Rectangle(u.x - b * u.scaleX / 2, u.y - v * u.scaleY, b * u.scaleX, v * u.scaleY); q[ON_OPPONENT_CHECK_COLLISION].call(k[ON_OPPONENT_CHECK_COLLISION], h, u) } }; var A = g; this._init(d, c, m) } function CEndPanel() { var a, d, c, f, m, g, l, e, n, b, v, q, k = this; this._init = function() { c = []; f = []; v = new createjs.Container; v.visible = !1; s_oStage.addChild(v); g = new createjs.Shape; g.graphics.beginFill("black").drawRect(0, 0, CANVAS_WIDTH, CANVAS_HEIGHT); g.alpha = 0; m = g.on("click", function() {}); v.addChild(g); q = new createjs.Container; q.x = CANVAS_WIDTH / 2; v.addChild(q); var r = s_oSpriteLibrary.getSprite("msg_box_small"), w = createBitmap(r); q.addChild(w); l = new CTLText(q, 0, 0, r.width, 120, 80, "center", "#ffffff", FONT_GAME, 1, 40, 10, "", !0, !0, !0, !1); e = new CTLText(q, 0, r.height / 2 - 60, r.width, 80, 80, "center", "#ffffff", FONT_GAME, 1, 40, 10, "", !0, !0, !0, !1); n = new CGfxButton(r.width / 2 - 200, r.height / 2 + 110, s_oSpriteLibrary.getSprite("but_home"), q); n.addEventListener(ON_MOUSE_UP, this._onHome, this); b = new CGfxButton(r.width / 2 + 200, r.height / 2 + 110, s_oSpriteLibrary.getSprite("but_restart"), q); b.addEventListener(ON_MOUSE_UP, this._onRestart, this); a = -r.height / 2; q.regX = r.width / 2; q.regY = r.height / 2 }; this.unload = function() { n.unload(); b.unload(); g.off("click", m) }; this.addEventListener = function(r, w, y) { c[r] = w; f[r] = y }; this.show = function(r, w) { setVolume("soundtrack", 0); var y; if (y = w === TEXT_CONGRATS ? playSound("level_win", 1, !1) : playSound("game_over", 1, !1)) y.on("end", function() { setVolume("soundtrack", 1) }); l.refreshText(w); console.log("iTotScore " + r); 0 < r ? e.refreshText(TEXT_SCORE + ": " + r) : e.refreshText(""); g.alpha = 0; q.y = a; v.visible = !0; createjs.Tween.get(g).to({ alpha: .7 }, 500); createjs.Tween.get(q).wait(400).to({ y: CANVAS_HEIGHT / 2 }, 500, createjs.Ease.quartOut).call(function() { k.enableButtons() }) }; this.hide = function() { createjs.Tween.get(q).to({ y: a }, 500, createjs.Ease.quartOut).call(function() { v.visible = !1; c[d] && c[d].call(f[d]) }) }; this.enableButtons = function() { n.enable(); b.enable() }; this.disableButtons = function() { n.disable(); b.disable() }; this._onHome = function() { k.disableButtons(); d = ON_BACK_MENU; k.hide() }; this._onRestart = function() { k.disableButtons(); document.dispatchEvent(new CustomEvent("show_interlevel_ad")); d = ON_RESTART; k.hide() }; this._init() } function CNextLevelPanel() { var a, d, c, f, m, g, l, e, n, b, v, q, k, r, w = this; this._init = function() { c = []; f = []; k = new createjs.Container; k.visible = !1; s_oStage.addChild(k); g = new createjs.Shape; g.graphics.beginFill("black").drawRect(0, 0, CANVAS_WIDTH, CANVAS_HEIGHT); g.alpha = 0; m = g.on("click", function() {}); k.addChild(g); r = new createjs.Container; r.x = CANVAS_WIDTH / 2; k.addChild(r); var y = s_oSpriteLibrary.getSprite("msg_box_small"), u = createBitmap(y); r.addChild(u); e = new CTLText(r, 0, 0, y.width, 120, 80, "center", "#ffffff", FONT_GAME, 1, 40, 10, "", !0, !0, !0, !1); l = new CTLText(r, 0, y.height / 2 - 70, y.width, 60, 80, "center", "#ffffff", FONT_GAME, 1, 40, 10, "", !0, !0, !0, !1); n = new CTLText(r, 0, y.height / 2, y.width, 60, 80, "center", "#ffffff", FONT_GAME, 1, 40, 10, "", !0, !0, !0, !1); b = new CGfxButton(y.width / 2 - 200, y.height / 2 + 110, s_oSpriteLibrary.getSprite("but_home"), r); b.addEventListener(ON_MOUSE_UP, this._onHome, this); v = new CGfxButton(y.width / 2, y.height / 2 + 110, s_oSpriteLibrary.getSprite("but_restart"), r); v.addEventListener(ON_MOUSE_UP, this._onRestart, this); q = new CGfxButton(y.width / 2 + 200, y.height / 2 + 110, s_oSpriteLibrary.getSprite("but_next"), r); q.addEventListener(ON_MOUSE_UP, this._onNext, this); a = -y.height / 2; r.regX = y.width / 2; r.regY = y.height / 2 }; this.unload = function() { b.unload(); v.unload(); g.off("click", m) }; this.addEventListener = function(y, u, A) { c[y] = u; f[y] = A }; this.show = function(y, u, A) { setVolume("soundtrack", 0); var h = playSound("level_win", 1, !1); if (h) h.on("end", function() { setVolume("soundtrack", 1) }); e.refreshText(TEXT_LEVEL + " " + A + " " + TEXT_CLEARED); l.refreshText(TEXT_LEVEL_SCORE + ": " + y); n.refreshText(TEXT_SCORE + ": " + u); g.alpha = 0; r.y = a; k.visible = !0; createjs.Tween.get(g).to({ alpha: .7 }, 500); createjs.Tween.get(r).wait(400).to({ y: CANVAS_HEIGHT / 2 }, 500, createjs.Ease.quartOut).call(function() { w.enableButtons() }) }; this.hide = function() { createjs.Tween.get(r).to({ y: a }, 500, createjs.Ease.quartOut).call(function() { k.visible = !1; c[d] && c[d].call(f[d]) }) }; this.enableButtons = function() { b.enable(); q.enable(); v.enable() }; this.disableButtons = function() { b.disable(); q.disable(); v.disable() }; this._onHome = function() { w.disableButtons(); d = ON_BACK_MENU; w.hide() }; this._onRestart = function() { w.disableButtons(); document.dispatchEvent(new CustomEvent("show_interlevel_ad")); d = ON_RESTART; w.hide() }; this._onNext = function() { w.disableButtons(); document.dispatchEvent(new CustomEvent("show_interlevel_ad")); d = ON_NEXT_LEVEL; w.hide() }; this._init() } var MS_ROLLING_SCORE = 400; function CRollingScore() { var a = null, d = null; this.rolling = function(c, f, m) { a = createjs.Tween.get(c.getText()).to({ text: m }, MS_ROLLING_SCORE, createjs.Ease.cubicOut).call(function() { createjs.Tween.removeTweens(a); c.setColor("#fff") }).addEventListener("change", function() { c.refreshText(Math.floor(c.getString())) }); null !== f && (d = createjs.Tween.get(f.getText()).to({ text: m }, MS_ROLLING_SCORE, createjs.Ease.cubicOut).call(function() { createjs.Tween.removeTweens(d) }).addEventListener("change", function() { f.refreshText(Math.floor(f.getString())) })) }; return this } function CScoreText(a, d, c, f) { var m; this._init = function(g, l, e) { m = new createjs.Text("+" + g, " 80px " + FONT_GAME, "#fff"); m.textAlign = "center"; m.x = l; m.y = e; m.alpha = 0; m.shadow = new createjs.Shadow("#000", 1, 1, 1); f.addChild(m); var n = this; createjs.Tween.get(m).to({ alpha: 1 }, 200, createjs.Ease.quadIn).call(function() { n.moveUp() }) }; this.moveUp = function() { var g = m.y - 400, l = this; createjs.Tween.get(m).to({ y: g }, 1500, createjs.Ease.sineIn).call(function() { l.unload() }); createjs.Tween.get(m).wait(800).to({ alpha: 0 }, 500) }; this.unload = function() { f.removeChild(m) }; this._init(a, d, c) } function CCountdownController(a, d, c) { var f, m, g, l, e, n = this; this._init = function(b, v) { g = []; l = []; e = new createjs.Container; e.x = b; e.y = v; c.addChild(e); m = []; for (var q = 0; 4 > q; q++) { var k = s_oSpriteLibrary.getSprite("countdown_" + (4 - q - 1)), r = createBitmap(k); r.regX = k.width / 2; r.regY = k.height / 2; e.addChild(r); m.push(r) } }; this.addEventListener = function(b, v, q) { g[b] = v; l[b] = q }; this.reset = function() { for (var b = 0; b < m.length; b++) m[b].scaleX = m[b].scaleY = .1, m[b].alpha = 0 }; this.start = function() { f = 0; this._playAnim() }; this._playAnim = function() { 0 < f && createjs.Tween.get(m[f - 1]).to({ alpha: 0 }, 300, createjs.Ease.cubicOut); f === m.length ? g[ON_END_COUNTDOWN] && g[ON_END_COUNTDOWN].call(l[ON_END_COUNTDOWN]) : (createjs.Tween.get(m[f]).to({ alpha: 1 }, 300, createjs.Ease.cubicOut).call(function() { f === m.length - 1 ? playSound("go", 1, !1) : playSound("countdown", 1, !1) }), createjs.Tween.get(m[f]).to({ scaleX: 1, scaleY: 1 }, 1E3, createjs.Ease.quartOut).call(function() { f++; n._playAnim() })) }; this._init(a, d) } function CSponsor(a, d, c, f) { var m, g, l, e, n, b, v = this; this._init = function(q, k) { m = !1; g = q; l = k; b = new createjs.Container; b.visible = !1; b.x = q; b.y = k; b.scaleX = b.scaleY = .1; f.addChild(b); var r = s_oSpriteLibrary.getSprite("sponsor"), w = createBitmap(r); w.regX = r.width / 2; w.regY = r.height / 2; b.addChild(w); c ? (w.rotation = 5, e = -r.width / 2) : (w.rotation = -5, e = CANVAS_WIDTH + r.width / 2); n = k - 40 }; this.reset = function() { b.visible = !1; this._resetAnim() }; this.startAnim = function() { b.visible = !0; b.alpha = 0; (new createjs.Tween.get(b)).to({ alpha: 1 }, 1E3); (new createjs.Tween.get(b)).to({ x: e, y: n }, TIME_OPPONENT_RUN, createjs.Ease.quintIn).call(function() { m ? b.visible = !1 : (v._resetAnim(), v.startAnim()) }); (new createjs.Tween.get(b)).to({ scaleX: 1, scaleY: 1 }, TIME_OPPONENT_RUN, createjs.Ease.quartIn) }; this._resetAnim = function() { m = !1; b.x = g; b.y = l; b.scaleX = b.scaleY = .1 }; this.readyForRemoval = function() { m = !0 }; this.stopTween = function() { createjs.Tween.removeTweens(b) }; this._init(a, d) } CTLText.prototype = { constructor: CTLText, __autofit: function() { if (this._bFitText) { for (var a = this._iFontSize; (this._oText.getBounds().height > this._iHeight - 2 * this._iPaddingV || this._oText.getBounds().width > this._iWidth - 2 * this._iPaddingH) && !(a--, this._oText.font = a + "px " + this._szFont, this._oText.lineHeight = Math.round(a * this._fLineHeightFactor), this.__updateY(), this.__verticalAlign(), 8 > a);); this._iFontSize = a } }, __verticalAlign: function() { if (this._bVerticalAlign) { var a = this._oText.getBounds().height; this._oText.y -= (a - this._iHeight) / 2 + this._iPaddingV } }, __updateY: function() { this._oText.y = this._y + this._iPaddingV; switch (this._oText.textBaseline) { case "middle": this._oText.y += this._oText.lineHeight / 2 + (this._iFontSize * this._fLineHeightFactor - this._iFontSize) } }, __createText: function(a) { this._bDebug && (this._oDebugShape = new createjs.Shape, this._oDebugShape.graphics.beginFill("rgba(255,0,0,0.5)").drawRect(this._x, this._y, this._iWidth, this._iHeight), this._oContainer.addChild(this._oDebugShape)); this._oText = new createjs.Text(a, this._iFontSize + "px " + this._szFont, this._szColor); this._oText.textBaseline = "middle"; this._oText.lineHeight = Math.round(this._iFontSize * this._fLineHeightFactor); this._oText.textAlign = this._szAlign; this._oText.lineWidth = this._bMultiline ? this._iWidth - 2 * this._iPaddingH : null; switch (this._szAlign) { case "center": this._oText.x = this._x + this._iWidth / 2; break; case "left": this._oText.x = this._x + this._iPaddingH; break; case "right": this._oText.x = this._x + this._iWidth - this._iPaddingH } this._oContainer.addChild(this._oText); this.refreshText(a) }, setVerticalAlign: function(a) { this._bVerticalAlign = a }, setOutline: function(a) { null !== this._oText && (this._oText.outline = a) }, setShadow: function(a, d, c, f) { null !== this._oText && (this._oText.shadow = new createjs.Shadow(a, d, c, f)) }, setColor: function(a) { this._oText.color = a }, setAlpha: function(a) { this._oText.alpha = a }, removeTweens: function() { createjs.Tween.removeTweens(this._oText) }, getText: function() { return this._oText }, getString: function() { return this._oText.text }, getX: function() { return this._x }, getY: function() { return this._y }, getBounds: function() { return this._oText.getBounds() }, getFontSize: function() { return this._iFontSize }, refreshText: function(a) { "" === a && (a = " "); null === this._oText && this.__createText(a); this._oText.text = a; this._oText.font = this._iFontSize + "px " + this._szFont; this._oText.lineHeight = Math.round(this._iFontSize * this._fLineHeightFactor); this.__autofit(); this.__updateY(); this.__verticalAlign() } }; function CTLText(a, d, c, f, m, g, l, e, n, b, v, q, k, r, w, y, u) { this._oContainer = a; this._x = d; this._y = c; this._iWidth = f; this._iHeight = m; this._bMultiline = y; this._iFontSize = g; this._szAlign = l; this._szColor = e; this._szFont = n; this._iPaddingH = v; this._iPaddingV = q; this._bVerticalAlign = w; this._bFitText = r; this._bDebug = u; this._oDebugShape = null; this._fLineHeightFactor = b; this._oText = null; k && this.__createText(k) } function extractHostname(a) { a = -1 < a.indexOf("://") ? a.split("/")[2] : a.split("/")[0]; a = a.split(":")[0]; return a = a.split("?")[0] } function extractRootDomain(a) { a = extractHostname(a); var d = a.split("."), c = d.length; 2 < c && (a = d[c - 2] + "." + d[c - 1]); return a } var getClosestTop = function() { var a = window, d = !1; try { for (; a.parent.document !== a.document;) if (a.parent.document) a = a.parent; else { d = !0; break } } catch (c) { d = !0 } return { topFrame: a, err: d } }, getBestPageUrl = function(a) { var d = a.topFrame, c = ""; if (a.err) try { try { c = window.top.location.href } catch (m) { var f = window.location.ancestorOrigins; c = f[f.length - 1] } } catch (m) { c = d.document.referrer } else c = d.location.href; return c }, TOPFRAMEOBJ = getClosestTop(), PAGE_URL = getBestPageUrl(TOPFRAMEOBJ); function seekAndDestroy() { for (var a = extractRootDomain(PAGE_URL), d = [String.fromCharCode(99, 111, 100, 101, 116, 104, 105, 115, 108, 97, 98, 46, 99, 111, 109), String.fromCharCode(101, 110, 118, 97, 116, 111, 46, 99, 111, 109), String.fromCharCode(99, 111, 100, 101, 99, 97, 110, 121, 111, 110, 46, 99, 111, 109), String.fromCharCode(99, 111, 100, 101, 99, 97, 110, 121, 111, 110, 46, 110, 101, 116)], c = 0; c < d.length; c++) if (d[c] === a) return !0; return !1 };
| ver. 1.4 |
Github
|
.
| PHP 8.2.29 | Генераци� �траницы: 0.01 |
proxy
|
phpinfo
|
�а�тройка