stuff
This commit is contained in:
parent
e983cfefbe
commit
195db64f8f
|
@ -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 => {
|
||||
let [children, index] = BDFDB.ReactUtils.findParent(e.returnValue, {name: "ConnectedUnreadDMs"});
|
||||
if (index > -1) children.splice(index + 1, 0, BDFDB.ReactUtils.createElement("div", {}));
|
||||
e.returnValue.props.children = [];
|
||||
BDFDB.ReactUtils.forceUpdate(GuildsIns);
|
||||
}}, {once: true});
|
||||
BDFDB.ReactUtils.forceUpdate(GuildsIns);
|
||||
|
@ -2612,6 +2612,7 @@ module.exports = (_ => {
|
|||
return found;
|
||||
};
|
||||
|
||||
let ChannelsRerenderTimeout;
|
||||
BDFDB.ChannelUtils = {};
|
||||
BDFDB.ChannelUtils.is = function (channel) {
|
||||
if (!BDFDB.ObjectUtils.is(channel)) return false;
|
||||
|
@ -2685,6 +2686,20 @@ 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) {
|
||||
|
|
|
@ -13,12 +13,12 @@ module.exports = (_ => {
|
|||
"info": {
|
||||
"name": "EditChannels",
|
||||
"author": "DevilBro",
|
||||
"version": "4.1.7",
|
||||
"version": "4.1.8",
|
||||
"description": "Allow you to rename and recolor channelnames"
|
||||
},
|
||||
"changeLog": {
|
||||
"fixed": {
|
||||
"Autocomplete Menu": "Works again"
|
||||
"Works again": "Yas"
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -77,8 +77,8 @@ module.exports = (_ => {
|
|||
AuditLog: "render",
|
||||
SettingsInvites: "render",
|
||||
HeaderBarContainer: "render",
|
||||
ChannelCategoryItem: "render",
|
||||
ChannelItem: "render",
|
||||
ChannelCategoryItem: "default",
|
||||
ChannelItem: "default",
|
||||
QuickSwitchChannelResult: "render",
|
||||
MessageContent: "type"
|
||||
},
|
||||
|
@ -86,8 +86,8 @@ module.exports = (_ => {
|
|||
AutocompleteChannelResult: "render",
|
||||
AuditLog: "render",
|
||||
HeaderBarContainer: "render",
|
||||
ChannelCategoryItem: "render",
|
||||
ChannelItem: "render",
|
||||
ChannelCategoryItem: "default",
|
||||
ChannelItem: "default",
|
||||
QuickSwitchChannelResult: "render",
|
||||
RecentsChannelHeader: "default"
|
||||
}
|
||||
|
@ -174,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}));
|
||||
}
|
||||
|
||||
|
@ -205,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);
|
||||
}
|
||||
})
|
||||
]
|
||||
|
@ -290,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);
|
||||
|
@ -307,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);
|
||||
|
@ -543,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);
|
||||
}
|
||||
}]
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue