diff --git a/examples/timer-table.html b/examples/timer-table.html index b2751c1..c328f6f 100644 --- a/examples/timer-table.html +++ b/examples/timer-table.html @@ -22,8 +22,8 @@ <h5>Timer</h5> <div id="chessboard"></div> </div> <div class="col-md-6"> - <table id="timerTable" class="table table-hover"> - <tbody></tbody> + <table id="timerTable" class="table"> + <tbody class="h4"></tbody> </table> </div> </div> diff --git a/examples/timer-table.js b/examples/timer-table.js index 7e7dbac..d3c7852 100644 --- a/examples/timer-table.js +++ b/examples/timer-table.js @@ -16,10 +16,8 @@ const timerTable = new TimerTable( document.querySelector('#timerTable tbody'), { turn: 'w', - timer: { - w: 300, - b: 300 - } + w: 300, + b: 300 } ); diff --git a/src/TimerTable.js b/src/TimerTable.js index 68b18d0..3c2c2d0 100644 --- a/src/TimerTable.js +++ b/src/TimerTable.js @@ -15,12 +15,12 @@ export class TimerTable extends AbstractComponent { count() { if (this.props.turn === Pgn.symbol.WHITE) { - if (this.props.timer.w > 0) { - this.props.timer.w -= 1; + if (this.props.w > 0) { + this.props.w -= 1; } } else { - if (this.props.timer.b > 0) { - this.props.timer.b -= 1; + if (this.props.b > 0) { + this.props.b -= 1; } } @@ -31,15 +31,15 @@ export class TimerTable extends AbstractComponent { this._el.replaceChildren(); const tr = document.createElement('tr'); const wTd = document.createElement('td'); - const wText = document.createTextNode(this._convert(this.props.timer.w)); + const wText = document.createTextNode(this._convert(this.props.w)); const bTd = document.createElement('td'); - const bText = document.createTextNode(this._convert(this.props.timer.b)); + const bText = document.createTextNode(this._convert(this.props.b)); wTd.classList.add('text-end'); wTd.appendChild(wText); bTd.appendChild(bText); tr.appendChild(wTd); tr.appendChild(bTd); - + this._el.appendChild(tr); } }