//META{"name":"ServerFolders","website":"https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/ServerFolders","source":"https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/Plugins/ServerFolders/ServerFolders.plugin.js"}*// class ServerFolders { getName () {return "ServerFolders";} getVersion () {return "6.3.6";} getAuthor () {return "DevilBro";} getDescription () {return "Adds the feature to create folders to organize your servers. Right click a server > 'Serverfolders' > 'Create Server' to create a server. To add servers to a folder hold 'Ctrl' and drag the server onto the folder, this will add the server to the folderlist and hide it in the serverlist. To open a folder click the folder. A folder can only be opened when it has at least one server in it. To remove a server from a folder, open the folder and either right click the server > 'Serverfolders' > 'Remove Server from Folder' or hold 'Del' and click the server in the folderlist.";} constructor () { this.changelog = { "fixed":[["Light Theme Update","Fixed bugs for the Light Theme Update, which broke 99% of my plugins"]] }; this.labels = {}; this.patchModules = { "Guilds":["componentDidMount","componentDidUpdate","componentWillUnmount"], "Guild":["componentDidMount","componentDidUpdate","render","componentWillUnmount"], "StandardSidebarView":"componentWillUnmount" }; } initConstructor () { this.cachedGuildState = {}; this.css = ` .${this.name}-modal .ui-icon-picker-icon { position: relative; width: 70px; height: 70px; border: 4px solid transparent; border-radius: 12px; margin: 0; } .${this.name}-modal .ui-icon-picker-icon .ui-picker-inner { margin: 5px 5px; width: 60px; height: 60px; background-repeat: no-repeat; background-clip: padding-box; background-position: 50%; background-size: cover; border-radius: 12px; } .${this.name}-modal .ui-icon-picker-icon.selected ${BDFDB.dotCN.hovercardbutton} { display: none !important; } .${this.name}-modal .ui-icon-picker-icon ${BDFDB.dotCN.hovercardbutton} { position: absolute; top: -10px; right: -10px; } .${this.name}-modal .ui-icon-picker-icon.preview.nopic .ui-picker-inner { background-image: url('data:image/svg+xml; utf8, '); } ${BDFDB.dotCN.guildouter}.folder ${BDFDB.dotCN.guildicon} { background-clip: padding-box !important; background-position: center !important; background-size: cover !important; } ${BDFDB.dotCN.guildupperbadge}.count { left: 0px; right: unset; } ${BDFDB.dotCN.guildouter}.serverfolders-dragpreview { pointer-events: none !important; position: absolute !important; opacity: 0.5 !important; z-index: 10000 !important; } ${BDFDB.dotCN.guildouter}.serverfolders-dragpreview, ${BDFDB.dotCN.guildouter}.serverfolders-dragpreview ${BDFDB.dotCN.guildinner}, ${BDFDB.dotCN.guildouter}.serverfolders-dragpreview ${BDFDB.dotCNS.guildinner + BDFDB.dotCN.guildiconwrapper}, ${BDFDB.dotCN.guildouter}.serverfolders-dragpreview ${BDFDB.dotCNS.guildinner + BDFDB.dotCNS.guildiconwrapper + BDFDB.dotCN.guildicon} { border-radius: 50% !important; width: 48px !important; height: 48px !important; } ${BDFDB.dotCN.guildouter}.serverfolders-dragpreview ${BDFDB.dotCN.guildpillwrapper}, ${BDFDB.dotCN.guildouter}.serverfolders-dragpreview ${BDFDB.dotCN.guildbadgewrapper} { display: none !important; } ${BDFDB.dotCN.guildouter}.serverfolders-dragpreview ${BDFDB.dotCN.guildiconacronym} { color: white !important; background-color: #444 !important; border-radius: 50% !important; overflow: hidden !important; } ${BDFDB.dotCN.guildswrapper}.foldercontent { transition: width .3s linear !important; left: 72px; } ${BDFDB.dotCN.guildswrapper}.foldercontent .folderseparatorouter { margin-top: 10px; } ${BDFDB.dotCN.guildswrapper}.foldercontent.foldercontentclosed { 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; }`; this.folderContentMarkup = `
`; this.folderIconMarkup = `
`; this.dragPlaceholderMarkup = `
`; this.folderSettingsModalMarkup = `

REPLACE_modal_header_text

REPLACE_modal_tabheader1_text
REPLACE_modal_tabheader2_text
REPLACE_modal_tabheader3_text
REPLACE_modal_tabheader4_text

REPLACE_modal_foldername_text

REPLACE_modal_iconpicker_text

REPLACE_modal_colorpicker1_text

REPLACE_modal_colorpicker2_text

REPLACE_modal_colorpicker3_text

REPLACE_modal_colorpicker4_text

REPLACE_modal_copytooltipcolor_text

REPLACE_modal_customopen_text

REPLACE_modal_customclosed_text

REPLACE_modal_custompreview_text

`; this.folderIcons = [ {openicon:``, closedicon:``}, {openicon:``, closedicon:``}, {openicon:``, closedicon:``}, {openicon:``, closedicon:``}, {openicon:``, closedicon:``}, {openicon:``, closedicon:``}, {openicon:``, closedicon:``} ]; 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."}, addSeparators: {value:true, description:"Adds separators between Servers of different Folders."} } }; } getSettingsPanel () { if (!global.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return; let settings = BDFDB.getAllData(this, "settings"); let settingshtml = `
${this.name}
`; for (let key in settings) { settingshtml += `

${this.defaults.settings[key].description}

`; } settingshtml += `

Reset all Folders.

`; settingshtml += `

Remove all custom Icons.

