diff --git a/src/js/settings.js b/src/js/settings.js index 270b9049c..82393af38 100644 --- a/src/js/settings.js +++ b/src/js/settings.js @@ -420,7 +420,7 @@ export function updateDiscordSection() { function setActiveFunboxButton() { $(`.pageSettings .section.funbox .button`).removeClass("active"); $( - `.pageSettings .section.funbox .button[funbox='${Funbox.active}']` + `.pageSettings .section.funbox .button[funbox='${Funbox.funboxSaved}']` ).addClass("active"); } diff --git a/src/js/test/funbox.js b/src/js/test/funbox.js index a173e1ea1..cf6b6bf47 100644 --- a/src/js/test/funbox.js +++ b/src/js/test/funbox.js @@ -7,10 +7,10 @@ import Config, * as UpdateConfig from "./config"; import * as Settings from "./settings"; export let active = "none"; +export let funboxSaved = "none"; +export let modeSaved = null; let memoryTimer = null; let memoryInterval = null; -let currentFunbox = "none"; -let currentMode = null; function showMemoryTimer() { $("#typingTest #memoryTimer").stop(true, true).animate( @@ -74,8 +74,8 @@ export function toggleScript(...params) { export async function activate(funbox, mode) { if (funbox === undefined) { - funbox = currentFunbox; - mode = currentMode; + funbox = funboxSaved; + mode = modeSaved; } if (Misc.getCurrentLanguage().ligatures) { if (funbox == "choo_choo" || funbox == "earthquake") { @@ -152,16 +152,17 @@ export async function activate(funbox, mode) { active = funbox; } - TestUI.updateModesNotice(); - return true; -} -export function setFunbox(funbox, mode) { - currentFunbox = funbox; - currentMode = mode; if (funbox !== "layoutfluid" || mode !== "script") { if (Config.layout !== Config.savedLayout) { UpdateConfig.setLayout(Config.savedLayout); Settings.groups.layout.updateButton(); } } + TestUI.updateModesNotice(); + return true; +} +export function setFunbox(funbox, mode) { + funboxSaved = funbox; + modeSaved = mode; + active = funbox; }