Format
This commit is contained in:
parent
a55f0890ce
commit
f11b4c935f
|
@ -8,7 +8,9 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||
|
||||
// Get playerId from meta tag
|
||||
const displayNameMeta = document.querySelector('meta[name="displayName"]');
|
||||
const initialDisplayName = displayNameMeta ? displayNameMeta.content : 'New Player';
|
||||
const initialDisplayName = displayNameMeta
|
||||
? displayNameMeta.content
|
||||
: 'New Player';
|
||||
|
||||
// Initialize display name with initial name
|
||||
displayNameSpan.textContent = initialDisplayName;
|
||||
|
|
|
@ -6,7 +6,7 @@ export function renderGameBoardHtml(
|
|||
): string {
|
||||
// Check the last move, so that the stone can be highlighted
|
||||
const lastMove = game.history[game.history.length - 1];
|
||||
|
||||
|
||||
let boardHtml = '<div id="game-board" class="game-board-grid">';
|
||||
for (let row = 0; row < game.board.length; row++) {
|
||||
for (let col = 0; col < game.board[row].length; col++) {
|
||||
|
@ -16,7 +16,8 @@ export function renderGameBoardHtml(
|
|||
if (stone) {
|
||||
const colorClass =
|
||||
stone === 'black' ? 'stone-black-heart' : 'stone-white-heart';
|
||||
const lastMoveClass = col == lastMove.col && row == lastMove.row ? 'last-move' : '';
|
||||
const lastMoveClass =
|
||||
col == lastMove.col && row == lastMove.row ? 'last-move' : '';
|
||||
stoneHtml = `<div class="${colorClass} ${lastMoveClass}"></div>`;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue