This commit is contained in:
Mirco Wittrien 2023-10-31 10:04:40 +01:00
parent df124ebc41
commit 715ec0957b
2 changed files with 20 additions and 29 deletions

View File

@ -453,7 +453,7 @@
"FolderHeader": {"strings": ["folderNode:", "expandedFolderIconWrapper", "forceCircular"]}, "FolderHeader": {"strings": ["folderNode:", "expandedFolderIconWrapper", "forceCircular"]},
"FolderIcon": {"strings": ["folderNode:", "folderIconWrapper", "closedFolderIconWrapper"]}, "FolderIcon": {"strings": ["folderNode:", "folderIconWrapper", "closedFolderIconWrapper"]},
"FolderItem": {"strings": ["folderNode:", "expandedFolderBackground", "onExpandCollapse"]}, "FolderItem": {"strings": ["folderNode:", "expandedFolderBackground", "onExpandCollapse"]},
"FolderItemWrapper": {"strings": ["folderNode:", "getCurrentUserActiveStream", "defaultFolderName:"]}, "FolderItemWrapper": {"strings": ["folderNode:", "isFolderExpanded", "defaultFolderName:"]},
"FolderSettingsModal": {"strings": [".handleNameChange=", ".handleSubmit", "folderName:"]}, "FolderSettingsModal": {"strings": [".handleNameChange=", ".handleSubmit", "folderName:"]},
"GuildBans": {"strings": [".Messages.BANS_NO_USERS_BANNED", ".Messages.BANS_SEARCH_PLACEHOLDER", ".getSortedBans"]}, "GuildBans": {"strings": [".Messages.BANS_NO_USERS_BANNED", ".Messages.BANS_SEARCH_PLACEHOLDER", ".getSortedBans"]},
"GuildChannelListContextMenu": {"strings": ["GUILD_ACTIONS_MENU_LABEL", "\"guild-context\",\"aria-label\""]}, "GuildChannelListContextMenu": {"strings": ["GUILD_ACTIONS_MENU_LABEL", "\"guild-context\",\"aria-label\""]},

View File

