From e5cca00ba695566118eeebfc18dc2cad691e24bd Mon Sep 17 00:00:00 2001 From: Mirco Wittrien Date: Sun, 15 Mar 2020 11:06:38 +0100 Subject: [PATCH] stuff --- Plugins/BDFDB.js | 25 +++++++++++++++++++------ Plugins/PluginRepo/PluginRepo.plugin.js | 12 ++++-------- Plugins/ThemeRepo/ThemeRepo.plugin.js | 12 ++++-------- 3 files changed, 27 insertions(+), 22 deletions(-) diff --git a/Plugins/BDFDB.js b/Plugins/BDFDB.js index fec96a94ed..e5206fee00 100644 --- a/Plugins/BDFDB.js +++ b/Plugins/BDFDB.js @@ -3785,26 +3785,39 @@ return BdApi.isPluginEnabled(pluginName); }; BDFDB.BDUtils.enablePlugin = function (pluginName, showToast = true) { - BdApi.Plugins && BdApi.Plugins.manager.enable(pluginName, !showToast) || window.pluginModule && window.pluginModule.startPlugin(pluginName); + if (BdApi.Plugins) BdApi.Plugins.manager.enable(pluginName, !showToast); + else if (window.pluginModule) window.pluginModule.startPlugin(pluginName); }; BDFDB.BDUtils.disablePlugin = function (pluginName, showToast = true) { - BdApi.Plugins && BdApi.Plugins.manager.disable(pluginName, !showToast) || window.pluginModule && window.pluginModule.stopPlugin(pluginName); + if (BdApi.Plugins) BdApi.Plugins.manager.disable(pluginName, !showToast); + else if (window.pluginModule) window.pluginModule.stopPlugin(pluginName); }; BDFDB.BDUtils.getPlugin = function (pluginName, hasToBeEnabled = false, overHeader = false) { - if (!hasToBeEnabled || BDFDB.BDUtils.isPluginEnabled(pluginName)) return !overHeader ? BdApi.getPlugin(pluginName) : (BdApi.Plugins && BdApi.Plugins.list && BdApi.Plugins.list[pluginName] || window.bdplugins && window.bdplugins[pluginName]); + if (!hasToBeEnabled || BDFDB.BDUtils.isPluginEnabled(pluginName)) { + if (overHeader) { + if (BdApi.Plugins && BdApi.Plugins.list) return BdApi.Plugins.list[pluginName]; + else if (window.bdplugins) window.bdplugins[pluginName]; + } + else return BdApi.getPlugin(pluginName); + } return null; }; BDFDB.BDUtils.isThemeEnabled = function (themeName) { return BdApi.isThemeEnabled(themeName); }; BDFDB.BDUtils.enableTheme = function (themeName, showToast = true) { - BdApi.Themes && BdApi.Themes.manager.enable(themeName, !showToast) || window.themeModule && window.themeModule.enableTheme(themeName); + if (BdApi.Themes) BdApi.Themes.manager.enable(themeName, !showToast); + else if (window.themeModule) window.themeModule.enableTheme(themeName); }; BDFDB.BDUtils.disableTheme = function (themeName, showToast = true) { - BdApi.Themes && BdApi.Themes.manager.disable(themeName, !showToast) || window.themeModule && window.themeModule.disableTheme(themeName); + if (BdApi.Themes) BdApi.Themes.manager.disable(themeName, !showToast); + else if (window.themeModule) window.themeModule.disableTheme(themeName); }; BDFDB.BDUtils.getTheme = function (themeName, hasToBeEnabled = false) { - if (!hasToBeEnabled || BDFDB.BDUtils.isThemeEnabled(pluginName)) return BdApi.Themes && BdApi.Themes.list && BdApi.Themes.list[themeName] || window.bdthemes && window.bdthemes[themeName]; + if (!hasToBeEnabled || BDFDB.BDUtils.isThemeEnabled(themeName)) { + if (BdApi.Themes && BdApi.Themes.list) return BdApi.Themes.list[themeName]; + else if (window.bdthemes) window.bdthemes[themeName]; + } return null; }; BDFDB.BDUtils.getSettings = function (key) { diff --git a/Plugins/PluginRepo/PluginRepo.plugin.js b/Plugins/PluginRepo/PluginRepo.plugin.js index fee5fd6785..7d2b4340c8 100644 --- a/Plugins/PluginRepo/PluginRepo.plugin.js +++ b/Plugins/PluginRepo/PluginRepo.plugin.js @@ -76,10 +76,6 @@ var PluginRepo = (_ => { getDescription () {return "Allows you to look at all plugins from the plugin repo and download them on the fly. Repo button is in the plugins settings.";} constructor () { - this.changelog = { - "fixed":[["Fetching","Fixed an issue with some plugins while fetching"]] - }; - this.patchedModules = { after: { V2C_ContentColumn: "render" @@ -362,10 +358,10 @@ var PluginRepo = (_ => { label: sortKeys[options.sortKey], value: options.sortKey }, - options: Object.keys(sortKeys).map(key => {return { + options: Object.keys(sortKeys).filter(n => n != "NEW" || Object.keys(loadedPlugins).some(p => !cachedPlugins.includes[p])).map(key => ({ label: sortKeys[key], value: key - };}), + })), onChange: (key, instance) => { options.sortKey = key; this.updateList(instance, options); @@ -379,10 +375,10 @@ var PluginRepo = (_ => { label: orderKeys[options.orderKey], value: options.orderKey }, - options: Object.keys(orderKeys).map(key => {return { + options: Object.keys(orderKeys).map(key => ({ label: orderKeys[key], value: key - };}), + })), onChange: (key, instance) => { options.orderKey = key; this.updateList(instance, options); diff --git a/Plugins/ThemeRepo/ThemeRepo.plugin.js b/Plugins/ThemeRepo/ThemeRepo.plugin.js index 383cf4a8af..8f229adc38 100644 --- a/Plugins/ThemeRepo/ThemeRepo.plugin.js +++ b/Plugins/ThemeRepo/ThemeRepo.plugin.js @@ -132,10 +132,6 @@ var ThemeRepo = (_ => { getDescription () {return "Allows you to preview all themes from the theme repo and download them on the fly. Repo button is in the theme settings.";} constructor () { - this.changelog = { - "improved":[["New Library Structure & React","Restructured my Library and switched to React rendering instead of DOM manipulation"]] - }; - this.patchedModules = { after: { V2C_ContentColumn: "render" @@ -433,10 +429,10 @@ var ThemeRepo = (_ => { label: sortKeys[options.sortKey], value: options.sortKey }, - options: Object.keys(sortKeys).map(key => {return { + options: Object.keys(sortKeys).filter(n => n != "NEW" || Object.keys(loadedThemes).some(t => !cachedThemes.includes[t])).map(key => ({ label: sortKeys[key], value: key - };}), + })), onChange: (key, instance) => { options.sortKey = key; this.updateList(instance, options); @@ -450,10 +446,10 @@ var ThemeRepo = (_ => { label: orderKeys[options.orderKey], value: options.orderKey }, - options: Object.keys(orderKeys).map(key => {return { + options: Object.keys(orderKeys).map(key => ({ label: orderKeys[key], value: key - };}), + })), onChange: (key, instance) => { options.orderKey = key; this.updateList(instance, options);