This commit is contained in:
Mirco Wittrien 2020-03-15 09:35:55 +01:00
parent 9e95d83dc2
commit 1bfd590403
2 changed files with 16 additions and 3 deletions

View File

@ -3778,14 +3778,27 @@
if (!pluginName) return false;
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);
};
BDFDB.BDUtils.disablePlugin = function (pluginName, showToast = true) {
BdApi.Plugins && BdApi.Plugins.manager.disable(pluginName, !showToast) || window.pluginModule && window.pluginModule.stopPlugin(pluginName);
};
BDFDB.BDUtils.getPlugin = function (pluginName, hasToBeEnabled = false, overHeader = false) {
if (BdApi.Plugins && BdApi.Plugins.list && (!hasToBeEnabled || BDFDB.BDUtils.isPluginEnabled(pluginName))) return !overHeader ? BdApi.getPlugin(pluginName) : BdApi.Plugins.list[pluginName];
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]);
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);
};
BDFDB.BDUtils.disableTheme = function (themeName, showToast = true) {
BdApi.Themes && BdApi.Themes.manager.disable(themeName, !showToast) || window.themeModule && window.themeModule.disableTheme(themeName);
};
BDFDB.BDUtils.getTheme = function (themeName, hasToBeEnabled = false) {
if (BdApi.Themes && BdApi.Themes.list && (!hasToBeEnabled || BDFDB.BDUtils.isThemeEnabled(themeName))) return BdApi.Themes.list[themeName];
if (!hasToBeEnabled || BDFDB.BDUtils.isThemeEnabled(pluginName)) return BdApi.Themes && BdApi.Themes.list && BdApi.Themes.list[themeName] || window.bdthemes && window.bdthemes[themeName];
return null;
};
BDFDB.BDUtils.getSettings = function (key) {

File diff suppressed because one or more lines are too long