mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-12-17 13:39:46 +08:00
added a button to practise missed words
This commit is contained in:
parent
4f5a851206
commit
b9be145c92
3 changed files with 42 additions and 1 deletions
|
|
@ -1490,7 +1490,8 @@ key {
|
|||
#showWordHistoryButton,
|
||||
#copyResultToClipboardButton,
|
||||
#restartTestButtonWithSameWordset,
|
||||
#nextTestButton {
|
||||
#nextTestButton,
|
||||
#practiseMissedWordsButton {
|
||||
position: relative;
|
||||
border-radius: var(--roundness);
|
||||
padding: 1rem 2rem;
|
||||
|
|
|
|||
|
|
@ -1236,6 +1236,15 @@
|
|||
>
|
||||
<i class="fas fa-fw fa-sync-alt"></i>
|
||||
</div>
|
||||
<div
|
||||
id="practiseMissedWordsButton"
|
||||
aria-label="Practise missed words"
|
||||
data-balloon-pos="down"
|
||||
tabindex="0"
|
||||
onclick="this.blur();"
|
||||
>
|
||||
<i class="fas fa-fw fa-exclamation-triangle"></i>
|
||||
</div>
|
||||
<div
|
||||
id="showWordHistoryButton"
|
||||
aria-label="Toggle words history"
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ let notSignedInLastResult = null;
|
|||
let caretAnimating = true;
|
||||
let lastSecondNotRound = false;
|
||||
let paceCaret = null;
|
||||
let missedWords = [];
|
||||
|
||||
let themeColors = {
|
||||
bg: "#323437",
|
||||
|
|
@ -2522,6 +2523,7 @@ function restartTest(withSameWordset = false) {
|
|||
// afkDetected = false;
|
||||
wpmHistory = [];
|
||||
rawHistory = [];
|
||||
missedWords = [];
|
||||
correctedHistory = [];
|
||||
setFocus(false);
|
||||
hideCaret();
|
||||
|
|
@ -3888,6 +3890,32 @@ $(document.body).on("click", "#restartTestButton", (event) => {
|
|||
restartTest();
|
||||
});
|
||||
|
||||
$(document).on("keypress", "#practiseMissedWordsButton", (event) => {
|
||||
if (event.keyCode == 13) {
|
||||
if (missedWords.length > 0) {
|
||||
changeMode("custom");
|
||||
customText = missedWords;
|
||||
customTextIsRandom = true;
|
||||
customTextWordCount = 50;
|
||||
restartTest();
|
||||
} else {
|
||||
showNotification("You haven't missed any words.", 2000);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$(document.body).on("click", "#practiseMissedWordsButton", (event) => {
|
||||
if (missedWords.length > 0) {
|
||||
changeMode("custom");
|
||||
customText = missedWords;
|
||||
customTextIsRandom = true;
|
||||
customTextWordCount = 50;
|
||||
restartTest();
|
||||
} else {
|
||||
showNotification("You haven't missed any words.", 2000);
|
||||
}
|
||||
});
|
||||
|
||||
$(document).on("keypress", "#nextTestButton", (event) => {
|
||||
if (event.keyCode == 13) {
|
||||
restartTest();
|
||||
|
|
@ -4033,6 +4061,9 @@ $(document).keypress(function (event) {
|
|||
currentError.count++;
|
||||
currentError.words.push(currentWordIndex);
|
||||
thisCharCorrect = false;
|
||||
if (!missedWords.includes(wordsList[currentWordIndex])) {
|
||||
missedWords.push(wordsList[currentWordIndex]);
|
||||
}
|
||||
} else {
|
||||
accuracyStats.correct++;
|
||||
thisCharCorrect = true;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue