This commit is contained in:
Mirco Wittrien 2020-05-19 16:23:18 +02:00
parent f314081fea
commit a912786ac8
5 changed files with 70 additions and 66 deletions

View File

@ -3796,7 +3796,6 @@
colorPickerSwatchSingle: "single-Fbb1wB",
colorPickerSwatchSelected: "selected-f5IVXN",
confirmModal: "confirmModal-t-WDWJ",
contextMenuHint: "hint-BK71lM",
dev: "dev-A7f2Rx",
favButtonContainer: "favbutton-8Fzu45",
guild: "guild-r3yAE_",
@ -3817,6 +3816,7 @@
popoutWrapper: "popout-xwjvsX",
quickSelectWrapper: "quickSelectWrapper-UCfTKz",
quickSelectPopoutWrapper: "quickSelectPopout-u2dtIf",
menuItemHint: "hint-BK71lM",
modalHeaderHasSibling: "hasSiblings-fRyjyl",
modalInnerScrollerLess: "inner-YgPpF3",
modalTabContent: "tabContent-nZ-1U5",
@ -4632,7 +4632,6 @@
contextmenucheckboxdisabled: ["ContextMenuCheckbox", "disabled"],
contextmenucheckboxinner: ["ContextMenuCheckbox", "checkboxInner"],
contextmenucheckboxelement: ["ContextMenuCheckbox", "checkboxElement"],
contextmenuhint: ["BDFDB", "contextMenuHint"],
contextmenuimage: ["ContextMenu", "image"],
contextmenuitem: ["ContextMenu", "item"],
contextmenuitembrand: ["ContextMenu", "brand"],
@ -5080,7 +5079,7 @@
mention: ["NotFound", "mention"],
mentioninteractive: ["NotFound", "mentionInteractive"],
mentionwrapper: ["NotFound", "mentionWrapper"],
menumenu: ["Menu", "menu"],
menu: ["Menu", "menu"],
menuaccommodatescrollbar: ["Menu", "accommodateScrollbar"],
menucaret: ["Menu", "caret"],
menucheck: ["Menu", "check"],
@ -5093,6 +5092,7 @@
menudisabled: ["Menu", "disabled"],
menufocused: ["Menu", "focused"],
menuhideinteraction: ["Menu", "hideInteraction"],
menuhint: ["BDFDB", "menuItemHint"],
menuhintcontainer: ["Menu", "hintContainer"],
menuicon: ["Menu", "icon"],
menuiconcontainer: ["Menu", "iconContainer"],
@ -7438,7 +7438,7 @@
InternalComponents.LibraryComponents.MenuItems.MenuHint = InternalBDFDB.loadPatchedComp("MenuItems.MenuHint") || reactInitialized && class BDFDB_MenuHint extends LibraryModules.React.Component {
render() {
return !this.props.hint ? null : BDFDB.ReactUtils.createElement("div", {
className: BDFDB.disCN.contextmenuhint,
className: BDFDB.disCN.menuhint,
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TextScroller, {
children: this.props.hint
})
@ -8527,7 +8527,7 @@
cursor: pointer;
}
${BDFDB.dotCN.contextmenuhint} {
${BDFDB.dotCN.menuhint} {
width: 42px;
max-width: 42px;
margin-left: 8px;
@ -9534,10 +9534,12 @@
return e.methodArguments[0].id == myGuildId ? e.methodArguments[0].banner : e.callOriginalMethod();
}});
const ContextMenuTypes = ["UserSettingsCog", "User", "Developer", "Slate", "GuildFolder", "GroupDM", "Message", "Native", "Channel", "Guild"];
const ContextMenuTypes = ["UserSettingsCog", "User", "Developer", "Slate", "GuildFolder", "GroupDM", "Message", "Native", "Channel", "Guild"].map(n => n + "ContextMenu");
const ExtraPatchedPatches = ["MessageOptionContextMenu", "MessageOptionToolbar"];
const QueuedComponents = BDFDB.ArrayUtils.removeCopies([].concat(ContextMenuTypes, ExtraPatchedPatches));
InternalBDFDB.addContextListeners = function (plugin) {
plugin = plugin == BDFDB && InternalBDFDB || plugin;
for (let type of ContextMenuTypes) if (typeof plugin[`on${type}ContextMenu`] === "function") {
for (let type of QueuedComponents) if (typeof plugin[`on${type}`] === "function") {
BDFDB.InternalData.componentPatchQueries[type].query.push(plugin);
BDFDB.InternalData.componentPatchQueries[type].query = BDFDB.ArrayUtils.removeCopies(BDFDB.InternalData.componentPatchQueries[type].query);
BDFDB.InternalData.componentPatchQueries[type].query.sort((x, y) => {return x.name < y.name ? -1 : x.name > y.name ? 1 : 0;});
@ -9547,7 +9549,7 @@
InternalBDFDB.patchContextMenuForPlugin = function (plugin, type, module) {
plugin = plugin == BDFDB && InternalBDFDB || plugin;
if (module && module.exports && module.exports.default) BDFDB.ModuleUtils.patch(plugin, module.exports, "default", {after: e => {
if (e.returnValue && typeof plugin[`on${type}ContextMenu`] === "function") plugin[`on${type}ContextMenu`]({instance:{props:e.methodArguments[0]}, returnvalue:e.returnValue, methodname:"default"});
if (e.returnValue && typeof plugin[`on${type}`] === "function") plugin[`on${type}`]({instance:{props:e.methodArguments[0]}, returnvalue:e.returnValue, methodname:"default"});
}});
};
InternalBDFDB.patchContextMenuForLib = function (menu, type) {
@ -9564,7 +9566,7 @@
}
};
for (let type of ContextMenuTypes) if (!BDFDB.InternalData.componentPatchQueries[type]) BDFDB.InternalData.componentPatchQueries[type] = {query:[], modules:[]};
for (let type of QueuedComponents) if (!BDFDB.InternalData.componentPatchQueries[type]) BDFDB.InternalData.componentPatchQueries[type] = {query:[], modules:[]};
BDFDB.ModuleUtils.patch(BDFDB, LibraryModules.ContextMenuUtils, "openContextMenu", {before: e => {
let menu = e.methodArguments[1]();
if (BDFDB.ObjectUtils.is(menu) && menu.type && menu.type.displayName) {

File diff suppressed because one or more lines are too long

View File

@ -4,7 +4,7 @@ var EditChannels = (_ => {
return class EditChannels {
getName () {return "EditChannels";}
getVersion () {return "4.1.2";}
getVersion () {return "4.1.3";}
getAuthor () {return "DevilBro";}
@ -12,7 +12,7 @@ var EditChannels = (_ => {
constructor () {
this.changelog = {
"fixed":[["Icons","Icons are now properly colored again"]]
"fixed":[["Context Menu Update","Fixes for the context menu update, yaaaaaay"]]
};
this.patchedModules = {
@ -159,22 +159,24 @@ var EditChannels = (_ => {
onChannelContextMenu (e) {
if (e.instance.props.channel) {
let [children, index] = BDFDB.ReactUtils.findChildren(e.returnvalue, {name:["FluxContainer(MessageDeveloperModeGroup)", "DeveloperModeGroup"]});
children.splice(index > -1 ? index : children.length, 0, BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Group, {
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Sub, {
let [children, index] = BDFDB.ReactUtils.findChildren(e.returnvalue, {props:[["id", "devmode-copy-id"]]});
children.splice(index > -1 ? index : children.length, 0, BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.MenuItems.MenuGroup, {
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.MenuItems.MenuItem, {
label: this.labels.context_localchannelsettings_text,
render: [
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Group, {
id: BDFDB.ContextMenuUtils.createItemId(this.name, "settings-submenu"),
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.MenuItems.MenuGroup, {
children: [
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Item, {
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.MenuItems.MenuItem, {
label: this.labels.submenu_channelsettings_text,
id: BDFDB.ContextMenuUtils.createItemId(this.name, "settings-change"),
action: _ => {
BDFDB.ContextMenuUtils.close(e.instance);
this.openChannelSettingsModal(e.instance.props.channel);
}
}),
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Item, {
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.MenuItems.MenuItem, {
label: this.labels.submenu_resetsettings_text,
id: BDFDB.ContextMenuUtils.createItemId(this.name, "settings-reset"),
disabled: !BDFDB.DataUtils.load(this, "channels", e.instance.props.channel.id),
action: _ => {
BDFDB.ContextMenuUtils.close(e.instance);
@ -184,7 +186,6 @@ var EditChannels = (_ => {
})
]
})
]
})
}));
}

View File

@ -4,7 +4,7 @@ var EditServers = (_ => {
return class EditServers {
getName () {return "EditServers";}
getVersion () {return "2.2.0";}
getVersion () {return "2.2.1";}
getAuthor () {return "DevilBro";}
@ -12,7 +12,7 @@ var EditServers = (_ => {
constructor () {
this.changelog = {
"improved":[["Server Folders","Works better with Server Folders now"]]
"fixed":[["Context Menu Update","Fixes for the context menu update, yaaaaaay"]]
};
this.patchedModules = {
@ -158,22 +158,24 @@ var EditServers = (_ => {
onGuildContextMenu (e) {
if (e.instance.props.guild) {
let [children, index] = BDFDB.ReactUtils.findChildren(e.returnvalue, {name:["FluxContainer(MessageDeveloperModeGroup)", "DeveloperModeGroup"]});
children.splice(index > -1 ? index : children.length, 0, BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Group, {
children: [
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Sub, {
let [children, index] = BDFDB.ReactUtils.findChildren(e.returnvalue, {props:[["id", "devmode-copy-id"]]});
children.splice(index > -1 ? index : children.length, 0, BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.MenuItems.MenuGroup, {
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.MenuItems.MenuItem, {
label: this.labels.context_localserversettings_text,
render: [BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Group, {
id: BDFDB.ContextMenuUtils.createItemId(this.name, "settings-submenu"),
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.MenuItems.MenuGroup, {
children: [
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Item, {
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.MenuItems.MenuItem, {
label: this.labels.submenu_serversettings_text,
id: BDFDB.ContextMenuUtils.createItemId(this.name, "settings-change"),
action: _ => {
BDFDB.ContextMenuUtils.close(e.instance);
this.openGuildSettingsModal(e.instance.props.guild.id);
}
}),
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Item, {
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.MenuItems.MenuItem, {
label: this.labels.submenu_resetsettings_text,
id: BDFDB.ContextMenuUtils.createItemId(this.name, "settings-reset"),
disabled: !BDFDB.DataUtils.load(this, "servers", e.instance.props.guild.id),
action: _ => {
BDFDB.ContextMenuUtils.close(e.instance);
@ -182,9 +184,8 @@ var EditServers = (_ => {
}
})
]
})]
})
]
})
}));
}
}

View File

@ -245,7 +245,7 @@ var EditUsers = (_ => {
children: [
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.MenuItems.MenuItem, {
label: this.labels.submenu_usersettings_text,
id: BDFDB.ContextMenuUtils.createItemId(this.name, "settings-open"),
id: BDFDB.ContextMenuUtils.createItemId(this.name, "settings-change"),
action: _ => {
BDFDB.ContextMenuUtils.close(e.instance);
this.openUserSettingsModal(e.instance.props.user);