added an 'all' quote filter

This commit is contained in:
Jack 2020-09-28 14:58:45 +01:00
parent 788412a3a7
commit c12f82779c
3 changed files with 15 additions and 7 deletions

View file

@ -891,6 +891,7 @@
<div class="group quoteLength hidden">
<!-- <div class="title">time</div> -->
<div class="buttons">
<div class="text-button" quoteLength="-1" tabindex="2">all</div>
<div class="text-button" quoteLength="0" tabindex="2">short</div>
<div class="text-button active" quoteLength="1" tabindex="2">
medium

View file

@ -520,7 +520,14 @@ function initWords() {
wordsList.push(randomWord);
}
} else if (config.mode == "quote") {
randomQuote = quotes.groups[config.quoteLength][Math.floor(Math.random() * quotes.groups[config.quoteLength].length)];
let group = config.quoteLength;
if (config.quoteLength === -1) {
group = Math.floor(Math.random() * quotes.groups.length);
}
randomQuote = quotes.groups[group][Math.floor(Math.random() * quotes.groups[group].length)];
let w = randomQuote.text.trim().split(" ");
for (let i = 0; i < w.length; i++) {
wordsList.push(w[i]);
@ -2247,15 +2254,15 @@ function showResult(difficultyFailed = false) {
if (config.mode === "quote") {
let qlen;
if (config.quoteLength === 0) {
qlen = "short";
qlen = "short ";
}else if (config.quoteLength === 1) {
qlen = "medium";
qlen = "medium ";
}else if (config.quoteLength === 2) {
qlen = "long";
qlen = "long ";
}else if (config.quoteLength === 2) {
qlen = "thicc";
qlen = "thicc ";
}
testType += qlen + ' ' + config.mode;
testType += qlen + config.mode;
} else {
testType += config.mode;
}

View file

@ -649,7 +649,7 @@ function changeTimeConfig(time, nosave) {
//quote length
function changeQuoteLength(len, nosave) {
if (len !== null && !isNaN(len) && len >= 0) {
if (len !== null && !isNaN(len) && len >= -1 && len <= 3) {
} else {
len = 1;
}