diff --git a/functions/index.js b/functions/index.js index 0e920a405..ee558c189 100644 --- a/functions/index.js +++ b/functions/index.js @@ -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; } diff --git a/src/js/commandline.js b/src/js/commandline.js index f191ec211..c6570eca9 100644 --- a/src/js/commandline.js +++ b/src/js/commandline.js @@ -974,6 +974,14 @@ let commandsCaretStyle = { setCaretStyle("underline"); }, }, + { + id: "setCaretStyleCarrot", + display: "carrot", + visible: false, + exec: () => { + setCaretStyle("carrot"); + }, + }, ], }; diff --git a/src/js/script.js b/src/js/script.js index 568807880..eb6709be8 100644 --- a/src/js/script.js +++ b/src/js/script.js @@ -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, diff --git a/src/js/userconfig.js b/src/js/userconfig.js index 3a45bb0ec..e86244890 100644 --- a/src/js/userconfig.js +++ b/src/js/userconfig.js @@ -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(); } diff --git a/src/sass/style.scss b/src/sass/style.scss index 0fca8a8a3..cdc0a7eb3 100644 --- a/src/sass/style.scss +++ b/src/sass/style.scss @@ -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; diff --git a/static/carrot.png b/static/carrot.png new file mode 100644 index 000000000..751ea31db Binary files /dev/null and b/static/carrot.png differ