moved live wpm below keymap, catching any error while flashing keymap key

This commit is contained in:
Jack 2020-08-02 22:34:43 +01:00
parent d9531181f7
commit e3a529058f
3 changed files with 44 additions and 37 deletions

View file

@ -739,6 +739,10 @@ a:hover {
#liveWpm {
top: 6rem;
&.lower {
top: 15rem;
}
}
#centerContent {

View file

@ -1062,41 +1062,43 @@ function flashPressedKeymapKey(key, correct) {
key = `#Key${key.toUpperCase()}`;
}
if (correct) {
$(key)
.stop(true, true)
.css({
color: themeColors.bg,
backgroundColor: themeColors.main,
borderColor: themeColors.main,
})
.animate(
{
color: themeColors.sub,
backgroundColor: themeColors.bg,
borderColor: themeColors.sub,
},
500,
"easeOutExpo"
);
} else {
$(key)
.stop(true, true)
.css({
color: themeColors.bg,
backgroundColor: themeColors.error,
borderColor: themeColors.error,
})
.animate(
{
color: themeColors.sub,
backgroundColor: themeColors.bg,
borderColor: themeColors.sub,
},
500,
"easeOutExpo"
);
}
try {
if (correct) {
$(key)
.stop(true, true)
.css({
color: themeColors.bg,
backgroundColor: themeColors.main,
borderColor: themeColors.main,
})
.animate(
{
color: themeColors.sub,
backgroundColor: themeColors.bg,
borderColor: themeColors.sub,
},
500,
"easeOutExpo"
);
} else {
$(key)
.stop(true, true)
.css({
color: themeColors.bg,
backgroundColor: themeColors.error,
borderColor: themeColors.error,
})
.animate(
{
color: themeColors.sub,
backgroundColor: themeColors.bg,
borderColor: themeColors.sub,
},
500,
"easeOutExpo"
);
}
} catch (e) {}
}
function updateHighlightedKeymapKey() {

View file

@ -740,9 +740,10 @@ function changeKeymapMode(mode, nosave) {
mode = "off";
}
if (mode === "off") {
hideKeymap();
// hideKeymap();
$("#liveWpm").removeClass("lower");
} else {
showKeymap();
$("#liveWpm").addClass("lower");
}
if (mode === "react") {
$(".active-key").removeClass("active-key");