mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-02-04 04:51:16 +08:00
added quick end
This commit is contained in:
parent
cabf8412e8
commit
1d35ee7297
5 changed files with 53 additions and 4 deletions
|
@ -311,12 +311,22 @@
|
|||
</div>
|
||||
<div class="section blindMode">
|
||||
<h1>blind mode</h1>
|
||||
<div class="text">No errors or incorrect words are highlighted. Helps you focus on raw speed.</div>
|
||||
<div class="text">No errors or incorrect words are highlighted. Helps you focus on raw speed. If enabled, quick end is recommended.</div>
|
||||
<div class="buttons">
|
||||
<div class="button on" tabindex="0" onclick="this.blur();">⠀</div>
|
||||
<div class="button off" tabindex="0" onclick="this.blur();">off</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section quickEnd">
|
||||
<h1>quick end</h1>
|
||||
<div class="text">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.
|
||||
</div>
|
||||
<div class="buttons">
|
||||
<div class="button on" tabindex="0" onclick="this.blur();">on</div>
|
||||
<div class="button off" tabindex="0" onclick="this.blur();">off</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section fontSize">
|
||||
<h1>font size</h1>
|
||||
<div class="text">Change the font size of the test words</div>
|
||||
|
|
|
@ -56,6 +56,13 @@ let commands = {
|
|||
toggleBlindMode();
|
||||
}
|
||||
},
|
||||
{
|
||||
id: "toggleQuickEnd",
|
||||
display: "Toggle quick end",
|
||||
exec: () => {
|
||||
toggleQuickEnd();
|
||||
}
|
||||
},
|
||||
{
|
||||
id: "changeDifficulty",
|
||||
display: "Change difficulty...",
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
})
|
||||
|
|
|
@ -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';
|
||||
|
|
Loading…
Reference in a new issue