From 8bffd349e1b22f3956b9a60ca7dd71c36bf32513 Mon Sep 17 00:00:00 2001 From: Miodec Date: Fri, 11 Feb 2022 20:34:32 +0100 Subject: [PATCH] added new function to clear funbox --- frontend/src/js/pages/test.js | 2 +- frontend/src/js/test/funbox.js | 11 +++++++++++ frontend/src/js/test/test-logic.js | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/frontend/src/js/pages/test.js b/frontend/src/js/pages/test.js index b893f2ee3..b34e54ce3 100644 --- a/frontend/src/js/pages/test.js +++ b/frontend/src/js/pages/test.js @@ -13,7 +13,7 @@ export const page = new Page( "/", async () => { TestLogic.restart(); - Funbox.activate("none"); + Funbox.clear(); TestConfig.hide(); $("#wordsInput").focusout(); }, diff --git a/frontend/src/js/test/funbox.js b/frontend/src/js/test/funbox.js index 1fa0c1e29..95682294f 100644 --- a/frontend/src/js/test/funbox.js +++ b/frontend/src/js/test/funbox.js @@ -92,6 +92,17 @@ export function setFunbox(funbox, mode) { return true; } +export async function clear() { + $("#funBoxTheme").attr("href", ``); + $("#words").removeClass("nospace"); + $("#words").removeClass("arrows"); + reset(); + $("#wordsWrapper").removeClass("hidden"); + ManualRestart.set(); + ModesNotice.update(); + return true; +} + export async function activate(funbox) { let mode = modeSaved; diff --git a/frontend/src/js/test/test-logic.js b/frontend/src/js/test/test-logic.js index 79ac3aadd..64b1954a0 100644 --- a/frontend/src/js/test/test-logic.js +++ b/frontend/src/js/test/test-logic.js @@ -456,7 +456,7 @@ export function restart( "Sorry, this funbox won't work with repeated tests.", 0 ); - await Funbox.activate("none"); + await Funbox.clear(); } else { await Funbox.activate(); }