This commit is contained in:
Mirco Wittrien 2022-07-08 17:04:44 +02:00
parent 3976f2a40e
commit 86cf08fb29
3 changed files with 40 additions and 56 deletions

View File

@ -187,12 +187,13 @@
"Channel" "Channel"
], ],
"ContextMenuTypesMap": { "ContextMenuTypesMap": {
"GroupDMUserContextMenu": "UserContextMenu" "GroupDMUserContextMenu": "UserContextMenu",
"GroupDMContextMenu": "ChannelContextMenu"
}, },
"ContextMenuSubItemsMap": { "ContextMenuSubItemsMap": {
"ChannelContextMenu": { "ChannelContextMenu": {
"keys": ["channel"], "keys": ["channel"],
"items": ["useChannelFavoriteSetNickname", "useChannelGoToOriginalGuildItem", "useChannelCloneItem", "useChannelCopyLinkItem", "useChannelEditItem", "useChannelMarkAsReadItem"] "items": ["useChannelLeaveItem", "useChannelDeleteItem", "useChannelFavoriteSetNickname", "useChannelGoToOriginalGuildItem", "useChannelCloneItem", "useChannelCopyLinkItem", "useChannelEditItem", "useChannelMarkAsReadItem"]
}, },
"UserContextMenu": { "UserContextMenu": {
"keys": ["user", "channel"], "keys": ["user", "channel"],
@ -224,7 +225,7 @@
"useMuteChannelItem": {"strings": ["DM", "MenuItem", "Messages.MUTE_CHANNEL"], "lazyLoaded": true}, "useMuteChannelItem": {"strings": ["DM", "MenuItem", "Messages.MUTE_CHANNEL"], "lazyLoaded": true},
"useUserManagementItems": {"strings": ["canManageUser", "MenuItem", "Messages.BAN_USER"], "lazyLoaded": true}, "useUserManagementItems": {"strings": ["canManageUser", "MenuItem", "Messages.BAN_USER"], "lazyLoaded": true},
"useUserRelationshipItems": {"strings": ["ContextMenu", "isFriend", "addRelationship", "Messages.REMOVE_FRIEND"], "lazyLoaded": true}, "useUserRelationshipItems": {"strings": ["ContextMenu", "isFriend", "addRelationship", "Messages.REMOVE_FRIEND"], "lazyLoaded": true},
"useInviteItem": {"strings": ["CREATE_INSTANT_INVITE", "invite-people"]}, "useInviteItem": {"strings": ["CREATE_INSTANT_INVITE", "invite-people"], "lazyLoaded": true},
"Account": {"class": "accountinfo"}, "Account": {"class": "accountinfo"},
"App": {"class": "app"}, "App": {"class": "app"},
"AppSkeleton": {"class": "app"}, "AppSkeleton": {"class": "app"},

View File

@ -2,7 +2,7 @@
* @name EditChannels * @name EditChannels
* @author DevilBro * @author DevilBro
* @authorId 278543574059057154 * @authorId 278543574059057154
* @version 4.3.8 * @version 4.3.9
* @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
@ -17,7 +17,7 @@ module.exports = (_ => {
"info": { "info": {
"name": "EditChannels", "name": "EditChannels",
"author": "DevilBro", "author": "DevilBro",
"version": "4.3.8", "version": "4.3.9",
"description": "Allows you to locally edit Channels" "description": "Allows you to locally edit Channels"
} }
}; };
@ -222,45 +222,33 @@ module.exports = (_ => {
} }
onChannelContextMenu (e) { onChannelContextMenu (e) {
this.injectItem(e); if (e.instance.props.channel && (e.subType == "useChannelDeleteItem" || e.subType == "useChannelLeaveItem")) {
} if (e.returnvalue.length > 0) e.returnvalue.unshift(BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuSeparator, {}));
e.returnvalue.unshift(BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
onGroupDMContextMenu (e) { label: this.labels.context_localchannelsettings,
this.injectItem(e); id: BDFDB.ContextMenuUtils.createItemId(this.name, "settings-submenu"),
} children: BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuGroup, {
children: [
injectItem (e) { BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
if (e.instance.props.channel) { label: this.labels.submenu_channelsettings,
let [children, index] = BDFDB.ContextMenuUtils.findItem(e.returnvalue, {id: "devmode-copy-id", group: true}); id: BDFDB.ContextMenuUtils.createItemId(this.name, "settings-change"),
children.splice(index > -1 ? index : children.length, 0, BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuGroup, { action: _ => this.openChannelSettingsModal(e.instance.props.channel)
children: BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, { }),
label: this.labels.context_localchannelsettings, BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
id: BDFDB.ContextMenuUtils.createItemId(this.name, "settings-submenu"), label: this.labels.submenu_resetsettings,
children: BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuGroup, { id: BDFDB.ContextMenuUtils.createItemId(this.name, "settings-reset"),
children: [ color: BDFDB.LibraryComponents.MenuItems.Colors.DANGER,
BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, { disabled: !changedChannels[e.instance.props.channel.id],
label: this.labels.submenu_channelsettings, action: event => {
id: BDFDB.ContextMenuUtils.createItemId(this.name, "settings-change"), let remove = _ => {
action: _ => { BDFDB.DataUtils.remove(this, "channels", e.instance.props.channel.id);
this.openChannelSettingsModal(e.instance.props.channel); this.forceUpdateAll(true);
} };
}), if (event.shiftKey) remove();
BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, { else BDFDB.ModalUtils.confirm(this, this.labels.confirm_reset, remove);
label: this.labels.submenu_resetsettings, }
id: BDFDB.ContextMenuUtils.createItemId(this.name, "settings-reset"), })
color: BDFDB.LibraryComponents.MenuItems.Colors.DANGER, ]
disabled: !changedChannels[e.instance.props.channel.id],
action: event => {
let remove = _ => {
BDFDB.DataUtils.remove(this, "channels", e.instance.props.channel.id);
this.forceUpdateAll(true);
};
if (event.shiftKey) remove();
else BDFDB.ModalUtils.confirm(this, this.labels.confirm_reset, remove);
}
})
]
})
}) })
})); }));
} }

