@@ -178,7 +178,6 @@ ConfigEvent.subscribe((eventKey, eventValue, nosave) => {
178178 if ( typeof eventValue !== "boolean" ) return ;
179179 if ( eventKey === "flipTestColors" ) flipColors ( eventValue ) ;
180180 if ( eventKey === "colorfulMode" ) colorful ( eventValue ) ;
181- if ( eventKey === "highlightMode" ) void updateWordElement ( eventValue ) ;
182181 if ( eventKey === "burstHeatmap" ) void applyBurstHeatmap ( ) ;
183182} ) ;
184183
@@ -238,19 +237,12 @@ export function updateActiveElement(
238237 initial = false
239238) : void {
240239 const active = document . querySelector ( "#words .active" ) ;
240+ if ( ! backspace ) {
241+ active ?. classList . add ( "typed" ) ;
242+ }
241243 if ( Config . mode === "zen" && backspace ) {
242244 active ?. remove ( ) ;
243245 } else if ( active !== null ) {
244- if (
245- [ "word" , "next_word" , "next_two_words" , "next_three_words" ] . includes (
246- Config . highlightMode
247- ) &&
248- Config . theme !== "shadow"
249- ) {
250- active . querySelectorAll ( "letter" ) . forEach ( ( e ) => {
251- e . classList . remove ( "correct" ) ;
252- } ) ;
253- }
254246 active . classList . remove ( "active" ) ;
255247 }
256248 const activeWord =
@@ -262,13 +254,11 @@ export function updateActiveElement(
262254
263255 activeWord . classList . add ( "active" ) ;
264256 activeWord . classList . remove ( "error" ) ;
257+ activeWord . classList . remove ( "typed" ) ;
258+
265259 activeWordTop = ( document . querySelector ( "#words .active" ) as HTMLElement )
266260 . offsetTop ;
267- if ( Config . highlightMode === "word" ) {
268- activeWord . querySelectorAll ( "letter" ) . forEach ( ( e ) => {
269- e . classList . add ( "correct" ) ;
270- } ) ;
271- }
261+
272262 if ( ! initial && shouldUpdateWordsInputPosition ( ) ) {
273263 void updateWordsInputPosition ( ) ;
274264 }
@@ -757,10 +747,7 @@ export async function screenshot(): Promise<void> {
757747 } , 3000 ) ;
758748}
759749
760- export async function updateWordElement (
761- showError = ! Config . blindMode ,
762- inputOverride ?: string
763- ) : Promise < void > {
750+ export async function updateWordElement ( inputOverride ?: string ) : Promise < void > {
764751 const input = inputOverride ?? TestInput . input . current ;
765752 const wordAtIndex = document . querySelector (
766753 "#words .word.active"
@@ -821,26 +808,13 @@ export async function updateWordElement(
821808 }
822809 }
823810
824- let wordHighlightClassString = correctSoFar ? "correct" : "incorrect" ;
825-
826- if ( Config . blindMode ) {
827- wordHighlightClassString = "correct" ;
828- }
829-
830811 const funbox = FunboxList . get ( Config . funbox ) . find (
831812 ( f ) => f . functions ?. getWordHtml
832813 ) ;
833- const isTts = FunboxList . get ( Config . funbox ) . find ( ( it ) => it . name === "tts" ) ;
834814
835815 for ( let i = 0 ; i < input . length ; i ++ ) {
836816 const charCorrect = currentWord [ i ] === input [ i ] ;
837817
838- let correctClass = "correct" ;
839- if ( Config . highlightMode === "off" ) {
840- correctClass = "" ;
841- if ( isTts ) correctClass = "visible" ;
842- }
843-
844818 let currentLetter = currentWord [ i ] as string ;
845819 let tabChar = "" ;
846820 let nlChar = "" ;
@@ -858,53 +832,31 @@ export async function updateWordElement(
858832 }
859833
860834 if ( charCorrect ) {
861- ret += `<letter class="${
862- Config . highlightMode === "word"
863- ? wordHighlightClassString
864- : correctClass
865- } ${ tabChar } ${ nlChar } ">${ currentLetter } </letter>`;
835+ ret += `<letter class="correct ${ tabChar } ${ nlChar } ">${ currentLetter } </letter>` ;
866836 } else if (
867837 currentLetter !== undefined &&
868838 CompositionState . getComposing ( ) &&
869839 i >= CompositionState . getStartPos ( ) &&
870840 ! ( containsKorean && ! correctSoFar )
871841 ) {
872- ret += `<letter class="${
873- Config . highlightMode === "word" ? wordHighlightClassString : ""
874- } dead">${
842+ ret += `<letter class="dead">${
875843 Config . indicateTypos === "replace"
876844 ? input [ i ] === " "
877845 ? "_"
878846 : input [ i ]
879847 : currentLetter
880848 } </letter>`;
881- } else if ( ! showError ) {
882- if ( currentLetter !== undefined ) {
883- ret += `<letter class="${
884- Config . highlightMode === "word"
885- ? wordHighlightClassString
886- : correctClass
887- } ${ tabChar } ${ nlChar } ">${ currentLetter } </letter>`;
888- }
889849 } else if ( currentLetter === undefined ) {
890850 if ( ! Config . hideExtraLetters ) {
891851 let letter = input [ i ] ;
892852 if ( letter === " " || letter === "\t" || letter === "\n" ) {
893853 letter = "_" ;
894854 }
895- ret += `<letter class="${
896- Config . highlightMode === "word"
897- ? wordHighlightClassString
898- : "incorrect"
899- } extra ${ tabChar } ${ nlChar } ">${ letter } </letter>`;
855+ ret += `<letter class="incorrect extra ${ tabChar } ${ nlChar } ">${ letter } </letter>` ;
900856 }
901857 } else {
902858 ret +=
903- `<letter class="${
904- Config . highlightMode === "word"
905- ? wordHighlightClassString
906- : "incorrect"
907- } ${ tabChar } ${ nlChar } ">` +
859+ `<letter class="incorrect ${ tabChar } ${ nlChar } ">` +
908860 ( Config . indicateTypos === "replace"
909861 ? input [ i ] === " "
910862 ? "_"
@@ -930,12 +882,7 @@ export async function updateWordElement(
930882 } else if ( currentWord [ i ] === "\n" ) {
931883 ret += `<letter class='nlChar'><i class="fas fa-level-down-alt fa-rotate-90 fa-fw"></i></letter>` ;
932884 } else {
933- ret +=
934- `<letter class="${
935- Config . highlightMode === "word" ? wordHighlightClassString : ""
936- } ">` +
937- currentWord [ i ] +
938- "</letter>" ;
885+ ret += `<letter>` + currentWord [ i ] + "</letter>" ;
939886 }
940887 }
941888
0 commit comments