Fix some typos in the code and comments
parent
c4bdc25c82
commit
5ae8237809
|
@ -144,7 +144,7 @@ trait ScalatagsExtensions {
|
|||
|
||||
val targetBlank: Modifier = (t: Builder) => {
|
||||
// Prevent tab nabbing when opening untrusted links. Apply also to trusted
|
||||
// links, because there can be a small peformance advantage and lila does
|
||||
// links, because there can be a small performance advantage and lila does
|
||||
// not use window.opener anywhere. Will not be overwritten by additional
|
||||
// rels.
|
||||
t.setAttr("rel", Builder.GenericAttrValueSource("noopener"))
|
||||
|
|
|
@ -229,7 +229,7 @@ object tree {
|
|||
p("Did you create multiple accounts? If so, remember that you promised not to, on the sign up page."),
|
||||
p(
|
||||
"If you violated the terms of service on a previous account, then you are not allowed to make a new one, ",
|
||||
"unless it was explicitely allowed by the moderation team during an appeal."
|
||||
"unless it was explicitly allowed by the moderation team during an appeal."
|
||||
),
|
||||
p(
|
||||
"If you never violated the terms of service, and didn't make several accounts, then you can appeal this account closure:"
|
||||
|
|
|
@ -149,7 +149,7 @@ object dgt {
|
|||
List((false, trans.no.txt()), (true, trans.yes.txt()))
|
||||
),
|
||||
st.small(cls := "form-help")(
|
||||
"""Select YES to annouce both your moves and your opponent's moves. Select NO to annouce only your opponent's moves."""
|
||||
"""Select YES to announce both your moves and your opponent's moves. Select NO to announce only your opponent's moves."""
|
||||
)
|
||||
),
|
||||
div(cls := "form-group")(
|
||||
|
|
|
@ -49,7 +49,7 @@ function wasmInfo() {
|
|||
}
|
||||
|
||||
function localStorageInfo() {
|
||||
var intresting = [
|
||||
var interesting = [
|
||||
'client-eval-enabled',
|
||||
'analyse.ceval.max-depth',
|
||||
'analyse.ceval.multipv',
|
||||
|
@ -65,8 +65,8 @@ function localStorageInfo() {
|
|||
'surl7'
|
||||
];
|
||||
var info = {};
|
||||
for (var i = 0; i < intresting.length; i++) {
|
||||
info[intresting[i]] = window.localStorage.getItem(intresting[i]);
|
||||
for (var i = 0; i < interesting.length; i++) {
|
||||
info[interesting[i]] = window.localStorage.getItem(interesting[i]);
|
||||
}
|
||||
return info;
|
||||
}
|
||||
|
|
|
@ -114,7 +114,7 @@ export function getBestEval(evs: NodeEvals): Eval | undefined {
|
|||
if (!serverEv) return localEv;
|
||||
if (!localEv) return serverEv;
|
||||
|
||||
// Prefer localEv if it exeeds fishnet node limit or finds a better mate.
|
||||
// Prefer localEv if it exceeds fishnet node limit or finds a better mate.
|
||||
if (
|
||||
localEv.nodes > serverNodes ||
|
||||
(typeof localEv.mate !== 'undefined' &&
|
||||
|
|
|
@ -33,8 +33,8 @@ export function povChances(color: Color, ev: Eval): number {
|
|||
}
|
||||
|
||||
// computes the difference, in winning chances, between two evaluations
|
||||
// 1 = e1 is infinately better than e2
|
||||
// -1 = e1 is infinately worse than e2
|
||||
// 1 = e1 is infinitely better than e2
|
||||
// -1 = e1 is infinitely worse than e2
|
||||
export function povDiff(color: Color, e1: Eval, e2: Eval): number {
|
||||
return (povChances(color, e1) - povChances(color, e2)) / 2;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Uniboard: keep the same page layout accross pages */
|
||||
/* Uniboard: keep the same page layout across pages */
|
||||
|
||||
$mq-board-resizable: $mq-small;
|
||||
$mq-col1-uniboard: $mq-not-small $mq-portrait;
|
||||
|
|
|
@ -473,7 +473,7 @@
|
|||
line-height: inherit;
|
||||
position: relative;
|
||||
|
||||
// #160 Line break (\n) as delimeter
|
||||
// #160 Line break (\n) as delimiter
|
||||
white-space: pre-wrap;
|
||||
|
||||
color: $input-color;
|
||||
|
@ -712,7 +712,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
// intial state, pre-rendered
|
||||
// initial state, pre-rendered
|
||||
&--initial {
|
||||
#{$dropdown}__wrapper {
|
||||
max-height: 20px;
|
||||
|
|
|
@ -173,7 +173,7 @@ export default function (token: string) {
|
|||
*
|
||||
* Get my profile
|
||||
*
|
||||
* Shows Public informations about the logged in user.
|
||||
* Shows Public information about the logged in user.
|
||||
*
|
||||
* Example
|
||||
* {"id":"andrescavallin","username":"andrescavallin","online":true,"perfs":{"blitz":{"games":0,"rating":1500,"rd":350,"prog":0,"prov":true},"bullet":{"games":0,"rating":1500,"rd":350,"prog":0,"prov":true},"correspondence":{"games":0,"rating":1500,"rd":350,"prog":0,"prov":true},"classical":{"games":0,"rating":1500,"rd":350,"prog":0,"prov":true},"rapid":{"games":0,"rating":1500,"rd":350,"prog":0,"prov":true}},"createdAt":1599930231644,"seenAt":1599932744930,"playTime":{"total":0,"tv":0},"language":"en-US","url":"http://localhost:9663/@/andrescavallin","nbFollowing":0,"nbFollowers":0,"count":{"all":0,"rated":0,"ai":0,"draw":0,"drawH":0,"loss":0,"lossH":0,"win":0,"winH":0,"bookmark":0,"playing":0,"import":0,"me":0},"followable":true,"following":false,"blocking":false,"followsYou":false}
|
||||
|
@ -190,7 +190,7 @@ export default function (token: string) {
|
|||
me = data;
|
||||
//Log raw data received
|
||||
if (verbose) console.log('/api/account Response:' + JSON.stringify(data));
|
||||
//Diplay Title + UserName . Title may be undefined
|
||||
//Display Title + UserName . Title may be undefined
|
||||
console.log('┌─────────────────────────────────────────────────────┐');
|
||||
console.log('│ ' + (typeof data.title == 'undefined' ? '' : data.title) + ' ' + data.username);
|
||||
//Display performance ratings
|
||||
|
@ -238,7 +238,7 @@ export default function (token: string) {
|
|||
//Response may contain several JSON objects on the same chunk separated by \n . This may create an empty element at the end.
|
||||
const jsonArray = value ? decoder.decode(value).split('\n') : [];
|
||||
for (let i = 0; i < jsonArray.length; i++) {
|
||||
//Skip empty elements that may have happened witht the .split('\n')
|
||||
//Skip empty elements that may have happened with the .split('\n')
|
||||
if (jsonArray[i].length > 2) {
|
||||
try {
|
||||
const data = JSON.parse(jsonArray[i]);
|
||||
|
@ -329,13 +329,13 @@ export default function (token: string) {
|
|||
if (done) break;
|
||||
//Log raw data received
|
||||
if (verbose && value!.length > 1)
|
||||
console.log('connectToGameStream - board game stream recevied:', decoder.decode(value));
|
||||
console.log('connectToGameStream - board game stream received:', decoder.decode(value));
|
||||
//Update connection status
|
||||
gameConnectionMap.set(gameId, { connected: true, lastEvent: time.getTime() });
|
||||
//Response may contain several JSON objects on the same chunk separated by \n . This may create an empty element at the end.
|
||||
const jsonArray = decoder.decode(value)!.split('\n');
|
||||
for (let i = 0; i < jsonArray.length; i++) {
|
||||
//Skip empty elements that may have happened witht the .split('\n')
|
||||
//Skip empty elements that may have happened with the .split('\n')
|
||||
if (jsonArray[i].length > 2) {
|
||||
try {
|
||||
const data = JSON.parse(jsonArray[i]);
|
||||
|
@ -418,7 +418,7 @@ export default function (token: string) {
|
|||
//Check if any started games are disconnected
|
||||
for (const [gameId, networkState] of gameConnectionMap) {
|
||||
if (!networkState.connected && gameStateMap.get(gameId).status == 'started') {
|
||||
//Game is not conencted and has not finished, reconnect
|
||||
//Game is not connected and has not finished, reconnect
|
||||
if (verbose) console.log(`Started game is disconnected. Attempting reconnection for gameId: ${gameId}`);
|
||||
connectToGameStream(gameId);
|
||||
}
|
||||
|
@ -827,7 +827,7 @@ export default function (token: string) {
|
|||
|
||||
liveChessConnection.onclose = () => {
|
||||
console.error('Websocket to LiveChess disconnected');
|
||||
//Clear the value of current serial number this serves as a diconnected status
|
||||
//Clear the value of current serial number this serves as a disconnected status
|
||||
currentSerialnr = '0';
|
||||
//Set connection state to false
|
||||
isLiveChessConnected = false;
|
||||
|
@ -842,7 +842,7 @@ export default function (token: string) {
|
|||
lastLiveChessBoard = message.param.board;
|
||||
}
|
||||
if (message.response == 'call' && message.id == '1') {
|
||||
//Get the list of availble boards on LiveChess
|
||||
//Get the list of available boards on LiveChess
|
||||
boards = message.param;
|
||||
console.table(boards);
|
||||
if (verbose) console.info(boards[0].serialnr);
|
||||
|
@ -899,18 +899,18 @@ export default function (token: string) {
|
|||
console.warn('onmessage - Multiple moves received on single message - movesToProcess: ' + movesToProcess);
|
||||
if (localBoard.turn == currentGameColor) {
|
||||
//If more than one move is received when its the DGT board player's turn this may be a invalid move
|
||||
//Move will be quarentined by 2.5 seconds
|
||||
const quarentinedlastLegalParam = lastLegalParam;
|
||||
//Move will be quarantined by 2.5 seconds
|
||||
const quarantinedlastLegalParam = lastLegalParam;
|
||||
await sleep(2500);
|
||||
//Check if a different move was recevied and processed during quarentine
|
||||
if (JSON.stringify(lastLegalParam.san) != JSON.stringify(quarentinedlastLegalParam.san)) {
|
||||
//lastLegalParam was altered, this mean a new move was received from LiveChess during quarentine
|
||||
//Check if a different move was received and processed during quarantine
|
||||
if (JSON.stringify(lastLegalParam.san) != JSON.stringify(quarantinedlastLegalParam.san)) {
|
||||
//lastLegalParam was altered, this mean a new move was received from LiveChess during quarantine
|
||||
console.warn(
|
||||
'onmessage - Invalid moved quarentined and not sent to lichess. Newer move interpretration received.'
|
||||
'onmessage - Invalid moved quarantined and not sent to lichess. Newer move interpretration received.'
|
||||
);
|
||||
return;
|
||||
}
|
||||
//There is a chance that the same move came twice and quarentined twice before updating lastLegalParam
|
||||
//There is a chance that the same move came twice and quarantined twice before updating lastLegalParam
|
||||
else if (
|
||||
lastLegalParam !== undefined &&
|
||||
JSON.stringify(lastLegalParam.san) == JSON.stringify(message.param.san)
|
||||
|
@ -918,7 +918,7 @@ export default function (token: string) {
|
|||
//It looks like a duplicate, so just ignore it
|
||||
if (verbose)
|
||||
console.info(
|
||||
'onmessage - Duplicate position and san move received after quarentine and will be ignored'
|
||||
'onmessage - Duplicate position and san move received after quarantine and will be ignored'
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
@ -1075,7 +1075,7 @@ export default function (token: string) {
|
|||
//Wait a few seconds to see if the games reconnects or starts and give some space to other code to run
|
||||
console.warn('validateAndSendBoardMove - Cannot send move while disconnected. Re-Trying in 2 seconds...');
|
||||
await sleep(2000);
|
||||
//Now attempt to select for which game is this command intented
|
||||
//Now attempt to select for which game is this command intended
|
||||
await chooseCurrentGame();
|
||||
}
|
||||
//Now send the move
|
||||
|
@ -1108,8 +1108,8 @@ export default function (token: string) {
|
|||
.then(response => {
|
||||
try {
|
||||
if (response.status == 200 || response.status == 201) {
|
||||
//Move sucessfully sent
|
||||
if (verbose) console.log('sendMove - Move sucessfully sent.');
|
||||
//Move successfully sent
|
||||
if (verbose) console.log('sendMove - Move successfully sent.');
|
||||
} else {
|
||||
response.json().then(errorJson => {
|
||||
console.error('sendMove - Failed to send move. ' + errorJson.error);
|
||||
|
|
|
@ -23,7 +23,7 @@ type Send = (t: Tpe, d: Payload, o?: any) => void;
|
|||
|
||||
interface Options {
|
||||
idle: boolean;
|
||||
pingMaxLag: number; // time to wait for pong before reseting the connection
|
||||
pingMaxLag: number; // time to wait for pong before resetting the connection
|
||||
pingDelay: number; // time between pong and ping
|
||||
autoReconnectDelay: number;
|
||||
protocol: string;
|
||||
|
@ -64,7 +64,7 @@ export default class StrongSocket {
|
|||
|
||||
static defaultOptions: Options = {
|
||||
idle: false,
|
||||
pingMaxLag: 9000, // time to wait for pong before reseting the connection
|
||||
pingMaxLag: 9000, // time to wait for pong before resetting the connection
|
||||
pingDelay: 2500, // time between pong and ping
|
||||
autoReconnectDelay: 3500,
|
||||
protocol: location.protocol === 'https:' ? 'wss:' : 'ws:',
|
||||
|
|
Loading…
Reference in New Issue