View File

@ -2,7 +2,7 @@
* @name PinDMs * @name PinDMs
* @author DevilBro * @author DevilBro
* @authorId 278543574059057154 * @authorId 278543574059057154
* @version 1.9.1 * @version 1.9.2
* @description Allows you to pin DMs, making them appear at the top of your DMs/ServerList * @description Allows you to pin DMs, making them appear at the top of your DMs/ServerList
* @invite Jx3TjNS * @invite Jx3TjNS
* @donate https://www.paypal.me/MircoWittrien * @donate https://www.paypal.me/MircoWittrien
@ -17,13 +17,8 @@ module.exports = (_ => {
"info": { "info": {
"name": "PinDMs", "name": "PinDMs",
"author": "DevilBro", "author": "DevilBro",
"version": "1.9.1", "version": "1.9.2",
"description": "Allows you to pin DMs, making them appear at the top of your DMs/ServerList" "description": "Allows you to pin DMs, making them appear at the top of your DMs/ServerList"
},
"changeLog": {
"added": {
"Predefined Group for Bots": ""
}
} }
}; };
@ -259,13 +254,13 @@ module.exports = (_ => {
} }
onUserContextMenu (e) { onUserContextMenu (e) {
if (e.instance.props.channel && e.subType == "useCloseDMItem") e.returnvalue.unshift(this.createItem(e.instance.props.channel.id)); if (e.instance.props.channel && !e.instance.props.channel.guild_id && e.subType == "useCloseDMItem") e.returnvalue.unshift(this.createItem(e.instance.props.channel.id));
} }
onGroupDMContextMenu (e) { onChannelContextMenu (e) {
if (e.instance.props.channel) { if (e.instance.props.channel && !e.instance.props.channel.guild_id && e.instance.props.channel.isGroupDM() && e.subType == "useChannelMarkAsReadItem") {
let [children, index] = BDFDB.ContextMenuUtils.findItem(e.returnvalue, {id: "change-icon"}); if (e.returnvalue.length > 0) e.returnvalue.push(BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuSeparator, {}));
if (index > -1) children.splice(index + 1, 0, this.createItem(e.instance.props.channel.id)); e.returnvalue.push(this.createItem(e.instance.props.channel.id));
} }
} }