Merge pull request #9314 from kraktus/moves

Fix movetime chart for legacy browsers.
pull/9319/head
Thibault Duplessis 2021-06-30 09:49:36 +02:00 committed by GitHub
commit 782a3318fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 5 deletions

View File

@ -85,12 +85,12 @@ lichess.movetimeChart = function (data, trans, hunter) {
label += '<br />' + trans('nbSeconds', '<strong>' + seconds + '</strong>');
moveSeries[colorName].push(movePoint);
let clock = node?.clock;
let clock = node ? node.clock : undefined;
if (clock == undefined) {
if (x < data.game.moveCentis.length - 1) showTotal = false;
else if (data.game.status.name === 'outoftime') clock = 0;
else if (data.clock) {
const prevClock = tree[x - 1]?.clock;
const prevClock = tree[x - 1] ? tree[x - 1].clock : undefined;
if (prevClock) clock = prevClock + data.clock.increment - centis;
}
}
@ -118,9 +118,10 @@ lichess.movetimeChart = function (data, trans, hunter) {
click: event => {
if (event.point) {
const x = event.point.x;
const p = this.highcharts.series[(showTotal ? 4 : 0) + ((tree[x]?.ply ?? x) % 2)].data[x >> 1];
if (p) p.select(true);
lichess.pubsub.emit('analysis.chart.click', x);
const p =
this.highcharts.series[
(showTotal ? 4 : 0) + (((tree[x] ? tree[x].ply : undefined) || x) % 2)
].data[x >> 1];
}
},
},