mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2024-11-11 09:34:35 +08:00
added no space funbox
This commit is contained in:
parent
0e8caaa47c
commit
f35415f296
3 changed files with 26 additions and 0 deletions
|
@ -322,6 +322,7 @@ function activateFunbox(funbox, mode) {
|
|||
memoryFunboxInterval = clearInterval(memoryFunboxInterval);
|
||||
memoryFunboxTimer = null;
|
||||
$("#wordsWrapper").removeClass("hidden");
|
||||
$("#words").removeClass("nospace");
|
||||
}
|
||||
|
||||
if (mode === "style") {
|
||||
|
@ -358,6 +359,9 @@ function activateFunbox(funbox, mode) {
|
|||
if (config.keymapMode === "next") {
|
||||
setKeymapMode("react");
|
||||
}
|
||||
} else if (funbox === "no_space") {
|
||||
$("#words").addClass("nospace");
|
||||
restartTest(false, true);
|
||||
}
|
||||
activeFunBox = funbox;
|
||||
}
|
||||
|
@ -4302,6 +4306,9 @@ $(document).keydown((event) => {
|
|||
} else {
|
||||
currentInput = inputHistory.pop();
|
||||
currentCorrected = correctedHistory.pop();
|
||||
if (activeFunBox === "no_space") {
|
||||
currentInput = currentInput.substring(0, currentInput.length - 1);
|
||||
}
|
||||
}
|
||||
currentWordIndex--;
|
||||
currentWordElementIndex--;
|
||||
|
@ -4720,6 +4727,14 @@ $(document).keydown(function (event) {
|
|||
activeWordTopBeforeJump = activeWordTop;
|
||||
compareInput(!config.blindMode);
|
||||
|
||||
if (currentInput.length === wordsList[currentWordIndex].length) {
|
||||
jQuery.event.trigger({
|
||||
type: "keydown",
|
||||
which: " ".charCodeAt(0),
|
||||
key: " ",
|
||||
});
|
||||
}
|
||||
|
||||
let newActiveTop = document.querySelector("#words .word.active").offsetTop;
|
||||
if (activeWordTopBeforeJump < newActiveTop && !lineTransition) {
|
||||
activeWordJumped = true;
|
||||
|
|
|
@ -1867,6 +1867,12 @@ key {
|
|||
margin: 0.75rem;
|
||||
}
|
||||
|
||||
#words.nospace {
|
||||
.word {
|
||||
margin: 0.5rem 0;
|
||||
}
|
||||
}
|
||||
|
||||
.word.error {
|
||||
/* margin-bottom: 1px; */
|
||||
border-bottom: 2px solid var(--error-color);
|
||||
|
|
|
@ -83,5 +83,10 @@
|
|||
"name": "memory",
|
||||
"type": "script",
|
||||
"info": "Test your memory. Remember the words and type them blind."
|
||||
},
|
||||
{
|
||||
"name": "no_space",
|
||||
"type": "script",
|
||||
"info": "Whoneedsspacesanyway?"
|
||||
}
|
||||
]
|
||||
|
|
Loading…
Reference in a new issue