File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -253,7 +253,7 @@ function compareInput() {
253253 // $(letterElems[i]).removeClass('incorrect').addClass('correct');
254254 } else {
255255 if ( config . difficulty == "master" ) {
256- showResult ( ) ;
256+ showResult ( true ) ;
257257 }
258258 if ( currentWord [ i ] == undefined ) {
259259 ret +=
@@ -462,7 +462,7 @@ function showCrown() {
462462 } , 250 , "easeOutCubic" ) ;
463463}
464464
465- function showResult ( ) {
465+ function showResult ( difficultyFailed = false ) {
466466 testEnd = Date . now ( ) ;
467467 testActive = false ;
468468 setFocus ( false ) ;
@@ -503,7 +503,9 @@ function showResult() {
503503 // $("#result .stats .time .bottom").text(roundedToFixed(stats.time,1)+'s');
504504 }
505505
506- if ( afkDetected ) {
506+ if ( difficultyFailed ) {
507+ showNotification ( "Test failed" , 3000 ) ;
508+ } else if ( afkDetected ) {
507509 showNotification ( "Test invalid - AFK detected" , 3000 ) ;
508510 } else {
509511 let completedEvent = {
@@ -1239,9 +1241,12 @@ $(document).keydown((event) => {
12391241 highlightBadWord ( ) ;
12401242 currentInput = "" ;
12411243 currentWordIndex ++ ;
1242- if ( currentWordIndex == wordsList . length || config . difficulty == "expert" ) {
1244+ if ( currentWordIndex == wordsList . length ) {
12431245 showResult ( ) ;
12441246 return ;
1247+ } else if ( config . difficulty == "expert" ) {
1248+ showResult ( true ) ;
1249+ return ;
12451250 }
12461251 updateActiveElement ( ) ;
12471252 updateCaretPosition ( ) ;
You can’t perform that action at this time.
0 commit comments