Update EditChannels.plugin.js
This commit is contained in:
parent
cdac2327fc
commit
0dd74ab79d
|
@ -14,7 +14,7 @@ module.exports = (_ => {
|
||||||
"info": {
|
"info": {
|
||||||
"name": "EditChannels",
|
"name": "EditChannels",
|
||||||
"author": "DevilBro",
|
"author": "DevilBro",
|
||||||
"version": "4.2.4",
|
"version": "4.2.5",
|
||||||
"description": "Allow you to rename and recolor channelnames"
|
"description": "Allow you to rename and recolor channelnames"
|
||||||
},
|
},
|
||||||
"changeLog": {
|
"changeLog": {
|
||||||
|
@ -78,7 +78,9 @@ module.exports = (_ => {
|
||||||
changeInAutoComplete: {value: true, inner: true, description: "Autocomplete Menu"},
|
changeInAutoComplete: {value: true, inner: true, description: "Autocomplete Menu"},
|
||||||
changeInAuditLog: {value: true, inner: true, description: "Audit Log"},
|
changeInAuditLog: {value: true, inner: true, description: "Audit Log"},
|
||||||
changeInInviteLog: {value: true, inner: true, description: "Invite Log"},
|
changeInInviteLog: {value: true, inner: true, description: "Invite Log"},
|
||||||
changeInQuickSwitcher: {value: true, inner: true, description: "Quick Switcher"}
|
changeInQuickSwitcher: {value: true, inner: true, description: "Quick Switcher"},
|
||||||
|
changeInSearchResults: {value: true, inner: true, description: "Search Results"},
|
||||||
|
changeInSearchPopout: {value: true, inner: true, description: "Search Popout"}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -92,6 +94,7 @@ module.exports = (_ => {
|
||||||
ChannelCategoryItem: "type",
|
ChannelCategoryItem: "type",
|
||||||
ChannelItem: "default",
|
ChannelItem: "default",
|
||||||
QuickSwitchChannelResult: "render",
|
QuickSwitchChannelResult: "render",
|
||||||
|
SearchPopoutComponent: "render",
|
||||||
MessageContent: "type"
|
MessageContent: "type"
|
||||||
},
|
},
|
||||||
after: {
|
after: {
|
||||||
|
@ -103,6 +106,7 @@ module.exports = (_ => {
|
||||||
DirectMessage: "render",
|
DirectMessage: "render",
|
||||||
PrivateChannel: "render",
|
PrivateChannel: "render",
|
||||||
QuickSwitchChannelResult: "render",
|
QuickSwitchChannelResult: "render",
|
||||||
|
SearchResultsInner: "default",
|
||||||
RecentsChannelHeader: "default",
|
RecentsChannelHeader: "default",
|
||||||
ChannelMention: "ChannelMention"
|
ChannelMention: "ChannelMention"
|
||||||
}
|
}
|
||||||
|
@ -110,7 +114,8 @@ module.exports = (_ => {
|
||||||
|
|
||||||
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"] {
|
||||||
text-decoration: underline;
|
text-decoration: underline;
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
@ -317,15 +322,40 @@ module.exports = (_ => {
|
||||||
}
|
}
|
||||||
|
|
||||||
processFocusRing (e) {
|
processFocusRing (e) {
|
||||||
if (e.returnvalue && e.returnvalue.props && e.returnvalue.props.className && e.returnvalue.props.className.indexOf(BDFDB.disCN.categoryiconvisibility) > -1 && settings.changeInChannelList) {
|
if (e.returnvalue && e.returnvalue.props.className) {
|
||||||
let dataListId = BDFDB.ObjectUtils.get(e.returnvalue, "props.children.0.props.data-list-item-id");
|
let change, channelId, nameClass, categoyClass, iconClass, modify = {};
|
||||||
if (dataListId) {
|
if (settings.changeInChannelList && e.returnvalue.props.className.indexOf(BDFDB.disCN.categoryiconvisibility) > -1) {
|
||||||
let channelId = dataListId.split("_").pop();
|
change = true;
|
||||||
let modify = {muted: BDFDB.LibraryModules.MutedUtils.isGuildOrCategoryOrChannelMuted(BDFDB.LibraryModules.LastGuildStore.getGuildId(), channelId)};
|
channelId = BDFDB.ReactUtils.findValue(e.returnvalue, "data-list-item-id")?.split("_").pop();
|
||||||
let categoryName = BDFDB.ReactUtils.findChild(e.returnvalue, {props: [["className", BDFDB.disCN.categoryname]]});
|
nameClass = BDFDB.disCN.categoryname;
|
||||||
if (categoryName) this.changeChannelColor(categoryName.props && categoryName.props.children || categoryName, channelId, modify);
|
iconClass = BDFDB.disCN.categoryicon;
|
||||||
let categoryIcon = BDFDB.ReactUtils.findChild(e.returnvalue, {props: [["className", BDFDB.disCN.categoryicon]]});
|
modify = {muted: BDFDB.LibraryModules.MutedUtils.isGuildOrCategoryOrChannelMuted(BDFDB.LibraryModules.LastGuildStore.getGuildId(), channelId)};
|
||||||
if (categoryIcon) this.changeChannelIconColor(categoryIcon, channelId, Object.assign({alpha: 0.6}, modify));
|
}
|
||||||
|
else if (settings.changeInSearchPopout && e.returnvalue.props.className.indexOf(BDFDB.disCN.searchpopoutoption) > -1) {
|
||||||
|
change = true;
|
||||||
|
channelId = BDFDB.ReactUtils.findValue(e.returnvalue._owner, "result", {up: true})?.channel.id;
|
||||||
|
nameClass = BDFDB.disCN.searchpopoutresultchannel;
|
||||||
|
categoyClass = BDFDB.disCN.searchpopoutsearchresultchannelcategory;
|
||||||
|
iconClass = BDFDB.disCN.searchpopoutsearchresultchannelicon;
|
||||||
|
}
|
||||||
|
if (change) {
|
||||||
|
if (changedChannels[channelId]) {
|
||||||
|
let name = nameClass && BDFDB.ReactUtils.findChild(e.returnvalue, {props: [["className", nameClass]]});
|
||||||
|
if (name) {
|
||||||
|
name = name.props && name.props.children || name;
|
||||||
|
this.changeChannelColor(BDFDB.ArrayUtils.is(name) ? name.find(c => c.type == "strong") || name[0] : name, channelId, modify);
|
||||||
|
}
|
||||||
|
let icon = iconClass && BDFDB.ReactUtils.findChild(e.returnvalue, {props: [["className", iconClass]]});
|
||||||
|
if (icon) this.changeChannelIconColor(icon, channelId, Object.assign({alpha: 0.6}, modify));
|
||||||
|
}
|
||||||
|
let categoryId = BDFDB.LibraryModules.ChannelStore.getChannel(channelId)?.parent_id;
|
||||||
|
if (categoryId && changedChannels[categoryId]) {
|
||||||
|
let categoryName = categoyClass && BDFDB.ReactUtils.findChild(e.returnvalue, {props: [["className", categoyClass]]});
|
||||||
|
if (categoryName) {
|
||||||
|
categoryName.props.children = this.getChannelData(categoryId).name;
|
||||||
|
this.changeChannelColor(categoryName, categoryId, modify);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -406,6 +436,26 @@ module.exports = (_ => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
processSearchPopoutComponent (e) {
|
||||||
|
if (BDFDB.ArrayUtils.is(BDFDB.ObjectUtils.get(e, "instance.props.resultsState.autocompletes")) && settings.changeInSearchPopout) {
|
||||||
|
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) {
|
||||||
|
if (settings.changeInSearchResults) {
|
||||||
|
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) {
|
||||||
|
let channelId = BDFDB.ObjectUtils.get(group, "props.children.key")?.split("-")[0];
|
||||||
|
let channelName = channelId && changedChannels[channelId] && BDFDB.ReactUtils.findChild(group, {props: [["className", BDFDB.disCN.searchresultschannelname]]});
|
||||||
|
if (channelName) {
|
||||||
|
if (changedChannels[channelId].name) channelName.props.children = "#" + changedChannels[channelId].name;
|
||||||
|
this.changeChannelColor(channelName, channelId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
processRecentsChannelHeader (e) {
|
processRecentsChannelHeader (e) {
|
||||||
if (settings.changeInRecentMentions && BDFDB.ArrayUtils.is(e.returnvalue.props.children)) {
|
if (settings.changeInRecentMentions && BDFDB.ArrayUtils.is(e.returnvalue.props.children)) {
|
||||||
for (let child of e.returnvalue.props.children) if (child && child.props && child.props.channel && child.type.displayName == "ChannelName") {
|
for (let child of e.returnvalue.props.children) if (child && child.props && child.props.channel && child.type.displayName == "ChannelName") {
|
||||||
|
|
Loading…
Reference in New Issue