diff options
4 files changed, 98 insertions, 55 deletions
diff --git a/.config/BetterDiscord/plugins/EditChannels.config.json b/.config/BetterDiscord/plugins/EditChannels.config.json index d8b6132..9ae19ab 100644 --- a/.config/BetterDiscord/plugins/EditChannels.config.json +++ b/.config/BetterDiscord/plugins/EditChannels.config.json @@ -1,6 +1,6 @@ { "changeLog": { - "version": "4.1.7" + "version": "4.1.8" }, "changelog": { "currentversion": "4.1.5" diff --git a/.config/BetterDiscord/plugins/EditChannels.plugin.js b/.config/BetterDiscord/plugins/EditChannels.plugin.js index a3a4dce..2f7a518 100644 --- a/.config/BetterDiscord/plugins/EditChannels.plugin.js +++ b/.config/BetterDiscord/plugins/EditChannels.plugin.js @@ -1,26 +1,34 @@ -//META{"name":"EditChannels","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/EditChannels","source":"https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/Plugins/EditChannels/EditChannels.plugin.js"}*// +/** + * @name EditChannels + * @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/EditChannels + * @source https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/Plugins/EditChannels/EditChannels.plugin.js + */ module.exports = (_ => { - const config = { + const config = { "info": { "name": "EditChannels", "author": "DevilBro", - "version": "4.1.7", - "description": "Allows you to rename and recolor channelnames." + "version": "4.1.8", + "description": "Allow you to rename and recolor channelnames" }, "changeLog": { "fixed": { - "Autocomplete Menu": "Works again" + "Works again": "Yas" } } }; - return !window.BDFDB_Global || (!window.BDFDB_Global.loaded && !window.BDFDB_Global.started) ? class { + return !window.BDFDB_Global || (!window.BDFDB_Global.loaded && !window.BDFDB_Global.started) ? class { getName () {return config.info.name;} getAuthor () {return config.info.author;} getVersion () {return config.info.version;} getDescription () {return config.info.description;} - load() { + load() { if (!window.BDFDB_Global || !Array.isArray(window.BDFDB_Global.pluginQueue)) window.BDFDB_Global = Object.assign({}, window.BDFDB_Global, {pluginQueue:[]}); if (!window.BDFDB_Global.downloadModal) { window.BDFDB_Global.downloadModal = true; @@ -31,20 +39,20 @@ module.exports = (_ => { onConfirm: _ => { delete window.BDFDB_Global.downloadModal; require("request").get("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js", (e, r, b) => { - if (!e && b && b.indexOf(`//META{"name":"`) > -1) require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => {}); + if (!e && b && b.indexOf(`* @name BDFDB`) > -1) require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => {}); else BdApi.alert("Error", "Could not download BDFDB library plugin, try again some time later."); }); } }); } if (!window.BDFDB_Global.pluginQueue.includes(config.info.name)) window.BDFDB_Global.pluginQueue.push(config.info.name); - } - start() {} - stop() {} - } : (([Plugin, BDFDB]) => { + } + start() {this.load();} + stop() {} + } : (([Plugin, BDFDB]) => { var changedChannels = {}, settings = {}; - return class EditChannels extends Plugin { + return class EditChannels extends Plugin { onLoad() { this.defaults = { settings: { @@ -69,8 +77,8 @@ module.exports = (_ => { AuditLog: "render", SettingsInvites: "render", HeaderBarContainer: "render", - ChannelCategoryItem: "render", - ChannelItem: "render", + ChannelCategoryItem: "default", + ChannelItem: "default", QuickSwitchChannelResult: "render", MessageContent: "type" }, @@ -78,8 +86,8 @@ module.exports = (_ => { AutocompleteChannelResult: "render", AuditLog: "render", HeaderBarContainer: "render", - ChannelCategoryItem: "render", - ChannelItem: "render", + ChannelCategoryItem: "default", + ChannelItem: "default", QuickSwitchChannelResult: "render", RecentsChannelHeader: "default" } @@ -126,7 +134,6 @@ module.exports = (_ => { let settingsPanel, settingsItems = []; for (let key in settings) if (!this.defaults.settings[key].inner) settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, { - className: BDFDB.disCN.marginbottom8, type: "Switch", plugin: this, keys: ["settings", key], @@ -137,7 +144,6 @@ module.exports = (_ => { title: "Change Channels in:", first: settingsItems.length == 0, children: Object.keys(settings).map(key => this.defaults.settings[key].inner && BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, { - className: BDFDB.disCN.marginbottom8, type: "Switch", plugin: this, keys: ["settings", key], @@ -147,7 +153,6 @@ module.exports = (_ => { })); settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsItem, { type: "Button", - className: BDFDB.disCN.marginbottom8, color: BDFDB.LibraryComponents.Button.Colors.RED, label: "Reset all Channels", onClick: _ => { @@ -169,12 +174,13 @@ module.exports = (_ => { } } - forceUpdateAll () { + forceUpdateAll (instant = false) { changedChannels = BDFDB.DataUtils.load(this, "channels"); settings = BDFDB.DataUtils.get(this, "settings"); this.changeAppTitle(); BDFDB.PatchUtils.forceAllUpdates(this); + BDFDB.ChannelUtils.rerenderAll(instant); BDFDB.ReactUtils.forceUpdate(BDFDB.ReactUtils.findOwner(document.querySelector(BDFDB.dotCN.app), {name:"Channel", unlimited:true})); } @@ -200,7 +206,7 @@ module.exports = (_ => { disabled: !changedChannels[e.instance.props.channel.id], action: _ => { BDFDB.DataUtils.remove(this, "channels", e.instance.props.channel.id); - this.forceUpdateAll(); + this.forceUpdateAll(true); } }) ] @@ -285,9 +291,15 @@ module.exports = (_ => { if (!e.returnvalue) e.instance.props.channel = this.getChannelData(e.instance.props.channel.id); else { let onMouseEnter = e.returnvalue.props.onMouseEnter || ( _ => {}); - e.returnvalue.props.onMouseEnter = event => {e.instance.setState({hovered: true});}; + e.returnvalue.props.onMouseEnter = event => { + onMouseEnter(event); + e.instance.setState({hovered: true}); + }; let onMouseLeave = e.returnvalue.props.onMouseLeave || ( _ => {}); - e.returnvalue.props.onMouseLeave = event => {e.instance.setState({hovered: false});}; + e.returnvalue.props.onMouseLeave = event => { + onMouseLeave(event); + e.instance.setState({hovered: false}); + }; let modify = BDFDB.ObjectUtils.extract(Object.assign({}, e.instance.props, e.instance.state), "muted", "locked", "selected", "unread", "connected", "hovered"); let categoryName = BDFDB.ReactUtils.findChild(e.returnvalue, {props:[["className", BDFDB.disCN.categoryname]]}); if (categoryName) this.changeChannelColor(categoryName, e.instance.props.channel.id, modify); @@ -302,9 +314,15 @@ module.exports = (_ => { if (!e.returnvalue) e.instance.props.channel = this.getChannelData(e.instance.props.channel.id); else { let onMouseEnter = e.returnvalue.props.onMouseEnter || ( _ => {}); - e.returnvalue.props.onMouseEnter = event => {e.instance.setState({hovered: true});}; + e.returnvalue.props.onMouseEnter = event => { + onMouseEnter(event); + e.instance.setState({hovered: true}); + }; let onMouseLeave = e.returnvalue.props.onMouseLeave || ( _ => {}); - e.returnvalue.props.onMouseLeave = event => {e.instance.setState({hovered: false});}; + e.returnvalue.props.onMouseLeave = event => { + onMouseLeave(event); + e.instance.setState({hovered: false}); + }; let modify = BDFDB.ObjectUtils.extract(Object.assign({}, e.instance.props, e.instance.state), "muted", "locked", "selected", "unread", "connected", "hovered"); let channelName = BDFDB.ReactUtils.findChild(e.returnvalue, {props:[["className", BDFDB.disCN.channelname]]}); if (channelName) this.changeChannelColor(channelName, e.instance.props.channel.id, modify); @@ -510,7 +528,8 @@ module.exports = (_ => { }), BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsItem, { type: "Switch", - className: BDFDB.disCN.marginbottom20 + " input-inheritcolor", + className: "input-inheritcolor", + margin: 20, label: this.labels.modal_inheritcolor_text, tag: BDFDB.LibraryComponents.FormComponents.FormTitle.Tags.H5, value: channel.type == 4 && data.inheritColor, @@ -537,7 +556,7 @@ module.exports = (_ => { let changed = false; if (Object.keys(data).every(key => data[key] == null || data[key] == false) && (changed = true)) BDFDB.DataUtils.remove(this, "channels", channel.id); else if (!BDFDB.equals(oldData, data) && (changed = true)) BDFDB.DataUtils.save(data, this, "channels", channel.id); - if (changed) this.forceUpdateAll(); + if (changed) this.forceUpdateAll(true); } }] }); @@ -758,5 +777,5 @@ module.exports = (_ => { } } }; - })(window.BDFDB_Global.PluginUtils.buildPlugin(config)); + })(window.BDFDB_Global.PluginUtils.buildPlugin(config)); })();
\ No newline at end of file diff --git a/.config/BetterDiscord/plugins/EditServers.config.json b/.config/BetterDiscord/plugins/EditServers.config.json index e4f09bb..bf342bb 100644 --- a/.config/BetterDiscord/plugins/EditServers.config.json +++ b/.config/BetterDiscord/plugins/EditServers.config.json @@ -1,6 +1,6 @@ { "changeLog": { - "version": "2.2.4" + "version": "2.2.5" }, "changelog": { "currentversion": "2.2.3" @@ -55,6 +55,7 @@ }, "settings": { "addOriginalTooltip": true, + "changeInChat": true, "changeInGuildHeader": true, "changeInGuildInvites": true, "changeInGuildList": true, diff --git a/.config/BetterDiscord/plugins/EditServers.plugin.js b/.config/BetterDiscord/plugins/EditServers.plugin.js index 9456f61..5484066 100644 --- a/.config/BetterDiscord/plugins/EditServers.plugin.js +++ b/.config/BetterDiscord/plugins/EditServers.plugin.js @@ -1,26 +1,35 @@ -//META{"name":"EditServers","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/EditServers","source":"https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/Plugins/EditServers/EditServers.plugin.js"}*// +/** + * @name EditServers + * @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/EditServers + * @source https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/Plugins/EditServers/EditServers.plugin.js + */ module.exports = (_ => { - const config = { + const config = { "info": { "name": "EditServers", "author": "DevilBro", - "version": "2.2.4", - "description": "Allows you to change the icon, name and color of servers." + "version": "2.2.5", + "description": "Allow you to change the icon, name and color of servers" }, "changeLog": { - "fixed": { - "Server Invites": "No longer breaks server invites of non-joined servers" + "improved": { + "Welcome Message": "Now also changes the server name in the welcome message" } } }; - return !window.BDFDB_Global || (!window.BDFDB_Global.loaded && !window.BDFDB_Global.started) ? class { + + return !window.BDFDB_Global || (!window.BDFDB_Global.loaded && !window.BDFDB_Global.started) ? class { getName () {return config.info.name;} getAuthor () {return config.info.author;} getVersion () {return config.info.version;} getDescription () {return config.info.description;} - load() { + load() { if (!window.BDFDB_Global || !Array.isArray(window.BDFDB_Global.pluginQueue)) window.BDFDB_Global = Object.assign({}, window.BDFDB_Global, {pluginQueue:[]}); if (!window.BDFDB_Global.downloadModal) { window.BDFDB_Global.downloadModal = true; @@ -31,20 +40,20 @@ module.exports = (_ => { onConfirm: _ => { delete window.BDFDB_Global.downloadModal; require("request").get("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js", (e, r, b) => { - if (!e && b && b.indexOf(`//META{"name":"`) > -1) require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => {}); + if (!e && b && b.indexOf(`* @name BDFDB`) > -1) require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => {}); else BdApi.alert("Error", "Could not download BDFDB library plugin, try again some time later."); }); } }); } if (!window.BDFDB_Global.pluginQueue.includes(config.info.name)) window.BDFDB_Global.pluginQueue.push(config.info.name); - } - start() {} - stop() {} - } : (([Plugin, BDFDB]) => { + } + start() {this.load();} + stop() {} + } : (([Plugin, BDFDB]) => { var changedGuilds = {}, settings = {}; - return class EditServers extends Plugin { + return class EditServers extends Plugin { onLoad() { this.defaults = { settings: { @@ -52,6 +61,7 @@ module.exports = (_ => { changeInGuildList: {value:true, inner:true, description:"Server List"}, changeInGuildHeader: {value:true, inner:true, description:"Server Header"}, changeInGuildInvites: {value:true, inner:true, description:"Server Invites"}, + changeInChat: {value:true, inner:true, description:"Chat (Welcome Message, etc.)"}, changeInMutualGuilds: {value:true, inner:true, description:"Mutual Servers"}, changeInRecentMentions: {value:true, inner:true, description:"Recent Mentions Popout"}, changeInQuickSwitcher: {value:true, inner:true, description:"Quick Switcher"} @@ -75,7 +85,8 @@ module.exports = (_ => { BlobMask: "render", GuildIconWrapper: "render", GuildIcon: "render", - GuildHeader: "render" + GuildHeader: "render", + WelcomeArea: "default" } }; @@ -115,7 +126,6 @@ module.exports = (_ => { let settingsPanel, settingsItems = [], innerItems = []; for (let key in settings) if (!this.defaults.settings[key].inner) settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, { - className: BDFDB.disCN.marginbottom8, type: "Switch", plugin: this, keys: ["settings", key], @@ -126,7 +136,6 @@ module.exports = (_ => { title: "Change Servers in:", first: settingsItems.length == 0, children: Object.keys(settings).map(key => this.defaults.settings[key].inner && BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, { - className: BDFDB.disCN.marginbottom8, type: "Switch", plugin: this, keys: ["settings", key], @@ -136,7 +145,6 @@ module.exports = (_ => { })); settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsItem, { type: "Button", - className: BDFDB.disCN.marginbottom8, color: BDFDB.LibraryComponents.Button.Colors.RED, label: "Reset all Servers", onClick: _ => { @@ -244,16 +252,16 @@ module.exports = (_ => { let renderChildren = e.returnvalue.props.children; e.returnvalue.props.children = (...args) => { let renderedChildren = renderChildren(...args); - let [children, index] = BDFDB.ReactUtils.findParent(renderedChildren, {props:[["className", BDFDB.disCN.guildiconacronym]]}); - if (index > -1) { + let guildAcronym = BDFDB.ReactUtils.findChild(renderedChildren, {props:[["className", BDFDB.disCN.guildiconacronym]]}); + if (guildAcronym) { let fontGradient = BDFDB.ObjectUtils.is(data.color2); - children[index].props.style = Object.assign({}, children[index].props.style, { + guildAcronym.props.style = Object.assign({}, guildAcronym.props.style, { background: BDFDB.ObjectUtils.is(data.color1) ? BDFDB.ColorUtils.createGradient(data.color1) : BDFDB.ColorUtils.convert(data.color1, "RGBA"), color: !fontGradient && BDFDB.ColorUtils.convert(data.color2, "RGBA") }); - if (fontGradient) children[index].props.children = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TextGradientElement, { + if (fontGradient) guildAcronym.props.children = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TextGradientElement, { gradient: BDFDB.ColorUtils.createGradient(data.color2), - children: children[index].props.children + children: guildAcronym.props.children }); } return renderedChildren; @@ -340,6 +348,19 @@ module.exports = (_ => { } } + processWelcomeArea (e) { + if (e.instance.props.channel && settings.changeInChat) { + let name = (BDFDB.LibraryModules.GuildStore.getGuild(e.instance.props.channel.guild_id) || {}).name; + let guildName = name && BDFDB.ReactUtils.findChild(e.returnvalue, {props:[["className", "titleName-3-Lp3Z"]]}); + if (guildName && guildName.props && BDFDB.ArrayUtils.is(guildName.props.children)) { + for (let child of guildName.props.children) if (child && child.props && BDFDB.ArrayUtils.is(child.props.children) && child.props.children[0] == name) { + child.props.children = [(this.getGuildData(e.instance.props.channel.guild_id) || {}).name || name]; + break; + } + } + } + } + getGuildData (guildId, change = true) { let guild = BDFDB.LibraryModules.GuildStore.getGuild(guildId); if (!guild) return new BDFDB.DiscordObjects.Guild({}); @@ -456,6 +477,7 @@ module.exports = (_ => { BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsItem, { className: "input-removeicon", type: "Switch", + margin: 0, grow: 0, label: BDFDB.LanguageUtils.LanguageStrings.REMOVE, tag: BDFDB.LibraryComponents.FormComponents.FormTitle.Tags.H5, @@ -502,6 +524,7 @@ module.exports = (_ => { BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsItem, { className: "input-removebanner", type: "Switch", + margin: 0, grow: 0, label: BDFDB.LanguageUtils.LanguageStrings.REMOVE, tag: BDFDB.LibraryComponents.FormComponents.FormTitle.Tags.H5, @@ -1079,5 +1102,5 @@ module.exports = (_ => { } } }; - })(window.BDFDB_Global.PluginUtils.buildPlugin(config)); + })(window.BDFDB_Global.PluginUtils.buildPlugin(config)); })();
\ No newline at end of file |