Update EditServers.plugin.js

This commit is contained in:
Mirco Wittrien 2020-02-17 12:04:17 +01:00
parent a282f35379
commit fd6a1c0686
1 changed files with 32 additions and 33 deletions

View File

@ -389,18 +389,18 @@ var EditServers = (_ => {
children: [ children: [
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormItem, { BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormItem, {
title: this.labels.modal_guildname_text, title: this.labels.modal_guildname_text,
className: BDFDB.disCN.marginbottom8, className: BDFDB.disCN.marginbottom8 + " input-guildname",
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TextInput, { children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TextInput, {
inputClassName: "input-guildname", inputId: "GUILDNAME",
value: data.name, value: data.name,
placeholder: guild.name, placeholder: guild.name,
autoFocus: true, autoFocus: true,
onChange: (value, instance) => { onChange: (value, instance) => {
if (!currentIgnoreCustomNameState) { if (!currentIgnoreCustomNameState) {
let acronyminputins = BDFDB.ReactUtils.findOwner(instance._reactInternalFiber.return.return.return, {props:[["inputId","GUILDACRONYM"]]}); let acronymInputIns = BDFDB.ReactUtils.findOwner(instance._reactInternalFiber.return.return.return, {props:[["inputId","GUILDACRONYM"]]});
if (acronyminputins) { if (acronymInputIns) {
acronyminputins.props.placeholder = value && BDFDB.LibraryModules.StringUtils.getAcronym(value) || guild.acronym; acronymInputIns.props.placeholder = value && BDFDB.LibraryModules.StringUtils.getAcronym(value) || guild.acronym;
BDFDB.ReactUtils.forceUpdate(acronyminputins); BDFDB.ReactUtils.forceUpdate(acronymInputIns);
} }
} }
} }
@ -408,9 +408,9 @@ var EditServers = (_ => {
}), }),
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormItem, { BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormItem, {
title: this.labels.modal_guildacronym_text, title: this.labels.modal_guildacronym_text,
className: BDFDB.disCN.marginbottom4, className: BDFDB.disCN.marginbottom4 + " input-guildacronym",
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TextInput, { children:
inputClassName: "input-guildacronym", BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TextInput, {
inputId: "GUILDACRONYM", inputId: "GUILDACRONYM",
value: data.shortName, value: data.shortName,
placeholder: !data.ignoreCustomName && data.name && BDFDB.LibraryModules.StringUtils.getAcronym(data.name) || guild.acronym placeholder: !data.ignoreCustomName && data.name && BDFDB.LibraryModules.StringUtils.getAcronym(data.name) || guild.acronym
@ -424,18 +424,18 @@ var EditServers = (_ => {
value: data.ignoreCustomName, value: data.ignoreCustomName,
onChange: (value, instance) => { onChange: (value, instance) => {
currentIgnoreCustomNameState = value; currentIgnoreCustomNameState = value;
let acronyminputins = BDFDB.ReactUtils.findOwner(instance._reactInternalFiber.return, {props:[["inputId","GUILDACRONYM"]]}); let nameInputIns = BDFDB.ReactUtils.findOwner(instance._reactInternalFiber.return, {props:[["inputId","GUILDNAME"]]});
if (acronyminputins) { let acronymInputIns = BDFDB.ReactUtils.findOwner(instance._reactInternalFiber.return, {props:[["inputId","GUILDACRONYM"]]});
acronyminputins.props.placeholder = !value && data.name && BDFDB.LibraryModules.StringUtils.getAcronym(data.name) || guild.acronym; if (nameInputIns && acronymInputIns) {
BDFDB.ReactUtils.forceUpdate(acronyminputins); acronymInputIns.props.placeholder = !value && nameInputIns.props.value && BDFDB.LibraryModules.StringUtils.getAcronym(nameInputIns.props.value) || guild.acronym;
BDFDB.ReactUtils.forceUpdate(acronymInputIns);
} }
} }
}), }),
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormItem, { BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormItem, {
title: this.labels.modal_guildicon_text, title: this.labels.modal_guildicon_text,
className: BDFDB.disCN.marginbottom4, className: BDFDB.disCN.marginbottom4 + " input-guildicon",
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TextInput, { children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TextInput, {
inputClassName: "input-guildicon",
inputId: "GUILDICON", inputId: "GUILDICON",
success: !data.removeIcon && data.url, success: !data.removeIcon && data.url,
value: data.url, value: data.url,
@ -453,20 +453,19 @@ var EditServers = (_ => {
tag: BDFDB.LibraryComponents.FormComponents.FormTitle.Tags.H5, tag: BDFDB.LibraryComponents.FormComponents.FormTitle.Tags.H5,
value: data.removeIcon, value: data.removeIcon,
onChange: (value, instance) => { onChange: (value, instance) => {
let iconinputins = BDFDB.ReactUtils.findOwner(instance._reactInternalFiber.return, {props:[["inputId","GUILDICON"]]}); let iconInputIns = BDFDB.ReactUtils.findOwner(instance._reactInternalFiber.return, {props:[["inputId","GUILDICON"]]});
if (iconinputins) { if (iconInputIns) {
delete iconinputins.props.success; delete iconInputIns.props.success;
delete iconinputins.props.errorMessage; delete iconInputIns.props.errorMessage;
iconinputins.props.disabled = value; iconInputIns.props.disabled = value;
BDFDB.ReactUtils.forceUpdate(iconinputins); BDFDB.ReactUtils.forceUpdate(iconInputIns);
} }
} }
}), }),
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormItem, { BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormItem, {
title: this.labels.modal_guildbanner_text, title: this.labels.modal_guildbanner_text,
className: BDFDB.disCN.marginbottom4, className: BDFDB.disCN.marginbottom4 + " input-guildbanner",
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TextInput, { children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TextInput, {
inputClassName: "input-guildbanner",
inputId: "GUILDBANNER", inputId: "GUILDBANNER",
success: !data.removeBanner && data.banner, success: !data.removeBanner && data.banner,
value: data.banner, value: data.banner,
@ -485,12 +484,12 @@ var EditServers = (_ => {
value: data.removeBanner, value: data.removeBanner,
disabled: guild.id == "410787888507256842", disabled: guild.id == "410787888507256842",
onChange: (value, instance) => { onChange: (value, instance) => {
let bannerinputins = BDFDB.ReactUtils.findOwner(instance._reactInternalFiber.return, {props:[["inputId","GUILDBANNER"]]}); let bannerInputIns = BDFDB.ReactUtils.findOwner(instance._reactInternalFiber.return, {props:[["inputId","GUILDBANNER"]]});
if (bannerinputins) { if (bannerInputIns) {
delete bannerinputins.props.success; delete bannerInputIns.props.success;
delete bannerinputins.props.errorMessage; delete bannerInputIns.props.errorMessage;
bannerinputins.props.disabled = value; bannerInputIns.props.disabled = value;
BDFDB.ReactUtils.forceUpdate(bannerinputins); BDFDB.ReactUtils.forceUpdate(bannerInputIns);
} }
} }
}) })
@ -554,12 +553,12 @@ var EditServers = (_ => {
click: modal => { click: modal => {
let olddata = Object.assign({}, data); let olddata = Object.assign({}, data);
let guildnameinput = modal.querySelector(".input-guildname"); let guildnameinput = modal.querySelector(".input-guildname " + BDFDB.dotCN.input);
let guildacronyminput = modal.querySelector(".input-guildacronym"); let guildacronyminput = modal.querySelector(".input-guildacronym " + BDFDB.dotCN.input);
let ignorecustomnameinput = modal.querySelector(".input-ignorecustomname " + BDFDB.dotCN.switchinner); let ignorecustomnameinput = modal.querySelector(".input-ignorecustomname " + BDFDB.dotCN.switchinner);
let guildiconinput = modal.querySelector(".input-guildicon"); let guildiconinput = modal.querySelector(".input-guildicon " + BDFDB.dotCN.input);
let removeiconinput = modal.querySelector(".input-removeicon " + BDFDB.dotCN.switchinner); let removeiconinput = modal.querySelector(".input-removeicon " + BDFDB.dotCN.switchinner);
let guildbannerinput = modal.querySelector(".input-guildbanner"); let guildbannerinput = modal.querySelector(".input-guildbanner " + BDFDB.dotCN.input);
let removebannerinput = modal.querySelector(".input-removebanner " + BDFDB.dotCN.switchinner); let removebannerinput = modal.querySelector(".input-removebanner " + BDFDB.dotCN.switchinner);
data.name = guildnameinput.value.trim() || null; data.name = guildnameinput.value.trim() || null;