changed the way custom speed is set for the pace caret

This commit is contained in:
Jack 2020-10-01 19:51:29 +01:00
parent 7180b041e5
commit 8c92983ae5
3 changed files with 5 additions and 4 deletions

View file

@ -2574,6 +2574,7 @@ function restartTest(withSameWordset = false, nosave = false) {
hideLiveWpm();
hideTimer();
bailout = false;
paceCaret = null;
if(paceCaret !== null) clearTimeout(paceCaret.timeout);
$("#showWordHistoryButton").removeClass("loaded");
keypressPerSecond = [];
@ -2632,7 +2633,6 @@ function restartTest(withSameWordset = false, nosave = false) {
$("#typingTest").css("opacity", 0).removeClass("hidden");
if (!withSameWordset) {
sameWordset = false;
paceCaret = null;
initWords();
initPaceCaret(nosave);
} else {
@ -3596,8 +3596,6 @@ function playErrorSound() {
async function initPaceCaret(nosave = false) {
setPaceCaretCustomSpeed(parseInt($(".pageSettings .section.paceCaret input.customPaceCaretSpeed").val()),nosave);
let mode2 = "";
if (config.mode === "time") {
mode2 = config.time;

View file

@ -656,6 +656,10 @@ function updateDiscordSettingsSection() {
}
}
$(document).on('focusout', ".pageSettings .section.paceCaret input.customPaceCaretSpeed", (e) => {
setPaceCaretCustomSpeed(parseInt($(".pageSettings .section.paceCaret input.customPaceCaretSpeed").val()));
})
$(document).on("click", ".pageSettings .section.themes .theme.button", (e) => {
let theme = $(e.currentTarget).attr("theme");
if (!$(e.target).hasClass("favButton")) {

View file

@ -416,7 +416,6 @@ function setPaceCaretCustomSpeed(val, nosave) {
val = 100;
}
config.paceCaretCustomSpeed = val;
$(".pageSettings .section.paceCaret input.customPaceCaretSpeed").val(val);
if (!nosave) saveConfigToCookie();
}