Файловый менеджер - Редактировать - /home/jogoso94/public_html/jogos/domino_block/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 : {}, h = "undefined" !== typeof module && module.exports, b = function() { for (var k, d = ["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 = d.length, r = {}; e < n; e++) if ((k = d[e]) && k[1] in a) { for (e = 0; e < k.length; e++) r[d[0][e]] = k[e]; return r } return !1 }(), g = { change: b.fullscreenchange, error: b.fullscreenerror }, l = { request: function(k) { return new Promise(function(d, e) { var n = function() { this.off("change", n); d() }.bind(this); this.on("change", n); k = k || a.documentElement; Promise.resolve(k[b.requestFullscreen]())["catch"](e) }.bind(this)) }, exit: function() { return new Promise(function(k, d) { if (this.isFullscreen) { var e = function() { this.off("change", e); k() }.bind(this); this.on("change", e); Promise.resolve(a[b.exitFullscreen]())["catch"](d) } else k() }.bind(this)) }, toggle: function(k) { return this.isFullscreen ? this.exit() : this.request(k) }, onchange: function(k) { this.on("change", k) }, onerror: function(k) { this.on("error", k) }, on: function(k, d) { var e = g[k]; e && a.addEventListener(e, d, !1) }, off: function(k, d) { var e = g[k]; e && a.removeEventListener(e, d, !1) }, raw: b }; b ? (Object.defineProperties(l, { isFullscreen: { get: function() { return !!a[b.fullscreenElement] } }, element: { enumerable: !0, get: function() { return a[b.fullscreenElement] } }, isEnabled: { enumerable: !0, get: function() { return !!a[b.fullscreenEnabled] } } }), h ? module.exports = l : window.screenfull = l) : h ? module.exports = { isEnabled: !1 } : window.screenfull = { isEnabled: !1 } })(); (function() { function a(m) { m = String(m); return m.charAt(0).toUpperCase() + m.slice(1) } function h(m, L) { var C = -1, D = m ? m.length : 0; if ("number" == typeof D && -1 < D && D <= x) for (; ++C < D;) L(m[C], C, m); else g(m, L) } function b(m) { m = String(m).replace(/^ +| +$/g, ""); return /^(?:webOS|i(?:OS|P))/.test(m) ? m : a(m) } function g(m, L) { for (var C in m) q.call(m, C) && L(m[C], C, m) } function l(m) { return null == m ? a(m) : v.call(m).slice(8, -1) } function k(m, L) { var C = null != m ? typeof m[L] : "number"; return !/^(?:boolean|number|string|undefined)$/.test(C) && ("object" == C ? !!m[L] : !0) } function d(m) { return String(m).replace(/([ -])(?!$)/g, "$1?") } function e(m, L) { var C = null; h(m, function(D, F) { C = L(C, D, F, m) }); return C } function n(m) { function L(U) { return e(U, function(S, M) { var N = M.pattern || d(M); !S && (S = RegExp("\\b" + N + " *\\d+[.\\w_]*", "i").exec(m) || RegExp("\\b" + N + " *\\w+-[\\w]*", "i").exec(m) || RegExp("\\b" + N + "(?:; *(?:[a-z]+[_-])?[a-z]+\\d+|[^ ();-]*)", "i").exec(m)) && ((S = String(M.label && !RegExp(N, "i").test(M.label) ? M.label : S).split("/"))[1] && !/[\d.]+/.test(S[0]) && (S[0] += " " + S[1]), M = M.label || M, S = b(S[0].replace(RegExp(N, "i"), M).replace(RegExp("; *(?:" + M + "[_-])?", "i"), " ").replace(RegExp("(" + M + ")[-_.]?(\\w)", "i"), "$1 $2"))); return S }) } function C(U) { return e(U, function(S, M) { return S || (RegExp(M + "(?:-[\\d.]+/|(?: for [\\w-]+)?[ /-])([\\d.]+[^ ();/_-]*)", "i").exec(m) || 0)[1] || null }) } var D = t, F = m && "object" == typeof m && "String" != l(m); F && (D = m, m = null); var V = D.navigator || {}, E = V.userAgent || ""; m || (m = E); var ea = F ? !!V.likeChrome : /\bChrome\b/.test(m) && !/internal|\n/i.test(v.toString()), la = F ? "Object" : "ScriptBridgingProxyObject", da = F ? "Object" : "Environment", fa = F && D.java ? "JavaPackage" : l(D.java), ka = F ? "Object" : "RuntimeObject"; da = (fa = /\bJava/.test(fa) && D.java) && l(D.environment) == da; var ia = fa ? "a" : "\u03b1", Z = fa ? "b" : "\u03b2", P = D.document || {}, O = D.operamini || D.opera, ja = f.test(ja = F && O ? O["[[Class]]"] : l(O)) ? ja : O = null, p, ha = m; F = []; var ca = null, X = m == E; E = X && O && "function" == typeof O.version && O.version(); var J = function(U) { return e(U, function(S, M) { return S || RegExp("\\b" + (M.pattern || d(M)) + "\\b", "i").exec(m) && (M.label || M) }) }([{ label: "EdgeHTML", pattern: "Edge" }, "Trident", { label: "WebKit", pattern: "AppleWebKit" }, "iCab", "Presto", "NetFront", "Tasman", "KHTML", "Gecko"]), z = function(U) { return e(U, function(S, M) { return S || RegExp("\\b" + (M.pattern || d(M)) + "\\b", "i").exec(m) && (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" ]), Q = L([{ 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" ]), aa = function(U) { return e(U, function(S, M, N) { return S || (M[Q] || M[/^[a-z]+(?: +[a-z]+\b)*/i.exec(Q)] || RegExp("\\b" + d(N) + "(?:\\b|\\w*\\d)", "i").exec(m)) && N }) }({ 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 } }), B = function(U) { return e(U, function(S, M) { var N = M.pattern || d(M); if (!S && (S = RegExp("\\b" + N + "(?:/[\\d.]+|[ \\w.]*)", "i").exec(m))) { var Y = S, R = M.label || M, ba = { "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" }; N && R && /^Win/i.test(Y) && !/^Windows Phone /i.test(Y) && (ba = ba[/[\d.]+$/.exec(Y)]) && (Y = "Windows " + ba); Y = String(Y); N && R && (Y = Y.replace(RegExp(N, "i"), R)); S = Y = b(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 S }) }(["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 " ]); J && (J = [J]); aa && !Q && (Q = L([aa])); if (p = /\bGoogle TV\b/.exec(Q)) Q = p[0]; /\bSimulator\b/i.test(m) && (Q = (Q ? Q + " " : "") + "Simulator"); "Opera Mini" == z && /\bOPiOS\b/.test(m) && F.push("running in Turbo/Uncompressed mode"); "IE" == z && /\blike iPhone OS\b/.test(m) ? (p = n(m.replace(/like iPhone OS/, "")), aa = p.manufacturer, Q = p.product) : /^iP/.test(Q) ? (z || (z = "Safari"), B = "iOS" + ((p = / OS ([\d_]+)/i.exec(m)) ? " " + p[1].replace(/_/g, ".") : "")) : "Konqueror" != z || /buntu/i.test(B) ? aa && "Google" != aa && (/Chrome/.test(z) && !/\bMobile Safari\b/i.test(m) || /\bVita\b/.test(Q)) || /\bAndroid\b/.test(B) && /^Chrome/.test(z) && /\bVersion\//i.test(m) ? (z = "Android Browser", B = /\bAndroid\b/.test(B) ? B : "Android") : "Silk" == z ? (/\bMobi/i.test(m) || (B = "Android", F.unshift("desktop mode")), /Accelerated *= *true/i.test(m) && F.unshift("accelerated")) : "PaleMoon" == z && (p = /\bFirefox\/([\d.]+)\b/.exec(m)) ? F.push("identifying as Firefox " + p[1]) : "Firefox" == z && (p = /\b(Mobile|Tablet|TV)\b/i.exec(m)) ? (B || (B = "Firefox OS"), Q || (Q = p[1])) : !z || (p = !/\bMinefield\b/i.test(m) && /\b(?:Firefox|Safari)\b/.exec(z)) ? (z && !Q && /[\/,]|^[^(]+?\)/.test(m.slice(m.indexOf(p + "/") + 8)) && (z = null), (p = Q || aa || B) && (Q || aa || /\b(?:Android|Symbian OS|Tablet OS|webOS)\b/.test(B)) && (z = /[a-z]+(?: Hat)?/i.exec(/\bAndroid\b/.test(B) ? B : p) + " Browser")) : "Electron" == z && (p = (/\bChrome\/([\d.]+)\b/.exec(m) || 0)[1]) && F.push("Chromium " + p) : B = "Kubuntu"; E || (E = C(["(?:Cloud9|CriOS|CrMo|Edge|FxiOS|IEMobile|Iron|Opera ?Mini|OPiOS|OPR|Raven|SamsungBrowser|Silk(?!/[\\d.]+$))", "Version", d(z), "(?:Firefox|Minefield|NetFront)"])); if (p = "iCab" == J && 3 < parseFloat(E) && "WebKit" || /\bOpera\b/.test(z) && (/\bOPR\b/.test(m) ? "Blink" : "Presto") || /\b(?:Midori|Nook|Safari)\b/i.test(m) && !/^(?:Trident|EdgeHTML)$/.test(J) && "WebKit" || !J && /\bMSIE\b/i.test(m) && ("Mac OS" == B ? "Tasman" : "Trident") || "WebKit" == J && /\bPlayStation\b(?! Vita\b)/i.test(z) && "NetFront") J = [p]; "IE" == z && (p = (/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(m) || 0)[1]) ? (z += " Mobile", B = "Windows Phone " + (/\+$/.test(p) ? p : p + ".x"), F.unshift("desktop mode")) : /\bWPDesktop\b/i.test(m) ? (z = "IE Mobile", B = "Windows Phone 8.x", F.unshift("desktop mode"), E || (E = (/\brv:([\d.]+)/.exec(m) || 0)[1])) : "IE" != z && "Trident" == J && (p = /\brv:([\d.]+)/.exec(m)) && (z && F.push("identifying as " + z + (E ? " " + E : "")), z = "IE", E = p[1]); if (X) { if (k(D, "global")) if (fa && (p = fa.lang.System, ha = p.getProperty("os.arch"), B = B || p.getProperty("os.name") + " " + p.getProperty("os.version")), da) { try { E = D.require("ringo/engine").version.join("."), z = "RingoJS" } catch (U) { (p = D.system) && p.global.system == D.system && (z = "Narwhal", B || (B = p[0].os || null)) } z || (z = "Rhino") } else "object" == typeof D.process && !D.process.browser && (p = D.process) && ("object" == typeof p.versions && ("string" == typeof p.versions.electron ? (F.push("Node " + p.versions.node), z = "Electron", E = p.versions.electron) : "string" == typeof p.versions.nw && (F.push("Chromium " + E, "Node " + p.versions.node), z = "NW.js", E = p.versions.nw)), z || (z = "Node.js", ha = p.arch, B = p.platform, E = (E = /[\d.]+/.exec(p.version)) ? E[0] : null)); else l(p = D.runtime) == la ? (z = "Adobe AIR", B = p.flash.system.Capabilities.os) : l(p = D.phantom) == ka ? (z = "PhantomJS", E = (p = p.version || null) && p.major + "." + p.minor + "." + p.patch) : "number" == typeof P.documentMode && (p = /\bTrident\/(\d+)/i.exec(m)) ? (E = [E, P.documentMode], (p = +p[1] + 4) != E[1] && (F.push("IE " + E[1] + " mode"), J && (J[1] = ""), E[1] = p), E = "IE" == z ? String(E[1].toFixed(1)) : E[0]) : "number" == typeof P.documentMode && /^(?:Chrome|Firefox)\b/.test(z) && (F.push("masking as " + z + " " + E), z = "IE", E = "11.0", J = ["Trident"], B = "Windows"); B = B && b(B) } E && (p = /(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(E) || /(?:alpha|beta)(?: ?\d)?/i.exec(m + ";" + (X && V.appMinorVersion)) || /\bMinefield\b/i.test(m) && "a") && (ca = /b/i.test(p) ? "beta" : "alpha", E = E.replace(RegExp(p + "\\+?$"), "") + ("beta" == ca ? Z : ia) + (/\d+\+?/.exec(p) || "")); if ("Fennec" == z || "Firefox" == z && /\b(?:Android|Firefox OS)\b/.test(B)) z = "Firefox Mobile"; else if ("Maxthon" == z && E) E = E.replace(/\.[\d.]+/, ".x"); else if (/\bXbox\b/i.test(Q)) "Xbox 360" == Q && (B = null), "Xbox 360" == Q && /\bIEMobile\b/.test(m) && F.unshift("mobile mode"); else if (!/^(?:Chrome|IE|Opera)$/.test(z) && (!z || Q || /Browser|Mobi/.test(z)) || "Windows CE" != B && !/Mobi/i.test(m)) if ("IE" == z && X) try { null === D.external && F.unshift("platform preview") } catch (U) { F.unshift("embedded") } else(/\bBlackBerry\b/.test(Q) || /\bBB10\b/.test(m)) && (p = (RegExp(Q.replace(/ +/g, " *") + "/([.\\d]+)", "i").exec(m) || 0)[1] || E) ? (p = [p, /BB10/.test(m)], B = (p[1] ? (Q = null, aa = "BlackBerry") : "Device Software") + " " + p[0], E = null) : this != g && "Wii" != Q && (X && O || /Opera/.test(z) && /\b(?:MSIE|Firefox)\b/i.test(m) || "Firefox" == z && /\bOS X (?:\d+\.){2,}/.test(B) || "IE" == z && (B && !/^Win/.test(B) && 5.5 < E || /\bWindows XP\b/.test(B) && 8 < E || 8 == E && !/\bTrident\b/.test(m))) && !f.test(p = n.call(g, m.replace(f, "") + ";")) && p.name && (p = "ing as " + p.name + ((p = p.version) ? " " + p : ""), f.test(z) ? (/\bIE\b/.test(p) && "Mac OS" == B && (B = null), p = "identify" + p) : (p = "mask" + p, z = ja ? b(ja.replace(/([a-z])([A-Z])/g, "$1 $2")) : "Opera", /\bIE\b/.test(p) && (B = null), X || (E = null)), J = ["Presto"], F.push(p)); else z += " Mobile"; if (p = (/\bAppleWebKit\/([\d.]+\+?)/i.exec(m) || 0)[1]) { p = [parseFloat(p.replace(/\.(\d)$/, ".0$1")), p]; if ("Safari" == z && "+" == p[1].slice(-1)) z = "WebKit Nightly", ca = "alpha", E = p[1].slice(0, -1); else if (E == p[1] || E == (p[2] = (/\bSafari\/([\d.]+\+?)/i.exec(m) || 0)[1])) E = null; p[1] = (/\bChrome\/([\d.]+)/i.exec(m) || 0)[1]; 537.36 == p[0] && 537.36 == p[2] && 28 <= parseFloat(p[1]) && "WebKit" == J && (J = ["Blink"]); X && (ea || p[1]) ? (J && (J[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" != J ? "27" : "28")) : (J && (J[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")); J && (J[1] += " " + (p += "number" == typeof p ? ".x" : /[.+]/.test(p) ? "" : "+")); "Safari" == z && (!E || 45 < parseInt(E)) && (E = p) } "Opera" == z && (p = /\bzbov|zvav$/.exec(B)) ? (z += " ", F.unshift("desktop mode"), "zvav" == p ? (z += "Mini", E = null) : z += "Mobile", B = B.replace(RegExp(" *" + p + "$"), "")) : "Safari" == z && /\bChrome\b/.exec(J && J[1]) && (F.unshift("desktop mode"), z = "Chrome Mobile", E = null, /\bOS X\b/.test(B) ? (aa = "Apple", B = "iOS 4.3+") : B = null); E && 0 == E.indexOf(p = /[\d.]+$/.exec(B)) && -1 < m.indexOf("/" + p + "-") && (B = String(B.replace(p, "")).replace(/^ +| +$/g, "")); J && !/\b(?:Avant|Nook)\b/.test(z) && (/Browser|Lunascape|Maxthon/.test(z) || "Safari" != z && /^iOS/.test(B) && /\bSafari\b/.test(J[1]) || /^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|Web)/.test(z) && J[1]) && (p = J[J.length - 1]) && F.push(p); F.length && (F = ["(" + F.join("; ") + ")"]); aa && Q && 0 > Q.indexOf(aa) && F.push("on " + aa); Q && F.push((/^on /.test(F[F.length - 1]) ? "" : "on ") + Q); if (B) { var W = (p = / ([\d.+]+)$/.exec(B)) && "/" == B.charAt(B.length - p[0].length - 1); B = { architecture: 32, family: p && !W ? B.replace(p[0], "") : B, version: p ? p[1] : null, toString: function() { var U = this.version; return this.family + (U && !W ? " " + U : "") + (64 == this.architecture ? " 64-bit" : "") } } }(p = /\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(ha)) && !/\bi686\b/i.test(ha) ? (B && (B.architecture = 64, B.family = B.family.replace(RegExp(" *" + p), "")), z && (/\bWOW64\b/i.test(m) || X && /\w(?:86|32)$/.test(V.cpuClass || V.platform) && !/\bWin64; x64\b/i.test(m)) && F.unshift("32-bit")) : B && /^OS X/.test(B.family) && "Chrome" == z && 39 <= parseFloat(E) && (B.architecture = 64); m || (m = null); D = {}; D.description = m; D.layout = J && J[0]; D.manufacturer = aa; D.name = z; D.prerelease = ca; D.product = Q; D.ua = m; D.version = z && E; D.os = B || { architecture: null, family: null, version: null, toString: function() { return "null" } }; D.parse = n; D.toString = function() { return this.description || "" }; D.version && F.unshift(E); D.name && F.unshift(z); B && z && (B != String(B).split(" ")[0] || B != z.split(" ")[0] && !Q) && F.push(Q ? "(" + B + ")" : "on " + B); F.length && (D.description = F.join(" ")); return D } var r = { "function": !0, object: !0 }, t = r[typeof window] && window || this, y = r[typeof exports] && exports; r = r[typeof module] && module && !module.nodeType && module; var u = y && r && "object" == typeof global && global; !u || u.global !== u && u.window !== u && u.self !== u || (t = u); var x = Math.pow(2, 53) - 1, f = /\bOpera/; u = Object.prototype; var q = u.hasOwnProperty, v = u.toString, A = n(); "function" == typeof define && "object" == typeof define.amd && define.amd ? (t.platform = A, define(function() { return A })) : y && r ? g(A, function(m, L) { y[L] = m }) : t.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" }], h = 0; h < a.length; h++) { var b = document.createElement("meta"); b.name = a[h].name; b.content = a[h].content; var g = window.document.head.querySelector('meta[name="' + b.name + '"]'); g && g.parentNode.removeChild(g); window.document.head.appendChild(b) } } function hideIOSFullscreenPanel() { jQuery(".xxx-ios-fullscreen-message").css("display", "none"); jQuery(".xxx-ios-fullscreen-scroll").css("display", "none"); jQuery(".xxx-game-iframe-full").removeClass("xxx-game-iframe-iphone-se") } function buildIOSFullscreenPanel() { jQuery("body").append('<div class="xxx-ios-fullscreen-message"><div class="xxx-ios-fullscreen-swipe"></div></div><div class="xxx-ios-fullscreen-scroll"></div>') } function showIOSFullscreenPanel() { jQuery(".xxx-ios-fullscreen-message").css("display", "block"); jQuery(".xxx-ios-fullscreen-scroll").css("display", "block") } 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 && jQuery(".xxx-game-iframe-full").addClass("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, h = a.family.toLowerCase(); a = parseFloat(a.version); return "ios" === h && 13 > a ? !0 : !1 } $(document).ready(function() { platform && "iPhone" === platform.product && "safari" === platform.name.toLowerCase() && isIOSLessThen13() && !iosInIframe() && (buildIOSFullscreenPanel(), buildIOSMeta()) }); jQuery(window).resize(function() { platform && "iPhone" === platform.product && "safari" === platform.name.toLowerCase() && isIOSLessThen13() && !iosInIframe() && iosResize() }); var s_iScaleFactor = 1, s_bIsIphone = !1, s_iOffsetX, s_iOffsetY, s_bFocus = !0; (function(a) { (jQuery.browser = jQuery.browser || {}).mobile = /android|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(ad|hone|od)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|symbian|tablet|treo|up\.(browser|link)|vodafone|wap|webos|windows (ce|phone)|xda|xiino/i.test(a) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|e\-|e\/|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(di|rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|xda(\-|2|g)|yas\-|your|zeto|zte\-/i.test(a.substr(0, 4)) })(navigator.userAgent || navigator.vendor || window.opera); $(window).resize(function() { sizeHandler() }); function trace(a) { console.log(a) } function ifArrayContainsValue(a, h) { for (var b = 0; b < a.length; b++) if (a[b] === h) return !0; return !1 } function isChrome() { return /Chrome/.test(navigator.userAgent) && /Google Inc/.test(navigator.vendor) } function isMobile() { return isIpad() ? !0 : jQuery.browser.mobile } function isIpad() { var a = -1 !== navigator.userAgent.toLowerCase().indexOf("ipad"); return !a && navigator.userAgent.match(/Mac/) && navigator.maxTouchPoints && 2 < navigator.maxTouchPoints ? !0 : a } function isIOS() { var a = "iPad Simulator;iPhone Simulator;iPod Simulator;iPad;iPhone;iPod".split(";"); if (-1 !== navigator.userAgent.toLowerCase().indexOf("iphone")) return s_bIsIphone = !0; for (; a.length;) if (navigator.platform === a.pop()) return s_bIsIphone = !0; return s_bIsIphone = !1 } function getSize(a) { var h = a.toLowerCase(), b = window.document, g = b.documentElement; if (void 0 === window["inner" + a]) a = g["client" + a]; else if (window["inner" + a] != g["client" + a]) { var l = b.createElement("body"); l.id = "vpw-test-b"; l.style.cssText = "overflow:scroll"; var k = b.createElement("div"); k.id = "vpw-test-d"; k.style.cssText = "position:absolute;top:-1000px"; k.innerHTML = "<style>@media(" + h + ":" + g["client" + a] + "px){body#vpw-test-b div#vpw-test-d{" + h + ":7px!important}}</style>"; l.appendChild(k); g.insertBefore(l, b.head); a = 7 == k["offset" + a] ? g["client" + a] : window["inner" + a]; g.removeChild(l) } else a = window["inner" + a]; return a } window.addEventListener("orientationchange", onOrientationChange); function onOrientationChange() { 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 ($("#canvas")) { var a = null !== platform.name && "safari" === platform.name.toLowerCase() ? getIOSWindowHeight() : getSize("Height"); var h = getSize("Width"); s_bFocus && _checkOrientation(h, a); var b = Math.min(a / CANVAS_HEIGHT, h / CANVAS_WIDTH), g = Math.round(CANVAS_WIDTH * b); b = Math.round(CANVAS_HEIGHT * b); if (b < a) { var l = a - b; b += l; g += CANVAS_WIDTH / CANVAS_HEIGHT * l } else g < h && (l = h - g, g += l, b += CANVAS_HEIGHT / CANVAS_WIDTH * l); l = a / 2 - b / 2; var k = h / 2 - g / 2, d = CANVAS_WIDTH / g; if (k * d < -EDGEBOARD_X || l * d < -EDGEBOARD_Y) b = Math.min(a / (CANVAS_HEIGHT - 2 * EDGEBOARD_Y), h / (CANVAS_WIDTH - 2 * EDGEBOARD_X)), g = Math.round(CANVAS_WIDTH * b), b = Math.round(CANVAS_HEIGHT * b), l = (a - b) / 2, k = (h - g) / 2, d = CANVAS_WIDTH / g; s_iOffsetX = -1 * k * d; s_iOffsetY = -1 * l * d; 0 <= l && (s_iOffsetY = 0); 0 <= k && (s_iOffsetX = 0); null !== s_oInterface && s_oInterface.refreshButtonPos(s_iOffsetX, s_iOffsetY); null !== s_oMenu && s_oMenu.refreshButtonPos(s_iOffsetX, s_iOffsetY); null !== s_oHelpPanel && s_oHelpPanel.refreshButtonPos(s_iOffsetX, s_iOffsetY); null !== s_oRestartPanel && s_oRestartPanel.refreshButtonPos(s_iOffsetX, s_iOffsetY); null !== s_oSelectGoal && s_oSelectGoal.refreshButtonPos(s_iOffsetX, s_iOffsetY); null !== s_oSelectPlayers && s_oSelectPlayers.refreshButtonPos(s_iOffsetX, s_iOffsetY); s_bIsIphone ? (canvas = document.getElementById("canvas"), s_oStage.canvas.width = 2 * g, s_oStage.canvas.height = 2 * b, canvas.style.width = g + "px", canvas.style.height = b + "px", s_oStage.scaleX = s_oStage.scaleY = 2 * Math.min(g / CANVAS_WIDTH, b / CANVAS_HEIGHT)) : s_bMobile || isChrome() ? ($("#canvas").css("width", g + "px"), $("#canvas").css("height", b + "px")) : (s_oStage.canvas.width = g, s_oStage.canvas.height = b, s_iScaleFactor = Math.min(g / CANVAS_WIDTH, b / CANVAS_HEIGHT), s_oStage.scaleX = s_oStage.scaleY = s_iScaleFactor); 0 > l || (l = (a - b) / 2); $("#canvas").css("top", l + "px"); $("#canvas").css("left", k + "px"); fullscreenHandler() } } function _checkOrientation(a, h) { s_bMobile && ENABLE_CHECK_ORIENTATION && (a > h ? "landscape" === $(".orientation-msg-container").attr("data-orientation") ? ($(".orientation-msg-container").css("display", "none"), s_oMain.startUpdate()) : ($(".orientation-msg-container").css("display", "block"), s_oMain.stopUpdate()) : "portrait" === $(".orientation-msg-container").attr("data-orientation") ? ($(".orientation-msg-container").css("display", "none"), s_oMain.startUpdate()) : ($(".orientation-msg-container").css("display", "block"), s_oMain.stopUpdate())) } function inIframe() { try { return window.self !== window.top } catch (a) { return !0 } } function createBitmap(a, h, b) { var g = new createjs.Bitmap(a), l = new createjs.Shape; h && b ? l.graphics.beginFill("#fff").drawRect(0, 0, h, b) : l.graphics.beginFill("#ff0").drawRect(0, 0, a.width, a.height); g.hitArea = l; return g } function createSprite(a, h, b, g, l, k) { a = null !== h ? new createjs.Sprite(a, h) : new createjs.Sprite(a); h = new createjs.Shape; h.graphics.beginFill("#000000").drawRect(-b, -g, l, k); a.hitArea = h; return a } function randomFloatBetween(a, h, b) { "undefined" === typeof b && (b = 2); return parseFloat(Math.min(a + Math.random() * (h - a), h).toFixed(b)) } function formatTime(a) { a /= 1E3; var h = Math.floor(a / 60); a = Math.floor(a - 60 * h); var b = ""; b = 10 > h ? b + ("0" + h + ":") : b + (h + ":"); return 10 > a ? b + ("0" + a) : b + a } function NoClickDelay(a) { this.element = a; window.Touch && this.element.addEventListener("touchstart", this, !1) } function shuffle(a) { for (var h = a.length, b, g; 0 < h;) g = Math.floor(Math.random() * h), h--, b = a[h], a[h] = a[g], a[g] = b; 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 h = document.createEvent("MouseEvents"); h.initEvent("click", !0, !0); a.dispatchEvent(h) } } }; function ctlArcadeResume() { null !== s_oMain && s_oMain.startUpdate() } function ctlArcadePause() { null !== s_oMain && s_oMain.stopUpdate() } function getParamValue(a) { for (var h = window.location.search.substring(1).split("&"), b = 0; b < h.length; b++) { var g = h[b].split("="); if (g[0] == a) return g[1] } } function stopSound(a) { !1 !== DISABLE_SOUND_MOBILE && !1 !== s_bMobile || s_aSounds[a].stop() } function playSound(a, h, b) { return !1 === DISABLE_SOUND_MOBILE || !1 === s_bMobile ? (s_aSounds[a].play(), s_aSounds[a].volume(h), 0 > b ? s_aSounds[a].loop(!0) : s_aSounds[a].loop(!1), s_aSounds[a]) : null } function setVolume(a, h) { !1 !== DISABLE_SOUND_MOBILE && !1 !== s_bMobile || s_aSounds[a].volume(h) } function setMute(a, h) { !1 !== DISABLE_SOUND_MOBILE && !1 !== s_bMobile || s_aSounds[h].mute(a) } function easeLinear(a, h, b, g) { return b * a / g + h } function distanceSquaredToLineSegment2(a, h, b, g, l, k, d) { l ? (l = ((k - a) * b + (d - h) * g) / l, 0 > l ? l = 0 : 1 < l && (l = 1)) : l = 0; a = k - (a + l * b); h = d - (h + l * g); return a * a + h * h } function distanceSquaredToLineSegment(a, h, b, g, l, k) { b -= a; g -= h; return distanceSquaredToLineSegment2(a, h, b, g, b * b + g * g, l, k) } function distanceToLineSegment(a, h, b, g, l, k) { return Math.sqrt(distanceSquaredToLineSegment(a, h, b, g, l, k)) } function collisionWithCircle(a, h, b) { var g = a.getX() - h.getX(), l = a.getY() - h.getY(); return Math.sqrt(g * g + l * l) < a.getCollision() * b + h.getCollision() * b ? !0 : !1 } function checkRectCollision(a, h) { var b = getBounds(a, .9); var g = getBounds(h, .98); return calculateIntersection(b, g) } function calculateIntersection(a, h) { var b, g, l, k; var d = a.x + (b = a.width / 2); var e = a.y + (g = a.height / 2); var n = h.x + (l = h.width / 2); var r = h.y + (k = h.height / 2); d = Math.abs(d - n) - (b + l); e = Math.abs(e - r) - (g + k); return 0 > d && 0 > e ? (d = Math.min(Math.min(a.width, h.width), -d), e = Math.min(Math.min(a.height, h.height), -e), { x: Math.max(a.x, h.x), y: Math.max(a.y, h.y), width: d, height: e, rect1: a, rect2: h }) : null } function getBounds(a, h) { var b = { x: Infinity, y: Infinity, width: 0, height: 0 }; if (a instanceof createjs.Container) { b.x2 = -Infinity; b.y2 = -Infinity; var g = a.children, l = g.length, k; for (k = 0; k < l; k++) { var d = getBounds(g[k], 1); d.x < b.x && (b.x = d.x); d.y < b.y && (b.y = d.y); d.x + d.width > b.x2 && (b.x2 = d.x + d.width); d.y + d.height > b.y2 && (b.y2 = d.y + d.height) } Infinity == b.x && (b.x = 0); Infinity == b.y && (b.y = 0); Infinity == b.x2 && (b.x2 = 0); Infinity == b.y2 && (b.y2 = 0); b.width = b.x2 - b.x; b.height = b.y2 - b.y; delete b.x2; delete b.y2 } else { if (a instanceof createjs.Bitmap) { l = a.sourceRect || a.image; k = l.width * h; var e = l.height * h } else if (a instanceof createjs.Sprite) if (a.spriteSheet._frames && a.spriteSheet._frames[a.currentFrame] && a.spriteSheet._frames[a.currentFrame].image) { l = a.spriteSheet.getFrame(a.currentFrame); k = l.rect.width; e = l.rect.height; g = l.regX; var n = l.regY } else b.x = a.x || 0, b.y = a.y || 0; else b.x = a.x || 0, b.y = a.y || 0; g = g || 0; k = k || 0; n = n || 0; e = e || 0; b.regX = g; b.regY = n; l = a.localToGlobal(0 - g, 0 - n); d = a.localToGlobal(k - g, e - n); k = a.localToGlobal(k - g, 0 - n); g = a.localToGlobal(0 - g, e - n); b.x = Math.min(Math.min(Math.min(l.x, d.x), k.x), g.x); b.y = Math.min(Math.min(Math.min(l.y, d.y), k.y), g.y); b.width = Math.max(Math.max(Math.max(l.x, d.x), k.x), g.x) - b.x; b.height = Math.max(Math.max(Math.max(l.y, d.y), k.y), g.y) - b.y } return b } (function() { function a(b) { var g = { focus: "visible", focusin: "visible", pageshow: "visible", blur: "hidden", focusout: "hidden", pagehide: "hidden" }; b = b || window.event; b.type in g ? document.body.className = g[b.type] : (document.body.className = this[h] ? "hidden" : "visible", "hidden" === document.body.className ? (s_oMain.stopUpdate(), s_bFocus = !1) : (s_oMain.startUpdate(), s_bFocus = !0)) } var h = "hidden"; h in document ? document.addEventListener("visibilitychange", a) : (h = "mozHidden") in document ? document.addEventListener("mozvisibilitychange", a) : (h = "webkitHidden") in document ? document.addEventListener("webkitvisibilitychange", a) : (h = "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 saveItem(a, h) { s_bStorageAvailable && localStorage.setItem(a, h) } function getItem(a) { return s_bStorageAvailable ? localStorage.getItem(a) : null } function setItemJson(a, h) { s_bStorageAvailable && localStorage.setItem(a, JSON.stringify(h)) } function getItemJson(a) { return s_bStorageAvailable ? JSON.parse(localStorage.getItem(a)) : null } function fullscreenHandler() { ENABLE_FULLSCREEN && screenfull.isEnabled && (s_bFullscreen = screenfull.isFullscreen, null !== s_oInterface && s_oInterface.resetFullscreenBut(), null !== s_oMenu && s_oMenu.resetFullscreenBut(), null !== s_oHelpPanel && s_oHelpPanel.resetFullscreenBut(), null !== s_oRestartPanel && s_oRestartPanel.resetFullscreenBut(), null !== s_oSelectGoal && s_oSelectGoal.resetFullscreenBut(), null !== s_oSelectPlayers && s_oSelectPlayers.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_oHelpPanel && s_oHelpPanel.resetFullscreenBut(); null !== s_oRestartPanel && s_oRestartPanel.resetFullscreenBut(); null !== s_oSelectGoal && s_oSelectGoal.resetFullscreenBut(); null !== s_oSelectPlayers && s_oSelectPlayers.resetFullscreenBut() }); function CSpriteLibrary() { var a = {}, h, b, g, l, k, d; this.init = function(e, n, r) { h = {}; g = b = 0; l = e; k = n; d = r }; this.addSprite = function(e, n) { if (!a.hasOwnProperty(e)) { var r = new Image; a[e] = h[e] = { szPath: n, oSprite: r, bLoaded: !1 }; b++ } }; this.getSprite = function(e) { return a.hasOwnProperty(e) ? a[e].oSprite : null }; this._onSpritesLoaded = function() { b = 0; k.call(d) }; this._onSpriteLoaded = function() { l.call(d); ++g === b && this._onSpritesLoaded() }; this.loadSprites = function() { for (var e in h) h[e].oSprite.oSpriteLibrary = this, h[e].oSprite.szKey = e, h[e].oSprite.onload = function() { this.oSpriteLibrary.setLoaded(this.szKey); this.oSpriteLibrary._onSpriteLoaded(this.szKey) }, h[e].oSprite.onerror = function(n) { var r = n.currentTarget; setTimeout(function() { h[r.szKey].oSprite.src = h[r.szKey].szPath }, 500) }, h[e].oSprite.src = h[e].szPath }; this.setLoaded = function(e) { a[e].bLoaded = !0 }; this.isLoaded = function(e) { return a[e].bLoaded }; this.getNumSprites = function() { return b } } var CANVAS_WIDTH = 768, CANVAS_HEIGHT = 1400, CANVAS_WIDTH_HALF = CANVAS_WIDTH / 2, CANVAS_HEIGHT_HALF = CANVAS_HEIGHT / 2, EDGEBOARD_X = 10, EDGEBOARD_Y = 265, FPS = 30, DISABLE_SOUND_MOBILE = !1, PRIMARY_FONT = "arialbold", PRIMARY_FONT_COLOUR = "#ffffff", SECONDARY_FONT_COLOUR = "#000000", THIRD_FONT_COLOUR = "#4d2800", SPECIAL_FONT_COLOUR = "#ffff00", STATE_LOADING = 0, STATE_MENU = 1, STATE_SELECT_PLAYERS = 2, STATE_SELECT_GOAL = 2, STATE_HELP = 1, STATE_GAME = 3, ON_MOUSE_DOWN = 0, ON_MOUSE_UP = 1, ON_MOUSE_OVER = 2, ON_MOUSE_OUT = 3, INITIAL_TILES = 7, TILES_NUMBER = 28, WIN_SCORE, ENABLE_FULLSCREEN, ENABLE_CHECK_ORIENTATION, CENTER_ATTACH = 0, SIDE_LEFT_ATTACH = 1, SIDE_RIGHT_ATTACH = 2, DOMINO_TIMER = 500, MATCHOVER_TIMER = 1E3, LEFT_SIDE = 0, RIGHT_SIDE = 1, DRAWNTILES_LIMIT1 = 4, DRAWNTILES_LIMIT2 = 8, DRAWNTILES_LIMIT3 = 16, SCALE_VAR = .5, TILE_VALUES = [ [0, 0], [1, 2], [2, 3], [2, 4], [1, 5], [5, 5], [3, 6], [0, 1], [2, 2], [3, 3], [3, 4], [2, 5], [0, 6], [4, 6], [1, 1], [0, 3], [0, 4], [4, 4], [3, 5], [1, 6], [5, 6], [0, 2], [1, 3], [1, 4], [0, 5], [4, 5], [2, 6], [6, 6] ], TILE_BACK = 28, PLAYER_ROTATION = [0, 0, 270, 90], PLAYER_LOCK_POSITIONS = [ [CANVAS_WIDTH_HALF + 220, CANVAS_HEIGHT_HALF + 345 ], [CANVAS_WIDTH_HALF - 260, CANVAS_HEIGHT_HALF - 335], [CANVAS_WIDTH_HALF + 308, CANVAS_HEIGHT_HALF - 238], [CANVAS_WIDTH_HALF - 348, CANVAS_HEIGHT_HALF + 242] ], PLAYER_TEXT_COORDINATES = [ [CANVAS_WIDTH_HALF - 265, CANVAS_HEIGHT_HALF + 360], [CANVAS_WIDTH_HALF + 150, CANVAS_HEIGHT_HALF - 315], [CANVAS_WIDTH_HALF + 260, CANVAS_HEIGHT_HALF + 250], [CANVAS_WIDTH_HALF - 380, CANVAS_HEIGHT_HALF - 200] ], PLAYER_SCORE_COORDINATES = [ [CANVAS_WIDTH_HALF - 265, CANVAS_HEIGHT_HALF + 385], [CANVAS_WIDTH_HALF + 150, CANVAS_HEIGHT_HALF - 295], [CANVAS_WIDTH_HALF + 290, CANVAS_HEIGHT_HALF + 250], [CANVAS_WIDTH_HALF - 400, CANVAS_HEIGHT_HALF - 200] ], PLAYER_HANDS_COORDS = [ [CANVAS_WIDTH_HALF + 200, CANVAS_HEIGHT_HALF + 420], [CANVAS_WIDTH_HALF - 260, CANVAS_HEIGHT_HALF - 262], [CANVAS_WIDTH_HALF + 330, CANVAS_HEIGHT_HALF - 70], [CANVAS_WIDTH_HALF - 330, CANVAS_HEIGHT_HALF - 50] ], TILE_INIT_SCALE = .7, TILE_WIDTH = 84, TILE_HEIGHT = 138, TILE_SCALE_LIMIT = .74, TILE_SCALE_VAR = .07, NO_PLAYER = 5, FIRST_GAME, TEXT_HELP_TITLE = "HOW TO PLAY", TEXT_HELP1 = "MATCH TILES WITH THE SAME NUMBER OF DOTS", TEXT_HELP2 = "PLAY ALL YOUR TILES BEFORE THE OTHERS, WITH THE LEAST POSSIBLE MOVES", TEXT_HELP3 = "THE FIRST PLAYER THAT REACHES ", TEXT_HELP4 = " POINTS WINS THE GAME", TEXT_SELECT = "SELECT PLAYERS", TEXT_GOAL = "SELECT YOUR GOAL", TEXT_PLAYER = "PLAYER", TEXT_WINS = "WINS", TEXT_DOMINO = "DOMINO!", TEXT_LOCKED = "LOCKED!", TEXT_SELECTSIDE = "SELECT SIDE TO ATTACH", TEXT_PTS = "PTS", TEXT_BESTSCORE = "YOUR BEST SCORE", TEXT_MATCHSCORE = "MATCH SCORE", TEXT_GAMESUMMARY = "GAME SUMMARY", TEXT_GAMEWON = "CONGRATULATIONS! YOU WON!", TEXT_MATCHOVER = "MATCH OVER!", TEXT_GAMEOVER = "GAME OVER!", TEXT_ARE_SURE = "ARE YOU SURE YOU WANT TO EXIT? ALL UNSAVED PROGRESS WILL BE LOST", TEXT_RESTART = "A PREVIOUS MATCH WAS FOUND IN MEMORY. DO YOU WANT TO RESTART OVER THE GAME OR CONTINUE?", TEXT_SCORE = "LAST SAVED SCORE", TEXT_PRELOADER_CONTINUE = "START", TEXT_CREDITS_DEVELOPED = "DEVELOPED BY", TEXT_ERR_LS = "YOUR WEB BROWSER DOES NOT SUPPORT STORING SETTING LOCALLY. IN SAFARI, THE MOST COMMON CAUSE OF THIS IS USING 'PRIVATE BROWSING MODE'. SOME INFO MAY NOT SAVE OR SOME FEATURE MAY NOT WORK PROPERLY.", TEXT_SHARE_IMAGE = "200x200.jpg", TEXT_SHARE_TITLE = "Congratulations!", TEXT_SHARE_MSG1 = "You collected <strong>", TEXT_SHARE_MSG2 = " points</strong>!<br><br>Share your score with your friends!", TEXT_SHARE_SHARE1 = "My score is ", TEXT_SHARE_SHARE2 = " points! Can you do better"; function CPreloader() { var a, h, b, g, l, k, d, e, n, r; 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.addSprite("but_start", "./sprites/but_start.png"); s_oSpriteLibrary.loadSprites(); r = new createjs.Container; s_oStage.addChild(r) }; this.unload = function() { n.unload(); n = null; r.removeAllChildren() }; this._onImagesLoaded = function() {}; this._onAllImagesLoaded = function() { this.attachSprites(); s_oMain.preloaderReady() }; this.attachSprites = function() { var t = new createjs.Shape; t.graphics.beginFill("black").drawRect(0, 0, CANVAS_WIDTH, CANVAS_HEIGHT); r.addChild(t); t = s_oSpriteLibrary.getSprite("200x200"); d = createBitmap(t); d.regX = .5 * t.width; d.regY = .5 * t.height; d.x = CANVAS_WIDTH_HALF; d.y = CANVAS_HEIGHT_HALF - 180; r.addChild(d); e = new createjs.Shape; e.graphics.beginFill("rgba(0,0,0,0.01)").drawRoundRect(d.x - 100, d.y - 100, 200, 200, 10); r.addChild(e); d.mask = e; t = s_oSpriteLibrary.getSprite("progress_bar"); g = createBitmap(t); g.x = CANVAS_WIDTH_HALF - t.width / 2; g.y = CANVAS_HEIGHT_HALF + 50; r.addChild(g); a = t.width; h = t.height; l = new createjs.Shape; l.graphics.beginFill("rgba(0,0,0,0.01)").drawRect(g.x, g.y, 1, h); r.addChild(l); g.mask = l; b = new createjs.Text("", "30px " + PRIMARY_FONT, PRIMARY_FONT_COLOUR); b.x = CANVAS_WIDTH_HALF; b.y = CANVAS_HEIGHT_HALF + 100; b.textBaseline = "alphabetic"; b.textAlign = "center"; r.addChild(b); t = s_oSpriteLibrary.getSprite("but_start"); n = new CTextButton(CANVAS_WIDTH_HALF, CANVAS_HEIGHT_HALF, t, TEXT_PRELOADER_CONTINUE, "Arial", "#000", "bold 50", r); n.addEventListener(ON_MOUSE_UP, this._onButStartRelease, this); n.setVisible(!1); k = new createjs.Shape; k.graphics.beginFill("black").drawRect(0, 0, CANVAS_WIDTH, CANVAS_HEIGHT); r.addChild(k); createjs.Tween.get(k).to({ alpha: 0 }, 500).call(function() { createjs.Tween.removeTweens(k); r.removeChild(k) }) }; this._onButStartRelease = function() { s_oMain._onRemovePreloader() }; this.refreshLoader = function(t) { b.text = t + "%"; 100 === t && (s_oMain._onRemovePreloader(), b.visible = !1, g.visible = !1); l.graphics.clear(); t = Math.floor(t * a / 100); l.graphics.beginFill("rgba(0,0,0,0.01)").drawRect(g.x, g.y, t, h) }; this._init() } function CMain(a) { var h, b = 0, g = 0, l = STATE_LOADING, k, d; this.initContainer = function() { s_oCanvas = document.getElementById("canvas"); s_oStage = new createjs.Stage(s_oCanvas); s_oStage.preventSelection = !1; createjs.Touch.enable(s_oStage, !0); s_bMobile = isMobile(); !1 === s_bMobile && (s_oStage.enableMouseOver(20), $("body").on("contextmenu", "#canvas", function(n) { return !1 })); s_iPrevTime = (new Date).getTime(); createjs.Ticker.addEventListener("tick", this._update); createjs.Ticker.framerate = FPS; navigator.userAgent.match(/Windows Phone/i) && (DISABLE_SOUND_MOBILE = !0); s_oSpriteLibrary = new CSpriteLibrary; k = new CPreloader; }; this.preloaderReady = function() { this._loadImages(); !1 !== DISABLE_SOUND_MOBILE && !1 !== s_bMobile || this._initSounds(); h = !0 }; this.soundLoaded = function() { b++; k.refreshLoader(Math.floor(b / g * 100)) }; this._initSounds = function() { Howler.mute(!s_bAudioActive); s_aSoundsInfo = []; s_aSoundsInfo.push({ path: "./sounds/", filename: "press_button", loop: !1, volume: 1, ingamename: "click" }); s_aSoundsInfo.push({ path: "./sounds/", filename: "game_win", loop: !1, volume: 1, ingamename: "game_win" }); s_aSoundsInfo.push({ path: "./sounds/", filename: "game_over", loop: !1, volume: 1, ingamename: "game_over" }); s_aSoundsInfo.push({ path: "./sounds/", filename: "match_over", loop: !1, volume: 1, ingamename: "match_over" }); s_aSoundsInfo.push({ path: "./sounds/", filename: "tile", loop: !1, volume: 1, ingamename: "tile" }); s_aSoundsInfo.push({ path: "./sounds/", filename: "wrong", loop: !1, volume: 1, ingamename: "wrong" }); s_aSoundsInfo.push({ path: "./sounds/", filename: "select", loop: !1, volume: 1, ingamename: "select" }); s_aSoundsInfo.push({ path: "./sounds/", filename: "box_open", loop: !1, volume: 1, ingamename: "box_open" }); s_aSoundsInfo.push({ path: "./sounds/", filename: "box_move", loop: !1, volume: 1, ingamename: "box_move" }); s_aSoundsInfo.push({ path: "./sounds/", filename: "domino", loop: !1, volume: 1, ingamename: "domino" }); s_aSoundsInfo.push({ path: "./sounds/", filename: "locked", loop: !1, volume: 1, ingamename: "locked" }); g += s_aSoundsInfo.length; s_aSounds = []; for (var n = 0; n < s_aSoundsInfo.length; n++) this.tryToLoadSound(s_aSoundsInfo[n], !1) }; this.tryToLoadSound = function(n, r) { setTimeout(function() { s_aSounds[n.ingamename] = new Howl({ src: [n.path + n.filename + ".mp3"], autoplay: !1, preload: !0, loop: n.loop, volume: n.volume, onload: s_oMain.soundLoaded, onloaderror: function(t, y) { for (var u = 0; u < s_aSoundsInfo.length; u++) if (t === s_aSounds[s_aSoundsInfo[u].ingamename]._sounds[0]._id) { s_oMain.tryToLoadSound(s_aSoundsInfo[u], !0); break } }, onplayerror: function(t) { for (var y = 0; y < s_aSoundsInfo.length; y++) if (t === s_aSounds[s_aSoundsInfo[y].ingamename]._sounds[0]._id) { s_aSounds[s_aSoundsInfo[y].ingamename].once("unlock", function() { s_aSounds[s_aSoundsInfo[y].ingamename].play() }); break } } }) }, r ? 200 : 0) }; this._loadImages = function() { s_oSpriteLibrary.init(this._onImagesLoaded, this._onAllImagesLoaded, this); s_oSpriteLibrary.addSprite("but_exit", "./sprites/but_exit.png"); s_oSpriteLibrary.addSprite("audio_icon", "./sprites/audio_icon.png"); s_oSpriteLibrary.addSprite("but_play", "./sprites/but_play.png"); s_oSpriteLibrary.addSprite("but_restart", "./sprites/but_restart.png"); s_oSpriteLibrary.addSprite("but_resetgame", "./sprites/but_resetgame.png"); s_oSpriteLibrary.addSprite("but_continue", "./sprites/but_continue.png"); s_oSpriteLibrary.addSprite("but_home", "./sprites/but_home.png"); s_oSpriteLibrary.addSprite("but_menu_bg", "./sprites/but_menu_bg.png"); s_oSpriteLibrary.addSprite("msg_box", "./sprites/msg_box.png"); s_oSpriteLibrary.addSprite("msg_box2", "./sprites/msg_box2.png"); s_oSpriteLibrary.addSprite("but_credits", "./sprites/but_credits.png"); s_oSpriteLibrary.addSprite("logo_ctl", "./sprites/logo_ctl.png"); s_oSpriteLibrary.addSprite("but_fullscreen", "./sprites/but_fullscreen.png"); s_oSpriteLibrary.addSprite("bg_end_panel", "./sprites/bg_end_panel.png"); s_oSpriteLibrary.addSprite("bg_game", "./sprites/bg_game.png"); s_oSpriteLibrary.addSprite("bg_menu", "./sprites/bg_menu.png"); s_oSpriteLibrary.addSprite("but_no", "./sprites/but_no.png"); s_oSpriteLibrary.addSprite("but_yes", "./sprites/but_yes.png"); s_oSpriteLibrary.addSprite("but_hint", "./sprites/but_hint.png"); s_oSpriteLibrary.addSprite("but_2players", "./sprites/but_2players.png"); s_oSpriteLibrary.addSprite("but_3players", "./sprites/but_3players.png"); s_oSpriteLibrary.addSprite("but_4players", "./sprites/but_4players.png"); s_oSpriteLibrary.addSprite("but_restart_small", "./sprites/but_restart_small.png"); s_oSpriteLibrary.addSprite("tiles", "./sprites/tiles.png"); s_oSpriteLibrary.addSprite("glow", "./sprites/glow.png"); s_oSpriteLibrary.addSprite("lock", "./sprites/lock.png"); s_oSpriteLibrary.addSprite("box", "./sprites/box.png"); s_oSpriteLibrary.addSprite("cover", "./sprites/cover.png"); s_oSpriteLibrary.addSprite("frame", "./sprites/frame.png"); s_oSpriteLibrary.addSprite("game_frame", "./sprites/game_frame.png"); s_oSpriteLibrary.addSprite("arrow_right", "./sprites/arrow_right.png"); s_oSpriteLibrary.addSprite("arrow_left", "./sprites/arrow_left.png"); s_oSpriteLibrary.addSprite("side_selection", "./sprites/side_selection.png"); s_oSpriteLibrary.addSprite("but_check", "./sprites/but_check.png"); g += s_oSpriteLibrary.getNumSprites(); s_oSpriteLibrary.loadSprites() }; this._onImagesLoaded = function() { b++; k.refreshLoader(Math.floor(b / g * 100)) }; this._onAllImagesLoaded = function() {}; this._onRemovePreloader = function() { try { saveItem("ls_available", "ok") } catch (n) { s_bStorageAvailable = !1 } k.unload(); this.gotoMenu() }; this.gotoMenu = function() { new CMenu; l = STATE_MENU }; this.gotoSelectPlayers = function() { new CSelectPlayers; l = STATE_SELECT_PLAYERS }; this.gotoSelectGoal = function(n) { new CSelectGoal(n); l = STATE_SELECT_GOAL }; this.gotoGame = function(n, r) { d = new CGame(e, n, r); l = STATE_GAME; $(s_oMain).trigger("start_session") }; this.gotoHelp = function() { new CHelp; l = STATE_HELP }; this.stopUpdate = function() { h = !1; createjs.Ticker.paused = !0; $("#block_game").css("display", "block"); s_bAudioActive && Howler.mute(!0) }; this.startUpdate = function() { s_iPrevTime = (new Date).getTime(); h = !0; createjs.Ticker.paused = !1; $("#block_game").css("display", "none"); s_bAudioActive && Howler.mute(!1) }; this._update = function(n) { if (!1 !== h) { var r = (new Date).getTime(); s_iTimeElaps = r - s_iPrevTime; s_iCntTime += s_iTimeElaps; s_iCntFps++; s_iPrevTime = r; 1E3 <= s_iCntTime && (s_iCurFps = s_iCntFps, s_iCntTime -= 1E3, s_iCntFps = 0); l === STATE_GAME && d.update(); s_oStage.update(n) } }; s_oMain = this; var e = a; ENABLE_FULLSCREEN = a.fullscreen; ENABLE_CHECK_ORIENTATION = a.check_orientation; WIN_SCORE = a.max_score; s_bAudioActive = a.audio_enable_on_startup; this.initContainer() } var s_bMobile, s_bAudioActive = !0, s_bGlowActive = !0, s_bFullscreen = !1, s_iCntTime = 0, s_iTimeElaps = 0, s_iPrevTime = 0, s_iCntFps = 0, s_iCurFps = 0, s_iLevelReached = 1, s_szCurDraw, s_oDrawLayer, s_oStage, s_oMain, s_oSpriteLibrary, s_aSounds, s_oCanvas, s_aBestScore, s_aPlayersScore2 = [0, 0], s_aPlayersScore3 = [0, 0, 0], s_aPlayersScore4 = [0, 0, 0, 0], s_bStorageAvailable = !0; function CMenu() { var a, h, b, g, l, k, d, e, n, r, t, y, u = null, x = null; this._init = function() { d = createBitmap(s_oSpriteLibrary.getSprite("bg_menu")); s_oStage.addChild(d); var f = s_oSpriteLibrary.getSprite("but_play"); e = new CGfxButton(CANVAS_WIDTH_HALF, CANVAS_HEIGHT_HALF + 300, f); e.addEventListener(ON_MOUSE_UP, this._onButPlayRelease, this); f = s_oSpriteLibrary.getSprite("but_credits"); b = 20 + f.width / 2; g = f.height / 2 + 10; t = new CGfxButton(b, g, f); t.addEventListener(ON_MOUSE_UP, this._onCredits, this); if (!1 === DISABLE_SOUND_MOBILE || !1 === s_bMobile) f = s_oSpriteLibrary.getSprite("audio_icon"), l = CANVAS_WIDTH - f.width / 4 - 20, k = f.height / 2 + 10, r = new CToggle(l, k, f, s_bAudioActive, s_oStage), r.addEventListener(ON_MOUSE_UP, this._onAudioToggle, this); f = window.document; var q = f.documentElement; u = q.requestFullscreen || q.mozRequestFullScreen || q.webkitRequestFullScreen || q.msRequestFullscreen; x = f.exitFullscreen || f.mozCancelFullScreen || f.webkitExitFullscreen || f.msExitFullscreen; !1 === ENABLE_FULLSCREEN && (u = !1); u && screenfull.isEnabled && (f = s_oSpriteLibrary.getSprite("but_fullscreen"), a = b + f.width / 2 + 10, h = g, y = new CToggle(a, h, f, s_bFullscreen, s_oStage), y.addEventListener(ON_MOUSE_UP, this._onFullscreenRelease, this)); n = new createjs.Shape; n.graphics.beginFill("black").drawRect(0, 0, CANVAS_WIDTH, CANVAS_HEIGHT); s_oStage.addChild(n); createjs.Tween.get(n).to({ alpha: 0 }, 1E3).call(function() { s_oStage.removeChild(n) }); s_bStorageAvailable ? (f = getItemJson("classicdomino_best_score"), null !== f && (s_aBestScore = f), f = getItemJson("classicdomino_scores2"), null !== f && (s_aPlayersScore2 = [], s_aPlayersScore2 = f), f = getItemJson("classicdomino_scores3"), null !== f && (s_aPlayersScore3 = [], s_aPlayersScore3 = f), f = getItemJson("classicdomino_scores4"), null !== f && (s_aPlayersScore4 = [], s_aPlayersScore4 = f)) : new CMsgBox(TEXT_ERR_LS, s_oStage); this.refreshButtonPos(s_iOffsetX, s_iOffsetY); FIRST_GAME = !0 }; this.unload = function() { e.unload(); e = null; s_oStage.removeChild(d); d = null; t.unload(); if (!1 === DISABLE_SOUND_MOBILE || !1 === s_bMobile) r.unload(), r = null; u && screenfull.isEnabled && y.unload(); s_oMenu = null }; this.refreshButtonPos = function(f, q) { !1 !== DISABLE_SOUND_MOBILE && !1 !== s_bMobile || r.setPosition(l - f, k + q); u && screenfull.isEnabled && y.setPosition(a + f, h + q); t.setPosition(b + f, g + q) }; this.exitFromCredits = function() {}; this._onAudioToggle = function() { Howler.mute(s_bAudioActive); s_bAudioActive = !s_bAudioActive }; this._onCredits = function() { new CCreditsPanel }; this._onButPlayRelease = function() { this.unload(); s_oMain.gotoSelectPlayers() }; this.resetFullscreenBut = function() { u && screenfull.isEnabled && y.setActive(s_bFullscreen) }; this._onFullscreenRelease = function() { s_bFullscreen ? x.call(window.document) : u.call(window.document.documentElement); sizeHandler() }; s_oMenu = this; this._init() } var s_oMenu = null; function CSelectPlayers() { var a, h, b, g, l, k, d, e, n, r, t, y, u = null, x = null; this._init = function() { k = new createjs.Container; s_oStage.addChild(k); l = createBitmap(s_oSpriteLibrary.getSprite("bg_end_panel")); k.addChild(l); var f = s_oSpriteLibrary.getSprite("msg_box2"), q = createBitmap(f); q.regX = f.width / 2; q.regY = f.height / 2; q.x = CANVAS_WIDTH_HALF; q.y = CANVAS_HEIGHT_HALF; k.addChild(q); new CTLText(k, CANVAS_WIDTH_HALF - 260, CANVAS_HEIGHT_HALF - 150, 520, 40, 40, "center", PRIMARY_FONT_COLOUR, PRIMARY_FONT, 1, 0, 0, TEXT_SELECT, !0, !0, !1, !1); f = CANVAS_HEIGHT_HALF + 30; q = s_oSpriteLibrary.getSprite("but_2players"); d = new CGfxButton(CANVAS_WIDTH_HALF - 180, f, q, k); d.addEventListenerWithParams(ON_MOUSE_UP, this._onButPlayRelease, this, 2); q = s_oSpriteLibrary.getSprite("but_3players"); e = new CGfxButton(CANVAS_WIDTH_HALF, f, q, k); e.addEventListenerWithParams(ON_MOUSE_UP, this._onButPlayRelease, this, 3); q = s_oSpriteLibrary.getSprite("but_4players"); n = new CGfxButton(CANVAS_WIDTH_HALF + 180, f, q, k); n.addEventListenerWithParams(ON_MOUSE_UP, this._onButPlayRelease, this, 4); if (!1 === DISABLE_SOUND_MOBILE || !1 === s_bMobile) f = s_oSpriteLibrary.getSprite("audio_icon"), b = CANVAS_WIDTH - f.width / 4 - 20, g = f.height / 2 + 10, t = new CToggle(b, g, f, s_bAudioActive, s_oStage), t.addEventListener(ON_MOUSE_UP, this._onAudioToggle, this); f = window.document; q = f.documentElement; u = q.requestFullscreen || q.mozRequestFullScreen || q.webkitRequestFullScreen || q.msRequestFullscreen; x = f.exitFullscreen || f.mozCancelFullScreen || f.webkitExitFullscreen || f.msExitFullscreen; !1 === ENABLE_FULLSCREEN && (u = !1); u && screenfull.isEnabled && (f = s_oSpriteLibrary.getSprite("but_fullscreen"), a = 20 + f.width / 4, h = f.height / 2 + 10, y = new CToggle(a, h, f, s_bFullscreen, s_oStage), y.addEventListener(ON_MOUSE_UP, this._onFullscreenRelease, this)); r = new createjs.Shape; r.graphics.beginFill("black").drawRect(0, 0, CANVAS_WIDTH, CANVAS_HEIGHT); s_oStage.addChild(r); createjs.Tween.get(r).to({ alpha: 0 }, 1E3).call(function() { s_oStage.removeChild(r) }); this.refreshButtonPos(s_iOffsetX, s_iOffsetY) }; this.unload = function() { k.removeAllChildren(); if (!1 === DISABLE_SOUND_MOBILE || !1 === s_bMobile) t.unload(), t = null; u && screenfull.isEnabled && y.unload(); s_oSelectPlayers = null }; this.refreshButtonPos = function(f, q) { !1 !== DISABLE_SOUND_MOBILE && !1 !== s_bMobile || t.setPosition(b - f, g + q); u && screenfull.isEnabled && y.setPosition(a + f, h + q) }; this._onAudioToggle = function() { Howler.mute(s_bAudioActive); s_bAudioActive = !s_bAudioActive }; this._onButPlayRelease = function(f) { this.unload(); playSound("click", 1, 0); s_oMain.gotoSelectGoal(f) }; this.resetFullscreenBut = function() { u && screenfull.isEnabled && y.setActive(s_bFullscreen) }; this._onFullscreenRelease = function() { s_bFullscreen ? x.call(window.document) : u.call(window.document.documentElement); sizeHandler() }; s_oSelectPlayers = this; this._init() } var s_oSelectPlayers = null; function CSelectGoal(a) { var h, b, g, l, k, d, e, n, r, t, y, u, x, f = null, q = null; this._init = function() { k = new createjs.Container; s_oStage.addChild(k); d = createBitmap(s_oSpriteLibrary.getSprite("bg_end_panel")); k.addChild(d); e = createBitmap(s_oSpriteLibrary.getSprite("msg_box")); e.regX = 308; e.regY = 308.5; e.x = CANVAS_WIDTH_HALF; e.y = CANVAS_HEIGHT_HALF; k.addChild(e); new CTLText(k, CANVAS_WIDTH_HALF - 260, CANVAS_HEIGHT_HALF - 220, 520, 40, 40, "center", PRIMARY_FONT_COLOUR, PRIMARY_FONT, 1, 0, 0, TEXT_GOAL, !0, !0, !1, !1); var v = s_oSpriteLibrary.getSprite("but_menu_bg"); n = new CTextButton(CANVAS_WIDTH_HALF, CANVAS_HEIGHT_HALF - 60, v, WIN_SCORE[0], PRIMARY_FONT, THIRD_FONT_COLOUR, 40, s_oStage); n.addEventListenerWithParams(ON_MOUSE_UP, this._onButPlayRelease, this, 0); v = s_oSpriteLibrary.getSprite("but_menu_bg"); r = new CTextButton(CANVAS_WIDTH_HALF, CANVAS_HEIGHT_HALF + 60, v, WIN_SCORE[1], PRIMARY_FONT, THIRD_FONT_COLOUR, 40, s_oStage); r.addEventListenerWithParams(ON_MOUSE_UP, this._onButPlayRelease, this, 1); v = s_oSpriteLibrary.getSprite("but_menu_bg"); t = new CTextButton(CANVAS_WIDTH_HALF, CANVAS_HEIGHT_HALF + 180, v, WIN_SCORE[2], PRIMARY_FONT, THIRD_FONT_COLOUR, 40, s_oStage); t.addEventListenerWithParams(ON_MOUSE_UP, this._onButPlayRelease, this, 2); if (!1 === DISABLE_SOUND_MOBILE || !1 === s_bMobile) v = s_oSpriteLibrary.getSprite("audio_icon"), g = CANVAS_WIDTH - v.width / 4 - 20, l = v.height / 2 + 10, u = new CToggle(g, l, v, s_bAudioActive, s_oStage), u.addEventListener(ON_MOUSE_UP, this._onAudioToggle, this); v = window.document; var A = v.documentElement; f = A.requestFullscreen || A.mozRequestFullScreen || A.webkitRequestFullScreen || A.msRequestFullscreen; q = v.exitFullscreen || v.mozCancelFullScreen || v.webkitExitFullscreen || v.msExitFullscreen; !1 === ENABLE_FULLSCREEN && (f = !1); f && screenfull.isEnabled && (v = s_oSpriteLibrary.getSprite("but_fullscreen"), h = 20 + v.width / 4, b = v.height / 2 + 10, x = new CToggle(h, b, v, s_bFullscreen, s_oStage), x.addEventListener(ON_MOUSE_UP, this._onFullscreenRelease, this)); y = new createjs.Shape; y.graphics.beginFill("black").drawRect(0, 0, CANVAS_WIDTH, CANVAS_HEIGHT); s_oStage.addChild(y); createjs.Tween.get(y).to({ alpha: 0 }, 1E3).call(function() { s_oStage.removeChild(y) }); this.refreshButtonPos(s_iOffsetX, s_iOffsetY) }; this.unload = function() { n.unload(); r.unload(); t.unload(); t = r = n = null; k.removeAllChildren(); if (!1 === DISABLE_SOUND_MOBILE || !1 === s_bMobile) u.unload(), u = null; f && screenfull.isEnabled && x.unload(); s_oSelectGoal = null }; this.refreshButtonPos = function(v, A) { !1 !== DISABLE_SOUND_MOBILE && !1 !== s_bMobile || u.setPosition(g - v, l + A); f && screenfull.isEnabled && x.setPosition(h + v, b + A) }; this._onAudioToggle = function() { Howler.mute(s_bAudioActive); s_bAudioActive = !s_bAudioActive }; this.checkIfArrayIsZero = function(v) { for (var A = 0, m = 0; m < v.length; ++m) if (0 !== v[m]) { A = 1; break } return A ? !1 : !0 }; this._onButPlayRelease = function(v) { playSound("click", 1, 0); switch (a) { case 2: !1 === s_oSelectGoal.checkIfArrayIsZero(s_aPlayersScore2) ? (this.unload(), new CRestartMenu(a, v)) : (this.unload(), s_oMain.gotoGame(a, v)); break; case 3: !1 === s_oSelectGoal.checkIfArrayIsZero(s_aPlayersScore3) ? (this.unload(), new CRestartMenu(a, v)) : (this.unload(), s_oMain.gotoGame(a, v)); break; case 4: !1 === s_oSelectGoal.checkIfArrayIsZero(s_aPlayersScore4) ? (this.unload(), new CRestartMenu(a, v)) : (this.unload(), s_oMain.gotoGame(a, v)) } }; this.resetFullscreenBut = function() { f && screenfull.isEnabled && x.setActive(s_bFullscreen) }; this._onFullscreenRelease = function() { s_bFullscreen ? q.call(window.document) : f.call(window.document.documentElement); sizeHandler() }; s_oSelectGoal = this; this._init() } var s_oSelectGoal = null; function CGame(a, h, b) { var g, l, k, d, e, n, r, t, y, u, x, f, q, v, A, m, L, C, D, F, V, E, ea, la, da, fa, ka, ia, Z, P, O, ja, p, ha, ca, X, J, z, Q, aa, B, W, U, S, M, N, Y, R, ba, ma; this._init = function() { Y = []; R = []; N = []; ba = []; u = h; x = b; D = C = A = m = L = q = v = f = 0; F = 1; V = .75 * TILE_WIDTH; E = .95 * TILE_WIDTH; ea = 38; M = ia = ka = null; k = l = !1; n = !0; y = e = t = d = r = !1; switch (u) { case 2: for (var c = 0; c < s_aPlayersScore2.length; c++) N[c] = s_aPlayersScore2[c]; break; case 3: for (c = 0; c < s_aPlayersScore3.length; c++) N[c] = s_aPlayersScore3[c]; break; case 4: for (c = 0; c < s_aPlayersScore4.length; c++) N[c] = s_aPlayersScore4[c] } c = s_oSpriteLibrary.getSprite("bg_game"); da = createBitmap(c); da.x = c.width / 2; da.y = c.height / 2; da.regX = CANVAS_WIDTH_HALF; da.regY = (CANVAS_HEIGHT_HALF + ea) / 2; fa = createBitmap(s_oSpriteLibrary.getSprite("game_frame")); s_oStage.addChild(da, fa); new CBoxAnimation(u, R); this._initPlayersAndTiles(); J = new createjs.Container; s_oStage.addChild(J); this._initLockedText(); z = new createjs.Container; s_oStage.addChild(z); this._initDominoText(); la = new CInterface; W = new createjs.Container; s_oStage.addChild(W); c = s_oSpriteLibrary.getSprite("side_selection"); var w = createBitmap(c); w.regX = .5 * c.width; w.regY = .5 * c.height; W.addChild(w); new CTLText(W, -75, -18, 150, 40, 20, "center", PRIMARY_FONT_COLOUR, PRIMARY_FONT, 1, 0, 0, TEXT_SELECTSIDE, !0, !0, !0, !1); c = s_oSpriteLibrary.getSprite("arrow_left"); U = new CGfxButton(-90, 0, c, W); U.addEventListenerWithParams(ON_MOUSE_UP, this._onSelectedSide, this, LEFT_SIDE); c = s_oSpriteLibrary.getSprite("arrow_right"); S = new CGfxButton(90, 0, c, W); S.addEventListenerWithParams(ON_MOUSE_UP, this._onSelectedSide, this, RIGHT_SIDE); W.x = CANVAS_WIDTH_HALF; W.y = CANVAS_HEIGHT_HALF; W.visible = !1; B = new createjs.Shape; B.graphics.beginFill("#ff0000").drawRect(0, R[0].getY() - 50, CANVAS_WIDTH, 100); B.alpha = .01; B.visible = !0; B.on("mousedown", function() {}); s_oStage.addChild(B); !0 === FIRST_GAME ? new CHelpPanel(x) : this._onExitHelp() }; this._initLockedText = function() { var c = CANVAS_WIDTH_HALF, w = CANVAS_HEIGHT_HALF + ea; ca = createBitmap(s_oSpriteLibrary.getSprite("msg_box")); ca.regX = 308; ca.regY = 308.5; ca.scaleX = ca.scaleY = .5; ca.x = c; ca.y = w; J.addChild(ca); ja = new CTLText(J, c - 100, w - 100, 200, 70, 30, "center", PRIMARY_FONT_COLOUR, PRIMARY_FONT, 1, 0, 0, TEXT_PLAYER + " " + f + " " + TEXT_LOCKED, !0, !0, !0, !1); Q = new CGfxButton(CANVAS_WIDTH_HALF, CANVAS_HEIGHT_HALF + 100, s_oSpriteLibrary.getSprite("but_continue"), J); Q.addEventListener(ON_MOUSE_UP, this._onLockedContinue, this); J.alpha = 0 }; this._initDominoText = function() { var c = CANVAS_WIDTH_HALF, w = CANVAS_HEIGHT_HALF + ea; X = createBitmap(s_oSpriteLibrary.getSprite("msg_box")); X.regX = 308; X.regY = 308.5; X.scaleX = X.scaleY = .5; X.x = c; X.y = w; z.addChild(X); p = new CTLText(z, c - 100, w - 100, 200, 70, 30, "center", PRIMARY_FONT_COLOUR, PRIMARY_FONT, 1, 0, 0, TEXT_PLAYER + " " + f + " " + TEXT_DOMINO, !0, !0, !0, !1); aa = new CGfxButton(CANVAS_WIDTH_HALF, CANVAS_HEIGHT_HALF + 100, s_oSpriteLibrary.getSprite("but_continue"), z); aa.addEventListener(ON_MOUSE_UP, this._onDominoContinue, this); z.alpha = 0 }; this._initPlayersAndTiles = function() { for (var c = 0; c < u; c++) R[c] = new CPlayer(c, N[c]); Z = new createjs.Container; Z.x = CANVAS_WIDTH_HALF; Z.y = CANVAS_HEIGHT_HALF + ea; s_oStage.addChild(Z); for (c = 0; c < TILES_NUMBER; c++) { var w = new CTile(Z, c, NO_PLAYER, 0, 0); Y.push(w) } shuffle(Y); for (c = w = 0; c < u * INITIAL_TILES; c++) R[w].addTile(Y[c]), w++, w >= u && (w = 0); for (c = 0; c < u; c++) for (w = 0; w < INITIAL_TILES; w++) R[c].setTileVisible(w, !1); for (c = 0; c < TILES_NUMBER; c++) Y[c].setVisible(!1); Y = null; Z.x = CANVAS_WIDTH_HALF; Z.y = CANVAS_HEIGHT_HALF; Z.regX = CANVAS_WIDTH_HALF / 2; Z.regY = CANVAS_HEIGHT_HALF / 2 + ea }; this.unload = function() { la.unload(); createjs.Tween.removeAllTweens(); s_oStage.removeAllChildren(); s_oGame = null }; this.onExit = function() { s_oGame.unload(); s_oMain.gotoMenu(); $(s_oMain).trigger("end_session"); $(s_oMain).trigger("show_interlevel_ad") }; this.restart = function() { this.unload(); s_oMain.gotoGame(u, x); $(s_oMain).trigger("restart_level", 1); s_oStage.update(); k = !1 }; this._onExitHelp = function() { g = !0; FIRST_GAME = !1; s_oBox.openTileBox() }; this._gameOver = function() { g = !1; null === ka && (playSound("game_over", 1, 0), this.showEndPanel()) }; this._checkWin = function() { k && (playSound("game_win", 1, 0), N[0] > s_aBestScore && (s_aBestScore = N[0], setItemJson("classicdomino_best_score", N[0])), this.showEndPanel()) }; this.showEndPanel = function() { ka = new CEndPanel(u, D, C); J.visible = !1; z.visible = !1; $(s_oMain).trigger("share_event", N[0]); $(s_oMain).trigger("save_score", [N[0], u]) }; this.checkDrawned = function() { return r }; this.setGlowVisibleFalse = function() { if (!(0 < f) && l && null === s_oBox) for (var c = R[0].getTilesArray(), w = 0; w < c.length; w++) c[w].setGlowVisible(!1) }; this.setGlowVisibleTrue = function() { if (!(0 < f) && l && null === s_oBox) for (var c = R[0].getTilesArray(), w = 0; w < c.length; w++) { var G = c[w]; G.setGlowVisible(!1); if (G.getDotsValue(0) === q || G.getDotsValue(0) === v || G.getDotsValue(1) === q || G.getDotsValue(1) === v) s_bGlowActive && G.setGlowVisible(!0), ma.push(G) } }; this.checkToDrawn = function() { r = !0; ma = []; this.setGlowVisibleTrue(); 0 === ma.length ? (r = !1, !1 === R[0].getLocked() && R[0].setLocked(!0), this.passTurn()) : (r = !1, !0 === R[0].getLocked() && R[0].setLocked(!1)) }; this.cpuDrawTile = function() { r = !0; for (var c = R[f].getTilesArray(), w = [], G = 0; G < c.length; G++) { var K = c[G]; K.getDotsValue(0) !== q && K.getDotsValue(0) !== v && K.getDotsValue(1) !== q && K.getDotsValue(1) !== v || w.push(K) } 0 === w.length ? (!1 === R[f].getLocked() && R[f].setLocked(!0), this.passTurn()) : (R[f].setLocked(!1), this.sortTilesByValue(w), this.checkClickedTile(w[0]), r = !1) }; this.sortTilesByValue = function(c) { c.sort(function(w, G) { return w.getDotsValue(0) + w.getDotsValue(1) < G.getDotsValue(0) + G.getDotsValue(1) ? -1 : w.getDotsValue(0) + w.getDotsValue(1) > G.getDotsValue(0) + G.getDotsValue(1) ? 1 : 0 }) }; this.passTurn = function() { r = !1; ja.refreshText(TEXT_PLAYER + " " + (f + 1) + " " + TEXT_LOCKED); (new createjs.Tween.get(J)).to({ alpha: 1 }, 500, createjs.Ease.cubicIn); playSound("locked", 1, 0) }; this._selectTileSide = function(c) { M = c; y = !0; W.visible = !0; W.alpha = 0; createjs.Tween.get(W).to({ alpha: 1 }, 500, createjs.Ease.cubicIn).call(function() { createjs.Tween.removeTweens(W) }); c.setDrawn() }; this._onSelectedSide = function(c) { if (y) { r = !0; createjs.Tween.get(W).to({ alpha: 0 }, 500, createjs.Ease.cubicIn).call(function() { W.visible = !1; createjs.Tween.removeTweens(W) }); y = !1; if (c === LEFT_SIDE) { if (!1 === M.isDouble()) { var w = -90; M.getDotsValue(0) === q && (w = 90) } else w = 0; c = SIDE_LEFT_ATTACH } else !1 === M.isDouble() ? (w = 90, M.getDotsValue(0) === v && (w = -90)) : w = 0, c = SIDE_RIGHT_ATTACH; this.moveToBoard(M, w, c); M = null } }; this.checkIfBothSidesCanBeAttached = function(c) { if (c.getDotsValue(0) === q && c.getDotsValue(1) === v && (c.getDotsValue(0) === q || c.getDotsValue(1) === v) || c.getDotsValue(1) === q && c.getDotsValue(0) === v && (c.getDotsValue(1) === q || c.getDotsValue(0) === v)) return !0; if (c.getDotsValue(0) !== q && c.getDotsValue(1) !== v) return !1; c.getDotsValue(1) !== q && c.getDotsValue(0); return !1 }; this.checkClickedTile = function(c) { if (!y) if (!0 === n) if (0 === f) if (c.isPlayerTile()) { c.setDrawn(); r = !0; var w = -90; !0 === c.isDouble() && (w = 0); this.moveToBoard(c, w, CENTER_ATTACH) } else this.callShake(c.getTile()); else c.setDrawn(), r = !0, w = 90, !0 === c.isDouble() && (w = 0), this.moveToBoard(c, w, CENTER_ATTACH); else !1 === n && (0 === f && !0 === this.checkIfBothSidesCanBeAttached(c) ? this._selectTileSide(c) : c.getDotsValue(0) === q || c.getDotsValue(1) === q ? (c.setDrawn(), r = !0, !1 === c.isDouble() ? (w = -90, c.getDotsValue(0) === q && (w = 90)) : w = 0, this.moveToBoard(c, w, SIDE_LEFT_ATTACH)) : c.getDotsValue(0) === v || c.getDotsValue(1) === v ? (c.setDrawn(), r = !0, !1 === c.isDouble() ? (w = 90, c.getDotsValue(0) === v && (w = -90)) : w = 0, this.moveToBoard(c, w, SIDE_RIGHT_ATTACH)) : this.callShake(c.getTile())) }; this.callShake = function(c) { playSound("wrong", 1, 0); this.stopShake(); ha = new CShake(c, 300, 1, 5) }; this.stopShake = function() { ha && (ha.stopTremble(), ha = null) }; this.moveToBoard = function(c, w, G) { this.stopShake(); c.removeHitArea(); var K = c.getValue(), H = R[f].getContainer().localToLocal(c.getX(), c.getY(), Z); K = new CTile(Z, K, f, H.x, H.y); playSound("select", 1, 0); !1 === K.isTurned() && (0 === f ? K.turnTileInvisible() : K.turnTile()); c.unload(); R[f].removeTile(c); H = CANVAS_WIDTH_HALF / 2; var I = CANVAS_HEIGHT_HALF / 2 + 2 * ea, T = TILE_WIDTH / 4.5; switch (G) { case CENTER_ATTACH: P = O = K; q = K.getDotsValue(0); v = K.getDotsValue(1); this.startTileMovement(K, H, I, w); break; case SIDE_LEFT_ATTACH: G = c.isDouble() || P.isDouble() ? V : E; q = 0 < w ? K.getDotsValue(1) : K.getDotsValue(0); A < DRAWNTILES_LIMIT1 ? (H = P.getX() - G, I = P.getY()) : A === DRAWNTILES_LIMIT1 - 1 ? (H = P.getX(), I = P.getY() - G, !1 === c.isDouble() && (w += 90)) : A === DRAWNTILES_LIMIT1 ? (H = P.getX(), c.isDouble() || P.isDouble() ? c.isDouble() && P.isDouble() ? (H -= T, I = P.getY() - 1.25 * G) : c.isDouble() ? (H -= 1.1 * T, I = P.getY() - .7 * G) : I = P.getY() - 1.3 * G : (H -= T, I = P.getY() - .8 * G), w += 90) : A < DRAWNTILES_LIMIT2 ? (H = P.getX(), I = P.getY() - G, w += 90) : A === DRAWNTILES_LIMIT2 - 1 ? (H = P.getX() + G, I = P.getY(), !1 === c.isDouble() && (w += 180)) : A === DRAWNTILES_LIMIT2 ? (I = P.getY(), c.isDouble() || P.isDouble() ? c.isDouble() && P.isDouble() ? (H = P.getY() + 1.25 * G, I -= T) : c.isDouble() ? (H = P.getX() + .7 * G, I -= 1.1 * T) : H = P.getX() + 1.3 * G : (H = P.getX() + .8 * G, I -= T), w += 180) : A >= DRAWNTILES_LIMIT3 ? (H = P.getX(), I = P.getY() + 3.2 * T, w += 180) : (w += 180, H = P.getX() + G, I = P.getY()); P = K; A += 1; this.startTileMovement(K, H, I, w); break; case SIDE_RIGHT_ATTACH: G = c.isDouble() || O.isDouble() ? V : E, v = 0 < w ? K.getDotsValue(0) : K.getDotsValue(1), m < DRAWNTILES_LIMIT1 ? (H = O.getX() + G, I = O.getY()) : m === DRAWNTILES_LIMIT1 - 1 ? (H = O.getX(), I = O.getY() + G, !1 === c.isDouble() && (w += 90)) : m === DRAWNTILES_LIMIT1 ? (H = O.getX(), c.isDouble() || O.isDouble() ? c.isDouble() && O.isDouble() ? (H += T, I = O.getY() + 1.25 * G) : c.isDouble() ? (H += 1.1 * T, I = O.getY() + .7 * G) : I = O.getY() + 1.3 * G : (H += T, I = O.getY() + .8 * G), w += 90) : m < DRAWNTILES_LIMIT2 ? (H = O.getX(), I = O.getY() + G, w += 90) : m === DRAWNTILES_LIMIT2 - 1 ? (H = O.getX() - G, I = O.getY(), !1 === c.isDouble() && (w += 180)) : m === DRAWNTILES_LIMIT2 ? (I = O.getY(), c.isDouble() || O.isDouble() ? c.isDouble() && O.isDouble() ? (H = O.getY() - 1.25 * G, I -= T) : c.isDouble() ? (H = O.getX() - .7 * G, I += 1.1 * T) : H = O.getX() - 1.3 * G : (H = O.getX() - .8 * G, I += T), w += 180) : m >= DRAWNTILES_LIMIT3 ? (H = P.getX(), I = P.getY() - 3.2 * T, w += 180) : (w += 180, H = O.getX() - G, I = O.getY()), O = K, m += 1, this.startTileMovement(K, H, I, w) } }; this.zoomCamera = function() { F > TILE_SCALE_LIMIT && (F -= TILE_SCALE_VAR); (new createjs.Tween(da)).to({ scaleX: F, scaleY: F }, 1E3, createjs.Ease.cubicInOut); (new createjs.Tween(Z)).to({ scaleX: F, scaleY: F }, 1E3, createjs.Ease.cubicInOut) }; this.startTileMovement = function(c, w, G, K) { var H = c.getTile(); c.removeHitArea(); c.setPlayerTile(!1); Z.setChildIndex(H, Z.numChildren - 1); c = 1 - F; H.scaleX += c; H.scaleY += c; (new createjs.Tween(H)).to({ x: w, y: G, rotation: K, scaleX: TILE_INIT_SCALE, scaleY: TILE_INIT_SCALE }, 750, createjs.Ease.cubicIn).call(function() { playSound("tile", .2, 0); 0 === w && 0 === G || s_oGame.zoomCamera(); s_oGame.checkAfterTileMoved() }) }; this.checkAfterTileMoved = function() { !0 === s_oGame.checkForDomino(f) ? (t = !0, g = !1, s_oGame.showDominoText()) : (R[f].arrangeTiles(), s_oGame.changeTurn()) }; this.checkFirstTile = function() { l = !0; for (var c, w = 0, G, K = 0; K < u; K++) for (var H = R[K].getTilesArray(), I = 0; I < H.length; I++) { var T = H[I].getDotsValue(0) + H[I].getDotsValue(1); T >= w && H[I].isDouble() && (w = H[I].getDotsValue(0) + H[I].getDotsValue(1), G = I, c = K) } if (0 === w) for (K = 0; K < u; K++) for (H = R[K].getTilesArray(), I = 0; I < H.length; I++) T = H[I].getDotsValue(0) + H[I].getDotsValue(1), T >= w && (w = H[I].getDotsValue(0) + H[I].getDotsValue(1), G = I, c = K); f = c; H = R[c].getTilesArray(); w = H[G]; 0 === c ? (s_bGlowActive && w.setGlowVisible(!0), B.visible = !1) : 0 < c && this.checkClickedTile(w); R[f].setTurn(!0); this.setTurnVisibility() }; this._checkGame = function() { if (!0 !== d) { !0 === n && (n = !1); if (!r) if (0 === f) B.visible = !1, s_oGame.checkToDrawn(); else { B.visible = !0; if (!0 === t) return; s_oGame.cpuDrawTile() }! 1 === t && s_oGame.checkLockedPlayers() } }; this.checkForDomino = function(c) { return 0 === R[c].getTilesArray().length ? !0 : !1 }; this.showDominoText = function() { for (var c = 0; c < u; c++) for (var w = R[c].getTilesArray(), G = 0; G < w.length; G++) { var K = w[G]; 0 < c && K.turnTile() } p.refreshText(TEXT_PLAYER + " " + (f + 1) + " " + TEXT_DOMINO); (new createjs.Tween.get(z)).to({ alpha: 1 }, 500, createjs.Ease.cubicIn); playSound("domino", 1, 0) }; this._onLockedContinue = function() { 1 > J.alpha || (!1 === d ? (new createjs.Tween.get(J)).to({ alpha: 0 }, 500, createjs.Ease.cubicIn).call(s_oGame.changeTurn) : (s_oGame.getMatchWinnerScore(), s_oGame.matchOver())) }; this._onDominoContinue = function() { if (!(1 > z.alpha)) { for (var c = 0; c < u; c++) C = c !== f ? C + s_oGame.totalTilesValue(c) : C - s_oGame.totalTilesValue(c); D = f; s_oGame.matchOver() } }; this.checkLockedPlayers = function() { for (var c = 0; c < u; c++) !1 === s_oGame.checkForDomino(c) && (!0 === R[c].getLocked() ? ba[c] = !0 : ba[c] = !1, this.checkLockedMatch()) }; this.checkLockedMatch = function() { 2 === u ? d = !0 === ba[0] && !0 === ba[1] ? !0 : !1 : 3 === u ? d = !0 === ba[0] && !0 === ba[1] && !0 === ba[2] ? !0 : !1 : 4 === u && (d = !0 === ba[0] && !0 === ba[1] && !0 === ba[2] && !0 === ba[3] ? !0 : !1) }; this.totalTilesValue = function(c) { for (var w = R[c].getTilesArray(), G = 0, K = 0; K < w.length; K++) { var H = w[K]; 0 < c && H.turnTile(); G += H.getDotsValue(0) + H.getDotsValue(1) } return G }; this.getMatchWinnerScore = function(c) { if (!e) { c = []; for (var w = 0; w < u; w++) { var G = s_oGame.totalTilesValue(w); c[w] = [w, G] } c.sort(function(K, H) { var I = K[1]; var T = H[1]; return I < T ? -1 : I > T ? 1 : 0 }); for (w = 1; w < c.length; w++) C += c[w][1]; C -= c[0][1]; D = c[0][0] } }; this.lockedMatch = function() { s_oGame.getMatchWinnerScore(); e = !0 }; this.resetScore = function(c) { switch (c) { case 2: s_aPlayersScore2 = [0, 0]; setItemJson("classicdomino_scores2", s_aPlayersScore2); N = s_aPlayersScore2; break; case 3: s_aPlayersScore3 = [0, 0, 0]; setItemJson("classicdomino_scores3", s_aPlayersScore3); N = s_aPlayersScore3; break; case 4: s_aPlayersScore4 = [0, 0, 0, 0], setItemJson("classicdomino_scores4", s_aPlayersScore4), N = s_aPlayersScore4 } }; this.saveScore = function() { switch (u) { case 2: setItemJson("classicdomino_scores2", N); for (var c = 0; c < N.length; c++) s_aPlayersScore2[c] = N[c]; break; case 3: setItemJson("classicdomino_scores3", N); for (c = 0; c < N.length; c++) s_aPlayersScore3[c] = N[c]; break; case 4: for (setItemJson("classicdomino_scores4", N), c = 0; c < N.length; c++) s_aPlayersScore4[c] = N[c] } }; this.matchOver = function() { N[D] += C; this.saveScore(); this.checkForWinner() }; this.checkForWinner = function() { for (var c = !1, w = 0; w < u; w++) N[w] >= WIN_SCORE[x] && (c = !0, 0 === w ? (k = !0, this._checkWin()) : this._gameOver()); !1 === c && this.matchOverScreen() }; this.matchOverScreen = function() { g = !1; null === ia && (playSound("match_over", 1, 0), ia = new CMatchOver(u, D, C), J.visible = !1, z.visible = !1) }; this.checkBoard = function() { var c = new createjs.Shape; c.graphics.beginFill("rgba(0,0,0,0.4)").drawRect(0, 0, CANVAS_WIDTH, CANVAS_HEIGHT); c.on("click", s_oGame.returnToEndPanel, s_oGame, !0, c); s_oStage.addChild(c); ia.hide() }; this.returnToEndPanel = function(c, w) { s_oStage.removeChild(w); ia.show() }; this.getScore = function(c) { return N[c] }; this.setValueSide1 = function(c) { q = c }; this.setValueSide2 = function(c) { v = c }; this.getValueSide1 = function() { return q }; this.getValueSide2 = function() { return v }; this.getTurn = function() { return f }; this.gameReady = function() { return l }; this.setTurnVisibility = function() { for (var c = 0; c < u; c++) c === f ? R[c].setTurn(!0) : R[c].setTurn(!1) }; this.changeTurn = function() { r = !1; f += 1; f >= u && (f = 0); s_oGame.setTurnVisibility(); if (0 !== f) for (var c = R[0].getTilesArray(), w = 0; w < c.length; w++) c[w].setGlowVisible(!1); s_oGame._checkGame() }; this.update = function() { g && d && !e && (L += s_iTimeElaps, L > MATCHOVER_TIMER && !0 !== t && (g = !1, L = 0, this.lockedMatch())) }; s_oGame = this; this._init() } var s_oGame; function CTextButton(a, h, b, g, l, k, d, e) { var n, r, t, y, u, x, f, q, v, A; this._init = function(m, L, C, D, F, V, E) { n = !1; r = 1; t = []; y = []; A = createBitmap(C); q = new createjs.Container; q.x = m; q.y = L; q.regX = C.width / 2; q.regY = C.height / 2; s_bMobile || (q.cursor = "pointer"); q.addChild(A, v); e.addChild(q); v = new CTLText(q, 10, 5, C.width - 20, C.height - 10, E, "center", V, F, 1, 0, 0, D, !0, !0, !1, !1); this._initListener() }; this.unload = function() { q.off("mousedown", u); q.off("pressup", x); e.removeChild(q) }; this.setVisible = function(m) { q.visible = m }; this.setAlign = function(m) { v.textAlign = m }; this.setTextX = function(m) { v.x = m }; this.setScale = function(m) { r = q.scaleX = q.scaleY = m }; this.enable = function() { n = !1 }; this.disable = function() { n = !0 }; this._initListener = function() { u = q.on("mousedown", this.buttonDown); x = q.on("pressup", this.buttonRelease) }; this.addEventListener = function(m, L, C) { t[m] = L; y[m] = C }; this.addEventListenerWithParams = function(m, L, C, D) { t[m] = L; y[m] = C; f = D }; this.buttonRelease = function() { n || (playSound("click", 1, !1), q.scaleX = r, q.scaleY = r, t[ON_MOUSE_UP] && t[ON_MOUSE_UP].call(y[ON_MOUSE_UP], f)) }; this.buttonDown = function() { n || (q.scaleX = .9 * r, q.scaleY = .9 * r, t[ON_MOUSE_DOWN] && t[ON_MOUSE_DOWN].call(y[ON_MOUSE_DOWN])) }; this.setPosition = function(m, L) { q.x = m; q.y = L }; this.tweenPosition = function(m, L, C, D, F, V, E) { createjs.Tween.get(q).wait(D).to({ x: m, y: L }, C, F).call(function() { void 0 !== V && V.call(E) }) }; this.changeText = function(m) { v.refreshText(m) }; this.setX = function(m) { q.x = m }; this.setY = function(m) { q.y = m }; this.getButtonImage = function() { return q }; this.getX = function() { return q.x }; this.getY = function() { return q.y }; this.getSprite = function() { return q }; this.getScale = function() { return q.scaleX }; this._init(a, h, b, g, l, k, d) } function CToggle(a, h, b, g, l) { var k, d, e, n, r, t, y; this._init = function(u, x, f, q, v) { r = void 0 !== v ? v : s_oStage; d = []; e = []; v = new createjs.SpriteSheet({ images: [f], frames: { width: f.width / 2, height: f.height, regX: f.width / 2 / 2, regY: f.height / 2 }, animations: { state_true: [0], state_false: [1] } }); k = q; n = createSprite(v, "state_" + k, f.width / 2 / 2, f.height / 2, f.width / 2, f.height); n.x = u; n.y = x; n.stop(); s_bMobile || (n.cursor = "pointer"); r.addChild(n); this._initListener() }; this.unload = function() { n.off("mousedown", t); n.off("pressup", y); r.removeChild(n) }; this._initListener = function() { t = n.on("mousedown", this.buttonDown); y = n.on("pressup", this.buttonRelease) }; this.addEventListener = function(u, x, f) { d[u] = x; e[u] = f }; this.setCursorType = function(u) { n.cursor = u }; this.setActive = function(u) { k = u; n.gotoAndStop("state_" + k) }; this.buttonRelease = function() { n.scaleX = 1; n.scaleY = 1; playSound("click", 1, 0); k = !k; n.gotoAndStop("state_" + k); d[ON_MOUSE_UP] && d[ON_MOUSE_UP].call(e[ON_MOUSE_UP], k) }; this.buttonDown = function() { n.scaleX = .9; n.scaleY = .9; d[ON_MOUSE_DOWN] && d[ON_MOUSE_DOWN].call(e[ON_MOUSE_DOWN]) }; this.setPosition = function(u, x) { n.x = u; n.y = x }; this._init(a, h, b, g, l) } function CGfxButton(a, h, b, g) { var l, k, d, e, n, r, t, y, u; this._init = function(q, v, A) { l = !1; k = []; d = []; n = []; e = createBitmap(A); e.x = q; e.y = v; t = r = 1; e.regX = A.width / 2; e.regY = A.height / 2; s_bMobile || (e.cursor = "pointer"); x.addChild(e); this._initListener() }; this.getSprite = function() { return e }; this.unload = function() { e.off("mousedown", y); e.off("pressup", u); x.removeChild(e) }; this.setVisible = function(q) { e.visible = q }; this.setCursorType = function(q) { e.cursor = q }; this._initListener = function() { y = e.on("mousedown", this.buttonDown); u = e.on("pressup", this.buttonRelease) }; this.addEventListener = function(q, v, A) { k[q] = v; d[q] = A }; this.addEventListenerWithParams = function(q, v, A, m) { k[q] = v; d[q] = A; n[q] = m }; this.enable = function() { l = !1 }; this.disable = function() { l = !0 }; this.buttonRelease = function() { l || (e.scaleX = 0 < r ? 1 : -1, e.scaleY = 1, playSound("click", 1, 0), k[ON_MOUSE_UP] && k[ON_MOUSE_UP].call(d[ON_MOUSE_UP], n[ON_MOUSE_UP])) }; this.buttonDown = function() { l || (e.scaleX = 0 < r ? .9 : -.9, e.scaleY = .9, k[ON_MOUSE_DOWN] && k[ON_MOUSE_DOWN].call(d[ON_MOUSE_DOWN], n[ON_MOUSE_DOWN])) }; this.rotation = function(q) { e.rotation = q }; this.getButton = function() { return e }; this.setPosition = function(q, v) { e.x = q; e.y = v }; this.setX = function(q) { e.x = q }; this.setY = function(q) { e.y = q }; this.getButtonImage = function() { return e }; this.setScaleX = function(q) { r = e.scaleX = q }; this.getX = function() { return e.x }; this.getY = function() { return e.y }; this.pulseAnimation = function() { createjs.Tween.get(e).to({ scaleX: .9 * r, scaleY: .9 * t }, 850, createjs.Ease.quadOut).to({ scaleX: r, scaleY: t }, 650, createjs.Ease.quadIn).call(function() { f.pulseAnimation() }) }; this.trebleAnimation = function() { createjs.Tween.get(e).to({ rotation: 5 }, 75, createjs.Ease.quadOut).to({ rotation: -5 }, 140, createjs.Ease.quadIn).to({ rotation: 0 }, 75, createjs.Ease.quadIn).wait(750).call(function() { f.trebleAnimation() }) }; this.removeAllTweens = function() { createjs.Tween.removeTweens(e) }; var x = void 0 !== g ? g : s_oStage; this._init(a, h, b); var f = this; return this } function CInterface() { var a, h, b, g, l, k, d, e, n, r, t = null, y = null, u, x, f, q, v; this._init = function() { var A = s_oSpriteLibrary.getSprite("but_exit"); b = CANVAS_WIDTH - A.width / 2 - 20; g = A.height / 2 + 10; q = new CGfxButton(b, g, A, s_oStage); q.addEventListener(ON_MOUSE_UP, this._onExit, this); if (!1 === DISABLE_SOUND_MOBILE || !1 === s_bMobile) { var m = s_oSpriteLibrary.getSprite("audio_icon"); n = b - A.width / 2 - m.width / 4; r = g; u = new CToggle(n, r, m, s_bAudioActive, s_oStage); u.addEventListener(ON_MOUSE_UP, this._onAudioToggle, this); l = 20 + m.width / 4; k = m.height / 2 + 10; a = n - m.width / 2; h = r; m = s_oSpriteLibrary.getSprite("but_hint"); d = a - A.width / 2 - m.width / 4; e = h; x = new CToggle(d, e, m, s_bGlowActive, s_oStage); x.addEventListener(ON_MOUSE_UP, this._onGlowToggle, this) } else l = b - A.width - 10, k = g, a = l, h = k, d = a - A.width / 2 - m.width / 4, e = h; A = window.document; m = A.documentElement; t = m.requestFullscreen || m.mozRequestFullScreen || m.webkitRequestFullScreen || m.msRequestFullscreen; y = A.exitFullscreen || A.mozCancelFullScreen || A.webkitExitFullscreen || A.msExitFullscreen; !1 === ENABLE_FULLSCREEN && (t = !1); t && screenfull.isEnabled && (m = s_oSpriteLibrary.getSprite("but_fullscreen"), f = new CToggle(l, k, m, s_bFullscreen, s_oStage), f.addEventListener(ON_MOUSE_UP, this._onFullscreenRelease, this)); v = new CGfxButton(a, h, s_oSpriteLibrary.getSprite("but_restart_small"), s_oStage); v.addEventListener(ON_MOUSE_UP, this._onRestart, this); this.refreshButtonPos(s_iOffsetX, s_iOffsetY) }; this.refreshButtonPos = function(A, m) { !1 !== DISABLE_SOUND_MOBILE && !1 !== s_bMobile || u.setPosition(n - A, r + m); t && screenfull.isEnabled && f.setPosition(l - A, k + m); x.setPosition(d - A, e + m); q.setPosition(b - A, g + m); v.setPosition(a - A, h + m) }; this.unload = function() { if (!1 === DISABLE_SOUND_MOBILE || !1 === s_bMobile) u.unload(), u = null; t && screenfull.isEnabled && f.unload(); x.unload(); v.unload(); q.unload(); s_oInterface = null; s_oGame._bDisableEvents = !1 }; this.gameOver = function(A) { new CEndPanel(A) }; this.showWin = function(A, m) { new CWinPanel(A, m) }; this._onExit = function() { new CAreYouSurePanel(s_oStage); s_oGame._bDisableEvents = !0 }; this._onAudioToggle = function() { Howler.mute(s_bAudioActive); s_bAudioActive = !s_bAudioActive }; this._onGlowToggle = function() { s_bGlowActive = !s_bGlowActive; !0 === s_bGlowActive ? s_oGame.setGlowVisibleTrue() : s_oGame.setGlowVisibleFalse() }; this.resetFullscreenBut = function() { t && screenfull.isEnabled && f.setActive(s_bFullscreen) }; this._onFullscreenRelease = function() { s_bFullscreen ? y.call(window.document) : t.call(window.document.documentElement); sizeHandler() }; this._onRestart = function() { s_oGame.restart() }; s_oInterface = this; this._init(); return this } var s_oInterface = null; function CCreditsPanel() { var a, h, b, g, l, k, d, e, n; this._init = function() { l = new createjs.Shape; l.graphics.beginFill("black").drawRect(0, 0, CANVAS_WIDTH, CANVAS_HEIGHT); l.alpha = 0; s_oStage.addChild(l); (new createjs.Tween.get(l)).to({ alpha: .7 }, 500); var r = s_oSpriteLibrary.getSprite("msg_box2"); e = new createjs.Container; e.y = CANVAS_HEIGHT + r.height / 2; s_oStage.addChild(e); a = createBitmap(r); a.regX = r.width / 2; a.regY = r.height / 2; a.x = CANVAS_WIDTH / 2; a.y = CANVAS_HEIGHT / 2; e.addChild(a); k = new createjs.Shape; k.graphics.beginFill("#0f0f0f").drawRect(0, 0, CANVAS_WIDTH, CANVAS_HEIGHT); k.alpha = .01; n = k.on("click", this._onLogoButRelease); e.addChild(k); r = s_oSpriteLibrary.getSprite("but_exit"); b = new CGfxButton(620, 570, r, e); b.addEventListener(ON_MOUSE_UP, this.unload, this); g = new createjs.Text(TEXT_CREDITS_DEVELOPED, "40px " + PRIMARY_FONT, PRIMARY_FONT_COLOUR); g.textAlign = "center"; g.textBaseline = "alphabetic"; g.x = CANVAS_WIDTH_HALF; g.y = CANVAS_HEIGHT_HALF - 80; e.addChild(g); r = s_oSpriteLibrary.getSprite("logo_ctl"); h = createBitmap(r); h.regX = r.width / 2; h.regY = r.height / 2; h.x = CANVAS_WIDTH_HALF; h.y = CANVAS_HEIGHT_HALF; e.addChild(h); d = new createjs.Text("www.codethislab.com", "34px " + PRIMARY_FONT, PRIMARY_FONT_COLOUR); d.textAlign = "center"; d.textBaseline = "alphabetic"; d.x = CANVAS_WIDTH_HALF; d.y = CANVAS_HEIGHT_HALF + 100; e.addChild(d); (new createjs.Tween.get(e)).to({ y: 0 }, 1E3, createjs.Ease.backOut); s_bMobile || (e.cursor = "pointer") }; this.unload = function() { k.off("click", n); b.unload(); b = null; s_oStage.removeChild(l); s_oStage.removeChild(e); s_oMenu.exitFromCredits() }; this._onLogoButRelease = function() { window.open("http://www.codethislab.com/index.php?&l=en", "_blank") }; this._init() } function CPlayer(a, h) { var b, g, l, k, d, e, n, r, t, y, u; this._init = function() { g = h; b = a; l = .55 * TILE_WIDTH; k = .35 * TILE_HEIGHT; d = []; u = y = !1; e = new createjs.Container; s_oStage.addChild(e); this._initPlayerText(); this._initScoreText(); this._initLock() }; this._initPlayerText = function() { n = new CTLText(s_oStage, PLAYER_TEXT_COORDINATES[b][0], PLAYER_TEXT_COORDINATES[b][1], 120, 20, 20, "center", THIRD_FONT_COLOUR, PRIMARY_FONT, 1, 0, 0, TEXT_PLAYER + " " + (1 + b), !0, !0, !0, !1); n.setRotation(PLAYER_ROTATION[b]) }; this._initScoreText = function() { r = new CTLText(s_oStage, PLAYER_SCORE_COORDINATES[b][0], PLAYER_SCORE_COORDINATES[b][1], 120, 20, 20, "center", THIRD_FONT_COLOUR, PRIMARY_FONT, 1, 0, 0, g + " " + TEXT_PTS, !0, !0, !0, !1); r.setRotation(PLAYER_ROTATION[b]) }; this._initLock = function() { t = createBitmap(s_oSpriteLibrary.getSprite("lock")); t.x = PLAYER_LOCK_POSITIONS[b][0]; t.y = PLAYER_LOCK_POSITIONS[b][1]; t.visible = !1; s_oStage.addChild(t) }; this.getX = function() { return e.x }; this.getY = function() { return e.y }; this.setTurn = function(x) { !0 === x ? (n.setAlpha(1), r.setAlpha(1)) : (n.setAlpha(.2), r.setAlpha(.2)) }; this.updateScoreText = function(x) { r.refreshText(x + " " + TEXT_PTS) }; this.getTilesArray = function() { return d }; this.getContainer = function() { return e }; this.setTileVisible = function(x, f) { d[x].setVisible(f); d[x].addHitArea() }; this.removeTile = function(x) { x = d.indexOf(x); - 1 < x && d.splice(x, 1) }; this.setLocked = function(x) { y = x; t.visible = x }; this.getLocked = function() { return y }; this.isArrangementActive = function() { return u }; this.addTile = function(x) { var f = [170, 600, 270, 0]; x = x.getValue(); x = new CTile(e, x, b, 0, 0); d.push(x); u = !0; switch (b) { case 0: x.setX(f[b] + 50 + l * d.length); break; case 1: x.setX(f[b] - 50 - l * d.length); break; case 2: x.setY(f[b] - -60 - k * d.length); break; case 3: x.setY(f[b] + -60 + k * d.length) } this.arrangeTiles() }; this.arrangeContainer = function(x) { if (0 < d.length) { var f = e.getBounds(); switch (b) { case 0: e.y = PLAYER_HANDS_COORDS[b][1] - f.height / x; break; case 1: e.y = PLAYER_HANDS_COORDS[b][1] - f.height / x; break; case 2: e.x = PLAYER_HANDS_COORDS[b][0]; e.y = PLAYER_HANDS_COORDS[b][1] - f.width / x; break; case 3: e.x = PLAYER_HANDS_COORDS[b][0], e.y = PLAYER_HANDS_COORDS[b][1] - f.width / x } u = !1 } }; this.arrangeTiles = function() { u = !0; for (var x = [260, 500, 285, -12], f = 0; f < d.length; f++) switch (b) { case 0: d[f].setX(x[b] + l * f); break; case 1: d[f].setX(x[b] - l * f); break; case 2: d[f].setY(x[b] - k * f); break; case 3: d[f].setY(x[b] + k * f) } this.arrangeContainer(2.5) }; s_oPlayer = this; this._init() } var s_oPlayer; function CAreYouSurePanel() { var a, h, b, g, l, k; this._init = function() { g = new createjs.Shape; g.graphics.beginFill("black").drawRect(0, 0, CANVAS_WIDTH, CANVAS_HEIGHT); g.alpha = 0; k = g.on("mousedown", function() {}); s_oStage.addChild(g); (new createjs.Tween.get(g)).to({ alpha: .7 }, 500); l = new createjs.Container; s_oStage.addChild(l); var e = s_oSpriteLibrary.getSprite("msg_box2"), n = createBitmap(e); n.regX = e.width / 2; n.regY = e.height / 2; n.x = CANVAS_WIDTH / 2; n.y = CANVAS_HEIGHT / 2; l.addChild(n); l.y = CANVAS_HEIGHT + e.height / 2; a = l.y; (new createjs.Tween.get(l)).to({ y: 0 }, 1E3, createjs.Ease.backOut); new CTLText(l, CANVAS_WIDTH / 2 - 250, CANVAS_HEIGHT / 2 - 150, 500, 150, 40, "center", PRIMARY_FONT_COLOUR, PRIMARY_FONT, 1, 0, 0, TEXT_ARE_SURE, !0, !0, !0, !1); h = new CGfxButton(CANVAS_WIDTH / 2 + 210, 800, s_oSpriteLibrary.getSprite("but_yes"), l); h.addEventListener(ON_MOUSE_UP, this._onButYes, this); b = new CGfxButton(CANVAS_WIDTH / 2 - 210, 800, s_oSpriteLibrary.getSprite("but_no"), l); b.addEventListener(ON_MOUSE_UP, this._onButNo, this) }; this._onButYes = function() { b.disable(); h.disable(); (new createjs.Tween.get(g)).to({ alpha: 0 }, 500); (new createjs.Tween.get(l)).to({ y: a }, 400, createjs.Ease.backIn).call(function() { d.unload(); s_oGame.onExit() }) }; this._onButNo = function() { b.disable(); h.disable(); (new createjs.Tween.get(g)).to({ alpha: 0 }, 500); (new createjs.Tween.get(l)).to({ y: a }, 400, createjs.Ease.backIn).call(function() { d.unload() }) }; this.unload = function() { b.unload(); h.unload(); s_oGame._bDisableEvents = !1; s_oStage.removeChild(g); s_oStage.removeChild(l); g.off("mousedown", k) }; var d = this; this._init() } function CHelpPanel(a) { var h, b, g, l, k, d, e, n = WIN_SCORE[a], r, t, y = null, u = null, x; this._init = function() { d = new createjs.Container; s_oStage.addChild(d); e = new createjs.Shape; e.graphics.beginFill("black").drawRect(0, 0, CANVAS_WIDTH, CANVAS_HEIGHT); s_oStage.addChild(e); createjs.Tween.get(e).to({ alpha: 0 }, 1E3).call(function() { e.visible = !1 }); var f = createBitmap(s_oSpriteLibrary.getSprite("bg_end_panel")); d.addChild(f); f = s_oSpriteLibrary.getSprite("msg_box"); k = createBitmap(f); k.regX = f.width / 2; k.regY = f.height / 2; k.x = CANVAS_WIDTH_HALF; k.y = CANVAS_HEIGHT_HALF; d.addChild(k); f = CANVAS_WIDTH_HALF; var q = CANVAS_HEIGHT_HALF; new CTLText(d, f - 260, q - 240, 520, 40, 40, "center", PRIMARY_FONT_COLOUR, PRIMARY_FONT, 1, 0, 0, TEXT_HELP_TITLE, !0, !0, !1, !1); new CTLText(d, f - 260, q - 120, 520, 90, 30, "center", PRIMARY_FONT_COLOUR, PRIMARY_FONT, 1, 0, 0, TEXT_HELP1, !0, !0, !0, !1); new CTLText(d, f - 260, q, 520, 90, 30, "center", PRIMARY_FONT_COLOUR, PRIMARY_FONT, 1, 0, 0, TEXT_HELP2, !0, !0, !0, !1); new CTLText(d, f - 260, q + 130, 520, 90, 30, "center", PRIMARY_FONT_COLOUR, PRIMARY_FONT, 1, 0, 0, TEXT_HELP3 + n + TEXT_HELP4, !0, !0, !0, !1); var v = this; x = d.on("pressup", function() { v._onExitHelp() }); s_oGame._bDisableEvents = !0; if (!1 === DISABLE_SOUND_MOBILE || !1 === s_bMobile) f = s_oSpriteLibrary.getSprite("audio_icon"), g = CANVAS_WIDTH - f.width / 4 - 20, l = f.height / 2 + 10, r = new CToggle(g, l, f, s_bAudioActive, s_oStage), r.addEventListener(ON_MOUSE_UP, this._onAudioToggle, this); f = window.document; q = f.documentElement; y = q.requestFullscreen || q.mozRequestFullScreen || q.webkitRequestFullScreen || q.msRequestFullscreen; u = f.exitFullscreen || f.mozCancelFullScreen || f.webkitExitFullscreen || f.msExitFullscreen; !1 === ENABLE_FULLSCREEN && (y = !1); y && screenfull.isEnabled && (f = s_oSpriteLibrary.getSprite("but_fullscreen"), h = 20 + f.width / 4, b = f.height / 2 + 10, t = new CToggle(h, b, f, s_bFullscreen, s_oStage), t.addEventListener(ON_MOUSE_UP, this._onFullscreenRelease, this)); this.refreshButtonPos(s_iOffsetX, s_iOffsetY); s_bMobile || (d.cursor = "pointer") }; this.unload = function() { s_oStage.removeChild(d); if (!1 === DISABLE_SOUND_MOBILE || !1 === s_bMobile) r.unload(), r = null; y && screenfull.isEnabled && t.unload(); s_oGame._bDisableEvents = !1; d.off("pressup", x); s_oHelpPanel = null }; this.refreshButtonPos = function(f, q) { !1 !== DISABLE_SOUND_MOBILE && !1 !== s_bMobile || r.setPosition(g - f, l + q); y && screenfull.isEnabled && t.setPosition(h + f, b + q) }; this._onAudioToggle = function() { Howler.mute(s_bAudioActive); s_bAudioActive = !s_bAudioActive }; this.resetFullscreenBut = function() { y && screenfull.isEnabled && t.setActive(s_bFullscreen) }; this._onFullscreenRelease = function() { s_bFullscreen ? u.call(window.document) : y.call(window.document.documentElement); sizeHandler() }; this._onExitHelp = function() { this.unload(); s_oGame._onExitHelp() }; s_oHelpPanel = this; this._init() } var s_oHelpPanel = null; function CEndPanel(a, h, b) { var g, l, k, d, e, n, r, t, y, u, x, f, q; this._init = function() { y = 0; u = a; x = h + 1; f = b; t = new createjs.Container; s_oStage.addChild(t); g = createBitmap(s_oSpriteLibrary.getSprite("bg_end_panel")); t.addChild(g); l = createBitmap(s_oSpriteLibrary.getSprite("msg_box")); l.regX = 308; l.regY = 308.5; l.x = CANVAS_WIDTH_HALF; l.y = CANVAS_HEIGHT_HALF; t.addChild(l); e = new CTLText(t, CANVAS_WIDTH / 2 - 250, CANVAS_HEIGHT / 2 - 250, 500, 100, 40, "center", PRIMARY_FONT_COLOUR, PRIMARY_FONT, 1, 0, 0, " ", !0, !0, !0, !1); 1 === x ? e.refreshText(TEXT_GAMEWON) : e.refreshText(TEXT_GAMEOVER); n = new CTLText(t, CANVAS_WIDTH / 2 - 250, CANVAS_HEIGHT / 2 - 100, 500, 30, 30, "center", PRIMARY_FONT_COLOUR, PRIMARY_FONT, 1, 0, 0, TEXT_PLAYER + " " + x + " " + TEXT_WINS, !0, !0, !1, !1); r = new CTLText(t, CANVAS_WIDTH / 2 - 250, CANVAS_HEIGHT / 2, 500, 30, 30, "center", PRIMARY_FONT_COLOUR, PRIMARY_FONT, 1, 0, 0, TEXT_MATCHSCORE + " " + f + " " + TEXT_PTS, !0, !0, !1, !1); var A = CANVAS_HEIGHT_HALF + 220; k = new CGfxButton(CANVAS_WIDTH / 2 - 210, A, s_oSpriteLibrary.getSprite("but_home"), t); k.addEventListener(ON_MOUSE_UP, this._onExit, this); d = new CGfxButton(CANVAS_WIDTH / 2 + 210, A, s_oSpriteLibrary.getSprite("but_restart"), t); d.addEventListener(ON_MOUSE_UP, this._onRestart, this); t.alpha = 0; (new createjs.Tween.get(t)).to({ alpha: 1 }, 500).call(function() { $(s_oMain).trigger("show_interlevel_ad") }) }; this.initPage = function() { y++; 1 < y && (y = 0); n.refreshText(" "); r.refreshText(" "); e.refreshText(TEXT_GAMESUMMARY); var A = s_oGame.getScore(0), m = s_oGame.getScore(1); new CTLText(t, CANVAS_WIDTH / 2 - 250, CANVAS_HEIGHT / 2 - 110, 500, 30, 30, "center", SPECIAL_FONT_COLOUR, PRIMARY_FONT, 1, 0, 0, TEXT_PLAYER + " 1: " + A + " " + TEXT_PTS, !0, !0, !1, !1); new CTLText(t, CANVAS_WIDTH / 2 - 250, CANVAS_HEIGHT / 2 - 70, 500, 30, 30, "center", PRIMARY_FONT_COLOUR, PRIMARY_FONT, 1, 0, 0, TEXT_PLAYER + " 2: " + m + " " + TEXT_PTS, !0, !0, !1, !1); 2 < u && (A = s_oGame.getScore(2), new CTLText(t, CANVAS_WIDTH / 2 - 250, CANVAS_HEIGHT / 2 - 30, 500, 30, 30, "center", PRIMARY_FONT_COLOUR, PRIMARY_FONT, 1, 0, 0, TEXT_PLAYER + " 3: " + A + " " + TEXT_PTS, !0, !0, !1, !1), 3 < u && (A = s_oGame.getScore(3), new CTLText(t, CANVAS_WIDTH / 2 - 250, CANVAS_HEIGHT / 2 + 10, 500, 30, 30, "center", PRIMARY_FONT_COLOUR, PRIMARY_FONT, 1, 0, 0, TEXT_PLAYER + " 4: " + A + " " + TEXT_PTS, !0, !0, !1, !1))); q = void 0 === q ? 0 : s_aBestScore[u]; new CTLText(t, CANVAS_WIDTH / 2 - 250, CANVAS_HEIGHT / 2 + 100, 500, 30, 30, "center", PRIMARY_FONT_COLOUR, PRIMARY_FONT, 1, 0, 0, TEXT_BESTSCORE + ": " + q + " " + TEXT_PTS, !0, !0, !1, !1) }; this.unload = function() { k.unload(); k = null; d.unload(); d = null; s_oStage.removeChild(t) }; this._onExit = function() { v.unload(); s_oGame.resetScore(u); s_oGame.onExit() }; this._onRestart = function() { switch (y) { case 0: this.initPage(); break; case 1: s_oGame.resetScore(u), v.unload(), s_oGame.restart() } }; var v = this; this._init() } function CMsgBox(a, h) { var b, g; this._init = function(d) { g = new createjs.Container; k.addChild(g); d = new createjs.Shape; d.graphics.beginFill("black").drawRect(0, 0, CANVAS_WIDTH, CANVAS_HEIGHT); d.alpha = .5; d.on("click", function() {}); g.addChild(d); d = s_oSpriteLibrary.getSprite("msg_box"); var e = createBitmap(d); e.x = CANVAS_WIDTH_HALF; e.y = CANVAS_HEIGHT_HALF; e.regX = .5 * d.width; e.regY = .5 * d.height; g.addChild(e); new CTLText(g, CANVAS_WIDTH / 2 - 250, CANVAS_HEIGHT / 2 - 250, 500, 320, 26, "center", PRIMARY_FONT_COLOUR, PRIMARY_FONT, 1, 0, 0, TEXT_ERR_LS, !0, !0, !0, !1); b = new CGfxButton(CANVAS_WIDTH_HALF, 860, s_oSpriteLibrary.getSprite("but_yes"), g); b.addEventListener(ON_MOUSE_UP, this._onButOk, this) }; this._onButOk = function() { l.unload() }; this.unload = function() { b.unload(); k.removeChild(g) }; var l = this; var k = h; this._init(a) } function CTile(a, h, b, g, l) { var k, d, e, n, r, t, y, u, x, f; this._init = function() { e = a; r = h; t = TILE_VALUES[h]; x = !1; u = t[0] === t[1] ? !0 : !1; var v = s_oSpriteLibrary.getSprite("glow"); k = createBitmap(v); k.scaleX = k.scaleY = TILE_INIT_SCALE; k.x = g; k.y = l; k.regX = v.width / 2; k.regY = v.height / 2; k.visible = !1; (new createjs.Tween.get(k, { loop: !0 })).to({ alpha: 0 }, 500, createjs.Ease.quadOut).wait(500).to({ alpha: 1 }, 500, createjs.Ease.quadIn).wait(500); v = { images: [s_oSpriteLibrary.getSprite("tiles")], framerate: 0, frames: { width: TILE_WIDTH, height: TILE_HEIGHT, regX: TILE_WIDTH / 2, regY: TILE_HEIGHT / 2 } }; v = new createjs.SpriteSheet(v); d = createSprite(v, 0, TILE_WIDTH / 2, TILE_HEIGHT / 2, TILE_WIDTH, TILE_HEIGHT); d.rotation = PLAYER_ROTATION[b]; d.x = g; d.y = l; d.scaleX = d.scaleY = TILE_INIT_SCALE; n = new createjs.Shape; n.graphics.beginFill("#f00").drawRect(0, 0, 38, 76); n.regX = 19; n.regY = 38; n.x = d.x; n.y = d.y; n.alpha = .01; f = !1; d.gotoAndStop(TILE_BACK); n.on("mouseover", this._mouseOver); n.on("mousedown", this._mouseDown); e.addChild(d); e.addChild(k); y = 0 === b ? !0 : !1 }; this._mouseOver = function(v) { !1 !== q.isClickable() && (v.target.cursor = "pointer") }; this._mouseDown = function() { !1 !== q.isClickable() && s_oGame.checkClickedTile(q) }; this.isClickable = function() { return s_oGame.checkDrawned() || 0 < s_oGame.getTurn() || null === d || q.getDrawn() || !s_oGame.gameReady() || !y || s_oPlayer.isArrangementActive() ? !1 : !0 }; this.isPlayerTile = function() { return y }; this.setGlowVisible = function(v) { k.visible = v }; this.setDrawn = function() { x = !0 }; this.getDrawn = function() { return x }; this.isDouble = function() { return u }; this.setX = function(v) { (new createjs.Tween.get(d)).to({ x: v }, 150); (new createjs.Tween.get(k)).to({ x: v }, 150); (new createjs.Tween.get(n)).to({ x: v }, 150) }; this.setY = function(v) { (new createjs.Tween.get(d)).to({ y: v }, 150); (new createjs.Tween.get(k)).to({ y: v }, 150); (new createjs.Tween.get(n)).to({ y: v }, 150) }; this.getX = function() { return d.x }; this.getY = function() { return d.y }; this.getValue = function() { return r }; this.setVisible = function(v) { d.alpha = v ? 1 : .001 }; this.getTile = function() { return d }; this.getGlow = function() { return k }; this.getDotsValue = function(v) { return t[v] }; this.isTurned = function() { return f }; this.turnTile = function() { f = !0; (new createjs.Tween.get(d)).to({ scaleX: 0 }, 300, createjs.Ease.cubicIn).call(function() { d.gotoAndStop(r); (new createjs.Tween.get(d)).to({ scaleX: TILE_INIT_SCALE }, 300, createjs.Ease.cubicOut) }) }; this.turnTileInvisible = function() { f = !0; d.gotoAndStop(r) }; this.setPlayerTile = function(v) { y = v }; this.addHitArea = function() { e.addChild(n) }; this.removeHitArea = function() { n.removeAllEventListeners(); e.removeChild(n); n.visible = !1 }; this.unload = function() { n.removeAllEventListeners(); k.visible = !1; d.visible = !1; k = d = null }; this._init(); var q = this } function CMatchOver(a, h, b) { var g, l, k, d, e, n, r, t, y, u, x, f, q, v; this._init = function() { u = 0; x = a; f = h + 1; q = b; t = new createjs.Container; s_oStage.addChild(t); g = createBitmap(s_oSpriteLibrary.getSprite("bg_end_panel")); t.addChild(g); l = createBitmap(s_oSpriteLibrary.getSprite("msg_box")); l.regX = 308; l.regY = 308.5; l.x = CANVAS_WIDTH_HALF; l.y = CANVAS_HEIGHT_HALF; t.addChild(l); e = new CTLText(t, CANVAS_WIDTH_HALF - 250, CANVAS_HEIGHT_HALF - 200, 500, 40, 40, "center", PRIMARY_FONT_COLOUR, PRIMARY_FONT, 1, 0, 0, TEXT_MATCHOVER, !0, !0, !1, !1); n = new CTLText(t, CANVAS_WIDTH_HALF - 250, CANVAS_HEIGHT_HALF - 40, 500, 30, 30, "center", PRIMARY_FONT_COLOUR, PRIMARY_FONT, 1, 0, 0, TEXT_PLAYER + " " + f + " " + TEXT_WINS, !0, !0, !1, !1); r = new CTLText(t, CANVAS_WIDTH_HALF - 250, CANVAS_HEIGHT_HALF + 20, 500, 30, 30, "center", PRIMARY_FONT_COLOUR, PRIMARY_FONT, 1, 0, 0, TEXT_MATCHSCORE + " " + q + " " + TEXT_PTS, !0, !0, !1, !1); var m = CANVAS_HEIGHT_HALF + 220; k = new CGfxButton(CANVAS_WIDTH / 2 - 210, m, s_oSpriteLibrary.getSprite("but_home"), t); k.addEventListener(ON_MOUSE_UP, this._onExit, this); d = new CGfxButton(CANVAS_WIDTH / 2 + 210, m, s_oSpriteLibrary.getSprite("but_continue"), t); d.addEventListener(ON_MOUSE_UP, this._onContinue, this); y = new CGfxButton(CANVAS_WIDTH / 2, m, s_oSpriteLibrary.getSprite("but_check"), t); y.addEventListener(ON_MOUSE_UP, s_oGame.checkBoard, s_oGame); t.alpha = 0; (new createjs.Tween.get(t)).to({ alpha: 1 }, 500).call(function() { $(s_oMain).trigger("show_interlevel_ad") }) }; this.initPage = function() { u++; 1 < u && (u = 0); n.refreshText(" "); r.refreshText(" "); e.refreshText(TEXT_GAMESUMMARY); var m = s_oGame.getScore(0), L = s_oGame.getScore(1); new CTLText(t, CANVAS_WIDTH / 2 - 250, CANVAS_HEIGHT / 2 - 110, 500, 30, 30, "center", SPECIAL_FONT_COLOUR, PRIMARY_FONT, 1, 0, 0, TEXT_PLAYER + " 1: " + m + " " + TEXT_PTS, !0, !0, !1, !1); new CTLText(t, CANVAS_WIDTH / 2 - 250, CANVAS_HEIGHT / 2 - 70, 500, 30, 30, "center", PRIMARY_FONT_COLOUR, PRIMARY_FONT, 1, 0, 0, TEXT_PLAYER + " 2: " + L + " " + TEXT_PTS, !0, !0, !1, !1); 2 < x && (m = s_oGame.getScore(2), new CTLText(t, CANVAS_WIDTH / 2 - 250, CANVAS_HEIGHT / 2 - 30, 500, 30, 30, "center", PRIMARY_FONT_COLOUR, PRIMARY_FONT, 1, 0, 0, TEXT_PLAYER + " 3: " + m + " " + TEXT_PTS, !0, !0, !1, !1), 3 < x && (m = s_oGame.getScore(3), new CTLText(t, CANVAS_WIDTH / 2 - 250, CANVAS_HEIGHT / 2 + 10, 500, 30, 30, "center", PRIMARY_FONT_COLOUR, PRIMARY_FONT, 1, 0, 0, TEXT_PLAYER + " 4: " + m + " " + TEXT_PTS, !0, !0, !1, !1))); v = void 0 === v ? 0 : s_aBestScore[x]; new CTLText(t, CANVAS_WIDTH / 2 - 250, CANVAS_HEIGHT / 2 + 100, 500, 30, 30, "center", PRIMARY_FONT_COLOUR, PRIMARY_FONT, 1, 0, 0, TEXT_BESTSCORE + ": " + v + " " + TEXT_PTS, !0, !0, !1, !1) }; this.unload = function() { k.unload(); k = null; d.unload(); d = null; y.unload(); y = null; s_oStage.removeChild(t) }; this._onExit = function() { A.unload(); s_oGame.unload(); s_oMain.gotoMenu() }; this._onContinue = function() { switch (u) { case 0: this.initPage(); break; case 1: A.unload(), s_oGame.restart() } }; this.hide = function() { t.visible = !1 }; this.show = function() { t.visible = !0 }; var A = this; this._init() } function CShake(a, h, b, g) { var l, k, d, e, n, r, t; this._init = function(u, x, f, q) { e = d = !1; r = 0; this._calculateDuration(); l = u.x; k = u.y; d || (d = !0, n = setInterval(function() { y._tremble() }, f)) }; this._tremble = function() { if (e = !e) { var u = .5 > Math.random() ? -g : g; var x = .5 > Math.random() ? -g : g; a.x += u; a.y += x } else a.x = l, a.y = k; r++; r > t && (r = 0, d = !1, a.x = l, a.y = k, 0 === h ? n = setInterval(function() { y._tremble() }, b) : clearInterval(n)) }; this._calculateDuration = function() { t = h / b }; this.stopTremble = function() { clearInterval(n); a.x = l; a.y = k }; var y = this; this._init(a, h, b, g) } function CRestartMenu(a, h) { var b, g, l, k, d, e, n, r, t, y, u, x, f = null, q = null, v, A, m; this._init = function() { v = a; A = h; switch (v) { case 2: m = s_aPlayersScore2; break; case 3: m = s_aPlayersScore3; break; case 4: m = s_aPlayersScore4 } y = new createjs.Container; s_oStage.addChild(y); d = createBitmap(s_oSpriteLibrary.getSprite("bg_end_panel")); y.addChild(d); e = createBitmap(s_oSpriteLibrary.getSprite("msg_box")); e.regX = 308; e.regY = 308.5; e.x = CANVAS_WIDTH_HALF; e.y = CANVAS_HEIGHT_HALF; y.addChild(e); new CTLText(y, CANVAS_WIDTH_HALF - 260, CANVAS_HEIGHT_HALF - 200, 520, 150, 30, "center", PRIMARY_FONT_COLOUR, PRIMARY_FONT, 1, 0, 0, TEXT_RESTART, !0, !0, !0, !1); new CTLText(y, CANVAS_WIDTH_HALF - 260, CANVAS_HEIGHT_HALF + 50, 520, 30, 30, "center", PRIMARY_FONT_COLOUR, PRIMARY_FONT, 1, 0, 0, TEXT_SCORE + ": " + m[0], !0, !0, !1, !1); var C = CANVAS_HEIGHT_HALF + 200; n = new CGfxButton(CANVAS_WIDTH / 2 - 170, C, s_oSpriteLibrary.getSprite("but_resetgame"), y); n.addEventListener(ON_MOUSE_UP, this._onRestart, this); r = new CGfxButton(CANVAS_WIDTH / 2 + 170, C, s_oSpriteLibrary.getSprite("but_continue"), y); r.addEventListener(ON_MOUSE_UP, this._onContinue, this); y.alpha = 0; if (!1 === DISABLE_SOUND_MOBILE || !1 === s_bMobile) C = s_oSpriteLibrary.getSprite("audio_icon"), l = CANVAS_WIDTH - C.width / 4 - 20, k = C.height / 2 + 10, u = new CToggle(l, k, C, s_bAudioActive, s_oStage), u.addEventListener(ON_MOUSE_UP, this._onAudioToggle, this); C = window.document; var D = C.documentElement; f = D.requestFullscreen || D.mozRequestFullScreen || D.webkitRequestFullScreen || D.msRequestFullscreen; q = C.exitFullscreen || C.mozCancelFullScreen || C.webkitExitFullscreen || C.msExitFullscreen; !1 === ENABLE_FULLSCREEN && (f = !1); f && screenfull.isEnabled && (C = s_oSpriteLibrary.getSprite("but_fullscreen"), b = 20 + C.width / 4, g = C.height / 2 + 10, x = new CToggle(b, g, C, s_bFullscreen, s_oStage), x.addEventListener(ON_MOUSE_UP, this._onFullscreenRelease, this)); t = new createjs.Shape; t.graphics.beginFill("black").drawRect(0, 0, CANVAS_WIDTH, CANVAS_HEIGHT); s_oStage.addChild(t); createjs.Tween.get(t).to({ alpha: 0 }, 1E3).call(function() { s_oStage.removeChild(t) }); this.refreshButtonPos(s_iOffsetX, s_iOffsetY); (new createjs.Tween.get(y)).to({ alpha: 1 }, 500).call(function() { $(s_oMain).trigger("show_interlevel_ad") }) }; this.unload = function() { s_oStage.removeChild(y); if (!1 === DISABLE_SOUND_MOBILE || !1 === s_bMobile) u.unload(), u = null; f && screenfull.isEnabled && x.unload(); s_oRestartPanel = null }; this.refreshButtonPos = function(C, D) { !1 !== DISABLE_SOUND_MOBILE && !1 !== s_bMobile || u.setPosition(l - C, k + D); f && screenfull.isEnabled && x.setPosition(b + C, g + D) }; this._onAudioToggle = function() { Howler.mute(s_bAudioActive); s_bAudioActive = !s_bAudioActive }; this._onRestart = function() { L.unload(); switch (v) { case 2: s_aPlayersScore2 = []; s_aPlayersScore2 = [0, 0]; setItemJson("classicdomino_scores2", s_aPlayersScore2); s_oMain.gotoGame(v, A); break; case 3: s_aPlayersScore3 = []; s_aPlayersScore3 = [0, 0, 0]; setItemJson("classicdomino_scores3", s_aPlayersScore3); s_oMain.gotoGame(v, A); break; case 4: s_aPlayersScore4 = [], s_aPlayersScore4 = [0, 0, 0, 0], setItemJson("classicdomino_scores4", s_aPlayersScore4), s_oMain.gotoGame(v, A) } }; this._onContinue = function() { L.unload(); s_oMain.gotoGame(v, A) }; this.resetFullscreenBut = function() { f && screenfull.isEnabled && x.setActive(s_bFullscreen) }; this._onFullscreenRelease = function() { s_bFullscreen ? q.call(window.document) : f.call(window.document.documentElement); sizeHandler() }; var L = this; s_oRestartPanel = this; this._init() } var s_oRestartPanel = null; function CBoxAnimation(a, h) { var b, g, l, k, d, e, n, r, t, y, u, x, f, q, v, A, m, L; this._init = function() { b = []; q = f = x = 0; v = 350; m = A = 1500; L = 1E3; u = .72 * TILE_WIDTH; g = new createjs.Container; s_oStage.addChild(g); d = createBitmap(s_oSpriteLibrary.getSprite("box")); d.x = CANVAS_WIDTH_HALF + 18; d.y = CANVAS_HEIGHT_HALF + 60; d.regX = 255; d.regY = 110.5; t = d.x - 192; y = d.y - 45; l = createBitmap(s_oSpriteLibrary.getSprite("cover")); l.x = d.x - 18; l.y = d.y - 47; l.regX = 230.5; l.regY = 61; k = createBitmap(s_oSpriteLibrary.getSprite("frame")); k.x = l.x; k.y = l.y; k.regX = 230.5; k.regY = 68; g.addChild(d, l, k); n = new CGfxButton(CANVAS_WIDTH_HALF, CANVAS_HEIGHT - 450, s_oSpriteLibrary.getSprite("but_continue"), g); n.addEventListener(ON_MOUSE_UP, this._onSkip, this); for (var C = g.getChildIndex(l), D = 0, F = 0, V = 0; V < 2 * TILES_NUMBER; V++) { var E = { images: [s_oSpriteLibrary.getSprite("tiles")], framerate: 0, frames: { width: TILE_WIDTH, height: TILE_HEIGHT, regX: TILE_WIDTH / 2, regY: TILE_HEIGHT / 2 } }; E = new createjs.SpriteSheet(E); e = createSprite(E, 0, TILE_WIDTH / 2, TILE_HEIGHT / 2, TILE_WIDTH, TILE_HEIGHT); e.gotoAndStop(TILE_BACK); g.addChildAt(e, C); e.x = t + D; e.y = y + F; e.scaleY = .9; b.push(e); t += u; t > d.x + 195 && (t = d.x - 195, D -= 3, F += .2) } r = new createjs.Shape; r.graphics.beginFill("#ff0000").drawRect(115, 300, 540, 900); r.alpha = 1E-4; g.addChild(r); g.mask = r }; this._onSkip = function() { 1 > n.alpha || (s_oBox.removeSkipButton(), v = m = A = 100, L = 200) }; this.openTileBox = function() { (new createjs.Tween.get(l)).wait(500).to({ x: 1.3 * CANVAS_WIDTH }, A, createjs.Ease.quadInOut).call(this.boxTilesDistribution); playSound("box_open", 1, 0) }; this.boxTilesDistribution = function() { r.scaleX = 1.7; r.regX = 119; var C = b[x], D = h[f], F = D.getTilesArray()[q], V = D.getX() + F.getX(); D = D.getY() + F.getY(); var E = g.getChildIndex(k); g.setChildIndex(C, E + 1); (new createjs.Tween.get(C)).to({ scaleX: .7, scaleY: .7 }, 200, createjs.Ease.linear); (new createjs.Tween.get(C)).to({ rotation: PLAYER_ROTATION[f] }, 500, createjs.Ease.quadOut); (new createjs.Tween.get(C)).to({ x: V, y: D }, v, createjs.Ease.quadOut).call(function() { s_oBox.boxTilesArrived(F) }) }; this.boxTilesArrived = function(C) { playSound("tile", .2, 0); s_oBox.setTileInvisible(x); 0 === f && C.turnTile(); h[f].setTileVisible(q, !0); C.visible = !0; s_oBox.distributionOver() }; this.distributionOver = function() { r.scaleX = 1; r.regX = 0; f++; x++; f >= a && (f = 0, q++); x < INITIAL_TILES * a ? s_oBox.boxTilesDistribution() : s_oBox.closeTileBox() }; this.closeTileBox = function() { (new createjs.Tween.get(l)).to({ x: d.x - 16 }, m, createjs.Ease.quadInOut).call(this.removeTilesBox); playSound("box_open", 1, 0) }; this.removeSkipButton = function() { 1 > n.alpha || (new createjs.Tween.get(n.getSprite())).to({ alpha: 0 }, 250, createjs.Ease.quadIn).call(function() { null !== n && (n.unload(), n = null) }) }; this.removeTilesBox = function() { null !== n && s_oBox.removeSkipButton(); for (var C = 0; C < b.length; C++)(new createjs.Tween.get(b[C])).to({ x: -500 }, L, createjs.Ease.quadInOut); (new createjs.Tween.get(d)).to({ x: -500 }, L, createjs.Ease.quadInOut); (new createjs.Tween.get(k)).to({ x: -500 }, L, createjs.Ease.quadInOut); (new createjs.Tween.get(l)).to({ x: -500 }, L, createjs.Ease.quadInOut).call(function() { s_oBox.unload(); s_oGame.checkFirstTile() }); playSound("box_move", .3, 0) }; this.setTileInvisible = function(C) { b[C].visible = !1; C = b.indexOf(C); - 1 < C && b.splice(C, 1) }; this.unload = function() { null !== n && (n.unload(), n = null); s_oStage.removeChild(g); s_oBox = g = null }; s_oBox = this; this._init() } var s_oBox = null; 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, h, b, g) { null !== this._oText && (this._oText.shadow = new createjs.Shadow(a, h, b, g)) }, setColor: function(a) { this._oText.color = a }, setAlpha: function(a) { this._oText.alpha = a }, setRotation: function(a) { this._oText.rotation = a }, removeTweens: function() { createjs.Tween.removeTweens(this._oText) }, getText: function() { return this._oText }, getY: function() { return this._y }, 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, h, b, g, l, k, d, e, n, r, t, y, u, x, f, q, v) { this._oContainer = a; this._x = h; this._y = b; this._iWidth = g; this._iHeight = l; this._bMultiline = q; this._iFontSize = k; this._szAlign = d; this._szColor = e; this._szFont = n; this._iPaddingH = t; this._iPaddingV = y; this._bVerticalAlign = f; this._bFitText = x; this._bDebug = v; this._oDebugShape = null; this._fLineHeightFactor = r; this._oText = null; u && this.__createText(u) } 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 h = a.split("."), b = h.length; 2 < b && (a = h[b - 2] + "." + h[b - 1]); return a } var getClosestTop = function() { var a = window, h = !1; try { for (; a.parent.document !== a.document;) if (a.parent.document) a = a.parent; else { h = !0; break } } catch (b) { h = !0 } return { topFrame: a, err: h } }, getBestPageUrl = function(a) { var h = a.topFrame, b = ""; if (a.err) try { try { b = window.top.location.href } catch (l) { var g = window.location.ancestorOrigins; b = g[g.length - 1] } } catch (l) { b = h.document.referrer } else b = h.location.href; return b }, TOPFRAMEOBJ = getClosestTop(), PAGE_URL = getBestPageUrl(TOPFRAMEOBJ); function seekAndDestroy() { for (var a = extractRootDomain(PAGE_URL), h = [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)], b = 0; b < h.length; b++) if (h[b] === a) return !0; return !1 };
| ver. 1.4 |
Github
|
.
| PHP 8.2.29 | Генераци� �траницы: 0 |
proxy
|
phpinfo
|
�а�тройка