@@ -480,6 +480,7 @@ function showResult(difficultyFailed = false) {
480480 setFocus ( false ) ;
481481 hideCaret ( ) ;
482482 hideLiveWpm ( ) ;
483+ testInvalid = false ;
483484 let stats = calculateStats ( ) ;
484485 if ( stats === undefined ) {
485486 stats = {
@@ -563,6 +564,7 @@ function showResult(difficultyFailed = false) {
563564 }
564565 } else {
565566 showNotification ( "Test invalid" , 3000 ) ;
567+ testInvalid = true ;
566568 try {
567569 firebase . analytics ( ) . logEvent ( 'testCompletedInvalid' , completedEvent ) ;
568570 } catch ( e ) {
@@ -572,29 +574,49 @@ function showResult(difficultyFailed = false) {
572574 }
573575
574576
575- let infoText = "" ;
577+ let testType = "" ;
576578
577579
578- infoText += config . mode ;
580+ testType += config . mode ;
579581 if ( config . mode == "time" ) {
580- infoText += " " + config . time
582+ testType += " " + config . time
581583 } else if ( config . mode == "words" ) {
582- infoText += " " + config . words
584+ testType += " " + config . words
583585 }
584586 if ( config . mode != "custom" ) {
585- infoText += "<br>" + config . language . replace ( '_' , ' ' ) ;
587+ testType += "<br>" + config . language . replace ( '_' , ' ' ) ;
586588 }
587589 if ( config . punctuation ) {
588- infoText += "<br>punctuation"
590+ testType += "<br>punctuation"
589591 }
590592 if ( config . difficulty == "expert" ) {
591- infoText += "<br>expert" ;
593+ testType += "<br>expert" ;
592594 } else if ( config . difficulty == "master" ) {
593- infoText += "<br>master" ;
595+ testType += "<br>master" ;
596+ }
597+
598+ $ ( "#result .stats .testType .bottom" ) . html ( testType ) ;
599+
600+
601+ let otherText = "" ;
602+ if ( difficultyFailed ) {
603+ otherText += "<br>failed"
604+ }
605+ if ( afkDetected ) {
606+ otherText += "<br>afk detected"
607+ }
608+ if ( testInvalid ) {
609+ otherText += "<br>invalid"
610+ }
611+
612+ if ( otherText == "" ) {
613+ $ ( "#result .stats .info" ) . addClass ( 'hidden' ) ;
614+ } else {
615+ $ ( "#result .stats .info" ) . removeClass ( 'hidden' ) ;
616+ otherText = otherText . substring ( 4 ) ;
617+ $ ( "#result .stats .info .bottom" ) . html ( otherText ) ;
594618 }
595619
596- $ ( "#result .stats .info .bottom" ) . html ( infoText ) ;
597-
598620 let labels = [ ] ;
599621 for ( let i = 1 ; i <= wpmHistory . length ; i ++ ) {
600622 labels . push ( i . toString ( ) ) ;
0 commit comments