From 7b599a2465125fad761df325dad688be76e4acb0 Mon Sep 17 00:00:00 2001 From: Miodec Date: Fri, 11 Feb 2022 01:38:43 +0100 Subject: [PATCH] removed dependencies --- .../src/js/controllers/preset-controller.js | 2 -- frontend/src/js/elements/commandline-lists.js | 1 + frontend/src/js/elements/commandline.js | 16 ++++++++++++++++ frontend/src/js/pages/settings.js | 1 + frontend/src/js/test/test-ui.js | 19 ------------------- 5 files changed, 18 insertions(+), 21 deletions(-) diff --git a/frontend/src/js/controllers/preset-controller.js b/frontend/src/js/controllers/preset-controller.js index b54c580cc..e4fb7da8e 100644 --- a/frontend/src/js/controllers/preset-controller.js +++ b/frontend/src/js/controllers/preset-controller.js @@ -1,7 +1,6 @@ import * as Config from "../config"; import * as DB from "../db"; import * as Notifications from "../elements/notifications"; -import * as Settings from "../pages/settings"; import * as TestLogic from "../test/test-logic"; import * as TagController from "./tag-controller"; @@ -19,7 +18,6 @@ export function apply(_id) { TestLogic.restart(); Notifications.add("Preset applied", 1, 2); Config.saveToLocalStorage(); - Settings.update(); } }); } diff --git a/frontend/src/js/elements/commandline-lists.js b/frontend/src/js/elements/commandline-lists.js index 72cef6407..8e89d0cf5 100644 --- a/frontend/src/js/elements/commandline-lists.js +++ b/frontend/src/js/elements/commandline-lists.js @@ -284,6 +284,7 @@ export function updatePresetCommands() { display: dis, exec: () => { PresetController.apply(preset._id); + Settings.update(); TestUI.updateModesNotice(); }, }); diff --git a/frontend/src/js/elements/commandline.js b/frontend/src/js/elements/commandline.js index 8c44d8599..c2af0bc67 100644 --- a/frontend/src/js/elements/commandline.js +++ b/frontend/src/js/elements/commandline.js @@ -634,3 +634,19 @@ $(document).on("click", ".keymap .r5 #KeySpace", (e) => { CommandlineLists.setCurrent([CommandlineLists.commandsKeymapLayouts]); show(); }); + +$(document).on("click", "#testModesNotice .text-button", (event) => { + let commands = CommandlineLists.getList( + $(event.currentTarget).attr("commands") + ); + let 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); + } +}); diff --git a/frontend/src/js/pages/settings.js b/frontend/src/js/pages/settings.js index 1eac337d3..fb2535211 100644 --- a/frontend/src/js/pages/settings.js +++ b/frontend/src/js/pages/settings.js @@ -808,6 +808,7 @@ $(document).on( let presetid = $(target).parent(".preset").attr("id"); console.log("Applying Preset"); PresetController.apply(presetid); + update(); } ); diff --git a/frontend/src/js/test/test-ui.js b/frontend/src/js/test/test-ui.js index 785419ee1..2324338f9 100644 --- a/frontend/src/js/test/test-ui.js +++ b/frontend/src/js/test/test-ui.js @@ -9,8 +9,6 @@ import * as PaceCaret from "./pace-caret"; import * as CustomText from "./custom-text"; import * as Keymap from "../elements/keymap"; import * as Caret from "./caret"; -import * as CommandlineLists from "../elements/commandline-lists"; -import * as Commandline from "../elements/commandline"; import * as OutOfFocus from "./out-of-focus"; import * as ManualRestart from "./manual-restart-tracker"; import * as PractiseWords from "./practise-words"; @@ -1080,23 +1078,6 @@ $(document).on("mouseenter", "#resultWordsHistory .words .word", (e) => { } }); -$(document).on("click", "#testModesNotice .text-button", (event) => { - // console.log("CommandlineLists."+$(event.currentTarget).attr("commands")); - let commands = CommandlineLists.getList( - $(event.currentTarget).attr("commands") - ); - let func = $(event.currentTarget).attr("function"); - if (commands !== undefined) { - if ($(event.currentTarget).attr("commands") === "commandsTags") { - CommandlineLists.updateTagCommands(); - } - CommandlineLists.pushCurrent(commands); - Commandline.show(); - } else if (func != undefined) { - eval(func); - } -}); - $("#wordsInput").on("focus", () => { if (!resultVisible && Config.showOutOfFocusWarning) { OutOfFocus.hide();