From 98f168e5c6866ee3d3391ddd5b2854bbe2ee8407 Mon Sep 17 00:00:00 2001 From: Jack Date: Mon, 27 Jul 2020 03:06:02 +0100 Subject: [PATCH] when custom text random is enabled, making sure to dynamically add more words made sure progress words for custom texts --- public/js/script.js | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/public/js/script.js b/public/js/script.js index 8518add22..b36591a9f 100644 --- a/public/js/script.js +++ b/public/js/script.js @@ -310,15 +310,19 @@ function initWords() { ) { // let wordsBound = config.mode == "time" ? 60 : config.words; let wordsBound = 60; - if (config.showAllLines && config.mode != "time") { - wordsBound = config.words; + if (config.showAllLines) { + if (config.mode === "custom") { + wordsBound = customTextWordCount; + } else if (config.mode != "time") { + wordsBound = config.words; + } } else { if (config.mode === "words" && config.words < wordsBound) { wordsBound = config.words; } - } - if (config.mode == "custom") { - wordsBound = customTextWordCount; + if (config.mode == "custom" && customTextWordCount < wordsBound) { + wordsBound = customTextWordCount; + } } let wordset = language; if (config.mode == "custom") { @@ -796,6 +800,13 @@ function updateTimer() { if (config.mode === "words") { outof = config.words; } + if (config.mode === "custom") { + if (customTextIsRandom) { + outof = customTextWordCount; + } else { + outof = customText.length; + } + } $("#timerNumber").html(`${inputHistory.length}/${outof}`); // $("#timerNumber").html(config.time - time); }