refractored funbox vars

This commit is contained in:
Saint-dev 2021-04-05 13:38:19 -04:00
parent 1d3512c79d
commit a2b7aa281c
2 changed files with 12 additions and 11 deletions

View file

@ -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");
}

View file

@ -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;
}