stuff
This commit is contained in:
parent
2d49ecb922
commit
7bbb1caf2d
|
@ -329,44 +329,46 @@ module.exports = (_ => {
|
|||
|
||||
processHeaderBarContainer (e) {
|
||||
let channel = BDFDB.LibraryModules.ChannelStore.getChannel(e.instance.props.channelId);
|
||||
if (channel && (BDFDB.ChannelUtils.isTextChannel(channel) || channel.isGroupDM() || BDFDB.ChannelUtils.isThread(channel)) && this.settings.places.channelHeader) {
|
||||
if (channel && this.settings.places.channelHeader) {
|
||||
let thread;
|
||||
if (BDFDB.ChannelUtils.isThread(channel)) {
|
||||
thread = channel;
|
||||
channel = BDFDB.LibraryModules.ChannelStore.getChannel(thread.parent_id);
|
||||
}
|
||||
if (!e.returnvalue) {
|
||||
let channelNames = BDFDB.ReactUtils.findChild(e.instance, {all: true, name: ["Title", "ChannelName"]});
|
||||
if (channelNames.length) {
|
||||
if (channelNames[0].props.children) {
|
||||
if (changedChannels[channel.id] && changedChannels[channel.id].name) channelNames[0].props.children = channel.isGroupDM() ? this.getGroupName(channel.id) : this.getChannelData(channel.id).name;
|
||||
this.changeChannelColor(channelNames[0], channel.id);
|
||||
}
|
||||
if (channelNames[0].props.channel) channelNames[0].props.channel = this.getChannelData(channel.id);
|
||||
if (thread && channelNames[1].props.children) {
|
||||
if (changedChannels[thread.id] && changedChannels[thread.id].name) channelNames[1].props.children = this.getChannelData(thread.id).name;
|
||||
this.changeChannelColor(channelNames[1], thread.id);
|
||||
if (changedChannels[channel.id] || thread && changedChannels[thread.id]) {
|
||||
if (!e.returnvalue) {
|
||||
let channelNames = BDFDB.ReactUtils.findChild(e.instance, {all: true, name: ["Title", "ChannelName"]});
|
||||
if (channelNames.length) {
|
||||
if (channelNames[0].props.children) {
|
||||
if (changedChannels[channel.id] && changedChannels[channel.id].name) channelNames[0].props.children = channel.isGroupDM() ? this.getGroupName(channel.id) : this.getChannelData(channel.id).name;
|
||||
this.changeChannelColor(channelNames[0], channel.id);
|
||||
}
|
||||
if (channelNames[0].props.channel) channelNames[0].props.channel = this.getChannelData(channel.id);
|
||||
if (thread && channelNames[1].props.children) {
|
||||
if (changedChannels[thread.id] && changedChannels[thread.id].name) channelNames[1].props.children = this.getChannelData(thread.id).name;
|
||||
this.changeChannelColor(channelNames[1], thread.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
let channelIcons = BDFDB.ReactUtils.findChild(e.instance, {all: true, name: "Icon"});
|
||||
if (channelIcons.length) {
|
||||
if (channelIcons[0].props.icon) {
|
||||
let iconRender = channelIcons[0].props.icon;
|
||||
channelIcons[0].props.icon = BDFDB.TimeUtils.suppress((...args) => {
|
||||
let icon = iconRender(...args);
|
||||
this.changeChannelIconColor(icon, channel.id);
|
||||
return icon;
|
||||
}, "Error in Channel Icon Render of HeaderBarContainer!", this);
|
||||
}
|
||||
if (thread && channelIcons[1].props.icon) {
|
||||
let iconRender = channelIcons[1].props.icon;
|
||||
channelIcons[1].props.icon = BDFDB.TimeUtils.suppress((...args) => {
|
||||
let icon = iconRender(...args);
|
||||
this.changeChannelIconColor(icon, thread.id);
|
||||
return icon;
|
||||
}, "Error in Thread Icon Render of HeaderBarContainer!", this);
|
||||
else {
|
||||
let channelIcons = BDFDB.ReactUtils.findChild(e.instance, {all: true, name: "Icon"});
|
||||
if (channelIcons.length) {
|
||||
if (channelIcons[0].props.icon) {
|
||||
let iconRender = channelIcons[0].props.icon;
|
||||
channelIcons[0].props.icon = BDFDB.TimeUtils.suppress((...args) => {
|
||||
let icon = iconRender(...args);
|
||||
this.changeChannelIconColor(icon, channel.id);
|
||||
return icon;
|
||||
}, "Error in Channel Icon Render of HeaderBarContainer!", this);
|
||||
}
|
||||
if (thread && channelIcons[1].props.icon) {
|
||||
let iconRender = channelIcons[1].props.icon;
|
||||
channelIcons[1].props.icon = BDFDB.TimeUtils.suppress((...args) => {
|
||||
let icon = iconRender(...args);
|
||||
this.changeChannelIconColor(icon, thread.id);
|
||||
return icon;
|
||||
}, "Error in Thread Icon Render of HeaderBarContainer!", this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* @name EditUsers
|
||||
* @author DevilBro
|
||||
* @authorId 278543574059057154
|
||||
* @version 4.5.6
|
||||
* @version 4.5.7
|
||||
* @description Allows you to locally edit Users
|
||||
* @invite Jx3TjNS
|
||||
* @donate https://www.paypal.me/MircoWittrien
|
||||
|
@ -17,7 +17,7 @@ module.exports = (_ => {
|
|||
"info": {
|
||||
"name": "EditUsers",
|
||||
"author": "DevilBro",
|
||||
"version": "4.5.6",
|
||||
"version": "4.5.7",
|
||||
"description": "Allows you to locally edit Users"
|
||||
}
|
||||
};
|
||||
|
@ -483,6 +483,7 @@ module.exports = (_ => {
|
|||
processHeaderBarContainer (e) {
|
||||
let channel = BDFDB.LibraryModules.ChannelStore.getChannel(e.instance.props.channelId);
|
||||
if (channel && channel.isDM() && this.settings.places.dmHeader) {
|
||||
console.log(e);
|
||||
let userName = BDFDB.ReactUtils.findChild(e.instance, {name: "Title"});
|
||||
if (userName) {
|
||||
let recipientId = channel.getRecipientId();
|
||||
|
@ -493,12 +494,23 @@ module.exports = (_ => {
|
|||
}
|
||||
|
||||
processChannelCallHeader (e) {
|
||||
if (e.instance.props.channel && e.instance.props.channel.isDM() && this.settings.places.dmHeader) {
|
||||
let userName = BDFDB.ReactUtils.findChild(e.returnvalue, {name: "Title"});
|
||||
if (userName) {
|
||||
let recipientId = e.instance.props.channel.getRecipientId();
|
||||
userName.props.children = this.getUserData(recipientId).username;
|
||||
this.changeUserColor(userName, recipientId);
|
||||
if (e.instance.props.channel && this.settings.places.dmHeader) {
|
||||
if (e.instance.props.channel.isDM()) {
|
||||
let userName = BDFDB.ReactUtils.findChild(e.returnvalue, {name: "Title"});
|
||||
if (userName) {
|
||||
let recipientId = e.instance.props.channel.getRecipientId();
|
||||
if (changedUsers[recipientId]) {
|
||||
userName.props.children = this.getUserData(recipientId).username;
|
||||
this.changeUserColor(userName, recipientId);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
let channelTitle = BDFDB.ReactUtils.findChild(e.returnvalue, {name: "ChannelTitle"});
|
||||
if (channelTitle && channelTitle.props && channelTitle.props.focusedParticipant && channelTitle.props.focusedParticipant.user && changedUsers[channelTitle.props.focusedParticipant.user.id]) {
|
||||
channelTitle.props.focusedParticipant.user = this.getUserData(channelTitle.props.focusedParticipant.user.id);
|
||||
channelTitle.props.focusedParticipant.userNick = changedUsers[channelTitle.props.focusedParticipant.user.id].name || channelTitle.props.focusedParticipant.userNick;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* @name OldTitleBar
|
||||
* @author DevilBro
|
||||
* @authorId 278543574059057154
|
||||
* @version 1.7.2
|
||||
* @version 1.7.3
|
||||
* @description Allows you to switch to Discord's old Titlebar
|
||||
* @invite Jx3TjNS
|
||||
* @donate https://www.paypal.me/MircoWittrien
|
||||
|
@ -17,7 +17,7 @@ module.exports = (_ => {
|
|||
"info": {
|
||||
"name": "OldTitleBar",
|
||||
"author": "DevilBro",
|
||||
"version": "1.7.2",
|
||||
"version": "1.7.3",
|
||||
"description": "Allows you to switch to Discord's old Titlebar"
|
||||
}
|
||||
};
|
||||
|
@ -250,15 +250,11 @@ module.exports = (_ => {
|
|||
if (!wrapper) return;
|
||||
let children = BDFDB.ObjectUtils.get(wrapper, "props.toolbar.props.children");
|
||||
if (!children) {
|
||||
let [oldToolbarParent, oldToolbarIndex] = BDFDB.ReactUtils.findParent(e.returnvalue, {key: "OldTitleBar-toolbar"});
|
||||
if (oldToolbarIndex > -1) oldToolbarParent.splice(oldToolbarIndex, 1);
|
||||
let toolbar = BDFDB.ReactUtils.createElement("div", {
|
||||
className: BDFDB.disCNS.channelheadertoolbar + BDFDB.disCN._oldtitlebartoolbar,
|
||||
key: "OldTitleBar-toolbar",
|
||||
children: []
|
||||
});
|
||||
wrapper.props.children.push(toolbar);
|
||||
children = toolbar.props.children;
|
||||
children = [];
|
||||
wrapper.props.toolbar = [
|
||||
wrapper.props.toolbar,
|
||||
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Flex, {children})
|
||||
];
|
||||
}
|
||||
this.injectButtons(children, true);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue