BetterDiscordAddons/Plugins/EditUsers/EditUsers.plugin.js

1641 lines
83 KiB
JavaScript
Raw Normal View History

2019-09-20 22:32:52 +02:00
//META{"name":"EditUsers","website":"https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/EditUsers","source":"https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/Plugins/EditUsers/EditUsers.plugin.js"}*//
2018-10-11 10:21:26 +02:00
2019-07-21 16:27:11 +02:00
class EditUsers {
getName () {return "EditUsers";}
2020-01-08 09:40:17 +01:00
getVersion () {return "3.6.8";}
getAuthor () {return "DevilBro";}
2019-01-17 23:48:29 +01:00
getDescription () {return "Allows you to change the icon, name, tag and color of users.";}
2019-01-26 22:45:19 +01:00
2019-09-04 12:34:02 +02:00
constructor () {
2019-02-07 22:54:50 +01:00
this.changelog = {
2019-10-23 11:41:32 +02:00
"fixed":[["Account","Fixed the coloring in the account details container"]]
2019-02-07 22:54:50 +01:00
};
2019-09-04 12:34:02 +02:00
2019-11-14 17:56:26 +01:00
this.patchedModules = {
after: {
"ChannelTextArea":"componentDidMount",
"MemberListItem":["componentDidMount","componentDidUpdate"],
"UserPopout":["componentDidMount","componentDidUpdate"],
"UserProfile":["componentDidMount","componentDidUpdate"],
"FriendRow":"componentDidMount",
"VoiceUser":["componentDidMount","componentDidUpdate"],
"Account":["componentDidMount","componentDidUpdate"],
"AuditLog":"componentDidMount",
"BannedCard":"render",
"InviteCard":"render",
"MemberCard":"render",
"InvitationCard":"componentDidMount",
"TypingUsers":"componentDidUpdate",
"MessageUsername":["componentDidMount","componentDidUpdate"],
"DirectMessage":"componentDidMount",
"CallAvatar":"componentDidMount",
"VideoTile":"componentDidMount",
"PictureInPictureVideo":"componentDidMount",
"PrivateChannel":["componentDidMount","componentDidUpdate"],
"HeaderBar":["componentDidMount","componentDidUpdate"],
"HeaderBarContainer":["componentDidMount","componentDidUpdate"],
"Clickable":"componentDidMount",
"MessageContent":["componentDidMount","componentDidUpdate"],
"StandardSidebarView":"componentWillUnmount"
}
};
2019-09-04 12:34:02 +02:00
}
2019-01-26 22:45:19 +01:00
2019-09-04 12:34:02 +02:00
initConstructor () {
2019-07-20 10:56:48 +02:00
this.avatarselector = BDFDB.dotCNC.guildicon + BDFDB.dotCNC.avatar + BDFDB.dotCNC.callavatarwrapper + BDFDB.dotCN.voiceavatarcontainer;
2018-10-11 10:21:26 +02:00
this.css = `
2019-06-03 21:24:55 +02:00
${BDFDB.dotCN.bottag} {
2019-06-07 11:46:51 +02:00
line-height: 13px;
2019-06-03 21:24:55 +02:00
height: 13px;
2019-06-07 11:39:54 +02:00
top: unset;
bottom: 0px;
2019-06-03 21:24:55 +02:00
position: relative;
margin: 0 0 0 1ch;
}
2019-07-11 23:03:36 +02:00
${BDFDB.dotCN.userpopoutheaderbottagwithnickname} {
2019-06-07 11:39:54 +02:00
bottom: 4px;
}
2019-08-06 20:53:56 +02:00
${BDFDB.dotCN.userpopoutheaderbottagwithnickname} {
2019-06-07 11:46:51 +02:00
bottom: 0px;
}
2019-08-06 20:53:56 +02:00
${BDFDB.dotCNS.userpopoutheadernamewrapper + BDFDB.dotCN.bottag},
${BDFDB.dotCN.userprofilebottag},
2019-07-28 15:55:42 +02:00
${BDFDB.dotCN.bottagmessagecozy} {
bottom: 2px;
}
2019-06-07 11:39:54 +02:00
${BDFDB.dotCN.bottagmessagecompact} {
margin-right: 6px;
2019-06-07 11:39:54 +02:00
bottom: 3px;
2018-10-11 10:21:26 +02:00
}`;
this.defaults = {
settings: {
2019-10-21 12:11:46 +02:00
changeInChatTextarea: {value:true, inner:true, description:"Chat Textarea"},
changeInChatWindow: {value:true, inner:true, description:"Messages"},
changeInMentions: {value:true, inner:true, description:"Mentions"},
changeInVoiceChat: {value:true, inner:true, description:"Voice Channels"},
changeInMemberList: {value:true, inner:true, description:"Member List"},
changeInRecentDms: {value:true, inner:true, description:"Direct Message Notifications"},
changeInDmsList: {value:true, inner:true, description:"Direct Message List"},
changeInDmHeader: {value:true, inner:true, description:"Direct Message Header"},
changeInDmCalls: {value:true, inner:true, description:"Calls/ScreenShares"},
changeInTyping: {value:true, inner:true, description:"Typing List"},
changeInFriendList: {value:true, inner:true, description:"Friend List"},
changeInInviteList: {value:true, inner:true, description:"Invite List"},
changeInActivity: {value:true, inner:true, description:"Activity Page"},
changeInUserPopout: {value:true, inner:true, description:"User Popouts"},
changeInUserProfil: {value:true, inner:true, description:"User Profile Modal"},
changeInAutoComplete: {value:true, inner:true, description:"Autocomplete Menu"},
changeInAuditLog: {value:true, inner:true, description:"Audit Log"},
changeInMemberLog: {value:true, inner:true, description:"Member Log"},
changeInSearchPopout: {value:true, inner:true, description:"Search Popout"},
changeInUserAccount: {value:true, inner:true, description:"Your Account Information"},
changeInAppTitle: {value:true, inner:true, description:"Discord App Title (DMs)"}
}
};
2018-10-11 10:21:26 +02:00
}
2019-01-26 22:45:19 +01:00
2019-10-17 11:36:34 +02:00
getSettingsPanel () {
2020-01-17 19:50:31 +01:00
if (!window.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
2019-10-22 23:04:35 +02:00
let settings = BDFDB.DataUtils.get(this, "settings");
2019-12-18 16:45:08 +01:00
let settingspanel, settingsitems = [], inneritems = [];
2019-10-16 22:18:15 +02:00
2019-11-01 22:47:23 +01:00
for (let key in settings) (!this.defaults.settings[key].inner ? settingsitems : inneritems).push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
2019-10-16 22:18:15 +02:00
className: BDFDB.disCN.marginbottom8,
2019-11-01 22:47:23 +01:00
type: "Switch",
2019-10-16 22:18:15 +02:00
plugin: this,
keys: ["settings", key],
label: this.defaults.settings[key].description,
value: settings[key]
}));
2019-10-22 18:55:25 +02:00
settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsPanelInner, {
2019-10-17 20:32:58 +02:00
title: "Change Users in:",
2019-11-05 08:56:21 +01:00
first: settingsitems.length == 0,
2019-10-17 18:54:51 +02:00
children: inneritems
2019-10-16 22:18:15 +02:00
}));
2019-10-22 18:55:25 +02:00
settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsItem, {
2019-10-21 12:11:46 +02:00
type: "Button",
2019-10-16 22:18:15 +02:00
className: BDFDB.disCN.marginbottom8,
color: BDFDB.LibraryComponents.Button.Colors.RED,
label: "Reset all Users",
onClick: _ => {
2020-01-14 00:06:07 +01:00
BDFDB.ModalUtils.confirm(this, "Are you sure you want to reset all users?", _ => {
2019-10-22 19:49:57 +02:00
BDFDB.DataUtils.remove(this, "users");
2019-10-17 11:36:34 +02:00
this.forceUpdateAll();
2019-10-16 22:18:15 +02:00
});
},
2019-10-19 11:41:39 +02:00
children: BDFDB.LanguageUtils.LanguageStrings.RESET
2019-10-16 22:18:15 +02:00
}));
2019-12-18 16:45:08 +01:00
return settingspanel = BDFDB.PluginUtils.createSettingsPanel(this, settingsitems);
2018-10-11 10:21:26 +02:00
}
//legacy
load () {}
start () {
2020-01-17 19:50:31 +01:00
if (!window.BDFDB) window.BDFDB = {myPlugins:{}};
if (window.BDFDB && window.BDFDB.myPlugins && typeof window.BDFDB.myPlugins == "object") window.BDFDB.myPlugins[this.getName()] = this;
2020-01-21 12:56:26 +01:00
let libraryScript = document.querySelector("head script#BDFDBLibraryScript");
2019-05-26 13:55:26 +02:00
if (!libraryScript || (performance.now() - libraryScript.getAttribute("date")) > 600000) {
2018-10-11 10:21:26 +02:00
if (libraryScript) libraryScript.remove();
libraryScript = document.createElement("script");
2019-05-26 13:55:26 +02:00
libraryScript.setAttribute("id", "BDFDBLibraryScript");
2018-10-11 10:21:26 +02:00
libraryScript.setAttribute("type", "text/javascript");
2019-10-18 10:56:41 +02:00
libraryScript.setAttribute("src", "https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.min.js");
2019-01-17 23:48:29 +01:00
libraryScript.setAttribute("date", performance.now());
2020-01-14 00:06:07 +01:00
libraryScript.addEventListener("load", _ => {this.initialize();});
2018-10-11 10:21:26 +02:00
document.head.appendChild(libraryScript);
2019-05-26 13:55:26 +02:00
}
2020-01-17 19:50:31 +01:00
else if (window.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();
2020-01-14 00:06:07 +01:00
this.startTimeout = setTimeout(_ => {
2019-11-01 10:27:07 +01:00
try {return this.initialize();}
catch (err) {console.error(`%c[${this.getName()}]%c`, "color: #3a71c1; font-weight: 700;", "", "Fatal Error: Could not initiate plugin! " + err);}
}, 30000);
2018-10-11 10:21:26 +02:00
}
initialize () {
2020-01-17 19:50:31 +01:00
if (window.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
2019-01-22 11:05:54 +01:00
if (this.started) return;
2019-10-22 18:55:25 +02:00
BDFDB.PluginUtils.init(this);
2019-01-26 22:45:19 +01:00
2020-01-14 00:06:07 +01:00
var observer = new MutationObserver(_ => {this.changeAppTitle();});
2019-10-22 18:55:25 +02:00
BDFDB.ObserverUtils.connect(this, document.head.querySelector("title"), {name:"appTitleObserver",instance:observer}, {childList:true});
2019-10-17 11:36:34 +02:00
this.forceUpdateAll();
2018-10-11 10:21:26 +02:00
}
2019-11-01 10:14:50 +01:00
else console.error(`%c[${this.getName()}]%c`, "color: #3a71c1; font-weight: 700;", "", "Fatal Error: Could not load BD functions!");
2018-10-11 10:21:26 +02:00
}
stop () {
2020-01-17 19:50:31 +01:00
if (window.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
2019-10-22 11:37:23 +02:00
this.stopping = true;
2019-10-22 19:49:57 +02:00
let data = BDFDB.DataUtils.load(this, "users");
BDFDB.DataUtils.remove(this, "users");
2019-10-17 11:36:34 +02:00
try {this.forceUpdateAll();} catch (err) {}
2019-10-22 19:49:57 +02:00
BDFDB.DataUtils.save(data, this, "users");
2019-01-26 22:45:19 +01:00
2019-10-23 11:10:01 +02:00
BDFDB.DOMUtils.remove(".autocompleteEditUsers", ".autocompleteEditUsersRow");
2019-01-26 22:45:19 +01:00
2019-10-22 18:55:25 +02:00
BDFDB.PluginUtils.clear(this);
2018-10-11 10:21:26 +02:00
}
}
2019-01-26 22:45:19 +01:00
2018-10-11 10:21:26 +02:00
// begin of own functions
2019-09-11 12:14:43 +02:00
2019-12-10 13:59:44 +01:00
onUserContextMenu (e) {
if (e.instance.props.user) {
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.ContextMenuItems.Group, {
2019-09-11 12:14:43 +02:00
children: [
2019-12-05 09:10:14 +01:00
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Sub, {
2019-09-11 12:14:43 +02:00
label: this.labels.context_localusersettings_text,
2019-12-05 09:10:14 +01:00
render: [BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Group, {
2019-09-11 12:14:43 +02:00
children: [
2019-12-05 09:10:14 +01:00
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Item, {
2019-09-11 12:14:43 +02:00
label: this.labels.submenu_usersettings_text,
2019-11-21 11:38:04 +01:00
action: _ => {
2019-12-10 13:59:44 +01:00
BDFDB.ContextMenuUtils.close(e.instance);
this.showUserSettings(e.instance.props.user);
2019-09-11 12:14:43 +02:00
}
}),
2019-12-05 09:10:14 +01:00
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Item, {
2019-09-11 12:14:43 +02:00
label: this.labels.submenu_resetsettings_text,
2019-12-10 13:59:44 +01:00
disabled: !BDFDB.DataUtils.load(this, "users", e.instance.props.user.id),
2019-11-21 11:38:04 +01:00
action: _ => {
2019-12-10 13:59:44 +01:00
BDFDB.ContextMenuUtils.close(e.instance);
BDFDB.DataUtils.remove(this, "users", e.instance.props.user.id);
2019-10-17 11:36:34 +02:00
this.forceUpdateAll();
2019-09-11 12:14:43 +02:00
}
})
]
})]
})
]
2019-12-10 13:59:44 +01:00
}));
2018-10-11 10:21:26 +02:00
}
}
2019-10-17 11:36:34 +02:00
forceUpdateAll () {
this.changeAppTitle();
2019-10-22 18:55:25 +02:00
BDFDB.ModuleUtils.forceAllUpdates(this);
2019-10-17 11:36:34 +02:00
}
2019-01-26 22:45:19 +01:00
2019-01-04 16:53:42 +01:00
showUserSettings (info) {
2019-10-22 20:16:05 +02:00
let data = BDFDB.DataUtils.load(this, "users", info.id) || {};
2019-10-16 22:18:15 +02:00
let member = BDFDB.LibraryModules.MemberStore.getMember(BDFDB.LibraryModules.LastGuildStore.getGuildId(), info.id) || {};
2019-10-30 13:27:14 +01:00
BDFDB.ModalUtils.open(this, {
2019-10-16 22:18:15 +02:00
size: "MEDIUM",
header: this.labels.modal_header_text,
subheader: member.nick || info.username,
children: [
2019-10-24 10:48:18 +02:00
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ModalComponents.ModalTabContent, {
2019-10-16 22:18:15 +02:00
tab: this.labels.modal_tabheader1_text,
children: [
2019-10-22 18:55:25 +02:00
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormItem, {
2019-10-16 22:18:15 +02:00
title: this.labels.modal_username_text,
className: BDFDB.disCN.marginbottom20 + " input-username",
2019-11-25 13:42:12 +01:00
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TextInput, {
value: data.name,
placeholder: member.nick || info.username,
autoFocus: true
})
2019-10-16 22:18:15 +02:00
}),
2019-10-22 18:55:25 +02:00
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormItem, {
2019-10-16 22:18:15 +02:00
title: this.labels.modal_usertag_text,
className: BDFDB.disCN.marginbottom20 + " input-usertag",
2019-11-25 13:42:12 +01:00
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TextInput, {
value: data.tag
})
2019-10-16 22:18:15 +02:00
}),
2019-10-22 18:55:25 +02:00
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormItem, {
2019-10-16 22:18:15 +02:00
title: this.labels.modal_useravatar_text,
2019-10-17 11:36:34 +02:00
className: BDFDB.disCN.marginbottom8 + " input-useravatar",
2019-11-25 13:42:12 +01:00
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TextInput, {
inputClassName: !data.removeIcon && data.url ? BDFDB.disCN.inputsuccess : null,
inputId: "USERAVATAR",
value: data.url,
placeholder: BDFDB.UserUtils.getAvatar(info.id),
disabled: data.removeIcon,
onFocus: e => {
this.createNoticeTooltip(e.target);
},
onChange: (value, instance) => {
this.checkUrl(value, instance);
}
})
2019-10-16 22:18:15 +02:00
}),
2019-10-22 18:55:25 +02:00
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsItem, {
2019-10-16 22:18:15 +02:00
type: "Switch",
className: BDFDB.disCN.marginbottom20 + " input-removeicon",
label: this.labels.modal_removeicon_text,
value: data.removeIcon,
onChange: (value, instance) => {
2019-10-21 12:59:51 +02:00
let avatarinputins = BDFDB.ReactUtils.findOwner(instance._reactInternalFiber.return, {props:[["inputId","USERAVATAR"]]});
2019-10-16 22:18:15 +02:00
if (avatarinputins) {
avatarinputins.props.inputClassName = null;
avatarinputins.props.disabled = value;
2019-10-21 12:11:46 +02:00
BDFDB.ReactUtils.forceUpdate(avatarinputins);
2019-10-16 22:18:15 +02:00
}
}
2019-10-17 11:36:34 +02:00
})
2019-10-16 22:18:15 +02:00
]
}),
2019-10-24 10:48:18 +02:00
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ModalComponents.ModalTabContent, {
2019-10-16 22:18:15 +02:00
tab: this.labels.modal_tabheader2_text,
children: [
2019-10-22 18:55:25 +02:00
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormItem, {
2019-10-16 22:18:15 +02:00
title: this.labels.modal_colorpicker1_text,
className: BDFDB.disCN.marginbottom20,
2019-11-25 13:42:12 +01:00
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ColorSwatches, {
color: data.color1,
number: 1
})
2019-10-16 22:18:15 +02:00
}),
2019-10-22 18:55:25 +02:00
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormItem, {
2019-10-16 22:18:15 +02:00
title: this.labels.modal_colorpicker2_text,
className: BDFDB.disCN.marginbottom20,
2019-11-25 13:42:12 +01:00
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ColorSwatches, {
color: data.color2,
number: 2
})
2019-10-16 22:18:15 +02:00
})
]
}),
2019-10-24 10:48:18 +02:00
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ModalComponents.ModalTabContent, {
2019-10-16 22:18:15 +02:00
tab: this.labels.modal_tabheader3_text,
children: [
2019-10-22 18:55:25 +02:00
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormItem, {
2019-10-16 22:18:15 +02:00
title: this.labels.modal_colorpicker3_text,
className: BDFDB.disCN.marginbottom20,
2019-11-25 13:42:12 +01:00
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ColorSwatches, {
color: data.color3,
number: 3,
disabled: data.ignoreTagColor
})
2019-10-16 22:18:15 +02:00
}),
2019-10-22 18:55:25 +02:00
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormItem, {
2019-10-16 22:18:15 +02:00
title: this.labels.modal_colorpicker4_text,
className: BDFDB.disCN.marginbottom20,
2019-11-25 13:42:12 +01:00
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ColorSwatches, {
color: data.color4,
number: 4,
disabled: data.ignoreTagColor
})
2019-10-16 22:18:15 +02:00
}),
2019-10-22 18:55:25 +02:00
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsItem, {
2019-10-16 22:18:15 +02:00
type: "Switch",
className: BDFDB.disCN.marginbottom20 + " input-ignoretagcolor",
label: this.labels.modal_ignoretagcolor_text,
value: data.ignoreTagColor,
onChange: (value, instance) => {
2019-10-21 12:59:51 +02:00
let colorpicker3ins = BDFDB.ReactUtils.findOwner(instance._reactInternalFiber.return, {props:[["number",3]]});
let colorpicker4ins = BDFDB.ReactUtils.findOwner(instance._reactInternalFiber.return, {props:[["number",4]]});
2019-10-16 22:18:15 +02:00
if (colorpicker3ins) colorpicker3ins.setState({disabled: value});
if (colorpicker4ins) colorpicker4ins.setState({disabled: value});
}
})
]
})
],
buttons: [{
2019-10-19 11:41:39 +02:00
contents: BDFDB.LanguageUtils.LanguageStrings.SAVE,
2019-10-16 22:18:15 +02:00
color: "BRAND",
close: true,
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);
data.name = usernameinput.value.trim() || null;
data.tag = usertaginput.value.trim() || null;
2019-10-23 11:10:01 +02:00
data.url = (!data.removeIcon && BDFDB.DOMUtils.containsClass(useravatarinput, BDFDB.disCN.inputsuccess) ? useravatarinput.value.trim() : null) || null;
2019-10-16 22:18:15 +02:00
data.removeIcon = removeiconinput.checked;
data.ignoreTagColor = ignoretagcolorinput.checked;
2019-10-23 11:10:01 +02:00
data.color1 = BDFDB.ColorUtils.getSwatchColor(modal, 1);
data.color2 = BDFDB.ColorUtils.getSwatchColor(modal, 2);
data.color3 = BDFDB.ColorUtils.getSwatchColor(modal, 3);
data.color4 = BDFDB.ColorUtils.getSwatchColor(modal, 4);
2019-10-16 22:18:15 +02:00
let changed = false;
2019-10-22 20:16:05 +02:00
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);
2019-10-17 11:36:34 +02:00
if (changed) this.forceUpdateAll();
2018-10-11 10:21:26 +02:00
}
2019-10-16 22:18:15 +02:00
}]
});
2018-10-11 10:21:26 +02:00
}
2019-10-16 22:18:15 +02:00
2019-09-11 12:14:43 +02:00
processChannelTextArea (instance, wrapper, returnvalue) {
2019-10-22 18:55:25 +02:00
let channel = BDFDB.ReactUtils.getValue(instance, "props.channel");
2019-01-25 11:35:40 +01:00
if (channel) {
var textarea = wrapper.querySelector("textarea");
if (!textarea) return;
2019-06-26 08:52:17 +02:00
if (channel.type == 1 && instance.props.type == "normal" && !instance.props.disabled) {
2019-09-07 09:21:39 +02:00
let user = BDFDB.LibraryModules.UserStore.getUser(channel.recipients[0]);
if (user) {
let data = this.getUserData(user.id, wrapper);
2019-10-25 11:30:50 +02:00
textarea.setAttribute("placeholder", BDFDB.LanguageUtils.LanguageStringsFormat("TEXTAREA_PLACEHOLDER", `@${data.name || user.username}`));
}
}
2019-10-22 18:55:25 +02:00
BDFDB.ListenerUtils.remove(this, textarea);
2019-10-22 20:16:05 +02:00
if (BDFDB.DataUtils.get(this, "settings", "changeInAutoComplete")) {
2019-10-22 18:55:25 +02:00
BDFDB.ListenerUtils.add(this, textarea, "keydown", e => {
let autocompletemenu = textarea.parentElement.querySelector(BDFDB.dotCN.autocomplete);
if (autocompletemenu && (e.which == 9 || e.which == 13)) {
2019-10-23 11:10:01 +02:00
if (BDFDB.DOMUtils.containsClass(autocompletemenu.querySelector(BDFDB.dotCN.autocompleteselected).parentElement, "autocompleteEditUsersRow")) {
2019-10-22 18:55:25 +02:00
BDFDB.ListenerUtils.stopEvent(e);
2019-09-04 12:34:02 +02:00
this.swapWordWithMention(textarea);
}
}
else if (autocompletemenu && (e.which == 38 || e.which == 40)) {
let autocompleteitems = autocompletemenu.querySelectorAll(BDFDB.dotCN.autocompleteselectable + ":not(.autocompleteEditUsersSelector)");
let selected = autocompletemenu.querySelector(BDFDB.dotCN.autocompleteselected);
2019-10-23 11:10:01 +02:00
if (BDFDB.DOMUtils.containsClass(selected, "autocompleteEditUsersSelector") || autocompleteitems[e.which == 38 ? 0 : (autocompleteitems.length-1)] == selected) {
2019-10-22 18:55:25 +02:00
BDFDB.ListenerUtils.stopEvent(e);
let next = this.getNextSelection(autocompletemenu, null, e.which == 38 ? false : true);
2019-10-23 11:10:01 +02:00
BDFDB.DOMUtils.removeClass(selected, BDFDB.disCN.autocompleteselected);
BDFDB.DOMUtils.addClass(selected, BDFDB.disCN.autocompleteselector);
BDFDB.DOMUtils.addClass(next, BDFDB.disCN.autocompleteselected);
}
}
else if (textarea.value && !e.shiftKey && e.which == 13 && !autocompletemenu && textarea.value.indexOf("s/") != 0) {
this.format = true;
textarea.dispatchEvent(new Event("input"));
}
else if (!e.ctrlKey && e.which != 16 && textarea.selectionStart == textarea.selectionEnd && textarea.selectionEnd == textarea.value.length) {
2019-11-01 11:09:32 +01:00
BDFDB.TimeUtils.clear(textarea.EditUsersAutocompleteTimeout);
2020-01-14 00:06:07 +01:00
textarea.EditUsersAutocompleteTimeout = BDFDB.TimeUtils.timeout(_ => {this.addAutoCompleteMenu(textarea, channel);},100);
}
2019-01-26 22:45:19 +01:00
2019-10-23 11:10:01 +02:00
if (!e.ctrlKey && e.which != 38 && e.which != 40 && !(e.which == 39 && textarea.selectionStart == textarea.selectionEnd && textarea.selectionEnd == textarea.value.length)) BDFDB.DOMUtils.remove(".autocompleteEditUsers", ".autocompleteEditUsersRow");
});
2019-10-22 18:55:25 +02:00
BDFDB.ListenerUtils.add(this, textarea, "click", e => {
2020-01-14 00:06:07 +01:00
if (textarea.selectionStart == textarea.selectionEnd && textarea.selectionEnd == textarea.value.length) BDFDB.TimeUtils.timeout(_ => {this.addAutoCompleteMenu(textarea, channel);});
});
2018-10-11 10:21:26 +02:00
}
}
}
2019-09-04 12:34:02 +02:00
2019-09-11 12:14:43 +02:00
processMemberListItem (instance, wrapper, returnvalue) {
2019-07-18 12:53:00 +02:00
let username = wrapper.querySelector(BDFDB.dotCN.memberusername);
if (username) {
this.changeName(instance.props.user, username);
this.changeAvatar(instance.props.user, this.getAvatarDiv(wrapper));
2019-10-09 11:23:07 +02:00
this.addTag(instance.props.user, username.parentElement, BDFDB.disCN.bottagmember);
2019-07-18 12:53:00 +02:00
}
}
2019-09-11 12:14:43 +02:00
processUserPopout (instance, wrapper, returnvalue) {
2019-07-18 12:53:00 +02:00
let username = wrapper.querySelector(BDFDB.dotCNC.userpopoutheadertagusernamenonickname + BDFDB.dotCN.userpopoutheadernickname);
if (username) {
this.changeName(instance.props.user, username);
this.changeAvatar(instance.props.user, this.getAvatarDiv(wrapper));
2019-08-06 20:53:56 +02:00
this.addTag(instance.props.user, username.parentElement, BDFDB.disCN.bottagnametag, wrapper);
2019-07-18 12:53:00 +02:00
}
}
2019-09-11 12:14:43 +02:00
processUserProfile (instance, wrapper, returnvalue) {
2019-07-18 12:53:00 +02:00
let username = wrapper.querySelector(BDFDB.dotCN.userprofileusername);
if (username) {
this.changeName(instance.props.user, username);
this.changeAvatar(instance.props.user, this.getAvatarDiv(wrapper));
2019-08-06 20:53:56 +02:00
this.addTag(instance.props.user, username.parentElement, BDFDB.disCNS.userprofilebottag + BDFDB.disCN.bottagnametag, wrapper);
2019-07-18 12:53:00 +02:00
}
}
2019-01-26 22:45:19 +01:00
2019-09-11 12:14:43 +02:00
processFriendRow (instance, wrapper, returnvalue) {
2019-07-18 12:53:00 +02:00
let username = wrapper.querySelector(BDFDB.dotCN.friendsusername);
2019-06-16 19:30:24 +02:00
if (username) {
this.changeName(instance.props.user, username);
this.changeAvatar(instance.props.user, this.getAvatarDiv(wrapper));
}
}
2019-09-04 12:34:02 +02:00
2019-09-11 12:14:43 +02:00
processVoiceUser (instance, wrapper, returnvalue) {
2019-08-29 10:44:05 +02:00
let user = instance.props.user;
if (user && wrapper.className) {
this.changeVoiceUser(user, wrapper.querySelector(BDFDB.dotCN.voicename), instance.props.speaking);
this.changeAvatar(user, this.getAvatarDiv(wrapper));
}
}
2019-06-16 19:30:24 +02:00
2019-09-11 12:14:43 +02:00
processAccount (instance, wrapper, returnvalue) {
2019-10-23 11:41:32 +02:00
let user = instance.props.currentUser;
2019-06-16 21:11:15 +02:00
if (user) {
2019-09-07 09:21:39 +02:00
this.changeName(user, wrapper.querySelector(BDFDB.dotCN.accountinfodetails).firstElementChild);
2019-06-16 21:11:15 +02:00
this.changeAvatar(user, this.getAvatarDiv(wrapper));
}
}
2019-01-26 22:45:19 +01:00
2019-09-11 12:14:43 +02:00
processMessageUsername (instance, wrapper, returnvalue) {
2019-10-22 18:55:25 +02:00
let message = BDFDB.ReactUtils.getValue(instance, "props.message");
if (message) {
let username = wrapper.querySelector(BDFDB.dotCN.messageusername);
if (username) {
2019-09-07 09:21:39 +02:00
let channel = BDFDB.LibraryModules.ChannelStore.getChannel(message.channel_id) || {};
this.changeName(message.author, username, channel.guild_id);
2019-10-23 11:10:01 +02:00
if (!BDFDB.DOMUtils.containsClass(wrapper.parentElement, BDFDB.disCN.messageheadercompact)) this.changeAvatar(message.author, this.getAvatarDiv(wrapper));
let messagegroup = BDFDB.DOMUtils.getParent(BDFDB.dotCN.messagegroup, wrapper);
this.addTag(message.author, wrapper, BDFDB.DOMUtils.containsClass(messagegroup, BDFDB.disCN.messagegroupcozy) ? BDFDB.disCN.bottagmessagecozy : BDFDB.disCN.bottagmessagecompact);
2018-12-22 22:34:45 +01:00
}
2018-10-11 10:21:26 +02:00
}
}
2019-01-26 22:45:19 +01:00
2019-09-11 12:14:43 +02:00
processAuditLog (instance, wrapper, returnvalue) {
2019-10-22 18:55:25 +02:00
let log = BDFDB.ReactUtils.getValue(instance, "props.log");
if (log && log.user) {
let hooks = wrapper.querySelectorAll(BDFDB.dotCN.auditloguserhook);
2019-10-22 18:55:25 +02:00
let guild_id = BDFDB.ReactUtils.getValue(instance, "_reactInternalFiber.return.memoizedProps.guildId");
if (hooks.length > 0) this.changeName2(log.user, hooks[0].firstChild, guild_id);
if (hooks.length > 1 && log.targetType == "USER") this.changeName2(log.target, hooks[1].firstChild, guild_id);
}
}
2019-01-26 22:45:19 +01:00
2019-09-11 12:14:43 +02:00
processBannedCard (instance, wrapper, returnvalue) {
2019-11-11 11:11:33 +01:00
if (instance.props.user && instance.props.guild) {
2019-02-07 22:54:50 +01:00
let username = wrapper.querySelector(BDFDB.dotCN.guildsettingsbannedusername);
if (username) {
2019-09-04 12:34:02 +02:00
this.changeName3(instance.props.user, username);
2019-02-07 22:54:50 +01:00
this.changeAvatar(instance.props.user, this.getAvatarDiv(wrapper));
}
}
}
2019-09-11 12:14:43 +02:00
processInviteCard (instance, wrapper, returnvalue) {
2019-10-22 18:55:25 +02:00
let invite = BDFDB.ReactUtils.getValue(instance, "props.invite");
2019-02-07 22:54:50 +01:00
if (invite && invite.inviter && invite.guild) {
2019-09-17 14:28:26 +02:00
let username = wrapper.querySelector(BDFDB.dotCN.username);
2019-02-07 22:54:50 +01:00
if (username) {
this.changeName2(invite.inviter, username, invite.guild.id);
this.changeAvatar(invite.inviter, this.getAvatarDiv(wrapper));
}
}
}
2019-09-11 12:14:43 +02:00
processMemberCard (instance, wrapper, returnvalue) {
2019-11-11 11:11:33 +01:00
if (instance.props.user && instance.props.guild) {
2019-02-07 22:54:50 +01:00
let username = wrapper.querySelector(BDFDB.dotCN.guildsettingsmembername);
if (username) {
this.changeName2(instance.props.user, username, instance.props.guild.id);
this.changeAvatar(instance.props.user, this.getAvatarDiv(wrapper));
}
}
}
2019-09-11 12:14:43 +02:00
processInvitationCard (instance, wrapper, returnvalue) {
2019-11-11 11:11:33 +01:00
if (instance.props.user) {
2019-03-28 13:56:12 +01:00
let username = wrapper.querySelector(BDFDB.dotCN.invitemodalinviterowname);
if (username) {
this.changeName3(instance.props.user, username);
this.changeAvatar(instance.props.user, this.getAvatarDiv(wrapper));
}
}
}
2019-09-11 12:14:43 +02:00
processTypingUsers (instance, wrapper, returnvalue) {
2019-10-22 18:55:25 +02:00
let users = !instance.props.typingUsers ? [] : Object.keys(instance.props.typingUsers).filter(id => id != BDFDB.UserUtils.me.id).filter(id => !BDFDB.LibraryModules.FriendUtils.isBlocked(id)).map(id => BDFDB.LibraryModules.UserStore.getUser(id)).filter(id => id != null);
wrapper.querySelectorAll(BDFDB.dotCNS.typing + "strong").forEach((username, i) => {
if (users[i] && username) this.changeName2(users[i], username);
});
}
2019-01-26 22:45:19 +01:00
2019-09-11 12:14:43 +02:00
processDirectMessage (instance, wrapper, returnvalue) {
2019-10-22 18:55:25 +02:00
let channel = BDFDB.ReactUtils.getValue(instance, "props.channel");
if (channel && channel.type == 1) {
2019-09-07 09:21:39 +02:00
let user = BDFDB.LibraryModules.UserStore.getUser(channel.recipients[0]);
if (user) {
let avatar = this.getAvatarDiv(wrapper);
if (avatar) {
this.changeAvatar(user, avatar);
this.changeTooltip(user, avatar, "right");
}
2018-12-22 22:34:45 +01:00
}
2018-10-11 10:21:26 +02:00
}
}
2019-01-26 22:45:19 +01:00
2019-09-11 12:14:43 +02:00
processCallAvatar (instance, wrapper, returnvalue) {
2019-11-11 11:11:33 +01:00
if (instance.props.id) {
2019-09-07 09:21:39 +02:00
let user = BDFDB.LibraryModules.UserStore.getUser(instance.props.id);
if (!user) {
2019-09-07 09:21:39 +02:00
let channel = BDFDB.LibraryModules.ChannelStore.getChannel(instance.props.id);
if (channel && channel.type == 1) user = BDFDB.LibraryModules.UserStore.getUser(channel.recipients[0]);
}
if (user) {
this.changeName2(user, wrapper.parentElement.querySelector(BDFDB.dotCN.callmembers));
2019-10-02 09:53:39 +02:00
let avatar = this.getAvatarDiv(wrapper);
if (avatar) {
this.changeAvatar(user, avatar);
2019-10-23 11:10:01 +02:00
if (BDFDB.DOMUtils.containsClass(avatar.parentElement, BDFDB.disCN.callvideo)) this.changeTooltip(user, avatar.parentElement, "left");
2019-10-02 09:53:39 +02:00
}
2018-10-11 10:21:26 +02:00
}
}
}
2019-01-26 22:45:19 +01:00
2019-09-11 12:14:43 +02:00
processVideoTile (instance, wrapper, returnvalue) {
2019-11-11 11:11:33 +01:00
if (instance.props.user) this.changeAvatar(instance.props.user, this.getAvatarDiv(wrapper));
2019-02-19 20:43:46 +01:00
}
2019-09-11 12:14:43 +02:00
processPictureInPictureVideo (instance, wrapper, returnvalue) {
2019-11-11 11:11:33 +01:00
if (instance.props.backgroundKey) {
2019-09-07 09:21:39 +02:00
let user = BDFDB.LibraryModules.UserStore.getUser(instance.props.backgroundKey);
2019-02-19 12:09:01 +01:00
if (user) this.changeAvatar(user, this.getAvatarDiv(wrapper));
}
}
2019-09-11 12:14:43 +02:00
processPrivateChannel (instance, wrapper, returnvalue) {
2019-11-11 11:11:33 +01:00
if (instance.props.user) {
2019-09-11 12:14:43 +02:00
let username = wrapper.querySelector(BDFDB.dotCN.namecontainername);
2019-07-18 12:53:00 +02:00
this.changePrivateChannel(instance.props.user, username && username.firstElementChild ? username.firstElementChild : username);
this.changeAvatar(instance.props.user, this.getAvatarDiv(wrapper));
}
}
2019-01-26 22:45:19 +01:00
2019-09-11 12:14:43 +02:00
processHeaderBarContainer (instance, wrapper, returnvalue) {
2019-04-29 09:11:09 +02:00
this.processHeaderBar(instance, wrapper);
}
2019-09-04 12:34:02 +02:00
2019-09-11 12:14:43 +02:00
processHeaderBar (instance, wrapper, returnvalue) {
2019-10-22 18:55:25 +02:00
let channel_id = BDFDB.ReactUtils.getValue(instance, "props.channelId") || BDFDB.ReactUtils.getValue(instance, "_reactInternalFiber.return.memoizedProps.channelId");
if (channel_id) {
2019-08-29 23:23:06 +02:00
let channelname = wrapper.querySelector(BDFDB.dotCN.channelheaderheaderbartitle);
if (channelname) {
2019-09-07 09:21:39 +02:00
let channel = BDFDB.LibraryModules.ChannelStore.getChannel(channel_id);
if (channel) {
2019-09-07 09:21:39 +02:00
if (channel.type == 1) this.changeName(BDFDB.LibraryModules.UserStore.getUser(channel.recipients[0]), channelname);
else {
2019-08-29 23:23:06 +02:00
if (channelname.EditUsersChangeObserver && typeof channelname.EditUsersChangeObserver.disconnect == "function") channelname.EditUsersChangeObserver.disconnect();
2020-01-08 09:40:17 +01:00
if (BDFDB.BDUtils.isPluginEnabled("EditChannels")) {}
2019-08-29 23:23:06 +02:00
else {
channelname.style.removeProperty("color");
channelname.style.removeProperty("background");
2019-10-23 11:10:01 +02:00
BDFDB.DOMUtils.setText(channelname, channel.name);
2019-08-29 23:23:06 +02:00
}
}
}
}
}
}
2019-01-26 22:45:19 +01:00
2019-09-11 12:14:43 +02:00
processClickable (instance, wrapper, returnvalue) {
if (!wrapper || !instance.props || !instance.props.className) return;
if (instance.props.tag == "a" && instance.props.className.indexOf(BDFDB.disCN.anchorunderlineonhover) > -1) {
2019-10-23 11:10:01 +02:00
if (BDFDB.DOMUtils.containsClass(wrapper.parentElement, BDFDB.disCN.messagesystemcontent) && wrapper.parentElement.querySelector("a") == wrapper) {
2019-10-22 19:38:25 +02:00
let message = BDFDB.ReactUtils.findValue(wrapper.parentElement, "message", {up:true});
2019-02-16 12:58:25 +01:00
if (message) {
this.changeName(message.author, wrapper);
2019-09-07 09:21:39 +02:00
if (message.mentions.length == 1) this.changeName(BDFDB.LibraryModules.UserStore.getUser(message.mentions[0]), wrapper.parentElement.querySelectorAll("a")[1]);
2019-02-16 12:58:25 +01:00
}
2018-12-22 22:34:45 +01:00
}
2018-10-11 10:21:26 +02:00
}
else if (instance.props.tag == "span" && instance.props.className.indexOf(BDFDB.disCN.mention) > -1) {
2019-10-22 18:55:25 +02:00
let render = BDFDB.ReactUtils.getValue(instance, "_reactInternalFiber.return.return.stateNode.props.render");
2019-05-26 14:29:29 +02:00
if (typeof render == "function") {
var props = render().props;
if (props && props.user) this.changeMention(props.user, wrapper);
2019-09-07 09:21:39 +02:00
else if (props && props.userId) this.changeMention(BDFDB.LibraryModules.UserStore.getUser(props.userId), wrapper);
2019-05-26 14:29:29 +02:00
}
2018-10-11 10:21:26 +02:00
}
else if (instance.props.tag == "div" && instance.props.className.indexOf(BDFDB.disCN.quickswitchresult) > -1) {
2019-10-22 18:55:25 +02:00
let user = BDFDB.ReactUtils.getValue(instance, "_reactInternalFiber.return.return.memoizedProps.user");
2019-03-13 13:02:06 +01:00
if (user) {
this.changeName2(user, wrapper.querySelector(BDFDB.dotCN.quickswitchresultmatch));
this.changeAvatar(user, this.getAvatarDiv(wrapper));
2018-10-11 10:21:26 +02:00
}
}
else if (instance.props.tag == "div" && instance.props.className.indexOf(BDFDB.disCN.autocompleterow) > -1) {
2019-10-22 18:55:25 +02:00
let user = BDFDB.ReactUtils.getValue(instance, "_reactInternalFiber.return.memoizedProps.user");
if (user) {
this.changeName2(user, wrapper.querySelector(BDFDB.dotCN.marginleft8));
this.changeAvatar(user, this.getAvatarDiv(wrapper));
2018-10-11 10:21:26 +02:00
}
}
2019-08-19 11:17:57 +02:00
else if (instance.props.tag == "div" && instance.props.className.indexOf(BDFDB.disCN.searchpopoutuser) > -1) {
2019-10-22 18:55:25 +02:00
let result = BDFDB.ReactUtils.getValue(instance, "_reactInternalFiber.return.memoizedProps.result");
2019-08-19 11:17:57 +02:00
if (result && result.user) {
this.changeName3(result.user, wrapper.querySelector(BDFDB.dotCN.searchpopoutdisplayednick));
this.changeAvatar(result.user, wrapper.querySelector(BDFDB.dotCN.searchpopoutdisplayavatar));
}
}
2018-10-11 10:21:26 +02:00
}
2019-01-26 22:45:19 +01:00
2019-09-11 12:14:43 +02:00
processMessageContent (instance, wrapper, returnvalue) {
2019-10-22 18:55:25 +02:00
let message = BDFDB.ReactUtils.getValue(instance, "props.message");
if (message && message.author) {
let markup = wrapper.querySelector(BDFDB.dotCN.messagemarkup);
if (markup) {
2019-09-07 09:21:39 +02:00
let channel = BDFDB.LibraryModules.ChannelStore.getChannel(message.channel_id) || {};
let member = BDFDB.LibraryModules.MemberStore.getMember(channel.guild_id, message.author.id) || {};
let data = this.getUserData(message.author.id, wrapper);
2019-10-23 10:03:33 +02:00
markup.style.setProperty("color", window.settingsCookie["bda-gs-7"] ? BDFDB.ColorUtils.convert(data.color1 && !BDFDB.ObjectUtils.is(data.color1) ? data.color1 : member.colorString, "RGBA") : null, "important");
}
}
}
2019-01-26 22:45:19 +01:00
2019-09-11 12:14:43 +02:00
processStandardSidebarView (instance, wrapper, returnvalue) {
if (this.SettingsUpdated) {
delete this.SettingsUpdated;
2019-10-17 11:36:34 +02:00
this.forceUpdateAll();
}
}
checkUrl (url, instance) {
2019-10-22 18:55:25 +02:00
let input = BDFDB.ReactUtils.findDOMNode(instance).firstElementChild;
2019-11-01 11:09:32 +01:00
BDFDB.TimeUtils.clear(instance.checkTimeout);
2019-10-17 11:36:34 +02:00
if (url == null || !url.trim()) {
2019-10-23 11:10:01 +02:00
if (input) BDFDB.DOMUtils.remove(input.tooltip);
2019-10-17 11:36:34 +02:00
instance.props.inputClassName = null;
instance.forceUpdate();
}
2020-01-14 00:06:07 +01:00
else instance.checkTimeout = BDFDB.TimeUtils.timeout(_ => {
2019-10-17 11:36:34 +02:00
BDFDB.LibraryRequires.request(url.trim(), (error, response, result) => {
if (response && response.headers["content-type"] && response.headers["content-type"].indexOf("image") != -1) {
2019-10-23 11:10:01 +02:00
if (input) BDFDB.DOMUtils.remove(input.tooltip);
2019-10-17 11:36:34 +02:00
instance.props.inputClassName = BDFDB.disCN.inputsuccess;
}
else {
this.createNoticeTooltip(input, true);
instance.props.inputClassName = BDFDB.disCN.inputerror;
}
delete instance.checkTimeout;
instance.forceUpdate();
});
}, 1000);
}
2019-09-04 12:34:02 +02:00
2019-10-16 22:18:15 +02:00
createNoticeTooltip (input, isinvalid = false) {
if (!input) return;
2019-10-23 11:10:01 +02:00
BDFDB.DOMUtils.remove(input.tooltip);
var invalid = isinvalid || BDFDB.DOMUtils.containsClass(input, BDFDB.disCN.inputerror);
var valid = invalid ? false : BDFDB.DOMUtils.containsClass(input, BDFDB.disCN.inputsuccess);
2019-10-22 18:55:25 +02:00
if (invalid || valid) input.tooltip = BDFDB.TooltipUtils.create(input, invalid ? this.labels.modal_invalidurl_text : this.labels.modal_validurl_text, {type:"right", selector:"notice-tooltip", color: invalid ? "red" : "green"});
2019-10-16 22:18:15 +02:00
}
2019-03-27 19:18:10 +01:00
changeAppTitle () {
2019-09-07 09:21:39 +02:00
let channel = BDFDB.LibraryModules.ChannelStore.getChannel(BDFDB.LibraryModules.LastChannelStore.getChannelId());
2019-03-27 19:18:10 +01:00
let title = document.head.querySelector("title");
if (title && channel && channel.type == 1) {
2019-09-07 09:21:39 +02:00
let info = BDFDB.LibraryModules.UserStore.getUser(channel.recipients[0]);
2019-03-27 19:18:10 +01:00
if (info) {
let data = this.getUserData(info.id, title);
2019-10-23 11:10:01 +02:00
BDFDB.DOMUtils.setText(title, "@" + (data.name || info.username));
2019-03-27 19:18:10 +01:00
}
}
}
2019-01-26 22:45:19 +01:00
2019-09-07 09:21:39 +02:00
changeName (info, username, guildid = BDFDB.LibraryModules.LastGuildStore.getGuildId()) {
2018-12-25 17:09:23 +01:00
if (!info || !username || !username.parentElement) return;
if (username.EditUsersChangeObserver && typeof username.EditUsersChangeObserver.disconnect == "function") username.EditUsersChangeObserver.disconnect();
let data = this.getUserData(info.id, username);
2019-09-07 09:21:39 +02:00
let member = BDFDB.LibraryModules.MemberStore.getMember(guildid, info.id) || {};
2019-06-24 10:34:18 +02:00
this.changeBotTags(data, username, member);
if (data.name || data.color1 || data.color2 || username.getAttribute("changed-by-editusers")) {
2019-10-23 11:10:01 +02:00
let isBRCenabled = BDFDB.BDUtils.isPluginEnabled("BetterRoleColors");
2019-11-25 13:42:12 +01:00
let usenick = !BDFDB.DOMUtils.containsClass(username, BDFDB.disCN.userprofileusername) && !BDFDB.DOMUtils.containsClass(username.parentElement, BDFDB.disCN.listname, BDFDB.disCN.accountinfodetails, false) && member.nick;
2019-11-25 13:44:45 +01:00
let usemembercolor = !BDFDB.DOMUtils.containsClass(username.parentElement, BDFDB.disCN.listname) && (BDFDB.DOMUtils.containsClass(username, BDFDB.disCN.memberusername, BDFDB.disCN.messageusername, false) || isBRCenabled);
2019-09-04 12:34:02 +02:00
2019-10-22 18:55:25 +02:00
if (BDFDB.ObjectUtils.is(data.color1)) {
2019-10-23 10:03:33 +02:00
username.style.setProperty("color", BDFDB.ColorUtils.convert(data.color1[Object.keys(data.color1)[0]], "RGBA"), "important");
2019-10-23 11:10:01 +02:00
BDFDB.DOMUtils.setText(username, BDFDB.DOMUtils.create(`<span style="pointer-events: none; -webkit-background-clip: text !important; color: transparent !important; background-image: ${BDFDB.ColorUtils.createGradient(data.color1)} !important;">${BDFDB.StringUtils.htmlEscape(data.name || (usenick ? member.nick : info.username))}</span>`));
2019-08-19 11:17:57 +02:00
}
else {
2019-10-23 10:03:33 +02:00
username.style.setProperty("color", BDFDB.ColorUtils.convert(data.color1 || (usemembercolor ? member.colorString : null), "RGBA"), "important");
2019-10-23 11:10:01 +02:00
BDFDB.DOMUtils.setText(username, data.name || (usenick ? member.nick : info.username));
2019-08-19 11:17:57 +02:00
}
2019-09-04 12:34:02 +02:00
2019-10-23 10:03:33 +02:00
username.style.setProperty("background", BDFDB.ObjectUtils.is(data.color2) ? BDFDB.ColorUtils.createGradient(data.color2) : BDFDB.ColorUtils.convert(data.color2, "RGBA"), "important");
2019-09-04 12:34:02 +02:00
if (data.name || data.color1 || data.color2) {
username.setAttribute("changed-by-editusers", true);
username.EditUsersChangeObserver = new MutationObserver((changes, _) => {
username.EditUsersChangeObserver.disconnect();
this.changeName(info, username);
});
username.EditUsersChangeObserver.observe(username, {attributes:true});
}
else username.removeAttribute("changed-by-editusers");
2018-10-11 10:21:26 +02:00
}
}
2019-01-26 22:45:19 +01:00
2019-09-07 09:21:39 +02:00
changeName2 (info, username, guildid = BDFDB.LibraryModules.LastGuildStore.getGuildId()) {
2018-12-25 17:09:23 +01:00
if (!info || !username || !username.parentElement) return;
if (username.EditUsersChangeObserver && typeof username.EditUsersChangeObserver.disconnect == "function") username.EditUsersChangeObserver.disconnect();
let data = this.getUserData(info.id, username);
2019-09-07 09:21:39 +02:00
let member = BDFDB.LibraryModules.MemberStore.getMember(guildid, info.id) || {};
2019-06-24 10:34:18 +02:00
this.changeBotTags(data, username, member);
if (data.name || data.color1 || username.getAttribute("changed-by-editusers")) {
2019-10-22 18:55:25 +02:00
if (BDFDB.ObjectUtils.is(data.color1)) {
2019-10-23 10:03:33 +02:00
username.style.setProperty("color", BDFDB.ColorUtils.convert(data.color1[Object.keys(data.color1)[0]], "RGBA"), "important");
2019-10-23 11:10:01 +02:00
BDFDB.DOMUtils.setText(username, BDFDB.DOMUtils.create(`<span style="pointer-events: none; -webkit-background-clip: text !important; color: transparent !important; background-image: ${BDFDB.ColorUtils.createGradient(data.color1)} !important;">${BDFDB.StringUtils.htmlEscape(data.name || member.nick || info.username)}</span>`));
2019-08-19 11:17:57 +02:00
}
else {
2019-10-23 11:10:01 +02:00
username.style.setProperty("color", BDFDB.ColorUtils.convert(data.color1 || (BDFDB.BDUtils.isPluginEnabled("BetterRoleColors") ? member.colorString : null), "RGBA"), "important");
BDFDB.DOMUtils.setText(username, data.name || member.nick || info.username);
2019-08-19 11:17:57 +02:00
}
if (data.name || data.color1) {
username.setAttribute("changed-by-editusers", true);
username.EditUsersChangeObserver = new MutationObserver((changes, _) => {
username.EditUsersChangeObserver.disconnect();
this.changeName(info, username);
});
username.EditUsersChangeObserver.observe(username, {attributes:true});
}
else username.removeAttribute("changed-by-editusers");
}
2018-10-11 10:21:26 +02:00
}
2019-01-26 22:45:19 +01:00
2019-08-19 11:17:57 +02:00
changeName3 (info, username, adddisc = false) {
2018-12-25 17:09:23 +01:00
if (!info || !username || !username.parentElement) return;
if (username.EditUsersChangeObserver && typeof username.EditUsersChangeObserver.disconnect == "function") username.EditUsersChangeObserver.disconnect();
let data = this.getUserData(info.id, username);
if (data.name || data.color1 || username.getAttribute("changed-by-editusers")) {
if (adddisc) {
2019-10-23 11:10:01 +02:00
BDFDB.DOMUtils.setText(username, BDFDB.DOMUtils.create(`<span ${data.color1 ? (BDFDB.ObjectUtils.is(data.color1) ? 'style="pointer-events: none; -webkit-background-clip: text !important; color: transparent !important; background-image:' + BDFDB.ColorUtils.createGradient(data.color1) + ' !important;"' : 'style="color:' + data.color1 + ' !important;"'): ''}>${BDFDB.StringUtils.htmlEscape(data.name || info.username)}</span><span${typeof adddisc == "string" ? ' class="' + adddisc + '"' : ''}>#${info.discriminator}</span>`));
}
else {
2019-10-22 18:55:25 +02:00
if (BDFDB.ObjectUtils.is(data.color1)) {
2019-10-23 10:03:33 +02:00
username.style.setProperty("color", BDFDB.ColorUtils.convert(data.color1[Object.keys(data.color1)[0]], "RGBA"), "important");
2019-10-23 11:10:01 +02:00
BDFDB.DOMUtils.setText(username, BDFDB.DOMUtils.create(`<span style="pointer-events: none; -webkit-background-clip: text !important; color: transparent !important; background-image: ${BDFDB.ColorUtils.createGradient(data.color1)} !important;">${BDFDB.StringUtils.htmlEscape(data.name || info.username)}</span>`));
2019-08-19 11:17:57 +02:00
}
else {
2019-10-23 10:03:33 +02:00
username.style.setProperty("color", BDFDB.ColorUtils.convert(data.color1, "RGBA"), "important");
2019-10-23 11:10:01 +02:00
BDFDB.DOMUtils.setText(username, data.name || info.username);
2019-08-19 11:17:57 +02:00
}
}
if (data.name || data.color1) {
username.setAttribute("changed-by-editusers", true);
username.EditUsersChangeObserver = new MutationObserver((changes, _) => {
username.EditUsersChangeObserver.disconnect();
this.changeName(info, username);
});
username.EditUsersChangeObserver.observe(username, {attributes:true});
}
else username.removeAttribute("changed-by-editusers");
}
}
2019-09-04 12:34:02 +02:00
2019-02-07 22:54:50 +01:00
changeBotTags (data, username, member) {
2019-10-23 11:10:01 +02:00
for (let tag of username.parentElement.parentElement.querySelectorAll(BDFDB.dotCN.bottag)) if (!BDFDB.DOMUtils.containsClass(tag, "TRE-tag")) {
let isBRCbottagsEnabled = BDFDB.ReactUtils.getValue(BDFDB.BDUtils.getPlugin("BetterRoleColors", true), "settings.modules.botTags");
let tagcolor = BDFDB.ColorUtils.convert(data.color1 || (isBRCbottagsEnabled || BDFDB.DOMUtils.containsClass(tag, "owner-tag-rolecolor") ? member.colorString : null), "RGBA");
2019-10-23 10:03:33 +02:00
tagcolor = BDFDB.ColorUtils.isBright(tagcolor) ? BDFDB.ColorUtils.change(tagcolor, -0.3) : tagcolor;
2019-10-23 11:10:01 +02:00
tag.style.setProperty(BDFDB.DOMUtils.containsClass(tag, BDFDB.disCN.bottaginvert) ? "color" : "background-color", tagcolor, "important");
2019-02-07 22:54:50 +01:00
}
}
2019-01-26 22:45:19 +01:00
changeAvatar (info, avatar) {
2018-12-25 17:09:23 +01:00
if (!info || !avatar || !avatar.parentElement) return;
if (avatar.EditUsersChangeObserver && typeof avatar.EditUsersChangeObserver.disconnect == "function") avatar.EditUsersChangeObserver.disconnect();
let data = this.getUserData(info.id, avatar);
if (data.url || data.removeIcon || avatar.getAttribute("changed-by-editusers")) {
2019-10-22 18:55:25 +02:00
if (avatar.tagName == "IMG") avatar.setAttribute("src", data.removeIcon ? null : (data.url || BDFDB.UserUtils.getAvatar(info.id)));
else {
2019-10-22 18:55:25 +02:00
let url = data.removeIcon ? null : ("url(" + (data.url || BDFDB.UserUtils.getAvatar(info.id)) + ")");
2019-10-23 11:10:01 +02:00
if (url && BDFDB.DOMUtils.getParent(BDFDB.dotCN.userprofile, avatar) && url.search(/discordapp\.com\/avatars\/[0-9]*\/a_/) > -1) url = url.replace(".webp)", ".gif)");
avatar.style.setProperty("background-image", url);
if (data.url && !data.removeIcon) {
avatar.style.setProperty("background-position", "center");
avatar.style.setProperty("background-size", "cover");
}
2019-01-02 09:58:59 +01:00
}
if (data.url || data.removeIcon) {
avatar.setAttribute("changed-by-editusers", true);
2019-07-18 15:09:53 +02:00
avatar.EditUsersChangeObserver = new MutationObserver((changes, _) => {changes.forEach((change, i) => {
avatar.EditUsersChangeObserver.disconnect();
this.changeAvatar(info, avatar);
});});
avatar.EditUsersChangeObserver.observe(avatar, {attributes:true});
}
else avatar.removeAttribute("changed-by-editusers");
}
2018-10-11 10:21:26 +02:00
}
2019-01-26 22:45:19 +01:00
changeTooltip (info, wrapper, type) {
2018-12-25 17:09:23 +01:00
if (!info || !wrapper || !wrapper.parentElement) return;
let data = this.getUserData(info.id, wrapper);
2019-10-23 11:10:01 +02:00
wrapper = BDFDB.DOMUtils.containsClass(wrapper, BDFDB.disCN.guildicon) ? wrapper.parentElement.parentElement.parentElement : wrapper;
2019-01-17 23:48:29 +01:00
wrapper.removeEventListener("mouseenter", wrapper.tooltipListenerEditUsers);
if (data.name) {
2020-01-14 00:06:07 +01:00
wrapper.tooltipListenerEditUsers = _ => {
2019-10-22 18:55:25 +02:00
BDFDB.TooltipUtils.create(wrapper, data.name, {type, selector:"EditUsers-tooltip", hide:true});
2019-01-17 23:48:29 +01:00
};
wrapper.addEventListener("mouseenter", wrapper.tooltipListenerEditUsers);
}
2018-10-11 10:21:26 +02:00
}
2019-01-26 22:45:19 +01:00
2019-08-06 20:53:56 +02:00
addTag (info, wrapper, selector = "", container) {
2019-10-23 11:10:01 +02:00
if (!info || !wrapper || !wrapper.parentElement || BDFDB.DOMUtils.containsClass(wrapper, BDFDB.disCN.accountinfodetails) || BDFDB.DOMUtils.containsClass(wrapper, "discord-tag")) return;
BDFDB.DOMUtils.remove(wrapper.querySelectorAll(".EditUsers-tag"));
let data = this.getUserData(info.id, wrapper);
if (data.tag) {
2019-09-07 09:21:39 +02:00
let member = data.ignoreTagColor ? (BDFDB.LibraryModules.MemberStore.getMember(BDFDB.LibraryModules.LastGuildStore.getGuildId(), info.id) || {}) : {};
2019-10-23 10:03:33 +02:00
let color3 = BDFDB.ObjectUtils.is(data.color3) && !data.ignoreTagColor ? BDFDB.ColorUtils.createGradient(data.color3) : BDFDB.ColorUtils.convert(!data.ignoreTagColor ? data.color3 : member.colorString, "RGBA");
let color4 = BDFDB.ObjectUtils.is(data.color4) && !data.ignoreTagColor ? BDFDB.ColorUtils.createGradient(data.color4) : (!data.ignoreTagColor && data.color4 ? BDFDB.ColorUtils.convert(data.color4, "RGBA") : (color3 ? (BDFDB.ColorUtils.isBright(color3) ? "black" : "white") : null));
let tag = document.createElement("span");
2019-10-23 11:10:01 +02:00
let invert = container && !color3 && !color4 && container.firstElementChild && !(BDFDB.DOMUtils.containsClass(container.firstElementChild, BDFDB.disCN.userpopoutheadernormal) || BDFDB.DOMUtils.containsClass(container.firstElementChild, BDFDB.disCN.userprofiletopsectionnormal));
2019-08-06 20:53:56 +02:00
tag.className = "EditUsers-tag " + (!invert ? BDFDB.disCN.bottagregular : BDFDB.disCN.bottaginvert) + (selector ? (" " + selector) : "");
2019-08-19 11:17:57 +02:00
tag.style.setProperty("background", !invert ? color3 : color4, "important");
let fontcolor = invert ? color3 : color4;
let fontobj = invert ? data.color3 : data.color4;
2019-10-23 11:10:01 +02:00
if (BDFDB.ObjectUtils.is(fontobj)) tag.appendChild(BDFDB.DOMUtils.create(`<span style="pointer-events: none; -webkit-background-clip: text !important; color: transparent !important; background-image: ${fontcolor} !important;">${BDFDB.StringUtils.htmlEscape(data.tag)}</span>`));
2019-08-19 11:17:57 +02:00
else {
tag.innerText = data.tag;
tag.style.setProperty("color", fontcolor, "important");
}
wrapper.appendChild(tag);
}
2018-10-11 10:21:26 +02:00
}
2019-01-26 22:45:19 +01:00
changePrivateChannel (info, username) {
if (!info || !username || !username.parentElement) return;
2019-10-23 11:10:01 +02:00
let dmchannel = BDFDB.DOMUtils.getParent(BDFDB.dotCN.dmchannel, username);
if (!dmchannel) return;
if (username.EditUsersChangeObserver && typeof username.EditUsersChangeObserver.disconnect == "function") username.EditUsersChangeObserver.disconnect();
2019-01-17 23:48:29 +01:00
dmchannel.removeEventListener("mouseenter", dmchannel.mouseenterListenerEditUsers);
dmchannel.removeEventListener("mouseleave", dmchannel.mouseleaveListenerEditUsers);
let data = this.getUserData(info.id, username);
if (data.name || data.color1 || data.color2 || username.getAttribute("changed-by-editusers")) {
2019-10-23 11:10:01 +02:00
if (username.EditUsersHovered || BDFDB.DOMUtils.containsClass(dmchannel, BDFDB.disCN.namecontainerselected)) colorHover();
else colorDefault();
2019-01-26 22:45:19 +01:00
if (data.name || data.color1 || data.color2) {
2020-01-14 00:06:07 +01:00
dmchannel.mouseenterListenerEditUsers = _ => {
2019-01-17 23:48:29 +01:00
username.EditUsersHovered = true;
colorHover();
};
2020-01-14 00:06:07 +01:00
dmchannel.mouseleaveListenerEditUsers = _ => {
2019-01-17 23:48:29 +01:00
delete username.EditUsersHovered;
colorDefault();
};
dmchannel.addEventListener("mouseenter", dmchannel.mouseenterListenerEditUsers);
dmchannel.addEventListener("mouseleave", dmchannel.mouseleaveListenerEditUsers);
username.setAttribute("changed-by-editusers", true);
username.EditUsersChangeObserver = new MutationObserver((changes, _) => {
username.EditUsersChangeObserver.disconnect();
this.changePrivateChannel(info, username);
});
username.EditUsersChangeObserver.observe(username, {attributes:true});
}
else username.removeAttribute("changed-by-editusers");
function colorDefault() {
2019-10-22 18:55:25 +02:00
if (BDFDB.ObjectUtils.is(data.color1)) {
2019-08-19 11:17:57 +02:00
username.style.removeProperty("color");
2019-10-23 11:10:01 +02:00
BDFDB.DOMUtils.setText(username, BDFDB.DOMUtils.create(`<span style="pointer-events: none; -webkit-background-clip: text !important; color: transparent !important; background-image: ${BDFDB.ColorUtils.createGradient(BDFDB.ColorUtils.change(data.color1, -0.5))} !important;">${BDFDB.StringUtils.htmlEscape(data.name || info.username)}</span>`));
2019-08-19 11:17:57 +02:00
}
else {
2019-10-23 10:03:33 +02:00
username.style.setProperty("color", BDFDB.ColorUtils.change(data.color1, -0.5, "RGBA"), "important");
2019-10-23 11:10:01 +02:00
BDFDB.DOMUtils.setText(username, data.name || info.username);
2019-08-19 11:17:57 +02:00
}
2019-10-23 10:03:33 +02:00
username.style.setProperty("background", BDFDB.ObjectUtils.is(data.color2) ? BDFDB.ColorUtils.createGradient(BDFDB.ColorUtils.change(data.color2, -0.5)) : BDFDB.ColorUtils.change(data.color2, -0.5, "RGBA"), "important");
}
function colorHover() {
2019-10-22 18:55:25 +02:00
if (BDFDB.ObjectUtils.is(data.color1)) {
2019-08-19 11:17:57 +02:00
username.style.removeProperty("color");
2019-10-23 11:10:01 +02:00
BDFDB.DOMUtils.setText(username, BDFDB.DOMUtils.create(`<span style="pointer-events: none; -webkit-background-clip: text !important; color: transparent !important; background-image: ${BDFDB.ColorUtils.createGradient(data.color1)} !important;">${BDFDB.StringUtils.htmlEscape(data.name || info.username)}</span>`));
2019-08-19 11:17:57 +02:00
}
else {
2019-10-23 10:03:33 +02:00
username.style.setProperty("color", BDFDB.ColorUtils.convert(data.color1, "RGBA"), "important");
2019-10-23 11:10:01 +02:00
BDFDB.DOMUtils.setText(username, data.name || info.username);
2019-08-19 11:17:57 +02:00
}
2019-10-23 10:03:33 +02:00
username.style.setProperty("background", BDFDB.ObjectUtils.is(data.color2) ? BDFDB.ColorUtils.createGradient(data.color2) : BDFDB.ColorUtils.convert(data.color2, "RGBA"), "important");
}
}
}
2019-01-26 22:45:19 +01:00
changeMention (info, mention) {
2018-12-25 17:09:23 +01:00
if (!info || !mention || !mention.parentElement) return;
if (mention.EditUsersChangeObserver && typeof mention.EditUsersChangeObserver.disconnect == "function") mention.EditUsersChangeObserver.disconnect();
2019-01-17 23:48:29 +01:00
mention.removeEventListener("mouseover", mention.mouseoverListenerEditUsers);
mention.removeEventListener("mouseout", mention.mouseoutListenerEditUsers);
let data = this.getUserData(info.id, mention);
2019-09-07 09:21:39 +02:00
let member = BDFDB.LibraryModules.MemberStore.getMember(BDFDB.LibraryModules.LastGuildStore.getGuildId(), info.id) || {};
2019-10-23 11:10:01 +02:00
let name = "@" + (data.name ? data.name : (BDFDB.BDUtils.isPluginEnabled("RemoveNicknames") ? BDFDB.BDUtils.getPlugin("RemoveNicknames").getNewName(info, mention) : member.nick || info.username));
2019-09-04 12:34:02 +02:00
2019-10-22 18:55:25 +02:00
let isgradient = data.color1 && BDFDB.ObjectUtils.is(data.color1);
2019-10-23 11:10:01 +02:00
let datacolor = data.color1 || (BDFDB.BDUtils.isPluginEnabled("BetterRoleColors") ? member.colorString : null);
2019-10-23 10:03:33 +02:00
let color = isgradient ? BDFDB.ColorUtils.createGradient(data.color1) : BDFDB.ColorUtils.convert(datacolor, "RGBA");
let color0_1 = isgradient ? BDFDB.ColorUtils.createGradient(BDFDB.ColorUtils.setAlpha(data.color1, 0.1, "RGBA")) : BDFDB.ColorUtils.setAlpha(datacolor, 0.1, "RGBA");
let color0_7 = isgradient ? BDFDB.ColorUtils.createGradient(BDFDB.ColorUtils.setAlpha(data.color1, 0.7, "RGBA")) : BDFDB.ColorUtils.setAlpha(datacolor, 0.7, "RGBA");
2019-09-04 12:34:02 +02:00
if (mention.EditUsersHovered) colorHover();
else colorDefault();
2020-01-14 00:06:07 +01:00
mention.mouseoverListenerEditUsers = _ => {
2019-01-17 23:48:29 +01:00
mention.EditUsersHovered = true;
colorHover();
};
2020-01-14 00:06:07 +01:00
mention.mouseoutListenerEditUsers = _ => {
2019-01-17 23:48:29 +01:00
delete mention.EditUsersHovered;
colorDefault();
};
mention.addEventListener("mouseover", mention.mouseoverListenerEditUsers);
mention.addEventListener("mouseout", mention.mouseoutListenerEditUsers);
mention.EditUsersChangeObserver = new MutationObserver((changes, _) => {
mention.EditUsersChangeObserver.disconnect();
this.changeMention(info, mention);
});
mention.EditUsersChangeObserver.observe(mention, {attributes:true});
function colorDefault() {
2019-08-19 11:17:57 +02:00
mention.style.setProperty("background", color0_1, "important");
if (isgradient) {
mention.style.removeProperty("color");
2019-10-23 11:10:01 +02:00
BDFDB.DOMUtils.setText(mention, BDFDB.DOMUtils.create(`<span style="pointer-events: none; -webkit-background-clip: text !important; color: transparent !important; background-image: ${color} !important;">${BDFDB.StringUtils.htmlEscape(name)}</span>`));
2019-08-19 11:17:57 +02:00
}
else {
mention.style.setProperty("color", color, "important");
2019-10-23 11:10:01 +02:00
BDFDB.DOMUtils.setText(mention, name);
2019-08-19 11:17:57 +02:00
}
}
function colorHover() {
2019-08-19 11:17:57 +02:00
mention.style.setProperty("background", color0_7, "important");
mention.style.setProperty("color", data.color1 ? "#FFFFFF" : null, "important");
2019-10-23 11:10:01 +02:00
BDFDB.DOMUtils.setText(mention, name);
2018-12-22 22:34:45 +01:00
}
2018-10-11 10:21:26 +02:00
}
2019-01-26 22:45:19 +01:00
2019-08-29 10:44:05 +02:00
changeVoiceUser (info, username, speaking) {
2018-12-25 17:09:23 +01:00
if (!info || !username || !username.parentElement) return;
if (username.EditUsersChangeObserver && typeof username.EditUsersChangeObserver.disconnect == "function") username.EditUsersChangeObserver.disconnect();
2019-04-23 08:09:58 +02:00
username.removeEventListener("mouseover", username.mouseoverListenerEditUsers);
username.removeEventListener("mouseout", username.mouseoutListenerEditUsers);
let data = this.getUserData(info.id, username);
if (data.name || data.color1 || username.getAttribute("changed-by-editusers")) {
2019-09-07 09:21:39 +02:00
let member = BDFDB.LibraryModules.MemberStore.getMember(BDFDB.LibraryModules.LastGuildStore.getGuildId(), info.id) || {};
2019-04-23 08:09:58 +02:00
if (username.EditUsersHovered) colorHover();
else colorDefault();
if (data.name || data.color1) {
2020-01-14 00:06:07 +01:00
username.mouseoverListenerEditUsers = _ => {
2019-04-23 08:09:58 +02:00
username.EditUsersHovered = true;
colorHover();
};
2020-01-14 00:06:07 +01:00
username.mouseoutListenerEditUsers = _ => {
2019-04-23 08:09:58 +02:00
delete username.EditUsersHovered;
colorDefault();
};
username.parentElement.parentElement.addEventListener("mouseover", username.mouseoverListenerEditUsers);
username.parentElement.parentElement.addEventListener("mouseout", username.mouseoutListenerEditUsers);
username.EditUsersChangeObserver = new MutationObserver((changes, _) => {
username.EditUsersChangeObserver.disconnect();
2019-08-29 10:44:05 +02:00
this.changeVoiceUser(info, username, speaking);
});
username.EditUsersChangeObserver.observe(username, {attributes:true});
}
else username.removeAttribute("changed-by-editusers");
2019-04-23 08:09:58 +02:00
function colorDefault() {
2019-10-22 18:55:25 +02:00
if (BDFDB.ObjectUtils.is(data.color1)) {
2019-08-19 11:17:57 +02:00
username.style.removeProperty("color");
2019-10-23 11:10:01 +02:00
BDFDB.DOMUtils.setText(username, BDFDB.DOMUtils.create(`<span style="pointer-events: none; -webkit-background-clip: text !important; color: transparent !important; background-image: ${BDFDB.ColorUtils.createGradient(!speaking ? BDFDB.ColorUtils.change(data.color1, -50) : data.color1)} !important;">${BDFDB.StringUtils.htmlEscape(data.name || member.nick || info.username)}</span>`));
2019-08-19 11:17:57 +02:00
}
else {
2019-10-23 11:10:01 +02:00
var color1 = data.color1 || (BDFDB.BDUtils.isPluginEnabled("BetterRoleColors") ? member.colorString : "");
2019-10-23 10:03:33 +02:00
username.style.setProperty("color", !speaking ? BDFDB.ColorUtils.change(color1, -50, "RGBA") : BDFDB.ColorUtils.convert(color1, "RGBA"), "important");
2019-10-23 11:10:01 +02:00
BDFDB.DOMUtils.setText(username, data.name || member.nick || info.username);
2019-08-19 11:17:57 +02:00
}
2019-04-23 08:09:58 +02:00
}
function colorHover() {
2019-10-22 18:55:25 +02:00
if (BDFDB.ObjectUtils.is(data.color1)) {
2019-08-19 11:17:57 +02:00
username.style.removeProperty("color");
2019-10-23 11:10:01 +02:00
BDFDB.DOMUtils.setText(username, BDFDB.DOMUtils.create(`<span style="pointer-events: none; -webkit-background-clip: text !important; color: transparent !important; background-image: ${BDFDB.ColorUtils.createGradient(data.color1)} !important;">${BDFDB.StringUtils.htmlEscape(data.name || member.nick || info.username)}</span>`));
2019-08-19 11:17:57 +02:00
}
else {
2019-10-23 10:03:33 +02:00
username.style.setProperty("color", BDFDB.ColorUtils.convert(data.color1, "RGBA"), "important");
2019-10-23 11:10:01 +02:00
BDFDB.DOMUtils.setText(username, data.name || member.nick || info.username);
2019-08-19 11:17:57 +02:00
}
2019-04-23 08:09:58 +02:00
}
}
}
2019-01-26 22:45:19 +01:00
getAvatarDiv (wrapper) {
var avatar = wrapper.querySelector(this.avatarselector);
while (!avatar && wrapper.parentElement) {
wrapper = wrapper.parentElement;
avatar = wrapper.querySelector(this.avatarselector);
2018-10-11 10:21:26 +02:00
}
2019-10-02 09:53:39 +02:00
return avatar.querySelector("img") || avatar.firstElementChild || avatar;
2018-10-11 10:21:26 +02:00
}
2019-01-26 22:45:19 +01:00
getUserData (id, wrapper) {
2019-10-22 20:16:05 +02:00
let data = BDFDB.DataUtils.load(this, "users", id);
2019-08-29 10:44:05 +02:00
if (!data) {
delete wrapper.EditUsersCachedDataState;
return {};
}
else if (wrapper.EditUsersCachedDataState) {
return data;
}
2019-09-04 12:34:02 +02:00
2019-10-22 19:49:57 +02:00
let allenabled = true, settings = BDFDB.DataUtils.get(this, "settings");
2019-02-07 22:54:50 +01:00
for (let i in settings) if (!settings[i]) {
allenabled = false;
break;
}
if (allenabled) return data;
2019-09-04 12:34:02 +02:00
2019-02-16 12:58:25 +01:00
let key = null;
2019-10-23 11:10:01 +02:00
if (!BDFDB.DOMUtils.containsClass(wrapper, BDFDB.disCN.mention) && BDFDB.DOMUtils.getParent(BDFDB.dotCN.messagegroup, wrapper)) key = "changeInChatWindow";
else if (BDFDB.DOMUtils.containsClass(wrapper, BDFDB.disCN.mention)) key = "changeInMentions";
else if (BDFDB.DOMUtils.getParent(BDFDB.dotCN.textareawrapchat, wrapper)) key = "changeInChatTextarea";
else if (BDFDB.DOMUtils.getParent(BDFDB.dotCN.voiceuser, wrapper)) key = "changeInVoiceChat";
else if (BDFDB.DOMUtils.getParent(BDFDB.dotCN.members, wrapper)) key = "changeInMemberList";
else if (BDFDB.DOMUtils.getParent(BDFDB.dotCN.guildouter, wrapper)) key = "changeInRecentDms";
else if (BDFDB.DOMUtils.getParent(BDFDB.dotCN.dmchannels, wrapper)) key = "changeInDmsList";
else if (BDFDB.DOMUtils.getParent(BDFDB.dotCN.channelheaderheaderbar, wrapper)) key = "changeInDmHeader";
else if (BDFDB.DOMUtils.getParent(BDFDB.dotCN.callavatarwrapper, wrapper) || BDFDB.DOMUtils.getParent(BDFDB.dotCN.callincoming, wrapper) || BDFDB.DOMUtils.getParent(BDFDB.dotCN.callcurrentcontainer, wrapper) || BDFDB.DOMUtils.getParent(BDFDB.dotCN.pictureinpicture, wrapper)) key = "changeInDmCalls";
else if (BDFDB.DOMUtils.getParent(BDFDB.dotCN.typing, wrapper)) key = "changeInTyping";
else if (BDFDB.DOMUtils.getParent(BDFDB.dotCN.friends, wrapper) || BDFDB.DOMUtils.getParent(BDFDB.dotCN.userprofilebody, wrapper)) key = "changeInFriendList";
else if (BDFDB.DOMUtils.getParent(BDFDB.dotCN.invitemodalinviterow, wrapper)) key = "changeInInviteList";
else if (BDFDB.DOMUtils.getParent(BDFDB.dotCN.activityfeed, wrapper)) key = "changeInActivity";
else if (BDFDB.DOMUtils.getParent(BDFDB.dotCN.userpopout, wrapper)) key = "changeInUserPopout";
else if (BDFDB.DOMUtils.getParent(BDFDB.dotCN.userprofileheader, wrapper)) key = "changeInUserProfil";
else if (BDFDB.DOMUtils.getParent(BDFDB.dotCN.autocomplete, wrapper)) key = "changeInAutoComplete";
else if (BDFDB.DOMUtils.getParent(BDFDB.dotCN.auditlog, wrapper)) key = "changeInAuditLog";
else if (BDFDB.DOMUtils.getParent(BDFDB.dotCN.guildsettingsbannedcard, wrapper) || BDFDB.DOMUtils.getParent(BDFDB.dotCN.guildsettingsinvitecard, wrapper) || BDFDB.DOMUtils.getParent(BDFDB.dotCN.guildsettingsmembercard, wrapper)) key = "changeInMemberLog";
else if (BDFDB.DOMUtils.getParent(BDFDB.dotCN.searchpopout, wrapper) || BDFDB.DOMUtils.getParent(BDFDB.dotCN.searchpopoutdmaddpopout, wrapper) || BDFDB.DOMUtils.getParent(BDFDB.dotCN.quickswitcher, wrapper)) key = "changeInSearchPopout";
else if (BDFDB.DOMUtils.getParent(BDFDB.dotCN.accountinfo, wrapper)) key = "changeInUserAccount";
2019-03-27 19:18:10 +01:00
else if (wrapper.parentElement == document.head) key = "changeInAppTitle";
2019-09-04 12:34:02 +02:00
2019-08-29 10:44:05 +02:00
if (!key || settings[key]) {
wrapper.EditUsersCachedDataState = true;
return data;
}
2019-10-22 18:55:25 +02:00
else return {};
}
2019-01-26 22:45:19 +01:00
addAutoCompleteMenu (textarea, channel) {
if (textarea.parentElement.querySelector(".autocompleteEditUsersRow")) return;
let words = textarea.value.split(/\s/);
let lastword = words[words.length-1].trim();
if (lastword && lastword.length > 1 && lastword[0] == "@") {
2019-10-22 19:49:57 +02:00
let users = BDFDB.DataUtils.load(this, "users");
if (!users) return;
let userarray = [];
for (let id in users) if (users[id].name) {
2019-09-07 09:21:39 +02:00
let user = BDFDB.LibraryModules.UserStore.getUser(id);
let member = user ? BDFDB.LibraryModules.MemberStore.getMember(channel.guild_id, id) : null;
if (user && member) userarray.push(Object.assign({lowercasename:users[id].name.toLowerCase(),user,member},users[id]));
}
2019-10-22 18:55:25 +02:00
userarray = BDFDB.ArrayUtils.keySort(userarray.filter(n => n.lowercasename.indexOf(lastword.toLowerCase().slice(1)) != -1), "lowercasename");
if (userarray.length) {
let autocompletemenu = textarea.parentElement.querySelector(BDFDB.dotCNS.autocomplete + BDFDB.dotCN.autocompleteinner), amount = 15;
if (!autocompletemenu) {
2019-10-23 11:10:01 +02:00
autocompletemenu = BDFDB.DOMUtils.create(`<div class="${BDFDB.disCNS.autocomplete + BDFDB.disCN.autocomplete2} autocompleteEditUsers"><div class="${BDFDB.disCN.autocompleteinner}"><div class="${BDFDB.disCNS.autocompleterowvertical + BDFDB.disCN.autocompleterow} autocompleteEditUsersRow"><div class="${BDFDB.disCN.autocompleteselector} autocompleteEditUsersSelector"><div class="${BDFDB.disCNS.autocompletecontenttitle + BDFDB.disCNS.small + BDFDB.disCNS.titlesize12 + BDFDB.disCNS.height16 + BDFDB.disCN.weightsemibold}">${BDFDB.LanguageUtils.LanguageStrings.MEMBERS_MATCHING.replace("{{prefix}}", BDFDB.StringUtils.htmlEscape(lastword))}</strong></div></div></div></div></div>`);
textarea.parentElement.appendChild(autocompletemenu);
autocompletemenu = autocompletemenu.firstElementChild;
}
else {
amount -= autocompletemenu.querySelectorAll(BDFDB.dotCN.autocompleteselectable).length;
}
2019-01-26 22:45:19 +01:00
2019-10-22 18:55:25 +02:00
BDFDB.ListenerUtils.add(this, autocompletemenu, "mouseenter", BDFDB.dotCN.autocompleteselectable, e => {
var selected = autocompletemenu.querySelectorAll(BDFDB.dotCN.autocompleteselected);
2019-10-23 11:10:01 +02:00
BDFDB.DOMUtils.removeClass(selected, BDFDB.disCN.autocompleteselected);
BDFDB.DOMUtils.addClass(selected, BDFDB.disCN.autocompleteselector);
BDFDB.DOMUtils.addClass(e.currentTarget, BDFDB.disCN.autocompleteselected);
});
2019-01-26 22:45:19 +01:00
for (let data of userarray) {
if (amount-- < 1) break;
2019-10-22 18:55:25 +02:00
let status = BDFDB.UserUtils.getStatus(data.user.id);
let isgradient = data.color1 && BDFDB.ObjectUtils.is(data.color1);
2019-10-23 11:10:01 +02:00
let username = isgradient ? `<div class="${BDFDB.disCN.marginleft8}" changed-by-editusers="true" style="flex: 1 1 auto;"><span style="pointer-events: none; -webkit-background-clip: text !important; color: transparent !important; background-image: ${BDFDB.ColorUtils.createGradient(data.color1)} !important;">${BDFDB.StringUtils.htmlEscape(data.name || data.member.nick || data.user.username)}</span></div>` : `<div class="${BDFDB.disCN.marginleft8}" changed-by-editusers="true" style="flex: 1 1 auto;${data.color1 ? (' color: ' + BDFDB.ColorUtils.convert(data.color1, 'RGB') + ' !important;') : ''}">${BDFDB.StringUtils.htmlEscape(data.name || data.member.nick || data.user.username)}</div>`;
let autocompleterow = BDFDB.DOMUtils.create(`<div class="${BDFDB.disCNS.autocompleterowvertical + BDFDB.disCN.autocompleterow} autocompleteEditUsersRow"><div userid="${data.user.id}" class="${BDFDB.disCNS.autocompleteselector + BDFDB.disCN.autocompleteselectable} autocompleteEditUsersSelector"><div class="${BDFDB.disCNS.flex + BDFDB.disCNS.horizontal + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.autocompletecontent}" style="flex: 1 1 auto;"><div class="${BDFDB.disCN.avatarwrapper}" role="img" aria-label="${data.user.username}, ${BDFDB.LanguageUtils.LanguageStrings["STATUS_" + status.toUpperCase()]}" aria-hidden="false" style="width: 24px; height: 24px;"><svg width="30" height="24" viewBox="0 0 30 24" class="${BDFDB.disCN.avatarmask}" aria-hidden="true"><foreignObject x="0" y="0" width="24" height="24" mask="url(#svg-mask-avatar-status-round-24)"><img src="${data.url || BDFDB.UserUtils.getAvatar(data.user.id)}" alt=" " class="${BDFDB.disCN.avatar}" aria-hidden="true"></foreignObject><rect width="8" height="8" x="16" y="16" fill="${BDFDB.UserUtils.getStatusColor(status)}" mask="url(#svg-mask-status-${status})" class="${BDFDB.disCN.avatarpointerevents}"></rect></svg></div>${username}<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.horizontal + BDFDB.disCNS.justifystart + BDFDB.disCNS.alignbaseline + BDFDB.disCNS.nowrap + BDFDB.disCN.autocompletedescription}" style="flex: 0 1 auto;"><div class="${BDFDB.disCN.autocompletedescriptionusername}">${BDFDB.StringUtils.htmlEscape(data.user.username)}</div><div class="${BDFDB.disCN.autocompletedescriptiondiscriminator}">#${data.user.discriminator}</div></div></div></div></div>`);
2020-01-14 00:06:07 +01:00
autocompleterow.querySelector(BDFDB.dotCN.autocompleteselectable).addEventListener("click", _ => {this.swapWordWithMention(textarea);});
autocompletemenu.appendChild(autocompleterow);
}
if (!autocompletemenu.querySelector(BDFDB.dotCN.autocompleteselected)) {
2019-10-23 11:10:01 +02:00
BDFDB.DOMUtils.addClass(autocompletemenu.querySelector(".autocompleteEditUsersRow " + BDFDB.dotCN.autocompleteselectable), BDFDB.disCN.autocompleteselected);
}
}
}
}
2019-01-26 22:45:19 +01:00
getNextSelection (menu, selected, forward) {
selected = selected ? selected : menu.querySelector(BDFDB.dotCN.autocompleteselected).parentElement;
let next, sibling = forward ? selected.nextElementSibling : selected.previousElementSibling;
if (sibling) {
next = sibling.querySelector(BDFDB.dotCN.autocompleteselectable);
}
else {
let items = menu.querySelectorAll(BDFDB.dotCN.autocompleteselectable);
2019-09-04 12:34:02 +02:00
next = forward ? items[0] : items[items.length-1];
}
return next ? next : this.getNextSelection(menu, sibling, forward);
}
2019-01-26 22:45:19 +01:00
swapWordWithMention (textarea) {
let selected = textarea.parentElement.querySelector(".autocompleteEditUsersRow " + BDFDB.dotCN.autocompleteselected);
let words = textarea.value.split(/\s/);
let lastword = words[words.length-1].trim();
if (selected && lastword) {
let username = selected.querySelector(BDFDB.dotCN.autocompletedescriptionusername).textContent;
let discriminator = selected.querySelector(BDFDB.dotCN.autocompletedescriptiondiscriminator).textContent;
let userid = selected.getAttribute("userid");
2019-10-23 11:10:01 +02:00
BDFDB.DOMUtils.remove(".autocompleteEditUsers", ".autocompleteEditUsersRow");
2019-09-04 12:34:02 +02:00
textarea.focus();
textarea.selectionStart = textarea.value.length - lastword.length;
textarea.selectionEnd = textarea.value.length;
2019-01-25 12:15:44 +01:00
document.execCommand("insertText", false, (username && discriminator ? ("@" + username + discriminator) : `<@!${userid}>`) + " ");
textarea.selectionStart = textarea.value.length;
textarea.selectionEnd = textarea.value.length;
}
}
2019-01-26 22:45:19 +01:00
2018-10-11 10:21:26 +02:00
setLabelsByLanguage () {
2019-10-22 18:55:25 +02:00
switch (BDFDB.LanguageUtils.getLanguage().id) {
2018-10-11 10:21:26 +02:00
case "hr": //croatian
return {
context_localusersettings_text: "Lokalne korisničke postavke",
submenu_usersettings_text: "Promijeni postavke",
submenu_resetsettings_text: "Poništi korisnika",
modal_header_text: "Lokalne korisničke postavke",
modal_username_text: "Lokalno korisničko ime",
modal_usertag_text: "Oznaka",
2019-10-16 22:18:15 +02:00
modal_useravatar_text: "Ikona",
2018-10-11 10:21:26 +02:00
modal_removeicon_text: "Ukloni ikonu",
modal_tabheader1_text: "Korisnik",
modal_tabheader2_text: "Boja naziva",
modal_tabheader3_text: "Boja oznaka",
modal_colorpicker1_text: "Boja naziva",
modal_colorpicker2_text: "Boja pozadine",
modal_colorpicker3_text: "Boja oznaka",
modal_colorpicker4_text: "Boja fonta",
modal_ignoretagcolor_text: "Upotrijebite boju uloga",
modal_validurl_text: "Vrijedi URL",
2019-09-11 12:14:43 +02:00
modal_invalidurl_text: "Nevažeći URL"
2018-10-11 10:21:26 +02:00
};
case "da": //danish
return {
context_localusersettings_text: "Lokal brugerindstillinger",
submenu_usersettings_text: "Skift indstillinger",
submenu_resetsettings_text: "Nulstil bruger",
modal_header_text: "Lokal brugerindstillinger",
modal_username_text: "Lokalt brugernavn",
modal_usertag_text: "Initialer",
2019-10-16 22:18:15 +02:00
modal_useravatar_text: "Ikon",
2018-10-11 10:21:26 +02:00
modal_removeicon_text: "Fjern ikon",
modal_tabheader1_text: "Bruger",
modal_tabheader2_text: "Navnefarve",
modal_tabheader3_text: "Etiketfarve",
modal_colorpicker1_text: "Navnefarve",
modal_colorpicker2_text: "Baggrundsfarve",
modal_colorpicker3_text: "Etiketfarve",
modal_colorpicker4_text: "Skriftfarve",
modal_ignoretagcolor_text: "Brug rollefarve",
modal_validurl_text: "Gyldig URL",
2019-09-11 12:14:43 +02:00
modal_invalidurl_text: "Ugyldig URL"
2018-10-11 10:21:26 +02:00
};
case "de": //german
return {
context_localusersettings_text: "Lokale Benutzereinstellungen",
submenu_usersettings_text: "Einstellungen ändern",
submenu_resetsettings_text: "Benutzer zurücksetzen",
modal_header_text: "Lokale Benutzereinstellungen",
modal_username_text: "Lokaler Benutzername",
modal_usertag_text: "Etikett",
2019-10-16 22:18:15 +02:00
modal_useravatar_text: "Icon",
2018-10-11 10:21:26 +02:00
modal_removeicon_text: "Entferne Icon",
modal_tabheader1_text: "Benutzer",
modal_tabheader2_text: "Namensfarbe",
modal_tabheader3_text: "Etikettfarbe",
modal_colorpicker1_text: "Namensfarbe",
modal_colorpicker2_text: "Hintergrundfarbe",
modal_colorpicker3_text: "Etikettfarbe",
modal_colorpicker4_text: "Schriftfarbe",
modal_ignoretagcolor_text: "Benutze Rollenfarbe",
modal_validurl_text: "Gültige URL",
2019-09-11 12:14:43 +02:00
modal_invalidurl_text: "Ungültige URL"
2018-10-11 10:21:26 +02:00
};
case "es": //spanish
return {
context_localusersettings_text: "Ajustes local de usuario",
submenu_usersettings_text: "Cambiar ajustes",
submenu_resetsettings_text: "Restablecer usuario",
modal_header_text: "Ajustes local de usuario",
modal_username_text: "Nombre local de usuario",
modal_usertag_text: "Etiqueta",
2019-10-16 22:18:15 +02:00
modal_useravatar_text: "Icono",
2018-10-11 10:21:26 +02:00
modal_removeicon_text: "Eliminar icono",
modal_tabheader1_text: "Usuario",
modal_tabheader2_text: "Color del nombre",
modal_tabheader3_text: "Color de la etiqueta",
modal_colorpicker1_text: "Color del nombre",
modal_colorpicker2_text: "Color de fondo",
modal_colorpicker3_text: "Color de la etiqueta",
modal_colorpicker4_text: "Color de fuente",
modal_ignoretagcolor_text: "Usar color de rol",
modal_validurl_text: "URL válida",
2019-09-11 12:14:43 +02:00
modal_invalidurl_text: "URL inválida"
2018-10-11 10:21:26 +02:00
};
case "fr": //french
return {
context_localusersettings_text: "Paramètres locale d'utilisateur",
submenu_usersettings_text: "Modifier les paramètres",
submenu_resetsettings_text: "Réinitialiser l'utilisateur",
modal_header_text: "Paramètres locale d'utilisateur",
modal_username_text: "Nom local d'utilisateur",
modal_usertag_text: "Étiquette",
2019-10-16 22:18:15 +02:00
modal_useravatar_text: "Icône",
2018-10-11 10:21:26 +02:00
modal_removeicon_text: "Supprimer l'icône",
modal_tabheader1_text: "Serveur",
modal_tabheader2_text: "Couleur du nom",
modal_tabheader3_text: "Couleur de l'étiquette",
modal_colorpicker1_text: "Couleur du nom",
modal_colorpicker2_text: "Couleur de fond",
modal_colorpicker3_text: "Couleur de l'étiquette",
modal_colorpicker4_text: "Couleur de la police",
modal_ignoretagcolor_text: "Utiliser la couleur de rôle",
modal_validurl_text: "URL valide",
2019-09-11 12:14:43 +02:00
modal_invalidurl_text: "URL invalide"
2018-10-11 10:21:26 +02:00
};
case "it": //italian
return {
context_localusersettings_text: "Impostazioni locale utente",
submenu_usersettings_text: "Cambia impostazioni",
submenu_resetsettings_text: "Ripristina utente",
modal_header_text: "Impostazioni locale utente",
modal_username_text: "Nome locale utente",
modal_usertag_text: "Etichetta",
2019-10-16 22:18:15 +02:00
modal_useravatar_text: "Icona",
2018-10-11 10:21:26 +02:00
modal_removeicon_text: "Rimuova l'icona",
modal_tabheader1_text: "Utente",
modal_tabheader2_text: "Colore del nome",
modal_tabheader3_text: "Colore della etichetta",
modal_colorpicker1_text: "Colore del nome",
modal_colorpicker2_text: "Colore di sfondo",
modal_colorpicker3_text: "Colore della etichetta",
modal_colorpicker4_text: "Colore del carattere",
modal_ignoretagcolor_text: "Usa il colore del ruolo",
modal_validurl_text: "URL valido",
2019-09-11 12:14:43 +02:00
modal_invalidurl_text: "URL non valido"
2018-10-11 10:21:26 +02:00
};
case "nl": //dutch
return {
context_localusersettings_text: "Lokale gebruikerinstellingen",
submenu_usersettings_text: "Verandere instellingen",
submenu_resetsettings_text: "Reset gebruiker",
modal_header_text: "Lokale gebruikerinstellingen",
modal_username_text: "Lokale gebruikernaam",
modal_usertag_text: "Etiket",
2019-10-16 22:18:15 +02:00
modal_useravatar_text: "Icoon",
2018-10-11 10:21:26 +02:00
modal_removeicon_text: "Verwijder icoon",
modal_tabheader1_text: "Gebruiker",
modal_tabheader2_text: "Naamkleur",
modal_tabheader3_text: "Etiketkleur",
modal_colorpicker1_text: "Naamkleur",
modal_colorpicker2_text: "Achtergrondkleur",
modal_colorpicker3_text: "Etiketkleur",
modal_colorpicker4_text: "Doopvontkleur",
modal_ignoretagcolor_text: "Gebruik rolkleur",
modal_validurl_text: "Geldige URL",
2019-09-11 12:14:43 +02:00
modal_invalidurl_text: "Ongeldige URL"
2018-10-11 10:21:26 +02:00
};
case "no": //norwegian
return {
context_localusersettings_text: "Lokal brukerinnstillinger",
submenu_usersettings_text: "Endre innstillinger",
submenu_resetsettings_text: "Tilbakestill bruker",
modal_header_text: "Lokal brukerinnstillinger",
modal_username_text: "Lokalt gebruikernavn",
modal_usertag_text: "Stikkord",
2019-10-16 22:18:15 +02:00
modal_useravatar_text: "Ikon",
2018-10-11 10:21:26 +02:00
modal_removeicon_text: "Fjern ikon",
modal_tabheader1_text: "Bruker",
modal_tabheader2_text: "Navnfarge",
modal_tabheader3_text: "Stikkordfarge",
modal_colorpicker1_text: "Navnfarge",
modal_colorpicker2_text: "Bakgrunnfarge",
modal_colorpicker3_text: "Stikkordfarge",
modal_colorpicker4_text: "Skriftfarge",
modal_ignoretagcolor_text: "Bruk rollefarge",
modal_validurl_text: "Gyldig URL",
2019-09-11 12:14:43 +02:00
modal_invalidurl_text: "Ugyldig URL"
2018-10-11 10:21:26 +02:00
};
case "pl": //polish
return {
context_localusersettings_text: "Lokalne ustawienia użytkownika",
submenu_usersettings_text: "Zmień ustawienia",
submenu_resetsettings_text: "Resetuj ustawienia",
modal_header_text: "Lokalne ustawienia użytkownika",
modal_username_text: "Lokalna nazwa użytkownika",
modal_usertag_text: "Etykieta",
2019-10-16 22:18:15 +02:00
modal_useravatar_text: "Ikona",
2018-10-11 10:21:26 +02:00
modal_removeicon_text: "Usuń ikonę",
modal_tabheader1_text: "Użytkownik",
modal_tabheader2_text: "Kolor nazwy",
modal_tabheader3_text: "Kolor etykiety",
modal_colorpicker1_text: "Kolor nazwy",
modal_colorpicker2_text: "Kolor tła",
modal_colorpicker3_text: "Kolor etykiety",
modal_colorpicker4_text: "Kolor czcionki",
modal_ignoretagcolor_text: "Użyj kolor roli",
modal_validurl_text: "Prawidłowe URL",
2019-09-11 12:14:43 +02:00
modal_invalidurl_text: "Nieprawidłowe URL"
2018-10-11 10:21:26 +02:00
};
case "pt-BR": //portuguese (brazil)
return {
context_localusersettings_text: "Configurações local do utilizador",
submenu_usersettings_text: "Mudar configurações",
submenu_resetsettings_text: "Redefinir utilizador",
modal_header_text: "Configurações local do utilizador",
modal_username_text: "Nome local do utilizador",
modal_usertag_text: "Etiqueta",
2019-10-16 22:18:15 +02:00
modal_useravatar_text: "Icone",
2018-10-11 10:21:26 +02:00
modal_removeicon_text: "Remover ícone",
modal_tabheader1_text: "Utilizador",
modal_tabheader2_text: "Cor do nome",
modal_tabheader3_text: "Cor da etiqueta",
modal_colorpicker1_text: "Cor do nome",
modal_colorpicker2_text: "Cor do fundo",
modal_colorpicker3_text: "Cor da etiqueta",
modal_colorpicker4_text: "Cor da fonte",
modal_ignoretagcolor_text: "Use a cor do papel",
modal_validurl_text: "URL válido",
2019-09-11 12:14:43 +02:00
modal_invalidurl_text: "URL inválida"
2018-10-11 10:21:26 +02:00
};
case "fi": //finnish
return {
context_localusersettings_text: "Paikallinen käyttäjä asetukset",
submenu_usersettings_text: "Vaihda asetuksia",
submenu_resetsettings_text: "Nollaa käyttäjä",
modal_header_text: "Paikallinen käyttäjä asetukset",
modal_username_text: "Paikallinen käyttäjätunnus",
modal_usertag_text: "Merkki",
2019-10-16 22:18:15 +02:00
modal_useravatar_text: "Ikonin",
2018-10-11 10:21:26 +02:00
modal_removeicon_text: "Poista kuvake",
modal_tabheader1_text: "Käyttäjä",
modal_tabheader2_text: "Nimiväri",
modal_tabheader3_text: "Merkkiväri",
modal_colorpicker1_text: "Nimiväri",
modal_colorpicker2_text: "Taustaväri",
modal_colorpicker3_text: "Merkkiväri",
modal_colorpicker4_text: "Fontinväri",
modal_ignoretagcolor_text: "Käytä rooliväriä",
modal_validurl_text: "Voimassa URL",
2019-09-11 12:14:43 +02:00
modal_invalidurl_text: "Virheellinen URL"
2018-10-11 10:21:26 +02:00
};
case "sv": //swedish
return {
context_localusersettings_text: "Lokal användareinställningar",
submenu_usersettings_text: "Ändra inställningar",
submenu_resetsettings_text: "Återställ användare",
modal_header_text: "Lokal användareinställningar",
modal_username_text: "Lokalt användarenamn",
modal_usertag_text: "Märka",
2019-10-16 22:18:15 +02:00
modal_useravatar_text: "Ikon",
2018-10-11 10:21:26 +02:00
modal_removeicon_text: "Ta bort ikonen",
modal_tabheader1_text: "Användare",
modal_tabheader2_text: "Namnfärg",
modal_tabheader3_text: "Märkafärg",
modal_colorpicker1_text: "Namnfärg",
modal_colorpicker2_text: "Bakgrundfärg",
modal_colorpicker3_text: "Märkafärg",
modal_colorpicker4_text: "Fontfärg",
modal_ignoretagcolor_text: "Använd rollfärg",
modal_validurl_text: "Giltig URL",
2019-09-11 12:14:43 +02:00
modal_invalidurl_text: "Ogiltig URL"
2018-10-11 10:21:26 +02:00
};
case "tr": //turkish
return {
context_localusersettings_text: "Yerel Kullanıcı Ayarları",
submenu_usersettings_text: "Ayarları Değiştir",
submenu_resetsettings_text: "Kullanıcı Sıfırla",
modal_header_text: "Yerel Kullanıcı Ayarları",
modal_username_text: "Yerel Kullanıcı Isim",
modal_usertag_text: "Etiket",
2019-10-16 22:18:15 +02:00
modal_useravatar_text: "Simge",
2018-10-11 10:21:26 +02:00
modal_removeicon_text: "Simge kaldır",
modal_tabheader1_text: "Kullanıcı",
modal_tabheader2_text: "Simge rengi",
modal_tabheader3_text: "Isim rengi",
modal_colorpicker1_text: "Simge rengi",
modal_colorpicker2_text: "Arka fon rengi",
modal_colorpicker3_text: "Etiket rengi",
modal_colorpicker4_text: "Yazı rengi",
modal_ignoretagcolor_text: "Rol rengini kullan",
modal_validurl_text: "Geçerli URL",
2019-09-11 12:14:43 +02:00
modal_invalidurl_text: "Geçersiz URL"
2018-10-11 10:21:26 +02:00
};
case "cs": //czech
return {
context_localusersettings_text: "Místní nastavení uživatel",
submenu_usersettings_text: "Změnit nastavení",
submenu_resetsettings_text: "Obnovit uživatel",
modal_header_text: "Místní nastavení uživatel",
modal_username_text: "Místní název uživatel",
modal_usertag_text: "Štítek",
2019-10-16 22:18:15 +02:00
modal_useravatar_text: "Ikony",
2018-10-11 10:21:26 +02:00
modal_removeicon_text: "Odstranit ikonu",
modal_tabheader1_text: "Uživatel",
modal_tabheader2_text: "Barva název",
modal_tabheader3_text: "Barva štítek",
modal_colorpicker1_text: "Barva název",
modal_colorpicker2_text: "Barva pozadí",
modal_colorpicker3_text: "Barva štítek",
modal_colorpicker4_text: "Barva fontu",
modal_ignoretagcolor_text: "Použijte barva role",
modal_validurl_text: "Platná URL",
2019-09-11 12:14:43 +02:00
modal_invalidurl_text: "Neplatná URL"
2018-10-11 10:21:26 +02:00
};
case "bg": //bulgarian
return {
context_localusersettings_text: "Настройки за локални потребител",
submenu_usersettings_text: "Промяна на настройките",
submenu_resetsettings_text: "Възстановяване на потребител",
modal_header_text: "Настройки за локални потребител",
modal_username_text: "Локално име на потребител",
modal_usertag_text: "Cвободен край",
2019-10-16 22:18:15 +02:00
modal_useravatar_text: "Икона",
2018-10-11 10:21:26 +02:00
modal_removeicon_text: "Премахване на иконата",
modal_tabheader1_text: "Потребител",
modal_tabheader2_text: "Цвят на име",
modal_tabheader3_text: "Цвят на свободен край",
modal_colorpicker1_text: "Цвят на име",
modal_colorpicker2_text: "Цвят на заден план",
modal_colorpicker3_text: "Цвят на свободен край",
modal_colorpicker4_text: "Цвят на шрифта",
modal_ignoretagcolor_text: "Използвайте цвят на ролите",
modal_validurl_text: "Валиден URL",
2019-09-11 12:14:43 +02:00
modal_invalidurl_text: "Невалиден URL"
2018-10-11 10:21:26 +02:00
};
case "ru": //russian
return {
context_localusersettings_text: "Настройки локального пользователь",
submenu_usersettings_text: "Изменить настройки",
submenu_resetsettings_text: "Сбросить пользователь",
modal_header_text: "Настройки локального пользователь",
modal_username_text: "Имя локального пользователь",
modal_usertag_text: "Tег",
2019-10-16 22:18:15 +02:00
modal_useravatar_text: "Значок",
2018-10-11 10:21:26 +02:00
modal_removeicon_text: "Удалить значок",
modal_tabheader1_text: "Пользователь",
modal_tabheader2_text: "Цвет имя",
modal_tabheader3_text: "Цвет тег",
modal_colorpicker1_text: "Цвет имя",
modal_colorpicker2_text: "Цвет задний план",
modal_colorpicker3_text: "Цвет тег",
modal_colorpicker4_text: "Цвет шрифта",
modal_ignoretagcolor_text: "Использовать цвет ролей",
modal_validurl_text: "Действительный URL",
2019-09-11 12:14:43 +02:00
modal_invalidurl_text: "Неверная URL"
2018-10-11 10:21:26 +02:00
};
case "uk": //ukrainian
return {
context_localusersettings_text: "Налаштування локального користувач",
submenu_usersettings_text: "Змінити налаштування",
submenu_resetsettings_text: "Скидання користувач",
modal_header_text: "Налаштування локального користувач",
modal_username_text: "Локальне ім'я користувач",
modal_usertag_text: "Tег",
2019-10-16 22:18:15 +02:00
modal_useravatar_text: "Іконка",
2018-10-11 10:21:26 +02:00
modal_removeicon_text: "Видалити піктограму",
modal_tabheader1_text: "Користувач",
modal_tabheader2_text: "Колір ім'я",
modal_tabheader3_text: "Колір тег",
modal_colorpicker1_text: "Колір ім'я",
modal_colorpicker2_text: "Колір фон",
modal_colorpicker3_text: "Колір тег",
modal_colorpicker4_text: "Колір шрифту",
modal_ignoretagcolor_text: "Використовуйте рольовий колір",
modal_validurl_text: "Дійсна URL",
2019-09-11 12:14:43 +02:00
modal_invalidurl_text: "Недійсна URL"
2018-10-11 10:21:26 +02:00
};
case "ja": //japanese
return {
context_localusersettings_text: "ローカルユーザーー設定",
submenu_usersettings_text: "設定を変更する",
submenu_resetsettings_text: "ユーザーーをリセットする",
modal_header_text: "ローカルユーザーー設定",
modal_username_text: "ローカルユーザーー名",
modal_usertag_text: "タグ",
2019-10-16 22:18:15 +02:00
modal_useravatar_text: "アイコン",
2018-10-11 10:21:26 +02:00
modal_removeicon_text: "アイコンを削除",
modal_tabheader1_text: "ユーザー",
modal_tabheader2_text: "名の色",
modal_tabheader3_text: "タグの色",
modal_colorpicker1_text: "名の色",
modal_colorpicker2_text: "バックグラウンドの色",
modal_colorpicker3_text: "タグの色",
modal_colorpicker4_text: "フォントの色",
modal_ignoretagcolor_text: "ロールカラーを使用する",
modal_validurl_text: "有効な URL",
2019-09-11 12:14:43 +02:00
modal_invalidurl_text: "無効な URL"
2018-10-11 10:21:26 +02:00
};
case "zh-TW": //chinese (traditional)
return {
context_localusersettings_text: "本地用戶設置",
submenu_usersettings_text: "更改設置",
submenu_resetsettings_text: "重置用戶",
modal_header_text: "本地用戶設置",
modal_username_text: "用戶名稱",
modal_usertag_text: "標籤",
2019-10-16 22:18:15 +02:00
modal_useravatar_text: "圖標",
2018-10-11 10:21:26 +02:00
modal_removeicon_text: "刪除圖標",
modal_tabheader1_text: "用戶",
modal_tabheader2_text: "名稱顏色",
modal_tabheader3_text: "標籤顏色",
modal_colorpicker1_text: "名稱顏色",
modal_colorpicker2_text: "背景顏色",
modal_colorpicker3_text: "標籤顏色",
modal_colorpicker4_text: "字體顏色",
modal_ignoretagcolor_text: "使用角色",
modal_validurl_text: "有效的 URL",
2019-09-11 12:14:43 +02:00
modal_invalidurl_text: "無效的 URL"
2018-10-11 10:21:26 +02:00
};
case "ko": //korean
return {
context_localusersettings_text: "로컬 사용자 설정",
submenu_usersettings_text: "설정 변경",
submenu_resetsettings_text: "사용자 재설정",
modal_header_text: "로컬 사용자 설정",
modal_username_text: "로컬 사용자 이름",
modal_usertag_text: "꼬리표",
2019-10-16 22:18:15 +02:00
modal_useravatar_text: "상",
2018-10-11 10:21:26 +02:00
modal_removeicon_text: "상 삭제",
modal_tabheader1_text: "사용자",
modal_tabheader2_text: "이름 색깔",
modal_tabheader3_text: "꼬리표 색깔",
modal_colorpicker1_text: "이름 색깔",
modal_colorpicker2_text: "배경 색깔",
modal_colorpicker3_text: "꼬리표 색깔",
modal_colorpicker4_text: "글꼴 색깔",
modal_ignoretagcolor_text: "역할 색상 사용",
modal_validurl_text: "유효한 URL",
2019-09-11 12:14:43 +02:00
modal_invalidurl_text: "잘못된 URL"
2018-10-11 10:21:26 +02:00
};
default: //default: english
return {
context_localusersettings_text: "Local Usersettings",
submenu_usersettings_text: "Change Settings",
submenu_resetsettings_text: "Reset User",
modal_header_text: "Local Usersettings",
modal_username_text: "Local Username",
modal_usertag_text: "Tag",
2019-10-16 22:18:15 +02:00
modal_useravatar_text: "Icon",
2018-10-11 10:21:26 +02:00
modal_removeicon_text: "Remove Icon",
modal_tabheader1_text: "User",
modal_tabheader2_text: "Namecolor",
modal_tabheader3_text: "Tagcolor",
modal_colorpicker1_text: "Namecolor",
modal_colorpicker2_text: "Backgroundcolor",
modal_colorpicker3_text: "Tagcolor",
modal_colorpicker4_text: "Fontcolor",
modal_ignoretagcolor_text: "Use Rolecolor",
modal_validurl_text: "Valid URL",
2019-09-11 12:14:43 +02:00
modal_invalidurl_text: "Invalid URL"
2018-10-11 10:21:26 +02:00
};
}
}
2019-01-04 16:53:42 +01:00
}