This commit is contained in:
Mirco Wittrien 2019-10-21 12:59:51 +02:00
parent 30c652357e
commit bf4e5f87b7
4 changed files with 35 additions and 20 deletions

View File

@ -1027,7 +1027,13 @@ var BDFDB = {myPlugins: BDFDB && BDFDB.myPlugins || {}, BDv2Api: BDFDB && BDFDB.
}
}
}
if (result == null) for (let key of Object.getOwnPropertyNames(instance)) if (key && whitelist[key] && (typeof instance[key] === "object" || typeof instance[key] === "function")) result = getOwner(instance[key]);
if (result == null) {
let keys = Object.getOwnPropertyNames(instance);
for (let i = 0; result == null && i < keys.length; i++) {
let key = keys[i];
if (key && whitelist[key] && (typeof instance[key] === "object" || typeof instance[key] === "function")) result = getOwner(instance[key]);
}
}
}
depth--;
return result;
@ -1070,23 +1076,29 @@ var BDFDB = {myPlugins: BDFDB && BDFDB.myPlugins || {}, BDv2Api: BDFDB && BDFDB.
function getKey(instance) {
depth++;
var result = null;
if (instance && !Node.prototype.isPrototypeOf(instance) && !BDFDB.ReactUtils.getInstance(instance) && depth < maxdepth && performance.now() - start < maxtime) for (let key of Object.getOwnPropertyNames(instance)) if (key && !blacklist[key]) {
var value = instance[key];
if (searchkey === key && (config.value === undefined || BDFDB.equals(config.value, value))) {
if (config.all === undefined || !config.all) result = value;
else if (config.all) {
if (config.noCopies === undefined || !config.noCopies) foundkeys.push(value);
else if (config.noCopies) {
var copy = false;
for (let foundkey of foundkeys) if (BDFDB.equals(value, foundkey)) {
copy = true;
break;
if (instance && !Node.prototype.isPrototypeOf(instance) && !BDFDB.ReactUtils.getInstance(instance) && depth < maxdepth && performance.now() - start < maxtime) {
let keys = Object.getOwnPropertyNames(instance);
for (let i = 0; result == null && i < keys.length; i++) {
let key = keys[i];
if (key && !blacklist[key]) {
var value = instance[key];
if (searchkey === key && (config.value === undefined || BDFDB.equals(config.value, value))) {
if (config.all === undefined || !config.all) result = value;
else if (config.all) {
if (config.noCopies === undefined || !config.noCopies) foundkeys.push(value);
else if (config.noCopies) {
var copy = false;
for (let foundkey of foundkeys) if (BDFDB.equals(value, foundkey)) {
copy = true;
break;
}
if (!copy) foundkeys.push(value);
}
}
if (!copy) foundkeys.push(value);
}
else if ((typeof value === "object" || typeof value === "function") && (whitelist[key] || key[0] == "." || !isNaN(key[0]))) result = getKey(value);
}
}
else if ((typeof value === "object" || typeof value === "function") && (whitelist[key] || key[0] == "." || !isNaN(key[0]))) result = getKey(value);
}
depth--;
return result;

File diff suppressed because one or more lines are too long

View File

@ -261,6 +261,7 @@ class EditServers {
children: [
BDFDB.React.createElement(BDFDB.LibraryComponents.TextInput, {
inputClassName: !data.removeIcon && data.url ? BDFDB.disCN.inputsuccess : null,
inputId: "GUILDICON",
value: data.url,
placeholder: BDFDB.getGuildIcon(info.id),
disabled: data.removeIcon,
@ -279,7 +280,7 @@ class EditServers {
label: this.labels.modal_removeicon_text,
value: data.removeIcon,
onChange: (value, instance) => {
let iconinputins = BDFDB.getReactValue(instance, "_reactInternalFiber.return.child.sibling.sibling.child.child.sibling.child.stateNode");
let iconinputins = BDFDB.ReactUtils.findOwner(instance._reactInternalFiber.return, {props:[["inputId","GUILDICON"]]});
if (iconinputins) {
iconinputins.props.inputClassName = null;
iconinputins.props.disabled = value;
@ -293,6 +294,7 @@ class EditServers {
children: [
BDFDB.React.createElement(BDFDB.LibraryComponents.TextInput, {
inputClassName: !data.removeBanner && data.banner ? BDFDB.disCN.inputsuccess : null,
inputId: "GUILDBANNER",
value: data.banner,
placeholder: BDFDB.getGuildBanner(info.id),
disabled: data.removeBanner || info.id == "410787888507256842",
@ -312,7 +314,7 @@ class EditServers {
value: data.removeBanner,
disabled: info.id == "410787888507256842",
onChange: (value, instance) => {
let bannerinputins = BDFDB.getReactValue(instance, "_reactInternalFiber.return.child.sibling.sibling.child.child.sibling.child.stateNode");
let bannerinputins = BDFDB.ReactUtils.findOwner(instance._reactInternalFiber.return, {props:[["inputId","GUILDBANNER"]]});
if (bannerinputins) {
bannerinputins.props.inputClassName = null;
bannerinputins.props.disabled = value;

View File

@ -268,6 +268,7 @@ class EditUsers {
children: [
BDFDB.React.createElement(BDFDB.LibraryComponents.TextInput, {
inputClassName: !data.removeIcon && data.url ? BDFDB.disCN.inputsuccess : null,
inputId: "USERAVATAR",
value: data.url,
placeholder: BDFDB.getUserAvatar(info.id),
disabled: data.removeIcon,
@ -286,7 +287,7 @@ class EditUsers {
label: this.labels.modal_removeicon_text,
value: data.removeIcon,
onChange: (value, instance) => {
let avatarinputins = BDFDB.getReactValue(instance, "_reactInternalFiber.return.child.sibling.sibling.child.child.sibling.child.stateNode");
let avatarinputins = BDFDB.ReactUtils.findOwner(instance._reactInternalFiber.return, {props:[["inputId","USERAVATAR"]]});
if (avatarinputins) {
avatarinputins.props.inputClassName = null;
avatarinputins.props.disabled = value;
@ -352,8 +353,8 @@ class EditUsers {
label: this.labels.modal_ignoretagcolor_text,
value: data.ignoreTagColor,
onChange: (value, instance) => {
let colorpicker3ins = BDFDB.getReactValue(instance, "_reactInternalFiber.return.child.child.child.sibling.child.stateNode");
let colorpicker4ins = BDFDB.getReactValue(instance, "_reactInternalFiber.return.child.sibling.child.child.sibling.child.stateNode");
let colorpicker3ins = BDFDB.ReactUtils.findOwner(instance._reactInternalFiber.return, {props:[["number",3]]});
let colorpicker4ins = BDFDB.ReactUtils.findOwner(instance._reactInternalFiber.return, {props:[["number",4]]});
if (colorpicker3ins) colorpicker3ins.setState({disabled: value});
if (colorpicker4ins) colorpicker4ins.setState({disabled: value});
}