From b23ce833e2cd94cd85528243428625c45e4cb69a Mon Sep 17 00:00:00 2001 From: willerbee Date: Sun, 11 Oct 2020 23:50:14 +0800 Subject: [PATCH] Added more functions to use the feature --- public/js/commandline.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/public/js/commandline.js b/public/js/commandline.js index 783bbe1a5..d6c1225c8 100644 --- a/public/js/commandline.js +++ b/public/js/commandline.js @@ -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: [