From 7cf34cfb74750cc78344c8bb2817df8a80a57d74 Mon Sep 17 00:00:00 2001 From: KatieFrogs <23621460+KatieFrogs@users.noreply.github.com> Date: Tue, 22 Feb 2022 17:43:27 +0300 Subject: [PATCH] Hide plugin menu if empty --- public/src/js/plugins.js | 9 +++++++++ public/src/js/songselect.js | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/public/src/js/plugins.js b/public/src/js/plugins.js index df0f983..1267226 100644 --- a/public/src/js/plugins.js +++ b/public/src/js/plugins.js @@ -151,6 +151,15 @@ class Plugins{ return input.slice(0, index) + insertedText + input.slice(index + searchString.length) } + hasSettings(){ + for(var i = 0; i < this.allPlugins.length; i++){ + var plugin = this.allPlugins[i].plugin + if(plugin.loaded && (!plugin.hide || plugin.settings())){ + return true + } + } + return false + } getSettings(){ var items = [] for(var i = 0; i < this.allPlugins.length; i++){ diff --git a/public/src/js/songselect.js b/public/src/js/songselect.js index 4caebeb..0352884 100644 --- a/public/src/js/songselect.js +++ b/public/src/js/songselect.js @@ -161,7 +161,7 @@ class SongSelect{ category: strings.random }) } - if(plugins.allPlugins.length){ + if(plugins.hasSettings()){ this.songs.push({ title: strings.plugins.title, skin: this.songSkin.plugins,