mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2024-09-21 07:46:15 +08:00
fix(config): fixed setting keymap legends
This commit is contained in:
parent
ecc3902a6a
commit
795f695d88
|
@ -87,8 +87,8 @@ let defaultConfig = {
|
|||
showAllLines: false,
|
||||
keymapMode: "off",
|
||||
keymapStyle: "staggered",
|
||||
keymapLayout: "qwerty",
|
||||
keymapLegendStyle: "lowercase",
|
||||
keymapLayout: "qwerty",
|
||||
fontFamily: "Roboto_Mono",
|
||||
smoothLineScroll: false,
|
||||
alwaysShowDecimalPlaces: false,
|
||||
|
@ -1266,15 +1266,18 @@ export function setKeymapMode(mode, nosave) {
|
|||
if (!nosave) saveToCookie();
|
||||
}
|
||||
|
||||
export function setKeymapLegendStyle(style = "lowercase", shouldSave = true) {
|
||||
export function setKeymapLegendStyle(style, nosave) {
|
||||
// Remove existing styles
|
||||
keymapLegendStyles.forEach(({ name }) => {
|
||||
$(".keymapLegendStyle").removeClass(name);
|
||||
});
|
||||
|
||||
// Save to cookie for persistence
|
||||
style = style || "lowercase";
|
||||
|
||||
// Update and save to cookie for persistence
|
||||
$(".keymapLegendStyle").addClass(style);
|
||||
config.keymapLegendStyle = style;
|
||||
if (shouldSave) saveToCookie();
|
||||
if (!nosave) saveToCookie();
|
||||
}
|
||||
|
||||
export function setKeymapStyle(style, nosave) {
|
||||
|
@ -1282,17 +1285,9 @@ export function setKeymapStyle(style, nosave) {
|
|||
$(".keymap").removeClass("split");
|
||||
$(".keymap").removeClass("split_matrix");
|
||||
|
||||
if (style == null || style == undefined) {
|
||||
style = "staggered";
|
||||
}
|
||||
style = style || "staggered";
|
||||
|
||||
if (style === "matrix") {
|
||||
$(".keymap").addClass("matrix");
|
||||
} else if (style === "split") {
|
||||
$(".keymap").addClass("split");
|
||||
} else if (style === "split_matrix") {
|
||||
$(".keymap").addClass("split_matrix");
|
||||
}
|
||||
$(".keymap").addClass(style);
|
||||
config.keymapStyle = style;
|
||||
if (!nosave) saveToCookie();
|
||||
}
|
||||
|
@ -1444,6 +1439,7 @@ export function apply(configObj) {
|
|||
setTimerOpacity(configObj.timerOpacity, true);
|
||||
setKeymapMode(configObj.keymapMode, true);
|
||||
setKeymapStyle(configObj.keymapStyle, true);
|
||||
setKeymapLegendStyle(configObj.keymapLegendStyle, true);
|
||||
setKeymapLayout(configObj.keymapLayout, true);
|
||||
setFontFamily(configObj.fontFamily, true);
|
||||
setSmoothCaret(configObj.smoothCaret, true);
|
||||
|
|
|
@ -2774,7 +2774,7 @@
|
|||
<div class="buttons">
|
||||
<div
|
||||
class="button"
|
||||
keymapStyle="lowercase"
|
||||
keymapLegendStyle="lowercase"
|
||||
tabindex="0"
|
||||
onclick="this.blur();"
|
||||
>
|
||||
|
@ -2782,7 +2782,7 @@
|
|||
</div>
|
||||
<div
|
||||
class="button"
|
||||
keymapStyle="uppercase"
|
||||
keymapLegendStyle="uppercase"
|
||||
tabindex="0"
|
||||
onclick="this.blur();"
|
||||
>
|
||||
|
@ -2790,7 +2790,7 @@
|
|||
</div>
|
||||
<div
|
||||
class="button"
|
||||
keymapStyle="blank"
|
||||
keymapLegendStyle="blank"
|
||||
tabindex="0"
|
||||
onclick="this.blur();"
|
||||
>
|
||||
|
|
Loading…
Reference in a new issue