h('button',
{
on: { click: this.clickGameSeek },
- attrs: { "aria-label": 'New online game' },
+ attrs: { "aria-label": translations['New online game'] },
'class': {
"tooltip": true,
"play": true,
h('button',
{
on: { click: this.clickComputerGame },
- attrs: { "aria-label": 'New game VS computer' },
+ attrs: { "aria-label": translations['New game versus computer'] },
'class': {
"tooltip":true,
"play": true,
h('button',
{
on: { click: this.clickFriendGame },
- attrs: { "aria-label": 'New IRL game' },
+ attrs: { "aria-label": translations['Analysis mode'] },
'class': {
"tooltip":true,
"play": true,
{
on: { click: this.startChat },
attrs: {
- "aria-label": 'Start chat',
+ "aria-label": translations['Start chat'],
"id": "chatBtn",
},
'class': {
{
on: { click: this.clearComputerGame },
attrs: {
- "aria-label": 'Clear computer game',
+ "aria-label": translations['Clear game versus computer'],
"id": "clearBtn",
},
'class': {
{
on: { click: this.showSettings },
attrs: {
- "aria-label": 'Settings',
+ "aria-label": translations['Settings'],
"id": "settingsBtn",
},
'class': {
h('button',
{
on: { click: this.resign },
- attrs: { "aria-label": 'Resign' },
+ attrs: { "aria-label": translations['Resign'] },
'class': {
"tooltip":true,
"play": true,
h('button',
{
on: { click: e => this.undo() },
- attrs: { "aria-label": 'Undo' },
+ attrs: { "aria-label": translations['Undo'] },
"class": {
"play": true,
"spaceleft": true,
h('button',
{
on: { click: e => this.play() },
- attrs: { "aria-label": 'Play' },
+ attrs: { "aria-label": translations['Play'] },
"class": {
"play": true,
"spaceleft": true,
h('button',
{
on: { click: this.undoInGame },
- attrs: { "aria-label": 'Undo' },
+ attrs: { "aria-label": translations['Undo'] },
"class": {
"play": true,
"spaceleft": true,
h('button',
{
on: { click: () => { this.mycolor = this.vr.getOppCol(this.mycolor) } },
- attrs: { "aria-label": 'Flip' },
+ attrs: { "aria-label": translations['Flip'] },
"class": {
"play": true,
"spaceleft": true,
[
h('div',
{
- "class": { "card": true, "smallpad": true },
+ "class": {
+ "card": true,
+ "smallpad": true,
+ "small-modal": true,
+ "text-center": true,
+ },
},
[
h('label',
{
attrs: { "id": "titleFenedit" },
"class": { "section": true },
- domProps: { innerHTML: "Position + flags (FEN):" },
+ domProps: { innerHTML: translations["Position + flags (FEN):"] },
}
),
h('input',
this.newGame("friend", fen);
}
},
- domProps: { innerHTML: "Ok" },
+ domProps: { innerHTML: translations["Ok"] },
}
),
h('button',
VariantRules.GenRandInitFen();
}
},
- domProps: { innerHTML: "Random" },
+ domProps: { innerHTML: translations["Random"] },
}
),
]
{
attrs: { "id": "settingsTitle" },
"class": { "section": true },
- domProps: { innerHTML: "Preferences" },
+ domProps: { innerHTML: translations["Preferences"] },
}
),
h('fieldset',
h('label',
{
attrs: { for: "nameSetter" },
- domProps: { innerHTML: "My name is..." },
+ domProps: { innerHTML: translations["My name is..."] },
},
),
h('input',
h('label',
{
attrs: { for: "setHints" },
- domProps: { innerHTML: "Show hints?" },
+ domProps: { innerHTML: translations["Show hints?"] },
},
),
h('input',
h('label',
{
attrs: { for: "selectColor" },
- domProps: { innerHTML: "Board colors" },
+ domProps: { innerHTML: translations["Board colors"] },
},
),
h("select",
{
domProps: {
"value": "lichess",
- innerHTML: "brown"
+ innerHTML: translations["brown"]
},
attrs: { "selected": this.color=="lichess" },
}
{
domProps: {
"value": "chesscom",
- innerHTML: "green"
+ innerHTML: translations["green"]
},
attrs: { "selected": this.color=="chesscom" },
}
{
domProps: {
"value": "chesstempo",
- innerHTML: "blue"
+ innerHTML: translations["blue"]
},
attrs: { "selected": this.color=="chesstempo" },
}
h('label',
{
attrs: { for: "selectSound" },
- domProps: { innerHTML: "Play sounds?" },
+ domProps: { innerHTML: translations["Play sounds?"] },
},
),
h("select",
{
domProps: {
"value": "0",
- innerHTML: "None"
+ innerHTML: translations["None"]
},
attrs: { "selected": this.sound==0 },
}
{
domProps: {
"value": "1",
- innerHTML: "Newgame"
+ innerHTML: translations["New game"]
},
attrs: { "selected": this.sound==1 },
}
{
domProps: {
"value": "2",
- innerHTML: "All"
+ innerHTML: translations["All"]
},
attrs: { "selected": this.sound==2 },
}
{
attrs: { "id": "titleChat" },
"class": { "section": true },
- domProps: { innerHTML: "Chat with " + this.oppName },
+ domProps: { innerHTML: translations["Chat with "] + this.oppName },
}
)
];
attrs: {
"id": "input-chat",
type: "text",
- placeholder: "Type here",
+ placeholder: translations["Type here"],
},
on: { keyup: this.trySendChat }, //if key is 'enter'
}
{
attrs: { id: "sendChatBtn"},
on: { click: this.sendChat },
- domProps: { innerHTML: "Send" },
+ domProps: { innerHTML: translations["Send"] },
}
)
]);
{
attrs: { "id": "downloadBtn" },
on: { click: this.download },
- domProps: { innerHTML: "Download game" },
+ domProps: { innerHTML: translations["Download game"] },
}
),
]
h('h3',
{
"class": { clickable: true },
- domProps: { innerHTML: "Show solution" },
+ domProps: { innerHTML: translations["Show solution"] },
on: { click: this.toggleShowSolution },
}
),
switch (this.score)
{
case "1-0":
- eogMessage = "White win";
+ eogMessage = translations["White win"];
break;
case "0-1":
- eogMessage = "Black win";
+ eogMessage = translations["Black win"];
break;
case "1/2":
- eogMessage = "Draw";
+ eogMessage = translations["Draw"];
break;
}
return eogMessage;
// We opened another tab on the same game
this.mode = "idle";
this.vr = null;
- alert("Already playing a game in this variant on another tab!");
+ alert(translations[
+ "Already playing a game in this variant on another tab!"]);
break;
case "newgame": //opponent found
// oppid: opponent socket ID
{
const storageVariant = localStorage.getItem("variant");
if (!!storageVariant && storageVariant !== variant)
- return alert("Finish your " + storageVariant + " game first!");
+ {
+ return alert(translations["Finish your "] +
+ storageVariant + translations[" game first!"]);
+ }
// Send game request and wait..
try {
this.conn.send(JSON.stringify({code:"newgame", fen:fen}));
const score = localStorage.getItem("comp-score");
if (storageVariant !== variant && score == "*")
{
- if (!confirm("Unfinished " + storageVariant +
- " computer game will be erased"))
+ if (!confirm(storageVariant +
+ translations[": unfinished computer game will be erased"]))
{
return;
}
const fen = localStorage.getItem(prefix+"fen");
const score = localStorage.getItem(prefix+"score"); //set in "endGame()"
this.fenStart = localStorage.getItem(prefix+"fenStart");
+ this.vr = new VariantRules(fen, moves);
if (mode == "human")
{
this.gameId = localStorage.getItem("gameId");
code:"ping",oppid:this.oppid,gameId:this.gameId}));
}
else
+ {
this.compWorker.postMessage(["init",fen]);
- this.vr = new VariantRules(fen, moves);
+ if (this.mycolor != this.vr.turn)
+ this.playComputerMove();
+ }
if (moves.length > 0)
{
const lastMove = moves[moves.length-1];