This commit is contained in:
Mirco Wittrien 2020-02-17 13:16:17 +01:00
parent fd6a1c0686
commit 1e07d0bfb4
2 changed files with 283 additions and 229 deletions

View File

@ -389,15 +389,16 @@ var EditServers = (_ => {
children: [
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormItem, {
title: this.labels.modal_guildname_text,
className: BDFDB.disCN.marginbottom8 + " input-guildname",
className: BDFDB.disCN.marginbottom20,
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TextInput, {
inputId: "GUILDNAME",
className: "input-guildname",
key: "GUILDNAME",
value: data.name,
placeholder: guild.name,
autoFocus: true,
onChange: (value, instance) => {
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, {key: "GUILDACRONYM"});
if (acronymInputIns) {
acronymInputIns.props.placeholder = value && BDFDB.LibraryModules.StringUtils.getAcronym(value) || guild.acronym;
BDFDB.ReactUtils.forceUpdate(acronymInputIns);
@ -408,90 +409,123 @@ var EditServers = (_ => {
}),
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormItem, {
title: this.labels.modal_guildacronym_text,
className: BDFDB.disCN.marginbottom4 + " input-guildacronym",
className: BDFDB.disCN.marginbottom8,
children:
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TextInput, {
inputId: "GUILDACRONYM",
className: "input-guildacronym",
key: "GUILDACRONYM",
value: data.shortName,
placeholder: !data.ignoreCustomName && data.name && BDFDB.LibraryModules.StringUtils.getAcronym(data.name) || guild.acronym
})
}),
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsItem, {
type: "Switch",
className: BDFDB.disCN.marginbottom8 + " input-ignorecustomname",
className: BDFDB.disCN.marginbottom20 + " input-ignorecustomname",
label: this.labels.modal_ignorecustomname_text,
tag: BDFDB.LibraryComponents.FormComponents.FormTitle.Tags.H5,
value: data.ignoreCustomName,
onChange: (value, instance) => {
currentIgnoreCustomNameState = value;
let nameInputIns = BDFDB.ReactUtils.findOwner(instance._reactInternalFiber.return, {props:[["inputId","GUILDNAME"]]});
let acronymInputIns = BDFDB.ReactUtils.findOwner(instance._reactInternalFiber.return, {props:[["inputId","GUILDACRONYM"]]});
let nameInputIns = BDFDB.ReactUtils.findOwner(instance._reactInternalFiber.return, {key: "GUILDNAME"});
let acronymInputIns = BDFDB.ReactUtils.findOwner(instance._reactInternalFiber.return, {key: "GUILDACRONYM"});
if (nameInputIns && 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, {
title: this.labels.modal_guildicon_text,
className: BDFDB.disCN.marginbottom4 + " input-guildicon",
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TextInput, {
inputId: "GUILDICON",
success: !data.removeIcon && data.url,
value: data.url,
placeholder: BDFDB.GuildUtils.getIcon(guild.id),
disabled: data.removeIcon,
onChange: (value, instance) => {
this.checkUrl(value, instance);
}
})
BDFDB.ReactUtils.createElement("div", {
className: BDFDB.disCN.marginbottom20,
children: [
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Flex, {
className: BDFDB.disCN.marginbottom8,
align: BDFDB.LibraryComponents.Flex.Align.CENTER,
direction: BDFDB.LibraryComponents.Flex.Direction.HORIZONTAL,
children: [
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormTitle, {
className: BDFDB.disCN.marginreset,
tag: BDFDB.LibraryComponents.FormComponents.FormTitle.Tags.H5,
children: this.labels.modal_guildicon_text
}),
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsItem, {
className: "input-removeicon",
type: "Switch",
grow: 0,
label: BDFDB.LanguageUtils.LanguageStrings.REMOVE,
tag: BDFDB.LibraryComponents.FormComponents.FormTitle.Tags.H5,
value: data.removeIcon,
onChange: (value, instance) => {
let iconInputIins = BDFDB.ReactUtils.findOwner(instance._reactInternalFiber.return.return, {key: "GUILDICON"});
if (iconInputIins) {
delete iconInputIins.props.success;
delete iconInputIins.props.errorMessage;
iconInputIins.props.disabled = value;
BDFDB.ReactUtils.forceUpdate(iconInputIins);
}
}
})
]
}),
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TextInput, {
className: "input-guildicon",
key: "GUILDICON",
success: !data.removeIcon && data.url,
maxLength: 100000000000000000000,
value: data.url,
placeholder: BDFDB.GuildUtils.getIcon(guild.id),
disabled: data.removeIcon,
onChange: (value, instance) => {
this.checkUrl(value, instance);
}
})
]
}),
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsItem, {
type: "Switch",
className: BDFDB.disCN.marginbottom8 + " input-removeicon",
label: this.labels.modal_removeicon_text,
tag: BDFDB.LibraryComponents.FormComponents.FormTitle.Tags.H5,
value: data.removeIcon,
onChange: (value, instance) => {
let iconInputIns = BDFDB.ReactUtils.findOwner(instance._reactInternalFiber.return, {props:[["inputId","GUILDICON"]]});
if (iconInputIns) {
delete iconInputIns.props.success;
delete iconInputIns.props.errorMessage;
iconInputIns.props.disabled = value;
BDFDB.ReactUtils.forceUpdate(iconInputIns);
}
}
}),
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormItem, {
title: this.labels.modal_guildbanner_text,
className: BDFDB.disCN.marginbottom4 + " input-guildbanner",
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TextInput, {
inputId: "GUILDBANNER",
success: !data.removeBanner && data.banner,
value: data.banner,
placeholder: BDFDB.GuildUtils.getBanner(guild.id),
disabled: data.removeBanner || guild.id == "410787888507256842",
onChange: (value, instance) => {
this.checkUrl(value, instance);
}
})
}),
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsItem, {
type: "Switch",
className: BDFDB.disCN.marginbottom20 + " input-removebanner",
label: this.labels.modal_removebanner_text,
tag: BDFDB.LibraryComponents.FormComponents.FormTitle.Tags.H5,
value: data.removeBanner,
disabled: guild.id == "410787888507256842",
onChange: (value, instance) => {
let bannerInputIns = BDFDB.ReactUtils.findOwner(instance._reactInternalFiber.return, {props:[["inputId","GUILDBANNER"]]});
if (bannerInputIns) {
delete bannerInputIns.props.success;
delete bannerInputIns.props.errorMessage;
bannerInputIns.props.disabled = value;
BDFDB.ReactUtils.forceUpdate(bannerInputIns);
}
}
BDFDB.ReactUtils.createElement("div", {
className: BDFDB.disCN.marginbottom20,
children: [
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Flex, {
className: BDFDB.disCN.marginbottom8,
align: BDFDB.LibraryComponents.Flex.Align.CENTER,
direction: BDFDB.LibraryComponents.Flex.Direction.HORIZONTAL,
children: [
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormTitle, {
className: BDFDB.disCN.marginreset,
tag: BDFDB.LibraryComponents.FormComponents.FormTitle.Tags.H5,
children: this.labels.modal_guildbanner_text
}),
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsItem, {
className: "input-removebanner",
type: "Switch",
grow: 0,
label: BDFDB.LanguageUtils.LanguageStrings.REMOVE,
tag: BDFDB.LibraryComponents.FormComponents.FormTitle.Tags.H5,
value: data.removeBanner && guild.id != "410787888507256842",
disabled: guild.id == "410787888507256842",
onChange: (value, instance) => {
let bannerInputIns = BDFDB.ReactUtils.findOwner(instance._reactInternalFiber.return.return, {key: "GUILDBANNER"});
if (bannerInputIns) {
delete bannerInputIns.props.success;
delete bannerInputIns.props.errorMessage;
bannerInputIns.props.disabled = value;
BDFDB.ReactUtils.forceUpdate(bannerInputIns);
}
}
})
]
}),
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TextInput, {
className: "input-guildbanner",
key: "GUILDBANNER",
success: !data.removeBanner && data.banner,
maxLength: 100000000000000000000,
value: data.banner,
placeholder: BDFDB.GuildUtils.getBanner(guild.id),
disabled: data.removeBanner || guild.id == "410787888507256842",
onChange: (value, instance) => {
this.checkUrl(value, instance);
}
})
]
})
]
}),
@ -626,9 +660,7 @@ var EditServers = (_ => {
modal_guildacronym_text: "Akronim lokalnog poslužitelja",
modal_ignorecustomname_text: "Koristite izvorno ime poslužitelja za akronim poslužitelja",
modal_guildicon_text: "Ikona",
modal_removeicon_text: "Ukloni ikonu",
modal_guildbanner_text: "Baner",
modal_removebanner_text: "Uklonite baner",
modal_tabheader1_text: "Poslužitelja",
modal_tabheader2_text: "Boja ikona",
modal_tabheader3_text: "Boja tooltip",
@ -648,9 +680,7 @@ var EditServers = (_ => {
modal_guildacronym_text: "Lokalt serverakronym",
modal_ignorecustomname_text: "Brug det originale servernavn til serverens akronym",
modal_guildicon_text: "Ikon",
modal_removeicon_text: "Fjern ikon",
modal_guildbanner_text: "Banner",
modal_removebanner_text: "Fjern banner",
modal_tabheader1_text: "Server",
modal_tabheader2_text: "Ikonfarve",
modal_tabheader3_text: "Tooltipfarve",
@ -670,9 +700,7 @@ var EditServers = (_ => {
modal_guildacronym_text: "Lokale Serverkürzel",
modal_ignorecustomname_text: "Benutze den ursprünglichen Servernamen für das Serverkürzel",
modal_guildicon_text: "Icon",
modal_removeicon_text: "Icon entfernen",
modal_guildbanner_text: "Banner",
modal_removebanner_text: "Banner entfernen",
modal_tabheader1_text: "Server",
modal_tabheader2_text: "Iconfarbe",
modal_tabheader3_text: "Tooltipfarbe",
@ -692,9 +720,7 @@ var EditServers = (_ => {
modal_guildacronym_text: "Acrónimo local del servidor",
modal_ignorecustomname_text: "Use el nombre del servidor original para el acrónimo del servidor",
modal_guildicon_text: "Icono",
modal_removeicon_text: "Eliminar icono",
modal_guildbanner_text: "Bandera",
modal_removebanner_text: "Eliminar bandera",
modal_tabheader1_text: "Servidor",
modal_tabheader2_text: "Color del icono",
modal_tabheader3_text: "Color de tooltip",
@ -714,9 +740,7 @@ var EditServers = (_ => {
modal_guildacronym_text: "Acronyme local de serveur",
modal_ignorecustomname_text: "Utilisez le nom de serveur d'origine pour l'acronyme de serveur",
modal_guildicon_text: "Icône",
modal_removeicon_text: "Supprimer l'icône",
modal_guildbanner_text: "Bannière",
modal_removebanner_text: "Supprimer la bannière",
modal_tabheader1_text: "Serveur",
modal_tabheader2_text: "Couleur de l'icône",
modal_tabheader3_text: "Couleur de tooltip",
@ -736,9 +760,7 @@ var EditServers = (_ => {
modal_guildacronym_text: "Acronimo locale server",
modal_ignorecustomname_text: "Utilizzare il nome del server originale per l'acronimo del server",
modal_guildicon_text: "Icona",
modal_removeicon_text: "Rimuova l'icona",
modal_guildbanner_text: "Bandiera",
modal_removebanner_text: "Rimuovi bandiera",
modal_tabheader1_text: "Server",
modal_tabheader2_text: "Colore dell'icona",
modal_tabheader3_text: "Colore della tooltip",
@ -758,9 +780,7 @@ var EditServers = (_ => {
modal_guildacronym_text: "Lokale server acroniem",
modal_ignorecustomname_text: "Gebruik de oorspronkelijke servernaam voor het serveracrononiem",
modal_guildicon_text: "Icoon",
modal_removeicon_text: "Verwijder icoon",
modal_guildbanner_text: "Banier",
modal_removebanner_text: "Verwijder banier",
modal_tabheader1_text: "Server",
modal_tabheader2_text: "Icoonkleur",
modal_tabheader3_text: "Tooltipkleur",
@ -780,9 +800,7 @@ var EditServers = (_ => {
modal_guildacronym_text: "Lokalt serverforkortelse",
modal_ignorecustomname_text: "Bruk det originale servernavnet til serverforkortelsen",
modal_guildicon_text: "Ikon",
modal_removeicon_text: "Fjern ikon",
modal_guildbanner_text: "Banner",
modal_removebanner_text: "Fjern banner",
modal_tabheader1_text: "Server",
modal_tabheader2_text: "Ikonfarge",
modal_tabheader3_text: "Tooltipfarge",
@ -802,9 +820,7 @@ var EditServers = (_ => {
modal_guildacronym_text: "Akronim lokalnego serwera",
modal_ignorecustomname_text: "Użyj oryginalnej nazwy serwera dla akronimu serwera",
modal_guildicon_text: "Ikona",
modal_removeicon_text: "Usuń ikonę",
modal_guildbanner_text: "Baner",
modal_removebanner_text: "Usuń baner",
modal_tabheader1_text: "Serwer",
modal_tabheader2_text: "Kolor ikony",
modal_tabheader3_text: "Kolor podpowiedzi",
@ -824,9 +840,7 @@ var EditServers = (_ => {
modal_guildacronym_text: "Acrônimo local de servidor",
modal_ignorecustomname_text: "Use o nome do servidor original para a sigla do servidor",
modal_guildicon_text: "Icone",
modal_removeicon_text: "Remover ícone",
modal_guildbanner_text: "Bandeira",
modal_removebanner_text: "Remover bandeira",
modal_tabheader1_text: "Servidor",
modal_tabheader2_text: "Cor do ícone",
modal_tabheader3_text: "Cor da tooltip",
@ -846,9 +860,7 @@ var EditServers = (_ => {
modal_guildacronym_text: "Paikallisen palvelimen lyhenne",
modal_ignorecustomname_text: "Käytä alkuperäistä palvelimen nimeä palvelimen lyhenteessä",
modal_guildicon_text: "Ikonin",
modal_removeicon_text: "Poista kuvake",
modal_guildbanner_text: "Banneri",
modal_removebanner_text: "Poista banneri",
modal_tabheader1_text: "Palvelimen",
modal_tabheader2_text: "Ikoninväri",
modal_tabheader3_text: "Tooltipväri",
@ -868,9 +880,7 @@ var EditServers = (_ => {
modal_guildacronym_text: "Lokal server förkortning",
modal_ignorecustomname_text: "Använd det ursprungliga servernamnet för serverförkortningen",
modal_guildicon_text: "Ikon",
modal_removeicon_text: "Ta bort ikonen",
modal_guildbanner_text: "Banderoll",
modal_removebanner_text: "Ta bort banderoll",
modal_tabheader1_text: "Server",
modal_tabheader2_text: "Ikonfärg",
modal_tabheader3_text: "Tooltipfärg",
@ -890,9 +900,7 @@ var EditServers = (_ => {
modal_guildacronym_text: "Yerel sunucu kısaltması",
modal_ignorecustomname_text: "Sunucu kısaltması için orijinal sunucu adını kullanın",
modal_guildicon_text: "Simge",
modal_removeicon_text: "Simge kaldır",
modal_guildbanner_text: "Afişi",
modal_removebanner_text: "Afişi kaldır",
modal_tabheader1_text: "Sunucu",
modal_tabheader2_text: "Simge rengi",
modal_tabheader3_text: "Tooltip rengi",
@ -912,9 +920,7 @@ var EditServers = (_ => {
modal_guildacronym_text: "Zkratka místního serveru",
modal_ignorecustomname_text: "Pro zkratku serveru použijte původní název serveru",
modal_guildicon_text: "Ikony",
modal_removeicon_text: "Odstranit ikonu",
modal_guildbanner_text: "Prapor",
modal_removebanner_text: "Odstraňte prapor",
modal_tabheader1_text: "Server",
modal_tabheader2_text: "Barva ikony",
modal_tabheader3_text: "Barva tooltip",
@ -934,9 +940,7 @@ var EditServers = (_ => {
modal_guildacronym_text: "Акроним на локалния сървър",
modal_ignorecustomname_text: "Използвайте оригиналното име на сървъра за съкращението на сървъра",
modal_guildicon_text: "Икона",
modal_removeicon_text: "Премахване на иконата",
modal_guildbanner_text: "Знаме",
modal_removebanner_text: "Премахване на знаме",
modal_tabheader1_text: "Cървър",
modal_tabheader2_text: "Цвят на иконата",
modal_tabheader3_text: "Цвят на подсказка",
@ -956,9 +960,7 @@ var EditServers = (_ => {
modal_guildacronym_text: "Акроним локального сервера",
modal_ignorecustomname_text: "Используйте оригинальное имя сервера для сокращения сервера",
modal_guildicon_text: "Значок",
modal_removeicon_text: "Удалить значок",
modal_guildbanner_text: "Баннер",
modal_removebanner_text: "Удалить баннер",
modal_tabheader1_text: "Cервер",
modal_tabheader2_text: "Цвет значков",
modal_tabheader3_text: "Цвет подсказка",
@ -978,9 +980,7 @@ var EditServers = (_ => {
modal_guildacronym_text: "Акронім локального сервера",
modal_ignorecustomname_text: "Використовуйте оригінальне ім'я сервера для абревіатури сервера",
modal_guildicon_text: "Іконка",
modal_removeicon_text: "Видалити піктограму",
modal_guildbanner_text: "Банер",
modal_removebanner_text: "Видалити банер",
modal_tabheader1_text: "Cервер",
modal_tabheader2_text: "Колір ікони",
modal_tabheader3_text: "Колір підказка",
@ -1000,9 +1000,7 @@ var EditServers = (_ => {
modal_guildacronym_text: "ローカルサーバーの頭字語",
modal_ignorecustomname_text: "サーバーの頭字語に元のサーバー名を使用する",
modal_guildicon_text: "アイコン",
modal_removeicon_text: "アイコンを削除",
modal_guildbanner_text: "バナー",
modal_removebanner_text: "バナーを削除",
modal_tabheader1_text: "サーバー",
modal_tabheader2_text: "アイコンの色",
modal_tabheader3_text: "ツールチップの色",
@ -1022,9 +1020,7 @@ var EditServers = (_ => {
modal_guildacronym_text: "本地服務器縮寫",
modal_ignorecustomname_text: "使用原始服務器名稱作為服務器首字母縮寫",
modal_guildicon_text: "圖標",
modal_removeicon_text: "刪除圖標",
modal_guildbanner_text: "旗幟",
modal_removebanner_text: "刪除橫幅",
modal_tabheader1_text: "服務器",
modal_tabheader2_text: "圖標顏色",
modal_tabheader3_text: "工具提示顏色",
@ -1044,9 +1040,7 @@ var EditServers = (_ => {
modal_guildacronym_text: "로컬 서버 약어",
modal_ignorecustomname_text: "서버 약어에 원래 서버 이름을 사용하십시오",
modal_guildicon_text: "상",
modal_removeicon_text: "상 삭제",
modal_guildbanner_text: "기치",
modal_removebanner_text: "배너 삭제",
modal_tabheader1_text: "서버",
modal_tabheader2_text: "상 색깔",
modal_tabheader3_text: "툴팁 색깔",
@ -1066,9 +1060,7 @@ var EditServers = (_ => {
modal_guildacronym_text: "Local Serveracronym",
modal_ignorecustomname_text: "Use the original Servername for the Serveracronym",
modal_guildicon_text: "Icon",
modal_removeicon_text: "Remove Icon",
modal_guildbanner_text: "Banner",
modal_removebanner_text: "Remove Banner",
modal_tabheader1_text: "Server",
modal_tabheader2_text: "Iconcolor",
modal_tabheader3_text: "Tooltipcolor",

View File

@ -4,7 +4,7 @@ var EditUsers = (_ => {
return class EditUsers {
getName () {return "EditUsers";}
getVersion () {return "3.7.5";}
getVersion () {return "3.7.6";}
getAuthor () {return "DevilBro";}
@ -12,7 +12,7 @@ var EditUsers = (_ => {
constructor () {
this.changelog = {
"added":[["Message Color","You can now set unique message colors for users"]],
"added":[["Custom Status","Ever been spoiled by a custom status of a user? You can now set your own local status for ppl or complete remove the status of a user"],["Message Color","You can now set unique message colors for users"]],
"fixed":[["Colored Text","Changing a User Color will now properly change the message color if Colored Text is enabled"],["Message Update","Fixed the plugin for the new Message Update"]],
"improved":[["New Library Structure & React","Restructured my Library and switched to React rendering instead of DOM manipulation"]]
};
@ -38,6 +38,7 @@ var EditUsers = (_ => {
SettingsInvites: "render",
GuildSettingsBans: "render",
InvitationCard: "render",
PrivateChannel: "render",
PrivateChannelRecipientsInvitePopout: "render",
QuickSwitchUserResult: "render",
SearchPopoutComponent: "render",
@ -363,9 +364,12 @@ var EditUsers = (_ => {
let data = BDFDB.DataUtils.load(this, "users", e.instance.props.user.id);
if (!e.returnvalue) {
e.instance.props.user = this.getUserData(e.instance.props.user.id, true, true);
if (data && data.name) {
e.instance.props.nickname = data.name;
e.instance.props.guildMember = Object.assign({}, e.instance.props.guildMember, {nick: data.name});
if (data) {
if (data.name) {
e.instance.props.nickname = data.name;
e.instance.props.guildMember = Object.assign({}, e.instance.props.guildMember, {nick: data.name});
}
if (data.removeStatus || data.status) e.instance.props.customStatusActivity = this.createCustomStatus(data);
}
}
else {
@ -381,11 +385,25 @@ var EditUsers = (_ => {
}
processUserProfile (e) {
if (e.instance.props.user && BDFDB.DataUtils.get(this, "settings", "changeInUserProfile")) e.instance.props.user = this.getUserData(e.instance.props.user.id);
if (e.instance.props.user && BDFDB.DataUtils.get(this, "settings", "changeInUserProfile")) {
e.instance.props.user = this.getUserData(e.instance.props.user.id);
let data = BDFDB.DataUtils.load(this, "users", e.instance.props.user.id);
if (data && (data.removeStatus || data.status)) e.instance.props.customStatusActivity = this.createCustomStatus(data);
}
}
processUserInfo (e) {
if (e.instance.props.user && BDFDB.DataUtils.get(this, "settings", "changeInFriendList")) e.instance.props.user = this.getUserData(e.instance.props.user.id);
if (e.instance.props.user && BDFDB.DataUtils.get(this, "settings", "changeInFriendList")) {
e.instance.props.user = this.getUserData(e.instance.props.user.id);
if (BDFDB.ReactUtils.isValidElement(e.instance.props.subText)) {
let data = BDFDB.DataUtils.load(this, "users", e.instance.props.user.id);
if (data && (data.removeStatus || data.status)) {
e.instance.props.subText.props.activities = [].concat(e.instance.props.subText.props.activities).filter(n => n && n.type != 4);
let activity = this.createCustomStatus(data);
if (activity) e.instance.props.subText.props.activities.unshift(activity);
}
}
}
}
processNowPlayingHeader (e) {
@ -418,20 +436,21 @@ var EditUsers = (_ => {
processAccount (e) {
if (e.instance.props.currentUser && BDFDB.DataUtils.get(this, "settings", "changeInUserAccount")) {
if (!e.returnvalue) e.instance.props.currentUser = this.getUserData(e.instance.props.currentUser.id);
let data = BDFDB.DataUtils.load(this, "users", e.instance.props.currentUser.id);
if (!e.returnvalue) {
e.instance.props.currentUser = this.getUserData(e.instance.props.currentUser.id);
if (data && (data.removeStatus || data.status)) e.instance.props.customStatusActivity = this.createCustomStatus(data);
}
else {
let [children, index] = BDFDB.ReactUtils.findChildren(e.returnvalue, {name: "Tooltip"});
if (index > -1) {
if (typeof children[index].props.children == "function") {
let data = BDFDB.DataUtils.load(this, "users", e.instance.props.currentUser.id);
if (data && (data.color1 || data.color2)) {
let renderChildren = children[index].props.children;
children[index].props.children = (...args) => {
let renderedChildren = renderChildren(...args);
let [children2, index2] = BDFDB.ReactUtils.findChildren(renderedChildren, {name: "PanelTitle"});
if (index2 > -1) this.changeUserColor(children2[index2], e.instance.props.currentUser.id);
return renderedChildren;
}
if (data && (data.color1 || data.color2)) {
let [children, index] = BDFDB.ReactUtils.findChildren(e.returnvalue, {name: "Tooltip"});
if (index > -1 && typeof children[index].props.children == "function") {
let renderChildren = children[index].props.children;
children[index].props.children = (...args) => {
let renderedChildren = renderChildren(...args);
let [children2, index2] = BDFDB.ReactUtils.findChildren(renderedChildren, {name: "PanelTitle"});
if (index2 > -1) this.changeUserColor(children2[index2], e.instance.props.currentUser.id);
return renderedChildren;
}
}
}
@ -538,7 +557,14 @@ var EditUsers = (_ => {
if (!e.returnvalue) {
e.instance.props.user = this.getUserData(e.instance.props.user.id);
let data = BDFDB.DataUtils.load(this, "users", e.instance.props.user.id);
if (data && data.name) e.instance.props.nick = data.name;
if (data) {
if (data.name) e.instance.props.nick = data.name;
if (data.removeStatus || data.status) {
e.instance.props.activities = [].concat(e.instance.props.activities).filter(n => n.type != 4);
let activity = this.createCustomStatus(data);
if (activity) e.instance.props.activities.unshift(activity);
}
}
}
else {
this.changeUserColor(e.returnvalue.props.name, e.instance.props.user.id, {changeBackground: true});
@ -637,11 +663,20 @@ var EditUsers = (_ => {
processPrivateChannel (e) {
if (e.instance.props.user && BDFDB.DataUtils.get(this, "settings", "changeInDmsList")) {
e.returnvalue.props.name = BDFDB.ReactUtils.createElement("span", {children: this.getUserData(e.instance.props.user.id).username});
e.returnvalue.props.avatar.props.src = this.getUserAvatar(e.instance.props.user.id);
this.changeUserColor(e.returnvalue.props.name, e.instance.props.user.id, {changeBackground: true});
e.returnvalue.props.name = [e.returnvalue.props.name];
this.injectBadge(e.returnvalue.props.name, e.instance.props.user.id, null, 1);
if (!e.returnvalue) {
let data = BDFDB.DataUtils.load(this, "users", e.instance.props.user.id);
if (data && (data.removeStatus || data.status)) {
e.instance.props.activities = [].concat(e.instance.props.activities).filter(n => n.type != 4);
let activity = this.createCustomStatus(data);
if (activity) e.instance.props.activities.unshift(activity);
}
}
else {
e.returnvalue.props.name = BDFDB.ReactUtils.createElement("span", {children: this.getUserData(e.instance.props.user.id).username});
this.changeUserColor(e.returnvalue.props.name, e.instance.props.user.id, {changeBackground: true});
e.returnvalue.props.name = [e.returnvalue.props.name];
this.injectBadge(e.returnvalue.props.name, e.instance.props.user.id, null, 1);
}
}
}
@ -814,95 +849,139 @@ var EditUsers = (_ => {
}
}
createCustomStatus (data) {
return !BDFDB.ObjectUtils.is(data) || data.removeStatus ? null : {
created_at: (new Date()).getTime().toString(),
emoji: null,
id: "custom",
name: "Custom Status",
state: data.status,
type: 4
}
}
forceUpdateAll () {
this.changeAppTitle();
BDFDB.ModuleUtils.forceAllUpdates(this);
BDFDB.MessageUtils.rerenderAll();
}
openUserSettingsModal (info) {
let data = BDFDB.DataUtils.load(this, "users", info.id) || {};
let member = BDFDB.LibraryModules.MemberStore.getMember(BDFDB.LibraryModules.LastGuildStore.getGuildId(), info.id) || {};
openUserSettingsModal (user) {
let data = BDFDB.DataUtils.load(this, "users", user.id) || {};
let member = BDFDB.LibraryModules.MemberStore.getMember(BDFDB.LibraryModules.LastGuildStore.getGuildId(), user.id) || {};
let activity = BDFDB.LibraryModules.StatusMetaUtils.getApplicationActivity(user.id);
BDFDB.ModalUtils.open(this, {
size: "MEDIUM",
header: this.labels.modal_header_text,
subheader: member.nick || info.username,
subheader: member.nick || user.username,
children: [
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ModalComponents.ModalTabContent, {
tab: this.labels.modal_tabheader1_text,
children: [
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormItem, {
title: this.labels.modal_username_text,
className: BDFDB.disCN.marginbottom8 + " input-username",
className: BDFDB.disCN.marginbottom20 + " input-username",
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TextInput, {
value: data.name,
placeholder: member.nick || info.username,
placeholder: member.nick || user.username,
autoFocus: true
})
}),
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormItem, {
title: this.labels.modal_usertag_text,
className: BDFDB.disCN.marginbottom8 + " input-usertag",
className: BDFDB.disCN.marginbottom20 + " input-usertag",
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TextInput, {
value: data.tag
})
}),
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormItem, {
title: this.labels.modal_useravatar_text,
className: BDFDB.disCN.marginbottom4 + " input-useravatar",
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TextInput, {
inputId: "USERAVATAR",
success: !data.removeIcon && data.url,
value: data.url,
placeholder: BDFDB.UserUtils.getAvatar(info.id),
disabled: data.removeIcon,
onChange: (value, instance) => {
this.checkUrl(value, instance);
}
})
BDFDB.ReactUtils.createElement("div", {
className: BDFDB.disCN.marginbottom20,
children: [
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Flex, {
className: BDFDB.disCN.marginbottom8,
align: BDFDB.LibraryComponents.Flex.Align.CENTER,
direction: BDFDB.LibraryComponents.Flex.Direction.HORIZONTAL,
children: [
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormTitle, {
className: BDFDB.disCN.marginreset,
tag: BDFDB.LibraryComponents.FormComponents.FormTitle.Tags.H5,
children: this.labels.modal_useravatar_text
}),
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsItem, {
className: "input-removeicon",
type: "Switch",
grow: 0,
label: BDFDB.LanguageUtils.LanguageStrings.REMOVE,
tag: BDFDB.LibraryComponents.FormComponents.FormTitle.Tags.H5,
value: data.removeIcon,
onChange: (value, instance) => {
let avatarInputIins = BDFDB.ReactUtils.findOwner(instance._reactInternalFiber.return.return, {key: "USERAVATAR"});
if (avatarInputIins) {
delete avatarInputIins.props.success;
delete avatarInputIins.props.errorMessage;
avatarInputIins.props.disabled = value;
BDFDB.ReactUtils.forceUpdate(avatarInputIins);
}
}
})
]
}),
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TextInput, {
className: "input-useravatar",
key: "USERAVATAR",
success: !data.removeIcon && data.url,
maxLength: 100000000000000000000,
value: data.url,
placeholder: BDFDB.UserUtils.getAvatar(user.id),
disabled: data.removeIcon,
onChange: (value, instance) => {
this.checkUrl(value, instance);
}
})
]
}),
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsItem, {
type: "Switch",
className: BDFDB.disCN.marginbottom8 + " input-removeicon",
label: this.labels.modal_removeicon_text,
tag: BDFDB.LibraryComponents.FormComponents.FormTitle.Tags.H5,
value: data.removeIcon,
onChange: (value, instance) => {
let avatarInputIins = BDFDB.ReactUtils.findOwner(instance._reactInternalFiber.return, {props:[["inputId","USERAVATAR"]]});
if (avatarInputIins) {
delete avatarInputIins.props.success;
delete avatarInputIins.props.errorMessage;
avatarInputIins.props.disabled = value;
BDFDB.ReactUtils.forceUpdate(avatarInputIins);
}
}
}),
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormItem, {
title: this.labels.modal_useravatar_text,
className: BDFDB.disCN.marginbottom4 + " input-userstatus",
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TextInput, {
inputId: "USERSTATUS",
value: data.url,
placeholder: BDFDB.UserUtils.getAvatar(info.id),
disabled: data.removeStatus
})
}),
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsItem, {
type: "Switch",
className: BDFDB.disCN.marginbottom8 + " input-removestatus",
label: this.labels.modal_removeicon_text,
tag: BDFDB.LibraryComponents.FormComponents.FormTitle.Tags.H5,
value: data.removeStatus,
onChange: (value, instance) => {
let statusInputIns = BDFDB.ReactUtils.findOwner(instance._reactInternalFiber.return, {props:[["inputId","USERSTATUS"]]});
if (statusInputIns) {
delete statusInputIns.props.success;
delete statusInputIns.props.errorMessage;
statusInputIns.props.disabled = value;
BDFDB.ReactUtils.forceUpdate(statusInputIns);
}
}
BDFDB.ReactUtils.createElement("div", {
className: BDFDB.disCN.marginbottom20,
children: [
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Flex, {
className: BDFDB.disCN.marginbottom8,
align: BDFDB.LibraryComponents.Flex.Align.CENTER,
direction: BDFDB.LibraryComponents.Flex.Direction.HORIZONTAL,
children: [
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormTitle, {
className: BDFDB.disCN.marginreset,
tag: BDFDB.LibraryComponents.FormComponents.FormTitle.Tags.H5,
children: BDFDB.LanguageUtils.LanguageStrings.CUSTOM_STATUS
}),
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsItem, {
className: "input-removestatus",
type: "Switch",
grow: 0,
label: BDFDB.LanguageUtils.LanguageStrings.REMOVE,
tag: BDFDB.LibraryComponents.FormComponents.FormTitle.Tags.H5,
value: data.removeStatus,
onChange: (value, instance) => {
let statusInputIins = BDFDB.ReactUtils.findOwner(instance._reactInternalFiber.return.return, {key: "USERSTATUS"});
if (statusInputIins) {
delete statusInputIins.props.success;
delete statusInputIins.props.errorMessage;
statusInputIins.props.disabled = value;
BDFDB.ReactUtils.forceUpdate(statusInputIins);
}
}
})
]
}),
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TextInput, {
className: "input-userstatus",
key: "USERSTATUS",
maxLength: 100000000000000000000,
value: data.status,
placeholder: activity && activity.type == 4 && activity.state || "",
disabled: data.removeStatus
})
]
})
]
}),
@ -985,17 +1064,21 @@ var EditUsers = (_ => {
click: modal => {
let olddata = Object.assign({}, data);
let usernameinput = modal.querySelector(".input-username " + BDFDB.dotCN.input);
let usertaginput = modal.querySelector(".input-usertag " + BDFDB.dotCN.input);
let useravatarinput = modal.querySelector(".input-useravatar " + BDFDB.dotCN.input);
let removeiconinput = modal.querySelector(".input-removeicon " + BDFDB.dotCN.switchinner);
let ignoretagcolorinput = modal.querySelector(".input-ignoretagcolor " + BDFDB.dotCN.switchinner);
let userNameInput = modal.querySelector(".input-username " + BDFDB.dotCN.input);
let userTagInput = modal.querySelector(".input-usertag " + BDFDB.dotCN.input);
let userAvatarInput = modal.querySelector(".input-useravatar " + BDFDB.dotCN.input);
let removeIconInput = modal.querySelector(".input-removeicon " + BDFDB.dotCN.switchinner);
let userStatusInput = modal.querySelector(".input-userstatus " + BDFDB.dotCN.input);
let removeStatusInput = modal.querySelector(".input-removestatus " + BDFDB.dotCN.switchinner);
let ignoreTagColorInput = modal.querySelector(".input-ignoretagcolor " + BDFDB.dotCN.switchinner);
data.name = usernameinput.value.trim() || null;
data.tag = usertaginput.value.trim() || null;
data.url = (!data.removeIcon && BDFDB.DOMUtils.containsClass(useravatarinput, BDFDB.disCN.inputsuccess) ? useravatarinput.value.trim() : null) || null;
data.removeIcon = removeiconinput.checked;
data.ignoreTagColor = ignoretagcolorinput.checked;
data.name = userNameInput.value.trim() || null;
data.tag = userTagInput.value.trim() || null;
data.url = (!data.removeIcon && BDFDB.DOMUtils.containsClass(userAvatarInput, BDFDB.disCN.inputsuccess) ? userAvatarInput.value.trim() : null) || null;
data.removeIcon = removeIconInput.checked;
data.status = !data.removeStatus && userStatusInput.value.trim() || null;
data.removeStatus = removeStatusInput.checked;
data.ignoreTagColor = ignoreTagColorInput.checked;
data.color1 = BDFDB.ColorUtils.getSwatchColor(modal, 1);
data.color2 = BDFDB.ColorUtils.getSwatchColor(modal, 2);
@ -1004,8 +1087,8 @@ var EditUsers = (_ => {
data.color5 = BDFDB.ColorUtils.getSwatchColor(modal, 5);
let changed = false;
if (Object.keys(data).every(key => data[key] == null || data[key] == false) && (changed = true)) BDFDB.DataUtils.remove(this, "users", info.id);
else if (!BDFDB.equals(olddata, data) && (changed = true)) BDFDB.DataUtils.save(data, this, "users", info.id);
if (Object.keys(data).every(key => data[key] == null || data[key] == false) && (changed = true)) BDFDB.DataUtils.remove(this, "users", user.id);
else if (!BDFDB.equals(olddata, data) && (changed = true)) BDFDB.DataUtils.save(data, this, "users", user.id);
if (changed) this.forceUpdateAll();
}
}]
@ -1046,7 +1129,6 @@ var EditUsers = (_ => {
modal_username_text: "Lokalno korisničko ime",
modal_usertag_text: "Oznaka",
modal_useravatar_text: "Ikona",
modal_removeicon_text: "Ukloni ikonu",
modal_tabheader1_text: "Korisnik",
modal_tabheader2_text: "Boja naziva",
modal_tabheader3_text: "Boja oznaka",
@ -1068,7 +1150,6 @@ var EditUsers = (_ => {
modal_username_text: "Lokalt brugernavn",
modal_usertag_text: "Initialer",
modal_useravatar_text: "Ikon",
modal_removeicon_text: "Fjern ikon",
modal_tabheader1_text: "Bruger",
modal_tabheader2_text: "Navnefarve",
modal_tabheader3_text: "Etiketfarve",
@ -1090,7 +1171,6 @@ var EditUsers = (_ => {
modal_username_text: "Lokaler Benutzername",
modal_usertag_text: "Etikett",
modal_useravatar_text: "Icon",
modal_removeicon_text: "Entferne Icon",
modal_tabheader1_text: "Benutzer",
modal_tabheader2_text: "Namensfarbe",
modal_tabheader3_text: "Etikettfarbe",
@ -1112,7 +1192,6 @@ var EditUsers = (_ => {
modal_username_text: "Nombre local de usuario",
modal_usertag_text: "Etiqueta",
modal_useravatar_text: "Icono",
modal_removeicon_text: "Eliminar icono",
modal_tabheader1_text: "Usuario",
modal_tabheader2_text: "Color del nombre",
modal_tabheader3_text: "Color de la etiqueta",
@ -1134,7 +1213,6 @@ var EditUsers = (_ => {
modal_username_text: "Nom local d'utilisateur",
modal_usertag_text: "Étiquette",
modal_useravatar_text: "Icône",
modal_removeicon_text: "Supprimer l'icône",
modal_tabheader1_text: "Serveur",
modal_tabheader2_text: "Couleur du nom",
modal_tabheader3_text: "Couleur de l'étiquette",
@ -1156,7 +1234,6 @@ var EditUsers = (_ => {
modal_username_text: "Nome locale utente",
modal_usertag_text: "Etichetta",
modal_useravatar_text: "Icona",
modal_removeicon_text: "Rimuova l'icona",
modal_tabheader1_text: "Utente",
modal_tabheader2_text: "Colore del nome",
modal_tabheader3_text: "Colore della etichetta",
@ -1178,7 +1255,6 @@ var EditUsers = (_ => {
modal_username_text: "Lokale gebruikernaam",
modal_usertag_text: "Etiket",
modal_useravatar_text: "Icoon",
modal_removeicon_text: "Verwijder icoon",
modal_tabheader1_text: "Gebruiker",
modal_tabheader2_text: "Naamkleur",
modal_tabheader3_text: "Etiketkleur",
@ -1200,7 +1276,6 @@ var EditUsers = (_ => {
modal_username_text: "Lokalt gebruikernavn",
modal_usertag_text: "Stikkord",
modal_useravatar_text: "Ikon",
modal_removeicon_text: "Fjern ikon",
modal_tabheader1_text: "Bruker",
modal_tabheader2_text: "Navnfarge",
modal_tabheader3_text: "Stikkordfarge",
@ -1222,7 +1297,6 @@ var EditUsers = (_ => {
modal_username_text: "Lokalna nazwa użytkownika",
modal_usertag_text: "Etykieta",
modal_useravatar_text: "Ikona",
modal_removeicon_text: "Usuń ikonę",
modal_tabheader1_text: "Użytkownik",
modal_tabheader2_text: "Kolor nazwy",
modal_tabheader3_text: "Kolor etykiety",
@ -1244,7 +1318,6 @@ var EditUsers = (_ => {
modal_username_text: "Nome local do utilizador",
modal_usertag_text: "Etiqueta",
modal_useravatar_text: "Icone",
modal_removeicon_text: "Remover ícone",
modal_tabheader1_text: "Utilizador",
modal_tabheader2_text: "Cor do nome",
modal_tabheader3_text: "Cor da etiqueta",
@ -1266,7 +1339,6 @@ var EditUsers = (_ => {
modal_username_text: "Paikallinen käyttäjätunnus",
modal_usertag_text: "Merkki",
modal_useravatar_text: "Ikonin",
modal_removeicon_text: "Poista kuvake",
modal_tabheader1_text: "Käyttäjä",
modal_tabheader2_text: "Nimiväri",
modal_tabheader3_text: "Merkkiväri",
@ -1288,7 +1360,6 @@ var EditUsers = (_ => {
modal_username_text: "Lokalt användarenamn",
modal_usertag_text: "Märka",
modal_useravatar_text: "Ikon",
modal_removeicon_text: "Ta bort ikonen",
modal_tabheader1_text: "Användare",
modal_tabheader2_text: "Namnfärg",
modal_tabheader3_text: "Märkafärg",
@ -1310,7 +1381,6 @@ var EditUsers = (_ => {
modal_username_text: "Yerel Kullanıcı Isim",
modal_usertag_text: "Etiket",
modal_useravatar_text: "Simge",
modal_removeicon_text: "Simge kaldır",
modal_tabheader1_text: "Kullanıcı",
modal_tabheader2_text: "Simge rengi",
modal_tabheader3_text: "Isim rengi",
@ -1332,7 +1402,6 @@ var EditUsers = (_ => {
modal_username_text: "Místní název uživatel",
modal_usertag_text: "Štítek",
modal_useravatar_text: "Ikony",
modal_removeicon_text: "Odstranit ikonu",
modal_tabheader1_text: "Uživatel",
modal_tabheader2_text: "Barva název",
modal_tabheader3_text: "Barva štítek",
@ -1354,7 +1423,6 @@ var EditUsers = (_ => {
modal_username_text: "Локално име на потребител",
modal_usertag_text: "Cвободен край",
modal_useravatar_text: "Икона",
modal_removeicon_text: "Премахване на иконата",
modal_tabheader1_text: "Потребител",
modal_tabheader2_text: "Цвят на име",
modal_tabheader3_text: "Цвят на свободен край",
@ -1376,7 +1444,6 @@ var EditUsers = (_ => {
modal_username_text: "Имя локального пользователь",
modal_usertag_text: "Tег",
modal_useravatar_text: "Значок",
modal_removeicon_text: "Удалить значок",
modal_tabheader1_text: "Пользователь",
modal_tabheader2_text: "Цвет имя",
modal_tabheader3_text: "Цвет тег",
@ -1398,7 +1465,6 @@ var EditUsers = (_ => {
modal_username_text: "Локальне ім'я користувач",
modal_usertag_text: "Tег",
modal_useravatar_text: "Іконка",
modal_removeicon_text: "Видалити піктограму",
modal_tabheader1_text: "Користувач",
modal_tabheader2_text: "Колір ім'я",
modal_tabheader3_text: "Колір тег",
@ -1420,7 +1486,6 @@ var EditUsers = (_ => {
modal_username_text: "ローカルユーザーー名",
modal_usertag_text: "タグ",
modal_useravatar_text: "アイコン",
modal_removeicon_text: "アイコンを削除",
modal_tabheader1_text: "ユーザー",
modal_tabheader2_text: "名の色",
modal_tabheader3_text: "タグの色",
@ -1442,7 +1507,6 @@ var EditUsers = (_ => {
modal_username_text: "用戶名稱",
modal_usertag_text: "標籤",
modal_useravatar_text: "圖標",
modal_removeicon_text: "刪除圖標",
modal_tabheader1_text: "用戶",
modal_tabheader2_text: "名稱顏色",
modal_tabheader3_text: "標籤顏色",
@ -1464,7 +1528,6 @@ var EditUsers = (_ => {
modal_username_text: "로컬 사용자 이름",
modal_usertag_text: "꼬리표",
modal_useravatar_text: "상",
modal_removeicon_text: "상 삭제",
modal_tabheader1_text: "사용자",
modal_tabheader2_text: "이름 색깔",
modal_tabheader3_text: "꼬리표 색깔",
@ -1486,7 +1549,6 @@ var EditUsers = (_ => {
modal_username_text: "Local Username",
modal_usertag_text: "Tag",
modal_useravatar_text: "Icon",
modal_removeicon_text: "Remove Icon",
modal_tabheader1_text: "User",
modal_tabheader2_text: "Namecolor",
modal_tabheader3_text: "Tagcolor",