BetterDiscordAddons/Plugins/EditServers/EditServers.plugin.js

1314 lines
62 KiB
JavaScript
Raw Normal View History

2020-10-20 23:25:34 +02:00
/**
* @name EditServers
2021-03-05 13:26:41 +01:00
* @author DevilBro
2020-10-20 23:25:34 +02:00
* @authorId 278543574059057154
2021-06-12 17:16:39 +02:00
* @version 2.3.3
2021-03-05 13:26:41 +01:00
* @description Allows you to locally edit Servers
2020-10-20 23:25:34 +02:00
* @invite Jx3TjNS
* @donate https://www.paypal.me/MircoWittrien
* @patreon https://www.patreon.com/MircoWittrien
2021-03-09 15:10:55 +01:00
* @website https://mwittrien.github.io/
* @source https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/EditServers/
2021-03-10 09:17:37 +01:00
* @updateUrl https://mwittrien.github.io/BetterDiscordAddons/Plugins/EditServers/EditServers.plugin.js
2020-10-20 23:25:34 +02:00
*/
2018-10-11 10:21:26 +02:00
2020-09-19 20:49:33 +02:00
module.exports = (_ => {
2020-10-09 21:09:35 +02:00
const config = {
2020-09-19 20:49:33 +02:00
"info": {
"name": "EditServers",
"author": "DevilBro",
2021-06-12 17:16:39 +02:00
"version": "2.3.3",
2021-03-04 12:15:46 +01:00
"description": "Allows you to locally edit Servers"
2021-06-12 17:16:39 +02:00
},
"changeLog": {
"fixed": {
"Invite Icon": "Fixed Icon being squashed for non squarish icons"
}
2020-02-04 08:20:40 +01:00
}
2020-09-19 20:49:33 +02:00
};
2020-10-29 17:51:46 +01:00
2021-06-15 13:42:02 +02:00
return (window.Lightcord || window.LightCord) ? class {
getName () {return config.info.name;}
getAuthor () {return config.info.author;}
getVersion () {return config.info.version;}
getDescription () {return "Do not use LightCord!";}
load () {BdApi.alert("Attention!", "By using LightCord you are risking your Discord Account, due to using a 3rd Party Client. Switch to an official Discord Client (https://discord.com/) with the proper BD Injection (https://betterdiscord.app/)");}
start() {}
stop() {}
} : !window.BDFDB_Global || (!window.BDFDB_Global.loaded && !window.BDFDB_Global.started) ? class {
2021-01-06 12:38:36 +01:00
getName () {return config.info.name;}
getAuthor () {return config.info.author;}
getVersion () {return config.info.version;}
2021-02-01 17:13:13 +01:00
getDescription () {return `The Library Plugin needed for ${config.info.name} is missing. Open the Plugin Settings to download it. \n\n${config.info.description}`;}
downloadLibrary () {
require("request").get("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js", (e, r, b) => {
2021-03-05 13:14:18 +01:00
if (!e && b && r.statusCode == 200) require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => BdApi.showToast("Finished downloading BDFDB Library", {type: "success"}));
2021-03-06 14:59:48 +01:00
else BdApi.alert("Error", "Could not download BDFDB Library Plugin. Try again later or download it manually from GitHub: https://mwittrien.github.io/downloader/?library");
2021-02-01 17:13:13 +01:00
});
}
2020-09-19 20:49:33 +02:00
2021-01-06 12:38:36 +01:00
load () {
2020-11-19 16:51:14 +01:00
if (!window.BDFDB_Global || !Array.isArray(window.BDFDB_Global.pluginQueue)) window.BDFDB_Global = Object.assign({}, window.BDFDB_Global, {pluginQueue: []});
2020-09-19 20:49:33 +02:00
if (!window.BDFDB_Global.downloadModal) {
window.BDFDB_Global.downloadModal = true;
2021-01-14 16:14:44 +01:00
BdApi.showConfirmationModal("Library Missing", `The Library Plugin needed for ${config.info.name} is missing. Please click "Download Now" to install it.`, {
2020-09-19 20:49:33 +02:00
confirmText: "Download Now",
cancelText: "Cancel",
onCancel: _ => {delete window.BDFDB_Global.downloadModal;},
2020-09-20 08:15:13 +02:00
onConfirm: _ => {
delete window.BDFDB_Global.downloadModal;
2021-02-01 17:13:13 +01:00
this.downloadLibrary();
2020-09-20 08:15:13 +02:00
}
2020-09-19 20:49:33 +02:00
});
}
if (!window.BDFDB_Global.pluginQueue.includes(config.info.name)) window.BDFDB_Global.pluginQueue.push(config.info.name);
2020-10-09 21:09:35 +02:00
}
2021-01-06 12:38:36 +01:00
start () {this.load();}
stop () {}
getSettingsPanel () {
2020-11-28 23:12:09 +01:00
let template = document.createElement("template");
2021-01-14 16:14:44 +01:00
template.innerHTML = `<div style="color: var(--header-primary); font-size: 16px; font-weight: 300; white-space: pre; line-height: 22px;">The Library Plugin needed for ${config.info.name} is missing.\nPlease click <a style="font-weight: 500;">Download Now</a> to install it.</div>`;
2021-02-01 17:13:13 +01:00
template.content.firstElementChild.querySelector("a").addEventListener("click", this.downloadLibrary);
2020-11-28 23:12:09 +01:00
return template.content.firstElementChild;
}
2020-10-09 21:09:35 +02:00
} : (([Plugin, BDFDB]) => {
2021-05-07 14:23:52 +02:00
var changedGuilds = {};
2020-09-19 20:49:33 +02:00
2020-10-09 21:09:35 +02:00
return class EditServers extends Plugin {
2021-01-06 12:38:36 +01:00
onLoad () {
2020-09-19 20:49:33 +02:00
this.defaults = {
2021-05-07 14:23:52 +02:00
general: {
addOriginalTooltip: {value: true, description: "Hovering over a changed Server Header shows the original Name as Tooltip"},
},
places: {
guildList: {value: true, description: "Server List"},
guildHeader: {value: true, description: "Server Header"},
guildInvites: {value: true, description: "Server Invites"},
chat: {value: true, description: "Chat (Welcome Message, etc.)"},
mutualGuilds: {value: true, description: "Mutual Servers"},
recentMentions: {value: true, description: "Recent Mentions Popout"},
quickSwitcher: {value: true, description: "Quick Switcher"}
2020-09-19 20:49:33 +02:00
}
};
2020-02-04 08:20:40 +01:00
2020-09-19 20:49:33 +02:00
this.patchedModules = {
before: {
Guild: "render",
GuildIconWrapper: "render",
2021-06-09 21:43:27 +02:00
MutualGuilds: "default",
2020-09-19 20:49:33 +02:00
QuickSwitcher: "render",
QuickSwitchChannelResult: "render",
GuildSidebar: "render",
GuildHeader: "render",
InviteGuildName: "GuildName"
},
after: {
RecentsChannelHeader: "default",
Guild: "render",
BlobMask: "render",
GuildIconWrapper: "render",
GuildIcon: "render",
2021-05-07 14:23:52 +02:00
NavItem: "default",
2020-10-29 17:51:46 +01:00
GuildHeader: "render",
WelcomeArea: "default"
2020-09-19 20:49:33 +02:00
}
};
this.patchPriority = 7;
2021-06-12 17:16:39 +02:00
this.css = `
${BDFDB.dotCN.inviteguildicon} {
background-size: cover;
2021-06-30 15:11:47 +02:00
object-fit: cover;
2021-06-12 17:16:39 +02:00
}
`;
2020-02-04 08:20:40 +01:00
}
2020-09-19 20:49:33 +02:00
2021-06-12 17:16:39 +02:00
onStart () {
2020-11-19 16:51:14 +01:00
BDFDB.PatchUtils.patch(this, BDFDB.LibraryModules.IconUtils, "getGuildBannerURL", {instead: e => {
2020-02-04 08:20:40 +01:00
let guild = BDFDB.LibraryModules.GuildStore.getGuild(e.methodArguments[0].id);
if (guild) {
if (e.methodArguments[0].id == "410787888507256842") return guild.banner;
2020-06-08 20:55:34 +02:00
let data = changedGuilds[guild.id];
2020-02-04 08:20:40 +01:00
if (data && data.banner && !data.removeBanner) return data.banner;
}
return e.callOriginalMethod();
}});
2019-12-01 18:25:43 +01:00
2020-09-11 19:31:36 +02:00
BDFDB.PatchUtils.patch(this, BDFDB.LibraryComponents.GuildComponents.Guild.prototype, "render", {
2020-11-19 16:51:14 +01:00
before: e => {this.processGuild({instance: e.thisObject, returnvalue: e.returnValue, methodname: "render"});},
after: e => {this.processGuild({instance: e.thisObject, returnvalue: e.returnValue, methodname: "render"});}
2020-02-04 08:20:40 +01:00
});
2020-06-08 20:55:34 +02:00
this.forceUpdateAll();
2020-02-04 08:20:40 +01:00
}
2020-09-19 20:49:33 +02:00
2021-01-06 12:38:36 +01:00
onStop () {
2020-06-08 20:55:34 +02:00
this.forceUpdateAll();
2020-09-19 20:49:33 +02:00
}
2019-10-22 11:37:23 +02:00
2020-09-19 20:49:33 +02:00
getSettingsPanel (collapseStates = {}) {
2021-05-07 14:23:52 +02:00
let settingsPanel;
return settingsPanel = BDFDB.PluginUtils.createSettingsPanel(this, {
collapseStates: collapseStates,
children: _ => {
let settingsItems = [];
settingsItems.push(Object.keys(this.defaults.general).map(key => BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
type: "Switch",
plugin: this,
keys: ["general", key],
label: this.defaults.general[key].description,
value: this.settings.general[key]
})));
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsPanelList, {
title: "Change Servers in:",
children: Object.keys(this.defaults.places).map(key => BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
type: "Switch",
plugin: this,
keys: ["places", key],
label: this.defaults.places[key].description,
value: this.settings.places[key]
}))
}));
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsItem, {
type: "Button",
color: BDFDB.LibraryComponents.Button.Colors.RED,
label: "Reset all Servers",
onClick: _ => BDFDB.ModalUtils.confirm(this, this.labels.confirm_resetall, _ => {
BDFDB.DataUtils.remove(this, "servers");
this.forceUpdateAll();;
}),
children: BDFDB.LanguageUtils.LanguageStrings.RESET
2021-05-10 09:10:56 +02:00
}));
2021-05-10 03:35:43 +02:00
return settingsItems;
2021-05-07 14:23:52 +02:00
}
});
2019-03-14 14:06:14 +01:00
}
2018-10-11 10:21:26 +02:00
2021-01-06 12:38:36 +01:00
onSettingsClosed () {
2020-09-19 20:49:33 +02:00
if (this.SettingsUpdated) {
delete this.SettingsUpdated;
this.forceUpdateAll();
}
}
2020-02-04 08:20:40 +01:00
2021-01-06 12:38:36 +01:00
forceUpdateAll () {
2020-09-19 20:49:33 +02:00
changedGuilds = BDFDB.DataUtils.load(this, "servers");
BDFDB.PatchUtils.forceAllUpdates(this);
}
onGuildContextMenu (e) {
if (e.instance.props.guild) {
let [children, index] = BDFDB.ContextMenuUtils.findItem(e.returnvalue, {id: "devmode-copy-id", group: true});
children.splice(index > -1 ? index : children.length, 0, BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuGroup, {
children: BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
label: this.labels.context_localserversettings,
2020-09-19 20:49:33 +02:00
id: BDFDB.ContextMenuUtils.createItemId(this.name, "settings-submenu"),
children: BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuGroup, {
children: [
BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
label: this.labels.submenu_serversettings,
2020-09-19 20:49:33 +02:00
id: BDFDB.ContextMenuUtils.createItemId(this.name, "settings-change"),
2021-05-07 14:23:52 +02:00
action: _ => this.openGuildSettingsModal(e.instance.props.guild.id)
2020-09-19 20:49:33 +02:00
}),
BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
label: this.labels.submenu_resetsettings,
2020-09-19 20:49:33 +02:00
id: BDFDB.ContextMenuUtils.createItemId(this.name, "settings-reset"),
2020-12-22 20:38:51 +01:00
color: BDFDB.LibraryComponents.MenuItems.Colors.DANGER,
2020-09-19 20:49:33 +02:00
disabled: !changedGuilds[e.instance.props.guild.id],
2020-12-22 20:38:51 +01:00
action: event => {
let remove = _ => {
BDFDB.DataUtils.remove(this, "servers", e.instance.props.guild.id);
this.forceUpdateAll(true);
};
if (event.shiftKey) remove();
else BDFDB.ModalUtils.confirm(this, this.labels.confirm_reset, remove);
2020-09-19 20:49:33 +02:00
}
})
]
})
2020-02-04 08:20:40 +01:00
})
2020-09-19 20:49:33 +02:00
}));
}
2020-02-04 08:20:40 +01:00
}
2019-09-04 12:34:02 +02:00
2020-09-19 20:49:33 +02:00
processGuild (e) {
2021-05-07 14:23:52 +02:00
if (BDFDB.GuildUtils.is(e.instance.props.guild) && e.instance.props.guild.joinedAt && this.settings.places.guildList) {
2020-09-19 20:49:33 +02:00
e.instance.props.guild = this.getGuildData(e.instance.props.guild.id);
if (e.returnvalue) {
let data = changedGuilds[e.instance.props.guild.id];
if (data && (data.color3 || data.color4)) {
let [children, index] = BDFDB.ReactUtils.findParent(e.returnvalue, {name: ["GuildTooltip", "BDFDB_TooltipContainer"]});
if (index > -1) children[index] = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TooltipContainer, {
tooltipConfig: {
type: "right",
guild: e.instance.props.guild,
list: true,
offset: 12,
backgroundColor: data.color3,
fontColor: data.color4
},
children: children[index].props.children
});
}
2020-02-04 08:20:40 +01:00
}
2019-12-01 18:25:43 +01:00
}
}
2019-09-04 12:34:02 +02:00
2020-09-19 20:49:33 +02:00
processBlobMask (e) {
2021-05-07 14:23:52 +02:00
if (this.settings.places.guildList) {
2020-09-19 20:49:33 +02:00
let [children, index] = BDFDB.ReactUtils.findParent(e.returnvalue, {name: "NavItem"});
if (index > -1 && children[index].props.to && children[index].props.to.pathname) {
let guild = BDFDB.LibraryModules.GuildStore.getGuild((children[index].props.to.pathname.split("/channels/")[1] || "").split("/")[0]);
if (guild) {
let data = changedGuilds[guild.id];
if (data) {
if (data.shortName) children[index].props.name = data.shortName.split("").join(" ");
else if (data.name && data.ignoreCustomName) children[index].props.name = guild.name;
}
2020-02-04 08:20:40 +01:00
}
2019-12-02 14:16:56 +01:00
}
}
2019-12-01 18:25:43 +01:00
}
2020-09-19 20:49:33 +02:00
processGuildIconWrapper (e) {
2020-09-23 09:01:08 +02:00
if (BDFDB.GuildUtils.is(e.instance.props.guild) && e.instance.props.guild.joinedAt) {
2021-05-07 14:23:52 +02:00
if (e.instance.props.className && e.instance.props.className.indexOf(BDFDB.disCN.guildfolderguildicon) > -1) e.instance.props.guild = this.getGuildData(e.instance.props.guild.id, this.settings.places.guildList);
else if (e.instance.props.className && e.instance.props.className.indexOf(BDFDB.disCN.listavatar) > -1) e.instance.props.guild = this.getGuildData(e.instance.props.guild.id, this.settings.places.mutualGuilds);
2020-09-19 20:49:33 +02:00
else e.instance.props.guild = this.getGuildData(e.instance.props.guild.id);
}
2020-02-04 08:20:40 +01:00
}
2020-09-19 20:49:33 +02:00
processGuildIcon (e) {
2020-09-23 09:01:08 +02:00
if (BDFDB.GuildUtils.is(e.instance.props.guild) && e.instance.props.guild.joinedAt && e.instance.props.style && (!e.instance.props.style.backgroundImage || e.instance.props.style.backgroundImage == "none")) {
2020-09-19 20:49:33 +02:00
let data = changedGuilds[e.instance.props.guild.id];
if (data) {
2021-05-07 14:23:52 +02:00
if (e.instance.props.className && e.instance.props.className.indexOf(BDFDB.disCN.guildfolderguildicon) > -1) this.changeGuildIcon(e, data, this.settings.places.guildList);
else if (e.instance.props.className && e.instance.props.className.indexOf(BDFDB.disCN.listavatar) > -1 || BDFDB.ReactUtils.findConstructor(e.instance, "MutualGuild", {up: true})) this.changeGuildIcon(e, data, this.settings.places.mutualGuilds);
2020-09-19 20:49:33 +02:00
else this.changeGuildIcon(e, data);
}
2020-02-04 08:20:40 +01:00
}
2019-12-01 18:25:43 +01:00
}
2021-05-07 14:23:52 +02:00
processNavItem (e) {
if (this.settings.places.guildList) {
let pathname = BDFDB.ObjectUtils.get(e.instance, "props.to.pathname");
let data = pathname && changedGuilds[(pathname.split("/channels/")[1] || "").split("/")[0]];
if (data) {
let guildAcronym = BDFDB.ReactUtils.findChild(e.returnvalue, {props: [["className", BDFDB.disCN.guildiconacronym]]});
if (guildAcronym) {
let fontGradient = BDFDB.ObjectUtils.is(data.color2);
guildAcronym.props.style = Object.assign({}, guildAcronym.props.style, {
background: BDFDB.ObjectUtils.is(data.color1) ? BDFDB.ColorUtils.createGradient(data.color1) : BDFDB.ColorUtils.convert(data.color1, "RGBA"),
color: !fontGradient && BDFDB.ColorUtils.convert(data.color2, "RGBA")
});
if (fontGradient) guildAcronym.props.children = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TextGradientElement, {
gradient: BDFDB.ColorUtils.createGradient(data.color2),
children: guildAcronym.props.children
});
}
}
}
}
2019-12-01 18:25:43 +01:00
2020-09-19 20:49:33 +02:00
processMutualGuilds (e) {
2021-06-09 21:43:27 +02:00
if (this.settings.places.mutualGuilds) {
let [children, index] = BDFDB.ReactUtils.findParent(e.returnvalue, {name: "GuildRow"});
if (index > -1) for (let row of children) if (row && row.props && row.props.guild) row.props.guild = this.getGuildData(row.props.guild.id);
}
2020-09-19 20:49:33 +02:00
}
2020-02-04 08:20:40 +01:00
2020-09-19 20:49:33 +02:00
processQuickSwitcher (e) {
2021-05-07 14:23:52 +02:00
if (this.settings.places.quickSwitcher) for (let i in e.instance.props.results) if (e.instance.props.results[i].type == "GUILD") e.instance.props.results[i].record = this.getGuildData(e.instance.props.results[i].record.id);
2019-12-30 11:34:44 +01:00
}
2020-09-19 20:49:33 +02:00
processQuickSwitchChannelResult (e) {
2021-05-07 14:23:52 +02:00
if (e.instance.props.channel && e.instance.props.channel.guild_id && this.settings.places.quickSwitcher) {
2020-09-19 20:49:33 +02:00
e.instance.props.children.props.children = this.getGuildData(e.instance.props.channel.guild_id).name;
2020-02-04 08:20:40 +01:00
}
2020-01-02 11:39:22 +01:00
}
2020-09-19 20:49:33 +02:00
processRecentsChannelHeader (e) {
2021-05-07 14:23:52 +02:00
if (this.settings.places.recentMentions && BDFDB.ArrayUtils.is(e.returnvalue.props.children)) {
2020-09-19 20:49:33 +02:00
for (let child of e.returnvalue.props.children) if (child && child.props && child.props.channel && child.type.displayName == "ChannelName") {
let oldType = child.type;
child.type = (...args) => {
let instance = oldType(...args);
2020-11-19 16:51:14 +01:00
let guildName = BDFDB.ReactUtils.findChild(instance, {props: [["className", BDFDB.disCN.recentmentionsguildname]]});
2020-09-19 20:49:33 +02:00
if (guildName) guildName.props.children = (this.getGuildData(e.instance.props.channel.guild_id) || {}).name || guildName.props.children;
return instance;
};
child.type.displayName = oldType.displayName;
}
2019-12-01 18:25:43 +01:00
}
2019-04-26 14:57:08 +02:00
}
2020-09-19 20:49:33 +02:00
processGuildSidebar (e) {
if (e.instance.props.guild) {
let data = changedGuilds[e.instance.props.guild.id];
if (data) {
if (data.removeBanner) e.instance.props.guild = new BDFDB.DiscordObjects.Guild(Object.assign({}, e.instance.props.guild, {banner: null}));
else if (data.banner) e.instance.props.guild = new BDFDB.DiscordObjects.Guild(Object.assign({}, e.instance.props.guild, {banner: data.banner}));
}
2020-02-04 08:20:40 +01:00
}
2019-04-26 14:57:08 +02:00
}
2020-09-19 20:49:33 +02:00
processGuildHeader (e) {
2021-05-07 14:23:52 +02:00
if (e.instance.props.guild && this.settings.places.guildHeader) {
2020-09-19 20:49:33 +02:00
e.instance.props.guild = this.getGuildData(e.instance.props.guild.id);
let oldName = (BDFDB.LibraryModules.GuildStore.getGuild(e.instance.props.guild.id) || {}).name;
2021-05-07 14:23:52 +02:00
if (e.returnvalue && this.settings.general.addOriginalTooltip && oldName != e.instance.props.guild.name) {
2020-09-19 20:49:33 +02:00
e.returnvalue.props.children[0] = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TooltipContainer, {
text: oldName,
children: e.returnvalue.props.children[0],
tooltipConfig: {type: "right"}
});
}
2020-02-04 08:20:40 +01:00
}
2020-09-19 20:49:33 +02:00
}
processInviteGuildName (e) {
2021-05-07 14:23:52 +02:00
if (e.instance.props.guild && e.instance.props.guild.joinedAt && this.settings.places.guildInvites) {
2020-09-19 20:49:33 +02:00
e.instance.props.guild = this.getGuildData(e.instance.props.guild.id);
2020-02-04 08:20:40 +01:00
}
2020-01-02 11:39:22 +01:00
}
2020-09-19 20:49:33 +02:00
2020-10-29 17:51:46 +01:00
processWelcomeArea (e) {
2021-05-07 14:23:52 +02:00
if (e.instance.props.channel && this.settings.places.chat) {
2020-10-29 17:51:46 +01:00
let name = (BDFDB.LibraryModules.GuildStore.getGuild(e.instance.props.channel.guild_id) || {}).name;
2020-11-19 16:51:14 +01:00
let guildName = name && BDFDB.ReactUtils.findChild(e.returnvalue, {props: [["className", "titleName-3-Lp3Z"]]});
2020-10-29 17:51:46 +01:00
if (guildName && guildName.props && BDFDB.ArrayUtils.is(guildName.props.children)) {
for (let child of guildName.props.children) if (child && child.props && BDFDB.ArrayUtils.is(child.props.children) && child.props.children[0] == name) {
child.props.children = [(this.getGuildData(e.instance.props.channel.guild_id) || {}).name || name];
break;
}
}
}
}
2020-09-19 20:49:33 +02:00
getGuildData (guildId, change = true) {
let guild = BDFDB.LibraryModules.GuildStore.getGuild(guildId);
if (!guild) return new BDFDB.DiscordObjects.Guild({});
let data = change && changedGuilds[guild.id];
if (data) {
let newGuildObject = {}, nativeObject = new BDFDB.DiscordObjects.Guild(guild);
for (let key in nativeObject) newGuildObject[key] = nativeObject[key];
newGuildObject.name = data.name || nativeObject.name;
newGuildObject.acronym = data.shortName && data.shortName.replace(/\s/g, "") || BDFDB.LibraryModules.StringUtils.getAcronym(!data.ignoreCustomName && data.name || nativeObject.name);
if (data.removeIcon) {
newGuildObject.icon = null;
newGuildObject.getIconURL = _ => {return null;};
}
else if (data.url) {
newGuildObject.icon = data.url;
newGuildObject.getIconURL = _ => {return data.url;};
}
if (data.removeBanner) newGuildObject.banner = null;
else if (data.banner) newGuildObject.banner = data.banner;
return newGuildObject;
}
return new BDFDB.DiscordObjects.Guild(guild);
2020-02-04 08:20:40 +01:00
}
2020-06-08 20:55:34 +02:00
2020-09-19 20:49:33 +02:00
changeGuildIcon (e, data, change = true) {
if (change) {
let fontGradient = BDFDB.ObjectUtils.is(data.color2);
e.returnvalue.props.style = Object.assign({}, e.returnvalue.props.style, {
background: BDFDB.ObjectUtils.is(data.color1) ? BDFDB.ColorUtils.createGradient(data.color1) : BDFDB.ColorUtils.convert(data.color1, "RGBA"),
color: !fontGradient && BDFDB.ColorUtils.convert(data.color2, "RGBA")
});
if (fontGradient) e.returnvalue.props.children[0] = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TextGradientElement, {
gradient: BDFDB.ColorUtils.createGradient(data.color2),
children: e.returnvalue.props.children[0]
});
}
}
2019-09-04 12:34:02 +02:00
2020-09-19 20:49:33 +02:00
openGuildSettingsModal (guildId) {
let guild = BDFDB.LibraryModules.GuildStore.getGuild(guildId);
if (!guild) return;
let data = changedGuilds[guild.id] || {};
2021-01-29 19:48:09 +01:00
let newData = Object.assign({}, data);
2020-09-19 20:49:33 +02:00
2021-01-29 19:48:09 +01:00
let nameInput, acronymInput, iconInput, bannerInput;
2020-09-19 20:49:33 +02:00
BDFDB.ModalUtils.open(this, {
size: "MEDIUM",
header: this.labels.modal_header,
2021-01-23 18:50:24 +01:00
subHeader: guild.name,
2020-09-19 20:49:33 +02:00
children: [
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ModalComponents.ModalTabContent, {
tab: this.labels.modal_tabheader1,
2020-09-19 20:49:33 +02:00
children: [
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormItem, {
title: this.labels.modal_guildname,
2020-09-19 20:49:33 +02:00
className: BDFDB.disCN.marginbottom20,
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TextInput, {
value: data.name,
placeholder: guild.name,
autoFocus: true,
2021-01-29 19:48:09 +01:00
ref: instance => {if (instance) nameInput = instance;},
onChange: value => {
newData.name = value;
if (!newData.ignoreCustomName) {
acronymInput.props.placeholder = value && BDFDB.LibraryModules.StringUtils.getAcronym(value) || guild.acronym;
BDFDB.ReactUtils.forceUpdate(acronymInput);
2020-09-19 20:49:33 +02:00
}
2020-02-17 13:16:17 +01:00
}
})
2020-09-19 20:49:33 +02:00
}),
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormItem, {
title: this.labels.modal_guildacronym,
2020-09-19 20:49:33 +02:00
className: BDFDB.disCN.marginbottom8,
children:
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TextInput, {
value: data.shortName,
2021-01-29 19:48:09 +01:00
ref: instance => {if (instance) acronymInput = instance;},
placeholder: !data.ignoreCustomName && data.name && BDFDB.LibraryModules.StringUtils.getAcronym(data.name) || guild.acronym,
onChange: value => {newData.shortName = value;}
2020-02-04 08:20:40 +01:00
})
2020-09-19 20:49:33 +02:00
}),
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsItem, {
type: "Switch",
2021-01-29 19:48:09 +01:00
className: BDFDB.disCN.marginbottom20,
label: this.labels.modal_ignorecustomname,
2020-09-19 20:49:33 +02:00
tag: BDFDB.LibraryComponents.FormComponents.FormTitle.Tags.H5,
value: data.ignoreCustomName,
2021-01-29 19:48:09 +01:00
onChange: value => {
newData.ignoreCustomName = value;
acronymInput.props.placeholder = !value && newData.name && BDFDB.LibraryModules.StringUtils.getAcronym(newData.name) || guild.acronym;
BDFDB.ReactUtils.forceUpdate(acronymInput);
2020-09-19 20:49:33 +02:00
}
}),
BDFDB.ReactUtils.createElement("div", {
className: BDFDB.disCN.marginbottom20,
children: [
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Flex, {
className: BDFDB.disCN.marginbottom8,
align: BDFDB.LibraryComponents.Flex.Align.CENTER,
direction: BDFDB.LibraryComponents.Flex.Direction.HORIZONTAL,
children: [
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormTitle, {
className: BDFDB.disCN.marginreset,
tag: BDFDB.LibraryComponents.FormComponents.FormTitle.Tags.H5,
children: this.labels.modal_guildicon
2020-09-19 20:49:33 +02:00
}),
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsItem, {
type: "Switch",
2020-10-14 21:08:41 +02:00
margin: 0,
2020-09-19 20:49:33 +02:00
grow: 0,
label: BDFDB.LanguageUtils.LanguageStrings.REMOVE,
tag: BDFDB.LibraryComponents.FormComponents.FormTitle.Tags.H5,
value: data.removeIcon,
2021-01-29 19:48:09 +01:00
onChange: value => {
newData.removeIcon = value;
if (value) {
delete iconInput.props.success;
delete iconInput.props.errorMessage;
iconInput.props.disabled = true;
BDFDB.ReactUtils.forceUpdate(iconInput);
}
else {
iconInput.props.disabled = false;
this.checkUrl(iconInput.props.value, iconInput).then(returnValue => {
newData.url = returnValue;
});
2020-09-19 20:49:33 +02:00
}
}
})
]
}),
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TextInput, {
success: !data.removeIcon && data.url,
maxLength: 100000000000000000000,
value: data.url,
placeholder: BDFDB.GuildUtils.getIcon(guild.id),
disabled: data.removeIcon,
2021-01-29 19:48:09 +01:00
ref: instance => {if (instance) iconInput = instance;},
2020-09-19 20:49:33 +02:00
onChange: (value, instance) => {
2021-01-29 19:48:09 +01:00
this.checkUrl(value, instance).then(returnValue => {
newData.url = returnValue;
});
2020-09-19 20:49:33 +02:00
}
})
]
}),
BDFDB.ReactUtils.createElement("div", {
className: BDFDB.disCN.marginbottom20,
children: [
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Flex, {
className: BDFDB.disCN.marginbottom8,
align: BDFDB.LibraryComponents.Flex.Align.CENTER,
direction: BDFDB.LibraryComponents.Flex.Direction.HORIZONTAL,
children: [
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormTitle, {
className: BDFDB.disCN.marginreset,
tag: BDFDB.LibraryComponents.FormComponents.FormTitle.Tags.H5,
children: this.labels.modal_guildbanner
2020-09-19 20:49:33 +02:00
}),
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsItem, {
type: "Switch",
2020-10-14 21:08:41 +02:00
margin: 0,
2020-09-19 20:49:33 +02:00
grow: 0,
label: BDFDB.LanguageUtils.LanguageStrings.REMOVE,
tag: BDFDB.LibraryComponents.FormComponents.FormTitle.Tags.H5,
value: data.removeBanner && guild.id != "410787888507256842",
disabled: guild.id == "410787888507256842",
2021-01-29 19:48:09 +01:00
onChange: value => {
newData.removeBanner = value;
if (value) {
delete bannerInput.props.success;
delete bannerInput.props.errorMessage;
bannerInput.props.disabled = true;
BDFDB.ReactUtils.forceUpdate(bannerInput);
}
else {
bannerInput.props.disabled = false;
this.checkUrl(bannerInput.props.value, bannerInput).then(returnValue => {
newData.url = returnValue;
});
2020-09-19 20:49:33 +02:00
}
}
})
]
}),
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TextInput, {
success: !data.removeBanner && data.banner,
maxLength: 100000000000000000000,
value: data.banner,
placeholder: BDFDB.GuildUtils.getBanner(guild.id),
disabled: data.removeBanner || guild.id == "410787888507256842",
2021-01-29 19:48:09 +01:00
ref: instance => {if (instance) bannerInput = instance;},
2020-09-19 20:49:33 +02:00
onChange: (value, instance) => {
2021-01-29 19:48:09 +01:00
this.checkUrl(value, instance).then(returnValue => {
newData.banner = returnValue;
});
2020-09-19 20:49:33 +02:00
}
})
]
})
]
}),
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ModalComponents.ModalTabContent, {
tab: this.labels.modal_tabheader2,
2020-09-19 20:49:33 +02:00
children: [
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormItem, {
title: this.labels.modal_colorpicker1,
2020-09-19 20:49:33 +02:00
className: BDFDB.disCN.marginbottom20,
children: [
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ColorSwatches, {
color: data.color1,
2021-01-29 20:04:13 +01:00
onColorChange: value => {newData.color1 = value;}
2020-09-19 20:49:33 +02:00
})
]
}),
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormItem, {
title: this.labels.modal_colorpicker2,
2020-09-19 20:49:33 +02:00
className: BDFDB.disCN.marginbottom20,
children: [
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ColorSwatches, {
color: data.color2,
2021-01-29 20:04:13 +01:00
onColorChange: value => {newData.color2 = value;}
2020-09-19 20:49:33 +02:00
})
]
})
]
}),
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ModalComponents.ModalTabContent, {
tab: this.labels.modal_tabheader3,
2020-09-19 20:49:33 +02:00
children: [
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormItem, {
title: this.labels.modal_colorpicker3,
2020-09-19 20:49:33 +02:00
className: BDFDB.disCN.marginbottom20,
children: [
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ColorSwatches, {
color: data.color3,
2021-01-29 20:04:13 +01:00
onColorChange: value => {newData.color3 = value;}
2020-09-19 20:49:33 +02:00
})
]
}),
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormItem, {
title: this.labels.modal_colorpicker4,
2020-09-19 20:49:33 +02:00
className: BDFDB.disCN.marginbottom20,
children: [
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ColorSwatches, {
color: data.color4,
2021-01-29 20:04:13 +01:00
onColorChange: value => {newData.color4 = value;}
2020-09-19 20:49:33 +02:00
})
]
})
]
})
],
buttons: [{
contents: BDFDB.LanguageUtils.LanguageStrings.SAVE,
color: "BRAND",
close: true,
2021-01-29 19:48:09 +01:00
onClick: _ => {
newData.url = !newData.removeIcon ? newData.url : "";
newData.removeBanner = newData.removeBanner && guild.id != "410787888507256842";
newData.banner = !newData.removeBanner ? newData.banner : "";
2019-01-26 22:45:19 +01:00
2020-09-19 20:49:33 +02:00
let changed = false;
2021-01-29 19:48:09 +01:00
if (Object.keys(newData).every(key => newData[key] == null || newData[key] == false) && (changed = true)) {
BDFDB.DataUtils.remove(this, "servers", guild.id);
}
else if (!BDFDB.equals(newData, data) && (changed = true)) {
BDFDB.DataUtils.save(newData, this, "servers", guild.id);
}
if (changed) this.forceUpdateAll();
2020-09-19 20:49:33 +02:00
}
}]
});
2020-02-04 08:20:40 +01:00
}
2020-09-19 20:49:33 +02:00
checkUrl (url, instance) {
2021-01-29 19:48:09 +01:00
return new Promise(callback => {
BDFDB.TimeUtils.clear(instance.checkTimeout);
url = url && url.trim();
if (!url || instance.props.disabled) {
delete instance.props.success;
delete instance.props.errorMessage;
callback("");
BDFDB.ReactUtils.forceUpdate(instance);
}
else instance.checkTimeout = BDFDB.TimeUtils.timeout(_ => {
BDFDB.LibraryRequires.request(url, (error, response, result) => {
delete instance.checkTimeout;
if (instance.props.disabled) {
delete instance.props.success;
delete instance.props.errorMessage;
callback("");
}
else if (response && response.headers["content-type"] && response.headers["content-type"].indexOf("image") != -1) {
instance.props.success = true;
delete instance.props.errorMessage;
callback(url);
}
else {
delete instance.props.success;
instance.props.errorMessage = this.labels.modal_invalidurl;
callback("");
}
BDFDB.ReactUtils.forceUpdate(instance);
});
}, 1000);
});
2020-09-19 20:49:33 +02:00
}
2019-09-04 12:34:02 +02:00
2020-09-19 20:49:33 +02:00
setBanner (id, data) {
data = data || {};
let guild = BDFDB.LibraryModules.GuildStore.getGuild(id);
if (!guild) return;
if (guild.EditServersCachedBanner === undefined) guild.EditServersCachedBanner = guild.banner;
guild.banner = data.removeBanner ? null : (data.banner || guild.EditServersCachedBanner);
2020-02-04 08:20:40 +01:00
}
2020-07-26 17:02:25 +02:00
2021-01-06 12:38:36 +01:00
setLabelsByLanguage () {
2020-09-19 20:49:33 +02:00
switch (BDFDB.LanguageUtils.getLanguage().id) {
case "bg": // Bulgarian
2020-09-19 20:49:33 +02:00
return {
2020-12-22 20:38:51 +01:00
confirm_reset: "Наистина ли искате да нулирате този сървър?",
confirm_resetall: "Наистина ли искате да нулирате всички сървъри?",
context_localserversettings: "Настройки на локалния сървър",
modal_colorpicker1: "Цвят на иконата",
modal_colorpicker2: "Цвят на шрифта",
modal_colorpicker3: "Цвят на подсказка",
modal_colorpicker4: "Цвят на шрифта",
modal_guildacronym: "Локален сървър Акроним",
modal_guildbanner: "Банер",
modal_guildicon: "Икона",
modal_guildname: "Име на локален сървър",
modal_header: "Настройки на локалния сървър",
modal_ignorecustomname: "Използвайте оригиналното име на сървъра за съкращението на сървъра",
modal_invalidurl: "Невалиден адрес",
modal_tabheader1: "Сървър",
modal_tabheader2: "Цвят на иконата",
modal_tabheader3: "Цвят на подсказка",
submenu_resetsettings: "Нулиране на сървъра",
submenu_serversettings: "Промяна на настройките"
2020-09-19 20:49:33 +02:00
};
case "da": // Danish
2020-09-19 20:49:33 +02:00
return {
2020-12-22 20:38:51 +01:00
confirm_reset: "Er du sikker på, at du vil nulstille denne server?",
confirm_resetall: "Er du sikker på, at du vil nulstille alle servere?",
context_localserversettings: "Lokale serverindstillinger",
modal_colorpicker1: "Ikonfarve",
2020-12-22 20:38:51 +01:00
modal_colorpicker2: "Skrift farve",
modal_colorpicker3: "Værktøjstip farve",
modal_colorpicker4: "Skrift farve",
modal_guildacronym: "Lokal server akronym",
modal_guildbanner: "Banner",
modal_guildicon: "Ikon",
modal_guildname: "Lokalt servernavn",
modal_header: "Lokale serverindstillinger",
modal_ignorecustomname: "Brug det originale servernavn til serverakronymet",
modal_invalidurl: "Ugyldig URL",
modal_tabheader1: "Server",
modal_tabheader2: "Ikonfarve",
2020-12-22 20:38:51 +01:00
modal_tabheader3: "Værktøjstip farve",
submenu_resetsettings: "Nulstil server",
submenu_serversettings: "Ændre indstillinger"
2020-09-19 20:49:33 +02:00
};
case "de": // German
2020-09-19 20:49:33 +02:00
return {
2020-12-22 20:38:51 +01:00
confirm_reset: "Möchtest du diesen Server wirklich zurücksetzen?",
confirm_resetall: "Möchtest du wirklich alle Server zurücksetzen?",
context_localserversettings: "Lokale Servereinstellungen",
modal_colorpicker1: "Symbolfarbe",
modal_colorpicker2: "Schriftfarbe",
modal_colorpicker3: "Tooltipfarbe",
modal_colorpicker4: "Schriftfarbe",
modal_guildacronym: "Lokales Serverakronym",
modal_guildbanner: "Banner",
modal_guildicon: "Symbol",
modal_guildname: "Lokaler Servername",
modal_header: "Lokale Servereinstellungen",
2020-12-22 20:38:51 +01:00
modal_ignorecustomname: "Verwenden Sie den ursprünglichen Servernamen für das Serverakronym",
modal_invalidurl: "Ungültige URL",
modal_tabheader1: "Server",
modal_tabheader2: "Symbolfarbe",
modal_tabheader3: "Tooltipfarbe",
submenu_resetsettings: "Server zurücksetzen",
submenu_serversettings: "Einstellungen ändern"
2020-09-19 20:49:33 +02:00
};
case "el": // Greek
2020-09-19 20:49:33 +02:00
return {
2020-12-22 20:38:51 +01:00
confirm_reset: "Είστε βέβαιοι ότι θέλετε να επαναφέρετε αυτόν τον διακομιστή;",
confirm_resetall: "Είστε βέβαιοι ότι θέλετε να επαναφέρετε όλους τους διακομιστές;",
context_localserversettings: "Ρυθμίσεις τοπικού διακομιστή",
modal_colorpicker1: "Χρώμα εικονιδίου",
modal_colorpicker2: "Χρώμα γραμματοσειράς",
modal_colorpicker3: "Χρώμα επεξήγησης εργαλείου",
modal_colorpicker4: "Χρώμα γραμματοσειράς",
modal_guildacronym: "Τοπικό αρκτικόλεξο διακομιστή",
modal_guildbanner: "Πανό",
modal_guildicon: "Εικόνισμα",
modal_guildname: "Τοπικό όνομα διακομιστή",
modal_header: "Ρυθμίσεις τοπικού διακομιστή",
modal_ignorecustomname: "Χρησιμοποιήστε το αρχικό όνομα διακομιστή για το αρκτικόλεξο διακομιστή",
modal_invalidurl: "Μη έγκυρη διεύθυνση URL",
modal_tabheader1: "Υπηρέτης",
modal_tabheader2: "Χρώμα εικονιδίου",
modal_tabheader3: "Χρώμα επεξήγησης εργαλείου",
submenu_resetsettings: "Επαναφορά διακομιστή",
submenu_serversettings: "Αλλαξε ρυθμίσεις"
2020-09-19 20:49:33 +02:00
};
case "es": // Spanish
2020-09-19 20:49:33 +02:00
return {
2020-12-22 20:38:51 +01:00
confirm_reset: "¿Está seguro de que desea restablecer este servidor?",
confirm_resetall: "¿Está seguro de que desea restablecer todos los servidores?",
context_localserversettings: "Configuración del servidor local",
modal_colorpicker1: "Color del icono",
modal_colorpicker2: "Color de fuente",
modal_colorpicker3: "Color de información sobre herramientas",
modal_colorpicker4: "Color de fuente",
modal_guildacronym: "Acrónimo del servidor local",
modal_guildbanner: "Bandera",
modal_guildicon: "Icono",
modal_guildname: "Nombre del servidor local",
modal_header: "Configuración del servidor local",
modal_ignorecustomname: "Utilice el nombre del servidor original para el acrónimo del servidor",
modal_invalidurl: "URL invalida",
modal_tabheader1: "Servidor",
modal_tabheader2: "Color del icono",
modal_tabheader3: "Color de información sobre herramientas",
submenu_resetsettings: "Restablecer servidor",
submenu_serversettings: "Cambiar ajustes"
2020-09-19 20:49:33 +02:00
};
case "fi": // Finnish
2020-09-19 20:49:33 +02:00
return {
2020-12-22 20:38:51 +01:00
confirm_reset: "Haluatko varmasti nollata tämän palvelimen?",
confirm_resetall: "Haluatko varmasti nollata kaikki palvelimet?",
context_localserversettings: "Paikallisen palvelimen asetukset",
modal_colorpicker1: "Kuvakkeen väri",
modal_colorpicker2: "Fontin väri",
modal_colorpicker3: "Työkaluvihjeen väri",
modal_colorpicker4: "Fontin väri",
modal_guildacronym: "Paikallisen palvelimen lyhenne",
modal_guildbanner: "Banneri",
modal_guildicon: "Kuvake",
modal_guildname: "Paikallisen palvelimen nimi",
modal_header: "Paikallisen palvelimen asetukset",
modal_ignorecustomname: "Käytä palvelimen lyhenteessä alkuperäistä palvelimen nimeä",
modal_invalidurl: "Virheellinen URL",
modal_tabheader1: "Palvelin",
modal_tabheader2: "Kuvakkeen väri",
modal_tabheader3: "Työkaluvihjeen väri",
submenu_resetsettings: "Nollaa palvelin",
submenu_serversettings: "Vaihda asetuksia"
2020-09-19 20:49:33 +02:00
};
case "fr": // French
2020-09-19 20:49:33 +02:00
return {
2020-12-22 20:38:51 +01:00
confirm_reset: "Êtes-vous sûr de vouloir réinitialiser ce serveur?",
confirm_resetall: "Voulez-vous vraiment réinitialiser tous les serveurs?",
context_localserversettings: "Paramètres locaux du serveur",
modal_colorpicker1: "Couleur de l'icône",
modal_colorpicker2: "Couleur de la police",
modal_colorpicker3: "Couleur de l'info-bulle",
modal_colorpicker4: "Couleur de la police",
2020-12-22 20:38:51 +01:00
modal_guildacronym: "Acronyme local du serveur",
modal_guildbanner: "Bannière",
modal_guildicon: "Icône",
2020-12-22 20:38:51 +01:00
modal_guildname: "Nom local du serveur",
modal_header: "Paramètres locaux du serveur",
modal_ignorecustomname: "Utilisez le nom de serveur d'origine pour l'acronyme de serveur",
modal_invalidurl: "URL invalide",
modal_tabheader1: "Serveur",
modal_tabheader2: "Couleur de l'icône",
modal_tabheader3: "Couleur de l'info-bulle",
submenu_resetsettings: "Réinitialiser le serveur",
submenu_serversettings: "Modifier les paramètres"
2020-09-19 20:49:33 +02:00
};
case "hr": // Croatian
2020-09-19 20:49:33 +02:00
return {
2020-12-22 20:38:51 +01:00
confirm_reset: "Jeste li sigurni da želite resetirati ovaj poslužitelj?",
confirm_resetall: "Jeste li sigurni da želite resetirati sve poslužitelje?",
context_localserversettings: "Postavke lokalnog poslužitelja",
2020-12-22 20:38:51 +01:00
modal_colorpicker1: "Ikona Boja",
modal_colorpicker2: "Boja fonta",
modal_colorpicker3: "Boja opisa",
modal_colorpicker4: "Boja fonta",
2020-12-22 20:38:51 +01:00
modal_guildacronym: "Lokalni poslužitelj kratica",
modal_guildbanner: "Natpis",
modal_guildicon: "Ikona",
modal_guildname: "Naziv lokalnog poslužitelja",
modal_header: "Postavke lokalnog poslužitelja",
modal_ignorecustomname: "Koristite izvorno ime poslužitelja za kraticu poslužitelja",
modal_invalidurl: "Neispravna poveznica",
modal_tabheader1: "Poslužitelj",
2020-12-22 20:38:51 +01:00
modal_tabheader2: "Ikona Boja",
modal_tabheader3: "Boja opisa",
submenu_resetsettings: "Resetiraj poslužitelj",
submenu_serversettings: "Promijeniti postavke"
2020-09-19 20:49:33 +02:00
};
case "hu": // Hungarian
2020-09-19 20:49:33 +02:00
return {
2020-12-22 20:38:51 +01:00
confirm_reset: "Biztosan visszaállítja ezt a szervert?",
confirm_resetall: "Biztosan visszaállítja az összes szervert?",
context_localserversettings: "Helyi kiszolgáló beállításai",
2020-12-22 20:38:51 +01:00
modal_colorpicker1: "Ikon színe",
modal_colorpicker2: "Betű szín",
2020-12-22 20:38:51 +01:00
modal_colorpicker3: "Tooltip Color",
modal_colorpicker4: "Betű szín",
modal_guildacronym: "Helyi szerver betűszó",
modal_guildbanner: "Transzparens",
modal_guildicon: "Ikon",
modal_guildname: "Helyi kiszolgáló neve",
modal_header: "Helyi kiszolgáló beállításai",
modal_ignorecustomname: "A kiszolgáló rövidítéshez használja az eredeti kiszolgáló nevet",
modal_invalidurl: "Érvénytelen URL",
modal_tabheader1: "Szerver",
2020-12-22 20:38:51 +01:00
modal_tabheader2: "Ikon színe",
modal_tabheader3: "Tooltip Color",
submenu_resetsettings: "Reset Server",
submenu_serversettings: "Beállítások megváltoztatása"
2020-09-19 20:49:33 +02:00
};
case "it": // Italian
2020-09-19 20:49:33 +02:00
return {
2020-12-22 20:38:51 +01:00
confirm_reset: "Sei sicuro di voler reimpostare questo server?",
confirm_resetall: "Sei sicuro di voler ripristinare tutti i server?",
context_localserversettings: "Impostazioni locale del server",
modal_colorpicker1: "Colore dell'icona",
modal_colorpicker2: "Colore del carattere",
modal_colorpicker3: "Colore della descrizione comando",
modal_colorpicker4: "Colore del carattere",
2020-12-22 20:38:51 +01:00
modal_guildacronym: "Acronimo locale del server",
modal_guildbanner: "Banner",
modal_guildicon: "Icona",
2020-12-22 20:38:51 +01:00
modal_guildname: "Nome locale server",
modal_header: "Impostazioni locale del server",
modal_ignorecustomname: "Utilizzare il nome del server originale per l'acronimo del server",
modal_invalidurl: "URL non valido",
modal_tabheader1: "Server",
2020-12-22 20:38:51 +01:00
modal_tabheader2: "Colore dell'icona",
modal_tabheader3: "Colore della descrizione comando",
submenu_resetsettings: "Reimposta server",
submenu_serversettings: "Cambia impostazioni"
2020-09-19 20:49:33 +02:00
};
case "ja": // Japanese
2020-09-19 20:49:33 +02:00
return {
2020-12-22 20:38:51 +01:00
confirm_reset: "このサーバーをリセットしてもよろしいですか?",
confirm_resetall: "すべてのサーバーをリセットしてもよろしいですか?",
context_localserversettings: "ローカルサーバー設定",
modal_colorpicker1: "アイコンの色",
modal_colorpicker2: "フォントの色",
modal_colorpicker3: "ツールチップの色",
modal_colorpicker4: "フォントの色",
modal_guildacronym: "ローカルサーバーの頭字語",
modal_guildbanner: "バナー",
modal_guildicon: "アイコン",
modal_guildname: "ローカルサーバー名",
modal_header: "ローカルサーバー設定",
modal_ignorecustomname: "サーバーの頭字語には元のサーバー名を使用します",
modal_invalidurl: "無効なURL",
modal_tabheader1: "サーバ",
modal_tabheader2: "アイコンの色",
modal_tabheader3: "ツールチップの色",
submenu_resetsettings: "サーバーのリセット",
submenu_serversettings: "設定を変更する"
2020-09-19 20:49:33 +02:00
};
case "ko": // Korean
2020-09-19 20:49:33 +02:00
return {
2020-12-22 20:38:51 +01:00
confirm_reset: "이 서버를 재설정 하시겠습니까?",
confirm_resetall: "모든 서버를 재설정 하시겠습니까?",
context_localserversettings: "로컬 서버 설정",
modal_colorpicker1: "아이콘 색상",
modal_colorpicker2: "글자 색",
modal_colorpicker3: "툴팁 색상",
modal_colorpicker4: "글자 색",
modal_guildacronym: "로컬 서버 약어",
modal_guildbanner: "배너",
modal_guildicon: "상",
modal_guildname: "로컬 서버 이름",
modal_header: "로컬 서버 설정",
modal_ignorecustomname: "서버 약어에 원래 서버 이름 사용",
modal_invalidurl: "잘못된 URL",
modal_tabheader1: "섬기는 사람",
modal_tabheader2: "아이콘 색상",
modal_tabheader3: "툴팁 색상",
submenu_resetsettings: "서버 재설정",
submenu_serversettings: "설정 변경"
2020-09-19 20:49:33 +02:00
};
case "lt": // Lithuanian
2020-09-19 20:49:33 +02:00
return {
2020-12-22 20:38:51 +01:00
confirm_reset: "Ar tikrai norite iš naujo nustatyti šį serverį?",
confirm_resetall: "Ar tikrai norite iš naujo nustatyti visus serverius?",
context_localserversettings: "Vietinio serverio nustatymai",
modal_colorpicker1: "Piktogramos spalva",
modal_colorpicker2: "Šrifto spalva",
modal_colorpicker3: "Patarimo spalva",
modal_colorpicker4: "Šrifto spalva",
modal_guildacronym: "Vietinio serverio santrumpa",
modal_guildbanner: "Reklamjuostė",
modal_guildicon: "Piktograma",
modal_guildname: "Vietinio serverio pavadinimas",
modal_header: "Vietinio serverio nustatymai",
modal_ignorecustomname: "Serverio akronimui naudokite originalų serverio pavadinimą",
modal_invalidurl: "Neteisingas URL",
modal_tabheader1: "Serveris",
modal_tabheader2: "Piktogramos spalva",
modal_tabheader3: "Patarimo spalva",
submenu_resetsettings: "Iš naujo nustatyti serverį",
submenu_serversettings: "Pakeisti nustatymus"
2020-09-19 20:49:33 +02:00
};
case "nl": // Dutch
2020-09-19 20:49:33 +02:00
return {
2020-12-22 20:38:51 +01:00
confirm_reset: "Weet u zeker dat u deze server opnieuw wilt instellen?",
confirm_resetall: "Weet u zeker dat u alle servers wilt resetten?",
context_localserversettings: "Lokale serverinstellingen",
modal_colorpicker1: "Icoonkleur",
modal_colorpicker2: "Letterkleur",
modal_colorpicker3: "Tooltipkleur",
modal_colorpicker4: "Letterkleur",
modal_guildacronym: "Lokale serveracroniem",
modal_guildbanner: "Banner",
modal_guildicon: "Icoon",
modal_guildname: "Lokale servernaam",
modal_header: "Lokale serverinstellingen",
modal_ignorecustomname: "Gebruik de oorspronkelijke servernaam voor het serveracroniem",
modal_invalidurl: "Ongeldige URL",
modal_tabheader1: "Server",
modal_tabheader2: "Icoonkleur",
modal_tabheader3: "Tooltipkleur",
submenu_resetsettings: "Reset server",
submenu_serversettings: "Instellingen veranderen"
2020-09-19 20:49:33 +02:00
};
case "no": // Norwegian
2020-09-19 20:49:33 +02:00
return {
2020-12-22 20:38:51 +01:00
confirm_reset: "Er du sikker på at du vil tilbakestille denne serveren?",
confirm_resetall: "Er du sikker på at du vil tilbakestille alle serverne?",
context_localserversettings: "Lokale serverinnstillinger",
modal_colorpicker1: "Ikonfarge",
modal_colorpicker2: "Skriftfarge",
2020-12-22 20:38:51 +01:00
modal_colorpicker3: "Verktøytipsfarge",
modal_colorpicker4: "Skriftfarge",
2020-12-22 20:38:51 +01:00
modal_guildacronym: "Lokal serverakronymet",
modal_guildbanner: "Banner",
modal_guildicon: "Ikon",
modal_guildname: "Lokalt servernavn",
modal_header: "Lokale serverinnstillinger",
modal_ignorecustomname: "Bruk det originale servernavnet for serverakronymet",
modal_invalidurl: "Ugyldig URL",
modal_tabheader1: "Server",
modal_tabheader2: "Ikonfarge",
2020-12-22 20:38:51 +01:00
modal_tabheader3: "Verktøytipsfarge",
submenu_resetsettings: "Tilbakestill server",
submenu_serversettings: "Endre innstillinger"
2020-09-19 20:49:33 +02:00
};
case "pl": // Polish
2020-09-19 20:49:33 +02:00
return {
2020-12-22 20:38:51 +01:00
confirm_reset: "Czy na pewno chcesz zresetować ten serwer?",
confirm_resetall: "Czy na pewno chcesz zresetować wszystkie serwery?",
context_localserversettings: "Ustawienia serwera lokalnego",
modal_colorpicker1: "Kolor ikony",
modal_colorpicker2: "Kolor czcionki",
modal_colorpicker3: "Kolor etykiety narzędzi",
modal_colorpicker4: "Kolor czcionki",
2020-12-22 20:38:51 +01:00
modal_guildacronym: "Akronim lokalnego serwera",
modal_guildbanner: "Transparent",
modal_guildicon: "Ikona",
modal_guildname: "Nazwa serwera lokalnego",
modal_header: "Ustawienia serwera lokalnego",
modal_ignorecustomname: "Użyj oryginalnej nazwy serwera dla akronimu serwera",
modal_invalidurl: "Nieprawidłowy URL",
modal_tabheader1: "Serwer",
modal_tabheader2: "Kolor ikony",
modal_tabheader3: "Kolor etykiety narzędzi",
submenu_resetsettings: "Zresetuj serwer",
submenu_serversettings: "Zmień ustawienia"
2020-09-19 20:49:33 +02:00
};
case "pt-BR": // Portuguese (Brazil)
2020-09-19 20:49:33 +02:00
return {
2020-12-22 20:38:51 +01:00
confirm_reset: "Tem certeza que deseja redefinir este servidor?",
confirm_resetall: "Tem certeza de que deseja redefinir todos os servidores?",
context_localserversettings: "Configurações do servidor local",
modal_colorpicker1: "Cor do ícone",
modal_colorpicker2: "Cor da fonte",
modal_colorpicker3: "Cor da dica de ferramenta",
modal_colorpicker4: "Cor da fonte",
modal_guildacronym: "Acrônimo de servidor local",
modal_guildbanner: "Bandeira",
modal_guildicon: "Ícone",
modal_guildname: "Nome do servidor local",
modal_header: "Configurações do servidor local",
modal_ignorecustomname: "Use o nome do servidor original para o acrônimo do servidor",
modal_invalidurl: "URL inválida",
modal_tabheader1: "Servidor",
modal_tabheader2: "Cor do ícone",
modal_tabheader3: "Cor da dica de ferramenta",
submenu_resetsettings: "Reiniciar Servidor",
submenu_serversettings: "Mudar configurações"
2020-09-19 20:49:33 +02:00
};
case "ro": // Romanian
2020-09-19 20:49:33 +02:00
return {
2020-12-22 20:38:51 +01:00
confirm_reset: "Sigur doriți să resetați acest server?",
confirm_resetall: "Sigur doriți să resetați toate serverele?",
context_localserversettings: "Setări locale ale serverului",
modal_colorpicker1: "Culoare pictogramă",
modal_colorpicker2: "Culoarea fontului",
2020-12-22 20:38:51 +01:00
modal_colorpicker3: "Culoare sfat de instrumente",
modal_colorpicker4: "Culoarea fontului",
modal_guildacronym: "Acronim de server local",
modal_guildbanner: "Banner",
modal_guildicon: "Pictogramă",
modal_guildname: "Numele serverului local",
modal_header: "Setări locale ale serverului",
modal_ignorecustomname: "Utilizați numele serverului original pentru acronimul serverului",
modal_invalidurl: "URL invalid",
modal_tabheader1: "Server",
modal_tabheader2: "Culoare pictogramă",
modal_tabheader3: "Culoare sfat",
submenu_resetsettings: "Resetați serverul",
submenu_serversettings: "Schimbă setările"
2020-09-19 20:49:33 +02:00
};
case "ru": // Russian
2020-09-19 20:49:33 +02:00
return {
2020-12-22 20:38:51 +01:00
confirm_reset: "Вы уверены, что хотите сбросить этот сервер?",
confirm_resetall: "Вы уверены, что хотите сбросить все серверы?",
context_localserversettings: "Настройки локального сервера",
modal_colorpicker1: "Цвет значка",
modal_colorpicker2: "Цвет шрифта",
modal_colorpicker3: "Цвет всплывающей подсказки",
modal_colorpicker4: "Цвет шрифта",
modal_guildacronym: "Акроним локального сервера",
modal_guildbanner: "Баннер",
modal_guildicon: "Икона",
modal_guildname: "Имя локального сервера",
modal_header: "Настройки локального сервера",
modal_ignorecustomname: "Используйте исходное имя сервера для аббревиатуры сервера",
modal_invalidurl: "Неверная ссылка",
modal_tabheader1: "Сервер",
modal_tabheader2: "Цвет значка",
modal_tabheader3: "Цвет всплывающей подсказки",
submenu_resetsettings: "Сбросить сервер",
submenu_serversettings: "Изменить настройки"
2020-09-19 20:49:33 +02:00
};
case "sv": // Swedish
2020-09-19 20:49:33 +02:00
return {
2020-12-22 20:38:51 +01:00
confirm_reset: "Är du säker på att du vill återställa den här servern?",
confirm_resetall: "Är du säker på att du vill återställa alla servrar?",
context_localserversettings: "Lokala serverinställningar",
modal_colorpicker1: "Ikonfärg",
modal_colorpicker2: "Fontfärg",
modal_colorpicker3: "Verktygstipsfärg",
modal_colorpicker4: "Fontfärg",
2020-12-22 20:38:51 +01:00
modal_guildacronym: "Lokal servernakronym",
modal_guildbanner: "Baner",
modal_guildicon: "Ikon",
modal_guildname: "Lokalt servernamn",
modal_header: "Lokala serverinställningar",
2020-12-22 20:38:51 +01:00
modal_ignorecustomname: "Använd det ursprungliga servernamnet för servernakronym",
modal_invalidurl: "Ogiltig URL",
modal_tabheader1: "Server",
modal_tabheader2: "Ikonfärg",
modal_tabheader3: "Verktygstipsfärg",
submenu_resetsettings: "Återställ server",
submenu_serversettings: "Ändra inställningar"
2020-09-19 20:49:33 +02:00
};
case "th": // Thai
2020-09-19 20:49:33 +02:00
return {
2020-12-22 20:38:51 +01:00
confirm_reset: "แน่ใจไหมว่าต้องการรีเซ็ตเซิร์ฟเวอร์นี้",
confirm_resetall: "แน่ใจไหมว่าต้องการรีเซ็ตเซิร์ฟเวอร์ทั้งหมด",
context_localserversettings: "การตั้งค่าเซิร์ฟเวอร์ภายใน",
modal_colorpicker1: "ไอคอนสี",
modal_colorpicker2: "สีตัวอักษร",
2020-12-22 20:38:51 +01:00
modal_colorpicker3: "เคล็ดลับเครื่องมือสี",
modal_colorpicker4: "สีตัวอักษร",
modal_guildacronym: "ตัวย่อเซิร์ฟเวอร์ภายใน",
modal_guildbanner: "แบนเนอร์",
modal_guildicon: "ไอคอน",
modal_guildname: "ชื่อเซิร์ฟเวอร์ภายใน",
modal_header: "การตั้งค่าเซิร์ฟเวอร์ภายใน",
modal_ignorecustomname: "ใช้ชื่อเซิร์ฟเวอร์เดิมสำหรับตัวย่อเซิร์ฟเวอร์",
modal_invalidurl: "URL ไม่ถูกต้อง",
modal_tabheader1: "เซิร์ฟเวอร์",
modal_tabheader2: "ไอคอนสี",
modal_tabheader3: "เคล็ดลับเครื่องมือสี",
submenu_resetsettings: "รีเซ็ตเซิร์ฟเวอร์",
submenu_serversettings: "เปลี่ยนการตั้งค่า"
};
case "tr": // Turkish
return {
2020-12-22 20:38:51 +01:00
confirm_reset: "Bu Sunucuyu sıfırlamak istediğinizden emin misiniz?",
confirm_resetall: "Tüm Sunucuları sıfırlamak istediğinizden emin misiniz?",
context_localserversettings: "Yerel Sunucu Ayarları",
modal_colorpicker1: "Simge Rengi",
modal_colorpicker2: "Yazı rengi",
modal_colorpicker3: "Araç İpucu Rengi",
modal_colorpicker4: "Yazı rengi",
modal_guildacronym: "Yerel Sunucu Kısaltması",
modal_guildbanner: "Afiş",
modal_guildicon: "Simge",
modal_guildname: "Yerel Sunucu Adı",
modal_header: "Yerel Sunucu Ayarları",
modal_ignorecustomname: "Sunucu Kısaltması için orijinal Sunucu Adını kullanın",
modal_invalidurl: "Geçersiz URL",
modal_tabheader1: "Sunucu",
modal_tabheader2: "Simge Rengi",
modal_tabheader3: "Araç İpucu Rengi",
submenu_resetsettings: "Sunucuyu Sıfırla",
submenu_serversettings: "Ayarları değiştir"
};
case "uk": // Ukrainian
return {
2020-12-22 20:38:51 +01:00
confirm_reset: "Справді скинути цей сервер?",
confirm_resetall: "Ви впевнені, що хочете скинути всі сервери?",
context_localserversettings: "Налаштування локального сервера",
modal_colorpicker1: "Значок Колір",
modal_colorpicker2: "Колір шрифту",
modal_colorpicker3: "Колір підказки",
modal_colorpicker4: "Колір шрифту",
modal_guildacronym: "Акронім локального сервера",
modal_guildbanner: "Банер",
modal_guildicon: "Піктограма",
modal_guildname: "Назва локального сервера",
modal_header: "Налаштування локального сервера",
modal_ignorecustomname: "Використовуйте оригінальне ім’я сервера для абревіатури сервера",
modal_invalidurl: "Недійсна URL-адреса",
modal_tabheader1: "Сервер",
modal_tabheader2: "Значок Колір",
modal_tabheader3: "Колір підказки",
submenu_resetsettings: "Скинути сервер",
submenu_serversettings: "Змінити налаштування"
};
case "vi": // Vietnamese
return {
2020-12-22 20:38:51 +01:00
confirm_reset: "Bạn có chắc chắn muốn đặt lại Máy chủ này không?",
confirm_resetall: "Bạn có chắc chắn muốn đặt lại tất cả Máy chủ không?",
context_localserversettings: "Cài đặt máy chủ cục bộ",
modal_colorpicker1: "Màu biểu tượng",
modal_colorpicker2: "Màu phông chữ",
modal_colorpicker3: "Màu chú giải công cụ",
modal_colorpicker4: "Màu phông chữ",
modal_guildacronym: "Từ viết tắt của máy chủ cục bộ",
modal_guildbanner: "Ảnh bìa",
modal_guildicon: "Biểu tượng",
modal_guildname: "Tên máy chủ cục bộ",
modal_header: "Cài đặt máy chủ cục bộ",
modal_ignorecustomname: "Sử dụng tên máy chủ ban đầu cho từ viết tắt máy chủ",
modal_invalidurl: "URL không hợp lệ",
modal_tabheader1: "Người phục vụ",
modal_tabheader2: "Màu biểu tượng",
modal_tabheader3: "Màu chú giải công cụ",
submenu_resetsettings: "Đặt lại máy chủ",
submenu_serversettings: "Thay đổi cài đặt"
};
2021-01-15 17:54:22 +01:00
case "zh-CN": // Chinese (China)
return {
2020-12-22 20:38:51 +01:00
confirm_reset: "您确定要重置此服务器吗?",
confirm_resetall: "您确定要重置所有服务器吗?",
context_localserversettings: "本地服务器设置",
modal_colorpicker1: "图标颜色",
modal_colorpicker2: "字体颜色",
modal_colorpicker3: "工具提示颜色",
modal_colorpicker4: "字体颜色",
modal_guildacronym: "本地服务器缩写",
modal_guildbanner: "旗帜",
modal_guildicon: "图标",
modal_guildname: "本地服务器名称",
modal_header: "本地服务器设置",
modal_ignorecustomname: "使用原始服务器名称作为服务器首字母缩写词",
modal_invalidurl: "无效的网址",
modal_tabheader1: "服务器",
modal_tabheader2: "图标颜色",
modal_tabheader3: "工具提示颜色",
submenu_resetsettings: "重置服务器",
submenu_serversettings: "更改设置"
};
2021-01-15 17:54:22 +01:00
case "zh-TW": // Chinese (Taiwan)
return {
2020-12-22 20:38:51 +01:00
confirm_reset: "您確定要重置此服務器嗎?",
confirm_resetall: "您確定要重置所有服務器嗎?",
context_localserversettings: "本地服務器設置",
modal_colorpicker1: "圖標顏色",
modal_colorpicker2: "字體顏色",
modal_colorpicker3: "工具提示顏色",
modal_colorpicker4: "字體顏色",
2020-12-22 20:38:51 +01:00
modal_guildacronym: "本地服務器縮​​寫",
modal_guildbanner: "旗幟",
modal_guildicon: "圖標",
modal_guildname: "本地服務器名稱",
modal_header: "本地服務器設置",
modal_ignorecustomname: "使用原始服務器名稱作為服務器首字母縮寫詞",
modal_invalidurl: "無效的網址",
modal_tabheader1: "服務器",
modal_tabheader2: "圖標顏色",
modal_tabheader3: "工具提示顏色",
submenu_resetsettings: "重置服務器",
submenu_serversettings: "更改設置"
};
default: // English
return {
2020-12-22 20:38:51 +01:00
confirm_reset: "Are you sure you want to reset this Server?",
confirm_resetall: "Are you sure you want to reset all Servers?",
context_localserversettings: "Local Server Settings",
modal_colorpicker1: "Icon Color",
modal_colorpicker2: "Font Color",
modal_colorpicker3: "Tooltip Color",
modal_colorpicker4: "Font Color",
modal_guildacronym: "Local Server Acronym",
modal_guildbanner: "Banner",
modal_guildicon: "Icon",
modal_guildname: "Local Server Name",
modal_header: "Local Server Settings",
modal_ignorecustomname: "Use the original Server Name for the Server Acronym",
modal_invalidurl: "Invalid URL",
modal_tabheader1: "Server",
modal_tabheader2: "Icon Color",
modal_tabheader3: "Tooltip Color",
submenu_resetsettings: "Reset Server",
submenu_serversettings: "Change Settings"
2020-09-19 20:49:33 +02:00
};
}
}
};
2020-10-09 21:09:35 +02:00
})(window.BDFDB_Global.PluginUtils.buildPlugin(config));
2020-12-15 17:38:45 +01:00
})();