This commit is contained in:
Mirco Wittrien 2020-03-15 10:21:23 +01:00
parent e8b9c82cde
commit 126e9a837d
5 changed files with 17 additions and 18 deletions

View File

@ -1089,8 +1089,8 @@
WebModulesData.SpecialFilter = { WebModulesData.SpecialFilter = {
V2C_ContentColumn: ins => ins && ins.return && (ins.return.key == "pcolumn" || ins.return.key == "tcolumn") && ins.return.type, V2C_ContentColumn: ins => ins && ins.return && (ins.return.key == "pcolumn" || ins.return.key == "tcolumn") && ins.return.type,
V2C_List: ins => ins && ins.return && (ins.return.key == "plugin-list" || ins.return.key == "theme-list") && ins.return.type, V2C_List: ins => ins && ins.return && (ins.return.key == "plugin-list" || ins.return.key == "theme-list") && ins.return.type,
V2C_PluginCard: ins && ins.child && ins.child.stateNode && ins.child.stateNode.props && ins.child.stateNode.props.plugin && ins.child.type, V2C_PluginCard: ins => ins && ins.child && ins.child.stateNode && ins.child.stateNode.props && ins.child.stateNode.props.plugin && ins.child.type,
V2C_ThemeCard: ins && ins.child && ins.child.stateNode && ins.child.stateNode.props && ins.child.stateNode.props.theme && ins.child.type V2C_ThemeCard: ins => ins && ins.child && ins.child.stateNode && ins.child.stateNode.props && ins.child.stateNode.props.theme && ins.child.type
}; };
WebModulesData.PatchFinder = { WebModulesData.PatchFinder = {
Account: "accountinfo", Account: "accountinfo",

File diff suppressed because one or more lines are too long

View File

@ -883,7 +883,7 @@ var PluginRepo = (_ => {
startPlugin (data) { startPlugin (data) {
if (BDFDB.BDUtils.isPluginEnabled(data.name) == false) { if (BDFDB.BDUtils.isPluginEnabled(data.name) == false) {
window.pluginModule.startPlugin(data.name); BDFDB.BDUtils.enablePlugin(data.name, false);
BDFDB.LogUtils.log(`Started Plugin ${data.name}.`, this.name); BDFDB.LogUtils.log(`Started Plugin ${data.name}.`, this.name);
} }
} }
@ -898,7 +898,7 @@ var PluginRepo = (_ => {
stopPlugin (data) { stopPlugin (data) {
if (BDFDB.BDUtils.isPluginEnabled(data.name) == true) { if (BDFDB.BDUtils.isPluginEnabled(data.name) == true) {
window.pluginModule.stopPlugin(data.name); BDFDB.BDUtils.disablePlugin(data.name, false);
BDFDB.LogUtils.log(`Stopped Plugin ${data.name}.`, this.name); BDFDB.LogUtils.log(`Stopped Plugin ${data.name}.`, this.name);
} }
} }

View File

@ -1,20 +1,18 @@
//META{"name":"RepoControls","authorId":"278543574059057154","invite":"Jx3TjNS","donate":"https://www.paypal.me/MircoWittrien","patreon":"https://www.patreon.com/MircoWittrien","website":"https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/RepoControls","source":"https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/Plugins/RepoControls/RepoControls.plugin.js"}*// //META{"name":"RepoControls","authorId":"278543574059057154","invite":"Jx3TjNS","donate":"https://www.paypal.me/MircoWittrien","patreon":"https://www.patreon.com/MircoWittrien","website":"https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/RepoControls","source":"https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/Plugins/RepoControls/RepoControls.plugin.js"}*//
var RepoControls = (_ => { var RepoControls = (_ => {
let searchTimeout;
return class RepoControls { return class RepoControls {
getName () {return "RepoControls";} getName () {return "RepoControls";}
getVersion () {return "1.3.5";} getVersion () {return "1.3.6";}
getAuthor () {return "DevilBro";} getAuthor () {return "DevilBro";}
getDescription () {return "Lets you sort and filter your list of downloaded Themes and Plugins.";} getDescription () {return "Lets you sort and filter your list of downloaded Themes and Plugins.";}
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_List: "render", V2C_List: "render",
@ -124,7 +122,7 @@ var RepoControls = (_ => {
// begin of own functions // begin of own functions
processV2CContentColumn (e) { processV2CContentColumn (e) {
let [children, index] = BDFDB.ReactUtils.findChildren(e.returnvalue, {name: "V2C_List"}); let [children, index] = BDFDB.ReactUtils.findChildren(e.returnvalue, {key: ["plugin-list", "theme-list"]});
if (index > -1) { if (index > -1) {
let list = children[index]; let list = children[index];
this.injectControls(e.instance, list, children, index, children[index].key.split("-")[0]); this.injectControls(e.instance, list, children, index, children[index].key.split("-")[0]);
@ -180,7 +178,6 @@ var RepoControls = (_ => {
injectControls (instance, parent, children, index, type) { injectControls (instance, parent, children, index, type) {
let sortings = BDFDB.DataUtils.get(this, "sortings"); let sortings = BDFDB.DataUtils.get(this, "sortings");
this.searchTimeout;
children.splice(index, 0, BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Flex, { children.splice(index, 0, BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Flex, {
className: BDFDB.disCN.marginbottom8, className: BDFDB.disCN.marginbottom8,
justify: BDFDB.LibraryComponents.Flex.Justify.BETWEEN, justify: BDFDB.LibraryComponents.Flex.Justify.BETWEEN,
@ -188,8 +185,8 @@ var RepoControls = (_ => {
children: [ children: [
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SearchBar, { BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SearchBar, {
onChange: value => { onChange: value => {
BDFDB.TimeUtils.clear(this.searchTimeout); BDFDB.TimeUtils.clear(searchTimeout);
this.searchTimeout = BDFDB.TimeUtils.timeout(_ => { searchTimeout = BDFDB.TimeUtils.timeout(_ => {
this.sortEntries(instance, parent, value); this.sortEntries(instance, parent, value);
}, 1000); }, 1000);
}, },
@ -258,7 +255,8 @@ var RepoControls = (_ => {
}); });
entry.props.RCdata.type = "plugin"; entry.props.RCdata.type = "plugin";
entry.props.RCdata.enabled = BDFDB.BDUtils.isPluginEnabled(entry.key) ? 1 : 2; entry.props.RCdata.enabled = BDFDB.BDUtils.isPluginEnabled(entry.key) ? 1 : 2;
entry.props.RCdata.path = window.bdplugins && window.bdplugins[entry.key] && typeof window.bdplugins[entry.key].filename == "string" && BDFDB.LibraryRequires.path.join(BDFDB.BDUtils.getPluginsFolder(), window.bdplugins[entry.key].filename); let loadedPlugin = BDFDB.BDUtils.getPlugin(entry.key, false, true);
entry.props.RCdata.path = loadedPlugin && typeof loadedPlugin.filename == "string" && BDFDB.LibraryRequires.path.join(BDFDB.BDUtils.getPluginsFolder(), loadedPlugin.filename);
} }
else if (entry.props.theme) { else if (entry.props.theme) {
["name", "author", "version", "description"].forEach(key => { ["name", "author", "version", "description"].forEach(key => {
@ -267,7 +265,8 @@ var RepoControls = (_ => {
}); });
entry.props.RCdata.type = "theme"; entry.props.RCdata.type = "theme";
entry.props.RCdata.enabled = BDFDB.BDUtils.isThemeEnabled(entry.key) ? 1 : 2; entry.props.RCdata.enabled = BDFDB.BDUtils.isThemeEnabled(entry.key) ? 1 : 2;
entry.props.RCdata.path = window.bdthemes && window.bdthemes[entry.key] && typeof window.bdthemes[entry.key].filename == "string" && BDFDB.LibraryRequires.path.join(BDFDB.BDUtils.getThemesFolder(), window.bdthemes[entry.key].filename); let loadedTheme = BDFDB.BDUtils.getTheme(entry.key, false);
entry.props.RCdata.path = loadedTheme && typeof loadedTheme.filename == "string" && BDFDB.LibraryRequires.path.join(BDFDB.BDUtils.getThemesFolder(), loadedTheme.filename);
} }
let stats = entry.props.RCdata.path && BDFDB.LibraryRequires.fs.statSync(entry.props.RCdata.path); let stats = entry.props.RCdata.path && BDFDB.LibraryRequires.fs.statSync(entry.props.RCdata.path);
entry.props.RCdata.adddate = stats && stats.atime.getTime(); entry.props.RCdata.adddate = stats && stats.atime.getTime();

View File

@ -1081,7 +1081,7 @@ var ThemeRepo = (_ => {
if (BDFDB.BDUtils.isThemeEnabled(data.name) == false) { if (BDFDB.BDUtils.isThemeEnabled(data.name) == false) {
BDFDB.DOMUtils.remove(`style#${data.name}`); BDFDB.DOMUtils.remove(`style#${data.name}`);
document.head.appendChild(BDFDB.DOMUtils.create(`<style id=${data.name}>${data.css}</style>`)); document.head.appendChild(BDFDB.DOMUtils.create(`<style id=${data.name}>${data.css}</style>`));
window.themeModule.enableTheme(data.name); BDFDB.BDUtils.enableTheme(data.name, false);
BDFDB.LogUtils.log(`Applied Theme ${data.name}.`, this.name); BDFDB.LogUtils.log(`Applied Theme ${data.name}.`, this.name);
} }
} }
@ -1097,7 +1097,7 @@ var ThemeRepo = (_ => {
removeTheme (data) { removeTheme (data) {
if (BDFDB.BDUtils.isThemeEnabled(data.name) == true) { if (BDFDB.BDUtils.isThemeEnabled(data.name) == true) {
BDFDB.DOMUtils.remove(`style#${data.name}`); BDFDB.DOMUtils.remove(`style#${data.name}`);
window.themeModule.disableTheme(data.name); BDFDB.BDUtils.disableTheme(data.name, false);
BDFDB.LogUtils.log(`Removed Theme ${data.name}.`, this.name); BDFDB.LogUtils.log(`Removed Theme ${data.name}.`, this.name);
} }
} }