From 24afa7f2f39cd59f94cd91926621b68595c4eb45 Mon Sep 17 00:00:00 2001 From: Mirco Wittrien Date: Fri, 30 Oct 2020 15:41:20 +0100 Subject: [PATCH] Revert "stuff" This reverts commit 195db64f8fe6f4235febcc8d0ba1f542ffbb1db0. --- Library/0BDFDB.plugin.js | 19 ++-------- Plugins/EditChannels/EditChannels.plugin.js | 39 +++++++-------------- 2 files changed, 15 insertions(+), 43 deletions(-) diff --git a/Library/0BDFDB.plugin.js b/Library/0BDFDB.plugin.js index 3e6db2a0a3..045f04fd30 100644 --- a/Library/0BDFDB.plugin.js +++ b/Library/0BDFDB.plugin.js @@ -2559,14 +2559,14 @@ module.exports = (_ => { if (unreadChannels.length) BDFDB.ChannelUtils.markAsRead(unreadChannels); }; BDFDB.GuildUtils.rerenderAll = function (instant) { - return; BDFDB.TimeUtils.clear(GuildsRerenderTimeout); GuildsRerenderTimeout = BDFDB.TimeUtils.timeout(_ => { let GuildsIns = BDFDB.ReactUtils.findOwner(document.querySelector(BDFDB.dotCN.app), {name:"Guilds", unlimited:true}); let GuildsPrototype = BDFDB.ObjectUtils.get(GuildsIns, "_reactInternalFiber.type.prototype"); if (GuildsIns && GuildsPrototype) { BDFDB.PatchUtils.patch(BDFDB, GuildsPrototype, "render", {after: e => { - e.returnValue.props.children = []; + let [children, index] = BDFDB.ReactUtils.findParent(e.returnValue, {name: "ConnectedUnreadDMs"}); + if (index > -1) children.splice(index + 1, 0, BDFDB.ReactUtils.createElement("div", {})); BDFDB.ReactUtils.forceUpdate(GuildsIns); }}, {once: true}); BDFDB.ReactUtils.forceUpdate(GuildsIns); @@ -2612,7 +2612,6 @@ module.exports = (_ => { return found; }; - let ChannelsRerenderTimeout; BDFDB.ChannelUtils = {}; BDFDB.ChannelUtils.is = function (channel) { if (!BDFDB.ObjectUtils.is(channel)) return false; @@ -2686,20 +2685,6 @@ module.exports = (_ => { } if (unreadChannels.length) LibraryModules.AckUtils.bulkAck(unreadChannels); }; - BDFDB.ChannelUtils.rerenderAll = function (instant) { - BDFDB.TimeUtils.clear(ChannelsRerenderTimeout); - ChannelsRerenderTimeout = BDFDB.TimeUtils.timeout(_ => { - let ChannelsIns = BDFDB.ReactUtils.findOwner(document.querySelector(BDFDB.dotCN.guildchannels), {name:"Channels", unlimited:true}); - let ChannelsPrototype = BDFDB.ObjectUtils.get(ChannelsIns, "_reactInternalFiber.type.prototype"); - if (ChannelsIns && ChannelsPrototype) { - BDFDB.PatchUtils.patch(BDFDB, ChannelsPrototype, "render", {after: e => { - e.returnValue.props.children = []; - BDFDB.ReactUtils.forceUpdate(ChannelsIns); - }}, {once: true}); - BDFDB.ReactUtils.forceUpdate(ChannelsIns); - } - }, instant ? 0 : 1000); - }; BDFDB.DMUtils = {}; BDFDB.DMUtils.isDMChannel = function (channelOrId) { diff --git a/Plugins/EditChannels/EditChannels.plugin.js b/Plugins/EditChannels/EditChannels.plugin.js index 2f7a51835b..4d30efb3ea 100644 --- a/Plugins/EditChannels/EditChannels.plugin.js +++ b/Plugins/EditChannels/EditChannels.plugin.js @@ -13,12 +13,12 @@ module.exports = (_ => { "info": { "name": "EditChannels", "author": "DevilBro", - "version": "4.1.8", + "version": "4.1.7", "description": "Allow you to rename and recolor channelnames" }, "changeLog": { "fixed": { - "Works again": "Yas" + "Autocomplete Menu": "Works again" } } }; @@ -77,8 +77,8 @@ module.exports = (_ => { AuditLog: "render", SettingsInvites: "render", HeaderBarContainer: "render", - ChannelCategoryItem: "default", - ChannelItem: "default", + ChannelCategoryItem: "render", + ChannelItem: "render", QuickSwitchChannelResult: "render", MessageContent: "type" }, @@ -86,8 +86,8 @@ module.exports = (_ => { AutocompleteChannelResult: "render", AuditLog: "render", HeaderBarContainer: "render", - ChannelCategoryItem: "default", - ChannelItem: "default", + ChannelCategoryItem: "render", + ChannelItem: "render", QuickSwitchChannelResult: "render", RecentsChannelHeader: "default" } @@ -174,13 +174,12 @@ module.exports = (_ => { } } - forceUpdateAll (instant = false) { + forceUpdateAll () { 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})); } @@ -206,7 +205,7 @@ module.exports = (_ => { disabled: !changedChannels[e.instance.props.channel.id], action: _ => { BDFDB.DataUtils.remove(this, "channels", e.instance.props.channel.id); - this.forceUpdateAll(true); + this.forceUpdateAll(); } }) ] @@ -291,15 +290,9 @@ 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 => { - onMouseEnter(event); - e.instance.setState({hovered: true}); - }; + e.returnvalue.props.onMouseEnter = event => {e.instance.setState({hovered: true});}; let onMouseLeave = e.returnvalue.props.onMouseLeave || ( _ => {}); - e.returnvalue.props.onMouseLeave = event => { - onMouseLeave(event); - e.instance.setState({hovered: false}); - }; + e.returnvalue.props.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); @@ -314,15 +307,9 @@ 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 => { - onMouseEnter(event); - e.instance.setState({hovered: true}); - }; + e.returnvalue.props.onMouseEnter = event => {e.instance.setState({hovered: true});}; let onMouseLeave = e.returnvalue.props.onMouseLeave || ( _ => {}); - e.returnvalue.props.onMouseLeave = event => { - onMouseLeave(event); - e.instance.setState({hovered: false}); - }; + e.returnvalue.props.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); @@ -556,7 +543,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(true); + if (changed) this.forceUpdateAll(); } }] });