mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-10-23 05:56:10 +08:00
added funbox to the command line
This commit is contained in:
parent
df07f2b497
commit
adb4633335
2 changed files with 46 additions and 0 deletions
|
@ -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: [],
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Add table
Reference in a new issue