From 63f9b3245895d24e24a35f2811a2839525fb16b4 Mon Sep 17 00:00:00 2001 From: Jack Date: Sat, 1 Aug 2020 14:44:59 +0100 Subject: [PATCH] added fonts to the command line --- public/js/commandline.js | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/public/js/commandline.js b/public/js/commandline.js index 24d3e9186..b4b751028 100644 --- a/public/js/commandline.js +++ b/public/js/commandline.js @@ -259,6 +259,15 @@ let commands = { showCommandLine(); }, }, + { + id: "changeFontFamily", + display: "Change font family...", + subgroup: true, + exec: () => { + currentCommands.push(commandsFonts); + showCommandLine(); + }, + }, { id: "joinDiscord", display: "Join the Discord server", @@ -706,6 +715,11 @@ $.getJSON("funbox/list.json", function (data) { }); }); +let commandsFonts = { + title: "Change font...", + list: [], +}; + let fontsList; $.getJSON("js/fonts.json", function (data) { @@ -715,16 +729,20 @@ $.getJSON("js/fonts.json", function (data) { if (nameA > nameB) return 1; return 0; }); + data.forEach((font) => { + commandsFonts.list.push({ + id: "changeFont" + font.name.replace(/ /g, "_"), + display: font.name, + exec: () => { + setFontFamily(font.name); + }, + }); + }); }); let commandsThemes = { title: "Change theme...", - list: [ - { - id: "couldnotload", - display: "Could not load the themes list :(", - }, - ], + list: [], }; let commandsLanguages = {