Added more functions to use the feature

This commit is contained in:
willerbee 2020-10-11 23:50:14 +08:00 committed by GitHub
parent 68734ebe8a
commit b23ce833e2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -31,6 +31,28 @@ function generateSingleListOfCommands() {
list: allCommands};
}
function isSingleListCommandLineActive() {
return $("#commandLine").hasClass("allCommands");
}
function useSingleListCommandLine(show = true) {
let allCommands = generateSingleListOfCommands();
if (config.singleListCommandLine == "manual") currentCommands.push(allCommands);
else if (config.singleListCommandLine == "on") currentCommands = [allCommands];
if (config.singleListCommandLine != "off") $("#commandLine").addClass("allCommands");
if (show) showCommandLine();
}
function restoreOldCommandLine(show = true) {
if (isSingleListCommandLineActive()) {
$("#commandLine").removeClass("allCommands");
currentCommands = currentCommands.filter( l => l.title != "All Commands");
if (currentCommands.length < 1) currentCommands = [commands];
}
if (show) showCommandLine();
}
let commands = {
title: "",
list: [