EditChannels

This commit is contained in:
Mirco Wittrien 2022-11-04 20:53:39 +01:00
parent ad612dfe55
commit 906f3ed6de
2 changed files with 418 additions and 444 deletions

View File

@ -412,6 +412,7 @@
"LazyImageZoomable": {"strings": ["renderLinkComponent", "onCloseImage"]}, "LazyImageZoomable": {"strings": ["renderLinkComponent", "onCloseImage"]},
"ListItemTooltip": {"strings": [".listItemWrapper", "tooltipClassName", "disableWrapper"]}, "ListItemTooltip": {"strings": [".listItemWrapper", "tooltipClassName", "disableWrapper"]},
"MemberListItem": {"protos": ["renderOwner", "renderDecorators", "renderPremium"]}, "MemberListItem": {"protos": ["renderOwner", "renderDecorators", "renderPremium"]},
"Mention": {"strings": [".iconType", ".color,", "CHANNEL_BROWSER_TITLE"]},
"Menu": {"strings": ["\"empty\"", "getItemProps", "isUsingKeyboardNavigation"]}, "Menu": {"strings": ["\"empty\"", "getItemProps", "isUsingKeyboardNavigation"]},
"Message": {"strings": ["childrenMessageContent", "childrenRepliedMessage", "zalgo", ".buttonContainer"]}, "Message": {"strings": ["childrenMessageContent", "childrenRepliedMessage", "zalgo", ".buttonContainer"]},
"MessageAccessories": {"protos": ["renderGiftCodes", "renderEmbeds", "renderActivityInvite"]}, "MessageAccessories": {"protos": ["renderGiftCodes", "renderEmbeds", "renderActivityInvite"]},
@ -454,7 +455,8 @@
"Reactor": {"strings": ["currentUser cannot be undefined", "reactorDefault"]}, "Reactor": {"strings": ["currentUser cannot be undefined", "reactorDefault"]},
"ReactorsComponent": {"strings": ["hasMore", "emoji", "spinnerMore"]}, "ReactorsComponent": {"strings": ["hasMore", "emoji", "spinnerMore"]},
"RecentMentions": {"strings": ["canCloseAllMessages", "RECENT_MENTIONS", "badgeable"]}, "RecentMentions": {"strings": ["canCloseAllMessages", "RECENT_MENTIONS", "badgeable"]},
"RecentsChannelHeader": {"strings": ["\"ArrowRight\"", "gotoChannel:"]}, "RecentsChannelHeader": {"strings": [".subtextContainer", ".channelNameSpan", ".channelNameHeader", ".gotoChannel"]},
"RichChannelMention": {"strings": ["iconType:", "Messages.DELETED_CHANNEL_PLACEHOLDER"]},
"RichUserMention": {"strings": ["hidePersonalInformation", "getUser", "userTooltip"]}, "RichUserMention": {"strings": ["hidePersonalInformation", "getUser", "userTooltip"]},
"SearchBar": {"strings": [").inputRef", ".containerRef", ".handleOnChange"]}, "SearchBar": {"strings": [").inputRef", ".containerRef", ".handleOnChange"]},
"SearchPopout": {"strings": [".handleHintClick", ".selectedIndex", "token.start"]}, "SearchPopout": {"strings": [".handleHintClick", ".selectedIndex", "token.start"]},
@ -467,12 +469,16 @@
"Spoiler": {"strings": ["revealSpoiler", ".onReveal"]}, "Spoiler": {"strings": ["revealSpoiler", ".onReveal"]},
"SpoilerWarning": {"strings": [".spoilerWarning", ".SPOILER"]}, "SpoilerWarning": {"strings": [".spoilerWarning", ".SPOILER"]},
"StandardSidebarView": {"strings": ["standardSidebarView", ".sidebarTheme", "mobileSidebarHeader"]}, "StandardSidebarView": {"strings": ["standardSidebarView", ".sidebarTheme", "mobileSidebarHeader"]},
"SystemMessageThreadCreated": {"strings": ["threadOnClick:", ".SYSTEM_MESSAGE_THREAD_CREATED", "viewThreadsOnClick:"]},
"SystemMessageWrapper": {"strings": ["unknown message type", "\"SystemMessage\""]}, "SystemMessageWrapper": {"strings": ["unknown message type", "\"SystemMessage\""]},
"TabBar": {"props": ["Types", "Looks", "Item", "Panel"]}, "TabBar": {"props": ["Types", "Looks", "Item", "Panel"]},
"TextChannelEmptyMessage": {"strings": ["MANAGE_CHANNELS", ".BEGINNING_CHANNEL_DESCRIPTION", "topicHook:"]}, "TextChannelEmptyMessage": {"strings": ["MANAGE_CHANNELS", ".BEGINNING_CHANNEL_DESCRIPTION", "topicHook:"]},
"Tooltip": {"protos": ["renderTooltip", "setDomElement", "shouldShowTooltip", "toggleShow"]}, "Tooltip": {"protos": ["renderTooltip", "setDomElement", "shouldShowTooltip", "toggleShow"]},
"TransitionGroup": {"protos": ["performAppear", "performEnter", "performLeave"]}, "TransitionGroup": {"protos": ["performAppear", "performEnter", "performLeave"]},
"ThreadCard": {"strings": [".threadId", ".gotoThread", ".container", ".threadName"]},
"ThreadEmptyMessage": {"strings": [",{channel:", ".name)", "{channelId:", ".iconWrapper", ".icon}"]}, "ThreadEmptyMessage": {"strings": [",{channel:", ".name)", "{channelId:", ".iconWrapper", ".icon}"]},
"ThreadMessageAccessories": {"strings": ["threadMetadata", "NO_RECENT_THREAD_MESSAGES", ".Messages.THREAD"]},
"ThreadSidebar": {"strings": [".baseChannelId", ".SIDEBAR", ".THREAD_HEADER_BAR"]},
"UnavailableGuildsButton": {"strings": [".errorInner", ".guildsError", "Messages.PARTIAL_OUTAGE"]}, "UnavailableGuildsButton": {"strings": [".errorInner", ".guildsError", "Messages.PARTIAL_OUTAGE"]},
"UnreadDMs": {"strings": ["getMutablePrivateChannels", "selectedVoiceGuildId", ".selectedVoiceChannelId"]}, "UnreadDMs": {"strings": ["getMutablePrivateChannels", "selectedVoiceGuildId", ".selectedVoiceChannelId"]},
"UseCopyIdItem": {"strings": ["\"devmode-copy-id\""]}, "UseCopyIdItem": {"strings": ["\"devmode-copy-id\""]},
@ -2958,6 +2964,8 @@
"radiogroup": ["RadioGroup", "item"], "radiogroup": ["RadioGroup", "item"],
"radiogroupinner": ["RadioGroup", "radioBar"], "radiogroupinner": ["RadioGroup", "radioBar"],
"recentmentionschannelname": ["RecentMentionsHeader", "channelName"], "recentmentionschannelname": ["RecentMentionsHeader", "channelName"],
"recentmentionschannelnameheader": ["RecentMentionsHeader", "channelNameHeader"],
"recentmentionschannelnamespan": ["RecentMentionsHeader", "channelNameSpan"],
"recentmentionsclosebutton": ["RecentMentions", "closeButton"], "recentmentionsclosebutton": ["RecentMentions", "closeButton"],
"recentmentionsdmicon": ["RecentMentionsHeader", "dmIcon"], "recentmentionsdmicon": ["RecentMentionsHeader", "dmIcon"],
"recentmentionsguildicon": ["RecentMentionsHeader", "guildIcon"], "recentmentionsguildicon": ["RecentMentionsHeader", "guildIcon"],

