@@ -284,6 +284,17 @@ document.addEventListener("DOMContentLoaded", async () => {
284
284
console . log ( "going up" ) ;
285
285
move ( DIRECTION_UP ) ;
286
286
break ;
287
+ case "d" :
288
+ if ( import . meta. env . DEV ) {
289
+ if ( debugButton . style . display === "" ) {
290
+ debugButton . style . display = "none" ;
291
+ undoButton . style . display = "none" ;
292
+ } else {
293
+ debugButton . style . display = "" ;
294
+ undoButton . style . display = "" ;
295
+ }
296
+ }
297
+ break ;
287
298
}
288
299
} ;
289
300
@@ -296,16 +307,17 @@ document.addEventListener("DOMContentLoaded", async () => {
296
307
if ( gameState . ended ) {
297
308
newGame ( ) ;
298
309
if ( onNewGameStarted ) {
299
- onNewGameStarted ( )
310
+ onNewGameStarted ( ) ;
300
311
}
301
312
return ;
302
313
}
303
314
const dialogElem = createDialogContentFromTemplate ( "#prompt-dialog-content" ) ;
304
- ( dialogElem . querySelector ( ".prompt-text" ) as HTMLSpanElement ) . innerText = "Are you sure you want to start a new game? All progress will be lost." ;
315
+ ( dialogElem . querySelector ( ".prompt-text" ) as HTMLSpanElement ) . innerText =
316
+ "Are you sure you want to start a new game? All progress will be lost." ;
305
317
renderPromptDialog ( dialogElem , true , ( ) => {
306
318
newGame ( ) ;
307
319
if ( onNewGameStarted ) {
308
- onNewGameStarted ( )
320
+ onNewGameStarted ( ) ;
309
321
}
310
322
} ) ;
311
323
} ;
@@ -543,7 +555,8 @@ document.addEventListener("DOMContentLoaded", async () => {
543
555
}
544
556
} else if ( elem . classList . contains ( BLOCK_STYLE_SETTING_NAME ) ) {
545
557
const blockStyleIndex = selectableBlockStyles . indexOf ( selectedBlockStyle ) ;
546
- let nextBlockStyle = selectableBlockStyles [ ( blockStyleIndex + 1 ) % selectableBlockStyles . length ] ;
558
+ let nextBlockStyle =
559
+ selectableBlockStyles [ ( blockStyleIndex + 1 ) % selectableBlockStyles . length ] ;
547
560
switchBlockStyle ( nextBlockStyle ) ;
548
561
savePreferenceValue ( BLOCK_STYLE_PREFERENCE_NAME , nextBlockStyle ) ;
549
562
toggle . innerText = nextBlockStyle ;
@@ -593,12 +606,16 @@ document.addEventListener("DOMContentLoaded", async () => {
593
606
}
594
607
if ( getPreferenceValue ( ANIMATIONS_PREFERENCE_NAME ) === SETTING_ENABLED ) {
595
608
isAnimationEnabled = true ;
596
- const setting = document . querySelector ( `.setting.${ ANIMATIONS_SETTING_NAME } ` ) as HTMLElement ;
609
+ const setting = document . querySelector (
610
+ `.setting.${ ANIMATIONS_SETTING_NAME } `
611
+ ) as HTMLElement ;
597
612
const knob = setting . querySelector ( ".knob" ) as HTMLElement ;
598
613
knob . classList . add ( "enabled" ) ;
599
614
}
600
615
switchBlockStyle ( getPreferenceValue ( BLOCK_STYLE_PREFERENCE_NAME ) ) ;
601
- const blockStyleSetting = document . querySelector ( `.setting.${ BLOCK_STYLE_SETTING_NAME } ` ) as HTMLElement ;
616
+ const blockStyleSetting = document . querySelector (
617
+ `.setting.${ BLOCK_STYLE_SETTING_NAME } `
618
+ ) as HTMLElement ;
602
619
( blockStyleSetting . querySelector ( ".toggle" ) as HTMLElement ) . innerText = selectedBlockStyle ;
603
620
604
621
const generateShareText = ( gameState : GameState ) => {
@@ -827,9 +844,14 @@ document.addEventListener("DOMContentLoaded", async () => {
827
844
} ) ;
828
845
829
846
if ( import . meta. env . DEV ) {
830
- undoButton . style . display = "" ;
831
847
debugButton . style . display = "" ;
832
- ( document . querySelector ( "#debug-overlay" ) as HTMLDivElement ) . style . display = "" ;
848
+ undoButton . style . display = "" ;
849
+ const debugOverlay = document . querySelector ( "#debug-overlay" ) as HTMLDivElement ;
850
+ debugOverlay . style . display = "" ;
851
+ debugOverlay . addEventListener ( "click" , ( e ) => {
852
+ e . preventDefault ( ) ;
853
+ debugOverlay . style . opacity = debugOverlay . style . opacity !== "0" ? "0" : "1" ;
854
+ } ) ;
833
855
( document . querySelector ( "#swipeSensitivity" ) as HTMLSpanElement ) . innerText =
834
856
swipeSensitivity . toString ( ) ;
835
857
}
0 commit comments