stuff
This commit is contained in:
parent
51e2572e72
commit
949d66d2c7
|
@ -953,7 +953,9 @@
|
|||
return InternalBDFDB.findModule("prop", JSON.stringify(properties), m => properties.every(prop => m[prop] !== undefined), getExport);
|
||||
};
|
||||
BDFDB.ModuleUtils.findByName = function (name, getExport) {
|
||||
return InternalBDFDB.findModule("name", JSON.stringify(name), m => m.displayName === name, typeof getExport != "boolean" ? true : getExport);
|
||||
let module = InternalBDFDB.findModule("name", JSON.stringify(name), m => m.displayName === name || m.render && m.render.displayName === name, typeof getExport != "boolean" ? true : getExport);
|
||||
if (module && module.render && module.render.displayName == name) module.displayName = name;
|
||||
return module;
|
||||
};
|
||||
BDFDB.ModuleUtils.findByString = function (...strings) {
|
||||
strings = strings.flat(10);
|
||||
|
@ -1017,6 +1019,9 @@
|
|||
"QuickSwitchChannelResult",
|
||||
"QuickSwitchGuildResult"
|
||||
];
|
||||
WebModulesData.Nonprototype = [
|
||||
"ChannelTextAreaContainer"
|
||||
];
|
||||
WebModulesData.Patchfinder = {
|
||||
Account: "accountinfo",
|
||||
App: "app",
|
||||
|
@ -1269,7 +1274,7 @@
|
|||
patchfunctions[patchtype] = e => {
|
||||
if (window.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) InternalBDFDB.initiateProcess(plugin, type, {instance:e.thisObject, returnvalue:e.returnValue, methodname:e.originalMethodName, patchtypes:[patchtype]});
|
||||
}
|
||||
BDFDB.ModuleUtils.patch(plugin, instance.prototype, plugin.patchedModules[patchtype][type], patchfunctions);
|
||||
BDFDB.ModuleUtils.patch(plugin, WebModulesData.Nonprototype.includes(name) ? instance : instance.prototype, plugin.patchedModules[patchtype][type], patchfunctions);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1635,7 +1640,7 @@
|
|||
function check (instance) {
|
||||
if (!instance) return false;
|
||||
let props = instance.stateNode ? instance.stateNode.props : instance.props;
|
||||
return instance.type && config.name && config.name.some(name => ((instance.type.displayName || instance.type.name || instance.type) === name)) || config.key && config.key.some(key => instance.key == key) || props && config.props && config.props.every(prop => BDFDB.ArrayUtils.is(prop) ? (BDFDB.ArrayUtils.is(prop[1]) ? prop[1].some(checkvalue => propCheck(props, prop[0], checkvalue)) : propCheck(props, prop[0], prop[1])) : props[prop] !== undefined) || config.filter && config.filter(instance);
|
||||
return instance.type && config.name && config.name.some(name => ((instance.type.render && instance.type.render.displayName || instance.type.displayName || instance.type.name || instance.type) === name)) || config.key && config.key.some(key => instance.key == key) || props && config.props && config.props.every(prop => BDFDB.ArrayUtils.is(prop) ? (BDFDB.ArrayUtils.is(prop[1]) ? prop[1].some(checkvalue => propCheck(props, prop[0], checkvalue)) : propCheck(props, prop[0], prop[1])) : props[prop] !== undefined) || config.filter && config.filter(instance);
|
||||
}
|
||||
function propCheck (props, key, value) {
|
||||
return key != null && props[key] != null && value != null && (key == "className" ? (" " + props[key] + " ").indexOf(" " + value + " ") > -1 : BDFDB.equals(props[key], value));
|
||||
|
@ -1668,15 +1673,15 @@
|
|||
depth++;
|
||||
var result = undefined;
|
||||
if (instance && !Node.prototype.isPrototypeOf(instance) && !BDFDB.ReactUtils.getInstance(instance) && depth < maxdepth && performance.now() - start < maxtime) {
|
||||
if (instance.type && types.some(name => (instance.type.displayName || instance.type.name) === name.split(" _ _ ")[0])) {
|
||||
if (instance.type && types.some(name => (instance.type.render && instance.type.render.displayName || instance.type.displayName || instance.type.name) === name.split(" _ _ ")[0])) {
|
||||
if (config.all === undefined || !config.all) result = instance.type;
|
||||
else if (config.all) {
|
||||
if (!instance.type.BDFDBreactSearch) {
|
||||
instance.type.BDFDBreactSearch = true;
|
||||
if (config.group) {
|
||||
if (instance.type && (instance.type.displayName || instance.type.name)) {
|
||||
if (instance.type && (instance.type.render && instance.type.render.displayName || instance.type.displayName || instance.type.name)) {
|
||||
var group = "Default";
|
||||
for (let name of types) if ((instance.type.displayName || instance.type.name).split(" _ _ ")[0]) {
|
||||
for (let name of types) if ((instance.type.render && instance.type.render.displayName || instance.type.displayName || instance.type.name).split(" _ _ ")[0]) {
|
||||
group = name;
|
||||
break;
|
||||
}
|
||||
|
@ -1729,15 +1734,15 @@
|
|||
var result = undefined;
|
||||
if (instance && !Node.prototype.isPrototypeOf(instance) && !BDFDB.ReactUtils.getInstance(instance) && depth < maxdepth && performance.now() - start < maxtime) {
|
||||
let props = instance.stateNode ? instance.stateNode.props : instance.props;
|
||||
if (instance.stateNode && !Node.prototype.isPrototypeOf(instance.stateNode) && (instance.type && config.name && config.name.some(name => (instance.type.displayName || instance.type.name || instance.type) === name.split(" _ _ ")[0]) || config.key && config.key.some(key => instance.key == key) || props && config.props && config.props.every(prop => BDFDB.ArrayUtils.is(prop) ? (BDFDB.ArrayUtils.is(prop[1]) ? prop[1].some(checkvalue => BDFDB.equals(props[prop[0]], checkvalue)) : BDFDB.equals(props[prop[0]], prop[1])) : props[prop] !== undefined))) {
|
||||
if (instance.stateNode && !Node.prototype.isPrototypeOf(instance.stateNode) && (instance.type && config.name && config.name.some(name => (instance.type.render && instance.type.render.displayName || instance.type.displayName || instance.type.name || instance.type) === name.split(" _ _ ")[0]) || config.key && config.key.some(key => instance.key == key) || props && config.props && config.props.every(prop => BDFDB.ArrayUtils.is(prop) ? (BDFDB.ArrayUtils.is(prop[1]) ? prop[1].some(checkvalue => BDFDB.equals(props[prop[0]], checkvalue)) : BDFDB.equals(props[prop[0]], prop[1])) : props[prop] !== undefined))) {
|
||||
if (config.all === undefined || !config.all) result = instance.stateNode;
|
||||
else if (config.all) {
|
||||
if (!instance.stateNode.BDFDBreactSearch) {
|
||||
instance.stateNode.BDFDBreactSearch = true;
|
||||
if (config.group) {
|
||||
if (config.name && instance.type && (instance.type.displayName || instance.type.name || instance.type)) {
|
||||
if (config.name && instance.type && (instance.type.render && instance.type.render.displayName || instance.type.displayName || instance.type.name || instance.type)) {
|
||||
var group = "Default";
|
||||
for (let name of config.name) if ((instance.type.displayName || instance.type.name || instance.type).split(" _ _ ")[0]) {
|
||||
for (let name of config.name) if ((instance.type.render && instance.type.render.displayName || instance.type.displayName || instance.type.name || instance.type).split(" _ _ ")[0]) {
|
||||
group = name;
|
||||
break;
|
||||
}
|
||||
|
@ -1779,7 +1784,7 @@
|
|||
depth++;
|
||||
var result = undefined;
|
||||
if (instance && !Node.prototype.isPrototypeOf(instance) && !BDFDB.ReactUtils.getInstance(instance) && depth < maxdepth && performance.now() - start < maxtime) {
|
||||
if (instance.memoizedProps && (instance.type && config.name && config.name.some(name => (instance.type.displayName || instance.type.name || instance.type) === name.split(" _ _ ")[0]) || config.key && config.key.some(key => instance.key == key))) result = instance.memoizedProps;
|
||||
if (instance.memoizedProps && (instance.type && config.name && config.name.some(name => (instance.type.render && instance.type.render.displayName || instance.type.displayName || instance.type.name || instance.type) === name.split(" _ _ ")[0]) || config.key && config.key.some(key => instance.key == key))) result = instance.memoizedProps;
|
||||
if (result === undefined) {
|
||||
let keys = Object.getOwnPropertyNames(instance);
|
||||
for (let i = 0; result === undefined && i < keys.length; i++) {
|
||||
|
@ -4445,9 +4450,6 @@
|
|||
selectSingleDark: "css-1k00wn6-singleValue",
|
||||
selectSingleLight: "css-6nrxdk-singleValue",
|
||||
selectValue: "css-1hwfws3",
|
||||
slateContainer: "slateContainer-3rqVBl",
|
||||
slatePlaceholder: "placeholder-P6ptfj",
|
||||
slateTextArea: "slateTextArea-1bp44y",
|
||||
splashBackground: "splashBackground-1FRCko",
|
||||
stopAnimations: "stop-animations",
|
||||
subtext: "subtext-3CDbHg",
|
||||
|
@ -5860,9 +5862,6 @@
|
|||
textareapickerbuttoncontainer: ["ChannelTextArea", "buttonContainer"],
|
||||
textareapickerbuttons: ["ChannelTextArea", "buttons"],
|
||||
textareascrollablecontainer: ["ChannelTextArea", "scrollableContainer"],
|
||||
textareaslate: ["NotFound", "slateTextArea"],
|
||||
textareaslatecontainer: ["NotFound", "slateContainer"],
|
||||
textareaslateplaceholder: ["NotFound", "slatePlaceholder"],
|
||||
textareauploadinput: ["ChannelTextAreaAttachButton", "uploadInput"],
|
||||
textareawebkit: ["ChannelTextArea", "webkit"],
|
||||
textareawrapall: ["ChannelTextArea", "channelTextArea"],
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -268,10 +268,11 @@ class ChatAliases {
|
|||
}
|
||||
|
||||
processChannelAutoComplete (e) {
|
||||
let minLength = BDFDB.DataUtils.get(this, "amounts", "minAliasLength");
|
||||
e.instance.state.autocompleteOptions.ALIASES = {
|
||||
matches: (firstChar, rest, isFirstWord) => {
|
||||
let currentLastWord = BDFDB.StringUtils.getCurrentWord(e.instance.props.editorRef.current.props.richValue).word || "";
|
||||
for (let word in this.aliases) {
|
||||
if (currentLastWord.length >= minLength) for (let word in this.aliases) {
|
||||
let aliasdata = this.aliases[word];
|
||||
if (!aliasdata.regex && aliasdata.autoc) {
|
||||
if (aliasdata.exact) {
|
||||
|
@ -335,9 +336,9 @@ class ChatAliases {
|
|||
if (e.instance.state.autocompleteType == "COMMAND" && BDFDB.ArrayUtils.is(e.instance.state.autocompletes.commands)) {
|
||||
for (let i in e.instance.state.autocompletes.commands) if (e.instance.state.autocompletes.commands[i].alias) e.instance.state.autocompletes.commands[i] = null;
|
||||
e.instance.state.autocompletes.commands = e.instance.state.autocompletes.commands.filter(n => n);
|
||||
let currentLastWord = BDFDB.StringUtils.getCurrentWord(e.instance.props.editorRef.current.props.richValue).word;
|
||||
let currentLastWord = BDFDB.StringUtils.getCurrentWord(e.instance.props.editorRef.current.props.richValue).word || "";
|
||||
let commandAliases = BDFDB.ObjectUtils.filter(this.aliases, key => key.startsWith("/"), true);
|
||||
if (currentLastWord) for (let word in commandAliases) {
|
||||
if (currentLastWord.length >= minLength) for (let word in commandAliases) {
|
||||
if (e.instance.state.autocompletes.commands.length >= BDFDB.DiscordConstants.MAX_AUTOCOMPLETE_RESULTS) break;
|
||||
let aliasdata = commandAliases[word];
|
||||
let command = {command: word.slice(1), description: aliasdata.replace, alias:true};
|
||||
|
|
Loading…
Reference in New Issue