removed duplicate code, fixed applying none funbox

This commit is contained in:
Miodec 2021-01-18 19:37:52 +00:00
parent 8cf356ee29
commit 54446332d6

View file

@ -339,7 +339,7 @@ async function activateFunbox(funbox, mode, mp = false) {
$("#wordsWrapper").removeClass("hidden");
// }
if (mode === null || mode === undefined) {
if ((mode === null || mode === undefined) && funbox !== "none") {
let list = await Misc.getFunboxList();
mode = list.filter((f) => f.name === funbox)[0].type;
}
@ -4946,6 +4946,8 @@ $(document).keyup(() => {
});
$(document).keydown(function (event) {
if (MP.state >= 10 && MP.state <= 20) return;
if (!resultVisible) {
let now = performance.now();
let diff = Math.abs(keypressStats.spacing.current - now);
@ -5009,24 +5011,6 @@ $(document).keydown(function (event) {
}
} catch {}
//autofocus
let pageTestActive = !$(".pageTest").hasClass("hidden");
let commandLineVisible = !$("#commandLineWrapper").hasClass("hidden");
let wordsFocused = $("#wordsInput").is(":focus");
let modePopupVisible =
!$("#customTextPopupWrapper").hasClass("hidden") ||
!$("#customMode2PopupWrapper").hasClass("hidden");
if (pageTestActive && !commandLineVisible && !modePopupVisible) {
if (!wordsFocused && event.key !== "Enter") {
focusWords();
if (config.showOutOfFocusWarning) return;
}
} else {
return;
}
if (MP.state >= 10 && MP.state <= 20) return;
//backspace
const isBackspace =
event.key === "Backspace" ||