Skip to content
This repository has been archived by the owner on May 22, 2022. It is now read-only.

Commit

Permalink
More CodeClimateControl :sun:
Browse files Browse the repository at this point in the history
  • Loading branch information
jfkz committed Jul 24, 2016
1 parent 2c41be9 commit 5dd296b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
3 changes: 3 additions & 0 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
engines:
duplication:
enabled: true
exclude_fingerprints:
- 2a1694a4e6b79bdfb4dbe34e6c04a097
- f85d548cc10c68f7803699ac7025e196
config:
languages:
- ruby
Expand Down
20 changes: 10 additions & 10 deletions scripts/chess_controller.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*eslint-env browser*/
/* global chrome, CMD_START_BOT, bot */
/* global chrome */

var Bot = function ($) {
var engine = {},
Expand All @@ -11,7 +11,7 @@ var Bot = function ($) {
}

var g_backgroundEngineValid = true,
g_backgroundEngine,
g_backgroundEngine = null,
g_analyzing = false,
blob = null;

Expand Down Expand Up @@ -43,14 +43,14 @@ var Bot = function ($) {
}

function EnsureAnalysisStopped() {
if (g_analyzing && g_backgroundEngine != null) {
if (g_analyzing && g_backgroundEngine !== null) {
g_backgroundEngine.terminate();
g_backgroundEngine = null;
}
}

function MakeMove(move) {
if (engine.moveFound != null) {
if (engine.moveFound !== null) {
engine.moveFound(move);
} else {
console.error("Error move:" + move);
Expand All @@ -62,7 +62,7 @@ var Bot = function ($) {
return false;
}

if (g_backgroundEngine == null) {
if (g_backgroundEngine === null) {
// g_backgroundEngineValid = true;
try {
g_backgroundEngine = new Worker(window.URL.createObjectURL(blob));
Expand Down Expand Up @@ -145,7 +145,7 @@ var Bot = function ($) {

engine.makeLiveSuggest = function (movesArray) {
// Terminate engine
if (g_backgroundEngine != null) {
if (g_backgroundEngine !== null) {
g_backgroundEngine.terminate();
g_backgroundEngine = null;
}
Expand Down Expand Up @@ -382,16 +382,16 @@ var PageManager = function($, window, cookieManager){
is_flipped = isBetaDesign ? $boardContainer.parent().find(".player-info.black.bottom").length > 0 : $board.hasClass('chess_boardFlipped'),
betaPositionFix = isBetaDesign ? (is_flipped ? -1 : 1 ) : 0,
betaVerticalFix = isBetaDesign ? (is_flipped ? boardHeight / 55 : -boardHeight / 55 ) : 1,
betaHorizontalFix = isBetaDesign ? 0 : 1;
betaHorizontalFix = isBetaDesign ? 0 : 1,
$boardArea = $board.find("div[id^=chessboard_][id$=_boardarea]");

/*
// I keep this unusefull code to remember how can i made it fully automattic
$board.find('.chess_com_piece.pinked').css('background-color', '');
$board.find("img[id^=img_chessboard_][id$=_" + fromSquare+ "]").addClass('pinked').css('background-color', 'pink');
*/
// Move pinkSquares to the right place
$boardArea = $board.find("div[id^=chessboard_][id$=_boardarea]");

// Move pinkSquares to the right place
function placeSquareToPoint($square, point) {
var pinkTop, pinkLeft;
if (!is_flipped) {
Expand Down Expand Up @@ -428,7 +428,7 @@ var PageManager = function($, window, cookieManager){
humanMoves = humanMoves.split(' ');
for (hm in humanMoves) {
if (hm == 0) { continue; }
humanMoves[hm] = ((parseInt(hm) + currentColor) % 2 == 0 ? '↑' : '↓') + humanMoves[hm];
humanMoves[hm] = ((parseInt(hm, 10) + currentColor) % 2 == 0 ? '↑' : '↓') + humanMoves[hm];
}
move = (currentColor % 2 == 0 ? '↑' : '↓') + humanMoves.slice(0,5).join(' ');
}
Expand Down

0 comments on commit 5dd296b

Please sign in to comment.