This commit is contained in:
Raphaël Jakse 2020-04-27 19:57:45 +02:00
parent 16b829040f
commit 35c635571f
3 changed files with 21 additions and 16 deletions

View File

@ -39,10 +39,7 @@
],
"callback-return": "error",
"camelcase": "error",
"capitalized-comments": [
"error",
"always"
],
"capitalized-comments": "off",
"class-methods-use-this": "error",
"comma-dangle": "error",
"comma-spacing": [

View File

@ -555,7 +555,9 @@ function handleCommand(cmdNumber, message, response) {
}
letter = rack[cmd.indexFrom];
operations.push(() => {rack[cmd.indexFrom] = "";});
operations.push(() => {
rack[cmd.indexFrom] = "";
});
break;
case "board":
@ -574,7 +576,9 @@ function handleCommand(cmdNumber, message, response) {
return false;
}
operations.push(() => {letter = game.bagPopLetter(playerName);});
operations.push(() => {
letter = game.bagPopLetter(playerName);
});
break;
default:
@ -596,7 +600,9 @@ function handleCommand(cmdNumber, message, response) {
return false;
}
operations.push(() => {rack[cmd.indexTo] = letter;});
operations.push(() => {
rack[cmd.indexTo] = letter;
});
break;
case "board":
@ -623,8 +629,8 @@ function handleCommand(cmdNumber, message, response) {
response.write(
JSON.stringify({
error:0,
rack: (cmd.from === "bag" && cmd.to === "rack") ? rack : undefined,
error: 0,
rack: (cmd.from === "bag" && cmd.to === "rack") ? rack : undefined, // eslint-disable-line no-undefined
remainingLetters: game.bag.length
})
);

View File

@ -43,7 +43,9 @@
setConf("MAX_WEBSOCKET_ERRORS", 1);
setConf("APP_PATH", "");
const _ = (window.libD && libD.l10n) ? libD.l10n() : function (s) {return s;};
const _ = (window.libD && libD.l10n) ? libD.l10n() : function (s) {
return s;
};
const trivabble = window.trivabble = {l10n: _};
@ -235,11 +237,11 @@
if (moveCMD.to === moveCMD.from) {
if (moveCMD.indexTo !== moveCMD.indexFrom) {
if (moveCMD.from === "rack") {
sendCmds([moveRack]);
} else {
sendCmds([moveCMD]);
}
sendCmds([
(moveCMD.from === "rack")
? moveRack
: moveCMD
]);
}
} else if (moveCMD.to === "rack") {
moveRack.rack[moveCMD.indexTo] = "";
@ -1300,7 +1302,7 @@
type: "rack",
rack: letters.map(
function (tile) {
return tile.querySelector(".tile-letter").textContent
return tile.querySelector(".tile-letter").textContent;
}
)
}