Merge pull request #602 from decafff/master

Fix "Bail Out" subcommands not hiding in single command mode
This commit is contained in:
Jack 2020-11-19 15:26:29 +00:00 committed by GitHub
commit 00beebdd1e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 11 deletions

View file

@ -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();
},
},
{

View file

@ -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 {