diff --git a/js/game_manager.js b/js/game_manager.js index 91c0390b15590ac5c453ef9df3da23929928f916..01ce04c3bbec283e254f0c1e54d41a0b62b17b30 100644 --- a/js/game_manager.js +++ b/js/game_manager.js @@ -211,8 +211,6 @@ GameManager.prototype.tileMatchesAvailable = function () { var cell = { x: x + vector.x, y: y + vector.y }; var other = self.grid.cellContent(cell); - if (other) { - } if (other && other.value === tile.value) { return true; // These two tiles can be merged diff --git a/js/html_actuator.js b/js/html_actuator.js index 0984570eb42fab123e1edcf85f2cc8bff5b82a6d..5562ce9c11abd4e5bf05bfff71f4603d4b6775ef 100644 --- a/js/html_actuator.js +++ b/js/html_actuator.js @@ -1,7 +1,7 @@ function HTMLActuator() { this.tileContainer = document.querySelector(".tile-container"); this.scoreContainer = document.querySelector(".score-container"); - this.bestContainer = document.querySelector(".best-container"); + this.bestContainer = document.querySelector(".best-container"); this.messageContainer = document.querySelector(".game-message"); this.score = 0; diff --git a/js/keyboard_input_manager.js b/js/keyboard_input_manager.js index bcd6f199a0a5cc9389f9379e9a85a845de9b8f90..24dde7a1238e32dcf29b2f15d790450a42d6dce1 100644 --- a/js/keyboard_input_manager.js +++ b/js/keyboard_input_manager.js @@ -59,20 +59,22 @@ KeyboardInputManager.prototype.listen = function () { // Listen to swipe events var touchStartClientX, touchStartClientY; var gameContainer = document.getElementsByClassName("game-container")[0]; - gameContainer.addEventListener("touchstart", function(event) { + + gameContainer.addEventListener("touchstart", function (event) { if (event.touches.length > 1) return; touchStartClientX = event.touches[0].clientX; touchStartClientY = event.touches[0].clientY; event.preventDefault(); }); - gameContainer.addEventListener("touchmove", function(event) { + + gameContainer.addEventListener("touchmove", function (event) { event.preventDefault(); }); - gameContainer.addEventListener("touchend", function(event) { - if (event.touches.length > 0) { - return; - } + + gameContainer.addEventListener("touchend", function (event) { + if (event.touches.length > 0) return; + var dx = event.changedTouches[0].clientX - touchStartClientX; var absDx = Math.abs(dx); diff --git a/js/local_score_manager.js b/js/local_score_manager.js index 95c6966a6ef011d818cc02d8d6e08412fd0aab99..7e35cd166e9467d30724612fe10b451852006781 100644 --- a/js/local_score_manager.js +++ b/js/local_score_manager.js @@ -1,7 +1,7 @@ window.fakeStorage = { _data : {}, setItem : function (id, val) { - console.log('set'); + console.log("set"); return this._data[id] = String(val); }, getItem : function (id) { @@ -13,8 +13,9 @@ window.fakeStorage = { function LocalScoreManager() { var localSupported = !!window.localStorage; - this.key = 'bestScore'; - this.storage = localSupported ? window.localStorage : window.fakeStorage; + + this.key = "bestScore"; + this.storage = localSupported ? window.localStorage : window.fakeStorage; } LocalScoreManager.prototype.get = function () {