mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2024-09-20 07:16:17 +08:00
commit
147bc47e43
|
@ -828,18 +828,18 @@ function validateResult(result) {
|
|||
);
|
||||
return false;
|
||||
}
|
||||
if (result.allChars != undefined) {
|
||||
let raw = roundTo2((result.allChars * (60 / result.testDuration)) / 5);
|
||||
if (
|
||||
raw < result.rawWpm - result.rawWpm * 0.01 ||
|
||||
raw > result.rawWpm + result.rawWpm * 0.01
|
||||
) {
|
||||
console.error(
|
||||
`Could not validate result for ${result.uid}. raw ${raw} != ${result.rawWpm}`
|
||||
);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// if (result.allChars != undefined) {
|
||||
// let raw = roundTo2((result.allChars * (60 / result.testDuration)) / 5);
|
||||
// if (
|
||||
// raw < result.rawWpm - result.rawWpm * 0.01 ||
|
||||
// raw > result.rawWpm + result.rawWpm * 0.01
|
||||
// ) {
|
||||
// console.error(
|
||||
// `Could not validate result for ${result.uid}. raw ${raw} != ${result.rawWpm}`
|
||||
// );
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
if (result.mode === "time" && (result.mode2 === 15 || result.mode2 === 60)) {
|
||||
let keyPressTimeSum =
|
||||
result.keySpacing.reduce((total, val) => {
|
||||
|
@ -870,7 +870,7 @@ function validateResult(result) {
|
|||
if (result.chartData.wpm.filter((w) => w > 400).length > 0) return false;
|
||||
}
|
||||
|
||||
if (result.consistency < 10) return false;
|
||||
if (result.wpm > 100 && result.consistency < 10) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -974,6 +974,14 @@ let commandsCaretStyle = {
|
|||
setCaretStyle("underline");
|
||||
},
|
||||
},
|
||||
{
|
||||
id: "setCaretStyleCarrot",
|
||||
display: "carrot",
|
||||
visible: false,
|
||||
exec: () => {
|
||||
setCaretStyle("carrot");
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
|
|
|
@ -1766,16 +1766,13 @@ function calculateStats() {
|
|||
let wpm = Misc.roundTo2(
|
||||
((chars.correctWordChars + chars.correctSpaces) * (60 / testSeconds)) / 5
|
||||
);
|
||||
// let wpmraw = Misc.roundTo2(
|
||||
// ((chars.allCorrectChars +
|
||||
// chars.spaces +
|
||||
// chars.incorrectChars +
|
||||
// chars.extraChars) *
|
||||
// (60 / testSeconds)) /
|
||||
// 5
|
||||
// );
|
||||
let wpmraw = Misc.roundTo2(
|
||||
rawHistory.reduce((a, b) => a + b, 0) / rawHistory.length
|
||||
((chars.allCorrectChars +
|
||||
chars.spaces +
|
||||
chars.incorrectChars +
|
||||
chars.extraChars) *
|
||||
(60 / testSeconds)) /
|
||||
5
|
||||
);
|
||||
let acc = Misc.roundTo2(
|
||||
(accuracyStats.correct /
|
||||
|
@ -3452,8 +3449,7 @@ function liveWpmAndRaw() {
|
|||
let testNow = performance.now();
|
||||
let testSeconds = (testNow - testStart) / 1000;
|
||||
let wpm = Math.round(((correctWordChars + spaces) * (60 / testSeconds)) / 5);
|
||||
// let raw = Math.round(((chars + spaces) * (60 / testSeconds)) / 5);
|
||||
let raw = Math.round((currentKeypress.count * (60 / 1)) / 5);
|
||||
let raw = Math.round(((chars + spaces) * (60 / testSeconds)) / 5);
|
||||
return {
|
||||
wpm: wpm,
|
||||
raw: raw,
|
||||
|
|
|
@ -607,6 +607,7 @@ function setCaretStyle(caretStyle, nosave) {
|
|||
$("#caret").removeClass("underline");
|
||||
$("#caret").removeClass("outline");
|
||||
$("#caret").removeClass("block");
|
||||
$("#caret").removeClass("carrot");
|
||||
|
||||
if (caretStyle == "off") {
|
||||
$("#caret").addClass("off");
|
||||
|
@ -618,6 +619,8 @@ function setCaretStyle(caretStyle, nosave) {
|
|||
$("#caret").addClass("outline");
|
||||
} else if (caretStyle == "underline") {
|
||||
$("#caret").addClass("underline");
|
||||
} else if (caretStyle == "carrot") {
|
||||
$("#caret").addClass("carrot");
|
||||
}
|
||||
if (!nosave) saveConfigToCookie();
|
||||
}
|
||||
|
|
|
@ -1145,6 +1145,21 @@ a:hover {
|
|||
width: 2px;
|
||||
}
|
||||
|
||||
&.carrot {
|
||||
background-color: transparent;
|
||||
background-image: url("../carrot.png");
|
||||
background-size: contain;
|
||||
background-position: center;
|
||||
background-repeat: no-repeat;
|
||||
width: 0.25rem;
|
||||
&.size2 {
|
||||
margin-left: -0.1rem;
|
||||
}
|
||||
&.size3 {
|
||||
margin-left: -0.2rem;
|
||||
}
|
||||
}
|
||||
|
||||
&.block {
|
||||
width: 0.7em;
|
||||
margin-left: 0.25em;
|
||||
|
|
BIN
static/carrot.png
Normal file
BIN
static/carrot.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.9 KiB |
Loading…
Reference in a new issue