BetterDiscordAddons/Plugins/EditServers/EditServers.plugin.js

1091 lines
50 KiB
JavaScript
Raw Normal View History

2019-09-20 22:32:52 +02:00
//META{"name":"EditServers","website":"https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/EditServers","source":"https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/Plugins/EditServers/EditServers.plugin.js"}*//
2018-10-11 10:21:26 +02:00
class EditServers {
2019-01-17 23:48:29 +01:00
getName () {return "EditServers";}
2019-10-19 19:15:57 +02:00
getVersion () {return "2.1.1";}
2019-01-17 23:48:29 +01:00
getAuthor () {return "DevilBro";}
getDescription () {return "Allows you to change the icon, name and color of servers.";}
2019-01-26 22:45:19 +01:00
2019-09-04 12:34:02 +02:00
constructor () {
2019-06-06 19:08:09 +02:00
this.changelog = {
2019-10-19 19:15:57 +02:00
"fixed":[["Tooltips","Fixed issue where native tooltip wasn't hidden"]]
2019-09-04 12:34:02 +02:00
};
2018-10-11 10:21:26 +02:00
this.labels = {};
2019-01-26 22:45:19 +01:00
this.patchModules = {
2019-04-26 14:57:08 +02:00
"Guild":"componentDidMount",
2019-05-20 13:50:57 +02:00
"GuildIconWrapper":"componentDidMount",
"GuildHeader":["componentDidMount","componentDidUpdate"],
"Clickable":"componentDidMount"
};
2019-09-04 12:34:02 +02:00
}
2018-10-11 10:21:26 +02:00
2019-09-04 12:34:02 +02:00
initConstructor () {
2019-02-13 11:15:00 +01:00
this.defaults = {
settings: {
2019-02-13 19:57:35 +01:00
addOriginalTooltip: {value:true, inner:false, description:"Hovering over a changed Server Header shows the original Name as Tooltip"},
changeInGuildList: {value:true, inner:true, description:"Server List"},
changeInMutualGuilds: {value:true, inner:true, description:"Mutual Servers"},
changeInGuildHeader: {value:true, inner:true, description:"Server Header"},
changeInSearchPopout: {value:true, inner:true, description:"Search Popout"}
2019-02-13 11:15:00 +01:00
}
};
2018-10-11 10:21:26 +02:00
}
2019-01-26 22:45:19 +01:00
2018-10-11 10:21:26 +02:00
getSettingsPanel () {
2019-01-22 11:28:32 +01:00
if (!global.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
2019-02-13 19:57:35 +01:00
var settings = BDFDB.getAllData(this, "settings");
2019-10-17 11:36:34 +02:00
var settingsitems = [], inneritems = [];
for (let key in settings) (!this.defaults.settings[key].inner ? settingsitems : inneritems).push(BDFDB.React.createElement(BDFDB.LibraryComponents.SettingsSwitch, {
className: BDFDB.disCN.marginbottom8,
plugin: this,
keys: ["settings", key],
label: this.defaults.settings[key].description,
value: settings[key]
}));
2019-10-17 18:54:51 +02:00
settingsitems.push(BDFDB.React.createElement(BDFDB.LibraryComponents.SettingsPanelInner, {
title: "Change Servers in:",
children: inneritems
2019-10-17 11:36:34 +02:00
}));
settingsitems.push(BDFDB.React.createElement(BDFDB.LibraryComponents.SettingsItem, {
2019-10-21 12:11:46 +02:00
type: "Button",
2019-10-17 11:36:34 +02:00
className: BDFDB.disCN.marginbottom8,
color: BDFDB.LibraryComponents.Button.Colors.RED,
label: "Reset all Servers",
onClick: _ => {
BDFDB.openConfirmModal(this, "Are you sure you want to reset all servers?", () => {
BDFDB.removeAllData(this, "servers");
this.forceUpdateAll();
});
},
2019-10-19 11:41:39 +02:00
children: BDFDB.LanguageUtils.LanguageStrings.RESET
2019-10-17 11:36:34 +02:00
}));
return BDFDB.createSettingsPanel(this, settingsitems);
2018-10-11 10:21:26 +02:00
}
//legacy
load () {}
start () {
2019-02-04 09:13:15 +01:00
if (!global.BDFDB) global.BDFDB = {myPlugins:{}};
if (global.BDFDB && global.BDFDB.myPlugins && typeof global.BDFDB.myPlugins == "object") global.BDFDB.myPlugins[this.getName()] = this;
2019-05-26 13:55:26 +02:00
var libraryScript = document.querySelector('head script#BDFDBLibraryScript');
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());
2019-05-26 13:55:26 +02: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
}
else if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();
2018-10-11 10:21:26 +02:00
this.startTimeout = setTimeout(() => {this.initialize();}, 30000);
}
initialize () {
2019-01-17 23:48:29 +01:00
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
2019-01-22 11:05:54 +01:00
if (this.started) return;
2018-10-11 10:21:26 +02:00
BDFDB.loadMessage(this);
2019-01-26 22:45:19 +01:00
2019-09-11 12:14:43 +02:00
BDFDB.WebModules.patch(BDFDB.LibraryModules.IconUtils, 'getGuildBannerURL', this, {instead:e => {
let guild = BDFDB.LibraryModules.GuildStore.getGuild(e.methodArguments[0].id);
2019-03-14 14:06:14 +01:00
if (guild) {
if (e.methodArguments[0].id == "410787888507256842") return guild.banner;
let data = BDFDB.loadData(guild.id, this, "servers");
if (data && data.banner && !data.removeBanner) return data.banner;
}
return e.callOriginalMethod();
}});
2019-10-17 11:36:34 +02:00
this.forceUpdateAll();
2018-10-11 10:21:26 +02:00
}
else {
2019-02-12 21:56:34 +01:00
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 () {
2019-01-17 23:48:29 +01:00
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
let data = BDFDB.loadAllData(this, "servers");
BDFDB.removeAllData(this, "servers");
2019-10-17 11:36:34 +02:00
try {this.forceUpdateAll();} catch (err) {}
BDFDB.saveAllData(data, this, "servers");
2019-09-04 12:34:02 +02:00
2019-03-14 14:06:14 +01:00
for (let guildobj of BDFDB.readServerList()) if (guildobj.instance) {
2019-05-20 13:50:57 +02:00
delete guildobj.instance.props.guild.EditServersCachedBanner;
2019-03-14 14:06:14 +01:00
}
2019-01-26 22:45:19 +01:00
2018-10-11 10:21:26 +02:00
BDFDB.unloadMessage(this);
}
}
// begin of own functions
2019-09-11 12:14:43 +02:00
onGuildContextMenu (instance, menu, returnvalue) {
if (instance.props && instance.props.guild && !menu.querySelector(`${this.name}-contextMenuSubItem`)) {
2019-09-11 14:31:41 +02:00
let [children, index] = BDFDB.getContextMenuGroupAndIndex(returnvalue, ["FluxContainer(MessageDeveloperModeGroup)", "DeveloperModeGroup"]);
2019-09-11 12:14:43 +02:00
const itemgroup = BDFDB.React.createElement(BDFDB.LibraryComponents.ContextMenuItemGroup, {
className: `BDFDB-contextMenuItemGroup ${this.name}-contextMenuItemGroup`,
children: [
BDFDB.React.createElement(BDFDB.LibraryComponents.ContextMenuSubItem, {
label: this.labels.context_localserversettings_text,
className: `BDFDB-contextMenuSubItem ${this.name}-contextMenuSubItem ${this.name}-serversettings-contextMenuSubItem`,
render: [BDFDB.React.createElement(BDFDB.LibraryComponents.ContextMenuItemGroup, {
className: `BDFDB-contextMenuItemGroup ${this.name}-contextMenuItemGroup`,
children: [
BDFDB.React.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
label: this.labels.submenu_serversettings_text,
className: `BDFDB-ContextMenuItem ${this.name}-ContextMenuItem ${this.name}-serversettings-ContextMenuItem`,
action: e => {
BDFDB.closeContextMenu(menu);
this.showServerSettings(instance.props.guild);
}
}),
BDFDB.React.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
label: this.labels.submenu_resetsettings_text,
className: `BDFDB-ContextMenuItem ${this.name}-ContextMenuItem ${this.name}-resetsettings-ContextMenuItem`,
disabled: !BDFDB.loadData(instance.props.guild.id, this, "servers"),
action: e => {
BDFDB.closeContextMenu(menu);
BDFDB.removeData(instance.props.guild.id, this, "servers");
2019-10-17 11:36:34 +02:00
this.forceUpdateAll(instance.props.guild.id);
2019-09-11 12:14:43 +02:00
}
})
]
})]
})
]
2019-01-17 23:48:29 +01:00
});
2019-09-11 12:14:43 +02:00
if (index > -1) children.splice(index, 0, itemgroup);
else children.push(itemgroup);
2018-10-11 10:21:26 +02:00
}
}
2019-09-04 12:34:02 +02:00
2019-09-11 12:14:43 +02:00
processGuild (instance, wrapper, returnvalue) {
2019-05-07 19:42:08 +02:00
if (instance.props && instance.props.guild) {
2019-04-26 14:57:08 +02:00
let icon = wrapper.querySelector(BDFDB.dotCN.guildicon + ":not(.fake-guildicon), " + BDFDB.dotCN.guildiconacronym + ":not(.fake-guildacronym)");
if (!icon) return;
this.changeGuildIcon(instance.props.guild, icon);
this.changeTooltip(instance.props.guild, wrapper.querySelector(BDFDB.dotCN.guildcontainer), "right");
}
}
2019-09-04 12:34:02 +02:00
2019-09-11 12:14:43 +02:00
processGuildIconWrapper (instance, wrapper, returnvalue) {
2019-04-26 14:57:08 +02:00
if (instance.props && instance.props.guild) {
let icon = wrapper.classList && BDFDB.containsClass(wrapper, BDFDB.disCN.avataricon) ? wrapper : wrapper.querySelector(BDFDB.dotCN.avataricon);
if (!icon) return;
this.changeGuildIcon(instance.props.guild, icon);
if (BDFDB.getParentEle(BDFDB.dotCN.friendscolumn, icon)) this.changeTooltip(instance.props.guild, icon.parentElement, "top");
}
}
2019-09-11 12:14:43 +02:00
processGuildHeader (instance, wrapper, returnvalue) {
2019-04-26 14:57:08 +02:00
if (instance.props && instance.props.guild) {
this.changeGuildName(instance.props.guild, wrapper.querySelector(BDFDB.dotCN.guildheadername));
}
}
2019-09-11 12:14:43 +02:00
processClickable (instance, wrapper, returnvalue) {
2019-04-26 14:57:08 +02:00
if (!wrapper || !instance.props || !instance.props.className) return;
else if (instance.props.tag == "div" && instance.props.className.indexOf(BDFDB.disCN.userprofilelistrow) > -1) {
let guild = BDFDB.getReactValue(instance, "_reactInternalFiber.return.memoizedProps.guild");
if (guild && BDFDB.getReactValue(instance, "_reactInternalFiber.return.type.displayName") == "GuildRow") {
this.changeGuildName(guild, wrapper.querySelector(BDFDB.dotCN.userprofilelistname));
}
}
else if (instance.props.tag == "div" && instance.props.className.indexOf(BDFDB.disCN.quickswitchresult) > -1) {
let guild = BDFDB.getReactValue(instance, "_reactInternalFiber.return.return.memoizedProps.guild");
2019-04-27 09:21:54 +02:00
if (guild) this.changeGuildName(guild, wrapper.querySelector(BDFDB.dotCN.quickswitchresultmatch));
2019-04-26 14:57:08 +02:00
else {
let channel = BDFDB.getReactValue(instance, "_reactInternalFiber.return.return.memoizedProps.channel");
2019-09-11 12:14:43 +02:00
if (channel && channel.guild_id) this.changeGuildName(BDFDB.LibraryModules.GuildStore.getGuild(channel.guild_id), wrapper.querySelector(BDFDB.dotCN.quickswitchresultmisccontainer));
2019-04-26 14:57:08 +02:00
}
}
}
2019-10-17 11:36:34 +02:00
forceUpdateAll (guildid) {
this.updateGuildSidebar();
BDFDB.WebModules.forceAllUpdates(this);
if (guildid) {
let ServerFolders = BDFDB.getPlugin("ServerFolders", true);
if (ServerFolders) {
let folder = ServerFolders.getFolderOfGuildId(guildid);
if (folder) ServerFolders.updateGuildInFolderContent(folder.folderId, guildid);
}
2019-03-14 14:06:14 +01:00
}
2019-10-17 11:36:34 +02:00
}
2019-09-04 12:34:02 +02:00
2019-10-17 11:36:34 +02:00
showServerSettings (info) {
var data = BDFDB.loadData(info.id, this, "servers") || {};
BDFDB.openModal(this, {
size: "MEDIUM",
header: this.labels.modal_header_text,
subheader: info.name,
children: [
BDFDB.React.createElement(BDFDB.LibraryComponents.ModalTabContent, {
tab: this.labels.modal_tabheader1_text,
children: [
BDFDB.React.createElement(BDFDB.LibraryComponents.FormComponents.FormItem, {
title: this.labels.modal_guildname_text,
className: BDFDB.disCN.marginbottom20 + " input-guildname",
children: [
BDFDB.React.createElement(BDFDB.LibraryComponents.TextInput, {
value: data.name,
placeholder: info.name,
autoFocus: true
})
]
}),
BDFDB.React.createElement(BDFDB.LibraryComponents.FormComponents.FormItem, {
title: this.labels.modal_guildacronym_text,
className: BDFDB.disCN.marginbottom20 + " input-guildacronym",
children: [
BDFDB.React.createElement(BDFDB.LibraryComponents.TextInput, {
value: data.shortName,
placeholder: info.acronym
})
]
}),
BDFDB.React.createElement(BDFDB.LibraryComponents.FormComponents.FormItem, {
title: this.labels.modal_guildicon_text,
className: BDFDB.disCN.marginbottom8 + " input-guildicon",
children: [
BDFDB.React.createElement(BDFDB.LibraryComponents.TextInput, {
inputClassName: !data.removeIcon && data.url ? BDFDB.disCN.inputsuccess : null,
value: data.url,
placeholder: BDFDB.getGuildIcon(info.id),
disabled: data.removeIcon,
onFocus: e => {
this.createNoticeTooltip(e.target);
},
onChange: (value, instance) => {
this.checkUrl(value, instance);
}
})
]
}),
BDFDB.React.createElement(BDFDB.LibraryComponents.SettingsItem, {
type: "Switch",
className: BDFDB.disCN.marginbottom20 + " input-removeicon",
label: this.labels.modal_removeicon_text,
value: data.removeIcon,
onChange: (value, instance) => {
let iconinputins = BDFDB.getReactValue(instance, "_reactInternalFiber.return.child.sibling.sibling.child.child.sibling.child.stateNode");
if (iconinputins) {
iconinputins.props.inputClassName = null;
iconinputins.props.disabled = value;
iconinputins.forceUpdate();
}
}
}),
BDFDB.React.createElement(BDFDB.LibraryComponents.FormComponents.FormItem, {
title: this.labels.modal_guildbanner_text,
className: BDFDB.disCN.marginbottom8 + " input-guildbanner",
children: [
BDFDB.React.createElement(BDFDB.LibraryComponents.TextInput, {
inputClassName: !data.removeBanner && data.banner ? BDFDB.disCN.inputsuccess : null,
value: data.banner,
placeholder: BDFDB.getGuildBanner(info.id),
disabled: data.removeBanner || info.id == "410787888507256842",
onFocus: e => {
this.createNoticeTooltip(e.target);
},
onChange: (value, instance) => {
this.checkUrl(value, instance);
}
})
]
}),
BDFDB.React.createElement(BDFDB.LibraryComponents.SettingsItem, {
type: "Switch",
className: BDFDB.disCN.marginbottom20 + " input-removebanner",
label: this.labels.modal_removebanner_text,
value: data.removeBanner,
disabled: info.id == "410787888507256842",
onChange: (value, instance) => {
let bannerinputins = BDFDB.getReactValue(instance, "_reactInternalFiber.return.child.sibling.sibling.child.child.sibling.child.stateNode");
if (bannerinputins) {
bannerinputins.props.inputClassName = null;
bannerinputins.props.disabled = value;
bannerinputins.forceUpdate();
}
}
})
]
}),
BDFDB.React.createElement(BDFDB.LibraryComponents.ModalTabContent, {
tab: this.labels.modal_tabheader2_text,
children: [
BDFDB.React.createElement(BDFDB.LibraryComponents.FormComponents.FormItem, {
title: this.labels.modal_colorpicker1_text,
className: BDFDB.disCN.marginbottom20,
children: [
BDFDB.React.createElement(BDFDB.LibraryComponents.ColorSwatches, {
color: data.color1,
number: 1
})
]
}),
BDFDB.React.createElement(BDFDB.LibraryComponents.FormComponents.FormItem, {
title: this.labels.modal_colorpicker2_text,
className: BDFDB.disCN.marginbottom20,
children: [
BDFDB.React.createElement(BDFDB.LibraryComponents.ColorSwatches, {
color: data.color2,
number: 2
})
]
})
]
}),
BDFDB.React.createElement(BDFDB.LibraryComponents.ModalTabContent, {
tab: this.labels.modal_tabheader3_text,
children: [
BDFDB.React.createElement(BDFDB.LibraryComponents.FormComponents.FormItem, {
title: this.labels.modal_colorpicker3_text,
className: BDFDB.disCN.marginbottom20,
children: [
BDFDB.React.createElement(BDFDB.LibraryComponents.ColorSwatches, {
color: data.color3,
number: 3
})
]
}),
BDFDB.React.createElement(BDFDB.LibraryComponents.FormComponents.FormItem, {
title: this.labels.modal_colorpicker4_text,
className: BDFDB.disCN.marginbottom20,
children: [
BDFDB.React.createElement(BDFDB.LibraryComponents.ColorSwatches, {
color: data.color4,
number: 4
})
]
})
]
})
],
buttons: [{
2019-10-19 11:41:39 +02:00
contents: BDFDB.LanguageUtils.LanguageStrings.SAVE,
2019-10-17 11:36:34 +02:00
color: "BRAND",
close: true,
click: modal => {
let olddata = Object.assign({}, data);
let guildnameinput = modal.querySelector(".input-guildname " + BDFDB.dotCN.input);
let guildacronyminput = modal.querySelector(".input-guildacronym " + BDFDB.dotCN.input);
let guildiconinput = modal.querySelector(".input-guildicon " + BDFDB.dotCN.input);
let removeiconinput = modal.querySelector(".input-removeicon " + BDFDB.dotCN.switchinner);
let guildbannerinput = modal.querySelector(".input-guildbanner " + BDFDB.dotCN.input);
let removebannerinput = modal.querySelector(".input-removebanner " + BDFDB.dotCN.switchinner);
data.name = guildnameinput.value.trim() || null;
data.shortName = guildacronyminput.value.trim() || null;
data.url = (!data.removeIcon && BDFDB.containsClass(guildiconinput, BDFDB.disCN.inputsuccess) ? guildiconinput.value.trim() : null) || null;
data.removeIcon = removeiconinput.checked;
data.banner = (!data.removeBanner && BDFDB.containsClass(guildbannerinput, BDFDB.disCN.inputsuccess) ? guildbannerinput.value.trim() : null) || null;
data.removeBanner = removebannerinput.checked && info.id != "410787888507256842";
2019-03-14 14:06:14 +01:00
2019-10-17 11:36:34 +02:00
data.color1 = BDFDB.getSwatchColor(modal, 1);
data.color2 = BDFDB.getSwatchColor(modal, 2);
data.color3 = BDFDB.getSwatchColor(modal, 3);
data.color4 = BDFDB.getSwatchColor(modal, 4);
2019-01-26 22:45:19 +01:00
2019-10-17 11:36:34 +02:00
let changed = false;
if (Object.keys(data).every(key => data[key] == null || data[key] == false) && (changed = true)) BDFDB.removeData(info.id, this, "servers");
else if (!BDFDB.equals(olddata, data) && (changed = true)) BDFDB.saveData(info.id, data, this, "servers");
if (changed) this.forceUpdateAll(info.id);
}
}]
2019-01-17 23:48:29 +01:00
});
2018-10-11 10:21:26 +02:00
}
2019-10-17 11:36:34 +02:00
checkUrl (url, instance) {
let input = BDFDB.React.findDOMNode(instance).firstElementChild;
clearTimeout(instance.checkTimeout);
if (url == null || !url.trim()) {
if (input) BDFDB.removeEles(input.tooltip);
instance.props.inputClassName = null;
instance.forceUpdate();
2018-10-11 10:21:26 +02:00
}
2019-10-17 11:36:34 +02:00
else instance.checkTimeout = setTimeout(() => {
BDFDB.LibraryRequires.request(url.trim(), (error, response, result) => {
2018-10-11 10:21:26 +02:00
if (response && response.headers["content-type"] && response.headers["content-type"].indexOf("image") != -1) {
2019-10-17 11:36:34 +02:00
if (input) BDFDB.removeEles(input.tooltip);
instance.props.inputClassName = BDFDB.disCN.inputsuccess;
2018-10-11 10:21:26 +02:00
}
else {
2019-10-17 11:36:34 +02:00
this.createNoticeTooltip(input, true);
instance.props.inputClassName = BDFDB.disCN.inputerror;
2018-10-11 10:21:26 +02:00
}
2019-10-17 11:36:34 +02:00
delete instance.checkTimeout;
instance.forceUpdate();
2018-10-11 10:21:26 +02:00
});
2019-10-17 11:36:34 +02:00
}, 1000);
2018-10-11 10:21:26 +02:00
}
2019-01-26 22:45:19 +01:00
2019-10-17 11:36:34 +02:00
createNoticeTooltip (input, isinvalid = false) {
if (!input) return;
BDFDB.removeEles(input.tooltip);
var invalid = isinvalid || BDFDB.containsClass(input, BDFDB.disCN.inputerror);
var valid = invalid ? false : BDFDB.containsClass(input, BDFDB.disCN.inputsuccess);
if (invalid || valid) input.tooltip = BDFDB.createTooltip(invalid ? this.labels.modal_invalidurl_text : this.labels.modal_validurl_text, input, {type:"right", selector:"notice-tooltip", color: invalid ? "red" : "green"});
2018-10-11 10:21:26 +02:00
}
2019-01-26 22:45:19 +01:00
changeGuildName (info, guildname) {
if (!info || !guildname || !guildname.parentElement) return;
if (guildname.EditServersChangeObserver && typeof guildname.EditServersChangeObserver.disconnect == "function") guildname.EditServersChangeObserver.disconnect();
2019-02-13 19:57:35 +01:00
guildname.removeEventListener("mouseenter", guildname.mouseenterListenerEditChannels);
2019-02-13 11:17:34 +01:00
let data = this.getGuildData(info.id, guildname);
2019-01-17 23:48:29 +01:00
if (data.name || data.color2 || guildname.getAttribute("changed-by-editservers")) {
2019-08-19 11:17:57 +02:00
if (BDFDB.isObject(data.color2)) {
2019-09-25 15:57:15 +02:00
guildname.style.setProperty("color", BDFDB.colorCONVERT(data.color2[Object.keys(data.color2)[0]], "RGBA"), "important");
2019-08-19 11:17:57 +02:00
BDFDB.setInnerText(guildname, BDFDB.htmlToElement(`<span style="pointer-events: none; -webkit-background-clip: text !important; color: transparent !important; background-image: ${BDFDB.colorGRADIENT(data.color2)} !important;">${BDFDB.encodeToHTML(data.name || info.name)}</span>`));
}
else {
2019-09-25 15:57:15 +02:00
guildname.style.setProperty("color", BDFDB.colorCONVERT(data.color2, "RGBA"), "important");
2019-08-19 11:17:57 +02:00
BDFDB.setInnerText(guildname, data.name || info.name);
}
2019-02-13 19:57:35 +01:00
if (data.name && BDFDB.containsClass(guildname, BDFDB.disCN.guildheadername) && BDFDB.getData("addOriginalTooltip", this, "settings")) {
guildname.mouseenterListenerEditChannels = () => {
2019-10-19 19:15:57 +02:00
BDFDB.createTooltip(info.name, guildname.parentElement, {type:"right", selector:"EditServers-tooltip", hide:true});
2019-02-13 19:57:35 +01:00
};
guildname.addEventListener("mouseenter", guildname.mouseenterListenerEditChannels);
}
2019-01-17 23:48:29 +01:00
if (data.name || data.color2) {
guildname.setAttribute("changed-by-editservers", true);
guildname.EditServersChangeObserver = new MutationObserver((changes, _) => {
guildname.EditServersChangeObserver.disconnect();
this.changeName(info, guildname);
});
guildname.EditServersChangeObserver.observe(guildname, {attributes:true});
}
else guildname.removeAttribute("changed-by-editservers");
}
}
2019-01-26 22:45:19 +01:00
changeGuildIcon (info, icon) {
if (!info || !icon || !icon.parentElement) return;
if (icon.EditServersChangeObserver && typeof icon.EditServersChangeObserver.disconnect == "function") icon.EditServersChangeObserver.disconnect();
2019-02-13 11:17:34 +01:00
let data = this.getGuildData(info.id, icon);
2019-06-05 11:13:12 +02:00
if (data.url || data.name || data.shortName || data.removeIcon || icon.getAttribute("changed-by-editservers")) {
2019-02-01 11:48:53 +01:00
let url = data.url || BDFDB.getGuildIcon(info.id);
2019-06-05 11:13:12 +02:00
let name = data.name || info.name || "";
2019-10-17 11:36:34 +02:00
let shortname = data.url ? "" : (data.shortName || (info.icon && !data.removeIcon ? "" : info.acronym));
2019-06-05 11:13:12 +02:00
if (BDFDB.containsClass(icon.parentElement, BDFDB.disCN.guildiconwrapper)) icon.parentElement.setAttribute("aria-label", name);
2019-04-26 14:57:08 +02:00
if (icon.tagName == "IMG") {
icon.setAttribute("src", data.removeIcon ? null : url);
let removeicon = data.removeIcon && BDFDB.containsClass(icon, BDFDB.disCN.guildicon);
BDFDB.toggleEles(icon, !removeicon);
BDFDB.removeEles(icon.parentElement.querySelector(".fake-guildacronym"));
if (removeicon) {
2019-10-17 11:36:34 +02:00
let fakeicon = BDFDB.htmlToElement(`<div class="${BDFDB.disCNS.guildiconchildwrapper + BDFDB.disCN.guildiconacronym} fake-guildacronym" aria-label="Server Acronym"></div>`);
2019-08-19 11:17:57 +02:00
if (data.color1) {
if (BDFDB.isObject(data.color1)) fakeicon.style.setProperty("background-image", BDFDB.colorGRADIENT(data.color1));
2019-09-25 15:57:15 +02:00
else fakeicon.style.setProperty("background-color", BDFDB.colorCONVERT(data.color1, "RGBA"));
2019-08-19 11:17:57 +02:00
}
2019-09-25 15:57:15 +02:00
if (data.color2) fakeicon.style.setProperty("color", BDFDB.colorCONVERT(BDFDB.isObject(data.color2) ? data.color2[Object.keys(data.color2)[0]] : data.color2, "RGBA"));
2019-08-19 11:17:57 +02:00
BDFDB.setInnerText(fakeicon, BDFDB.isObject(data.color2) ? BDFDB.htmlToElement(`<span style="pointer-events: none; -webkit-background-clip: text !important; color: transparent !important; background-image: ${BDFDB.colorGRADIENT(data.color2)} !important;">${BDFDB.encodeToHTML(shortname)}</span>`) : shortname);
2019-04-26 14:57:08 +02:00
icon.parentElement.appendChild(fakeicon);
2019-08-19 11:17:57 +02:00
fakeicon.style.setProperty("font-size", this.getFontSize(fakeicon));
2019-04-26 14:57:08 +02:00
}
}
else {
2019-08-19 11:17:57 +02:00
if (!data.removeIcon && !shortname && url) {
BDFDB.setInnerText(icon, "");
icon.style.setProperty("background-image", `url(${url})`);
}
else {
if (data.color1) {
if (BDFDB.isObject(data.color1)) icon.style.setProperty("background-image", BDFDB.colorGRADIENT(data.color1));
2019-09-25 15:57:15 +02:00
else icon.style.setProperty("background-color", BDFDB.colorCONVERT(data.color1, "RGBA"));
2019-08-19 11:17:57 +02:00
}
else {
icon.style.removeProperty("background-image");
icon.style.removeProperty("background-color");
}
2019-09-25 15:57:15 +02:00
if (data.color2) icon.style.setProperty("color", BDFDB.colorCONVERT(BDFDB.isObject(data.color2) ? data.color2[Object.keys(data.color2)[0]] : data.color2, "RGBA"));
2019-08-19 11:17:57 +02:00
BDFDB.setInnerText(icon, BDFDB.isObject(data.color2) ? BDFDB.htmlToElement(`<span style="pointer-events: none; -webkit-background-clip: text !important; color: transparent !important; background-image: ${BDFDB.colorGRADIENT(data.color2)} !important;">${BDFDB.encodeToHTML(shortname)}</span>`) : shortname);
}
2019-01-17 23:48:29 +01:00
icon.style.setProperty("font-size", this.getFontSize(icon));
2019-08-19 11:17:57 +02:00
BDFDB.toggleClass(icon, this.getNoIconClasses(icon), !icon.style.getPropertyValue("background-image") || BDFDB.isObject(data.color1));
2019-01-17 23:48:29 +01:00
if (data.url && !data.removeIcon) {
icon.style.setProperty("background-position", "center");
icon.style.setProperty("background-size", "cover");
}
}
2019-06-05 11:13:12 +02:00
if (data.url || data.name || data.shortName || data.removeIcon) {
2019-01-17 23:48:29 +01:00
icon.setAttribute("changed-by-editservers", true);
icon.EditServersChangeObserver = new MutationObserver((changes, _) => {
changes.forEach(
(change, i) => {
2019-06-06 19:08:09 +02:00
if (!data.url && !data.removeIcon && change.type == "attributes" && change.attributeName == "src" && change.target.src.indexOf(".gif") > -1) return;
2019-01-17 23:48:29 +01:00
icon.EditServersChangeObserver.disconnect();
this.changeGuildIcon(info, icon);
}
);
});
icon.EditServersChangeObserver.observe(icon, {attributes:true});
}
else icon.removeAttribute("changed-by-editservers");
}
}
2019-01-26 22:45:19 +01:00
changeTooltip (info, wrapper, type) {
if (!info || !wrapper || !wrapper.parentElement) return;
2019-02-13 11:17:34 +01:00
let data = this.getGuildData(info.id, wrapper);
2019-01-17 23:48:29 +01:00
wrapper.removeEventListener("mouseenter", wrapper.tooltipListenerEditServers);
if (data.name || data.color3 || data.color4) {
2019-10-18 14:56:41 +02:00
let ServerFolders = BDFDB.getPlugin("ServerFolders", true);
let folder = ServerFolders ? ServerFolders.getFolderOfGuildId(info.id) : null;
let folderData = folder ? BDFDB.loadData(folder.folderId, "ServerFolders", "folders") : null;
let color3 = data.color3 || (folderData && folderData.copyTooltipColor ? folderData.color3 : null);
let color4 = data.color4 || (folderData && folderData.copyTooltipColor ? folderData.color4 : null);
var isgradient3 = color3 && BDFDB.isObject(color3);
var isgradient4 = color4 && BDFDB.isObject(color4);
var bgColor = color3 ? (!isgradient3 ? BDFDB.colorCONVERT(color3, "RGBA") : BDFDB.colorGRADIENT(color3)) : "";
var fontColor = color4 ? (!isgradient4 ? BDFDB.colorCONVERT(color4, "RGBA") : BDFDB.colorGRADIENT(color4)) : "";
2019-01-17 23:48:29 +01:00
wrapper.tooltipListenerEditServers = () => {
2019-10-18 14:56:41 +02:00
BDFDB.createTooltip(isgradient4 ? `<span style="pointer-events: none; -webkit-background-clip: text !important; color: transparent !important; background-image: ${fontColor} !important;">${BDFDB.encodeToHTML(data.name || info.name)}</span>` : (data.name || info.name), wrapper, {type, selector:"EditServers-tooltip", style:`${isgradient4 ? '' : 'color: ' + fontColor + ' !important; '}background: ${bgColor} !important; border-color: ${isgradient3 ? BDFDB.colorCONVERT(color3[0], "RGBA") : bgColor} !important;`, html:isgradient3});
2019-01-17 23:48:29 +01:00
};
wrapper.addEventListener("mouseenter", wrapper.tooltipListenerEditServers);
2019-05-29 11:24:05 +02:00
if (document.querySelector(BDFDB.dotCN.guildcontainer + ":hover") == wrapper) wrapper.tooltipListenerEditServers();
2019-01-17 23:48:29 +01:00
}
}
2019-01-26 22:45:19 +01:00
getFontSize (icon) {
2019-08-19 11:17:57 +02:00
if (icon.style.getPropertyValue("background-image") && icon.style.getPropertyValue("background-image").indexOf("linear-gradient(") == -1) return null;
2019-04-26 14:57:08 +02:00
else if (BDFDB.containsClass(icon, BDFDB.disCN.guildicon) || BDFDB.containsClass(icon, BDFDB.disCN.guildiconacronym)) {
2019-08-19 11:17:57 +02:00
var shortname = icon.firstElementChild ? icon.firstElementChild.innerText : icon.innerText;
2019-02-01 11:48:53 +01:00
if (shortname) {
if (shortname.length > 5) return "10px";
else if (shortname.length > 4) return "12px";
else if (shortname.length > 3) return "14px";
else if (shortname.length > 1) return "16px";
else if (shortname.length == 1) return "18px";
}
}
2019-01-17 23:48:29 +01:00
else if (BDFDB.containsClass(icon, BDFDB.disCN.avatariconsizexlarge)) return "12px";
else if (BDFDB.containsClass(icon, BDFDB.disCN.avatariconsizelarge)) return "10px";
else if (BDFDB.containsClass(icon, BDFDB.disCN.avatariconsizemedium)) return "8px";
else if (BDFDB.containsClass(icon, BDFDB.disCN.avatariconsizesmall)) return "4.8px";
else if (BDFDB.containsClass(icon, BDFDB.disCN.avatariconsizemini)) return "4px";
2019-02-01 11:48:53 +01:00
return "10px";
}
2019-01-26 22:45:19 +01:00
getNoIconClasses (icon) {
let noiconclasses = [BDFDB.disCN.avatarnoicon];
2019-01-17 23:48:29 +01:00
if (BDFDB.containsClass(icon, BDFDB.disCN.userprofilelistavatar)) noiconclasses.push(BDFDB.disCN.userprofilelistguildavatarwithouticon);
return noiconclasses;
2018-10-11 10:21:26 +02:00
}
2019-01-26 22:45:19 +01:00
2019-02-13 11:15:00 +01:00
getGuildData (id, wrapper) {
let data = BDFDB.loadData(id, this, "servers");
2019-05-20 13:50:57 +02:00
this.setBanner(id, data);
2019-02-13 11:15:00 +01:00
if (!data) return {};
let allenabled = true, settings = BDFDB.getAllData(this, "settings");
for (let i in settings) if (!settings[i]) {
allenabled = false;
break;
}
if (allenabled) return data;
let key = null;
if (BDFDB.getParentEle(BDFDB.dotCN.guilds, wrapper)) key = "changeInGuildList";
else if (BDFDB.getParentEle(BDFDB.dotCN.userprofile, wrapper) || BDFDB.getParentEle(BDFDB.dotCN.friends, wrapper)) key = "changeInMutualGuilds";
else if (BDFDB.getParentEle(BDFDB.dotCN.guildheader, wrapper)) key = "changeInGuildHeader";
else if (BDFDB.getParentEle(BDFDB.dotCN.searchpopout, wrapper) || BDFDB.getParentEle(BDFDB.dotCN.quickswitcher, wrapper)) key = "changeInSearchPopout";
return !key || settings[key] ? data : {};
}
2019-09-04 12:34:02 +02:00
2019-05-20 13:50:57 +02:00
setBanner (id, data) {
2019-03-14 14:06:14 +01:00
data = data || {};
2019-09-11 12:14:43 +02:00
let guild = BDFDB.LibraryModules.GuildStore.getGuild(id);
2019-03-14 14:06:14 +01:00
if (!guild) return;
2019-05-20 13:50:57 +02:00
if (guild.EditServersCachedBanner === undefined) guild.EditServersCachedBanner = guild.banner;
guild.banner = data.removeBanner ? null : (data.banner || guild.EditServersCachedBanner);
2019-03-14 14:06:14 +01:00
}
2019-09-04 12:34:02 +02:00
2019-03-14 14:06:14 +01:00
updateGuildSidebar() {
if (document.querySelector(BDFDB.dotCN.guildheader)) {
var ins = BDFDB.getOwnerInstance({node: document.querySelector(BDFDB.dotCN.app), name: ["GuildSidebar", "GuildHeader"], all: true, noCopies: true, depth: 99999999, time: 99999999});
if (ins) for (let i in ins) ins[i].updater.enqueueForceUpdate(ins[i])
}
}
2019-02-13 11:15:00 +01:00
2018-10-11 10:21:26 +02:00
setLabelsByLanguage () {
switch (BDFDB.getDiscordLanguage().id) {
case "hr": //croatian
return {
context_localserversettings_text: "Lokalne postavke poslužitelja",
submenu_serversettings_text: "Promijeni postavke",
submenu_resetsettings_text: "Ponovno postavite poslužitelj",
modal_header_text: "Lokalne postavke poslužitelja",
2019-10-17 11:36:34 +02:00
modal_guildname_text: "Naziv lokalnog poslužitelja",
modal_guildacronym_text: "Poslužitelj prečaca",
modal_guildicon_text: "Ikona",
2018-10-11 10:21:26 +02:00
modal_removeicon_text: "Ukloni ikonu",
2019-10-17 11:36:34 +02:00
modal_guildbanner_text: "Baner",
2019-03-14 14:06:14 +01:00
modal_removebanner_text: "Uklonite baner",
2018-10-11 10:21:26 +02:00
modal_tabheader1_text: "Poslužitelja",
modal_tabheader2_text: "Boja ikona",
modal_tabheader3_text: "Boja tooltip",
modal_colorpicker1_text: "Boja ikona",
modal_colorpicker2_text: "Boja fonta",
modal_colorpicker3_text: "Boja tooltip",
modal_colorpicker4_text: "Boja fonta",
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_localserversettings_text: "Lokal serverindstillinger",
submenu_serversettings_text: "Skift indstillinger",
submenu_resetsettings_text: "Nulstil server",
modal_header_text: "Lokal serverindstillinger",
2019-10-17 11:36:34 +02:00
modal_guildname_text: "Lokalt servernavn",
modal_guildacronym_text: "Initialer",
modal_guildicon_text: "Ikon",
2018-10-11 10:21:26 +02:00
modal_removeicon_text: "Fjern ikon",
2019-10-17 11:36:34 +02:00
modal_guildbanner_text: "Banner",
2019-03-14 14:06:14 +01:00
modal_removebanner_text: "Fjern banner",
2018-10-11 10:21:26 +02:00
modal_tabheader1_text: "Server",
modal_tabheader2_text: "Ikonfarve",
modal_tabheader3_text: "Tooltipfarve",
modal_colorpicker1_text: "Ikonfarve",
modal_colorpicker2_text: "Skriftfarve",
modal_colorpicker3_text: "Tooltipfarve",
modal_colorpicker4_text: "Skriftfarve",
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_localserversettings_text: "Lokale Servereinstellungen",
submenu_serversettings_text: "Einstellungen ändern",
submenu_resetsettings_text: "Server zurücksetzen",
modal_header_text: "Lokale Servereinstellungen",
2019-10-17 11:36:34 +02:00
modal_guildname_text: "Lokaler Servername",
modal_guildacronym_text: "Serverkürzel",
modal_guildicon_text: "Icon",
2019-03-14 14:06:14 +01:00
modal_removeicon_text: "Icon entfernen",
2019-10-17 11:36:34 +02:00
modal_guildbanner_text: "Banner",
2019-03-14 14:06:14 +01:00
modal_removebanner_text: "Banner entfernen",
2018-10-11 10:21:26 +02:00
modal_tabheader1_text: "Server",
modal_tabheader2_text: "Iconfarbe",
modal_tabheader3_text: "Tooltipfarbe",
modal_colorpicker1_text: "Iconfarbe",
modal_colorpicker2_text: "Schriftfarbe",
modal_colorpicker3_text: "Tooltipfarbe",
modal_colorpicker4_text: "Schriftfarbe",
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_localserversettings_text: "Ajustes local de servidor",
submenu_serversettings_text: "Cambiar ajustes",
submenu_resetsettings_text: "Restablecer servidor",
modal_header_text: "Ajustes local de servidor",
2019-10-17 11:36:34 +02:00
modal_guildname_text: "Nombre local del servidor",
modal_guildacronym_text: "Iniciales",
modal_guildicon_text: "Icono",
2018-10-11 10:21:26 +02:00
modal_removeicon_text: "Eliminar icono",
2019-10-17 11:36:34 +02:00
modal_guildbanner_text: "Bandera",
2019-03-14 14:06:14 +01:00
modal_removebanner_text: "Eliminar bandera",
2018-10-11 10:21:26 +02:00
modal_tabheader1_text: "Servidor",
modal_tabheader2_text: "Color del icono",
modal_tabheader3_text: "Color de tooltip",
modal_colorpicker1_text: "Color del icono",
modal_colorpicker2_text: "Color de fuente",
modal_colorpicker3_text: "Color de tooltip",
modal_colorpicker4_text: "Color de fuente",
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_localserversettings_text: "Paramètres locale du serveur",
submenu_serversettings_text: "Modifier les paramètres",
submenu_resetsettings_text: "Réinitialiser le serveur",
modal_header_text: "Paramètres locale du serveur",
2019-10-17 11:36:34 +02:00
modal_guildname_text: "Nom local du serveur",
modal_guildacronym_text: "Initiales",
modal_guildicon_text: "Icône",
2018-10-11 10:21:26 +02:00
modal_removeicon_text: "Supprimer l'icône",
2019-10-17 11:36:34 +02:00
modal_guildbanner_text: "Bannière",
2019-03-14 14:06:14 +01:00
modal_removebanner_text: "Supprimer la bannière",
2018-10-11 10:21:26 +02:00
modal_tabheader1_text: "Serveur",
modal_tabheader2_text: "Couleur de l'icône",
modal_tabheader3_text: "Couleur de tooltip",
modal_colorpicker1_text: "Couleur de l'icône",
modal_colorpicker2_text: "Couleur de la police",
modal_colorpicker3_text: "Couleur de tooltip",
modal_colorpicker4_text: "Couleur de la police",
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_localserversettings_text: "Impostazioni locale server",
submenu_serversettings_text: "Cambia impostazioni",
submenu_resetsettings_text: "Ripristina server",
modal_header_text: "Impostazioni locale server",
2019-10-17 11:36:34 +02:00
modal_guildname_text: "Nome locale server",
modal_guildacronym_text: "Iniziali",
modal_guildicon_text: "Icona",
2018-10-11 10:21:26 +02:00
modal_removeicon_text: "Rimuova l'icona",
2019-10-17 11:36:34 +02:00
modal_guildbanner_text: "Bandiera",
2019-03-14 14:06:14 +01:00
modal_removebanner_text: "Rimuovi bandiera",
2018-10-11 10:21:26 +02:00
modal_tabheader1_text: "Server",
modal_tabheader2_text: "Colore dell'icona",
modal_tabheader3_text: "Colore della tooltip",
modal_colorpicker1_text: "Colore dell'icona",
modal_colorpicker2_text: "Colore del carattere",
modal_colorpicker3_text: "Colore della tooltip",
modal_colorpicker4_text: "Colore del carattere",
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_localserversettings_text: "Lokale serverinstellingen",
submenu_serversettings_text: "Verandere instellingen",
submenu_resetsettings_text: "Reset server",
modal_header_text: "Lokale serverinstellingen",
2019-10-17 11:36:34 +02:00
modal_guildname_text: "Lokale servernaam",
modal_guildacronym_text: "Initialen",
modal_guildicon_text: "Icoon",
2018-10-11 10:21:26 +02:00
modal_removeicon_text: "Verwijder icoon",
2019-10-17 11:36:34 +02:00
modal_guildbanner_text: "Banier",
2019-03-14 14:06:14 +01:00
modal_removebanner_text: "Verwijder banier",
2018-10-11 10:21:26 +02:00
modal_tabheader1_text: "Server",
modal_tabheader2_text: "Icoonkleur",
modal_tabheader3_text: "Tooltipkleur",
modal_colorpicker1_text: "Icoonkleur",
modal_colorpicker2_text: "Doopvontkleur",
modal_colorpicker3_text: "Tooltipkleur",
modal_colorpicker4_text: "Doopvontkleur",
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_localserversettings_text: "Lokal serverinnstillinger",
submenu_serversettings_text: "Endre innstillinger",
submenu_resetsettings_text: "Tilbakestill server",
modal_header_text: "Lokal serverinnstillinger",
2019-10-17 11:36:34 +02:00
modal_guildname_text: "Lokalt servernavn",
modal_guildacronym_text: "Initialer",
modal_guildicon_text: "Ikon",
2018-10-11 10:21:26 +02:00
modal_removeicon_text: "Fjern ikon",
2019-10-17 11:36:34 +02:00
modal_guildbanner_text: "Banner",
2019-03-14 14:06:14 +01:00
modal_removebanner_text: "Fjern banner",
2018-10-11 10:21:26 +02:00
modal_tabheader1_text: "Server",
modal_tabheader2_text: "Ikonfarge",
modal_tabheader3_text: "Tooltipfarge",
modal_colorpicker1_text: "Ikonfarge",
modal_colorpicker2_text: "Skriftfarge",
modal_colorpicker3_text: "Tooltipfarge",
modal_colorpicker4_text: "Skriftfarge",
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_localserversettings_text: "Lokalne ustawienia serwera",
submenu_serversettings_text: "Zmień ustawienia",
2019-03-14 14:06:14 +01:00
submenu_resetsettings_text: "Resetuj ustawienia",
2018-10-11 10:21:26 +02:00
modal_header_text: "Lokalne ustawienia serwera",
2019-10-17 11:36:34 +02:00
modal_guildname_text: "Lokalna nazwa serwera",
modal_guildacronym_text: "Krótka nazwa",
modal_guildicon_text: "Ikona",
2018-10-11 10:21:26 +02:00
modal_removeicon_text: "Usuń ikonę",
2019-10-17 11:36:34 +02:00
modal_guildbanner_text: "Baner",
2019-03-14 14:06:14 +01:00
modal_removebanner_text: "Usuń baner",
2018-10-11 10:21:26 +02:00
modal_tabheader1_text: "Serwer",
modal_tabheader2_text: "Kolor ikony",
modal_tabheader3_text: "Kolor podpowiedzi",
modal_colorpicker1_text: "Kolor ikony",
modal_colorpicker2_text: "Kolor czcionki",
modal_colorpicker3_text: "Kolor podpowiedzi",
modal_colorpicker4_text: "Kolor czcionki",
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_localserversettings_text: "Configurações local do servidor",
submenu_serversettings_text: "Mudar configurações",
submenu_resetsettings_text: "Redefinir servidor",
modal_header_text: "Configurações local do servidor",
2019-10-17 11:36:34 +02:00
modal_guildname_text: "Nome local do servidor",
modal_guildacronym_text: "Iniciais",
modal_guildicon_text: "Icone",
2018-10-11 10:21:26 +02:00
modal_removeicon_text: "Remover ícone",
2019-10-17 11:36:34 +02:00
modal_guildbanner_text: "Bandeira",
2019-03-14 14:06:14 +01:00
modal_removebanner_text: "Remover bandeira",
2018-10-11 10:21:26 +02:00
modal_tabheader1_text: "Servidor",
modal_tabheader2_text: "Cor do ícone",
modal_tabheader3_text: "Cor da tooltip",
modal_colorpicker1_text: "Cor do ícone",
modal_colorpicker2_text: "Cor da fonte",
modal_colorpicker3_text: "Cor da tooltip",
modal_colorpicker4_text: "Cor da fonte",
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_localserversettings_text: "Paikallinen palvelimen asetukset",
submenu_serversettings_text: "Vaihda asetuksia",
submenu_resetsettings_text: "Nollaa palvelimen",
modal_header_text: "Paikallinen palvelimen asetukset",
2019-10-17 11:36:34 +02:00
modal_guildname_text: "Paikallinen palvelimenimi",
modal_guildacronym_text: "Nimikirjaimet",
modal_guildicon_text: "Ikonin",
2018-10-11 10:21:26 +02:00
modal_removeicon_text: "Poista kuvake",
2019-10-17 11:36:34 +02:00
modal_guildbanner_text: "Banneri",
2019-03-14 14:06:14 +01:00
modal_removebanner_text: "Poista banneri",
2018-10-11 10:21:26 +02:00
modal_tabheader1_text: "Palvelimen",
modal_tabheader2_text: "Ikoninväri",
modal_tabheader3_text: "Tooltipväri",
modal_colorpicker1_text: "Ikoninväri",
modal_colorpicker2_text: "Fontinväri",
modal_colorpicker3_text: "Tooltipväri",
modal_colorpicker4_text: "Fontinvä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_localserversettings_text: "Lokal serverinställningar",
submenu_serversettings_text: "Ändra inställningar",
submenu_resetsettings_text: "Återställ server",
modal_header_text: "Lokal serverinställningar",
2019-10-17 11:36:34 +02:00
modal_guildname_text: "Lokalt servernamn",
modal_guildacronym_text: "Initialer",
modal_guildicon_text: "Ikon",
2018-10-11 10:21:26 +02:00
modal_removeicon_text: "Ta bort ikonen",
2019-10-17 11:36:34 +02:00
modal_guildbanner_text: "Banderoll",
2019-03-14 14:06:14 +01:00
modal_removebanner_text: "Ta bort banderoll",
2018-10-11 10:21:26 +02:00
modal_tabheader1_text: "Server",
modal_tabheader2_text: "Ikonfärg",
modal_tabheader3_text: "Tooltipfärg",
modal_colorpicker1_text: "Ikonfärg",
modal_colorpicker2_text: "Fontfärg",
modal_colorpicker3_text: "Tooltipfärg",
modal_colorpicker4_text: "Fontfä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_localserversettings_text: "Yerel Sunucu Ayarları",
submenu_serversettings_text: "Ayarları Değiştir",
submenu_resetsettings_text: "Sunucu Sıfırla",
modal_header_text: "Yerel Sunucu Ayarları",
2019-10-17 11:36:34 +02:00
modal_guildname_text: "Yerel Sunucu Adı",
modal_guildacronym_text: "Baş harfleri",
modal_guildicon_text: "Simge",
2018-10-11 10:21:26 +02:00
modal_removeicon_text: "Simge kaldır",
2019-10-17 11:36:34 +02:00
modal_guildbanner_text: "Afişi",
2019-03-14 14:06:14 +01:00
modal_removebanner_text: "Afişi kaldır",
2018-10-11 10:21:26 +02:00
modal_tabheader1_text: "Sunucu",
modal_tabheader2_text: "Simge rengi",
modal_tabheader3_text: "Tooltip rengi",
modal_colorpicker1_text: "Simge rengi",
modal_colorpicker2_text: "Yazı rengi",
modal_colorpicker3_text: "Tooltip rengi",
modal_colorpicker4_text: "Yazı rengi",
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_localserversettings_text: "Místní nastavení serveru",
submenu_serversettings_text: "Změnit nastavení",
submenu_resetsettings_text: "Obnovit server",
modal_header_text: "Místní nastavení serveru",
2019-10-17 11:36:34 +02:00
modal_guildname_text: "Místní název serveru",
modal_guildacronym_text: "Iniciály",
modal_guildicon_text: "Ikony",
2018-10-11 10:21:26 +02:00
modal_removeicon_text: "Odstranit ikonu",
2019-10-17 11:36:34 +02:00
modal_guildbanner_text: "Prapor",
2019-03-14 14:06:14 +01:00
modal_removebanner_text: "Odstraňte prapor",
2018-10-11 10:21:26 +02:00
modal_tabheader1_text: "Server",
modal_tabheader2_text: "Barva ikony",
modal_tabheader3_text: "Barva tooltip",
modal_colorpicker1_text: "Barva ikony",
modal_colorpicker2_text: "Barva fontu",
modal_colorpicker3_text: "Barva tooltip",
modal_colorpicker4_text: "Barva fontu",
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_localserversettings_text: "Настройки за локални cървър",
submenu_serversettings_text: "Промяна на настройките",
submenu_resetsettings_text: "Възстановяване на cървър",
modal_header_text: "Настройки за локални cървър",
2019-10-17 11:36:34 +02:00
modal_guildname_text: "Локално име на cървър",
modal_guildacronym_text: "Инициали",
modal_guildicon_text: "Икона",
2018-10-11 10:21:26 +02:00
modal_removeicon_text: "Премахване на иконата",
2019-10-17 11:36:34 +02:00
modal_guildbanner_text: "Знаме",
2019-03-14 14:06:14 +01:00
modal_removebanner_text: "Премахване на знаме",
2018-10-11 10:21:26 +02:00
modal_tabheader1_text: "Cървър",
modal_tabheader2_text: "Цвят на иконата",
modal_tabheader3_text: "Цвят на подсказка",
modal_colorpicker1_text: "Цвят на иконата",
modal_colorpicker2_text: "Цвят на шрифта",
modal_colorpicker3_text: "Цвят на подсказка",
modal_colorpicker4_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_localserversettings_text: "Настройки локального cервер",
submenu_serversettings_text: "Изменить настройки",
submenu_resetsettings_text: "Сбросить cервер",
modal_header_text: "Настройки локального cервер",
2019-10-17 11:36:34 +02:00
modal_guildname_text: "Имя локального cервер",
modal_guildacronym_text: "Инициалы",
modal_guildicon_text: "Значок",
2018-10-11 10:21:26 +02:00
modal_removeicon_text: "Удалить значок",
2019-10-17 11:36:34 +02:00
modal_guildbanner_text: "Баннер",
2019-03-14 14:06:14 +01:00
modal_removebanner_text: "Удалить баннер",
2018-10-11 10:21:26 +02:00
modal_tabheader1_text: "Cервер",
modal_tabheader2_text: "Цвет значков",
modal_tabheader3_text: "Цвет подсказка",
modal_colorpicker1_text: "Цвет значков",
modal_colorpicker2_text: "Цвет шрифта",
modal_colorpicker3_text: "Цвет подсказка",
modal_colorpicker4_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_localserversettings_text: "Налаштування локального cервер",
submenu_serversettings_text: "Змінити налаштування",
submenu_resetsettings_text: "Скидання cервер",
modal_header_text: "Налаштування локального cервер",
2019-10-17 11:36:34 +02:00
modal_guildname_text: "Локальне ім'я cервер",
modal_guildacronym_text: "Ініціали",
modal_guildicon_text: "Іконка",
2018-10-11 10:21:26 +02:00
modal_removeicon_text: "Видалити піктограму",
2019-10-17 11:36:34 +02:00
modal_guildbanner_text: "Банер",
2019-03-14 14:06:14 +01:00
modal_removebanner_text: "Видалити банер",
2018-10-11 10:21:26 +02:00
modal_tabheader1_text: "Cервер",
modal_tabheader2_text: "Колір ікони",
modal_tabheader3_text: "Колір підказка",
modal_colorpicker1_text: "Колір ікони",
modal_colorpicker2_text: "Колір шрифту",
modal_colorpicker3_text: "Колір підказка",
modal_colorpicker4_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_localserversettings_text: "ローカルサーバー設定",
submenu_serversettings_text: "設定を変更する",
submenu_resetsettings_text: "サーバーをリセットする",
modal_header_text: "ローカルサーバー設定",
2019-10-17 11:36:34 +02:00
modal_guildname_text: "ローカルサーバー名",
modal_guildacronym_text: "イニシャル",
modal_guildicon_text: "アイコン",
2018-10-11 10:21:26 +02:00
modal_removeicon_text: "アイコンを削除",
2019-10-17 11:36:34 +02:00
modal_guildbanner_text: "バナー",
2019-03-14 14:06:14 +01:00
modal_removebanner_text: "バナーを削除",
2018-10-11 10:21:26 +02:00
modal_tabheader1_text: "サーバー",
modal_tabheader2_text: "アイコンの色",
modal_tabheader3_text: "ツールチップの色",
modal_colorpicker1_text: "アイコンの色",
modal_colorpicker2_text: "フォントの色",
modal_colorpicker3_text: "ツールチップの色",
modal_colorpicker4_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_localserversettings_text: "本地服務器設置",
submenu_serversettings_text: "更改設置",
submenu_resetsettings_text: "重置服務器",
modal_header_text: "本地服務器設置",
2019-10-17 11:36:34 +02:00
modal_guildname_text: "服務器名稱",
modal_guildacronym_text: "聲母",
modal_guildicon_text: "圖標",
2018-10-11 10:21:26 +02:00
modal_removeicon_text: "刪除圖標",
2019-10-17 11:36:34 +02:00
modal_guildbanner_text: "旗幟",
2019-03-14 14:06:14 +01:00
modal_removebanner_text: "刪除橫幅",
2018-10-11 10:21:26 +02:00
modal_tabheader1_text: "服務器",
modal_tabheader2_text: "圖標顏色",
modal_tabheader3_text: "工具提示顏色",
modal_colorpicker1_text: "圖標顏色",
modal_colorpicker2_text: "字體顏色",
modal_colorpicker3_text: "工具提示顏色",
modal_colorpicker4_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_localserversettings_text: "로컬 서버 설정",
submenu_serversettings_text: "설정 변경",
submenu_resetsettings_text: "서버 재설정",
modal_header_text: "로컬 서버 설정",
2019-10-17 11:36:34 +02:00
modal_guildname_text: "로컬 서버 이름",
modal_guildacronym_text: "머리 글자",
modal_guildicon_text: "상",
2018-10-11 10:21:26 +02:00
modal_removeicon_text: "상 삭제",
2019-10-17 11:36:34 +02:00
modal_guildbanner_text: "기치",
2019-03-14 14:06:14 +01:00
modal_removebanner_text: "배너 삭제",
2018-10-11 10:21:26 +02:00
modal_tabheader1_text: "서버",
modal_tabheader2_text: "상 색깔",
modal_tabheader3_text: "툴팁 색깔",
modal_colorpicker1_text: "상 색깔",
modal_colorpicker2_text: "글꼴 색깔",
modal_colorpicker3_text: "툴팁 색깔",
modal_colorpicker4_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_localserversettings_text: "Local Serversettings",
submenu_serversettings_text: "Change Settings",
submenu_resetsettings_text: "Reset Server",
modal_header_text: "Local Serversettings",
2019-10-17 11:36:34 +02:00
modal_guildname_text: "Local Servername",
modal_guildacronym_text: "Initials",
modal_guildicon_text: "Icon",
2018-10-11 10:21:26 +02:00
modal_removeicon_text: "Remove Icon",
2019-10-17 11:36:34 +02:00
modal_guildbanner_text: "Banner",
2019-03-14 14:06:14 +01:00
modal_removebanner_text: "Remove Banner",
2018-10-11 10:21:26 +02:00
modal_tabheader1_text: "Server",
modal_tabheader2_text: "Iconcolor",
modal_tabheader3_text: "Tooltipcolor",
modal_colorpicker1_text: "Iconcolor",
modal_colorpicker2_text: "Fontcolor",
modal_colorpicker3_text: "Tooltipcolor",
modal_colorpicker4_text: "Fontcolor",
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
};
}
}
}