This commit is contained in:
Mirco Wittrien 2022-02-21 20:15:36 +01:00
parent 0d45f5f815
commit acee10f777
4 changed files with 58 additions and 17 deletions

View File

@ -152,6 +152,42 @@
"ZoomUtils": {"props": ["setZoom", "setFontSize"]}
},
"ModuleUtilsConfig": {
"QueuedComponents": [
"GuildHeaderContextMenu",
"SystemMessageOptionContextMenu",
"SystemMessageOptionToolbar",
"MessageOptionContextMenu",
"MessageOptionToolbar"
],
"ContextMenuTypes": [
"UserSettingsCog",
"UserProfileActions",
"Event",
"GroupDMUser",
"GroupDM",
"DM",
"User",
"Developer",
"Slate",
"GuildSettingsRole",
"GuildDirectoryEntry",
"GuildFolder",
"SystemMessage",
"Message",
"Native",
"Role",
"Guild",
"Channel"
],
"ContextMenuTypesMap": {
"GroupDMUserContextMenu": "DMContextMenu"
},
"ContextMenuSubItemsMap": {
"UserContextMenu": {
"key": "user",
"items": ["useHideNoVideoParticipantsItem", "useHideSelfVideoItem", "usePreviewVideoItem", "useChangeIdentityItem", "useMoveToAudienceItem", "useAddFriendNicknameItem", "useAddNoteItem", "useBlockUserItem", "useCallUserItem", "useFocusVideoItem", "useInviteUserToGuildItems", "useMentionUserItem", "useMessageUserItem", "useUserProfileItem", "useUserRolesItems", "useUserVolumeItem", "useWatchStreamItem"]
}
},
"PatchTypes": [
"before",
"instead",
@ -264,6 +300,7 @@
"QuickSwitchUserResult": "LibraryComponents.QuickSwitchItems.User"
}
},
"ForceLoadedComponents": {},
"NativeSubComponents": {
"Button": {"props": ["Colors", "Hovers", "Looks"]},
"Checkbox": {"name": "Checkbox"},

View File

@ -184,10 +184,6 @@ module.exports = (_ => {
}
onDMContextMenu (e) {
this.onUserContextMenu(e);
}
onUserContextMenu (e) {
if (e.instance.props.user) {
let [children, index] = BDFDB.ContextMenuUtils.findItem(e.returnvalue, {id: "remove-friend"});
let favorized = favorizedFriends.indexOf(e.instance.props.user.id) > -1;

View File

@ -2,7 +2,7 @@
* @name ImageUtilities
* @author DevilBro
* @authorId 278543574059057154
* @version 4.5.5
* @version 4.5.6
* @description Adds several Utilities for Images/Videos (Gallery, Download, Reverse Search, Zoom, Copy, etc.)
* @invite Jx3TjNS
* @donate https://www.paypal.me/MircoWittrien
@ -17,7 +17,7 @@ module.exports = (_ => {
"info": {
"name": "ImageUtilities",
"author": "DevilBro",
"version": "4.5.5",
"version": "4.5.6",
"description": "Adds several Utilities for Images/Videos (Gallery, Download, Reverse Search, Zoom, Copy, etc.)"
}
};
@ -508,7 +508,17 @@ module.exports = (_ => {
}
onUserContextMenu (e) {
if (e.instance.props.user && this.settings.places.userAvatars) this.injectItem(e, (e.instance.props.user.getAvatarURL(e.instance.props.guildId, 4096) || "").replace(/\.webp|\.gif/, ".png"), BDFDB.LibraryModules.IconUtils.isAnimatedIconHash(e.instance.props.user.avatar) && e.instance.props.user.getAvatarURL(e.instance.props.guildId, 4096, true));
if (e.instance.props.user && this.settings.places.userAvatars && e.subType == "useUserRolesItems") {
let validUrls = this.filterUrls((e.instance.props.user.getAvatarURL(e.instance.props.guildId, 4096) || "").replace(/\.webp|\.gif/, ".png"), BDFDB.LibraryModules.IconUtils.isAnimatedIconHash(e.instance.props.user.avatar) && e.instance.props.user.getAvatarURL(e.instance.props.guildId, 4096, true));
if (!validUrls.length) return;
if (e.returnvalue.length) e.returnvalue.push(BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuSeparator, {}));
e.returnvalue.push(BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
label: this.isValid(validUrls[0].file, "video") ? BDFDB.LanguageUtils.LanguageStrings.VIDEO : BDFDB.LanguageUtils.LanguageStrings.IMAGE + " " + BDFDB.LanguageUtils.LanguageStrings.ACTIONS,
id: BDFDB.ContextMenuUtils.createItemId(this.name, "main-subitem"),
children: this.createSubMenus(e.instance, validUrls)
}));
}
}
onGroupDMContextMenu (e) {

View File

@ -2,7 +2,7 @@
* @name UserNotes
* @author DevilBro
* @authorId 278543574059057154
* @version 1.0.7
* @version 1.0.8
* @description Allows you to write User Notes locally
* @invite Jx3TjNS
* @donate https://www.paypal.me/MircoWittrien
@ -17,7 +17,7 @@ module.exports = (_ => {
"info": {
"name": "UserNotes",
"author": "DevilBro",
"version": "1.0.7",
"version": "1.0.8",
"description": "Allows you to write User Notes locally"
}
};
@ -106,14 +106,12 @@ module.exports = (_ => {
}
onUserContextMenu (e) {
if (e.instance.props.user) {
let [children, index] = BDFDB.ContextMenuUtils.findItem(e.returnvalue, {id: "devmode-copy-id", group: true});
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.user_note,
id: BDFDB.ContextMenuUtils.createItemId(this.name, "user-note"),
action: _ => this.openNotesModal(e.instance.props.user)
})
if (e.instance.props.user && e.subType == "useUserRolesItems") {
if (e.returnvalue.length) e.returnvalue.push(BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuSeparator, {}));
e.returnvalue.push(BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
label: this.labels.user_note,
id: BDFDB.ContextMenuUtils.createItemId(this.name, "user-note"),
action: _ => this.openNotesModal(e.instance.props.user)
}));
}
}