mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2024-11-11 01:15:49 +08:00
time mode now shows 3 lines and generates a new line only when the second is completed
This commit is contained in:
parent
49e3de8b38
commit
ca0e07231a
1 changed files with 14 additions and 5 deletions
|
@ -9,6 +9,7 @@ let testStart, testEnd;
|
|||
let wpmHistory = [];
|
||||
let currentCommands = commands;
|
||||
let restartCount = 0;
|
||||
let currentTestLine = 0;
|
||||
|
||||
let accuracyStats = {
|
||||
correct: 0,
|
||||
|
@ -215,7 +216,7 @@ function showWords() {
|
|||
$("#words").append(w);
|
||||
}
|
||||
$("#words").removeClass('hidden');
|
||||
const wordHeight = $($(".word")[0]).outerHeight();
|
||||
const wordHeight = $($(".word")[0]).outerHeight(true);
|
||||
$("#words").css("height", wordHeight * 3 + 'px').css("overflow", "hidden");
|
||||
}
|
||||
updateActiveElement();
|
||||
|
@ -554,7 +555,7 @@ function restartTest() {
|
|||
hideCaret();
|
||||
testActive = false;
|
||||
hideLiveWpm();
|
||||
|
||||
currentTestLine = 0;
|
||||
let el = null;
|
||||
if($("#words").hasClass('hidden')){
|
||||
//results are being displayed
|
||||
|
@ -1024,10 +1025,18 @@ $(document).keydown((event) => {
|
|||
let nextTop = $($("#words .word")[currentWordIndex + 1]).position().top;
|
||||
if (nextTop > currentTop) {
|
||||
//last word of the line
|
||||
for (let i = 0; i < currentWordIndex + 1; i++) {
|
||||
$($("#words .word")[i]).addClass("hidden");
|
||||
// addWordLine();
|
||||
if(currentTestLine > 0){
|
||||
let toHide = [];
|
||||
for (let i = 0; i < currentWordIndex + 1; i++) {
|
||||
let forWordTop = $($("#words .word")[i]).position().top;
|
||||
if(forWordTop < currentTop){
|
||||
// $($("#words .word")[i]).addClass("hidden");
|
||||
toHide.push($($("#words .word")[i]));
|
||||
}
|
||||
}
|
||||
toHide.forEach(el => el.addClass('hidden'));
|
||||
}
|
||||
currentTestLine++;
|
||||
}
|
||||
}
|
||||
if (currentWord == currentInput) {
|
||||
|
|
Loading…
Reference in a new issue