mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2024-09-22 00:06:16 +08:00
parent
9579b818f6
commit
8476a7c594
|
@ -986,29 +986,6 @@ export async function init() {
|
|||
|
||||
export async function addWord() {
|
||||
let bound = 100;
|
||||
if (Config.funbox === "wikipedia" || Config.funbox == "poetry") {
|
||||
if (
|
||||
Config.mode == "time" &&
|
||||
TestWords.words.length - TestWords.words.currentIndex < 20
|
||||
) {
|
||||
let section =
|
||||
Config.funbox == "wikipedia"
|
||||
? await Wikipedia.getSection(Config.language)
|
||||
: await Poetry.getPoem();
|
||||
let wordCount = 0;
|
||||
for (let word of section.words) {
|
||||
if (wordCount >= Config.words && Config.mode == "words") {
|
||||
break;
|
||||
}
|
||||
wordCount++;
|
||||
TestWords.words.push(word);
|
||||
TestUI.addWord(word);
|
||||
}
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (Config.funbox === "plus_one") bound = 1;
|
||||
if (Config.funbox === "plus_two") bound = 2;
|
||||
if (
|
||||
|
@ -1028,6 +1005,27 @@ export async function addWord() {
|
|||
TestWords.words.length >= TestWords.randomQuote.textSplit.length)
|
||||
)
|
||||
return;
|
||||
|
||||
if (Config.funbox === "wikipedia" || Config.funbox == "poetry") {
|
||||
if (TestWords.words.length - TestWords.words.currentIndex < 20) {
|
||||
let section =
|
||||
Config.funbox == "wikipedia"
|
||||
? await Wikipedia.getSection(Config.language)
|
||||
: await Poetry.getPoem();
|
||||
let wordCount = 0;
|
||||
for (let word of section.words) {
|
||||
if (wordCount >= Config.words && Config.mode == "words") {
|
||||
break;
|
||||
}
|
||||
wordCount++;
|
||||
TestWords.words.push(word);
|
||||
TestUI.addWord(word);
|
||||
}
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
const language =
|
||||
Config.mode !== "custom"
|
||||
? await Misc.getCurrentLanguage(Config.language)
|
||||
|
|
Loading…
Reference in a new issue