From aec4959d5b6ad2e7c3de84159d4d9903ea2de1bf Mon Sep 17 00:00:00 2001 From: Miodec Date: Fri, 26 Mar 2021 00:31:03 +0000 Subject: [PATCH] fixed some todo's --- src/js/test/caret.js | 3 --- src/js/test/keymap.js | 7 +++---- src/js/test/live-acc.js | 3 ++- src/js/test/live-wpm.js | 3 ++- src/js/test/timer-progress.js | 5 +++-- 5 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/js/test/caret.js b/src/js/test/caret.js index 3f523cd20..7ab152dc4 100644 --- a/src/js/test/caret.js +++ b/src/js/test/caret.js @@ -12,7 +12,6 @@ export function stopAnimation() { } } -//TODO remove config when module export function startAnimation() { if (caretAnimating === false) { if (Config.smoothCaret) { @@ -28,8 +27,6 @@ export function hide() { $("#caret").addClass("hidden"); } -//TODO remove this after test logic is a module -//TODO remove config when module export function updatePosition() { if ($("#wordsWrapper").hasClass("hidden")) return; if ($("#caret").hasClass("off")) { diff --git a/src/js/test/keymap.js b/src/js/test/keymap.js index 98146f49e..94036e40e 100644 --- a/src/js/test/keymap.js +++ b/src/js/test/keymap.js @@ -1,4 +1,4 @@ -import Config from "./config"; +import Config, * as UpdateConfig from "./config"; import * as ThemeColors from "./theme-colors"; import layouts from "./layouts"; @@ -152,8 +152,7 @@ export function show() { $(".keymap").removeClass("hidden"); } -//TODO remove setkeymaplayout after userconfig is a module -export function refreshKeys(layout, setKeymapLayout) { +export function refreshKeys(layout) { try { let lts = layouts[layout]; //layout to show let layoutString = layout; @@ -240,6 +239,6 @@ export function refreshKeys(layout, setKeymapLayout) { console.log( "something went wrong when changing layout, resettings: " + e.message ); - setKeymapLayout("qwerty", true); + UpdateConfig.setKeymapLayout("qwerty", true); } } diff --git a/src/js/test/live-acc.js b/src/js/test/live-acc.js index 23c144bf4..5c8e18cc7 100644 --- a/src/js/test/live-acc.js +++ b/src/js/test/live-acc.js @@ -1,4 +1,5 @@ import Config from "./config"; +import * as TestLogic from "./test-logic"; export function update(acc) { let number = Math.floor(acc); @@ -11,7 +12,7 @@ export function update(acc) { export function show() { if (!Config.showLiveAcc) return; - // if (!TestLogic.active) return; + if (!TestLogic.active) return; if (Config.timerStyle === "mini") { // $("#miniTimerAndLiveWpm .wpm").css("opacity", Config.timerOpacity); if (!$("#miniTimerAndLiveWpm .acc").hasClass("hidden")) return; diff --git a/src/js/test/live-wpm.js b/src/js/test/live-wpm.js index 2cedad0cc..b7cf8054f 100644 --- a/src/js/test/live-wpm.js +++ b/src/js/test/live-wpm.js @@ -1,4 +1,5 @@ import Config from "./config"; +import * as TestLogic from "./test-logic"; export function update(wpm, raw) { // if (!TestLogic.active || !Config.showLiveWpm) { @@ -17,9 +18,9 @@ export function update(wpm, raw) { document.querySelector("#liveWpm").innerHTML = number; } -//TODO needs to check if test is active export function show() { if (!Config.showLiveWpm) return; + if (!TestLogic.active) return; if (Config.timerStyle === "mini") { // $("#miniTimerAndLiveWpm .wpm").css("opacity", Config.timerOpacity); if (!$("#miniTimerAndLiveWpm .wpm").hasClass("hidden")) return; diff --git a/src/js/test/timer-progress.js b/src/js/test/timer-progress.js index 11b2f0872..08eed76ef 100644 --- a/src/js/test/timer-progress.js +++ b/src/js/test/timer-progress.js @@ -2,6 +2,7 @@ import Config from "./config"; import * as CustomText from "./custom-text"; import * as Misc from "./misc"; import * as TestLogic from "./test-logic"; +import * as TestTimer from "./test-timer"; export function show() { let op = Config.showTimerProgress ? Config.timerOpacity : 0; @@ -84,8 +85,8 @@ export function restart() { } } -//TODO remove the parameters once they are inside a module -export function update(time) { +export function update() { + let time = TestTimer.time; if ( Config.mode === "time" || (Config.mode === "custom" && CustomText.isTimeRandom)