mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2024-11-11 09:34:35 +08:00
Merge pull request #602 from decafff/master
Fix "Bail Out" subcommands not hiding in single command mode
This commit is contained in:
commit
00beebdd1e
2 changed files with 21 additions and 11 deletions
|
@ -575,6 +575,9 @@ let commands = {
|
|||
exec: () => {
|
||||
hideCommandLine();
|
||||
},
|
||||
available: () => {
|
||||
return canBailOut();
|
||||
},
|
||||
},
|
||||
{
|
||||
id: "bailOutForSure",
|
||||
|
@ -583,23 +586,16 @@ let commands = {
|
|||
bailout = true;
|
||||
showResult();
|
||||
},
|
||||
available: () => {
|
||||
return canBailOut();
|
||||
},
|
||||
},
|
||||
],
|
||||
});
|
||||
showCommandLine();
|
||||
},
|
||||
available: () => {
|
||||
return (
|
||||
(config.mode === "custom" &&
|
||||
customTextIsRandom &&
|
||||
customTextWordCount >= 5000) ||
|
||||
(config.mode === "custom" &&
|
||||
!customTextIsRandom &&
|
||||
customText.length >= 5000) ||
|
||||
(config.mode === "words" && config.words >= 5000) ||
|
||||
config.words === 0 ||
|
||||
(config.mode === "time" && (config.time >= 3600 || config.time === 0))
|
||||
);
|
||||
return canBailOut();
|
||||
},
|
||||
},
|
||||
{
|
||||
|
|
|
@ -511,6 +511,20 @@ function toggleFullscreen(elem) {
|
|||
}
|
||||
}
|
||||
|
||||
function canBailOut() {
|
||||
return (
|
||||
(config.mode === "custom" &&
|
||||
customTextIsRandom &&
|
||||
customTextWordCount >= 5000) ||
|
||||
(config.mode === "custom" &&
|
||||
!customTextIsRandom &&
|
||||
customText.length >= 5000) ||
|
||||
(config.mode === "words" && config.words >= 5000) ||
|
||||
config.words === 0 ||
|
||||
(config.mode === "time" && (config.time >= 3600 || config.time === 0))
|
||||
);
|
||||
}
|
||||
|
||||
let simplePopups = {};
|
||||
|
||||
class SimplePopup {
|
||||
|
|
Loading…
Reference in a new issue