This commit is contained in:
Mirco Wittrien 2020-03-15 11:06:38 +01:00
parent 126e9a837d
commit e5cca00ba6
3 changed files with 27 additions and 22 deletions

View File

@ -3785,26 +3785,39 @@
return BdApi.isPluginEnabled(pluginName); return BdApi.isPluginEnabled(pluginName);
}; };
BDFDB.BDUtils.enablePlugin = function (pluginName, showToast = true) { 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) { 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) { 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; return null;
}; };
BDFDB.BDUtils.isThemeEnabled = function (themeName) { BDFDB.BDUtils.isThemeEnabled = function (themeName) {
return BdApi.isThemeEnabled(themeName); return BdApi.isThemeEnabled(themeName);
}; };
BDFDB.BDUtils.enableTheme = function (themeName, showToast = true) { 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) { 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) { 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; return null;
}; };
BDFDB.BDUtils.getSettings = function (key) { BDFDB.BDUtils.getSettings = function (key) {

View File

@ -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.";} 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 () { constructor () {
this.changelog = {
"fixed":[["Fetching","Fixed an issue with some plugins while fetching"]]
};
this.patchedModules = { this.patchedModules = {
after: { after: {
V2C_ContentColumn: "render" V2C_ContentColumn: "render"
@ -362,10 +358,10 @@ var PluginRepo = (_ => {
label: sortKeys[options.sortKey], label: sortKeys[options.sortKey],
value: 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], label: sortKeys[key],
value: key value: key
};}), })),
onChange: (key, instance) => { onChange: (key, instance) => {
options.sortKey = key; options.sortKey = key;
this.updateList(instance, options); this.updateList(instance, options);
@ -379,10 +375,10 @@ var PluginRepo = (_ => {
label: orderKeys[options.orderKey], label: orderKeys[options.orderKey],
value: options.orderKey value: options.orderKey
}, },
options: Object.keys(orderKeys).map(key => {return { options: Object.keys(orderKeys).map(key => ({
label: orderKeys[key], label: orderKeys[key],
value: key value: key
};}), })),
onChange: (key, instance) => { onChange: (key, instance) => {
options.orderKey = key; options.orderKey = key;
this.updateList(instance, options); this.updateList(instance, options);

View File

@ -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.";} 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 () { constructor () {
this.changelog = {
"improved":[["New Library Structure & React","Restructured my Library and switched to React rendering instead of DOM manipulation"]]
};
this.patchedModules = { this.patchedModules = {
after: { after: {
V2C_ContentColumn: "render" V2C_ContentColumn: "render"
@ -433,10 +429,10 @@ var ThemeRepo = (_ => {
label: sortKeys[options.sortKey], label: sortKeys[options.sortKey],
value: 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], label: sortKeys[key],
value: key value: key
};}), })),
onChange: (key, instance) => { onChange: (key, instance) => {
options.sortKey = key; options.sortKey = key;
this.updateList(instance, options); this.updateList(instance, options);
@ -450,10 +446,10 @@ var ThemeRepo = (_ => {
label: orderKeys[options.orderKey], label: orderKeys[options.orderKey],
value: options.orderKey value: options.orderKey
}, },
options: Object.keys(orderKeys).map(key => {return { options: Object.keys(orderKeys).map(key => ({
label: orderKeys[key], label: orderKeys[key],
value: key value: key
};}), })),
onChange: (key, instance) => { onChange: (key, instance) => {
options.orderKey = key; options.orderKey = key;
this.updateList(instance, options); this.updateList(instance, options);