max word count is 100000

This commit is contained in:
Miodec 2022-02-04 14:52:26 +01:00
parent 61f39b64b9
commit d5fae40187

View file

@ -1068,19 +1068,23 @@ export function setQuoteLength(len, nosave, multipleMode) {
}
export function setWordCount(wordCount, nosave) {
if (wordCount === null || isNaN(wordCount) || wordCount < 0) {
wordCount = 10;
}
wordCount = parseInt(wordCount);
if (
wordCount === null ||
isNaN(wordCount) ||
wordCount < 0 ||
wordCount > 100000
) {
wordCount = defaultConfig.wordCount;
}
// if (!nosave) setMode("words", nosave);
config.words = wordCount;
$("#top .config .wordCount .text-button").removeClass("active");
if (![10, 25, 50, 100, 200].includes(wordCount)) {
wordCount = "custom";
$("#top .config .wordCount .text-button[wordCount='custom']").addClass(
"active"
);
}
$(
"#top .config .wordCount .text-button[wordCount='" + wordCount + "']"
).addClass("active");
ChallengeContoller.clearActive();
if (!nosave) saveToLocalStorage();
}