/**
* @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.5",
"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"
}
};
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 config.info.description;}
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;
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, _ => {});
else BdApi.alert("Error", "Could not download BDFDB library plugin, try again some time later.");
});
}
});
}
if (!window.BDFDB_Global.pluginQueue.includes(config.info.name)) window.BDFDB_Global.pluginQueue.push(config.info.name);
}
start() {this.load();}
stop() {}
} : (([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;
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)"}
})
});
})
})
}
};
var redCross = `'data:image/svg+xml; base64, PHN2ZyB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2ZXJzaW9uPSIxLjEiIHdpZHRoPSI0MDAiIGhlaWdodD0iNDAwIj48cGF0aCBkPSJNNDAuNDAwIDE3LjE3OCBDIDM5Ljg1MCAxNy4zNjYsMzguNzkzIDE3LjUzOCwzOC4wNTAgMTcuNTYwIEMgMzMuMzUxIDE3LjY5OSwyMy4zOTcgMjQuNzg4LDIxLjM4MSAyOS40MzIgQyAyMS4wODcgMzAuMTA5LDIwLjU2NiAzMC44OTYsMjAuMjIzIDMxLjE4MSBDIDE5Ljg4MCAzMS40NjUsMTkuNjAwIDMxLjg2NiwxOS42MDAgMzIuMDcxIEMgMTkuNjAwIDMyLjI3NiwxOS4yMzYgMzMuMjQyLDE4Ljc5MiAzNC4yMTggQyAxNi4zNDUgMzkuNTg5LDE2LjM0NSA0OS42MTEsMTguNzkyIDU0Ljk4MiBDIDE5LjIzNiA1NS45NTgsMTkuNjAwIDU2LjkxOCwxOS42MDAgNTcuMTE2IEMgMTkuNjAwIDU3LjMxNCwxOS45NjAgNTcuODAyLDIwLjQwMCA1OC4yMDAgQyAyMC44NDAgNTguNTk4LDIxLjIwMCA1OS4xMzEsMjEuMjAwIDU5LjM4NSBDIDIxLjIwMCA2MC4zOTEsMjUuNjgwIDY0Ljk0Miw5MS41MDUgMTMwLjgwMCBDIDEyOC45OTUgMTY4LjMxMCwxNTkuODQ5IDE5OS4zMjYsMTYwLjA2OCAxOTkuNzI0IEMgMTYwLjQwOSAyMDAuMzQ0LDE1MC45NTAgMjA5Ljk2NCw5My45ODkgMjY2LjkyNCBDIDE4Ljc5OCAzNDIuMTEzLDE5LjYwMCAzNDEuMjkyLDE5LjYwMCAzNDMuMTI2IEMgMTkuNjAwIDM0My4yODMsMTkuMjUwIDM0NC4wNjUsMTguODIyIDM0NC44NjQgQyAxNS40MjkgMzUxLjE5NSwxNS45NTggMzYyLjkxOCwxOS45MzIgMzY5LjQ0MCBDIDIyLjA5NCAzNzIuOTkwLDI3LjQ3NCAzNzguODAwLDI4LjU5OCAzNzguODAwIEMgMjguODYxIDM3OC44MDAsMjkuNDAyIDM3OS4xNjAsMjkuODAwIDM3OS42MDAgQyAzMC4xOTggMzgwLjA0MCwzMC43MDMgMzgwLjQwMCwzMC45MjIgMzgwLjQwMCBDIDMxLjE0MSAzODAuNDAwLDMyLjIzOCAzODAuODMxLDMzLjM2MCAzODEuMzU4IEMgMzQuNDgyIDM4MS44ODYsMzYuNDgwIDM4Mi41MzMsMzcuODAwIDM4Mi43OTcgQyA0My43ODYgMzgzLjk5NCw0NC4zMjMgMzg0LjAyNyw0Ny4yOTkgMzgzLjM4NiBDIDQ4Ljg5NSAzODMuMDQyLDUxLjAxMCAzODIuNjE5LDUyLjAwMCAzODIuNDQ2IEMgNTIuOTkwIDM4Mi4yNzQsNTQuNTE3IDM4MS43NDMsNTUuMzk0IDM4MS4yNjYgQyA1Ni4yNzEgMzgwLjc5MCw1Ny4xODggMzgwLjQwMCw1Ny40MzIgMzgwLjQwMCBDIDU3LjY3NiAzODAuNDAwLDU4LjIwMiAzODAuMDQwLDU4LjYwMCAzNzkuNjAwIEMgNTguOTk4IDM3OS4xNjAsNTkuNTk4IDM3OC44MDAsNTkuOTMyIDM3OC44MDAgQyA2MC4yNjcgMzc4LjgwMCw5MS43MjUgMzQ3LjYxNSwxMjkuODM5IDMwOS41MDAgQyAxNjkuMDU3IDI3MC4yODEsMTk5LjQ5NiAyNDAuMTQ1LDE5OS45NjQgMjQwLjA3MyBDIDIwMC42MDIgMjM5Ljk3NSwyMTYuMDAxIDI1NS4xOTMsMjY3LjQ5NSAzMDYuODE0IEMgMzI3LjA0NiAzNjYuNTExLDMzOS41MzEgMzc4LjgwMCwzNDAuNjI3IDM3OC44MDAgQyAzNDAuNzk4IDM3OC44MDAsMzQxLjI2NSAzNzkuMDk3LDM0MS42NjcgMzc5LjQ2MSBDIDM0NS43MjggMzgzLjEzNiwzNjEuMDEzIDM4NC40MDksMzY1LjY4NSAzODEuNDYxIEMgMzY2LjE4OCAzODEuMTQzLDM2Ny4wMjQgMzgwLjc1NywzNjcuNTQxIDM4MC42MDIgQyAzNzAuNTgzIDM3OS42OTEsMzc2LjYyMyAzNzQuMjAwLDM3OS4zODIgMzY5LjgzNiBDIDM4NS4xMDUgMzYwLjc4NSwzODQuMDM5IDM0Ni40MDksMzc3LjAzOSAzMzguMjI4IEMgMzc2LjA4NCAzMzcuMTEzLDM0NC44NDYgMzA1Ljc0MywzMDcuNjIxIDI2OC41MTcgQyAyNTUuMzI5IDIxNi4yMjQsMjM5Ljk2OSAyMDAuNjQ3LDI0MC4wNzAgMjAwLjAwOSBDIDI0MC4xNDMgMTk5LjU0NSwyNzAuMDYyIDE2OS4yODgsMzA4LjIxNiAxMzEuMDkxIEMgMzQ1LjYyNSA5My42NDEsMzc2LjcyMyA2Mi4zNzAsMzc3LjMyNCA2MS42MDAgQyAzODQuMjg2IDUyLjY3OCwzODUuMDM2IDQwLjYyMSwzNzkuMjc3IDMwLjE3MSBDIDM3Ni4xMzYgMjQuNDY5LDM2Ny45MDYgMTguNTM3LDM2MS42NjggMTcuNDc3IEMgMzU0LjY1NiAxNi4yODYsMzQ1LjA5NSAxNy42NjUsMzQxLjg4MyAyMC4zMzEgQyAzNDEuNTY3IDIwLjU5NCwzNDAuNTQ5IDIxLjMxOCwzMzkuNjIyIDIxLjk0MSBDIDMzOC42OTUgMjIuNTYzLDMwNy4wMzEgNTMuOTcyLDI2OS4yNTkgOTEuNzM3IEMgMjMxLjQ4NiAxMjkuNTAxLDIwMC4zMzAgMTYwLjQwMCwyMDAuMDIyIDE2MC40MDAgQyAxOTkuNzE0IDE2MC40MDAsMTY4LjkzOCAxMjkuODY5LDEzMS42MzEgOTIuNTU0IEMgNTYuMjI1IDE3LjEzMSw2MC4yODggMjEuMDQ3LDU1LjIwMCAxOC44ODcgQyA1MS41OTEgMTcuMzU0LDQyLjgzNiAxNi4zNDMsNDAuNDAwIDE3LjE3OHoiIGZpbGw9InJnYigyNDAsIDcxLCA3MSkiPjwvcGF0aD48L3N2Zz4='`;
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() {
return [
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormItem, {
title: _this.labels.modal_customopen_text,
className: BDFDB.disCN.marginbottom20,
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TextInput, {
type: "file",
filter: "image",
value: this.props.open,
onChange: value => {
this.props.open = value;
BDFDB.ReactUtils.forceUpdate(this);
}
})
}),
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormItem, {
title: _this.labels.modal_customclosed_text,
className: BDFDB.disCN.marginbottom20,
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TextInput, {
type: "file",
filter: "image",
value: this.props.closed,
onChange: value => {
this.props.closed = value;
BDFDB.ReactUtils.forceUpdate(this);
}
})
}),
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormItem, {
title: _this.labels.modal_custompreview_text,
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: (e, instance) => {
let inputIns = BDFDB.ReactUtils.findOwner(this, {name: "BDFDB_TextInput", all: true, unlimited: true});
if (inputIns.length == 2 && inputIns[0].props.value && inputIns[1].props.value) {
this.checkImage(inputIns[0].props.value, openIcon => {
this.checkImage(inputIns[1].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 the 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: "render",
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.GuildUtils.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_text,
id: BDFDB.ContextMenuUtils.createItemId(this.name, "submenu-add"),
children: folder ? [
BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
label: this.labels.serversubmenu_removefromfolder_text,
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_text,
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_text,
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_text,
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_text,
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_text,
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, {name: ["FluxContainer(Guilds)", "FluxContainer(NavigableGuilds)"]});
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: BDFDB.DiscordConstants.Colors.BRAND}
});
}
}
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 [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_text},
{value: this.labels.modal_tabheader2_text},
{value: this.labels.modal_tabheader3_text},
{value: this.labels.modal_tabheader4_text}
],
onItemSelect: (value, instance) => {
let tabContentInstances = BDFDB.ReactUtils.findOwner(e.instance, {name: "BDFDB_ModalTabContent", all: true, unlimited: true});
for (let ins of tabContentInstances) {
if (ins.props.tab == value) ins.props.open = true;
else delete ins.props.open;
}
BDFDB.ReactUtils.forceUpdate(tabContentInstances);
}
})
})
}));
}
[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_text,
open: true,
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, {
inputClassName: "input-foldername",
value: folder.folderName,
placeholder: folder.folderName || BDFDB.LanguageUtils.LanguageStrings.SERVER_FOLDER_PLACEHOLDER,
autoFocus: true
})
}),
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormItem, {
title: this.labels.modal_iconpicker_text,
className: BDFDB.disCN.marginbottom20,
children: BDFDB.ReactUtils.createElement(folderIconPickerComponent, {
selectedIcon: data.iconID
}, true)
}),
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsItem, {
type: "Switch",
className: "input-usecloseicon",
margin: 20,
label: this.labels.modal_usecloseicon_text,
tag: BDFDB.LibraryComponents.FormComponents.FormTitle.Tags.H5,
value: data.useCloseIcon
})
]
}),
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ModalComponents.ModalTabContent, {
tab: this.labels.modal_tabheader2_text,
children: [
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormItem, {
title: this.labels.modal_colorpicker1_text,
className: BDFDB.disCN.marginbottom20,
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ColorSwatches, {
color: data.color1,
defaultFallback: !data.color1 && !data.swapColors,
number: 1
})
}),
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormItem, {
title: this.labels.modal_colorpicker2_text,
className: BDFDB.disCN.marginbottom20,
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ColorSwatches, {
color: data.color2,
defaultFallback: !data.color2 && data.swapColors,
number: 2
})
}),
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsItem, {
type: "Switch",
className: "input-swapcolors",
margin: 20,
label: this.labels.modal_swapcolor_text,
tag: BDFDB.LibraryComponents.FormComponents.FormTitle.Tags.H5,
value: data.swapColors
})
]
}),
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ModalComponents.ModalTabContent, {
tab: this.labels.modal_tabheader3_text,
children: [
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormItem, {
title: this.labels.modal_colorpicker3_text,
className: BDFDB.disCN.marginbottom20,
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ColorSwatches, {
color: data.color3,
number: 3
})
}),
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormItem, {
title: this.labels.modal_colorpicker4_text,
className: BDFDB.disCN.marginbottom20,
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ColorSwatches, {
color: data.color4,
number: 4
})
}),
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsItem, {
type: "Switch",
className: "input-copytooltipcolor",
margin: 20,
label: this.labels.modal_copytooltipcolor_text,
tag: BDFDB.LibraryComponents.FormComponents.FormTitle.Tags.H5,
value: data.copyTooltipColor
})
]
}),
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ModalComponents.ModalTabContent, {
tab: this.labels.modal_tabheader4_text,
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: event => {
let oldData = Object.assign({}, data);
let root = BDFDB.ReactUtils.findDOMNode(e.instance).parentElement.querySelector(BDFDB.dotCN.layermodal);
data.iconID = root.querySelector(BDFDB.dotCN._serverfoldersiconswatch + BDFDB.dotCN._serverfoldersiconswatchselected).getAttribute("iconID");
data.useCloseIcon = root.querySelector(".input-usecloseicon " + BDFDB.dotCN.switchinner).checked;
data.swapColors = root.querySelector(".input-swapcolors " + BDFDB.dotCN.switchinner).checked;
data.copyTooltipColor = root.querySelector(".input-copytooltipcolor " + BDFDB.dotCN.switchinner).checked;
data.color1 = BDFDB.ColorUtils.getSwatchColor(root, 1);
data.color2 = BDFDB.ColorUtils.getSwatchColor(root, 2);
data.color3 = BDFDB.ColorUtils.getSwatchColor(root, 3);
data.color4 = BDFDB.ColorUtils.getSwatchColor(root, 4);
let nativeColor = data.swapColors ? "color2" : "color1";
this.updateFolder({
folderId: e.instance.props.folderId,
folderName: root.querySelector(".input-foldername").value,
folderColor: data[nativeColor] ? BDFDB.ColorUtils.convert(data[nativeColor] && BDFDB.ObjectUtils.is(data[nativeColor]) ? data[nativeColor][Object.keys(data[nativeColor])[0]] : data[nativeColor], "INT") : null
});
if (!BDFDB.equals(oldData, data)) {
BDFDB.DataUtils.save(data, 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_text,
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,
click: (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 "hr": //croatian
return {
servercontext_serverfolders_text: "Poslužitelj mapu",
serversubmenu_createfolder_text: "Izradi mapu",
serversubmenu_addtofolder_text: "Dodaj poslužitelj u mapu",
serversubmenu_removefromfolder_text: "Ukloni poslužitelj iz mapu",
foldercontext_autoreadfolder_text: "Auto: Označite kao pročitano",
foldercontext_mutefolder_text: "Isključite mapu",
foldercontext_removefolder_text: "Izbriši mapu",
modal_tabheader1_text: "Mape",
modal_tabheader2_text: "Boja mape",
modal_tabheader3_text: "Boja tooltip",
modal_tabheader4_text: "Prilagođeni ikona",
modal_iconpicker_text: "Odabir mape",
modal_usecloseicon_text: "Koristite zatvorenu ikonu umjesto minisevera",
modal_swapcolor_text: "Koristite drugu boju za izvorne mape",
modal_copytooltipcolor_text: "Koristite iste boje za poslužitelj u mapi",
modal_colorpicker1_text: "Boja primarne mape",
modal_colorpicker2_text: "Boja sekundarne mape",
modal_colorpicker3_text: "Boja tooltip",
modal_colorpicker4_text: "Boja fonta",
modal_customopen_text: "Otvori ikona",
modal_customclosed_text: "Zatvorena ikona",
modal_custompreview_text: "Pregled ikona"
};
case "da": //danish
return {
servercontext_serverfolders_text: "Servermapper",
serversubmenu_createfolder_text: "Opret mappe",
serversubmenu_addtofolder_text: "Tilføj server til mappe",
serversubmenu_removefromfolder_text: "Fjern server fra mappe",
foldercontext_autoreadfolder_text: "Auto: Markér som læst",
foldercontext_mutefolder_text: "Dæmp mappe",
foldercontext_removefolder_text: "Slet mappe",
modal_tabheader1_text: "Mappe",
modal_tabheader2_text: "Mappefarve",
modal_tabheader3_text: "Tooltipfarve",
modal_tabheader4_text: "Brugerdefinerede ikoner",
modal_iconpicker_text: "Mappevalg",
modal_usecloseicon_text: "Brug et lukket ikon i stedet for miniserverne",
modal_swapcolor_text: "BBrug den anden farve til de originale mapper",
modal_copytooltipcolor_text: "Brug de samme farver til server på mappen",
modal_colorpicker1_text: "Primær mappefarve",
modal_colorpicker2_text: "Sekundær mappefarve",
modal_colorpicker3_text: "Tooltipfarve",
modal_colorpicker4_text: "Skriftfarve",
modal_customopen_text: "Åbn ikon",
modal_customclosed_text: "Lukket ikon",
modal_custompreview_text: "Ikon forhåndsvisning"
};
case "de": //german
return {
servercontext_serverfolders_text: "Serverordner",
serversubmenu_createfolder_text: "Ordner erzeugen",
serversubmenu_addtofolder_text: "Server zum Ordner hinzufügen",
serversubmenu_removefromfolder_text: "Server aus Ordner entfernen",
foldercontext_autoreadfolder_text: "Auto: Als gelesen markieren",
foldercontext_mutefolder_text: "Ordner stummschalten",
foldercontext_removefolder_text: "Ordner löschen",
modal_tabheader1_text: "Ordner",
modal_tabheader2_text: "Ordnerfarbe",
modal_tabheader3_text: "Tooltipfarbe",
modal_tabheader4_text: "Eigene Icons",
modal_iconpicker_text: "Ordnerauswahl",
modal_usecloseicon_text: "Verwende anstelle der Miniserver ein geschlossenes Symbol",
modal_swapcolor_text: "Verwende die zweite Farbe für den ursprünglichen Ordner",
modal_copytooltipcolor_text: "Verwende dieselbe Farbe für alle Server eines Ordners",
modal_colorpicker1_text: "Primäre Ordnerfarbe",
modal_colorpicker2_text: "Sekundäre Ordnerfarbe",
modal_colorpicker3_text: "Tooltipfarbe",
modal_colorpicker4_text: "Schriftfarbe",
modal_customopen_text: "Geöffnetes Icon",
modal_customclosed_text: "Geschlossenes Icon",
modal_custompreview_text: "Iconvorschau"
};
case "es": //spanish
return {
servercontext_serverfolders_text: "Carpetas de servidor",
serversubmenu_createfolder_text: "Crear carpeta",
serversubmenu_addtofolder_text: "Añadir servidor a la carpeta",
serversubmenu_removefromfolder_text: "Eliminar servidor de la carpeta",
foldercontext_autoreadfolder_text: "Auto: Marcar como leído",
foldercontext_mutefolder_text: "Silenciar carpeta",
foldercontext_removefolder_text: "Eliminar carpeta",
modal_tabheader1_text: "Carpeta",
modal_tabheader2_text: "Color de carpeta",
modal_tabheader3_text: "Color de tooltip",
modal_tabheader4_text: "Iconos personalizados",
modal_iconpicker_text: "Selección de carpeta",
modal_usecloseicon_text: "Use un icono cerrado en lugar de los miniservidores",
modal_swapcolor_text: "Use el segundo color para las carpetas originales",
modal_copytooltipcolor_text: "Usa los mismos colores para el servidor de la carpeta",
modal_colorpicker1_text: "Color primaria de carpeta",
modal_colorpicker2_text: "Color secundario de la carpeta",
modal_colorpicker3_text: "Color de tooltip",
modal_colorpicker4_text: "Color de fuente",
modal_customopen_text: "Ícono abierto",
modal_customclosed_text: "Icono cerrado",
modal_custompreview_text: "Vista previa del icono"
};
case "fr": //french
return {
servercontext_serverfolders_text: "Dossiers du serveur",
serversubmenu_createfolder_text: "Créer le dossier",
serversubmenu_addtofolder_text: "Ajouter le serveur à un dossier",
serversubmenu_removefromfolder_text: "Supprimer le serveur du dossier",
foldercontext_autoreadfolder_text: "Auto: Marquer comme lu",
foldercontext_mutefolder_text: "Rendre muet le dossier",
foldercontext_removefolder_text: "Supprimer le dossier",
modal_tabheader1_text: "Dossier",
modal_tabheader2_text: "Couleur du dossier",
modal_tabheader3_text: "Couleur de tooltip",
modal_tabheader4_text: "Icônes personnalisées",
modal_iconpicker_text: "Choix du dossier",
modal_usecloseicon_text: "Utilisez une icône fermée à la place des mini-serveurs",
modal_swapcolor_text: "Utilisez la deuxième couleur pour les dossiers d'origine",
modal_copytooltipcolor_text: "Utilisez les mêmes couleurs pour le serveur du dossier",
modal_colorpicker1_text: "Couleur primaire du dossier",
modal_colorpicker2_text: "Couleur secondaire du dossier",
modal_colorpicker3_text: "Couleur de tooltip",
modal_colorpicker4_text: "Couleur de la police",
modal_customopen_text: "Icône ouverte",
modal_customclosed_text: "Icône fermée",
modal_custompreview_text: "Aperçu de l'icône"
};
case "it": //italian
return {
servercontext_serverfolders_text: "Cartelle del server",
serversubmenu_addtofolder_text: "Aggiungi il server alla cartella",
serversubmenu_createfolder_text: "Creare una cartella",
serversubmenu_removefromfolder_text: "Rimuovi il server dalla cartella",
foldercontext_autoreadfolder_text: "Auto: Contrassegna come letto",
foldercontext_mutefolder_text: "Disattiva cartella",
foldercontext_removefolder_text: "Elimina cartella",
modal_tabheader1_text: "Cartella",
modal_tabheader2_text: "Colore della cartella",
modal_tabheader3_text: "Colore della tooltip",
modal_tabheader4_text: "Icone personalizzate",
modal_iconpicker_text: "Selezione della cartella",
modal_usecloseicon_text: "Utilizzare un'icona chiusa anziché i mini server",
modal_swapcolor_text: "Usa il secondo colore per le cartelle originali",
modal_copytooltipcolor_text: "Usa gli stessi colori per il server della cartella",
modal_colorpicker1_text: "Colore primaria della cartella",
modal_colorpicker2_text: "Colore secondaria della cartella",
modal_colorpicker3_text: "Colore della tooltip",
modal_colorpicker4_text: "Colore del carattere",
modal_customopen_text: "Icona aperta",
modal_customclosed_text: "Icona chiusa",
modal_custompreview_text: "Icona anteprima"
};
case "nl": //dutch
return {
servercontext_serverfolders_text: "Servermappen",
serversubmenu_addtofolder_text: "Voeg server toe aan de map",
serversubmenu_createfolder_text: "Map aanmaken",
serversubmenu_removefromfolder_text: "Verwijder de server uit de map",
foldercontext_autoreadfolder_text: "Auto: Markeren als gelezen",
foldercontext_mutefolder_text: "Demp map",
foldercontext_removefolder_text: "Verwijder map",
modal_tabheader1_text: "Map",
modal_tabheader2_text: "Mapkleur",
modal_tabheader3_text: "Tooltipkleur",
modal_tabheader4_text: "Aangepaste keuze",
modal_iconpicker_text: "Map keuze",
modal_usecloseicon_text: "Gebruik een gesloten keuze in plaats van de miniservers",
modal_swapcolor_text: "Gebruik de tweede kleur voor de originele mappen",
modal_copytooltipcolor_text: "Gebruik dezelfde kleuren voor de server van de map",
modal_colorpicker1_text: "Primaire mapkleur",
modal_colorpicker2_text: "Tweede mapkleur",
modal_colorpicker3_text: "Tooltipkleur",
modal_colorpicker4_text: "Doopvontkleur",
modal_customopen_text: "Geopende keuze",
modal_customclosed_text: "Gesloten keuze",
modal_custompreview_text: "Voorbeeld van keuze"
};
case "no": //norwegian
return {
servercontext_serverfolders_text: "Servermapper",
serversubmenu_addtofolder_text: "Legg til server i mappe",
serversubmenu_createfolder_text: "Lag mappe",
serversubmenu_removefromfolder_text: "Fjern server fra mappe",
foldercontext_autoreadfolder_text: "Auto: Merk som les",
foldercontext_mutefolder_text: "Demp mappe",
foldercontext_removefolder_text: "Slett mappe",
modal_tabheader1_text: "Mappe",
modal_tabheader2_text: "Mappefarge",
modal_tabheader3_text: "Tooltipfarge",
modal_tabheader4_text: "Tilpassede ikoner",
modal_iconpicker_text: "Mappevalg",
modal_usecloseicon_text: "Bruk et lukket ikon i stedet for minitjenerne",
modal_swapcolor_text: "Bruk den andre fargen for de originale mappene",
modal_copytooltipcolor_text: "Bruk de samme fargene til serveren til mappen",
modal_colorpicker1_text: "Primær mappefarge",
modal_colorpicker2_text: "Sekundær mappefarge",
modal_colorpicker3_text: "Tooltipfarge",
modal_colorpicker4_text: "Skriftfarge",
modal_customopen_text: "Åpnet ikon",
modal_customclosed_text: "Lukket ikon",
modal_custompreview_text: "Ikon forhåndsvisning"
};
case "pl": //polish
return {
servercontext_serverfolders_text: "Foldery serwera",
serversubmenu_addtofolder_text: "Dodaj serwer do folderu",
serversubmenu_createfolder_text: "Utwórz folder",
serversubmenu_removefromfolder_text: "Usuń serwer z folderu",
foldercontext_autoreadfolder_text: "Auto: Oznacz jako przeczytane",
foldercontext_mutefolder_text: "Wycisz folder",
foldercontext_removefolder_text: "Usuń folder",
modal_tabheader1_text: "Folder",
modal_tabheader2_text: "Kolor folderu",
modal_tabheader3_text: "Kolor podpowiedzi",
modal_tabheader4_text: "Niestandardowe ikony",
modal_iconpicker_text: "Wybór folderu",
modal_usecloseicon_text: "Użyj zamkniętej ikony zamiast mini serwerów",
modal_swapcolor_text: "Użyj drugiego koloru dla oryginalnych folderów",
modal_copytooltipcolor_text: "Użyj tych samych kolorów dla serwera folderu",
modal_colorpicker1_text: "Podstawowy kolor folderu",
modal_colorpicker2_text: "Drugorzędny kolor folderu",
modal_colorpicker3_text: "Kolor podpowiedzi",
modal_colorpicker4_text: "Kolor czcionki",
modal_customopen_text: "Otwarta ikona",
modal_customclosed_text: "Zamknięta ikona",
modal_custompreview_text: "Podgląd ikony"
};
case "pt-BR": //portuguese (brazil)
return {
servercontext_serverfolders_text: "Pastas de servidores",
serversubmenu_addtofolder_text: "Adicionar servidor à pasta",
serversubmenu_createfolder_text: "Criar pasta",
serversubmenu_removefromfolder_text: "Remover servidor da pasta",
foldercontext_autoreadfolder_text: "Auto: Marcar como lido",
foldercontext_mutefolder_text: "Silenciar pasta",
foldercontext_removefolder_text: "Excluir pasta",
modal_tabheader1_text: "Pasta",
modal_tabheader2_text: "Cor da pasta",
modal_tabheader3_text: "Cor da tooltip",
modal_tabheader4_text: "Ícones personalizados",
modal_iconpicker_text: "Escolha da pasta",
modal_usecloseicon_text: "Use um ícone fechado em vez dos mini servidores",
modal_swapcolor_text: "Use a segunda cor para as pastas originais",
modal_copytooltipcolor_text: "Use as mesmas cores para o servidor da pasta",
modal_colorpicker1_text: "Cor primária da pasta",
modal_colorpicker2_text: "Cor secundária da pasta",
modal_colorpicker3_text: "Cor da tooltip",
modal_colorpicker4_text: "Cor da fonte",
modal_customopen_text: "Ícone aberto",
modal_customclosed_text: "Ícone fechado",
modal_custompreview_text: "Pré-visualização de ícones"
};
case "fi": //finnish
return {
servercontext_serverfolders_text: "Palvelinkansiot",
serversubmenu_addtofolder_text: "Lisää palvelin kansioon",
serversubmenu_createfolder_text: "Luo kansio",
serversubmenu_removefromfolder_text: "Poista palvelin kansioon",
foldercontext_autoreadfolder_text: "Auto: merkitse luettavaksi",
foldercontext_mutefolder_text: "Mykistä kansio",
foldercontext_removefolder_text: "Poista kansio",
modal_tabheader1_text: "Kansio",
modal_tabheader2_text: "Kansionväri",
modal_tabheader3_text: "Tooltipväri",
modal_tabheader4_text: "Mukautetut kuvakkeet",
modal_iconpicker_text: "Kansion valinta",
modal_usecloseicon_text: "Käytä suljettua kuvaketta minipalvelimien sijasta",
modal_swapcolor_text: "Käytä toista väriä alkuperäisissä kansioissa",
modal_copytooltipcolor_text: "Käytä samoja värejä kansion palvelimelle",
modal_colorpicker1_text: "Ensisijainen kansionväri",
modal_colorpicker2_text: "Toissijainen kansionväri",
modal_colorpicker3_text: "Tooltipväri",
modal_colorpicker4_text: "Fontinväri",
modal_customopen_text: "Avattu kuvake",
modal_customclosed_text: "Suljettu kuvake",
modal_custompreview_text: "Kuvakkeen esikatselu"
};
case "sv": //swedish
return {
servercontext_serverfolders_text: "Servermappar",
serversubmenu_addtofolder_text: "Lägg till server i mapp",
serversubmenu_createfolder_text: "Skapa mapp",
serversubmenu_removefromfolder_text: "Ta bort servern från mappen",
foldercontext_autoreadfolder_text: "Auto: Markera som Läs",
foldercontext_mutefolder_text: "Stäng mapp",
foldercontext_removefolder_text: "Ta bort mapp",
modal_tabheader1_text: "Mapp",
modal_tabheader2_text: "Mappfärg",
modal_tabheader3_text: "Tooltipfärg",
modal_tabheader4_text: "Anpassade ikoner",
modal_iconpicker_text: "Mappval",
modal_usecloseicon_text: "Använd en stängd ikon istället för miniservrarna",
modal_swapcolor_text: "Använd den andra färgen för originalmapparna",
modal_copytooltipcolor_text: "Använd samma färger för mappen på mappen",
modal_colorpicker1_text: "Primär mappfärg",
modal_colorpicker2_text: "Sekundär mappfärg",
modal_colorpicker3_text: "Tooltipfärg",
modal_colorpicker4_text: "Fontfärg",
modal_customopen_text: "Öppnad ikon",
modal_customclosed_text: "Closed Icon",
modal_custompreview_text: "Ikon förhandsvisning"
};
case "tr": //turkish
return {
servercontext_serverfolders_text: "Sunucu klasörleri",
serversubmenu_addtofolder_text: "Klasöre sunucu ekle",
serversubmenu_createfolder_text: "Klasör oluşturun",
serversubmenu_removefromfolder_text: "Sunucuyu klasörden kaldır",
foldercontext_autoreadfolder_text: "Oto: Okundu Olarak İşaretle",
foldercontext_mutefolder_text: "Klasörü kapat",
foldercontext_removefolder_text: "Klasörü sil",
modal_tabheader1_text: "Klasör",
modal_tabheader2_text: "Klasör rengi",
modal_tabheader3_text: "Tooltip rengi",
modal_tabheader4_text: "Özel simgeler",
modal_iconpicker_text: "Klasör seçimi",
modal_usecloseicon_text: "Mini sunucular yerine kapalı bir simge kullanın",
modal_swapcolor_text: "Orijinal klasörler için ikinci rengi kullanın",
modal_copytooltipcolor_text: "Klasörün sunucusu için aynı renkleri kullanın",
modal_colorpicker1_text: "Birincil klasör rengi",
modal_colorpicker2_text: "İkincil klasör rengi",
modal_colorpicker3_text: "Tooltip rengi",
modal_colorpicker4_text: "Yazı rengi",
modal_customopen_text: "Açılmış simge",
modal_customclosed_text: "Kapalı simge",
modal_custompreview_text: "Simge önizleme"
};
case "cs": //czech
return {
servercontext_serverfolders_text: "Složky serveru",
serversubmenu_addtofolder_text: "Přidat server do složky",
serversubmenu_createfolder_text: "Vytvořit složky",
serversubmenu_removefromfolder_text: "Odebrat server ze složky",
foldercontext_autoreadfolder_text: "Auto: Označit jako přečtené",
foldercontext_mutefolder_text: "Ztlumte složky",
foldercontext_removefolder_text: "Smazat složky",
modal_tabheader1_text: "Složky",
modal_tabheader2_text: "Barva složky",
modal_tabheader3_text: "Barva tooltip",
modal_tabheader4_text: "Vlastní ikony",
modal_iconpicker_text: "Volba složky",
modal_usecloseicon_text: "Místo mini serverů použijte uzavřenou ikonu",
modal_swapcolor_text: "Použijte druhou barvu pro původní složky",
modal_copytooltipcolor_text: "Použijte stejné barvy pro server složky",
modal_colorpicker1_text: "Primární barva složky",
modal_colorpicker2_text: "Sekundární barva složky",
modal_colorpicker3_text: "Barva tooltip",
modal_colorpicker4_text: "Barva fontu",
modal_customopen_text: "Otevřená ikona",
modal_customclosed_text: "Uzavřená ikona",
modal_custompreview_text: "Náhled ikony"
};
case "bg": //bulgarian
return {
servercontext_serverfolders_text: "Сървърни папки",
serversubmenu_addtofolder_text: "Добавяне на сървър в папка",
serversubmenu_createfolder_text: "Създай папка",
serversubmenu_removefromfolder_text: "Премахване на сървър от папка",
foldercontext_autoreadfolder_text: "Авто: Маркиране като четене",
foldercontext_mutefolder_text: "Заглушаване на папката",
foldercontext_removefolder_text: "Изтриване на папка",
modal_tabheader1_text: "Папка",
modal_tabheader2_text: "Цвят на папка",
modal_tabheader3_text: "Цвят на подсказка",
modal_tabheader4_text: "Персонализирани икони",
modal_iconpicker_text: "Избор на папки",
modal_usecloseicon_text: "Използвайте затворена икона вместо мини сървърите",
modal_swapcolor_text: "Използвайте втория цвят за оригиналните папки",
modal_copytooltipcolor_text: "Използвайте същите цветове за сървъра на папката",
modal_colorpicker3_text: "Цвят на подсказка",
modal_colorpicker4_text: "Цвят на шрифта",
modal_colorpicker1_text: "Цвят основнен на папка",
modal_colorpicker2_text: "цвят вторичен на папка",
modal_customopen_text: "Отворена икона",
modal_customclosed_text: "Затворена икона",
modal_custompreview_text: "Икона Преглед"
};
case "ru": //russian
return {
servercontext_serverfolders_text: "Папки сервера",
serversubmenu_addtofolder_text: "Добавить сервер в папку",
serversubmenu_createfolder_text: "Создать папки",
serversubmenu_removefromfolder_text: "Удалить сервер из папки",
foldercontext_autoreadfolder_text: "Авто: Отметить как прочитанное",
foldercontext_mutefolder_text: "Отключить папки",
foldercontext_removefolder_text: "Удалить папки",
modal_tabheader1_text: "Папка",
modal_tabheader2_text: "Цвет папки",
modal_tabheader3_text: "Цвет подсказка",
modal_tabheader4_text: "Пользовательские значки",
modal_iconpicker_text: "Выбор папки",
modal_usecloseicon_text: "Используйте закрытую иконку вместо мини-серверов",
modal_swapcolor_text: "Используйте второй цвет для оригинальных папок",
modal_copytooltipcolor_text: "Используйте те же цвета для сервера папки",
modal_colorpicker1_text: "Цвет основной папки",
modal_colorpicker2_text: "Цвет вторичной папки",
modal_colorpicker3_text: "Цвет подсказка",
modal_colorpicker4_text: "Цвет шрифта",
modal_customopen_text: "Открытая иконка",
modal_customclosed_text: "Закрытая иконка",
modal_custompreview_text: "Иконка Просмотр"
};
case "uk": //ukrainian
return {
servercontext_serverfolders_text: "Папки сервера",
serversubmenu_addtofolder_text: "Додати сервер до папки",
serversubmenu_createfolder_text: "Створити папки",
serversubmenu_removefromfolder_text: "Видалити папку з папки",
foldercontext_autoreadfolder_text: "Авто: Позначити як прочитане",
foldercontext_mutefolder_text: "Відключення папки",
foldercontext_removefolder_text: "Видалити папки",
modal_tabheader1_text: "Папки",
modal_tabheader2_text: "Колір папки",
modal_tabheader3_text: "Колір підказка",
modal_tabheader4_text: "Користувальницькі іконки",
modal_iconpicker_text: "Вибір папки",
modal_usecloseicon_text: "Використовуйте закритий значок замість міні-серверів",
modal_swapcolor_text: "Використовуйте другий колір для оригінальних папок",
modal_copytooltipcolor_text: "Використовуйте ті ж кольори для сервера папки",
modal_colorpicker1_text: "Колір основної папки",
modal_colorpicker2_text: "Колір вторинного папки",
modal_colorpicker3_text: "Колір підказка",
modal_colorpicker4_text: "Колір шрифту",
modal_customopen_text: "Відкрита ікона",
modal_customclosed_text: "Закрита ікона",
modal_custompreview_text: "Піктограма попереднього перегляду"
};
case "ja": //japanese
return {
servercontext_serverfolders_text: "サーバーフォルダ",
serversubmenu_addtofolder_text: "サーバーをフォルダに追加する",
serversubmenu_createfolder_text: "フォルダーを作る",
serversubmenu_removefromfolder_text: "サーバーをフォルダから削除する",
foldercontext_autoreadfolder_text: "自動: 読み取りとしてマークする",
foldercontext_mutefolder_text: "ミュートフォルダー",
foldercontext_removefolder_text: "フォルダを削除する",
modal_tabheader1_text: "フォルダ",
modal_tabheader2_text: "フォルダの色",
modal_tabheader3_text: "ツールチップの色",
modal_tabheader4_text: "カスタムアイコン",
modal_iconpicker_text: "フォルダの選択",
modal_usecloseicon_text: "ミニサーバーの代わりに閉じたアイコンを使用する",
modal_swapcolor_text: "Використовуйте другий колір для оригінальних папок",
modal_copytooltipcolor_text: "フォルダのサーバーに同じ色を使う",
modal_colorpicker1_text: "プライマリフォルダの色",
modal_colorpicker2_text: "セカンダリフォルダの色",
modal_colorpicker3_text: "ツールチップの色",
modal_colorpicker4_text: "フォントの色",
modal_customopen_text: "開いたアイコン",
modal_customclosed_text: "クローズドアイコン",
modal_custompreview_text: "アイコンのプレビュー"
};
case "zh-TW": //chinese (traditional)
return {
servercontext_serverfolders_text: "服務器文件夾",
serversubmenu_addtofolder_text: "添加服務器到文件夾",
serversubmenu_createfolder_text: "創建文件夾",
serversubmenu_removefromfolder_text: "從文件夾中刪除服務器",
foldercontext_autoreadfolder_text: "自動: 標記為已讀",
foldercontext_mutefolder_text: "靜音文件夾",
foldercontext_removefolder_text: "刪除文件夾",
modal_tabheader1_text: "夾",
modal_tabheader2_text: "文件夾顏色",
modal_tabheader3_text: "工具提示顏色",
modal_tabheader4_text: "自定義圖標",
modal_iconpicker_text: "文件夾選擇",
modal_usecloseicon_text: "使用關閉的圖標代替迷你服務器",
modal_swapcolor_text: "將第二種顏色用於原始文件夾",
modal_copytooltipcolor_text: "對文件夾的服務器使用相同的顏色",
modal_colorpicker1_text: "主文件夾顏色",
modal_colorpicker2_text: "輔助文件夾顏色",
modal_colorpicker3_text: "工具提示顏色",
modal_colorpicker4_text: "字體顏色",
modal_customopen_text: "打開的圖標",
modal_customclosed_text: "封閉的圖標",
modal_custompreview_text: "圖標預覽"
};
case "ko": //korean
return {
servercontext_serverfolders_text: "서버 폴더",
serversubmenu_addtofolder_text: "폴더에 서버 추가",
serversubmenu_createfolder_text: "폴더 만들기",
serversubmenu_removefromfolder_text: "폴더에서 서버 제거",
foldercontext_autoreadfolder_text: "자동: 읽은 상태로 표시",
foldercontext_mutefolder_text: "폴더 음소거",
foldercontext_removefolder_text: "폴더 삭제",
modal_tabheader1_text: "폴더",
modal_tabheader2_text: "폴더 색",
modal_tabheader3_text: "툴팁 색깔",
modal_tabheader4_text: "사용자 정의 아이콘",
modal_iconpicker_text: "폴더 선택",
modal_usecloseicon_text: "미니 서버 대신 닫힌 아이콘을 사용하십시오",
modal_swapcolor_text: "원본 폴더에 두 번째 색상 사용",
modal_copytooltipcolor_text: "폴더의 서버에 대해 동일한 색상을 사용하십시오",
modal_colorpicker1_text: "기본 폴더 색",
modal_colorpicker2_text: "보조 폴더 색",
modal_colorpicker3_text: "툴팁 색깔",
modal_colorpicker4_text: "글꼴 색깔",
modal_customopen_text: "열린 아이콘",
modal_customclosed_text: "닫힌 아이콘",
modal_custompreview_text: "아이콘 미리보기"
};
default: //default: english
return {
servercontext_serverfolders_text: "Serverfolders",
serversubmenu_addtofolder_text: "Add Server to Folder",
serversubmenu_createfolder_text: "Create Folder",
serversubmenu_removefromfolder_text: "Remove Server from Folder",
foldercontext_autoreadfolder_text: "Auto: Mark As Read",
foldercontext_mutefolder_text: "Mute Folder",
foldercontext_removefolder_text: "Delete Folder",
modal_tabheader1_text: "Folder",
modal_tabheader2_text: "Foldercolor",
modal_tabheader3_text: "Tooltipcolor",
modal_tabheader4_text: "Custom Icons",
modal_iconpicker_text: "Folderchoice",
modal_usecloseicon_text: "Use a closed Icon instead of the Mini-Servers",
modal_swapcolor_text: "Use second Color for the native Folder",
modal_copytooltipcolor_text: "Use same Colors for Servers of the Folder",
modal_colorpicker1_text: "Primary Foldercolor",
modal_colorpicker2_text: "Secondary Foldercolor",
modal_colorpicker3_text: "Tooltipcolor",
modal_colorpicker4_text: "Fontcolor",
modal_customopen_text: "Open Icon",
modal_customclosed_text: "Closed Icon",
modal_custompreview_text: "Iconpreview"
};
}
}
};
})(window.BDFDB_Global.PluginUtils.buildPlugin(config));
})();