@@ -194,7 +194,11 @@ async function app() {
194194 } ;
195195 const $main = $ ( 'main' ) ;
196196 const themeToggle = $ ( '[data-action="toggleTheme"]' ) ;
197- const cleanAttempts = $ ( 'main .attempts' ) . innerHTML ;
197+ const $attempts = $ ( 'main .attempts' ) ;
198+ const $keyboard = $ ( '.keyboard' , $main ) ;
199+
200+ const cleanKeyboard = $keyboard . innerHTML ;
201+ const cleanAttempts = $attempts . innerHTML ;
198202
199203 const THEME_KEY = 'sordle-theme' ;
200204 const getInitialTheme = ( ) => {
@@ -307,10 +311,8 @@ async function app() {
307311 } ;
308312
309313 const rippleKeyboard = ( ) => {
310- const keyboard = $ ( '.keyboard' , $main ) ;
311- if ( ! keyboard ) return ;
312- const keys = $$ ( 'button' , keyboard ) ;
313- const rect = keyboard . getBoundingClientRect ( ) ;
314+ const keys = $$ ( 'button' , $keyboard ) ;
315+ const rect = $keyboard . getBoundingClientRect ( ) ;
314316 const cx = rect . left + rect . width / 2 ;
315317 const cy = rect . top + rect . height / 2 ;
316318 let max = 1 ;
@@ -323,9 +325,9 @@ async function app() {
323325 keys . forEach ( ( key , i ) => {
324326 key . style . setProperty ( '--ripple-delay' , `${ Math . round ( ( distances [ i ] / max ) * 260 ) } ms` ) ;
325327 } ) ;
326- keyboard . classList . remove ( 'ripple' ) ;
327- void keyboard . offsetWidth ;
328- keyboard . classList . add ( 'ripple' ) ;
328+ $ keyboard. classList . remove ( 'ripple' ) ;
329+ void $ keyboard. offsetWidth ;
330+ $ keyboard. classList . add ( 'ripple' ) ;
329331 } ;
330332
331333 // Celebration: launch confetti up and inward from both bottom corners.
@@ -546,7 +548,8 @@ async function app() {
546548 // Locally (dev server) always play "brain" to make testing deterministic.
547549 let nextWord : null | Word = null ;
548550
549- // dev only - nextWord = await getWord('brain');
551+ // dev only -
552+ nextWord = await getWord ( 'brain' ) ;
550553
551554 if ( ! nextWord ) nextWord = await getRandomWord ( ) ;
552555
@@ -594,7 +597,8 @@ async function app() {
594597
595598 const clearGame = ( ) => {
596599 localStorage . removeItem ( SAVE_KEY ) ;
597- $ ( 'main .attempts' ) . innerHTML = cleanAttempts ;
600+ $attempts . innerHTML = cleanAttempts ;
601+ $keyboard . innerHTML = cleanKeyboard ;
598602 } ;
599603
600604 const setKeyColor = ( char : string , color : Status ) => {
0 commit comments