From 059bd8dca8a9fdca6033c80bd4a3150fb3ff0dab Mon Sep 17 00:00:00 2001 From: USA1555 <162125128+USA1555@users.noreply.github.com> Date: Sun, 15 Feb 2026 17:52:11 +0300 Subject: [PATCH 1/3] Fix Issue #1: Prevent game start without player name --- script.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/script.js b/script.js index 43cfa50..afe356d 100644 --- a/script.js +++ b/script.js @@ -33,6 +33,11 @@ function toggleTheme() { themeIcon.textContent = '🌙'; } } +if (!playerName || playerName.trim() === "") { + alert("Player name is required"); + return; +} + function switchTab(tabName) { const tabs = document.querySelectorAll('.tab-content'); From abd84a3898c75dfe641a5ce42f887644b4cee9d0 Mon Sep 17 00:00:00 2001 From: USA1555 <162125128+USA1555@users.noreply.github.com> Date: Sun, 15 Feb 2026 18:34:51 +0300 Subject: [PATCH 2/3] Fix Issue #1: Prevent game start without player name --- script.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/script.js b/script.js index afe356d..449875e 100644 --- a/script.js +++ b/script.js @@ -33,11 +33,6 @@ function toggleTheme() { themeIcon.textContent = '🌙'; } } -if (!playerName || playerName.trim() === "") { - alert("Player name is required"); - return; -} - function switchTab(tabName) { const tabs = document.querySelectorAll('.tab-content'); @@ -140,6 +135,12 @@ function generateKeyboard() { function startGame() { const p1Name = document.getElementById('player1Name').value.trim(); const p2Name = document.getElementById('player2Name').value.trim(); + + // ✅ Fix Issue #1: Prevent starting the game if BOTH names are empty + if (!p1Name && !p2Name) { + alert("Player name is required. Please enter at least one player name."); + return; + } gameState.player1.name = p1Name || 'Player 1'; gameState.player2.name = p2Name || 'Player 2'; From 73173815efc4f92c4861105ee9d3f99f59515f10 Mon Sep 17 00:00:00 2001 From: USA1555 <162125128+USA1555@users.noreply.github.com> Date: Sun, 15 Feb 2026 18:45:32 +0300 Subject: [PATCH 3/3] Fix #3: Make night mode toggle apply theme --- script.js | 19 ++++++++++++++----- styles.css | 22 ++++++++++++++++++++++ 2 files changed, 36 insertions(+), 5 deletions(-) diff --git a/script.js b/script.js index 449875e..85a1c48 100644 --- a/script.js +++ b/script.js @@ -20,20 +20,29 @@ let gameState = { let wordBank = []; document.addEventListener('DOMContentLoaded', function() { + const savedTheme = localStorage.getItem('theme'); + if (savedTheme === 'dark') { + document.body.classList.add('dark'); + const themeIcon = document.querySelector('.theme-icon'); + if (themeIcon) themeIcon.textContent = '☀️'; + } + loadWordBank(); generateKeyboard(); }); function toggleTheme() { + document.body.classList.toggle('dark'); + const themeIcon = document.querySelector('.theme-icon'); - - if (themeIcon.textContent === '🌙') { - themeIcon.textContent = '☀️'; - } else { - themeIcon.textContent = '🌙'; + if (themeIcon) { + themeIcon.textContent = document.body.classList.contains('dark') ? '☀️' : '🌙'; } + + localStorage.setItem('theme', document.body.classList.contains('dark') ? 'dark' : 'light'); } + function switchTab(tabName) { const tabs = document.querySelectorAll('.tab-content'); tabs.forEach(tab => tab.classList.remove('active')); diff --git a/styles.css b/styles.css index 2d7f786..ee95ac6 100644 --- a/styles.css +++ b/styles.css @@ -527,3 +527,25 @@ body.dark-mode .add-word-form input { body.dark-mode .empty-state { color: #999; } +body.dark { + background: #0f172a; + color: #e2e8f0; +} + +body.dark .container, +body.dark .tab-content, +body.dark .card, +body.dark .game-container, +body.dark .word-bank-container { + background: #111827; + color: #e2e8f0; +} + +body.dark button, +body.dark input, +body.dark textarea, +body.dark select { + background: #1f2937; + color: #e2e8f0; + border-color: #374151; +}