@ -2,7 +2,7 @@
* @name DisplayServersAsChannels * @name DisplayServersAsChannels
* @author DevilBro * @author DevilBro
* @authorId 278543574059057154 * @authorId 278543574059057154
* @version 1.7.1 * @version 1.7.2
* @description Displays Servers in a similar way as Channels * @description Displays Servers in a similar way as Channels
* @invite Jx3TjNS * @invite Jx3TjNS
* @donate https://www.paypal.me/MircoWittrien * @donate https://www.paypal.me/MircoWittrien
@ -79,6 +79,7 @@ module.exports = (_ => {
"CircleIconButton", "CircleIconButton",
"DirectMessage", "DirectMessage",
"FolderHeader", "FolderHeader",
"FolderIcon",
"FolderItemWrapper", "FolderItemWrapper",
"GuildFavorites", "GuildFavorites",
"GuildItem", "GuildItem",
@ -209,10 +210,10 @@ module.exports = (_ => {
e.returnvalue = this.removeMask(e.returnvalue); e.returnvalue = this.removeMask(e.returnvalue);
this.addElementName(e.returnvalue, e.instance.props.guild.name, { this.addElementName(e.returnvalue, e.instance.props.guild.name, {
badges: [ badges: [
this.settings.general.showGuildIcon && BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.GuildIconComponents.Icon, { this.settings.general.showGuildIcon && BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.GuildIcon, {
animate: e.instance.props.animatable && e.instance.state && e.instance.state.hovered, animate: e.instance.props.animatable && e.instance.state && e.instance.state.hovered,
guild: e.instance.props.guild, guild: e.instance.props.guild,
size: BDFDB.LibraryComponents.GuildIconComponents.Icon.Sizes.SMALLER size: BDFDB.LibraryComponents.GuildIcon.Sizes.SMALLER
}), }),
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.GuildBadge, { BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.GuildBadge, {
size: this.settings.amounts.serverElementHeight * 0.5, size: this.settings.amounts.serverElementHeight * 0.5,
@ -228,17 +229,19 @@ module.exports = (_ => {
processFolderHeader (e) { processFolderHeader (e) {
if (!e.instance.props.folderNode) return; if (!e.instance.props.folderNode) return;
e.returnvalue = this.removeMask(e.returnvalue, true); e.returnvalue = this.removeMask(e.returnvalue, true);
}
processFolderIcon (e) {
if (!e.instance.props.folderNode) return;
let folderColor = BDFDB.ColorUtils.convert(e.instance.props.folderNode.color, "HEX") || BDFDB.ColorUtils.convert(BDFDB.DiscordConstants.Colors.BRAND, "RGB"); let folderColor = BDFDB.ColorUtils.convert(e.instance.props.folderNode.color, "HEX") || BDFDB.ColorUtils.convert(BDFDB.DiscordConstants.Colors.BRAND, "RGB");
let folderSize = Math.round(this.settings.amounts.serverElementHeight * 0.725); let folderSize = Math.round(this.settings.amounts.serverElementHeight * 0.725);
let badge = null; let badge = null;
let [children, index] = BDFDB.ReactUtils.findParent(e.returnvalue, {props: [["className", BDFDB.disCN.guildfoldericonwrapper]]}); let [children, index] = BDFDB.ReactUtils.findParent(e.returnvalue, {props: [["className", BDFDB.disCN.guildfoldericonwrapper]]});
if (index > -1 && children[index] && children[index].props && children[index].props.style && children[index].props.style.background) badge = children[index]; if (index > -1 && children[index] && children[index].props && children[index].props.style && children[index].props.style.background) badge = children[index];
else { e.returnvalue = BDFDB.ReactUtils.createElement("div", {});
[children, index] = BDFDB.ReactUtils.findParent(e.returnvalue, {name: "FolderIcon"});
if (index > -1) children[index] = null;
}
this.addElementName(e.returnvalue, e.instance.props.folderNode.name || BDFDB.LanguageUtils.LanguageStrings.SERVER_FOLDER_PLACEHOLDER, { this.addElementName(e.returnvalue, e.instance.props.folderNode.name || BDFDB.LanguageUtils.LanguageStrings.SERVER_FOLDER_PLACEHOLDER, {
wrap: true, wrap: true,
useReturn: true,
backgroundColor: e.instance.props.expanded && BDFDB.ColorUtils.setAlpha(folderColor, 0.2), backgroundColor: e.instance.props.expanded && BDFDB.ColorUtils.setAlpha(folderColor, 0.2),
badges: badge || BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SvgIcon, { badges: badge || BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SvgIcon, {
color: folderColor, color: folderColor,
@ -259,25 +262,12 @@ module.exports = (_ => {
} }
processCircleIconButton (e) { processCircleIconButton (e) {
const child = BDFDB.ReactUtils.findChild(e.returnvalue, {filter: n => n.props && n.props.id && typeof n.props.children == "function"}); this.removeTooltip(e.returnvalue);
let process = returnvalue => { e.returnvalue = this.removeMask(e.returnvalue);
this.removeTooltip(returnvalue); this.addElementName(e.returnvalue, e.instance.props.tooltip, {
returnvalue = this.removeMask(returnvalue); wrap: true,
this.addElementName(e.returnvalue, e.instance.props.tooltip, { backgroundColor: "transparent"
wrap: true, });
backgroundColor: "transparent"
});
return returnvalue;
};
if (child) {
let renderChildren = child.props.children;
child.props.children = BDFDB.TimeUtils.suppress((...args) => {
let children = BDFDB.ReactUtils.createElement(BDFDB.ReactUtils.Fragment, {children: renderChildren(...args)});
children = process(children);
return children;
});
}
else e.returnvalue = process(e.returnvalue);
} }
processUnavailableGuildsButton (e) { processUnavailableGuildsButton (e) {
@ -342,9 +332,10 @@ module.exports = (_ => {
} }
addElementName (parent, name, options = {}) { addElementName (parent, name, options = {}) {
let [children, index] = BDFDB.ReactUtils.findParent(parent, { let [children, index] = options.useReturn ? [[parent], 0] : BDFDB.ReactUtils.findParent(parent, {
name: ["NavItem", "Clickable"], name: ["NavItem", "Clickable"],
props: [["className", BDFDB.disCN.guildserrorinner]], someProps: true,
props: [["className", BDFDB.disCN.guildserrorinner], ["className", BDFDB.disCN.guildbuttoninner]],
filter: c => c && c.props && (c.props.id == "home" || !isNaN(parseInt(c.props.id))) filter: c => c && c.props && (c.props.id == "home" || !isNaN(parseInt(c.props.id)))
}); });
if (index == -1) return; if (index == -1) return;