mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-03-13 15:36:42 +08:00
removed a possibility of double words appearing in timed mode
This commit is contained in:
parent
53d33176e3
commit
1c2b319781
1 changed files with 2 additions and 1 deletions
|
@ -190,7 +190,8 @@ function addWord() {
|
|||
let language = words[config.language];
|
||||
let randomWord = language[Math.floor(Math.random() * language.length)];
|
||||
previousWord = wordsList[wordsList.length - 1];
|
||||
while (randomWord.indexOf(' ') > -1 || (!config.punctuation && randomWord == "I") || randomWord.indexOf(' ') > -1) {
|
||||
previousWordStripped = previousWord.replace(/[.?!":\-,]/g,'').toLowerCase();
|
||||
while (previousWordStripped == randomWord || randomWord.indexOf(' ') > -1 || (!config.punctuation && randomWord == "I")) {
|
||||
randomWord = language[Math.floor(Math.random() * language.length)];
|
||||
}
|
||||
if (config.punctuation && config.mode != "custom"){
|
||||
|
|
Loading…
Reference in a new issue