mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-11-08 05:03:39 +08:00
remove evals (#2624)
This commit is contained in:
parent
c27caa68af
commit
8da243ecfe
3 changed files with 23 additions and 7 deletions
|
|
@ -3215,8 +3215,28 @@ export function pushCurrent(val: MonkeyTypes.CommandsGroup): void {
|
|||
current.push(val);
|
||||
}
|
||||
|
||||
export function getList(list: string): MonkeyTypes.CommandsGroup {
|
||||
return eval(list);
|
||||
const listsObject = {
|
||||
commandsChallenges,
|
||||
commandsLanguages,
|
||||
commandsDifficulty,
|
||||
commandsLazyMode,
|
||||
commandsPaceCaret,
|
||||
commandsShowAvg,
|
||||
commandsMinWpm,
|
||||
commandsMinAcc,
|
||||
commandsMinBurst,
|
||||
commandsFunbox,
|
||||
commandsConfidenceMode,
|
||||
commandsStopOnError,
|
||||
commandsLayouts,
|
||||
commandsOppositeShiftMode,
|
||||
commandsTags,
|
||||
};
|
||||
|
||||
export type ListsObjectKeys = keyof typeof listsObject;
|
||||
|
||||
export function getList(list: ListsObjectKeys): MonkeyTypes.CommandsGroup {
|
||||
return listsObject[list];
|
||||
}
|
||||
|
||||
ConfigEvent.subscribe((eventKey, eventValue) => {
|
||||
|
|
|
|||
|
|
@ -668,17 +668,14 @@ $(document).on("click", "#keymap .r5 .key-space", () => {
|
|||
|
||||
$(document).on("click", "#testModesNotice .text-button", (event) => {
|
||||
const commands = CommandlineLists.getList(
|
||||
$(event.currentTarget).attr("commands") as string
|
||||
$(event.currentTarget).attr("commands") as CommandlineLists.ListsObjectKeys
|
||||
);
|
||||
const func = $(event.currentTarget).attr("function");
|
||||
if (commands !== undefined) {
|
||||
if ($(event.currentTarget).attr("commands") === "commandsTags") {
|
||||
CommandlineLists.updateTagCommands();
|
||||
}
|
||||
CommandlineLists.pushCurrent(commands);
|
||||
show();
|
||||
} else if (func != undefined) {
|
||||
eval(func);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -566,7 +566,6 @@ list["clearTagPb"] = new SimplePopup(
|
|||
} else {
|
||||
Notifications.add("Something went wrong: " + response.message, -1);
|
||||
}
|
||||
// console.log(`clearing for ${eval("this.parameters[0]")} ${eval("this.parameters[1]")}`);
|
||||
},
|
||||
(thisPopup) => {
|
||||
thisPopup.text = `Are you sure you want to clear PB for tag ${thisPopup.parameters[1]}?`;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue