diff --git a/src/js/commandline.js b/src/js/commandline.js index 4059e6b2f..47d8ef888 100644 --- a/src/js/commandline.js +++ b/src/js/commandline.js @@ -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(); }, }, { diff --git a/src/js/misc.js b/src/js/misc.js index 31481088d..bfd61d010 100644 --- a/src/js/misc.js +++ b/src/js/misc.js @@ -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 {