feat(chat): add function to clear game chat before starting a new game and on exit

This commit is contained in:
ur002 2026-02-01 19:14:07 +03:00
parent cfb350fa8a
commit d6e4acdf4e
2 changed files with 14 additions and 0 deletions

BIN
poker.db

Binary file not shown.

View File

@ -194,6 +194,9 @@ function startSinglePlayer() {
// Сохраняем имя
localStorage.setItem('playerName', playerName);
// Очищаем чат перед началом новой игры
clearGameChat();
// Создаём игру
game = new PokerGame({
smallBlind: 5,
@ -1502,6 +1505,16 @@ function toggleChat() {
document.getElementById('game-chat').classList.toggle('expanded');
}
/**
* Очистить игровой чат
*/
function clearGameChat() {
const container = document.getElementById('game-chat-messages');
if (container) {
container.innerHTML = '';
}
}
// =============================================================================
// НАСТРОЙКИ
// =============================================================================
@ -1966,6 +1979,7 @@ function leaveGame() {
leaveRoom();
}
game = null;
clearGameChat(); // Очищаем чат при выходе из игры
showScreen('main-menu');
}
}