added funbox to the command line

This commit is contained in:
Jack 2020-08-11 20:33:09 +01:00
parent df07f2b497
commit adb4633335
2 changed files with 46 additions and 0 deletions

View file

@ -237,6 +237,15 @@ let commands = {
showCommandLine();
},
},
{
id: "changeFunbox",
display: "Change funbox...",
subgroup: true,
exec: () => {
currentCommands.push(commandsFunbox);
showCommandLine();
},
},
{
id: "changeLayout",
display: "Change layout...",
@ -726,6 +735,35 @@ getFontsList().then((fonts) => {
});
});
let commandsFunbox = {
title: "Change funbox...",
list: [
{
id: "changeFunboxNone",
display: "none",
exec: () => {
if (activateFunbox("none", null)) {
restartTest();
}
},
},
],
};
getFunboxList().then((funboxes) => {
funboxes.forEach((funbox) => {
commandsFunbox.list.push({
id: "changeFunbox" + funbox.name,
display: funbox.name.replace(/_/g, " "),
exec: () => {
if (activateFunbox(funbox.name, funbox.type)) {
restartTest();
}
},
});
});
});
let commandsThemes = {
title: "Change theme...",
list: [],

View file

@ -145,6 +145,13 @@ function copyResultToClipboard() {
}
function activateFunbox(funbox, mode) {
if (testActive || resultVisible) {
showNotification(
"You can only change the funbox before starting a test.",
4000
);
return false;
}
$("#funBoxTheme").attr("href", ``);
if (funbox === "none") {
activeFunBox = "none";
@ -178,6 +185,7 @@ function activateFunbox(funbox, mode) {
activeFunBox = funbox;
}
updateTestModesNotice();
return true;
}
function toggleScriptFunbox(...params) {