diff --git a/public/index.html b/public/index.html index 15bf54936..50c362e94 100644 --- a/public/index.html +++ b/public/index.html @@ -311,12 +311,22 @@

blind mode

-
No errors or incorrect words are highlighted. Helps you focus on raw speed.
+
No errors or incorrect words are highlighted. Helps you focus on raw speed. If enabled, quick end is recommended.
off
+
+

quick end

+
With this option enabled, tests will end as soon as you type in the same number of letters as the last word, no matter if + its correct or not. When disabled, you need to manually confirm the last incorrect word with a space. This only applies to the words mode. +
+
+
on
+
off
+
+

font size

Change the font size of the test words
diff --git a/public/js/commandline.js b/public/js/commandline.js index 2fdbb16dc..66e325c6a 100644 --- a/public/js/commandline.js +++ b/public/js/commandline.js @@ -56,6 +56,13 @@ let commands = { toggleBlindMode(); } }, + { + id: "toggleQuickEnd", + display: "Toggle quick end", + exec: () => { + toggleQuickEnd(); + } + }, { id: "changeDifficulty", display: "Change difficulty...", diff --git a/public/js/script.js b/public/js/script.js index b6c4c1d28..95c859664 100644 --- a/public/js/script.js +++ b/public/js/script.js @@ -277,7 +277,7 @@ function compareInput() { } } $(".word.active").html(ret); - if (currentWord == currentInput && currentWordIndex == wordsList.length - 1) { + if ((currentWord == currentInput || (config.quickEnd && currentWord.length == currentInput.length)) && currentWordIndex == wordsList.length - 1) { inputHistory.push(currentInput); currentInput = ""; showResult(); diff --git a/public/js/settings.js b/public/js/settings.js index 1fc65a7fe..a346855a9 100644 --- a/public/js/settings.js +++ b/public/js/settings.js @@ -16,6 +16,8 @@ function updateSettingsPage(){ setSettingsButton('keyTips', config.showKeyTips); setSettingsButton('freedomMode', config.freedomMode); setSettingsButton('blindMode', config.blindMode); + setSettingsButton('quickEnd', config.quickEnd); + setActiveThemeButton(); setActiveLanguageButton(); @@ -202,3 +204,15 @@ $(".pageSettings .section.blindMode .buttons .button.off").click(e => { showNotification('Blind mode off', 1000); setSettingsButton('blindMode', config.blindMode); }) + +//blind mode +$(".pageSettings .section.quickEnd .buttons .button.on").click(e => { + setQuickEnd(true); + showNotification('Quick end on', 1000); + setSettingsButton('quickEnd', config.quickEnd); +}) +$(".pageSettings .section.quickEnd .buttons .button.off").click(e => { + setQuickEnd(false); + showNotification('Quick end off', 1000); + setSettingsButton('quickEnd', config.quickEnd); +}) diff --git a/public/js/userconfig.js b/public/js/userconfig.js index 517e431d8..99783e838 100644 --- a/public/js/userconfig.js +++ b/public/js/userconfig.js @@ -13,7 +13,8 @@ let config = { freedomMode: false, resultFilters: ["all"], difficulty: "normal", - blindMode: false + blindMode: false, + quickEnd: false } //cookies @@ -45,6 +46,7 @@ function loadConfigFromCookie() { setCaretStyle(newConfig.caretStyle,true); setDifficulty(newConfig.difficulty,true); setBlindMode(newConfig.blindMode,true); + setQuickEnd(newConfig.quickEnd,true); if(newConfig.resultFilters == null || newConfig.resultFilters == undefined){ newConfig.resultFilters = ["all"]; } @@ -77,7 +79,6 @@ function toggleBlindMode(){ blind = false; } config.blindMode = blind; - if(!nosave) saveConfigToCookie(); } function setBlindMode(blind, nosave){ @@ -88,6 +89,23 @@ function setBlindMode(blind, nosave){ if(!nosave) saveConfigToCookie(); } +//quickend +function toggleQuickEnd(){ + qe = !config.quickEnd; + if(qe == undefined){ + qe = false; + } + config.quickEnd = qe; +} + +function setQuickEnd(qe, nosave){ + if(qe == undefined){ + qe = false; + } + config.quickEnd = qe; + if(!nosave) saveConfigToCookie(); +} + function setCaretStyle(caretStyle, nosave) { if (caretStyle == null || caretStyle == undefined) { caretStyle = 'default';