View File

@ -2,7 +2,7 @@
* @name EditChannels * @name EditChannels
* @author DevilBro * @author DevilBro
* @authorId 278543574059057154 * @authorId 278543574059057154
* @version 4.4.2 * @version 4.4.3
* @description Allows you to locally edit Channels * @description Allows you to locally edit Channels
* @invite Jx3TjNS * @invite Jx3TjNS
* @donate https://www.paypal.me/MircoWittrien * @donate https://www.paypal.me/MircoWittrien
@ -83,48 +83,48 @@ module.exports = (_ => {
} }
}; };
this.patchedModules = { this.modulePatches = {
before: { before: [
ChannelTextAreaEditor: "render", "AuditLogEntry",
TextChannelEmptyMessage: "default", "AutocompleteChannelResult",
ThreadEmptyMessage: "default", "ChannelsList",
SystemMessageWrapper: "type", "ChannelTextAreaEditor",
AutocompleteChannelResult: "render", "ChannelThreadItem",
GuildSettingsAuditLogEntry: "render", "GuildSettingsInvites",
SettingsInvites: "render", "MessageContent",
HeaderBarContainer: "default", "QuickSwitchChannelResult",
ChannelCategoryItem: "type", "RecentsChannelHeader",
ChannelItem: "default", "SearchPopout",
GuildSidebarThreadListEntry: "type", "SystemMessageWrapper",
QuickSwitchChannelResult: "render", "TextChannelEmptyMessage",
SearchPopoutComponent: "render", "ThreadEmptyMessage",
MessageContent: "type" "ThreadMessageAccessories"
}, ],
after: { after: [
ThreadMessageAccessories: "default", "AuditLogEntry",
ThreadCreated: "default", "AutocompleteChannelResult",
AutocompleteChannelResult: "render", "ChannelItem",
GuildSettingsAuditLogEntry: "render", "ChannelThreadItem",
HeaderBarContainer: "default", "DirectMessage",
ThreadSidebar: "default", "FocusRingScope",
ThreadCard: "type", "HeaderBarContainer",
FocusRing: "FocusRing", "PrivateChannel",
ChannelItem: "default", "QuickSwitchChannelResult",
GuildSidebarThreadListEntry: "type", "RecentsChannelHeader",
DirectMessage: "render", "RichChannelMention",
PrivateChannel: "render", "SearchResultsInner",
QuickSwitchChannelResult: "render", "SystemMessageThreadCreated",
SearchResultsInner: "default", "ThreadCard",
RecentsChannelHeader: "default", "ThreadMessageAccessories",
RichChannelMention: "ChannelMention" "ThreadSidebar"
} ]
}; };
this.patchPriority = 9; this.patchPriority = 9;
this.css = ` this.css = `
${BDFDB.dotCN.messagespopoutchannelname}:hover > span[style*="color"], ${BDFDB.dotCN.messagespopoutchannelname}:hover > span[style*="color"],
${BDFDB.dotCN.recentmentionschannelname}:hover > span[style*="color"], ${BDFDB.dotCN.recentmentionschannelname}:hover span[style*="color"],
${BDFDB.dotCN.searchresultschannelname}:hover > span[style*="color"] { ${BDFDB.dotCN.searchresultschannelname}:hover > span[style*="color"] {
text-decoration: underline; text-decoration: underline;
} }
@ -217,9 +217,10 @@ module.exports = (_ => {
} }
onChannelContextMenu (e) { onChannelContextMenu (e) {
if (e.instance.props.channel && (e.subType == "useChannelDeleteItem" || e.subType == "useChannelLeaveItem")) { if (!e.instance.props.channel) return;
if (e.returnvalue.length > 0) e.returnvalue.unshift(BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuSeparator, {})); let [children, index] = BDFDB.ContextMenuUtils.findItem(e.returnvalue, {id: "devmode-copy-id", group: true});
e.returnvalue.unshift(BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, { children.splice(index > -1 ? index : children.length, 0, BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuGroup, {
children: BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
label: this.labels.context_localchannelsettings, label: this.labels.context_localchannelsettings,
id: BDFDB.ContextMenuUtils.createItemId(this.name, "settings-submenu"), id: BDFDB.ContextMenuUtils.createItemId(this.name, "settings-submenu"),
children: BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuGroup, { children: BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuGroup, {
@ -245,57 +246,58 @@ module.exports = (_ => {
}) })
] ]
}) })
})
})); }));
} }
onThreadContextMenu (e) {
this.onChannelContextMenu(e);
}
onGroupDMContextMenu (e) {
this.onChannelContextMenu(e);
} }
processChannelTextAreaEditor (e) { processChannelTextAreaEditor (e) {
if (!e.instance.props.disabled && e.instance.props.channel && changedChannels[e.instance.props.channel.id] && (e.instance.props.type == BDFDB.DiscordConstants.ChannelTextAreaTypes.NORMAL || e.instance.props.type == BDFDB.LibraryComponents.ChannelTextAreaTypes.SIDEBAR) && this.settings.places.chatTextarea) { if (!this.settings.places.chatTextarea || e.instance.props.disabled || !e.instance.props.channel || !changedChannels[e.instance.props.channel.id] || e.instance.props.type != BDFDB.DiscordConstants.ChannelTextAreaTypes.NORMAL && e.instance.props.type != BDFDB.DiscordConstants.ChannelTextAreaTypes.NORMAL_WITH_ACTIVITY && e.instance.props.type != BDFDB.DiscordConstants.ChannelTextAreaTypes.SIDEBAR) return;
if (changedChannels[e.instance.props.channel.id].name) e.instance.props.placeholder = BDFDB.LanguageUtils.LanguageStringsFormat("TEXTAREA_PLACEHOLDER", `#${changedChannels[e.instance.props.channel.id].name}`); if (changedChannels[e.instance.props.channel.id].name) e.instance.props.placeholder = BDFDB.LanguageUtils.LanguageStringsFormat("TEXTAREA_PLACEHOLDER", `#${changedChannels[e.instance.props.channel.id].name}`);
} }
}
processTextChannelEmptyMessage (e) { processTextChannelEmptyMessage (e) {
if (e.instance.props.channel && changedChannels[e.instance.props.channel.id] && this.settings.places.chatWindow) e.instance.props.channel = this.getChannelData(e.instance.props.channel.id); if (this.settings.places.chatWindow && e.instance.props.channel && changedChannels[e.instance.props.channel.id]) e.instance.props.channel = this.getChannelData(e.instance.props.channel.id);
} }
processThreadEmptyMessage (e) { processThreadEmptyMessage (e) {
if (e.instance.props.channel && changedChannels[e.instance.props.channel.id] && this.settings.places.chatWindow) e.instance.props.channel = this.getChannelData(e.instance.props.channel.id); if (this.settings.places.chatWindow && e.instance.props.channel && changedChannels[e.instance.props.channel.id]) e.instance.props.channel = this.getChannelData(e.instance.props.channel.id);
} }
processSystemMessageWrapper (e) { processSystemMessageWrapper (e) {
if (e.instance.props.channel && changedChannels[e.instance.props.channel.id] && this.settings.places.chatWindow) e.instance.props.channel = this.getChannelData(e.instance.props.channel.id); if (this.settings.places.chatWindow && e.instance.props.channel && changedChannels[e.instance.props.channel.id]) e.instance.props.channel = this.getChannelData(e.instance.props.channel.id);
} }
processThreadCreated (e) { processSystemMessageThreadCreated (e) {
if (e.instance.props.message && e.instance.props.message.messageReference && e.instance.props.message.messageReference.channel_id && changedChannels[e.instance.props.message.messageReference.channel_id] && this.settings.places.chatWindow) { if (!this.settings.places.chatWindow || !e.instance.props.message || !e.instance.props.message.messageReference || !e.instance.props.message.messageReference.channel_id || !changedChannels[e.instance.props.message.messageReference.channel_id]) return;
let channelName = BDFDB.ObjectUtils.get(e, "returnvalue.props.children.2.props.children.0"); let channelName = BDFDB.ObjectUtils.get(e, "returnvalue.props.children.2.props.children.0");
if (changedChannels[e.instance.props.message.messageReference.channel_id].name) channelName.props.children = [changedChannels[e.instance.props.message.messageReference.channel_id].name]; if (changedChannels[e.instance.props.message.messageReference.channel_id].name) channelName.props.children = [changedChannels[e.instance.props.message.messageReference.channel_id].name];
this.changeChannelColor(channelName, e.instance.props.message.messageReference.channel_id); this.changeChannelColor(channelName, e.instance.props.message.messageReference.channel_id);
} }
}
processThreadMessageAccessories (e) { processThreadMessageAccessories (e) {
if (e.returnvalue.props.channel && changedChannels[e.returnvalue.props.channel.id] && this.settings.places.chatWindow) { if (!this.settings.places.chatWindow || !e.instance.props.channel || !changedChannels[e.instance.props.channel.id]) return;
e.returnvalue.props.channel = this.getChannelData(e.returnvalue.props.channel.id); if (!e.returnvalue) e.instance.props.channel = this.getChannelData(e.instance.props.channel.id);
let type = e.returnvalue.type; else {
e.returnvalue.type = BDFDB.TimeUtils.suppress((...args) => { let channelName = BDFDB.ReactUtils.findChild(e.returnvalue, {props: [["className", BDFDB.disCN.messagesystemname]]});
let returnValue = type(...args); if (channelName) this.changeChannelColor(channelName, e.instance.props.channel.id);
let channelName = BDFDB.ReactUtils.findChild(returnValue, {props: [["className", BDFDB.disCN.messagesystemname]]});
this.changeChannelColor(channelName, e.instance.props.message.messageReference.channel_id);
return returnValue;
}, "Error in Type Render of ThreadMessageAccessories!", this);
} }
} }
processAutocompleteChannelResult (e) { processAutocompleteChannelResult (e) {
if (e.instance.props.channel && this.settings.places.autocompletes) { if (!this.settings.places.autocompletes || !e.instance.props.channel) return;
if (!e.returnvalue) { if (!e.returnvalue) {
if (e.instance.props.category) e.instance.props.category = this.getChannelData(e.instance.props.category.id); if (e.instance.props.category) e.instance.props.category = this.getChannelData(e.instance.props.category.id);
e.instance.props.channel = this.getChannelData(e.instance.props.channel.id); e.instance.props.channel = this.getChannelData(e.instance.props.channel.id);
} }
else { else if (typeof e.returnvalue.props.children == "function") {
if (typeof e.returnvalue.props.children == "function") {
let childrenRender = e.returnvalue.props.children; let childrenRender = e.returnvalue.props.children;
e.returnvalue.props.children = BDFDB.TimeUtils.suppress((...args) => { e.returnvalue.props.children = BDFDB.TimeUtils.suppress((...args) => {
let modify = Object.assign({}, e.instance.props, e.instance.state); let modify = Object.assign({}, e.instance.props, e.instance.state);
@ -316,46 +318,43 @@ module.exports = (_ => {
return iconChild; return iconChild;
}, "Error in Type of AutocompleteRowIcon!", this); }, "Error in Type of AutocompleteRowIcon!", this);
} }
let channelName = BDFDB.ReactUtils.findChild(children, {name: "AutocompleteRowHeading"}); let channelName = BDFDB.ReactUtils.findChild(children, {name: "AutocompleteRowContentPrimary"});
if (channelName) this.changeChannelColor(channelName, e.instance.props.channel.id, modify); if (channelName) this.changeChannelColor(channelName.props.children, e.instance.props.channel.id, modify);
let categoryName = e.instance.props.category && BDFDB.ReactUtils.findChild(children, {name: "AutocompleteRowContentSecondary"}); let categoryName = e.instance.props.category && BDFDB.ReactUtils.findChild(children, {name: "AutocompleteRowContentSecondary"});
if (categoryName) this.changeChannelColor(categoryName, e.instance.props.category.id, modify); if (categoryName) this.changeChannelColor(categoryName, e.instance.props.category.id, modify);
return children; return children;
}, "Error in Children Render of AutocompleteChannelResult!", this); }, "Error in Children Render of AutocompleteChannelResult!", this);
} }
} }
}
}
processGuildSettingsAuditLogEntry (e) { processAuditLogEntry (e) {
if (!this.settings.places.auditLog) return;
let channel = BDFDB.ObjectUtils.get(e.instance, "props.log.options.channel"); let channel = BDFDB.ObjectUtils.get(e.instance, "props.log.options.channel");
if (channel && this.settings.places.auditLog) { if (!channel) return;
if (!e.returnvalue) e.instance.props.log.options.channel = this.getChannelData(channel.id); if (!e.returnvalue) e.instance.props.log.options.channel = this.getChannelData(channel.id);
else { else {
let channelName = BDFDB.ReactUtils.findChild(e.returnvalue, {props: [["children", [["#" + channel.name]]]]}); let channelName = BDFDB.ReactUtils.findChild(e.returnvalue, {props: [["children", [["#" + channel.name]]]]});
if (channelName) this.changeChannelColor(channelName, channel.id); if (channelName) this.changeChannelColor(channelName, channel.id);
} }
} }
}
processSettingsInvites (e) { processGuildSettingsInvites (e) {
if (BDFDB.ObjectUtils.is(e.instance.props.invites) && this.settings.places.inviteLog) { if (!this.settings.places.inviteLog || !e.instance.props.invites) return;
e.instance.props.invites = Object.assign({}, e.instance.props.invites); e.instance.props.invites = Object.assign({}, e.instance.props.invites);
for (let id in e.instance.props.invites) e.instance.props.invites[id] = new BDFDB.DiscordObjects.Invite(Object.assign({}, e.instance.props.invites[id], {channel: this.getChannelData(e.instance.props.invites[id].channel.id)})); for (let id in e.instance.props.invites) e.instance.props.invites[id] = new BDFDB.DiscordObjects.Invite(Object.assign({}, e.instance.props.invites[id], {channel: this.getChannelData(e.instance.props.invites[id].channel.id)}));
} }
}
processHeaderBarContainer (e) { processHeaderBarContainer (e) {
if (!this.settings.places.channelHeader) return;
let channel = BDFDB.LibraryStores.ChannelStore.getChannel(e.instance.props.channelId); let channel = BDFDB.LibraryStores.ChannelStore.getChannel(e.instance.props.channelId);
if (channel && this.settings.places.channelHeader) { if (!channel) return;
let thread; let thread;
if (BDFDB.ChannelUtils.isThread(channel)) { if (BDFDB.ChannelUtils.isThread(channel)) {
thread = channel; thread = channel;
channel = BDFDB.LibraryStores.ChannelStore.getChannel(thread.parent_id); channel = BDFDB.LibraryStores.ChannelStore.getChannel(thread.parent_id);
} }
if (changedChannels[channel.id] || thread && changedChannels[thread.id]) { if (!changedChannels[channel.id] && !(thread && changedChannels[thread.id])) return;
if (!e.returnvalue) { let channelNames = BDFDB.ReactUtils.findChild(e.returnvalue, {all: true, name: ["HeaderBarTitle", "HeaderBarChannelName"]});
let channelNames = BDFDB.ReactUtils.findChild(e.instance, {all: true, name: ["Title", "ChannelName"]});
if (channelNames.length) { if (channelNames.length) {
if (channelNames[0].props.children) { 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; if (changedChannels[channel.id] && changedChannels[channel.id].name) channelNames[0].props.children = channel.isGroupDM() ? this.getGroupName(channel.id) : this.getChannelData(channel.id).name;
@ -367,9 +366,7 @@ module.exports = (_ => {
this.changeChannelColor(channelNames[1], thread.id); this.changeChannelColor(channelNames[1], thread.id);
} }
} }
} let channelIcons = BDFDB.ReactUtils.findChild(e.returnvalue, {all: true, name: "HeaderBarTitleIcon"});
else {
let channelIcons = BDFDB.ReactUtils.findChild(e.instance, {all: true, name: "Icon"});
if (channelIcons.length) { if (channelIcons.length) {
if (channelIcons[0].props.icon) { if (channelIcons[0].props.icon) {
let iconRender = channelIcons[0].props.icon; let iconRender = channelIcons[0].props.icon;
@ -389,18 +386,15 @@ module.exports = (_ => {
} }
} }
} }
}
}
}
processThreadSidebar (e) { processThreadSidebar (e) {
if (changedChannels[e.instance.props.channelId] && this.settings.places.channelHeader) { if (!this.settings.places.channelHeader || !changedChannels[e.instance.props.channelId]) return;
let channelName = BDFDB.ReactUtils.findChild(e.returnvalue, {name: ["Title", "ChannelName"]}); let channelName = BDFDB.ReactUtils.findChild(e.returnvalue, {name: ["HeaderBarTitle", "HeaderBarChannelName"]});
if (channelName && channelName.props.children) { if (channelName && channelName.props.children) {
if (changedChannels[e.instance.props.channelId].name) channelName.props.children = this.getChannelData(e.instance.props.channelId).name; if (changedChannels[e.instance.props.channelId].name) channelName.props.children = this.getChannelData(e.instance.props.channelId).name;
this.changeChannelColor(channelName, e.instance.props.channelId); this.changeChannelColor(channelName, e.instance.props.channelId);
} }
let [children, index] = BDFDB.ReactUtils.findParent(e.returnvalue, {name: "Icon"}); let [children, index] = BDFDB.ReactUtils.findParent(e.returnvalue, {name: "HeaderBarTitleIcon"});
if (index > -1) { if (index > -1) {
let icon = BDFDB.ReactUtils.createElement(children[index].props.icon, { let icon = BDFDB.ReactUtils.createElement(children[index].props.icon, {
className: BDFDB.disCN.channelheadericon className: BDFDB.disCN.channelheadericon
@ -412,20 +406,18 @@ module.exports = (_ => {
}) })
} }
} }
}
processThreadCard (e) { processThreadCard (e) {
if (changedChannels[e.instance.props.threadId] && this.settings.places.threads) { if (!this.settings.places.threads || !changedChannels[e.instance.props.threadId]) return;
let channelName = BDFDB.ReactUtils.findChild(e.returnvalue, {props: [["className", BDFDB.disCN.threadcardname]]}); let channelName = BDFDB.ReactUtils.findChild(e.returnvalue, {props: [["className", BDFDB.disCN.threadcardname]]});
if (channelName) { if (channelName) {
if (changedChannels[e.instance.props.threadId].name) channelName.props.children = changedChannels[e.instance.props.threadId].name; if (changedChannels[e.instance.props.threadId].name) channelName.props.children = changedChannels[e.instance.props.threadId].name;
this.changeChannelColor(channelName, e.instance.props.threadId); this.changeChannelColor(channelName, e.instance.props.threadId);
} }
} }
}
processFocusRing (e) { processFocusRingScope (e) {
if (e.returnvalue && e.returnvalue.props.className) { if (!e.returnvalue || !e.returnvalue.props.className) return;
let change, hoveredEvents, channelId, nameClass, categoyClass, iconClass, modify = {}; let change, hoveredEvents, channelId, nameClass, categoyClass, iconClass, modify = {};
if (this.settings.places.channelList && e.returnvalue.props.className.indexOf(BDFDB.disCN.categoryiconvisibility) > -1) { if (this.settings.places.channelList && e.returnvalue.props.className.indexOf(BDFDB.disCN.categoryiconvisibility) > -1) {
change = true; change = true;
@ -482,37 +474,29 @@ module.exports = (_ => {
} }
} }
} }
}
processChannelCategoryItem (e) { processChannelsList (e) {
if (e.instance.props.channel && this.settings.places.channelList) e.instance.props.channel = this.getChannelData(e.instance.props.channel.id, true, e.instance.props.channel); if (!this.settings.places.channelList || !e.instance.props.guildChannels) return;
e.instance.props.guildChannels = new e.instance.props.guildChannels.constructor(e.instance.props.guild.id, e.instance.props.guildChannels.communitySection && e.instance.props.guildChannels.communitySection.communityRows || []);
let getCategoryFromSection = e.instance.props.guildChannels.getCategoryFromSection.bind(e.instance.props.guildChannels);
e.instance.props.guildChannels.getCategoryFromSection = BDFDB.TimeUtils.suppress((...args) => {
let returnValue = getCategoryFromSection(...args);
if (returnValue && returnValue.record) returnValue.record = this.getChannelData(returnValue.record.id);
return returnValue;
}, "Error in getCategoryFromSection of ChannelsList!", this);
let getChannelFromSectionRow = e.instance.props.guildChannels.getChannelFromSectionRow.bind(e.instance.props.guildChannels);
e.instance.props.guildChannels.getChannelFromSectionRow = BDFDB.TimeUtils.suppress((...args) => {
let returnValue = getChannelFromSectionRow(...args);
if (returnValue.channel && returnValue.category) returnValue = Object.assign({}, returnValue, {
channel: Object.assign({}, returnValue.channel, {record: this.getChannelData(returnValue.channel.record.id)}),
category: Object.assign({}, returnValue.category, {record: this.getChannelData(returnValue.category.record.id)})
});
return returnValue;
}, "Error in getChannelFromSectionRow of ChannelsList!", this);
} }
processChannelItem (e) { processChannelItem (e) {
if (e.instance.props.channel && this.settings.places.channelList) { if (!this.settings.places.channelList || !e.instance.props.channel) return;
if (!e.returnvalue) {
e.instance.props.channel = this.getChannelData(e.instance.props.channel.id, true, e.instance.props.channel);
let changeColors = (wrapper, props) => {
let color = this.chooseColor(this.getChannelDataColor(e.instance.props.channel.id), props);
let channelName = wrapper.querySelector(BDFDB.dotCN.channelnameinner);
let channelIcon = wrapper.querySelector(BDFDB.dotCN.channelicon);
if (channelName && channelName.firstElementChild) channelName.firstElementChild.style.setProperty("color", color);
if (channelIcon) {
for (let path of channelIcon.querySelectorAll('[path*="rgba("], [path*="rgb("]')) path.setAttribute("path", color);
for (let fill of channelIcon.querySelectorAll('[fill*="rgba("], [fill*="rgb("]')) fill.setAttribute("fill", color);
}
};
let onMouseEnter = e.instance.props.onMouseEnter, onMouseLeave = e.instance.props.onMouseLeave;
e.instance.props.onMouseEnter = BDFDB.TimeUtils.suppress(event => {
changeColors(event.currentTarget, {hovered: true});
return (onMouseEnter || (_ => {}))(event);
}, "Error in onMouseEnter of ChannelItem!", this);
e.instance.props.onMouseLeave = BDFDB.TimeUtils.suppress(event => {
changeColors(event.currentTarget, BDFDB.ObjectUtils.extract(e.instance.props, "muted", "locked", "selected", "unread", "connected", "hovered"));
return (onMouseLeave || (_ => {}))(event);
}, "Error in onMouseLeave of ChannelItem!", this);
}
else {
let modify = BDFDB.ObjectUtils.extract(e.instance.props, "muted", "locked", "selected", "unread", "connected", "hovered"); let modify = BDFDB.ObjectUtils.extract(e.instance.props, "muted", "locked", "selected", "unread", "connected", "hovered");
let channelName = BDFDB.ReactUtils.findChild(e.returnvalue, {props: [["className", BDFDB.disCN.channelnameinner]]}); let channelName = BDFDB.ReactUtils.findChild(e.returnvalue, {props: [["className", BDFDB.disCN.channelnameinner]]});
if (channelName) this.changeChannelColor(channelName, e.instance.props.channel.id, modify); if (channelName) this.changeChannelColor(channelName, e.instance.props.channel.id, modify);
@ -533,11 +517,9 @@ module.exports = (_ => {
}, "Error in Type Render of ChannelItem!", this); }, "Error in Type Render of ChannelItem!", this);
} }
} }
}
}
processGuildSidebarThreadListEntry (e) { processChannelThreadItem (e) {
if (e.instance.props.thread && this.settings.places.channelList) { if (!this.settings.places.channelList || !e.instance.props.thread) return;
if (!e.returnvalue) e.instance.props.thread = this.getChannelData(e.instance.props.thread.id, true, e.instance.props.thread); if (!e.returnvalue) e.instance.props.thread = this.getChannelData(e.instance.props.thread.id, true, e.instance.props.thread);
else { else {
let modify = BDFDB.ObjectUtils.extract(e.instance.props, "muted", "locked", "selected", "unread", "connected", "hovered"); let modify = BDFDB.ObjectUtils.extract(e.instance.props, "muted", "locked", "selected", "unread", "connected", "hovered");
@ -545,10 +527,9 @@ module.exports = (_ => {
if (channelName) this.changeChannelColor(channelName, e.instance.props.thread.id, modify); if (channelName) this.changeChannelColor(channelName, e.instance.props.thread.id, modify);
} }
} }
}
processDirectMessage (e) { processDirectMessage (e) {
if (e.instance.props.channel && e.instance.props.channel.isGroupDM() && this.settings.places.recentDms) { if (!this.settings.places.recentDms || !e.instance.props.channel || !e.instance.props.channel.isGroupDM()) return;
if (changedChannels[e.instance.props.channel.id] && changedChannels[e.instance.props.channel.id].name) { if (changedChannels[e.instance.props.channel.id] && changedChannels[e.instance.props.channel.id].name) {
let tooltip = BDFDB.ReactUtils.findChild(e.returnvalue, {name: "ListItemTooltip"}); let tooltip = BDFDB.ReactUtils.findChild(e.returnvalue, {name: "ListItemTooltip"});
if (tooltip) tooltip.props.text = this.getGroupName(e.instance.props.channel.id); if (tooltip) tooltip.props.text = this.getGroupName(e.instance.props.channel.id);
@ -563,36 +544,33 @@ module.exports = (_ => {
}, "Error in Avatar Render of DirectMessage!", this); }, "Error in Avatar Render of DirectMessage!", this);
} }
} }
}
processPrivateChannel (e) { processPrivateChannel (e) {
if (e.instance.props.channel && e.instance.props.channel.isGroupDM() && this.settings.places.channelList) { if (!this.settings.places.channelList || !e.instance.props.channel || !e.instance.props.channel.isGroupDM()) return;
let wrapper = e.returnvalue && e.returnvalue.props.children && e.returnvalue.props.children.props && typeof e.returnvalue.props.children.props.children == "function" ? e.returnvalue.props.children : e.returnvalue; let wrapper = e.returnvalue && e.returnvalue.props.children && e.returnvalue.props.children.props && typeof e.returnvalue.props.children.props.children == "function" ? e.returnvalue.props.children : e.returnvalue;
if (typeof wrapper.props.children == "function") { if (typeof wrapper.props.children == "function") {
let process = returnvalue => {
const wrapper = returnvalue.props.avatar ? returnvalue : BDFDB.ReactUtils.findChild(returnvalue, {props: ["avatar"]});
if (!wrapper) return;
if (changedChannels[e.instance.props.channel.id] && changedChannels[e.instance.props.channel.id].name) {
wrapper.props.name = BDFDB.ReactUtils.createElement("span", {children: this.getGroupName(e.instance.props.channel.id)});
}
this.changeChannelColor(wrapper.props.name, e.instance.props.channel.id, BDFDB.ObjectUtils.extract(Object.assign({}, e.instance.props, e.instance.state), "hovered", "selected", "hasUnreadMessages", "muted"));
wrapper.props.name = [wrapper.props.name];
if (wrapper.props.avatar) wrapper.props.avatar.props.src = this.getGroupIcon(e.instance.props.channel.id);
};
let childrenRender = wrapper.props.children; let childrenRender = wrapper.props.children;
wrapper.props.children = BDFDB.TimeUtils.suppress((...args) => { wrapper.props.children = BDFDB.TimeUtils.suppress((...args) => {
let children = childrenRender(...args); let children = childrenRender(...args);
this._processPrivateChannel(e.instance, children); process(children);
return children; return children;
}, "Error in Children Render of PrivateChannel!", this); }, "Error in Children Render of PrivateChannel!", this);
} }
else this._processPrivateChannel(e.instance, wrapper); else process(wrapper);
}
}
_processPrivateChannel (instance, returnvalue) {
const wrapper = returnvalue.props.avatar ? returnvalue : BDFDB.ReactUtils.findChild(returnvalue, {props: ["avatar"]});
if (!wrapper) return;
if (changedChannels[instance.props.channel.id] && changedChannels[instance.props.channel.id].name) {
wrapper.props.name = BDFDB.ReactUtils.createElement("span", {children: this.getGroupName(instance.props.channel.id)});
}
this.changeChannelColor(wrapper.props.name, instance.props.channel.id, {modify: BDFDB.ObjectUtils.extract(Object.assign({}, instance.props, instance.state), "hovered", "selected", "hasUnreadMessages", "muted")});
wrapper.props.name = [wrapper.props.name];
if (wrapper.props.avatar) wrapper.props.avatar.props.src = this.getGroupIcon(instance.props.channel.id);
} }
processQuickSwitchChannelResult (e) { processQuickSwitchChannelResult (e) {
if (e.instance.props.channel && this.settings.places.quickSwitcher) { if (!this.settings.places.quickSwitcher || !e.instance.props.channel) return;
if (!e.returnvalue) { if (!e.returnvalue) {
e.instance.props.channel = this.getChannelData(e.instance.props.channel.id); e.instance.props.channel = this.getChannelData(e.instance.props.channel.id);
if (e.instance.props.category) e.instance.props.category = this.getChannelData(e.instance.props.category.id); if (e.instance.props.category) e.instance.props.category = this.getChannelData(e.instance.props.category.id);
@ -609,16 +587,14 @@ module.exports = (_ => {
} }
} }
} }
}
processSearchPopoutComponent (e) { processSearchPopout (e) {
if (BDFDB.ArrayUtils.is(BDFDB.ObjectUtils.get(e, "instance.props.resultsState.autocompletes")) && this.settings.places.searchPopout) { if (!this.settings.places.searchPopout || !BDFDB.ArrayUtils.is(BDFDB.ObjectUtils.get(e, "instance.props.resultsState.autocompletes"))) return;
for (let autocomplete of e.instance.props.resultsState.autocompletes) if (autocomplete && BDFDB.ArrayUtils.is(autocomplete.results)) for (let result of autocomplete.results) if (result.channel) result.channel = this.getChannelData(result.channel.id); for (let autocomplete of e.instance.props.resultsState.autocompletes) if (autocomplete && BDFDB.ArrayUtils.is(autocomplete.results)) for (let result of autocomplete.results) if (result.channel) result.channel = this.getChannelData(result.channel.id);
} }
}
processSearchResultsInner (e) { processSearchResultsInner (e) {
if (this.settings.places.searchResults) { if (!this.settings.places.searchResults) return;
let results = BDFDB.ReactUtils.findChild(e.returnvalue, {props: [["id", "search-results"]]}); let results = BDFDB.ReactUtils.findChild(e.returnvalue, {props: [["id", "search-results"]]});
if (results && BDFDB.ArrayUtils.is(results.props.children)) for (let group of results.props.children) { if (results && BDFDB.ArrayUtils.is(results.props.children)) for (let group of results.props.children) {
let channelId = (BDFDB.ObjectUtils.get(group, "props.children.key") || "").split("-")[0]; let channelId = (BDFDB.ObjectUtils.get(group, "props.children.key") || "").split("-")[0];
@ -629,35 +605,30 @@ module.exports = (_ => {
} }
} }
} }
}
processRecentsChannelHeader (e) { processRecentsChannelHeader (e) {
if (this.settings.places.recentMentions && BDFDB.ArrayUtils.is(e.returnvalue.props.children)) { if (!this.settings.places.recentMentions || !e.instance.props.channel) return;
for (let child of e.returnvalue.props.children) if (child && child.props && child.props.channel && child.type.displayName == "ChannelName") { if (!e.returnvalue) e.instance.props.channel = this.getChannelData(e.instance.props.channel.id);
child.props.channel = this.getChannelData(child.props.channel.id); else {
let oldType = child.type; let [children, index] = BDFDB.ReactUtils.findParent(e.returnvalue, {props: [["className", BDFDB.disCN.recentmentionschannelnamespan]]});
child.type = (...args) => { if (index > -1) {
let instance = oldType(...args); this.changeChannelColor(children[index], e.instance.props.channel.id);
let channelName = BDFDB.ReactUtils.findChild(instance, {props: [["className", BDFDB.disCN.recentmentionschannelname]]}); let icon = index > 0 && children[index-1];
if (channelName) this.changeChannelColor(channelName, child.props.channel.id); if (icon && icon.props && icon.props.width) this.changeChannelIconColor(icon, e.instance.props.channel.id);
return instance;
};
child.type.displayName = oldType.displayName;
} }
} }
} }
processMessageContent (e) { processMessageContent (e) {
if (BDFDB.ArrayUtils.is(e.instance.props.content) && this.settings.places.mentions) for (let ele of e.instance.props.content) { if (!this.settings.places.mentions || !BDFDB.ArrayUtils.is(e.instance.props.content)) return;
if (BDFDB.ReactUtils.isValidElement(ele) && ele.type && ele.type.displayName == "Tooltip" && typeof ele.props.children == "function") { for (let ele of e.instance.props.content) if (BDFDB.ReactUtils.isValidElement(ele) && ele.type && ele.type.prototype && ele.type.prototype.renderTooltip && typeof ele.props.children == "function") {
let children = ele.props.children({}); let children = ele.props.children({});
if (children && children.type.displayName == "Mention") { if (!children || !children.props || !children.props.iconType || !children.props.className || children.props.className.indexOf("channelMention") != 0) return;
const checkChild = label => { const checkChild = channelName => {
if (label[0] != "#") return;
let channelName = label.slice(1);
let guildId = BDFDB.LibraryStores.SelectedGuildStore.getGuildId(); let guildId = BDFDB.LibraryStores.SelectedGuildStore.getGuildId();
let channels = guildId && [].concat(BDFDB.LibraryStores.GuildChannelStore.getChannels(guildId).SELECTABLE, Object.keys(BDFDB.LibraryStores.ActiveThreadsStore.getThreadsForGuild(guildId)).map(id => ({channel: BDFDB.LibraryStores.ChannelStore.getChannel(id)}))); let channels = guildId && [].concat(BDFDB.LibraryStores.GuildChannelStore.getChannels(guildId).SELECTABLE, Object.keys(BDFDB.LibraryStores.ActiveThreadsStore.getThreadsForGuild(guildId)).map(id => ({channel: BDFDB.LibraryStores.ChannelStore.getChannel(id)})));
if (BDFDB.ArrayUtils.is(channels)) for (let channelObj of channels) { if (!BDFDB.ArrayUtils.is(channels)) return;
for (let channelObj of channels) {
if (channelName == channelObj.channel.name) { if (channelName == channelObj.channel.name) {
let category = BDFDB.LibraryStores.ChannelStore.getChannel(channelObj.channel.parent_id); let category = BDFDB.LibraryStores.ChannelStore.getChannel(channelObj.channel.parent_id);
if (!category || category && ele.props.text == category.name) { if (!category || category && ele.props.text == category.name) {
@ -669,11 +640,11 @@ module.exports = (_ => {
let color = this.getChannelDataColor(channelObj.channel.id); let color = this.getChannelDataColor(channelObj.channel.id);
if (name || color) { if (name || color) {
let renderChildren = ele.props.children; let renderChildren = ele.props.children;
ele.props.children = (...args) => { ele.props.children = BDFDB.TimeUtils.suppress((...args) => {
let children = renderChildren(...args); let renderedChildren = renderChildren(...args);
this.changeMention(children, {name, color}); this.changeMention(renderedChildren, {name, color});
return children; return renderedChildren;
} }, "Error in Children Render of ChannelMention in MessageContent!", this);
} }
break; break;
} }
@ -687,14 +658,12 @@ module.exports = (_ => {
} }
} }
} }
}
}
processRichChannelMention (e) { processRichChannelMention (e) {
if (e.instance.props.id && this.settings.places.mentions) { if (!this.settings.places.mentions || !e.instance.props.id) return;
let name = (changedChannels[e.instance.props.id] || {}).name; let name = (changedChannels[e.instance.props.id] || {}).name;
let color = this.getChannelDataColor(e.instance.props.id); let color = this.getChannelDataColor(e.instance.props.id);
if (name || color) { if (!name && !color) return;
if (typeof e.returnvalue.props.children == "function") { if (typeof e.returnvalue.props.children == "function") {
let renderChildren = e.returnvalue.props.children; let renderChildren = e.returnvalue.props.children;
e.returnvalue.props.children = BDFDB.TimeUtils.suppress((...args) => { e.returnvalue.props.children = BDFDB.TimeUtils.suppress((...args) => {
@ -705,6 +674,14 @@ module.exports = (_ => {
} }
else this.changeMention(e.returnvalue, {name, color}); else this.changeMention(e.returnvalue, {name, color});
} }
changeAppTitle () {
if (!this.settings.places.appTitle) return;
let channel = BDFDB.LibraryStores.ChannelStore.getChannel(BDFDB.LibraryStores.SelectedChannelStore.getChannelId());
let title = document.head.querySelector("title");
if (title && channel && (document.location.href || "").indexOf(channel.id) > -1 && changedChannels[channel.id] && changedChannels[channel.id].name) {
if (channel.isGroupDM()) BDFDB.DOMUtils.setText(title, this.getGroupName(channel.id));
else BDFDB.DOMUtils.setText(title, (BDFDB.ChannelUtils.isTextChannel(channel) ? "#" : "") + this.getChannelData(channel.id).name);
} }
} }
@ -720,27 +697,20 @@ module.exports = (_ => {
} }
else changeMentionName(child[i]); else changeMentionName(child[i]);
} }
else if (child.props && typeof child.props.children == "string" && child.props.children[0] == "#") child.props.children = "#" + data.name; else if (child.props) {
else if (child.props && BDFDB.ArrayUtils.is(child.props.children)) changeMentionName(child.props.children); if (child.props.iconType && typeof child.props.children == "string") child.props.children = data.name;
else if (child.props.iconType && BDFDB.ArrayUtils.is(child.props.children) && child.props.children.length == 1) child.props.children = [data.name];
else if (typeof child.props.children == "string" && child.props.children[0] == "#") child.props.children = "#" + data.name;
else if (BDFDB.ArrayUtils.is(child.props.children)) changeMentionName(child.props.children);
}
}; };
changeMentionName(mention); changeMentionName(mention);
} }
if (data.color) mention.props.color = BDFDB.ColorUtils.convert(BDFDB.ObjectUtils.is(data.color) ? data.color[0] : data.color, "INT"); if (data.color) mention.props.color = BDFDB.ColorUtils.convert(BDFDB.ObjectUtils.is(data.color) ? data.color[0] : data.color, "INT");
} }
changeAppTitle () {
if (this.settings.places.appTitle) {
let channel = BDFDB.LibraryStores.ChannelStore.getChannel(BDFDB.LibraryStores.SelectedChannelStore.getChannelId());
let title = document.head.querySelector("title");
if (title && channel && (document.location.href || "").indexOf(channel.id) > -1 && changedChannels[channel.id] && changedChannels[channel.id].name) {
if (channel.isGroupDM()) BDFDB.DOMUtils.setText(title, this.getGroupName(channel.id));
else BDFDB.DOMUtils.setText(title, (BDFDB.ChannelUtils.isTextChannel(channel) ? "#" : "") + this.getChannelData(channel.id).name);
}
}
}
changeChannelColor (child, channelId, modify) { changeChannelColor (child, channelId, modify) {
if (BDFDB.ReactUtils.isValidElement(child)) { if (!BDFDB.ReactUtils.isValidElement(child)) return;
let color = this.getChannelDataColor(channelId); let color = this.getChannelDataColor(channelId);
if (color) { if (color) {
color = modify ? this.chooseColor(color, modify) : BDFDB.ColorUtils.convert(color, "RGBA"); color = modify ? this.chooseColor(color, modify) : BDFDB.ColorUtils.convert(color, "RGBA");
@ -756,13 +726,13 @@ module.exports = (_ => {
}); });
} }
} }
}
changeChannelIconColor (child, channelId, modify) { changeChannelIconColor (child, channelId, modify) {
if (!this.settings.general.changeChannelIcon) return;
let color = child && this.getChannelDataColor(channelId); let color = child && this.getChannelDataColor(channelId);
if (color && this.settings.general.changeChannelIcon) { if (!color) return;
color = modify ? this.chooseColor(BDFDB.ObjectUtils.is(color) ? color[0] : color, modify) : BDFDB.ColorUtils.convert(BDFDB.ObjectUtils.is(color) ? color[0] : color, "RGBA"); color = modify ? this.chooseColor(BDFDB.ObjectUtils.is(color) ? color[0] : color, modify) : BDFDB.ColorUtils.convert(BDFDB.ObjectUtils.is(color) ? color[0] : color, "RGBA");
if (color) { if (!color) return;
child.props.foreground = null; child.props.foreground = null;
child.props.color = color || "currentColor"; child.props.color = color || "currentColor";
child.props.children = [child.props.children].flat(10).filter(n => n); child.props.children = [child.props.children].flat(10).filter(n => n);
@ -771,11 +741,9 @@ module.exports = (_ => {
if (c && c.props && c.props.path == "currentColor") c.props.path = color || "currentColor"; if (c && c.props && c.props.path == "currentColor") c.props.path = color || "currentColor";
} }
} }
}
}
chooseColor (color, config) { chooseColor (color, config) {
if (color) { if (!color) return null;
if (BDFDB.ObjectUtils.is(config)) { if (BDFDB.ObjectUtils.is(config)) {
if (config.focused || config.hovered || config.selected || config.connected) color = BDFDB.ColorUtils.change(color, 0.5); if (config.focused || config.hovered || config.selected || config.connected) color = BDFDB.ColorUtils.change(color, 0.5);
else if (config.muted || config.locked) color = BDFDB.ColorUtils.change(color, -0.5); else if (config.muted || config.locked) color = BDFDB.ColorUtils.change(color, -0.5);
@ -783,8 +751,6 @@ module.exports = (_ => {
} }
return BDFDB.ColorUtils.convert(color, "RGBA"); return BDFDB.ColorUtils.convert(color, "RGBA");
} }
return null;
}
getChannelDataColor (channelId) { getChannelDataColor (channelId) {
if (changedChannels[channelId] && changedChannels[channelId].color) return changedChannels[channelId].color; if (changedChannels[channelId] && changedChannels[channelId].color) return changedChannels[channelId].color;