aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLoek Le Blansch <l.leblansch@gmail.com>2020-09-20 10:24:58 +0200
committerLoek Le Blansch <l.leblansch@gmail.com>2020-09-20 10:24:58 +0200
commit5315593f5804ca7d070dd012c69cac375069e72a (patch)
treea5da5bb7b2c2cfb6cca5cdc893a8cd10035a6311
parent7f7bd84a907f2be62760ca7827ec236b3be01d24 (diff)
update
-rw-r--r--.cache/wal/chromium/Cached Theme.pakbin1374 -> 1372 bytes
-rw-r--r--.cache/wal/chromium/bg.pngbin495 -> 495 bytes
-rw-r--r--.cache/wal/chromium/manifest.json38
-rw-r--r--.cache/wal/colors.json38
-rw-r--r--.config/BetterDiscord/plugins/BetterSearchPage.plugin.js332
-rw-r--r--.config/BetterDiscord/plugins/EditChannels.plugin.js1379
-rw-r--r--.config/BetterDiscord/plugins/EditServers.config.json3
-rw-r--r--.config/BetterDiscord/plugins/EditServers.plugin.js1983
-rw-r--r--.config/BetterDiscord/plugins/NotificationSounds.plugin.js984
-rw-r--r--.config/BetterDiscord/plugins/PinDMs.plugin.js2073
-rw-r--r--.config/BetterDiscord/plugins/QuickMention.plugin.js136
-rw-r--r--.config/BetterDiscord/plugins/RemoveNicknames.plugin.js316
-rw-r--r--.config/BetterDiscord/plugins/SendLargeMessages.plugin.js452
-rw-r--r--.config/BetterDiscord/themes/HorizontalServerList.theme.css17
-rw-r--r--.config/BetterDiscord/themes/pywal.theme.css120
-rw-r--r--.config/X11/Xresources42
-rw-r--r--.config/X11/Xresources-colors38
-rw-r--r--.config/X11/Xresources-custom6
-rw-r--r--.config/i3/config14
-rw-r--r--.config/nvim/init.vim43
-rw-r--r--.config/nvim/pywal/base.vim10
-rw-r--r--.config/nvim/pywal/colors.vim84
-rw-r--r--.config/nvim/pywal/pywal.vim94
-rw-r--r--.config/picom.conf30
-rw-r--r--.config/polybar/config16
-rw-r--r--.config/rofi/pywal.rasi12
-rw-r--r--.config/spicetify/Themes/Loekaars/color.ini32
-rw-r--r--.config/startpage/pywal.css114
-rw-r--r--.config/zathura/zathurarc4
-rw-r--r--.zshrc7
30 files changed, 4138 insertions, 4279 deletions
diff --git a/.cache/wal/chromium/Cached Theme.pak b/.cache/wal/chromium/Cached Theme.pak
index 5a0c3d4..73a7e5d 100644
--- a/.cache/wal/chromium/Cached Theme.pak
+++ b/.cache/wal/chromium/Cached Theme.pak
Binary files differ
diff --git a/.cache/wal/chromium/bg.png b/.cache/wal/chromium/bg.png
index 12ed749..4df2f57 100644
--- a/.cache/wal/chromium/bg.png
+++ b/.cache/wal/chromium/bg.png
Binary files differ
diff --git a/.cache/wal/chromium/manifest.json b/.cache/wal/chromium/manifest.json
index 892b2f6..5abd2f5 100644
--- a/.cache/wal/chromium/manifest.json
+++ b/.cache/wal/chromium/manifest.json
@@ -9,8 +9,8 @@
"colors": {
"bookmark_text": [
197,
- 198,
- 198
+ 197,
+ 197
],
"frame": [
255,
@@ -20,42 +20,42 @@
"ntp_background": [
25,
26,
- 27
+ 25
],
"ntp_text": [
25,
26,
- 27
+ 25
],
"tab_background_text": [
137,
- 139,
- 139
+ 137,
+ 137
],
"tab_background_text_inactive": [
137,
- 139,
- 139
+ 137,
+ 137
],
"tab_background_text_incognito": [
137,
- 139,
- 139
+ 137,
+ 137
],
"tab_background_text_incognito_inactive": [
137,
- 139,
- 139
+ 137,
+ 137
],
"tab_text": [
197,
- 198,
- 198
+ 197,
+ 197
],
"toolbar": [
32,
- 35,
- 36
+ 33,
+ 32
],
"button_background": [
255,
@@ -65,9 +65,9 @@
},
"tints": {
"buttons": [
- 0.5416666666666666,
- 20.40816326530612,
- 76.86274509803923
+ 0.08974358974358962,
+ 21.78770949720669,
+ 70.19607843137254
],
"frame_inactive": [
-1,
diff --git a/.cache/wal/colors.json b/.cache/wal/colors.json
index 3e74873..9131813 100644
--- a/.cache/wal/colors.json
+++ b/.cache/wal/colors.json
@@ -3,26 +3,26 @@
"alpha": "100",
"special": {
- "background": "#191b1c",
- "foreground": "#c5c6c6",
- "cursor": "#c5c6c6"
+ "background": "#191a19",
+ "foreground": "#c5c5c5",
+ "cursor": "#c5c5c5"
},
"colors": {
- "color0": "#191b1c",
- "color1": "#4c626b",
- "color2": "#536569",
- "color3": "#576e76",
- "color4": "#74919d",
- "color5": "#84a6b4",
- "color6": "#9cbac4",
- "color7": "#c5c6c6",
- "color8": "#525454",
- "color9": "#4c626b",
- "color10": "#536569",
- "color11": "#576e76",
- "color12": "#74919d",
- "color13": "#84a6b4",
- "color14": "#9cbac4",
- "color15": "#c5c6c6"
+ "color0": "#191a19",
+ "color1": "#61543e",
+ "color2": "#565d34",
+ "color3": "#536063",
+ "color4": "#6b6543",
+ "color5": "#7c807e",
+ "color6": "#b3a18c",
+ "color7": "#c5c5c5",
+ "color8": "#525352",
+ "color9": "#61543e",
+ "color10": "#565d34",
+ "color11": "#536063",
+ "color12": "#6b6543",
+ "color13": "#7c807e",
+ "color14": "#b3a18c",
+ "color15": "#c5c5c5"
}
}
diff --git a/.config/BetterDiscord/plugins/BetterSearchPage.plugin.js b/.config/BetterDiscord/plugins/BetterSearchPage.plugin.js
index 64b71e4..f74c1f1 100644
--- a/.config/BetterDiscord/plugins/BetterSearchPage.plugin.js
+++ b/.config/BetterDiscord/plugins/BetterSearchPage.plugin.js
@@ -1,194 +1,178 @@
//META{"name":"BetterSearchPage","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/BetterSearchPage","source":"https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/Plugins/BetterSearchPage/BetterSearchPage.plugin.js"}*//
-var BetterSearchPage = (_ => {
- return class BetterSearchPage {
- getName () {return "BetterSearchPage";}
-
- getVersion () {return "1.1.5";}
-
- getAuthor () {return "DevilBro";}
-
- getDescription () {return "Adds some extra controls to the search results page.";}
-
- constructor () {
- this.patchedModules = {
- after: {
- SearchResultsInner: "default"
- }
- };
+module.exports = (_ => {
+ const config = {
+ "info": {
+ "name": "BetterSearchPage",
+ "author": "DevilBro",
+ "version": "1.1.5",
+ "description": "Adds some extra controls to the search results page."
}
-
- initConstructor () {
- this.defaults = {
- settings: {
- addFirstLast: {value:true, description:"Adds a first and last page button."},
- addJumpTo: {value:true, description:"Adds a jump to input field (press enter to jump)."},
- cloneToTheTop: {value:true, description:"Clones the controls to the top of the results page."}
- }
- };
- }
-
- getSettingsPanel () {
- if (!window.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
- let settings = BDFDB.DataUtils.get(this, "settings");
- let settingsPanel, settingsItems = [];
+ };
+ 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", (error, response, body) => {require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), body, _ => {});});}
+ });
+ }
+ if (!window.BDFDB_Global.pluginQueue.includes(config.info.name)) window.BDFDB_Global.pluginQueue.push(config.info.name);
+ }
+ start() {}
+ stop() {}
+ } : (([Plugin, BDFDB]) => {
+ var settings = {};
+
+ return class BetterSearchPage extends Plugin {
+ onLoad() {
+ this.defaults = {
+ settings: {
+ addFirstLast: {value:true, description:"Adds a first and last page button."},
+ addJumpTo: {value:true, description:"Adds a jump to input field (press enter to jump)."},
+ cloneToTheTop: {value:true, description:"Clones the controls to the top of the results page."}
+ }
+ };
+
+ this.patchedModules = {
+ after: {
+ SearchResultsInner: "default"
+ }
+ };
+
+ }
- for (let key in settings) settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
- className: BDFDB.disCN.marginbottom8,
- type: "Switch",
- plugin: this,
- keys: ["settings", key],
- label: this.defaults.settings[key].description,
- value: settings[key]
- }));
+ onStart() {
+ this.forceUpdateAll();
+ }
- return settingsPanel = BDFDB.PluginUtils.createSettingsPanel(this, settingsItems);
- }
-
- // Legacy
- load () {}
-
- start () {
- if (!window.BDFDB) window.BDFDB = {myPlugins:{}};
- if (window.BDFDB && window.BDFDB.myPlugins && typeof window.BDFDB.myPlugins == "object") window.BDFDB.myPlugins[this.getName()] = this;
- let 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.min.js");
- libraryScript.setAttribute("date", performance.now());
- libraryScript.addEventListener("load", _ => {this.initialize();});
- document.head.appendChild(libraryScript);
+ onStop() {
+ this.forceUpdateAll();
}
- else if (window.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();
- this.startTimeout = setTimeout(_ => {
- try {return this.initialize();}
- catch (err) {console.error(`%c[${this.getName()}]%c`, "color: #3a71c1; font-weight: 700;", "", "Fatal Error: Could not initiate plugin! " + err);}
- }, 30000);
- }
- initialize () {
- if (window.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
- if (this.started) return;
- BDFDB.PluginUtils.init(this);
+ getSettingsPanel (collapseStates = {}) {
+ let settingsPanel, settingsItems = [];
- BDFDB.ModuleUtils.forceAllUpdates(this);
- }
- else console.error(`%c[${this.getName()}]%c`, "color: #3a71c1; font-weight: 700;", "", "Fatal Error: Could not load BD functions!");
- }
-
- stop () {
- if (window.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
- this.stopping = true;
+ for (let key in settings) settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
+ className: BDFDB.disCN.marginbottom8,
+ type: "Switch",
+ plugin: this,
+ keys: ["settings", key],
+ label: this.defaults.settings[key].description,
+ value: settings[key]
+ }));
- BDFDB.ModuleUtils.forceAllUpdates(this);
-
- BDFDB.PluginUtils.clear(this);
+ return settingsPanel = BDFDB.PluginUtils.createSettingsPanel(this, settingsItems);
}
- }
-
- // Begin of own functions
-
- onSettingsClosed (e) {
- if (this.SettingsUpdated) {
- delete this.SettingsUpdated;
- BDFDB.ModuleUtils.forceAllUpdates(this);
+ onSettingsClosed (e) {
+ if (this.SettingsUpdated) {
+ delete this.SettingsUpdated;
+ this.forceUpdateAll();
+ }
+ }
+
+ forceUpdateAll () {
+ settings = BDFDB.DataUtils.get(this, "settings");
+
+ BDFDB.PatchUtils.forceAllUpdates(this);
}
- }
- processSearchResultsInner (e) {
- if (e.instance.props.search) {
- let [children, index] = BDFDB.ReactUtils.findChildren(e.returnvalue, {name:"SearchPagination"});
- if (index > -1) {
- let settings = BDFDB.DataUtils.get(this, "settings");
- let currentpage = parseInt(Math.floor(e.instance.props.search.offset / BDFDB.DiscordConstants.SEARCH_PAGE_SIZE)) + 1;
- let maxpage = e.instance.props.search.totalResults > 5000 ? parseInt(Math.ceil(5000 / BDFDB.DiscordConstants.SEARCH_PAGE_SIZE)) : parseInt(Math.ceil(e.instance.props.search.totalResults / BDFDB.DiscordConstants.SEARCH_PAGE_SIZE));
- let doJump = page => {
- page = page < 1 ? 1 : (page > maxpage ? maxpage : page);
- if (page < currentpage) BDFDB.LibraryModules.SearchPageUtils.searchPreviousPage(e.instance.props.searchId, (currentpage - page) * BDFDB.DiscordConstants.SEARCH_PAGE_SIZE);
- else if (page > currentpage) BDFDB.LibraryModules.SearchPageUtils.searchNextPage(e.instance.props.searchId, (page - currentpage) * BDFDB.DiscordConstants.SEARCH_PAGE_SIZE);
- };
- let pagination = children[index].type(children[index].props);
- if (!pagination) return;
-
- if (currentpage >= maxpage) {
- pagination.props.children[2].props.className = BDFDB.DOMUtils.formatClassName(pagination.props.children[2].props.className, BDFDB.disCN.searchresultspaginationdisabled);
- pagination.props.children[2].props.onClick = _ => {};
- }
- pagination.props.children[0] = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TooltipContainer, {
- text: "Previous",
- children: pagination.props.children[0]
- });
- pagination.props.children[2] = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TooltipContainer, {
- text: currentpage >= maxpage ? "Max Page is 200" : "Next",
- tooltipConfig: {color: currentpage >= maxpage && BDFDB.LibraryComponents.TooltipContainer.Colors.RED},
- children: pagination.props.children[2]
- });
- if (settings.addFirstLast) {
- pagination.props.children.unshift(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TooltipContainer, {
- text: "First",
- "aria-label": "First",
- onClick: _ => {if (currentpage != 1) doJump(1);},
- children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Clickable, {
- className: BDFDB.DOMUtils.formatClassName(BDFDB.disCN.searchresultspaginationbutton, currentpage == 1 && BDFDB.disCN.searchresultspaginationdisabled),
- children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SvgIcon, {
- className: BDFDB.disCN.searchresultspaginationicon,
- nativeClass: true,
- iconSVG: `<svg width="24" height="24" viewBox="0 0 24 24"><g fill="none" fill-rule="evenodd"><polygon fill="currentColor" fill-rule="nonzero" points="12.35 4.35 10 2 0 12 10 22 12.35 19.65 4.717 12"></polygon><polygon fill="currentColor" fill-rule="nonzero" points="24.35 4.35 22 2 12 12 22 22 24.35 19.65 16.717 12"></polygon><polygon points="0 0 24 0 24 24 0 24"></polygon></g></svg>`
+ processSearchResultsInner (e) {
+ if (e.instance.props.search) {
+ let [children, index] = BDFDB.ReactUtils.findParent(e.returnvalue, {name:"SearchPagination"});
+ if (index > -1) {
+ let currentPage = parseInt(Math.floor(e.instance.props.search.offset / BDFDB.DiscordConstants.SEARCH_PAGE_SIZE)) + 1;
+ let maxPage = e.instance.props.search.totalResults > 5000 ? parseInt(Math.ceil(5000 / BDFDB.DiscordConstants.SEARCH_PAGE_SIZE)) : parseInt(Math.ceil(e.instance.props.search.totalResults / BDFDB.DiscordConstants.SEARCH_PAGE_SIZE));
+ let doJump = page => {
+ page = page < 1 ? 1 : (page > maxPage ? maxPage : page);
+ if (page < currentPage) BDFDB.LibraryModules.SearchPageUtils.searchPreviousPage(e.instance.props.searchId, (currentPage - page) * BDFDB.DiscordConstants.SEARCH_PAGE_SIZE);
+ else if (page > currentPage) BDFDB.LibraryModules.SearchPageUtils.searchNextPage(e.instance.props.searchId, (page - currentPage) * BDFDB.DiscordConstants.SEARCH_PAGE_SIZE);
+ };
+ let pagination = children[index].type(children[index].props);
+ if (!pagination) return;
+
+ if (currentPage >= maxPage) {
+ pagination.props.children[2].props.className = BDFDB.DOMUtils.formatClassName(pagination.props.children[2].props.className, BDFDB.disCN.searchresultspaginationdisabled);
+ pagination.props.children[2].props.onClick = _ => {};
+ }
+ pagination.props.children[0] = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TooltipContainer, {
+ text: "Previous",
+ children: pagination.props.children[0]
+ });
+ pagination.props.children[2] = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TooltipContainer, {
+ text: currentPage >= maxPage ? "Max Page is 200" : "Next",
+ tooltipConfig: {color: currentPage >= maxPage && BDFDB.LibraryComponents.TooltipContainer.Colors.RED},
+ children: pagination.props.children[2]
+ });
+ if (settings.addFirstLast) {
+ pagination.props.children.unshift(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TooltipContainer, {
+ text: BDFDB.LanguageUtils.LibraryStrings.first,
+ "aria-label": BDFDB.LanguageUtils.LibraryStrings.first,
+ onClick: _ => {if (currentPage != 1) doJump(1);},
+ children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Clickable, {
+ className: BDFDB.DOMUtils.formatClassName(BDFDB.disCN.searchresultspaginationbutton, currentPage == 1 && BDFDB.disCN.searchresultspaginationdisabled, BDFDB.disCN.focusable),
+ children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SvgIcon, {
+ className: BDFDB.disCN.searchresultspaginationicon,
+ name: BDFDB.LibraryComponents.SvgIcon.Names.LEFT_DOUBLE_CARET
+ })
})
- })
- }));
- pagination.props.children.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TooltipContainer, {
- text: currentpage >= maxpage ? "Max Page is 200" : "Last",
- tooltipConfig: {color: currentpage >= maxpage && BDFDB.LibraryComponents.TooltipContainer.Colors.RED},
- "aria-label": "Last",
- onClick: _ => {if (currentpage != maxpage) doJump(maxpage);},
- children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Clickable, {
- className: BDFDB.DOMUtils.formatClassName(BDFDB.disCN.searchresultspaginationbutton, currentpage >= maxpage && BDFDB.disCN.searchresultspaginationdisabled),
- children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SvgIcon, {
- className: BDFDB.disCN.searchresultspaginationicon,
- nativeClass: true,
- iconSVG: `<svg width="24" height="24" viewBox="0 0 24 24"><g fill="none" fill-rule="evenodd"><polygon fill="currentColor" fill-rule="nonzero" points="2.47 2 0.12 4.35 7.753 12 0.12 19.65 2.47 22 12.47 12"></polygon><polygon fill="currentColor" fill-rule="nonzero" points="14.47 2 12.12 4.35 19.753 12 12.12 19.65 14.47 22 24.47 12"></polygon><polygon points="0 0 24 0 24 24 0 24"></polygon></g></svg>`
+ }));
+ pagination.props.children.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TooltipContainer, {
+ text: currentPage >= maxPage ? "Max Page is 200" : BDFDB.LanguageUtils.LibraryStrings.last,
+ tooltipConfig: {color: currentPage >= maxPage && BDFDB.LibraryComponents.TooltipContainer.Colors.RED},
+ "aria-label": BDFDB.LanguageUtils.LibraryStrings.last,
+ onClick: _ => {if (currentPage != maxPage) doJump(maxPage);},
+ children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Clickable, {
+ className: BDFDB.DOMUtils.formatClassName(BDFDB.disCN.searchresultspaginationbutton, currentPage >= maxPage && BDFDB.disCN.searchresultspaginationdisabled, BDFDB.disCN.focusable),
+ children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SvgIcon, {
+ className: BDFDB.disCN.searchresultspaginationicon,
+ name: BDFDB.LibraryComponents.SvgIcon.Names.RIGHT_DOUBLE_CARET
+ })
})
- })
- }));
- }
- if (settings.addJumpTo) {
- pagination.props.children.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TextInput, {
- key: "BSP-pagination-jumpinput",
- type: "number",
- size: BDFDB.LibraryComponents.TextInput.Sizes.MINI,
- suppress: true,
- value: currentpage,
- min: 1,
- max: maxpage,
- onKeyDown: (e, inputinstance) => {if (e.which == 13) doJump(inputinstance.props.value);}
- }));
- pagination.props.children.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TooltipContainer, {
- text: BDFDB.LanguageUtils.LanguageStrings.JUMP,
- "aria-label": BDFDB.LanguageUtils.LanguageStrings.JUMP,
- onClick: (e, buttoninstance) => {
- let jumpinput = BDFDB.ReactUtils.findOwner(buttoninstance._reactInternalFiber.return, {key:"BSP-pagination-jumpinput"});
- if (jumpinput) doJump(jumpinput.props.value);
- },
- children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Clickable, {
- className: BDFDB.disCN.searchresultspaginationbutton,
- children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SvgIcon, {
- className: BDFDB.disCN.searchresultspaginationicon,
- nativeClass: true,
- style: {transform: "rotate(90deg"},
- name: BDFDB.LibraryComponents.SvgIcon.Names.RIGHT_CARET
+ }));
+ }
+ if (settings.addJumpTo) {
+ pagination.props.children.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TextInput, {
+ key: "BSP-pagination-jumpinput",
+ type: "number",
+ size: BDFDB.LibraryComponents.TextInput.Sizes.MINI,
+ value: currentPage,
+ min: 1,
+ max: maxPage,
+ onKeyDown: (event, instance) => {if (event.which == 13) doJump(instance.props.value);}
+ }));
+ pagination.props.children.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TooltipContainer, {
+ text: BDFDB.LanguageUtils.LanguageStrings.JUMP,
+ "aria-label": BDFDB.LanguageUtils.LanguageStrings.JUMP,
+ onClick: (event, instance) => {
+ let jumpInput = BDFDB.ReactUtils.findOwner(instance._reactInternalFiber.return, {key:"BSP-pagination-jumpinput"});
+ if (jumpInput) doJump(jumpInput.props.value);
+ },
+ children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Clickable, {
+ className: BDFDB.disCN.searchresultspaginationbutton,
+ children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SvgIcon, {
+ className: BDFDB.disCN.searchresultspaginationicon,
+ style: {transform: "rotate(90deg"},
+ name: BDFDB.LibraryComponents.SvgIcon.Names.RIGHT_CARET
+ })
})
- })
- }));
+ }));
+ }
+ children[index] = pagination;
+ if (settings.cloneToTheTop) children.unshift(pagination);
}
- children[index] = pagination;
- if (settings.cloneToTheTop) children.unshift(pagination);
}
}
- }
- }
+ };
+ })(window.BDFDB_Global.PluginUtils.buildPlugin(config));
})(); \ No newline at end of file
diff --git a/.config/BetterDiscord/plugins/EditChannels.plugin.js b/.config/BetterDiscord/plugins/EditChannels.plugin.js
index 74327e3..9bbe92c 100644
--- a/.config/BetterDiscord/plugins/EditChannels.plugin.js
+++ b/.config/BetterDiscord/plugins/EditChannels.plugin.js
@@ -1,770 +1,755 @@
//META{"name":"EditChannels","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/EditChannels","source":"https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/Plugins/EditChannels/EditChannels.plugin.js"}*//
-var EditChannels = (_ => {
- var changedChannels = {}, settings = {};
-
- return class EditChannels {
- getName () {return "EditChannels";}
-
- getVersion () {return "4.1.6";}
-
- getAuthor () {return "DevilBro";}
-
- getDescription () {return "Allows you to rename and recolor channelnames.";}
-
- constructor () {
- this.patchedModules = {
- before: {
- ChannelEditorContainer: "render",
- ChannelAutoComplete: "render",
- AutocompleteChannelResult: "render",
- AuditLog: "render",
- SettingsInvites: "render",
- HeaderBarContainer: "render",
- ChannelCategoryItem: "render",
- ChannelItem: "render",
- QuickSwitchChannelResult: "render",
- MessageContent: "type"
- },
- after: {
- AutocompleteChannelResult: "render",
- AuditLog: "render",
- HeaderBarContainer: "render",
- ChannelCategoryItem: "render",
- ChannelItem: "render",
- QuickSwitchChannelResult: "render",
- RecentsChannelHeader: "default"
- }
- };
+module.exports = (_ => {
+ const config = {
+ "info": {
+ "name": "EditChannels",
+ "author": "DevilBro",
+ "version": "4.1.6",
+ "description": "Allows you to rename and recolor channelnames."
}
-
- initConstructor () {
- this.css = `
- ${BDFDB.dotCN.messagespopoutchannelname}:hover > span[style*="color"],
- ${BDFDB.dotCN.recentmentionschannelname}:hover > span[style*="color"] {
- text-decoration: underline;
- }
- `;
-
- this.defaults = {
- settings: {
- changeChannelIcon: {value:true, inner:false, description:"Change color of Channel Icon"},
- changeInChatTextarea: {value:true, inner:true, description:"Chat Textarea"},
- changeInMentions: {value:true, inner:true, description:"Mentions"},
- changeInChannelList: {value:true, inner:true, description:"Channel List"},
- changeInChannelHeader: {value:true, inner:true, description:"Channel Header"},
- changeInRecentMentions: {value:true, inner:true, description:"Recent Mentions Popout"},
- changeInAutoComplete: {value:true, inner:true, description:"Autocomplete Menu"},
- changeInAuditLog: {value:true, inner:true, description:"Audit Log"},
- changeInInviteLog: {value:true, inner:true, description:"Invite Log"},
- changeInQuickSwitcher: {value:true, inner:true, description:"Quick Switcher"}
- }
- };
- }
-
- getSettingsPanel () {
- if (!window.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
- let settings = BDFDB.DataUtils.get(this, "settings");
- let settingsPanel, settingsItems = [], innerItems = [];
-
- for (let key in settings) (!this.defaults.settings[key].inner ? settingsItems : innerItems).push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
- className: BDFDB.disCN.marginbottom8,
- type: "Switch",
- plugin: this,
- keys: ["settings", key],
- label: this.defaults.settings[key].description,
- value: settings[key]
- }));
- settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsPanelInner, {
- title: "Change Channels in:",
- first: settingsItems.length == 0,
- children: innerItems
- }));
- settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsItem, {
- type: "Button",
- className: BDFDB.disCN.marginbottom8,
- color: BDFDB.LibraryComponents.Button.Colors.RED,
- label: "Reset all Channels",
- onClick: _ => {
- BDFDB.ModalUtils.confirm(this, "Are you sure you want to reset all channels?", _ => {
- BDFDB.DataUtils.remove(this, "channels");
- this.forceUpdateAll();
- });
- },
- children: BDFDB.LanguageUtils.LanguageStrings.RESET
- }));
+ };
+ 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", (error, response, body) => {require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), body, _ => {});});}
+ });
+ }
+ if (!window.BDFDB_Global.pluginQueue.includes(config.info.name)) window.BDFDB_Global.pluginQueue.push(config.info.name);
+ }
+ start() {}
+ stop() {}
+ } : (([Plugin, BDFDB]) => {
+ var changedChannels = {}, settings = {};
+
+ return class EditChannels extends Plugin {
+ onLoad() {
+ this.defaults = {
+ settings: {
+ changeChannelIcon: {value:true, inner:false, description:"Change color of Channel Icon"},
+ changeInChatTextarea: {value:true, inner:true, description:"Chat Textarea"},
+ changeInMentions: {value:true, inner:true, description:"Mentions"},
+ changeInChannelList: {value:true, inner:true, description:"Channel List"},
+ changeInChannelHeader: {value:true, inner:true, description:"Channel Header"},
+ changeInRecentMentions: {value:true, inner:true, description:"Recent Mentions Popout"},
+ changeInAutoComplete: {value:true, inner:true, description:"Autocomplete Menu"},
+ changeInAuditLog: {value:true, inner:true, description:"Audit Log"},
+ changeInInviteLog: {value:true, inner:true, description:"Invite Log"},
+ changeInQuickSwitcher: {value:true, inner:true, description:"Quick Switcher"}
+ }
+ };
- return settingsPanel = BDFDB.PluginUtils.createSettingsPanel(this, settingsItems);
- }
-
- // Legacy
- load () {}
-
- start () {
- if (!window.BDFDB) window.BDFDB = {myPlugins:{}};
- if (window.BDFDB && window.BDFDB.myPlugins && typeof window.BDFDB.myPlugins == "object") window.BDFDB.myPlugins[this.getName()] = this;
- let 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.min.js");
- libraryScript.setAttribute("date", performance.now());
- libraryScript.addEventListener("load", _ => {this.initialize();});
- document.head.appendChild(libraryScript);
+ this.patchedModules = {
+ before: {
+ ChannelEditorContainer: "render",
+ ChannelAutoComplete: "render",
+ AutocompleteChannelResult: "render",
+ AuditLog: "render",
+ SettingsInvites: "render",
+ HeaderBarContainer: "render",
+ ChannelCategoryItem: "render",
+ ChannelItem: "render",
+ QuickSwitchChannelResult: "render",
+ MessageContent: "type"
+ },
+ after: {
+ AutocompleteChannelResult: "render",
+ AuditLog: "render",
+ HeaderBarContainer: "render",
+ ChannelCategoryItem: "render",
+ ChannelItem: "render",
+ QuickSwitchChannelResult: "render",
+ RecentsChannelHeader: "default"
+ }
+ };
+
+ this.css = `
+ ${BDFDB.dotCN.messagespopoutchannelname}:hover > span[style*="color"],
+ ${BDFDB.dotCN.recentmentionschannelname}:hover > span[style*="color"] {
+ text-decoration: underline;
+ }
+ `;
}
- else if (window.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();
- this.startTimeout = setTimeout(_ => {
- try {return this.initialize();}
- catch (err) {console.error(`%c[${this.getName()}]%c`, "color: #3a71c1; font-weight: 700;", "", "Fatal Error: Could not initiate plugin! " + err);}
- }, 30000);
- }
-
- initialize () {
- if (window.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
- if (this.started) return;
- BDFDB.PluginUtils.init(this);
-
+
+ onStart() {
let observer = new MutationObserver(_ => {this.changeAppTitle();});
BDFDB.ObserverUtils.connect(this, document.head.querySelector("title"), {name:"appTitleObserver",instance:observer}, {childList:true});
this.forceUpdateAll();
}
- else console.error(`%c[${this.getName()}]%c`, "color: #3a71c1; font-weight: 700;", "", "Fatal Error: Could not load BD functions!");
- }
-
- stop () {
- if (window.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
- this.stopping = true;
-
+
+ onStop() {
this.forceUpdateAll();
-
- BDFDB.PluginUtils.clear(this);
}
- }
-
- // Begin of own functions
-
- onChannelContextMenu (e) {
- if (e.instance.props.channel) {
- let [children, index] = BDFDB.ContextMenuUtils.findItem(e.returnvalue, {id: "devmode-copy-id", group: true});
- children.splice(index > -1 ? index : children.length, 0, BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuGroup, {
- children: BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
- label: this.labels.context_localchannelsettings_text,
- id: BDFDB.ContextMenuUtils.createItemId(this.name, "settings-submenu"),
- children: BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuGroup, {
- children: [
- BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
- label: this.labels.submenu_channelsettings_text,
- id: BDFDB.ContextMenuUtils.createItemId(this.name, "settings-change"),
- action: _ => {
- BDFDB.ContextMenuUtils.close(e.instance);
- this.openChannelSettingsModal(e.instance.props.channel);
- }
- }),
- BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
- label: this.labels.submenu_resetsettings_text,
- id: BDFDB.ContextMenuUtils.createItemId(this.name, "settings-reset"),
- disabled: !changedChannels[e.instance.props.channel.id],
- action: _ => {
- BDFDB.ContextMenuUtils.close(e.instance);
- BDFDB.DataUtils.remove(this, "channels", e.instance.props.channel.id);
- this.forceUpdateAll();
- }
- })
- ]
- })
- })
+ getSettingsPanel (collapseStates = {}) {
+ let settingsPanel, settingsItems = [];
+
+ for (let key in settings) if (!this.defaults.settings[key].inner) settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
+ className: BDFDB.disCN.marginbottom8,
+ type: "Switch",
+ plugin: this,
+ keys: ["settings", key],
+ label: this.defaults.settings[key].description,
+ value: settings[key]
+ }));
+ settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsPanelInner, {
+ title: "Change Channels in:",
+ first: settingsItems.length == 0,
+ children: Object.keys(settings).map(key => this.defaults.settings[key].inner && BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
+ className: BDFDB.disCN.marginbottom8,
+ 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",
+ className: BDFDB.disCN.marginbottom8,
+ color: BDFDB.LibraryComponents.Button.Colors.RED,
+ label: "Reset all Channels",
+ onClick: _ => {
+ BDFDB.ModalUtils.confirm(this, "Are you sure you want to reset all channels?", _ => {
+ BDFDB.DataUtils.remove(this, "channels");
+ this.forceUpdateAll();
+ });
+ },
+ children: BDFDB.LanguageUtils.LanguageStrings.RESET
}));
+
+ return settingsPanel = BDFDB.PluginUtils.createSettingsPanel(this, settingsItems);
}
- }
- onSettingsClosed () {
- if (this.SettingsUpdated) {
- delete this.SettingsUpdated;
- this.forceUpdateAll();
+ onSettingsClosed () {
+ if (this.SettingsUpdated) {
+ delete this.SettingsUpdated;
+ this.forceUpdateAll();
+ }
}
- }
- processChannelEditorContainer (e) {
- if (!e.instance.props.disabled && e.instance.props.channel && BDFDB.ChannelUtils.isTextChannel(e.instance.props.channel) && e.instance.props.type == BDFDB.DiscordConstants.TextareaTypes.NORMAL && settings.changeInChatTextarea) {
- let data = changedChannels[e.instance.props.channel.id];
- e.instance.props.placeholder = BDFDB.LanguageUtils.LanguageStringsFormat("TEXTAREA_PLACEHOLDER", `#${data && data.name || e.instance.props.channel.name}`);
+ forceUpdateAll () {
+ changedChannels = BDFDB.DataUtils.load(this, "channels");
+ settings = BDFDB.DataUtils.get(this, "settings");
+
+ this.changeAppTitle();
+ BDFDB.PatchUtils.forceAllUpdates(this);
+ BDFDB.ReactUtils.forceUpdate(BDFDB.ReactUtils.findOwner(document.querySelector(BDFDB.dotCN.app), {name:"Channel", unlimited:true}));
}
- }
- processChannelAutoComplete (e) {
- if (e.instance.state.autocompleteType == "CHANNELS" && BDFDB.ArrayUtils.is(e.instance.state.autocompletes.channels) && e.instance.props.channel && e.instance.props.channel.guild_id) {
- let lastWord = (e.instance.props.textValue || "").slice(1).toLowerCase();
- if (!lastWord) return;
- let channelArray = [];
- for (let id in changedChannels) if (changedChannels[id] && changedChannels[id].name) {
- let channel = BDFDB.LibraryModules.ChannelStore.getChannel(id);
- let category = channel && channel.parent_id && BDFDB.LibraryModules.ChannelStore.getChannel(channel.parent_id);
- let catdata = category && changedChannels[category.id] || {};
- if (BDFDB.ChannelUtils.isTextChannel(channel) && channel.guild_id == e.instance.props.channel.guild_id) channelArray.push(Object.assign({
- lowerCaseName: changedChannels[id].name.toLowerCase(),
- lowerCaseCatName: catdata && catdata.name && catdata.name.toLowerCase(),
- channel,
- category,
- catdata
- }, changedChannels[id]));
+ onChannelContextMenu (e) {
+ if (e.instance.props.channel) {
+ let [children, index] = BDFDB.ContextMenuUtils.findItem(e.returnvalue, {id: "devmode-copy-id", group: true});
+ children.splice(index > -1 ? index : children.length, 0, BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuGroup, {
+ children: BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
+ label: this.labels.context_localchannelsettings_text,
+ id: BDFDB.ContextMenuUtils.createItemId(this.name, "settings-submenu"),
+ children: BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuGroup, {
+ children: [
+ BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
+ label: this.labels.submenu_channelsettings_text,
+ id: BDFDB.ContextMenuUtils.createItemId(this.name, "settings-change"),
+ action: _ => {
+ this.openChannelSettingsModal(e.instance.props.channel);
+ }
+ }),
+ BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
+ label: this.labels.submenu_resetsettings_text,
+ id: BDFDB.ContextMenuUtils.createItemId(this.name, "settings-reset"),
+ disabled: !changedChannels[e.instance.props.channel.id],
+ action: _ => {
+ BDFDB.DataUtils.remove(this, "channels", e.instance.props.channel.id);
+ this.forceUpdateAll();
+ }
+ })
+ ]
+ })
+ })
+ }));
+ }
+ }
+
+ processChannelEditorContainer (e) {
+ if (!e.instance.props.disabled && e.instance.props.channel && BDFDB.ChannelUtils.isTextChannel(e.instance.props.channel) && e.instance.props.type == BDFDB.DiscordConstants.TextareaTypes.NORMAL && settings.changeInChatTextarea) {
+ let data = changedChannels[e.instance.props.channel.id];
+ e.instance.props.placeholder = BDFDB.LanguageUtils.LanguageStringsFormat("TEXTAREA_PLACEHOLDER", `#${data && data.name || e.instance.props.channel.name}`);
}
- channelArray = BDFDB.ArrayUtils.keySort(channelArray.filter(n => e.instance.state.autocompletes.channels.every(channel => channel.id != n.channel.id) && (n.lowerCaseName.indexOf(lastWord) != -1 || (n.lowerCaseCatName && n.lowerCaseCatName.indexOf(lastWord) != -1))), "lowerCaseName");
- e.instance.state.autocompletes.channels = [].concat(e.instance.state.autocompletes.channels, channelArray.map(n => n.channel)).slice(0, BDFDB.DiscordConstants.MAX_AUTOCOMPLETE_RESULTS);
}
- }
- processAutocompleteChannelResult (e) {
- if (e.instance.props.channel && settings.changeInAutoComplete) {
- if (!e.returnvalue) {
- e.instance.props.channel = this.getChannelData(e.instance.props.channel.id);
- if (e.instance.props.category) e.instance.props.category = this.getChannelData(e.instance.props.category.id);
+ processChannelAutoComplete (e) {
+ if (e.instance.state.autocompleteType == "CHANNELS" && BDFDB.ArrayUtils.is(e.instance.state.autocompletes.channels) && e.instance.props.channel && e.instance.props.channel.guild_id) {
+ let lastWord = (e.instance.props.textValue || "").slice(1).toLowerCase();
+ if (!lastWord) return;
+ let channelArray = [];
+ for (let id in changedChannels) if (changedChannels[id] && changedChannels[id].name) {
+ let channel = BDFDB.LibraryModules.ChannelStore.getChannel(id);
+ let category = channel && channel.parent_id && BDFDB.LibraryModules.ChannelStore.getChannel(channel.parent_id);
+ let catdata = category && changedChannels[category.id] || {};
+ if (BDFDB.ChannelUtils.isTextChannel(channel) && channel.guild_id == e.instance.props.channel.guild_id) channelArray.push(Object.assign({
+ lowerCaseName: changedChannels[id].name.toLowerCase(),
+ lowerCaseCatName: catdata && catdata.name && catdata.name.toLowerCase(),
+ channel,
+ category,
+ catdata
+ }, changedChannels[id]));
+ }
+ channelArray = BDFDB.ArrayUtils.keySort(channelArray.filter(n => e.instance.state.autocompletes.channels.every(channel => channel.id != n.channel.id) && (n.lowerCaseName.indexOf(lastWord) != -1 || (n.lowerCaseCatName && n.lowerCaseCatName.indexOf(lastWord) != -1))), "lowerCaseName");
+ e.instance.state.autocompletes.channels = [].concat(e.instance.state.autocompletes.channels, channelArray.map(n => n.channel)).slice(0, BDFDB.DiscordConstants.MAX_AUTOCOMPLETE_RESULTS);
}
- else {
- let channelName = BDFDB.ReactUtils.findChild(e.returnvalue, {props:[["className", BDFDB.disCN.marginleft4]]});
- if (channelName) this.changeChannelColor(channelName, e.instance.props.channel.id);
- let channelIcon = BDFDB.ReactUtils.findChild(e.returnvalue, {props:[["className", BDFDB.disCN.autocompleteicon]]});
- if (channelIcon) this.changeChannelIconColor(channelIcon, e.instance.props.channel.id, {alpha: 0.6});
- if (e.instance.props.category) {
- let categoryName = BDFDB.ReactUtils.findChild(e.returnvalue, {props:[["className", BDFDB.disCN.autocompletedescription]]});
- if (categoryName) this.changeChannelColor(categoryName, e.instance.props.category.id);
+ }
+
+ processAutocompleteChannelResult (e) {
+ if (e.instance.props.channel && settings.changeInAutoComplete) {
+ if (!e.returnvalue) {
+ e.instance.props.channel = this.getChannelData(e.instance.props.channel.id);
+ if (e.instance.props.category) e.instance.props.category = this.getChannelData(e.instance.props.category.id);
+ }
+ else {
+ let channelName = BDFDB.ReactUtils.findChild(e.returnvalue, {props:[["className", BDFDB.disCN.marginleft4]]});
+ if (channelName) this.changeChannelColor(channelName, e.instance.props.channel.id);
+ let channelIcon = BDFDB.ReactUtils.findChild(e.returnvalue, {props:[["className", BDFDB.disCN.autocompleteicon]]});
+ if (channelIcon) this.changeChannelIconColor(channelIcon, e.instance.props.channel.id, {alpha: 0.6});
+ if (e.instance.props.category) {
+ let categoryName = BDFDB.ReactUtils.findChild(e.returnvalue, {props:[["className", BDFDB.disCN.autocompletedescription]]});
+ if (categoryName) this.changeChannelColor(categoryName, e.instance.props.category.id);
+ }
}
}
}
- }
- processAuditLog (e) {
- let channel = BDFDB.ReactUtils.getValue(e.instance, "props.log.options.channel");
- if (channel && settings.changeInAuditLog) {
- if (!e.returnvalue) e.instance.props.log.options.channel = this.getChannelData(channel.id);
- else {
- let channelName = BDFDB.ReactUtils.findChild(e.returnvalue, {props:[["children", [["#" + channel.name]]]]});
- if (channelName) this.changeChannelColor(channelName, channel.id);
+ processAuditLog (e) {
+ let channel = BDFDB.ObjectUtils.get(e.instance, "props.log.options.channel");
+ if (channel && settings.changeInAuditLog) {
+ if (!e.returnvalue) e.instance.props.log.options.channel = this.getChannelData(channel.id);
+ else {
+ let channelName = BDFDB.ReactUtils.findChild(e.returnvalue, {props:[["children", [["#" + channel.name]]]]});
+ if (channelName) this.changeChannelColor(channelName, channel.id);
+ }
}
}
- }
- processSettingsInvites (e) {
- if (BDFDB.ObjectUtils.is(e.instance.props.invites) && settings.changeInInviteLog) {
- e.instance.props.invites = Object.assign({}, e.instance.props.invites);
- for (let id in e.instance.props.invites) e.instance.props.invites[id] = new BDFDB.DiscordObjects.Invite(Object.assign({}, e.instance.props.invites[id], {channel: this.getChannelData(e.instance.props.invites[id].channel.id)}));
+ processSettingsInvites (e) {
+ if (BDFDB.ObjectUtils.is(e.instance.props.invites) && settings.changeInInviteLog) {
+ e.instance.props.invites = Object.assign({}, e.instance.props.invites);
+ for (let id in e.instance.props.invites) e.instance.props.invites[id] = new BDFDB.DiscordObjects.Invite(Object.assign({}, e.instance.props.invites[id], {channel: this.getChannelData(e.instance.props.invites[id].channel.id)}));
+ }
}
- }
- processHeaderBarContainer (e) {
- let channel = BDFDB.LibraryModules.ChannelStore.getChannel(e.instance.props.channelId);
- if (channel && BDFDB.ChannelUtils.isTextChannel(channel) && settings.changeInChannelHeader) {
- if (!e.returnvalue) {
- let channelName = BDFDB.ReactUtils.findChild(e.instance, {name: "Title"});
- if (channelName) {
- channelName.props.children = this.getChannelData(channel.id).name;
- this.changeChannelColor(channelName, channel.id);
+ processHeaderBarContainer (e) {
+ let channel = BDFDB.LibraryModules.ChannelStore.getChannel(e.instance.props.channelId);
+ if (channel && BDFDB.ChannelUtils.isTextChannel(channel) && settings.changeInChannelHeader) {
+ if (!e.returnvalue) {
+ let channelName = BDFDB.ReactUtils.findChild(e.instance, {name: "Title"});
+ if (channelName) {
+ channelName.props.children = this.getChannelData(channel.id).name;
+ this.changeChannelColor(channelName, channel.id);
+ }
}
- }
- else {
- let [children, index] = BDFDB.ReactUtils.findParent(e.instance, {name: "Icon"});
- if (index > -1) {
- let icon = BDFDB.ReactUtils.createElement(children[index].props.icon, {
- className: BDFDB.disCN.channelheadericon
- });
- this.changeChannelIconColor(icon, channel.id, {alpha: 0.6});
- children[index] = BDFDB.ReactUtils.createElement("div", {
- className: BDFDB.disCN.channelheadericonwrapper,
- children: icon
- })
+ else {
+ let [children, index] = BDFDB.ReactUtils.findParent(e.instance, {name: "Icon"});
+ if (index > -1) {
+ let icon = BDFDB.ReactUtils.createElement(children[index].props.icon, {
+ className: BDFDB.disCN.channelheadericon
+ });
+ this.changeChannelIconColor(icon, channel.id, {alpha: 0.6});
+ children[index] = BDFDB.ReactUtils.createElement("div", {
+ className: BDFDB.disCN.channelheadericonwrapper,
+ children: icon
+ })
+ }
}
}
}
- }
- processChannelCategoryItem (e) {
- if (e.instance.props.channel && settings.changeInChannelList) {
- if (!e.returnvalue) e.instance.props.channel = this.getChannelData(e.instance.props.channel.id);
- else {
- let onMouseEnter = e.returnvalue.props.onMouseEnter || ( _ => {});
- e.returnvalue.props.onMouseEnter = event => {e.instance.setState({hovered: true});};
- let onMouseLeave = e.returnvalue.props.onMouseLeave || ( _ => {});
- e.returnvalue.props.onMouseLeave = event => {e.instance.setState({hovered: false});};
- let modify = BDFDB.ObjectUtils.extract(Object.assign({}, e.instance.props, e.instance.state), "muted", "locked", "selected", "unread", "connected", "hovered");
- let categoryName = BDFDB.ReactUtils.findChild(e.returnvalue, {props:[["className", BDFDB.disCN.categoryname]]});
- if (categoryName) this.changeChannelColor(categoryName, e.instance.props.channel.id, modify);
- let categoryIcon = BDFDB.ReactUtils.findChild(e.returnvalue, {props:[["className", BDFDB.disCN.categoryicon]]});
- if (categoryIcon) this.changeChannelIconColor(categoryIcon, e.instance.props.channel.id, Object.assign({alpha: 0.6}, modify));
+ processChannelCategoryItem (e) {
+ if (e.instance.props.channel && settings.changeInChannelList) {
+ if (!e.returnvalue) e.instance.props.channel = this.getChannelData(e.instance.props.channel.id);
+ else {
+ let onMouseEnter = e.returnvalue.props.onMouseEnter || ( _ => {});
+ e.returnvalue.props.onMouseEnter = event => {e.instance.setState({hovered: true});};
+ let onMouseLeave = e.returnvalue.props.onMouseLeave || ( _ => {});
+ e.returnvalue.props.onMouseLeave = event => {e.instance.setState({hovered: false});};
+ let modify = BDFDB.ObjectUtils.extract(Object.assign({}, e.instance.props, e.instance.state), "muted", "locked", "selected", "unread", "connected", "hovered");
+ let categoryName = BDFDB.ReactUtils.findChild(e.returnvalue, {props:[["className", BDFDB.disCN.categoryname]]});
+ if (categoryName) this.changeChannelColor(categoryName, e.instance.props.channel.id, modify);
+ let categoryIcon = BDFDB.ReactUtils.findChild(e.returnvalue, {props:[["className", BDFDB.disCN.categoryicon]]});
+ if (categoryIcon) this.changeChannelIconColor(categoryIcon, e.instance.props.channel.id, Object.assign({alpha: 0.6}, modify));
+ }
}
}
- }
- processChannelItem (e) {
- if (e.instance.props.channel && settings.changeInChannelList) {
- if (!e.returnvalue) e.instance.props.channel = this.getChannelData(e.instance.props.channel.id);
- else {
- let onMouseEnter = e.returnvalue.props.onMouseEnter || ( _ => {});
- e.returnvalue.props.onMouseEnter = event => {e.instance.setState({hovered: true});};
- let onMouseLeave = e.returnvalue.props.onMouseLeave || ( _ => {});
- e.returnvalue.props.onMouseLeave = event => {e.instance.setState({hovered: false});};
- let modify = BDFDB.ObjectUtils.extract(Object.assign({}, e.instance.props, e.instance.state), "muted", "locked", "selected", "unread", "connected", "hovered");
- let channelName = BDFDB.ReactUtils.findChild(e.returnvalue, {props:[["className", BDFDB.disCN.channelname]]});
- if (channelName) this.changeChannelColor(channelName, e.instance.props.channel.id, modify);
- let channelIcon = BDFDB.ReactUtils.findChild(e.returnvalue, {props:[["className", BDFDB.disCN.channelicon]]});
- if (channelIcon) this.changeChannelIconColor(channelIcon, e.instance.props.channel.id, Object.assign({alpha: 0.6}, modify));
+ processChannelItem (e) {
+ if (e.instance.props.channel && settings.changeInChannelList) {
+ if (!e.returnvalue) e.instance.props.channel = this.getChannelData(e.instance.props.channel.id);
+ else {
+ let onMouseEnter = e.returnvalue.props.onMouseEnter || ( _ => {});
+ e.returnvalue.props.onMouseEnter = event => {e.instance.setState({hovered: true});};
+ let onMouseLeave = e.returnvalue.props.onMouseLeave || ( _ => {});
+ e.returnvalue.props.onMouseLeave = event => {e.instance.setState({hovered: false});};
+ let modify = BDFDB.ObjectUtils.extract(Object.assign({}, e.instance.props, e.instance.state), "muted", "locked", "selected", "unread", "connected", "hovered");
+ let channelName = BDFDB.ReactUtils.findChild(e.returnvalue, {props:[["className", BDFDB.disCN.channelname]]});
+ if (channelName) this.changeChannelColor(channelName, e.instance.props.channel.id, modify);
+ let channelIcon = BDFDB.ReactUtils.findChild(e.returnvalue, {props:[["className", BDFDB.disCN.channelicon]]});
+ if (channelIcon) this.changeChannelIconColor(channelIcon, e.instance.props.channel.id, Object.assign({alpha: 0.6}, modify));
+ }
}
}
- }
-
- processQuickSwitchChannelResult (e) {
- if (e.instance.props.channel && settings.changeInQuickSwitcher) {
- if (!e.returnvalue) {
- e.instance.props.channel = this.getChannelData(e.instance.props.channel.id);
- if (e.instance.props.category) e.instance.props.category = this.getChannelData(e.instance.props.category.id);
- }
- else {
- let modify = BDFDB.ObjectUtils.extract(e.instance.props, "focused", "unread", "mentions");
- let channelName = BDFDB.ReactUtils.findChild(e.returnvalue, {props:[["className", BDFDB.disCN.quickswitchresultmatch]]});
- if (channelName) this.changeChannelColor(channelName, e.instance.props.channel.id, modify);
- let channelIcon = BDFDB.ReactUtils.findChild(e.returnvalue, {props:[["className", BDFDB.disCN.quickswitchresulticon]]});
- if (channelIcon) this.changeChannelIconColor(channelIcon, e.instance.props.channel.id, Object.assign({alpha: 0.6}, modify));
- if (e.instance.props.category) {
- let categoryName = BDFDB.ReactUtils.findChild(e.returnvalue, {props:[["className", BDFDB.disCN.quickswitchresultnote]]});
- if (categoryName) this.changeChannelColor(categoryName, e.instance.props.category.id);
+
+ processQuickSwitchChannelResult (e) {
+ if (e.instance.props.channel && settings.changeInQuickSwitcher) {
+ if (!e.returnvalue) {
+ e.instance.props.channel = this.getChannelData(e.instance.props.channel.id);
+ if (e.instance.props.category) e.instance.props.category = this.getChannelData(e.instance.props.category.id);
+ }
+ else {
+ let modify = BDFDB.ObjectUtils.extract(e.instance.props, "focused", "unread", "mentions");
+ let channelName = BDFDB.ReactUtils.findChild(e.returnvalue, {props:[["className", BDFDB.disCN.quickswitchresultmatch]]});
+ if (channelName) this.changeChannelColor(channelName, e.instance.props.channel.id, modify);
+ let channelIcon = BDFDB.ReactUtils.findChild(e.returnvalue, {props:[["className", BDFDB.disCN.quickswitchresulticon]]});
+ if (channelIcon) this.changeChannelIconColor(channelIcon, e.instance.props.channel.id, Object.assign({alpha: 0.6}, modify));
+ if (e.instance.props.category) {
+ let categoryName = BDFDB.ReactUtils.findChild(e.returnvalue, {props:[["className", BDFDB.disCN.quickswitchresultnote]]});
+ if (categoryName) this.changeChannelColor(categoryName, e.instance.props.category.id);
+ }
}
}
}
- }
-
- processRecentsChannelHeader (e) {
- if (settings.changeInRecentMentions && BDFDB.ArrayUtils.is(e.returnvalue.props.children)) {
- for (let child of e.returnvalue.props.children) if (child && child.props && child.props.channel && child.type.displayName == "ChannelName") {
- child.props.channel = this.getChannelData(child.props.channel.id);
- let oldType = child.type;
- child.type = (...args) => {
- let instance = oldType(...args);
- let channelName = BDFDB.ReactUtils.findChild(instance, {props:[["className", BDFDB.disCN.recentmentionschannelname]]});
- if (channelName) this.changeChannelColor(channelName, child.props.channel.id);
- return instance;
- };
- child.type.displayName = oldType.displayName;
+
+ processRecentsChannelHeader (e) {
+ if (settings.changeInRecentMentions && BDFDB.ArrayUtils.is(e.returnvalue.props.children)) {
+ for (let child of e.returnvalue.props.children) if (child && child.props && child.props.channel && child.type.displayName == "ChannelName") {
+ child.props.channel = this.getChannelData(child.props.channel.id);
+ let oldType = child.type;
+ child.type = (...args) => {
+ let instance = oldType(...args);
+ let channelName = BDFDB.ReactUtils.findChild(instance, {props:[["className", BDFDB.disCN.recentmentionschannelname]]});
+ if (channelName) this.changeChannelColor(channelName, child.props.channel.id);
+ return instance;
+ };
+ child.type.displayName = oldType.displayName;
+ }
}
}
- }
- processMessageContent (e) {
- if (BDFDB.ArrayUtils.is(e.instance.props.content) && settings.changeInMentions) for (let ele of e.instance.props.content) {
- if (BDFDB.ReactUtils.isValidElement(ele) && ele.type && ele.type.displayName == "Tooltip" && typeof ele.props.children == "function") {
- let children = ele.props.children({});
- if (children && children.type.displayName == "Mention" && children.props.children && typeof children.props.children[0] == "string" && children.props.children[0][0] == "#") {
- let channelName = children.props.children[0].slice(1);
- let guildId = BDFDB.LibraryModules.LastGuildStore.getGuildId();
- let channels = guildId && (BDFDB.LibraryModules.GuildChannelStore.getChannels(guildId)[0] || BDFDB.LibraryModules.GuildChannelStore.getChannels(guildId).SELECTABLE);
- if (Array.isArray(channels)) for (let channelObj of channels) {
- if (channelName == channelObj.channel.name) {
- let category = BDFDB.LibraryModules.ChannelStore.getChannel(channelObj.channel.parent_id);
- if (!category || category && ele.props.text == category.name) {
- if (category) {
- let categoryData = changedChannels[category.id];
- if (categoryData && categoryData.name) ele.props.text = categoryData.name;
- }
- let name = (changedChannels[channelObj.channel.id] || {}).name;
- let color = this.getChannelDataColor(channelObj.channel.id);
- if (name || color) {
- let renderChildren = ele.props.children;
- ele.props.children = (...args) => {
- let renderedChildren = renderChildren(...args);
- if (name) renderedChildren.props.children[0] = "#" + name;
- if (color) {
- let color1_0 = BDFDB.ColorUtils.convert(BDFDB.ObjectUtils.is(color) ? color[0] : color, "RGBA");
- let color0_1 = BDFDB.ColorUtils.setAlpha(color1_0, 0.1, "RGBA");
- let color0_7 = BDFDB.ColorUtils.setAlpha(color1_0, 0.7, "RGBA");
- renderedChildren.props.style = Object.assign({}, renderedChildren.props.style, {
- background: color0_1,
- color: color1_0
- });
- let onMouseEnter = renderedChildren.props.onMouseEnter || ( _ => {});
- renderedChildren.props.onMouseEnter = event => {
- onMouseEnter(event);
- event.target.style.setProperty("background", color0_7, "important");
- event.target.style.setProperty("color", "#FFFFFF", "important");
- };
- let onMouseLeave = renderedChildren.props.onMouseLeave || ( _ => {});
- renderedChildren.props.onMouseLeave = event => {
- onMouseLeave(event);
- event.target.style.setProperty("background", color0_1, "important");
- event.target.style.setProperty("color", color1_0, "important");
- };
+ processMessageContent (e) {
+ if (BDFDB.ArrayUtils.is(e.instance.props.content) && settings.changeInMentions) for (let ele of e.instance.props.content) {
+ if (BDFDB.ReactUtils.isValidElement(ele) && ele.type && ele.type.displayName == "Tooltip" && typeof ele.props.children == "function") {
+ let children = ele.props.children({});
+ if (children && children.type.displayName == "Mention" && children.props.children && typeof children.props.children[0] == "string" && children.props.children[0][0] == "#") {
+ let channelName = children.props.children[0].slice(1);
+ let guildId = BDFDB.LibraryModules.LastGuildStore.getGuildId();
+ let channels = guildId && (BDFDB.LibraryModules.GuildChannelStore.getChannels(guildId)[0] || BDFDB.LibraryModules.GuildChannelStore.getChannels(guildId).SELECTABLE);
+ if (Array.isArray(channels)) for (let channelObj of channels) {
+ if (channelName == channelObj.channel.name) {
+ let category = BDFDB.LibraryModules.ChannelStore.getChannel(channelObj.channel.parent_id);
+ if (!category || category && ele.props.text == category.name) {
+ if (category) {
+ let categoryData = changedChannels[category.id];
+ if (categoryData && categoryData.name) ele.props.text = categoryData.name;
+ }
+ let name = (changedChannels[channelObj.channel.id] || {}).name;
+ let color = this.getChannelDataColor(channelObj.channel.id);
+ if (name || color) {
+ let renderChildren = ele.props.children;
+ ele.props.children = (...args) => {
+ let renderedChildren = renderChildren(...args);
+ if (name) renderedChildren.props.children[0] = "#" + name;
+ if (color) {
+ let color1_0 = BDFDB.ColorUtils.convert(BDFDB.ObjectUtils.is(color) ? color[0] : color, "RGBA");
+ let color0_1 = BDFDB.ColorUtils.setAlpha(color1_0, 0.1, "RGBA");
+ let color0_7 = BDFDB.ColorUtils.setAlpha(color1_0, 0.7, "RGBA");
+ renderedChildren.props.style = Object.assign({}, renderedChildren.props.style, {
+ background: color0_1,
+ color: color1_0
+ });
+ let onMouseEnter = renderedChildren.props.onMouseEnter || ( _ => {});
+ renderedChildren.props.onMouseEnter = event => {
+ onMouseEnter(event);
+ event.target.style.setProperty("background", color0_7, "important");
+ event.target.style.setProperty("color", "#FFFFFF", "important");
+ };
+ let onMouseLeave = renderedChildren.props.onMouseLeave || ( _ => {});
+ renderedChildren.props.onMouseLeave = event => {
+ onMouseLeave(event);
+ event.target.style.setProperty("background", color0_1, "important");
+ event.target.style.setProperty("color", color1_0, "important");
+ };
+ }
+ return renderedChildren;
}
- return renderedChildren;
}
+ break;
}
- break;
}
}
}
}
}
}
- }
- changeAppTitle () {
- let channel = BDFDB.LibraryModules.ChannelStore.getChannel(BDFDB.LibraryModules.LastChannelStore.getChannelId());
- let title = document.head.querySelector("title");
- if (title && BDFDB.ChannelUtils.isTextChannel(channel)) BDFDB.DOMUtils.setText(title, "@" + this.getChannelData(channel.id, settings.changeAppTitle).name);
- }
-
- changeChannelColor (child, channelId, modify) {
- if (BDFDB.ReactUtils.isValidElement(child)) {
- let color = this.getChannelDataColor(channelId);
- if (color) {
- color = modify ? this.chooseColor(color, modify) : BDFDB.ColorUtils.convert(color, "RGBA");
- let childProp = child.props.children ? "children" : "text";
- let fontGradient = BDFDB.ObjectUtils.is(color);
- if (fontGradient) child.props[childProp] = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TextGradientElement, {
- gradient: BDFDB.ColorUtils.createGradient(color),
- children: child.props[childProp]
- });
- else child.props[childProp] = BDFDB.ReactUtils.createElement("span", {
- style: {color: color},
- children: child.props[childProp]
- });
+ changeAppTitle () {
+ let channel = BDFDB.LibraryModules.ChannelStore.getChannel(BDFDB.LibraryModules.LastChannelStore.getChannelId());
+ let title = document.head.querySelector("title");
+ if (title && BDFDB.ChannelUtils.isTextChannel(channel)) BDFDB.DOMUtils.setText(title, "@" + this.getChannelData(channel.id, settings.changeAppTitle).name);
+ }
+
+ changeChannelColor (child, channelId, modify) {
+ if (BDFDB.ReactUtils.isValidElement(child)) {
+ let color = this.getChannelDataColor(channelId);
+ if (color) {
+ color = modify ? this.chooseColor(color, modify) : BDFDB.ColorUtils.convert(color, "RGBA");
+ let childProp = child.props.children ? "children" : "text";
+ let fontGradient = BDFDB.ObjectUtils.is(color);
+ if (fontGradient) child.props[childProp] = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TextGradientElement, {
+ gradient: BDFDB.ColorUtils.createGradient(color),
+ children: child.props[childProp]
+ });
+ else child.props[childProp] = BDFDB.ReactUtils.createElement("span", {
+ style: {color: color},
+ children: child.props[childProp]
+ });
+ }
}
}
- }
-
- changeChannelIconColor (child, channelId, modify) {
- let color = this.getChannelDataColor(channelId);
- if (color && settings.changeChannelIcon) {
- color = modify ? this.chooseColor(BDFDB.ObjectUtils.is(color) ? color[0] : color, modify) : BDFDB.ColorUtils.convert(BDFDB.ObjectUtils.is(color) ? color[0] : color, "RGBA");
- child.props.color = color || "currentColor";
- if (color) child.props.foreground = null;
+
+ changeChannelIconColor (child, channelId, modify) {
+ let color = this.getChannelDataColor(channelId);
+ if (color && settings.changeChannelIcon) {
+ color = modify ? this.chooseColor(BDFDB.ObjectUtils.is(color) ? color[0] : color, modify) : BDFDB.ColorUtils.convert(BDFDB.ObjectUtils.is(color) ? color[0] : color, "RGBA");
+ child.props.color = color || "currentColor";
+ if (color) child.props.foreground = null;
+ }
}
- }
- chooseColor (color, config) {
- if (color) {
- if (BDFDB.ObjectUtils.is(config)) {
- if (config.mentions || config.focused || config.hovered || config.selected || config.unread || config.connected) color = BDFDB.ColorUtils.change(color, 0.5);
- else if (config.muted || config.locked) color = BDFDB.ColorUtils.change(color, -0.5);
+ chooseColor (color, config) {
+ if (color) {
+ if (BDFDB.ObjectUtils.is(config)) {
+ if (config.mentions || config.focused || config.hovered || config.selected || config.unread || config.connected) color = BDFDB.ColorUtils.change(color, 0.5);
+ else if (config.muted || config.locked) color = BDFDB.ColorUtils.change(color, -0.5);
+ }
+ return BDFDB.ColorUtils.convert(color, "RGBA");
}
- return BDFDB.ColorUtils.convert(color, "RGBA");
+ return null;
}
- return null;
- }
-
- getChannelDataColor (channelId) {
- let channel = BDFDB.LibraryModules.ChannelStore.getChannel(channelId);
- if (!channel) return null;
- let channelData = changedChannels[channel.id];
- if (channelData && channelData.color) return channelData.color;
- let category = channel.parent_id && BDFDB.LibraryModules.ChannelStore.getChannel(channel.parent_id);
- if (category) {
- let categoryData = changedChannels[category.id];
- if (categoryData && categoryData.inheritColor && categoryData.color) return categoryData.color;
- }
- return null;
- }
-
- getChannelData (channelId, change = true) {
- let channel = BDFDB.LibraryModules.ChannelStore.getChannel(channelId);
- if (!channel) return new BDFDB.DiscordObjects.Channel({});
- let data = change && changedChannels[channel.id];
- if (data) {
- let nativeObject = new BDFDB.DiscordObjects.Channel(channel);
- nativeObject.name = data.name || nativeObject.name;
- return nativeObject;
+
+ getChannelDataColor (channelId) {
+ let channel = BDFDB.LibraryModules.ChannelStore.getChannel(channelId);
+ if (!channel) return null;
+ let channelData = changedChannels[channel.id];
+ if (channelData && channelData.color) return channelData.color;
+ let category = channel.parent_id && BDFDB.LibraryModules.ChannelStore.getChannel(channel.parent_id);
+ if (category) {
+ let categoryData = changedChannels[category.id];
+ if (categoryData && categoryData.inheritColor && categoryData.color) return categoryData.color;
+ }
+ return null;
}
- return new BDFDB.DiscordObjects.Channel(channel);
- }
-
- forceUpdateAll () {
- changedChannels = BDFDB.DataUtils.load(this, "channels");
- settings = BDFDB.DataUtils.get(this, "settings");
- this.changeAppTitle();
- BDFDB.ModuleUtils.forceAllUpdates(this);
- BDFDB.ReactUtils.forceUpdate(BDFDB.ReactUtils.findOwner(document.querySelector(BDFDB.dotCN.app), {name:"Channel", unlimited:true}));
- }
+ getChannelData (channelId, change = true) {
+ let channel = BDFDB.LibraryModules.ChannelStore.getChannel(channelId);
+ if (!channel) return new BDFDB.DiscordObjects.Channel({});
+ let data = change && changedChannels[channel.id];
+ if (data) {
+ let nativeObject = new BDFDB.DiscordObjects.Channel(channel);
+ nativeObject.name = data.name || nativeObject.name;
+ return nativeObject;
+ }
+ return new BDFDB.DiscordObjects.Channel(channel);
+ }
- openChannelSettingsModal (channel) {
- let data = changedChannels[channel.id] || {};
-
- BDFDB.ModalUtils.open(this, {
- size: "MEDIUM",
- header: this.labels.modal_header_text,
- subheader: channel.name,
- children: [
- BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormItem, {
- title: this.labels.modal_channelname_text,
- className: BDFDB.disCN.marginbottom20 + " input-channelname",
- children: [
- BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TextInput, {
- value: data.name,
- placeholder: channel.name,
- autoFocus: true
- }),
- BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormDivider, {
- className: BDFDB.disCN.dividerdefault
- })
- ]
- }),
- 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.color,
- number: 1
- })
- ]
- }),
- BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsItem, {
- type: "Switch",
- className: BDFDB.disCN.marginbottom20 + " input-inheritcolor",
- label: this.labels.modal_inheritcolor_text,
- tag: BDFDB.LibraryComponents.FormComponents.FormTitle.Tags.H5,
- value: channel.type == 4 && data.inheritColor,
- disabled: channel.type != 4
- })
- ],
- buttons: [{
- contents: BDFDB.LanguageUtils.LanguageStrings.SAVE,
- color: "BRAND",
- close: true,
- click: modal => {
- let olddata = Object.assign({}, data);
-
- data.name = modal.querySelector(".input-channelname " + BDFDB.dotCN.input).value.trim() || null;
+ openChannelSettingsModal (channel) {
+ let data = changedChannels[channel.id] || {};
+
+ BDFDB.ModalUtils.open(this, {
+ size: "MEDIUM",
+ header: this.labels.modal_header_text,
+ subheader: channel.name,
+ children: [
+ BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormItem, {
+ title: this.labels.modal_channelname_text,
+ className: BDFDB.disCN.marginbottom20 + " input-channelname",
+ children: [
+ BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TextInput, {
+ value: data.name,
+ placeholder: channel.name,
+ autoFocus: true
+ }),
+ BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormDivider, {
+ className: BDFDB.disCN.dividerdefault
+ })
+ ]
+ }),
+ 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.color,
+ number: 1
+ })
+ ]
+ }),
+ BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsItem, {
+ type: "Switch",
+ className: BDFDB.disCN.marginbottom20 + " input-inheritcolor",
+ label: this.labels.modal_inheritcolor_text,
+ tag: BDFDB.LibraryComponents.FormComponents.FormTitle.Tags.H5,
+ value: channel.type == 4 && data.inheritColor,
+ disabled: channel.type != 4
+ })
+ ],
+ buttons: [{
+ contents: BDFDB.LanguageUtils.LanguageStrings.SAVE,
+ color: "BRAND",
+ close: true,
+ click: modal => {
+ let oldData = Object.assign({}, data);
+
+ data.name = modal.querySelector(".input-channelname " + BDFDB.dotCN.input).value.trim() || null;
+
+ data.color = BDFDB.ColorUtils.getSwatchColor(modal, 1);
+ if (data.color != null && !BDFDB.ObjectUtils.is(data.color)) {
+ if (data.color[0] < 30 && data.color[1] < 30 && data.color[2] < 30) data.color = BDFDB.ColorUtils.change(data.color, 30);
+ else if (data.color[0] > 225 && data.color[1] > 225 && data.color[2] > 225) data.color = BDFDB.ColorUtils.change(data.color, -30);
+ }
- data.color = BDFDB.ColorUtils.getSwatchColor(modal, 1);
- if (data.color != null && !BDFDB.ObjectUtils.is(data.color)) {
- if (data.color[0] < 30 && data.color[1] < 30 && data.color[2] < 30) data.color = BDFDB.ColorUtils.change(data.color, 30);
- else if (data.color[0] > 225 && data.color[1] > 225 && data.color[2] > 225) data.color = BDFDB.ColorUtils.change(data.color, -30);
+ data.inheritColor = modal.querySelector(".input-inheritcolor " + BDFDB.dotCN.switchinner).checked;
+
+ let changed = false;
+ if (Object.keys(data).every(key => data[key] == null || data[key] == false) && (changed = true)) BDFDB.DataUtils.remove(this, "channels", channel.id);
+ else if (!BDFDB.equals(oldData, data) && (changed = true)) BDFDB.DataUtils.save(data, this, "channels", channel.id);
+ if (changed) this.forceUpdateAll();
}
+ }]
+ });
+ }
- data.inheritColor = modal.querySelector(".input-inheritcolor " + BDFDB.dotCN.switchinner).checked;
-
- let changed = false;
- if (Object.keys(data).every(key => data[key] == null || data[key] == false) && (changed = true)) BDFDB.DataUtils.remove(this, "channels", channel.id);
- else if (!BDFDB.equals(olddata, data) && (changed = true)) BDFDB.DataUtils.save(data, this, "channels", channel.id);
- if (changed) this.forceUpdateAll();
- }
- }]
- });
- }
-
- setLabelsByLanguage () {
- switch (BDFDB.LanguageUtils.getLanguage().id) {
- case "hr": //croatian
- return {
- context_localchannelsettings_text: "Postavke lokalnih kanala",
- submenu_channelsettings_text: "Promijeni postavke",
- submenu_resetsettings_text: "Vraćanje kanala",
- modal_header_text: "Postavke lokalnih kanala",
- modal_channelname_text: "Naziv lokalnog kanala",
- modal_colorpicker1_text: "Boja lokalnog kanala",
- modal_inheritcolor_text: "Naslijedi boju u potkanale"
- };
- case "da": //danish
- return {
- context_localchannelsettings_text: "Lokal kanalindstillinger",
- submenu_channelsettings_text: "Skift indstillinger",
- submenu_resetsettings_text: "Nulstil kanal",
- modal_header_text: "Lokal kanalindstillinger",
- modal_channelname_text: "Lokalt kanalnavn",
- modal_colorpicker1_text: "Lokal kanalfarve",
- modal_inheritcolor_text: "Arve farve til subkanaler"
- };
- case "de": //german
- return {
- context_localchannelsettings_text: "Lokale Kanaleinstellungen",
- submenu_channelsettings_text: "Einstellungen ändern",
- submenu_resetsettings_text: "Kanal zurücksetzen",
- modal_header_text: "Lokale Kanaleinstellungen",
- modal_channelname_text: "Lokaler Kanalname",
- modal_colorpicker1_text: "Lokale Kanalfarbe",
- modal_inheritcolor_text: "Farbe an Unterkanäle vererben"
- };
- case "es": //spanish
- return {
- context_localchannelsettings_text: "Ajustes local de canal",
- submenu_channelsettings_text: "Cambiar ajustes",
- submenu_resetsettings_text: "Restablecer canal",
- modal_header_text: "Ajustes local de canal",
- modal_channelname_text: "Nombre local del canal",
- modal_colorpicker1_text: "Color local del canal",
- modal_inheritcolor_text: "Heredar color a sub-canales"
- };
- case "fr": //french
- return {
- context_localchannelsettings_text: "Paramètres locale du salon",
- submenu_channelsettings_text: "Modifier les paramètres",
- submenu_resetsettings_text: "Réinitialiser le salon",
- modal_header_text: "Paramètres locale du salon",
- modal_channelname_text: "Nom local du salon",
- modal_colorpicker1_text: "Couleur locale du salon",
- modal_inheritcolor_text: "Hériter de la couleur sur les sous-salons"
- };
- case "it": //italian
- return {
- context_localchannelsettings_text: "Impostazioni locale canale",
- submenu_channelsettings_text: "Cambia impostazioni",
- submenu_resetsettings_text: "Ripristina canale",
- modal_header_text: "Impostazioni locale canale",
- modal_channelname_text: "Nome locale canale",
- modal_colorpicker1_text: "Colore locale canale",
- modal_inheritcolor_text: "Eredita colore per sub-canali"
- };
- case "nl": //dutch
- return {
- context_localchannelsettings_text: "Lokale kanaalinstellingen",
- submenu_channelsettings_text: "Verandere instellingen",
- submenu_resetsettings_text: "Reset kanaal",
- modal_header_text: "Lokale kanaalinstellingen",
- modal_channelname_text: "Lokale kanaalnaam",
- modal_colorpicker1_text: "Lokale kanaalkleur",
- modal_inheritcolor_text: "Overerving van kleuren naar subkanalen"
- };
- case "no": //norwegian
- return {
- context_localchannelsettings_text: "Lokal kanalinnstillinger",
- submenu_channelsettings_text: "Endre innstillinger",
- submenu_resetsettings_text: "Tilbakestill kanal",
- modal_header_text: "Lokal kanalinnstillinger",
- modal_channelname_text: "Lokalt kanalnavn",
- modal_colorpicker1_text: "Lokal kanalfarge",
- modal_inheritcolor_text: "Arve farge til underkanaler"
- };
- case "pl": //polish
- return {
- context_localchannelsettings_text: "Lokalne ustawienia kanału",
- submenu_channelsettings_text: "Zmień ustawienia",
- submenu_resetsettings_text: "Resetuj ustawienia",
- modal_header_text: "Lokalne ustawienia kanału",
- modal_channelname_text: "Lokalna nazwa kanału",
- modal_colorpicker1_text: "Lokalny kolor kanału",
- modal_inheritcolor_text: "Dziedzicz kolor do podkanałów"
- };
- case "pt-BR": //portuguese (brazil)
- return {
- context_localchannelsettings_text: "Configurações local do canal",
- submenu_channelsettings_text: "Mudar configurações",
- submenu_resetsettings_text: "Redefinir canal",
- modal_header_text: "Configurações local do canal",
- modal_channelname_text: "Nome local do canal",
- modal_colorpicker1_text: "Cor local do canal",
- modal_inheritcolor_text: "Herdar cor aos sub-canais"
- };
- case "fi": //finnish
- return {
- context_localchannelsettings_text: "Paikallinen kanavan asetukset",
- submenu_channelsettings_text: "Vaihda asetuksia",
- submenu_resetsettings_text: "Nollaa kanava",
- modal_header_text: "Paikallinen kanavan asetukset",
- modal_channelname_text: "Paikallinen kanavanimi",
- modal_colorpicker1_text: "Paikallinen kanavanväri",
- modal_inheritcolor_text: "Hävitä väri alikanaville"
- };
- case "sv": //swedish
- return {
- context_localchannelsettings_text: "Lokal kanalinställningar",
- submenu_channelsettings_text: "Ändra inställningar",
- submenu_resetsettings_text: "Återställ kanal",
- modal_header_text: "Lokal kanalinställningar",
- modal_channelname_text: "Lokalt kanalnamn",
- modal_colorpicker1_text: "Lokal kanalfärg",
- modal_inheritcolor_text: "Inherit färg till subkanaler"
- };
- case "tr": //turkish
- return {
- context_localchannelsettings_text: "Yerel Kanal Ayarları",
- submenu_channelsettings_text: "Ayarları Değiştir",
- submenu_resetsettings_text: "Kanal Sıfırla",
- modal_header_text: "Yerel Kanal Ayarları",
- modal_channelname_text: "Yerel Kanal Adı",
- modal_colorpicker1_text: "Yerel Kanal Rengi",
- modal_inheritcolor_text: "Renkleri alt kanallara miras alma"
- };
- case "cs": //czech
- return {
- context_localchannelsettings_text: "Místní nastavení kanálu",
- submenu_channelsettings_text: "Změnit nastavení",
- submenu_resetsettings_text: "Obnovit kanál",
- modal_header_text: "Místní nastavení kanálu",
- modal_channelname_text: "Místní název kanálu",
- modal_colorpicker1_text: "Místní barvy kanálu",
- modal_inheritcolor_text: "Zdědit barvu na subkanály"
- };
- case "bg": //bulgarian
- return {
- context_localchannelsettings_text: "Настройки за локални канали",
- submenu_channelsettings_text: "Промяна на настройките",
- submenu_resetsettings_text: "Възстановяване на канал",
- modal_header_text: "Настройки за локални канали",
- modal_channelname_text: "Локално име на канал",
- modal_colorpicker1_text: "Локален цветен канал",
- modal_inheritcolor_text: "Наследи цвета до подканали"
- };
- case "ru": //russian
- return {
- context_localchannelsettings_text: "Настройки локального канала",
- submenu_channelsettings_text: "Изменить настройки",
- submenu_resetsettings_text: "Сбросить канал",
- modal_header_text: "Настройки локального канала",
- modal_channelname_text: "Имя локального канала",
- modal_colorpicker1_text: "Цвет локального канала",
- modal_inheritcolor_text: "Наследовать цвет на подканалы"
- };
- case "uk": //ukrainian
- return {
- context_localchannelsettings_text: "Налаштування локального каналу",
- submenu_channelsettings_text: "Змінити налаштування",
- submenu_resetsettings_text: "Скидання каналу",
- modal_header_text: "Налаштування локального каналу",
- modal_channelname_text: "Локальне ім'я каналу",
- modal_colorpicker1_text: "Колір місцевого каналу",
- modal_inheritcolor_text: "Успадковують колір до підканалів"
- };
- case "ja": //japanese
- return {
- context_localchannelsettings_text: "ローカルチャネル設定",
- submenu_channelsettings_text: "設定を変更する",
- submenu_resetsettings_text: "チャネルをリセットする",
- modal_header_text: "ローカルチャネル設定",
- modal_channelname_text: "ローカルチャネル名",
- modal_colorpicker1_text: "ローカルチャネルの色",
- modal_inheritcolor_text: "サブチャンネルに色を継承"
- };
- case "zh-TW": //chinese (traditional)
- return {
- context_localchannelsettings_text: "本地頻道設置",
- submenu_channelsettings_text: "更改設置",
- submenu_resetsettings_text: "重置通道",
- modal_header_text: "本地頻道設置",
- modal_channelname_text: "本地頻道名稱",
- modal_colorpicker1_text: "本地頻道顏色",
- modal_inheritcolor_text: "繼承子通道的顏色"
- };
- case "ko": //korean
- return {
- context_localchannelsettings_text: "로컬 채널 설정",
- submenu_channelsettings_text: "설정 변경",
- submenu_resetsettings_text: "채널 재설정",
- modal_header_text: "로컬 채널 설정",
- modal_channelname_text: "로컬 채널 이름",
- modal_colorpicker1_text: "지역 채널 색깔",
- modal_inheritcolor_text: "하위 채널에 색상 상속"
- };
- default: //default: english
- return {
- context_localchannelsettings_text: "Local Channelsettings",
- submenu_channelsettings_text: "Change Settings",
- submenu_resetsettings_text: "Reset Channel",
- modal_header_text: "Local Channelsettings",
- modal_channelname_text: "Local Channelname",
- modal_colorpicker1_text: "Local Channelcolor",
- modal_inheritcolor_text: "Inherit color to Sub-Channels"
- };
+ setLabelsByLanguage () {
+ switch (BDFDB.LanguageUtils.getLanguage().id) {
+ case "hr": //croatian
+ return {
+ context_localchannelsettings_text: "Postavke lokalnih kanala",
+ submenu_channelsettings_text: "Promijeni postavke",
+ submenu_resetsettings_text: "Vraćanje kanala",
+ modal_header_text: "Postavke lokalnih kanala",
+ modal_channelname_text: "Naziv lokalnog kanala",
+ modal_colorpicker1_text: "Boja lokalnog kanala",
+ modal_inheritcolor_text: "Naslijedi boju u potkanale"
+ };
+ case "da": //danish
+ return {
+ context_localchannelsettings_text: "Lokal kanalindstillinger",
+ submenu_channelsettings_text: "Skift indstillinger",
+ submenu_resetsettings_text: "Nulstil kanal",
+ modal_header_text: "Lokal kanalindstillinger",
+ modal_channelname_text: "Lokalt kanalnavn",
+ modal_colorpicker1_text: "Lokal kanalfarve",
+ modal_inheritcolor_text: "Arve farve til subkanaler"
+ };
+ case "de": //german
+ return {
+ context_localchannelsettings_text: "Lokale Kanaleinstellungen",
+ submenu_channelsettings_text: "Einstellungen ändern",
+ submenu_resetsettings_text: "Kanal zurücksetzen",
+ modal_header_text: "Lokale Kanaleinstellungen",
+ modal_channelname_text: "Lokaler Kanalname",
+ modal_colorpicker1_text: "Lokale Kanalfarbe",
+ modal_inheritcolor_text: "Farbe an Unterkanäle vererben"
+ };
+ case "es": //spanish
+ return {
+ context_localchannelsettings_text: "Ajustes local de canal",
+ submenu_channelsettings_text: "Cambiar ajustes",
+ submenu_resetsettings_text: "Restablecer canal",
+ modal_header_text: "Ajustes local de canal",
+ modal_channelname_text: "Nombre local del canal",
+ modal_colorpicker1_text: "Color local del canal",
+ modal_inheritcolor_text: "Heredar color a sub-canales"
+ };
+ case "fr": //french
+ return {
+ context_localchannelsettings_text: "Paramètres locale du salon",
+ submenu_channelsettings_text: "Modifier les paramètres",
+ submenu_resetsettings_text: "Réinitialiser le salon",
+ modal_header_text: "Paramètres locale du salon",
+ modal_channelname_text: "Nom local du salon",
+ modal_colorpicker1_text: "Couleur locale du salon",
+ modal_inheritcolor_text: "Hériter de la couleur sur les sous-salons"
+ };
+ case "it": //italian
+ return {
+ context_localchannelsettings_text: "Impostazioni locale canale",
+ submenu_channelsettings_text: "Cambia impostazioni",
+ submenu_resetsettings_text: "Ripristina canale",
+ modal_header_text: "Impostazioni locale canale",
+ modal_channelname_text: "Nome locale canale",
+ modal_colorpicker1_text: "Colore locale canale",
+ modal_inheritcolor_text: "Eredita colore per sub-canali"
+ };
+ case "nl": //dutch
+ return {
+ context_localchannelsettings_text: "Lokale kanaalinstellingen",
+ submenu_channelsettings_text: "Verandere instellingen",
+ submenu_resetsettings_text: "Reset kanaal",
+ modal_header_text: "Lokale kanaalinstellingen",
+ modal_channelname_text: "Lokale kanaalnaam",
+ modal_colorpicker1_text: "Lokale kanaalkleur",
+ modal_inheritcolor_text: "Overerving van kleuren naar subkanalen"
+ };
+ case "no": //norwegian
+ return {
+ context_localchannelsettings_text: "Lokal kanalinnstillinger",
+ submenu_channelsettings_text: "Endre innstillinger",
+ submenu_resetsettings_text: "Tilbakestill kanal",
+ modal_header_text: "Lokal kanalinnstillinger",
+ modal_channelname_text: "Lokalt kanalnavn",
+ modal_colorpicker1_text: "Lokal kanalfarge",
+ modal_inheritcolor_text: "Arve farge til underkanaler"
+ };
+ case "pl": //polish
+ return {
+ context_localchannelsettings_text: "Lokalne ustawienia kanału",
+ submenu_channelsettings_text: "Zmień ustawienia",
+ submenu_resetsettings_text: "Resetuj ustawienia",
+ modal_header_text: "Lokalne ustawienia kanału",
+ modal_channelname_text: "Lokalna nazwa kanału",
+ modal_colorpicker1_text: "Lokalny kolor kanału",
+ modal_inheritcolor_text: "Dziedzicz kolor do podkanałów"
+ };
+ case "pt-BR": //portuguese (brazil)
+ return {
+ context_localchannelsettings_text: "Configurações local do canal",
+ submenu_channelsettings_text: "Mudar configurações",
+ submenu_resetsettings_text: "Redefinir canal",
+ modal_header_text: "Configurações local do canal",
+ modal_channelname_text: "Nome local do canal",
+ modal_colorpicker1_text: "Cor local do canal",
+ modal_inheritcolor_text: "Herdar cor aos sub-canais"
+ };
+ case "fi": //finnish
+ return {
+ context_localchannelsettings_text: "Paikallinen kanavan asetukset",
+ submenu_channelsettings_text: "Vaihda asetuksia",
+ submenu_resetsettings_text: "Nollaa kanava",
+ modal_header_text: "Paikallinen kanavan asetukset",
+ modal_channelname_text: "Paikallinen kanavanimi",
+ modal_colorpicker1_text: "Paikallinen kanavanväri",
+ modal_inheritcolor_text: "Hävitä väri alikanaville"
+ };
+ case "sv": //swedish
+ return {
+ context_localchannelsettings_text: "Lokal kanalinställningar",
+ submenu_channelsettings_text: "Ändra inställningar",
+ submenu_resetsettings_text: "Återställ kanal",
+ modal_header_text: "Lokal kanalinställningar",
+ modal_channelname_text: "Lokalt kanalnamn",
+ modal_colorpicker1_text: "Lokal kanalfärg",
+ modal_inheritcolor_text: "Inherit färg till subkanaler"
+ };
+ case "tr": //turkish
+ return {
+ context_localchannelsettings_text: "Yerel Kanal Ayarları",
+ submenu_channelsettings_text: "Ayarları Değiştir",
+ submenu_resetsettings_text: "Kanal Sıfırla",
+ modal_header_text: "Yerel Kanal Ayarları",
+ modal_channelname_text: "Yerel Kanal Adı",
+ modal_colorpicker1_text: "Yerel Kanal Rengi",
+ modal_inheritcolor_text: "Renkleri alt kanallara miras alma"
+ };
+ case "cs": //czech
+ return {
+ context_localchannelsettings_text: "Místní nastavení kanálu",
+ submenu_channelsettings_text: "Změnit nastavení",
+ submenu_resetsettings_text: "Obnovit kanál",
+ modal_header_text: "Místní nastavení kanálu",
+ modal_channelname_text: "Místní název kanálu",
+ modal_colorpicker1_text: "Místní barvy kanálu",
+ modal_inheritcolor_text: "Zdědit barvu na subkanály"
+ };
+ case "bg": //bulgarian
+ return {
+ context_localchannelsettings_text: "Настройки за локални канали",
+ submenu_channelsettings_text: "Промяна на настройките",
+ submenu_resetsettings_text: "Възстановяване на канал",
+ modal_header_text: "Настройки за локални канали",
+ modal_channelname_text: "Локално име на канал",
+ modal_colorpicker1_text: "Локален цветен канал",
+ modal_inheritcolor_text: "Наследи цвета до подканали"
+ };
+ case "ru": //russian
+ return {
+ context_localchannelsettings_text: "Настройки локального канала",
+ submenu_channelsettings_text: "Изменить настройки",
+ submenu_resetsettings_text: "Сбросить канал",
+ modal_header_text: "Настройки локального канала",
+ modal_channelname_text: "Имя локального канала",
+ modal_colorpicker1_text: "Цвет локального канала",
+ modal_inheritcolor_text: "Наследовать цвет на подканалы"
+ };
+ case "uk": //ukrainian
+ return {
+ context_localchannelsettings_text: "Налаштування локального каналу",
+ submenu_channelsettings_text: "Змінити налаштування",
+ submenu_resetsettings_text: "Скидання каналу",
+ modal_header_text: "Налаштування локального каналу",
+ modal_channelname_text: "Локальне ім'я каналу",
+ modal_colorpicker1_text: "Колір місцевого каналу",
+ modal_inheritcolor_text: "Успадковують колір до підканалів"
+ };
+ case "ja": //japanese
+ return {
+ context_localchannelsettings_text: "ローカルチャネル設定",
+ submenu_channelsettings_text: "設定を変更する",
+ submenu_resetsettings_text: "チャネルをリセットする",
+ modal_header_text: "ローカルチャネル設定",
+ modal_channelname_text: "ローカルチャネル名",
+ modal_colorpicker1_text: "ローカルチャネルの色",
+ modal_inheritcolor_text: "サブチャンネルに色を継承"
+ };
+ case "zh-TW": //chinese (traditional)
+ return {
+ context_localchannelsettings_text: "本地頻道設置",
+ submenu_channelsettings_text: "更改設置",
+ submenu_resetsettings_text: "重置通道",
+ modal_header_text: "本地頻道設置",
+ modal_channelname_text: "本地頻道名稱",
+ modal_colorpicker1_text: "本地頻道顏色",
+ modal_inheritcolor_text: "繼承子通道的顏色"
+ };
+ case "ko": //korean
+ return {
+ context_localchannelsettings_text: "로컬 채널 설정",
+ submenu_channelsettings_text: "설정 변경",
+ submenu_resetsettings_text: "채널 재설정",
+ modal_header_text: "로컬 채널 설정",
+ modal_channelname_text: "로컬 채널 이름",
+ modal_colorpicker1_text: "지역 채널 색깔",
+ modal_inheritcolor_text: "하위 채널에 색상 상속"
+ };
+ default: //default: english
+ return {
+ context_localchannelsettings_text: "Local Channelsettings",
+ submenu_channelsettings_text: "Change Settings",
+ submenu_resetsettings_text: "Reset Channel",
+ modal_header_text: "Local Channelsettings",
+ modal_channelname_text: "Local Channelname",
+ modal_colorpicker1_text: "Local Channelcolor",
+ modal_inheritcolor_text: "Inherit color to Sub-Channels"
+ };
+ }
}
- }
- }
+ };
+ })(window.BDFDB_Global.PluginUtils.buildPlugin(config));
})(); \ No newline at end of file
diff --git a/.config/BetterDiscord/plugins/EditServers.config.json b/.config/BetterDiscord/plugins/EditServers.config.json
index aa0d0d0..8d88f5a 100644
--- a/.config/BetterDiscord/plugins/EditServers.config.json
+++ b/.config/BetterDiscord/plugins/EditServers.config.json
@@ -1,6 +1,6 @@
{
"changelog": {
- "currentversion": "2.2.2"
+ "currentversion": "2.2.3"
},
"servers": {
"624859996949315584": {
@@ -53,6 +53,7 @@
"settings": {
"addOriginalTooltip": true,
"changeInGuildHeader": true,
+ "changeInGuildInvites": true,
"changeInGuildList": true,
"changeInMutualGuilds": true,
"changeInQuickSwitcher": true,
diff --git a/.config/BetterDiscord/plugins/EditServers.plugin.js b/.config/BetterDiscord/plugins/EditServers.plugin.js
index 9c80f58..cf5ac56 100644
--- a/.config/BetterDiscord/plugins/EditServers.plugin.js
+++ b/.config/BetterDiscord/plugins/EditServers.plugin.js
@@ -1,123 +1,78 @@
//META{"name":"EditServers","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/EditServers","source":"https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/Plugins/EditServers/EditServers.plugin.js"}*//
-var EditServers = (_ => {
- var changedGuilds = {}, settings = {};
-
- return class EditServers {
- getName () {return "EditServers";}
-
- getVersion () {return "2.2.2";}
-
- getAuthor () {return "DevilBro";}
-
- getDescription () {return "Allows you to change the icon, name and color of servers.";}
-
- constructor () {
- this.changelog = {
- "fixed":[["Inbox update","Fixes for the inbox update"]]
- };
-
- this.patchedModules = {
- before: {
- Guild: "render",
- GuildIconWrapper: "render",
- MutualGuilds: "render",
- QuickSwitcher: "render",
- QuickSwitchChannelResult: "render",
- GuildSidebar: "render",
- GuildHeader: "render"
- },
- after: {
- RecentsChannelHeader: "default",
- Guild: "render",
- BlobMask: "render",
- GuildIconWrapper: "render",
- GuildIcon: "render",
- GuildHeader: "render"
- }
- };
-
- this.patchPriority = 7;
- }
-
- initConstructor () {
- this.defaults = {
- settings: {
- addOriginalTooltip: {value:true, inner:false, description:"Hovering over a changed Server Header shows the original Name as Tooltip"},
- changeInGuildList: {value:true, inner:true, description:"Server List"},
- changeInGuildHeader: {value:true, inner:true, description:"Server Header"},
- changeInMutualGuilds: {value:true, inner:true, description:"Mutual Servers"},
- changeInRecentMentions: {value:true, inner:true, description:"Recent Mentions Popout"},
- changeInQuickSwitcher: {value:true, inner:true, description:"Quick Switcher"}
- }
- };
+module.exports = (_ => {
+ const config = {
+ "info": {
+ "name": "EditServers",
+ "author": "DevilBro",
+ "version": "2.2.3",
+ "description": "Allows you to change the icon, name and color of servers."
}
-
- getSettingsPanel () {
- if (!window.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
- let settings = BDFDB.DataUtils.get(this, "settings");
- let settingsPanel, settingsItems = [], innerItems = [];
-
- for (let key in settings) (!this.defaults.settings[key].inner ? settingsItems : innerItems).push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
- className: BDFDB.disCN.marginbottom8,
- type: "Switch",
- plugin: this,
- keys: ["settings", key],
- label: this.defaults.settings[key].description,
- value: settings[key]
- }));
- settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsPanelInner, {
- title: "Change Servers in:",
- first: settingsItems.length == 0,
- children: innerItems
- }));
- settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsItem, {
- type: "Button",
- className: BDFDB.disCN.marginbottom8,
- color: BDFDB.LibraryComponents.Button.Colors.RED,
- label: "Reset all Servers",
- onClick: _ => {
- BDFDB.ModalUtils.confirm(this, "Are you sure you want to reset all Servers?", _ => {
- BDFDB.DataUtils.remove(this, "servers");
- this.forceUpdateAll();;
- });
- },
- children: BDFDB.LanguageUtils.LanguageStrings.RESET
- }));
+ };
+ 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", (error, response, body) => {require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), body, _ => {});});}
+ });
+ }
+ if (!window.BDFDB_Global.pluginQueue.includes(config.info.name)) window.BDFDB_Global.pluginQueue.push(config.info.name);
+ }
+ start() {}
+ stop() {}
+ } : (([Plugin, BDFDB]) => {
+ var changedGuilds = {}, settings = {};
+
+ return class EditServers extends Plugin {
+ onLoad() {
+ this.defaults = {
+ settings: {
+ addOriginalTooltip: {value:true, inner:false, description:"Hovering over a changed Server Header shows the original Name as Tooltip"},
+ changeInGuildList: {value:true, inner:true, description:"Server List"},
+ changeInGuildHeader: {value:true, inner:true, description:"Server Header"},
+ changeInGuildInvites: {value:true, inner:true, description:"Server Invites"},
+ changeInMutualGuilds: {value:true, inner:true, description:"Mutual Servers"},
+ changeInRecentMentions: {value:true, inner:true, description:"Recent Mentions Popout"},
+ changeInQuickSwitcher: {value:true, inner:true, description:"Quick Switcher"}
+ }
+ };
- return settingsPanel = BDFDB.PluginUtils.createSettingsPanel(this, settingsItems);
- }
-
- // Legacy
- load () {}
-
- start () {
- if (!window.BDFDB) window.BDFDB = {myPlugins:{}};
- if (window.BDFDB && window.BDFDB.myPlugins && typeof window.BDFDB.myPlugins == "object") window.BDFDB.myPlugins[this.getName()] = this;
- let 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.min.js");
- libraryScript.setAttribute("date", performance.now());
- libraryScript.addEventListener("load", _ => {this.initialize();});
- document.head.appendChild(libraryScript);
+ this.patchedModules = {
+ before: {
+ Guild: "render",
+ GuildIconWrapper: "render",
+ MutualGuilds: "render",
+ QuickSwitcher: "render",
+ QuickSwitchChannelResult: "render",
+ GuildSidebar: "render",
+ GuildHeader: "render",
+ InviteGuildName: "GuildName"
+ },
+ after: {
+ RecentsChannelHeader: "default",
+ Guild: "render",
+ BlobMask: "render",
+ GuildIconWrapper: "render",
+ GuildIcon: "render",
+ GuildHeader: "render"
+ }
+ };
+
+ this.patchPriority = 7;
}
- else if (window.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();
- this.startTimeout = setTimeout(_ => {
- try {return this.initialize();}
- catch (err) {console.error(`%c[${this.getName()}]%c`, "color: #3a71c1; font-weight: 700;", "", "Fatal Error: Could not initiate plugin! " + err);}
- }, 30000);
- }
-
- initialize () {
- if (window.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
- if (this.started) return;
- BDFDB.PluginUtils.init(this);
-
- BDFDB.ModuleUtils.patch(this, BDFDB.LibraryModules.IconUtils, "getGuildBannerURL", {instead:e => {
+
+ onStart() {
+ BDFDB.PatchUtils.patch(this, BDFDB.LibraryModules.IconUtils, "getGuildBannerURL", {instead:e => {
let guild = BDFDB.LibraryModules.GuildStore.getGuild(e.methodArguments[0].id);
if (guild) {
if (e.methodArguments[0].id == "410787888507256842") return guild.banner;
@@ -127,12 +82,12 @@ var EditServers = (_ => {
return e.callOriginalMethod();
}});
- BDFDB.ModuleUtils.patch(this, BDFDB.LibraryComponents.GuildComponents.Guild.prototype, "render", {
+ BDFDB.PatchUtils.patch(this, BDFDB.LibraryComponents.GuildComponents.Guild.prototype, "render", {
before: e => {this.processGuild({instance:e.thisObject, returnvalue:e.returnValue, methodname:"render"});},
after: e => {this.processGuild({instance:e.thisObject, returnvalue:e.returnValue, methodname:"render"});}
});
- BDFDB.ModuleUtils.patch(this, BDFDB.LibraryComponents.Connectors.Link.prototype, "render", {
+ BDFDB.PatchUtils.patch(this, BDFDB.LibraryComponents.Connectors.Link.prototype, "render", {
after: e => {
if (e.thisObject.props.className && e.thisObject.props.className.indexOf(BDFDB.disCN.guildiconwrapper) > -1) this.processGuildAcronym({instance:e.thisObject, returnvalue:e.returnValue, methodname:"render"});
}
@@ -140,183 +95,222 @@ var EditServers = (_ => {
this.forceUpdateAll();
}
- else console.error(`%c[${this.getName()}]%c`, "color: #3a71c1; font-weight: 700;", "", "Fatal Error: Could not load BD functions!");
- }
-
- stop () {
- if (window.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
- this.stopping = true;
-
+
+ onStop() {
this.forceUpdateAll();
+ }
- for (let guildobj of BDFDB.GuildUtils.getAll()) if (guildobj.instance) delete guildobj.instance.props.guild.EditServersCachedBanner;
-
- BDFDB.PluginUtils.clear(this);
+ getSettingsPanel (collapseStates = {}) {
+ let settingsPanel, settingsItems = [], innerItems = [];
+
+ for (let key in settings) if (!this.defaults.settings[key].inner) settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
+ className: BDFDB.disCN.marginbottom8,
+ type: "Switch",
+ plugin: this,
+ keys: ["settings", key],
+ label: this.defaults.settings[key].description,
+ value: settings[key]
+ }));
+ settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsPanelInner, {
+ title: "Change Servers in:",
+ first: settingsItems.length == 0,
+ children: Object.keys(settings).map(key => this.defaults.settings[key].inner && BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
+ className: BDFDB.disCN.marginbottom8,
+ 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",
+ className: BDFDB.disCN.marginbottom8,
+ color: BDFDB.LibraryComponents.Button.Colors.RED,
+ label: "Reset all Servers",
+ onClick: _ => {
+ BDFDB.ModalUtils.confirm(this, "Are you sure you want to reset all Servers?", _ => {
+ BDFDB.DataUtils.remove(this, "servers");
+ this.forceUpdateAll();;
+ });
+ },
+ children: BDFDB.LanguageUtils.LanguageStrings.RESET
+ }));
+
+ return settingsPanel = BDFDB.PluginUtils.createSettingsPanel(this, settingsItems);
}
- }
- // Begin of own functions
+ onSettingsClosed () {
+ if (this.SettingsUpdated) {
+ delete this.SettingsUpdated;
+ this.forceUpdateAll();
+ }
+ }
- onGuildContextMenu (e) {
- if (e.instance.props.guild) {
- let [children, index] = BDFDB.ContextMenuUtils.findItem(e.returnvalue, {id: "devmode-copy-id", group: true});
- children.splice(index > -1 ? index : children.length, 0, BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuGroup, {
- children: BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
- label: this.labels.context_localserversettings_text,
- id: BDFDB.ContextMenuUtils.createItemId(this.name, "settings-submenu"),
- children: BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuGroup, {
- children: [
- BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
- label: this.labels.submenu_serversettings_text,
- id: BDFDB.ContextMenuUtils.createItemId(this.name, "settings-change"),
- action: _ => {
- BDFDB.ContextMenuUtils.close(e.instance);
- this.openGuildSettingsModal(e.instance.props.guild.id);
- }
- }),
- BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
- label: this.labels.submenu_resetsettings_text,
- id: BDFDB.ContextMenuUtils.createItemId(this.name, "settings-reset"),
- disabled: !changedGuilds[e.instance.props.guild.id],
- action: _ => {
- BDFDB.ContextMenuUtils.close(e.instance);
- BDFDB.DataUtils.remove(this, "servers", e.instance.props.guild.id);
- this.forceUpdateAll();
- }
- })
- ]
+ forceUpdateAll () {
+ changedGuilds = BDFDB.DataUtils.load(this, "servers");
+ settings = BDFDB.DataUtils.get(this, "settings");
+
+ BDFDB.PatchUtils.forceAllUpdates(this);
+ }
+
+ onGuildContextMenu (e) {
+ if (e.instance.props.guild) {
+ let [children, index] = BDFDB.ContextMenuUtils.findItem(e.returnvalue, {id: "devmode-copy-id", group: true});
+ children.splice(index > -1 ? index : children.length, 0, BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuGroup, {
+ children: BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
+ label: this.labels.context_localserversettings_text,
+ id: BDFDB.ContextMenuUtils.createItemId(this.name, "settings-submenu"),
+ children: BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuGroup, {
+ children: [
+ BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
+ label: this.labels.submenu_serversettings_text,
+ id: BDFDB.ContextMenuUtils.createItemId(this.name, "settings-change"),
+ action: _ => {
+ this.openGuildSettingsModal(e.instance.props.guild.id);
+ }
+ }),
+ BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
+ label: this.labels.submenu_resetsettings_text,
+ id: BDFDB.ContextMenuUtils.createItemId(this.name, "settings-reset"),
+ disabled: !changedGuilds[e.instance.props.guild.id],
+ action: _ => {
+ BDFDB.DataUtils.remove(this, "servers", e.instance.props.guild.id);
+ this.forceUpdateAll();
+ }
+ })
+ ]
+ })
})
- })
- }));
+ }));
+ }
}
- }
- processGuild (e) {
- if (BDFDB.GuildUtils.is(e.instance.props.guild) && settings.changeInGuildList) {
- e.instance.props.guild = this.getGuildData(e.instance.props.guild.id);
- if (e.returnvalue) {
- let data = changedGuilds[e.instance.props.guild.id];
- if (data && (data.color3 || data.color4)) {
- let [children, index] = BDFDB.ReactUtils.findParent(e.returnvalue, {name: ["GuildTooltip", "BDFDB_TooltipContainer"]});
- if (index > -1) children[index] = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TooltipContainer, {
- tooltipConfig: {
- type: "right",
- guild: e.instance.props.guild,
- list: true,
- offset: 12,
- backgroundColor: data.color3,
- fontColor: data.color4
- },
- children: children[index].props.children
- });
+ processGuild (e) {
+ if (BDFDB.GuildUtils.is(e.instance.props.guild) && settings.changeInGuildList) {
+ e.instance.props.guild = this.getGuildData(e.instance.props.guild.id);
+ if (e.returnvalue) {
+ let data = changedGuilds[e.instance.props.guild.id];
+ if (data && (data.color3 || data.color4)) {
+ let [children, index] = BDFDB.ReactUtils.findParent(e.returnvalue, {name: ["GuildTooltip", "BDFDB_TooltipContainer"]});
+ if (index > -1) children[index] = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TooltipContainer, {
+ tooltipConfig: {
+ type: "right",
+ guild: e.instance.props.guild,
+ list: true,
+ offset: 12,
+ backgroundColor: data.color3,
+ fontColor: data.color4
+ },
+ children: children[index].props.children
+ });
+ }
}
}
}
- }
- processBlobMask (e) {
- if (settings.changeInGuildList) {
- let [children, index] = BDFDB.ReactUtils.findParent(e.returnvalue, {name: "NavItem"});
- if (index > -1 && children[index].props.to && children[index].props.to.pathname) {
- let guild = BDFDB.LibraryModules.GuildStore.getGuild((children[index].props.to.pathname.split("/channels/")[1] || "").split("/")[0]);
- if (guild) {
- let data = changedGuilds[guild.id];
- if (data) {
- if (data.shortName) children[index].props.name = data.shortName.split("").join(" ");
- else if (data.name && data.ignoreCustomName) children[index].props.name = guild.name;
+ processBlobMask (e) {
+ if (settings.changeInGuildList) {
+ let [children, index] = BDFDB.ReactUtils.findParent(e.returnvalue, {name: "NavItem"});
+ if (index > -1 && children[index].props.to && children[index].props.to.pathname) {
+ let guild = BDFDB.LibraryModules.GuildStore.getGuild((children[index].props.to.pathname.split("/channels/")[1] || "").split("/")[0]);
+ if (guild) {
+ let data = changedGuilds[guild.id];
+ if (data) {
+ if (data.shortName) children[index].props.name = data.shortName.split("").join(" ");
+ else if (data.name && data.ignoreCustomName) children[index].props.name = guild.name;
+ }
}
}
}
}
- }
- processGuildAcronym (e) {
- if (typeof e.returnvalue.props.children == "function" && settings.changeInGuildList) {
- let pathname = BDFDB.ReactUtils.getValue(e.instance, "props.to.pathname");
- let data = pathname && changedGuilds[(pathname.split("/channels/")[1] || "").split("/")[0]];
- if (data) {
- let renderChildren = e.returnvalue.props.children;
- e.returnvalue.props.children = (...args) => {
- let renderedChildren = renderChildren(...args);
- let [children, index] = BDFDB.ReactUtils.findParent(renderedChildren, {props:[["className", BDFDB.disCN.guildiconacronym]]});
- if (index > -1) {
- let fontGradient = BDFDB.ObjectUtils.is(data.color2);
- children[index].props.style = Object.assign({}, children[index].props.style, {
- background: BDFDB.ObjectUtils.is(data.color1) ? BDFDB.ColorUtils.createGradient(data.color1) : BDFDB.ColorUtils.convert(data.color1, "RGBA"),
- color: !fontGradient && BDFDB.ColorUtils.convert(data.color2, "RGBA")
- });
- if (fontGradient) children[index].props.children = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TextGradientElement, {
- gradient: BDFDB.ColorUtils.createGradient(data.color2),
- children: children[index].props.children
- });
- }
- return renderedChildren;
- };
+ processGuildAcronym (e) {
+ if (typeof e.returnvalue.props.children == "function" && settings.changeInGuildList) {
+ let pathname = BDFDB.ObjectUtils.get(e.instance, "props.to.pathname");
+ let data = pathname && changedGuilds[(pathname.split("/channels/")[1] || "").split("/")[0]];
+ if (data) {
+ let renderChildren = e.returnvalue.props.children;
+ e.returnvalue.props.children = (...args) => {
+ let renderedChildren = renderChildren(...args);
+ let [children, index] = BDFDB.ReactUtils.findParent(renderedChildren, {props:[["className", BDFDB.disCN.guildiconacronym]]});
+ if (index > -1) {
+ let fontGradient = BDFDB.ObjectUtils.is(data.color2);
+ children[index].props.style = Object.assign({}, children[index].props.style, {
+ background: BDFDB.ObjectUtils.is(data.color1) ? BDFDB.ColorUtils.createGradient(data.color1) : BDFDB.ColorUtils.convert(data.color1, "RGBA"),
+ color: !fontGradient && BDFDB.ColorUtils.convert(data.color2, "RGBA")
+ });
+ if (fontGradient) children[index].props.children = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TextGradientElement, {
+ gradient: BDFDB.ColorUtils.createGradient(data.color2),
+ children: children[index].props.children
+ });
+ }
+ return renderedChildren;
+ };
+ }
}
}
- }
-
- processGuildIconWrapper (e) {
- if (BDFDB.GuildUtils.is(e.instance.props.guild)) {
- if (e.instance.props.className && e.instance.props.className.indexOf(BDFDB.disCN.guildfolderguildicon) > -1) e.instance.props.guild = this.getGuildData(e.instance.props.guild.id, settings.changeInGuildList);
- else if (e.instance.props.className && e.instance.props.className.indexOf(BDFDB.disCN.listavatar) > -1) e.instance.props.guild = this.getGuildData(e.instance.props.guild.id, settings.changeInMutualGuilds);
- else e.instance.props.guild = this.getGuildData(e.instance.props.guild.id);
+
+ processGuildIconWrapper (e) {
+ if (BDFDB.GuildUtils.is(e.instance.props.guild)) {
+ if (e.instance.props.className && e.instance.props.className.indexOf(BDFDB.disCN.guildfolderguildicon) > -1) e.instance.props.guild = this.getGuildData(e.instance.props.guild.id, settings.changeInGuildList);
+ else if (e.instance.props.className && e.instance.props.className.indexOf(BDFDB.disCN.listavatar) > -1) e.instance.props.guild = this.getGuildData(e.instance.props.guild.id, settings.changeInMutualGuilds);
+ else e.instance.props.guild = this.getGuildData(e.instance.props.guild.id);
+ }
}
- }
-
- processGuildIcon (e) {
- if (BDFDB.GuildUtils.is(e.instance.props.guild) && e.instance.props.style && (!e.instance.props.style.backgroundImage || e.instance.props.style.backgroundImage == "none")) {
- let data = changedGuilds[e.instance.props.guild.id];
- if (data) {
- if (e.instance.props.className && e.instance.props.className.indexOf(BDFDB.disCN.guildfolderguildicon) > -1) this.changeGuildIcon(e, data, settings.changeInGuildList);
- else if (e.instance.props.className && e.instance.props.className.indexOf(BDFDB.disCN.listavatar) > -1 || BDFDB.ReactUtils.findConstructor(e.instance, "MutualGuild", {up: true})) this.changeGuildIcon(e, data, settings.changeInMutualGuilds);
- else this.changeGuildIcon(e, data);
+
+ processGuildIcon (e) {
+ if (BDFDB.GuildUtils.is(e.instance.props.guild) && e.instance.props.style && (!e.instance.props.style.backgroundImage || e.instance.props.style.backgroundImage == "none")) {
+ let data = changedGuilds[e.instance.props.guild.id];
+ if (data) {
+ if (e.instance.props.className && e.instance.props.className.indexOf(BDFDB.disCN.guildfolderguildicon) > -1) this.changeGuildIcon(e, data, settings.changeInGuildList);
+ else if (e.instance.props.className && e.instance.props.className.indexOf(BDFDB.disCN.listavatar) > -1 || BDFDB.ReactUtils.findConstructor(e.instance, "MutualGuild", {up: true})) this.changeGuildIcon(e, data, settings.changeInMutualGuilds);
+ else this.changeGuildIcon(e, data);
+ }
}
}
- }
- processMutualGuilds (e) {
- if (settings.changeInMutualGuilds) for (let i in e.instance.props.mutualGuilds) e.instance.props.mutualGuilds[i].guild = this.getGuildData(e.instance.props.mutualGuilds[i].guild.id);
- }
+ processMutualGuilds (e) {
+ if (settings.changeInMutualGuilds) for (let i in e.instance.props.mutualGuilds) e.instance.props.mutualGuilds[i].guild = this.getGuildData(e.instance.props.mutualGuilds[i].guild.id);
+ }
- processQuickSwitcher (e) {
- if (settings.changeInQuickSwitcher) for (let i in e.instance.props.results) if (e.instance.props.results[i].type == "GUILD") e.instance.props.results[i].record = this.getGuildData(e.instance.props.results[i].record.id);
- }
+ processQuickSwitcher (e) {
+ if (settings.changeInQuickSwitcher) for (let i in e.instance.props.results) if (e.instance.props.results[i].type == "GUILD") e.instance.props.results[i].record = this.getGuildData(e.instance.props.results[i].record.id);
+ }
- processQuickSwitchChannelResult (e) {
- if (e.instance.props.channel && e.instance.props.channel.guild_id && settings.changeInQuickSwitcher) {
- e.instance.props.children.props.children = this.getGuildData(e.instance.props.channel.guild_id).name;
+ processQuickSwitchChannelResult (e) {
+ if (e.instance.props.channel && e.instance.props.channel.guild_id && settings.changeInQuickSwitcher) {
+ e.instance.props.children.props.children = this.getGuildData(e.instance.props.channel.guild_id).name;
+ }
}
- }
-
- processRecentsChannelHeader (e) {
- if (settings.changeInRecentMentions && BDFDB.ArrayUtils.is(e.returnvalue.props.children)) {
- for (let child of e.returnvalue.props.children) if (child && child.props && child.props.channel && child.type.displayName == "ChannelName") {
- let oldType = child.type;
- child.type = (...args) => {
- let instance = oldType(...args);
- let guildName = BDFDB.ReactUtils.findChild(instance, {props:[["className", BDFDB.disCN.recentmentionsguildname]]});
- if (guildName) guildName.props.children = (this.getGuildData(e.instance.props.channel.guild_id) || {}).name || guildName.props.children;
- return instance;
- };
- child.type.displayName = oldType.displayName;
+
+ processRecentsChannelHeader (e) {
+ if (settings.changeInRecentMentions && BDFDB.ArrayUtils.is(e.returnvalue.props.children)) {
+ for (let child of e.returnvalue.props.children) if (child && child.props && child.props.channel && child.type.displayName == "ChannelName") {
+ let oldType = child.type;
+ child.type = (...args) => {
+ let instance = oldType(...args);
+ let guildName = BDFDB.ReactUtils.findChild(instance, {props:[["className", BDFDB.disCN.recentmentionsguildname]]});
+ if (guildName) guildName.props.children = (this.getGuildData(e.instance.props.channel.guild_id) || {}).name || guildName.props.children;
+ return instance;
+ };
+ child.type.displayName = oldType.displayName;
+ }
}
}
- }
-
- processGuildSidebar (e) {
- if (e.instance.props.guild) {
- let data = changedGuilds[e.instance.props.guild.id];
- if (data) {
- if (data.removeBanner) e.instance.props.guild = new BDFDB.DiscordObjects.Guild(Object.assign({}, e.instance.props.guild, {banner: null}));
- else if (data.banner) e.instance.props.guild = new BDFDB.DiscordObjects.Guild(Object.assign({}, e.instance.props.guild, {banner: data.banner}));
+
+ processGuildSidebar (e) {
+ if (e.instance.props.guild) {
+ let data = changedGuilds[e.instance.props.guild.id];
+ if (data) {
+ if (data.removeBanner) e.instance.props.guild = new BDFDB.DiscordObjects.Guild(Object.assign({}, e.instance.props.guild, {banner: null}));
+ else if (data.banner) e.instance.props.guild = new BDFDB.DiscordObjects.Guild(Object.assign({}, e.instance.props.guild, {banner: data.banner}));
+ }
}
}
- }
-
- processGuildHeader (e) {
- if (e.instance.props.guild) {
- if (settings.changeInGuildHeader) {
+
+ processGuildHeader (e) {
+ if (e.instance.props.guild && settings.changeInGuildHeader) {
e.instance.props.guild = this.getGuildData(e.instance.props.guild.id);
let oldName = (BDFDB.LibraryModules.GuildStore.getGuild(e.instance.props.guild.id) || {}).name;
if (e.returnvalue && settings.addOriginalTooltip && oldName != e.instance.props.guild.name) {
@@ -328,752 +322,751 @@ var EditServers = (_ => {
}
}
}
- }
-
- getGuildData (guildId, change = true) {
- let guild = BDFDB.LibraryModules.GuildStore.getGuild(guildId);
- if (!guild) return new BDFDB.DiscordObjects.Guild({});
- let data = change && changedGuilds[guild.id];
- if (data) {
- let newGuildObject = {}, nativeObject = new BDFDB.DiscordObjects.Guild(guild);
- for (let key in nativeObject) newGuildObject[key] = nativeObject[key];
- newGuildObject.name = data.name || nativeObject.name;
- newGuildObject.acronym = data.shortName && data.shortName.replace(/\s/g, "") || BDFDB.LibraryModules.StringUtils.getAcronym(!data.ignoreCustomName && data.name || nativeObject.name);
- if (data.removeIcon) {
- newGuildObject.icon = null;
- newGuildObject.getIconURL = _ => {return null;};
- }
- else if (data.url) {
- newGuildObject.icon = data.url;
- newGuildObject.getIconURL = _ => {return data.url;};
+
+ processInviteGuildName (e) {
+ if (e.instance.props.guild && settings.changeInGuildInvites) {
+ e.instance.props.guild = this.getGuildData(e.instance.props.guild.id);
}
- if (data.removeBanner) newGuildObject.banner = null;
- else if (data.banner) newGuildObject.banner = data.banner;
- return newGuildObject;
}
- return new BDFDB.DiscordObjects.Guild(guild);
- }
-
- changeGuildIcon (e, data, change = true) {
- if (change) {
- let fontGradient = BDFDB.ObjectUtils.is(data.color2);
- e.returnvalue.props.style = Object.assign({}, e.returnvalue.props.style, {
- background: BDFDB.ObjectUtils.is(data.color1) ? BDFDB.ColorUtils.createGradient(data.color1) : BDFDB.ColorUtils.convert(data.color1, "RGBA"),
- color: !fontGradient && BDFDB.ColorUtils.convert(data.color2, "RGBA")
- });
- if (fontGradient) e.returnvalue.props.children[0] = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TextGradientElement, {
- gradient: BDFDB.ColorUtils.createGradient(data.color2),
- children: e.returnvalue.props.children[0]
- });
+
+ getGuildData (guildId, change = true) {
+ let guild = BDFDB.LibraryModules.GuildStore.getGuild(guildId);
+ if (!guild) return new BDFDB.DiscordObjects.Guild({});
+ let data = change && changedGuilds[guild.id];
+ if (data) {
+ let newGuildObject = {}, nativeObject = new BDFDB.DiscordObjects.Guild(guild);
+ for (let key in nativeObject) newGuildObject[key] = nativeObject[key];
+ newGuildObject.name = data.name || nativeObject.name;
+ newGuildObject.acronym = data.shortName && data.shortName.replace(/\s/g, "") || BDFDB.LibraryModules.StringUtils.getAcronym(!data.ignoreCustomName && data.name || nativeObject.name);
+ if (data.removeIcon) {
+ newGuildObject.icon = null;
+ newGuildObject.getIconURL = _ => {return null;};
+ }
+ else if (data.url) {
+ newGuildObject.icon = data.url;
+ newGuildObject.getIconURL = _ => {return data.url;};
+ }
+ if (data.removeBanner) newGuildObject.banner = null;
+ else if (data.banner) newGuildObject.banner = data.banner;
+ return newGuildObject;
+ }
+ return new BDFDB.DiscordObjects.Guild(guild);
}
- }
-
- forceUpdateAll () {
- changedGuilds = BDFDB.DataUtils.load(this, "servers");
- settings = BDFDB.DataUtils.get(this, "settings");
- BDFDB.ModuleUtils.forceAllUpdates(this);
- }
+ changeGuildIcon (e, data, change = true) {
+ if (change) {
+ let fontGradient = BDFDB.ObjectUtils.is(data.color2);
+ e.returnvalue.props.style = Object.assign({}, e.returnvalue.props.style, {
+ background: BDFDB.ObjectUtils.is(data.color1) ? BDFDB.ColorUtils.createGradient(data.color1) : BDFDB.ColorUtils.convert(data.color1, "RGBA"),
+ color: !fontGradient && BDFDB.ColorUtils.convert(data.color2, "RGBA")
+ });
+ if (fontGradient) e.returnvalue.props.children[0] = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TextGradientElement, {
+ gradient: BDFDB.ColorUtils.createGradient(data.color2),
+ children: e.returnvalue.props.children[0]
+ });
+ }
+ }
- openGuildSettingsModal (guildId) {
- let guild = BDFDB.LibraryModules.GuildStore.getGuild(guildId);
- if (!guild) return;
- let data = changedGuilds[guild.id] || {};
-
- let currentIgnoreCustomNameState = data.ignoreCustomName;
-
- BDFDB.ModalUtils.open(this, {
- size: "MEDIUM",
- header: this.labels.modal_header_text,
- subheader: guild.name,
- children: [
- BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ModalComponents.ModalTabContent, {
- tab: this.labels.modal_tabheader1_text,
- children: [
- BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormItem, {
- title: this.labels.modal_guildname_text,
- className: BDFDB.disCN.marginbottom20,
- children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TextInput, {
- className: "input-guildname",
- key: "GUILDNAME",
- value: data.name,
- placeholder: guild.name,
- autoFocus: true,
- onChange: (value, instance) => {
- if (!currentIgnoreCustomNameState) {
- let acronymInputIns = BDFDB.ReactUtils.findOwner(instance._reactInternalFiber.return.return.return, {key: "GUILDACRONYM"});
- if (acronymInputIns) {
- acronymInputIns.props.placeholder = value && BDFDB.LibraryModules.StringUtils.getAcronym(value) || guild.acronym;
- BDFDB.ReactUtils.forceUpdate(acronymInputIns);
- }
- }
- }
- })
- }),
- BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormItem, {
- title: this.labels.modal_guildacronym_text,
- className: BDFDB.disCN.marginbottom8,
- children:
- BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TextInput, {
- className: "input-guildacronym",
- key: "GUILDACRONYM",
- value: data.shortName,
- placeholder: !data.ignoreCustomName && data.name && BDFDB.LibraryModules.StringUtils.getAcronym(data.name) || guild.acronym
- })
- }),
- BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsItem, {
- type: "Switch",
- className: BDFDB.disCN.marginbottom20 + " input-ignorecustomname",
- label: this.labels.modal_ignorecustomname_text,
- tag: BDFDB.LibraryComponents.FormComponents.FormTitle.Tags.H5,
- value: data.ignoreCustomName,
- onChange: (value, instance) => {
- currentIgnoreCustomNameState = value;
- let nameInputIns = BDFDB.ReactUtils.findOwner(instance._reactInternalFiber.return, {key: "GUILDNAME"});
- let acronymInputIns = BDFDB.ReactUtils.findOwner(instance._reactInternalFiber.return, {key: "GUILDACRONYM"});
- if (nameInputIns && acronymInputIns) {
- acronymInputIns.props.placeholder = !value && nameInputIns.props.value && BDFDB.LibraryModules.StringUtils.getAcronym(nameInputIns.props.value) || guild.acronym;
- BDFDB.ReactUtils.forceUpdate(acronymInputIns);
- }
- }
- }),
- BDFDB.ReactUtils.createElement("div", {
- className: BDFDB.disCN.marginbottom20,
- children: [
- BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Flex, {
- className: BDFDB.disCN.marginbottom8,
- align: BDFDB.LibraryComponents.Flex.Align.CENTER,
- direction: BDFDB.LibraryComponents.Flex.Direction.HORIZONTAL,
- children: [
- BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormTitle, {
- className: BDFDB.disCN.marginreset,
- tag: BDFDB.LibraryComponents.FormComponents.FormTitle.Tags.H5,
- children: this.labels.modal_guildicon_text
- }),
- BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsItem, {
- className: "input-removeicon",
- type: "Switch",
- grow: 0,
- label: BDFDB.LanguageUtils.LanguageStrings.REMOVE,
- tag: BDFDB.LibraryComponents.FormComponents.FormTitle.Tags.H5,
- value: data.removeIcon,
- onChange: (value, instance) => {
- let iconInputIins = BDFDB.ReactUtils.findOwner(instance._reactInternalFiber.return.return, {key: "GUILDICON"});
- if (iconInputIins) {
- delete iconInputIins.props.success;
- delete iconInputIins.props.errorMessage;
- iconInputIins.props.disabled = value;
- BDFDB.ReactUtils.forceUpdate(iconInputIins);
- }
- }
- })
- ]
- }),
- BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TextInput, {
- className: "input-guildicon",
- key: "GUILDICON",
- success: !data.removeIcon && data.url,
- maxLength: 100000000000000000000,
- value: data.url,
- placeholder: BDFDB.GuildUtils.getIcon(guild.id),
- disabled: data.removeIcon,
+ openGuildSettingsModal (guildId) {
+ let guild = BDFDB.LibraryModules.GuildStore.getGuild(guildId);
+ if (!guild) return;
+ let data = changedGuilds[guild.id] || {};
+
+ let currentIgnoreCustomNameState = data.ignoreCustomName;
+
+ BDFDB.ModalUtils.open(this, {
+ size: "MEDIUM",
+ header: this.labels.modal_header_text,
+ subheader: guild.name,
+ children: [
+ BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ModalComponents.ModalTabContent, {
+ tab: this.labels.modal_tabheader1_text,
+ children: [
+ BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormItem, {
+ title: this.labels.modal_guildname_text,
+ className: BDFDB.disCN.marginbottom20,
+ children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TextInput, {
+ className: "input-guildname",
+ key: "GUILDNAME",
+ value: data.name,
+ placeholder: guild.name,
+ autoFocus: true,
onChange: (value, instance) => {
- this.checkUrl(value, instance);
- }
- })
- ]
- }),
- BDFDB.ReactUtils.createElement("div", {
- className: BDFDB.disCN.marginbottom20,
- children: [
- BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Flex, {
- className: BDFDB.disCN.marginbottom8,
- align: BDFDB.LibraryComponents.Flex.Align.CENTER,
- direction: BDFDB.LibraryComponents.Flex.Direction.HORIZONTAL,
- children: [
- BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormTitle, {
- className: BDFDB.disCN.marginreset,
- tag: BDFDB.LibraryComponents.FormComponents.FormTitle.Tags.H5,
- children: this.labels.modal_guildbanner_text
- }),
- BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsItem, {
- className: "input-removebanner",
- type: "Switch",
- grow: 0,
- label: BDFDB.LanguageUtils.LanguageStrings.REMOVE,
- tag: BDFDB.LibraryComponents.FormComponents.FormTitle.Tags.H5,
- value: data.removeBanner && guild.id != "410787888507256842",
- disabled: guild.id == "410787888507256842",
- onChange: (value, instance) => {
- let bannerInputIns = BDFDB.ReactUtils.findOwner(instance._reactInternalFiber.return.return, {key: "GUILDBANNER"});
- if (bannerInputIns) {
- delete bannerInputIns.props.success;
- delete bannerInputIns.props.errorMessage;
- bannerInputIns.props.disabled = value;
- BDFDB.ReactUtils.forceUpdate(bannerInputIns);
- }
+ if (!currentIgnoreCustomNameState) {
+ let acronymInputIns = BDFDB.ReactUtils.findOwner(instance._reactInternalFiber.return.return.return, {key: "GUILDACRONYM"});
+ if (acronymInputIns) {
+ acronymInputIns.props.placeholder = value && BDFDB.LibraryModules.StringUtils.getAcronym(value) || guild.acronym;
+ BDFDB.ReactUtils.forceUpdate(acronymInputIns);
}
- })
- ]
- }),
- BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TextInput, {
- className: "input-guildbanner",
- key: "GUILDBANNER",
- success: !data.removeBanner && data.banner,
- maxLength: 100000000000000000000,
- value: data.banner,
- placeholder: BDFDB.GuildUtils.getBanner(guild.id),
- disabled: data.removeBanner || guild.id == "410787888507256842",
- onChange: (value, instance) => {
- this.checkUrl(value, instance);
+ }
}
})
- ]
- })
- ]
- }),
- 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,
- 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,
- number: 2
- })
- ]
- })
- ]
- }),
- 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.FormComponents.FormItem, {
+ title: this.labels.modal_guildacronym_text,
+ className: BDFDB.disCN.marginbottom8,
+ children:
+ BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TextInput, {
+ className: "input-guildacronym",
+ key: "GUILDACRONYM",
+ value: data.shortName,
+ placeholder: !data.ignoreCustomName && data.name && BDFDB.LibraryModules.StringUtils.getAcronym(data.name) || guild.acronym
})
- ]
- })
- ]
- })
- ],
- buttons: [{
- contents: BDFDB.LanguageUtils.LanguageStrings.SAVE,
- color: "BRAND",
- close: true,
- click: modal => {
- let olddata = Object.assign({}, data);
-
- let guildnameinput = modal.querySelector(".input-guildname " + BDFDB.dotCN.input);
- let guildacronyminput = modal.querySelector(".input-guildacronym " + BDFDB.dotCN.input);
- let ignorecustomnameinput = modal.querySelector(".input-ignorecustomname " + BDFDB.dotCN.switchinner);
- let guildiconinput = modal.querySelector(".input-guildicon " + BDFDB.dotCN.input);
- let removeiconinput = modal.querySelector(".input-removeicon " + BDFDB.dotCN.switchinner);
- let guildbannerinput = modal.querySelector(".input-guildbanner " + BDFDB.dotCN.input);
- let removebannerinput = modal.querySelector(".input-removebanner " + BDFDB.dotCN.switchinner);
-
- data.name = guildnameinput.value.trim() || null;
- data.shortName = guildacronyminput.value.trim() || null;
- data.ignoreCustomName = ignorecustomnameinput.checked;
- data.url = (!data.removeIcon && BDFDB.DOMUtils.containsClass(guildiconinput, BDFDB.disCN.inputsuccess) ? guildiconinput.value.trim() : null) || null;
- data.removeIcon = removeiconinput.checked;
- data.banner = (!data.removeBanner && BDFDB.DOMUtils.containsClass(guildbannerinput, BDFDB.disCN.inputsuccess) ? guildbannerinput.value.trim() : null) || null;
- data.removeBanner = removebannerinput.checked && guild.id != "410787888507256842";
+ }),
+ BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsItem, {
+ type: "Switch",
+ className: BDFDB.disCN.marginbottom20 + " input-ignorecustomname",
+ label: this.labels.modal_ignorecustomname_text,
+ tag: BDFDB.LibraryComponents.FormComponents.FormTitle.Tags.H5,
+ value: data.ignoreCustomName,
+ onChange: (value, instance) => {
+ currentIgnoreCustomNameState = value;
+ let nameInputIns = BDFDB.ReactUtils.findOwner(instance._reactInternalFiber.return, {key: "GUILDNAME"});
+ let acronymInputIns = BDFDB.ReactUtils.findOwner(instance._reactInternalFiber.return, {key: "GUILDACRONYM"});
+ if (nameInputIns && acronymInputIns) {
+ acronymInputIns.props.placeholder = !value && nameInputIns.props.value && BDFDB.LibraryModules.StringUtils.getAcronym(nameInputIns.props.value) || guild.acronym;
+ BDFDB.ReactUtils.forceUpdate(acronymInputIns);
+ }
+ }
+ }),
+ BDFDB.ReactUtils.createElement("div", {
+ className: BDFDB.disCN.marginbottom20,
+ children: [
+ BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Flex, {
+ className: BDFDB.disCN.marginbottom8,
+ align: BDFDB.LibraryComponents.Flex.Align.CENTER,
+ direction: BDFDB.LibraryComponents.Flex.Direction.HORIZONTAL,
+ children: [
+ BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormTitle, {
+ className: BDFDB.disCN.marginreset,
+ tag: BDFDB.LibraryComponents.FormComponents.FormTitle.Tags.H5,
+ children: this.labels.modal_guildicon_text
+ }),
+ BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsItem, {
+ className: "input-removeicon",
+ type: "Switch",
+ grow: 0,
+ label: BDFDB.LanguageUtils.LanguageStrings.REMOVE,
+ tag: BDFDB.LibraryComponents.FormComponents.FormTitle.Tags.H5,
+ value: data.removeIcon,
+ onChange: (value, instance) => {
+ let iconInputIins = BDFDB.ReactUtils.findOwner(instance._reactInternalFiber.return.return, {key: "GUILDICON"});
+ if (iconInputIins) {
+ delete iconInputIins.props.success;
+ delete iconInputIins.props.errorMessage;
+ iconInputIins.props.disabled = value;
+ BDFDB.ReactUtils.forceUpdate(iconInputIins);
+ }
+ }
+ })
+ ]
+ }),
+ BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TextInput, {
+ className: "input-guildicon",
+ key: "GUILDICON",
+ success: !data.removeIcon && data.url,
+ maxLength: 100000000000000000000,
+ value: data.url,
+ placeholder: BDFDB.GuildUtils.getIcon(guild.id),
+ disabled: data.removeIcon,
+ onChange: (value, instance) => {
+ this.checkUrl(value, instance);
+ }
+ })
+ ]
+ }),
+ BDFDB.ReactUtils.createElement("div", {
+ className: BDFDB.disCN.marginbottom20,
+ children: [
+ BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Flex, {
+ className: BDFDB.disCN.marginbottom8,
+ align: BDFDB.LibraryComponents.Flex.Align.CENTER,
+ direction: BDFDB.LibraryComponents.Flex.Direction.HORIZONTAL,
+ children: [
+ BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormTitle, {
+ className: BDFDB.disCN.marginreset,
+ tag: BDFDB.LibraryComponents.FormComponents.FormTitle.Tags.H5,
+ children: this.labels.modal_guildbanner_text
+ }),
+ BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsItem, {
+ className: "input-removebanner",
+ type: "Switch",
+ grow: 0,
+ label: BDFDB.LanguageUtils.LanguageStrings.REMOVE,
+ tag: BDFDB.LibraryComponents.FormComponents.FormTitle.Tags.H5,
+ value: data.removeBanner && guild.id != "410787888507256842",
+ disabled: guild.id == "410787888507256842",
+ onChange: (value, instance) => {
+ let bannerInputIns = BDFDB.ReactUtils.findOwner(instance._reactInternalFiber.return.return, {key: "GUILDBANNER"});
+ if (bannerInputIns) {
+ delete bannerInputIns.props.success;
+ delete bannerInputIns.props.errorMessage;
+ bannerInputIns.props.disabled = value;
+ BDFDB.ReactUtils.forceUpdate(bannerInputIns);
+ }
+ }
+ })
+ ]
+ }),
+ BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TextInput, {
+ className: "input-guildbanner",
+ key: "GUILDBANNER",
+ success: !data.removeBanner && data.banner,
+ maxLength: 100000000000000000000,
+ value: data.banner,
+ placeholder: BDFDB.GuildUtils.getBanner(guild.id),
+ disabled: data.removeBanner || guild.id == "410787888507256842",
+ onChange: (value, instance) => {
+ this.checkUrl(value, instance);
+ }
+ })
+ ]
+ })
+ ]
+ }),
+ 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,
+ 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,
+ number: 2
+ })
+ ]
+ })
+ ]
+ }),
+ 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
+ })
+ ]
+ })
+ ]
+ })
+ ],
+ buttons: [{
+ contents: BDFDB.LanguageUtils.LanguageStrings.SAVE,
+ color: "BRAND",
+ close: true,
+ click: modal => {
+ let oldData = Object.assign({}, data);
+
+ let guildnameinput = modal.querySelector(".input-guildname " + BDFDB.dotCN.input);
+ let guildacronyminput = modal.querySelector(".input-guildacronym " + BDFDB.dotCN.input);
+ let ignorecustomnameinput = modal.querySelector(".input-ignorecustomname " + BDFDB.dotCN.switchinner);
+ let guildiconinput = modal.querySelector(".input-guildicon " + BDFDB.dotCN.input);
+ let removeiconinput = modal.querySelector(".input-removeicon " + BDFDB.dotCN.switchinner);
+ let guildbannerinput = modal.querySelector(".input-guildbanner " + BDFDB.dotCN.input);
+ let removebannerinput = modal.querySelector(".input-removebanner " + BDFDB.dotCN.switchinner);
+
+ data.name = guildnameinput.value.trim() || null;
+ data.shortName = guildacronyminput.value.trim() || null;
+ data.ignoreCustomName = ignorecustomnameinput.checked;
+ data.url = (!data.removeIcon && BDFDB.DOMUtils.containsClass(guildiconinput, BDFDB.disCN.inputsuccess) ? guildiconinput.value.trim() : null) || null;
+ data.removeIcon = removeiconinput.checked;
+ data.banner = (!data.removeBanner && BDFDB.DOMUtils.containsClass(guildbannerinput, BDFDB.disCN.inputsuccess) ? guildbannerinput.value.trim() : null) || null;
+ data.removeBanner = removebannerinput.checked && guild.id != "410787888507256842";
- data.color1 = BDFDB.ColorUtils.getSwatchColor(modal, 1);
- data.color2 = BDFDB.ColorUtils.getSwatchColor(modal, 2);
- data.color3 = BDFDB.ColorUtils.getSwatchColor(modal, 3);
- data.color4 = BDFDB.ColorUtils.getSwatchColor(modal, 4);
+ data.color1 = BDFDB.ColorUtils.getSwatchColor(modal, 1);
+ data.color2 = BDFDB.ColorUtils.getSwatchColor(modal, 2);
+ data.color3 = BDFDB.ColorUtils.getSwatchColor(modal, 3);
+ data.color4 = BDFDB.ColorUtils.getSwatchColor(modal, 4);
- let changed = false;
- if (Object.keys(data).every(key => !data[key]) && (changed = true)) BDFDB.DataUtils.remove(this, "servers", guild.id);
- else if (!BDFDB.equals(olddata, data) && (changed = true)) BDFDB.DataUtils.save(data, this, "servers", guild.id);
- if (changed) this.forceUpdateAll();;
- }
- }]
- });
- }
-
- checkUrl (url, instance) {
- BDFDB.TimeUtils.clear(instance.checkTimeout);
- if (url == null || !url.trim()) {
- delete instance.props.success;
- delete instance.props.errorMessage;
- instance.forceUpdate();
+ let changed = false;
+ if (Object.keys(data).every(key => !data[key]) && (changed = true)) BDFDB.DataUtils.remove(this, "servers", guild.id);
+ else if (!BDFDB.equals(oldData, data) && (changed = true)) BDFDB.DataUtils.save(data, this, "servers", guild.id);
+ if (changed) this.forceUpdateAll();;
+ }
+ }]
+ });
}
- else instance.checkTimeout = BDFDB.TimeUtils.timeout(_ => {
- BDFDB.LibraryRequires.request(url.trim(), (error, response, result) => {
- if (response && response.headers["content-type"] && response.headers["content-type"].indexOf("image") != -1) {
- instance.props.success = true;
- delete instance.props.errorMessage;
- }
- else {
- delete instance.props.success;
- instance.props.errorMessage = this.labels.modal_invalidurl_text;
- }
- delete instance.checkTimeout;
+
+ checkUrl (url, instance) {
+ BDFDB.TimeUtils.clear(instance.checkTimeout);
+ if (url == null || !url.trim()) {
+ delete instance.props.success;
+ delete instance.props.errorMessage;
instance.forceUpdate();
- });
- }, 1000);
- }
+ }
+ else instance.checkTimeout = BDFDB.TimeUtils.timeout(_ => {
+ BDFDB.LibraryRequires.request(url.trim(), (error, response, result) => {
+ if (response && response.headers["content-type"] && response.headers["content-type"].indexOf("image") != -1) {
+ instance.props.success = true;
+ delete instance.props.errorMessage;
+ }
+ else {
+ delete instance.props.success;
+ instance.props.errorMessage = this.labels.modal_invalidurl_text;
+ }
+ delete instance.checkTimeout;
+ instance.forceUpdate();
+ });
+ }, 1000);
+ }
- setBanner (id, data) {
- data = data || {};
- let guild = BDFDB.LibraryModules.GuildStore.getGuild(id);
- if (!guild) return;
- if (guild.EditServersCachedBanner === undefined) guild.EditServersCachedBanner = guild.banner;
- guild.banner = data.removeBanner ? null : (data.banner || guild.EditServersCachedBanner);
- }
+ setBanner (id, data) {
+ data = data || {};
+ let guild = BDFDB.LibraryModules.GuildStore.getGuild(id);
+ if (!guild) return;
+ if (guild.EditServersCachedBanner === undefined) guild.EditServersCachedBanner = guild.banner;
+ guild.banner = data.removeBanner ? null : (data.banner || guild.EditServersCachedBanner);
+ }
- setLabelsByLanguage () {
- switch (BDFDB.LanguageUtils.getLanguage().id) {
- case "hr": //croatian
- return {
- context_localserversettings_text: "Lokalne postavke poslužitelja",
- submenu_serversettings_text: "Promijeni postavke",
- submenu_resetsettings_text: "Ponovno postavite poslužitelj",
- modal_header_text: "Lokalne postavke poslužitelja",
- modal_guildname_text: "Naziv lokalnog poslužitelja",
- modal_guildacronym_text: "Akronim lokalnog poslužitelja",
- modal_ignorecustomname_text: "Koristite izvorno ime poslužitelja za akronim poslužitelja",
- modal_guildicon_text: "Ikona",
- modal_guildbanner_text: "Baner",
- modal_tabheader1_text: "Poslužitelja",
- modal_tabheader2_text: "Boja ikona",
- modal_tabheader3_text: "Boja tooltip",
- modal_colorpicker1_text: "Boja ikona",
- modal_colorpicker2_text: "Boja fonta",
- modal_colorpicker3_text: "Boja tooltip",
- modal_colorpicker4_text: "Boja fonta",
- modal_invalidurl_text: "Nevažeći URL"
- };
- case "da": //danish
- return {
- context_localserversettings_text: "Lokal serverindstillinger",
- submenu_serversettings_text: "Skift indstillinger",
- submenu_resetsettings_text: "Nulstil server",
- modal_header_text: "Lokal serverindstillinger",
- modal_guildname_text: "Lokalt servernavn",
- modal_guildacronym_text: "Lokalt serverakronym",
- modal_ignorecustomname_text: "Brug det originale servernavn til serverens akronym",
- modal_guildicon_text: "Ikon",
- modal_guildbanner_text: "Banner",
- modal_tabheader1_text: "Server",
- modal_tabheader2_text: "Ikonfarve",
- modal_tabheader3_text: "Tooltipfarve",
- modal_colorpicker1_text: "Ikonfarve",
- modal_colorpicker2_text: "Skriftfarve",
- modal_colorpicker3_text: "Tooltipfarve",
- modal_colorpicker4_text: "Skriftfarve",
- modal_invalidurl_text: "Ugyldig URL"
- };
- case "de": //german
- return {
- context_localserversettings_text: "Lokale Servereinstellungen",
- submenu_serversettings_text: "Einstellungen ändern",
- submenu_resetsettings_text: "Server zurücksetzen",
- modal_header_text: "Lokale Servereinstellungen",
- modal_guildname_text: "Lokaler Servername",
- modal_guildacronym_text: "Lokales Serverkürzel",
- modal_ignorecustomname_text: "Benutze den ursprünglichen Servernamen für das Serverkürzel",
- modal_guildicon_text: "Icon",
- modal_guildbanner_text: "Banner",
- modal_tabheader1_text: "Server",
- modal_tabheader2_text: "Iconfarbe",
- modal_tabheader3_text: "Tooltipfarbe",
- modal_colorpicker1_text: "Iconfarbe",
- modal_colorpicker2_text: "Schriftfarbe",
- modal_colorpicker3_text: "Tooltipfarbe",
- modal_colorpicker4_text: "Schriftfarbe",
- modal_invalidurl_text: "Ungültige URL"
- };
- case "es": //spanish
- return {
- context_localserversettings_text: "Ajustes local de servidor",
- submenu_serversettings_text: "Cambiar ajustes",
- submenu_resetsettings_text: "Restablecer servidor",
- modal_header_text: "Ajustes local de servidor",
- modal_guildname_text: "Nombre local del servidor",
- modal_guildacronym_text: "Acrónimo local del servidor",
- modal_ignorecustomname_text: "Use el nombre del servidor original para el acrónimo del servidor",
- modal_guildicon_text: "Icono",
- modal_guildbanner_text: "Bandera",
- modal_tabheader1_text: "Servidor",
- modal_tabheader2_text: "Color del icono",
- modal_tabheader3_text: "Color de tooltip",
- modal_colorpicker1_text: "Color del icono",
- modal_colorpicker2_text: "Color de fuente",
- modal_colorpicker3_text: "Color de tooltip",
- modal_colorpicker4_text: "Color de fuente",
- modal_invalidurl_text: "URL inválida"
- };
- case "fr": //french
- return {
- context_localserversettings_text: "Paramètres locale du serveur",
- submenu_serversettings_text: "Modifier les paramètres",
- submenu_resetsettings_text: "Réinitialiser le serveur",
- modal_header_text: "Paramètres locale du serveur",
- modal_guildname_text: "Nom local du serveur",
- modal_guildacronym_text: "Acronyme local de serveur",
- modal_ignorecustomname_text: "Utilisez le nom de serveur d'origine pour l'acronyme de serveur",
- modal_guildicon_text: "Icône",
- modal_guildbanner_text: "Bannière",
- modal_tabheader1_text: "Serveur",
- modal_tabheader2_text: "Couleur de l'icône",
- modal_tabheader3_text: "Couleur de tooltip",
- modal_colorpicker1_text: "Couleur de l'icône",
- modal_colorpicker2_text: "Couleur de la police",
- modal_colorpicker3_text: "Couleur de tooltip",
- modal_colorpicker4_text: "Couleur de la police",
- modal_invalidurl_text: "URL invalide"
- };
- case "it": //italian
- return {
- context_localserversettings_text: "Impostazioni locale server",
- submenu_serversettings_text: "Cambia impostazioni",
- submenu_resetsettings_text: "Ripristina server",
- modal_header_text: "Impostazioni locale server",
- modal_guildname_text: "Nome locale server",
- modal_guildacronym_text: "Acronimo locale server",
- modal_ignorecustomname_text: "Utilizzare il nome del server originale per l'acronimo del server",
- modal_guildicon_text: "Icona",
- modal_guildbanner_text: "Bandiera",
- modal_tabheader1_text: "Server",
- modal_tabheader2_text: "Colore dell'icona",
- modal_tabheader3_text: "Colore della tooltip",
- modal_colorpicker1_text: "Colore dell'icona",
- modal_colorpicker2_text: "Colore del carattere",
- modal_colorpicker3_text: "Colore della tooltip",
- modal_colorpicker4_text: "Colore del carattere",
- modal_invalidurl_text: "URL non valido"
- };
- case "nl": //dutch
- return {
- context_localserversettings_text: "Lokale serverinstellingen",
- submenu_serversettings_text: "Verandere instellingen",
- submenu_resetsettings_text: "Reset server",
- modal_header_text: "Lokale serverinstellingen",
- modal_guildname_text: "Lokale servernaam",
- modal_guildacronym_text: "Lokale server acroniem",
- modal_ignorecustomname_text: "Gebruik de oorspronkelijke servernaam voor het serveracrononiem",
- modal_guildicon_text: "Icoon",
- modal_guildbanner_text: "Banier",
- modal_tabheader1_text: "Server",
- modal_tabheader2_text: "Icoonkleur",
- modal_tabheader3_text: "Tooltipkleur",
- modal_colorpicker1_text: "Icoonkleur",
- modal_colorpicker2_text: "Doopvontkleur",
- modal_colorpicker3_text: "Tooltipkleur",
- modal_colorpicker4_text: "Doopvontkleur",
- modal_invalidurl_text: "Ongeldige URL"
- };
- case "no": //norwegian
- return {
- context_localserversettings_text: "Lokal serverinnstillinger",
- submenu_serversettings_text: "Endre innstillinger",
- submenu_resetsettings_text: "Tilbakestill server",
- modal_header_text: "Lokal serverinnstillinger",
- modal_guildname_text: "Lokalt servernavn",
- modal_guildacronym_text: "Lokalt serverforkortelse",
- modal_ignorecustomname_text: "Bruk det originale servernavnet til serverforkortelsen",
- modal_guildicon_text: "Ikon",
- modal_guildbanner_text: "Banner",
- modal_tabheader1_text: "Server",
- modal_tabheader2_text: "Ikonfarge",
- modal_tabheader3_text: "Tooltipfarge",
- modal_colorpicker1_text: "Ikonfarge",
- modal_colorpicker2_text: "Skriftfarge",
- modal_colorpicker3_text: "Tooltipfarge",
- modal_colorpicker4_text: "Skriftfarge",
- modal_invalidurl_text: "Ugyldig URL"
- };
- case "pl": //polish
- return {
- context_localserversettings_text: "Lokalne ustawienia serwera",
- submenu_serversettings_text: "Zmień ustawienia",
- submenu_resetsettings_text: "Resetuj ustawienia",
- modal_header_text: "Lokalne ustawienia serwera",
- modal_guildname_text: "Lokalna nazwa serwera",
- modal_guildacronym_text: "Akronim lokalnego serwera",
- modal_ignorecustomname_text: "Użyj oryginalnej nazwy serwera dla akronimu serwera",
- modal_guildicon_text: "Ikona",
- modal_guildbanner_text: "Baner",
- modal_tabheader1_text: "Serwer",
- modal_tabheader2_text: "Kolor ikony",
- modal_tabheader3_text: "Kolor podpowiedzi",
- modal_colorpicker1_text: "Kolor ikony",
- modal_colorpicker2_text: "Kolor czcionki",
- modal_colorpicker3_text: "Kolor podpowiedzi",
- modal_colorpicker4_text: "Kolor czcionki",
- modal_invalidurl_text: "Nieprawidłowe URL"
- };
- case "pt-BR": //portuguese (brazil)
- return {
- context_localserversettings_text: "Configurações local do servidor",
- submenu_serversettings_text: "Mudar configurações",
- submenu_resetsettings_text: "Redefinir servidor",
- modal_header_text: "Configurações local do servidor",
- modal_guildname_text: "Nome local do servidor",
- modal_guildacronym_text: "Acrônimo local de servidor",
- modal_ignorecustomname_text: "Use o nome do servidor original para a sigla do servidor",
- modal_guildicon_text: "Icone",
- modal_guildbanner_text: "Bandeira",
- modal_tabheader1_text: "Servidor",
- modal_tabheader2_text: "Cor do ícone",
- modal_tabheader3_text: "Cor da tooltip",
- modal_colorpicker1_text: "Cor do ícone",
- modal_colorpicker2_text: "Cor da fonte",
- modal_colorpicker3_text: "Cor da tooltip",
- modal_colorpicker4_text: "Cor da fonte",
- modal_invalidurl_text: "URL inválida"
- };
- case "fi": //finnish
- return {
- context_localserversettings_text: "Paikallinen palvelimen asetukset",
- submenu_serversettings_text: "Vaihda asetuksia",
- submenu_resetsettings_text: "Nollaa palvelimen",
- modal_header_text: "Paikallinen palvelimen asetukset",
- modal_guildname_text: "Paikallinen palvelimenimi",
- modal_guildacronym_text: "Paikallisen palvelimen lyhenne",
- modal_ignorecustomname_text: "Käytä alkuperäistä palvelimen nimeä palvelimen lyhenteessä",
- modal_guildicon_text: "Ikonin",
- modal_guildbanner_text: "Banneri",
- modal_tabheader1_text: "Palvelimen",
- modal_tabheader2_text: "Ikoninväri",
- modal_tabheader3_text: "Tooltipväri",
- modal_colorpicker1_text: "Ikoninväri",
- modal_colorpicker2_text: "Fontinväri",
- modal_colorpicker3_text: "Tooltipväri",
- modal_colorpicker4_text: "Fontinväri",
- modal_invalidurl_text: "Virheellinen URL"
- };
- case "sv": //swedish
- return {
- context_localserversettings_text: "Lokal serverinställningar",
- submenu_serversettings_text: "Ändra inställningar",
- submenu_resetsettings_text: "Återställ server",
- modal_header_text: "Lokal serverinställningar",
- modal_guildname_text: "Lokalt servernamn",
- modal_guildacronym_text: "Lokal server förkortning",
- modal_ignorecustomname_text: "Använd det ursprungliga servernamnet för serverförkortningen",
- modal_guildicon_text: "Ikon",
- modal_guildbanner_text: "Banderoll",
- modal_tabheader1_text: "Server",
- modal_tabheader2_text: "Ikonfärg",
- modal_tabheader3_text: "Tooltipfärg",
- modal_colorpicker1_text: "Ikonfärg",
- modal_colorpicker2_text: "Fontfärg",
- modal_colorpicker3_text: "Tooltipfärg",
- modal_colorpicker4_text: "Fontfärg",
- modal_invalidurl_text: "Ogiltig URL"
- };
- case "tr": //turkish
- return {
- context_localserversettings_text: "Yerel Sunucu Ayarları",
- submenu_serversettings_text: "Ayarları Değiştir",
- submenu_resetsettings_text: "Sunucu Sıfırla",
- modal_header_text: "Yerel sunucu ayarları",
- modal_guildname_text: "Yerel sunucu adı",
- modal_guildacronym_text: "Yerel sunucu kısaltması",
- modal_ignorecustomname_text: "Sunucu kısaltması için orijinal sunucu adını kullanın",
- modal_guildicon_text: "Simge",
- modal_guildbanner_text: "Afişi",
- modal_tabheader1_text: "Sunucu",
- modal_tabheader2_text: "Simge rengi",
- modal_tabheader3_text: "Tooltip rengi",
- modal_colorpicker1_text: "Simge rengi",
- modal_colorpicker2_text: "Yazı rengi",
- modal_colorpicker3_text: "Tooltip rengi",
- modal_colorpicker4_text: "Yazı rengi",
- modal_invalidurl_text: "Geçersiz URL"
- };
- case "cs": //czech
- return {
- context_localserversettings_text: "Místní nastavení serveru",
- submenu_serversettings_text: "Změnit nastavení",
- submenu_resetsettings_text: "Obnovit server",
- modal_header_text: "Místní nastavení serveru",
- modal_guildname_text: "Místní název serveru",
- modal_guildacronym_text: "Zkratka místního serveru",
- modal_ignorecustomname_text: "Pro zkratku serveru použijte původní název serveru",
- modal_guildicon_text: "Ikony",
- modal_guildbanner_text: "Prapor",
- modal_tabheader1_text: "Server",
- modal_tabheader2_text: "Barva ikony",
- modal_tabheader3_text: "Barva tooltip",
- modal_colorpicker1_text: "Barva ikony",
- modal_colorpicker2_text: "Barva fontu",
- modal_colorpicker3_text: "Barva tooltip",
- modal_colorpicker4_text: "Barva fontu",
- modal_invalidurl_text: "Neplatná URL"
- };
- case "bg": //bulgarian
- return {
- context_localserversettings_text: "Настройки за локални cървър",
- submenu_serversettings_text: "Промяна на настройките",
- submenu_resetsettings_text: "Възстановяване на cървър",
- modal_header_text: "Настройки за локални cървър",
- modal_guildname_text: "Локално име на cървър",
- modal_guildacronym_text: "Акроним на локалния сървър",
- modal_ignorecustomname_text: "Използвайте оригиналното име на сървъра за съкращението на сървъра",
- modal_guildicon_text: "Икона",
- modal_guildbanner_text: "Знаме",
- modal_tabheader1_text: "Cървър",
- modal_tabheader2_text: "Цвят на иконата",
- modal_tabheader3_text: "Цвят на подсказка",
- modal_colorpicker1_text: "Цвят на иконата",
- modal_colorpicker2_text: "Цвят на шрифта",
- modal_colorpicker3_text: "Цвят на подсказка",
- modal_colorpicker4_text: "Цвят на шрифта",
- modal_invalidurl_text: "Невалиден URL"
- };
- case "ru": //russian
- return {
- context_localserversettings_text: "Настройки локального cервер",
- submenu_serversettings_text: "Изменить настройки",
- submenu_resetsettings_text: "Сбросить cервер",
- modal_header_text: "Настройки локального cервер",
- modal_guildname_text: "Имя локального cервер",
- modal_guildacronym_text: "Акроним локального сервера",
- modal_ignorecustomname_text: "Используйте оригинальное имя сервера для сокращения сервера",
- modal_guildicon_text: "Значок",
- modal_guildbanner_text: "Баннер",
- modal_tabheader1_text: "Cервер",
- modal_tabheader2_text: "Цвет значков",
- modal_tabheader3_text: "Цвет подсказка",
- modal_colorpicker1_text: "Цвет значков",
- modal_colorpicker2_text: "Цвет шрифта",
- modal_colorpicker3_text: "Цвет подсказка",
- modal_colorpicker4_text: "Цвет шрифта",
- modal_invalidurl_text: "Неверная URL"
- };
- case "uk": //ukrainian
- return {
- context_localserversettings_text: "Налаштування локального cервер",
- submenu_serversettings_text: "Змінити налаштування",
- submenu_resetsettings_text: "Скидання cервер",
- modal_header_text: "Налаштування локального cервер",
- modal_guildname_text: "Локальне ім'я cервер",
- modal_guildacronym_text: "Акронім локального сервера",
- modal_ignorecustomname_text: "Використовуйте оригінальне ім'я сервера для абревіатури сервера",
- modal_guildicon_text: "Іконка",
- modal_guildbanner_text: "Банер",
- modal_tabheader1_text: "Cервер",
- modal_tabheader2_text: "Колір ікони",
- modal_tabheader3_text: "Колір підказка",
- modal_colorpicker1_text: "Колір ікони",
- modal_colorpicker2_text: "Колір шрифту",
- modal_colorpicker3_text: "Колір підказка",
- modal_colorpicker4_text: "Колір шрифту",
- modal_invalidurl_text: "Недійсна URL"
- };
- case "ja": //japanese
- return {
- context_localserversettings_text: "ローカルサーバー設定",
- submenu_serversettings_text: "設定を変更する",
- submenu_resetsettings_text: "サーバーをリセットする",
- modal_header_text: "ローカルサーバー設定",
- modal_guildname_text: "ローカルサーバー名",
- modal_guildacronym_text: "ローカルサーバーの頭字語",
- modal_ignorecustomname_text: "サーバーの頭字語に元のサーバー名を使用する",
- modal_guildicon_text: "アイコン",
- modal_guildbanner_text: "バナー",
- modal_tabheader1_text: "サーバー",
- modal_tabheader2_text: "アイコンの色",
- modal_tabheader3_text: "ツールチップの色",
- modal_colorpicker1_text: "アイコンの色",
- modal_colorpicker2_text: "フォントの色",
- modal_colorpicker3_text: "ツールチップの色",
- modal_colorpicker4_text: "フォントの色",
- modal_invalidurl_text: "無効な URL"
- };
- case "zh-TW": //chinese (traditional)
- return {
- context_localserversettings_text: "本地服務器設置",
- submenu_serversettings_text: "更改設置",
- submenu_resetsettings_text: "重置服務器",
- modal_header_text: "本地服務器設置",
- modal_guildname_text: "服務器名稱",
- modal_guildacronym_text: "本地服務器縮寫",
- modal_ignorecustomname_text: "使用原始服務器名稱作為服務器首字母縮寫",
- modal_guildicon_text: "圖標",
- modal_guildbanner_text: "旗幟",
- modal_tabheader1_text: "服務器",
- modal_tabheader2_text: "圖標顏色",
- modal_tabheader3_text: "工具提示顏色",
- modal_colorpicker1_text: "圖標顏色",
- modal_colorpicker2_text: "字體顏色",
- modal_colorpicker3_text: "工具提示顏色",
- modal_colorpicker4_text: "字體顏色",
- modal_invalidurl_text: "無效的 URL"
- };
- case "ko": //korean
- return {
- context_localserversettings_text: "로컬 서버 설정",
- submenu_serversettings_text: "설정 변경",
- submenu_resetsettings_text: "서버 재설정",
- modal_header_text: "로컬 서버 설정",
- modal_guildname_text: "로컬 서버 이름",
- modal_guildacronym_text: "로컬 서버 약어",
- modal_ignorecustomname_text: "서버 약어에 원래 서버 이름을 사용하십시오",
- modal_guildicon_text: "상",
- modal_guildbanner_text: "기치",
- modal_tabheader1_text: "서버",
- modal_tabheader2_text: "상 색깔",
- modal_tabheader3_text: "툴팁 색깔",
- modal_colorpicker1_text: "상 색깔",
- modal_colorpicker2_text: "글꼴 색깔",
- modal_colorpicker3_text: "툴팁 색깔",
- modal_colorpicker4_text: "글꼴 색깔",
- modal_invalidurl_text: "잘못된 URL"
- };
- default: //default: english
- return {
- context_localserversettings_text: "Local Serversettings",
- submenu_serversettings_text: "Change Settings",
- submenu_resetsettings_text: "Reset Server",
- modal_header_text: "Local Serversettings",
- modal_guildname_text: "Local Servername",
- modal_guildacronym_text: "Local Serveracronym",
- modal_ignorecustomname_text: "Use the original Servername for the Serveracronym",
- modal_guildicon_text: "Icon",
- modal_guildbanner_text: "Banner",
- modal_tabheader1_text: "Server",
- modal_tabheader2_text: "Iconcolor",
- modal_tabheader3_text: "Tooltipcolor",
- modal_colorpicker1_text: "Iconcolor",
- modal_colorpicker2_text: "Fontcolor",
- modal_colorpicker3_text: "Tooltipcolor",
- modal_colorpicker4_text: "Fontcolor",
- modal_invalidurl_text: "Invalid URL"
- };
+ setLabelsByLanguage () {
+ switch (BDFDB.LanguageUtils.getLanguage().id) {
+ case "hr": //croatian
+ return {
+ context_localserversettings_text: "Lokalne postavke poslužitelja",
+ submenu_serversettings_text: "Promijeni postavke",
+ submenu_resetsettings_text: "Ponovno postavite poslužitelj",
+ modal_header_text: "Lokalne postavke poslužitelja",
+ modal_guildname_text: "Naziv lokalnog poslužitelja",
+ modal_guildacronym_text: "Akronim lokalnog poslužitelja",
+ modal_ignorecustomname_text: "Koristite izvorno ime poslužitelja za akronim poslužitelja",
+ modal_guildicon_text: "Ikona",
+ modal_guildbanner_text: "Baner",
+ modal_tabheader1_text: "Poslužitelja",
+ modal_tabheader2_text: "Boja ikona",
+ modal_tabheader3_text: "Boja tooltip",
+ modal_colorpicker1_text: "Boja ikona",
+ modal_colorpicker2_text: "Boja fonta",
+ modal_colorpicker3_text: "Boja tooltip",
+ modal_colorpicker4_text: "Boja fonta",
+ modal_invalidurl_text: "Nevažeći URL"
+ };
+ case "da": //danish
+ return {
+ context_localserversettings_text: "Lokal serverindstillinger",
+ submenu_serversettings_text: "Skift indstillinger",
+ submenu_resetsettings_text: "Nulstil server",
+ modal_header_text: "Lokal serverindstillinger",
+ modal_guildname_text: "Lokalt servernavn",
+ modal_guildacronym_text: "Lokalt serverakronym",
+ modal_ignorecustomname_text: "Brug det originale servernavn til serverens akronym",
+ modal_guildicon_text: "Ikon",
+ modal_guildbanner_text: "Banner",
+ modal_tabheader1_text: "Server",
+ modal_tabheader2_text: "Ikonfarve",
+ modal_tabheader3_text: "Tooltipfarve",
+ modal_colorpicker1_text: "Ikonfarve",
+ modal_colorpicker2_text: "Skriftfarve",
+ modal_colorpicker3_text: "Tooltipfarve",
+ modal_colorpicker4_text: "Skriftfarve",
+ modal_invalidurl_text: "Ugyldig URL"
+ };
+ case "de": //german
+ return {
+ context_localserversettings_text: "Lokale Servereinstellungen",
+ submenu_serversettings_text: "Einstellungen ändern",
+ submenu_resetsettings_text: "Server zurücksetzen",
+ modal_header_text: "Lokale Servereinstellungen",
+ modal_guildname_text: "Lokaler Servername",
+ modal_guildacronym_text: "Lokales Serverkürzel",
+ modal_ignorecustomname_text: "Benutze den ursprünglichen Servernamen für das Serverkürzel",
+ modal_guildicon_text: "Icon",
+ modal_guildbanner_text: "Banner",
+ modal_tabheader1_text: "Server",
+ modal_tabheader2_text: "Iconfarbe",
+ modal_tabheader3_text: "Tooltipfarbe",
+ modal_colorpicker1_text: "Iconfarbe",
+ modal_colorpicker2_text: "Schriftfarbe",
+ modal_colorpicker3_text: "Tooltipfarbe",
+ modal_colorpicker4_text: "Schriftfarbe",
+ modal_invalidurl_text: "Ungültige URL"
+ };
+ case "es": //spanish
+ return {
+ context_localserversettings_text: "Ajustes local de servidor",
+ submenu_serversettings_text: "Cambiar ajustes",
+ submenu_resetsettings_text: "Restablecer servidor",
+ modal_header_text: "Ajustes local de servidor",
+ modal_guildname_text: "Nombre local del servidor",
+ modal_guildacronym_text: "Acrónimo local del servidor",
+ modal_ignorecustomname_text: "Use el nombre del servidor original para el acrónimo del servidor",
+ modal_guildicon_text: "Icono",
+ modal_guildbanner_text: "Bandera",
+ modal_tabheader1_text: "Servidor",
+ modal_tabheader2_text: "Color del icono",
+ modal_tabheader3_text: "Color de tooltip",
+ modal_colorpicker1_text: "Color del icono",
+ modal_colorpicker2_text: "Color de fuente",
+ modal_colorpicker3_text: "Color de tooltip",
+ modal_colorpicker4_text: "Color de fuente",
+ modal_invalidurl_text: "URL inválida"
+ };
+ case "fr": //french
+ return {
+ context_localserversettings_text: "Paramètres locale du serveur",
+ submenu_serversettings_text: "Modifier les paramètres",
+ submenu_resetsettings_text: "Réinitialiser le serveur",
+ modal_header_text: "Paramètres locale du serveur",
+ modal_guildname_text: "Nom local du serveur",
+ modal_guildacronym_text: "Acronyme local de serveur",
+ modal_ignorecustomname_text: "Utilisez le nom de serveur d'origine pour l'acronyme de serveur",
+ modal_guildicon_text: "Icône",
+ modal_guildbanner_text: "Bannière",
+ modal_tabheader1_text: "Serveur",
+ modal_tabheader2_text: "Couleur de l'icône",
+ modal_tabheader3_text: "Couleur de tooltip",
+ modal_colorpicker1_text: "Couleur de l'icône",
+ modal_colorpicker2_text: "Couleur de la police",
+ modal_colorpicker3_text: "Couleur de tooltip",
+ modal_colorpicker4_text: "Couleur de la police",
+ modal_invalidurl_text: "URL invalide"
+ };
+ case "it": //italian
+ return {
+ context_localserversettings_text: "Impostazioni locale server",
+ submenu_serversettings_text: "Cambia impostazioni",
+ submenu_resetsettings_text: "Ripristina server",
+ modal_header_text: "Impostazioni locale server",
+ modal_guildname_text: "Nome locale server",
+ modal_guildacronym_text: "Acronimo locale server",
+ modal_ignorecustomname_text: "Utilizzare il nome del server originale per l'acronimo del server",
+ modal_guildicon_text: "Icona",
+ modal_guildbanner_text: "Bandiera",
+ modal_tabheader1_text: "Server",
+ modal_tabheader2_text: "Colore dell'icona",
+ modal_tabheader3_text: "Colore della tooltip",
+ modal_colorpicker1_text: "Colore dell'icona",
+ modal_colorpicker2_text: "Colore del carattere",
+ modal_colorpicker3_text: "Colore della tooltip",
+ modal_colorpicker4_text: "Colore del carattere",
+ modal_invalidurl_text: "URL non valido"
+ };
+ case "nl": //dutch
+ return {
+ context_localserversettings_text: "Lokale serverinstellingen",
+ submenu_serversettings_text: "Verandere instellingen",
+ submenu_resetsettings_text: "Reset server",
+ modal_header_text: "Lokale serverinstellingen",
+ modal_guildname_text: "Lokale servernaam",
+ modal_guildacronym_text: "Lokale server acroniem",
+ modal_ignorecustomname_text: "Gebruik de oorspronkelijke servernaam voor het serveracrononiem",
+ modal_guildicon_text: "Icoon",
+ modal_guildbanner_text: "Banier",
+ modal_tabheader1_text: "Server",
+ modal_tabheader2_text: "Icoonkleur",
+ modal_tabheader3_text: "Tooltipkleur",
+ modal_colorpicker1_text: "Icoonkleur",
+ modal_colorpicker2_text: "Doopvontkleur",
+ modal_colorpicker3_text: "Tooltipkleur",
+ modal_colorpicker4_text: "Doopvontkleur",
+ modal_invalidurl_text: "Ongeldige URL"
+ };
+ case "no": //norwegian
+ return {
+ context_localserversettings_text: "Lokal serverinnstillinger",
+ submenu_serversettings_text: "Endre innstillinger",
+ submenu_resetsettings_text: "Tilbakestill server",
+ modal_header_text: "Lokal serverinnstillinger",
+ modal_guildname_text: "Lokalt servernavn",
+ modal_guildacronym_text: "Lokalt serverforkortelse",
+ modal_ignorecustomname_text: "Bruk det originale servernavnet til serverforkortelsen",
+ modal_guildicon_text: "Ikon",
+ modal_guildbanner_text: "Banner",
+ modal_tabheader1_text: "Server",
+ modal_tabheader2_text: "Ikonfarge",
+ modal_tabheader3_text: "Tooltipfarge",
+ modal_colorpicker1_text: "Ikonfarge",
+ modal_colorpicker2_text: "Skriftfarge",
+ modal_colorpicker3_text: "Tooltipfarge",
+ modal_colorpicker4_text: "Skriftfarge",
+ modal_invalidurl_text: "Ugyldig URL"
+ };
+ case "pl": //polish
+ return {
+ context_localserversettings_text: "Lokalne ustawienia serwera",
+ submenu_serversettings_text: "Zmień ustawienia",
+ submenu_resetsettings_text: "Resetuj ustawienia",
+ modal_header_text: "Lokalne ustawienia serwera",
+ modal_guildname_text: "Lokalna nazwa serwera",
+ modal_guildacronym_text: "Akronim lokalnego serwera",
+ modal_ignorecustomname_text: "Użyj oryginalnej nazwy serwera dla akronimu serwera",
+ modal_guildicon_text: "Ikona",
+ modal_guildbanner_text: "Baner",
+ modal_tabheader1_text: "Serwer",
+ modal_tabheader2_text: "Kolor ikony",
+ modal_tabheader3_text: "Kolor podpowiedzi",
+ modal_colorpicker1_text: "Kolor ikony",
+ modal_colorpicker2_text: "Kolor czcionki",
+ modal_colorpicker3_text: "Kolor podpowiedzi",
+ modal_colorpicker4_text: "Kolor czcionki",
+ modal_invalidurl_text: "Nieprawidłowe URL"
+ };
+ case "pt-BR": //portuguese (brazil)
+ return {
+ context_localserversettings_text: "Configurações local do servidor",
+ submenu_serversettings_text: "Mudar configurações",
+ submenu_resetsettings_text: "Redefinir servidor",
+ modal_header_text: "Configurações local do servidor",
+ modal_guildname_text: "Nome local do servidor",
+ modal_guildacronym_text: "Acrônimo local de servidor",
+ modal_ignorecustomname_text: "Use o nome do servidor original para a sigla do servidor",
+ modal_guildicon_text: "Icone",
+ modal_guildbanner_text: "Bandeira",
+ modal_tabheader1_text: "Servidor",
+ modal_tabheader2_text: "Cor do ícone",
+ modal_tabheader3_text: "Cor da tooltip",
+ modal_colorpicker1_text: "Cor do ícone",
+ modal_colorpicker2_text: "Cor da fonte",
+ modal_colorpicker3_text: "Cor da tooltip",
+ modal_colorpicker4_text: "Cor da fonte",
+ modal_invalidurl_text: "URL inválida"
+ };
+ case "fi": //finnish
+ return {
+ context_localserversettings_text: "Paikallinen palvelimen asetukset",
+ submenu_serversettings_text: "Vaihda asetuksia",
+ submenu_resetsettings_text: "Nollaa palvelimen",
+ modal_header_text: "Paikallinen palvelimen asetukset",
+ modal_guildname_text: "Paikallinen palvelimenimi",
+ modal_guildacronym_text: "Paikallisen palvelimen lyhenne",
+ modal_ignorecustomname_text: "Käytä alkuperäistä palvelimen nimeä palvelimen lyhenteessä",
+ modal_guildicon_text: "Ikonin",
+ modal_guildbanner_text: "Banneri",
+ modal_tabheader1_text: "Palvelimen",
+ modal_tabheader2_text: "Ikoninväri",
+ modal_tabheader3_text: "Tooltipväri",
+ modal_colorpicker1_text: "Ikoninväri",
+ modal_colorpicker2_text: "Fontinväri",
+ modal_colorpicker3_text: "Tooltipväri",
+ modal_colorpicker4_text: "Fontinväri",
+ modal_invalidurl_text: "Virheellinen URL"
+ };
+ case "sv": //swedish
+ return {
+ context_localserversettings_text: "Lokal serverinställningar",
+ submenu_serversettings_text: "Ändra inställningar",
+ submenu_resetsettings_text: "Återställ server",
+ modal_header_text: "Lokal serverinställningar",
+ modal_guildname_text: "Lokalt servernamn",
+ modal_guildacronym_text: "Lokal server förkortning",
+ modal_ignorecustomname_text: "Använd det ursprungliga servernamnet för serverförkortningen",
+ modal_guildicon_text: "Ikon",
+ modal_guildbanner_text: "Banderoll",
+ modal_tabheader1_text: "Server",
+ modal_tabheader2_text: "Ikonfärg",
+ modal_tabheader3_text: "Tooltipfärg",
+ modal_colorpicker1_text: "Ikonfärg",
+ modal_colorpicker2_text: "Fontfärg",
+ modal_colorpicker3_text: "Tooltipfärg",
+ modal_colorpicker4_text: "Fontfärg",
+ modal_invalidurl_text: "Ogiltig URL"
+ };
+ case "tr": //turkish
+ return {
+ context_localserversettings_text: "Yerel Sunucu Ayarları",
+ submenu_serversettings_text: "Ayarları Değiştir",
+ submenu_resetsettings_text: "Sunucu Sıfırla",
+ modal_header_text: "Yerel sunucu ayarları",
+ modal_guildname_text: "Yerel sunucu adı",
+ modal_guildacronym_text: "Yerel sunucu kısaltması",
+ modal_ignorecustomname_text: "Sunucu kısaltması için orijinal sunucu adını kullanın",
+ modal_guildicon_text: "Simge",
+ modal_guildbanner_text: "Afişi",
+ modal_tabheader1_text: "Sunucu",
+ modal_tabheader2_text: "Simge rengi",
+ modal_tabheader3_text: "Tooltip rengi",
+ modal_colorpicker1_text: "Simge rengi",
+ modal_colorpicker2_text: "Yazı rengi",
+ modal_colorpicker3_text: "Tooltip rengi",
+ modal_colorpicker4_text: "Yazı rengi",
+ modal_invalidurl_text: "Geçersiz URL"
+ };
+ case "cs": //czech
+ return {
+ context_localserversettings_text: "Místní nastavení serveru",
+ submenu_serversettings_text: "Změnit nastavení",
+ submenu_resetsettings_text: "Obnovit server",
+ modal_header_text: "Místní nastavení serveru",
+ modal_guildname_text: "Místní název serveru",
+ modal_guildacronym_text: "Zkratka místního serveru",
+ modal_ignorecustomname_text: "Pro zkratku serveru použijte původní název serveru",
+ modal_guildicon_text: "Ikony",
+ modal_guildbanner_text: "Prapor",
+ modal_tabheader1_text: "Server",
+ modal_tabheader2_text: "Barva ikony",
+ modal_tabheader3_text: "Barva tooltip",
+ modal_colorpicker1_text: "Barva ikony",
+ modal_colorpicker2_text: "Barva fontu",
+ modal_colorpicker3_text: "Barva tooltip",
+ modal_colorpicker4_text: "Barva fontu",
+ modal_invalidurl_text: "Neplatná URL"
+ };
+ case "bg": //bulgarian
+ return {
+ context_localserversettings_text: "Настройки за локални cървър",
+ submenu_serversettings_text: "Промяна на настройките",
+ submenu_resetsettings_text: "Възстановяване на cървър",
+ modal_header_text: "Настройки за локални cървър",
+ modal_guildname_text: "Локално име на cървър",
+ modal_guildacronym_text: "Акроним на локалния сървър",
+ modal_ignorecustomname_text: "Използвайте оригиналното име на сървъра за съкращението на сървъра",
+ modal_guildicon_text: "Икона",
+ modal_guildbanner_text: "Знаме",
+ modal_tabheader1_text: "Cървър",
+ modal_tabheader2_text: "Цвят на иконата",
+ modal_tabheader3_text: "Цвят на подсказка",
+ modal_colorpicker1_text: "Цвят на иконата",
+ modal_colorpicker2_text: "Цвят на шрифта",
+ modal_colorpicker3_text: "Цвят на подсказка",
+ modal_colorpicker4_text: "Цвят на шрифта",
+ modal_invalidurl_text: "Невалиден URL"
+ };
+ case "ru": //russian
+ return {
+ context_localserversettings_text: "Настройки локального cервер",
+ submenu_serversettings_text: "Изменить настройки",
+ submenu_resetsettings_text: "Сбросить cервер",
+ modal_header_text: "Настройки локального cервер",
+ modal_guildname_text: "Имя локального cервер",
+ modal_guildacronym_text: "Акроним локального сервера",
+ modal_ignorecustomname_text: "Используйте оригинальное имя сервера для сокращения сервера",
+ modal_guildicon_text: "Значок",
+ modal_guildbanner_text: "Баннер",
+ modal_tabheader1_text: "Cервер",
+ modal_tabheader2_text: "Цвет значков",
+ modal_tabheader3_text: "Цвет подсказка",
+ modal_colorpicker1_text: "Цвет значков",
+ modal_colorpicker2_text: "Цвет шрифта",
+ modal_colorpicker3_text: "Цвет подсказка",
+ modal_colorpicker4_text: "Цвет шрифта",
+ modal_invalidurl_text: "Неверная URL"
+ };
+ case "uk": //ukrainian
+ return {
+ context_localserversettings_text: "Налаштування локального cервер",
+ submenu_serversettings_text: "Змінити налаштування",
+ submenu_resetsettings_text: "Скидання cервер",
+ modal_header_text: "Налаштування локального cервер",
+ modal_guildname_text: "Локальне ім'я cервер",
+ modal_guildacronym_text: "Акронім локального сервера",
+ modal_ignorecustomname_text: "Використовуйте оригінальне ім'я сервера для абревіатури сервера",
+ modal_guildicon_text: "Іконка",
+ modal_guildbanner_text: "Банер",
+ modal_tabheader1_text: "Cервер",
+ modal_tabheader2_text: "Колір ікони",
+ modal_tabheader3_text: "Колір підказка",
+ modal_colorpicker1_text: "Колір ікони",
+ modal_colorpicker2_text: "Колір шрифту",
+ modal_colorpicker3_text: "Колір підказка",
+ modal_colorpicker4_text: "Колір шрифту",
+ modal_invalidurl_text: "Недійсна URL"
+ };
+ case "ja": //japanese
+ return {
+ context_localserversettings_text: "ローカルサーバー設定",
+ submenu_serversettings_text: "設定を変更する",
+ submenu_resetsettings_text: "サーバーをリセットする",
+ modal_header_text: "ローカルサーバー設定",
+ modal_guildname_text: "ローカルサーバー名",
+ modal_guildacronym_text: "ローカルサーバーの頭字語",
+ modal_ignorecustomname_text: "サーバーの頭字語に元のサーバー名を使用する",
+ modal_guildicon_text: "アイコン",
+ modal_guildbanner_text: "バナー",
+ modal_tabheader1_text: "サーバー",
+ modal_tabheader2_text: "アイコンの色",
+ modal_tabheader3_text: "ツールチップの色",
+ modal_colorpicker1_text: "アイコンの色",
+ modal_colorpicker2_text: "フォントの色",
+ modal_colorpicker3_text: "ツールチップの色",
+ modal_colorpicker4_text: "フォントの色",
+ modal_invalidurl_text: "無効な URL"
+ };
+ case "zh-TW": //chinese (traditional)
+ return {
+ context_localserversettings_text: "本地服務器設置",
+ submenu_serversettings_text: "更改設置",
+ submenu_resetsettings_text: "重置服務器",
+ modal_header_text: "本地服務器設置",
+ modal_guildname_text: "服務器名稱",
+ modal_guildacronym_text: "本地服務器縮寫",
+ modal_ignorecustomname_text: "使用原始服務器名稱作為服務器首字母縮寫",
+ modal_guildicon_text: "圖標",
+ modal_guildbanner_text: "旗幟",
+ modal_tabheader1_text: "服務器",
+ modal_tabheader2_text: "圖標顏色",
+ modal_tabheader3_text: "工具提示顏色",
+ modal_colorpicker1_text: "圖標顏色",
+ modal_colorpicker2_text: "字體顏色",
+ modal_colorpicker3_text: "工具提示顏色",
+ modal_colorpicker4_text: "字體顏色",
+ modal_invalidurl_text: "無效的 URL"
+ };
+ case "ko": //korean
+ return {
+ context_localserversettings_text: "로컬 서버 설정",
+ submenu_serversettings_text: "설정 변경",
+ submenu_resetsettings_text: "서버 재설정",
+ modal_header_text: "로컬 서버 설정",
+ modal_guildname_text: "로컬 서버 이름",
+ modal_guildacronym_text: "로컬 서버 약어",
+ modal_ignorecustomname_text: "서버 약어에 원래 서버 이름을 사용하십시오",
+ modal_guildicon_text: "상",
+ modal_guildbanner_text: "기치",
+ modal_tabheader1_text: "서버",
+ modal_tabheader2_text: "상 색깔",
+ modal_tabheader3_text: "툴팁 색깔",
+ modal_colorpicker1_text: "상 색깔",
+ modal_colorpicker2_text: "글꼴 색깔",
+ modal_colorpicker3_text: "툴팁 색깔",
+ modal_colorpicker4_text: "글꼴 색깔",
+ modal_invalidurl_text: "잘못된 URL"
+ };
+ default: //default: english
+ return {
+ context_localserversettings_text: "Local Serversettings",
+ submenu_serversettings_text: "Change Settings",
+ submenu_resetsettings_text: "Reset Server",
+ modal_header_text: "Local Serversettings",
+ modal_guildname_text: "Local Servername",
+ modal_guildacronym_text: "Local Serveracronym",
+ modal_ignorecustomname_text: "Use the original Servername for the Serveracronym",
+ modal_guildicon_text: "Icon",
+ modal_guildbanner_text: "Banner",
+ modal_tabheader1_text: "Server",
+ modal_tabheader2_text: "Iconcolor",
+ modal_tabheader3_text: "Tooltipcolor",
+ modal_colorpicker1_text: "Iconcolor",
+ modal_colorpicker2_text: "Fontcolor",
+ modal_colorpicker3_text: "Tooltipcolor",
+ modal_colorpicker4_text: "Fontcolor",
+ modal_invalidurl_text: "Invalid URL"
+ };
+ }
}
- }
- }
+ };
+ })(window.BDFDB_Global.PluginUtils.buildPlugin(config));
})(); \ No newline at end of file
diff --git a/.config/BetterDiscord/plugins/NotificationSounds.plugin.js b/.config/BetterDiscord/plugins/NotificationSounds.plugin.js
index e40a415..9edc81c 100644
--- a/.config/BetterDiscord/plugins/NotificationSounds.plugin.js
+++ b/.config/BetterDiscord/plugins/NotificationSounds.plugin.js
@@ -1,419 +1,116 @@
//META{"name":"NotificationSounds","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/NotificationSounds","source":"https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/Plugins/NotificationSounds/NotificationSounds.plugin.js"}*//
-var NotificationSounds = (_ => {
- var audios, choices, firedEvents, repatchIncoming, callAudio;
- const removeAllKey = "REMOVE_ALL_BDFDB_DEVILBRO_DO_NOT_COPY";
-
- const settingsAudio = new Audio();
-
- /* NEVER CHANGE THE SRC LINKS IN THE PLUGIN FILE, TO ADD NEW SONGS ADD THEM IN THE SETTINGS GUI IN THE PLUGINS PAGE */
- const types = {
- "message1": {implemented:true, name:"New Chatmessage", src:"/assets/dd920c06a01e5bb8b09678581e29d56f.mp3", mute:true, focus:null, include:true},
- "dm": {implemented:true, name:"Direct Message", src:"/assets/84c9fa3d07da865278bd77c97d952db4.mp3", mute:true, focus:true, include:false},
- "mentioned": {implemented:true, name:"Mentioned", src:"/assets/a5f42064e8120e381528b14fd3188b72.mp3", mute:true, focus:true, include:false},
- "role": {implemented:true, name:"Mentioned (role)", src:"/assets/a5f42064e8120e381528b14fd3188b72.mp3", mute:true, focus:true, include:false},
- "everyone": {implemented:true, name:"Mentioned (@everyone)", src:"/assets/a5f42064e8120e381528b14fd3188b72.mp3", mute:true, focus:true, include:false},
- "here": {implemented:true, name:"Mentioned (@here)", src:"/assets/a5f42064e8120e381528b14fd3188b72.mp3", mute:true, focus:true, include:false},
- "deafen": {implemented:true, name:"Voicechat Deafen", src:"/assets/e4d539271704b87764dc465b1a061abd.mp3", mute:false, focus:null, include:true},
- "mute": {implemented:true, name:"Voicechat Mute", src:"/assets/429d09ee3b86e81a75b5e06d3fb482be.mp3", mute:false, focus:null, include:true},
- "disconnect": {implemented:true, name:"Voicechat Disconnect", src:"/assets/7e125dc075ec6e5ae796e4c3ab83abb3.mp3", mute:false, focus:null, include:true},
- "undeafen": {implemented:true, name:"Voicechat Undeafen", src:"/assets/5a000a0d4dff083d12a1d4fc2c7cbf66.mp3", mute:false, focus:null, include:true},
- "unmute": {implemented:true, name:"Voicechat Unmute", src:"/assets/43805b9dd757ac4f6b9b58c1a8ee5f0d.mp3", mute:false, focus:null, include:true},
- "user_join": {implemented:true, name:"Voicechat User Joined", src:"/assets/5dd43c946894005258d85770f0d10cff.mp3", mute:false, focus:null, include:true},
- "user_leave": {implemented:true, name:"Voicechat User Left", src:"/assets/4fcfeb2cba26459c4750e60f626cebdc.mp3", mute:false, focus:null, include:true},
- "user_moved": {implemented:true, name:"Voicechat User Moved", src:"/assets/e81d11590762728c1b811eadfa5be766.mp3", mute:false, focus:null, include:true},
- "reconnect": {implemented:false, name:"Voicechat Reconnect", src:"/assets/471cfd0005b112ff857705e894bf41a6.mp3", mute:true, focus:null, include:true},
- "ptt_start": {implemented:true, name:"Push2Talk Start", src:"/assets/8b63833c8d252fedba6b9c4f2517c705.mp3", mute:false, focus:null, include:true},
- "ptt_stop": {implemented:true, name:"Push2Talk Stop", src:"/assets/74ab980d6890a0fa6aa0336182f9f620.mp3", mute:false, focus:null, include:true},
- "call_calling": {implemented:true, name:"Outgoing Call", src:"/assets/c6e92752668dde4eee5923d70441579f.mp3", mute:false, focus:null, include:true},
- "call_ringing": {implemented:true, name:"Incoming Call", src:"/assets/84a1b4e11d634dbfa1e5dd97a96de3ad.mp3", mute:true, focus:null, include:true},
- "call_ringing_beat": {implemented:false, name:"Incoming Call Beat", src:"/assets/b9411af07f154a6fef543e7e442e4da9.mp3", mute:true, focus:null, include:true},
- "stream_started": {implemented:true, name:"Stream Started", src:"/assets/9ca817f41727edc1b2f1bc4f1911107c.mp3", mute:false, focus:null, include:true},
- "stream_ended": {implemented:true, name:"Stream Ended", src:"/assets/4e30f98aa537854f79f49a76af822bbc.mp3", mute:false, focus:null, include:true},
- "stream_user_joined": {implemented:true, name:"Stream User Joined", src:"/assets/5827bbf9a67c61cbb0e02ffbf434b654.mp3", mute:false, focus:null, include:true},
- "stream_user_left": {implemented:true, name:"Stream User Left", src:"/assets/7cdcdcbc426cc43583365a671c24b740.mp3", mute:false, focus:null, include:true},
- "ddr-down": {implemented:true, name:"HotKeys Window Down", src:"/assets/71f048f8aa7d4b24bf4268a87cbbb192.mp3", mute:false, focus:null, include:true},
- "ddr-left": {implemented:true, name:"HotKeys Window Left", src:"/assets/1de04408e62b5d52ae3ebbb91e9e1978.mp3", mute:false, focus:null, include:true},
- "ddr-right": {implemented:true, name:"HotKeys Window Right", src:"/assets/2c0433f93db8449e4a82b76dc520cb29.mp3", mute:false, focus:null, include:true},
- "ddr-up": {implemented:true, name:"HotKeys Window Up", src:"/assets/68472713f7a62c7c37e0a6a5d5a1faeb.mp3", mute:false, focus:null, include:true},
- "mention1": {implemented:false, name:"Mention Ping", src:"/assets/fa4d62c3cbc80733bf1f01b9c6f181de.mp3", mute:true, focus:null, include:true},
- "mention2": {implemented:false, name:"Mention Ping 2", src:"/assets/a5f42064e8120e381528b14fd3188b72.mp3", mute:true, focus:null, include:true},
- "mention3": {implemented:false, name:"Mention Ping 3", src:"/assets/84c9fa3d07da865278bd77c97d952db4.mp3", mute:true, focus:null, include:true},
- "message2": {implemented:false, name:"New Chatmessage 2", src:"/assets/15fe810f6cfab609c7fcda61652b9b34.mp3", mute:true, focus:null, include:true},
- "message3": {implemented:false, name:"New Chatmessage 3", src:"/assets/53ce6a92d3c233e8b4ac529d34d374e4.mp3", mute:true, focus:null, include:true},
- "human_man": {implemented:false, name:"Human Man Voice", src:"/assets/a37dcd6272ae41cf49295d58c9806fe3.mp3", mute:true, focus:null, include:true},
- "robot_man": {implemented:false, name:"Robot Man Voice", src:"/assets/66598bea6e59eb8acdf32cf2d9d75ba9.mp3", mute:true, focus:null, include:true},
- "discodo": {implemented:false, name:"Unknown", src:"/assets/ae7d16bb2eea76b9b9977db0fad66658.mp3", mute:true, focus:null, include:true},
- "overlayunlock": {implemented:false, name:"Overlay Unlocked", src:"/assets/ad322ffe0a88436296158a80d5d11baa.mp3", mute:true, focus:null, include:true}
- };
-
- /* NEVER CHANGE THE SRC LINKS IN THE PLUGIN FILE, TO ADD NEW SONGS ADD THEM IN THE SETTINGS GUI IN THE PLUGINS PAGE */
- const defaultAudios = {
- "---": {
- "---": null
- },
- "Default": {
- "Communication Channel": "https://notificationsounds.com/soundfiles/63538fe6ef330c13a05a3ed7e599d5f7/file-sounds-917-communication-channel.wav",
- "Isn't it": "https://notificationsounds.com/soundfiles/ba2fd310dcaa8781a9a652a31baf3c68/file-sounds-969-isnt-it.wav",
- "Job Done": "https://notificationsounds.com/soundfiles/5b69b9cb83065d403869739ae7f0995e/file-sounds-937-job-done.wav",
- "Served": "https://notificationsounds.com/soundfiles/b337e84de8752b27eda3a12363109e80/file-sounds-913-served.wav",
- "Solemn": "https://notificationsounds.com/soundfiles/53fde96fcc4b4ce72d7739202324cd49/file-sounds-882-solemn.wav",
- "System Fault": "https://notificationsounds.com/soundfiles/ebd9629fc3ae5e9f6611e2ee05a31cef/file-sounds-990-system-fault.wav",
- "You wouldn't believe": "https://notificationsounds.com/soundfiles/087408522c31eeb1f982bc0eaf81d35f/file-sounds-949-you-wouldnt-believe.wav"
- },
- "Discord": {}
- };
-
- for (let id in types) if (types[id].include) defaultAudios.Discord[types[id].name] = types[id].src;
-
- return class NotificationSounds {
- getName () {return "NotificationSounds";}
-
- getVersion () {return "3.4.9";}
-
- getAuthor () {return "DevilBro";}
-
- getDescription () {return "Allows you to replace the native sounds of Discord with your own";}
-
- constructor () {
- this.changelog = {
- "improved":[["Start Over","When someone calls you again the call sound now starts over instead of continuing from the last time"]]
- };
-
- this.patchedModules = {
- after: {
- Shakeable: "render"
- }
- };
- }
-
- initConstructor () {
- audios = {};
- choices = {};
- firedEvents = {};
+module.exports = (_ => {
+ const config = {
+ "info": {
+ "name": "NotificationSounds",
+ "author": "DevilBro",
+ "version": "3.4.9",
+ "description": "Allows you to replace the native sounds of Discord with your own."
}
-
- getSettingsPanel (collapseStates = {}) {
- if (!window.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
-
- let createSoundCard = type => {
- return [
- BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Flex, {
- className: BDFDB.disCN.marginbottom8,
- align: BDFDB.LibraryComponents.Flex.Align.CENTER,
- direction: BDFDB.LibraryComponents.Flex.Direction.HORIZONTAL,
- children: [
- BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsLabel, {
- label: types[type].name
- }),
- types[type].focus != null ? BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsItem, {
- type: "Switch",
- mini: true,
- grow: 0,
- label: "Mute when Channel focused:",
- value: choices[type].focus,
- onChange: value => {
- choices[type].focus = value;
- this.saveChoice(type, false);
- }
- }) : null,
- BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsItem, {
- type: "Switch",
- mini: true,
- grow: 0,
- label: "Mute in DnD:",
- value: choices[type].mute,
- onChange: value => {
- choices[type].mute = value;
- this.saveChoice(type, false);
- }
- })
- ].filter(n => n)
- }),
- BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Flex, {
- className: BDFDB.disCN.marginbottom8,
- children: [
- BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Flex.Child, {
- grow: 0,
- shrink: 0,
- basis: "31%",
- children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormItem, {
- title: "Category",
- children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Select, {
- value: choices[type].category,
- options: Object.keys(audios).map(name => ({value:name, label:name})),
- searchable: true,
- onChange: category => {
- choices[type].category = category.value;
- choices[type].song = Object.keys(audios[category.value] || {})[0];
- choices[type].src = audios[choices[type].category][choices[type].song] || types[type].src;
- this.saveChoice(type, true);
- BDFDB.PluginUtils.refreshSettingsPanel(this, settingsPanel, collapseStates);
- }
- })
- })
- }),
- BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Flex.Child, {
- grow: 0,
- shrink: 0,
- basis: "31%",
- children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormItem, {
- title: "Song",
- children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Select, {
- value: choices[type].song,
- options: Object.keys(audios[choices[type].category] || {}).map(name => ({value:name, label:name})),
- searchable: true,
- onChange: song => {
- choices[type].song = song.value;
- choices[type].src = audios[choices[type].category][choices[type].song] || types[type].src;
- this.saveChoice(type, true);
- BDFDB.PluginUtils.refreshSettingsPanel(this, settingsPanel, collapseStates);
- }
- })
- })
- }),
- BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Flex.Child, {
- grow: 0,
- shrink: 0,
- basis: "31%",
- children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormItem, {
- title: "Volume",
- children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Slider, {
- defaultValue: choices[type].volume,
- digits: 1,
- onValueRender: value => {
- return value + "%";
- },
- onValueChange: value => {
- choices[type].volume = value;
- this.saveChoice(type, true);
- }
- })
- })
- })
- ]
- }),
- BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormDivider, {
- className: BDFDB.disCN.marginbottom8
- })
- ];
- };
-
- let successSavedAudio = data => {
- BDFDB.NotificationUtils.toast(`Song ${data.song} was added to category ${data.category}.`, {type:"success"});
- if (!audios[data.category]) audios[data.category] = {};
- audios[data.category][data.song] = data.source;
- BDFDB.DataUtils.save(audios, this, "audios");
- BDFDB.PluginUtils.refreshSettingsPanel(this, settingsPanel, collapseStates);
-
- };
-
- let settingsPanel, settingsItems = [];
+ };
+ 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;}
- settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.CollapseContainer, {
- title: "Add new Song",
- collapseStates: collapseStates,
- children: [
- BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Flex, {
- className: BDFDB.disCN.margintop4,
- children: [
- BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Flex.Child, {
- children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormItem, {
- title: "Categoryname",
- children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TextInput, {
- className: "input-newsong input-category",
- value: "",
- placeholder: "Categoryname"
- })
- })
- }),
- BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Flex.Child, {
- children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormItem, {
- title: "Songname",
- children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TextInput, {
- className: "input-newsong input-song",
- value: "",
- placeholder: "Songname"
- })
- })
- })
- ]
- }),
- BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Flex, {
- className: BDFDB.disCN.margintop4,
- align: BDFDB.LibraryComponents.Flex.Align.END,
- children: [
- BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Flex.Child, {
- children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormItem, {
- title: "Source",
- children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TextInput, {
- className: "input-newsong input-source",
- type: "file",
- filter: ["audio", "video"],
- useFilePath: true,
- value: "",
- placeholder: "Source"
- })
- })
- }),
- BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Button, {
- style: {marginBottom: 1},
- onClick: _ => {
- for (let input of settingsPanel.querySelectorAll(".input-newsong " + BDFDB.dotCN.input)) if (!input.value || input.value.length == 0 || input.value.trim().length == 0) return BDFDB.NotificationUtils.toast("Fill out all fields to add a new song.", {type:"danger"});
- let category = settingsPanel.querySelector(".input-category " + BDFDB.dotCN.input).value.trim();
- let song = settingsPanel.querySelector(".input-song " + BDFDB.dotCN.input).value.trim();
- let source = settingsPanel.querySelector(".input-source " + BDFDB.dotCN.input).value.trim();
- if (source.indexOf("http") == 0) BDFDB.LibraryRequires.request(source, (error, response, result) => {
- if (response) {
- let type = response.headers["content-type"];
- if (type && (type.indexOf("octet-stream") > -1 || type.indexOf("audio") > -1 || type.indexOf("video") > -1)) return successSavedAudio({category, song, source});
- }
- BDFDB.NotificationUtils.toast("Use a valid direct link to a video or audio source. They usually end on something like .mp3, .mp4 or .wav.", {type:"danger"});
- });
- else BDFDB.LibraryRequires.fs.readFile(source, (error, response) => {
- if (error) BDFDB.NotificationUtils.toast("Could not fetch file. Please make sure the file exists.", {type:"danger"});
- else return successSavedAudio({category, song, source:`data:audio/mpeg;base64,${response.toString("base64")}`});
- });
- },
- children: BDFDB.LanguageUtils.LanguageStrings.SAVE
- })
- ]
- })
- ]
- }));
- settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.CollapseContainer, {
- title: "Implemented Sounds",
- collapseStates: collapseStates,
- children: Object.keys(BDFDB.ObjectUtils.filter(types, typedata => typedata.implemented)).map(type => createSoundCard(type)).flat(10).filter(n => n)
- }));
- settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.CollapseContainer, {
- title: "Unimplemented Sounds",
- collapseStates: collapseStates,
- children: Object.keys(BDFDB.ObjectUtils.filter(types, typedata => !typedata.implemented)).map(type => createSoundCard(type)).flat(10).filter(n => n)
- }));
-
- let removeableCategories = [{value:removeAllKey, label:BDFDB.LanguageUtils.LanguageStrings.FORM_LABEL_ALL}].concat(Object.keys(audios).filter(category => !(defaultAudios[category] && !Object.keys(audios[category] || {}).filter(song => defaultAudios[category][song] === undefined).length)).map(name => ({value:name, label:name})));
- let removeableSongs = {};
- for (let category of removeableCategories) removeableSongs[category.value] = [{value:removeAllKey, label:BDFDB.LanguageUtils.LanguageStrings.FORM_LABEL_ALL}].concat(Object.keys(audios[category.value] || {}).filter(song => !(defaultAudios[category.value] && defaultAudios[category.value][song] !== undefined)).map(name => ({value:name, label:name})));
- settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.CollapseContainer, {
- title: "Remove Songs",
- collapseStates: collapseStates,
- children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Flex, {
- className: BDFDB.disCN.margintop4,
- align: BDFDB.LibraryComponents.Flex.Align.END,
- children: [
- BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Flex.Child, {
- grow: 0,
- shrink: 0,
- basis: "35%",
- children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormItem, {
- title: "Category",
- children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Select, {
- key: "REMOVE_CATEGORY",
- value: removeAllKey,
- options: removeableCategories,
- searchable: true,
- onChange: (category, instance) => {
- let songSelectIns = BDFDB.ReactUtils.findOwner(BDFDB.ReactUtils.findOwner(instance, {name:["BDFDB_Modal", "BDFDB_SettingsPanel"], up:true}), {key:"REMOVE_SONG"});
- if (songSelectIns && removeableSongs[category.value]) {
- songSelectIns.props.options = removeableSongs[category.value];
- songSelectIns.props.value = removeAllKey;
- BDFDB.ReactUtils.forceUpdate(songSelectIns);
- }
- }
- })
- })
- }),
- BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Flex.Child, {
- grow: 0,
- shrink: 0,
- basis: "35%",
- children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormItem, {
- title: "Song",
- children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Select, {
- key: "REMOVE_SONG",
- value: removeAllKey,
- options: removeableSongs[removeAllKey],
- searchable: true
- })
- })
- }),
- BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Flex.Child, {
- grow: 0,
- shrink: 0,
- basis: "25%",
- children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Button, {
- style: {marginBottom: 1},
- color: BDFDB.LibraryComponents.Button.Colors.RED,
- onClick: (event, instance) => {
- let wrapperIns = BDFDB.ReactUtils.findOwner(instance, {name:["BDFDB_Modal", "BDFDB_SettingsPanel"], up:true});
- let categorySelectIns = BDFDB.ReactUtils.findOwner(wrapperIns, {key:"REMOVE_CATEGORY"});
- let songSelectIns = BDFDB.ReactUtils.findOwner(wrapperIns, {key:"REMOVE_SONG"});
- if (categorySelectIns && songSelectIns) {
- let songAmount = 0;
- let catAll = categorySelectIns.props.value == removeAllKey;
- let songAll = songSelectIns.props.value == removeAllKey;
- if (catAll) songAmount = BDFDB.ArrayUtils.sum(Object.keys(audios).map(category => Object.keys(audios[category] || {}).filter(song => !(defaultAudios[category] && defaultAudios[category][song] !== undefined)).length));
- else if (songAll) songAmount = Object.keys(audios[categorySelectIns.props.value] || {}).filter(song => !(defaultAudios[categorySelectIns.props.value] && defaultAudios[categorySelectIns.props.value][song] !== undefined)).length;
- else if (audios[categorySelectIns.props.value][songSelectIns.props.value]) songAmount = 1;
-
- if (songAmount) BDFDB.ModalUtils.confirm(this, `Are you sure you want to delete ${songAmount} added song${songAmount == 1 ? "" : "s"}?`, _ => {
- if (catAll) BDFDB.DataUtils.remove(this, "audios");
- else if (songAll) BDFDB.DataUtils.remove(this, "audios", categorySelectIns.props.value);
- else {
- delete audios[categorySelectIns.props.value][songSelectIns.props.value];
- if (BDFDB.ObjectUtils.isEmpty(audios[categorySelectIns.props.value])) delete audios[categorySelectIns.props.value];
- BDFDB.DataUtils.save(audios, this, "audios");
- }
- this.loadAudios();
- this.loadChoices();
- BDFDB.PluginUtils.refreshSettingsPanel(this, settingsPanel, collapseStates);
- });
- else BDFDB.NotificationUtils.toast("No songs to delete.", {type:"danger"});
- }
- },
- children: BDFDB.LanguageUtils.LanguageStrings.DELETE
- })
- })
- ]
- })
- }));
-
- return settingsPanel = BDFDB.PluginUtils.createSettingsPanel(this, settingsItems);
- }
-
- // Legacy
- load () {
- if (window.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) BDFDB.PluginUtils.load(this);
- }
-
- start () {
- if (!window.BDFDB) window.BDFDB = {myPlugins:{}};
- if (window.BDFDB && window.BDFDB.myPlugins && typeof window.BDFDB.myPlugins == "object") window.BDFDB.myPlugins[this.getName()] = this;
- let 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.min.js");
- libraryScript.setAttribute("date", performance.now());
- libraryScript.addEventListener("load", _ => {this.initialize();});
- document.head.appendChild(libraryScript);
+ 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", (error, response, body) => {require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), body, _ => {});});}
+ });
}
- else if (window.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();
- this.startTimeout = setTimeout(_ => {
- try {return this.initialize();}
- catch (err) {console.error(`%c[${this.getName()}]%c`, "color: #3a71c1; font-weight: 700;", "", "Fatal Error: Could not initiate plugin! " + err);}
- }, 30000);
- }
+ if (!window.BDFDB_Global.pluginQueue.includes(config.info.name)) window.BDFDB_Global.pluginQueue.push(config.info.name);
+ }
+ start() {}
+ stop() {}
+ } : (([Plugin, BDFDB]) => {
+ var audios, choices, firedEvents, repatchIncoming, callAudio;
+ const removeAllKey = "REMOVE_ALL_BDFDB_DEVILBRO_DO_NOT_COPY";
+
+ const settingsAudio = new Audio();
+
+ /* NEVER CHANGE THE SRC LINKS IN THE PLUGIN FILE, TO ADD NEW SONGS ADD THEM IN THE SETTINGS GUI IN THE PLUGINS PAGE */
+ const types = {
+ "message1": {implemented:true, name:"New Chatmessage", src:"/assets/dd920c06a01e5bb8b09678581e29d56f.mp3", mute:true, focus:null, include:true},
+ "dm": {implemented:true, name:"Direct Message", src:"/assets/84c9fa3d07da865278bd77c97d952db4.mp3", mute:true, focus:true, include:false},
+ "mentioned": {implemented:true, name:"Mentioned", src:"/assets/a5f42064e8120e381528b14fd3188b72.mp3", mute:true, focus:true, include:false},
+ "role": {implemented:true, name:"Mentioned (role)", src:"/assets/a5f42064e8120e381528b14fd3188b72.mp3", mute:true, focus:true, include:false},
+ "everyone": {implemented:true, name:"Mentioned (@everyone)", src:"/assets/a5f42064e8120e381528b14fd3188b72.mp3", mute:true, focus:true, include:false},
+ "here": {implemented:true, name:"Mentioned (@here)", src:"/assets/a5f42064e8120e381528b14fd3188b72.mp3", mute:true, focus:true, include:false},
+ "deafen": {implemented:true, name:"Voicechat Deafen", src:"/assets/e4d539271704b87764dc465b1a061abd.mp3", mute:false, focus:null, include:true},
+ "mute": {implemented:true, name:"Voicechat Mute", src:"/assets/429d09ee3b86e81a75b5e06d3fb482be.mp3", mute:false, focus:null, include:true},
+ "disconnect": {implemented:true, name:"Voicechat Disconnect", src:"/assets/7e125dc075ec6e5ae796e4c3ab83abb3.mp3", mute:false, focus:null, include:true},
+ "undeafen": {implemented:true, name:"Voicechat Undeafen", src:"/assets/5a000a0d4dff083d12a1d4fc2c7cbf66.mp3", mute:false, focus:null, include:true},
+ "unmute": {implemented:true, name:"Voicechat Unmute", src:"/assets/43805b9dd757ac4f6b9b58c1a8ee5f0d.mp3", mute:false, focus:null, include:true},
+ "user_join": {implemented:true, name:"Voicechat User Joined", src:"/assets/5dd43c946894005258d85770f0d10cff.mp3", mute:false, focus:null, include:true},
+ "user_leave": {implemented:true, name:"Voicechat User Left", src:"/assets/4fcfeb2cba26459c4750e60f626cebdc.mp3", mute:false, focus:null, include:true},
+ "user_moved": {implemented:true, name:"Voicechat User Moved", src:"/assets/e81d11590762728c1b811eadfa5be766.mp3", mute:false, focus:null, include:true},
+ "reconnect": {implemented:false, name:"Voicechat Reconnect", src:"/assets/471cfd0005b112ff857705e894bf41a6.mp3", mute:true, focus:null, include:true},
+ "ptt_start": {implemented:true, name:"Push2Talk Start", src:"/assets/8b63833c8d252fedba6b9c4f2517c705.mp3", mute:false, focus:null, include:true},
+ "ptt_stop": {implemented:true, name:"Push2Talk Stop", src:"/assets/74ab980d6890a0fa6aa0336182f9f620.mp3", mute:false, focus:null, include:true},
+ "call_calling": {implemented:true, name:"Outgoing Call", src:"/assets/c6e92752668dde4eee5923d70441579f.mp3", mute:false, focus:null, include:true},
+ "call_ringing": {implemented:true, name:"Incoming Call", src:"/assets/84a1b4e11d634dbfa1e5dd97a96de3ad.mp3", mute:true, focus:null, include:true},
+ "call_ringing_beat": {implemented:false, name:"Incoming Call Beat", src:"/assets/b9411af07f154a6fef543e7e442e4da9.mp3", mute:true, focus:null, include:true},
+ "stream_started": {implemented:true, name:"Stream Started", src:"/assets/9ca817f41727edc1b2f1bc4f1911107c.mp3", mute:false, focus:null, include:true},
+ "stream_ended": {implemented:true, name:"Stream Ended", src:"/assets/4e30f98aa537854f79f49a76af822bbc.mp3", mute:false, focus:null, include:true},
+ "stream_user_joined": {implemented:true, name:"Stream User Joined", src:"/assets/5827bbf9a67c61cbb0e02ffbf434b654.mp3", mute:false, focus:null, include:true},
+ "stream_user_left": {implemented:true, name:"Stream User Left", src:"/assets/7cdcdcbc426cc43583365a671c24b740.mp3", mute:false, focus:null, include:true},
+ "ddr-down": {implemented:true, name:"HotKeys Window Down", src:"/assets/71f048f8aa7d4b24bf4268a87cbbb192.mp3", mute:false, focus:null, include:true},
+ "ddr-left": {implemented:true, name:"HotKeys Window Left", src:"/assets/1de04408e62b5d52ae3ebbb91e9e1978.mp3", mute:false, focus:null, include:true},
+ "ddr-right": {implemented:true, name:"HotKeys Window Right", src:"/assets/2c0433f93db8449e4a82b76dc520cb29.mp3", mute:false, focus:null, include:true},
+ "ddr-up": {implemented:true, name:"HotKeys Window Up", src:"/assets/68472713f7a62c7c37e0a6a5d5a1faeb.mp3", mute:false, focus:null, include:true},
+ "mention1": {implemented:false, name:"Mention Ping", src:"/assets/fa4d62c3cbc80733bf1f01b9c6f181de.mp3", mute:true, focus:null, include:true},
+ "mention2": {implemented:false, name:"Mention Ping 2", src:"/assets/a5f42064e8120e381528b14fd3188b72.mp3", mute:true, focus:null, include:true},
+ "mention3": {implemented:false, name:"Mention Ping 3", src:"/assets/84c9fa3d07da865278bd77c97d952db4.mp3", mute:true, focus:null, include:true},
+ "message2": {implemented:false, name:"New Chatmessage 2", src:"/assets/15fe810f6cfab609c7fcda61652b9b34.mp3", mute:true, focus:null, include:true},
+ "message3": {implemented:false, name:"New Chatmessage 3", src:"/assets/53ce6a92d3c233e8b4ac529d34d374e4.mp3", mute:true, focus:null, include:true},
+ "human_man": {implemented:false, name:"Human Man Voice", src:"/assets/a37dcd6272ae41cf49295d58c9806fe3.mp3", mute:true, focus:null, include:true},
+ "robot_man": {implemented:false, name:"Robot Man Voice", src:"/assets/66598bea6e59eb8acdf32cf2d9d75ba9.mp3", mute:true, focus:null, include:true},
+ "discodo": {implemented:false, name:"Unknown", src:"/assets/ae7d16bb2eea76b9b9977db0fad66658.mp3", mute:true, focus:null, include:true},
+ "overlayunlock": {implemented:false, name:"Overlay Unlocked", src:"/assets/ad322ffe0a88436296158a80d5d11baa.mp3", mute:true, focus:null, include:true}
+ };
- initialize () {
- if (window.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
- if (this.started) return;
- BDFDB.PluginUtils.init(this);
+ /* NEVER CHANGE THE SRC LINKS IN THE PLUGIN FILE, TO ADD NEW SONGS ADD THEM IN THE SETTINGS GUI IN THE PLUGINS PAGE */
+ const defaultAudios = {
+ "---": {
+ "---": null
+ },
+ "Default": {
+ "Communication Channel": "https://notificationsounds.com/soundfiles/63538fe6ef330c13a05a3ed7e599d5f7/file-sounds-917-communication-channel.wav",
+ "Isn't it": "https://notificationsounds.com/soundfiles/ba2fd310dcaa8781a9a652a31baf3c68/file-sounds-969-isnt-it.wav",
+ "Job Done": "https://notificationsounds.com/soundfiles/5b69b9cb83065d403869739ae7f0995e/file-sounds-937-job-done.wav",
+ "Served": "https://notificationsounds.com/soundfiles/b337e84de8752b27eda3a12363109e80/file-sounds-913-served.wav",
+ "Solemn": "https://notificationsounds.com/soundfiles/53fde96fcc4b4ce72d7739202324cd49/file-sounds-882-solemn.wav",
+ "System Fault": "https://notificationsounds.com/soundfiles/ebd9629fc3ae5e9f6611e2ee05a31cef/file-sounds-990-system-fault.wav",
+ "You wouldn't believe": "https://notificationsounds.com/soundfiles/087408522c31eeb1f982bc0eaf81d35f/file-sounds-949-you-wouldnt-believe.wav"
+ },
+ "Discord": {}
+ };
+
+ for (let id in types) if (types[id].include) defaultAudios.Discord[types[id].name] = types[id].src;
+
+ return class NotificationSounds extends Plugin {
+ onLoad() {
+ audios = {};
+ choices = {};
+ firedEvents = {};
- BDFDB.ModuleUtils.patch(this, BDFDB.LibraryModules.DispatchApiUtils, "dirtyDispatch", {before: e => {
+ this.patchedModules = {
+ after: {
+ Shakeable: "render"
+ }
+ };
+ }
+
+ onStart() {
+ BDFDB.PatchUtils.patch(this, BDFDB.LibraryModules.DispatchApiUtils, "dirtyDispatch", {before: e => {
if (BDFDB.ObjectUtils.is(e.methodArguments[0]) && e.methodArguments[0].type == BDFDB.DiscordConstants.ActionTypes.MESSAGE_CREATE && e.methodArguments[0].message) {
let message = e.methodArguments[0].message;
let guildId = message.guild_id || null;
@@ -454,7 +151,7 @@ var NotificationSounds = (_ => {
}
}});
- BDFDB.ModuleUtils.patch(this, BDFDB.LibraryModules.SoundUtils, "playSound", {instead: e => {
+ BDFDB.PatchUtils.patch(this, BDFDB.LibraryModules.SoundUtils, "playSound", {instead: e => {
let type = e.methodArguments[0];
if (choices[type]) BDFDB.TimeUtils.timeout(_ => {
if (type == "message1") {
@@ -469,7 +166,7 @@ var NotificationSounds = (_ => {
});
else e.callOriginalMethod();
}});
- BDFDB.ModuleUtils.patch(this, BDFDB.LibraryModules.SoundUtils, "createSound", {after: e => {
+ BDFDB.PatchUtils.patch(this, BDFDB.LibraryModules.SoundUtils, "createSound", {after: e => {
let type = e.methodArguments[0];
let audio = new Audio();
audio.src = choices[type].src;
@@ -498,7 +195,7 @@ var NotificationSounds = (_ => {
let callListenerModule = BDFDB.ModuleUtils.findByProperties("handleRingUpdate");
if (callListenerModule) {
callListenerModule.terminate();
- BDFDB.ModuleUtils.patch(this, callListenerModule, "handleRingUpdate", {instead: e => {
+ BDFDB.PatchUtils.patch(this, callListenerModule, "handleRingUpdate", {instead: e => {
BDFDB.LibraryModules.CallUtils.getCalls().filter(call => call.ringing.length > 0 && BDFDB.LibraryModules.VoiceUtils.getCurrentClientVoiceChannelId() === call.channelId).length > 0 && !BDFDB.LibraryModules.SoundStateUtils.isSoundDisabled("call_calling") && !BDFDB.LibraryModules.StreamerModeStore.disableSounds ? callAudio.loop() : callAudio.stop();
}});
callListenerModule.initialize();
@@ -506,119 +203,392 @@ var NotificationSounds = (_ => {
this.forceUpdateAll();
}
- else console.error(`%c[${this.getName()}]%c`, "color: #3a71c1; font-weight: 700;", "", "Fatal Error: Could not load BD functions!");
- }
-
-
- stop () {
- if (window.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
- this.stopping = true;
-
- BDFDB.PluginUtils.clear(this);
+
+ onStop() {
settingsAudio.pause();
}
- }
+ getSettingsPanel (collapseStates = {}) {
+ let createSoundCard = type => {
+ return [
+ BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Flex, {
+ className: BDFDB.disCN.marginbottom8,
+ align: BDFDB.LibraryComponents.Flex.Align.CENTER,
+ direction: BDFDB.LibraryComponents.Flex.Direction.HORIZONTAL,
+ children: [
+ BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsLabel, {
+ label: types[type].name
+ }),
+ types[type].focus != null ? BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsItem, {
+ type: "Switch",
+ mini: true,
+ grow: 0,
+ label: "Mute when Channel focused:",
+ value: choices[type].focus,
+ onChange: value => {
+ choices[type].focus = value;
+ this.saveChoice(type, false);
+ }
+ }) : null,
+ BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsItem, {
+ type: "Switch",
+ mini: true,
+ grow: 0,
+ label: "Mute in DnD:",
+ value: choices[type].mute,
+ onChange: value => {
+ choices[type].mute = value;
+ this.saveChoice(type, false);
+ }
+ })
+ ].filter(n => n)
+ }),
+ BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Flex, {
+ className: BDFDB.disCN.marginbottom8,
+ children: [
+ BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Flex.Child, {
+ grow: 0,
+ shrink: 0,
+ basis: "31%",
+ children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormItem, {
+ title: "Category",
+ children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Select, {
+ value: choices[type].category,
+ options: Object.keys(audios).map(name => ({value:name, label:name})),
+ searchable: true,
+ onChange: category => {
+ choices[type].category = category.value;
+ choices[type].song = Object.keys(audios[category.value] || {})[0];
+ choices[type].src = audios[choices[type].category][choices[type].song] || types[type].src;
+ this.saveChoice(type, true);
+ BDFDB.PluginUtils.refreshSettingsPanel(this, settingsPanel, collapseStates);
+ }
+ })
+ })
+ }),
+ BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Flex.Child, {
+ grow: 0,
+ shrink: 0,
+ basis: "31%",
+ children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormItem, {
+ title: "Song",
+ children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Select, {
+ value: choices[type].song,
+ options: Object.keys(audios[choices[type].category] || {}).map(name => ({value:name, label:name})),
+ searchable: true,
+ onChange: song => {
+ choices[type].song = song.value;
+ choices[type].src = audios[choices[type].category][choices[type].song] || types[type].src;
+ this.saveChoice(type, true);
+ BDFDB.PluginUtils.refreshSettingsPanel(this, settingsPanel, collapseStates);
+ }
+ })
+ })
+ }),
+ BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Flex.Child, {
+ grow: 0,
+ shrink: 0,
+ basis: "31%",
+ children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormItem, {
+ title: "Volume",
+ children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Slider, {
+ defaultValue: choices[type].volume,
+ digits: 1,
+ onValueRender: value => {
+ return value + "%";
+ },
+ onValueChange: value => {
+ choices[type].volume = value;
+ this.saveChoice(type, true);
+ }
+ })
+ })
+ })
+ ]
+ }),
+ BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormDivider, {
+ className: BDFDB.disCN.marginbottom8
+ })
+ ];
+ };
- // Begin of own functions
-
- onSettingsClosed () {
- if (this.SettingsUpdated) {
- delete this.SettingsUpdated;
- settingsAudio.pause();
+ let successSavedAudio = data => {
+ BDFDB.NotificationUtils.toast(`Song ${data.song} was added to category ${data.category}.`, {type:"success"});
+ if (!audios[data.category]) audios[data.category] = {};
+ audios[data.category][data.song] = data.source;
+ BDFDB.DataUtils.save(audios, this, "audios");
+ BDFDB.PluginUtils.refreshSettingsPanel(this, settingsPanel, collapseStates);
+
+ };
- this.forceUpdateAll();
+ let settingsPanel, settingsItems = [];
+
+ settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.CollapseContainer, {
+ title: "Add new Song",
+ collapseStates: collapseStates,
+ children: [
+ BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Flex, {
+ className: BDFDB.disCN.margintop4,
+ children: [
+ BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Flex.Child, {
+ children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormItem, {
+ title: "Categoryname",
+ children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TextInput, {
+ className: "input-newsong input-category",
+ value: "",
+ placeholder: "Categoryname"
+ })
+ })
+ }),
+ BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Flex.Child, {
+ children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormItem, {
+ title: "Songname",
+ children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TextInput, {
+ className: "input-newsong input-song",
+ value: "",
+ placeholder: "Songname"
+ })
+ })
+ })
+ ]
+ }),
+ BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Flex, {
+ className: BDFDB.disCN.margintop4,
+ align: BDFDB.LibraryComponents.Flex.Align.END,
+ children: [
+ BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Flex.Child, {
+ children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormItem, {
+ title: "Source",
+ children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TextInput, {
+ className: "input-newsong input-source",
+ type: "file",
+ filter: ["audio", "video"],
+ useFilePath: true,
+ value: "",
+ placeholder: "Source"
+ })
+ })
+ }),
+ BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Button, {
+ style: {marginBottom: 1},
+ onClick: _ => {
+ for (let input of settingsPanel.querySelectorAll(".input-newsong " + BDFDB.dotCN.input)) if (!input.value || input.value.length == 0 || input.value.trim().length == 0) return BDFDB.NotificationUtils.toast("Fill out all fields to add a new song.", {type:"danger"});
+ let category = settingsPanel.querySelector(".input-category " + BDFDB.dotCN.input).value.trim();
+ let song = settingsPanel.querySelector(".input-song " + BDFDB.dotCN.input).value.trim();
+ let source = settingsPanel.querySelector(".input-source " + BDFDB.dotCN.input).value.trim();
+ if (source.indexOf("http") == 0) BDFDB.LibraryRequires.request(source, (error, response, result) => {
+ if (response) {
+ let type = response.headers["content-type"];
+ if (type && (type.indexOf("octet-stream") > -1 || type.indexOf("audio") > -1 || type.indexOf("video") > -1)) return successSavedAudio({category, song, source});
+ }
+ BDFDB.NotificationUtils.toast("Use a valid direct link to a video or audio source. They usually end on something like .mp3, .mp4 or .wav.", {type:"danger"});
+ });
+ else BDFDB.LibraryRequires.fs.readFile(source, (error, response) => {
+ if (error) BDFDB.NotificationUtils.toast("Could not fetch file. Please make sure the file exists.", {type:"danger"});
+ else return successSavedAudio({category, song, source:`data:audio/mpeg;base64,${response.toString("base64")}`});
+ });
+ },
+ children: BDFDB.LanguageUtils.LanguageStrings.SAVE
+ })
+ ]
+ })
+ ]
+ }));
+ settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.CollapseContainer, {
+ title: "Implemented Sounds",
+ collapseStates: collapseStates,
+ children: Object.keys(BDFDB.ObjectUtils.filter(types, typedata => typedata.implemented)).map(type => createSoundCard(type)).flat(10).filter(n => n)
+ }));
+ settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.CollapseContainer, {
+ title: "Unimplemented Sounds",
+ collapseStates: collapseStates,
+ children: Object.keys(BDFDB.ObjectUtils.filter(types, typedata => !typedata.implemented)).map(type => createSoundCard(type)).flat(10).filter(n => n)
+ }));
+
+ let removeableCategories = [{value:removeAllKey, label:BDFDB.LanguageUtils.LanguageStrings.FORM_LABEL_ALL}].concat(Object.keys(audios).filter(category => !(defaultAudios[category] && !Object.keys(audios[category] || {}).filter(song => defaultAudios[category][song] === undefined).length)).map(name => ({value:name, label:name})));
+ let removeableSongs = {};
+ for (let category of removeableCategories) removeableSongs[category.value] = [{value:removeAllKey, label:BDFDB.LanguageUtils.LanguageStrings.FORM_LABEL_ALL}].concat(Object.keys(audios[category.value] || {}).filter(song => !(defaultAudios[category.value] && defaultAudios[category.value][song] !== undefined)).map(name => ({value:name, label:name})));
+ settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.CollapseContainer, {
+ title: "Remove Songs",
+ collapseStates: collapseStates,
+ children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Flex, {
+ className: BDFDB.disCN.margintop4,
+ align: BDFDB.LibraryComponents.Flex.Align.END,
+ children: [
+ BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Flex.Child, {
+ grow: 0,
+ shrink: 0,
+ basis: "35%",
+ children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormItem, {
+ title: "Category",
+ children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Select, {
+ key: "REMOVE_CATEGORY",
+ value: removeAllKey,
+ options: removeableCategories,
+ searchable: true,
+ onChange: (category, instance) => {
+ let songSelectIns = BDFDB.ReactUtils.findOwner(BDFDB.ReactUtils.findOwner(instance, {name:["BDFDB_Modal", "BDFDB_SettingsPanel"], up:true}), {key:"REMOVE_SONG"});
+ if (songSelectIns && removeableSongs[category.value]) {
+ songSelectIns.props.options = removeableSongs[category.value];
+ songSelectIns.props.value = removeAllKey;
+ BDFDB.ReactUtils.forceUpdate(songSelectIns);
+ }
+ }
+ })
+ })
+ }),
+ BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Flex.Child, {
+ grow: 0,
+ shrink: 0,
+ basis: "35%",
+ children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormItem, {
+ title: "Song",
+ children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Select, {
+ key: "REMOVE_SONG",
+ value: removeAllKey,
+ options: removeableSongs[removeAllKey],
+ searchable: true
+ })
+ })
+ }),
+ BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Flex.Child, {
+ grow: 0,
+ shrink: 0,
+ basis: "25%",
+ children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Button, {
+ style: {marginBottom: 1},
+ color: BDFDB.LibraryComponents.Button.Colors.RED,
+ onClick: (event, instance) => {
+ let wrapperIns = BDFDB.ReactUtils.findOwner(instance, {name:["BDFDB_Modal", "BDFDB_SettingsPanel"], up:true});
+ let categorySelectIns = BDFDB.ReactUtils.findOwner(wrapperIns, {key:"REMOVE_CATEGORY"});
+ let songSelectIns = BDFDB.ReactUtils.findOwner(wrapperIns, {key:"REMOVE_SONG"});
+ if (categorySelectIns && songSelectIns) {
+ let songAmount = 0;
+ let catAll = categorySelectIns.props.value == removeAllKey;
+ let songAll = songSelectIns.props.value == removeAllKey;
+ if (catAll) songAmount = BDFDB.ArrayUtils.sum(Object.keys(audios).map(category => Object.keys(audios[category] || {}).filter(song => !(defaultAudios[category] && defaultAudios[category][song] !== undefined)).length));
+ else if (songAll) songAmount = Object.keys(audios[categorySelectIns.props.value] || {}).filter(song => !(defaultAudios[categorySelectIns.props.value] && defaultAudios[categorySelectIns.props.value][song] !== undefined)).length;
+ else if (audios[categorySelectIns.props.value][songSelectIns.props.value]) songAmount = 1;
+
+ if (songAmount) BDFDB.ModalUtils.confirm(this, `Are you sure you want to delete ${songAmount} added song${songAmount == 1 ? "" : "s"}?`, _ => {
+ if (catAll) BDFDB.DataUtils.remove(this, "audios");
+ else if (songAll) BDFDB.DataUtils.remove(this, "audios", categorySelectIns.props.value);
+ else {
+ delete audios[categorySelectIns.props.value][songSelectIns.props.value];
+ if (BDFDB.ObjectUtils.isEmpty(audios[categorySelectIns.props.value])) delete audios[categorySelectIns.props.value];
+ BDFDB.DataUtils.save(audios, this, "audios");
+ }
+ this.loadAudios();
+ this.loadChoices();
+ BDFDB.PluginUtils.refreshSettingsPanel(this, settingsPanel, collapseStates);
+ });
+ else BDFDB.NotificationUtils.toast("No songs to delete.", {type:"danger"});
+ }
+ },
+ children: BDFDB.LanguageUtils.LanguageStrings.DELETE
+ })
+ })
+ ]
+ })
+ }));
+
+ return settingsPanel = BDFDB.PluginUtils.createSettingsPanel(this, settingsItems);
+ }
+
+ onSettingsClosed () {
+ if (this.SettingsUpdated) {
+ delete this.SettingsUpdated;
+ settingsAudio.pause();
+ this.forceUpdateAll();
+ }
}
- }
- processShakeable (e) {
- if (e.returnvalue && BDFDB.ArrayUtils.is(e.returnvalue.props.children)) {
- let child = e.returnvalue.props.children.find(n => {
- let string = n && n.type && n.type.toString();
- return string && string.indexOf("call_ringing_beat") > -1 && string.indexOf("call_ringing") > -1 && string.indexOf("hasIncomingCalls") > -1;
- });
- if (child) {
- let index = e.returnvalue.props.children.indexOf(child);
- if (repatchIncoming) {
- e.returnvalue.props.children[index] = null;
- BDFDB.TimeUtils.timeout(_ => {
- repatchIncoming = false;
- BDFDB.ReactUtils.forceUpdate(BDFDB.ReactUtils.findOwner(document.querySelector(BDFDB.dotCN.app), {name:"App", up:true}))
- });
+ forceUpdateAll () {
+ repatchIncoming = true;
+ callAudio = BDFDB.LibraryModules.SoundUtils.createSound("call_calling");
+ BDFDB.PatchUtils.forceAllUpdates(this);
+ }
+
+ processShakeable (e) {
+ if (e.returnvalue && BDFDB.ArrayUtils.is(e.returnvalue.props.children)) {
+ let child = e.returnvalue.props.children.find(n => {
+ let string = n && n.type && n.type.toString();
+ return string && string.indexOf("call_ringing_beat") > -1 && string.indexOf("call_ringing") > -1 && string.indexOf("hasIncomingCalls") > -1;
+ });
+ if (child) {
+ let index = e.returnvalue.props.children.indexOf(child);
+ if (repatchIncoming) {
+ e.returnvalue.props.children[index] = null;
+ BDFDB.TimeUtils.timeout(_ => {
+ repatchIncoming = false;
+ BDFDB.ReactUtils.forceUpdate(BDFDB.ReactUtils.findOwner(document.querySelector(BDFDB.dotCN.app), {name:"App", up:true}))
+ });
+ }
+ else e.returnvalue.props.children[index] = BDFDB.ReactUtils.createElement(e.returnvalue.props.children[index].type, {});
}
- else e.returnvalue.props.children[index] = BDFDB.ReactUtils.createElement(e.returnvalue.props.children[index].type, {});
}
}
- }
-
- forceUpdateAll () {
- repatchIncoming = true;
- callAudio = BDFDB.LibraryModules.SoundUtils.createSound("call_calling");
- BDFDB.ModuleUtils.forceAllUpdates(this);
- }
-
- loadAudios () {
- audios = Object.assign({}, defaultAudios, BDFDB.DataUtils.load(this, "audios"));
- BDFDB.DataUtils.save(audios, this, "audios");
- }
+ loadAudios () {
+ audios = Object.assign({}, defaultAudios, BDFDB.DataUtils.load(this, "audios"));
+ BDFDB.DataUtils.save(audios, this, "audios");
+ }
- loadChoices () {
- let loadedChoices = BDFDB.DataUtils.load(this, "choices");
- for (let type in types) {
- let choice = loadedChoices[type] || {}, songFound = false;
- for (let category in audios) if (choice.category == category) for (let song in audios[category]) if (choice.song == song) {
- songFound = true;
- break;
+ loadChoices () {
+ let loadedChoices = BDFDB.DataUtils.load(this, "choices");
+ for (let type in types) {
+ let choice = loadedChoices[type] || {}, songFound = false;
+ for (let category in audios) if (choice.category == category) for (let song in audios[category]) if (choice.song == song) {
+ songFound = true;
+ break;
+ }
+ if (!songFound) choice = {
+ category: "---",
+ song: "---",
+ volume: 100,
+ src: types[type].src,
+ mute: types[type].mute,
+ focus: types[type].focus
+ };
+ choices[type] = choice;
+ this.saveChoice(type, false);
}
- if (!songFound) choice = {
- category: "---",
- song: "---",
- volume: 100,
- src: types[type].src,
- mute: types[type].mute,
- focus: types[type].focus
- };
- choices[type] = choice;
- this.saveChoice(type, false);
}
- }
- saveChoice (type, play) {
- if (!choices[type]) return;
- BDFDB.DataUtils.save(choices[type], this, "choices", type);
- if (play) {
- this.SettingsUpdated = true;
- this.playAudio(type, settingsAudio);
+ saveChoice (type, play) {
+ if (!choices[type]) return;
+ BDFDB.DataUtils.save(choices[type], this, "choices", type);
+ if (play) {
+ this.SettingsUpdated = true;
+ this.playAudio(type, settingsAudio);
+ }
}
- }
- playAudio (type, audio) {
- if (!audio) {
- if (this.dontPlayAudio(type)) return;
- audio = new Audio();
+ playAudio (type, audio) {
+ if (!audio) {
+ if (this.dontPlayAudio(type)) return;
+ audio = new Audio();
+ }
+ else audio.pause();
+ audio.src = choices[type].src;
+ audio.volume = choices[type].volume/100;
+ audio.play();
}
- else audio.pause();
- audio.src = choices[type].src;
- audio.volume = choices[type].volume/100;
- audio.play();
- }
- isSuppressMentionEnabled (guildId, channelId) {
- let channelSettings = BDFDB.LibraryModules.MutedUtils.getChannelMessageNotifications(guildId, channelId);
- return channelSettings && (channelSettings == BDFDB.DiscordConstants.UserNotificationSettings.NO_MESSAGES || channelSettings == BDFDB.DiscordConstants.UserNotificationSettings.NULL && BDFDB.LibraryModules.MutedUtils.getMessageNotifications(guildId) == BDFDB.DiscordConstants.UserNotificationSettings.NO_MESSAGES);
- }
-
- dontPlayAudio (type) {
- let status = BDFDB.UserUtils.getStatus();
- return choices[type].mute && (status == "dnd" || status == "streaming");
- }
+ isSuppressMentionEnabled (guildId, channelId) {
+ let channelSettings = BDFDB.LibraryModules.MutedUtils.getChannelMessageNotifications(guildId, channelId);
+ return channelSettings && (channelSettings == BDFDB.DiscordConstants.UserNotificationSettings.NO_MESSAGES || channelSettings == BDFDB.DiscordConstants.UserNotificationSettings.NULL && BDFDB.LibraryModules.MutedUtils.getMessageNotifications(guildId) == BDFDB.DiscordConstants.UserNotificationSettings.NO_MESSAGES);
+ }
- fireEvent (type) {
- firedEvents[type] = true;
- BDFDB.TimeUtils.timeout(_ => {firedEvents[type] = false;},3000);
- }
- }
-})();
+ dontPlayAudio (type) {
+ let status = BDFDB.UserUtils.getStatus();
+ return choices[type].mute && (status == "dnd" || status == "streaming");
+ }
-module.exports = NotificationSounds; \ No newline at end of file
+ fireEvent (type) {
+ firedEvents[type] = true;
+ BDFDB.TimeUtils.timeout(_ => {firedEvents[type] = false;},3000);
+ }
+ };
+ })(window.BDFDB_Global.PluginUtils.buildPlugin(config));
+})(); \ No newline at end of file
diff --git a/.config/BetterDiscord/plugins/PinDMs.plugin.js b/.config/BetterDiscord/plugins/PinDMs.plugin.js
index 961e1ca..e61e79d 100644
--- a/.config/BetterDiscord/plugins/PinDMs.plugin.js
+++ b/.config/BetterDiscord/plugins/PinDMs.plugin.js
@@ -1,190 +1,137 @@
//META{"name":"PinDMs","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/PinDMs","source":"https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/Plugins/PinDMs/PinDMs.plugin.js"}*//
-var PinDMs = (_ => {
- var hoveredCategory, draggedCategory, releasedCategory;
- var hoveredChannel, draggedChannel, releasedChannel;
-
- var settings = {};
-
- return class PinDMs {
- getName () {return "PinDMs";}
-
- getVersion () {return "1.7.6";}
-
- getAuthor () {return "DevilBro";}
-
- getDescription () {return "Allows you to pin DMs, making them appear at the top of your DMs/Guild-list.";}
-
- constructor () {
- this.changelog = {
- "fixed":[["Sort By Recent","Now properly updates order when a new messages was sent/received"]]
- };
-
- this.patchedModules = {
- before: {
- PrivateChannelsList: "render",
- UnreadDMs: "render"
- },
- after: {
- PrivateChannelsList: "render",
- UnreadDMs: "render",
- PrivateChannel: ["render", "componentDidMount"],
- DirectMessage: ["render", "componentDidMount", "componentWillUnmount"]
- }
- };
- }
-
- initConstructor () {
- this.css = `
- ${BDFDB.dotCNS.dmchannel + BDFDB.dotCN.namecontainerchildren} {
- display: flex;
- }
- ${BDFDB.dotCN.dmchannel}:hover ${BDFDB.dotCN._pindmsunpinbutton} {
- display: block;
- }
- ${BDFDB.dotCN._pindmspinnedchannelsheadercontainer} {
- display: flex;
- cursor: pointer;
- }
- ${BDFDB.dotCNS._pindmspinnedchannelsheadercontainer + BDFDB.dotCN.dmchannelheadertext} {
- margin-right: 6px;
- }
- ${BDFDB.dotCN._pindmspinnedchannelsheadercontainer + BDFDB.dotCN._pindmspinnedchannelsheadercolored}:hover ${BDFDB.dotCN.dmchannelheadertext} {
- filter: brightness(150%);
- }
- ${BDFDB.dotCNS._pindmspinnedchannelsheadercontainer + BDFDB.dotCN._pindmspinnedchannelsheaderamount} {
- position: relative;
- top: -1px;
- margin-right: 6px;
- }
- ${BDFDB.dotCN._pindmspinnedchannelsheaderarrow} {
- flex: 0;
- width: 16px;
- height: 16px;
- margin-left: 0;
- margin-right: 2px;
- }
- ${BDFDB.dotCNS._pindmspinnedchannelsheadercollapsed + BDFDB.dotCN._pindmspinnedchannelsheaderarrow + BDFDB.dotCN.channelheadericonwrapper} {
- transform: rotate(-90deg);
- }
- ${BDFDB.dotCN._pindmsunpinbutton} {
- display: none;
- width: 16px;
- height: 16px;
- opacity: .7;
- margin: 2px;
- }
- ${BDFDB.dotCN._pindmsunpinbutton}:hover {
- opacity: 1;
- }
- ${BDFDB.dotCN._pindmsunpinicon} {
- display: block;
- width: 16px;
- height: 16px;
- }
- ${BDFDB.dotCNS._pindmsdmchannelplaceholder + BDFDB.dotCN.namecontainerlayout} {
- box-sizing: border-box;
- border: 1px dashed currentColor;
- }
- ${BDFDB.dotCN._pindmspinnedchannelsheadercontainer + BDFDB.dotCN._pindmsdmchannelplaceholder} {
- margin-left: 8px;
- height: 12px;
- box-sizing: border-box;
- border: 1px dashed currentColor;
- }
- ${BDFDB.dotCN._pindmsdragpreview} {
- pointer-events: none !important;
- position: absolute !important;
- opacity: 0.5 !important;
- z-index: 10000 !important;
- }`;
-
- this.defaults = {
- settings: {
- sortInRecentOrder: {value:false, inner:true, description:"Channel List"},
- sortInRecentOrderGuild: {value:false, inner:true, description:"Guild List"},
- showPinIcon: {value:true, inner:false, description:"Shows a little 'Pin' icon for pinned DMs in the server list:"},
- showCategoryUnread: {value:true, inner:false, description:"Shows the amount of unread Messages in a category in the channel list:"},
- showCategoryAmount: {value:true, inner:false, description:"Shows the amount of pinned DMs in a category in the channel list:"}
- }
- };
- }
-
- getSettingsPanel (collapseStates = {}) {
- if (!window.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
- settings = BDFDB.DataUtils.get(this, "settings");
- let settingsPanel, settingsItems = [], innerItems = [];
-
- for (let key in settings) (!this.defaults.settings[key].inner ? settingsItems : innerItems).push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
- className: BDFDB.disCN.marginbottom8,
- type: "Switch",
- plugin: this,
- keys: ["settings", key],
- label: this.defaults.settings[key].description,
- value: settings[key]
- }));
- settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsPanelInner, {
- title: "Sort pinned DMs in the recent message order instead of the pinned at order in:",
- first: settingsItems.length == 0,
- children: innerItems
- }));
- settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsItem, {
- type: "Button",
- className: BDFDB.disCN.marginbottom8,
- color: BDFDB.LibraryComponents.Button.Colors.RED,
- label: "Unpin all pinned DMs",
- onClick: _ => {
- BDFDB.ModalUtils.confirm(this, "Are you sure you want to unpin all pinned DMs?", _ => {
- BDFDB.DataUtils.remove(this, "dmCategories");
- BDFDB.DataUtils.remove(this, "pinnedRecents");
- });
- },
- children: BDFDB.LanguageUtils.LanguageStrings.UNPIN
- }));
-
- return settingsPanel = BDFDB.PluginUtils.createSettingsPanel(this, settingsItems);
- }
-
- // Legacy
- load () {
- if (window.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) BDFDB.PluginUtils.load(this);
+module.exports = (_ => {
+ const config = {
+ "info": {
+ "name": "PinDMs",
+ "author": "DevilBro",
+ "version": "1.7.6",
+ "description": "Allows you to pin DMs, making them appear at the top of your DMs/Server-List."
}
-
- start () {
- if (!window.BDFDB) window.BDFDB = {myPlugins:{}};
- if (window.BDFDB && window.BDFDB.myPlugins && typeof window.BDFDB.myPlugins == "object") window.BDFDB.myPlugins[this.getName()] = this;
- let 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.min.js");
- libraryScript.setAttribute("date", performance.now());
- libraryScript.addEventListener("load", _ => {this.initialize();});
- document.head.appendChild(libraryScript);
+ };
+ 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", (error, response, body) => {require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), body, _ => {});});}
+ });
}
- else if (window.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();
- this.startTimeout = setTimeout(_ => {
- try {return this.initialize();}
- catch (err) {console.error(`%c[${this.getName()}]%c`, "color: #3a71c1; font-weight: 700;", "", "Fatal Error: Could not initiate plugin! " + err);}
- }, 30000);
- }
-
- initialize () {
- if (window.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
- if (this.started) return;
- BDFDB.PluginUtils.init(this);
+ if (!window.BDFDB_Global.pluginQueue.includes(config.info.name)) window.BDFDB_Global.pluginQueue.push(config.info.name);
+ }
+ start() {}
+ stop() {}
+ } : (([Plugin, BDFDB]) => {
+ var hoveredCategory, draggedCategory, releasedCategory;
+ var hoveredChannel, draggedChannel, releasedChannel;
+
+ var settings = {};
+
+ return class PinDMs extends Plugin {
+ onLoad() {
+ this.defaults = {
+ settings: {
+ sortInRecentOrder: {value:false, inner:true, description:"Channel List"},
+ sortInRecentOrderGuild: {value:false, inner:true, description:"Guild List"},
+ showPinIcon: {value:true, inner:false, description:"Shows a little 'Pin' icon for pinned DMs in the server list:"},
+ showCategoryUnread: {value:true, inner:false, description:"Shows the amount of unread Messages in a category in the channel list:"},
+ showCategoryAmount: {value:true, inner:false, description:"Shows the amount of pinned DMs in a category in the channel list:"}
+ }
+ };
+ this.patchedModules = {
+ before: {
+ PrivateChannelsList: "render",
+ UnreadDMs: "render"
+ },
+ after: {
+ PrivateChannelsList: "render",
+ UnreadDMs: "render",
+ PrivateChannel: ["render", "componentDidMount"],
+ DirectMessage: ["render", "componentDidMount", "componentWillUnmount"]
+ }
+ };
+
+ this.css = `
+ ${BDFDB.dotCNS.dmchannel + BDFDB.dotCN.namecontainerchildren} {
+ display: flex;
+ }
+ ${BDFDB.dotCN.dmchannel}:hover ${BDFDB.dotCN._pindmsunpinbutton} {
+ display: block;
+ }
+ ${BDFDB.dotCN._pindmspinnedchannelsheadercontainer} {
+ display: flex;
+ cursor: pointer;
+ }
+ ${BDFDB.dotCNS._pindmspinnedchannelsheadercontainer + BDFDB.dotCN.dmchannelheadertext} {
+ margin-right: 6px;
+ }
+ ${BDFDB.dotCN._pindmspinnedchannelsheadercontainer + BDFDB.dotCN._pindmspinnedchannelsheadercolored}:hover ${BDFDB.dotCN.dmchannelheadertext} {
+ filter: brightness(150%);
+ }
+ ${BDFDB.dotCNS._pindmspinnedchannelsheadercontainer + BDFDB.dotCN._pindmspinnedchannelsheaderamount} {
+ position: relative;
+ top: -1px;
+ margin-right: 6px;
+ }
+ ${BDFDB.dotCN._pindmspinnedchannelsheaderarrow} {
+ flex: 0;
+ width: 16px;
+ height: 16px;
+ margin-left: 0;
+ margin-right: 2px;
+ }
+ ${BDFDB.dotCNS._pindmspinnedchannelsheadercollapsed + BDFDB.dotCN._pindmspinnedchannelsheaderarrow + BDFDB.dotCN.channelheadericonwrapper} {
+ transform: rotate(-90deg);
+ }
+ ${BDFDB.dotCN._pindmsunpinbutton} {
+ display: none;
+ width: 16px;
+ height: 16px;
+ opacity: .7;
+ margin: 2px;
+ }
+ ${BDFDB.dotCN._pindmsunpinbutton}:hover {
+ opacity: 1;
+ }
+ ${BDFDB.dotCN._pindmsunpinicon} {
+ display: block;
+ width: 16px;
+ height: 16px;
+ }
+ ${BDFDB.dotCNS._pindmsdmchannelplaceholder + BDFDB.dotCN.namecontainerlayout} {
+ box-sizing: border-box;
+ border: 1px dashed currentColor;
+ }
+ ${BDFDB.dotCN._pindmspinnedchannelsheadercontainer + BDFDB.dotCN._pindmsdmchannelplaceholder} {
+ margin-left: 8px;
+ height: 12px;
+ box-sizing: border-box;
+ border: 1px dashed currentColor;
+ }
+ ${BDFDB.dotCN._pindmsdragpreview} {
+ pointer-events: none !important;
+ position: absolute !important;
+ opacity: 0.5 !important;
+ z-index: 10000 !important;
+ }
+ `;
+ }
+
+ onStart() {
this.forceUpdateAll();
}
- else console.error(`%c[${this.getName()}]%c`, "color: #3a71c1; font-weight: 700;", "", "Fatal Error: Could not load BD functions!");
- }
-
- stop () {
- if (window.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
- this.stopping = true;
-
+
+ onStop() {
this.forceUpdateAll();
let unreadDMsInstance = BDFDB.ReactUtils.findOwner(document.querySelector(BDFDB.dotCN.app), {name:"UnreadDMs", unlimited:true});
@@ -193,292 +140,374 @@ var PinDMs = (_ => {
unreadDMsInstance.props.unreadPrivateChannelIds = BDFDB.LibraryModules.DirectMessageUnreadStore.getUnreadPrivateChannelIds();
BDFDB.ReactUtils.forceUpdate(unreadDMsInstance);
}
-
- BDFDB.PluginUtils.clear(this);
}
- }
+ getSettingsPanel (collapseStates = {}) {
+ let settingsPanel, settingsItems = [];
+
+
+ for (let key in settings) if (!this.defaults.settings[key].inner) settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
+ className: BDFDB.disCN.marginbottom8,
+ type: "Switch",
+ plugin: this,
+ keys: ["settings", key],
+ label: this.defaults.settings[key].description,
+ value: settings[key]
+ }));
+ settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsPanelInner, {
+ title: "Sort pinned DMs in the recent message order instead of the pinned at order in:",
+ first: settingsItems.length == 0,
+ children: Object.keys(settings).map(key => this.defaults.settings[key].inner && BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
+ className: BDFDB.disCN.marginbottom8,
+ 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",
+ className: BDFDB.disCN.marginbottom8,
+ color: BDFDB.LibraryComponents.Button.Colors.RED,
+ label: "Unpin all pinned DMs",
+ onClick: _ => {
+ BDFDB.ModalUtils.confirm(this, "Are you sure you want to unpin all pinned DMs?", _ => {
+ BDFDB.DataUtils.remove(this, "dmCategories");
+ BDFDB.DataUtils.remove(this, "pinnedRecents");
+ });
+ },
+ children: BDFDB.LanguageUtils.LanguageStrings.UNPIN
+ }));
+
+ return settingsPanel = BDFDB.PluginUtils.createSettingsPanel(this, settingsItems);
+ }
- // Begin of own functions
+ onSettingsClosed () {
+ if (this.SettingsUpdated) {
+ delete this.SettingsUpdated;
+ this.forceUpdateAll();
+ }
+ }
- onSettingsClosed () {
- if (this.SettingsUpdated) {
- delete this.SettingsUpdated;
- this.forceUpdateAll();
+ forceUpdateAll () {
+ settings = BDFDB.DataUtils.get(this, "settings");
+
+ BDFDB.ReactUtils.forceUpdate(BDFDB.ReactUtils.findOwner(document.querySelector(BDFDB.dotCN.app), {name:"FluxContainer(PrivateChannels)", all:true, unlimited:true}));
+ BDFDB.PatchUtils.forceAllUpdates(this);
}
- }
- onUserContextMenu (e) {
- if (e.instance.props.user) {
- let [children, index] = BDFDB.ContextMenuUtils.findItem(e.returnvalue, {id: "close-dm"});
- if (index > -1) {
- let id = BDFDB.LibraryModules.ChannelStore.getDMFromUserId(e.instance.props.user.id);
- if (id) this.injectItem(e.instance, id, children, index);
+ onUserContextMenu (e) {
+ if (e.instance.props.user) {
+ let [children, index] = BDFDB.ContextMenuUtils.findItem(e.returnvalue, {id: "close-dm"});
+ if (index > -1) {
+ let id = BDFDB.LibraryModules.ChannelStore.getDMFromUserId(e.instance.props.user.id);
+ if (id) this.injectItem(e.instance, id, children, index);
+ }
}
}
- }
- onGroupDMContextMenu (e) {
- if (e.instance.props.channel) {
- let [children, index] = BDFDB.ContextMenuUtils.findItem(e.returnvalue, {id: "change-icon"});
- if (index > -1) this.injectItem(e.instance, e.instance.props.channel.id, children, index + 1);
+ onGroupDMContextMenu (e) {
+ if (e.instance.props.channel) {
+ let [children, index] = BDFDB.ContextMenuUtils.findItem(e.returnvalue, {id: "change-icon"});
+ if (index > -1) this.injectItem(e.instance, e.instance.props.channel.id, children, index + 1);
+ }
}
- }
- injectItem (instance, id, children, index) {
- let pinnedInGuild = this.isPinned(id, "pinnedRecents");
-
- let categories = this.sortAndUpdateCategories("dmCategories", true);
- let currentCategory = this.getCategory(id, "dmCategories");
+ injectItem (instance, id, children, index) {
+ let pinnedInGuild = this.isPinned(id, "pinnedRecents");
+
+ let categories = this.sortAndUpdateCategories("dmCategories", true);
+ let currentCategory = this.getCategory(id, "dmCategories");
+
+ children.splice(index, 0, BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
+ label: this.labels.context_pindm_text,
+ id: BDFDB.ContextMenuUtils.createItemId(this.name, "submenu-pin"),
+ children: [
+ BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
+ label: this.labels.context_pinchannel_text,
+ id: BDFDB.ContextMenuUtils.createItemId(this.name, "submenu-channelist"),
+ children: [
+ BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuGroup, {
+ children: currentCategory ? BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
+ label: this.labels.context_unpinchannel_text,
+ id: BDFDB.ContextMenuUtils.createItemId(this.name, "unpin-channellist"),
+ color: BDFDB.LibraryComponents.MenuItems.Colors.DANGER,
+ action: _ => {
+ this.removeFromCategory(id, currentCategory, "dmCategories");
+ }
+ }) : BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
+ label: this.labels.context_addtonewcategory_text,
+ id: BDFDB.ContextMenuUtils.createItemId(this.name, "new-channellist"),
+ color: BDFDB.LibraryComponents.MenuItems.Colors.BRAND,
+ action: _ => {
+ this.openCategorySettingsModal({
+ id: this.generateID("dmCategories").toString(),
+ name: `${this.labels.header_pinneddms_text} #${categories.length + 1}`,
+ dms: [id],
+ pos: categories.length,
+ collapsed: false,
+ color: null
+ }, "dmCategories", true);
+ }
+ })
+ }),
+ categories.length ? BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuGroup, {
+ children: categories.map(category => currentCategory && currentCategory.id == category.id ? null : BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
+ label: category.name || this.labels.header_pinneddms_text,
+ id: BDFDB.ContextMenuUtils.createItemId(this.name, "pin-channellist", category.id),
+ action: _ => {
+ if (currentCategory) this.removeFromCategory(id, currentCategory, "dmCategories");
+ this.addToCategory(id, category, "dmCategories");
+ }
+ })).filter(n => n)
+ }) : null
+ ].filter(n => n)
+ }),
+ BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
+ label: this.labels[pinnedInGuild ? "context_unpinguild_text" : "context_pinguild_text"],
+ id: BDFDB.ContextMenuUtils.createItemId(this.name, pinnedInGuild ? "unpin-serverlist" : "pin-serverlist"),
+ danger: pinnedInGuild,
+ action: _ => {
+ if (!pinnedInGuild) this.addPin(id, "pinnedRecents");
+ else this.removePin(id, "pinnedRecents");
+ }
+ })
+ ]
+ }));
+ }
- children.splice(index, 0, BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
- label: this.labels.context_pindm_text,
- id: BDFDB.ContextMenuUtils.createItemId(this.name, "submenu-pin"),
- children: [
- BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
- label: this.labels.context_pinchannel_text,
- id: BDFDB.ContextMenuUtils.createItemId(this.name, "submenu-channelist"),
- children: [
- BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuGroup, {
- children: currentCategory ? BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
- label: this.labels.context_unpinchannel_text,
- id: BDFDB.ContextMenuUtils.createItemId(this.name, "unpin-channellist"),
- color: BDFDB.LibraryComponents.MenuItems.Colors.DANGER,
- action: _ => {
- this.removeFromCategory(id, currentCategory, "dmCategories");
- }
- }) : BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
- label: this.labels.context_addtonewcategory_text,
- id: BDFDB.ContextMenuUtils.createItemId(this.name, "new-channellist"),
- color: BDFDB.LibraryComponents.MenuItems.Colors.BRAND,
- action: _ => {
- this.openCategorySettingsModal({
- id: this.generateID("dmCategories").toString(),
- name: `${this.labels.header_pinneddms_text} #${categories.length + 1}`,
- dms: [id],
- pos: categories.length,
- collapsed: false,
- color: null
- }, "dmCategories", true);
- }
- })
- }),
- categories.length ? BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuGroup, {
- children: categories.map(category => currentCategory && currentCategory.id == category.id ? null : BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
- label: category.name || this.labels.header_pinneddms_text,
- id: BDFDB.ContextMenuUtils.createItemId(this.name, "pin-channellist", category.id),
- action: _ => {
- if (currentCategory) this.removeFromCategory(id, currentCategory, "dmCategories");
- this.addToCategory(id, category, "dmCategories");
- }
- })).filter(n => n)
- }) : null
- ].filter(n => n)
- }),
- BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
- label: this.labels[pinnedInGuild ? "context_unpinguild_text" : "context_pinguild_text"],
- id: BDFDB.ContextMenuUtils.createItemId(this.name, pinnedInGuild ? "unpin-serverlist" : "pin-serverlist"),
- danger: pinnedInGuild,
- action: _ => {
- if (!pinnedInGuild) this.addPin(id, "pinnedRecents");
- else this.removePin(id, "pinnedRecents");
- }
- })
- ]
- }));
- }
-
- processPrivateChannelsList (e) {
- let categories = this.sortAndUpdateCategories("dmCategories", true);
- if (categories.length) {
- e.instance.props.channels = Object.assign({}, e.instance.props.channels);
- e.instance.props.privateChannelIds = [].concat(e.instance.props.privateChannelIds || []);
- e.instance.props.pinnedChannelIds = Object.assign({}, e.instance.props.pinnedChannelIds);
- if (!e.returnvalue) {
- if (draggedChannel && releasedChannel) {
- let categoryId = releasedChannel.split("header_")[1];
- let category = categories.find(n => categoryId != undefined ? n.id == categoryId : n.dms.includes(releasedChannel));
- if (category) {
- BDFDB.ArrayUtils.remove(category.dms, draggedChannel, true);
- category.dms.splice(categoryId != undefined ? 0 : category.dms.indexOf(releasedChannel) + 1, 0, draggedChannel);
- BDFDB.DataUtils.save(category, this, "dmCategories", category.id);
+ processPrivateChannelsList (e) {
+ let categories = this.sortAndUpdateCategories("dmCategories", true);
+ if (categories.length) {
+ e.instance.props.channels = Object.assign({}, e.instance.props.channels);
+ e.instance.props.privateChannelIds = [].concat(e.instance.props.privateChannelIds || []);
+ e.instance.props.pinnedChannelIds = Object.assign({}, e.instance.props.pinnedChannelIds);
+ if (!e.returnvalue) {
+ if (draggedChannel && releasedChannel) {
+ let categoryId = releasedChannel.split("header_")[1];
+ let category = categories.find(n => categoryId != undefined ? n.id == categoryId : n.dms.includes(releasedChannel));
+ if (category) {
+ BDFDB.ArrayUtils.remove(category.dms, draggedChannel, true);
+ category.dms.splice(categoryId != undefined ? 0 : category.dms.indexOf(releasedChannel) + 1, 0, draggedChannel);
+ BDFDB.DataUtils.save(category, this, "dmCategories", category.id);
+ }
+ draggedChannel = null;
+ releasedChannel = null;
}
- draggedChannel = null;
- releasedChannel = null;
- }
- if (draggedCategory && releasedCategory) {
- let maybedDraggedCategory = categories.find(n => n.id == draggedCategory);
- let maybedReleasedCategory = categories.find(n => n.id == releasedCategory);
- if (maybedDraggedCategory && maybedReleasedCategory) {
- BDFDB.ArrayUtils.remove(categories, maybedDraggedCategory, true);
- categories.splice(categories.indexOf(maybedReleasedCategory) + 1, 0, maybedDraggedCategory);
- let newCategories = {}, newPos = 0;
- for (let category of [].concat(categories).reverse()) newCategories[category.id] = Object.assign(category, {pos:newPos++});
- BDFDB.DataUtils.save(newCategories, this, "dmCategories");
+ if (draggedCategory && releasedCategory) {
+ let maybedDraggedCategory = categories.find(n => n.id == draggedCategory);
+ let maybedReleasedCategory = categories.find(n => n.id == releasedCategory);
+ if (maybedDraggedCategory && maybedReleasedCategory) {
+ BDFDB.ArrayUtils.remove(categories, maybedDraggedCategory, true);
+ categories.splice(categories.indexOf(maybedReleasedCategory) + 1, 0, maybedDraggedCategory);
+ let newCategories = {}, newPos = 0;
+ for (let category of [].concat(categories).reverse()) newCategories[category.id] = Object.assign(category, {pos:newPos++});
+ BDFDB.DataUtils.save(newCategories, this, "dmCategories");
+ }
+ draggedCategory = null;
+ releasedCategory = null;
}
- draggedCategory = null;
- releasedCategory = null;
- }
- e.instance.props.pinnedChannelIds = {};
- for (let category of [].concat(categories).reverse()) {
- e.instance.props.pinnedChannelIds[category.id] = [];
- for (let id of this.sortDMsByTime(this.filterDMs(category.dms), "dmCategories").reverse()) {
- BDFDB.ArrayUtils.remove(e.instance.props.privateChannelIds, id, true);
- if (!category.collapsed || e.instance.props.selectedChannelId == id) {
- e.instance.props.privateChannelIds.unshift(id);
- e.instance.props.pinnedChannelIds[category.id].push(id);
+ e.instance.props.pinnedChannelIds = {};
+ for (let category of [].concat(categories).reverse()) {
+ e.instance.props.pinnedChannelIds[category.id] = [];
+ for (let id of this.sortDMsByTime(this.filterDMs(category.dms), "dmCategories").reverse()) {
+ BDFDB.ArrayUtils.remove(e.instance.props.privateChannelIds, id, true);
+ if (!category.collapsed || e.instance.props.selectedChannelId == id) {
+ e.instance.props.privateChannelIds.unshift(id);
+ e.instance.props.pinnedChannelIds[category.id].push(id);
+ }
}
}
}
- }
- else {
- e.returnvalue.props.sections = [];
- e.returnvalue.props.sections.push(e.instance.state.preRenderedChildren);
- let shownPinnedIds = BDFDB.ObjectUtils.toArray(e.instance.props.pinnedChannelIds).reverse();
- for (let ids of shownPinnedIds) e.returnvalue.props.sections.push(ids.length || 1);
- e.returnvalue.props.sections.push(e.instance.props.privateChannelIds.length - shownPinnedIds.flat().length);
-
- let sectionHeight = e.returnvalue.props.sectionHeight;
- let sectionHeightFunc = typeof sectionHeight != "function" ? _ => sectionHeight : sectionHeight;
- e.returnvalue.props.sectionHeight = (...args) => {
- if (args[0] != 0 && args[0] != e.returnvalue.props.sections.length - 1) {
- let category = categories[args[0] - 1];
- if (category) return 40;
- }
- return sectionHeightFunc(...args);
- };
-
- let rowHeight = e.returnvalue.props.rowHeight;
- let rowHeightFunc = typeof rowHeight != "function" ? _ => rowHeight : rowHeight;
- e.returnvalue.props.rowHeight = (...args) => {
- if (args[0] != 0 && args[0] != e.returnvalue.props.sections.length - 1) {
- let category = categories[args[0] - 1];
- if (category && (category.collapsed || category.id == draggedCategory)) return 0;
- }
- return rowHeightFunc(...args);
- };
-
- let renderRow = e.returnvalue.props.renderRow;
- e.returnvalue.props.renderRow = (...args) => {
- let row = renderRow(...args);
- return row && row.key == "no-private-channels" ? null : row;
- };
-
- let renderSection = e.returnvalue.props.renderSection;
- e.returnvalue.props.renderSection = (...args) => {
- if (args[0].section != 0 && args[0].section != e.returnvalue.props.sections.length - 1) {
- let category = categories[args[0].section - 1];
- if (category && draggedCategory != category.id) {
- let color = BDFDB.ColorUtils.convert(category.color, "RGBA");
- let foundDMs = this.filterDMs(category.dms);
- let unreadAmount = settings.showCategoryUnread && BDFDB.ArrayUtils.sum(foundDMs.map(id => BDFDB.LibraryModules.UnreadChannelUtils.getMentionCount(id)));
- return [
- BDFDB.ReactUtils.createElement("h2", {
- className: BDFDB.DOMUtils.formatClassName(BDFDB.disCN.dmchannelheadercontainer, BDFDB.disCN._pindmspinnedchannelsheadercontainer, category.collapsed && BDFDB.disCN._pindmspinnedchannelsheadercollapsed, color && BDFDB.disCN._pindmspinnedchannelsheadercolored, BDFDB.disCN.namecontainernamecontainer),
- categoryId: category.id,
- onMouseDown: event => {
- event = event.nativeEvent || event;
- let node = BDFDB.DOMUtils.getParent(BDFDB.dotCN._pindmspinnedchannelsheadercontainer, event.target).cloneNode(true);
- let mousemove = event2 => {
- if (Math.sqrt((event.pageX - event2.pageX)**2) > 20 || Math.sqrt((event.pageY - event2.pageY)**2) > 20) {
- BDFDB.ListenerUtils.stopEvent(event);
- draggedCategory = category.id;
- this.updateContainer("dmCategories");
- let dragPreview = this.createDragPreview(node, event2);
+ else {
+ e.returnvalue.props.sections = [];
+ e.returnvalue.props.sections.push(e.instance.state.preRenderedChildren);
+ let shownPinnedIds = BDFDB.ObjectUtils.toArray(e.instance.props.pinnedChannelIds).reverse();
+ for (let ids of shownPinnedIds) e.returnvalue.props.sections.push(ids.length || 1);
+ e.returnvalue.props.sections.push(e.instance.props.privateChannelIds.length - shownPinnedIds.flat().length);
+
+ let sectionHeight = e.returnvalue.props.sectionHeight;
+ let sectionHeightFunc = typeof sectionHeight != "function" ? _ => sectionHeight : sectionHeight;
+ e.returnvalue.props.sectionHeight = (...args) => {
+ if (args[0] != 0 && args[0] != e.returnvalue.props.sections.length - 1) {
+ let category = categories[args[0] - 1];
+ if (category) return 40;
+ }
+ return sectionHeightFunc(...args);
+ };
+
+ let rowHeight = e.returnvalue.props.rowHeight;
+ let rowHeightFunc = typeof rowHeight != "function" ? _ => rowHeight : rowHeight;
+ e.returnvalue.props.rowHeight = (...args) => {
+ if (args[0] != 0 && args[0] != e.returnvalue.props.sections.length - 1) {
+ let category = categories[args[0] - 1];
+ if (category && (category.collapsed || category.id == draggedCategory)) return 0;
+ }
+ return rowHeightFunc(...args);
+ };
+
+ let renderRow = e.returnvalue.props.renderRow;
+ e.returnvalue.props.renderRow = (...args) => {
+ let row = renderRow(...args);
+ return row && row.key == "no-private-channels" ? null : row;
+ };
+
+ let renderSection = e.returnvalue.props.renderSection;
+ e.returnvalue.props.renderSection = (...args) => {
+ if (args[0].section != 0 && args[0].section != e.returnvalue.props.sections.length - 1) {
+ let category = categories[args[0].section - 1];
+ if (category && draggedCategory != category.id) {
+ let color = BDFDB.ColorUtils.convert(category.color, "RGBA");
+ let foundDMs = this.filterDMs(category.dms);
+ let unreadAmount = settings.showCategoryUnread && BDFDB.ArrayUtils.sum(foundDMs.map(id => BDFDB.LibraryModules.UnreadChannelUtils.getMentionCount(id)));
+ return [
+ BDFDB.ReactUtils.createElement("h2", {
+ className: BDFDB.DOMUtils.formatClassName(BDFDB.disCN.dmchannelheadercontainer, BDFDB.disCN._pindmspinnedchannelsheadercontainer, category.collapsed && BDFDB.disCN._pindmspinnedchannelsheadercollapsed, color && BDFDB.disCN._pindmspinnedchannelsheadercolored, BDFDB.disCN.namecontainernamecontainer),
+ categoryId: category.id,
+ onMouseDown: event => {
+ event = event.nativeEvent || event;
+ let node = BDFDB.DOMUtils.getParent(BDFDB.dotCN._pindmspinnedchannelsheadercontainer, event.target).cloneNode(true);
+ let mousemove = event2 => {
+ if (Math.sqrt((event.pageX - event2.pageX)**2) > 20 || Math.sqrt((event.pageY - event2.pageY)**2) > 20) {
+ BDFDB.ListenerUtils.stopEvent(event);
+ draggedCategory = category.id;
+ this.updateContainer("dmCategories");
+ let dragPreview = this.createDragPreview(node, event2);
+ document.removeEventListener("mousemove", mousemove);
+ document.removeEventListener("mouseup", mouseup);
+ let dragging = event3 => {
+ this.updateDragPreview(dragPreview, event3);
+ let placeholder = BDFDB.DOMUtils.getParent(BDFDB.dotCN._pindmsdmchannelplaceholder, event3.target);
+ let categoryNode = BDFDB.DOMUtils.getParent(BDFDB.dotCN._pindmspinnedchannelsheadercontainer, placeholder ? placeholder.previousSibling : event3.target);
+ let maybeHoveredCategory = categoryNode && categoryNode.getAttribute("categoryId");
+ let update = maybeHoveredCategory != hoveredCategory;
+ if (maybeHoveredCategory) hoveredCategory = maybeHoveredCategory;
+ else hoveredCategory = null;
+ if (update) this.updateContainer("dmCategories");
+ };
+ let releasing = event3 => {
+ BDFDB.DOMUtils.remove(dragPreview);
+ if (hoveredCategory) releasedCategory = hoveredCategory;
+ else draggedCategory = null;
+ hoveredCategory = null;
+ this.updateContainer("dmCategories");
+ 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);
- let dragging = event3 => {
- this.updateDragPreview(dragPreview, event3);
- let placeholder = BDFDB.DOMUtils.getParent(BDFDB.dotCN._pindmsdmchannelplaceholder, event3.target);
- let categoryNode = BDFDB.DOMUtils.getParent(BDFDB.dotCN._pindmspinnedchannelsheadercontainer, placeholder ? placeholder.previousSibling : event3.target);
- let maybeHoveredCategory = categoryNode && categoryNode.getAttribute("categoryId");
- let update = maybeHoveredCategory != hoveredCategory;
- if (maybeHoveredCategory) hoveredCategory = maybeHoveredCategory;
- else hoveredCategory = null;
- if (update) this.updateContainer("dmCategories");
- };
- let releasing = event3 => {
- BDFDB.DOMUtils.remove(dragPreview);
- if (hoveredCategory) releasedCategory = hoveredCategory;
- else draggedCategory = null;
- hoveredCategory = null;
- this.updateContainer("dmCategories");
- document.removeEventListener("mousemove", dragging);
- document.removeEventListener("mouseup", releasing);
- };
- document.addEventListener("mousemove", dragging);
- document.addEventListener("mouseup", releasing);
+ };
+ document.addEventListener("mousemove", mousemove);
+ document.addEventListener("mouseup", mouseup);
+ },
+ onClick: _ => {
+ if (foundDMs.length || !category.collapsed) {
+ category.collapsed = !category.collapsed;
+ BDFDB.DataUtils.save(category, this, "dmCategories", category.id);
+ this.updateContainer("dmCategories");
}
- };
- let mouseup = _ => {
- document.removeEventListener("mousemove", mousemove);
- document.removeEventListener("mouseup", mouseup);
- };
- document.addEventListener("mousemove", mousemove);
- document.addEventListener("mouseup", mouseup);
- },
- onClick: _ => {
- if (foundDMs.length || !category.collapsed) {
- category.collapsed = !category.collapsed;
- BDFDB.DataUtils.save(category, this, "dmCategories", category.id);
- this.updateContainer("dmCategories");
- }
- },
- onContextMenu: event => {
- BDFDB.ContextMenuUtils.open(this, event, BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuGroup, {
- children: [
- BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
- label: BDFDB.LanguageUtils.LanguageStrings.CATEGORY_SETTINGS,
- id: BDFDB.ContextMenuUtils.createItemId(this.name, "category-settings"),
- action: event2 => {
- this.openCategorySettingsModal(category, "dmCategories");
- }
- }),
- BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
- label: BDFDB.LanguageUtils.LanguageStrings.DELETE_CATEGORY,
- id: BDFDB.ContextMenuUtils.createItemId(this.name, "remove-category"),
- color: BDFDB.LibraryComponents.MenuItems.Colors.DANGER,
- action: event2 => {
- BDFDB.DataUtils.remove(this, "dmCategories", category.id);
- this.updateContainer("dmCategories");
- }
+ },
+ onContextMenu: event => {
+ BDFDB.ContextMenuUtils.open(this, event, BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuGroup, {
+ children: [
+ BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
+ label: BDFDB.LanguageUtils.LanguageStrings.CATEGORY_SETTINGS,
+ id: BDFDB.ContextMenuUtils.createItemId(this.name, "category-settings"),
+ action: event2 => {
+ this.openCategorySettingsModal(category, "dmCategories");
+ }
+ }),
+ BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
+ label: BDFDB.LanguageUtils.LanguageStrings.DELETE_CATEGORY,
+ id: BDFDB.ContextMenuUtils.createItemId(this.name, "remove-category"),
+ color: BDFDB.LibraryComponents.MenuItems.Colors.DANGER,
+ action: event2 => {
+ BDFDB.DataUtils.remove(this, "dmCategories", category.id);
+ this.updateContainer("dmCategories");
+ }
+ })
+ ]
+ }));
+ },
+ children: [
+ BDFDB.ObjectUtils.is(color) ? BDFDB.ReactUtils.createElement("span", {
+ className: BDFDB.disCN.dmchannelheadertext,
+ children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TextGradientElement, {
+ gradient: BDFDB.ColorUtils.createGradient(color),
+ children: category.name
+ })
+ }) : BDFDB.ReactUtils.createElement("span", {
+ className: BDFDB.disCN.dmchannelheadertext,
+ style: {color: color},
+ children: category.name,
+ }),
+ unreadAmount ? BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Badges.NumberBadge, {
+ className: BDFDB.disCN._pindmspinnedchannelsheaderamount,
+ count: unreadAmount,
+ style: {backgroundColor: BDFDB.DiscordConstants.Colors.STATUS_RED}
+ }) : null,
+ settings.showCategoryAmount ? BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Badges.NumberBadge, {
+ className: BDFDB.disCN._pindmspinnedchannelsheaderamount,
+ count: foundDMs.length,
+ style: {backgroundColor: BDFDB.DiscordConstants.Colors.BRAND}
+ }) : null,
+ BDFDB.ReactUtils.createElement("div", {
+ className: BDFDB.disCNS._pindmspinnedchannelsheaderarrow + BDFDB.disCNS.channelheadericonwrapper + BDFDB.disCN.channelheadericonclickable,
+ children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SvgIcon, {
+ className: BDFDB.disCNS._pindmspinnedchannelsheaderarrow + BDFDB.disCN.channelheadericon,
+ nativeClass: true,
+ iconSVG: `<svg width="24" height="24" viewBox="4 4 16 16"><path fill="currentColor" fill-rule="evenodd" clip-rule="evenodd" d="M16.59 8.59004L12 13.17L7.41 8.59004L6 10L12 16L18 10L16.59 8.59004Z"></path></svg>`
})
- ]
- }));
- },
- children: [
- BDFDB.ObjectUtils.is(color) ? BDFDB.ReactUtils.createElement("span", {
- className: BDFDB.disCN.dmchannelheadertext,
- children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TextGradientElement, {
- gradient: BDFDB.ColorUtils.createGradient(color),
- children: category.name
- })
- }) : BDFDB.ReactUtils.createElement("span", {
- className: BDFDB.disCN.dmchannelheadertext,
- style: {color: color},
- children: category.name,
- }),
- unreadAmount ? BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Badges.NumberBadge, {
- className: BDFDB.disCN._pindmspinnedchannelsheaderamount,
- count: unreadAmount,
- style: {backgroundColor: BDFDB.DiscordConstants.Colors.STATUS_RED}
- }) : null,
- settings.showCategoryAmount ? BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Badges.NumberBadge, {
- className: BDFDB.disCN._pindmspinnedchannelsheaderamount,
- count: foundDMs.length,
- style: {backgroundColor: BDFDB.DiscordConstants.Colors.BRAND}
- }) : null,
- BDFDB.ReactUtils.createElement("div", {
- className: BDFDB.disCNS._pindmspinnedchannelsheaderarrow + BDFDB.disCNS.channelheadericonwrapper + BDFDB.disCN.channelheadericonclickable,
- children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SvgIcon, {
- className: BDFDB.disCNS._pindmspinnedchannelsheaderarrow + BDFDB.disCN.channelheadericon,
- nativeClass: true,
- iconSVG: `<svg width="24" height="24" viewBox="4 4 16 16"><path fill="currentColor" fill-rule="evenodd" clip-rule="evenodd" d="M16.59 8.59004L12 13.17L7.41 8.59004L6 10L12 16L18 10L16.59 8.59004Z"></path></svg>`
})
+ ].filter(n => n)
+ }),
+ hoveredChannel == "header_" + category.id && BDFDB.ReactUtils.createElement("div", {
+ className: BDFDB.disCNS.dmchannel + BDFDB.disCNS._pindmsdmchannelpinned + BDFDB.disCNS._pindmsdmchannelplaceholder + BDFDB.disCN.namecontainernamecontainer,
+ children: BDFDB.ReactUtils.createElement("div", {
+ className: BDFDB.disCN.namecontainerlayout
})
- ].filter(n => n)
- }),
- hoveredChannel == "header_" + category.id && BDFDB.ReactUtils.createElement("div", {
+ })
+ ].filter(n => n);
+ }
+ else return null;
+ }
+ else return renderSection(...args);
+ };
+ }
+
+ let pinnedIds = BDFDB.ObjectUtils.toArray(e.instance.props.pinnedChannelIds).reverse();
+ BDFDB.PatchUtils.unpatch(this, e.instance, "renderDM");
+ BDFDB.PatchUtils.patch(this, e.instance, "renderDM", {before: e2 => {
+ if (e2.methodArguments[0] != 0) e2.methodArguments[1] += pinnedIds.slice(0, e2.methodArguments[0] - 1).flat().length;
+ }, after: e2 => {
+ if (e2.methodArguments[0] != 0) {
+ let id = e.instance.props.privateChannelIds[e2.methodArguments[1]];
+ e2.returnValue = e.instance.props.channels[id] ? BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.PrivateChannelItems[e.instance.props.channels[id].isMultiUserDM() ? "GroupDM" : "DirectMessage"], Object.assign({
+ key: id,
+ channel: e.instance.props.channels[id],
+ selected: e.instance.props.selectedChannelId == id
+ }, (e.instance.props.navigator || e.instance.props.listNavigator).getItemProps({
+ index: e2.methodArguments[2]
+ }))) : null;
+
+ let category = categories[e2.methodArguments[0] - 1];
+ if (category) {
+ if (!id || (category.collapsed && e.instance.props.selectedChannelId != id) || !category.dms.includes(id) || draggedCategory == category.id || draggedChannel == id) e2.returnValue = null;
+ else if (hoveredCategory == category.id && [].concat(category.dms).reverse()[0] == id) e2.returnValue = [
+ e2.returnValue,
+ BDFDB.ReactUtils.createElement("h2", {
+ className: BDFDB.disCNS.dmchannelheadercontainer + BDFDB.disCNS._pindmspinnedchannelsheadercontainer + BDFDB.disCNS._pindmsdmchannelplaceholder + BDFDB.disCN.namecontainernamecontainer
+ })
+ ].filter(n => n);
+ else if (hoveredChannel == id) e2.returnValue = [
+ e2.returnValue,
+ BDFDB.ReactUtils.createElement("div", {
className: BDFDB.disCNS.dmchannel + BDFDB.disCNS._pindmsdmchannelpinned + BDFDB.disCNS._pindmsdmchannelplaceholder + BDFDB.disCN.namecontainernamecontainer,
children: BDFDB.ReactUtils.createElement("div", {
className: BDFDB.disCN.namecontainerlayout
@@ -486,139 +515,174 @@ var PinDMs = (_ => {
})
].filter(n => n);
}
- else return null;
}
- else return renderSection(...args);
- };
+ }}, {force: true, noCache: true});
}
-
- let pinnedIds = BDFDB.ObjectUtils.toArray(e.instance.props.pinnedChannelIds).reverse();
- BDFDB.ModuleUtils.unpatch(this, e.instance, "renderDM");
- BDFDB.ModuleUtils.patch(this, e.instance, "renderDM", {before: e2 => {
- if (e2.methodArguments[0] != 0) e2.methodArguments[1] += pinnedIds.slice(0, e2.methodArguments[0] - 1).flat().length;
- }, after: e2 => {
- if (e2.methodArguments[0] != 0) {
- let id = e.instance.props.privateChannelIds[e2.methodArguments[1]];
- e2.returnValue = e.instance.props.channels[id] ? BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.PrivateChannelItems[e.instance.props.channels[id].isMultiUserDM() ? "GroupDM" : "DirectMessage"], Object.assign({
- key: id,
- channel: e.instance.props.channels[id],
- selected: e.instance.props.selectedChannelId == id
- }, (e.instance.props.navigator || e.instance.props.listNavigator).getItemProps({
- index: e2.methodArguments[2]
- }))) : null;
-
- let category = categories[e2.methodArguments[0] - 1];
- if (category) {
- if (!id || (category.collapsed && e.instance.props.selectedChannelId != id) || !category.dms.includes(id) || draggedCategory == category.id || draggedChannel == id) e2.returnValue = null;
- else if (hoveredCategory == category.id && [].concat(category.dms).reverse()[0] == id) e2.returnValue = [
- e2.returnValue,
- BDFDB.ReactUtils.createElement("h2", {
- className: BDFDB.disCNS.dmchannelheadercontainer + BDFDB.disCNS._pindmspinnedchannelsheadercontainer + BDFDB.disCNS._pindmsdmchannelplaceholder + BDFDB.disCN.namecontainernamecontainer
- })
- ].filter(n => n);
- else if (hoveredChannel == id) e2.returnValue = [
- e2.returnValue,
- BDFDB.ReactUtils.createElement("div", {
- className: BDFDB.disCNS.dmchannel + BDFDB.disCNS._pindmsdmchannelpinned + BDFDB.disCNS._pindmsdmchannelplaceholder + BDFDB.disCN.namecontainernamecontainer,
- children: BDFDB.ReactUtils.createElement("div", {
- className: BDFDB.disCN.namecontainerlayout
- })
+ }
+
+ processUnreadDMs (e) {
+ e.instance.props.pinnedPrivateChannelIds = [];
+ let sortedRecents = this.sortAndUpdate("pinnedRecents");
+ if (sortedRecents.length) {
+ e.instance.props.unreadPrivateChannelIds = [];
+ for (let pos in sortedRecents) {
+ let id = sortedRecents[pos];
+ if (e.instance.props.channels[id]) {
+ if (!e.instance.props.pinnedPrivateChannelIds.includes(id)) e.instance.props.pinnedPrivateChannelIds.push(id);
+ if (!e.instance.props.unreadPrivateChannelIds.includes(id)) e.instance.props.unreadPrivateChannelIds.push(id);
+ }
+ }
+ e.instance.props.unreadPrivateChannelIds = e.instance.props.unreadPrivateChannelIds.concat(BDFDB.LibraryModules.DirectMessageUnreadStore.getUnreadPrivateChannelIds());
+ if (e.returnvalue) {
+ if (draggedChannel && releasedChannel) {
+ let pinnedPrivateChannelIds = [].concat(e.instance.props.pinnedPrivateChannelIds), newData = {};
+ BDFDB.ArrayUtils.remove(pinnedPrivateChannelIds, draggedChannel, true);
+ pinnedPrivateChannelIds.splice(pinnedPrivateChannelIds.indexOf(releasedChannel) + 1, 0, draggedChannel);
+ for (let pos in pinnedPrivateChannelIds) newData[pinnedPrivateChannelIds[pos]] = parseInt(pos);
+ BDFDB.DataUtils.save(newData, this, "pinnedRecents");
+ draggedChannel = null;
+ releasedChannel = null;
+ BDFDB.ReactUtils.forceUpdate(e.instance);
+ }
+ if (draggedChannel) {
+ let [children, index] = BDFDB.ReactUtils.findParent(e.returnvalue, {filter: child => BDFDB.ObjectUtils.get(child, "props.channel.id") == draggedChannel});
+ children.splice(index, 1);
+ }
+ if (this.hoveredChannel) {
+ let [children, index] = BDFDB.ReactUtils.findParent(e.returnvalue, {filter: child => BDFDB.ObjectUtils.get(child, "props.channel.id") == this.hoveredChannel});
+ children.splice(index + 1, 0, BDFDB.ReactUtils.createElement("div", {
+ className: BDFDB.disCNS.guildouter + BDFDB.disCN._pindmsrecentplaceholder,
+ children: BDFDB.ReactUtils.createElement("div", {
+ children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.GuildComponents.Items.DragPlaceholder, {})
})
- ].filter(n => n);
+ }));
}
}
- }}, {force: true, noCache: true});
+ }
+ else e.instance.props.unreadPrivateChannelIds = BDFDB.LibraryModules.DirectMessageUnreadStore.getUnreadPrivateChannelIds();
}
- }
- processUnreadDMs (e) {
- e.instance.props.pinnedPrivateChannelIds = [];
- let sortedRecents = this.sortAndUpdate("pinnedRecents");
- if (sortedRecents.length) {
- e.instance.props.unreadPrivateChannelIds = [];
- for (let pos in sortedRecents) {
- let id = sortedRecents[pos];
- if (e.instance.props.channels[id]) {
- if (!e.instance.props.pinnedPrivateChannelIds.includes(id)) e.instance.props.pinnedPrivateChannelIds.push(id);
- if (!e.instance.props.unreadPrivateChannelIds.includes(id)) e.instance.props.unreadPrivateChannelIds.push(id);
- }
- }
- e.instance.props.unreadPrivateChannelIds = e.instance.props.unreadPrivateChannelIds.concat(BDFDB.LibraryModules.DirectMessageUnreadStore.getUnreadPrivateChannelIds());
- if (e.returnvalue) {
- if (draggedChannel && releasedChannel) {
- let pinnedPrivateChannelIds = [].concat(e.instance.props.pinnedPrivateChannelIds), newData = {};
- BDFDB.ArrayUtils.remove(pinnedPrivateChannelIds, draggedChannel, true);
- pinnedPrivateChannelIds.splice(pinnedPrivateChannelIds.indexOf(releasedChannel) + 1, 0, draggedChannel);
- for (let pos in pinnedPrivateChannelIds) newData[pinnedPrivateChannelIds[pos]] = parseInt(pos);
- BDFDB.DataUtils.save(newData, this, "pinnedRecents");
- draggedChannel = null;
- releasedChannel = null;
- BDFDB.ReactUtils.forceUpdate(e.instance);
- }
- if (draggedChannel) {
- let [children, index] = BDFDB.ReactUtils.findParent(e.returnvalue, {filter: child => BDFDB.ReactUtils.getValue(child, "props.channel.id") == draggedChannel});
- children.splice(index, 1);
- }
- if (this.hoveredChannel) {
- let [children, index] = BDFDB.ReactUtils.findParent(e.returnvalue, {filter: child => BDFDB.ReactUtils.getValue(child, "props.channel.id") == this.hoveredChannel});
- children.splice(index + 1, 0, BDFDB.ReactUtils.createElement("div", {
- className: BDFDB.disCNS.guildouter + BDFDB.disCN._pindmsrecentplaceholder,
- children: BDFDB.ReactUtils.createElement("div", {
- children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.GuildComponents.Items.DragPlaceholder, {})
- })
- }));
+ processPrivateChannel (e) {
+ if (e.instance.props.channel) {
+ let category = this.getCategory(e.instance.props.channel.id, "dmCategories");
+ if (category) {
+ if (e.node) {
+ BDFDB.DOMUtils.addClass(e.node, BDFDB.disCN._pindmsdmchannelpinned);
+ e.node.removeEventListener("mousedown", e.node.PinDMsMouseDownListener);
+ if (!settings.sortInRecentOrder) {
+ e.node.setAttribute("draggable", false);
+ e.node.PinDMsMouseDownListener = event => {
+ if (!BDFDB.BDUtils.isPluginEnabled("PinDMs")) e.node.removeEventListener("mousedown", e.node.PinDMsMouseDownListener);
+ else {
+ 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);
+ draggedChannel = e.instance.props.channel.id;
+ this.updateContainer("dmCategories");
+ let dragPreview = this.createDragPreview(e.node, event2);
+ document.removeEventListener("mousemove", mousemove);
+ document.removeEventListener("mouseup", mouseup);
+ let dragging = event3 => {
+ this.updateDragPreview(dragPreview, event3);
+ let maybeHoveredChannel = null;
+ let categoryNode = BDFDB.DOMUtils.getParent(BDFDB.dotCN._pindmspinnedchannelsheadercontainer, event3.target);
+ if (categoryNode) {
+ let hoveredCategoryId = categoryNode.getAttribute("categoryid");
+ if (hoveredCategoryId && hoveredCategoryId == category.id) maybeHoveredChannel = "header_" + category.id;
+ }
+ else {
+ let placeholder = BDFDB.DOMUtils.getParent(BDFDB.dotCN._pindmsdmchannelplaceholder, event3.target);
+ maybeHoveredChannel = (BDFDB.ReactUtils.findValue(BDFDB.DOMUtils.getParent(BDFDB.dotCN._pindmsdmchannelpinned, placeholder ? placeholder.previousSibling : event3.target), "channel", {up: true}) || {}).id;
+ let maybeHoveredCategory = maybeHoveredChannel && this.getCategory(maybeHoveredChannel, "dmCategories");
+ if (!maybeHoveredCategory || maybeHoveredCategory.id != category.id) maybeHoveredChannel = null;
+ };
+ let update = maybeHoveredChannel != hoveredChannel;
+ if (maybeHoveredChannel) hoveredChannel = maybeHoveredChannel;
+ else hoveredChannel = null;
+ if (update) this.updateContainer("dmCategories");
+ };
+ let releasing = event3 => {
+ BDFDB.DOMUtils.remove(dragPreview);
+ if (hoveredChannel) releasedChannel = hoveredChannel;
+ else draggedChannel = null;
+ hoveredChannel = null;
+ this.updateContainer("dmCategories");
+ 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);
+ }
+ };
+ e.node.addEventListener("mousedown", e.node.PinDMsMouseDownListener);
+ }
+ }
+ if (e.returnvalue) e.returnvalue.props.children = [
+ BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TooltipContainer, {
+ text: BDFDB.LanguageUtils.LanguageStrings.UNPIN,
+ children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Clickable, {
+ className: BDFDB.disCN._pindmsunpinbutton,
+ onClick: event => {
+ BDFDB.ListenerUtils.stopEvent(event);
+ this.removeFromCategory(e.instance.props.channel.id, category, "dmCategories");
+ },
+ children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SvgIcon, {
+ className: BDFDB.disCN._pindmsunpinicon,
+ name: BDFDB.LibraryComponents.SvgIcon.Names.PIN
+ })
+ })
+ }),
+ e.returnvalue.props.children
+ ].flat(10).filter(n => n);
}
}
}
- else e.instance.props.unreadPrivateChannelIds = BDFDB.LibraryModules.DirectMessageUnreadStore.getUnreadPrivateChannelIds();
- }
- processPrivateChannel (e) {
- if (e.instance.props.channel) {
- let category = this.getCategory(e.instance.props.channel.id, "dmCategories");
- if (category) {
- if (e.node) {
- BDFDB.DOMUtils.addClass(e.node, BDFDB.disCN._pindmsdmchannelpinned);
- e.node.removeEventListener("mousedown", e.node.PinDMsMouseDownListener);
- if (!settings.sortInRecentOrder) {
- e.node.setAttribute("draggable", false);
- e.node.PinDMsMouseDownListener = event => {
- if (!BDFDB.BDUtils.isPluginEnabled("PinDMs")) e.node.removeEventListener("mousedown", e.node.PinDMsMouseDownListener);
- else {
- event = event.nativeEvent || event;
+ processDirectMessage (e) {
+ if (e.instance.props.channel) {
+ if (e.node && e.methodname == "componentDidMount") {
+ BDFDB.DOMUtils.removeClass(e.node, BDFDB.disCN._pindmsrecentpinned);
+ e.node.removeEventListener("contextmenu", e.node.PinDMsContextMenuListener);
+ e.node.PinDMsContextMenuListener = event => {BDFDB.DMUtils.openMenu(e.instance.props.channel.id, event);};
+ e.node.addEventListener("contextmenu", e.node.PinDMsContextMenuListener);
+ if (this.isPinned(e.instance.props.channel.id, "pinnedRecents")) {
+ BDFDB.DOMUtils.addClass(e.node, BDFDB.disCN._pindmsrecentpinned);
+ e.node.removeEventListener("mousedown", e.node.PinDMsMouseDownListener);
+ if (!settings.sortInRecentOrderGuild) {
+ for (let child of e.node.querySelectorAll("a")) child.setAttribute("draggable", false);
+ e.node.PinDMsMouseDownListener = 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);
draggedChannel = e.instance.props.channel.id;
- this.updateContainer("dmCategories");
+ BDFDB.PatchUtils.forceAllUpdates(this, "UnreadDMs");
let dragPreview = this.createDragPreview(e.node, event2);
document.removeEventListener("mousemove", mousemove);
document.removeEventListener("mouseup", mouseup);
let dragging = event3 => {
this.updateDragPreview(dragPreview, event3);
- let maybeHoveredChannel = null;
- let categoryNode = BDFDB.DOMUtils.getParent(BDFDB.dotCN._pindmspinnedchannelsheadercontainer, event3.target);
- if (categoryNode) {
- let hoveredCategoryId = categoryNode.getAttribute("categoryid");
- if (hoveredCategoryId && hoveredCategoryId == category.id) maybeHoveredChannel = "header_" + category.id;
- }
- else {
- let placeholder = BDFDB.DOMUtils.getParent(BDFDB.dotCN._pindmsdmchannelplaceholder, event3.target);
- maybeHoveredChannel = (BDFDB.ReactUtils.findValue(BDFDB.DOMUtils.getParent(BDFDB.dotCN._pindmsdmchannelpinned, placeholder ? placeholder.previousSibling : event3.target), "channel", {up: true}) || {}).id;
- let maybeHoveredCategory = maybeHoveredChannel && this.getCategory(maybeHoveredChannel, "dmCategories");
- if (!maybeHoveredCategory || maybeHoveredCategory.id != category.id) maybeHoveredChannel = null;
- };
+ let placeholder = BDFDB.DOMUtils.getParent(BDFDB.dotCN._pindmsrecentplaceholder, event3.target);
+ let maybeHoveredChannel = (BDFDB.ReactUtils.findValue(BDFDB.DOMUtils.getParent(BDFDB.dotCN._pindmsrecentpinned, placeholder ? placeholder.previousSibling : event3.target), "channel", {up: true}) || {}).id;
let update = maybeHoveredChannel != hoveredChannel;
if (maybeHoveredChannel) hoveredChannel = maybeHoveredChannel;
else hoveredChannel = null;
- if (update) this.updateContainer("dmCategories");
+ if (update) BDFDB.PatchUtils.forceAllUpdates(this, "UnreadDMs");
};
let releasing = event3 => {
BDFDB.DOMUtils.remove(dragPreview);
if (hoveredChannel) releasedChannel = hoveredChannel;
else draggedChannel = null;
hoveredChannel = null;
- this.updateContainer("dmCategories");
+ BDFDB.PatchUtils.forceAllUpdates(this, "UnreadDMs");
document.removeEventListener("mousemove", dragging);
document.removeEventListener("mouseup", releasing);
};
@@ -632,526 +696,443 @@ var PinDMs = (_ => {
};
document.addEventListener("mousemove", mousemove);
document.addEventListener("mouseup", mouseup);
- }
- };
- e.node.addEventListener("mousedown", e.node.PinDMsMouseDownListener);
- }
- }
- if (e.returnvalue) e.returnvalue.props.children = [
- BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TooltipContainer, {
- text: BDFDB.LanguageUtils.LanguageStrings.UNPIN,
- children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Clickable, {
- className: BDFDB.disCN._pindmsunpinbutton,
- onClick: event => {
- BDFDB.ListenerUtils.stopEvent(event);
- this.removeFromCategory(e.instance.props.channel.id, category, "dmCategories");
- },
- children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SvgIcon, {
- className: BDFDB.disCN._pindmsunpinicon,
- name: BDFDB.LibraryComponents.SvgIcon.Names.PIN
- })
- })
- }),
- e.returnvalue.props.children
- ].flat(10).filter(n => n);
- }
- }
- }
-
- processDirectMessage (e) {
- if (e.instance.props.channel) {
- if (e.node && e.methodname == "componentDidMount") {
- BDFDB.DOMUtils.removeClass(e.node, BDFDB.disCN._pindmsrecentpinned);
- e.node.removeEventListener("contextmenu", e.node.PinDMsContextMenuListener);
- e.node.PinDMsContextMenuListener = event => {BDFDB.DMUtils.openMenu(e.instance.props.channel.id, event);};
- e.node.addEventListener("contextmenu", e.node.PinDMsContextMenuListener);
- if (this.isPinned(e.instance.props.channel.id, "pinnedRecents")) {
- BDFDB.DOMUtils.addClass(e.node, BDFDB.disCN._pindmsrecentpinned);
- e.node.removeEventListener("mousedown", e.node.PinDMsMouseDownListener);
- if (!settings.sortInRecentOrderGuild) {
- for (let child of e.node.querySelectorAll("a")) child.setAttribute("draggable", false);
- e.node.PinDMsMouseDownListener = 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);
- draggedChannel = e.instance.props.channel.id;
- BDFDB.ModuleUtils.forceAllUpdates(this, "UnreadDMs");
- let dragPreview = this.createDragPreview(e.node, event2);
- document.removeEventListener("mousemove", mousemove);
- document.removeEventListener("mouseup", mouseup);
- let dragging = event3 => {
- this.updateDragPreview(dragPreview, event3);
- let placeholder = BDFDB.DOMUtils.getParent(BDFDB.dotCN._pindmsrecentplaceholder, event3.target);
- let maybeHoveredChannel = (BDFDB.ReactUtils.findValue(BDFDB.DOMUtils.getParent(BDFDB.dotCN._pindmsrecentpinned, placeholder ? placeholder.previousSibling : event3.target), "channel", {up: true}) || {}).id;
- let update = maybeHoveredChannel != hoveredChannel;
- if (maybeHoveredChannel) hoveredChannel = maybeHoveredChannel;
- else hoveredChannel = null;
- if (update) BDFDB.ModuleUtils.forceAllUpdates(this, "UnreadDMs");
- };
- let releasing = event3 => {
- BDFDB.DOMUtils.remove(dragPreview);
- if (hoveredChannel) releasedChannel = hoveredChannel;
- else draggedChannel = null;
- hoveredChannel = null;
- BDFDB.ModuleUtils.forceAllUpdates(this, "UnreadDMs");
- 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);
- };
- e.node.addEventListener("mousedown", e.node.PinDMsMouseDownListener);
+ e.node.addEventListener("mousedown", e.node.PinDMsMouseDownListener);
+ }
}
}
- }
- if (e.node && e.methodname == "componentWillUnmount") {
- BDFDB.ModuleUtils.forceAllUpdates(this, "PrivateChannelsList");
- }
- if (e.returnvalue && this.isPinned(e.instance.props.channel.id, "pinnedRecents") && settings.showPinIcon) {
- let [children, index] = BDFDB.ReactUtils.findParent(e.returnvalue, {name:"BlobMask"});
- if (index > -1) children[index].props.upperLeftBadge = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Badges.IconBadge, {
- className: BDFDB.disCN.guildiconbadge,
- disableColor: true,
- style: {transform: "scale(-1, 1)"},
- icon: BDFDB.LibraryComponents.SvgIcon.Names.NOVA_PIN
- });
+ if (e.node && e.methodname == "componentWillUnmount") {
+ BDFDB.PatchUtils.forceAllUpdates(this, "PrivateChannelsList");
+ }
+ if (e.returnvalue && this.isPinned(e.instance.props.channel.id, "pinnedRecents") && settings.showPinIcon) {
+ let [children, index] = BDFDB.ReactUtils.findParent(e.returnvalue, {name:"BlobMask"});
+ if (index > -1) children[index].props.upperLeftBadge = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Badges.IconBadge, {
+ className: BDFDB.disCN.guildiconbadge,
+ disableColor: true,
+ style: {transform: "scale(-1, 1)"},
+ icon: BDFDB.LibraryComponents.SvgIcon.Names.NOVA_PIN
+ });
+ }
}
}
- }
- generateID (type) {
- if (!type) return null;
- let categories = BDFDB.DataUtils.load(this, type);
- let id = Math.round(Math.random() * 10000000000000000);
- return categories[id] ? this.generateID() : id;
- }
-
- filterDMs (dms) {
- return dms.filter(id => BDFDB.LibraryModules.ChannelStore.getChannel(id));
- }
+ generateID (type) {
+ if (!type) return null;
+ let categories = BDFDB.DataUtils.load(this, type);
+ let id = Math.round(Math.random() * 10000000000000000);
+ return categories[id] ? this.generateID() : id;
+ }
+
+ filterDMs (dms) {
+ return dms.filter(id => BDFDB.LibraryModules.ChannelStore.getChannel(id));
+ }
- addToCategory (id, category, type) {
- if (!id || !category || !type) return;
- let wasEmpty = !this.filterDMs(category.dms).length;
- if (!category.dms.includes(id)) category.dms.unshift(id);
- if (wasEmpty && category.dms.length) category.collapsed = false;
- BDFDB.DataUtils.save(category, this, type, category.id);
- this.updateContainer(type);
- }
+ addToCategory (id, category, type) {
+ if (!id || !category || !type) return;
+ let wasEmpty = !this.filterDMs(category.dms).length;
+ if (!category.dms.includes(id)) category.dms.unshift(id);
+ if (wasEmpty && category.dms.length) category.collapsed = false;
+ BDFDB.DataUtils.save(category, this, type, category.id);
+ this.updateContainer(type);
+ }
- removeFromCategory (id, category, type) {
- if (!id || !category || !type) return;
- BDFDB.ArrayUtils.remove(category.dms, id, true);
- if (!this.filterDMs(category.dms).length) category.collapsed = true;
- BDFDB.DataUtils.save(category, this, type, category.id);
- this.updateContainer(type);
- }
+ removeFromCategory (id, category, type) {
+ if (!id || !category || !type) return;
+ BDFDB.ArrayUtils.remove(category.dms, id, true);
+ if (!this.filterDMs(category.dms).length) category.collapsed = true;
+ BDFDB.DataUtils.save(category, this, type, category.id);
+ this.updateContainer(type);
+ }
- getCategory (id, type) {
- if (!id || !type) return null;
- let categories = BDFDB.DataUtils.load(this, type);
- for (let catId in categories) if (categories[catId].dms.includes(id)) return categories[catId];
- return null;
- }
+ getCategory (id, type) {
+ if (!id || !type) return null;
+ let categories = BDFDB.DataUtils.load(this, type);
+ for (let catId in categories) if (categories[catId].dms.includes(id)) return categories[catId];
+ return null;
+ }
- sortAndUpdateCategories (type, reverse) {
- let data = BDFDB.ObjectUtils.sort(BDFDB.DataUtils.load(this, type), "pos"), newData = {};
- let sorted = [], pos = 0, sort = id => {
- if (sorted[pos] === undefined) {
- newData[id] = Object.assign({}, data[id], {pos});
- sorted[pos] = newData[id];
- }
- else {
- pos++;
- sort(id);
+ sortAndUpdateCategories (type, reverse) {
+ let data = BDFDB.ObjectUtils.sort(BDFDB.DataUtils.load(this, type), "pos"), newData = {};
+ let sorted = [], pos = 0, sort = id => {
+ if (sorted[pos] === undefined) {
+ newData[id] = Object.assign({}, data[id], {pos});
+ sorted[pos] = newData[id];
+ }
+ else {
+ pos++;
+ sort(id);
+ }
+ };
+ for (let id in data) sort(id);
+ if (!BDFDB.equals(data, newData)) BDFDB.DataUtils.save(newData, this, type);
+ return (reverse ? sorted.reverse() : sorted).filter(n => n);
+ }
+
+ sortDMsByTime (dms, type) {
+ if (dms.length > 1 && settings[type == "dmCategories" ? "sortInRecentOrder" : "sortInRecentOrderGuild"]) {
+ let timestamps = BDFDB.LibraryModules.DirectMessageStore.getPrivateChannelIds().reduce((newObj, channelId) => (newObj[channelId] = BDFDB.LibraryModules.UnreadChannelUtils.lastMessageId(channelId), newObj), {});
+ return [].concat(dms).sort(function (x, y) {return timestamps[x] > timestamps[y] ? -1 : timestamps[x] < timestamps[y] ? 1 : 0;});
}
- };
- for (let id in data) sort(id);
- if (!BDFDB.equals(data, newData)) BDFDB.DataUtils.save(newData, this, type);
- return (reverse ? sorted.reverse() : sorted).filter(n => n);
- }
-
- sortDMsByTime (dms, type) {
- if (dms.length > 1 && settings[type == "dmCategories" ? "sortInRecentOrder" : "sortInRecentOrderGuild"]) {
- let timestamps = BDFDB.LibraryModules.DirectMessageStore.getPrivateChannelIds().reduce((newObj, channelId) => (newObj[channelId] = BDFDB.LibraryModules.UnreadChannelUtils.lastMessageId(channelId), newObj), {});
- return [].concat(dms).sort(function (x, y) {return timestamps[x] > timestamps[y] ? -1 : timestamps[x] < timestamps[y] ? 1 : 0;});
+ else return dms;
}
- else return dms;
- }
-
- openCategorySettingsModal (data, type, isNew) {
- if (BDFDB.ObjectUtils.is(data) && type) BDFDB.ModalUtils.open(this, {
- size: "MEDIUM",
- header: BDFDB.LanguageUtils.LanguageStrings.CATEGORY_SETTINGS,
- subheader: data.name,
- children: [
- BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormItem, {
- title: BDFDB.LanguageUtils.LanguageStrings.CATEGORY_NAME,
- className: BDFDB.disCN.marginbottom20 + " input-categoryname",
- children: [
- BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TextInput, {
- value: data.name,
- placeholder: data.name,
- autoFocus: true
- }),
- BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormDivider, {
- className: BDFDB.disCN.dividerdefault
- })
- ]
- }),
- 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.color,
- number: 1
- })
- ]
- })
- ],
- buttons: [{
- contents: isNew ? BDFDB.LanguageUtils.LanguageStrings.CREATE : BDFDB.LanguageUtils.LanguageStrings.SAVE,
- color: "BRAND",
- close: true,
- click: modal => {
- data.name = modal.querySelector(".input-categoryname " + BDFDB.dotCN.input).value.trim() || data.name;
+
+ openCategorySettingsModal (data, type, isNew) {
+ if (BDFDB.ObjectUtils.is(data) && type) BDFDB.ModalUtils.open(this, {
+ size: "MEDIUM",
+ header: BDFDB.LanguageUtils.LanguageStrings.CATEGORY_SETTINGS,
+ subheader: data.name,
+ children: [
+ BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormItem, {
+ title: BDFDB.LanguageUtils.LanguageStrings.CATEGORY_NAME,
+ className: BDFDB.disCN.marginbottom20 + " input-categoryname",
+ children: [
+ BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TextInput, {
+ value: data.name,
+ placeholder: data.name,
+ autoFocus: true
+ }),
+ BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormDivider, {
+ className: BDFDB.disCN.dividerdefault
+ })
+ ]
+ }),
+ 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.color,
+ number: 1
+ })
+ ]
+ })
+ ],
+ buttons: [{
+ contents: isNew ? BDFDB.LanguageUtils.LanguageStrings.CREATE : BDFDB.LanguageUtils.LanguageStrings.SAVE,
+ color: "BRAND",
+ close: true,
+ click: modal => {
+ data.name = modal.querySelector(".input-categoryname " + BDFDB.dotCN.input).value.trim() || data.name;
- data.color = BDFDB.ColorUtils.getSwatchColor(modal, 1);
- if (data.color != null && !BDFDB.ObjectUtils.is(data.color)) {
- if (data.color[0] < 30 && data.color[1] < 30 && data.color[2] < 30) data.color = BDFDB.ColorUtils.change(data.color, 30);
- else if (data.color[0] > 225 && data.color[1] > 225 && data.color[2] > 225) data.color = BDFDB.ColorUtils.change(data.color, -30);
+ data.color = BDFDB.ColorUtils.getSwatchColor(modal, 1);
+ if (data.color != null && !BDFDB.ObjectUtils.is(data.color)) {
+ if (data.color[0] < 30 && data.color[1] < 30 && data.color[2] < 30) data.color = BDFDB.ColorUtils.change(data.color, 30);
+ else if (data.color[0] > 225 && data.color[1] > 225 && data.color[2] > 225) data.color = BDFDB.ColorUtils.change(data.color, -30);
+ }
+
+ BDFDB.DataUtils.save(data, this, type, data.id);
+
+ this.updateContainer(type);
}
-
- BDFDB.DataUtils.save(data, this, type, data.id);
-
- this.updateContainer(type);
- }
- }]
- });
- }
-
- addPin (newid, type) {
- if (!newid) return;
- let pinnedDMs = BDFDB.DataUtils.load(this, type);
- for (let id in pinnedDMs) pinnedDMs[id] = pinnedDMs[id] + 1;
- pinnedDMs[newid] = 0;
- BDFDB.DataUtils.save(pinnedDMs, this, type);
- this.updateContainer(type);
- }
-
- removePin (id, type) {
- if (!id) return;
- BDFDB.DataUtils.remove(this, type, id);
- this.updateContainer(type);
- }
-
- isPinned (id, type) {
- return BDFDB.DataUtils.load(this, type, id) != undefined;
- }
-
- updateContainer (type) {
- switch (type) {
- case "dmCategories":
- BDFDB.ModuleUtils.forceAllUpdates(this, "PrivateChannelsList");
- break;
- case "pinnedRecents":
- BDFDB.ModuleUtils.forceAllUpdates(this, "UnreadDMs");
- break;
+ }]
+ });
}
- }
- sortAndUpdate (type) {
- let data = BDFDB.DataUtils.load(this, type), newData = {};
- delete data[""];
- delete data["null"];
- let sortedDMs = [], existingDMs = [], sortDM = (id, pos) => {
- if (sortedDMs[pos] === undefined) sortedDMs[pos] = id;
- else sortDM(id, pos + 1);
- };
- for (let id in data) sortDM(id, data[id]);
- sortedDMs = sortedDMs.filter(n => n);
- for (let pos in sortedDMs) {
- newData[sortedDMs[pos]] = parseInt(pos);
- if (BDFDB.LibraryModules.ChannelStore.getChannel(sortedDMs[pos])) existingDMs.push(sortedDMs[pos]);
+ addPin (newid, type) {
+ if (!newid) return;
+ let pinnedDMs = BDFDB.DataUtils.load(this, type);
+ for (let id in pinnedDMs) pinnedDMs[id] = pinnedDMs[id] + 1;
+ pinnedDMs[newid] = 0;
+ BDFDB.DataUtils.save(pinnedDMs, this, type);
+ this.updateContainer(type);
}
- if (!BDFDB.equals(data, newData)) BDFDB.DataUtils.save(newData, this, type);
- return this.sortDMsByTime(existingDMs, type);
- }
- forceUpdateAll () {
- settings = BDFDB.DataUtils.get(this, "settings");
+ removePin (id, type) {
+ if (!id) return;
+ BDFDB.DataUtils.remove(this, type, id);
+ this.updateContainer(type);
+ }
- BDFDB.ReactUtils.forceUpdate(BDFDB.ReactUtils.findOwner(document.querySelector(BDFDB.dotCN.app), {name:"FluxContainer(PrivateChannels)", all:true, unlimited:true}));
- BDFDB.ModuleUtils.forceAllUpdates(this);
- }
+ isPinned (id, type) {
+ return BDFDB.DataUtils.load(this, type, id) != undefined;
+ }
+
+ updateContainer (type) {
+ switch (type) {
+ case "dmCategories":
+ BDFDB.PatchUtils.forceAllUpdates(this, "PrivateChannelsList");
+ break;
+ case "pinnedRecents":
+ BDFDB.PatchUtils.forceAllUpdates(this, "UnreadDMs");
+ break;
+ }
+ }
- createDragPreview (div, event) {
- if (!Node.prototype.isPrototypeOf(div)) return;
- let dragPreview = div.cloneNode(true);
- BDFDB.DOMUtils.addClass(dragPreview, BDFDB.disCN._pindmsdragpreview);
- BDFDB.DOMUtils.remove(dragPreview.querySelector(BDFDB.dotCNC.guildlowerbadge + BDFDB.dotCNC.guildupperbadge + BDFDB.dotCN.guildpillwrapper));
- document.querySelector(BDFDB.dotCN.appmount).appendChild(dragPreview);
- let rects = BDFDB.DOMUtils.getRects(dragPreview);
- BDFDB.DOMUtils.hide(dragPreview);
- dragPreview.style.setProperty("pointer-events", "none", "important");
- dragPreview.style.setProperty("left", event.clientX - (rects.width/2) + "px", "important");
- dragPreview.style.setProperty("top", event.clientY - (rects.height/2) + "px", "important");
- return dragPreview;
- }
+ sortAndUpdate (type) {
+ let data = BDFDB.DataUtils.load(this, type), newData = {};
+ delete data[""];
+ delete data["null"];
+ let sortedDMs = [], existingDMs = [], sortDM = (id, pos) => {
+ if (sortedDMs[pos] === undefined) sortedDMs[pos] = id;
+ else sortDM(id, pos + 1);
+ };
+ for (let id in data) sortDM(id, data[id]);
+ sortedDMs = sortedDMs.filter(n => n);
+ for (let pos in sortedDMs) {
+ newData[sortedDMs[pos]] = parseInt(pos);
+ if (BDFDB.LibraryModules.ChannelStore.getChannel(sortedDMs[pos])) existingDMs.push(sortedDMs[pos]);
+ }
+ if (!BDFDB.equals(data, newData)) BDFDB.DataUtils.save(newData, this, type);
+ return this.sortDMsByTime(existingDMs, type);
+ }
- updateDragPreview (dragPreview, event) {
- if (!Node.prototype.isPrototypeOf(dragPreview)) return;
- BDFDB.DOMUtils.show(dragPreview);
- let rects = BDFDB.DOMUtils.getRects(dragPreview);
- dragPreview.style.setProperty("left", event.clientX - (rects.width/2) + "px", "important");
- dragPreview.style.setProperty("top", event.clientY - (rects.height/2) + "px", "important");
- }
+ createDragPreview (div, event) {
+ if (!Node.prototype.isPrototypeOf(div)) return;
+ let dragPreview = div.cloneNode(true);
+ BDFDB.DOMUtils.addClass(dragPreview, BDFDB.disCN._pindmsdragpreview);
+ BDFDB.DOMUtils.remove(dragPreview.querySelector(BDFDB.dotCNC.guildlowerbadge + BDFDB.dotCNC.guildupperbadge + BDFDB.dotCN.guildpillwrapper));
+ document.querySelector(BDFDB.dotCN.appmount).appendChild(dragPreview);
+ let rects = BDFDB.DOMUtils.getRects(dragPreview);
+ BDFDB.DOMUtils.hide(dragPreview);
+ dragPreview.style.setProperty("pointer-events", "none", "important");
+ dragPreview.style.setProperty("left", event.clientX - (rects.width/2) + "px", "important");
+ dragPreview.style.setProperty("top", event.clientY - (rects.height/2) + "px", "important");
+ return dragPreview;
+ }
- setLabelsByLanguage () {
- switch (BDFDB.LanguageUtils.getLanguage().id) {
- case "hr": //croatian
- return {
- context_pindm_text: "Prikljucite Izravnu Poruku",
- context_pinchannel_text: "Priložite popisu kanala",
- context_unpinchannel_text: "Ukloni s popisa kanala",
- context_addtonewcategory_text: "Dodavanje u novu kategoriju",
- context_pinguild_text: "Priložite popisu poslužitelja",
- context_unpinguild_text: "Ukloni s popisa poslužitelja",
- header_pinneddms_text: "Prikvačene Izravne Poruke",
- modal_colorpicker1_text: "Boja kategorije"
- };
- case "da": //danish
- return {
- context_pindm_text: "Fastgør PB",
- context_pinchannel_text: "Vedhæft til kanalliste",
- context_unpinchannel_text: "Fjern fra kanalliste",
- context_addtonewcategory_text: "Føj til ny kategori",
- context_pinguild_text: "Vedhæft til serverliste",
- context_unpinguild_text: "Fjern fra serverliste",
- header_pinneddms_text: "Pinned Privat Beskeder",
- modal_colorpicker1_text: "Kategori farve"
- };
- case "de": //german
- return {
- context_pindm_text: "Direktnachricht anheften",
- context_pinchannel_text: "An Kanalliste anheften",
- context_unpinchannel_text: "Von Kanalliste loslösen",
- context_addtonewcategory_text: "Zur neuen Kategorie hinzufügen",
- context_pinguild_text: "An Serverliste anheften",
- context_unpinguild_text: "Von Serverliste loslösen",
- header_pinneddms_text: "Gepinnte Direktnachrichten",
- modal_colorpicker1_text: "Kategoriefarbe"
- };
- case "es": //spanish
- return {
- context_pindm_text: "Anclar MD",
- context_pinchannel_text: "Adjuntar a la lista de canales",
- context_unpinchannel_text: "Deshazte de la lista de canales",
- context_addtonewcategory_text: "Agregar a nueva categoría",
- context_pinguild_text: "Adjuntar a la lista de servidores",
- context_unpinguild_text: "Deshazte de la lista de servidores",
- header_pinneddms_text: "Mensajes Directos Fijados",
- modal_colorpicker1_text: "Color de la categoría"
- };
- case "fr": //french
- return {
- context_pindm_text: "Épingler MP",
- context_pinchannel_text: "Épingler à la liste des salons",
- context_unpinchannel_text: "Détacher de la liste des salons",
- context_addtonewcategory_text: "Ajouter à une nouvelle catégorie",
- context_pinguild_text: "Épingler à la liste de serveurs",
- context_unpinguild_text: "Détacher de la liste de serveurs",
- header_pinneddms_text: "Messages Prives Épinglés",
- modal_colorpicker1_text: "Couleur de la catégorie"
- };
- case "it": //italian
- return {
- context_pindm_text: "Fissa il messaggio diretto",
- context_pinchannel_text: "Allega alla lista dei canali",
- context_unpinchannel_text: "Rimuovi dalla lista dei canali",
- context_addtonewcategory_text: "Aggiungi a nuova categoria",
- context_pinguild_text: "Allega alla lista dei server",
- context_unpinguild_text: "Rimuovi dalla lista dei server",
- header_pinneddms_text: "Messaggi Diretti Aggiunti",
- modal_colorpicker1_text: "Colore della categoria"
- };
- case "nl": //dutch
- return {
- context_pindm_text: "PB pinnen",
- context_pinchannel_text: "Pin naar de kanalenlijst",
- context_unpinchannel_text: "Losmaken van kanalenlijst",
- context_addtonewcategory_text: "Toevoegen aan nieuwe categorie",
- context_pinguild_text: "Pin naar de serverlijst",
- context_unpinguild_text: "Losmaken van serverlijst",
- header_pinneddms_text: "Vastgezette Persoonluke Berichten",
- modal_colorpicker1_text: "Categorie kleur"
- };
- case "no": //norwegian
- return {
- context_pindm_text: "Fest DM",
- context_pinchannel_text: "Fest på kanalliste",
- context_unpinchannel_text: "Fjern fra kanalliste",
- context_addtonewcategory_text: "Legg til i ny kategori",
- context_pinguild_text: "Fest på serverliste",
- context_unpinguild_text: "Fjern fra serverlisten",
- header_pinneddms_text: "Pinned Direktemeldinger",
- modal_colorpicker1_text: "Kategorifarge"
- };
- case "pl": //polish
- return {
- context_pindm_text: "Przypnij PW",
- context_pinchannel_text: "Dołącz do listy kanałów",
- context_unpinchannel_text: "Usuń z listy kanałów",
- context_addtonewcategory_text: "Dodaj do nowej kategorii",
- context_pinguild_text: "Dołącz do listy serwerów",
- context_unpinguild_text: "Usuń z listy serwerów",
- header_pinneddms_text: "Prywatne Wiadomości Bezpośrednie",
- modal_colorpicker1_text: "Kolor kategorii"
- };
- case "pt-BR": //portuguese (brazil)
- return {
- context_pindm_text: "Fixar MD",
- context_pinchannel_text: "Anexar à lista de canais",
- context_unpinchannel_text: "Remover da lista de canais",
- context_addtonewcategory_text: "Adicionar à nova categoria",
- context_pinguild_text: "Anexar à lista de servidores",
- context_unpinguild_text: "Remover da lista de servidores",
- header_pinneddms_text: "Mensagens diretas fixadas",
- modal_colorpicker1_text: "Cor da categoria"
- };
- case "fi": //finnish
- return {
- context_pindm_text: "Kiinnitä yksityisviestit",
- context_pinchannel_text: "Liitä kanavaluetteloon",
- context_unpinchannel_text: "Poista kanavaluettelosta",
- context_addtonewcategory_text: "Lisää uuteen luokkaan",
- context_pinguild_text: "Liitä palvelinluetteloon",
- context_unpinguild_text: "Poista palvelinluettelosta",
- header_pinneddms_text: "Liitetyt yksityisviestit",
- modal_colorpicker1_text: "Luokan väri"
- };
- case "sv": //swedish
- return {
- context_pindm_text: "Fäst DM",
- context_pinchannel_text: "Fäst till kanallista",
- context_unpinchannel_text: "Ta bort från kanallistan",
- context_addtonewcategory_text: "Lägg till i ny kategori",
- context_pinguild_text: "Fäst till servernlista",
- context_unpinguild_text: "Ta bort från servernlista",
- header_pinneddms_text: "Inlagda Direktmeddelanden",
- modal_colorpicker1_text: "Kategori färg"
- };
- case "tr": //turkish
- return {
- context_pindm_text: "DM'yi Sabitle",
- context_pinchannel_text: "Kanal listesine ekle",
- context_unpinchannel_text: "Kanal listesinden kaldır",
- context_addtonewcategory_text: "Yeni kategoriye ekle",
- context_pinguild_text: "Sunucu listesine ekle",
- context_unpinguild_text: "Sunucu listesinden kaldır",
- header_pinneddms_text: "Direkt Mesajlar Sabitleyin",
- modal_colorpicker1_text: "Kategori rengi"
- };
- case "cs": //czech
- return {
- context_pindm_text: "Připnout PZ",
- context_pinchannel_text: "Připojení k seznamu kanálů",
- context_unpinchannel_text: "Odstranit ze seznamu kanálů",
- context_addtonewcategory_text: "Přidat do nové kategorie",
- context_pinguild_text: "Připojit ke seznamu serverů",
- context_unpinguild_text: "Odstranit ze seznamu serverů",
- header_pinneddms_text: "Připojené Přímá Zpráva",
- modal_colorpicker1_text: "Barva kategorie"
- };
- case "bg": //bulgarian
- return {
- context_pindm_text: "Закачени ДС",
- context_pinchannel_text: "Прикачете към списъка с канали",
- context_unpinchannel_text: "Премахване от списъка с канали",
- context_addtonewcategory_text: "Добавяне към нова категория",
- context_pinguild_text: "Прикачване към списъка със сървъри",
- context_unpinguild_text: "Премахване от списъка със сървъри",
- header_pinneddms_text: "Свързани директни съобщения",
- modal_colorpicker1_text: "Цвят на категорията"
- };
- case "ru": //russian
- return {
- context_pindm_text: "Закрепить ЛС",
- context_pinchannel_text: "Прикрепить к списку каналов",
- context_unpinchannel_text: "Удалить из списка каналов",
- context_addtonewcategory_text: "Добавить в новую категорию",
- context_pinguild_text: "Присоединить к списку серверов",
- context_unpinguild_text: "Удалить из списка серверов",
- header_pinneddms_text: "Прикрепленные Личные Сообщения",
- modal_colorpicker1_text: "Цвет категории"
- };
- case "uk": //ukrainian
- return {
- context_pindm_text: "Закріпити ОП",
- context_pinchannel_text: "Додайте до списку каналів",
- context_unpinchannel_text: "Видалити зі списку каналів",
- context_addtonewcategory_text: "Додати до нової категорії",
- context_pinguild_text: "Додайте до списку серверів",
- context_unpinguild_text: "Видалити зі списку серверів",
- header_pinneddms_text: "Прикріплені oсобисті повідомлення",
- modal_colorpicker1_text: "Колір категорії"
- };
- case "ja": //japanese
- return {
- context_pindm_text: "DMピン",
- context_pinchannel_text: "チャンネルリストに添付",
- context_unpinchannel_text: "チャンネルリストから削除",
- context_addtonewcategory_text: "新しいカテゴリに追加",
- context_pinguild_text: "サーバーリストに添付",
- context_unpinguild_text: "サーバーリストから削除",
- header_pinneddms_text: "固定された直接メッセージ",
- modal_colorpicker1_text: "カテゴリーの色"
- };
- case "zh-TW": //chinese (traditional)
- return {
- context_pindm_text: "引腳直接留言",
- context_pinchannel_text: "附加到頻道列表",
- context_unpinchannel_text: "從頻道列表中刪除",
- context_addtonewcategory_text: "添加到新類別",
- context_pinguild_text: "附加到服務器列表",
- context_unpinguild_text: "從服務器列表中刪除",
- header_pinneddms_text: "固定私人信息",
- modal_colorpicker1_text: "類別顏色"
- };
- case "ko": //korean
- return {
- context_pindm_text: "비공개 메시지 고정",
- context_pinchannel_text: "채널 목록에 첨부",
- context_unpinchannel_text: "채널 목록에서 삭제",
- context_addtonewcategory_text: "새 카테고리에 추가",
- context_pinguild_text: "서버 목록에 첨부",
- context_unpinguild_text: "서버 목록에서 제거",
- header_pinneddms_text: "고정 된 비공개 메시지",
- modal_colorpicker1_text: "카테고리 색상"
- };
- default: //default: english
- return {
- context_pindm_text: "Pin DM",
- context_pinchannel_text: "Pin to Channellist",
- context_unpinchannel_text: "Unpin from Channellist",
- context_addtonewcategory_text: "Add to new Category",
- context_pinguild_text: "Pin to Serverlist",
- context_unpinguild_text: "Unpin from Serverlist",
- header_pinneddms_text: "Pinned Direct Messages",
- modal_colorpicker1_text: "Categorycolor"
- };
+ updateDragPreview (dragPreview, event) {
+ if (!Node.prototype.isPrototypeOf(dragPreview)) return;
+ BDFDB.DOMUtils.show(dragPreview);
+ let rects = BDFDB.DOMUtils.getRects(dragPreview);
+ dragPreview.style.setProperty("left", event.clientX - (rects.width/2) + "px", "important");
+ dragPreview.style.setProperty("top", event.clientY - (rects.height/2) + "px", "important");
}
- }
- }
-})();
-module.exports = PinDMs; \ No newline at end of file
+ setLabelsByLanguage () {
+ switch (BDFDB.LanguageUtils.getLanguage().id) {
+ case "hr": //croatian
+ return {
+ context_pindm_text: "Prikljucite Izravnu Poruku",
+ context_pinchannel_text: "Priložite popisu kanala",
+ context_unpinchannel_text: "Ukloni s popisa kanala",
+ context_addtonewcategory_text: "Dodavanje u novu kategoriju",
+ context_pinguild_text: "Priložite popisu poslužitelja",
+ context_unpinguild_text: "Ukloni s popisa poslužitelja",
+ header_pinneddms_text: "Prikvačene Izravne Poruke",
+ modal_colorpicker1_text: "Boja kategorije"
+ };
+ case "da": //danish
+ return {
+ context_pindm_text: "Fastgør PB",
+ context_pinchannel_text: "Vedhæft til kanalliste",
+ context_unpinchannel_text: "Fjern fra kanalliste",
+ context_addtonewcategory_text: "Føj til ny kategori",
+ context_pinguild_text: "Vedhæft til serverliste",
+ context_unpinguild_text: "Fjern fra serverliste",
+ header_pinneddms_text: "Pinned Privat Beskeder",
+ modal_colorpicker1_text: "Kategori farve"
+ };
+ case "de": //german
+ return {
+ context_pindm_text: "Direktnachricht anheften",
+ context_pinchannel_text: "An Kanalliste anheften",
+ context_unpinchannel_text: "Von Kanalliste loslösen",
+ context_addtonewcategory_text: "Zur neuen Kategorie hinzufügen",
+ context_pinguild_text: "An Serverliste anheften",
+ context_unpinguild_text: "Von Serverliste loslösen",
+ header_pinneddms_text: "Gepinnte Direktnachrichten",
+ modal_colorpicker1_text: "Kategoriefarbe"
+ };
+ case "es": //spanish
+ return {
+ context_pindm_text: "Anclar MD",
+ context_pinchannel_text: "Adjuntar a la lista de canales",
+ context_unpinchannel_text: "Deshazte de la lista de canales",
+ context_addtonewcategory_text: "Agregar a nueva categoría",
+ context_pinguild_text: "Adjuntar a la lista de servidores",
+ context_unpinguild_text: "Deshazte de la lista de servidores",
+ header_pinneddms_text: "Mensajes Directos Fijados",
+ modal_colorpicker1_text: "Color de la categoría"
+ };
+ case "fr": //french
+ return {
+ context_pindm_text: "Épingler MP",
+ context_pinchannel_text: "Épingler à la liste des salons",
+ context_unpinchannel_text: "Détacher de la liste des salons",
+ context_addtonewcategory_text: "Ajouter à une nouvelle catégorie",
+ context_pinguild_text: "Épingler à la liste de serveurs",
+ context_unpinguild_text: "Détacher de la liste de serveurs",
+ header_pinneddms_text: "Messages Prives Épinglés",
+ modal_colorpicker1_text: "Couleur de la catégorie"
+ };
+ case "it": //italian
+ return {
+ context_pindm_text: "Fissa il messaggio diretto",
+ context_pinchannel_text: "Allega alla lista dei canali",
+ context_unpinchannel_text: "Rimuovi dalla lista dei canali",
+ context_addtonewcategory_text: "Aggiungi a nuova categoria",
+ context_pinguild_text: "Allega alla lista dei server",
+ context_unpinguild_text: "Rimuovi dalla lista dei server",
+ header_pinneddms_text: "Messaggi Diretti Aggiunti",
+ modal_colorpicker1_text: "Colore della categoria"
+ };
+ case "nl": //dutch
+ return {
+ context_pindm_text: "PB pinnen",
+ context_pinchannel_text: "Pin naar de kanalenlijst",
+ context_unpinchannel_text: "Losmaken van kanalenlijst",
+ context_addtonewcategory_text: "Toevoegen aan nieuwe categorie",
+ context_pinguild_text: "Pin naar de serverlijst",
+ context_unpinguild_text: "Losmaken van serverlijst",
+ header_pinneddms_text: "Vastgezette Persoonluke Berichten",
+ modal_colorpicker1_text: "Categorie kleur"
+ };
+ case "no": //norwegian
+ return {
+ context_pindm_text: "Fest DM",
+ context_pinchannel_text: "Fest på kanalliste",
+ context_unpinchannel_text: "Fjern fra kanalliste",
+ context_addtonewcategory_text: "Legg til i ny kategori",
+ context_pinguild_text: "Fest på serverliste",
+ context_unpinguild_text: "Fjern fra serverlisten",
+ header_pinneddms_text: "Pinned Direktemeldinger",
+ modal_colorpicker1_text: "Kategorifarge"
+ };
+ case "pl": //polish
+ return {
+ context_pindm_text: "Przypnij PW",
+ context_pinchannel_text: "Dołącz do listy kanałów",
+ context_unpinchannel_text: "Usuń z listy kanałów",
+ context_addtonewcategory_text: "Dodaj do nowej kategorii",
+ context_pinguild_text: "Dołącz do listy serwerów",
+ context_unpinguild_text: "Usuń z listy serwerów",
+ header_pinneddms_text: "Prywatne Wiadomości Bezpośrednie",
+ modal_colorpicker1_text: "Kolor kategorii"
+ };
+ case "pt-BR": //portuguese (brazil)
+ return {
+ context_pindm_text: "Fixar MD",
+ context_pinchannel_text: "Anexar à lista de canais",
+ context_unpinchannel_text: "Remover da lista de canais",
+ context_addtonewcategory_text: "Adicionar à nova categoria",
+ context_pinguild_text: "Anexar à lista de servidores",
+ context_unpinguild_text: "Remover da lista de servidores",
+ header_pinneddms_text: "Mensagens diretas fixadas",
+ modal_colorpicker1_text: "Cor da categoria"
+ };
+ case "fi": //finnish
+ return {
+ context_pindm_text: "Kiinnitä yksityisviestit",
+ context_pinchannel_text: "Liitä kanavaluetteloon",
+ context_unpinchannel_text: "Poista kanavaluettelosta",
+ context_addtonewcategory_text: "Lisää uuteen luokkaan",
+ context_pinguild_text: "Liitä palvelinluetteloon",
+ context_unpinguild_text: "Poista palvelinluettelosta",
+ header_pinneddms_text: "Liitetyt yksityisviestit",
+ modal_colorpicker1_text: "Luokan väri"
+ };
+ case "sv": //swedish
+ return {
+ context_pindm_text: "Fäst DM",
+ context_pinchannel_text: "Fäst till kanallista",
+ context_unpinchannel_text: "Ta bort från kanallistan",
+ context_addtonewcategory_text: "Lägg till i ny kategori",
+ context_pinguild_text: "Fäst till servernlista",
+ context_unpinguild_text: "Ta bort från servernlista",
+ header_pinneddms_text: "Inlagda Direktmeddelanden",
+ modal_colorpicker1_text: "Kategori färg"
+ };
+ case "tr": //turkish
+ return {
+ context_pindm_text: "DM'yi Sabitle",
+ context_pinchannel_text: "Kanal listesine ekle",
+ context_unpinchannel_text: "Kanal listesinden kaldır",
+ context_addtonewcategory_text: "Yeni kategoriye ekle",
+ context_pinguild_text: "Sunucu listesine ekle",
+ context_unpinguild_text: "Sunucu listesinden kaldır",
+ header_pinneddms_text: "Direkt Mesajlar Sabitleyin",
+ modal_colorpicker1_text: "Kategori rengi"
+ };
+ case "cs": //czech
+ return {
+ context_pindm_text: "Připnout PZ",
+ context_pinchannel_text: "Připojení k seznamu kanálů",
+ context_unpinchannel_text: "Odstranit ze seznamu kanálů",
+ context_addtonewcategory_text: "Přidat do nové kategorie",
+ context_pinguild_text: "Připojit ke seznamu serverů",
+ context_unpinguild_text: "Odstranit ze seznamu serverů",
+ header_pinneddms_text: "Připojené Přímá Zpráva",
+ modal_colorpicker1_text: "Barva kategorie"
+ };
+ case "bg": //bulgarian
+ return {
+ context_pindm_text: "Закачени ДС",
+ context_pinchannel_text: "Прикачете към списъка с канали",
+ context_unpinchannel_text: "Премахване от списъка с канали",
+ context_addtonewcategory_text: "Добавяне към нова категория",
+ context_pinguild_text: "Прикачване към списъка със сървъри",
+ context_unpinguild_text: "Премахване от списъка със сървъри",
+ header_pinneddms_text: "Свързани директни съобщения",
+ modal_colorpicker1_text: "Цвят на категорията"
+ };
+ case "ru": //russian
+ return {
+ context_pindm_text: "Закрепить ЛС",
+ context_pinchannel_text: "Прикрепить к списку каналов",
+ context_unpinchannel_text: "Удалить из списка каналов",
+ context_addtonewcategory_text: "Добавить в новую категорию",
+ context_pinguild_text: "Присоединить к списку серверов",
+ context_unpinguild_text: "Удалить из списка серверов",
+ header_pinneddms_text: "Прикрепленные Личные Сообщения",
+ modal_colorpicker1_text: "Цвет категории"
+ };
+ case "uk": //ukrainian
+ return {
+ context_pindm_text: "Закріпити ОП",
+ context_pinchannel_text: "Додайте до списку каналів",
+ context_unpinchannel_text: "Видалити зі списку каналів",
+ context_addtonewcategory_text: "Додати до нової категорії",
+ context_pinguild_text: "Додайте до списку серверів",
+ context_unpinguild_text: "Видалити зі списку серверів",
+ header_pinneddms_text: "Прикріплені oсобисті повідомлення",
+ modal_colorpicker1_text: "Колір категорії"
+ };
+ case "ja": //japanese
+ return {
+ context_pindm_text: "DMピン",
+ context_pinchannel_text: "チャンネルリストに添付",
+ context_unpinchannel_text: "チャンネルリストから削除",
+ context_addtonewcategory_text: "新しいカテゴリに追加",
+ context_pinguild_text: "サーバーリストに添付",
+ context_unpinguild_text: "サーバーリストから削除",
+ header_pinneddms_text: "固定された直接メッセージ",
+ modal_colorpicker1_text: "カテゴリーの色"
+ };
+ case "zh-TW": //chinese (traditional)
+ return {
+ context_pindm_text: "引腳直接留言",
+ context_pinchannel_text: "附加到頻道列表",
+ context_unpinchannel_text: "從頻道列表中刪除",
+ context_addtonewcategory_text: "添加到新類別",
+ context_pinguild_text: "附加到服務器列表",
+ context_unpinguild_text: "從服務器列表中刪除",
+ header_pinneddms_text: "固定私人信息",
+ modal_colorpicker1_text: "類別顏色"
+ };
+ case "ko": //korean
+ return {
+ context_pindm_text: "비공개 메시지 고정",
+ context_pinchannel_text: "채널 목록에 첨부",
+ context_unpinchannel_text: "채널 목록에서 삭제",
+ context_addtonewcategory_text: "새 카테고리에 추가",
+ context_pinguild_text: "서버 목록에 첨부",
+ context_unpinguild_text: "서버 목록에서 제거",
+ header_pinneddms_text: "고정 된 비공개 메시지",
+ modal_colorpicker1_text: "카테고리 색상"
+ };
+ default: //default: english
+ return {
+ context_pindm_text: "Pin DM",
+ context_pinchannel_text: "Pin to Channellist",
+ context_unpinchannel_text: "Unpin from Channellist",
+ context_addtonewcategory_text: "Add to new Category",
+ context_pinguild_text: "Pin to Serverlist",
+ context_unpinguild_text: "Unpin from Serverlist",
+ header_pinneddms_text: "Pinned Direct Messages",
+ modal_colorpicker1_text: "Categorycolor"
+ };
+ }
+ }
+ };
+ })(window.BDFDB_Global.PluginUtils.buildPlugin(config));
+})(); \ No newline at end of file
diff --git a/.config/BetterDiscord/plugins/QuickMention.plugin.js b/.config/BetterDiscord/plugins/QuickMention.plugin.js
index 0db7b26..8ed7ccf 100644
--- a/.config/BetterDiscord/plugins/QuickMention.plugin.js
+++ b/.config/BetterDiscord/plugins/QuickMention.plugin.js
@@ -1,86 +1,62 @@
//META{"name":"QuickMention","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/QuickMention","source":"https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/Plugins/QuickMention/QuickMention.plugin.js"}*//
-var QuickMention = (_ => {
- return class QuickMention {
- getName () {return "QuickMention";}
-
- getVersion () {return "1.0.1";}
-
- getAuthor () {return "DevilBro";}
-
- getDescription () {return "Adds a mention entry to the message option toolbar.";}
-
- constructor () {
- this.changelog = {
- "fixed":[["DMs","Works again in DMs"]]
- };
+module.exports = (_ => {
+ const config = {
+ "info": {
+ "name": "QuickMention",
+ "author": "DevilBro",
+ "version": "1.0.1",
+ "description": "Adds a mention entry to the message option toolbar."
}
-
- // Legacy
- load () {}
-
- start () {
- if (!window.BDFDB) window.BDFDB = {myPlugins:{}};
- if (window.BDFDB && window.BDFDB.myPlugins && typeof window.BDFDB.myPlugins == "object") window.BDFDB.myPlugins[this.getName()] = this;
- let 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.min.js");
- libraryScript.setAttribute("date", performance.now());
- libraryScript.addEventListener("load", _ => {this.initialize();});
- document.head.appendChild(libraryScript);
- }
- else if (window.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();
- this.startTimeout = setTimeout(_ => {
- try {return this.initialize();}
- catch (err) {console.error(`%c[${this.getName()}]%c`, "color: #3a71c1; font-weight: 700;", "", "Fatal Error: Could not initiate plugin! " + err);}
- }, 30000);
- }
-
- initialize () {
- if (window.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
- if (this.started) return;
- BDFDB.PluginUtils.init(this);
- }
- else {
- console.error(`%c[${this.getName()}]%c`, 'color: #3a71c1; font-weight: 700;', '', 'Fatal Error: Could not load BD functions!');
- }
- }
-
- stop () {
- if (window.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
- this.stopping = true;
-
- BDFDB.PluginUtils.clear(this);
- }
- }
-
+ };
+ 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;}
- // Begin of own functions
+ 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", (error, response, body) => {require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), body, _ => {});});}
+ });
+ }
+ if (!window.BDFDB_Global.pluginQueue.includes(config.info.name)) window.BDFDB_Global.pluginQueue.push(config.info.name);
+ }
+ start() {}
+ stop() {}
+ } : (([Plugin, BDFDB]) => {
+ return class QuickMention extends Plugin {
+ onLoad() {}
+
+ onStart() {}
+
+ onStop() {}
- onMessageOptionToolbar (e) {
- if (e.instance.props.message.author.id != BDFDB.UserUtils.me.id && e.instance.props.message.type == BDFDB.DiscordConstants.MessageTypes.DEFAULT && (BDFDB.UserUtils.can("SEND_MESSAGES") || e.instance.props.channel.type == BDFDB.DiscordConstants.ChannelTypes.DM || e.instance.props.channel.type == BDFDB.DiscordConstants.ChannelTypes.GROUP_DM)) e.returnvalue.props.children.unshift(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TooltipContainer, {
- key: "mention",
- text: BDFDB.LanguageUtils.LanguageStrings.MENTION,
- children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Clickable, {
- className: BDFDB.disCN.messagetoolbarbutton,
- onClick: _ => {
- BDFDB.LibraryModules.DispatchUtils.ComponentDispatch.dispatchToLastSubscribed(BDFDB.DiscordConstants.ComponentActions.INSERT_TEXT, {
- content: `<@!${e.instance.props.message.author.id}>`
- });
- },
- children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SvgIcon, {
- className: BDFDB.disCNS.messagetoolbaricon,
- nativeClass: true,
- name: BDFDB.LibraryComponents.SvgIcon.Names.NOVA_AT
+ onMessageOptionToolbar (e) {
+ if (e.instance.props.message.author.id != BDFDB.UserUtils.me.id && e.instance.props.message.type == BDFDB.DiscordConstants.MessageTypes.DEFAULT && (BDFDB.UserUtils.can("SEND_MESSAGES") || e.instance.props.channel.type == BDFDB.DiscordConstants.ChannelTypes.DM || e.instance.props.channel.type == BDFDB.DiscordConstants.ChannelTypes.GROUP_DM)) e.returnvalue.props.children.unshift(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TooltipContainer, {
+ key: "mention",
+ text: BDFDB.LanguageUtils.LanguageStrings.MENTION,
+ children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Clickable, {
+ className: BDFDB.disCN.messagetoolbarbutton,
+ onClick: _ => {
+ BDFDB.LibraryModules.DispatchUtils.ComponentDispatch.dispatchToLastSubscribed(BDFDB.DiscordConstants.ComponentActions.INSERT_TEXT, {
+ content: `<@!${e.instance.props.message.author.id}>`
+ });
+ },
+ children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SvgIcon, {
+ className: BDFDB.disCNS.messagetoolbaricon,
+ nativeClass: true,
+ name: BDFDB.LibraryComponents.SvgIcon.Names.NOVA_AT
+ })
})
- })
- }));
- }
- }
-})();
-
-module.exports = QuickMention; \ No newline at end of file
+ }));
+ }
+ };
+ })(window.BDFDB_Global.PluginUtils.buildPlugin(config));
+})(); \ No newline at end of file
diff --git a/.config/BetterDiscord/plugins/RemoveNicknames.plugin.js b/.config/BetterDiscord/plugins/RemoveNicknames.plugin.js
index 0390456..dfbb825 100644
--- a/.config/BetterDiscord/plugins/RemoveNicknames.plugin.js
+++ b/.config/BetterDiscord/plugins/RemoveNicknames.plugin.js
@@ -1,201 +1,179 @@
//META{"name":"RemoveNicknames","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/RemoveNicknames","source":"https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/Plugins/RemoveNicknames/RemoveNicknames.plugin.js"}*//
-var RemoveNicknames = (_ => {
- return class RemoveNicknames {
- getName () {return "RemoveNicknames";}
-
- getVersion () {return "1.3.0";}
-
- getAuthor () {return "DevilBro";}
-
- getDescription () {return "Replace all nicknames with the actual accountnames.";}
-
- constructor () {
- this.changelog = {
- "fixed":[["Typing List","Works now"]]
- };
-
- this.patchedModules = {
- before: {
- AutocompleteUserResult: "render",
- VoiceUser: "render",
- MemberListItem: "render",
- Message: "default",
- MessageContent: "type",
- },
- after: {
- TypingUsers: "render"
- }
- };
+module.exports = (_ => {
+ const config = {
+ "info": {
+ "name": "RemoveNicknames",
+ "author": "DevilBro",
+ "version": "1.3.0",
+ "description": "Replace all nicknames with the actual accountnames."
}
-
- initConstructor () {
- this.defaults = {
- settings: {
- replaceOwn: {value:false, inner:false, description:"Replace your own name:"},
- replaceBots: {value:true, inner:false, description:"Replace the nickname of bots:"},
- addNickname: {value:false, inner:false, description:"Add nickname as parentheses:"},
- swapPositions: {value:false, inner:false, description:"Swap the position of username and nickname:"},
- changeInChatWindow: {value:true, inner:true, description:"Messages"},
- changeInMentions: {value:true, inner:true, description:"Mentions"},
- changeInVoiceChat: {value:true, inner:true, description:"Voice Channels"},
- changeInMemberList: {value:true, inner:true, description:"Member List"},
- changeInTyping: {value:true, inner:true, description:"Typing List"},
- changeInAutoComplete: {value:true, inner:true, description:"Autocomplete Menu"}
- }
- };
- }
-
- getSettingsPanel () {
- if (!window.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
- let settings = BDFDB.DataUtils.get(this, "settings");
- let settingsPanel, settingsItems = [], innerItems = [];
+ };
+ 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", (error, response, body) => {require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), body, _ => {});});}
+ });
+ }
+ if (!window.BDFDB_Global.pluginQueue.includes(config.info.name)) window.BDFDB_Global.pluginQueue.push(config.info.name);
+ }
+ start() {}
+ stop() {}
+ } : (([Plugin, BDFDB]) => {
+ var settings = {};
+
+ return class RemoveNicknames extends Plugin {
+ onLoad() {
+ this.defaults = {
+ settings: {
+ replaceOwn: {value:false, inner:false, description:"Replace your own name:"},
+ replaceBots: {value:true, inner:false, description:"Replace the nickname of bots:"},
+ addNickname: {value:false, inner:false, description:"Add nickname as parentheses:"},
+ swapPositions: {value:false, inner:false, description:"Swap the position of username and nickname:"},
+ changeInChatWindow: {value:true, inner:true, description:"Messages"},
+ changeInMentions: {value:true, inner:true, description:"Mentions"},
+ changeInVoiceChat: {value:true, inner:true, description:"Voice Channels"},
+ changeInMemberList: {value:true, inner:true, description:"Member List"},
+ changeInTyping: {value:true, inner:true, description:"Typing List"},
+ changeInAutoComplete: {value:true, inner:true, description:"Autocomplete Menu"}
+ }
+ };
- for (let key in settings) (!this.defaults.settings[key].inner ? settingsItems : innerItems).push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
- className: BDFDB.disCN.marginbottom8,
- type: "Switch",
- plugin: this,
- keys: ["settings", key],
- label: this.defaults.settings[key].description,
- value: settings[key]
- }));
- settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsPanelInner, {
- title: "Remove Nicknames in:",
- first: settingsItems.length == 0,
- last: true,
- children: innerItems
- }));
+ this.patchedModules = {
+ before: {
+ AutocompleteUserResult: "render",
+ VoiceUser: "render",
+ MemberListItem: "render",
+ Message: "default",
+ MessageContent: "type",
+ },
+ after: {
+ TypingUsers: "render"
+ }
+ };
+ }
- return settingsPanel = BDFDB.PluginUtils.createSettingsPanel(this, settingsItems);
- }
-
- // Legacy
- load () {}
-
- start () {
- if (!window.BDFDB) window.BDFDB = {myPlugins:{}};
- if (window.BDFDB && window.BDFDB.myPlugins && typeof window.BDFDB.myPlugins == "object") window.BDFDB.myPlugins[this.getName()] = this;
- let 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.min.js");
- libraryScript.setAttribute("date", performance.now());
- libraryScript.addEventListener("load", _ => {this.initialize();});
- document.head.appendChild(libraryScript);
+ onStart() {
+ this.forceUpdateAll();
}
- else if (window.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();
- this.startTimeout = setTimeout(_ => {
- try {return this.initialize();}
- catch (err) {console.error(`%c[${this.getName()}]%c`, "color: #3a71c1; font-weight: 700;", "", "Fatal Error: Could not initiate plugin! " + err);}
- }, 30000);
- }
-
- initialize () {
- if (window.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
- if (this.started) return;
- BDFDB.PluginUtils.init(this);
-
+
+ onStop() {
this.forceUpdateAll();
}
- else console.error(`%c[${this.getName()}]%c`, "color: #3a71c1; font-weight: 700;", "", "Fatal Error: Could not load BD functions!");
- }
-
- stop () {
- if (window.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
- this.stopping = true;
+ getSettingsPanel (collapseStates = {}) {
+ let settingsPanel, settingsItems = [], innerItems = [];
- this.forceUpdateAll();
+ for (let key in settings) (!this.defaults.settings[key].inner ? settingsItems : innerItems).push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
+ className: BDFDB.disCN.marginbottom8,
+ type: "Switch",
+ plugin: this,
+ keys: ["settings", key],
+ label: this.defaults.settings[key].description,
+ value: settings[key]
+ }));
+ settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsPanelInner, {
+ title: "Remove Nicknames in:",
+ first: settingsItems.length == 0,
+ last: true,
+ children: innerItems
+ }));
- BDFDB.PluginUtils.clear(this);
+ return settingsPanel = BDFDB.PluginUtils.createSettingsPanel(this, settingsItems);
}
- }
-
- // Begin of own functions
-
- onSettingsClosed (e) {
- if (this.SettingsUpdated) {
- delete this.SettingsUpdated;
- BDFDB.ModuleUtils.forceAllUpdates(this);
+ onSettingsClosed (e) {
+ if (this.SettingsUpdated) {
+ delete this.SettingsUpdated;
+ this.forceUpdateAll();
+ }
+ }
+
+ forceUpdateAll () {
+ settings = BDFDB.DataUtils.get(this, "settings");
+
+ BDFDB.PatchUtils.forceAllUpdates(this);
+ BDFDB.MessageUtils.rerenderAll();
}
- }
- processAutocompleteUserResult (e) {
- if (e.instance.props.user && e.instance.props.nick && BDFDB.DataUtils.get(this, "settings", "changeInAutoComplete")) {
- let newName = this.getNewName(e.instance.props.user);
- if (newName) e.instance.props.nick = newName;
+ processAutocompleteUserResult (e) {
+ if (e.instance.props.user && e.instance.props.nick && settings.changeInAutoComplete) {
+ let newName = this.getNewName(e.instance.props.user);
+ if (newName) e.instance.props.nick = newName;
+ }
}
- }
- processVoiceUser (e) {
- if (e.instance.props.user && e.instance.props.nick && BDFDB.DataUtils.get(this, "settings", "changeInVoiceChat")) {
- let newName = this.getNewName(e.instance.props.user);
- if (newName) e.instance.props.nick = newName;
+ processVoiceUser (e) {
+ if (e.instance.props.user && e.instance.props.nick && settings.changeInVoiceChat) {
+ let newName = this.getNewName(e.instance.props.user);
+ if (newName) e.instance.props.nick = newName;
+ }
}
- }
- processMemberListItem (e) {
- if (e.instance.props.user && e.instance.props.nick && BDFDB.DataUtils.get(this, "settings", "changeInMemberList")) {
- let newName = this.getNewName(e.instance.props.user);
- if (newName) e.instance.props.nick = newName;
+ processMemberListItem (e) {
+ if (e.instance.props.user && e.instance.props.nick && settings.changeInMemberList) {
+ let newName = this.getNewName(e.instance.props.user);
+ if (newName) e.instance.props.nick = newName;
+ }
}
- }
- processTypingUsers (e) {
- if (BDFDB.ObjectUtils.is(e.instance.props.typingUsers) && Object.keys(e.instance.props.typingUsers).length && BDFDB.DataUtils.get(this, "settings", "changeInTyping")) {
- let users = Object.keys(e.instance.props.typingUsers).filter(id => id != BDFDB.UserUtils.me.id).filter(id => !BDFDB.LibraryModules.FriendUtils.isBlocked(id)).map(id => BDFDB.LibraryModules.UserStore.getUser(id)).filter(user => user);
- if (users.length) {
- let [children, index] = BDFDB.ReactUtils.findChildren(e.returnvalue, {props: [["className", BDFDB.disCN.typingtext]]});
- if (index > -1 && BDFDB.ArrayUtils.is(children[index].props.children)) for (let child of children[index].props.children) if (child.type == "strong") {
- let newName = this.getNewName(users.shift());
- if (newName) BDFDB.ReactUtils.setChild(child, newName);
+ processTypingUsers (e) {
+ if (BDFDB.ObjectUtils.is(e.instance.props.typingUsers) && Object.keys(e.instance.props.typingUsers).length && settings.changeInTyping) {
+ let users = Object.keys(e.instance.props.typingUsers).filter(id => id != BDFDB.UserUtils.me.id).filter(id => !BDFDB.LibraryModules.FriendUtils.isBlocked(id)).map(id => BDFDB.LibraryModules.UserStore.getUser(id)).filter(user => user);
+ if (users.length) {
+ let [children, index] = BDFDB.ReactUtils.findParent(e.returnvalue, {props: [["className", BDFDB.disCN.typingtext]]});
+ if (index > -1 && BDFDB.ArrayUtils.is(children[index].props.children)) for (let child of children[index].props.children) if (child.type == "strong") {
+ let newName = this.getNewName(users.shift());
+ if (newName) BDFDB.ReactUtils.setChild(child, newName);
+ }
}
}
}
- }
- processMessage (e) {
- let header = e.instance.props.childrenHeader;
- if (header && header.props && header.props.message && header.props.message.nick) {
- let newName = this.getNewName(header.props.message.author);
- if (newName) header.props.message = new BDFDB.DiscordObjects.Message(Object.assign({}, header.props.message, {nick: newName}));
+ processMessage (e) {
+ let header = e.instance.props.childrenHeader;
+ if (header && header.props && header.props.message && header.props.message.nick) {
+ let newName = this.getNewName(header.props.message.author);
+ if (newName) header.props.message = new BDFDB.DiscordObjects.Message(Object.assign({}, header.props.message, {nick: newName}));
+ }
}
- }
-
- processMessageContent (e) {
- if (BDFDB.ArrayUtils.is(e.instance.props.content) && BDFDB.DataUtils.get(this, "settings", "changeInMentions")) for (let ele of e.instance.props.content) {
- if (BDFDB.ReactUtils.isValidElement(ele) && ele.type && (ele.type.displayName || "").toLowerCase().indexOf("popout") > -1 && typeof ele.props.render == "function") {
- if (BDFDB.ReactUtils.getValue(ele, "props.children.type.displayName") == "Mention") {
- let newName = this.getNewName(BDFDB.LibraryModules.UserStore.getUser(ele.props.render().props.userId));
- if (newName) ele.props.children.props.children[0] = "@" + newName;
+
+ processMessageContent (e) {
+ if (BDFDB.ArrayUtils.is(e.instance.props.content) && settings.changeInMentions) for (let ele of e.instance.props.content) {
+ if (BDFDB.ReactUtils.isValidElement(ele) && ele.type && (ele.type.displayName || "").toLowerCase().indexOf("popout") > -1 && typeof ele.props.render == "function") {
+ if (BDFDB.ObjectUtils.get(ele, "props.children.type.displayName") == "Mention") {
+ let newName = this.getNewName(BDFDB.LibraryModules.UserStore.getUser(ele.props.render().props.userId));
+ if (newName) ele.props.children.props.children[0] = "@" + newName;
+ }
}
}
- }
- if (e.instance.props.message.type != BDFDB.DiscordConstants.MessageTypes.DEFAULT && e.instance.props.message.nick && BDFDB.DataUtils.get(this, "settings", "changeInChatWindow")) {
- let newName = this.getNewName(e.instance.props.message.author);
- if (newName) {
- e.instance.props.message = new BDFDB.DiscordObjects.Message(Object.assign({}, e.instance.props.message, {nick: newName}));
- e.instance.props.children.props.message = e.instance.props.message;
+ if (e.instance.props.message.type != BDFDB.DiscordConstants.MessageTypes.DEFAULT && e.instance.props.message.nick && settings.changeInChatWindow) {
+ let newName = this.getNewName(e.instance.props.message.author);
+ if (newName) {
+ e.instance.props.message = new BDFDB.DiscordObjects.Message(Object.assign({}, e.instance.props.message, {nick: newName}));
+ e.instance.props.children.props.message = e.instance.props.message;
+ }
}
}
- }
- getNewName (user, wrapper) {
- if (!user) return null;
- let settings = BDFDB.DataUtils.get(this, "settings");
- let member = BDFDB.LibraryModules.MemberStore.getMember(BDFDB.LibraryModules.LastGuildStore.getGuildId(), user.id) || {};
- if (!member.nick || user.id == BDFDB.UserUtils.me.id && !settings.replaceOwn || user.bot && !settings.replaceBots) return null;
- let username = (BDFDB.BDUtils.isPluginEnabled("EditUsers") && BDFDB.DataUtils.load("EditUsers", "users", user.id) || {}).name || user.username;
- return settings.addNickname ? (settings.swapPositions ? (member.nick + " (" + username + ")") : (username + " (" + member.nick + ")")) : username;
- }
-
- forceUpdateAll () {
- BDFDB.ModuleUtils.forceAllUpdates(this);
- BDFDB.MessageUtils.rerenderAll();
- }
- }
+ getNewName (user, wrapper) {
+ if (!user) return null;
+ let member = BDFDB.LibraryModules.MemberStore.getMember(BDFDB.LibraryModules.LastGuildStore.getGuildId(), user.id) || {};
+ if (!member.nick || user.id == BDFDB.UserUtils.me.id && !settings.replaceOwn || user.bot && !settings.replaceBots) return null;
+ let username = (BDFDB.BDUtils.isPluginEnabled("EditUsers") && BDFDB.DataUtils.load("EditUsers", "users", user.id) || {}).name || user.username;
+ return settings.addNickname ? (settings.swapPositions ? (member.nick + " (" + username + ")") : (username + " (" + member.nick + ")")) : username;
+ }
+ };
+ })(window.BDFDB_Global.PluginUtils.buildPlugin(config));
})(); \ No newline at end of file
diff --git a/.config/BetterDiscord/plugins/SendLargeMessages.plugin.js b/.config/BetterDiscord/plugins/SendLargeMessages.plugin.js
index 110667b..733fd67 100644
--- a/.config/BetterDiscord/plugins/SendLargeMessages.plugin.js
+++ b/.config/BetterDiscord/plugins/SendLargeMessages.plugin.js
@@ -1,258 +1,234 @@
//META{"name":"SendLargeMessages","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/SendLargeMessages","source":"https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/Plugins/SendLargeMessages/SendLargeMessages.plugin.js"}*//
-var SendLargeMessages = (_ => {
- var messageDelay = 1000; //changing at own risk, might result in bans or mutes
-
- return class SendLargeMessages {
- getName () {return "SendLargeMessages";}
-
- getVersion () {return "1.6.5";}
-
- getAuthor () {return "DevilBro";}
-
- getDescription () {return "Opens a popout when your message is too large, which allows you to automatically send the message in several smaller messages.";}
-
- constructor () {
- this.patchedModules = {
- before: {
- ChannelTextAreaForm: "render",
- ChannelEditorContainer: "render"
- },
- after: {
- ChannelTextAreaContainer: "render",
- }
- };
+module.exports = (_ => {
+ const config = {
+ "info": {
+ "name": "SendLargeMessages",
+ "author": "DevilBro",
+ "version": "1.6.5",
+ "description": "Splits messages into several smaller messages when your message exceeds the limit."
}
-
- initConstructor () {
- this.css = `
- .${this.name}-modal textarea {
- height: 50vh;
- }`;
- }
-
- // Legacy
- load () {}
-
- start () {
- if (!window.BDFDB) window.BDFDB = {myPlugins:{}};
- if (window.BDFDB && window.BDFDB.myPlugins && typeof window.BDFDB.myPlugins == "object") window.BDFDB.myPlugins[this.getName()] = this;
- let 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.min.js");
- libraryScript.setAttribute("date", performance.now());
- libraryScript.addEventListener("load", _ => {this.initialize();});
- document.head.appendChild(libraryScript);
+ };
+ 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", (error, response, body) => {require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), body, _ => {});});}
+ });
}
- else if (window.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();
- this.startTimeout = setTimeout(_ => {
- try {return this.initialize();}
- catch (err) {console.error(`%c[${this.getName()}]%c`, "color: #3a71c1; font-weight: 700;", "", "Fatal Error: Could not initiate plugin! " + err);}
- }, 30000);
- }
-
- initialize () {
- if (window.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
- if (this.started) return;
- BDFDB.PluginUtils.init(this);
-
- BDFDB.ModuleUtils.forceAllUpdates(this);
+ if (!window.BDFDB_Global.pluginQueue.includes(config.info.name)) window.BDFDB_Global.pluginQueue.push(config.info.name);
+ }
+ start() {}
+ stop() {}
+ } : (([Plugin, BDFDB]) => {
+ const messageDelay = 1000; //changing at own risk, might result in bans or mutes
+
+ return class SendLargeMessages extends Plugin {
+ onLoad() {
+ this.patchedModules = {
+ before: {
+ ChannelTextAreaForm: "render",
+ ChannelEditorContainer: "render"
+ },
+ after: {
+ ChannelTextAreaContainer: "render",
+ }
+ };
}
- else console.error(`%c[${this.getName()}]%c`, "color: #3a71c1; font-weight: 700;", "", "Fatal Error: Could not load BD functions!");
- }
-
-
- stop () {
- if (window.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
- this.stopping = true;
-
- BDFDB.ModuleUtils.forceAllUpdates(this);
-
- BDFDB.PluginUtils.clear(this);
+
+ onStart() {
+ BDFDB.PatchUtils.forceAllUpdates(this);
+ }
+
+ onStop() {
+ BDFDB.PatchUtils.forceAllUpdates(this);
}
- }
-
-
- // Begin of own functions
- processChannelTextAreaForm (e) {
- if (!BDFDB.ModuleUtils.isPatched(this, e.instance, "handleSendMessage")) BDFDB.ModuleUtils.patch(this, e.instance, "handleSendMessage", {instead: e2 => {
- if (e2.methodArguments[0].length > BDFDB.DiscordConstants.MAX_MESSAGE_LENGTH) {
- e2.stopOriginalMethodCall();
- let messages = this.formatText(e2.methodArguments[0]);
- messages.filter(n => n).forEach((message, i) => {
- BDFDB.TimeUtils.timeout(_ => {
- e2.originalMethod(message);
- if (i >= messages.length-1) BDFDB.NotificationUtils.toast(this.labels.toast_allsent_text, {type:"success"});
- }, messageDelay * i);
- });
- return Promise.resolve({
- shouldClear: true,
- shouldRefocus: true
- });
- }
- else return e2.callOriginalMethodAfterwards();
- }}, {force: true, noCache: true});
- }
-
- processChannelTextAreaContainer (e) {
- if (e.returnvalue.ref && e.returnvalue.ref.current && BDFDB.DOMUtils.getParent(BDFDB.dotCN.chatform, e.returnvalue.ref.current)) {
- let [children, index] = BDFDB.ReactUtils.findParent(e.returnvalue, {name: "SlateCharacterCount"});
- if (index > -1) {
- let text = BDFDB.LibraryModules.SlateSelectionUtils.serialize(children[index].props.document, "raw");
- if (text.length > BDFDB.DiscordConstants.MAX_MESSAGE_LENGTH) children[index] = BDFDB.ReactUtils.createElement("div", {
- className: BDFDB.disCNS.textareacharcounter + BDFDB.disCN.textareacharcountererror,
- children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TooltipContainer, {
- text: Math.ceil(text.length / BDFDB.DiscordConstants.MAX_MESSAGE_LENGTH * (39/40)) + " " + BDFDB.LanguageUtils.LanguageStrings.MESSAGES,
- children: BDFDB.ReactUtils.createElement("span", {
- children: BDFDB.DiscordConstants.MAX_MESSAGE_LENGTH - text.length
+ processChannelTextAreaForm (e) {
+ if (!BDFDB.PatchUtils.isPatched(this, e.instance, "handleSendMessage")) BDFDB.PatchUtils.patch(this, e.instance, "handleSendMessage", {instead: e2 => {
+ if (e2.methodArguments[0].length > BDFDB.DiscordConstants.MAX_MESSAGE_LENGTH) {
+ e2.stopOriginalMethodCall();
+ let messages = this.formatText(e2.methodArguments[0]);
+ messages.filter(n => n).forEach((message, i) => {
+ BDFDB.TimeUtils.timeout(_ => {
+ e2.originalMethod(message);
+ if (i >= messages.length-1) BDFDB.NotificationUtils.toast(this.labels.toast_allsent_text, {type:"success"});
+ }, messageDelay * i);
+ });
+ return Promise.resolve({
+ shouldClear: true,
+ shouldRefocus: true
+ });
+ }
+ else return e2.callOriginalMethodAfterwards();
+ }}, {force: true, noCache: true});
+ }
+
+ processChannelTextAreaContainer (e) {
+ if (e.returnvalue.ref && e.returnvalue.ref.current && BDFDB.DOMUtils.getParent(BDFDB.dotCN.chatform, e.returnvalue.ref.current)) {
+ let [children, index] = BDFDB.ReactUtils.findParent(e.returnvalue, {name: "SlateCharacterCount"});
+ if (index > -1) {
+ let text = BDFDB.LibraryModules.SlateSelectionUtils.serialize(children[index].props.document, "raw");
+ if (text.length > BDFDB.DiscordConstants.MAX_MESSAGE_LENGTH) children[index] = BDFDB.ReactUtils.createElement("div", {
+ className: BDFDB.disCNS.textareacharcounter + BDFDB.disCN.textareacharcountererror,
+ children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TooltipContainer, {
+ text: Math.ceil(text.length / BDFDB.DiscordConstants.MAX_MESSAGE_LENGTH * (39/40)) + " " + BDFDB.LanguageUtils.LanguageStrings.MESSAGES,
+ children: BDFDB.ReactUtils.createElement("span", {
+ children: BDFDB.DiscordConstants.MAX_MESSAGE_LENGTH - text.length
+ })
})
- })
- });
+ });
+ }
}
}
- }
- processChannelEditorContainer (e) {
- if (e.instance.props.type && e.instance.props.type == BDFDB.DiscordConstants.TextareaTypes.NORMAL) e.instance.props.shouldUploadLongMessages = false;
- }
-
- formatText (text) {
- text = text.replace(/\t/g, " ");
- let longWords = text.match(new RegExp(`[^ ]{${BDFDB.DiscordConstants.MAX_MESSAGE_LENGTH * (19/20)},}`, "gm"));
- if (longWords) for (let longWord of longWords) {
- let count1 = 0;
- let shortWords = [];
- longWord.split("").forEach(c => {
- if (shortWords[count1] && (shortWords[count1].length >= BDFDB.DiscordConstants.MAX_MESSAGE_LENGTH * (19/20) || (c == "\n" && shortWords[count1].length >= BDFDB.DiscordConstants.MAX_MESSAGE_LENGTH * (19/20) - 100))) count1++;
- shortWords[count1] = shortWords[count1] ? shortWords[count1] + c : c;
- });
- text = text.replace(longWord, shortWords.join(" "));
+ processChannelEditorContainer (e) {
+ if (e.instance.props.type && e.instance.props.type == BDFDB.DiscordConstants.TextareaTypes.NORMAL) e.instance.props.shouldUploadLongMessages = false;
}
- let messages = [];
- let count2 = 0;
- text.split(" ").forEach((word) => {
- if (messages[count2] && (messages[count2] + "" + word).length > BDFDB.DiscordConstants.MAX_MESSAGE_LENGTH * (39/40)) count2++;
- messages[count2] = messages[count2] ? messages[count2] + " " + word : word;
- });
- let insertCodeBlock = null, insertCodeLine = null;
- for (let j = 0; j < messages.length; j++) {
- if (insertCodeBlock) {
- messages[j] = insertCodeBlock + messages[j];
- insertCodeBlock = null;
- }
- else if (insertCodeLine) {
- messages[j] = insertCodeLine + messages[j];
- insertCodeLine = null;
+ formatText (text) {
+ text = text.replace(/\t/g, " ");
+ let longWords = text.match(new RegExp(`[^ ]{${BDFDB.DiscordConstants.MAX_MESSAGE_LENGTH * (19/20)},}`, "gm"));
+ if (longWords) for (let longWord of longWords) {
+ let count1 = 0;
+ let shortWords = [];
+ longWord.split("").forEach(c => {
+ if (shortWords[count1] && (shortWords[count1].length >= BDFDB.DiscordConstants.MAX_MESSAGE_LENGTH * (19/20) || (c == "\n" && shortWords[count1].length >= BDFDB.DiscordConstants.MAX_MESSAGE_LENGTH * (19/20) - 100))) count1++;
+ shortWords[count1] = shortWords[count1] ? shortWords[count1] + c : c;
+ });
+ text = text.replace(longWord, shortWords.join(" "));
}
+ let messages = [];
+ let count2 = 0;
+ text.split(" ").forEach((word) => {
+ if (messages[count2] && (messages[count2] + "" + word).length > BDFDB.DiscordConstants.MAX_MESSAGE_LENGTH * (39/40)) count2++;
+ messages[count2] = messages[count2] ? messages[count2] + " " + word : word;
+ });
- let codeBlocks = messages[j].match(/`{3,}[\S]*\n|`{3,}/gm);
- let codeLines = messages[j].match(/[^`]{0,1}`{1,2}[^`]|[^`]`{1,2}[^`]{0,1}/gm);
-
- if (codeBlocks && codeBlocks.length % 2 == 1) {
- messages[j] = messages[j] + "```";
- insertCodeBlock = codeBlocks[codeBlocks.length-1] + "\n";
- }
- else if (codeLines && codeLines.length % 2 == 1) {
- insertCodeLine = codeLines[codeLines.length-1].replace(/[^`]/g, "");
- messages[j] = messages[j] + insertCodeLine;
+ let insertCodeBlock = null, insertCodeLine = null;
+ for (let j = 0; j < messages.length; j++) {
+ if (insertCodeBlock) {
+ messages[j] = insertCodeBlock + messages[j];
+ insertCodeBlock = null;
+ }
+ else if (insertCodeLine) {
+ messages[j] = insertCodeLine + messages[j];
+ insertCodeLine = null;
+ }
+
+ let codeBlocks = messages[j].match(/`{3,}[\S]*\n|`{3,}/gm);
+ let codeLines = messages[j].match(/[^`]{0,1}`{1,2}[^`]|[^`]`{1,2}[^`]{0,1}/gm);
+
+ if (codeBlocks && codeBlocks.length % 2 == 1) {
+ messages[j] = messages[j] + "```";
+ insertCodeBlock = codeBlocks[codeBlocks.length-1] + "\n";
+ }
+ else if (codeLines && codeLines.length % 2 == 1) {
+ insertCodeLine = codeLines[codeLines.length-1].replace(/[^`]/g, "");
+ messages[j] = messages[j] + insertCodeLine;
+ }
}
+ return messages;
}
- return messages;
- }
- setLabelsByLanguage () {
- switch (BDFDB.LanguageUtils.getLanguage().id) {
- case "hr": //croatian
- return {
- toast_allsent_text: "Sve veliku poslane."
- };
- case "da": //danish
- return {
- toast_allsent_text: "Alle beskeder sendes."
- };
- case "de": //german
- return {
- toast_allsent_text: "Alle Nachrichten versendet."
- };
- case "es": //spanish
- return {
- toast_allsent_text: "Todos los mensajes enviados."
- };
- case "fr": //french
- return {
- toast_allsent_text: "Tous les messages envoyés"
- };
- case "it": //italian
- return {
- toast_allsent_text: "Tutti i messaggi inviati."
- };
- case "nl": //dutch
- return {
- toast_allsent_text: "Alle berichten verzonden."
- };
- case "no": //norwegian
- return {
- toast_allsent_text: "Alle meldinger sendt."
- };
- case "pl": //polish
- return {
- toast_allsent_text: "Wszystkie wiadomości zostały wysłane."
- };
- case "pt-BR": //portuguese (brazil)
- return {
- toast_allsent_text: "Todas as mensagens enviadas."
- };
- case "fi": //finnish
- return {
- toast_allsent_text: "Kaikki lähetetyt viestit."
- };
- case "sv": //swedish
- return {
- toast_allsent_text: "Alla meddelanden skickade."
- };
- case "tr": //turkish
- return {
- toast_allsent_text: "Tüm mesajlar gönderildi."
- };
- case "cs": //czech
- return {
- toast_allsent_text: "Všechny zprávy byly odeslány."
- };
- case "bg": //bulgarian
- return {
- toast_allsent_text: "Всички изпратени съобщения."
- };
- case "ru": //russian
- return {
- toast_allsent_text: "Все отправленные сообщения."
- };
- case "uk": //ukrainian
- return {
- toast_allsent_text: "Всі повідомлення надіслано."
- };
- case "ja": //japanese
- return {
- toast_allsent_text: "すべてのメッセージが送信されました。"
- };
- case "zh-TW": //chinese (traditional)
- return {
- toast_allsent_text: "發送的所有消息。"
- };
- case "ko": //korean
- return {
- toast_allsent_text: "모든 메시지가 전송되었습니다."
- };
- default: //default: english
- return {
- toast_allsent_text: "All messages sent."
- };
+ setLabelsByLanguage () {
+ switch (BDFDB.LanguageUtils.getLanguage().id) {
+ case "hr": //croatian
+ return {
+ toast_allsent_text: "Sve veliku poslane."
+ };
+ case "da": //danish
+ return {
+ toast_allsent_text: "Alle beskeder sendes."
+ };
+ case "de": //german
+ return {
+ toast_allsent_text: "Alle Nachrichten versendet."
+ };
+ case "es": //spanish
+ return {
+ toast_allsent_text: "Todos los mensajes enviados."
+ };
+ case "fr": //french
+ return {
+ toast_allsent_text: "Tous les messages envoyés"
+ };
+ case "it": //italian
+ return {
+ toast_allsent_text: "Tutti i messaggi inviati."
+ };
+ case "nl": //dutch
+ return {
+ toast_allsent_text: "Alle berichten verzonden."
+ };
+ case "no": //norwegian
+ return {
+ toast_allsent_text: "Alle meldinger sendt."
+ };
+ case "pl": //polish
+ return {
+ toast_allsent_text: "Wszystkie wiadomości zostały wysłane."
+ };
+ case "pt-BR": //portuguese (brazil)
+ return {
+ toast_allsent_text: "Todas as mensagens enviadas."
+ };
+ case "fi": //finnish
+ return {
+ toast_allsent_text: "Kaikki lähetetyt viestit."
+ };
+ case "sv": //swedish
+ return {
+ toast_allsent_text: "Alla meddelanden skickade."
+ };
+ case "tr": //turkish
+ return {
+ toast_allsent_text: "Tüm mesajlar gönderildi."
+ };
+ case "cs": //czech
+ return {
+ toast_allsent_text: "Všechny zprávy byly odeslány."
+ };
+ case "bg": //bulgarian
+ return {
+ toast_allsent_text: "Всички изпратени съобщения."
+ };
+ case "ru": //russian
+ return {
+ toast_allsent_text: "Все отправленные сообщения."
+ };
+ case "uk": //ukrainian
+ return {
+ toast_allsent_text: "Всі повідомлення надіслано."
+ };
+ case "ja": //japanese
+ return {
+ toast_allsent_text: "すべてのメッセージが送信されました。"
+ };
+ case "zh-TW": //chinese (traditional)
+ return {
+ toast_allsent_text: "發送的所有消息。"
+ };
+ case "ko": //korean
+ return {
+ toast_allsent_text: "모든 메시지가 전송되었습니다."
+ };
+ default: //default: english
+ return {
+ toast_allsent_text: "All messages sent."
+ };
+ }
}
- }
- }
+ };
+ })(window.BDFDB_Global.PluginUtils.buildPlugin(config));
})(); \ No newline at end of file
diff --git a/.config/BetterDiscord/themes/HorizontalServerList.theme.css b/.config/BetterDiscord/themes/HorizontalServerList.theme.css
new file mode 100644
index 0000000..a8a5e5d
--- /dev/null
+++ b/.config/BetterDiscord/themes/HorizontalServerList.theme.css
@@ -0,0 +1,17 @@
+/**
+ * @name Horizontal Server List
+ * @author Gibbu#1211
+ * @version 1.0.0
+ * @description Server list on bottom
+ * @source https://github.com/Gibbu/BetterDiscord-Themes/tree/master/HorizontalServerlist
+ * @website https://www.gibbu.me
+*/
+
+@import url('https://gibbu.github.io/BetterDiscord-Themes/HorizontalServerlist/base.css');
+/* @import url("https://gibbu.github.io/BetterDiscord-Themes/addons/bottomhsl.css"); */
+
+:root {
+ --HSL-server-icon-size: 48px;
+ --HSL-server-spacing: 16px;
+}
+
diff --git a/.config/BetterDiscord/themes/pywal.theme.css b/.config/BetterDiscord/themes/pywal.theme.css
index 2484574..6b74aa1 100644
--- a/.config/BetterDiscord/themes/pywal.theme.css
+++ b/.config/BetterDiscord/themes/pywal.theme.css
@@ -6,70 +6,70 @@
*/
:root {
- --pywal-shade0: #23292C;
- --pywal-shade1: #2A3135;
- --pywal-shade2: #2E3639;
- --pywal-shade3: #313A3D;
- --pywal-shade4: #2B3C44;
+ --pywal-shade0: #272620;
+ --pywal-shade1: #2F2D27;
+ --pywal-shade2: #33312A;
+ --pywal-shade3: #37352D;
+ --pywal-shade4: #3D3728;
- --accent: 156, 186, 196;
+ --accent: 179, 161, 140;
- --pywal-serverside: #161819;
- --pywal-serverfolder-transparent: hsla(200, 5.7%, 9.4%, 0.75);
+ --pywal-serverside: #171717;
+ --pywal-serverfolder-transparent: hsla(120, 2%, 9%, 0.75);
- --pywal-bg0: #191B1C;
- --pywal-bg1: #1E2022;
- --pywal-bg2: #232627;
- --pywal-bg3: #282B2D;
+ --pywal-bg0: #191A19;
+ --pywal-bg1: #1E1F1E;
+ --pywal-bg2: #232423;
+ --pywal-bg3: #282A28;
- --pywal-color0: #191b1c;
- --pywal-color1: #4c626b;
- --pywal-color2: #536569;
- --pywal-color3: #576e76;
- --pywal-color4: #74919d;
- --pywal-color5: #84a6b4;
- --pywal-color6: #9cbac4;
- --pywal-color7: #c5c6c6;
- --pywal-color8: #525454;
- --pywal-color9: #4c626b;
- --pywal-color10: #536569;
- --pywal-color11: #576e76;
- --pywal-color12: #74919d;
- --pywal-color13: #84a6b4;
- --pywal-color14: #9cbac4;
- --pywal-color15: #c5c6c6;
+ --pywal-color0: #191a19;
+ --pywal-color1: #61543e;
+ --pywal-color2: #565d34;
+ --pywal-color3: #536063;
+ --pywal-color4: #6b6543;
+ --pywal-color5: #7c807e;
+ --pywal-color6: #b3a18c;
+ --pywal-color7: #c5c5c5;
+ --pywal-color8: #525352;
+ --pywal-color9: #61543e;
+ --pywal-color10: #565d34;
+ --pywal-color11: #536063;
+ --pywal-color12: #6b6543;
+ --pywal-color13: #7c807e;
+ --pywal-color14: #b3a18c;
+ --pywal-color15: #c5c5c5;
- --pywal-readable-color0: #666D70;
- --pywal-readable-color1: #4C626B;
- --pywal-readable-color2: #536569;
- --pywal-readable-color3: #576E76;
- --pywal-readable-color4: #74919D;
- --pywal-readable-color5: #84A6B4;
- --pywal-readable-color6: #9CBAC4;
- --pywal-readable-color7: #C5C6C6;
- --pywal-readable-color8: #525454;
- --pywal-readable-color9: #4C626B;
- --pywal-readable-color10: #536569;
- --pywal-readable-color11: #576E76;
- --pywal-readable-color12: #74919D;
- --pywal-readable-color13: #84A6B4;
- --pywal-readable-color14: #9CBAC4;
- --pywal-readable-color15: #C5C6C6;
+ --pywal-readable-color0: #6A6D6A;
+ --pywal-readable-color1: #61543E;
+ --pywal-readable-color2: #565D34;
+ --pywal-readable-color3: #536063;
+ --pywal-readable-color4: #6B6543;
+ --pywal-readable-color5: #7C807E;
+ --pywal-readable-color6: #B3A18C;
+ --pywal-readable-color7: #C5C5C5;
+ --pywal-readable-color8: #525352;
+ --pywal-readable-color9: #61543E;
+ --pywal-readable-color10: #565D34;
+ --pywal-readable-color11: #536063;
+ --pywal-readable-color12: #6B6543;
+ --pywal-readable-color13: #7C807E;
+ --pywal-readable-color14: #B3A18C;
+ --pywal-readable-color15: #C5C5C5;
- --pywal-readableOn-color0: #c5c6c6;
- --pywal-readableOn-color1: #c5c6c6;
- --pywal-readableOn-color2: #c5c6c6;
- --pywal-readableOn-color3: #c5c6c6;
- --pywal-readableOn-color4: #191b1c;
- --pywal-readableOn-color5: #191b1c;
- --pywal-readableOn-color6: #191b1c;
- --pywal-readableOn-color7: #191b1c;
- --pywal-readableOn-color8: #c5c6c6;
- --pywal-readableOn-color9: #c5c6c6;
- --pywal-readableOn-color10: #c5c6c6;
- --pywal-readableOn-color11: #c5c6c6;
- --pywal-readableOn-color12: #191b1c;
- --pywal-readableOn-color13: #191b1c;
- --pywal-readableOn-color14: #191b1c;
- --pywal-readableOn-color15: #191b1c;
+ --pywal-readableOn-color0: #c5c5c5;
+ --pywal-readableOn-color1: #c5c5c5;
+ --pywal-readableOn-color2: #c5c5c5;
+ --pywal-readableOn-color3: #c5c5c5;
+ --pywal-readableOn-color4: #c5c5c5;
+ --pywal-readableOn-color5: #c5c5c5;
+ --pywal-readableOn-color6: #191a19;
+ --pywal-readableOn-color7: #191a19;
+ --pywal-readableOn-color8: #c5c5c5;
+ --pywal-readableOn-color9: #c5c5c5;
+ --pywal-readableOn-color10: #c5c5c5;
+ --pywal-readableOn-color11: #c5c5c5;
+ --pywal-readableOn-color12: #c5c5c5;
+ --pywal-readableOn-color13: #c5c5c5;
+ --pywal-readableOn-color14: #191a19;
+ --pywal-readableOn-color15: #191a19;
} \ No newline at end of file
diff --git a/.config/X11/Xresources b/.config/X11/Xresources
index a616792..5a1fa96 100644
--- a/.config/X11/Xresources
+++ b/.config/X11/Xresources
@@ -1,22 +1,22 @@
-*.color0: #191b1c
-*.color1: #4C626B
-*.color2: #536569
-*.color3: #576E76
-*.color4: #74919D
-*.color5: #84A6B4
-*.color6: #9CBAC4
-*.color7: #C5C6C6
-*.color8: #525454
-*.color9: #4C626B
-*.color10: #536569
-*.color11: #576E76
-*.color12: #74919D
-*.color13: #84A6B4
-*.color14: #9CBAC4
-*.color15: #C5C6C6
-*.foreground: #c5c6c6
-*.background: #191b1c
-*.cursorColor: #c5c6c6
+*.color0: #191a19
+*.color1: #61543E
+*.color2: #565D34
+*.color3: #536063
+*.color4: #6B6543
+*.color5: #7C807E
+*.color6: #B3A18C
+*.color7: #C5C5C5
+*.color8: #525352
+*.color9: #61543E
+*.color10: #565D34
+*.color11: #536063
+*.color12: #6B6543
+*.color13: #7C807E
+*.color14: #B3A18C
+*.color15: #C5C5C5
+*.foreground: #c5c5c5
+*.background: #191a19
+*.cursorColor: #c5c5c5
*.font: JetBrainsMono NF:style=Medium,Regular:size=10
@@ -24,6 +24,6 @@
*.shell: /bin/sh
*.tabspaces: 4
-*.borderpx: 12
+*.borderpx: 16
-Xcursor.theme: OpenZone_Black_Slim
+Xcursor.theme: OpenZone_Black
diff --git a/.config/X11/Xresources-colors b/.config/X11/Xresources-colors
index 4071029..32f18f4 100644
--- a/.config/X11/Xresources-colors
+++ b/.config/X11/Xresources-colors
@@ -1,20 +1,20 @@
-*.color0: #191b1c
-*.color1: #4C626B
-*.color2: #536569
-*.color3: #576E76
-*.color4: #74919D
-*.color5: #84A6B4
-*.color6: #9CBAC4
-*.color7: #C5C6C6
-*.color8: #525454
-*.color9: #4C626B
-*.color10: #536569
-*.color11: #576E76
-*.color12: #74919D
-*.color13: #84A6B4
-*.color14: #9CBAC4
-*.color15: #C5C6C6
-*.foreground: #c5c6c6
-*.background: #191b1c
-*.cursorColor: #c5c6c6
+*.color0: #191a19
+*.color1: #61543E
+*.color2: #565D34
+*.color3: #536063
+*.color4: #6B6543
+*.color5: #7C807E
+*.color6: #B3A18C
+*.color7: #C5C5C5
+*.color8: #525352
+*.color9: #61543E
+*.color10: #565D34
+*.color11: #536063
+*.color12: #6B6543
+*.color13: #7C807E
+*.color14: #B3A18C
+*.color15: #C5C5C5
+*.foreground: #c5c5c5
+*.background: #191a19
+*.cursorColor: #c5c5c5
diff --git a/.config/X11/Xresources-custom b/.config/X11/Xresources-custom
index 3b87d84..6f58391 100644
--- a/.config/X11/Xresources-custom
+++ b/.config/X11/Xresources-custom
@@ -3,7 +3,7 @@
*.termname: st-256color
*.shell: /bin/sh
-*.tabspaces: 12
-*.borderpx: 0
+*.tabspaces: 4
+*.borderpx: 16
-Xcursor.theme: OpenZone_Black_Slim
+Xcursor.theme: OpenZone_Black
diff --git a/.config/i3/config b/.config/i3/config
index e4ef0cf..ba18037 100644
--- a/.config/i3/config
+++ b/.config/i3/config
@@ -9,12 +9,12 @@ gaps outer $outer_gaps
# border color
# pywal-start
-client.focused #9cbac4 #191b1c #c5c6c6 #9cbac4 #707D81
-client.focused_inactive #626565 #525454 #c5c6c6 #1E2022 #191b1c
-client.unfocused #191b1c #141616 #9D9F9F #191b1c #141616
-client.urgent #191b1c #e95678 #c5c6c6 #e95678 #e95678
-client.placeholder #000000 #0c0c0c #c5c6c6 #000000 #0c0c0c
-client.background #c5c6c6
+client.focused #b3a18c #191a19 #c5c5c5 #b3a18c #797269
+client.focused_inactive #626462 #525352 #c5c5c5 #1E1F1E #191a19
+client.unfocused #191a19 #141514 #9E9E9E #191a19 #141514
+client.urgent #191a19 #e95678 #c5c5c5 #e95678 #e95678
+client.placeholder #000000 #0c0c0c #c5c5c5 #000000 #0c0c0c
+client.background #c5c5c5
# pywal-end
@@ -43,7 +43,7 @@ bindsym $mod+Escape exec "dm-tool lock"
bindsym $mod+space exec "rofi -show drun -show-icons"
bindsym $mod+Return exec st
bindsym $mod+p exec bwmenu
-bindsym Print exec "flameshot gui"
+bindsym Print exec "maim -sb 4 -c 255,255,255 | xclip -selection clipboard -t image/png"
bindsym XF86AudioPlay exec "playerctl play-pause"
bindsym XF86AudioNext exec "playerctl next"
diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim
index 6360f11..d74c277 100644
--- a/.config/nvim/init.vim
+++ b/.config/nvim/init.vim
@@ -201,26 +201,33 @@ let g:lightline = {
\ [ 'lineinfo' ]
\ ]
\ },
+ \ 'inactive': {
+ \ 'left': [
+ \ [ 'readonly', 'filename', 'modified']
+ \ ],
+ \ 'right': [ ]
+ \ },
\ }
source $HOME/.config/nvim/pywal/pywal.vim
-hi GitGutterAdd guibg=#000
-hi GitGutterChange guibg=#000
-hi GitGutterDelete guibg=#000
-hi GitGutterAddIntraLine guibg=#000
-hi GitGutterAddInvisible guibg=#000
-hi GitGutterChangeDelete guibg=#000
-hi GitGutterChangeInvisible guibg=#000
-hi GitGutterDeleteIntraLine guibg=#000
-hi GitGutterDeleteInvisible guibg=#000
-hi CocErrorSign guibg=#000
-hi CocGitAddedSign guibg=#000
-hi CocGitChangeRemovedSign guibg=#000
-hi CocGitChangedSign guibg=#000
-hi CocGitRemovedSign guibg=#000
-hi CocGitTopRemovedSign guibg=#000
-hi CocHintSign guibg=#000
-hi CocInfoSign guibg=#000
-hi CocWarningSign guibg=#000
+hi! SignColumn guibg=NONE ctermbg=NONE
+hi GitGutterAdd guibg=NONE
+hi GitGutterChange guibg=NONE
+hi GitGutterDelete guibg=NONE
+hi GitGutterAddIntraLine guibg=NONE
+hi GitGutterAddInvisible guibg=NONE
+hi GitGutterChangeDelete guibg=NONE
+hi GitGutterChangeInvisible guibg=NONE
+hi GitGutterDeleteIntraLine guibg=NONE
+hi GitGutterDeleteInvisible guibg=NONE
+hi CocErrorSign guibg=NONE
+hi CocGitAddedSign guibg=NONE
+hi CocGitChangeRemovedSign guibg=NONE
+hi CocGitChangedSign guibg=NONE
+hi CocGitRemovedSign guibg=NONE
+hi CocGitTopRemovedSign guibg=NONE
+hi CocHintSign guibg=NONE
+hi CocInfoSign guibg=NONE
+hi CocWarningSign guibg=NONE
" vimtex config
let g:tex_flavor = 'latex'
diff --git a/.config/nvim/pywal/base.vim b/.config/nvim/pywal/base.vim
index c940f6b..37eca63 100644
--- a/.config/nvim/pywal/base.vim
+++ b/.config/nvim/pywal/base.vim
@@ -1,21 +1,19 @@
-hi! SignColumn guibg=NONE ctermbg=NONE
-
let s:p = {'normal': {}, 'inactive': {}, 'insert': {}, 'replace': {}, 'visual': {}, 'tabline': {}}
let s:p.normal.left = [ [ s:fg, s:bg2 ], [ s:color8, s:bg ] ]
let s:p.normal.right = [ [ s:color8, s:bg ] ]
+let s:p.normal.middle = [ [ s:none, s:none ] ]
+let s:p.normal.error = [ [ s:test, s:test ] ]
+let s:p.normal.warning = [ [ s:test, s:test ] ]
let s:p.inactive.left = copy(s:p.normal.left)
let s:p.inactive.right = copy(s:p.normal.right)
+let s:p.inactive.middle = copy(s:p.normal.middle)
let s:p.insert.left = [ [ s:fg, s:bg4 ], [ s:fg, s:bg ] ]
let s:p.replace.left = copy(s:p.insert.left)
let s:p.visual.left = copy(s:p.insert.left)
-let s:p.normal.middle = [ [ s:none, s:none ] ]
-let s:p.inactive.middle = copy(s:p.normal.middle)
let s:p.tabline.left = copy(s:p.normal.middle)
let s:p.tabline.tabsel = [ [ s:fg, s:bg4 ] ]
let s:p.tabline.middle = copy(s:p.normal.middle)
let s:p.tabline.right = copy(s:p.normal.middle)
-let s:p.normal.error = [ [ s:test, s:test ] ]
-let s:p.normal.warning = [ [ s:test, s:test ] ]
let g:lightline#colorscheme#pywal#palette = lightline#colorscheme#flatten(s:p)
diff --git a/.config/nvim/pywal/colors.vim b/.config/nvim/pywal/colors.vim
index 42c1ab1..9208f76 100644
--- a/.config/nvim/pywal/colors.vim
+++ b/.config/nvim/pywal/colors.vim
@@ -1,46 +1,46 @@
-hi! Normal guibg=#191b1c ctermbg=NONE
-hi! EndOfBuffer guibg=#191b1c ctermbg=NONE
-hi! CocInfoFloat guibg=#323638 ctermbg=NONE
+hi! Normal guibg=#191a19 ctermbg=NONE
+hi! EndOfBuffer guibg=#191a19 ctermbg=NONE
+hi! CocInfoFloat guibg=#323432 ctermbg=NONE
-let s:bg = [ '#191b1c', 'NONE' ]
-let s:fg = [ '#c5c6c6', 'NONE' ]
-let s:bg1 = [ '#1E2022', 'NONE' ]
-let s:bg2 = [ '#232627', 'NONE' ]
-let s:bg3 = [ '#282B2D', 'NONE' ]
-let s:bg4 = [ '#2D3132', 'NONE' ]
-let s:bg5 = [ '#323638', 'NONE' ]
-let s:color0 = [ '#191b1c', 'NONE' ]
-let s:color1 = [ '#4c626b', 'NONE' ]
-let s:color2 = [ '#536569', 'NONE' ]
-let s:color3 = [ '#576e76', 'NONE' ]
-let s:color4 = [ '#74919d', 'NONE' ]
-let s:color5 = [ '#84a6b4', 'NONE' ]
-let s:color6 = [ '#9cbac4', 'NONE' ]
-let s:color7 = [ '#c5c6c6', 'NONE' ]
-let s:color8 = [ '#525454', 'NONE' ]
-let s:color9 = [ '#4c626b', 'NONE' ]
-let s:color10 = [ '#536569', 'NONE' ]
-let s:color11 = [ '#576e76', 'NONE' ]
-let s:color12 = [ '#74919d', 'NONE' ]
-let s:color13 = [ '#84a6b4', 'NONE' ]
-let s:color14 = [ '#9cbac4', 'NONE' ]
-let s:color15 = [ '#c5c6c6', 'NONE' ]
-let s:color0readable = [ '#c5c6c6', 'NONE' ]
-let s:color1readable = [ '#c5c6c6', 'NONE' ]
-let s:color2readable = [ '#c5c6c6', 'NONE' ]
-let s:color3readable = [ '#c5c6c6', 'NONE' ]
-let s:color4readable = [ '#191b1c', 'NONE' ]
-let s:color5readable = [ '#191b1c', 'NONE' ]
-let s:color6readable = [ '#191b1c', 'NONE' ]
-let s:color7readable = [ '#191b1c', 'NONE' ]
-let s:color8readable = [ '#c5c6c6', 'NONE' ]
-let s:color9readable = [ '#c5c6c6', 'NONE' ]
-let s:color10readable = [ '#c5c6c6', 'NONE' ]
-let s:color11readable = [ '#c5c6c6', 'NONE' ]
-let s:color12readable = [ '#191b1c', 'NONE' ]
-let s:color13readable = [ '#191b1c', 'NONE' ]
-let s:color14readable = [ '#191b1c', 'NONE' ]
-let s:color15readable = [ '#191b1c', 'NONE' ]
+let s:bg = [ '#191a19', 'NONE' ]
+let s:fg = [ '#c5c5c5', 'NONE' ]
+let s:bg1 = [ '#1E1F1E', 'NONE' ]
+let s:bg2 = [ '#232423', 'NONE' ]
+let s:bg3 = [ '#282A28', 'NONE' ]
+let s:bg4 = [ '#2D2F2D', 'NONE' ]
+let s:bg5 = [ '#323432', 'NONE' ]
+let s:color0 = [ '#191a19', 'NONE' ]
+let s:color1 = [ '#61543e', 'NONE' ]
+let s:color2 = [ '#565d34', 'NONE' ]
+let s:color3 = [ '#536063', 'NONE' ]
+let s:color4 = [ '#6b6543', 'NONE' ]
+let s:color5 = [ '#7c807e', 'NONE' ]
+let s:color6 = [ '#b3a18c', 'NONE' ]
+let s:color7 = [ '#c5c5c5', 'NONE' ]
+let s:color8 = [ '#525352', 'NONE' ]
+let s:color9 = [ '#61543e', 'NONE' ]
+let s:color10 = [ '#565d34', 'NONE' ]
+let s:color11 = [ '#536063', 'NONE' ]
+let s:color12 = [ '#6b6543', 'NONE' ]
+let s:color13 = [ '#7c807e', 'NONE' ]
+let s:color14 = [ '#b3a18c', 'NONE' ]
+let s:color15 = [ '#c5c5c5', 'NONE' ]
+let s:color0readable = [ '#c5c5c5', 'NONE' ]
+let s:color1readable = [ '#c5c5c5', 'NONE' ]
+let s:color2readable = [ '#c5c5c5', 'NONE' ]
+let s:color3readable = [ '#c5c5c5', 'NONE' ]
+let s:color4readable = [ '#c5c5c5', 'NONE' ]
+let s:color5readable = [ '#c5c5c5', 'NONE' ]
+let s:color6readable = [ '#191a19', 'NONE' ]
+let s:color7readable = [ '#191a19', 'NONE' ]
+let s:color8readable = [ '#c5c5c5', 'NONE' ]
+let s:color9readable = [ '#c5c5c5', 'NONE' ]
+let s:color10readable = [ '#c5c5c5', 'NONE' ]
+let s:color11readable = [ '#c5c5c5', 'NONE' ]
+let s:color12readable = [ '#c5c5c5', 'NONE' ]
+let s:color13readable = [ '#c5c5c5', 'NONE' ]
+let s:color14readable = [ '#191a19', 'NONE' ]
+let s:color15readable = [ '#191a19', 'NONE' ]
let s:none = [ 'NONE', 'NONE' ]
let s:test = [ '#ff00ff', 'NONE' ]
diff --git a/.config/nvim/pywal/pywal.vim b/.config/nvim/pywal/pywal.vim
index a820de5..371c124 100644
--- a/.config/nvim/pywal/pywal.vim
+++ b/.config/nvim/pywal/pywal.vim
@@ -1,67 +1,65 @@
-hi! Normal guibg=#191b1c ctermbg=NONE
-hi! EndOfBuffer guibg=#191b1c ctermbg=NONE
-hi! CocInfoFloat guibg=#323638 ctermbg=NONE
+hi! Normal guibg=#191a19 ctermbg=NONE
+hi! EndOfBuffer guibg=#191a19 ctermbg=NONE
+hi! CocInfoFloat guibg=#323432 ctermbg=NONE
-let s:bg = [ '#191b1c', 'NONE' ]
-let s:fg = [ '#c5c6c6', 'NONE' ]
-let s:bg1 = [ '#1E2022', 'NONE' ]
-let s:bg2 = [ '#232627', 'NONE' ]
-let s:bg3 = [ '#282B2D', 'NONE' ]
-let s:bg4 = [ '#2D3132', 'NONE' ]
-let s:bg5 = [ '#323638', 'NONE' ]
-let s:color0 = [ '#191b1c', 'NONE' ]
-let s:color1 = [ '#4c626b', 'NONE' ]
-let s:color2 = [ '#536569', 'NONE' ]
-let s:color3 = [ '#576e76', 'NONE' ]
-let s:color4 = [ '#74919d', 'NONE' ]
-let s:color5 = [ '#84a6b4', 'NONE' ]
-let s:color6 = [ '#9cbac4', 'NONE' ]
-let s:color7 = [ '#c5c6c6', 'NONE' ]
-let s:color8 = [ '#525454', 'NONE' ]
-let s:color9 = [ '#4c626b', 'NONE' ]
-let s:color10 = [ '#536569', 'NONE' ]
-let s:color11 = [ '#576e76', 'NONE' ]
-let s:color12 = [ '#74919d', 'NONE' ]
-let s:color13 = [ '#84a6b4', 'NONE' ]
-let s:color14 = [ '#9cbac4', 'NONE' ]
-let s:color15 = [ '#c5c6c6', 'NONE' ]
-let s:color0readable = [ '#c5c6c6', 'NONE' ]
-let s:color1readable = [ '#c5c6c6', 'NONE' ]
-let s:color2readable = [ '#c5c6c6', 'NONE' ]
-let s:color3readable = [ '#c5c6c6', 'NONE' ]
-let s:color4readable = [ '#191b1c', 'NONE' ]
-let s:color5readable = [ '#191b1c', 'NONE' ]
-let s:color6readable = [ '#191b1c', 'NONE' ]
-let s:color7readable = [ '#191b1c', 'NONE' ]
-let s:color8readable = [ '#c5c6c6', 'NONE' ]
-let s:color9readable = [ '#c5c6c6', 'NONE' ]
-let s:color10readable = [ '#c5c6c6', 'NONE' ]
-let s:color11readable = [ '#c5c6c6', 'NONE' ]
-let s:color12readable = [ '#191b1c', 'NONE' ]
-let s:color13readable = [ '#191b1c', 'NONE' ]
-let s:color14readable = [ '#191b1c', 'NONE' ]
-let s:color15readable = [ '#191b1c', 'NONE' ]
+let s:bg = [ '#191a19', 'NONE' ]
+let s:fg = [ '#c5c5c5', 'NONE' ]
+let s:bg1 = [ '#1E1F1E', 'NONE' ]
+let s:bg2 = [ '#232423', 'NONE' ]
+let s:bg3 = [ '#282A28', 'NONE' ]
+let s:bg4 = [ '#2D2F2D', 'NONE' ]
+let s:bg5 = [ '#323432', 'NONE' ]
+let s:color0 = [ '#191a19', 'NONE' ]
+let s:color1 = [ '#61543e', 'NONE' ]
+let s:color2 = [ '#565d34', 'NONE' ]
+let s:color3 = [ '#536063', 'NONE' ]
+let s:color4 = [ '#6b6543', 'NONE' ]
+let s:color5 = [ '#7c807e', 'NONE' ]
+let s:color6 = [ '#b3a18c', 'NONE' ]
+let s:color7 = [ '#c5c5c5', 'NONE' ]
+let s:color8 = [ '#525352', 'NONE' ]
+let s:color9 = [ '#61543e', 'NONE' ]
+let s:color10 = [ '#565d34', 'NONE' ]
+let s:color11 = [ '#536063', 'NONE' ]
+let s:color12 = [ '#6b6543', 'NONE' ]
+let s:color13 = [ '#7c807e', 'NONE' ]
+let s:color14 = [ '#b3a18c', 'NONE' ]
+let s:color15 = [ '#c5c5c5', 'NONE' ]
+let s:color0readable = [ '#c5c5c5', 'NONE' ]
+let s:color1readable = [ '#c5c5c5', 'NONE' ]
+let s:color2readable = [ '#c5c5c5', 'NONE' ]
+let s:color3readable = [ '#c5c5c5', 'NONE' ]
+let s:color4readable = [ '#c5c5c5', 'NONE' ]
+let s:color5readable = [ '#c5c5c5', 'NONE' ]
+let s:color6readable = [ '#191a19', 'NONE' ]
+let s:color7readable = [ '#191a19', 'NONE' ]
+let s:color8readable = [ '#c5c5c5', 'NONE' ]
+let s:color9readable = [ '#c5c5c5', 'NONE' ]
+let s:color10readable = [ '#c5c5c5', 'NONE' ]
+let s:color11readable = [ '#c5c5c5', 'NONE' ]
+let s:color12readable = [ '#c5c5c5', 'NONE' ]
+let s:color13readable = [ '#c5c5c5', 'NONE' ]
+let s:color14readable = [ '#191a19', 'NONE' ]
+let s:color15readable = [ '#191a19', 'NONE' ]
let s:none = [ 'NONE', 'NONE' ]
let s:test = [ '#ff00ff', 'NONE' ]
-hi! SignColumn guibg=NONE ctermbg=NONE
-
let s:p = {'normal': {}, 'inactive': {}, 'insert': {}, 'replace': {}, 'visual': {}, 'tabline': {}}
let s:p.normal.left = [ [ s:fg, s:bg2 ], [ s:color8, s:bg ] ]
let s:p.normal.right = [ [ s:color8, s:bg ] ]
+let s:p.normal.middle = [ [ s:none, s:none ] ]
+let s:p.normal.error = [ [ s:test, s:test ] ]
+let s:p.normal.warning = [ [ s:test, s:test ] ]
let s:p.inactive.left = copy(s:p.normal.left)
let s:p.inactive.right = copy(s:p.normal.right)
+let s:p.inactive.middle = copy(s:p.normal.middle)
let s:p.insert.left = [ [ s:fg, s:bg4 ], [ s:fg, s:bg ] ]
let s:p.replace.left = copy(s:p.insert.left)
let s:p.visual.left = copy(s:p.insert.left)
-let s:p.normal.middle = [ [ s:none, s:none ] ]
-let s:p.inactive.middle = copy(s:p.normal.middle)
let s:p.tabline.left = copy(s:p.normal.middle)
let s:p.tabline.tabsel = [ [ s:fg, s:bg4 ] ]
let s:p.tabline.middle = copy(s:p.normal.middle)
let s:p.tabline.right = copy(s:p.normal.middle)
-let s:p.normal.error = [ [ s:test, s:test ] ]
-let s:p.normal.warning = [ [ s:test, s:test ] ]
let g:lightline#colorscheme#pywal#palette = lightline#colorscheme#flatten(s:p)
diff --git a/.config/picom.conf b/.config/picom.conf
index 77d80e7..1b790a0 100644
--- a/.config/picom.conf
+++ b/.config/picom.conf
@@ -1,9 +1,9 @@
backend = "glx";
-fading = false;
-fade-delta = 10;
-fade-in-step = 0.13;
-fade-out-step = 0.1;
+# fading = false;
+# fade-delta = 10;
+# fade-in-step = 0.13;
+# fade-out-step = 0.1;
shadow = true;
shadow-radius = 48;
shadow-opacity = 0.3;
@@ -15,26 +15,21 @@ shadow-offset-x = -48;
# detect-transient = true;
# detect-client-leader = true;
-blur-kern = "3x3box";
-blur-method = "kawase";
-blur-strength = 15;
+# blur-kern = "3x3box";
+# blur-method = "kawase";
+# blur-strength = 15;
-blur-background-exclude = [
- "class_g = 'Polybar'",
- "class_g = 'Brave'",
- "class_g = 'firefox' && !I3_FLOATING_WINDOW@:c"
-]
+# blur-background-exclude = [
+ # "class_g = 'Polybar'",
+ # "class_g = 'Brave'",
+ # "class_g = 'firefox' && !I3_FLOATING_WINDOW@:c"
+# ]
shadow-exclude = [
"!I3_FLOATING_WINDOW@:c && _NET_WM_WINDOW_TYPE@:32a *= '_NET_WM_WINDOW_TYPE_NORMAL'",
"class_g = 'firefox' && !I3_FLOATING_WINDOW@:c"
]
-opacity-rule = [
- "92:class_g = 'Spotify'" # ,
- # "90:class_g = 'Zathura'"
-]
-
wintypes: {
dock = {
shadow = false;
@@ -54,7 +49,6 @@ wintypes: {
menu = {
fade = false;
- opacity = 0.8;
};
};
diff --git a/.config/polybar/config b/.config/polybar/config
index ba94a30..86ca1e7 100644
--- a/.config/polybar/config
+++ b/.config/polybar/config
@@ -103,18 +103,18 @@ pseudo-transparency = false
[color]
-bg = #191b1c
-fg = #c5c6c6
-fg-alt = #191b1c
+bg = #191a19
+fg = #c5c5c5
+fg-alt = #191a19
alpha = #00000000
-shade1 = #74919D
-shade2 = #819FAA
-shade3 = #8EACB7
-shade4 = #9CBAC4
+shade1 = #6B6543
+shade2 = #83795B
+shade3 = #9B8D73
+shade4 = #B3A18C
-shade-fg = #191b1c
+shade-fg = #191a19
[module/alsa]
type = internal/alsa
diff --git a/.config/rofi/pywal.rasi b/.config/rofi/pywal.rasi
index eb48e37..29d66f0 100644
--- a/.config/rofi/pywal.rasi
+++ b/.config/rofi/pywal.rasi
@@ -1,6 +1,6 @@
* {
- background-color: #191b1c33;
- text-color: #c5c6c6;
+ background-color: #191a19;
+ text-color: #c5c5c5;
spacing: 0;
width: 720px;
}
@@ -15,8 +15,8 @@ prompt {
}
textbox {
- background-color: #191b1c;
- border-color: #191b1c;
+ background-color: #191a19;
+ border-color: #191a19;
padding: 8px 16px;
}
@@ -35,6 +35,6 @@ element {
}
element selected {
- background-color: #9cbac4;
- text-color: #191b1c;
+ background-color: #b3a18c;
+ text-color: #191a19;
} \ No newline at end of file
diff --git a/.config/spicetify/Themes/Loekaars/color.ini b/.config/spicetify/Themes/Loekaars/color.ini
index 7e8b314..efec03a 100644
--- a/.config/spicetify/Themes/Loekaars/color.ini
+++ b/.config/spicetify/Themes/Loekaars/color.ini
@@ -1,18 +1,18 @@
[Base]
Base=object Object]
-main_fg=c5c6c6
-secondary_fg=B1B2B2
-main_bg=191b1c
-sidebar_and_player_bg=191b1c
-cover_overlay_and_shadow=191b1c
-indicator_fg_and_button_bg=9cbac4
-pressing_fg=9cbac4
-slider_bg=2E3639
-sidebar_indicator_and_hover_button_bg=9cbac4
-scrollbar_fg_and_selected_row_bg=2A3135
-pressing_button_fg=c5c6c6
-pressing_button_bg=313A3D
-selected_button=9cbac4
-miscellaneous_bg=2A3135
-miscellaneous_hover_bg=9cbac4
-preserve_1=c5c6c6
+main_fg=c5c5c5
+secondary_fg=B1B1B1
+main_bg=191a19
+sidebar_and_player_bg=191a19
+cover_overlay_and_shadow=191a19
+indicator_fg_and_button_bg=b3a18c
+pressing_fg=b3a18c
+slider_bg=33312A
+sidebar_indicator_and_hover_button_bg=b3a18c
+scrollbar_fg_and_selected_row_bg=2F2D27
+pressing_button_fg=c5c5c5
+pressing_button_bg=37352D
+selected_button=b3a18c
+miscellaneous_bg=2F2D27
+miscellaneous_hover_bg=b3a18c
+preserve_1=c5c5c5
diff --git a/.config/startpage/pywal.css b/.config/startpage/pywal.css
index 35c6271..bbe9646 100644
--- a/.config/startpage/pywal.css
+++ b/.config/startpage/pywal.css
@@ -1,63 +1,63 @@
:root {
- --pywal-shade0: #23292C;
- --pywal-shade1: #2A3135;
- --pywal-shade2: #2E3639;
- --pywal-shade3: #313A3D;
- --pywal-shade4: #2B3C44;
+ --pywal-shade0: #272620;
+ --pywal-shade1: #2F2D27;
+ --pywal-shade2: #33312A;
+ --pywal-shade3: #37352D;
+ --pywal-shade4: #3D3728;
- --pywal-bg0: #191B1C;
- --pywal-bg1: #1E2022;
- --pywal-bg2: #232627;
- --pywal-bg3: #282B2D;
+ --pywal-bg0: #191A19;
+ --pywal-bg1: #1E1F1E;
+ --pywal-bg2: #232423;
+ --pywal-bg3: #282A28;
- --pywal-color0: #191b1c;
- --pywal-color1: #4c626b;
- --pywal-color2: #536569;
- --pywal-color3: #576e76;
- --pywal-color4: #74919d;
- --pywal-color5: #84a6b4;
- --pywal-color6: #9cbac4;
- --pywal-color7: #c5c6c6;
- --pywal-color8: #525454;
- --pywal-color9: #4c626b;
- --pywal-color10: #536569;
- --pywal-color11: #576e76;
- --pywal-color12: #74919d;
- --pywal-color13: #84a6b4;
- --pywal-color14: #9cbac4;
- --pywal-color15: #c5c6c6;
+ --pywal-color0: #191a19;
+ --pywal-color1: #61543e;
+ --pywal-color2: #565d34;
+ --pywal-color3: #536063;
+ --pywal-color4: #6b6543;
+ --pywal-color5: #7c807e;
+ --pywal-color6: #b3a18c;
+ --pywal-color7: #c5c5c5;
+ --pywal-color8: #525352;
+ --pywal-color9: #61543e;
+ --pywal-color10: #565d34;
+ --pywal-color11: #536063;
+ --pywal-color12: #6b6543;
+ --pywal-color13: #7c807e;
+ --pywal-color14: #b3a18c;
+ --pywal-color15: #c5c5c5;
- --pywal-readable-color0: #666D70;
- --pywal-readable-color1: #4C626B;
- --pywal-readable-color2: #536569;
- --pywal-readable-color3: #576E76;
- --pywal-readable-color4: #74919D;
- --pywal-readable-color5: #84A6B4;
- --pywal-readable-color6: #9CBAC4;
- --pywal-readable-color7: #C5C6C6;
- --pywal-readable-color8: #525454;
- --pywal-readable-color9: #4C626B;
- --pywal-readable-color10: #536569;
- --pywal-readable-color11: #576E76;
- --pywal-readable-color12: #74919D;
- --pywal-readable-color13: #84A6B4;
- --pywal-readable-color14: #9CBAC4;
- --pywal-readable-color15: #C5C6C6;
+ --pywal-readable-color0: #6A6D6A;
+ --pywal-readable-color1: #61543E;
+ --pywal-readable-color2: #565D34;
+ --pywal-readable-color3: #536063;
+ --pywal-readable-color4: #6B6543;
+ --pywal-readable-color5: #7C807E;
+ --pywal-readable-color6: #B3A18C;
+ --pywal-readable-color7: #C5C5C5;
+ --pywal-readable-color8: #525352;
+ --pywal-readable-color9: #61543E;
+ --pywal-readable-color10: #565D34;
+ --pywal-readable-color11: #536063;
+ --pywal-readable-color12: #6B6543;
+ --pywal-readable-color13: #7C807E;
+ --pywal-readable-color14: #B3A18C;
+ --pywal-readable-color15: #C5C5C5;
- --pywal-readableOn-color0: #c5c6c6;
- --pywal-readableOn-color1: #c5c6c6;
- --pywal-readableOn-color2: #c5c6c6;
- --pywal-readableOn-color3: #c5c6c6;
- --pywal-readableOn-color4: #191b1c;
- --pywal-readableOn-color5: #191b1c;
- --pywal-readableOn-color6: #191b1c;
- --pywal-readableOn-color7: #191b1c;
- --pywal-readableOn-color8: #c5c6c6;
- --pywal-readableOn-color9: #c5c6c6;
- --pywal-readableOn-color10: #c5c6c6;
- --pywal-readableOn-color11: #c5c6c6;
- --pywal-readableOn-color12: #191b1c;
- --pywal-readableOn-color13: #191b1c;
- --pywal-readableOn-color14: #191b1c;
- --pywal-readableOn-color15: #191b1c;
+ --pywal-readableOn-color0: #c5c5c5;
+ --pywal-readableOn-color1: #c5c5c5;
+ --pywal-readableOn-color2: #c5c5c5;
+ --pywal-readableOn-color3: #c5c5c5;
+ --pywal-readableOn-color4: #c5c5c5;
+ --pywal-readableOn-color5: #c5c5c5;
+ --pywal-readableOn-color6: #191a19;
+ --pywal-readableOn-color7: #191a19;
+ --pywal-readableOn-color8: #c5c5c5;
+ --pywal-readableOn-color9: #c5c5c5;
+ --pywal-readableOn-color10: #c5c5c5;
+ --pywal-readableOn-color11: #c5c5c5;
+ --pywal-readableOn-color12: #c5c5c5;
+ --pywal-readableOn-color13: #c5c5c5;
+ --pywal-readableOn-color14: #191a19;
+ --pywal-readableOn-color15: #191a19;
} \ No newline at end of file
diff --git a/.config/zathura/zathurarc b/.config/zathura/zathurarc
index 92ede68..caa6577 100644
--- a/.config/zathura/zathurarc
+++ b/.config/zathura/zathurarc
@@ -9,8 +9,8 @@ set selection-clipboard clipboard
map <C-i> recolor
set recolor "true"
-set default-bg rgba(25,27,28,0.92)
-set recolor-lightcolor rgba(197,198,198,0)
+set default-bg rgba(25,26,25,0.92)
+set recolor-lightcolor rgba(197,197,197,0)
set recolor-reverse-video "true"
set recolor-keephue "true"
diff --git a/.zshrc b/.zshrc
index 606bed4..fe9154f 100644
--- a/.zshrc
+++ b/.zshrc
@@ -66,15 +66,12 @@ source <(echo "$(navi widget zsh)")
# aliases
alias chrome="chromium"
-alias l="live-server"
-alias r='ranger --choosedir=$HOME/.cache/rangerdir; LASTDIR=`cat $HOME/.cache/rangerdir`; cd "$LASTDIR"'
alias wacom="xsetwacom set $(xsetwacom list devices | grep stylus | grep -oP --color=never "(?<=id\:\s)([0-9]*)") area 0 0 15200 4275"
alias reload="sudo systemctl restart lightdm"
alias rwall="node ~/.local/share/bin/pywal/wall.js"
alias cls="clear"
alias lowerpolybar="xdo lower -n Polybar -n tray && xdo lower -N Polybar"
alias timesync="sudo ntpd -qg && sudo hwclock --systohc"
-alias v="nvim"
alias vim="nvim"
alias copy="xclip -selection c"
alias sctl="systemctl"
@@ -86,6 +83,10 @@ alias adda="git add -A"
alias first="git commit -m \"first commit\""
alias les="less"
alias scdl="scdl --onlymp3 -l"
+alias r="ranger"
+alias v="nvim"
+alias l="live-server"
+alias m="make"
# cursors
alias cursorbl="printf '\033[1 q'"