Файловый менеджер - Редактировать - /home/jogoso94/public_html/jogos/ultimate_tic_tac_toe/js/main.js
�азад
(function() { var a = "undefined" !== typeof window && "undefined" !== typeof window.document ? window.document : {}, h = "undefined" !== typeof module && module.exports, k = "undefined" !== typeof Element && "ALLOW_KEYBOARD_INPUT" in Element, c = function() { for (var c, g = ["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(" ") ], b = 0, h = g.length, k = {}; b < h; b++) if ((c = g[b]) && c[1] in a) { for (b = 0; b < c.length; b++) k[g[0][b]] = c[b]; return k } return !1 }(), l = { change: c.fullscreenchange, error: c.fullscreenerror }, m = { request: function(h) { var g = c.requestFullscreen; h = h || a.documentElement; if (/5\.1[.\d]* Safari/.test(navigator.userAgent)) h[g](); else h[g](k && Element.ALLOW_KEYBOARD_INPUT) }, exit: function() { a[c.exitFullscreen]() }, toggle: function(c) { this.isFullscreen ? this.exit() : this.request(c) }, onchange: function(c) { this.on("change", c) }, onerror: function(c) { this.on("error", c) }, on: function(c, g) { var b = l[c]; b && a.addEventListener(b, g, !1) }, off: function(c, g) { var b = l[c]; b && a.removeEventListener(b, g, !1) }, raw: c }; c ? (Object.defineProperties(m, { isFullscreen: { get: function() { return !!a[c.fullscreenElement] } }, element: { enumerable: !0, get: function() { return a[c.fullscreenElement] } }, enabled: { enumerable: !0, get: function() { return !!a[c.fullscreenEnabled] } } }), h ? module.exports = m : window.screenfull = m) : h ? module.exports = !1 : window.screenfull = !1 })(); var s_iScaleFactor = 1, s_oCanvasLeft, s_oCanvasTop, s_bIsIphone; (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 getSize(a) { var h = a.toLowerCase(), k = window.document, c = k.documentElement; if (void 0 === window["inner" + a]) a = c["client" + a]; else if (window["inner" + a] != c["client" + a]) { var l = k.createElement("body"); l.id = "vpw-test-b"; l.style.cssText = "overflow:scroll"; var m = k.createElement("div"); m.id = "vpw-test-d"; m.style.cssText = "position:absolute;top:-1000px"; m.innerHTML = "<style>@media(" + h + ":" + c["client" + a] + "px){body#vpw-test-b div#vpw-test-d{" + h + ":7px!important}}</style>"; l.appendChild(m); c.insertBefore(l, k.head); a = 7 == m["offset" + a] ? c["client" + a] : window["inner" + a]; c.removeChild(l) } else a = window["inner" + a]; return a } function isChrome() { return /Chrome/.test(navigator.userAgent) && /Google Inc/.test(navigator.vendor) } function isIOS() { for (var a = "iPad Simulator;iPhone Simulator;iPod Simulator;iPad;iPhone;iPod".split(";"); a.length;) if (navigator.platform === a.pop()) return s_bIsIphone = !0; return s_bIsIphone = !1 } window.addEventListener("orientationchange", onOrientationChange); function onOrientationChange() { window.matchMedia("(orientation: portrait)").matches && sizeHandler(); window.matchMedia("(orientation: landscape)").matches && sizeHandler() } function getIOSWindowHeight() { return document.documentElement.clientWidth / window.innerWidth * window.innerHeight } function getHeightOfIOSToolbars() { var a = (0 === window.orientation ? screen.height : screen.width) - getIOSWindowHeight(); return 1 < a ? a : 0 } function _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 sizeHandler() { window.scrollTo(0, 1); if ($("#canvas")) { var a = navigator.userAgent.match(/(iPad|iPhone|iPod)/g) ? getIOSWindowHeight() : getSize("Height"); var h = getSize("Width"); _checkOrientation(h, a); var k = Math.min(a / CANVAS_HEIGHT, h / CANVAS_WIDTH), c = CANVAS_WIDTH * k; k *= CANVAS_HEIGHT; if (k < a) { var l = a - k; k += l; c += CANVAS_WIDTH / CANVAS_HEIGHT * l } else c < h && (l = h - c, c += l, k += CANVAS_HEIGHT / CANVAS_WIDTH * l); l = a / 2 - k / 2; var m = h / 2 - c / 2, n = CANVAS_WIDTH / c; if (m * n < -EDGEBOARD_X || l * n < -EDGEBOARD_Y) k = Math.min(a / (CANVAS_HEIGHT - 2 * EDGEBOARD_Y), h / (CANVAS_WIDTH - 2 * EDGEBOARD_X)), c = CANVAS_WIDTH * k, k *= CANVAS_HEIGHT, l = (a - k) / 2, m = (h - c) / 2, n = CANVAS_WIDTH / c; s_iOffsetX = -1 * m * n; s_iOffsetY = -1 * l * n; 0 <= l && (s_iOffsetY = 0); 0 <= m && (s_iOffsetX = 0); null !== s_oInterface && s_oInterface.refreshButtonPos(s_iOffsetX, s_iOffsetY); null !== s_oModeMenu && s_oModeMenu.refreshButtonPos(s_iOffsetX, s_iOffsetY); null !== s_oMenu && s_oMenu.refreshButtonPos(s_iOffsetX, s_iOffsetY); s_bIsIphone ? (canvas = document.getElementById("canvas"), s_oStage.canvas.width = 2 * c, s_oStage.canvas.height = 2 * k, canvas.style.width = c + "px", canvas.style.height = k + "px", s_iScaleFactor = 2 * Math.min(c / CANVAS_WIDTH, k / CANVAS_HEIGHT), s_oStage.scaleX = s_oStage.scaleY = s_iScaleFactor) : s_bMobile || isChrome() ? ($("#canvas").css("width", c + "px"), $("#canvas").css("height", k + "px")) : (s_oStage.canvas.width = c, s_oStage.canvas.height = k, s_iScaleFactor = Math.min(c / CANVAS_WIDTH, k / CANVAS_HEIGHT), s_oStage.scaleX = s_oStage.scaleY = s_iScaleFactor); 0 > l ? $("#canvas").css("top", l + "px") : $("#canvas").css("top", "0px"); $("#canvas").css("left", m + "px"); fullscreenHandler() } } function playSound(a, h, k) { return !1 === DISABLE_SOUND_MOBILE || !1 === s_bMobile ? (s_aSounds[a].play(), s_aSounds[a].volume(h), s_aSounds[a].loop(k), s_aSounds[a]) : null } function stopSound(a) { !1 !== DISABLE_SOUND_MOBILE && !1 !== s_bMobile || s_aSounds[a].stop() } 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[a].mute(h) } function createBitmap(a, h, k) { var c = new createjs.Bitmap(a), l = new createjs.Shape; h && k ? l.graphics.beginFill("#fff").drawRect(0, 0, h, k) : l.graphics.beginFill("#ff0").drawRect(0, 0, a.width, a.height); c.hitArea = l; return c } function createSprite(a, h, k, c, l, m) { a = null !== h ? new createjs.Sprite(a, h) : new createjs.Sprite(a); h = new createjs.Shape; h.graphics.beginFill("#000000").drawRect(-k, -c, l, m); a.hitArea = h; return a } function randomFloatBetween(a, h, k) { "undefined" === typeof k && (k = 2); return parseFloat(Math.min(a + Math.random() * (h - a), h).toFixed(k)) } function formatTime(a) { a /= 1E3; var h = Math.floor(a / 60); a = Math.floor(a - 60 * h); var k = ""; k = 10 > h ? k + ("0" + h + ":") : k + (h + ":"); return 10 > a ? k + ("0" + a) : k + a } function NoClickDelay(a) { this.element = a; window.Touch && this.element.addEventListener("touchstart", this, !1) } function shuffle(a) { for (var h = a.length, k, c; 0 < h;) c = Math.floor(Math.random() * h), h--, k = a[h], a[h] = a[c], a[c] = k; 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("&"), k = 0; k < h.length; k++) { var c = h[k].split("="); if (c[0] == a) return c[1] } } function fullscreenHandler() { ENABLE_FULLSCREEN && !1 !== screenfull.enabled && (s_bFullscreen = screen.height < window.innerHeight + 3 && screen.height > window.innerHeight - 3 ? !0 : !1, null !== s_oInterface && s_oInterface.resetFullscreenBut(), null !== s_oMenu && s_oMenu.resetFullscreenBut()) } if (screenfull.enabled) screenfull.on("change", function() { s_bFullscreen = screenfull.isFullscreen; null !== s_oInterface && s_oInterface.resetFullscreenBut(); null !== s_oMenu && s_oMenu.resetFullscreenBut() }); function CSpriteLibrary() { var a, h, k, c, l, m; this.init = function(n, g, b) { k = h = 0; c = n; l = g; m = b; a = {} }; this.addSprite = function(c, g) { a.hasOwnProperty(c) || (a[c] = { szPath: g, oSprite: new Image }, h++) }; this.getSprite = function(c) { return a.hasOwnProperty(c) ? a[c].oSprite : null }; this._onSpritesLoaded = function() { l.call(m) }; this._onSpriteLoaded = function() { c.call(m); ++k === h && this._onSpritesLoaded() }; this.loadSprites = function() { for (var c in a) a[c].oSprite.oSpriteLibrary = this, a[c].oSprite.onload = function() { this.oSpriteLibrary._onSpriteLoaded() }, a[c].oSprite.src = a[c].szPath }; this.getNumSprites = function() { return h } } var CANVAS_WIDTH = 1080, CANVAS_HEIGHT = 1920, EDGEBOARD_X = 25, EDGEBOARD_Y = 200, GAME_NAME = "ultimate_tic_tac_toe", FPS = 30, DISABLE_SOUND_MOBILE = !1, FONT_GAME = "aachen_btroman", STATE_LOADING = 0, STATE_MENU = 1, STATE_HELP = 1, STATE_GAME = 3, ON_MOUSE_DOWN = 0, ON_MOUSE_UP = 1, ON_MOUSE_OVER = 2, ON_MOUSE_OUT = 3, ON_DRAG_START = 4, ON_DRAG_END = 5, DRAW = 0, X_WINS = 1, O_WINS = 2, CELL_SIZE = 300, CELL_PADDING = 15, CELL_SCALING_3x3 = 1, CELL_SCALING_5x5 = .6, CELL_SCALING_7x7 = .44, MATRIX_YOFFSET = 200, Y_START_GRID = 320, POINTS_EARNED, ENABLE_FULLSCREEN, ENABLE_CHECK_ORIENTATION, TEXT_PRELOADER_CONTINUE = "START", TEXT_GAMEOVER = "GAME OVER", TEXT_PLAY = "PLAY", TEXT_PLAYAGAIN = "PLAY AGAIN", TEXT_PL1_VICTORY = "PLAYER 1\n WINS!!!", TEXT_PL2_VICTORY = "PLAYER 2\n WINS!!!", TEXT_DRAW = "DRAW!!!", TEXT_BUT1PLAYER = "1 Player", TEXT_BUT2PLAYERS = "2 Players", TEXT_ACTIVEPLAYER = { pt1: "Player ", pt2: " to move" }, TEXT_AIACTIVEPLAYER = { pt1: "AI ", pt2: " to move" }, TEXT_THREE_IN_ROW = "PLACE 3 IN A ROW!", TEXT_FOUR_IN_ROW = "PLACE 4 IN A ROW!", TEXT_CREDITS_DEVELOPED = "DEVELOPED BY", TEXT_LINK = "www.codethislab.com", 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?", TEXT_IOS_PRIVATE = 'Your web browser does not support storing settings locally. In Safari, the most common cause of this is using "Private Browsing Mode". Some info may not save or some features may not work properly', TEXT_SAVE_REMOVE = "THIS WILL REMOVE ALL YOUR ACHIEVEMENTS! DO YOU WANT TO PROCEED?", TEXT_ARE_SURE = "ARE YOU SURE?"; function CPreloader() { var a, h, k, c, l, m, n, g, b, p; 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(); p = new createjs.Container; s_oStage.addChild(p) }; this.unload = function() { p.removeAllChildren(); b.unload() }; this._onImagesLoaded = function() {}; this._onAllImagesLoaded = function() { this.attachSprites(); s_oMain.preloaderReady() }; this.attachSprites = function() { var q = new createjs.Shape; q.graphics.beginFill("black").drawRect(0, 0, CANVAS_WIDTH, CANVAS_HEIGHT); p.addChild(q); q = s_oSpriteLibrary.getSprite("200x200"); n = createBitmap(q); n.regX = .5 * q.width; n.regY = .5 * q.height; n.x = CANVAS_WIDTH / 2; n.y = CANVAS_HEIGHT / 2 - 180; p.addChild(n); g = new createjs.Shape; g.graphics.beginFill("rgba(0,0,0,0.01)").drawRoundRect(n.x - 100, n.y - 100, 200, 200, 10); p.addChild(g); n.mask = g; q = s_oSpriteLibrary.getSprite("progress_bar"); c = createBitmap(q); c.x = CANVAS_WIDTH / 2 - q.width / 2; c.y = CANVAS_HEIGHT / 2 + 50; p.addChild(c); a = q.width; h = q.height; l = new createjs.Shape; l.graphics.beginFill("rgba(0,0,0,0.01)").drawRect(c.x, c.y, 1, h); p.addChild(l); c.mask = l; k = new createjs.Text("", "30px " + FONT_GAME, "#fff"); k.x = CANVAS_WIDTH / 2; k.y = CANVAS_HEIGHT / 2 + 100; k.textBaseline = "alphabetic"; k.textAlign = "center"; p.addChild(k); q = s_oSpriteLibrary.getSprite("but_start"); b = CTextButton(CANVAS_WIDTH / 2, CANVAS_HEIGHT / 2, q, TEXT_PRELOADER_CONTINUE, "Arial", "#000", "bold 50", p); b.addEventListener(ON_MOUSE_UP, this._onButStartRelease, this); b.setVisible(!1); m = new createjs.Shape; m.graphics.beginFill("black").drawRect(0, 0, CANVAS_WIDTH, CANVAS_HEIGHT); p.addChild(m); createjs.Tween.get(m).to({ alpha: 0 }, 500).call(function() { createjs.Tween.removeTweens(m); p.removeChild(m) }) }; this._onButStartRelease = function() { s_oMain._onRemovePreloader() }; this.refreshLoader = function(g) { k.text = g + "%"; 100 === g && (b.setVisible(!0), k.visible = !1, c.visible = !1); l.graphics.clear(); g = Math.floor(g * a / 100); l.graphics.beginFill("rgba(0,0,0,0.01)").drawRect(c.x, c.y, g, h) }; this._init() } function CMain(a) { var h = !1, k = 0, c = 0, l = {}, m, n = !1; this.initContainer = function() { s_oStage = new createjs.Stage("canvas"); createjs.Touch.enable(s_oStage); s_bMobile = jQuery.browser.mobile; !1 === s_bMobile && s_oStage.enableMouseOver(20); s_iPrevTime = (new Date).getTime(); createjs.Ticker.framerate = FPS; createjs.Ticker.addEventListener("tick", this._update); navigator.userAgent.match(/Windows Phone/i) && (DISABLE_SOUND_MOBILE = !0); s_oSpriteLibrary = new CSpriteLibrary; s_oLocalStorage = new CLocalStorage(GAME_NAME); m = new CPreloader; }; this.preloaderReady = function() { !1 !== DISABLE_SOUND_MOBILE && !1 !== s_bMobile || this._initSounds(); this._loadImages(); h = !0 }; this.soundLoaded = function() { k++; m.refreshLoader(Math.floor(k / c * 100)) }; this._initSounds = function() { var a = []; a.push({ path: "./sounds/", filename: "gameover", loop: !1, volume: 1, ingamename: "gameover" }); a.push({ path: "./sounds/", filename: "place_mark", loop: !1, volume: 1, ingamename: "place_mark" }); a.push({ path: "./sounds/", filename: "press_but", loop: !1, volume: 1, ingamename: "press_but" }); a.push({ path: "./sounds/", filename: "win", loop: !1, volume: 1, ingamename: "win" }); a.push({ path: "./sounds/", filename: "draw", loop: !1, volume: 1, ingamename: "draw" }); c += a.length; s_aSounds = []; for (var b = 0; b < a.length; b++) s_aSounds[a[b].ingamename] = new Howl({ src: [a[b].path + a[b].filename + ".mp3"], autoplay: !1, preload: !0, loop: a[b].loop, volume: a[b].volume, onload: s_oMain.soundLoaded }) }; this._loadImages = function() { s_oSpriteLibrary.init(this._onImagesLoaded, this._onAllImagesLoaded, this); s_oSpriteLibrary.addSprite("bg_game", "./sprites/bg_game.jpg"); s_oSpriteLibrary.addSprite("bg_menu", "./sprites/bg_menu.jpg"); s_oSpriteLibrary.addSprite("but_box_1", "./sprites/but_box_1.png"); s_oSpriteLibrary.addSprite("but_box_2", "./sprites/but_box_2.png"); s_oSpriteLibrary.addSprite("but_exit", "./sprites/but_exit.png"); s_oSpriteLibrary.addSprite("but_fullscreen", "./sprites/but_fullscreen.png"); s_oSpriteLibrary.addSprite("cell", "./sprites/cell.png"); s_oSpriteLibrary.addSprite("choose_text", "./sprites/choose_text.png"); s_oSpriteLibrary.addSprite("but_3x3", "./sprites/layout_3x3.png"); s_oSpriteLibrary.addSprite("but_5x5", "./sprites/layout_5x5.png"); s_oSpriteLibrary.addSprite("but_7x7", "./sprites/layout_7x7.png"); s_oSpriteLibrary.addSprite("msg_box", "./sprites/msg_box.png"); s_oSpriteLibrary.addSprite("msg_box_small", "./sprites/msg_box_small.png"); s_oSpriteLibrary.addSprite("tokenX", "./sprites/player_1.png"); s_oSpriteLibrary.addSprite("tokenO", "./sprites/player_2.png"); s_oSpriteLibrary.addSprite("audio_icon", "./sprites/audio_icon.png"); s_oSpriteLibrary.addSprite("tris_line", "./sprites/tris_line.png"); s_oSpriteLibrary.addSprite("bg_mode_menu", "./sprites/bg_mode_menu.jpg"); s_oSpriteLibrary.addSprite("but_credits", "./sprites/but_credits.png"); s_oSpriteLibrary.addSprite("logo_credits", "./sprites/logo_credits.png"); s_oSpriteLibrary.addSprite("logo", "./sprites/logo.png"); s_oSpriteLibrary.addSprite("star_blue", "./sprites/star_blue.png"); s_oSpriteLibrary.addSprite("star_white", "./sprites/star_white.png"); s_oSpriteLibrary.addSprite("but_delete", "./sprites/but_delete.png"); s_oSpriteLibrary.addSprite("but_yes", "./sprites/but_yes.png"); c += s_oSpriteLibrary.getNumSprites(); s_oSpriteLibrary.loadSprites() }; this._onImagesLoaded = function() { k++; m.refreshLoader(Math.floor(k / c * 100)) }; this._onRemovePreloader = function() { m.unload(); s_oMain.gotoMenu() }; this._onAllImagesLoaded = function() {}; this.onAllPreloaderImagesLoaded = function() { this._loadImages() }; this.gotoMenu = function() { new CMenu }; this.gotoGameModeMenu = function(c) { s_bTwoPlayerMode = n = c ? !0 : !1; new CGameModeMenu }; this.gotoGame = function(c) { l.iMatrixSize = c; l.b2Players = n; new CGame(l) }; this.gotoHelp = function() { new CHelp }; this.stopUpdate = function() { h = !1; createjs.Ticker.paused = !0; $("#block_game").css("display", "block"); !1 !== DISABLE_SOUND_MOBILE && !1 !== s_bMobile || Howler.mute(!0) }; this.startUpdate = function() { s_iPrevTime = (new Date).getTime(); h = !0; createjs.Ticker.paused = !1; $("#block_game").css("display", "none"); (!1 === DISABLE_SOUND_MOBILE || !1 === s_bMobile) && s_bAudioActive && Howler.mute(!1) }; this._update = function(c) { if (!1 !== h) { var b = (new Date).getTime(); s_iTimeElaps = b - s_iPrevTime; s_iCntTime += s_iTimeElaps; s_iCntFps++; s_iPrevTime = b; 1E3 <= s_iCntTime && (s_iCurFps = s_iCntFps, s_iCntTime -= 1E3, s_iCntFps = 0); s_oStage.update(c) } }; s_oMain = this; l = a; ENABLE_FULLSCREEN = a.fullscreen; ENABLE_CHECK_ORIENTATION = a.check_orientation; this.initContainer() } var s_bMobile, s_bAudioActive = !0, s_iCntTime = 0, s_iTimeElaps = 0, s_iPrevTime = 0, s_iCntFps = 0, s_iCurFps = 0, s_bTwoPlayerMode, s_oDrawLayer, s_oStage, s_oMain, s_oSpriteLibrary, s_oGameSettings, s_aSounds; function CTextButton(a, h, k, c, l, m, n, g) { var b, p, q, e, f, d, r, u, x, y, w; this._init = function(c, a, g, h, k, m, l, n) { b = !1; e = []; f = []; x = n; r = createBitmap(g); p = g.width; q = g.height; u = new createjs.Text(h, l + "px " + k, m); h = u.getBounds(); u.textAlign = "center"; u.textBaseline = "alphabetic"; u.x = g.width / 2; u.y = Math.floor(g.height / 2) + h.height / 3; d = new createjs.Container; d.x = c; d.y = a; d.regX = g.width / 2; d.regY = g.height / 2; d.cursor = "pointer"; d.addChild(r, u); x.addChild(d); this._initListener() }; this.unload = function() { d.off("mousedown", y); d.off("pressup", w); x.removeChild(d) }; this.setVisible = function(b) { d.visible = b }; this.enable = function() { b = !1; r.filters = []; r.cache(0, 0, p, q) }; this.disable = function() { b = !0; var e = (new createjs.ColorMatrix).adjustSaturation(-100); r.filters = [new createjs.ColorMatrixFilter(e)]; r.cache(0, 0, p, q) }; this._initListener = function() { oParent = this; y = d.on("mousedown", this.buttonDown); w = d.on("pressup", this.buttonRelease) }; this.addEventListener = function(b, c, d) { e[b] = c; f[b] = d }; this.buttonRelease = function() { b || (playSound("press_but", 1, !1), d.scaleX = 1, d.scaleY = 1, e[ON_MOUSE_UP] && e[ON_MOUSE_UP].call(f[ON_MOUSE_UP])) }; this.buttonDown = function() { b || (d.scaleX = .9, d.scaleY = .9, e[ON_MOUSE_DOWN] && e[ON_MOUSE_DOWN].call(f[ON_MOUSE_DOWN])) }; this.setPosition = function(b, e) { d.x = b; d.y = e }; this.changeText = function(b) { u.text = b; _oTextBack.text = b }; this.setX = function(b) { d.x = b }; this.setY = function(b) { d.y = b }; this.getButtonImage = function() { return d }; this.getX = function() { return d.x }; this.getY = function() { return d.y }; this._init(a, h, k, c, l, m, n, g); return this } function CGfxButton(a, h, k, c) { var l, m, n, g, b, p, q = [], e, f, d, r; this._init = function(c, f, d, a) { l = !1; b = []; p = []; m = 1; n = d.width; g = d.height; e = createBitmap(d); e.x = c; e.y = f; e.regX = d.width / 2; e.regY = d.height / 2; e.cursor = "pointer"; a.addChild(e); this._initListener() }; this.unload = function() { e.off("mousedown", d); e.off("pressup", r); c.removeChild(e) }; this.setVisible = function(b) { e.visible = b }; this._initListener = function() { d = e.on("mousedown", this.buttonDown); r = e.on("pressup", this.buttonRelease) }; this.addEventListener = function(e, c, d) { b[e] = c; p[e] = d }; this.addEventListenerWithParams = function(e, c, d, f) { b[e] = c; p[e] = d; q = f }; this.buttonRelease = function() { l || (playSound("press_but", 1, !1), f || (e.scaleX = m, e.scaleY = m), b[ON_MOUSE_UP] && b[ON_MOUSE_UP].call(p[ON_MOUSE_UP], q)) }; this.buttonDown = function() { l || (f || (e.scaleX = .9 * m, e.scaleY = .9 * m), b[ON_MOUSE_DOWN] && b[ON_MOUSE_DOWN].call(p[ON_MOUSE_DOWN], q)) }; this.setPosition = function(b, c) { e.x = b; e.y = c }; this.setX = function(b) { e.x = b }; this.setY = function(b) { e.y = b }; this.enable = function() { l = !1; e.filters = []; e.cache(0, 0, n, g) }; this.disable = function() { l = !0; var b = (new createjs.ColorMatrix).adjustSaturation(-100).adjustBrightness(40); e.filters = [new createjs.ColorMatrixFilter(b)]; e.cache(0, 0, n, g) }; this.getButtonImage = function() { return e }; this.pulseAnimation = function() { f = createjs.Tween.get(e).to({ scaleX: 1.1 * m, scaleY: 1.1 * m }, 850, createjs.Ease.quadOut).to({ scaleX: m, scaleY: m }, 650, createjs.Ease.quadIn).call(function() { u.pulseAnimation() }) }; this.setClickable = function() { l = !0 }; this.getX = function() { return e.x }; this.getY = function() { return e.y }; this._init(a, h, k, c); var u = this; return this } function CToggle(a, h, k, c, l) { var m, n, g, b, p, q, e; this._init = function(e, c, a, h) { n = []; g = []; var d = new createjs.SpriteSheet({ images: [a], frames: { width: a.width / 2, height: a.height, regX: a.width / 2 / 2, regY: a.height / 2 }, animations: { state_true: [0], state_false: [1] } }); m = h; b = createSprite(d, "state_" + m, a.width / 2 / 2, a.height / 2, a.width / 2, a.height); b.x = e; b.y = c; b.stop(); f.addChild(b); this._initListener() }; this.unload = function() { b.off("mousedown", p); b.off("pressup", e); s_bMobile || b.off("mouseover", q); f.removeChild(b) }; this._initListener = function() { p = b.on("mousedown", this.buttonDown); e = b.on("pressup", this.buttonRelease); s_bMobile || (q = b.on("mouseover", this.buttonOver)) }; this.addEventListener = function(b, e, c) { n[b] = e; g[b] = c }; this.setActive = function(e) { m = e; b.gotoAndStop("state_" + m) }; this.buttonRelease = function() { b.scaleX = 1; b.scaleY = 1; playSound("press_but", 1, !1); m = !m; b.gotoAndStop("state_" + m); n[ON_MOUSE_UP] && n[ON_MOUSE_UP].call(g[ON_MOUSE_UP], m) }; this.buttonDown = function() { b.scaleX = .9; b.scaleY = .9; n[ON_MOUSE_DOWN] && n[ON_MOUSE_DOWN].call(g[ON_MOUSE_DOWN]) }; this.buttonOver = function(b) { s_bMobile || (b.target.cursor = "pointer") }; this.setPosition = function(e, c) { b.x = e; b.y = c }; var f = l; this._init(a, h, k, c) } function CMenu() { var a, h, k, c, l, m, n, g, b, p, q, e, f = null, d = null, r, u, x, y, w, z, t, A; this._init = function() { r = createBitmap(s_oSpriteLibrary.getSprite("bg_menu")); s_oStage.addChild(r); b = CANVAS_WIDTH / 2; p = CANVAS_HEIGHT - 340; var v = s_oSpriteLibrary.getSprite("but_box_1"); u = new CTextButton(b, p, v, TEXT_BUT1PLAYER, FONT_GAME, "#ffffff", 60, s_oStage); u.addEventListener(ON_MOUSE_UP, this._onBut1Player, this); n = CANVAS_WIDTH / 2; g = CANVAS_HEIGHT - 150; x = new CTextButton(n, g, v, TEXT_BUT2PLAYERS, FONT_GAME, "#ffffff", 60, s_oStage); x.addEventListener(ON_MOUSE_UP, this._onBut2Players, this); if (!1 === DISABLE_SOUND_MOBILE || !1 === s_bMobile) v = s_oSpriteLibrary.getSprite("audio_icon"), q = CANVAS_WIDTH - v.width / 4 - 10, e = v.height / 2 + 10, y = new CToggle(q, e, v, s_bAudioActive, s_oStage), y.addEventListener(ON_MOUSE_UP, this._onAudioToggle, this); v = s_oSpriteLibrary.getSprite("but_credits"); l = v.height / 2 + 10; m = v.height / 2 + 10; w = new CGfxButton(l, m, v, s_oStage); w.addEventListener(ON_MOUSE_UP, this._onCredits, this); v = window.document; var B = v.documentElement; f = B.requestFullscreen || B.mozRequestFullScreen || B.webkitRequestFullScreen || B.msRequestFullscreen; d = v.exitFullscreen || v.mozCancelFullScreen || v.webkitExitFullscreen || v.msExitFullscreen; !1 === ENABLE_FULLSCREEN && (f = !1); f && screenfull.enabled && (v = s_oSpriteLibrary.getSprite("but_fullscreen"), k = l + v.width / 2 + 10, c = m, t = new CToggle(k, c, v, s_bFullscreen, s_oStage), t.addEventListener(ON_MOUSE_UP, this._onFullscreenRelease, this)); s_oLocalStorage.isDirty() && (v = s_oSpriteLibrary.getSprite("but_delete"), a = v.height / 2 + 10, h = CANVAS_HEIGHT - v.height / 2 - 10, A = new CGfxButton(a, h, v, s_oStage), A.addEventListener(ON_MOUSE_UP, this._onDelete, this)); z = new createjs.Shape; z.graphics.beginFill("black").drawRect(0, 0, CANVAS_WIDTH, CANVAS_HEIGHT); s_oStage.addChild(z); createjs.Tween.get(z).to({ alpha: 0 }, 500).call(function() { z.visible = !1 }); this.refreshButtonPos(s_iOffsetX, s_iOffsetY); s_oLocalStorage.isUsed() || new CMsgBox(TEXT_IOS_PRIVATE) }; this.unload = function() { u.unload(); u = null; w.unload(); if (!1 === DISABLE_SOUND_MOBILE || !1 === s_bMobile) y.unload(), y = null; f && screenfull.enabled && t.unload(); s_oLocalStorage.isDirty() && A.unload(); s_oStage.removeAllChildren(); s_oMenu = null }; this.refreshButtonPos = function(d, r) { u.setPosition(b, p - r); x.setPosition(n, g - r); !1 !== DISABLE_SOUND_MOBILE && !1 !== s_bMobile || y.setPosition(q - d, r + e); w.setPosition(l + d, r + m); f && screenfull.enabled && t.setPosition(k + s_iOffsetX, c + s_iOffsetY); s_oLocalStorage.isDirty() && A.setPosition(a + d, h - r) }; this._onBut1Player = function() { this.unload(); $(s_oMain).trigger("start_session"); s_oMain.gotoGameModeMenu(!1) }; this._onBut2Players = function() { this.unload(); $(s_oMain).trigger("start_session"); s_oMain.gotoGameModeMenu(!0) }; this._onCredits = function() { new CCreditsPanel }; this._onAudioToggle = function() { Howler.mute(s_bAudioActive); s_bAudioActive = !s_bAudioActive }; this.resetFullscreenBut = function() { f && screenfull.enabled && t.setActive(s_bFullscreen) }; this._onFullscreenRelease = function() { s_bFullscreen ? d.call(window.document) : f.call(window.document.documentElement); sizeHandler() }; this._onDelete = function() { (new CAreYouSurePanel(s_oMenu.deleteSavings)).changeMessage(TEXT_SAVE_REMOVE, 50) }; this.deleteSavings = function() { s_oLocalStorage.deleteData(); s_oLocalStorage.resetData(); A.unload() }; s_oMenu = this; this._init() } var s_oMenu = null; function CGame(a) { var h = !1, k, c, l = 1, m = 0, n = 0, g = [], b = [], p = [], q; this._init = function(b) { k = b.b2Players; c = b.iMatrixSize; q = new CInterface(c); this.initMatrix(); this._initWinCellsArray(); $(s_oMain).trigger("start_level") }; this.unload = function() { for (var b = 0; b < c; b++) for (var f = 0; f < c; f++) p[b][f].unload(); q.unload(); s_oMain.gotoMenu() }; this.initMatrix = function() { for (var e = 0; e < c; e++) { p[e] = []; b[e] = []; for (var f = 0; f < c; f++) { var d, a = MATRIX_YOFFSET; 3 === c ? d = CELL_SCALING_3x3 : 5 === c ? d = CELL_SCALING_5x5 : 7 === c && (d = CELL_SCALING_7x7); var g = f * (CELL_SIZE + CELL_PADDING) * d; var h = Y_START_GRID + e * (CELL_SIZE + CELL_PADDING) * d; g += (CANVAS_WIDTH - CELL_SIZE * d * c) / 2 - 30 * d; h += a; p[e][f] = new CCell(g, h, d, f, e); b[e][f] = 0 } } }; this._initWinCellsArray = function() { if (3 === c) for (var b = 0; 3 > b; b++) g[b] = { x: 0, y: 0 }; else for (b = 0; 4 > b; b++) g[b] = { x: 0, y: 0 } }; this.getActivePlayer = function() { return l }; this.updateGameStatus = function(e, f) { if (!h) { b[f][e] = l; m++; 3 === c && (5 <= m ? this.checkTris() : this._switchPlayer()); if (5 === c || 7 === c) 7 <= m ? this.checkQuad() : this._switchPlayer(); q.update() } }; this._switchPlayer = function() { 1 === l ? !0 === k ? l = 2 : (l = 2, this._AINext()) : l = 1 }; this._checkWinningCouples = function(e) { for (var f = { x: void 0, y: void 0 }, d = 0; d < c; d++) for (var a = 0; a < c; a++) { if (b[d][a] === e) { if (d <= c - 3 && b[d][a] === b[d + 1][a] && 0 === b[d + 2][a]) return f.x = a, f.y = d + 2, f; if (a <= c - 3 && b[d][a] === b[d][a + 1] && 0 === b[d][a + 2]) return f.x = a + 2, f.y = d, f; if (a <= c - 3 && d <= c - 3 && b[d][a] === b[d + 1][a + 1] && 0 === b[d + 2][a + 2]) return f.x = a + 2, f.y = d + 2, f } if (a <= c - 3 && d <= c - 3 && b[d + 2][a] === e && b[d + 2][a] === b[d + 1][a + 1] && 0 === b[d][a + 2]) return f.x = a + 2, f.y = d, f; if (0 === b[d][a] && (d <= c - 3 && e === b[d + 1][a] && e === b[d + 2][a] || a <= c - 3 && e === b[d][a + 1] && e === b[d][a + 2] || a <= c - 3 && d <= c - 3 && e === b[d + 1][a + 1] && e === b[d + 2][a + 2])) return f.x = a, f.y = d, f; if (a <= c - 3 && d <= c - 3 && 0 === b[d + 2][a] && e === b[d + 1][a + 1] && e === b[d][a + 2]) return f.x = a, f.y = d + 2, f; if (b[d][a] === e) { if (d <= c - 3 && 0 === b[d + 1][a] && e === b[d + 2][a]) return f.x = a, f.y = d + 1, f; if (a <= c - 3 && 0 === b[d][a + 1] && e === b[d][a + 2]) return f.x = a + 1, f.y = d, f; if (a <= c - 3 && d <= c - 3 && 0 === b[d + 1][a + 1] && e === b[d + 2][a + 2]) return f.x = a + 1, f.y = d + 1, f } if (a <= c - 3 && d <= c - 3 && b[d + 2][a] === e && 0 === b[d + 1][a + 1] && e === b[d][a + 2]) return f.x = a + 1, f.y = d + 1, f } return f }; this._checkWinningTriples = function(a) { for (var f = { x: void 0, y: void 0 }, d = 0; d < c; d++) for (var e = 0; e < c; e++) { if (b[d][e] === a) { if (d <= c - 4 && b[d][e] === b[d + 1][e] && b[d][e] === b[d + 2][e] && 0 === b[d + 3][e]) return f.x = e, f.y = d + 3, f; if (e <= c - 4 && b[d][e] === b[d][e + 1] && b[d][e] === b[d][e + 2] && 0 === b[d][e + 3]) return f.x = e + 3, f.y = d, f; if (e <= c - 4 && d <= c - 4 && b[d][e] === b[d + 1][e + 1] && b[d][e] === b[d + 2][e + 2] && 0 === b[d + 3][e + 3]) return f.x = e + 3, f.y = d + 3, f } if (e <= c - 4 && d <= c - 4 && b[d + 3][e] === a && b[d + 3][e] === b[d + 2][e + 1] && b[d + 3][e] === b[d + 1][e + 2] && 0 === b[d][e + 3]) return f.x = e + 3, f.y = d, f; if (0 === b[d][e] && (d <= c - 4 && a === b[d + 1][e] && a === b[d + 2][e] && a === b[d + 3][e] || e <= c - 4 && a === b[d][e + 1] && a === b[d][e + 2] && a === b[d][e + 3] || e <= c - 4 && d <= c - 4 && a === b[d + 1][e + 1] && a === b[d + 2][e + 2] && a === b[d + 3][e + 3])) return f.x = e, f.y = d, f; if (e <= c - 4 && d <= c - 4 && 0 === b[d + 3][e] && a === b[d + 2][e + 1] && a === b[d + 1][e + 2] && a === b[d][e + 3]) return f.x = e, f.y = d + 3, f; if (b[d][e] === a) { if (d <= c - 4 && 0 === b[d + 1][e] && a === b[d + 2][e] && a === b[d + 3][e]) return f.x = e, f.y = d + 1, f; if (e <= c - 4 && 0 === b[d][e + 1] && a === b[d][e + 2] && a === b[d][e + 3]) return f.x = e + 1, f.y = d, f; if (e <= c - 4 && d <= c - 4 && 0 === b[d + 1][e + 1] && a === b[d + 2][e + 2] && a === b[d + 3][e + 3]) return f.x = e + 1, f.y = d + 1, f } if (e <= c - 4 && d <= c - 4 && b[d + 3][e] === a && 0 === b[d + 2][e + 1] && a === b[d + 1][e + 2] && a === b[d][e + 3]) return f.x = e + 1, f.y = d + 2, f } return f }; this._checkForks = function() { for (var e = { x: void 0, y: void 0 }, a = 0; a < c; a++) for (var d = 0; d < c; d++) if (a <= c - 3 && d <= c - 3 && 2 === b[a + 2][d] && 2 === b[a][d + 2] && 0 === b[a + 1][d] && 0 === b[a][d + 1] || 2 <= a && d <= c - 3 && 2 === b[a - 2][d] && 2 === b[a][d + 2] && 0 === b[a - 1][d] && 0 === b[a][d + 1] || 2 <= a && 2 <= d && 2 === b[a - 2][d] && 2 === b[a][d - 2] && 0 === b[a - 1][d] && 0 === b[a][d - 1] || a <= c - 3 && 2 <= d && 2 === b[a + 2][d] && 2 === b[a][d - 2] && 0 === b[a + 1][d] && 0 === b[a][d - 1]) return e.x = d, e.y = a, e; return e }; this._checkWinningSingletons = function(a) { for (var e = { x: void 0, y: void 0 }, d = 0; d < c; d++) for (var g = 0; g < c; g++) { if (b[d][g] === a) { if (d <= c - 3 && 0 === b[d + 1][g]) return e.x = g, e.y = d + 1, e; if (g <= c - 3 && 0 === b[d][g + 1]) return e.x = g + 1, e.y = d, e; if (g <= c - 3 && d <= c - 3 && 0 === b[d + 1][g + 1]) return e.x = g + 1, e.y = d + 1, e } if (g <= c - 3 && d <= c - 3 && b[d + 1][g] === a && 0 === b[d][g + 1]) return e.x = g + 1, e.y = d, e } return e }; this.checkTris = function() { for (var a = 0; a < c; a++) for (var f = 0; f < c; f++) { if (0 !== b[a][f]) { if (a <= c - 3 && b[a][f] === b[a + 1][f] && b[a][f] === b[a + 2][f]) { g[0].x = f; g[0].y = a; g[1].x = f; g[1].y = a + 1; g[2].x = f; g[2].y = a + 2; this.endGame(); return } if (f <= c - 3 && b[a][f] === b[a][f + 1] && b[a][f] === b[a][f + 2]) { g[0].x = f; g[0].y = a; g[1].x = f + 1; g[1].y = a; g[2].x = f + 2; g[2].y = a; this.endGame(); return } if (f <= c - 3 && a <= c - 3 && b[a][f] === b[a + 1][f + 1] && b[a][f] === b[a + 2][f + 2]) { g[0].x = f; g[0].y = a; g[1].x = f + 1; g[1].y = a + 1; g[2].x = f + 2; g[2].y = a + 2; this.endGame(); return } } if (f <= c - 3 && a <= c - 3 && 0 !== b[a + 2][f] && b[a + 2][f] === b[a + 1][f + 1] && b[a + 2][f] === b[a][f + 2]) { g[0].x = f; g[0].y = a + 2; g[1].x = f + 1; g[1].y = a + 1; g[2].x = f + 2; g[2].y = a; this.endGame(); return } } m === c * c && (l = 0, this.showEndPanel()); this._switchPlayer() }; this.checkQuad = function() { for (var a = 0; a < c; a++) for (var f = 0; f < c; f++) { if (0 !== b[a][f]) { if (a <= c - 4 && b[a][f] === b[a + 1][f] && b[a][f] === b[a + 2][f] && b[a][f] === b[a + 3][f]) { g[0].x = f; g[0].y = a; g[1].x = f; g[1].y = a + 1; g[2].x = f; g[2].y = a + 2; g[3].x = f; g[3].y = a + 3; this.endGame(); return } if (f <= c - 4 && b[a][f] === b[a][f + 1] && b[a][f] === b[a][f + 2] && b[a][f] === b[a][f + 3]) { g[0].x = f; g[0].y = a; g[1].x = f + 1; g[1].y = a; g[2].x = f + 2; g[2].y = a; g[3].x = f + 3; g[3].y = a; this.endGame(); return } if (f <= c - 4 && a <= c - 4 && b[a][f] === b[a + 1][f + 1] && b[a][f] === b[a + 2][f + 2] && b[a][f] === b[a + 3][f + 3]) { g[0].x = f; g[0].y = a; g[1].x = f + 1; g[1].y = a + 1; g[2].x = f + 2; g[2].y = a + 2; g[3].x = f + 3; g[3].y = a + 3; this.endGame(); return } } if (f <= c - 4 && a <= c - 4 && 0 !== b[a + 3][f] && b[a + 3][f] === b[a + 2][f + 1] && b[a + 3][f] === b[a + 1][f + 2] && b[a + 3][f] === b[a][f + 3]) { g[0].x = f; g[0].y = a + 3; g[1].x = f + 1; g[1].y = a + 2; g[2].x = f + 2; g[2].y = a + 1; g[3].x = f + 3; g[3].y = a; this.endGame(); return } } m === c * c && (l = 0, this.showEndPanel()); this._switchPlayer() }; this._AINext = function() { var a = {}; 3 === c && (a = this._checkWinningCouples(2), void 0 === a.x && (a = this._checkWinningCouples(1), void 0 === a.x && (a = this._checkForks()))); if (5 === c || 7 === c) a = this._checkWinningTriples(2), void 0 === a.x && (a = this._checkWinningTriples(1), void 0 === a.x && (a = this._checkWinningCouples(2), void 0 === a.x && (a = this._checkWinningCouples(1), void 0 === a.x && (a = this._checkWinningSingletons(2))))); if (void 0 === a.x) for (;;) { var f = Math.floor(Math.random() * c), d = Math.floor(Math.random() * c); if (0 === b[d][f]) { a.x = f; a.y = d; break } } p[a.y][a.x].AIMove() }; this.endGame = function() { for (var a = 0; a < g.length; a++) p[g[a].y][g[a].x].EndAnim(), n++ }; this.showEndPanel = function() { if (1 < n) n--; else if (1 === n || 0 === l) new CEndPanel(l), k ? playSound("win", 1, !1) : 0 === l ? playSound("draw", 1, !1) : 1 === l ? playSound("win", 1, !1) : playSound("gameover", 1, !1), $(s_oMain).trigger("end_level") }; this.onExit = function() { this.unload(); $(s_oMain).trigger("end_level"); $(s_oMain).trigger("end_session"); s_oMain.gotoMenu() }; this.isFrozen = function() { return h }; this.freeze = function() { h = !0 }; this.unFreeze = function() { h = !1 }; s_oGame = this; POINTS_EARNED = a.single_player_score_earned; this._init(a) } var s_oGame; function CInterface(a) { var h, k, c, l, m, n, g, b, p = null, q = null, e, f, d, r, u, x, y, w; this._init = function(a) { f = createBitmap(s_oSpriteLibrary.getSprite("bg_game")); s_oStage.addChild(f); var t = s_oSpriteLibrary.getSprite("but_exit"); g = CANVAS_WIDTH - t.height / 2 - 10; b = t.height / 2 + 10; d = new CGfxButton(g, b, t, s_oStage); d.addEventListener(ON_MOUSE_UP, this._onExit, this); m = CANVAS_WIDTH - t.width / 2 - 180; n = t.height / 2 + 10; if (!1 === DISABLE_SOUND_MOBILE || !1 === s_bMobile) t = s_oSpriteLibrary.getSprite("audio_icon"), e = new CToggle(m, n, t, s_bAudioActive, s_oStage), e.addEventListener(ON_MOUSE_UP, this._onAudioToggle, this); t = window.document; var w = t.documentElement; p = w.requestFullscreen || w.mozRequestFullScreen || w.webkitRequestFullScreen || w.msRequestFullscreen; q = t.exitFullscreen || t.mozCancelFullScreen || t.webkitExitFullscreen || t.msExitFullscreen; !1 === ENABLE_FULLSCREEN && (p = !1); p && screenfull.enabled && (t = s_oSpriteLibrary.getSprite("but_fullscreen"), h = m - t.width / 2 - 10, k = n, y = new CToggle(h, k, t, s_bFullscreen, s_oStage), y.addEventListener(ON_MOUSE_UP, this._onFullscreenRelease, this)); t = TEXT_ACTIVEPLAYER.pt1 + s_oGame.getActivePlayer() + TEXT_ACTIVEPLAYER.pt2; r = new createjs.Text(t, "100px " + FONT_GAME, "#008df0"); r.x = 40; r.y = 440; r.textBaseline = "alphabetic"; r.textAlign = "left"; s_oStage.addChild(r); u = new createjs.Text(3 < a ? TEXT_FOUR_IN_ROW : TEXT_THREE_IN_ROW, "60px " + FONT_GAME, "#008df0"); u.x = CANVAS_WIDTH / 2; u.y = CANVAS_HEIGHT - 300; u.textBaseline = "alphabetic"; u.textAlign = "center"; s_oStage.addChild(u); l = c = 20; x = createBitmap(s_oSpriteLibrary.getSprite("logo")); x.x = c; x.y = l; s_oStage.addChild(x); this.refreshButtonPos(s_iOffsetX, s_iOffsetY) }; this.unload = function() { s_oStage.removeChild(f); !1 !== DISABLE_SOUND_MOBILE && !1 !== s_bMobile || e.unload(); p && screenfull.enabled && y.unload(); d.unload(); s_oStage.removeChild(r) }; this.refreshButtonPos = function(a, f) { d.setPosition(g - a, f + b); !1 !== DISABLE_SOUND_MOBILE && !1 !== s_bMobile || e.setPosition(m - a, f + n); x.x = c + a; x.y = l + f; p && screenfull.enabled && y.setPosition(h - s_iOffsetX, k + s_iOffsetY) }; this.update = function() { var a = TEXT_ACTIVEPLAYER.pt1 + s_oGame.getActivePlayer() + TEXT_ACTIVEPLAYER.pt2; createjs.Tween.get(r).to({ scaleX: .1, scaleY: 1.2, alpha: .5 }, 250, createjs.Ease.cubicOut).call(function() { r.text = a; createjs.Tween.get(r).to({ scaleX: 1, scaleY: 1, alpha: 1 }, 250, createjs.Ease.cubicIn) }) }; this._onExit = function() { w = new CAreYouSurePanel(s_oInterface.onConfirmExit); w.changeMessage(TEXT_ARE_SURE, 80); w.setMessageY(-100) }; this.onConfirmExit = function() { s_oInterface.unload(); s_oGame.onExit() }; this._onAudioToggle = function() { Howler.mute(s_bAudioActive); s_bAudioActive = !s_bAudioActive }; this.resetFullscreenBut = function() { p && screenfull.enabled && y.setActive(s_bFullscreen) }; this._onFullscreenRelease = function() { s_bFullscreen ? q.call(window.document) : p.call(window.document.documentElement); sizeHandler() }; s_oInterface = this; this._init(a); return this } var s_oInterface = null; function CGameModeMenu() { var a, h, k, c, l, m, n, g; this._init = function() { k = createBitmap(s_oSpriteLibrary.getSprite("bg_mode_menu")); s_oStage.addChild(k); var b = createBitmap(s_oSpriteLibrary.getSprite("choose_text")); b.x = 40; b.y = 240; s_oStage.addChild(b); b = s_oSpriteLibrary.getSprite("but_3x3"); c = createBitmap(b); c.regX = b.width / 2; c.regY = b.height / 2; c.x = CANVAS_WIDTH / 2; c.y = 580; c.cursor = "pointer"; s_oStage.addChild(c); c.on("click", function() { playSound("press_but", 1, !1); this._onBut3x3() }, this); b = s_oSpriteLibrary.getSprite("but_5x5"); l = createBitmap(b); l.regX = b.width / 2; l.regY = b.height / 2; l.x = CANVAS_WIDTH / 2; l.y = 940; l.cursor = "pointer"; s_oStage.addChild(l); l.on("click", function() { playSound("press_but", 1, !1); this._onBut5x5() }, this); b = s_oSpriteLibrary.getSprite("but_7x7"); m = createBitmap(b); m.regX = b.width / 2; m.regY = b.height / 2; m.x = CANVAS_WIDTH / 2; m.y = 1300; m.cursor = "pointer"; s_oStage.addChild(m); m.on("click", function() { playSound("press_but", 1, !1); this._onBut7x7() }, this); if (!s_bTwoPlayerMode) { b = s_oSpriteLibrary.getSprite("star_blue"); a = b.width / 2 + 10; h = CANVAS_HEIGHT - b.height / 2 - 10; g = new createjs.Container; g.x = a; g.y = h; s_oStage.addChild(g); var p = createBitmap(b); p.regX = b.width / 2; p.regY = b.height / 2; g.addChild(p); p = new createjs.Text(s_iTotalScore, "70px " + FONT_GAME, "#008df0"); p.x = b.width / 2 + 10; p.y = 0; p.textBaseline = "middle"; p.textAlign = "left"; g.addChild(p) } 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 }, 500).call(function() { n.visible = !1 }); this.refreshButtonPos(s_iOffsetX, s_iOffsetY) }; this.unload = function() { c.removeAllEventListeners(); l.removeAllEventListeners(); m.removeAllEventListeners(); s_oStage.removeAllChildren(); s_oModeMenu = null }; this.refreshButtonPos = function(b, c) { s_bTwoPlayerMode || (g.x = a + b, g.y = h - c) }; this._onBut3x3 = function() { this.unload(); s_oMain.gotoGame(3) }; this._onBut5x5 = function() { this.unload(); s_oMain.gotoGame(5) }; this._onBut7x7 = function() { this.unload(); s_oMain.gotoGame(7) }; s_oModeMenu = this; this._init() } var s_oModeMenu = null; function CCell(a, h, k, c, l) { var m, n, g, b, p, q, e, f, d; this._init = function(a, c, h, k, l) { m = 0; n = k; g = l; b = h; k = s_oSpriteLibrary.getSprite("cell"); e = createBitmap(k); e.scaleX = e.scaleY = h; l = s_oSpriteLibrary.getSprite("tokenX"); p = createBitmap(l); p.x = k.width / 2 * h; p.y = k.height / 2 * h; p.regX = l.width / 2; p.regY = l.height / 2; p.scaleX = p.scaleY = h; p.alpha = 0; l = s_oSpriteLibrary.getSprite("tokenO"); q = createBitmap(l); q.x = k.width / 2 * h; q.y = k.height / 2 * h; q.regX = l.width / 2; q.regY = l.height / 2; q.scaleX = q.scaleY = h; q.alpha = 0; f = new createjs.Shape; f.graphics.beginFill("black").drawRect(0, 0, CELL_SIZE * h, CELL_SIZE * h); f.alpha = .05; d = new createjs.Container; d.x = a; d.y = c; d.cursor = "pointer"; d.addChild(e, p, q, f); d.on("click", function() { this.clicked() }, this); s_oStage.addChild(d) }; this.unload = function() { d.removeAllEventListeners(); s_oStage.removeChild(d) }; this.clicked = function() { s_oGame.isFrozen() || (d.removeAllEventListeners(), s_oGame.freeze(), this.showToken()) }; this.showToken = function() { playSound("place_mark", 1, !1); 1 === s_oGame.getActivePlayer() ? (m = 1, p.scaleX = p.scaleY = .5, p.alpha = .1, p.visible = !0, createjs.Tween.get(p).to({ scaleX: 1.2 * b, scaleY: 1.2 * b, alpha: 1 }, 200, createjs.Ease.cubicOut).call(function() { createjs.Tween.get(p).to({ scaleX: 1 * b, scaleY: 1 * b }, 200, createjs.Ease.cubicIn).call(function() { s_oGame.unFreeze(); s_oGame.updateGameStatus(n, g) }) })) : (m = 2, q.scaleX = p.scaleY = .5, q.alpha = .1, q.visible = !0, createjs.Tween.get(q).to({ scaleX: 1.2 * b, scaleY: 1.2 * b, alpha: 1 }, 200, createjs.Ease.cubicOut).call(function() { createjs.Tween.get(q).to({ scaleX: 1 * b, scaleY: 1 * b }, 200, createjs.Ease.cubicIn).call(function() { s_oGame.unFreeze(); s_oGame.updateGameStatus(n, g) }) })) }; this.AIMove = function() { d.removeAllEventListeners(); s_oGame.freeze(); m = 2; q.alpha = 0; createjs.Tween.get(q).wait(1E3).to({ scaleX: 1.2 * b, scaleY: 1.2 * b, alpha: 1 }, 250, createjs.Ease.cubicOut).call(function() { playSound("place_mark", 1, !1); createjs.Tween.get(q).to({ scaleX: 1 * b, scaleY: 1 * b }, 250, createjs.Ease.cubicIn).call(function() { s_oGame.unFreeze(); s_oGame.updateGameStatus(n, g) }) }) }; this.EndAnim = function() { s_oGame.freeze(); 1 === m ? createjs.Tween.get(p).to({ scaleX: 1.5 * b, scaleY: 1.5 * b, alpha: .8 }, 1E3, createjs.Ease.cubicInOut).call(function() { createjs.Tween.get(p).to({ scaleX: 1 * b, scaleY: 1 * b, alpha: 1 }, 1500, createjs.Ease.bounceOut).call(function() { s_oGame.showEndPanel() }) }) : createjs.Tween.get(q).to({ scaleX: 1.5 * b, scaleY: 1.5 * b, alpha: .8 }, 1E3, createjs.Ease.cubicInOut).call(function() { createjs.Tween.get(q).to({ scaleX: 1 * b, scaleY: 1 * b, alpha: 1 }, 1500, createjs.Ease.bounceOut).call(function() { s_oGame.showEndPanel() }) }) }; this._init(a, h, k, c, l) } function CEndPanel(a) { var h, k, c, l, m, n, g; this._init = function(a) { c = new createjs.Shape; c.graphics.beginFill("black").drawRect(0, 0, CANVAS_WIDTH, CANVAS_HEIGHT); c.alpha = .7; n = c.on("click", function() {}); s_oStage.addChild(c); var b = s_oSpriteLibrary.getSprite("msg_box"); h = createBitmap(b); h.regX = b.width / 2; h.regY = b.height / 2; h.x = CANVAS_WIDTH / 2; h.y = CANVAS_HEIGHT / 2; s_oStage.addChild(h); g = new createjs.Container; g.x = CANVAS_WIDTH / 2; g.y = CANVAS_HEIGHT / 2 - 320; s_oStage.addChild(g); b = createBitmap(s_oSpriteLibrary.getSprite("tokenX")); var q = new createjs.Text(TEXT_PL1_VICTORY, "100px " + FONT_GAME, "White"); q.textBaseline = "alphabetic"; q.textAlign = "center"; g.addChild(b); g.addChild(q); switch (a) { case X_WINS: q.text = TEXT_PL1_VICTORY; q.x = 70; b.image = s_oSpriteLibrary.getSprite("tokenX"); b.x = -390; b.y = -90; var e = POINTS_EARNED.win; break; case O_WINS: q.text = TEXT_PL2_VICTORY; q.x = 70; b.image = s_oSpriteLibrary.getSprite("tokenO"); b.x = -390; b.y = -90; e = POINTS_EARNED.lose; break; case DRAW: q.text = TEXT_DRAW, g.removeChild(b), e = POINTS_EARNED.draw } b = s_oSpriteLibrary.getSprite("but_box_2"); k = new CTextButton(CANVAS_WIDTH / 2, CANVAS_HEIGHT / 2 + 340, b, TEXT_PLAYAGAIN, FONT_GAME, "#008df0", 60, s_oStage); k.addEventListener(ON_MOUSE_UP, this._onButPlayAgain, this); s_bTwoPlayerMode ? (b = s_oSpriteLibrary.getSprite("msg_box_small"), h.image = b, h.regX = b.width / 2, h.regY = b.height / 2, g.y = CANVAS_HEIGHT / 2 - 180, k.setPosition(k.getX(), CANVAS_HEIGHT / 2 + 200)) : (b = s_oSpriteLibrary.getSprite("star_white"), m = new createjs.Container, m.x = CANVAS_WIDTH / 2 - 50, m.y = CANVAS_HEIGHT / 2 + 20, s_oStage.addChild(m), q = createBitmap(b), q.regX = b.width / 2, q.regY = b.height / 2, m.addChild(q), q = new createjs.Text(s_iTotalScore, "70px " + FONT_GAME, "#FFFFFF"), q.x = b.width / 2 + 10, q.y = 0, q.textBaseline = "middle", q.textAlign = "left", m.addChild(q), (new CRollingText(q, e + s_iTotalScore, 1E3, !1)).addValueAnimation(0, 0, m, e), s_iTotalScore += e, s_oLocalStorage.saveData(), $(s_oMain).trigger("save_score", s_iTotalScore), $(s_oMain).trigger("share_event", s_iTotalScore)); l = new createjs.Shape; l.graphics.beginFill("black").drawRect(0, 0, CANVAS_WIDTH, CANVAS_HEIGHT); s_oStage.addChild(l); $(s_oMain).trigger("end_game", [a]); createjs.Tween.get(l).to({ alpha: 0 }, 1E3).call(function() { l.visible = !1 }) }; this.unload = function() { k.unload(); k = null; $(s_oMain).trigger("show_interlevel_ad"); c.off("click", n); s_oStage.removeChild(g); s_oStage.removeChild(h); s_oStage.removeChild(m); s_oStage.removeChild(l) }; this._onButPlayAgain = function() { this.unload(); s_oGame.unload() }; this._init(a) } function CCreditsPanel() { var a, h, k, c, l, m, n, g, b; this._init = function() { b = new createjs.Container; s_oStage.addChild(b); var p = createBitmap(s_oSpriteLibrary.getSprite("bg_menu")); b.addChild(p); l = new createjs.Shape; l.graphics.beginFill("rgba(0,0,0,0.7)").drawRect(0, 0, CANVAS_WIDTH, CANVAS_HEIGHT); b.addChild(l); p = s_oSpriteLibrary.getSprite("msg_box_small"); h = createBitmap(p); h.x = CANVAS_WIDTH / 2; h.y = CANVAS_HEIGHT / 2; h.regX = p.width / 2; h.regY = p.height / 2; b.addChild(h); c = new createjs.Text(TEXT_CREDITS_DEVELOPED, "50px Arial", "#ffffff"); c.x = CANVAS_WIDTH / 2; c.y = 870; c.textAlign = "center"; b.addChild(c); p = s_oSpriteLibrary.getSprite("logo_credits"); var q = createBitmap(p); q.regX = p.width / 2; q.regY = p.height / 2; q.x = CANVAS_WIDTH / 2; q.y = 990; b.addChild(q); g = new createjs.Text(TEXT_LINK, "50px Arial", "#ffffff"); g.x = CANVAS_WIDTH / 2; g.y = 1050; g.textAlign = "center"; b.addChild(g); m = new createjs.Shape; m.graphics.beginFill("#0f0f0f").drawRect(0, 0, CANVAS_WIDTH, CANVAS_HEIGHT); m.alpha = .01; n = m.on("click", this._onLogoButRelease); b.addChild(m); p = s_oSpriteLibrary.getSprite("but_exit"); a = CANVAS_WIDTH / 2 + 380; k = new CGfxButton(a, 754, p, b); k.addEventListener(ON_MOUSE_UP, this.unload, this) }; this.unload = function() { m.off("click", n); k.unload(); k = null; s_oStage.removeChild(b) }; this._onLogoButRelease = function() { window.open("http://www.codethislab.com/index.php?&l=en") }; this._init() } function CRollingText(a, h, k, c) { var l = null, m; this._init = function(a, g, b) { m = { value: a.text }; l = createjs.Tween.get(m, { override: !0 }).to({ value: g }, b, createjs.Ease.sineOut).addEventListener("change", function() { a.text = c ? formatTime(m.value) : Math.floor(m.value) }).call(function() { createjs.Tween.removeTweens(l) }) }; this.addValueAnimation = function(c, g, b, h) { c = new createjs.Text("+" + h, "70px " + FONT_GAME, "#FFFFFF"); c.x = a.x; c.y = a.y; c.textBaseline = "middle"; c.textAlign = "left"; b.addChild(c); createjs.Tween.get(c).to({ y: -100 }, 1E3, createjs.Ease.sineOut); createjs.Tween.get(c).wait(600).to({ alpha: 0 }, 900) }; this._init(a, h, k); return this } var LOCALSTORAGE_TOTALSCORE = "totalscore", s_iTotalScore = 0; function CLocalStorage(a) { var h = !0; this._init = function(a) { try { var c = window.localStorage.getItem(a); this.resetData(); null !== c && void 0 !== c && this.loadData() } catch (l) { this.resetData() } }; this.isDirty = function() { return 0 < s_iTotalScore ? !0 : !1 }; this.isUsed = function() { try { window.localStorage.setItem("ls_available", "ok") } catch (k) { h = !1 } return h }; this.resetData = function() { s_iTotalScore = 0 }; this.deleteData = function() { window.localStorage.removeItem(a) }; this.saveData = function() { var h = {}; h[LOCALSTORAGE_TOTALSCORE] = s_iTotalScore; window.localStorage.setItem(a, JSON.stringify(h)) }; this.loadData = function() { var h = JSON.parse(window.localStorage.getItem(a))[LOCALSTORAGE_TOTALSCORE]; s_iTotalScore = parseInt(h) }; this._init(a) } function CAreYouSurePanel(a, h) { var k, c, l, m, n, g; this._init = function(a, b) { n = new createjs.Shape; n.graphics.beginFill("black").drawRect(0, 0, CANVAS_WIDTH, CANVAS_HEIGHT); n.alpha = 0; n.on("mousedown", function() {}); s_oStage.addChild(n); createjs.Tween.get(n).to({ alpha: .7 }, 500); g = new createjs.Container; s_oStage.addChild(g); var e = s_oSpriteLibrary.getSprite("msg_box_small"), f = createBitmap(e); f.regX = e.width / 2; f.regY = e.height / 2; g.addChild(f); g.x = CANVAS_WIDTH / 2; g.y = CANVAS_HEIGHT + e.height / 2; k = g.y; createjs.Tween.get(g).to({ y: CANVAS_HEIGHT / 2 - 40 }, 500, createjs.Ease.cubicOut); c = new createjs.Text(TEXT_ARE_SURE, " 50px " + FONT_GAME, "#ffffff"); c.y = -e.height / 2 + 120; c.textAlign = "center"; c.textBaseline = "middle"; c.lineWidth = 800; g.addChild(c); l = new CGfxButton(110, 160, s_oSpriteLibrary.getSprite("but_yes"), g); l.addEventListener(ON_MOUSE_UP, this._onButYes, this); m = new CGfxButton(-110, 160, s_oSpriteLibrary.getSprite("but_exit"), g); m.addEventListener(ON_MOUSE_UP, this._onButNo, this); m.pulseAnimation() }; this._onButYes = function() { m.setClickable(!1); l.setClickable(!1); createjs.Tween.get(n).to({ alpha: 0 }, 500); createjs.Tween.get(g).to({ y: k }, 400, createjs.Ease.backIn).call(function() { b.unload(); a && a() }) }; this._onButNo = function() { m.setClickable(!1); l.setClickable(!1); createjs.Tween.get(n).to({ alpha: 0 }, 500); createjs.Tween.get(g).to({ y: k }, 400, createjs.Ease.backIn).call(function() { b.unload(); h && h() }) }; this.changeMessage = function(a, b) { c.text = a; b && (c.font = " " + b + "px " + FONT_GAME) }; this.setMessageY = function(a) { c.y = a }; this.unload = function() { m.unload(); l.unload(); s_oStage.removeChild(n); s_oStage.removeChild(g); n.off("mousedown", function() {}) }; var b = this; this._init(a, h) } function CMsgBox(a, h) { var k, c, l, m, n; this._init = function(a, g) { m = new createjs.Shape; m.graphics.beginFill("black").drawRect(0, 0, CANVAS_WIDTH, CANVAS_HEIGHT); m.alpha = 0; m.on("mousedown", function() {}); s_oStage.addChild(m); (new createjs.Tween.get(m)).to({ alpha: .7 }, 500); n = new createjs.Container; s_oStage.addChild(n); var b = s_oSpriteLibrary.getSprite("msg_box_small"), e = createBitmap(b); e.regX = b.width / 2; e.regY = b.height / 2; n.addChild(e); n.x = CANVAS_WIDTH / 2; n.y = CANVAS_HEIGHT + b.height / 2; k = n.y; (new createjs.Tween.get(n)).to({ y: CANVAS_HEIGHT / 2 - 40 }, 500, createjs.Ease.quartIn); c = new createjs.Text(a, " 50px " + FONT_GAME, "#ffffff"); c.y = -b.height / 2 + 60; c.textAlign = "center"; c.textBaseline = "middle"; c.lineWidth = 800; n.addChild(c); l = new CGfxButton(0, 160, s_oSpriteLibrary.getSprite("but_yes"), n); l.addEventListener(ON_MOUSE_UP, this._onButYes, this); l.pulseAnimation() }; this._onButYes = function() { l.setClickable(!1); (new createjs.Tween.get(m)).to({ alpha: 0 }, 500); (new createjs.Tween.get(n)).to({ y: k }, 400, createjs.Ease.backIn).call(function() { g.unload(); h && h() }) }; this.changeMessage = function(a) { c.text = a }; this.unload = function() { l.unload(); s_oStage.removeChild(m); s_oStage.removeChild(n); m.off("mousedown", function() {}) }; var g = this; this._init(a, h) } 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("."), k = h.length; 2 < k && (a = h[k - 2] + "." + h[k - 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 (k) { h = !0 } return { topFrame: a, err: h } }, getBestPageUrl = function(a) { var h = a.topFrame, k = ""; if (a.err) try { try { k = window.top.location.href } catch (l) { var c = window.location.ancestorOrigins; k = c[c.length - 1] } } catch (l) { k = h.document.referrer } else k = h.location.href; return k }, 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)], k = 0; k < h.length; k++) if (h[k] === a) return !0; return !1 };
| ver. 1.4 |
Github
|
.
| PHP 8.2.29 | Генераци� �траницы: 0 |
proxy
|
phpinfo
|
�а�тройка