mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2026-01-09 00:45:32 +08:00
refactor(static): removed keymap static files and associated imports
This commit is contained in:
parent
a703a7123a
commit
e44a6e4fcb
5 changed files with 13 additions and 22 deletions
|
|
@ -15,7 +15,6 @@ import * as Funbox from "./funbox";
|
|||
import * as TagController from "./tag-controller";
|
||||
import * as Commandline from "./commandline";
|
||||
import * as CustomText from "./custom-text";
|
||||
import { keymapLegendStyles } from "../../static/keymap/legend";
|
||||
|
||||
export let current = [];
|
||||
|
||||
|
|
@ -653,23 +652,23 @@ let commandsKeymapLegendStyle = {
|
|||
list: [
|
||||
{
|
||||
id: "setKeymapLegendStyleLowercase",
|
||||
display: keymapLegendStyles.lowercase,
|
||||
display: "lowercase",
|
||||
exec: () => {
|
||||
UpdateConfig.setKeymapLegendStyle(keymapLegendStyles.lowercase);
|
||||
UpdateConfig.setKeymapLegendStyle("lowercase");
|
||||
},
|
||||
},
|
||||
{
|
||||
id: "setKeymapLegendStyleUppercase",
|
||||
display: keymapLegendStyles.uppercase,
|
||||
display: "uppercase",
|
||||
exec: () => {
|
||||
UpdateConfig.setKeymapLegendStyle(keymapLegendStyles.uppercase);
|
||||
UpdateConfig.setKeymapLegendStyle("uppercase");
|
||||
},
|
||||
},
|
||||
{
|
||||
id: "setKeymapLegendStyleBlank",
|
||||
display: keymapLegendStyles.blank,
|
||||
display: "blank",
|
||||
exec: () => {
|
||||
UpdateConfig.setKeymapLegendStyle(keymapLegendStyles.blank);
|
||||
UpdateConfig.setKeymapLegendStyle("blank");
|
||||
},
|
||||
},
|
||||
],
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@ import * as PaceCaret from "./pace-caret";
|
|||
import * as UI from "./ui";
|
||||
import * as CommandlineLists from "./commandline-lists";
|
||||
import * as BackgroundFilter from "./custom-background-filter";
|
||||
import keymapLegendStyles from "../../static/keymap/legend/_list.json";
|
||||
|
||||
export let cookieConfig = null;
|
||||
export let dbConfigLoaded = false;
|
||||
|
|
@ -87,7 +86,7 @@ let defaultConfig = {
|
|||
showAllLines: false,
|
||||
keymapMode: "off",
|
||||
keymapStyle: "staggered",
|
||||
keymapLegendStyle: keymapLegendStyles.lowercase,
|
||||
keymapLegendStyle: "lowercase",
|
||||
keymapLayout: "qwerty",
|
||||
fontFamily: "Roboto_Mono",
|
||||
smoothLineScroll: false,
|
||||
|
|
@ -1268,11 +1267,12 @@ export function setKeymapMode(mode, nosave) {
|
|||
|
||||
export function setKeymapLegendStyle(style, nosave) {
|
||||
// Remove existing styles
|
||||
Object.keys(keymapLegendStyles).forEach((name) => {
|
||||
const keymapLegendStyles = ["lowercase", "uppercase", "blank"];
|
||||
keymapLegendStyles.forEach((name) => {
|
||||
$(".keymapLegendStyle").removeClass(name);
|
||||
});
|
||||
|
||||
style = style || keymapLegendStyles.lowercase;
|
||||
style = style || "lowercase";
|
||||
|
||||
// Mutate the keymap in the DOM, if it exists.
|
||||
// 1. Remove everything
|
||||
|
|
@ -1280,10 +1280,10 @@ export function setKeymapLegendStyle(style, nosave) {
|
|||
$(".keymap-key > .letter").css("text-transform", "");
|
||||
|
||||
// 2. Append special styles onto the DOM elements
|
||||
if (style === keymapLegendStyles.uppercase) {
|
||||
if (style === "uppercase") {
|
||||
$(".keymap-key > .letter").css("text-transform", "capitalize");
|
||||
}
|
||||
if (style === keymapLegendStyles.blank) {
|
||||
if (style === "blank") {
|
||||
$(".keymap-key > .letter").css("display", "none");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@ import * as TagController from "./tag-controller";
|
|||
import * as SimplePopups from "./simple-popups";
|
||||
import * as EditTagsPopup from "./edit-tags-popup";
|
||||
import * as ThemePicker from "./theme-picker";
|
||||
import { KEYMAP_LEGEND_TITLE } from "../../static/keymap/legend";
|
||||
|
||||
export let groups = {};
|
||||
async function initGroups() {
|
||||
|
|
@ -69,7 +68,7 @@ async function initGroups() {
|
|||
UpdateConfig.setKeymapLayout
|
||||
);
|
||||
groups.keymapLegendStyle = new SettingsGroup(
|
||||
KEYMAP_LEGEND_TITLE,
|
||||
"keymapLegendStyle",
|
||||
UpdateConfig.setKeymapLegendStyle
|
||||
);
|
||||
groups.showKeyTips = new SettingsGroup(
|
||||
|
|
|
|||
|
|
@ -1,5 +0,0 @@
|
|||
{
|
||||
"lowercase": "lowercase",
|
||||
"uppercase": "uppercase",
|
||||
"blank": "blank"
|
||||
}
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
export * as keymapLegendStyles from "./_list.json";
|
||||
export const KEYMAP_LEGEND_TITLE = "keymapLegendStyle";
|
||||
Loading…
Add table
Reference in a new issue