/**
* @name ServerFolders
* @authorId 278543574059057154
* @invite Jx3TjNS
* @donate https://www.paypal.me/MircoWittrien
* @patreon https://www.patreon.com/MircoWittrien
* @website https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/ServerFolders
* @source https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/Plugins/ServerFolders/ServerFolders.plugin.js
* @updateUrl https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/Plugins/ServerFolders/ServerFolders.plugin.js
*/
module.exports = (_ => {
const config = {
"info": {
"name": "ServerFolders",
"author": "DevilBro",
"version": "6.8.8",
"description": "Patch Discords native Folders in a way to open Servers within a Folder in a new bar to the right, also adds a bunch of new features to more easily organize, customize and manage your Folders"
},
"changeLog": {
"improved": {
"Canary Changes": "Preparing Plugins for the changes that are already done on Discord Canary"
}
}
};
return !window.BDFDB_Global || (!window.BDFDB_Global.loaded && !window.BDFDB_Global.started) ? class {
getName () {return config.info.name;}
getAuthor () {return config.info.author;}
getVersion () {return config.info.version;}
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) => {
if (!e && b && b.indexOf(`* @name BDFDB`) > -1) require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => BdApi.showToast("Finished downloading BDFDB Library", {type: "success"}));
else BdApi.alert("Error", "Could not download BDFDB Library Plugin, try again later or download it manually from GitHub: https://github.com/mwittrien/BetterDiscordAddons/tree/master/Library/");
});
}
load () {
if (!window.BDFDB_Global || !Array.isArray(window.BDFDB_Global.pluginQueue)) window.BDFDB_Global = Object.assign({}, window.BDFDB_Global, {pluginQueue: []});
if (!window.BDFDB_Global.downloadModal) {
window.BDFDB_Global.downloadModal = true;
BdApi.showConfirmationModal("Library Missing", `The Library Plugin needed for ${config.info.name} is missing. Please click "Download Now" to install it.`, {
confirmText: "Download Now",
cancelText: "Cancel",
onCancel: _ => {delete window.BDFDB_Global.downloadModal;},
onConfirm: _ => {
delete window.BDFDB_Global.downloadModal;
this.downloadLibrary();
}
});
}
if (!window.BDFDB_Global.pluginQueue.includes(config.info.name)) window.BDFDB_Global.pluginQueue.push(config.info.name);
}
start () {this.load();}
stop () {}
getSettingsPanel () {
let template = document.createElement("template");
template.innerHTML = `
The Library Plugin needed for ${config.info.name} is missing.\nPlease click
Download Now to install it.
`;
template.content.firstElementChild.querySelector("a").addEventListener("click", this.downloadLibrary);
return template.content.firstElementChild;
}
} : (([Plugin, BDFDB]) => {
var _this;
var folderStates, folderReads, guildStates;
var folderConfigs = {}, customIcons = {}, settings = {};
const folderIcons = [
{openicon: ``,
closedicon: ``},
{openicon: ``,
closedicon: ``},
{openicon: ``,
closedicon: ``},
{openicon: ``,
closedicon: ``},
{openicon: ``,
closedicon: ``},
{openicon: ``,
closedicon: ``},
{openicon: ``,
closedicon: ``}
];
var folderGuildContent = null;
const folderGuildContentComponent = class FolderGuildsContent extends BdApi.React.Component {
componentDidMount() {
folderGuildContent = this;
}
render() {
let closing = this.props.closing;
delete this.props.closing;
let folders = Array.from(BDFDB.LibraryModules.FolderUtils.getExpandedFolders()).map(folderId => BDFDB.LibraryModules.FolderStore.getGuildFolderById(folderId)).filter(folder => folder && folder.guildIds);
this.props.folders = folders.length || closing ? folders : (this.props.folders || []);
BDFDB.TimeUtils.clear(this._rerenderTimeout);
if (!folders.length && this.props.folders.length && !closing) this._rerenderTimeout = BDFDB.TimeUtils.timeout(_ => {
this.props.closing = true;
BDFDB.ReactUtils.forceUpdate(this);
}, 300);
return BDFDB.ReactUtils.createElement("nav", {
className: BDFDB.DOMUtils.formatClassName(BDFDB.disCN.guildswrapper, BDFDB.disCN.guilds, this.props.themeOverride && BDFDB.disCN.themedark, BDFDB.disCN._serverfoldersfoldercontent, (!folders.length || closing) && BDFDB.disCN._serverfoldersfoldercontentclosed),
children: BDFDB.ReactUtils.createElement("ul", {
role: "tree",
tabindex: 0,
"data-list-id": "guildfoldersnav",
className: BDFDB.disCN.guildstree,
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Scrollers.None, {
className: BDFDB.disCN.guildsscroller,
children: this.props.folders.map(folder => {
let data = _this.getFolderConfig(folder.folderId);
return folder.guildIds.map(guildId => {
return [
this.draggedGuild == guildId ? null : BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.GuildComponents.Guild, {
guild: BDFDB.LibraryModules.GuildStore.getGuild(guildId),
state: true,
list: true,
tooltipConfig: Object.assign({
offset: 12
}, data.copyTooltipColor && {
backgroundColor: data.color3,
fontColor: data.color4,
}),
onClick: event => {
if (BDFDB.ListenerUtils.isPressed(46)) {
BDFDB.ListenerUtils.stopEvent(event);
_this.removeGuildFromFolder(folder.folderId, guildId);
}
else {
if (settings.closeAllFolders) {
for (let openFolderId of BDFDB.LibraryModules.FolderUtils.getExpandedFolders()) if (openFolderId != folder.folderId || !settings.forceOpenFolder) BDFDB.LibraryModules.GuildUtils.toggleGuildFolderExpand(openFolderId);
}
else if (settings.closeTheFolder && !settings.forceOpenFolder && BDFDB.LibraryModules.FolderUtils.isFolderExpanded(folder.folderId)) BDFDB.LibraryModules.GuildUtils.toggleGuildFolderExpand(folder.folderId);
else BDFDB.ReactUtils.forceUpdate(this);
}
},
onMouseDown: (event, instance) => {
event = event.nativeEvent || event;
let mouseMove = event2 => {
if (Math.sqrt((event.pageX - event2.pageX)**2) > 20 || Math.sqrt((event.pageY - event2.pageY)**2) > 20) {
BDFDB.ListenerUtils.stopEvent(event);
this.draggedGuild = guildId;
let dragPreview = _this.createDragPreview(BDFDB.ReactUtils.findDOMNode(instance).cloneNode(true), event2);
BDFDB.ReactUtils.forceUpdate(this);
document.removeEventListener("mousemove", mouseMove);
document.removeEventListener("mouseup", mouseUp);
let dragging = event3 => {
_this.updateDragPreview(dragPreview, event3);
let placeholder = BDFDB.DOMUtils.getParent(BDFDB.dotCN._serverfoldersguildplaceholder, event3.target);
let hoveredGuild = (BDFDB.ReactUtils.findValue(BDFDB.DOMUtils.getParent(BDFDB.dotCNS._serverfoldersfoldercontent + BDFDB.dotCN.guildouter, placeholder ? placeholder.previousSibling : event3.target), "guild", {up: true}) || {}).id;
if (hoveredGuild) {
let hoveredGuildFolder = BDFDB.GuildUtils.getFolder(hoveredGuild);
if (!hoveredGuildFolder || hoveredGuildFolder.folderId != folder.folderId) hoveredGuild = null;
}
let update = hoveredGuild != this.hoveredGuild;
if (hoveredGuild) this.hoveredGuild = hoveredGuild;
else delete this.hoveredGuild;
if (update) BDFDB.ReactUtils.forceUpdate(this);
};
let releasing = event3 => {
BDFDB.ListenerUtils.stopEvent(event3);
BDFDB.DOMUtils.remove(dragPreview);
if (this.hoveredGuild) {
let guildIds = [].concat(folder.guildIds);
BDFDB.ArrayUtils.remove(guildIds, this.draggedGuild, true);
guildIds.splice(guildIds.indexOf(this.hoveredGuild) + 1, 0, this.draggedGuild);
_this.updateFolder(Object.assign({}, folder, {guildIds}));
}
delete this.draggedGuild;
delete this.hoveredGuild;
BDFDB.ReactUtils.forceUpdate(this);
document.removeEventListener("mousemove", dragging);
document.removeEventListener("mouseup", releasing);
};
document.addEventListener("mousemove", dragging);
document.addEventListener("mouseup", releasing);
}
};
let mouseUp = _ => {
document.removeEventListener("mousemove", mouseMove);
document.removeEventListener("mouseup", mouseUp);
};
document.addEventListener("mousemove", mouseMove);
document.addEventListener("mouseup", mouseUp);
}
}),
this.hoveredGuild != guildId ? null : BDFDB.ReactUtils.createElement("div", {
className: BDFDB.disCNS.guildouter + BDFDB.disCN._serverfoldersguildplaceholder,
children: BDFDB.ReactUtils.createElement("div", {
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.GuildComponents.Items.DragPlaceholder, {})
})
})
]
});
}).filter(n => n).reduce((r, a) => r.concat(a, settings.addSeparators ? BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.GuildComponents.Items.Separator, {}) : null), [0]).slice(1, -1).flat(10).filter(n => n)
})
})
});
}
};
const folderIconPickerComponent = class FolderIconPicker extends BdApi.React.Component {
render() {
let folderIcons = _this.loadAllIcons();
for (let id in folderIcons) if (!folderIcons[id].customID) {
folderIcons[id].openicon = _this.createBase64SVG(folderIcons[id].openicon);
folderIcons[id].closedicon = _this.createBase64SVG(folderIcons[id].closedicon);
}
folderIcons["-1"] = {};
return BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Flex, {
wrap: BDFDB.LibraryComponents.Flex.Wrap.WRAP,
children: Object.keys(folderIcons).sort().map(id => {
return BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Card, {
className: BDFDB.DOMUtils.formatClassName(BDFDB.disCN._serverfoldersiconswatch, this.props.selectedIcon == id && BDFDB.disCN._serverfoldersiconswatchselected),
backdrop: false,
iconID: id,
grow: 0,
shrink: 0,
noRemove: !folderIcons[id].customID || this.props.selectedIcon == id,
onMouseEnter: _ => {
this.props.hoveredIcon = id;
BDFDB.ReactUtils.forceUpdate(this);
},
onMouseLeave: _ => {
delete this.props.hoveredIcon;
BDFDB.ReactUtils.forceUpdate(this);
},
onClick: _ => {
this.props.selectedIcon = id;
this.props.onSelect(this.props.selectedIcon);
BDFDB.ReactUtils.forceUpdate(this);
},
onRemove: _ => {
delete customIcons[id];
BDFDB.DataUtils.save(customIcons, _this, "customicons");
BDFDB.ReactUtils.forceUpdate(this);
},
children: folderIcons[id].closedicon ? BDFDB.ReactUtils.createElement("div", {
className: BDFDB.disCN._serverfoldersiconswatchinner,
style: {background: `url(${this.props.hoveredIcon == id ? folderIcons[id].openicon : folderIcons[id].closedicon}) center/cover no-repeat`}
}) : BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SvgIcon, {
className: BDFDB.disCN._serverfoldersiconswatchinner,
name: BDFDB.LibraryComponents.SvgIcon.Names.FOLDER,
style: {color: "rbg(0, 0, 0)"}
})
});
})
})
}
};
const redCross = `'data:image/svg+xml; utf8, '`;
const folderIconCustomPreviewComponent = class FolderIconCustomPreview extends BdApi.React.Component {
componentDidMount() {
this._previewInterval = BDFDB.TimeUtils.interval(_ => {
this.props.tick = !this.props.tick;
BDFDB.ReactUtils.forceUpdate(this);
}, 2000);
}
componentWillUnmount () {
BDFDB.TimeUtils.clear(this._previewInterval);
}
checkImage(base64OrUrl, callback) {
if (base64OrUrl.indexOf("https://") == 0 || base64OrUrl.indexOf("http://") == 0) BDFDB.LibraryRequires.request(base64OrUrl.trim(), (error, response, body) => {
if (response && response.headers["content-type"] && response.headers["content-type"].indexOf("image") != -1 && response.headers["content-type"] != "image/gif") {
this.resizeImage("data:" + response.headers["content-type"] + ";base64," + (new Buffer(body).toString("base64")), callback);
}
else callback(base64OrUrl);
});
else this.resizeImage(base64OrUrl, callback);
}
resizeImage(base64, callback) {
let type = base64.split("data:").slice(1).join(" ").split(";")[0];
if (type == "image/gif") callback(base64);
else {
let img = new Image();
img.onload = function() {
let width = 0, height = 0;
if (this.width >= this.height) {
width = (128 / this.height) * this.width;
height = 128;
}
else {
width = 128;
height = (128 / this.width) * this.height;
}
let canvas = document.createElement("canvas");
let ctx = canvas.getContext("2d");
ctx.canvas.width = width;
ctx.canvas.height = height;
document.body.appendChild(canvas);
ctx.drawImage(img, 0, 0, width, height);
callback(canvas.toDataURL(type));
};
img.onerror = function() {
callback(base64);
};
img.src = base64;
}
}
render() {
let openInput, closeInput;
return [
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormItem, {
title: _this.labels.modal_customopen,
className: BDFDB.disCN.marginbottom20,
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TextInput, {
type: "file",
filter: "image",
value: this.props.open,
ref: instance => {if (instance) openInput = instance;},
onChange: value => {
this.props.open = value;
BDFDB.ReactUtils.forceUpdate(this);
}
})
}),
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormItem, {
title: _this.labels.modal_customclosed,
className: BDFDB.disCN.marginbottom20,
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TextInput, {
type: "file",
filter: "image",
value: this.props.closed,
ref: instance => {if (instance) closeInput = instance;},
onChange: value => {
this.props.closed = value;
BDFDB.ReactUtils.forceUpdate(this);
}
})
}),
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormItem, {
title: _this.labels.modal_custompreview,
className: BDFDB.disCN.marginbottom20,
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Flex, {
justify: BDFDB.LibraryComponents.Flex.Justify.BETWEEN,
align: BDFDB.LibraryComponents.Flex.Align.CENTER,
children: [
BDFDB.ReactUtils.createElement("div", {
className: BDFDB.disCNS._serverfoldersiconswatch + BDFDB.disCN._serverfoldersiconswatchpreview,
children: BDFDB.ReactUtils.createElement("div", {
className: BDFDB.disCN._serverfoldersiconswatchinner,
style: {background: `url(${this.props.open || redCross}) center/cover no-repeat`}
})
}),
BDFDB.ReactUtils.createElement("div", {
className: BDFDB.disCNS._serverfoldersiconswatch + BDFDB.disCN._serverfoldersiconswatchpreview,
children: BDFDB.ReactUtils.createElement("div", {
className: BDFDB.disCN._serverfoldersiconswatchinner,
style: {background: `url(${this.props.closed || redCross}) center/cover no-repeat`}
})
}),
BDFDB.ReactUtils.createElement("div", {
className: BDFDB.disCNS._serverfoldersiconswatch + BDFDB.disCN._serverfoldersiconswatchpreview,
children: BDFDB.ReactUtils.createElement("div", {
className: BDFDB.disCN._serverfoldersiconswatchinner,
style: {background: `url(${(this.props.tick ? this.props.open : this.props.closed) || redCross}) center/cover no-repeat`}
})
}),
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Button, {
children: BDFDB.LanguageUtils.LanguageStrings.ADD,
onClick: _ => {
if (openInput.props.value && closeInput.props.value) {
this.checkImage(openInput.props.value, openIcon => {
this.checkImage(closeInput.props.value, closedIcon => {
customIcons[_this.generateId("customicon")] = {openicon: openIcon, closedicon: closedIcon};
BDFDB.DataUtils.save(customIcons, _this, "customicons");
this.props.open = null;
this.props.closed = null;
BDFDB.PatchUtils.forceAllUpdates(_this, "GuildFolderSettingsModal");
BDFDB.NotificationUtils.toast("Custom Icon was added to Selection", {type: "success"});
});
})
}
else BDFDB.NotificationUtils.toast("Add an Image for the open and closed Icon", {type: "danger"});
}
})
]
})
})
]
}
};
return class ServerFolders extends Plugin {
onLoad () {
_this = this;
folderStates = {};
folderReads = {};
guildStates = {};
this.defaults = {
settings: {
closeOtherFolders: {value: false, description: "Close other folders when opening a folder"},
closeTheFolder: {value: false, description: "Close the folder when selecting a server"},
closeAllFolders: {value: false, description: "Close all folders when selecting a server"},
forceOpenFolder: {value: false, description: "Force a folder to open when switching to a server of that folder"},
showCountBadge: {value: true, description: "Display badge for amount of servers in a folder"},
extraColumn: {value: true, description: "Move the servers from opened folders in an extra column"},
addSeparators: {value: true, description: "Add separators between servers of different folders in extra column"}
}
};
this.patchedModules = {
after: {
AppView: "default",
GuildFolder: "type",
Guilds: "render",
Guild: ["componentDidMount", "render"],
GuildFolderSettingsModal: ["componentDidMount", "render"]
}
};
this.css = `
.${this.name}-modal ${BDFDB.dotCN._serverfoldersiconswatch} {
position: relative;
margin: 3px 3px;
padding: 3px 3px;
width: 55px;
height: 55px;
border-radius: 12px;
cursor: pointer;
}
.${this.name}-modal ${BDFDB.dotCN._serverfoldersiconswatch + BDFDB.dotCN._serverfoldersiconswatchpreview} {
width: 95px;
height: 95px;
cursor: default;
}
.${this.name}-modal ${BDFDB.dotCN._serverfoldersiconswatch}:hover {
background-color: var(--background-modifier-hover);
}
.${this.name}-modal ${BDFDB.dotCN._serverfoldersiconswatch + BDFDB.dotCN._serverfoldersiconswatchselected} {
background-color: var(--background-modifier-selected);
}
.${this.name}-modal ${BDFDB.dotCNS._serverfoldersiconswatch + BDFDB.dotCN._serverfoldersiconswatchinner} {
width: 100%;
height: 100%;
border-radius: 12px;
background-position: center;
background-size: cover;
background-repeat: no-repeat;
}
.${this.name}-modal ${BDFDB.dotCN._serverfoldersiconswatch} svg${BDFDB.dotCN._serverfoldersiconswatchinner} {
transform: translateY(-2px) scale(0.8);
}
.${this.name}-modal ${BDFDB.dotCNS._serverfoldersiconswatch + BDFDB.dotCN.hovercardbutton} {
position: absolute;
top: -10px;
right: -10px;
}
${BDFDB.dotCN._serverfoldersdragpreview} {
pointer-events: none !important;
position: absolute !important;
opacity: 0.5 !important;
z-index: 10000 !important;
}
${BDFDB.dotCN.guildswrapper + BDFDB.dotCN._serverfoldersfoldercontent} {
transition: width 0.3s linear !important;
}
${BDFDB.dotCN.guildswrapper + BDFDB.dotCN._serverfoldersfoldercontent + BDFDB.dotCN._serverfoldersfoldercontentclosed} {
width: 0px !important;
}
${BDFDB.dotCN.appcontainer} {
display: flex !important;
}
${BDFDB.dotCN.guildswrapper} {
position: static !important;
contain: unset !important;
}
${BDFDB.dotCN.chatbase} {
position: static !important;
contain: unset !important;
width: 100% !important;
}
`;
}
onStart () {
let forceClosing = false;
BDFDB.PatchUtils.patch(this, BDFDB.LibraryModules.GuildUtils, "toggleGuildFolderExpand", {after: e => {
if (settings.closeOtherFolders && !forceClosing) {
forceClosing = true;
for (let openFolderId of BDFDB.LibraryModules.FolderUtils.getExpandedFolders()) if (openFolderId != e.methodArguments[0]) BDFDB.LibraryModules.GuildUtils.toggleGuildFolderExpand(openFolderId);
forceClosing = false;
}
}});
this.forceUpdateAll();
}
onStop () {
this.forceUpdateAll();
BDFDB.DOMUtils.removeClassFromDOM(BDFDB.disCN._serverfoldersfoldercontentisopen);
}
onSwitch () {
if (typeof BDFDB === "object" && settings.forceOpenFolder) {
let folder = BDFDB.GuildUtils.getFolder(BDFDB.LibraryModules.LastGuildStore.getGuildId());
if (folder && !BDFDB.LibraryModules.FolderUtils.isFolderExpanded(folder.folderId)) BDFDB.LibraryModules.GuildUtils.toggleGuildFolderExpand(folder.folderId);
}
}
getSettingsPanel (collapseStates = {}) {
let settingsPanel, settingsItems = [];
for (let key in settings) settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
type: "Switch",
plugin: this,
keys: ["settings", key],
label: this.defaults.settings[key].description,
value: settings[key]
}));
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsItem, {
type: "Button",
color: BDFDB.LibraryComponents.Button.Colors.RED,
label: "Reset all Folders",
onClick: _ => {
BDFDB.ModalUtils.confirm(this, "Are you sure you want to reset all folders?", _ => {
BDFDB.DataUtils.remove(this, "folders");
});
},
children: BDFDB.LanguageUtils.LanguageStrings.RESET
}));
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsItem, {
type: "Button",
color: BDFDB.LibraryComponents.Button.Colors.RED,
label: "Remove all custom Icons",
onClick: _ => {
BDFDB.ModalUtils.confirm(this, "Are you sure you want to remove all custom icons?", _ => {
BDFDB.DataUtils.remove(this, "customicons");
});
},
children: BDFDB.LanguageUtils.LanguageStrings.REMOVE
}));
return settingsPanel = BDFDB.PluginUtils.createSettingsPanel(this, settingsItems);
}
onSettingsClosed () {
if (this.SettingsUpdated) {
delete this.SettingsUpdated;
folderStates = {};
this.forceUpdateAll();
}
}
forceUpdateAll () {
settings = BDFDB.DataUtils.get(this, "settings");
folderConfigs = BDFDB.DataUtils.load(this, "folders");
customIcons = BDFDB.DataUtils.load(this, "customicons");
BDFDB.ReactUtils.forceUpdate(folderGuildContent);
BDFDB.PatchUtils.forceAllUpdates(this);
BDFDB.DiscordUtils.rerenderAll();
}
onGuildContextMenu (e) {
if (document.querySelector(BDFDB.dotCN.modalwrapper)) return;
if (e.instance.props.guild) {
let folders = BDFDB.LibraryModules.FolderStore.guildFolders.filter(n => n.folderId);
let folder = BDFDB.GuildUtils.getFolder(e.instance.props.guild.id);
let unfolderedGuilds = BDFDB.LibraryModules.FolderStore.getSortedGuilds().filter(n => !n.folderId).map(n => n.guilds[0]).filter(n => n);
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.servercontext_serverfolders,
id: BDFDB.ContextMenuUtils.createItemId(this.name, "submenu-add"),
children: folder ? [
BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
label: this.labels.serversubmenu_removefromfolder,
id: BDFDB.ContextMenuUtils.createItemId(this.name, "remove-from-folder"),
color: BDFDB.LibraryComponents.MenuItems.Colors.DANGER,
action: _ => {
this.removeGuildFromFolder(folder.folderId, e.instance.props.guild.id);
}
})
] : [
BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
label: this.labels.serversubmenu_createfolder,
id: BDFDB.ContextMenuUtils.createItemId(this.name, "create-folder"),
disabled: !unfolderedGuilds.length,
action: _ => {
this.openFolderCreationMenu(unfolderedGuilds, e.instance.props.guild.id);
}
}),
BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
label: this.labels.serversubmenu_addtofolder,
id: BDFDB.ContextMenuUtils.createItemId(this.name, "submenu-add-to-folder"),
disabled: !folders.length,
children: folders.map((folder, i) => BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
label: folder.folderName || `${BDFDB.LanguageUtils.LanguageStrings.SERVER_FOLDER_PLACEHOLDER} #${i + 1}`,
id: BDFDB.ContextMenuUtils.createItemId(this.name, "add-to-folder", i + 1),
action: _ => {
this.addGuildToFolder(folder.folderId, e.instance.props.guild.id);
}
}))
})
]
})
}));
}
}
onGuildFolderContextMenu (e) {
if (document.querySelector(BDFDB.dotCN.modalwrapper)) return;
if (e.instance.props.target && e.instance.props.folderId) {
let folder = BDFDB.LibraryModules.FolderStore.getGuildFolderById(e.instance.props.folderId);
let data = this.getFolderConfig(e.instance.props.folderId);
let muted = data.muteFolder && folder.guildIds.every(guildid => BDFDB.LibraryModules.MutedUtils.isGuildOrCategoryOrChannelMuted(guildid));
if (data.muteFolder != muted) {
data.muteFolder = muted;
BDFDB.DataUtils.save(data, this, "folders", e.instance.props.folderId);
}
let [children, index] = BDFDB.ContextMenuUtils.findItem(e.returnvalue, {id: "mark-folder-read"});
children.splice(index > -1 ? index + 1 : children.length, 0, BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuCheckboxItem, {
label: this.labels.foldercontext_autoreadfolder,
id: BDFDB.ContextMenuUtils.createItemId(this.name, "auto-read-folder"),
checked: data.autoRead,
action: state => {
data.autoRead = state;
BDFDB.DataUtils.save(data, this, "folders", e.instance.props.folderId);
}
}));
e.returnvalue.props.children.splice(e.returnvalue.props.children.length - 1, 0, BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuGroup, {
children: BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuCheckboxItem, {
label: this.labels.foldercontext_mutefolder,
id: BDFDB.ContextMenuUtils.createItemId(this.name, "mute-folder"),
checked: muted,
action: state => {
data.muteFolder = state;
BDFDB.DataUtils.save(data, this, "folders", e.instance.props.folderId);
for (let guildId of folder.guildIds) if (BDFDB.LibraryModules.MutedUtils.isGuildOrCategoryOrChannelMuted(guildId) != state) BDFDB.LibraryModules.GuildNotificationsUtils.updateGuildNotificationSettings(guildId, {muted: state, suppress_everyone: state, suppress_roles: state});
}
})
}));
e.returnvalue.props.children.push(BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuGroup, {
children: BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
label: this.labels.foldercontext_removefolder,
id: BDFDB.ContextMenuUtils.createItemId(this.name, "remove-folder"),
color: BDFDB.LibraryComponents.MenuItems.Colors.DANGER,
action: event => {
BDFDB.ModalUtils.confirm(this, `Are you sure you want to remove the folder${folder.folderName ? ` '${folder.folderName}'` : ""}?`, _ => {
this.removeFolder(e.instance.props.folderId);
});
}
})
}));
}
}
processAppView (e) {
if (settings.extraColumn) {
let [children, index] = BDFDB.ReactUtils.findParent(e.returnvalue, {props: [["className", BDFDB.disCN.guilds]]});
if (index > -1) children.splice(index + 1, 0, BDFDB.ReactUtils.createElement(folderGuildContentComponent, {
themeOverride: children[index].props.themeOverride
}, true));
}
}
processGuilds (e) {
if (settings.extraColumn) {
let topBar = BDFDB.ReactUtils.findChild(e.returnvalue, {props: [["className", BDFDB.disCN.guildswrapperunreadmentionsbartop]]});
if (topBar) {
let topIsVisible = topBar.props.isVisible;
topBar.props.isVisible = (...args) => {
let ids = BDFDB.LibraryModules.FolderStore.guildFolders.filter(n => n.folderId).map(n => n.guildIds).flat(10);
args[2] = args[2].filter(n => !ids.includes(n));
return topIsVisible(...args);
};
}
let bottomBar = BDFDB.ReactUtils.findChild(e.returnvalue, {props: [["className", BDFDB.disCN.guildswrapperunreadmentionsbarbottom]]});
if (bottomBar) {
let bottomIsVisible = bottomBar.props.isVisible;
bottomBar.props.isVisible = (...args) => {
let ids = BDFDB.LibraryModules.FolderStore.guildFolders.filter(n => n.folderId).map(n => n.guildIds).flat(10);
args[2] = args[2].filter(n => !ids.includes(n));
return bottomIsVisible(...args);
};
}
}
}
processGuildFolder (e) {
let expandedFolders = BDFDB.LibraryModules.FolderUtils.getExpandedFolders();
if (expandedFolders.size) BDFDB.DOMUtils.addClass(document.body, BDFDB.disCN._serverfoldersfoldercontentisopen);
else BDFDB.DOMUtils.removeClassFromDOM(BDFDB.disCN._serverfoldersfoldercontentisopen);
let data = this.getFolderConfig(e.instance.props.folderId);
if (data.muteFolder) for (let guildId of e.instance.props.guildIds) if (!BDFDB.LibraryModules.MutedUtils.isGuildOrCategoryOrChannelMuted(guildId)) BDFDB.LibraryModules.GuildNotificationsUtils.updateGuildNotificationSettings(guildId, {muted: true, suppress_everyone: true});
let state = this.getState(e.instance);
if (folderStates[e.instance.props.folderId] && !BDFDB.equals(state, folderStates[e.instance.props.folderId])) {
if (data.autoRead && (state.unread || state.badge > 0)) {
BDFDB.TimeUtils.clear(folderReads[e.instance.props.folderId]);
folderReads[e.instance.props.folderId] = BDFDB.TimeUtils.timeout(_ => {
BDFDB.GuildUtils.markAsRead(e.instance.props.guildIds);
}, 10000);
}
BDFDB.ReactUtils.forceUpdate(folderGuildContent);
}
folderStates[e.instance.props.folderId] = state;
let [children, index] = BDFDB.ReactUtils.findParent(e.returnvalue, {name: "ListItemTooltip"});
if (index > -1) children[index] = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TooltipContainer, {
text: e.instance.props.folderName || BDFDB.FolderUtils.getDefaultName(e.instance.props.folderId),
tooltipConfig: {
type: "right",
list: true,
offset: 12,
backgroundColor: data.color3,
fontColor: data.color4
},
children: children[index].props.children
});
if (e.instance.props.expanded || data.useCloseIcon) {
let folderIcons = this.loadAllIcons(), icontype = e.instance.props.expanded ? "openicon" : "closedicon";
let icon = folderIcons[data.iconID] ? (!folderIcons[data.iconID].customID ? this.createBase64SVG(folderIcons[data.iconID][icontype], data.color1, data.color2) : folderIcons[data.iconID][icontype]) : null;
if (icon) {
[children, index] = BDFDB.ReactUtils.findParent(e.returnvalue, {name: "FolderIcon"});
if (index > -1) children[index] = BDFDB.ReactUtils.createElement("div", {
className: BDFDB.disCN.guildfoldericonwrapper,
style: {background: `url(${icon}) center/cover no-repeat`}
});
}
}
if (settings.showCountBadge) {
[children, index] = BDFDB.ReactUtils.findParent(e.returnvalue, {name: "BlobMask"});
if (index > -1) {
children[index].props.upperLeftBadgeWidth = BDFDB.LibraryComponents.Badges.getBadgeWidthForValue(e.instance.props.guildIds.length);
children[index].props.upperLeftBadge = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Badges.NumberBadge, {
count: e.instance.props.guildIds.length,
style: {backgroundColor: "var(--bdfdb-blurple)"}
});
}
}
if (settings.extraColumn) {
e.returnvalue.props.children[0] = null;
e.returnvalue.props.children[2] = BDFDB.ReactUtils.createElement("div", {
children: e.returnvalue.props.children[2],
style: {display: "none"}
});
}
}
processGuild (e) {
let folder = BDFDB.GuildUtils.getFolder(e.instance.props.guild.id);
if (folder) {
let state = this.getState(e.instance);
if (guildStates[e.instance.props.guild.id] && !BDFDB.equals(state, guildStates[e.instance.props.guild.id])) {
BDFDB.ReactUtils.forceUpdate(folderGuildContent);
}
guildStates[e.instance.props.guild.id] = state;
if (e.returnvalue) {
let data = this.getFolderConfig(folder.folderId);
let [children, index] = BDFDB.ReactUtils.findParent(e.returnvalue, {name: ["GuildTooltip", "BDFDB_TooltipContainer"]});
if (index > -1) children[index] = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TooltipContainer, {
tooltipConfig: Object.assign({
type: "right",
list: true,
guild: e.instance.props.guild,
offset: 12
}, data.copyTooltipColor && {
backgroundColor: data.color3,
fontColor: data.color4,
}),
children: children[index].props.children
});
}
}
if (e.node) BDFDB.ListenerUtils.add(this, e.node, "click", _ => {BDFDB.TimeUtils.timeout(_ => {
let folder = BDFDB.GuildUtils.getFolder(e.instance.props.guild.id);
if (settings.closeAllFolders) for (let openFolderId of BDFDB.LibraryModules.FolderUtils.getExpandedFolders()) if (!folder || openFolderId != folder.folderId || !settings.forceOpenFolder) BDFDB.LibraryModules.GuildUtils.toggleGuildFolderExpand(openFolderId);
else if (folder && settings.closeTheFolder && !settings.forceOpenFolder && BDFDB.LibraryModules.FolderUtils.isFolderExpanded(folder.folderId)) BDFDB.LibraryModules.GuildUtils.toggleGuildFolderExpand(folder.folderId);
})});
}
processGuildFolderSettingsModal (e) {
if (e.node) {
let root = e.node.parentElement.querySelector(BDFDB.dotCN.layermodal);
BDFDB.DOMUtils.addClass(root, BDFDB.disCN.layermodalmedium, BDFDB.disCN.modalwrapper, `${this.name}-modal`);
BDFDB.DOMUtils.removeClass(root, BDFDB.disCN.layermodalsmall);
}
if (e.returnvalue) {
let folder = BDFDB.LibraryModules.FolderStore.getGuildFolderById(e.instance.props.folderId);
let data = this.getFolderConfig(e.instance.props.folderId);
let newData = Object.assign({}, data, {folderName: folder.folderName});
let tabs = {};
let [children, index] = BDFDB.ReactUtils.findParent(e.returnvalue, {name: ["ModalHeader", "Header"]});
if (index > -1) {
children[index].props.className = BDFDB.DOMUtils.formatClassName(children[index].props.className, BDFDB.disCN.modalheaderhassibling),
children.splice(index + 1, 0, BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Flex, {
grow: 0,
shrink: 0,
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Flex, {
className: BDFDB.disCN.tabbarcontainer,
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TabBar, {
className: BDFDB.disCN.tabbar,
itemClassName: BDFDB.disCN.tabbaritem,
type: BDFDB.LibraryComponents.TabBar.Types.TOP,
items: [
{value: this.labels.modal_tabheader1},
{value: this.labels.modal_tabheader2},
{value: this.labels.modal_tabheader3},
{value: this.labels.modal_tabheader4}
],
onItemSelect: (value, instance) => {
let tabsArray = BDFDB.ObjectUtils.toArray(tabs);
for (let ins of tabsArray) {
if (ins.props.tab == value) ins.props.open = true;
else delete ins.props.open;
}
BDFDB.ReactUtils.forceUpdate(tabsArray);
}
})
})
}));
}
[children, index] = BDFDB.ReactUtils.findParent(e.returnvalue, {name: ["ModalContent", "Content"]});
if (index > -1) children[index].props.children = [
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ModalComponents.ModalTabContent, {
tab: this.labels.modal_tabheader1,
open: true,
ref: instance => {if (instance) tabs[this.labels.modal_tabheader1] = instance;},
children: [
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormItem, {
title: BDFDB.LanguageUtils.LanguageStrings.GUILD_FOLDER_NAME,
className: BDFDB.disCN.marginbottom20,
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TextInput, {
value: folder.folderName,
placeholder: folder.folderName || BDFDB.LanguageUtils.LanguageStrings.SERVER_FOLDER_PLACEHOLDER,
autoFocus: true,
onChange: value => {newData.folderName = value;}
})
}),
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormItem, {
title: this.labels.modal_iconpicker,
className: BDFDB.disCN.marginbottom20,
children: BDFDB.ReactUtils.createElement(folderIconPickerComponent, {
selectedIcon: data.iconID,
onSelect: value => {newData.iconID = value;}
}, true)
}),
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsItem, {
type: "Switch",
margin: 20,
label: this.labels.modal_usecloseicon,
tag: BDFDB.LibraryComponents.FormComponents.FormTitle.Tags.H5,
value: data.useCloseIcon,
onChange: value => {newData.useCloseIcon = value;}
})
]
}),
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ModalComponents.ModalTabContent, {
tab: this.labels.modal_tabheader2,
ref: instance => {if (instance) tabs[this.labels.modal_tabheader2] = instance;},
children: [
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormItem, {
title: this.labels.modal_colorpicker1,
className: BDFDB.disCN.marginbottom20,
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ColorSwatches, {
color: data.color1,
defaultFallback: !data.color1 && !data.swapColors,
onColorChange: value => {newData.color1 = value;}
})
}),
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormItem, {
title: this.labels.modal_colorpicker2,
className: BDFDB.disCN.marginbottom20,
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ColorSwatches, {
color: data.color2,
defaultFallback: !data.color2 && data.swapColors,
onColorChange: value => {newData.color2 = value;}
})
}),
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsItem, {
type: "Switch",
margin: 20,
label: this.labels.modal_swapcolor,
tag: BDFDB.LibraryComponents.FormComponents.FormTitle.Tags.H5,
value: data.swapColors,
onChange: value => {newData.swapColors = value;}
})
]
}),
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ModalComponents.ModalTabContent, {
tab: this.labels.modal_tabheader3,
ref: instance => {if (instance) tabs[this.labels.modal_tabheader3] = instance;},
children: [
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormItem, {
title: this.labels.modal_colorpicker3,
className: BDFDB.disCN.marginbottom20,
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ColorSwatches, {
color: data.color3,
onColorChange: value => {newData.color3 = value;}
})
}),
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormItem, {
title: this.labels.modal_colorpicker4,
className: BDFDB.disCN.marginbottom20,
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ColorSwatches, {
color: data.color4,
onColorChange: value => {newData.color4 = value;}
})
}),
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsItem, {
type: "Switch",
margin: 20,
label: this.labels.modal_copytooltipcolor,
tag: BDFDB.LibraryComponents.FormComponents.FormTitle.Tags.H5,
value: data.copyTooltipColor,
onChange: value => {newData.copyTooltipColor = value;}
})
]
}),
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ModalComponents.ModalTabContent, {
tab: this.labels.modal_tabheader4,
ref: instance => {if (instance) tabs[this.labels.modal_tabheader4] = instance;},
children: BDFDB.ReactUtils.createElement(folderIconCustomPreviewComponent, {}, true)
})
];
[children, index] = BDFDB.ReactUtils.findParent(e.returnvalue, {name: ["ModalFooter", "Footer"]});
if (index > -1) children[index].props.children = [
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Button, {
children: BDFDB.LanguageUtils.LanguageStrings.SAVE,
onClick: _ => {
let folderColor = newData[newData.swapColors ? "color2" : "color1"];
this.updateFolder({
folderId: e.instance.props.folderId,
folderName: newData.folderName,
folderColor: folderColor ? BDFDB.ColorUtils.convert(folderColor && BDFDB.ObjectUtils.is(folderColor) ? folderColor[Object.keys(folderColor)[0]] : folderColor, "INT") : null
});
if (!BDFDB.equals(newData, data)) {
BDFDB.DataUtils.save(newData, this, "folders", e.instance.props.folderId);
this.forceUpdateAll();
}
e.instance.close();
}
})
]
}
}
loadAllIcons () {
let icons = {};
folderIcons.forEach((array, i) => {
icons[i] = {
openicon: array.openicon,
closedicon: array.closedicon,
customID: null
};
});
for (let id in customIcons) icons[id] = Object.assign({customID: id}, customIcons[id]);
return icons;
}
generateId (prefix) {
if (prefix == "folder") {
let id = Math.floor(Math.random() * 4294967296);
return BDFDB.LibraryModules.FolderStore.guildFolders.every(n => !n.folderId || n.folderId != id) ? id : this.generateId(prefix);
}
else {
let data = BDFDB.DataUtils.load(this, prefix + "s");
let id = prefix + "_" + Math.round(Math.random()*10000000000000000);
return data[id] ? this.generateId(prefix) : id;
}
}
getState (instance) {
let state = {};
for (let key in instance.props) {
if (typeof instance.props[key] != "object" && typeof instance.props[key] != "function") state[key] = instance.props[key];
else if (Array.isArray(instance.props[key])) state[key] = instance.props[key].length;
}
return state;
}
getFolderConfig (folderId) {
let folder = BDFDB.LibraryModules.FolderStore.getGuildFolderById(folderId) || {};
let data = folderConfigs[folderId] || {
iconID: "-1",
muteFolder: false,
autoRead: false,
useCloseIcon: true,
swapColors: false,
copyTooltipColor: false,
color1: null,
color2: ["255","255","255"],
color3: null,
color4: null
};
let nativeColor = data.swapColors ? "color2" : "color1";
if (!data[nativeColor]) data[nativeColor] = BDFDB.ColorUtils.convert(folder.folderColor, "RGBCOMP");
else if (folder.folderColor && !BDFDB.ColorUtils.compare(folder.folderColor, BDFDB.ColorUtils.convert(BDFDB.ObjectUtils.is(data[nativeColor]) ? data[nativeColor][Object.keys(data[nativeColor])[0]] : data[nativeColor], "INT"))) {
data[nativeColor] = BDFDB.ColorUtils.convert(folder.folderColor, "RGBCOMP");
BDFDB.DataUtils.save(data, this, "folders", folderId);
}
folderConfigs[folderId] = data;
return data;
}
createBase64SVG (paths, color1 = "#000000", color2 = "#FFFFFF") {
if (paths.indexOf("`;
if (isGradient1) {
color1 = BDFDB.ColorUtils.convert(color1, "RGBA");
svg += ``;
for (let pos of Object.keys(color1).sort()) svg += ``;
svg += ``;
}
if (isGradient2) {
color2 = BDFDB.ColorUtils.convert(color2, "RGBA");
svg += ``;
for (let pos of Object.keys(color2).sort()) svg += ``;
svg += ``;
}
svg += `${paths.replace("REPLACE_FILL1", isGradient1 ? "url(#grad1)" : BDFDB.ColorUtils.convert(color1, "RGBA")).replace("REPLACE_FILL2", isGradient2 ? "url(#grad2)" : BDFDB.ColorUtils.convert(color2, "RGBA"))}`;
return `data:image/svg+xml;base64,${btoa(svg)}`;
}
openFolderCreationMenu (guilds, initGuildId) {
let targetedGuildIds = [].concat(initGuildId || []);
BDFDB.ModalUtils.open(this, {
size: "MEDIUM",
header: this.labels.serversubmenu_createfolder,
subHeader: "",
contentClassName: BDFDB.disCN.listscroller,
children: guilds.map((guild, i) => {
return [
i == 0 ? null : BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormDivider, {
className: BDFDB.disCNS.margintop4 + BDFDB.disCN.marginbottom4
}),
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ListRow, {
prefix: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.GuildComponents.Guild, {
className: BDFDB.disCN.listavatar,
guild: guild,
menu: false,
tooltip: false
}),
label: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TextScroller, {
children: guild.name
}),
suffix: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Switch, {
value: targetedGuildIds.includes(guild.id),
onChange: value => {
if (value) targetedGuildIds.push(guild.id);
else BDFDB.ArrayUtils.remove(targetedGuildIds, guild.id, true);
}
})
})
];
}).flat(10).filter(n => n),
buttons: [{
contents: BDFDB.LanguageUtils.LanguageStrings.DONE,
color: "BRAND",
close: true,
onClick: (modal, instance) => {
this.createFolder(BDFDB.ArrayUtils.removeCopies(targetedGuildIds));
}
}]
});
}
updateFolder (folder) {
let oldGuildFolders = [].concat(BDFDB.LibraryModules.FolderStore.guildFolders), guildFolders = [], guildPositions = [];
for (let oldFolder of oldGuildFolders) {
if (oldFolder.folderId == folder.folderId) guildFolders.push(Object.assign({}, oldFolder, folder));
else guildFolders.push(oldFolder);
}
for (let folder of guildFolders) for (let fGuildId of folder.guildIds) guildPositions.push(fGuildId);
BDFDB.LibraryModules.SettingsUtils.updateRemoteSettings({guildPositions, guildFolders});
}
createFolder (guildIds) {
if (!guildIds) return;
guildIds = [guildIds].flat(10);
if (!guildIds.length) return;
let oldGuildFolders = [].concat(BDFDB.LibraryModules.FolderStore.guildFolders), guildFolders = [], guildPositions = [], added = false;
for (let oldFolder of oldGuildFolders) {
if (!oldFolder.folderId && guildIds.includes(oldFolder.guildIds[0])) {
if (!added) {
added = true;
guildFolders.push({
guildIds: guildIds,
folderId: this.generateId("folder")
});
}
}
else guildFolders.push(oldFolder);
}
for (let folder of guildFolders) for (let fGuildId of folder.guildIds) guildPositions.push(fGuildId);
BDFDB.LibraryModules.SettingsUtils.updateRemoteSettings({guildPositions, guildFolders});
}
removeFolder (folderId) {
let oldGuildFolders = [].concat(BDFDB.LibraryModules.FolderStore.guildFolders), guildFolders = [], guildPositions = [];
for (let oldFolder of oldGuildFolders) {
if (oldFolder.folderId == folderId) {
for (let guildId of oldFolder.guildIds) guildFolders.push({guildIds: [guildId]});
}
else guildFolders.push(oldFolder);
}
for (let folder of guildFolders) for (let fGuildId of folder.guildIds) guildPositions.push(fGuildId);
BDFDB.LibraryModules.SettingsUtils.updateRemoteSettings({guildPositions, guildFolders});
}
addGuildToFolder (folderId, guildId) {
let oldGuildFolders = [].concat(BDFDB.LibraryModules.FolderStore.guildFolders), guildFolders = [], guildPositions = [];
for (let oldFolder of oldGuildFolders) {
if (oldFolder.folderId) {
let newFolder = Object.assign({}, oldFolder);
if (oldFolder.folderId == folderId) newFolder.guildIds.push(guildId);
else BDFDB.ArrayUtils.remove(newFolder.guildIds, guildId);
guildFolders.push(newFolder);
}
else if (oldFolder.guildIds[0] != guildId) guildFolders.push(oldFolder);
}
for (let folder of guildFolders) for (let fGuildId of folder.guildIds) guildPositions.push(fGuildId);
BDFDB.LibraryModules.SettingsUtils.updateRemoteSettings({guildPositions, guildFolders});
}
removeGuildFromFolder (folderId, guildId) {
let oldGuildFolders = [].concat(BDFDB.LibraryModules.FolderStore.guildFolders), guildFolders = [], guildPositions = [];
for (let oldFolder of oldGuildFolders) {
if (oldFolder.folderId == folderId) {
let newFolder = Object.assign({}, oldFolder);
BDFDB.ArrayUtils.remove(newFolder.guildIds, guildId);
guildFolders.push(newFolder);
guildFolders.push({guildIds: [guildId]});
}
else guildFolders.push(oldFolder);
}
for (let folder of guildFolders) for (let fGuildId of folder.guildIds) guildPositions.push(fGuildId);
BDFDB.LibraryModules.SettingsUtils.updateRemoteSettings({guildPositions, guildFolders});
}
createDragPreview (div, event) {
if (!Node.prototype.isPrototypeOf(div)) return;
let dragPreview = div.cloneNode(true);
BDFDB.DOMUtils.addClass(dragPreview, BDFDB.disCN._serverfoldersdragpreview);
BDFDB.DOMUtils.remove(dragPreview.querySelector(BDFDB.dotCNC.guildlowerbadge + BDFDB.dotCNC.guildupperbadge + BDFDB.dotCN.guildpillwrapper));
BDFDB.DOMUtils.hide(dragPreview);
dragPreview.style.setProperty("pointer-events", "none", "important");
dragPreview.style.setProperty("left", event.clientX - 25 + "px", "important");
dragPreview.style.setProperty("top", event.clientY - 25 + "px", "important");
document.querySelector(BDFDB.dotCN.appmount).appendChild(dragPreview);
return dragPreview;
}
updateDragPreview (dragPreview, event) {
if (!Node.prototype.isPrototypeOf(dragPreview)) return;
BDFDB.DOMUtils.show(dragPreview);
dragPreview.style.setProperty("left", event.clientX - 25 + "px", "important");
dragPreview.style.setProperty("top", event.clientY - 25 + "px", "important");
}
setLabelsByLanguage () {
switch (BDFDB.LanguageUtils.getLanguage().id) {
case "bg": // Bulgarian
return {
foldercontext_autoreadfolder: "Авто: Маркиране като прочетено",
foldercontext_mutefolder: "Без звук папка",
foldercontext_removefolder: "Изтриване на папка",
modal_colorpicker1: "Основен цвят на папката",
modal_colorpicker2: "Вторичен цвят на папката",
modal_colorpicker3: "Цвят на подсказка",
modal_colorpicker4: "Цвят на шрифта",
modal_copytooltipcolor: "Използвайте един и същи цвят за всички сървъри в папка",
modal_customclosed: "Затворена икона",
modal_customopen: "Отворете иконата",
modal_custompreview: "Визуализация на иконата",
modal_iconpicker: "Избор на папка",
modal_swapcolor: "Използвайте втория цвят за оригиналната папка",
modal_tabheader1: "Папка",
modal_tabheader2: "Цвят на папката",
modal_tabheader3: "Цвят на подсказка",
modal_tabheader4: "Собствени символи",
modal_usecloseicon: "Използвайте затворена икона вместо минисервъра",
servercontext_serverfolders: "Папка на сървъра",
serversubmenu_addtofolder: "Добавете сървъра към папката",
serversubmenu_createfolder: "Създай папка",
serversubmenu_removefromfolder: "Премахнете сървъра от папката"
};
case "da": // Danish
return {
foldercontext_autoreadfolder: "Auto: Marker som læst",
foldercontext_mutefolder: "Dæmp mappe",
foldercontext_removefolder: "Slet mappe",
modal_colorpicker1: "Primær mappefarve",
modal_colorpicker2: "Sekundær mappefarve",
modal_colorpicker3: "Værktøjstipfarve",
modal_colorpicker4: "Skriftfarve",
modal_copytooltipcolor: "Brug den samme farve til alle servere i en mappe",
modal_customclosed: "Lukket ikon",
modal_customopen: "Åbn ikonet",
modal_custompreview: "Eksempel på ikon",
modal_iconpicker: "Mappevalg",
modal_swapcolor: "Brug den anden farve til den originale mappe",
modal_tabheader1: "Folder",
modal_tabheader2: "Mappefarve",
modal_tabheader3: "Værktøjstipfarve",
modal_tabheader4: "Egne symboler",
modal_usecloseicon: "Brug et lukket ikon i stedet for miniserver",
servercontext_serverfolders: "Servermappe",
serversubmenu_addtofolder: "Føj serveren til mappen",
serversubmenu_createfolder: "Opret mappe",
serversubmenu_removefromfolder: "Fjern serveren fra mappen"
};
case "de": // German
return {
foldercontext_autoreadfolder: "Auto: Als gelesen markieren",
foldercontext_mutefolder: "Ordner stummschalten",
foldercontext_removefolder: "Ordner löschen",
modal_colorpicker1: "Primäre Ordnerfarbe",
modal_colorpicker2: "Sekundäre Ordnerfarbe",
modal_colorpicker3: "Tooltipfarbe",
modal_colorpicker4: "Schriftfarbe",
modal_copytooltipcolor: "Dieselbe Farbe für alle Server eines Ordners verwenden",
modal_customclosed: "Geschlossenes Icon",
modal_customopen: "Geöffnetes Icon",
modal_custompreview: "Symbolvorschau",
modal_iconpicker: "Ordnerauswahl",
modal_swapcolor: "Die zweite Farbe für den ursprünglichen Ordner verwenden",
modal_tabheader1: "Ordner",
modal_tabheader2: "Ordnerfarbe",
modal_tabheader3: "Tooltipfarbe",
modal_tabheader4: "Eigene Symbole",
modal_usecloseicon: "Anstelle der Miniserver ein geschlossenes Symbol verwenden",
servercontext_serverfolders: "Serverordner",
serversubmenu_addtofolder: "Server zum Ordner hinzufügen",
serversubmenu_createfolder: "Ordner erzeugen",
serversubmenu_removefromfolder: "Server aus Ordner entfernen"
};
case "el": // Greek
return {
foldercontext_autoreadfolder: "Αυτόματο: Επισήμανση ως αναγνωσμένου",
foldercontext_mutefolder: "Σίγαση φακέλου",
foldercontext_removefolder: "Διαγραφή φακέλου",
modal_colorpicker1: "Κύριο χρώμα φακέλου",
modal_colorpicker2: "Χρώμα δευτερεύοντος φακέλου",
modal_colorpicker3: "Χρώμα επεξήγησης εργαλείου",
modal_colorpicker4: "Χρώμα γραμματοσειράς",
modal_copytooltipcolor: "Χρησιμοποιήστε το ίδιο χρώμα για όλους τους διακομιστές σε ένα φάκελο",
modal_customclosed: "Κλειστό εικονίδιο",
modal_customopen: "Άνοιγμα εικονιδίου",
modal_custompreview: "Προεπισκόπηση εικονιδίου",
modal_iconpicker: "Επιλογή φακέλου",
modal_swapcolor: "Χρησιμοποιήστε το δεύτερο χρώμα για τον αρχικό φάκελο",
modal_tabheader1: "Ντοσιέ",
modal_tabheader2: "Χρώμα φακέλου",
modal_tabheader3: "Χρώμα επεξήγησης εργαλείου",
modal_tabheader4: "Ίδια σύμβολα",
modal_usecloseicon: "Χρησιμοποιήστε ένα κλειστό εικονίδιο αντί για το miniserver",
servercontext_serverfolders: "Φάκελος διακομιστή",
serversubmenu_addtofolder: "Προσθέστε το διακομιστή στο φάκελο",
serversubmenu_createfolder: "ΔΗΜΙΟΥΡΓΩ φακελο",
serversubmenu_removefromfolder: "Κατάργηση διακομιστή από φάκελο"
};
case "es": // Spanish
return {
foldercontext_autoreadfolder: "Automático: marcar como leído",
foldercontext_mutefolder: "Silenciar carpeta",
foldercontext_removefolder: "Eliminar carpeta",
modal_colorpicker1: "Color de carpeta principal",
modal_colorpicker2: "Color de carpeta secundaria",
modal_colorpicker3: "Color de la información sobre herramientas",
modal_colorpicker4: "Color de fuente",
modal_copytooltipcolor: "Use el mismo color para todos los servidores de una carpeta",
modal_customclosed: "Icono cerrado",
modal_customopen: "Abrir icono",
modal_custompreview: "Vista previa del icono",
modal_iconpicker: "Selección de carpeta",
modal_swapcolor: "Use el segundo color para la carpeta original",
modal_tabheader1: "Carpeta",
modal_tabheader2: "Color de la carpeta",
modal_tabheader3: "Color de la información sobre herramientas",
modal_tabheader4: "Símbolos propios",
modal_usecloseicon: "Use un icono cerrado en lugar del miniserver",
servercontext_serverfolders: "Carpeta del servidor",
serversubmenu_addtofolder: "Agrega el servidor a la carpeta",
serversubmenu_createfolder: "Crear carpeta",
serversubmenu_removefromfolder: "Quitar servidor de carpeta"
};
case "fi": // Finnish
return {
foldercontext_autoreadfolder: "Automaattinen: Merkitse luetuksi",
foldercontext_mutefolder: "Mykistä kansio",
foldercontext_removefolder: "Poista kansio",
modal_colorpicker1: "Ensisijaisen kansion väri",
modal_colorpicker2: "Toissijaisen kansion väri",
modal_colorpicker3: "Työkaluvinkin väri",
modal_colorpicker4: "Fontin väri",
modal_copytooltipcolor: "Käytä samaa väriä kaikille kansion palvelimille",
modal_customclosed: "Suljettu kuvake",
modal_customopen: "Avaa kuvake",
modal_custompreview: "Kuvakkeen esikatselu",
modal_iconpicker: "Kansion valinta",
modal_swapcolor: "Käytä alkuperäisen kansion toista väriä",
modal_tabheader1: "Kansio",
modal_tabheader2: "Kansion väri",
modal_tabheader3: "Työkaluvinkin väri",
modal_tabheader4: "Omat symbolit",
modal_usecloseicon: "Käytä suljetun kuvaketta minipalvelimen sijaan",
servercontext_serverfolders: "Palvelinkansio",
serversubmenu_addtofolder: "Lisää palvelin kansioon",
serversubmenu_createfolder: "Luo kansio",
serversubmenu_removefromfolder: "Poista palvelin kansiosta"
};
case "fr": // French
return {
foldercontext_autoreadfolder: "Auto: marquer comme lu",
foldercontext_mutefolder: "Dossier muet",
foldercontext_removefolder: "Supprimer le dossier",
modal_colorpicker1: "Couleur du dossier primaire",
modal_colorpicker2: "Couleur du dossier secondaire",
modal_colorpicker3: "Couleur de l'info-bulle",
modal_colorpicker4: "Couleur de la police",
modal_copytooltipcolor: "Utilisez la même couleur pour tous les serveurs d'un dossier",
modal_customclosed: "Icône fermée",
modal_customopen: "Icône ouverte",
modal_custompreview: "Aperçu de l'icône",
modal_iconpicker: "Sélection de dossier",
modal_swapcolor: "Utilisez la deuxième couleur pour le dossier d'origine",
modal_tabheader1: "Dossier",
modal_tabheader2: "Couleur du dossier",
modal_tabheader3: "Couleur de l'info-bulle",
modal_tabheader4: "Propres symboles",
modal_usecloseicon: "Utilisez une icône fermée au lieu du miniserver",
servercontext_serverfolders: "Dossier du serveur",
serversubmenu_addtofolder: "Ajouter le serveur au dossier",
serversubmenu_createfolder: "Créer le dossier",
serversubmenu_removefromfolder: "Supprimer le serveur du dossier"
};
case "hr": // Croatian
return {
foldercontext_autoreadfolder: "Automatski: Označi kao pročitano",
foldercontext_mutefolder: "Isključi mapu",
foldercontext_removefolder: "Izbriši mapu",
modal_colorpicker1: "Boja primarne mape",
modal_colorpicker2: "Boja sekundarne mape",
modal_colorpicker3: "Boja opisa",
modal_colorpicker4: "Boja fonta",
modal_copytooltipcolor: "Koristite istu boju za sve poslužitelje u mapi",
modal_customclosed: "Zatvorena ikona",
modal_customopen: "Otvori ikonu",
modal_custompreview: "Pregled ikone",
modal_iconpicker: "Odabir mape",
modal_swapcolor: "Upotrijebite drugu boju za izvornu mapu",
modal_tabheader1: "Mapu",
modal_tabheader2: "Boja mape",
modal_tabheader3: "Boja opisa",
modal_tabheader4: "Vlastiti simboli",
modal_usecloseicon: "Upotrijebite zatvorenu ikonu umjesto miniservera",
servercontext_serverfolders: "Mapa poslužitelja",
serversubmenu_addtofolder: "Dodajte poslužitelj u mapu",
serversubmenu_createfolder: "Stvori mapu",
serversubmenu_removefromfolder: "Uklonite poslužitelj iz mape"
};
case "hu": // Hungarian
return {
foldercontext_autoreadfolder: "Automatikus: Megjelölés olvasottként",
foldercontext_mutefolder: "Mappa némítása",
foldercontext_removefolder: "Mappa törlése",
modal_colorpicker1: "Elsődleges mappa színe",
modal_colorpicker2: "Másodlagos mappa színe",
modal_colorpicker3: "Eszköztár színe",
modal_colorpicker4: "Betű szín",
modal_copytooltipcolor: "Használja ugyanazt a színt egy mappa összes kiszolgálójához",
modal_customclosed: "Zárt ikonra",
modal_customopen: "Megnyitás ikonra",
modal_custompreview: "Ikon előnézet",
modal_iconpicker: "Mappa kiválasztása",
modal_swapcolor: "Használja az eredeti mappa második színét",
modal_tabheader1: "Mappába",
modal_tabheader2: "Mappa színe",
modal_tabheader3: "Eszköztár színe",
modal_tabheader4: "Saját szimbólumok",
modal_usecloseicon: "Használjon zárt ikont a miniszerver helyett",
servercontext_serverfolders: "Szerver mappa",
serversubmenu_addtofolder: "Adja hozzá a szervert a mappához",
serversubmenu_createfolder: "Mappa létrehozás",
serversubmenu_removefromfolder: "Távolítsa el a szervert a mappából"
};
case "it": // Italian
return {
foldercontext_autoreadfolder: "Auto: contrassegna come letto",
foldercontext_mutefolder: "Disattiva cartella",
foldercontext_removefolder: "Elimina cartella",
modal_colorpicker1: "Colore cartella principale",
modal_colorpicker2: "Colore cartella secondaria",
modal_colorpicker3: "Colore della descrizione comando",
modal_colorpicker4: "Colore del carattere",
modal_copytooltipcolor: "Usa lo stesso colore per tutti i server in una cartella",
modal_customclosed: "Icona chiusa",
modal_customopen: "Icona Apri",
modal_custompreview: "Anteprima icona",
modal_iconpicker: "Selezione della cartella",
modal_swapcolor: "Usa il secondo colore per la cartella originale",
modal_tabheader1: "Cartella",
modal_tabheader2: "Colore cartella",
modal_tabheader3: "Colore della descrizione comando",
modal_tabheader4: "Simboli propri",
modal_usecloseicon: "Utilizza un'icona chiusa al posto del miniserver",
servercontext_serverfolders: "Cartella del server",
serversubmenu_addtofolder: "Aggiungi il server alla cartella",
serversubmenu_createfolder: "Creare una cartella",
serversubmenu_removefromfolder: "Rimuovi il server dalla cartella"
};
case "ja": // Japanese
return {
foldercontext_autoreadfolder: "自動:既読としてマーク",
foldercontext_mutefolder: "ミュートフォルダ",
foldercontext_removefolder: "フォルダを削除",
modal_colorpicker1: "プライマリフォルダの色",
modal_colorpicker2: "セカンダリフォルダの色",
modal_colorpicker3: "ツールチップの色",
modal_colorpicker4: "フォントの色",
modal_copytooltipcolor: "フォルダ内のすべてのサーバーに同じ色を使用する",
modal_customclosed: "閉じたアイコン",
modal_customopen: "アイコンを開く",
modal_custompreview: "アイコンプレビュー",
modal_iconpicker: "フォルダの選択",
modal_swapcolor: "元のフォルダに2番目の色を使用します",
modal_tabheader1: "フォルダ",
modal_tabheader2: "フォルダーの色",
modal_tabheader3: "ツールチップの色",
modal_tabheader4: "独自のシンボル",
modal_usecloseicon: "ミニサーバーの代わりに閉じたアイコンを使用する",
servercontext_serverfolders: "サーバーフォルダ",
serversubmenu_addtofolder: "サーバーをフォルダーに追加します",
serversubmenu_createfolder: "フォルダーを作る",
serversubmenu_removefromfolder: "フォルダからサーバーを削除します"
};
case "ko": // Korean
return {
foldercontext_autoreadfolder: "자동 : 읽은 상태로 표시",
foldercontext_mutefolder: "폴더 음소거",
foldercontext_removefolder: "폴더 삭제",
modal_colorpicker1: "기본 폴더 색상",
modal_colorpicker2: "보조 폴더 색상",
modal_colorpicker3: "툴팁 색상",
modal_colorpicker4: "글자 색",
modal_copytooltipcolor: "폴더의 모든 서버에 동일한 색상 사용",
modal_customclosed: "닫힌 아이콘",
modal_customopen: "열기 아이콘",
modal_custompreview: "아이콘 미리보기",
modal_iconpicker: "폴더 선택",
modal_swapcolor: "원본 폴더에 두 번째 색상 사용",
modal_tabheader1: "폴더",
modal_tabheader2: "폴더 색상",
modal_tabheader3: "툴팁 색상",
modal_tabheader4: "자신의 기호",
modal_usecloseicon: "미니 서버 대신 닫힌 아이콘 사용",
servercontext_serverfolders: "서버 폴더",
serversubmenu_addtofolder: "폴더에 서버 추가",
serversubmenu_createfolder: "폴더 생성",
serversubmenu_removefromfolder: "폴더에서 서버 제거"
};
case "lt": // Lithuanian
return {
foldercontext_autoreadfolder: "Automatinis: pažymėti kaip perskaitytą",
foldercontext_mutefolder: "Nutildyti aplanką",
foldercontext_removefolder: "Ištrinti aplanką",
modal_colorpicker1: "Pagrindinio aplanko spalva",
modal_colorpicker2: "Antrinio aplanko spalva",
modal_colorpicker3: "Patarimo spalva",
modal_colorpicker4: "Šrifto spalva",
modal_copytooltipcolor: "Naudokite tą pačią spalvą visiems aplanko serveriams",
modal_customclosed: "Uždaryta piktograma",
modal_customopen: "Atidaryti piktogramą",
modal_custompreview: "Piktogramos peržiūra",
modal_iconpicker: "Aplanko pasirinkimas",
modal_swapcolor: "Originalo aplankui naudokite antrą spalvą",
modal_tabheader1: "Aplanką",
modal_tabheader2: "Aplanko spalva",
modal_tabheader3: "Patarimo spalva",
modal_tabheader4: "Savo simbolius",
modal_usecloseicon: "Vietoj miniserverio naudokite uždarą piktogramą",
servercontext_serverfolders: "Serverio aplankas",
serversubmenu_addtofolder: "Pridėkite serverį prie aplanko",
serversubmenu_createfolder: "Sukurti aplanką",
serversubmenu_removefromfolder: "Pašalinti serverį iš aplanko"
};
case "nl": // Dutch
return {
foldercontext_autoreadfolder: "Auto: Markeer als gelezen",
foldercontext_mutefolder: "Mute map",
foldercontext_removefolder: "Verwijder map",
modal_colorpicker1: "Kleur primaire map",
modal_colorpicker2: "Kleur secundaire map",
modal_colorpicker3: "Tooltipkleur",
modal_colorpicker4: "Letterkleur",
modal_copytooltipcolor: "Gebruik dezelfde kleur voor alle servers in een map",
modal_customclosed: "Gesloten pictogram",
modal_customopen: "Open icoon",
modal_custompreview: "Pictogramvoorbeeld",
modal_iconpicker: "Map selecteren",
modal_swapcolor: "Gebruik de tweede kleur voor de originele map",
modal_tabheader1: "Map",
modal_tabheader2: "Mapkleur",
modal_tabheader3: "Tooltipkleur",
modal_tabheader4: "Eigen symbolen",
modal_usecloseicon: "Gebruik een gesloten pictogram in plaats van de miniserver",
servercontext_serverfolders: "Servermap",
serversubmenu_addtofolder: "Voeg de server toe aan de map",
serversubmenu_createfolder: "Map aanmaken",
serversubmenu_removefromfolder: "Verwijder de server uit de map"
};
case "no": // Norwegian
return {
foldercontext_autoreadfolder: "Auto: Merk som lest",
foldercontext_mutefolder: "Demp mappe",
foldercontext_removefolder: "Slett mappe",
modal_colorpicker1: "Primær mappefarge",
modal_colorpicker2: "Sekundær mappefarge",
modal_colorpicker3: "Verktøytipsfarge",
modal_colorpicker4: "Skriftfarge",
modal_copytooltipcolor: "Bruk samme farge for alle servere i en mappe",
modal_customclosed: "Lukket ikon",
modal_customopen: "Åpne ikonet",
modal_custompreview: "Forhåndsvisning av ikon",
modal_iconpicker: "Mappevalg",
modal_swapcolor: "Bruk den andre fargen for den originale mappen",
modal_tabheader1: "Mappe",
modal_tabheader2: "Mappefarge",
modal_tabheader3: "Verktøytipsfarge",
modal_tabheader4: "Egne symboler",
modal_usecloseicon: "Bruk et lukket ikon i stedet for miniserver",
servercontext_serverfolders: "Servermappe",
serversubmenu_addtofolder: "Legg til serveren i mappen",
serversubmenu_createfolder: "Lag mappe",
serversubmenu_removefromfolder: "Fjern serveren fra mappen"
};
case "pl": // Polish
return {
foldercontext_autoreadfolder: "Auto: oznacz jako przeczytane",
foldercontext_mutefolder: "Wycisz folder",
foldercontext_removefolder: "Usunięty folder",
modal_colorpicker1: "Główny kolor folderu",
modal_colorpicker2: "Kolor folderu dodatkowego",
modal_colorpicker3: "Kolor podpowiedzi",
modal_colorpicker4: "Kolor czcionki",
modal_copytooltipcolor: "Użyj tego samego koloru dla wszystkich serwerów w folderze",
modal_customclosed: "Ikona zamknięta",
modal_customopen: "Otwórz ikonę",
modal_custompreview: "Podgląd ikon",
modal_iconpicker: "Wybór folderu",
modal_swapcolor: "Użyj drugiego koloru dla oryginalnego folderu",
modal_tabheader1: "Teczka",
modal_tabheader2: "Kolor folderu",
modal_tabheader3: "Kolor podpowiedzi",
modal_tabheader4: "Własne symbole",
modal_usecloseicon: "Użyj zamkniętej ikony zamiast miniserwera",
servercontext_serverfolders: "Folder serwera",
serversubmenu_addtofolder: "Dodaj serwer do folderu",
serversubmenu_createfolder: "Utwórz folder",
serversubmenu_removefromfolder: "Usuń serwer z folderu"
};
case "pt-BR": // Portuguese (Brazil)
return {
foldercontext_autoreadfolder: "Auto: Marcar como lido",
foldercontext_mutefolder: "Pasta sem som",
foldercontext_removefolder: "Excluir pasta",
modal_colorpicker1: "Cor da pasta primária",
modal_colorpicker2: "Cor secundária da pasta",
modal_colorpicker3: "Cor da dica de ferramenta",
modal_colorpicker4: "Cor da fonte",
modal_copytooltipcolor: "Use a mesma cor para todos os servidores em uma pasta",
modal_customclosed: "Ícone fechado",
modal_customopen: "Ícone aberto",
modal_custompreview: "Antevisão do ícone",
modal_iconpicker: "Seleção de pasta",
modal_swapcolor: "Use a segunda cor para a pasta original",
modal_tabheader1: "Pasta",
modal_tabheader2: "Cor da pasta",
modal_tabheader3: "Cor da dica de ferramenta",
modal_tabheader4: "Símbolos próprios",
modal_usecloseicon: "Use um ícone fechado em vez do miniserver",
servercontext_serverfolders: "Pasta do servidor",
serversubmenu_addtofolder: "Adicione o servidor à pasta",
serversubmenu_createfolder: "Criar pasta",
serversubmenu_removefromfolder: "Remover servidor da pasta"
};
case "ro": // Romanian
return {
foldercontext_autoreadfolder: "Automat: marcați ca citit",
foldercontext_mutefolder: "Dezactivați folderul",
foldercontext_removefolder: "Ștergeți folderul",
modal_colorpicker1: "Culoarea folderului principal",
modal_colorpicker2: "Culoare dosar secundar",
modal_colorpicker3: "Culoarea sfatului de instrumente",
modal_colorpicker4: "Culoarea fontului",
modal_copytooltipcolor: "Utilizați aceeași culoare pentru toate serverele dintr-un folder",
modal_customclosed: "Pictogramă închisă",
modal_customopen: "Pictogramă Deschidere",
modal_custompreview: "Previzualizare pictogramă",
modal_iconpicker: "Selectarea dosarelor",
modal_swapcolor: "Utilizați a doua culoare pentru folderul original",
modal_tabheader1: "Pliant",
modal_tabheader2: "Culoare dosar",
modal_tabheader3: "Culoarea sfatului de instrumente",
modal_tabheader4: "Simboluri proprii",
modal_usecloseicon: "Folosiți o pictogramă închisă în locul miniserverului",
servercontext_serverfolders: "Dosar server",
serversubmenu_addtofolder: "Adăugați serverul în dosar",
serversubmenu_createfolder: "Creeaza dosar",
serversubmenu_removefromfolder: "Eliminați serverul din dosar"
};
case "ru": // Russian
return {
foldercontext_autoreadfolder: "Авто: Отметить как прочитанное",
foldercontext_mutefolder: "Отключить папку",
foldercontext_removefolder: "Удалить папку",
modal_colorpicker1: "Цвет основной папки",
modal_colorpicker2: "Цвет вторичной папки",
modal_colorpicker3: "Цвет всплывающей подсказки",
modal_colorpicker4: "Цвет шрифта",
modal_copytooltipcolor: "Используйте один цвет для всех серверов в папке",
modal_customclosed: "Закрытый значок",
modal_customopen: "Открыть значок",
modal_custompreview: "Предварительный просмотр значков",
modal_iconpicker: "Выбор папки",
modal_swapcolor: "Используйте второй цвет для исходной папки",
modal_tabheader1: "Папка",
modal_tabheader2: "Цвет папки",
modal_tabheader3: "Цвет всплывающей подсказки",
modal_tabheader4: "Собственные символы",
modal_usecloseicon: "Используйте закрытый значок вместо минисервера",
servercontext_serverfolders: "Папка сервера",
serversubmenu_addtofolder: "Добавьте сервер в папку",
serversubmenu_createfolder: "Создать папку",
serversubmenu_removefromfolder: "Удалить сервер из папки"
};
case "sv": // Swedish
return {
foldercontext_autoreadfolder: "Auto: Markera som läst",
foldercontext_mutefolder: "Tyst mapp",
foldercontext_removefolder: "Ta bort mapp",
modal_colorpicker1: "Primär mappfärg",
modal_colorpicker2: "Sekundär mappfärg",
modal_colorpicker3: "Verktygstipsfärg",
modal_colorpicker4: "Fontfärg",
modal_copytooltipcolor: "Använd samma färg för alla servrar i en mapp",
modal_customclosed: "Stängd ikon",
modal_customopen: "Öppna ikonen",
modal_custompreview: "Ikonförhandsvisning",
modal_iconpicker: "Mappval",
modal_swapcolor: "Använd den andra färgen för den ursprungliga mappen",
modal_tabheader1: "Mapp",
modal_tabheader2: "Mappfärg",
modal_tabheader3: "Verktygstipsfärg",
modal_tabheader4: "Egna symboler",
modal_usecloseicon: "Använd en stängd ikon istället för miniserver",
servercontext_serverfolders: "Servermapp",
serversubmenu_addtofolder: "Lägg till servern i mappen",
serversubmenu_createfolder: "Skapa mapp",
serversubmenu_removefromfolder: "Ta bort servern från mappen"
};
case "th": // Thai
return {
foldercontext_autoreadfolder: "อัตโนมัติ: ทำเครื่องหมายว่าอ่านแล้ว",
foldercontext_mutefolder: "ปิดเสียงโฟลเดอร์",
foldercontext_removefolder: "ลบโฟลเดอร์",
modal_colorpicker1: "สีโฟลเดอร์หลัก",
modal_colorpicker2: "สีโฟลเดอร์รอง",
modal_colorpicker3: "สีคำแนะนำเครื่องมือ",
modal_colorpicker4: "สีตัวอักษร",
modal_copytooltipcolor: "ใช้สีเดียวกันสำหรับเซิร์ฟเวอร์ทั้งหมดในโฟลเดอร์",
modal_customclosed: "ไอคอนปิด",
modal_customopen: "เปิดไอคอน",
modal_custompreview: "ดูตัวอย่างไอคอน",
modal_iconpicker: "การเลือกโฟลเดอร์",
modal_swapcolor: "ใช้สีที่สองสำหรับโฟลเดอร์เดิม",
modal_tabheader1: "โฟลเดอร์",
modal_tabheader2: "สีโฟลเดอร์",
modal_tabheader3: "สีคำแนะนำเครื่องมือ",
modal_tabheader4: "สัญลักษณ์ของตัวเอง",
modal_usecloseicon: "ใช้ไอคอนปิดแทน miniserver",
servercontext_serverfolders: "โฟลเดอร์เซิร์ฟเวอร์",
serversubmenu_addtofolder: "เพิ่มเซิร์ฟเวอร์ลงในโฟลเดอร์",
serversubmenu_createfolder: "สร้างโฟลเดอร์",
serversubmenu_removefromfolder: "ลบเซิร์ฟเวอร์ออกจากโฟลเดอร์"
};
case "tr": // Turkish
return {
foldercontext_autoreadfolder: "Otomatik: Okundu olarak işaretle",
foldercontext_mutefolder: "Klasörü sessize al",
foldercontext_removefolder: "Klasörü sil",
modal_colorpicker1: "Birincil klasör rengi",
modal_colorpicker2: "İkincil klasör rengi",
modal_colorpicker3: "Araç ipucu rengi",
modal_colorpicker4: "Yazı rengi",
modal_copytooltipcolor: "Bir klasördeki tüm sunucular için aynı rengi kullanın",
modal_customclosed: "Kapalı simge",
modal_customopen: "Aç simgesi",
modal_custompreview: "Simge önizlemesi",
modal_iconpicker: "Klasör seçimi",
modal_swapcolor: "Orijinal klasör için ikinci rengi kullanın",
modal_tabheader1: "Klasör",
modal_tabheader2: "Klasör rengi",
modal_tabheader3: "Araç ipucu rengi",
modal_tabheader4: "Kendi sembolleri",
modal_usecloseicon: "Miniserver yerine kapalı bir simge kullanın",
servercontext_serverfolders: "Sunucu klasörü",
serversubmenu_addtofolder: "Sunucuyu klasöre ekleyin",
serversubmenu_createfolder: "Klasör oluşturun",
serversubmenu_removefromfolder: "Sunucuyu klasörden kaldır"
};
case "uk": // Ukrainian
return {
foldercontext_autoreadfolder: "Авто: Позначити як прочитане",
foldercontext_mutefolder: "Вимкнути папку",
foldercontext_removefolder: "Видалити папку",
modal_colorpicker1: "Основний колір папки",
modal_colorpicker2: "Колір вторинної папки",
modal_colorpicker3: "Колір підказки",
modal_colorpicker4: "Колір шрифту",
modal_copytooltipcolor: "Використовуйте однаковий колір для всіх серверів у папці",
modal_customclosed: "Закритий значок",
modal_customopen: "Відкрити значок",
modal_custompreview: "Попередній перегляд піктограми",
modal_iconpicker: "Вибір папки",
modal_swapcolor: "Використовуйте другий колір для вихідної папки",
modal_tabheader1: "Папку",
modal_tabheader2: "Колір папки",
modal_tabheader3: "Колір підказки",
modal_tabheader4: "Власні символи",
modal_usecloseicon: "Використовуйте закритий значок замість мінісервера",
servercontext_serverfolders: "Папка сервера",
serversubmenu_addtofolder: "Додайте сервер до папки",
serversubmenu_createfolder: "Створити папку",
serversubmenu_removefromfolder: "Видалити сервер з папки"
};
case "vi": // Vietnamese
return {
foldercontext_autoreadfolder: "Tự động: Đánh dấu là đã đọc",
foldercontext_mutefolder: "Thư mục ẩn",
foldercontext_removefolder: "Xóa thư mục",
modal_colorpicker1: "Màu thư mục chính",
modal_colorpicker2: "Màu thư mục phụ",
modal_colorpicker3: "Màu chú giải công cụ",
modal_colorpicker4: "Màu phông chữ",
modal_copytooltipcolor: "Sử dụng cùng một màu cho tất cả các máy chủ trong một thư mục",
modal_customclosed: "Biểu tượng đã đóng",
modal_customopen: "Mở biểu tượng",
modal_custompreview: "Xem trước biểu tượng",
modal_iconpicker: "Lựa chọn thư mục",
modal_swapcolor: "Sử dụng màu thứ hai cho thư mục gốc",
modal_tabheader1: "Thư mục",
modal_tabheader2: "Màu thư mục",
modal_tabheader3: "Màu chú giải công cụ",
modal_tabheader4: "Ký hiệu riêng",
modal_usecloseicon: "Sử dụng biểu tượng đã đóng thay vì trình thu nhỏ",
servercontext_serverfolders: "Thư mục máy chủ",
serversubmenu_addtofolder: "Thêm máy chủ vào thư mục",
serversubmenu_createfolder: "Tạo thư mục",
serversubmenu_removefromfolder: "Xóa máy chủ khỏi thư mục"
};
case "zh-CN": // Chinese (China)
return {
foldercontext_autoreadfolder: "自动:标记为已读",
foldercontext_mutefolder: "静音文件夹",
foldercontext_removefolder: "删除资料夹",
modal_colorpicker1: "主文件夹颜色",
modal_colorpicker2: "辅助文件夹颜色",
modal_colorpicker3: "工具提示颜色",
modal_colorpicker4: "字体颜色",
modal_copytooltipcolor: "对文件夹中的所有服务器使用相同的颜色",
modal_customclosed: "已关闭图标",
modal_customopen: "开启图示",
modal_custompreview: "图标预览",
modal_iconpicker: "资料夹选择",
modal_swapcolor: "将第二种颜色用于原始文件夹",
modal_tabheader1: "夹",
modal_tabheader2: "资料夹颜色",
modal_tabheader3: "工具提示颜色",
modal_tabheader4: "自己的符号",
modal_usecloseicon: "使用关闭的图标代替小型服务器",
servercontext_serverfolders: "服务器文件夹",
serversubmenu_addtofolder: "将服务器添加到文件夹",
serversubmenu_createfolder: "创建文件夹",
serversubmenu_removefromfolder: "从文件夹中删除服务器"
};
case "zh-TW": // Chinese (Taiwan)
return {
foldercontext_autoreadfolder: "自動:標記為已讀",
foldercontext_mutefolder: "靜音文件夾",
foldercontext_removefolder: "刪除資料夾",
modal_colorpicker1: "主文件夾顏色",
modal_colorpicker2: "輔助文件夾顏色",
modal_colorpicker3: "工具提示顏色",
modal_colorpicker4: "字體顏色",
modal_copytooltipcolor: "對文件夾中的所有服務器使用相同的顏色",
modal_customclosed: "已關閉圖標",
modal_customopen: "開啟圖示",
modal_custompreview: "圖標預覽",
modal_iconpicker: "資料夾選擇",
modal_swapcolor: "將第二種顏色用於原始文件夾",
modal_tabheader1: "夾",
modal_tabheader2: "資料夾顏色",
modal_tabheader3: "工具提示顏色",
modal_tabheader4: "自己的符號",
modal_usecloseicon: "使用關閉的圖標代替小型服務器",
servercontext_serverfolders: "服務器文件夾",
serversubmenu_addtofolder: "將服務器添加到文件夾",
serversubmenu_createfolder: "創建文件夾",
serversubmenu_removefromfolder: "從文件夾中刪除服務器"
};
default: // English
return {
foldercontext_autoreadfolder: "Auto: Mark As Read",
foldercontext_mutefolder: "Mute Folder",
foldercontext_removefolder: "Delete Folder",
modal_colorpicker1: "Primary Folder Color",
modal_colorpicker2: "Secondary Folder Color",
modal_colorpicker3: "Tooltip Color",
modal_colorpicker4: "Font Color",
modal_copytooltipcolor: "Use the same Color for all Servers in a Folder",
modal_customclosed: "Closed icon",
modal_customopen: "Open icon",
modal_custompreview: "Icon preview",
modal_iconpicker: "Folder selection",
modal_swapcolor: "Use the second Color for the original Folder",
modal_tabheader1: "Folder",
modal_tabheader2: "Folder Color",
modal_tabheader3: "Tooltip Color",
modal_tabheader4: "Own symbols",
modal_usecloseicon: "Use a closed Icon instead of the Mini-Servers",
servercontext_serverfolders: "Server Folder",
serversubmenu_addtofolder: "Add the Server to the Folder",
serversubmenu_createfolder: "Create Folder",
serversubmenu_removefromfolder: "Remove Server from Folder"
};
}
}
};
})(window.BDFDB_Global.PluginUtils.buildPlugin(config));
})();