This commit is contained in:
Mirco Wittrien 2019-12-05 09:10:14 +01:00
parent 79b5837991
commit 130765bf9e
23 changed files with 114 additions and 92 deletions

View File

@ -1313,15 +1313,12 @@
}
};
var NoFluxContextMenus = ["ChannelContextMenu", "DeveloperContextMenu", "GuildContextMenu", "GuildRoleContextMenu", "MessageContextMenu", "NativeContextMenu", "ScreenshareContextMenu", "UserContextMenu", "UserSettingsCogContextMenu"];
var NoFluxPopouts = ["MessageOptionPopout"];
var FluxContextMenus = ["ApplicationContextMenu", "GroupDMContextMenu"];
for (let type of FluxContextMenus) BDFDB.InternalData.patchMenuQueries[type] = {query:[], module:null};
InternalBDFDB.addContextListeners = (plugin) => {
if (!BDFDB.ObjectUtils.is(plugin)) return;
for (let type of NoFluxContextMenus) if (typeof plugin[`on${type}`] === "function") InternalBDFDB.patchContextMenuPlugin(plugin, type, BDFDB.ModuleUtils.findByName(type));
for (let type of LibraryComponents.ContextMenus._NormalMenus) if (typeof plugin[`on${type}`] === "function") InternalBDFDB.patchContextMenuPlugin(plugin, type, LibraryComponents.ContextMenus[type]);
for (let type of NoFluxPopouts) if (typeof plugin[`on${type}`] === "function") InternalBDFDB.patchPopoutPlugin(plugin, type, BDFDB.ModuleUtils.findByName(type));
for (let type of FluxContextMenus) if (typeof plugin[`on${type}`] === "function") {
for (let type of LibraryComponents.ContextMenus._FluxMenus) if (typeof plugin[`on${type}`] === "function") {
if (BDFDB.InternalData.patchMenuQueries[type].module) InternalBDFDB.patchContextMenuPlugin(plugin, type, BDFDB.InternalData.patchMenuQueries[type].module);
else BDFDB.InternalData.patchMenuQueries[type].query.push(plugin);
}
@ -3802,7 +3799,7 @@
BDFDB.ContextMenuUtils = {};
BDFDB.ContextMenuUtils.open = function (plugin, e, children) {
LibraryModules.ContextMenuUtils.openContextMenu(e, function (e) {
return BDFDB.ReactUtils.createElement(LibraryComponents.ContextMenu, Object.assign({}, e, {
return BDFDB.ReactUtils.createElement(LibraryComponents.ContextMenus.NativeContextMenu, Object.assign({}, e, {
BDFDBcontextMenu: true,
type: BDFDB.DiscordConstants.ContextMenuTypes.NATIVE_TEXT,
value: "",
@ -6820,9 +6817,9 @@
LibraryComponents.Connectors = Object.assign({}, BDFDB.ModuleUtils.findByProperties("Router", "Link"));
LibraryComponents.ContextMenu = BDFDB.ModuleUtils.findByName("NativeContextMenu");
LibraryComponents.ContextMenuItems = {};
LibraryComponents.ContextMenuItem = BDFDB.ReactUtils.getValue(window.BDFDB, "LibraryComponents.ContextMenuItem") || reactInitialized && class BDFDB_ContextMenuItem extends LibraryModules.React.Component {
LibraryComponents.ContextMenuItems.Item = BDFDB.ReactUtils.getValue(window.BDFDB, "LibraryComponents.ContextMenuItems.Item") || reactInitialized && class BDFDB_ContextMenuItem extends LibraryModules.React.Component {
render() {
return BDFDB.ReactUtils.createElement(LibraryComponents.Clickable, {
className: BDFDB.DOMUtils.formatClassName(BDFDB.disCN.contextmenuitem, !this.props.disabled && BDFDB.disCN.contextmenuitemclickable, this.props.danger && BDFDB.disCN.contextmenuitemdanger, this.props.disabled && BDFDB.disCN.contextmenuitemdisabled, this.props.brand && BDFDB.disCN.contextmenuitembrand, this.props.className),
@ -6852,9 +6849,9 @@
}
};
LibraryComponents.ContextMenuItemGroup = BDFDB.ModuleUtils.findByString(`"div",{className`, `default.itemGroup}`);
LibraryComponents.ContextMenuItems.Group = BDFDB.ModuleUtils.findByString(`"div",{className`, `default.itemGroup}`);
LibraryComponents.ContextMenuSliderItem = BDFDB.ReactUtils.getValue(window.BDFDB, "LibraryComponents.ContextMenuSliderItem") || reactInitialized && class BDFDB_ContextMenuSliderItem extends LibraryModules.React.Component {
LibraryComponents.ContextMenuItems.Slider = BDFDB.ReactUtils.getValue(window.BDFDB, "LibraryComponents.ContextMenuItems.Slider") || reactInitialized && class BDFDB_ContextMenuSliderItem extends LibraryModules.React.Component {
handleValueChange(value) {
let newvalue = BDFDB.ArrayUtils.is(this.props.edges) && this.props.edges.length == 2 ? BDFDB.NumberUtils.mapRange([0, 100], this.props.edges, value) : value;
if (typeof this.props.digits == "number") newvalue = Math.round(newvalue * Math.pow(10, this.props.digits)) / Math.pow(10, this.props.digits);
@ -6884,9 +6881,9 @@
}
};
LibraryComponents.ContextMenuSubItem = BDFDB.ModuleUtils.findByName("FluxContainer(SubMenuItem)");
LibraryComponents.ContextMenuItems.Sub = BDFDB.ModuleUtils.findByName("FluxContainer(SubMenuItem)");
LibraryComponents.ContextMenuToggleItem = BDFDB.ReactUtils.getValue(window.BDFDB, "LibraryComponents.ContextMenuToggleItem") || reactInitialized && class BDFDB_ContextMenuToggleItem extends LibraryModules.React.Component {
LibraryComponents.ContextMenuItems.Toggle = BDFDB.ReactUtils.getValue(window.BDFDB, "LibraryComponents.ContextMenuItems.Toggle") || reactInitialized && class BDFDB_ContextMenuToggleItem extends LibraryModules.React.Component {
handleToggle() {
this.props.active = !this.props.active;
BDFDB.ReactUtils.forceUpdate(this);
@ -6897,6 +6894,22 @@
}
};
LibraryComponents.ContextMenus = {};
LibraryComponents.ContextMenus._NormalMenus = ["ChannelContextMenu", "DeveloperContextMenu", "GuildContextMenu", "GuildRoleContextMenu", "MessageContextMenu", "NativeContextMenu", "ScreenshareContextMenu", "SlateContextMenu", "UserContextMenu", "UserSettingsCogContextMenu"];
LibraryComponents.ContextMenus._FluxMenus = ["ApplicationContextMenu", "GroupDMContextMenu"];
LibraryComponents.ContextMenus.ApplicationContextMenu = BDFDB.ModuleUtils.findByName("FluxContainer(ApplicationContextMenu)");
LibraryComponents.ContextMenus.ChannelContextMenu = BDFDB.ModuleUtils.findByString("Error - no such ctx menu type", BDFDB.DiscordConstants.ContextMenuTypes.CHANNEL_LIST_TEXT);
LibraryComponents.ContextMenus.DeveloperContextMenu = BDFDB.ModuleUtils.findByName("DeveloperContextMenu");
LibraryComponents.ContextMenus.GroupDMContextMenu = BDFDB.ModuleUtils.findByName("FluxContainer(GroupDMContextMenu)");
LibraryComponents.ContextMenus.GuildContextMenu = BDFDB.ModuleUtils.findByString("Error - no such ctx menu type", BDFDB.DiscordConstants.ContextMenuTypes.GUILD_CHANNEL_LIST);
LibraryComponents.ContextMenus.GuildRoleContextMenu = BDFDB.ModuleUtils.findByName("GuildRoleContextMenu");
LibraryComponents.ContextMenus.MessageContextMenu = BDFDB.ModuleUtils.findByName("MessageContextMenu");
LibraryComponents.ContextMenus.NativeContextMenu = BDFDB.ModuleUtils.findByName("NativeContextMenu");
LibraryComponents.ContextMenus.ScreenshareContextMenu = BDFDB.ModuleUtils.findByName("ScreenshareContextMenu");
LibraryComponents.ContextMenus.SlateContextMenu = BDFDB.ModuleUtils.findByName("SlateContextMenu");
LibraryComponents.ContextMenus.UserContextMenu = BDFDB.ModuleUtils.findByString("Error - no such ctx menu type", BDFDB.DiscordConstants.ContextMenuTypes.USER_CHANNEL_MEMBERS);
LibraryComponents.ContextMenus.UserSettingsCogContextMenu = BDFDB.ModuleUtils.findByName("UserSettingsCogContextMenu");
LibraryComponents.FavButton = BDFDB.ReactUtils.getValue(window.BDFDB, "LibraryComponents.FavButton") || reactInitialized && class BDFDB_FavButton extends LibraryModules.React.Component {
handleClick() {
this.props.isFavorite = !this.props.isFavorite;
@ -9215,9 +9228,12 @@
return e.methodArguments[0].id == "410787888507256842" ? e.methodArguments[0].banner : e.callOriginalMethod();
}});
for (let type of NoFluxContextMenus) InternalBDFDB.patchContextMenuLib(BDFDB.ModuleUtils.findByName(type), false);
for (let type of LibraryComponents.ContextMenus._NormalMenus) InternalBDFDB.patchContextMenuLib(LibraryComponents.ContextMenus[type], false);
for (let type of NoFluxPopouts) InternalBDFDB.patchPopoutLib(BDFDB.ModuleUtils.findByName(type), false);
for (let type of FluxContextMenus) InternalBDFDB.patchContextMenuLib(BDFDB.ModuleUtils.findByName(`FluxContainer(${type})`), true);
for (let type of LibraryComponents.ContextMenus._FluxMenus) {
BDFDB.InternalData.patchMenuQueries[type] = {query:[], module:null};
InternalBDFDB.patchContextMenuLib(LibraryComponents.ContextMenus[type], true);
}
BDFDB.ModuleUtils.forceAllUpdates(BDFDB);
@ -9521,6 +9537,12 @@
BDFDB.LibraryComponents.ModalTabContent = LibraryComponents.ModalComponents.ModalTabContent;
BDFDB.LibraryComponents.NumberBadge = LibraryComponents.BadgeComponents.NumberBadge;
BDFDB.LibraryComponents.ContextMenuItem = LibraryComponents.ContextMenuItems.Item;
BDFDB.LibraryComponents.ContextMenuItemGroup = LibraryComponents.ContextMenuItems.Group;
BDFDB.LibraryComponents.ContextMenuSliderItem = LibraryComponents.ContextMenuItems.Slider;
BDFDB.LibraryComponents.ContextMenuSubItem = LibraryComponents.ContextMenuItems.Sub;
BDFDB.LibraryComponents.ContextMenuToggleItem = LibraryComponents.ContextMenuItems.Toggle;
BDFDB.loaded = true;
window.BDFDB = BDFDB;

File diff suppressed because one or more lines are too long

View File

@ -308,9 +308,9 @@ class ChatAliases {
appendItem (menu, returnvalue, text) {
let [children, index] = BDFDB.ReactUtils.findChildren(returnvalue, {name:["FluxContainer(MessageDeveloperModeGroup)", "DeveloperModeGroup"]});
const itemgroup = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItemGroup, {
const itemgroup = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Group, {
children: [
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Item, {
label: "Add to ChatAliases",
action: _ => {
BDFDB.ContextMenuUtils.close(menu);

View File

@ -300,9 +300,9 @@ class ChatFilter {
appendItem (menu, returnvalue, text) {
let [children, index] = BDFDB.ReactUtils.findChildren(returnvalue, {name:["FluxContainer(MessageDeveloperModeGroup)", "DeveloperModeGroup"]});
const itemgroup = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItemGroup, {
const itemgroup = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Group, {
children: [
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Item, {
label: "Add to ChatFilter",
action: _ => {
BDFDB.ContextMenuUtils.close(menu);

View File

@ -61,9 +61,9 @@ class CopyRawMessage {
onMessageContextMenu (e) {
if (e.instance.props.message && e.instance.props.message.content) {
let [children, index] = BDFDB.ReactUtils.findChildren(e.returnvalue, {name:["FluxContainer(MessageDeveloperModeGroup)", "DeveloperModeGroup"]});
const itemgroup = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItemGroup, {
const itemgroup = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Group, {
children: [
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Item, {
label: BDFDB.LanguageUtils.LanguageStrings.COPY_TEXT + " (Raw)",
hint: BDFDB.BDUtils.isPluginEnabled("MessageUtilities") ? BDFDB.BDUtils.getPlugin("MessageUtilities").getActiveShortcutString("Copy_Raw") : null,
action: _ => {
@ -81,7 +81,7 @@ class CopyRawMessage {
onMessageOptionPopout (e) {
if (e.instance.props.message) {
let [children, index] = BDFDB.ReactUtils.findChildren(e.returnvalue, {props:[["label", BDFDB.LanguageUtils.LanguageStrings.DELETE]]});
children.splice(index, 0, BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
children.splice(index, 0, BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Item, {
label: BDFDB.LanguageUtils.LanguageStrings.COPY_TEXT + " (Raw)",
className: BDFDB.disCN.optionpopoutitem,
action: _ => {

View File

@ -146,20 +146,20 @@ class EditChannels {
onChannelContextMenu (instance, menu, returnvalue) {
if (instance.props.channel && !BDFDB.DOMUtils.getParent(".container-hidden", instance.props.target) && !menu.querySelector(`${this.name}-contextMenuSubItem`)) {
let [children, index] = BDFDB.ReactUtils.findChildren(returnvalue, {name:["FluxContainer(MessageDeveloperModeGroup)", "DeveloperModeGroup"]});
children.splice(index > -1 ? index : children.length, 0, BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItemGroup, {
children.splice(index > -1 ? index : children.length, 0, BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Group, {
children: [
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuSubItem, {
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Sub, {
label: this.labels.context_localchannelsettings_text,
render: [BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItemGroup, {
render: [BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Group, {
children: [
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Item, {
label: this.labels.submenu_channelsettings_text,
action: _ => {
BDFDB.ContextMenuUtils.close(menu);
this.showChannelSettings(instance.props.channel);
}
}),
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Item, {
label: this.labels.submenu_resetsettings_text,
disabled: !BDFDB.DataUtils.load(this, "channels", instance.props.channel.id),
action: _ => {

View File

@ -159,20 +159,20 @@ class 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.ContextMenuItemGroup, {
children.splice(index > -1 ? index : children.length, 0, BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Group, {
children: [
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuSubItem, {
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Sub, {
label: this.labels.context_localserversettings_text,
render: [BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItemGroup, {
render: [BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Group, {
children: [
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Item, {
label: this.labels.submenu_serversettings_text,
action: _ => {
BDFDB.ContextMenuUtils.close(e.instance);
this.showServerSettings(e.instance.props.guild.id);
}
}),
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Item, {
label: this.labels.submenu_resetsettings_text,
disabled: !BDFDB.DataUtils.load(this, "servers", e.instance.props.guild.id),
action: _ => {

View File

@ -193,20 +193,20 @@ class EditUsers {
onUserContextMenu (instance, menu, returnvalue) {
if (instance.props.user && !menu.querySelector(`${this.name}-contextMenuSubItem`)) {
let [children, index] = BDFDB.ReactUtils.findChildren(returnvalue, {name:["FluxContainer(MessageDeveloperModeGroup)", "DeveloperModeGroup"]});
const itemgroup = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItemGroup, {
const itemgroup = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Group, {
children: [
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuSubItem, {
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Sub, {
label: this.labels.context_localusersettings_text,
render: [BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItemGroup, {
render: [BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Group, {
children: [
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Item, {
label: this.labels.submenu_usersettings_text,
action: _ => {
BDFDB.ContextMenuUtils.close(menu);
this.showUserSettings(instance.props.user);
}
}),
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Item, {
label: this.labels.submenu_resetsettings_text,
disabled: !BDFDB.DataUtils.load(this, "users", instance.props.user.id),
action: _ => {

View File

@ -131,7 +131,7 @@ class GoogleSearchReplace {
injectItem (e, text) {
let engines = BDFDB.DataUtils.get(this, "engines");
let items = [];
for (let key in engines) if (engines[key]) items.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
for (let key in engines) if (engines[key]) items.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Item, {
label: this.defaults.engines[key].name,
danger: key == "_all",
action: event => {
@ -143,12 +143,12 @@ class GoogleSearchReplace {
else BDFDB.DiscordUtils.openLink(this.defaults.engines[key].url.replace(this.textUrlReplaceString, encodeURIComponent(text)), useChromium, event.shiftKey);
}
}));
if (!items.length) items.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
if (!items.length) items.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Item, {
label: this.labels.submenu_disabled_text,
disabled: true
}));
let [children, index] = BDFDB.ReactUtils.findChildren(e.returnvalue, {name:"SearchWithGoogle"});
const item = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuSubItem, {
const item = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Sub, {
label: this.labels.context_googlesearchreplace_text,
render: items
});

View File

@ -168,7 +168,7 @@ class GoogleTranslateOption {
if (!messagediv || pos == -1) return;
let translated = BDFDB.DOMUtils.containsClass(messagediv, "GTO-translated-message");
let [children, index] = BDFDB.ReactUtils.findChildren(e.returnvalue, {name:"MessagePinItem"});
const translateUntranslateItem = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
const translateUntranslateItem = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Item, {
label: translated ? this.labels.context_messageuntranslateoption_text : this.labels.context_messagetranslateoption_text,
hint: BDFDB.BDUtils.isPluginEnabled("MessageUtilities") ? BDFDB.BDUtils.getPlugin("MessageUtilities").getActiveShortcutString("__Translate_Message") : null,
action: _ => {
@ -183,7 +183,7 @@ class GoogleTranslateOption {
let GSRstring = BDFDB.ReactUtils.getValue(BDFDB.BDUtils.getPlugin("GoogleSearchReplace", true), "labels.context_googlesearchreplace_text");
let [children2, index2] = BDFDB.ReactUtils.findChildren(e.returnvalue, {name:"SearchWithGoogle", props: GSRstring ? [["label", GSRstring]] : null});
var foundtranslation, foundinput, foundoutput;
const searchTranslationItem = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
const searchTranslationItem = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Item, {
label: this.labels.context_googletranslateoption_text,
action: event => {
var item = BDFDB.DOMUtils.getParent(BDFDB.dotCN.contextmenuitem, event.target);
@ -219,7 +219,7 @@ class GoogleTranslateOption {
if (!messagediv || pos == -1) return;
let translated = BDFDB.DOMUtils.containsClass(messagediv, "GTO-translated-message");
let [children, index] = BDFDB.ReactUtils.findChildren(e.returnvalue, {props:[["label", [BDFDB.LanguageUtils.LanguageStrings.PIN, BDFDB.LanguageUtils.LanguageStrings.UNPIN]]]});
children.splice(index + 1, 0, BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
children.splice(index + 1, 0, BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Item, {
label: this.labels[translated ? "popout_untranslateoption_text" : "popout_translateoption_text"],
className: BDFDB.disCN.optionpopoutitem,
action: _ => {

View File

@ -107,7 +107,7 @@ class ImageZoom {
if (index > -1) {
let openContext = event => {
let settings = BDFDB.DataUtils.get(this, "settings"), items = [];
for (let type in settings) items.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuSliderItem, {
for (let type in settings) items.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Slider, {
defaultValue: settings[type],
digits: this.defaults.settings[type].digits,
edges: this.defaults.settings[type].edges,
@ -121,7 +121,7 @@ class ImageZoom {
BDFDB.DataUtils.save(value, this, "settings", type);
}
}));
BDFDB.ContextMenuUtils.open(this, event, BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItemGroup, {
BDFDB.ContextMenuUtils.open(this, event, BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Group, {
children: items
}));
};

View File

@ -128,7 +128,7 @@ class PersonalPins {
if (!messagediv || pos == -1) return;
let note = this.getNoteData(e.instance.props.message, e.instance.props.target, e.instance.props.channel);
let [children, index] = BDFDB.ReactUtils.findChildren(e.returnvalue, {name:"MessagePinItem"});
const pinUnpinItem = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
const pinUnpinItem = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Item, {
label: this.labels[note ? "context_unpinoption_text" : "context_pinoption_text"],
hint: BDFDB.BDUtils.isPluginEnabled("MessageUtilities") ? BDFDB.BDUtils.getPlugin("MessageUtilities").getActiveShortcutString("__Note_Message") : null,
action: _ => {
@ -139,7 +139,7 @@ class PersonalPins {
if (index > -1) children.splice(index, 0, pinUnpinItem);
else children.push(pinUnpinItem);
if (this.isNoteOutdated(note, e.instance.props.message)) {
const updateItem = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
const updateItem = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Item, {
label: this.labels.context_updateoption_text,
action: _ => {
BDFDB.ContextMenuUtils.close(e.instance);
@ -158,7 +158,7 @@ class PersonalPins {
if (!messagediv || pos == -1) return;
let note = this.getNoteData(e.instance.props.message, e.instance.props.target, e.instance.props.channel);
let [children, index] = BDFDB.ReactUtils.findChildren(e.returnvalue, {props:[["label", [BDFDB.LanguageUtils.LanguageStrings.PIN, BDFDB.LanguageUtils.LanguageStrings.UNPIN]]]});
children.splice(index + 1, 0, BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
children.splice(index + 1, 0, BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Item, {
label: this.labels[note ? "context_unpinoption_text" : "popout_pinoption_text"],
className: BDFDB.disCN.optionpopoutitem,
action: _ => {
@ -166,7 +166,7 @@ class PersonalPins {
e.instance.props.onClose();
}
}));
if (this.isNoteOutdated(note, e.instance.props.message)) children.splice(index + 1, 0, BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
if (this.isNoteOutdated(note, e.instance.props.message)) children.splice(index + 1, 0, BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Item, {
label: this.labels.context_updateoption_text,
className: BDFDB.disCN.optionpopoutitem,
action: _ => {

View File

@ -180,10 +180,10 @@ class PinDMs {
injectItem (instance, id, children, index) {
let pinnedInChannel = this.isPinned(id, "pinnedDMs");
let pinnedInGuild = this.isPinned(id, "pinnedRecents");
children.splice(index, 0, BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuSubItem, {
children.splice(index, 0, BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Sub, {
label: this.labels.context_pindm_text,
render: [
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Item, {
label: this.labels[pinnedInChannel ? "context_unpinchannel_text" : "context_pinchannel_text"],
danger: pinnedInChannel,
action: _ => {
@ -192,7 +192,7 @@ class PinDMs {
else this.removePin(id, "pinnedDMs");
}
}),
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Item, {
label: this.labels[pinnedInGuild ? "context_unpinguild_text" : "context_pinguild_text"],
danger: pinnedInGuild,
action: _ => {

View File

@ -341,7 +341,7 @@ class PluginRepo {
onUserSettingsCogContextMenu (instance, menu, returnvalue) {
BDFDB.TimeUtils.timeout(() => {for (let child of returnvalue.props.children) if (child && child.props && child.props.label == "BandagedBD" && Array.isArray(child.props.render)) {
const repoItem = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
const repoItem = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Item, {
label: "Plugin Repo",
action: _ => {
if (!this.loading.is) BDFDB.ContextMenuUtils.close(menu);

View File

@ -126,7 +126,7 @@ class ReadAllNotificationsButton {
onUserContextMenu (e) {
if (e.instance.props.channelId && e.instance.props.type == BDFDB.DiscordConstants.ContextMenuTypes.USER_PRIVATE_CHANNELS) {
e.returnvalue.props.children.props.children.props.children.unshift(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
e.returnvalue.props.children.props.children.props.children.unshift(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Item, {
label: BDFDB.LanguageUtils.LanguageStrings.MARK_AS_READ,
disabled: !BDFDB.LibraryModules.DirectMessageUnreadStore.getUnreadPrivateChannelIds().includes(e.instance.props.channelId),
action: event => {
@ -155,30 +155,30 @@ class ReadAllNotificationsButton {
if (settings.includeDMs) BDFDB.DMUtils.markAsRead(BDFDB.DMUtils.getAll());
},
onContextMenu: event => {
BDFDB.ContextMenuUtils.open(this, event, BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItemGroup, {
BDFDB.ContextMenuUtils.open(this, event, BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Group, {
children: [
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Item, {
label: this.labels.context_unreadguilds_text,
action: event2 => {
BDFDB.ContextMenuUtils.close(event2._targetInst);
BDFDB.GuildUtils.markAsRead(BDFDB.GuildUtils.getUnread());
}
}),
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Item, {
label: this.labels.context_pingedguilds_text,
action: event2 => {
BDFDB.ContextMenuUtils.close(event2._targetInst);
BDFDB.GuildUtils.markAsRead(BDFDB.GuildUtils.getPinged());
}
}),
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Item, {
label: this.labels.context_mutedguilds_text,
action: event2 => {
BDFDB.ContextMenuUtils.close(event2._targetInst);
BDFDB.GuildUtils.markAsRead(BDFDB.GuildUtils.getMuted());
}
}),
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Item, {
label: this.labels.context_guilds_text,
action: event2 => {
BDFDB.ContextMenuUtils.close(event2._targetInst);
@ -186,7 +186,7 @@ class ReadAllNotificationsButton {
BDFDB.GuildUtils.markAsRead(BDFDB.GuildUtils.getAll());
}
}),
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Item, {
label: this.labels.context_dms_text,
action: event2 => {
BDFDB.ContextMenuUtils.close(event2._targetInst);

View File

@ -64,9 +64,9 @@ class RevealAllSpoilersOption {
let messagediv = BDFDB.DOMUtils.getParent(BDFDB.dotCN.messagegroup + "> [aria-disabled]," + BDFDB.dotCN.messagegroup + "> * > [aria-disabled]", e.instance.props.target);
if (!messagediv || !messagediv.querySelector(BDFDB.dotCN.spoilerhidden)) return;
let [children, index] = BDFDB.ReactUtils.findChildren(e.returnvalue, {name:["FluxContainer(MessageDeveloperModeGroup)", "DeveloperModeGroup"]});
const itemgroup = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItemGroup, {
const itemgroup = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Group, {
children: [
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Item, {
label: "Reveal all Spoilers",
hint: BDFDB.BDUtils.isPluginEnabled("MessageUtilities") ? BDFDB.BDUtils.getPlugin("MessageUtilities").getActiveShortcutString("__Reveal_Spoilers") : null,
action: _ => {

View File

@ -159,7 +159,7 @@ class ReverseImageSearch {
}
let engines = BDFDB.DataUtils.get(this, "engines");
let items = [];
for (let key in engines) if (engines[key]) items.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
for (let key in engines) if (engines[key]) items.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Item, {
label: this.defaults.engines[key].name,
danger: key == "_all",
action: event => {
@ -171,14 +171,14 @@ class ReverseImageSearch {
else BDFDB.DiscordUtils.openLink(this.defaults.engines[key].url.replace(this.imgUrlReplaceString, encodeURIComponent(url)), useChromium, event.shiftKey);
}
}));
if (!items.length) items.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
if (!items.length) items.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Item, {
label: this.labels.submenu_disabled_text,
disabled: true
}));
let [children, index] = BDFDB.ReactUtils.findChildren(e.returnvalue, {name:["FluxContainer(MessageDeveloperModeGroup)", "DeveloperModeGroup"]});
const itemgroup = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItemGroup, {
const itemgroup = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Group, {
children: [
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuSubItem, {
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Sub, {
label: "Reverse Image Search",
render: items
})

View File

@ -500,7 +500,7 @@ class ServerFolders {
BDFDB.DataUtils.save(data, this, "folders", e.instance.props.folderId);
}
let [children, index] = BDFDB.ReactUtils.findChildren(e.returnvalue, {name:"GuildFolderMarkReadItem"});
children.splice(index > -1 ? index + 1 : children.length, 0, BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuToggleItem, {
children.splice(index > -1 ? index + 1 : children.length, 0, BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Toggle, {
label: this.labels.foldercontext_autoreadfolder_text,
active: data.autoRead,
action: state => {
@ -508,8 +508,8 @@ class ServerFolders {
BDFDB.DataUtils.save(data, this, "folders", e.instance.props.folderId);
}
}));
e.returnvalue.props.children.splice(e.returnvalue.props.children.length - 1, 0, BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItemGroup, {
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuToggleItem, {
e.returnvalue.props.children.splice(e.returnvalue.props.children.length - 1, 0, BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Group, {
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Toggle, {
label: this.labels.foldercontext_mutefolder_text,
active: muted,
action: state => {
@ -519,8 +519,8 @@ class ServerFolders {
}
})
}));
e.returnvalue.props.children.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItemGroup, {
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
e.returnvalue.props.children.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Group, {
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Item, {
label: this.labels.foldercontext_removefolder_text,
danger: true,
action: event => {
@ -537,12 +537,12 @@ class ServerFolders {
let folder = BDFDB.GuildUtils.getFolder(e.instance.props.guild.id);
let unfolderedGuilds = BDFDB.LibraryModules.FolderStore.getSortedGuilds().filter(n => !n.folderId).map(n => n.guilds[0]);
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.ContextMenuItemGroup, {
children.splice(index > -1 ? index : children.length, 0, BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Group, {
children: [
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuSubItem, {
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Sub, {
label: this.labels.servercontext_serverfolders_text,
render: folder ? [
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Item, {
label: this.labels.serversubmenu_removefromfolder_text,
danger: true,
action: _ => {
@ -551,7 +551,7 @@ class ServerFolders {
}
})
] : [
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Item, {
label: this.labels.serversubmenu_createfolder_text,
disabled: !unfolderedGuilds.length,
action: _ => {
@ -562,7 +562,7 @@ class ServerFolders {
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents[folders.length ? "ContextMenuSubItem" : "ContextMenuItem"], {
label: this.labels.serversubmenu_addtofolder_text,
disabled: !folders.length,
render: folders.map((folder, i) => BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
render: folders.map((folder, i) => BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Item, {
label: folder.folderName || `${BDFDB.LanguageUtils.LanguageStrings.SERVER_FOLDER_PLACEHOLDER} #${i + 1}`,
action: _ => {
BDFDB.ContextMenuUtils.close(e.instance);

View File

@ -110,20 +110,20 @@ class ServerHider {
if (document.querySelector(BDFDB.dotCN.modalwrapper)) return;
if (e.instance.props.target && e.instance.props.type.startsWith("GUILD_ICON_")) {
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.ContextMenuItemGroup, {
children.splice(index > -1 ? index : children.length, 0, BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Group, {
children: [
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuSubItem, {
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Sub, {
label: this.labels.context_serverhider_text,
render: [BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItemGroup, {
render: [BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Group, {
children: [
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Item, {
label: this.labels.submenu_openhidemenu_text,
action: _ => {
BDFDB.ContextMenuUtils.close(e.instance);
this.showHideModal();
}
}),
!e.instance.props.guild && !e.instance.props.folderId ? null : BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
!e.instance.props.guild && !e.instance.props.folderId ? null : BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Item, {
label: e.instance.props.guild ? this.labels.submenu_hideserver_text : this.labels.submenu_hidefolder_text,
action: _ => {
BDFDB.ContextMenuUtils.close(e.instance);

View File

@ -184,8 +184,8 @@ class ShowHiddenChannels {
let isHidden = this.isChannelHidden(e.instance.props.channel.id);
if (isHidden || BDFDB.DataUtils.get(this, "settings", "showForNormal")) {
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.ContextMenuItemGroup, {
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
children.splice(index > -1 ? index : children.length, 0, BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Group, {
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Item, {
label: BDFDB.LanguageUtils.LanguageStrings.CHANNEL + " " + BDFDB.LanguageUtils.LanguageStrings.ACCESSIBILITY,
action: _ => {
BDFDB.ContextMenuUtils.close(e.instance);

View File

@ -176,22 +176,22 @@ class SpellCheck {
let [children, index] = BDFDB.ReactUtils.findChildren(returnvalue, {name:["FluxContainer(MessageDeveloperModeGroup)", "DeveloperModeGroup"]});
let items = [];
let similarWords = this.getSimilarWords(word.toLowerCase().trim());
for (let suggestion of similarWords.sort()) items.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
for (let suggestion of similarWords.sort()) items.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Item, {
label: suggestion,
action: _ => {
BDFDB.ContextMenuUtils.close(menu);
this.replaceWord(textarea, word, suggestion);
}
}));
if (!items.length) items.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
if (!items.length) items.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Item, {
label: this.labels.similarwordssubmenu_none_text,
disabled: true
}));
const itemgroup = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItemGroup, {
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuSubItem, {
const itemgroup = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Group, {
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Sub, {
label: BDFDB.LanguageUtils.LanguageStrings.SPELLCHECK,
render: [
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Item, {
label: this.labels.context_spellcheck_text,
hint: word,
action: _ => {
@ -199,7 +199,7 @@ class SpellCheck {
this.addToOwnDictionary(word);
}
}),
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuSubItem, {
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Sub, {
label: this.labels.context_similarwords_text,
render: items
})

View File

@ -401,7 +401,7 @@ class ThemeRepo {
onUserSettingsCogContextMenu (instance, menu, returnvalue) {
BDFDB.TimeUtils.timeout(() => {for (let child of returnvalue.props.children) if (child && child.props && child.props.label == "BandagedBD" && Array.isArray(child.props.render)) {
const repoItem = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
const repoItem = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Item, {
label: "Theme Repo",
action: _ => {
if (!this.loading.is) BDFDB.ContextMenuUtils.close(menu);

View File

@ -89,9 +89,9 @@ class UserNotes {
onUserContextMenu (e) {
if (e.instance.props.user) {
let [children, index] = BDFDB.ReactUtils.findChildren(e.returnvalue, {name:["FluxContainer(MessageDeveloperModeGroup)", "DeveloperModeGroup"]});
const itemgroup = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItemGroup, {
const itemgroup = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Group, {
children: [
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Item, {
label: BDFDB.LanguageUtils.LanguageStrings.USERS + " " + BDFDB.LanguageUtils.LanguageStrings.NOTE,
action: _ => {
BDFDB.ContextMenuUtils.close(e.instance);