`; settingshtml += `
`; let settingspanel = BDFDB.htmlToElement(settingshtml); BDFDB.initElements(settingspanel, this); BDFDB.addEventListener(this, settingspanel, "click", ".reset-button", () => { BDFDB.openConfirmModal(this, "Are you sure you want to delete all folders?", () => { BDFDB.removeAllData(this, "folders"); this.resetAllElements(); }); }); BDFDB.addEventListener(this, settingspanel, "click", ".removecustom-button", () => { BDFDB.openConfirmModal(this, "Are you sure you want to remove all custom icons?", () => { BDFDB.removeAllData(this, "customicons"); }); }); return settingspanel; } //legacy load () {} start () { if (!global.BDFDB) global.BDFDB = {myPlugins:{}}; if (global.BDFDB && global.BDFDB.myPlugins && typeof global.BDFDB.myPlugins == "object") global.BDFDB.myPlugins[this.getName()] = this; var libraryScript = document.querySelector('head script#BDFDBLibraryScript'); if (!libraryScript || (performance.now() - libraryScript.getAttribute("date")) > 600000) { if (libraryScript) libraryScript.remove(); libraryScript = document.createElement("script"); libraryScript.setAttribute("id", "BDFDBLibraryScript"); libraryScript.setAttribute("type", "text/javascript"); libraryScript.setAttribute("src", "https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js"); libraryScript.setAttribute("date", performance.now()); libraryScript.addEventListener("load", () => {this.initialize();}); document.head.appendChild(libraryScript); this.libLoadTimeout = setTimeout(() => { libraryScript.remove(); BDFDB.LibraryRequires.request("https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js", (error, response, body) => { if (body) { libraryScript = document.createElement("script"); libraryScript.setAttribute("id", "BDFDBLibraryScript"); libraryScript.setAttribute("type", "text/javascript"); libraryScript.setAttribute("date", performance.now()); libraryScript.innerText = body; document.head.appendChild(libraryScript); } this.initialize(); }); }, 15000); } else if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize(); this.startTimeout = setTimeout(() => {this.initialize();}, 30000); } initialize () { if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) { if (this.started) return; BDFDB.loadMessage(this); BDFDB.WebModules.forceAllUpdates(this, "Guilds"); } else { console.error(`%c[${this.getName()}]%c`, 'color: #3a71c1; font-weight: 700;', '', 'Fatal Error: Could not load BD functions!'); } } stop () { if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) { this.resetAllElements(); BDFDB.removeClasses("foldercontentopened"); BDFDB.removeEles(this.foldercontent, BDFDB.dotCN.guildswrapper + ".foldercontent", ".serverfolder-contextmenu"); BDFDB.unloadMessage(this); } } onSwitch () { if (typeof BDFDB === "object" && BDFDB.getData("forceOpenFolder", this, "settings")) { let serverObj = BDFDB.getSelectedServer(); if (!serverObj) return; let folderdiv = this.getFolderOfServer(serverObj); if (!folderdiv || BDFDB.containsClass(folderdiv, "open")) return; this.openCloseFolder(folderdiv); } } // begin of own functions changeLanguageStrings () { this.folderSettingsModalMarkup = this.folderSettingsModalMarkup.replace("REPLACE_modal_header_text", this.labels.modal_header_text); this.folderSettingsModalMarkup = this.folderSettingsModalMarkup.replace("REPLACE_modal_foldername_text", this.labels.modal_foldername_text); this.folderSettingsModalMarkup = this.folderSettingsModalMarkup.replace("REPLACE_modal_tabheader1_text", this.labels.modal_tabheader1_text); this.folderSettingsModalMarkup = this.folderSettingsModalMarkup.replace("REPLACE_modal_tabheader2_text", this.labels.modal_tabheader2_text); this.folderSettingsModalMarkup = this.folderSettingsModalMarkup.replace("REPLACE_modal_tabheader3_text", this.labels.modal_tabheader3_text); this.folderSettingsModalMarkup = this.folderSettingsModalMarkup.replace("REPLACE_modal_tabheader4_text", this.labels.modal_tabheader4_text); this.folderSettingsModalMarkup = this.folderSettingsModalMarkup.replace("REPLACE_modal_iconpicker_text", this.labels.modal_iconpicker_text); this.folderSettingsModalMarkup = this.folderSettingsModalMarkup.replace("REPLACE_modal_copytooltipcolor_text", this.labels.modal_copytooltipcolor_text); this.folderSettingsModalMarkup = this.folderSettingsModalMarkup.replace("REPLACE_modal_colorpicker1_text", this.labels.modal_colorpicker1_text); this.folderSettingsModalMarkup = this.folderSettingsModalMarkup.replace("REPLACE_modal_colorpicker2_text", this.labels.modal_colorpicker2_text); this.folderSettingsModalMarkup = this.folderSettingsModalMarkup.replace("REPLACE_modal_colorpicker3_text", this.labels.modal_colorpicker3_text); this.folderSettingsModalMarkup = this.folderSettingsModalMarkup.replace("REPLACE_modal_colorpicker4_text", this.labels.modal_colorpicker4_text); this.folderSettingsModalMarkup = this.folderSettingsModalMarkup.replace("REPLACE_modal_customopen_text", this.labels.modal_customopen_text); this.folderSettingsModalMarkup = this.folderSettingsModalMarkup.replace("REPLACE_modal_customclosed_text", this.labels.modal_customclosed_text); this.folderSettingsModalMarkup = this.folderSettingsModalMarkup.replace("REPLACE_modal_custompreview_text", this.labels.modal_custompreview_text); } onGuildContextMenu (instance, menu, returnvalue) { if (document.querySelector(".BDFDB-modal")) return; if (instance.props && instance.props.target && instance.props.guild && instance.props.type == "GUILD_ICON_BAR" && !menu.querySelector(".serverfolders-item")) { let folders = document.querySelectorAll(BDFDB.dotCNS.guildswrapper + BDFDB.dotCN.guildouter + ".folder"); let folderdiv = this.getFolderOfServer(instance.props.guild); let addtofolderitems = []; for (let i = 0; i < folders.length; i++) addtofolderitems.push(BDFDB.React.createElement(BDFDB.LibraryComponents.ContextMenuItem, { label: folders[i].getAttribute("foldername") || (this.labels.modal_tabheader1_text + " #" + parseInt(i+1)), className: `BDFDB-contextMenuItem ${this.name}-contextMenuItem ${this.name}-addtofolder-contextMenuItem`, action: e => { BDFDB.closeContextMenu(menu); this.addServerToFolder(instance.props.guild, folders[i]); } })); let [children, index] = BDFDB.getContextMenuGroupAndIndex(returnvalue, ["FluxContainer(MessageDeveloperModeGroup)", "DeveloperModeGroup"]); const itemgroup = BDFDB.React.createElement(BDFDB.LibraryComponents.ContextMenuItemGroup, { className: `BDFDB-contextMenuItemGroup ${this.name}-contextMenuItemGroup`, children: [ BDFDB.React.createElement(BDFDB.LibraryComponents.ContextMenuSubItem, { label: this.labels.servercontext_serverfolders_text, className: `BDFDB-contextMenuSubItem ${this.name}-contextMenuSubItem ${this.name}-guild-contextMenuSubItem`, render: [ BDFDB.React.createElement(BDFDB.LibraryComponents.ContextMenuItem, { label: this.labels.serversubmenu_createfolder_text, className: `BDFDB-contextMenuItem ${this.name}-contextMenuItem ${this.name}-createfolder-contextMenuItem`, action: e => { BDFDB.closeContextMenu(menu); this.createNewFolder(instance.props.target); } }), folderdiv ? BDFDB.React.createElement(BDFDB.LibraryComponents.ContextMenuItem, { label: this.labels.serversubmenu_removefromfolder_text, className: `BDFDB-contextMenuItem ${this.name}-contextMenuItem ${this.name}-repo-contextMenuItem`, danger: true, action: e => { BDFDB.closeContextMenu(menu); this.removeServerFromFolder(instance.props.guild, folderdiv); } }) : BDFDB.React.createElement(BDFDB.LibraryComponents.ContextMenuSubItem, { label: this.labels.serversubmenu_addtofolder_text, className: `BDFDB-contextMenuSubItem ${this.name}-contextMenuSubItem ${this.name}-addtofolder-contextMenuSubItem`, disabled: !addtofolderitems.length, render: addtofolderitems }) ] }) ] }); if (index > -1) children.splice(index, 0, itemgroup); else children.push(itemgroup); } } processGuilds (instance, wrapper, returnvalue, methodnames) { if (methodnames.includes("componentWillUnmount")) { BDFDB.removeEles(this.foldercontent, BDFDB.dotCN.guildswrapper + ".foldercontent", ".serverfolder-contextmenu", BDFDB.dotCN.guildouter + ".folder"); this.foldercontent = null; } if (methodnames.includes("componentDidMount")) { let process = () => { if (!wrapper.parentElement.querySelector(BDFDB.dotCN.guildswrapper + ".foldercontent")) { this.foldercontent = BDFDB.htmlToElement(this.folderContentMarkup); wrapper.parentElement.insertBefore(this.foldercontent, wrapper.nextElementSibling); this.foldercontentguilds = this.foldercontent.querySelector(BDFDB.dotCN.guildsscroller); } let folders = BDFDB.sortObject(BDFDB.loadAllData(this, "folders"), "position"); for (let folderID in folders) if (folderID && !wrapper.querySelector(BDFDB.dotCN.guildouter + ".folder#" + folderID)) { let folderdiv = this.createFolderDiv(folders[folderID]); this.readIncludedServerList(folderdiv).forEach(guilddiv => {this.hideServer(guilddiv, folderdiv);}); } BDFDB.WebModules.forceAllUpdates(this, "Guild"); }; if (document.querySelector(BDFDB.dotCNS.guildswrapper + BDFDB.dotCN.guildouter + ":not(.folder):not(.copy) " + BDFDB.dotCN.guildicon)) process(); else setTimeout(process, 5000); } if (methodnames.includes("componentDidUpdate")) { let serverAndFolders = this.getAllServersAndFolders(); let folders = BDFDB.loadAllData(this, "folders"); let foundfolders = serverAndFolders.filter(ele => BDFDB.containsClass(ele, "folder")); if (Object.keys(folders).length != foundfolders.length) for (let folderdiv of document.querySelectorAll(BDFDB.dotCN.guildouter + ".folder")) { if (folders[folderdiv.id]) this.insertFolderDiv(folders[folderdiv.id], folderdiv); } } } processGuild (instance, wrapper, returnvalue, methodnames) { if (instance.props && instance.props.guild) { if (methodnames.includes("componentDidMount")) { this.cachedGuildState[instance.props.guild.id] = this.getGuildState(instance); let folderdiv = this.getFolderOfServer(instance.props.guild); if (folderdiv && !wrapper.getAttribute("folder")) { this.hideServer(wrapper, folderdiv); this.updateCopyInFolderContent(wrapper, folderdiv); this.updateFolderNotifications(folderdiv); } BDFDB.addEventListener(this, wrapper, "click", () => {setImmediate(() => { var newsettings = BDFDB.getAllData(this, "settings") if (newsettings.closeAllFolders) document.querySelectorAll(BDFDB.dotCNS.guildswrapper + BDFDB.dotCN.guildouter + ".folder.open").forEach(openFolder => { if (!newsettings.forceOpenFolder || !this.foldercontent.querySelector(`${BDFDB.dotCN.guildouter}[folder="${openFolder.id}"][guild="${BDFDB.LibraryModules.LastGuildStore.getGuildId()}"]`)) this.openCloseFolder(openFolder); }); })}); BDFDB.addEventListener(this, wrapper, "mousedown", e => { if (BDFDB.pressedKeys.includes(17)) { BDFDB.stopEvent(e); let dragpreview = this.createDragPreview(wrapper, e); let updatePreview = e2 => { this.updateDragPreview(dragpreview, e2); }; let droppedPreview = e2 => { let dropfolderdiv = BDFDB.getParentEle(BDFDB.dotCN.guildouter + ".folder", e2.target); if (dropfolderdiv) this.addServerToFolder(instance.props.guild, dropfolderdiv); document.removeEventListener("mousemove", updatePreview); document.removeEventListener("mouseup", droppedPreview); BDFDB.removeEles(dragpreview); }; document.addEventListener("mousemove", updatePreview); document.addEventListener("mouseup", droppedPreview); } }); } if (methodnames.includes("componentDidUpdate")) { let state = this.getGuildState(instance); if (!BDFDB.equals(state, this.cachedGuildState[instance.props.guild.id])) { this.cachedGuildState[instance.props.guild.id] = state; let folderdiv = this.getFolderOfServer(instance.props.guild); if (folderdiv) setTimeout(() => { this.updateCopyInFolderContent(wrapper, folderdiv); this.updateFolderNotifications(folderdiv); },1000); } } if (methodnames.includes("render")) { if (!wrapper.getAttribute("folder")) { let folderdiv = this.getFolderOfServer(instance.props.guild); if (folderdiv) { this.cachedGuildState[instance.props.guild.id] = this.getGuildState(instance); this.hideServer(wrapper, folderdiv); this.updateCopyInFolderContent(wrapper, folderdiv); this.updateFolderNotifications(folderdiv); } } } if (methodnames.includes("componentWillUnmount")) { let folderdiv = this.getFolderOfServer(instance.props.guild); if (folderdiv) { BDFDB.removeEles(this.foldercontent.querySelectorAll(`[guild="${instance.props.guild.id}"]`)); this.updateFolderNotifications(folderdiv); } } } } processStandardSidebarView (instance, wrapper, returnvalue) { if (this.SettingsUpdated && this.foldercontent) { delete this.SettingsUpdated; this.foldercontent.querySelectorAll(BDFDB.dotCN.guildouter + ".folder").forEach(folderdiv => {this.updateFolderNotifications(folderdiv);}); } } getGuildState (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]; return state; } showFolderSettings (folderdiv) { if (!folderdiv) return; let {folderID,folderName,position,iconID,icons,copyTooltipColor,color1,color2,color3,color4,servers,isOpen,autounread} = BDFDB.loadData(folderdiv.id, this, "folders") || {}; if (!folderID) return; let folderSettingsModal = BDFDB.htmlToElement(this.folderSettingsModalMarkup); let foldernameinput = folderSettingsModal.querySelector("#input-foldername"); let copytooltipcolorinput = folderSettingsModal.querySelector("#input-copytooltipcolor"); folderSettingsModal.querySelector(BDFDB.dotCN.modalguildname).innerText = folderName || ""; foldernameinput.value = folderName || ""; foldernameinput.setAttribute("placeholder", folderName || ""); copytooltipcolorinput.checked = copyTooltipColor; this.setIcons(folderSettingsModal, iconID); BDFDB.setColorSwatches(folderSettingsModal, color1); BDFDB.setColorSwatches(folderSettingsModal, color2); BDFDB.setColorSwatches(folderSettingsModal, color3); BDFDB.setColorSwatches(folderSettingsModal, color4); BDFDB.appendModal(folderSettingsModal); BDFDB.addChildEventListener(folderSettingsModal, "change", "input[type='file'][option]", e => { let file = e.currentTarget.files[0]; if (file) this.fetchCustomIcon(folderSettingsModal, e.currentTarget.getAttribute("option")); }); BDFDB.addChildEventListener(folderSettingsModal, "keyup", "input[type='text'][option]", e => { if (e.which == 13) this.fetchCustomIcon(folderSettingsModal, e.currentTarget.getAttribute("option")); }); BDFDB.addChildEventListener(folderSettingsModal, "click", ".btn-addcustom", () => { this.saveCustomIcon(folderSettingsModal); }); BDFDB.addChildEventListener(folderSettingsModal, "click", ".btn-save", e => { folderName = foldernameinput.value.trim(); folderName = folderName ? folderName : null; var oldIconID = iconID; var selectedIcon = folderSettingsModal.querySelector(".ui-icon-picker-icon.selected"); iconID = selectedIcon.getAttribute("value"); copyTooltipColor = copytooltipcolorinput.checked; var oldColor1 = color1; var oldColor2 = color2; color1 = BDFDB.getSwatchColor(folderSettingsModal, 1); color2 = BDFDB.getSwatchColor(folderSettingsModal, 2); color3 = BDFDB.getSwatchColor(folderSettingsModal, 3); color4 = BDFDB.getSwatchColor(folderSettingsModal, 4); if (folderName) folderdiv.setAttribute("foldername", folderName); else folderdiv.removeAttribute("foldername"); folderdiv.querySelector(BDFDB.dotCN.guildiconwrapper).setAttribute("aria-label", folderName || ""); if (iconID != oldIconID || !BDFDB.equals(color1, oldColor1) || !BDFDB.equals(color2, oldColor2)) { let folderIcons = this.loadAllIcons(); let isCustom = BDFDB.containsClass(selectedIcon, "custom"); icons.openicon = !isCustom ? this.createBase64SVG(folderIcons[iconID].openicon, color1, color2) : folderIcons[iconID].openicon; icons.closedicon = !isCustom ? this.createBase64SVG(folderIcons[iconID].closedicon, color1, color2) : folderIcons[iconID].closedicon; folderdiv.querySelector(BDFDB.dotCN.guildicon).setAttribute("src", `${isOpen ? icons.openicon : icons.closedicon}`); BDFDB.saveData(folderID, {folderID,folderName,position,iconID,icons,copyTooltipColor,color1,color2,color3,color4,servers,isOpen}, this, "folders"); } else BDFDB.saveData(folderID, {folderID,folderName,position,iconID,icons,copyTooltipColor,color1,color2,color3,color4,servers,isOpen}, this, "folders"); }); foldernameinput.focus(); } createBase64SVG (paths, color1 = "#000000", color2 = "#FFFFFF") { if (paths.indexOf("`; if (isgradient1) { svg += ``; for (let pos of Object.keys(color1).sort()) svg += ``; svg += ``; } if (isgradient2) { svg += ``; for (let pos of Object.keys(color2).sort()) svg += ``; svg += ``; } svg += `${paths.replace("REPLACE_FILL1", isgradient1 ? "url(#grad1)" : BDFDB.colorCONVERT(color1, "HEX")).replace("REPLACE_FILL2", isgradient2 ? "url(#grad2)" : BDFDB.colorCONVERT(color2, "HEX"))}`; return `data:image/svg+xml;base64,${btoa(svg)}`; } setIcons (modal, selection) { let wrapper = modal.querySelector(".icons"); if (!wrapper) return; BDFDB.removeEles(wrapper.childNodes); 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); } wrapper.appendChild(BDFDB.htmlToElement(`
${Object.getOwnPropertyNames(folderIcons).map(id => `
${folderIcons[id].customID ? '
' : ''}
`).join("")}
`)); setIcon(wrapper.querySelector(`.ui-icon-picker-icon[value="${folderIcons[selection] ? selection : 0}"]`), false, true); BDFDB.addChildEventListener(wrapper, "click", ".ui-icon-picker-icon", e => { if (BDFDB.containsClass(e.target, BDFDB.disCN.hovercardbutton)) return; setIcon(wrapper.querySelector(".ui-icon-picker-icon.selected"), false, false); setIcon(e.currentTarget, true, true); }); BDFDB.addChildEventListener(wrapper, "click", BDFDB.dotCN.hovercardbutton, e => { if (BDFDB.containsClass(e.currentTarget.parentElement, "selected")) return; BDFDB.removeData(e.currentTarget.getAttribute("value"), this, "customicons"); e.currentTarget.parentElement.remove(); BDFDB.showToast(`Custom Icon was deleted.`, {type:"success"}); }); BDFDB.addChildEventListener(wrapper, "mouseenter", ".ui-icon-picker-icon", e => { setIcon(e.currentTarget, true); }); BDFDB.addChildEventListener(wrapper, "mouseleave", ".ui-icon-picker-icon", e => { setIcon(e.currentTarget, false); }); function setIcon (icon, hover, enable) { if (!icon) return; if (enable != undefined) BDFDB.toggleClass(icon, "selected", enable); if (hover) { icon.querySelector(".ui-picker-inner").style.setProperty("background-image", `url(${folderIcons[icon.getAttribute("value")].openicon})`); if (BDFDB.containsClass(icon, "selected")) icon.style.setProperty("background-color", "rgb(255,255,255,0.2)"); else icon.style.setProperty("background-color", "rgb(255,255,255,0.1)"); } else { icon.querySelector(".ui-picker-inner").style.setProperty("background-image", `url(${folderIcons[icon.getAttribute("value")].closedicon})`); if (BDFDB.containsClass(icon, "selected")) icon.style.setProperty("background-color", "rgb(255,255,255,0.2)"); else icon.style.removeProperty("background-color"); } } } loadAllIcons () { let icons = {}; this.folderIcons.forEach((array,i) => {icons[i] = {"openicon":array.openicon,"closedicon":array.closedicon,"customID":null};}); Object.assign(icons, BDFDB.loadAllData(this, "customicons")); return icons; } fetchCustomIcon (modal, type) { let successFetchIcon; let url = modal.querySelector("input[type='text'][option='" + type + "']").value; if (url.indexOf("http") == 0) { BDFDB.LibraryRequires.request(url, (error, response, result) => { if (response) { let type = response.headers["content-type"]; if (type && type.indexOf("image") > -1) { successFetchIcon(); return; } } BDFDB.showToast("Use a valid direct link to an image source. They usually end on something like .png, .jpg or .gif.", {type:"danger"}); }); } else { if (BDFDB.LibraryRequires.fs.existsSync(url)) { BDFDB.LibraryRequires.fs.readFile(url, (error, response) => { if (!error) { url = `data:image/png;base64,${response.toString("base64")}`; successFetchIcon(); } }); } else { BDFDB.showToast("Could not fetch file. Please make sure the file exists.", {type:"danger"}); } } successFetchIcon = () => { let iconpreview = modal.querySelector(".ui-icon-picker-icon.preview." + type); let iconpreviewinner = iconpreview.querySelector(".ui-picker-inner"); BDFDB.removeClass(iconpreview, "nopic"); iconpreview.url = url; iconpreviewinner.style.setProperty("background-image", `url(${url})`); let iconpreviewopen = modal.querySelector(".ui-icon-picker-icon.preview.open"); let iconpreviewclosed = modal.querySelector(".ui-icon-picker-icon.preview.closed"); if (!BDFDB.containsClass(iconpreviewopen, "nopic") && !BDFDB.containsClass(iconpreviewclosed, "nopic")) { let iconpreviewswitching = modal.querySelector(".ui-icon-picker-icon.preview.switching"); let iconpreviewopenimage = iconpreviewopen.querySelector(".ui-picker-inner").style.getPropertyValue("background-image"); let iconpreviewclosedimage = iconpreviewclosed.querySelector(".ui-picker-inner").style.getPropertyValue("background-image"); let iconpreviewswitchinginner = iconpreviewswitching.querySelector(".ui-picker-inner"); BDFDB.removeClass(iconpreviewswitching, "nopic"); iconpreviewswitchinginner.style.setProperty("background-image", iconpreviewopenimage); let switching = true; iconpreviewswitching.switchInterval = setInterval(() => { switching = !switching; iconpreviewswitchinginner.style.setProperty("background-image", switching ? iconpreviewopenimage : iconpreviewclosedimage); },1000); } }; } saveCustomIcon (modal) { let iconpreviewopen = modal.querySelector(".ui-icon-picker-icon.preview.open"); let iconpreviewclosed = modal.querySelector(".ui-icon-picker-icon.preview.closed"); let iconpreviewswitching = modal.querySelector(".ui-icon-picker-icon.preview.switching"); if (!BDFDB.containsClass(iconpreviewopen, "nopic") && !BDFDB.containsClass(iconpreviewclosed, "nopic") && !BDFDB.containsClass(iconpreviewswitching, "nopic")) { let customID = this.generateID("customicon"); BDFDB.saveData(customID, {"openicon":iconpreviewopen.url,"closedicon":iconpreviewclosed.url,customID}, this, "customicons"); modal.querySelectorAll("input[type='text'][option]").forEach((input) => {input.value = "";}); let iconpreviewopeninner = iconpreviewopen.querySelector(".ui-picker-inner"); let iconpreviewclosedinner = iconpreviewclosed.querySelector(".ui-picker-inner"); let iconpreviewswitchinginner = iconpreviewswitching.querySelector(".ui-picker-inner"); BDFDB.addClass(iconpreviewopen, "nopic"); iconpreviewopeninner.style.removeProperty("background-image"); BDFDB.addClass(iconpreviewclosed, "nopic"); iconpreviewclosedinner.style.removeProperty("background-image"); BDFDB.addClass(iconpreviewswitching, "nopic"); iconpreviewswitchinginner.style.removeProperty("background-image"); clearInterval(iconpreviewswitching.switchInterval); BDFDB.showToast(`Custom Icon was added to selection.`, {type:"success"}); this.setIcons(modal, modal.querySelector(".ui-icon-picker-icon.selected").getAttribute("value")); } else { BDFDB.showToast(`Add an image for the open and the closed icon.`, {type:"danger"}); } } resetAllElements () { this.toggleFolderContent(false); BDFDB.removeEles(BDFDB.dotCN.guildouter + ".folder", ".serverfolders-dragpreview"); BDFDB.readServerList().forEach(info => {this.unhideServer(info.div);}); } createNewFolder (ankerdiv) { if (!Node.prototype.isPrototypeOf(ankerdiv)) return; let guilddiv = BDFDB.getParentEle(BDFDB.dotCN.guildouter, ankerdiv); if (!guilddiv) return; this.showFolderSettings(this.createFolderDiv({ folderID: this.generateID("folder"), folderName: "", position: this.getAllServersAndFolders().indexOf(guilddiv), iconID: 0, icons: {openicon: this.createBase64SVG(this.folderIcons[0].openicon), closedicon: this.createBase64SVG(this.folderIcons[0].closedicon)}, autounread: false, copyTooltipColor: false, isOpen: false, color1: ["0","0","0"], color2: ["255","255","255"], color3: null, color4: null, servers: [] })); this.updateFolderPositions(); } createFolderDiv (data) { let folderdiv = BDFDB.htmlToElement(this.folderIconMarkup); let folderdivinner = folderdiv.querySelector(BDFDB.dotCN.guildcontainer); let foldericonwrapper = folderdiv.querySelector(BDFDB.dotCN.guildiconwrapper); this.insertFolderDiv(data, folderdiv); folderdiv.id = data.folderID; folderdiv.setAttribute("foldername", data.folderName); foldericonwrapper.setAttribute("aria-label", data.folderName); BDFDB.addClass(folderdiv, "closed"); folderdiv.querySelector("mask").setAttribute("id", "SERVERFOLDERS" + data.folderID); folderdiv.querySelector("foreignObject").setAttribute("mask", "url(#SERVERFOLDERS" + data.folderID + ")"); folderdiv.querySelector(BDFDB.dotCN.guildicon).setAttribute("src", `${data.icons.closedicon}`); folderdiv.addEventListener("click", () => { if (BDFDB.getData("closeOtherFolders", this, "settings")) { document.querySelectorAll(BDFDB.dotCNS.guildswrapper + BDFDB.dotCN.guildouter + ".folder.open").forEach(folder => { if (folder != folderdiv) this.openCloseFolder(folder); }); } this.openCloseFolder(folderdiv); }); folderdivinner.addEventListener("mouseenter", () => { let newdata = BDFDB.loadData(folderdiv.id, this, "folders"); if (!newdata || !newdata.folderName) return; var isgradient3 = newdata.color3 && BDFDB.isObject(newdata.color3); var isgradient4 = newdata.color4 && BDFDB.isObject(newdata.color4); var bgColor = newdata.color3 ? (!isgradient3 ? BDFDB.colorCONVERT(newdata.color3, "RGB") : BDFDB.colorGRADIENT(newdata.color3)) : ""; var fontColor = newdata.color4 ? (!isgradient4 ? BDFDB.colorCONVERT(newdata.color4, "RGB") : BDFDB.colorGRADIENT(newdata.color4)) : ""; BDFDB.createTooltip(isgradient4 ? `${BDFDB.encodeToHTML(newdata.folderName)}` : newdata.folderName, folderdivinner, {type:"right", selector:"guild-folder-tooltip", style:`${isgradient4 ? '' : 'color: ' + fontColor + ' !important; '}background: ${bgColor} !important; border-color: ${isgradient3 ? BDFDB.colorCONVERT(data.color3[0], "RGB") : bgColor} !important;`, html:isgradient3}); }); folderdiv.addEventListener("contextmenu", e => { let newdata = BDFDB.loadData(folderdiv.id, this, "folders"); if (!newdata) return; let unreadServers = BDFDB.readUnreadServerList(this.readIncludedServerList(folderdiv)); const itemGroup = BDFDB.React.createElement(BDFDB.LibraryComponents.ContextMenuItemGroup, { className: `BDFDB-contextMenuItemGroup ${this.name}-contextMenuItemGroup`, children: [ BDFDB.React.createElement(BDFDB.LibraryComponents.ContextMenuItem, { label: this.labels.foldercontext_unreadfolder_text, className: `BDFDB-contextMenuItem ${this.name}-contextMenuItem ${this.name}-unreadfolder-contextMenuItem`, disabled: !unreadServers.length, action: e => { BDFDB.closeContextMenu(BDFDB.getParentEle(BDFDB.dotCN.contextmenu, e.target)); BDFDB.markGuildAsRead(unreadServers); } }), BDFDB.React.createElement(BDFDB.LibraryComponents.ContextMenuToggleItem, { label: this.labels.foldercontext_autounreadfolder_text, className: `BDFDB-contextMenuToggleItem ${this.name}-contextMenuToggleItem ${this.name}-autounreadfolder-contextMenuToggleItem`, active: newdata.autounread, action: state => { newdata.autounread = state; BDFDB.saveData(newdata.folderID, newdata, this, "folders"); } }), BDFDB.React.createElement(BDFDB.LibraryComponents.ContextMenuItem, { label: this.labels.foldercontext_foldersettings_text, className: `BDFDB-contextMenuItem ${this.name}-contextMenuItem ${this.name}-foldersettings-contextMenuItem`, action: e => { BDFDB.closeContextMenu(BDFDB.getParentEle(BDFDB.dotCN.contextmenu, e.target)); this.showFolderSettings(folderdiv); } }), BDFDB.React.createElement(BDFDB.LibraryComponents.ContextMenuItem, { label: this.labels.serversubmenu_createfolder_text, className: `BDFDB-contextMenuItem ${this.name}-contextMenuItem ${this.name}-createfolder-contextMenuItem`, action: e => { BDFDB.closeContextMenu(BDFDB.getParentEle(BDFDB.dotCN.contextmenu, e.target)); this.createNewFolder(folderdiv); } }), BDFDB.React.createElement(BDFDB.LibraryComponents.ContextMenuItem, { label: this.labels.foldercontext_removefolder_text, className: `BDFDB-contextMenuItem ${this.name}-contextMenuItem ${this.name}-removefolder-contextMenuItem`, danger: true, action: e => { BDFDB.closeContextMenu(BDFDB.getParentEle(BDFDB.dotCN.contextmenu, e.target)); this.removeFolder(folderdiv); } }) ] }); BDFDB.openContextMenu(this, e, itemGroup); }); folderdiv.addEventListener("mousedown", e => { let x = e.pageX, y = e.pageY; let mousemove = e2 => { if (Math.sqrt((x - e2.pageX)**2) > 20 || Math.sqrt((y - e2.pageY)**2) > 20) { document.removeEventListener("mousemove", mousemove); document.removeEventListener("mouseup", mouseup); let guildswrap = document.querySelector(`${BDFDB.dotCN.guildswrapper}:not(.foldercontent) ${BDFDB.dotCN.guildsscroller}`); if (!guildswrap) return; let hovele = null; let placeholder = BDFDB.htmlToElement(this.dragPlaceholderMarkup); let dragpreview = this.createDragPreview(folderdiv, e); let dragging = e3 => { BDFDB.removeEles(placeholder); BDFDB.toggleEles(folderdiv, false); this.updateDragPreview(dragpreview, e3); hovele = BDFDB.getParentEle(BDFDB.dotCN.guildouter + ".folder", e3.target); if (hovele) { if (hovele.parentElement == guildswrap) guildswrap.insertBefore(placeholder, hovele.nextSibling); } else { hovele = BDFDB.getParentEle(BDFDB.dotCN.guildouter, e3.target); if (hovele && BDFDB.getReactValue(hovele, "return.memoizedProps.guild") && guildswrap.contains(hovele)) { if (hovele.parentElement == guildswrap) guildswrap.insertBefore(placeholder, hovele.nextSibling); } } }; let releasing = e3 => { document.removeEventListener("mousemove", dragging); document.removeEventListener("mouseup", releasing); BDFDB.removeEles(placeholder, dragpreview); BDFDB.toggleEles(folderdiv, true); if (hovele) { guildswrap.insertBefore(folderdiv, hovele.nextSibling); this.updateFolderPositions(folderdiv); } }; 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.addHoverBehaviour(folderdiv); BDFDB.saveData(data.folderID, data, this, "folders"); this.updateFolderNotifications(folderdiv); if (data.isOpen) folderdiv.click(); return folderdiv; } insertFolderDiv (data, folderdiv) { folderdiv.remove(); let serversandfolders = this.getAllServersAndFolders(); let insertnode = serversandfolders[data.position == -1 || data.position > serversandfolders.length - 1 ? serversandfolders.length - 1 : data.position]; if (insertnode) insertnode.parentElement.insertBefore(folderdiv, insertnode); else { insertnode = BDFDB.getParentEle(BDFDB.dotCN.guildouter, document.querySelector(BDFDB.dotCNS.guildsscroller + BDFDB.dotCN.guildbuttoncontainer)); if (insertnode) insertnode.parentElement.parentElement.insertBefore(folderdiv, insertnode.parentElement); } } generateID (prefix) { let data = BDFDB.loadAllData(this, prefix + "s"); let id = prefix + "_" + Math.round(Math.random()*10000000000000000); return data[id] ? this.generateID(prefix) : id; } addServerToFolder (info, folderdiv) { if (!info || !folderdiv) return; let guilddiv = BDFDB.getServerDiv(info); let data = BDFDB.loadData(folderdiv.id, this, "folders"); if (!guilddiv || !data || data.servers.includes(info.id)) return; data.servers.push(info.id); BDFDB.saveData(folderdiv.id, data, this, "folders"); this.hideServer(guilddiv, folderdiv); this.updateCopyInFolderContent(guilddiv, folderdiv); this.updateFolderNotifications(folderdiv); BDFDB.showToast(this.labels.toast_addserver_text.replace("${servername}", info.name).replace("${foldername}", data.folderName ? " " + data.folderName : ""), {type:"success"}); } removeServerFromFolder (info, folderdiv) { if (!info || !folderdiv || !this.foldercontent) return; let data = BDFDB.loadData(folderdiv.id, this, "folders"); if (!data) return; BDFDB.removeFromArray(data.servers, info.id); BDFDB.saveData(folderdiv.id, data, this, "folders"); BDFDB.removeEles(this.foldercontent.querySelectorAll(`${BDFDB.dotCN.guildouter}.copy[guild="${info.id}"]`)); if (!this.foldercontent.querySelector(`${BDFDB.dotCN.guildouter}.copy[folder="${folderdiv.id}"]`)) BDFDB.removeEles(this.foldercontent.querySelectorAll(`${BDFDB.dotCN.guildouter}.folderseparatorouter[folder="${folderdiv.id}"]`)); this.unhideServer(BDFDB.getServerDiv(info)); this.updateFolderNotifications(folderdiv); BDFDB.showToast(this.labels.toast_removeserver_text.replace("${servername}", info.name).replace("${foldername}", data.folderName ? " " + data.folderName : ""), {type:"danger"}); } removeFolder (folderdiv) { if (!folderdiv || !this.foldercontent) return; this.readIncludedServerList(folderdiv).forEach(guilddiv => {this.unhideServer(guilddiv);}); BDFDB.removeData(folderdiv.id, this, "folders"); this.closeFolderContent(folderdiv); folderdiv.remove(); this.updateFolderPositions(); } getAllServersAndFolders () { let separator = document.querySelector(`${BDFDB.dotCN.guildseparator}:not(.folderseparator)`).parentElement; let nextsibling = separator.nextElementSibling, serversandfolders = []; while (nextsibling) { if (nextsibling.querySelector(BDFDB.dotCN.guildcontainer)) serversandfolders.push(nextsibling); nextsibling = nextsibling.nextElementSibling } return serversandfolders } getFolderOfServer (idOrInfoOrEle) { if (!idOrInfoOrEle || !this.foldercontent) return; let id = Node.prototype.isPrototypeOf(idOrInfoOrEle) ? BDFDB.getServerID(idOrInfoOrEle) : (typeof idOrInfoOrEle == "object" ? idOrInfoOrEle.id : idOrInfoOrEle); if (!id) return; let folders = BDFDB.loadAllData(this, "folders"); for (let folderid in folders) for (let serverid of folders[folderid].servers) if (serverid == id) return document.querySelector(".folder#" + folderid); return null; } hideServer (guilddiv, folderdiv) { if (!Node.prototype.isPrototypeOf(guilddiv) || !folderdiv) return; guilddiv.setAttribute("folder", folderdiv.id); BDFDB.toggleEles(guilddiv, false); } unhideServer (guilddiv) { if (!Node.prototype.isPrototypeOf(guilddiv)) return; guilddiv.removeAttribute("folder"); BDFDB.toggleEles(guilddiv, true); } toggleFolderContent (forceOpenClose) { if (!this.foldercontent) return; forceOpenClose = forceOpenClose === undefined ? BDFDB.containsClass(this.foldercontent, "foldercontentclosed") : forceOpenClose; BDFDB.toggleClass(this.foldercontent, "foldercontentopen", forceOpenClose); BDFDB.toggleClass(this.foldercontent, "foldercontentclosed", !forceOpenClose); BDFDB.toggleClass(document.body, "foldercontentopened", forceOpenClose); } openCloseFolder (folderdiv) { if (!folderdiv || !this.foldercontent) return; let data = BDFDB.loadData(folderdiv.id, this, "folders"); if (!data) return; let isClosed = !BDFDB.containsClass(folderdiv, "open"); if (isClosed) { let includedServers = this.readIncludedServerList(folderdiv); if (includedServers.length == 0) return; BDFDB.addClass(folderdiv, "open"); BDFDB.removeClass(folderdiv, "closed"); this.toggleFolderContent(true); let settings = BDFDB.getAllData(this, "settings"); let open = () => { if (this.foldercontent) { if (settings.addSeparators && this.foldercontent.querySelectorAll(BDFDB.dotCN.guildcontainer).length) this.foldercontentguilds.appendChild(BDFDB.htmlToElement(`
`)); includedServers.forEach(guilddiv => {this.updateCopyInFolderContent(guilddiv, folderdiv);}); } } if (settings.closeOtherFolders && this.foldercontent.querySelectorAll(BDFDB.dotCN.guildcontainer).length) setTimeout(open, 300); else open(); } else this.closeFolderContent(folderdiv); folderdiv.querySelector(BDFDB.dotCN.guildicon).setAttribute("src", `${isClosed ? data.icons.openicon : data.icons.closedicon}`); data.isOpen = isClosed; BDFDB.saveData(folderdiv.id, data, this, "folders"); } closeFolderContent (folderdiv) { if (!folderdiv || !this.foldercontent) return; BDFDB.removeClass(folderdiv, "open"); BDFDB.addClass(folderdiv, "closed"); let includedCopies = this.foldercontent.querySelectorAll(`[folder="${folderdiv.id}"]`); for (let copy of includedCopies) copy.removeAttribute("folder"); if (!this.foldercontent.querySelector("[folder]")) { this.toggleFolderContent(false); setTimeout(() => { let settings = BDFDB.getAllData(this, "settings"); if (settings.closeOtherFolders) BDFDB.removeEles(includedCopies); else if (!settings.closeOtherFolders && !document.querySelector(BDFDB.dotCNS.guildswrapper + BDFDB.dotCN.guildouter + ".folder.open")) BDFDB.removeEles(includedCopies); }, 300); } else BDFDB.removeEles(includedCopies); let firstchild = this.foldercontentguilds.firstElementChild; if (BDFDB.containsClass(firstchild, "folderseparatorouter")) BDFDB.removeEles(firstchild); } updateCopyInFolderContent (guilddiv, folderdiv) { if (!guilddiv || !folderdiv || !this.foldercontent) return; if (BDFDB.containsClass(folderdiv, "open")) { let info = BDFDB.LibraryModules.GuildStore.getGuild(BDFDB.getServerID(guilddiv)); if (!info) return; let oldCopy = this.foldercontent.querySelector(`[guild="${info.id}"]`); if (oldCopy) { this.foldercontentguilds.insertBefore(this.createCopyOfServer(guilddiv, folderdiv), oldCopy); BDFDB.removeEles(oldCopy); } else { let sameFolderCopies = this.foldercontent.querySelectorAll(`[folder="${folderdiv.id}"]`); let insertNode = sameFolderCopies.length > 0 ? sameFolderCopies[sameFolderCopies.length-1].nextSibling : null; this.foldercontentguilds.insertBefore(this.createCopyOfServer(guilddiv, folderdiv), insertNode); } } } createCopyOfServer (guilddiv, folderdiv) { if (!guilddiv || !folderdiv || !this.foldercontent) return; let info = BDFDB.LibraryModules.GuildStore.getGuild(BDFDB.getServerID(guilddiv)); if (!info) return; let props = BDFDB.getReactValue(guilddiv, "return.stateNode.props"); let guildcopy = guilddiv.cloneNode(true); let guildcopyinner = guildcopy.querySelector(BDFDB.dotCN.guildcontainer); let guildiconwrapper = guildcopy.querySelector(BDFDB.dotCN.guildiconwrapper); let guildicon = guildcopy.querySelector(BDFDB.dotCN.guildicon); let guildpillitem = guildcopy.querySelector(BDFDB.dotCN.guildpillitem); guildcopy.setAttribute("guild", info.id); guildcopy.setAttribute("folder", folderdiv.id); guildiconwrapper.style.setProperty("border-radius", props.selected ? "30%" : "50%"); guildiconwrapper.style.setProperty("overflow", "hidden"); guildpillitem.style.setProperty("opacity", props.selected ? 1 : (props.unread ? 0.7 : 0)); guildpillitem.style.setProperty("height", props.selected ? "40px" : "8px"); guildpillitem.style.setProperty("transform", "translate3d(0px, 0px, 0px)"); guildcopy.querySelector("mask").setAttribute("id", "SERVERFOLDERSCOPY" + info.id); guildcopy.querySelector("mask path").setAttribute("d", "M0 0 l50 0l0 50l-50 0l0 -50Z"); guildcopy.querySelector("foreignObject").setAttribute("mask", "url(#SERVERFOLDERSCOPY" + info.id + ")"); BDFDB.addClass(guildcopy, "copy"); BDFDB.toggleEles(guildcopy, true); guildcopyinner.addEventListener("mouseenter", () => { let ESdata = BDFDB.isPluginEnabled("EditServers") ? window.bdplugins.EditServers.plugin.getGuildData(info.id, guildcopyinner) : null; if (ESdata && (ESdata.name || ESdata.color3 || ESdata.color4)) window.bdplugins.EditServers.plugin.changeTooltip(info, guildcopyinner, "right"); else { let folderData = BDFDB.loadData(folderdiv.id, this, "folders") || {}; let color3 = folderData.copyTooltipColor ? folderData.color3 : null; let color4 = folderData.copyTooltipColor ? folderData.color4 : null; let isgradient3 = color3 && BDFDB.isObject(color3); let isgradient4 = color4 && BDFDB.isObject(color4); let bgColor = color3 ? (!isgradient3 ? BDFDB.colorCONVERT(color3, "RGB") : BDFDB.colorGRADIENT(color3)) : ""; let fontColor = color4 ? (!isgradient4 ? BDFDB.colorCONVERT(color4, "RGB") : BDFDB.colorGRADIENT(color4)) : ""; BDFDB.createTooltip(isgradient4 ? `${BDFDB.encodeToHTML(info.name)}` : info.name, guildcopyinner, {type:"right", selector:"guild-folder-tooltip", style:`${isgradient4 ? '' : 'color: ' + fontColor + ' !important; '}background: ${bgColor} !important; border-color: ${isgradient3 ? BDFDB.colorCONVERT(color3[0], "RGB") : bgColor} !important;`, html:isgradient3}); } if (guildicon && guildicon.src && info.icon && info.icon.startsWith("a_") && info.features.has("ANIMATED_ICON") && guildicon.src.includes("discordapp.com/icons/")) { guildicon.src = guildicon.src.replace(".webp", ".gif"); } }); guildcopyinner.addEventListener("mouseleave", () => { if (guildicon && guildicon.src && info.icon && info.icon.startsWith("a_") && info.features.has("ANIMATED_ICON") && guildicon.src.includes("discordapp.com/icons/") && !this.isAutoPlayGif()) { guildicon.src = guildicon.src.replace(".gif", ".webp"); } }); guildcopy.addEventListener("click", e => { BDFDB.stopEvent(e); if (BDFDB.pressedKeys.includes(46)) this.removeServerFromFolder(info, folderdiv); else { let settings = BDFDB.getAllData(this, "settings"); if (!settings.closeAllFolders && settings.closeTheFolder) this.openCloseFolder(folderdiv); guilddiv.querySelector("a").click(); } }); guildcopy.addEventListener("contextmenu", e => { BDFDB.openGuildContextMenu(guilddiv, e); }); guildcopy.addEventListener("mousedown", e => { let x = e.pageX, y = e.pageY; let mousemove = e2 => { if (Math.sqrt((x - e2.pageX)**2) > 20 || Math.sqrt((y - e2.pageY)**2) > 20) { document.removeEventListener("mousemove", mousemove); document.removeEventListener("mouseup", mouseup); let hovcopy = null; let placeholder = BDFDB.htmlToElement(this.dragPlaceholderMarkup); let dragpreview = this.createDragPreview(guilddiv, e); let dragging = e3 => { BDFDB.removeEles(placeholder); BDFDB.toggleEles(guildcopy, false); this.updateDragPreview(dragpreview, e3); if (this.foldercontent.contains(e3.target)) { hovcopy = BDFDB.getParentEle(BDFDB.dotCN.guildouter, e3.target); if (hovcopy && hovcopy.getAttribute("folder") == folderdiv.id) this.foldercontentguilds.insertBefore(placeholder, hovcopy.nextSibling); else hovcopy = null; } }; let releasing = e3 => { document.removeEventListener("mousemove", dragging); document.removeEventListener("mouseup", releasing); BDFDB.removeEles(placeholder, dragpreview); BDFDB.toggleEles(guildcopy, true); let dropfolderdiv = BDFDB.getParentEle(BDFDB.dotCN.guildouter + ".folder", e3.target); if (dropfolderdiv && dropfolderdiv != folderdiv) { this.removeServerFromFolder(info, folderdiv); this.addServerToFolder(info, dropfolderdiv); } else if (hovcopy) { this.foldercontentguilds.insertBefore(guildcopy, hovcopy.nextSibling); this.updateServerPositions(folderdiv); } }; 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); }); guildcopy.querySelector("a").setAttribute("draggable", false); this.addHoverBehaviour(guildcopy); return guildcopy; } isAutoPlayGif () { return BDFDB.isPluginEnabled("AutoPlayGifs") && window.bdplugins && window.bdplugins.AutoPlayGifs && window.bdplugins.AutoPlayGifs.plugin && window.bdplugins.AutoPlayGifs.plugin.settings && window.bdplugins.AutoPlayGifs.plugin.settings.guildList; } createDragPreview (div, e) { if (!Node.prototype.isPrototypeOf(div)) return; let dragpreview = div.cloneNode(true); BDFDB.addClass(dragpreview, "serverfolders-dragpreview"); BDFDB.toggleEles(dragpreview, false); dragpreview.style.setProperty("pointer-events", "none", "important"); dragpreview.style.setProperty("left", e.clientX - 25 + "px", "important"); dragpreview.style.setProperty("top", e.clientY - 25 + "px", "important"); document.querySelector(BDFDB.dotCN.appmount).appendChild(dragpreview); return dragpreview; } updateDragPreview (dragpreview, e) { if (!Node.prototype.isPrototypeOf(dragpreview)) return; BDFDB.toggleEles(dragpreview, true); dragpreview.style.setProperty("left", e.clientX - 25 + "px", "important"); dragpreview.style.setProperty("top", e.clientY - 25 + "px", "important"); } updateFolderPositions () { if (!this.foldercontent) return; let serverAndFolders = this.getAllServersAndFolders(); for (let i = 0; i < serverAndFolders.length; i++) { let folderdiv = BDFDB.getParentEle(BDFDB.dotCN.guildouter + ".folder", serverAndFolders[i]); if (folderdiv) { let data = BDFDB.loadData(folderdiv.id, this, "folders"); if (data) { data.position = i; BDFDB.saveData(folderdiv.id, data, this, "folders"); } } } } updateServerPositions (folderdiv) { if (!this.foldercontent) return; let data = BDFDB.loadData(folderdiv.id, this, "folders"); if (data) { let servers = Array.from(this.foldercontent.querySelectorAll(`${BDFDB.dotCN.guildouter}.copy[folder="${folderdiv.id}"]`)).map(div => {return div.getAttribute("guild");}); for (let serverid of servers) BDFDB.removeFromArray(data.servers, serverid); data.servers = BDFDB.removeCopiesFromArray(servers.concat(data.servers)); BDFDB.saveData(folderdiv.id, data, this, "folders"); } } updateFolderNotifications (folderdiv) { if (!this.foldercontent) return; let data = BDFDB.loadData(folderdiv.id, this, "folders"); if (!data) return; let includedServers = this.readIncludedServerList(folderdiv); let unreadServers = BDFDB.readUnreadServerList(includedServers); if (unreadServers.length > 0 && data.autounread) BDFDB.markGuildAsRead(unreadServers); else { let folderpill = folderdiv.querySelector(BDFDB.dotCN.guildpill); let folderpillitem = folderdiv.querySelector(BDFDB.dotCN.guildpillitem); let folderdivbadges = folderdiv.querySelector(BDFDB.dotCN.guildbadgewrapper); let masks = folderdiv.querySelectorAll("mask rect"); let mentions = 0, unread = false, selected = false, audioenabled = false, videoenabled = false; includedServers.forEach(div => { let props = BDFDB.getReactValue(div, "return.stateNode.props"); if (props) { mentions += parseInt(props.badge); if (props.selected) selected = true; if (props.unread) unread = true; if (props.audio) audioenabled = true; if (props.video) videoenabled = true; } }); BDFDB.toggleClass(folderdiv, BDFDB.disCN._bdguildunread, unread); BDFDB.toggleClass(folderdiv, BDFDB.disCN._bdguildaudio, audioenabled); BDFDB.toggleClass(folderdiv, BDFDB.disCN._bdguildvideo, videoenabled); BDFDB.toggleClass(folderpill, BDFDB.disCN._bdpillunread, unread); folderpillitem.style.setProperty("opacity", unread ? 0.7 : 0); let showcount = BDFDB.getData("showCountBadge", this, "settings"); let notificationbadge = folderdiv.querySelector(BDFDB.dotCN.guildlowerbadge + ".notifications"); let countbadge = folderdiv.querySelector(BDFDB.dotCN.guildupperbadge + ".count"); countbadge.firstElementChild.innerText = includedServers.length; countbadge.firstElementChild.style.setProperty("width", `${includedServers.length > 99 ? 30 : (includedServers.length > 9 ? 22 : 16)}px`); countbadge.firstElementChild.style.setProperty("padding-right", `${includedServers.length > 99 ? 0 : (includedServers.length > 9 ? 0 : 1)}px`); BDFDB.toggleEles(countbadge, showcount); notificationbadge.firstElementChild.innerText = mentions; notificationbadge.firstElementChild.style.setProperty("width", `${mentions > 99 ? 30 : (mentions > 9 ? 22 : 16)}px`); notificationbadge.firstElementChild.style.setProperty("padding-right", `${mentions > 99 ? 0 : (mentions > 9 ? 0 : 1)}px`); BDFDB.toggleEles(notificationbadge, mentions > 0); masks[0].setAttribute("transform", audioenabled || videoenabled ? "translate(0 0)" : "translate(20 -20)"); masks[1].setAttribute("transform", mentions > 0 ? "translate(0 0)" : "translate(20 20)"); masks[1].setAttribute("x", `${mentions > 99 ? 14 : (mentions > 9 ? 22 : 28)}`); masks[1].setAttribute("width", `${mentions > 99 ? 38 : (mentions > 9 ? 30 : 24)}`); masks[2].setAttribute("transform", showcount ? "translate(0 0)" : "translate(-20 -20)"); masks[2].setAttribute("x", -4); masks[2].setAttribute("width", `${includedServers.length > 99 ? 38 : (includedServers.length > 9 ? 30 : 24)}`); if (audioenabled) folderdivbadges.appendChild(BDFDB.htmlToElement(`
`)); else BDFDB.removeEles(folderdivbadges.querySelectorAll(".audio-badge")); if (videoenabled) folderdivbadges.appendChild(BDFDB.htmlToElement(`
`)); else BDFDB.removeEles(folderdivbadges.querySelectorAll(".video-badge")); if (document.contains(folderdiv) && BDFDB.containsClass(folderdiv, "open") && !this.foldercontent.querySelector(`[folder="${folderdiv.id}"]`)) this.openCloseFolder(folderdiv); } } readIncludedServerList (folderdiv) { let data = BDFDB.loadData(folderdiv.id, this, "folders"); let includedServers = []; if (data) for (let id of data.servers) { let div = BDFDB.getServerDiv(id); if (div && includedServers.indexOf(div) == -1) includedServers.push(div); } return includedServers; } addHoverBehaviour (div) { let divinner = div.querySelector(BDFDB.dotCN.guildcontainer); let diviconwrapper = div.querySelector(BDFDB.dotCN.guildiconwrapper); let divpillitem = div.querySelector(BDFDB.dotCN.guildpillitem); let pillvisible = divpillitem.style.getPropertyValue("opacity") != 0; let guild = div.getAttribute("guild"); let borderRadius = new BDFDB.LibraryModules.AnimationUtils.Value(0); borderRadius .interpolate({ inputRange: [0, 1], outputRange: [50, 30] }) .addListener((value) => { diviconwrapper.style.setProperty("border-radius", `${value.value}%`); }); let pillHeight = new BDFDB.LibraryModules.AnimationUtils.Value(0); pillHeight .interpolate({ inputRange: [0, 1], outputRange: [8, 20] }) .addListener((value) => { divpillitem.style.setProperty("height", `${value.value}px`); }); let pillOpacity = new BDFDB.LibraryModules.AnimationUtils.Value(0); pillOpacity .interpolate({ inputRange: [0, 1], outputRange: [0, 0.7] }) .addListener((value) => { divpillitem.style.setProperty("opacity", `${value.value}`); }); let animate = (v) => { BDFDB.LibraryModules.AnimationUtils.parallel([ BDFDB.LibraryModules.AnimationUtils.timing(borderRadius, {toValue: v, duration: 200}), BDFDB.LibraryModules.AnimationUtils.spring(pillHeight, {toValue: v, friction: 5}) ]).start(); }; let animate2 = (v) => { BDFDB.LibraryModules.AnimationUtils.parallel([ BDFDB.LibraryModules.AnimationUtils.timing(pillOpacity, {toValue: v, duration: 200}), ]).start(); }; divinner.addEventListener("mouseenter", () => { pillvisible = divpillitem.style.getPropertyValue("opacity") != 0; if (!guild || (BDFDB.LibraryModules.LastGuildStore.getGuildId() != guild)) { animate(1); if (!pillvisible) animate2(1); } }) divinner.addEventListener("mouseleave", () => { if (!guild || (BDFDB.LibraryModules.LastGuildStore.getGuildId() != guild)) { animate(0); if (!pillvisible) animate2(0); } }); } setLabelsByLanguage () { switch (BDFDB.getDiscordLanguage().id) { case "hr": //croatian return { toast_addserver_text: "${servername} je dodan u mapu${foldername}.", toast_removeserver_text: "${servername} je uklonjena iz mape${foldername}.", 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_unreadfolder_text: "Označi sve kao pročitano", foldercontext_autounreadfolder_text: "Auto: Označite kao pročitano", foldercontext_foldersettings_text: "Postavke map", foldercontext_removefolder_text: "Izbriši mapu", modal_header_text: "Postavke mapa", modal_foldername_text: "Naziv mape", 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_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 { toast_addserver_text: "${servername} er blevet tilføjet til mappe${foldername}.", toast_removeserver_text: "${servername} er blevet fjernet fra mappen${foldername}.", 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_unreadfolder_text: "Markér alle som læst", foldercontext_autounreadfolder_text: "Auto: Markér som læst", foldercontext_foldersettings_text: "Mappeindstillinger", foldercontext_removefolder_text: "Slet mappe", modal_header_text: "Mappindstillinger", modal_foldername_text: "Mappenavn", modal_tabheader1_text: "Mappe", modal_tabheader2_text: "Mappefarve", modal_tabheader3_text: "Tooltipfarve", modal_tabheader4_text: "Brugerdefinerede ikoner", modal_iconpicker_text: "Mappevalg", 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 { toast_addserver_text: "${servername} wurde dem Ordner${foldername} hinzugefügt.", toast_removeserver_text: "${servername} wurde aus dem Ordner${foldername} entfernt.", 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_unreadfolder_text: "Alle als gelesen markieren", foldercontext_autounreadfolder_text: "Auto: Als gelesen markieren", foldercontext_foldersettings_text: "Ordnereinstellungen", foldercontext_removefolder_text: "Ordner löschen", modal_header_text: "Ordnereinstellungen", modal_foldername_text: "Ordnername", modal_tabheader1_text: "Ordner", modal_tabheader2_text: "Ordnerfarbe", modal_tabheader3_text: "Tooltipfarbe", modal_tabheader4_text: "Eigene Icons", modal_iconpicker_text: "Ordnerauswahl", modal_copytooltipcolor_text: "Benutze dieselben Farben für alle Server des 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 { toast_addserver_text: "${servername} ha sido agregado a la carpeta${foldername}.", toast_removeserver_text: "${servername} ha sido eliminado de la carpeta${foldername}.", 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_unreadfolder_text: "Marcar todo como leido", foldercontext_autounreadfolder_text: "Auto: Marcar como leído", foldercontext_foldersettings_text: "Ajustes de carpeta", foldercontext_removefolder_text: "Eliminar carpeta", modal_header_text: "Ajustes de carpeta", modal_foldername_text: "Nombre de la 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_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 { toast_addserver_text: "${servername} a été ajouté au dossier${foldername}.", toast_removeserver_text: "${servername} a été supprimé du dossier${foldername}.", 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_unreadfolder_text: "Tout marquer comme lu", foldercontext_autounreadfolder_text: "Auto: Marquer comme lu", foldercontext_foldersettings_text: "Paramètres du dossier", foldercontext_removefolder_text: "Supprimer le dossier", modal_header_text: "Paramètres du dossier", modal_foldername_text: "Nom de 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_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 { toast_addserver_text: "${servername} è stato aggiunto alla cartella${foldername}.", toast_removeserver_text: "${servername} è stato rimosso dalla cartella${foldername}.", servercontext_serverfolders_text: "Cartelle del server", serversubmenu_createfolder_text: "Creare una cartella", serversubmenu_addtofolder_text: "Aggiungi il server alla cartella", serversubmenu_removefromfolder_text: "Rimuovi il server dalla cartella", foldercontext_unreadfolder_text: "Segna tutti come letti", foldercontext_autounreadfolder_text: "Auto: Contrassegna come letto", foldercontext_foldersettings_text: "Impostazioni cartella", foldercontext_removefolder_text: "Elimina cartella", modal_header_text: "Impostazioni cartella", modal_foldername_text: "Nome della 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_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 { toast_addserver_text: "${servername} is toegevoegd aan de map${foldername}.", toast_removeserver_text: "${servername} is verwijderd uit de map${foldername}.", servercontext_serverfolders_text: "Servermappen", serversubmenu_createfolder_text: "Map aanmaken", serversubmenu_addtofolder_text: "Voeg server toe aan de map", serversubmenu_removefromfolder_text: "Verwijder de server uit de map", foldercontext_unreadfolder_text: "Alles als gelezen markeren", foldercontext_autounreadfolder_text: "Auto: Markeren als gelezen", foldercontext_foldersettings_text: "Mapinstellingen", foldercontext_removefolder_text: "Verwijder map", modal_header_text: "Mapinstellingen", modal_foldername_text: "Mapnaam", modal_tabheader1_text: "Map", modal_tabheader2_text: "Mapkleur", modal_tabheader3_text: "Tooltipkleur", modal_tabheader4_text: "Aangepaste keuze", modal_iconpicker_text: "Map keuze", 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 { toast_addserver_text: "${servername} er lagt til i mappe${foldername}.", toast_removeserver_text: "${servername} er fjernet fra mappen${foldername}.", servercontext_serverfolders_text: "Servermapper", serversubmenu_createfolder_text: "Lag mappe", serversubmenu_addtofolder_text: "Legg til server i mappe", serversubmenu_removefromfolder_text: "Fjern server fra mappe", foldercontext_unreadfolder_text: "Marker alle som lest", foldercontext_autounreadfolder_text: "Auto: Merk som les", foldercontext_foldersettings_text: "Mappinnstillinger", foldercontext_removefolder_text: "Slett mappe", modal_header_text: "Mappinnstillinger", modal_foldername_text: "Mappenavn", modal_tabheader1_text: "Mappe", modal_tabheader2_text: "Mappefarge", modal_tabheader3_text: "Tooltipfarge", modal_tabheader4_text: "Tilpassede ikoner", modal_iconpicker_text: "Mappevalg", 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 { toast_addserver_text: "${servername} został dodany do folderu${foldername}.", toast_removeserver_text: "${servername} został usunięty z folderu${foldername}.", servercontext_serverfolders_text: "Foldery serwera", serversubmenu_createfolder_text: "Utwórz folder", serversubmenu_addtofolder_text: "Dodaj serwer do folderu", serversubmenu_removefromfolder_text: "Usuń serwer z folderu", foldercontext_unreadfolder_text: "Oznacz wszystkie jako przeczytane", foldercontext_autounreadfolder_text: "Auto: Oznacz jako przeczytane", foldercontext_foldersettings_text: "Ustawienia folderu", foldercontext_removefolder_text: "Usuń folder", modal_header_text: "Ustawienia folderu", modal_foldername_text: "Nazwa folderu", 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_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 { toast_addserver_text: "${servername} foi adicionado à pasta${foldername}.", toast_removeserver_text: "${servername} foi removido da pasta${foldername}.", servercontext_serverfolders_text: "Pastas de servidores", serversubmenu_createfolder_text: "Criar pasta", serversubmenu_addtofolder_text: "Adicionar servidor à pasta", serversubmenu_removefromfolder_text: "Remover servidor da pasta", foldercontext_unreadfolder_text: "Marcar tudo como lido", foldercontext_autounreadfolder_text: "Auto: Marcar como lido", foldercontext_foldersettings_text: "Configurações da pasta", foldercontext_removefolder_text: "Excluir pasta", modal_header_text: "Configurações da pasta", modal_foldername_text: "Nome da 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_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 { toast_addserver_text: "${servername} on lisätty kansioon${foldername}.", toast_removeserver_text: "${servername} on poistettu kansioon${foldername}.", servercontext_serverfolders_text: "Palvelinkansiot", serversubmenu_createfolder_text: "Luo kansio", serversubmenu_addtofolder_text: "Lisää palvelin kansioon", serversubmenu_removefromfolder_text: "Poista palvelin kansioon", foldercontext_unreadfolder_text: "Merkitse kaikki luetuksi", foldercontext_autounreadfolder_text: "Auto: merkitse luettavaksi", foldercontext_foldersettings_text: "Kansion kansio", foldercontext_removefolder_text: "Poista kansio", modal_header_text: "Kansion kansio", modal_foldername_text: "Kansion nimi", 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_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 { toast_addserver_text: "${servername} har lagts till i mapp${foldername}.", toast_removeserver_text: "${servername} har tagits bort från mappen${foldername}.", servercontext_serverfolders_text: "Servermappar", serversubmenu_createfolder_text: "Skapa mapp", serversubmenu_addtofolder_text: "Lägg till server i mapp", serversubmenu_removefromfolder_text: "Ta bort servern från mappen", foldercontext_unreadfolder_text: "Markera allt som läst", foldercontext_autounreadfolder_text: "Auto: Markera som Läs", foldercontext_foldersettings_text: "Mappinställningar", foldercontext_removefolder_text: "Ta bort mapp", modal_header_text: "Mappinställningar", modal_foldername_text: "Mappnamn", modal_tabheader1_text: "Mapp", modal_tabheader2_text: "Mappfärg", modal_tabheader3_text: "Tooltipfärg", modal_tabheader4_text: "Anpassade ikoner", modal_iconpicker_text: "Mappval", 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 { toast_addserver_text: "${servername} klasörü${foldername} eklendi.", toast_removeserver_text: "${servername} klasörü${foldername} kaldırıldı", servercontext_serverfolders_text: "Sunucu klasörleri", serversubmenu_createfolder_text: "Klasör oluşturun", serversubmenu_addtofolder_text: "Klasöre sunucu ekle", serversubmenu_removefromfolder_text: "Sunucuyu klasörden kaldır", foldercontext_unreadfolder_text: "Tümünü Oku olarak işaretle", foldercontext_autounreadfolder_text: "Oto: Okundu Olarak İşaretle", foldercontext_foldersettings_text: "Klasör Ayarları", foldercontext_removefolder_text: "Klasörü sil", modal_header_text: "Klasör Ayarları", modal_foldername_text: "Klasör adı", 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_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 { toast_addserver_text: "${servername} byl přidán do složky${foldername}.", toast_removeserver_text: "${servername} byl odstraněn ze složky${foldername}.", servercontext_serverfolders_text: "Složky serveru", serversubmenu_createfolder_text: "Vytvořit složky", serversubmenu_addtofolder_text: "Přidat server do složky", serversubmenu_removefromfolder_text: "Odebrat server ze složky", foldercontext_unreadfolder_text: "Označit vše jako přečtené", foldercontext_autounreadfolder_text: "Auto: Označit jako přečtené", foldercontext_foldersettings_text: "Nastavení složky", foldercontext_removefolder_text: "Smazat složky", modal_header_text: "Nastavení složky", modal_foldername_text: "Název 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_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 { toast_addserver_text: "${servername} е добавен към папката${foldername}.", toast_removeserver_text: "${servername} е премахнат от папката${foldername}.", servercontext_serverfolders_text: "Сървърни папки", serversubmenu_createfolder_text: "Създай папка", serversubmenu_addtofolder_text: "Добавяне на сървър в папка", serversubmenu_removefromfolder_text: "Премахване на сървър от папка", foldercontext_unreadfolder_text: "Маркирай всички като прочетени", foldercontext_autounreadfolder_text: "Авто: Маркиране като четене", foldercontext_foldersettings_text: "Настройки папка", foldercontext_removefolder_text: "Изтриване на папка", modal_header_text: "Настройки папка", modal_foldername_text: "Име на папка", modal_tabheader1_text: "Папка", modal_tabheader2_text: "Цвят на папка", modal_tabheader3_text: "Цвят на подсказка", modal_tabheader4_text: "Персонализирани икони", modal_iconpicker_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 "ru": //russian return { toast_addserver_text: "${servername} добавлен в папку${foldername}.", toast_removeserver_text: "${servername} был удален из папки${foldername}.", servercontext_serverfolders_text: "Папки сервера", serversubmenu_createfolder_text: "Создать папки", serversubmenu_addtofolder_text: "Добавить сервер в папку", serversubmenu_removefromfolder_text: "Удалить сервер из папки", foldercontext_unreadfolder_text: "Отметить все как прочитанное", foldercontext_autounreadfolder_text: "Авто: Отметить как прочитанное", foldercontext_foldersettings_text: "Настройки папки", foldercontext_removefolder_text: "Удалить папки", modal_header_text: "Настройки папки", modal_foldername_text: "Имя папки", modal_tabheader1_text: "Папка", modal_tabheader2_text: "Цвет папки", modal_tabheader3_text: "Цвет подсказка", modal_tabheader4_text: "Пользовательские значки", modal_iconpicker_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 { toast_addserver_text: "${servername} було додано до папки${foldername}.", toast_removeserver_text: "${servername} був вилучений з папки${foldername}.", servercontext_serverfolders_text: "Папки сервера", serversubmenu_createfolder_text: "Створити папки", serversubmenu_addtofolder_text: "Додати сервер до папки", serversubmenu_removefromfolder_text: "Видалити папку з папки", foldercontext_unreadfolder_text: "Позначити як прочитане", foldercontext_autounreadfolder_text: "Авто: Позначити як прочитане", foldercontext_foldersettings_text: "Параметри папки", foldercontext_removefolder_text: "Видалити папки", modal_header_text: "Параметри папки", modal_foldername_text: "Ім'я папки", modal_tabheader1_text: "Папки", modal_tabheader2_text: "Колір папки", modal_tabheader3_text: "Колір підказка", modal_tabheader4_text: "Користувальницькі іконки", modal_iconpicker_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 { toast_addserver_text: "${servername} がフォルダ${foldername} に追加されました。", toast_removeserver_text: "${servername} がフォルダ${foldername} から削除されました。", servercontext_serverfolders_text: "サーバーフォルダ", serversubmenu_createfolder_text: "フォルダーを作る", serversubmenu_addtofolder_text: "サーバーをフォルダに追加する", serversubmenu_removefromfolder_text: "サーバーをフォルダから削除する", foldercontext_unreadfolder_text: "すべてを読むようにマークする", foldercontext_autounreadfolder_text: "自動: 読み取りとしてマークする", foldercontext_foldersettings_text: "フォルダ設定", foldercontext_removefolder_text: "フォルダを削除する", modal_header_text: "フォルダ設定", modal_foldername_text: "フォルダ名", modal_tabheader1_text: "フォルダ", modal_tabheader2_text: "フォルダの色", modal_tabheader3_text: "ツールチップの色", modal_tabheader4_text: "カスタムアイコン", modal_iconpicker_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 { toast_addserver_text: "${servername} 已被添加到文件夾${foldername}.", toast_removeserver_text: "${servername} 已從文件夾${foldername} 中刪除.", servercontext_serverfolders_text: "服務器文件夾", serversubmenu_createfolder_text: "創建文件夾", serversubmenu_addtofolder_text: "添加服務器到文件夾", serversubmenu_removefromfolder_text: "從文件夾中刪除服務器", foldercontext_unreadfolder_text: "標記為已讀", foldercontext_autounreadfolder_text: "自動: 標記為已讀", foldercontext_foldersettings_text: "文件夾設置", foldercontext_removefolder_text: "刪除文件夾", modal_header_text: "文件夾設置", modal_foldername_text: "文件夾名稱", modal_tabheader1_text: "夾", modal_tabheader2_text: "文件夾顏色", modal_tabheader3_text: "工具提示顏色", modal_tabheader4_text: "自定義圖標", modal_iconpicker_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 { toast_addserver_text: "${servername} 가 폴더${foldername} 에 추가되었습니다.", toast_removeserver_text: "${servername} 가 폴더${foldername} 에서 제거되었습니다.", servercontext_serverfolders_text: "서버 폴더", serversubmenu_createfolder_text: "폴더 만들기", serversubmenu_addtofolder_text: "폴더에 서버 추가", serversubmenu_removefromfolder_text: "폴더에서 서버 제거", foldercontext_unreadfolder_text: "모두 읽은 상태로 표시", foldercontext_autounreadfolder_text: "자동: 읽은 상태로 표시", foldercontext_foldersettings_text: "폴더 설정", foldercontext_removefolder_text: "폴더 삭제", modal_header_text: "폴더 설정", modal_foldername_text: "폴더 이름", modal_tabheader1_text: "폴더", modal_tabheader2_text: "폴더 색", modal_tabheader3_text: "툴팁 색깔", modal_tabheader4_text: "사용자 정의 아이콘", modal_iconpicker_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 { toast_addserver_text: "${servername} has been added to the folder${foldername}.", toast_removeserver_text: "${servername} has been removed from the folder${foldername}.", servercontext_serverfolders_text: "Serverfolders", serversubmenu_createfolder_text: "Create Folder", serversubmenu_addtofolder_text: "Add Server to Folder", serversubmenu_removefromfolder_text: "Remove Server from Folder", foldercontext_unreadfolder_text: "Mark All As Read", foldercontext_autounreadfolder_text: "Auto: Mark As Read", foldercontext_foldersettings_text: "Foldersettings", foldercontext_removefolder_text: "Delete Folder", modal_header_text: "Foldersettings", modal_foldername_text: "Foldername", modal_tabheader1_text: "Folder", modal_tabheader2_text: "Foldercolor", modal_tabheader3_text: "Tooltipcolor", modal_tabheader4_text: "Custom Icons", modal_iconpicker_text: "Folderchoice", 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" }; } } }