diff --git a/PluginsV2/BadgesEverywhere/README.md b/PluginsV2/BadgesEverywhere/README.md
deleted file mode 100644
index 6cd836dcb4..0000000000
--- a/PluginsV2/BadgesEverywhere/README.md
+++ /dev/null
@@ -1,5 +0,0 @@
-# These Plugins are meant only for BDv2, not BD nor BandagedBD. If you got either of those two go to [Plugins](https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/).
-
-## Better Friend Count - [Download Script](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/BetterFriendCount/index.js) [Download Config](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/BetterFriendCount/config.json)
-
-Shows the amount of total and online friends and blocked users in the friends tab.
diff --git a/PluginsV2/BadgesEverywhere/config.json b/PluginsV2/BadgesEverywhere/config.json
deleted file mode 100644
index 23bca47174..0000000000
--- a/PluginsV2/BadgesEverywhere/config.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "info": {
- "name": "BadgesEverywhere",
- "authors": [
- {
- "name": "DevilBro",
- "url": "https://www.paypal.me/MircoWittrien",
- "discord_id": "278543574059057154",
- "github_username": "mwittrien"
- }
- ],
- "version": 1.0,
- "description": "Displays Badges (Nitro, Hypesquad, etc...) in the chat/memberlist/userpopout. Thanks for Zerebos' help. \n\nMy Support Server: http://bit.ly/DevilBrosHaus or https://discordapp.com/invite/Jx3TjNS"
- }
-}
diff --git a/PluginsV2/BadgesEverywhere/index.js b/PluginsV2/BadgesEverywhere/index.js
deleted file mode 100644
index 52adb31071..0000000000
--- a/PluginsV2/BadgesEverywhere/index.js
+++ /dev/null
@@ -1,202 +0,0 @@
-module.exports = (Plugin, Api, Vendor) => {
- if (!global.BDFDB || typeof BDFDB != "object") global.BDFDB = {myPlugins:{}, BDv2Api: Api};
-
- return class extends Plugin {
- initConstructor () {
- this.patchModules = {
- "NameTag":"componentDidMount",
- "MessageUsername":"componentDidMount"
- };
-
- this.css = `
- .BE-badge {
- display: inline-block;
- height: 17px !important;
- margin: 0 2px !important;
- }
- .BE-badge.BE-badge-chat {
- margin-bottom: -3px !important;
- }
- .BE-badge.BE-badge-popout {
- margin-bottom: -2px !important;
- }
- .BE-badge.BE-badge:first-of-type {
- margin-left: 5px !important;
- }
- .BE-badge.BE-badge:last-of-type {
- margin-right: 5px !important;
- }
- .BE-badge.BE-badge-Staff {width:17px !important; min-width:17px !important;}
- .BE-badge.BE-badge-Partner {width:22px !important; min-width:22px !important;}
- .BE-badge.BE-badge-HypeSquad {width:17px !important; min-width:17px !important;}
- .BE-badge.BE-badge-BugHunter {width:17px !important; min-width:17px !important;}
- .BE-badge.BE-badge-HypeSquadBravery {width:17px !important; min-width:17px !important;}
- .BE-badge.BE-badge-HypeSquadBrilliance {width:17px !important; min-width:17px !important;}
- .BE-badge.BE-badge-HypeSquadBalance {width:17px !important; min-width:17px !important;}
- .BE-badge.BE-badge-EarlySupporter {width:24px !important; min-width:24px !important;}
- .BE-badge.BE-badge-Nitro {width:21px !important; min-width:21px !important;}
- .BE-badge.BE-badge-settings {width:30px !important; min-width:30px !important;}`;
-
-
- this.requestedusers = {};
- this.loadedusers = {};
-
- this.defaults = {
- settings: {
- showInPopout: {value:true, description:"Show Badge in User Popout."},
- showInChat: {value:true, description:"Show Badge in Chat Window."},
- showInMemberList: {value:true, description:"Show Badge in Member List."},
- useColoredVersion: {value:true, description:"Use colored version of the Badges for Chat and Members."}
- },
- badges: {
- 1: {value:true, name:"Staff", selector:"profileBadgeStaff"},
- 2: {value:true, name:"Partner", selector:"profileBadgePartner"},
- 4: {value:true, name:"HypeSquad", selector:"profileBadgeHypesquad"},
- 8: {value:true, name:"BugHunter", selector:"profileBadgeBugHunter"},
- 16: {value:false, name:"MFASMS", selector:false},
- 32: {value:false, name:"PROMODISMISSED", selector:false},
- 64: {value:true, name:"HypeSquad Bravery", selector:"profileBadgeHypeSquadOnlineHouse1"},
- 128: {value:true, name:"HypeSquad Brilliance", selector:"profileBadgeHypeSquadOnlineHouse2"},
- 256: {value:true, name:"HypeSquad Balance", selector:"profileBadgeHypeSquadOnlineHouse3"},
- 512: {value:true, name:"Early Supporter", selector:"profileBadgeEarlySupporter"},
- 2048: {value:true, name:"Nitro", selector:"profileBadgePremium"}
- }
- };
- }
-
- onStart () {
- if (global.BDFDB && global.BDFDB.myPlugins && typeof global.BDFDB.myPlugins == "object") global.BDFDB.myPlugins[this.name] = this;
- var libraryScript = document.querySelector('head script[src="https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js"]');
- if (!global.BDFDB || typeof BDFDB != "object" || performance.now() - BDFDB.creationTime > 600000) {
- if (libraryScript) libraryScript.remove();
- libraryScript = document.createElement("script");
- libraryScript.setAttribute("type", "text/javascript");
- libraryScript.setAttribute("src", "https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js");
- libraryScript.setAttribute("date", performance.now());
- libraryScript.addEventListener("load", () => {if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();});
- document.head.appendChild(libraryScript);
- }
- else if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();
- this.startTimeout = setTimeout(() => {this.initialize();}, 30000);
- }
-
- initialize () {
- if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
- if (this.started) return true;
- BDFDB.loadMessage(this);
-
- this.APIModule = BDFDB.WebModules.findByProperties("getAPIBaseURL");
- this.DiscordConstants = BDFDB.WebModules.findByProperties("Permissions", "ActivityTypes", "StatusTypes");
- this.BadgeClasses = BDFDB.WebModules.findByProperties("profileBadgeStaff","profileBadgePremium");
-
- for (let flag in this.defaults.badges) if (!this.defaults.badges[flag].selector) delete this.defaults.badges[flag];
-
- BDFDB.WebModules.forceAllUpdates(this);
-
- return true;
- }
- else {
- console.error(`%c[${this.name}]%c`, 'color: #3a71c1; font-weight: 700;', '', 'Fatal Error: Could not load BD functions!');
- return false;
- }
- }
-
- onStop () {
- if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
- BDFDB.removeEles(".BE-badges");
-
- BDFDB.unloadMessage(this);
- return true;
- }
- else {
- return false;
- }
- }
-
-
- // begin of own functions
-
- processNameTag (instance, wrapper) {
- if (!wrapper.classList || !instance || !instance.props) return;
- else if (BDFDB.containsClass(wrapper, BDFDB.disCN.membernametag) && BDFDB.getData("showInMemberList", this, "settings")) {
- this.addBadges(instance.props.user, wrapper, "list");
- }
- else if (BDFDB.containsClass(wrapper, BDFDB.disCN.userpopoutheadertag) && BDFDB.getData("showInPopout", this, "settings")) {
- wrapper = BDFDB.containsClass(wrapper, BDFDB.disCN.userpopoutheadertagwithnickname) && wrapper.previousSibling ? wrapper.previousSibling : wrapper;
- this.addBadges(instance.props.user, wrapper, "popout");
- }
- }
-
- processMessageUsername (instance, wrapper) {
- let message = BDFDB.getReactValue(instance, "props.message");
- if (message) {
- let username = wrapper.querySelector(BDFDB.dotCN.messageusername);
- if (username && BDFDB.getData("showInChat", this, "settings")) this.addBadges(message.author, wrapper, "chat");
- }
- }
-
- addBadges (info, wrapper, type) {
- if (!info || info.bot || !wrapper) return;
- if (!this.requestedusers[info.id]) {
- this.requestedusers[info.id] = [[wrapper,type]];
- this.APIModule.get(this.DiscordConstants.Endpoints.USER_PROFILE(info.id)).then(result => {
- let usercopy = Object.assign({},result.body.user);
- if (result.body.premium_since) usercopy.flags += 2048;
- this.loadedusers[info.id] = usercopy;
- for (let queredobj of this.requestedusers[info.id]) this.addToWrapper(info, queredobj[0], queredobj[1]);
- });
- }
- else if (!this.loadedusers[info.id]) {
- this.requestedusers[info.id].push([wrapper,type]);
- }
- else {
- this.addToWrapper(info, wrapper, type);
- }
- }
-
- addToWrapper (info, wrapper, type) {
- BDFDB.removeEles(wrapper.querySelectorAll(".BE-badges"));
- let badges = BDFDB.getAllData(this, "badges");
- let settings = BDFDB.getAllData(this, "settings");
- let header = BDFDB.getParentEle(BDFDB.dotCN.userpopoutheader, wrapper);
- let badgewrapper = BDFDB.htmlToElement(``);
- for (let flag in this.defaults.badges) {
- if ((this.loadedusers[info.id].flags | flag) == this.loadedusers[info.id].flags && badges[flag]) {
- let badge = BDFDB.htmlToElement(`
${this.name}
`;
- for (let rtype in replaces) {
- var words = BDFDB.loadData(rtype, this, "words");
- settingshtml += `
`;
- for (let key in settings) {
- if (this.defaults.settings[key].enabled[rtype]) settingshtml += `
`;
- }
- settingshtml += `
${this.defaults.replaces[rtype].description} `;
- settingshtml += `
List of ${rtype} Words: `;
- for (let config of this.configs) {
- settingshtml += ``;
- }
- settingshtml += `
`;
- for (let word in words) {
- settingshtml += `
${BDFDB.encodeToHTML(word)} (${BDFDB.encodeToHTML(words[word].replace)})
`
- for (let config of this.configs) {
- settingshtml += `
`;
- }
- settingshtml += `
`;
- }
- settingshtml += `
`
- settingshtml += `
Remove all added words. Reset
`;
- settingshtml += `
`;
- }
- var infoHidden = BDFDB.loadData("hideInfo", this, "hideInfo");
- settingshtml += `
`;
- settingshtml += `
Case: Will block/censor words while comparing lowercase/uppercase. apple => apple, not APPLE or AppLe
Not Case: Will block/censor words while ignoring lowercase/uppercase. apple => apple, APPLE and AppLe
Exact: Will block/censor words that are exactly the selected word. apple => apple, not applepie or pineapple
Not Exact: Will block/censor all words containing the selected word. apple => apple, applepie and pineapple
Empty: Ignores the default and set replace word and removes the word/message instead.
`;
- settingshtml += `
`;
-
- let settingspanel = BDFDB.htmlToElement(settingshtml);
-
- BDFDB.initElements(settingspanel, this);
-
- BDFDB.addEventListener(this, settingspanel, "keypress", ".wordInputs", e => {if (e.which == 13) this.updateContainer(settingspanel, e.currentTarget);});
- BDFDB.addEventListener(this, settingspanel, "keyup", ".defaultInputs", e => {this.saveReplace(e.currentTarget);});
- BDFDB.addEventListener(this, settingspanel, "click", ".btn-addword, .remove-word, .remove-all", e => {this.updateContainer(settingspanel, e.currentTarget);});
- BDFDB.addEventListener(this, settingspanel, "click", BDFDB.dotCN.checkboxinput, e => {this.updateConfig(e.currentTarget);});
- BDFDB.addEventListener(this, settingspanel, "click", ".toggle-info", e => {this.toggleInfo(e.currentTarget);});
-
- return settingspanel;
- }
-
- onSettingsClosed () {
- if (this.SettingsUpdated) {
- delete this.SettingsUpdated;
- document.querySelectorAll(`${BDFDB.dotCN.messagemarkup}.blocked, ${BDFDB.dotCN.messageaccessory}.censored, ${BDFDB.dotCN.messagemarkup}.blocked, ${BDFDB.dotCN.messageaccessory}.censored`).forEach(message => {this.resetMessage(message);});
- BDFDB.WebModules.forceAllUpdates(this);
- }
- }
- }
-};
diff --git a/PluginsV2/CompleteTimestamps/README.md b/PluginsV2/CompleteTimestamps/README.md
deleted file mode 100644
index d5ac99ef6e..0000000000
--- a/PluginsV2/CompleteTimestamps/README.md
+++ /dev/null
@@ -1,5 +0,0 @@
-# These Plugins are meant only for BDv2, not BD nor BandagedBD. If you got either of those two go to [Plugins](https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/).
-
-## Complete Timestamp - [Download Script](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/CompleteTimestamps/index.js) [Download Config](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/CompleteTimestamps/config.json)
-
-Replace all timestamps with complete timestamps.
diff --git a/PluginsV2/CompleteTimestamps/config.json b/PluginsV2/CompleteTimestamps/config.json
deleted file mode 100644
index 7d3adbfd24..0000000000
--- a/PluginsV2/CompleteTimestamps/config.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "info": {
- "name": "CompleteTimestamps",
- "authors": [
- {
- "name": "DevilBro",
- "url": "https://www.paypal.me/MircoWittrien",
- "discord_id": "278543574059057154",
- "github_username": "mwittrien"
- }
- ],
- "version": 1.0,
- "description": "Replace all timestamps with complete timestamps. \n\nMy Support Server: http://bit.ly/DevilBrosHaus or https://discordapp.com/invite/Jx3TjNS"
- }
-}
diff --git a/PluginsV2/CompleteTimestamps/index.js b/PluginsV2/CompleteTimestamps/index.js
deleted file mode 100644
index b6ba93b4e7..0000000000
--- a/PluginsV2/CompleteTimestamps/index.js
+++ /dev/null
@@ -1,334 +0,0 @@
-module.exports = (Plugin, Api, Vendor) => {
- if (!global.BDFDB || typeof BDFDB != "object") global.BDFDB = {myPlugins:{}, BDv2Api: Api};
-
- return class extends Plugin {
- initConstructor () {
- this.patchModules = {
- "MessageGroup":["componentDidMount","componentDidUpdate"]
- };
-
- this.languages;
-
- this.defaults = {
- settings: {
- showInChat: {value:true, description:"Replace Chat Timestamp with Complete Timestamp:"},
- showOnHover: {value:false, description:"Also show Timestamp when you hover over a message:"},
- changeForEdit: {value:false, description:"Change the Time for the Edited Time Tooltips:"},
- displayTime: {value:true, description:"Display the Time in the Timestamp:"},
- displayDate: {value:true, description:"Display the Date in the Timestamp:"},
- cutSeconds: {value:false, description:"Cut off Seconds of the Time:"},
- forceZeros: {value:false, description:"Force leading Zeros:"},
- otherOrder: {value:false, description:"Show the Time before the Date:"}
- },
- choices: {
- creationDateLang: {value:"$discord", description:"Timestamp Format:"}
- },
- formats: {
- ownFormat: {value:"$hour:$minute:$second, $day.$month.$year", description:"Own Format:"}
- }
- };
- }
-
- onStart () {
- if (global.BDFDB && global.BDFDB.myPlugins && typeof global.BDFDB.myPlugins == "object") global.BDFDB.myPlugins[this.name] = this;
- var libraryScript = document.querySelector('head script[src="https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js"]');
- if (!global.BDFDB || typeof BDFDB != "object" || performance.now() - BDFDB.creationTime > 600000) {
- if (libraryScript) libraryScript.remove();
- libraryScript = document.createElement("script");
- libraryScript.setAttribute("type", "text/javascript");
- libraryScript.setAttribute("src", "https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js");
- libraryScript.setAttribute("date", performance.now());
- libraryScript.addEventListener("load", () => {if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();});
- document.head.appendChild(libraryScript);
- }
- else if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();
- this.startTimeout = setTimeout(() => {this.initialize();}, 30000);
- }
-
- initialize () {
- if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
- if (this.started) return true;
- BDFDB.loadMessage(this);
-
- this.languages = Object.assign({"own":{name:"Own",id:"own",integrated:false,dic:false}},BDFDB.languages);
-
- BDFDB.addEventListener(this, document, "mouseenter", BDFDB.dotCNS.message + BDFDB.dotCN.messagecontent, e => {
- if (BDFDB.getData("showOnHover", this, "settings")) {
- let message = e.currentTarget;
- let messagegroup = BDFDB.getParentEle(BDFDB.dotCN.messagegroup, message);
- if (!messagegroup || !messagegroup.tagName) return;
- let info = this.getMessageData(message, messagegroup);
- if (!info || !info.timestamp || !info.timestamp._i) return;
- let choice = BDFDB.getData("creationDateLang", this, "choices");
- BDFDB.createTooltip(this.getTimestamp(this.languages[choice].id, info.timestamp._i), message, {type:"left",selector:"completetimestamp-tooltip"});
- }
- });
- BDFDB.addEventListener(this, document, "mouseenter", BDFDB.dotCNS.message + BDFDB.dotCN.messageedited, e => {
- if (BDFDB.getData("changeForEdit", this, "settings")) {
- let marker = e.currentTarget;
- let time = marker.getAttribute("datetime");
- if (!time) return;
- let choice = BDFDB.getData("creationDateLang", this, "choices");
- let customTooltipCSS = `
- body ${BDFDB.dotCN.tooltip}:not(.completetimestampedit-tooltip) {
- display: none !important;
- }`;
- BDFDB.createTooltip(this.getTimestamp(this.languages[choice].id, time), marker, {type:"top",selector:"completetimestampedit-tooltip",css:customTooltipCSS});
- }
- });
-
- BDFDB.WebModules.forceAllUpdates(this);
-
- return true;
- }
- else {
- console.error(`%c[${this.name}]%c`, 'color: #3a71c1; font-weight: 700;', '', 'Fatal Error: Could not load BD functions!');
- return false;
- }
- }
-
-
- onStop () {
- if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
- BDFDB.removeEles(".complete-timestamp-divider");
- BDFDB.removeClasses("complete-timestamp");
-
- BDFDB.removeLocalStyle(this.name + "CompactCorrection");
-
- BDFDB.unloadMessage(this);
- return true;
- }
- else {
- return false;
- }
- }
-
-
- // begin of own functions
-
- saveInputs (settingspanel) {
- let formats = {};
- for (let input of settingspanel.querySelectorAll(BDFDB.dotCN.input)) {
- formats[input.getAttribute("option")] = input.value;
- }
- BDFDB.saveAllData(formats, this, "formats");
- this.updateSettingsPanel(settingspanel);
- }
-
- updateSettingsPanel (settingspanel) {
- let choices = BDFDB.getAllData(this, "choices");
- for (let key in choices) {
- settingspanel.querySelector(`${BDFDB.dotCN.select}[option='${key}'] .languageTimestamp`).innerText = this.getTimestamp(this.languages[choices[key]].id);
- }
- this.SettingsUpdated = true;
- }
-
- toggleInfo (ele) {
- BDFDB.toggleClass(ele, BDFDB.disCN.categorywrappercollapsed);
- BDFDB.toggleClass(ele, BDFDB.disCN.categorywrapperdefault);
- var svg = ele.querySelector(BDFDB.dotCN.categoryicontransition);
- BDFDB.toggleClass(svg, BDFDB.disCN.directionright);
- BDFDB.toggleClass(svg, BDFDB.disCN.categoryiconcollapsed);
- BDFDB.toggleClass(svg, BDFDB.disCN.categoryicondefault);
-
- BDFDB.toggleEles(ele.nextElementSibling);
- BDFDB.saveData("hideInfo", BDFDB.isEleHidden(ele.nextElementSibling), this, "hideInfo");
- }
-
- openDropdownMenu (e) {
- let selectControl = e.currentTarget;
- let selectWrap = selectControl.parentElement;
- let plugincard = BDFDB.getParentEle("li", selectWrap);
-
- if (!plugincard || BDFDB.containsClass(selectWrap, BDFDB.disCN.selectisopen)) return;
-
- BDFDB.addClass(selectWrap, BDFDB.disCN.selectisopen);
- plugincard.style.setProperty("overflow", "visible", "important");
-
- let selectMenu = this.createDropdownMenu(selectWrap.getAttribute("value"));
- selectWrap.appendChild(selectMenu);
-
- BDFDB.addChildEventListener(selectMenu, "mousedown", BDFDB.dotCN.selectoption, e2 => {
- let language = e2.currentTarget.getAttribute("value");
- selectWrap.setAttribute("value", language);
- selectControl.querySelector(".languageName").innerText = this.languages[language].name;
- selectControl.querySelector(".languageTimestamp").innerText = this.getTimestamp(this.languages[language].id);
- BDFDB.saveData(selectWrap.getAttribute("option"), language, this, "choices");
- });
-
- var removeMenu = e2 => {
- if (e2.target.parentElement != selectMenu) {
- document.removeEventListener("mousedown", removeMenu);
- selectMenu.remove();
- plugincard.style.removeProperty("overflow");
- setTimeout(() => {BDFDB.removeClass(selectWrap, BDFDB.disCN.selectisopen);},100);
- }
- };
-
- document.addEventListener("mousedown", removeMenu);
- }
-
- createDropdownMenu (choice) {
- let menuhtml = ``;
- return BDFDB.htmlToElement(menuhtml);
- }
-
- processMessageGroup (instance, wrapper) {
- if (BDFDB.getData("showInChat", this, "settings")) for (let stamp of wrapper.querySelectorAll("time[datetime]")) this.changeTimestamp(stamp);
- }
-
- changeTimestamp (stamp) {
- if (!stamp.className || stamp.className.toLowerCase().indexOf("timestamp") == -1 || BDFDB.containsClass(stamp, "complete-timestamp")) return;
- let time = stamp.getAttribute("datetime");
- if (time) {
- this.setMaxWidth();
- BDFDB.addClass(stamp, "complete-timestamp");
- let stampdivider = document.createElement("span");
- stampdivider.className = "complete-timestamp-divider arabic-fix";
- stampdivider.style.setProperty("display", "inline", "important");
- stampdivider.style.setProperty("height", "0px", "important");
- stampdivider.style.setProperty("width", "0px", "important");
- stampdivider.style.setProperty("font-size", "0px", "important");
- stampdivider.innerText = "ARABIC FIX";
- stamp.parentElement.insertBefore(stampdivider, stamp);
- BDFDB.setInnerText(stamp, this.getTimestamp(this.languages[BDFDB.getData("creationDateLang", this, "choices")].id, time));
- }
- }
-
- getMessageData (div, messagegroup) {
- let pos = Array.from(messagegroup.querySelectorAll("." + div.className.replace(/ /g, "."))).indexOf(div);
- let instance = BDFDB.getReactInstance(messagegroup);
- if (!instance) return;
- let info = instance.return.stateNode.props.messages;
- return info && pos > -1 ? info[pos] : null;
- }
-
- getTimestamp (languageid, time) {
- let timeobj = time ? time : new Date();
- if (typeof time == "string") timeobj = new Date(time);
- if (timeobj.toString() == "Invalid Date") timeobj = new Date(parseInt(time));
- if (timeobj.toString() == "Invalid Date") return;
- let settings = BDFDB.getAllData(this, "settings"), timestring = "";
- if (languageid != "own") {
- let timestamp = [];
- if (settings.displayDate) timestamp.push(timeobj.toLocaleDateString(languageid));
- if (settings.displayTime) timestamp.push(settings.cutSeconds ? this.cutOffSeconds(timeobj.toLocaleTimeString(languageid)) : timeobj.toLocaleTimeString(languageid));
- if (settings.otherOrder) timestamp.reverse();
- timestring = timestamp.length > 1 ? timestamp.join(", ") : (timestamp.length > 0 ? timestamp[0] : "");
- if (timestring && settings.forceZeros) timestring = this.addLeadingZeros(timestring);
- }
- else {
- let ownformat = BDFDB.getData("ownFormat", this, "formats");
- languageid = BDFDB.getDiscordLanguage().id;
- let hour = timeobj.getHours(), minute = timeobj.getMinutes(), second = timeobj.getSeconds(), msecond = timeobj.getMilliseconds(), day = timeobj.getDate(), month = timeobj.getMonth()+1, timemode = "";
- if (ownformat.indexOf("$timemode") > -1) {
- timemode = hour >= 12 ? "PM" : "AM";
- hour = hour % 12;
- hour = hour ? hour : 12;
- }
- timestring = ownformat
- .replace("$hour", settings.forceZeros && hour < 10 ? "0" + hour : hour)
- .replace("$minute", minute < 10 ? "0" + minute : minute)
- .replace("$second", second < 10 ? "0" + second : second)
- .replace("$msecond", msecond)
- .replace("$timemode", timemode)
- .replace("$weekdayL", timeobj.toLocaleDateString(languageid,{weekday: "long"}))
- .replace("$weekdayS", timeobj.toLocaleDateString(languageid,{weekday: "short"}))
- .replace("$monthnameL", timeobj.toLocaleDateString(languageid,{month: "long"}))
- .replace("$monthnameS", timeobj.toLocaleDateString(languageid,{month: "short"}))
- .replace("$day", settings.forceZeros && day < 10 ? "0" + day : day)
- .replace("$month", settings.forceZeros && month < 10 ? "0" + month : month)
- .replace("$year", timeobj.getFullYear());
- }
- return timestring;
- }
-
- cutOffSeconds (timestring) {
- return timestring.replace(/(.*):(.*):(.{2})(.*)/, "$1:$2$4");
- }
-
- addLeadingZeros (timestring) {
- let chararray = timestring.split("");
- let numreg = /[0-9]/;
- for (let i = 0; i < chararray.length; i++) {
- if (!numreg.test(chararray[i-1]) && numreg.test(chararray[i]) && !numreg.test(chararray[i+1])) chararray[i] = "0" + chararray[i];
- }
-
- return chararray.join("");
- }
-
- setMaxWidth () {
- if (this.currentMode != BDFDB.getDiscordMode()) {
- this.currentMode = BDFDB.getDiscordMode();
- let timestamp = document.querySelector(BDFDB.dotCN.messagetimestampcompact);
- if (timestamp) {
- let choice = BDFDB.getData("creationDateLang", this, "choices");
- let testtimestamp = BDFDB.htmlToElement(`
${this.getTimestamp(this.languages[choice].id, new Date(253402124399995))} `);
- document.body.appendChild(testtimestamp);
- let width = BDFDB.getRects(testtimestamp).width + 5;
- testtimestamp.remove();
- BDFDB.appendLocalStyle(this.name + "CompactCorrection", `
- ${BDFDB.dotCN.messagetimestampcompact} {
- width: ${width}px !important;
- }
- ${BDFDB.dotCN.messagetimestampcompactismentioned} {
- width: ${width + 2}px !important;
- }
- ${BDFDB.dotCN.messagemarkupiscompact} {
- margin-left: ${width}px !important;
- text-indent: -${width}px !important;
- }
- ${BDFDB.dotCN.messageaccessorycompact} {
- padding-left: ${width}px !important;
- }
- `);
- }
- else BDFDB.removeLocalStyle(this.name + "CompactCorrection");
- }
- }
-
- getSettingsPanel () {
- if (!global.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
- let settings = BDFDB.getAllData(this, "settings");
- let choices = BDFDB.getAllData(this, "choices");
- let formats = BDFDB.getAllData(this, "formats");
- let settingshtml = `
${this.name}
`;
- for (let key in settings) {
- settingshtml += `
`;
- }
- for (let key in choices) {
- settingshtml += `
${this.defaults.choices[key].description} ${this.languages[choices[key]].name}
${this.getTimestamp(this.languages[choices[key]].id)}
`;
- }
- for (let key in formats) {
- settingshtml += `
`;
- }
- let infoHidden = BDFDB.loadData("hideInfo", this, "hideInfo");
- settingshtml += `
`;
- settingshtml += `
`;
- settingshtml += `
$hour will be replaced with the current hour
$minute will be replaced with the current minutes
$second will be replaced with the current seconds
$msecond will be replaced with the current milliseconds
$timemode will change $hour to a 12h format and will be replaced with AM/PM
$year will be replaced with the current year
$month will be replaced with the current month
$day will be replaced with the current day
$monthnameL will be replaced with the monthname in long format based on the Discord Language
$monthnameS will be replaced with the monthname in short format based on the Discord Language
$weekdayL will be replaced with the weekday in long format based on the Discord Language
$weekdayS will be replaced with the weekday in short format based on the Discord Language
`;
- settingshtml += `
`;
-
- let settingspanel = BDFDB.htmlToElement(settingshtml);
-
- BDFDB.initElements(settingspanel, this);
-
- BDFDB.addEventListener(this, settingspanel, "click", ".settings-switch", () => {this.updateSettingsPanel(settingspanel);});
- BDFDB.addEventListener(this, settingspanel, "keyup", BDFDB.dotCN.input, () => {this.saveInputs(settingspanel);});
- BDFDB.addEventListener(this, settingspanel, "click", BDFDB.dotCN.selectcontrol, e => {this.openDropdownMenu(e);});
- BDFDB.addEventListener(this, settingspanel, "click", ".toggle-info", e => {this.toggleInfo(e.currentTarget);});
- return settingspanel;
- }
-
- onSettingsClosed () {
- if (this.SettingsUpdated) {
- delete this.SettingsUpdated;
- BDFDB.WebModules.forceAllUpdates(this);
- }
- }
- }
-};
diff --git a/PluginsV2/CreationDate/README.md b/PluginsV2/CreationDate/README.md
deleted file mode 100644
index 17dff8a6d5..0000000000
--- a/PluginsV2/CreationDate/README.md
+++ /dev/null
@@ -1,5 +0,0 @@
-# These Plugins are meant only for BDv2, not BD nor BandagedBD. If you got either of those two go to [Plugins](https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/).
-
-## Creation Date - [Download Script](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/CreationDate/index.js) [Download Config](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/CreationDate/config.json)
-
-Displays the Creation Date of an Account in the UserPopout and UserModal.
diff --git a/PluginsV2/CreationDate/config.json b/PluginsV2/CreationDate/config.json
deleted file mode 100644
index 2bd6b79bbd..0000000000
--- a/PluginsV2/CreationDate/config.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "info": {
- "name": "CreationDate",
- "authors": [
- {
- "name": "DevilBro",
- "url": "https://www.paypal.me/MircoWittrien",
- "discord_id": "278543574059057154",
- "github_username": "mwittrien"
- }
- ],
- "version": 1.0,
- "description": "Displays the Creation Date of an Account in the UserPopout and UserModal. \n\nMy Support Server: http://bit.ly/DevilBrosHaus or https://discordapp.com/invite/Jx3TjNS"
- }
-}
diff --git a/PluginsV2/CreationDate/index.js b/PluginsV2/CreationDate/index.js
deleted file mode 100644
index 7b9bce9c5a..0000000000
--- a/PluginsV2/CreationDate/index.js
+++ /dev/null
@@ -1,299 +0,0 @@
-module.exports = (Plugin, Api, Vendor) => {
- if (!global.BDFDB || typeof BDFDB != "object") global.BDFDB = {myPlugins:{}, BDv2Api: Api};
-
- return class extends Plugin {
- initConstructor () {
- this.labels = {};
-
- this.patchModules = {
- "UserPopout":"componentDidMount",
- "UserProfile":"componentDidMount"
- };
-
- this.languages;
-
- this.css = `
- ${BDFDB.dotCNS.userpopout + BDFDB.dotCN.nametag} {
- margin-bottom: 4px;
- }
- ${BDFDB.dotCN.userprofile} .creationDate {
- margin-right: 20px;
- }
- ${BDFDB.dotCNS.themelight + BDFDB.dotCN.userpopoutheadernormal} .creationDate {
- color: #b9bbbe;
- }
- ${BDFDB.dotCNS.themelight + BDFDB.dotCN.userpopoutheader + BDFDB.notCN.userpopoutheadernormal} .creationDate,
- ${BDFDB.dotCNS.themedark + BDFDB.dotCN.userpopoutheader} .creationDate {
- color: hsla(0,0%,100%,.6);
- }
- ${BDFDB.dotCNS.themelight + BDFDB.dotCN.userprofiletopsectionnormal} .creationDate {
- color: hsla(216,4%,74%,.6);
- }
- ${BDFDB.dotCN.themelight} [class*='topSection']${BDFDB.notCN.userprofiletopsectionnormal} .creationDate,
- ${BDFDB.dotCN.themedark} [class*='topSection'] .creationDate {
- color: hsla(0,0%,100%,.6);
- }`;
-
-
- this.defaults = {
- settings: {
- addInUserPopout: {value:true, description:"Add in User Popouts:"},
- addInUserProfil: {value:true, description:"Add in User Profil Modal:"},
- addCreationTime: {value:true, description:"Display the Time of Creation:"},
- forceZeros: {value:false, description:"Force leading Zeros:"}
- },
- choices: {
- creationDateLang: {value:"$discord", description:"Creation Date Format:"}
- }
- };
- }
-
- onStart () {
- if (global.BDFDB && global.BDFDB.myPlugins && typeof global.BDFDB.myPlugins == "object") global.BDFDB.myPlugins[this.name] = this;
- var libraryScript = document.querySelector('head script[src="https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js"]');
- if (!global.BDFDB || typeof BDFDB != "object" || performance.now() - BDFDB.creationTime > 600000) {
- if (libraryScript) libraryScript.remove();
- libraryScript = document.createElement("script");
- libraryScript.setAttribute("type", "text/javascript");
- libraryScript.setAttribute("src", "https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js");
- libraryScript.setAttribute("date", performance.now());
- libraryScript.addEventListener("load", () => {if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();});
- document.head.appendChild(libraryScript);
- }
- else if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();
- this.startTimeout = setTimeout(() => {this.initialize();}, 30000);
- }
-
- initialize () {
- if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
- if (this.started) return true;
- BDFDB.loadMessage(this);
-
- this.languages = Object.assign({},BDFDB.languages);
-
- BDFDB.WebModules.forceAllUpdates(this);
-
- return true;
- }
- else {
- console.error(`%c[${this.name}]%c`, 'color: #3a71c1; font-weight: 700;', '', 'Fatal Error: Could not load BD functions!');
- return false;
- }
- }
-
-
- onStop () {
- if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
- BDFDB.removeEles(".creationDate");
- BDFDB.unloadMessage(this);
- return true;
- }
- else {
- return false;
- }
- }
-
-
- // begin of own functions
-
- openDropdownMenu (e) {
- let selectControl = e.currentTarget;
- let selectWrap = selectControl.parentElement;
- let plugincard = BDFDB.getParentEle("li", selectWrap);
-
- if (!plugincard || BDFDB.containsClass(selectWrap, BDFDB.disCN.selectisopen)) return;
-
- BDFDB.addClass(selectWrap, BDFDB.disCN.selectisopen);
- plugincard.style.setProperty("overflow", "visible", "important");
-
- let type = selectWrap.getAttribute("type");
- let selectMenu = this.createDropdownMenu(selectWrap.getAttribute("value"));
- selectWrap.appendChild(selectMenu);
-
- BDFDB.addChildEventListener(selectMenu, "mousedown", BDFDB.dotCN.selectoption, e2 => {
- let language = e2.currentTarget.getAttribute("value");
- selectWrap.setAttribute("value", language);
- selectControl.querySelector(".languageName").innerText = this.languages[language].name;
- selectControl.querySelector(".languageTimestamp").innerText = this.getCreationTime(language);
- BDFDB.saveData(type, language, this, "choices");
- });
-
- var removeMenu = e2 => {
- if (e2.target.parentElement != selectMenu) {
- document.removeEventListener("mousedown", removeMenu);
- selectMenu.remove();
- plugincard.style.removeProperty("overflow");
- setTimeout(() => {BDFDB.removeClass(selectWrap, BDFDB.disCN.selectisopen);},100);
- }
- };
-
- document.addEventListener("mousedown", removeMenu);
- }
-
- createDropdownMenu (choice) {
- let menuhtml = ``;
- return BDFDB.htmlToElement(menuhtml);
- }
-
- processUserPopout (instance, wrapper) {
- if (instance.props && instance.props.user && BDFDB.getData("addInUserPopout", this, "settings")) {
- this.addCreationDate(instance.props.user, wrapper.querySelector(BDFDB.dotCN.userpopoutheadertext), wrapper.parentElement);
- }
- }
-
- processUserProfile (instance, wrapper) {
- if (instance.props && instance.props.user && BDFDB.getData("addInUserProfil", this, "settings")) {
- this.addCreationDate(instance.props.user, wrapper.querySelector(BDFDB.dotCN.userprofileheaderinfo), null);
- }
- }
-
- addCreationDate (info, container, popout) {
- if (!info || !container || container.querySelector(".creationDate")) return;
- let choice = BDFDB.getData("creationDateLang", this, "choices");
- let nametag = container.querySelector(BDFDB.dotCN.nametag);
- let joinedAtDate = container.querySelector(".joinedAtDate");
- container.insertBefore(BDFDB.htmlToElement(`
${this.labels.createdat_text + " " + this.getCreationTime(this.languages[choice].id, info.createdAt)}
`), joinedAtDate ? joinedAtDate.nextSibling : (nametag ? nametag.nextSibling : null));
- BDFDB.initElements(container.parentElement, this);
- if (popout && popout.style.transform.indexOf("translateY(-1") == -1) {
- let arect = BDFDB.getRects(document.querySelector(BDFDB.dotCN.appmount));
- let prect = BDFDB.getRects(popout);
- popout.style.setProperty("top", (prect.y + prect.height > arect.height ? (arect.height - prect.height) : prect.y) + "px");
- }
- }
-
- getCreationTime (languageid, timestamp = new Date()) {
- let settings = BDFDB.getAllData(this, "settings");
- let timestring = settings.addCreationTime ? timestamp.toLocaleString(languageid) : timestamp.toLocaleDateString(languageid);
- if (timestring && settings.forceZeros) timestring = this.addLeadingZeros(timestring);
- return timestring;
- }
-
- addLeadingZeros (timestring) {
- let chararray = timestring.split("");
- let numreg = /[0-9]/;
- for (let i = 0; i < chararray.length; i++) {
- if (!numreg.test(chararray[i-1]) && numreg.test(chararray[i]) && !numreg.test(chararray[i+1])) chararray[i] = "0" + chararray[i];
- }
- return chararray.join("");
- }
-
- getSettingsPanel () {
- if (!global.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
- let settings = BDFDB.getAllData(this, "settings");
- let choices = BDFDB.getAllData(this, "choices");
- let settingshtml = `
${this.name}
`;
- for (let key in settings) {
- settingshtml += `
`;
- }
- for (let key in choices) {
- settingshtml += `
${this.defaults.choices[key].description} ${this.languages[choices[key]].name}
${this.getCreationTime(this.languages[choices[key]].id)}
`;
- }
- settingshtml += `
`;
-
- let settingspanel = BDFDB.htmlToElement(settingshtml);
-
- BDFDB.initElements(settingspanel, this);
-
- BDFDB.addEventListener(this, settingspanel, "click", ".settings-switch", () => {
- let choices = BDFDB.getAllData(this, "choices");
- for (let key in choices) settingspanel.querySelector(`${BDFDB.dotCN.select}[type='${key}'] .languageTimestamp`).innerText = this.getCreationTime(this.languages[choices[key]].id);
- });
- BDFDB.addEventListener(this, settingspanel, "click", BDFDB.dotCN.selectcontrol, e => {this.openDropdownMenu(e);});
- return settingspanel;
- }
-
- setLabelsByLanguage () {
- switch (BDFDB.getDiscordLanguage().id) {
- case "hr": //croatian
- return {
- createdat_text: "Izrađen"
- };
- case "da": //danish
- return {
- createdat_text: "Oprettet den"
- };
- case "de": //german
- return {
- createdat_text: "Erstellt am"
- };
- case "es": //spanish
- return {
- createdat_text: "Creado el"
- };
- case "fr": //french
- return {
- createdat_text: "Créé le"
- };
- case "it": //italian
- return {
- createdat_text: "Creato il"
- };
- case "nl": //dutch
- return {
- createdat_text: "Gemaakt op"
- };
- case "no": //norwegian
- return {
- createdat_text: "Opprettet på"
- };
- case "pl": //polish
- return {
- createdat_text: "Utworzono"
- };
- case "pt-BR": //portuguese (brazil)
- return {
- createdat_text: "Criado em"
- };
- case "fi": //finnish
- return {
- createdat_text: "Luotu"
- };
- case "sv": //swedish
- return {
- createdat_text: "Skapat den"
- };
- case "tr": //turkish
- return {
- createdat_text: "Oluşturma tarihi"
- };
- case "cs": //czech
- return {
- createdat_text: "Vytvořeno dne"
- };
- case "bg": //bulgarian
- return {
- createdat_text: "Създадена на"
- };
- case "ru": //russian
- return {
- createdat_text: "Создано"
- };
- case "uk": //ukrainian
- return {
- createdat_text: "Створено"
- };
- case "ja": //japanese
- return {
- createdat_text: "作成日"
- };
- case "zh-TW": //chinese (traditional)
- return {
- createdat_text: "創建於"
- };
- case "ko": //korean
- return {
- createdat_text: "생성 일"
- };
- default: //default: english
- return {
- createdat_text: "Created on"
- };
- }
- }
- }
-};
diff --git a/PluginsV2/DisplayServersAsChannels/README.md b/PluginsV2/DisplayServersAsChannels/README.md
deleted file mode 100644
index 89374553a6..0000000000
--- a/PluginsV2/DisplayServersAsChannels/README.md
+++ /dev/null
@@ -1,5 +0,0 @@
-# These Plugins are meant only for BDv2, not BD nor BandagedBD. If you got either of those two go to [Plugins](https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/).
-
-## Display Servers As Channels - [Download Script](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/DisplayServersAsChannels/index.js) [Download Config](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/DisplayServersAsChannels/config.json)
-
-Display servers in a similar way as channels.
diff --git a/PluginsV2/DisplayServersAsChannels/config.json b/PluginsV2/DisplayServersAsChannels/config.json
deleted file mode 100644
index 83064207ba..0000000000
--- a/PluginsV2/DisplayServersAsChannels/config.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "info": {
- "name": "DisplayServersAsChannels",
- "authors": [
- {
- "name": "DevilBro",
- "url": "https://www.paypal.me/MircoWittrien",
- "discord_id": "278543574059057154",
- "github_username": "mwittrien"
- }
- ],
- "version": 1.0,
- "description": "Display servers in a similar way as channels. \n\nMy Support Server: http://bit.ly/DevilBrosHaus or https://discordapp.com/invite/Jx3TjNS"
- }
-}
diff --git a/PluginsV2/DisplayServersAsChannels/index.js b/PluginsV2/DisplayServersAsChannels/index.js
deleted file mode 100644
index 288f8c6857..0000000000
--- a/PluginsV2/DisplayServersAsChannels/index.js
+++ /dev/null
@@ -1,301 +0,0 @@
-module.exports = (Plugin, Api, Vendor) => {
- if (!global.BDFDB || typeof BDFDB != "object") global.BDFDB = {myPlugins:{}, BDv2Api: Api};
-
- return class extends Plugin {
- initConstructor () {
- this.verificationBadgeMarkup =
- `
-
-
-
-
-
- `;
-
- this.css = `
- .bd-minimal .DSAC-styled ${BDFDB.dotCN.guildswrapper},
- .bd-minimal .DSAC-styled ${BDFDB.dotCN.guildsscrollerwrap},
- .bd-minimal .DSAC-styled ${BDFDB.dotCN.guilds} {
- width: 160px;
- }
- body.DSAC-styled .bd-settings-button,
- .DSAC-styled ${BDFDB.dotCN.guildswrapper},
- .DSAC-styled ${BDFDB.dotCN.guildsscrollerwrap},
- .DSAC-styled ${BDFDB.dotCN.guilds} {
- width: 240px;
- }
- .DSAC-styled ${BDFDB.dotCN.guilds}::-webkit-scrollbar-track-piece {
- background-color: rgb(27, 29, 32);
- border-color: rgb(32, 34, 37);
- }
- .DSAC-styled ${BDFDB.dotCN.guilds}::-webkit-scrollbar-thumb {
- background-color: rgb(17, 19, 22);
- border-color: rgb(32, 34, 37);
- }
- .bd-minimal .DSAC-styled ${BDFDB.dotCN.guild} {
- margin-left: 55px;
- }
- .bd-minimal .DSAC-styled ${BDFDB.dotCN.friendsonline} {
- margin-left: 40px;
- }
- .bd-minimal .DSAC-styled ${BDFDB.dotCN.guildseparator} ~ ${BDFDB.dotCN.guild},
- .bd-minimal .DSAC-styled ${BDFDB.dotCN.guildseparator} ~ ${BDFDB.dotCNS.guild + BDFDB.dotCN.guildinner},
- .bd-minimal .DSAC-styled ${BDFDB.dotCN.guildseparator} ~ ${BDFDB.dotCNS.guild + BDFDB.dotCN.guildinner} a,
- .bd-minimal .DSAC-styled ${BDFDB.dotCN.guildseparator} ~ ${BDFDB.dotCNS.guild + BDFDB.dotCNS.guildinner + BDFDB.dotCN.guildicon},
- .bd-minimal .DSAC-styled ${BDFDB.dotCN.guild}.copy,
- .bd-minimal .DSAC-styled ${BDFDB.dotCN.guild}.copy ${BDFDB.dotCN.guildinner},
- .bd-minimal .DSAC-styled ${BDFDB.dotCN.guild}.copy ${BDFDB.dotCN.guildinner} a,
- .bd-minimal .DSAC-styled ${BDFDB.dotCN.guild}.copy ${BDFDB.dotCNS.guildinner + BDFDB.dotCN.guildicon},
- .bd-minimal .DSAC-styled ${BDFDB.dotCN.guildseparator} ~ ${BDFDB.dotCNS.guild + BDFDB.dotCN.guildserror} {
- height: 20px;
- }
- .bd-minimal .DSAC-styled ${BDFDB.dotCN.guildseparator} ~ ${BDFDB.dotCNS.guild + BDFDB.dotCNS.guildinner + BDFDB.dotCN.guildicon},
- .bd-minimal .DSAC-styled ${BDFDB.dotCN.guild}.copy ${BDFDB.dotCNS.guildinner + BDFDB.dotCN.guildicon} {
- line-height: 20px;
- }
- .DSAC-styled ${BDFDB.dotCN.guildseparator} ~ ${BDFDB.dotCN.guild},
- .DSAC-styled ${BDFDB.dotCN.guildseparator} ~ ${BDFDB.dotCNS.guild + BDFDB.dotCN.guildinner},
- .DSAC-styled ${BDFDB.dotCN.guildseparator} ~ ${BDFDB.dotCNS.guild + BDFDB.dotCN.guildinner} a,
- .DSAC-styled ${BDFDB.dotCN.guildseparator} ~ ${BDFDB.dotCNS.guild + BDFDB.dotCNS.guildinner + BDFDB.dotCN.guildicon},
- .DSAC-styled ${BDFDB.dotCN.guild}.copy,
- .DSAC-styled ${BDFDB.dotCN.guild}.copy ${BDFDB.dotCN.guildinner},
- .DSAC-styled ${BDFDB.dotCN.guild}.copy ${BDFDB.dotCN.guildinner} a,
- .DSAC-styled ${BDFDB.dotCN.guild}.copy ${BDFDB.dotCNS.guildinner + BDFDB.dotCN.guildicon},
- .DSAC-styled ${BDFDB.dotCN.guildseparator} ~ ${BDFDB.dotCNS.guild + BDFDB.dotCN.guildserror} {
- margin-left: 0px;
- height: 32px;
- }
- .DSAC-styled ${BDFDB.dotCN.guildseparator} {
- margin-left: 0px;
- }
- .DSAC-styled ${BDFDB.dotCN.guild},
- .DSAC-styled ${BDFDB.dotCN.friendsonline} {
- margin-left: 80px;
- }
- .DSAC-styled ${BDFDB.dotCN.guild}.folder.open ${BDFDB.dotCN.guildicon} {
- text-decoration: underline;
- }
- .bd-minimal .DSAC-styled ${BDFDB.dotCN.guildseparator},
- .bd-minimal .DSAC-styled ${BDFDB.dotCN.guildseparator} ~ ${BDFDB.dotCN.guild},
- .bd-minimal .DSAC-styled ${BDFDB.dotCN.guild}.copy,
- .bd-minimal .DSAC-styled ${BDFDB.dotCN.guildseparator} ~ ${BDFDB.dotCNS.guild + BDFDB.dotCN.guildserror} {
- width: 130px;
- }
- .DSAC-styled ${BDFDB.dotCN.guildseparator},
- .DSAC-styled ${BDFDB.dotCN.guildseparator} ~ ${BDFDB.dotCN.guild},
- .DSAC-styled ${BDFDB.dotCN.guild}.copy,
- .DSAC-styled ${BDFDB.dotCN.guildseparator} ~ ${BDFDB.dotCNS.guild + BDFDB.dotCN.guildserror} {
- width: 215px;
- box-sizing: border-box;
- opacity: 0.4;
- padding-left: 5px;
- border-radius: 3px;
- align-items: center;
- justify-content: flex-start;
- }
- .DSAC-styled ${BDFDB.dotCN.guildseparator}:not([style*="display: none"]),
- .DSAC-styled ${BDFDB.dotCN.guildseparator} ~ ${BDFDB.dotCN.guild}:not([style*="display: none"]),
- .DSAC-styled ${BDFDB.dotCN.guild}.copy:not([style*="display: none"]),
- .DSAC-styled ${BDFDB.dotCN.guildseparator} ~ ${BDFDB.dotCNS.guild + BDFDB.dotCN.guildserror}:not([style*="display: none"]) {
- display: flex;
- }
- .DSAC-styled ${BDFDB.dotCN.guild + BDFDB.dotCN.guildunread}.copy.
- .DSAC-styled ${BDFDB.dotCN.guildseparator} ~ ${BDFDB.dotCN.guild + BDFDB.dotCN.guildunread} {
- opacity: 0.7;
- }
- .DSAC-styled ${BDFDB.dotCN.guild}.copy:not(${BDFDB.dotCN.guildselected}):hover,
- .DSAC-styled ${BDFDB.dotCN.guildseparator} ~ ${BDFDB.dotCN.guild + BDFDB.notCN.guildselected}:hover {
- opacity: 0.9;
- background-color: rgba(79,84,92,.3);
- }
- .DSAC-styled ${BDFDB.dotCN.guild + BDFDB.dotCN.guildselected}.copy,
- .DSAC-styled ${BDFDB.dotCN.guildseparator} ~ ${BDFDB.dotCN.guild + BDFDB.dotCN.guildselected} {
- opacity: 1;
- background-color: rgba(79,84,92,.6);
- }
- .DSAC-styled ${BDFDB.dotCN.guild}.copy > div[draggable],
- .DSAC-styled ${BDFDB.dotCN.guildseparator} ~ ${BDFDB.dotCN.guild} > div[draggable] {
- flex: 1 1 auto;
- }
- .DSAC-styled ${BDFDB.dotCN.guild + BDFDB.dotCN.guildaudio}.copy > div[draggable],
- .DSAC-styled ${BDFDB.dotCN.guild + BDFDB.dotCN.guildvideo}.copy > div[draggable],
- .DSAC-styled ${BDFDB.dotCN.guildseparator} ~ ${BDFDB.dotCN.guild + BDFDB.dotCN.guildaudio} > div[draggable],
- .DSAC-styled ${BDFDB.dotCN.guildseparator} ~ ${BDFDB.dotCN.guild + BDFDB.dotCN.guildvideo} > div[draggable] {
- padding-right: 20px;
- margin-right: 5px;
- }
- .DSAC-styled ${BDFDB.dotCN.guild + BDFDB.dotCN.guildaudio}.copy > div[draggable],
- .DSAC-styled ${BDFDB.dotCN.guildseparator} ~ ${BDFDB.dotCN.guild + BDFDB.dotCN.guildaudio} > div[draggable] {
- background: url(/assets/382ca83d9dc390c4be715248bb4864f4.svg) right no-repeat !important;
- }
- .DSAC-styled ${BDFDB.dotCN.guild + BDFDB.dotCN.guildvideo}.copy > div[draggable],
- .DSAC-styled ${BDFDB.dotCN.guildseparator} ~ ${BDFDB.dotCN.guild + BDFDB.dotCN.guildvideo} > div[draggable] {
- background: url(/assets/c46f51f425c824899b6138ea2b61b41d.svg) right no-repeat !important;
- }
- .DSAC-styled ${BDFDB.dotCN.guild}.copy ${BDFDB.dotCN.badge},
- .DSAC-styled ${BDFDB.dotCN.guildseparator} ~ ${BDFDB.dotCNS.guild + BDFDB.dotCN.badge} {
- position: static;
- margin: 0 3px;
- }
- .bd-minimal .DSAC-styled ${BDFDB.dotCN.guild}.copy ${BDFDB.dotCN.guildinner},
- .bd-minimal .DSAC-styled ${BDFDB.dotCN.guildseparator} ~ ${BDFDB.dotCNS.guild + BDFDB.dotCN.guildinner} {
- width: unset;
- }
- .DSAC-styled ${BDFDB.dotCN.guild}.copy ${BDFDB.dotCN.guildinner},
- .DSAC-styled ${BDFDB.dotCN.guildseparator} ~ ${BDFDB.dotCNS.guild + BDFDB.dotCN.guildinner} {
- background: transparent !important;
- border-radius: 0px !important;
- position: relative;
- }
- .DSAC-styled ${BDFDB.dotCN.guild + BDFDB.dotCN.guildaudio}.copy ${BDFDB.dotCN.guildinner}:after,
- .DSAC-styled ${BDFDB.dotCN.guild + BDFDB.dotCN.guildvideo}.copy ${BDFDB.dotCN.guildinner}:after,
- .DSAC-styled ${BDFDB.dotCN.guildseparator} ~ ${BDFDB.dotCN.guild + BDFDB.dotCNS.guildaudio + BDFDB.dotCN.guildinner}:after,
- .DSAC-styled ${BDFDB.dotCN.guildseparator} ~ ${BDFDB.dotCN.guild + BDFDB.dotCNS.guildvideo + BDFDB.dotCN.guildinner}:after {
- display: none !important;
- }
- .bd-minimal .DSAC-styled ${BDFDB.dotCN.guild}.copy ${BDFDB.dotCN.guildicon},
- .bd-minimal .DSAC-styled ${BDFDB.dotCN.guildseparator} ~ ${BDFDB.dotCNS.guild + BDFDB.dotCN.guildicon} {
- font-size: 14px !important;
- }
- .DSAC-styled ${BDFDB.dotCN.guild}.copy ${BDFDB.dotCN.guildicon},
- .DSAC-styled ${BDFDB.dotCN.guildseparator} ~ ${BDFDB.dotCNS.guild + BDFDB.dotCN.guildicon} {
- background: transparent !important;
- font-size: 16px !important;
- line-height: 32px;
- white-space: nowrap;
- text-align: left;
- position: absolute;
- left: 0;
- right: 0;
- width: unset;
- }
- .DSAC-styled ${BDFDB.dotCN.guild}.copy ${BDFDB.dotCN.guildinner} .DSAC-verification-badge,
- .DSAC-styled ${BDFDB.dotCN.guildseparator} ~ ${BDFDB.dotCNS.guild + BDFDB.dotCN.guildinner} .DSAC-verification-badge {
- position: absolute;
- left: 0;
- }
- .DSAC-styled ${BDFDB.dotCN.guildseparator} ~ ${BDFDB.dotCNS.guild + BDFDB.dotCN.guildserror} {
- margin-left: -5px;
- line-height: 28px;
- }
- .DSAC-styled ${BDFDB.dotCN.guildseparator} ~ ${BDFDB.dotCNS.guild + BDFDB.dotCN.guildserror},
- .DSAC-styled ${BDFDB.dotCN.guildseparator} ~ ${BDFDB.dotCN.guild + BDFDB.dotCN.guildsadd} {
- display: block !important;
- }
- .bd-minimal .DSAC-styled ${BDFDB.dotCN.guildseparator} ~ ${BDFDB.dotCN.guild + BDFDB.dotCNS.guildsadd + BDFDB.dotCN.guildsaddinner} {
- top: -0.2em;
- }
- .DSAC-styled ${BDFDB.dotCN.guildseparator} ~ ${BDFDB.dotCN.guild + BDFDB.dotCNS.guildsadd + BDFDB.dotCN.guildsaddinner} {
- top: -6px;
- }`;
- }
-
- onStart () {
- if (global.BDFDB && global.BDFDB.myPlugins && typeof global.BDFDB.myPlugins == "object") global.BDFDB.myPlugins[this.name] = this;
- var libraryScript = document.querySelector('head script[src="https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js"]');
- if (!global.BDFDB || typeof BDFDB != "object" || performance.now() - BDFDB.creationTime > 600000) {
- if (libraryScript) libraryScript.remove();
- libraryScript = document.createElement("script");
- libraryScript.setAttribute("type", "text/javascript");
- libraryScript.setAttribute("src", "https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js");
- libraryScript.setAttribute("date", performance.now());
- libraryScript.addEventListener("load", () => {if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();});
- document.head.appendChild(libraryScript);
- }
- else if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();
- this.startTimeout = setTimeout(() => {this.initialize();}, 30000);
- }
-
- initialize () {
- if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
- if (this.started) return true;
- BDFDB.loadMessage(this);
-
- var observer = null;
-
- observer = new MutationObserver((changes, _) => {
- changes.forEach(
- (change, i) => {
- var addedNodes = change.addedNodes;
- if (change.attributeName == "class" && change.oldValue && change.oldValue.indexOf(BDFDB.disCN.guildplaceholder) > -1) addedNodes = [change.target];
- if (change.attributeName == "draggable" && change.oldValue && change.oldValue == "false") addedNodes = [change.target.parentElement];
- if (addedNodes) {
- addedNodes.forEach((node) => {
- if (node && BDFDB.containsClass(node, BDFDB.disCN.guild) && !node.querySelector(BDFDB.dotCN.guildserror)) {
- if (BDFDB.containsClass(node, "folder")) this.changeServer(this.getFolderObject(node));
- else this.changeServer(BDFDB.getServerData(node));
- }
- });
- }
- }
- );
- });
- BDFDB.addObserver(this, BDFDB.dotCN.guilds, {name:"serverListObserver",instance:observer}, {childList: true, subtree:true, attributes:true, attributeFilter: ["class", "draggable"], attributeOldValue: true});
-
- BDFDB.readServerList().forEach(info => {this.changeServer(info);});
- document.querySelectorAll(BDFDB.dotCN.guild + ".folder").forEach(folderdiv => {this.changeServer(this.getFolderObject(folderdiv));});
-
- var appcontainer = document.querySelector(BDFDB.dotCN.appcontainer);
- if (appcontainer) {
- BDFDB.addEventListener(this, appcontainer, "mouseenter", `${BDFDB.dotCN.guildseparator} ~ ${BDFDB.dotCN.guild}, ${BDFDB.dotCN.guild}.copy`, e => {
- if (e.currentTarget.tagName && e.currentTarget.querySelector(BDFDB.dotCN.guildserror)) return;
- BDFDB.appendLocalStyle("HideAllToolTips" + this.name, `${BDFDB.dotCN.tooltip} {display: none !important;}`);
- });
- BDFDB.addEventListener(this, appcontainer, "mouseleave", `${BDFDB.dotCN.guildseparator} ~ ${BDFDB.dotCN.guild}, ${BDFDB.dotCN.guild}.copy`, e => {
- if (e.currentTarget.tagName && e.currentTarget.querySelector(BDFDB.dotCN.guildserror)) return;
- BDFDB.removeLocalStyle("HideAllToolTips" + this.name);
- });
- }
- BDFDB.addClass([document.body, appcontainer], "DSAC-styled");
-
- return true;
- }
- else {
- console.error(`%c[${this.name}]%c`, 'color: #3a71c1; font-weight: 700;', '', 'Fatal Error: Could not load BD functions!');
- return false;
- }
- }
-
- onStop () {
- if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
- BDFDB.readServerList().forEach(info => {this.resetServer(info);});
- document.querySelectorAll(BDFDB.dotCN.guild + ".folder").forEach(folderdiv => {this.resetServer(this.getFolderObject(folderdiv));});
- BDFDB.removeClasses("DSAC-styled");
-
- BDFDB.unloadMessage(this);
- return true;
- }
- else {
- return false;
- }
- }
-
-
- // begin of own functions
-
- changeServer (info) {
- if (!info || !info.div) return;
- var avatar = info.div.querySelector(BDFDB.dotCN.guildicon);
- if (avatar) {
- avatar.DSAColdName = avatar.textContent;
- avatar.innerHTML = `
${BDFDB.encodeToHTML(info.name || info.folderName || "")}
`;
- BDFDB.initElements(avatar, this);
- if (info.features && info.features.has("VERIFIED")) avatar.parentElement.insertBefore(BDFDB.htmlToElement(this.verificationBadgeMarkup), avatar);
- }
- }
-
- resetServer (info) {
- if (!info || !info.div) return;
- var avatar = info.div.querySelector(BDFDB.dotCN.guildicon);
- if (avatar) {
- avatar.innerHTML = BDFDB.encodeToHTML(avatar.DSAColdName);
- BDFDB.removeEles(info.div.querySelector(".DSAC-verification-badge"));
- }
- }
-
- getFolderObject (folderdiv) {
- var data = BDFDB.loadData(folderdiv.id, "ServerFolders", "folders");
- return data ? Object.assign({div:folderdiv}, data) : null;
- }
- }
-};
diff --git a/PluginsV2/EditChannels/README.md b/PluginsV2/EditChannels/README.md
deleted file mode 100644
index 194666c1c6..0000000000
--- a/PluginsV2/EditChannels/README.md
+++ /dev/null
@@ -1,8 +0,0 @@
-# These Plugins are meant only for BDv2, not BD nor BandagedBD. If you got either of those two go to [Plugins](https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/).
-
-## Edit Channels - [Download Script](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/EditChannels/index.js) [Download Config](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/EditChannels/config.json)
-
-Adds two options on your channel context menu.
-
-- You can open a popout, where you can change the local name and color for the selected channel.
-- You can set the selected channel back to its original state.
diff --git a/PluginsV2/EditChannels/config.json b/PluginsV2/EditChannels/config.json
deleted file mode 100644
index 26402a7b32..0000000000
--- a/PluginsV2/EditChannels/config.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "info": {
- "name": "EditChannels",
- "authors": [
- {
- "name": "DevilBro",
- "url": "https://www.paypal.me/MircoWittrien",
- "discord_id": "278543574059057154",
- "github_username": "mwittrien"
- }
- ],
- "version": 1.0,
- "description": "Allows you to rename and recolor channelnames. \n\nMy Support Server: http://bit.ly/DevilBrosHaus or https://discordapp.com/invite/Jx3TjNS"
- }
-}
diff --git a/PluginsV2/EditChannels/index.js b/PluginsV2/EditChannels/index.js
deleted file mode 100644
index efc277624e..0000000000
--- a/PluginsV2/EditChannels/index.js
+++ /dev/null
@@ -1,814 +0,0 @@
-module.exports = (Plugin, Api, Vendor) => {
- if (!global.BDFDB || typeof BDFDB != "object") global.BDFDB = {myPlugins:{}, BDv2Api: Api};
-
- return class extends Plugin {
- initConstructor () {
- this.labels = {};
-
- this.patchModules = {
- "ChannelTextArea":"componentDidMount",
- "AuditLog":"componentDidMount",
- "ChannelCategoryItem":"componentDidMount",
- "ChannelItem":"componentDidMount",
- "HeaderBar":["componentDidMount","componentDidUpdate"],
- "Clickable":"componentDidMount"
- };
-
- this.channelContextEntryMarkup =
- ``;
-
- this.channelContextSubMenuMarkup =
- ``;
-
- this.channelSettingsModalMarkup =
- `
-
-
- `;
-
- this.css = `
- ${BDFDB.dotCN.channelheadertitletext}[custom-editchannelsheader] ${BDFDB.dotCN.channelheaderchannelicon} {
- opacity: 0.6;
- }
- `;
-
- this.defaults = {
- settings: {
- changeChannelIcon: {value:true, description:"Change color of Channel Icon."},
- changeUnreadIndicator: {value:true, description:"Change color of Unread Indicator."}
- }
- };
- }
-
- onStart () {
- if (global.BDFDB && global.BDFDB.myPlugins && typeof global.BDFDB.myPlugins == "object") global.BDFDB.myPlugins[this.name] = this;
- var libraryScript = document.querySelector('head script[src="https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js"]');
- if (!global.BDFDB || typeof BDFDB != "object" || performance.now() - BDFDB.creationTime > 600000) {
- if (libraryScript) libraryScript.remove();
- libraryScript = document.createElement("script");
- libraryScript.setAttribute("type", "text/javascript");
- libraryScript.setAttribute("src", "https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js");
- libraryScript.setAttribute("date", performance.now());
- libraryScript.addEventListener("load", () => {if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();});
- document.head.appendChild(libraryScript);
- }
- else if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();
- this.startTimeout = setTimeout(() => {this.initialize();}, 30000);
- }
-
- initialize () {
- if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
- if (this.started) return true;
- BDFDB.loadMessage(this);
-
- this.UserUtils = BDFDB.WebModules.findByProperties("getUsers","getUser");
- this.ChannelUtils = BDFDB.WebModules.findByProperties("getChannels","getChannel");
- this.CurrentChannelUtils = BDFDB.WebModules.findByProperties("getChannels","getDefaultChannel");
- this.LastGuildStore = BDFDB.WebModules.findByProperties("getLastSelectedGuildId");
- this.LastChannelStore = BDFDB.WebModules.findByProperties("getLastSelectedChannelId");
-
- BDFDB.WebModules.forceAllUpdates(this);
-
- return true;
- }
- else {
- console.error(`%c[${this.name}]%c`, 'color: #3a71c1; font-weight: 700;', '', 'Fatal Error: Could not load BD functions!');
- return false;
- }
- }
-
- onStop () {
- if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
- let data = BDFDB.loadAllData(this, "channels");
- BDFDB.removeAllData(this, "channels");
- BDFDB.WebModules.forceAllUpdates(this);
- BDFDB.saveAllData(data, this, "channels");
-
- BDFDB.removeEles(".autocompleteEditChannels", ".autocompleteEditChannelsRow");
-
- BDFDB.unloadMessage(this);
- return true;
- }
- else {
- return false;
- }
- }
-
-
- // begin of own functions
-
- changeLanguageStrings () {
- this.channelContextEntryMarkup = this.channelContextEntryMarkup.replace("REPLACE_context_localchannelsettings_text", this.labels.context_localchannelsettings_text);
-
- this.channelContextSubMenuMarkup = this.channelContextSubMenuMarkup.replace("REPLACE_submenu_channelsettings_text", this.labels.submenu_channelsettings_text);
- this.channelContextSubMenuMarkup = this.channelContextSubMenuMarkup.replace("REPLACE_submenu_resetsettings_text", this.labels.submenu_resetsettings_text);
-
- this.channelSettingsModalMarkup = this.channelSettingsModalMarkup.replace("REPLACE_modal_header_text", this.labels.modal_header_text);
- this.channelSettingsModalMarkup = this.channelSettingsModalMarkup.replace("REPLACE_modal_channelname_text", this.labels.modal_channelname_text);
- this.channelSettingsModalMarkup = this.channelSettingsModalMarkup.replace("REPLACE_modal_colorpicker1_text", this.labels.modal_colorpicker1_text);
- this.channelSettingsModalMarkup = this.channelSettingsModalMarkup.replace("REPLACE_btn_save_text", this.labels.btn_save_text);
- }
-
- onChannelContextMenu (instance, menu) {
- if (instance.props && instance.props.channel && !menu.querySelector(".localchannelsettings-item")) {
- let channelContextEntry = BDFDB.htmlToElement(this.channelContextEntryMarkup);
- menu.appendChild(channelContextEntry);
- let settingsitem = channelContextEntry.querySelector(".localchannelsettings-item");
- settingsitem.addEventListener("mouseenter", () => {
- let channelContextSubMenu = BDFDB.htmlToElement(this.channelContextSubMenuMarkup);
- let channelitem = channelContextSubMenu.querySelector(".channelsettings-item");
- channelitem.addEventListener("click", () => {
- instance._reactInternalFiber.return.memoizedProps.closeContextMenu();
- this.showChannelSettings(instance.props.channel);
- });
- if (BDFDB.loadData(instance.props.channel.id, this, "channels")) {
- let resetitem = channelContextSubMenu.querySelector(".resetsettings-item");
- BDFDB.removeClass(resetitem, BDFDB.disCN.contextmenuitemdisabled);
- resetitem.addEventListener("click", () => {
- instance._reactInternalFiber.return.memoizedProps.closeContextMenu();
- BDFDB.removeData(instance.props.channel.id, this, "channels");
- BDFDB.WebModules.forceAllUpdates(this);
- });
- }
- BDFDB.appendSubMenu(settingsitem, channelContextSubMenu);
- });
- }
- }
-
- showChannelSettings (info) {
- var {name,color} = BDFDB.loadData(info.id, this, "channels") || {}
-
- let channelSettingsModal = BDFDB.htmlToElement(this.channelSettingsModalMarkup);
- let channelnameinput = channelSettingsModal.querySelector("#input-channelname");
-
- channelSettingsModal.querySelector(BDFDB.dotCN.modalguildname).innerText = info.name;
- channelnameinput.value = name || "";
- channelnameinput.setAttribute("placeholder", info.name);
- BDFDB.setColorSwatches(channelSettingsModal, color);
-
- BDFDB.appendModal(channelSettingsModal);
-
- BDFDB.addChildEventListener(channelSettingsModal, "click", ".btn-save", e => {
- e.preventDefault();
-
- name = channelnameinput.value.trim();
- name = name ? name : null;
-
- color = BDFDB.getSwatchColor(channelSettingsModal, 1);
- if (color) {
- if (color[0] < 30 && color[1] < 30 && color[2] < 30) color = BDFDB.colorCHANGE(color, 30);
- else if (color[0] > 225 && color[1] > 225 && color[2] > 225) color = BDFDB.colorCHANGE(color, -30);
- }
-
- if (name == null && color == null) {
- BDFDB.removeData(info.id, this, "channels");
- }
- else {
- BDFDB.saveData(info.id, {name,color}, this, "channels");
- }
- BDFDB.WebModules.forceAllUpdates(this);
- });
- channelnameinput.focus();
- }
-
- processChannelTextArea (instance, wrapper) {
- let channel = BDFDB.getReactValue(instance, "props.channel");
- if (channel) {
- var textarea = wrapper.querySelector("textarea");
- if (!textarea) return;
- if (channel.type == 0 && instance.props.type == "normal") {
- let data = BDFDB.loadData(channel.id, this, "channels") || {};
- wrapper.querySelector("textarea").setAttribute("placeholder", BDFDB.LanguageStrings.TEXTAREA_PLACEHOLDER.replace("{{channel}}", "#" + (data.name || channel.name)));
- }
- BDFDB.addEventListener(this, textarea, "keydown", e => {
- let autocompletemenu = textarea.parentElement.querySelector(BDFDB.dotCN.autocomplete);
- if (autocompletemenu && (e.which == 9 || e.which == 13)) {
- if (BDFDB.containsClass(autocompletemenu.querySelector(BDFDB.dotCN.autocompleteselected).parentElement, "autocompleteEditChannelsRow")) {
- e.originalEvent.preventDefault();
- e.originalEvent.stopPropagation();
- this.swapWordWithMention(textarea);
- }
- }
- else if (autocompletemenu && (e.which == 38 || e.which == 40)) {
- let autocompleteitems = autocompletemenu.querySelectorAll(BDFDB.dotCN.autocompleteselectable + ":not(.autocompleteEditChannelsSelector)");
- let selected = autocompletemenu.querySelector(BDFDB.dotCN.autocompleteselected);
- if (BDFDB.containsClass(selected, "autocompleteEditChannelsSelector") || autocompleteitems[e.which == 38 ? 0 : (autocompleteitems.length-1)] == selected) {
- e.originalEvent.preventDefault();
- e.originalEvent.stopPropagation();
- let next = this.getNextSelection(autocompletemenu, null, e.which == 38 ? false : true);
- BDFDB.removeClass(selected, BDFDB.disCN.autocompleteselected);
- BDFDB.addClass(selected, BDFDB.disCN.autocompleteselector);
- BDFDB.addClass(next, BDFDB.disCN.autocompleteselected);
- }
- }
- else if (textarea.value && !e.shiftKey && e.which == 13 && !autocompletemenu && textarea.value.indexOf("s/") != 0) {
- this.format = true;
- textarea.dispatchEvent(new Event("input"));
- }
- else if (!e.ctrlKey && e.which != 16 && textarea.selectionStart == textarea.selectionEnd && textarea.selectionEnd == textarea.value.length) {
- clearTimeout(textarea.EditChannelsAutocompleteTimeout);
- textarea.EditChannelsAutocompleteTimeout = setTimeout(() => {this.addAutoCompleteMenu(textarea, channel);},100);
- }
-
- if (!e.ctrlKey && e.which != 38 && e.which != 40 && !(e.which == 39 && textarea.selectionStart == textarea.selectionEnd && textarea.selectionEnd == textarea.value.length)) BDFDB.removeEles(".autocompleteEditChannels", ".autocompleteEditChannelsRow");
- });
- BDFDB.addEventListener(this, textarea, "click", e => {
- if (textarea.selectionStart == textarea.selectionEnd && textarea.selectionEnd == textarea.value.length) setImmediate(() => {this.addAutoCompleteMenu(textarea, channel);});
- });
- }
- }
-
- processAuditLog (instance, wrapper) {
- let channel = BDFDB.getReactValue(instance, "props.log.options.channel");
- if (channel) {
- let hooks = wrapper.querySelectorAll(`${BDFDB.dotCN.flexchild} > span${BDFDB.notCN.auditloguserhook}`);
- if (hooks.length > 0) this.changeChannel2(channel, hooks[0].firstChild);
- }
- }
-
- processChannelCategoryItem (instance, wrapper) {
- if (instance.props && instance.props.channel) {
- this.changeChannel(instance.props.channel, wrapper.querySelector(BDFDB.dotCN.categorycolortransition));
- }
- }
-
- processChannelItem (instance, wrapper) {
- if (instance.props && instance.props.channel) {
- this.changeChannel(instance.props.channel, wrapper.querySelector(BDFDB.dotCN.channelname));
- }
- }
-
- processHeaderBar (instance, wrapper) {
- let channel_id = BDFDB.getReactValue(instance, "_reactInternalFiber.return.memoizedProps.channelId");
- if (channel_id) {
- let channelname = wrapper.querySelector(BDFDB.dotCN.channelheaderchannelname);
- if (channelname) {
- let channel = this.ChannelUtils.getChannel(channel_id);
- if (channel) {
- if (channel.type == 0) this.changeChannel(channel, wrapper.querySelector(BDFDB.dotCN.channelheaderchannelname));
- else {
- if (channel.type == 1) channel = this.UserUtils.getUser(channel.recipients[0]) || channel;
- if (channelname.EditChannelsChangeObserver && typeof channelname.EditChannelsChangeObserver.disconnect == "function") channelname.EditChannelsChangeObserver.disconnect();
- channelname.style.removeProperty("color");
- channelname.style.removeProperty("background");
- BDFDB.setInnerText(channelname, channel.name || channel.username);
- }
- }
- }
- }
- }
-
- processClickable (instance, wrapper) {
- if (!instance.props || !instance.props.className) return;
- else if (instance.props.tag == "span" && instance.props.className.indexOf(BDFDB.disCN.mentionwrapper) > -1 && instance.props.className.indexOf(BDFDB.disCN.mention) == -1) {
- let children = BDFDB.getReactValue(instance, "_reactInternalFiber.memoizedProps.children");
- if (children && typeof children[0] == "string") {
- let channelname = children[0].slice(1);
- let categoryname = BDFDB.getReactValue(instance, "_reactInternalFiber.return.return.type.displayName") == "Tooltip" ? BDFDB.getReactValue(instance, "_reactInternalFiber.return.return.memoizedProps.text") : null;
- for (let channel of this.CurrentChannelUtils.getChannels(this.LastGuildStore.getGuildId())[0]) {
- if (channelname == channel.channel.name) {
- let category = categoryname ? this.ChannelUtils.getChannel(channel.channel.parent_id) : null;
- if (!category || category && categoryname == category.name) {
- this.changeMention(channel.channel, wrapper, category || {});
- break;
- }
- }
- }
- }
- }
- else if (instance.props.tag == "div" && instance.props.className.indexOf(BDFDB.disCN.quickswitchresult) > -1) {
- let result = BDFDB.getReactValue(instance, "_reactInternalFiber.return.memoizedProps.result");
- if (result && result.type.indexOf("_CHANNEL") != -1) {
- this.changeChannel(result.record, wrapper.querySelector(BDFDB.dotCN.quickswitchresultmatch));
- if (result.record.parent_id) {
- this.changeChannel(this.ChannelUtils.getChannel(result.record.parent_id), wrapper.querySelector(BDFDB.dotCN.quickswitchresultnote));
- }
- }
- }
- else if (instance.props.tag == "div" && instance.props.className.indexOf(BDFDB.disCN.autocompleterow) > -1) {
- let channel = BDFDB.getReactValue(instance, "_reactInternalFiber.return.memoizedProps.channel");
- if (channel) {
- this.changeChannel(channel, wrapper.querySelector(BDFDB.dotCN.marginleft4));
- let category = BDFDB.getReactValue(instance, "_reactInternalFiber.return.memoizedProps.category");
- if (category) this.changeChannel(category, wrapper.querySelector(BDFDB.dotCN.autocompletedescription));
- }
- }
- else if (instance.props.tag == "span" && instance.props.className.indexOf(BDFDB.disCN.messagespopoutchannelname) > -1) {
- let channel = BDFDB.getReactValue(instance, "_reactInternalFiber.return.sibling.child.child.memoizedProps.channel");
- if (channel) this.changeChannel2(channel, wrapper);
- }
- }
-
- changeChannel (info, channelname) {
- if (!info || !channelname || !channelname.parentElement) return;
- if (channelname.EditChannelsChangeObserver && typeof channelname.EditChannelsChangeObserver.disconnect == "function") channelname.EditChannelsChangeObserver.disconnect();
- let data = BDFDB.loadData(info.id, this, "channels") || {};
- let settings = BDFDB.getAllData(this, "settings");
- let color = this.chooseColor(channelname, data.color);
- channelname.style.setProperty("color", color, "important");
- BDFDB.setInnerText(channelname, data.name || info.name);
- let iconparent = BDFDB.containsClass(channelname, BDFDB.disCN.quickswitchresultmatch) ? channelname.parentElement.parentElement : channelname.parentElement;
- if (!BDFDB.containsClass(channelname, BDFDB.disCN.autocompletedescription)) {
- iconparent.querySelectorAll('svg [stroke]:not([stroke="none"]').forEach(icon => {
- if (!icon.getAttribute("oldstroke")) icon.setAttribute("oldstroke", icon.getAttribute("stroke"));
- icon.setAttribute("stroke", color && settings.changeChannelIcon ? color : icon.getAttribute("oldstroke"), "important");
- icon.style.setProperty("stroke", color && settings.changeChannelIcon ? color : icon.getAttribute("oldstroke"), "important");
- });
- iconparent.querySelectorAll('svg [fill]:not([fill="none"]').forEach(icon => {
- if (!icon.getAttribute("oldfill")) icon.setAttribute("oldfill", icon.getAttribute("fill"));
- icon.setAttribute("fill", color && settings.changeChannelIcon ? color : icon.getAttribute("oldfill"), "important");
- icon.style.setProperty("fill", color && settings.changeChannelIcon ? color : icon.getAttribute("oldfill"), "important");
- });
- let unread = iconparent.parentElement.querySelector(BDFDB.dotCN.channelunread);
- if (unread) unread.style.setProperty("background-color", color && settings.changeUnreadIndicator ? color : null, "important");
- }
- if (color) {
- channelname.EditChannelsChangeObserver = new MutationObserver((changes, _) => {
- changes.forEach(
- (change, i) => {
- if (change.type == "childList" && change.addedNodes.length && change.target.tagName && (change.target.tagName == "SVG" || change.target.querySelector("svg")) || change.type == "attributes" && change.attributeName == "class" && change.target.className.length && change.target.className.indexOf("name") > -1 || change.type == "attributes" && change.attributeName == "style" && BDFDB.containsClass(change.target, BDFDB.disCN.channelheaderchannelname)) {
- channelname.EditChannelsChangeObserver.disconnect();
- this.changeChannel(info, channelname);
- }
- }
- );
- });
- channelname.EditChannelsChangeObserver.observe(iconparent, {attributes:true, childList:true, subtree:true});
- }
- }
-
- changeChannel2 (info, channelname) {
- if (!info || !channelname || !channelname.parentElement) return;
- if (channelname.EditChannelsChangeObserver && typeof channelname.EditChannelsChangeObserver.disconnect == "function") channelname.EditChannelsChangeObserver.disconnect();
- let data = BDFDB.loadData(info.id, this, "channels") || {};
- let color = this.chooseColor(channelname, data.color);
- channelname.style.setProperty("color", color, "important");
- BDFDB.setInnerText(channelname, "#" + (data.name || info.name));
- if (color) {
- channelname.EditChannelsChangeObserver = new MutationObserver((changes, _) => {
- changes.forEach(
- (change, i) => {
- if (change.type == "childList" && change.addedNodes.length && change.target.tagName && (change.target.tagName == "SVG" || change.target.querySelector("svg")) || change.type == "attributes" && change.attributeName == "class" && change.target.className.length && change.target.className.indexOf("name") > -1) {
- channelname.EditChannelsChangeObserver.disconnect();
- this.changeChannel2(info, channelname);
- }
- }
- );
- });
- channelname.EditChannelsChangeObserver.observe(channelname.parentElement, {attributes:true, childList:true, subtree:true});
- }
- }
-
- changeMention (info, mention, categoryinfo) {
- if (!info || !mention || !mention.parentElement) return;
- if (mention.EditChannelsChangeObserver && typeof mention.EditChannelsChangeObserver.disconnect == "function") mention.EditChannelsChangeObserver.disconnect();
- mention.removeEventListener("mouseover", mention.mouseoverListenerEditChannels);
- mention.removeEventListener("mouseout", mention.mouseoutListenerEditChannels);
- let data = BDFDB.loadData(info.id, this, "channels") || {};
- let color = BDFDB.colorCONVERT(data.color, "RGBCOMP");
- BDFDB.setInnerText(mention, "#" + (data.name || info.name));
- if (mention.EditChannelsHovered) colorHover();
- else colorDefault();
- mention.mouseoverListenerEditChannels = () => {
- mention.EditChannelsHovered = true;
- colorHover();
- let categorydata = BDFDB.loadData(categoryinfo.id, this, "channels") || {};
- if (categorydata.name) BDFDB.createTooltip(categorydata.name, mention, {type:"top",selector:"EditChannels-tooltip",css:`body ${BDFDB.dotCN.tooltip}:not(.EditChannels-tooltip) {display: none !important;}`});
- };
- mention.mouseoutListenerEditChannels = () => {
- delete mention.EditChannelsHovered;
- colorDefault();
- };
- mention.addEventListener("mouseover", mention.mouseoverListenerEditChannels);
- mention.addEventListener("mouseout", mention.mouseoutListenerEditChannels);
- mention.EditChannelsChangeObserver = new MutationObserver((changes, _) => {
- mention.EditChannelsChangeObserver.disconnect();
- this.changeMention(info, mention, categoryinfo);
- });
- mention.EditChannelsChangeObserver.observe(mention, {attributes:true});
- function colorDefault() {
- mention.style.setProperty("color", color ? "rgb(" + color[0] + "," + color[1] + "," + color[2] + ")" : null, "important");
- mention.style.setProperty("background", color ? "rgba(" + color[0] + "," + color[1] + "," + color[2] + ",.1)" : null, "important");
- }
- function colorHover() {
- mention.style.setProperty("color", color ? "#FFFFFF" : null, "important");
- mention.style.setProperty("background", color ? "rgba(" + color[0] + "," + color[1] + "," + color[2] + ",.7)" : null, "important");
- }
- }
-
- chooseColor (channelname, color) {
- if (color && channelname) {
- let classname = channelname.className ? channelname.className.toLowerCase() : "";
- if (classname.indexOf("muted") > -1 || classname.indexOf("locked") > -1) color = BDFDB.colorCHANGE(color, -0.5);
- else if (classname.indexOf("selected") > -1 || classname.indexOf("hovered") > -1 || classname.indexOf("unread") > -1) color = BDFDB.colorCHANGE(color, 0.5);
- return BDFDB.colorCONVERT(color, "RGB");
- }
- return null;
- }
-
- addAutoCompleteMenu (textarea, channel) {
- if (textarea.parentElement.querySelector(".autocompleteEditChannelsRow")) return;
- let words = textarea.value.split(/\s/);
- let lastword = words[words.length-1].trim();
- if (lastword && lastword.length > 1 && lastword[0] == "#") {
- let channels = BDFDB.loadAllData(this, "channels");
- if (!channels) return;
- let channelarray = [];
- for (let id in channels) if (channels[id].name) {
- let channel = this.ChannelUtils.getChannel(id);
- let category = channel && channel.parent_id ? this.ChannelUtils.getChannel(channel.parent_id) : null;
- let catdata = (category ? channels[category.id] : null) || {};
- if (channel && channel.type == 0) channelarray.push(Object.assign({lowercasename:channels[id].name.toLowerCase(),lowercasecatname:(catdata && catdata.name ? catdata.name.toLowerCase() : null),channel,category,catdata},channels[id]));
- }
- channelarray = BDFDB.sortArrayByKey(channelarray.filter(n => n.lowercasename.indexOf(lastword.toLowerCase().slice(1)) != -1 || (n.lowercasecatname && n.lowercasecatname.indexOf(lastword.toLowerCase().slice(1)) != -1)), "lowercasename");
- if (channelarray.length) {
- let settings = BDFDB.getAllData(this, "settings");
- let autocompletemenu = textarea.parentElement.querySelector(BDFDB.dotCNS.autocomplete + BDFDB.dotCN.autocompleteinner), amount = 15;
- if (!autocompletemenu) {
- autocompletemenu = BDFDB.htmlToElement(`
${BDFDB.LanguageStrings.TEXT_CHANNELS_MATCHING.replace("{{prefix}}", BDFDB.encodeToHTML(lastword))}
`);
- textarea.parentElement.appendChild(autocompletemenu);
- autocompletemenu = autocompletemenu.firstElementChild;
- }
- else {
- amount -= autocompletemenu.querySelectorAll(BDFDB.dotCN.autocompleteselectable).length;
- }
-
- BDFDB.addEventListener(this, autocompletemenu, "mouseenter", BDFDB.dotCN.autocompleteselectable, e => {
- var selected = autocompletemenu.querySelectorAll(BDFDB.dotCN.autocompleteselected);
- BDFDB.removeClass(selected, BDFDB.disCN.autocompleteselected);
- BDFDB.addClass(selected, BDFDB.disCN.autocompleteselector);
- BDFDB.addClass(e.currentTarget, BDFDB.disCN.autocompleteselected);
- });
-
- for (let data of channelarray) {
- if (amount-- < 1) break;
- let color = BDFDB.colorCONVERT(data.color, "RGB");
- let catcolor = BDFDB.colorCONVERT(data.catdata.color, "RGB");
- let autocompleterow = BDFDB.htmlToElement(`
${BDFDB.encodeToHTML(data.name || data.channel.name)}
${data.category ? '
' + BDFDB.encodeToHTML(data.catdata.name || data.category.name) + '
' : ''}
`);
- autocompleterow.querySelector(BDFDB.dotCN.autocompleteselectable).addEventListener("click", () => {this.swapWordWithMention(textarea);});
- autocompletemenu.appendChild(autocompleterow);
- }
- if (!autocompletemenu.querySelector(BDFDB.dotCN.autocompleteselected)) {
- BDFDB.addClass(autocompletemenu.querySelector(".autocompleteEditChannelsRow " + BDFDB.dotCN.autocompleteselectable), BDFDB.disCN.autocompleteselected);
- }
- }
- }
- }
-
- getNextSelection (menu, selected, forward) {
- selected = selected ? selected : menu.querySelector(BDFDB.dotCN.autocompleteselected).parentElement;
- let next, sibling = forward ? selected.nextElementSibling : selected.previousElementSibling;
- if (sibling) {
- next = sibling.querySelector(BDFDB.dotCN.autocompleteselectable);
- }
- else {
- let items = menu.querySelectorAll(BDFDB.dotCN.autocompleteselectable);
- next = forward ? items[0] : items[items.length-1];
- }
- return next ? next : this.getNextSelection(menu, sibling, forward);
- }
-
- swapWordWithMention (textarea) {
- let selected = textarea.parentElement.querySelector(".autocompleteEditChannelsRow " + BDFDB.dotCN.autocompleteselected);
- let channelid = selected ? selected.getAttribute("channelid") : null;
- let words = textarea.value.split(/\s/);
- let lastword = words[words.length-1].trim();
- if (channelid && lastword) {
- BDFDB.removeEles(".autocompleteEditChannels", ".autocompleteEditChannelsRow");
- textarea.focus();
- textarea.selectionStart = textarea.value.length - lastword.length;
- textarea.selectionEnd = textarea.value.length;
- document.execCommand("insertText", false, `<#${channelid}> `);
- textarea.selectionStart = textarea.value.length;
- textarea.selectionEnd = textarea.value.length;
- }
- }
-
- getSettingsPanel () {
- if (!global.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
- var settings = BDFDB.getAllData(this, "settings");
- var settingshtml = `
${this.name}
`;
- for (let key in settings) {
- settingshtml += `
`;
- }
- settingshtml += `
`;
- settingshtml += `
`;
-
- let settingspanel = BDFDB.htmlToElement(settingshtml);
-
- BDFDB.initElements(settingspanel, this);
-
- BDFDB.addEventListener(this, settingspanel, "click", ".reset-button", () => {
- BDFDB.openConfirmModal(this, "Are you sure you want to reset all channels?", () => {
- BDFDB.removeAllData(this, "channels");
- BDFDB.WebModules.forceAllUpdates(this);
- });
- });
- return settingspanel;
- }
-
- onSettingsClosed () {
- if (this.SettingsUpdated) {
- delete this.SettingsUpdated;
- BDFDB.WebModules.forceAllUpdates(this);
- }
- }
-
- setLabelsByLanguage () {
- switch (BDFDB.getDiscordLanguage().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",
- btn_cancel_text: "Prekid",
- btn_save_text: "Uštedjeti"
- };
- 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",
- btn_cancel_text: "Afbryde",
- btn_save_text: "Spare"
- };
- 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",
- btn_cancel_text: "Abbrechen",
- btn_save_text: "Speichern"
- };
- 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",
- btn_cancel_text: "Cancelar",
- btn_save_text: "Guardar"
- };
- case "fr": //french
- return {
- context_localchannelsettings_text: "Paramètres locale du canal",
- submenu_channelsettings_text: "Modifier les paramètres",
- submenu_resetsettings_text: "Réinitialiser le canal",
- modal_header_text: "Paramètres locale du canal",
- modal_channelname_text: "Nom local du canal",
- modal_colorpicker1_text: "Couleur locale de la chaîne",
- btn_cancel_text: "Abandonner",
- btn_save_text: "Enregistrer"
- };
- 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",
- btn_cancel_text: "Cancellare",
- btn_save_text: "Salvare"
- };
- 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",
- btn_cancel_text: "Afbreken",
- btn_save_text: "Opslaan"
- };
- 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",
- btn_cancel_text: "Avbryte",
- btn_save_text: "Lagre"
- };
- 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",
- btn_cancel_text: "Anuluj",
- btn_save_text: "Zapisz"
- };
- 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",
- btn_cancel_text: "Cancelar",
- btn_save_text: "Salvar"
- };
- 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",
- btn_cancel_text: "Peruuttaa",
- btn_save_text: "Tallentaa"
- };
- 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",
- btn_cancel_text: "Avbryta",
- btn_save_text: "Spara"
- };
- 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",
- btn_cancel_text: "Iptal",
- btn_save_text: "Kayıt"
- };
- 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",
- btn_cancel_text: "Zrušení",
- btn_save_text: "Uložit"
- };
- case "bg": //bulgarian
- return {
- context_localchannelsettings_text: "Настройки за локални канали",
- submenu_channelsettings_text: "Промяна на настройките",
- submenu_resetsettings_text: "Възстановяване на канал",
- modal_header_text: "Настройки за локални канали",
- modal_channelname_text: "Локално име на канал",
- modal_colorpicker1_text: "Локален цветен канал",
- btn_cancel_text: "Зъбести",
- btn_save_text: "Cпасяване"
- };
- case "ru": //russian
- return {
- context_localchannelsettings_text: "Настройки локального канала",
- submenu_channelsettings_text: "Изменить настройки",
- submenu_resetsettings_text: "Сбросить канал",
- modal_header_text: "Настройки локального канала",
- modal_channelname_text: "Имя локального канала",
- modal_colorpicker1_text: "Цвет локального канала",
- btn_cancel_text: "Отмена",
- btn_save_text: "Cпасти"
- };
- case "uk": //ukrainian
- return {
- context_localchannelsettings_text: "Налаштування локального каналу",
- submenu_channelsettings_text: "Змінити налаштування",
- submenu_resetsettings_text: "Скидання каналу",
- modal_header_text: "Налаштування локального каналу",
- modal_channelname_text: "Локальне ім'я каналу",
- modal_colorpicker1_text: "Колір місцевого каналу",
- btn_cancel_text: "Скасувати",
- btn_save_text: "Зберегти"
- };
- case "ja": //japanese
- return {
- context_localchannelsettings_text: "ローカルチャネル設定",
- submenu_channelsettings_text: "設定を変更する",
- submenu_resetsettings_text: "チャネルをリセットする",
- modal_header_text: "ローカルチャネル設定",
- modal_channelname_text: "ローカルチャネル名",
- modal_colorpicker1_text: "ローカルチャネルの色",
- btn_cancel_text: "キャンセル",
- btn_save_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: "本地頻道顏色",
- btn_cancel_text: "取消",
- btn_save_text: "保存"
- };
- case "ko": //korean
- return {
- context_localchannelsettings_text: "로컬 채널 설정",
- submenu_channelsettings_text: "설정 변경",
- submenu_resetsettings_text: "채널 재설정",
- modal_header_text: "로컬 채널 설정",
- modal_channelname_text: "로컬 채널 이름",
- modal_colorpicker1_text: "지역 채널 색깔",
- btn_cancel_text: "취소",
- btn_save_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",
- btn_cancel_text: "Cancel",
- btn_save_text: "Save"
- };
- }
- }
- }
-};
diff --git a/PluginsV2/EditServers/README.md b/PluginsV2/EditServers/README.md
deleted file mode 100644
index 72ecefa0fc..0000000000
--- a/PluginsV2/EditServers/README.md
+++ /dev/null
@@ -1,8 +0,0 @@
-# These Plugins are meant only for BDv2, not BD nor BandagedBD. If you got either of those two go to [Plugins](https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/).
-
-## Edit Servers - [Download Script](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/EditServers/index.js) [Download Config](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/EditServers/config.json)
-
-Adds two options on your server context menu.
-
-- You can open a popout, where you can change the local name, initials, icon and color for the selected server.
-- You can set the selected server back to its original state.
diff --git a/PluginsV2/EditServers/config.json b/PluginsV2/EditServers/config.json
deleted file mode 100644
index 9f33a5f719..0000000000
--- a/PluginsV2/EditServers/config.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "info": {
- "name": "EditServers",
- "authors": [
- {
- "name": "DevilBro",
- "url": "https://www.paypal.me/MircoWittrien",
- "discord_id": "278543574059057154",
- "github_username": "mwittrien"
- }
- ],
- "version": 1.0,
- "description": "Allows you to change the icon, name and color of servers. \n\nMy Support Server: http://bit.ly/DevilBrosHaus or https://discordapp.com/invite/Jx3TjNS"
- }
-}
diff --git a/PluginsV2/EditServers/index.js b/PluginsV2/EditServers/index.js
deleted file mode 100644
index 819e684214..0000000000
--- a/PluginsV2/EditServers/index.js
+++ /dev/null
@@ -1,951 +0,0 @@
-module.exports = (Plugin, Api, Vendor) => {
- if (!global.BDFDB || typeof BDFDB != "object") global.BDFDB = {myPlugins:{}, BDv2Api: Api};
-
- return class extends Plugin {
- initConstructor () {
- this.labels = {};
-
- this.patchModules = {
- "GuildIcon":"componentDidMount",
- "GuildHeader":["componentDidMount","componentDidUpdate"],
- "Clickable":"componentDidMount"
- };
-
- this.serverContextEntryMarkup =
- ``;
-
- this.serverContextSubMenuMarkup =
- ``;
-
- this.serverSettingsModalMarkup =
- `
-
-
-
-
-
-
-
-
REPLACE_modal_tabheader1_text
-
REPLACE_modal_tabheader2_text
-
REPLACE_modal_tabheader3_text
-
-
-
-
-
-
-
- `;
- }
-
- onStart () {
- if (global.BDFDB && global.BDFDB.myPlugins && typeof global.BDFDB.myPlugins == "object") global.BDFDB.myPlugins[this.name] = this;
- var libraryScript = document.querySelector('head script[src="https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js"]');
- if (!global.BDFDB || typeof BDFDB != "object" || performance.now() - BDFDB.creationTime > 600000) {
- if (libraryScript) libraryScript.remove();
- libraryScript = document.createElement("script");
- libraryScript.setAttribute("type", "text/javascript");
- libraryScript.setAttribute("src", "https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js");
- libraryScript.setAttribute("date", performance.now());
- libraryScript.addEventListener("load", () => {if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();});
- document.head.appendChild(libraryScript);
- }
- else if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();
- this.startTimeout = setTimeout(() => {this.initialize();}, 30000);
- }
-
- initialize () {
- if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
- if (this.started) return true;
- BDFDB.loadMessage(this);
-
- this.GuildUtils = BDFDB.WebModules.findByProperties("getGuilds","getGuild");
-
- BDFDB.WebModules.forceAllUpdates(this);
-
- return true;
- }
- else {
- console.error(`%c[${this.name}]%c`, 'color: #3a71c1; font-weight: 700;', '', 'Fatal Error: Could not load BD functions!');
- return false;
- }
- }
-
- onStop () {
- if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
- let data = BDFDB.loadAllData(this, "servers");
- BDFDB.removeAllData(this, "servers");
- BDFDB.WebModules.forceAllUpdates(this);
- BDFDB.saveAllData(data, this, "servers");
-
- BDFDB.unloadMessage(this);
- return true;
- }
- else {
- return false;
- }
- }
-
-
- // begin of own functions
-
- changeLanguageStrings () {
- this.serverContextEntryMarkup = this.serverContextEntryMarkup.replace("REPLACE_context_localserversettings_text", this.labels.context_localserversettings_text);
-
- this.serverContextSubMenuMarkup = this.serverContextSubMenuMarkup.replace("REPLACE_submenu_serversettings_text", this.labels.submenu_serversettings_text);
- this.serverContextSubMenuMarkup = this.serverContextSubMenuMarkup.replace("REPLACE_submenu_resetsettings_text", this.labels.submenu_resetsettings_text);
-
- this.serverSettingsModalMarkup = this.serverSettingsModalMarkup.replace("REPLACE_modal_header_text", this.labels.modal_header_text);
- this.serverSettingsModalMarkup = this.serverSettingsModalMarkup.replace("REPLACE_modal_servername_text", this.labels.modal_servername_text);
- this.serverSettingsModalMarkup = this.serverSettingsModalMarkup.replace("REPLACE_modal_servershortname_text", this.labels.modal_servershortname_text);
- this.serverSettingsModalMarkup = this.serverSettingsModalMarkup.replace("REPLACE_modal_serverurl_text", this.labels.modal_serverurl_text);
- this.serverSettingsModalMarkup = this.serverSettingsModalMarkup.replace("REPLACE_modal_removeicon_text", this.labels.modal_removeicon_text);
- this.serverSettingsModalMarkup = this.serverSettingsModalMarkup.replace("REPLACE_modal_tabheader1_text", this.labels.modal_tabheader1_text);
- this.serverSettingsModalMarkup = this.serverSettingsModalMarkup.replace("REPLACE_modal_tabheader2_text", this.labels.modal_tabheader2_text);
- this.serverSettingsModalMarkup = this.serverSettingsModalMarkup.replace("REPLACE_modal_tabheader3_text", this.labels.modal_tabheader3_text);
- this.serverSettingsModalMarkup = this.serverSettingsModalMarkup.replace("REPLACE_modal_colorpicker1_text", this.labels.modal_colorpicker1_text);
- this.serverSettingsModalMarkup = this.serverSettingsModalMarkup.replace("REPLACE_modal_colorpicker2_text", this.labels.modal_colorpicker2_text);
- this.serverSettingsModalMarkup = this.serverSettingsModalMarkup.replace("REPLACE_modal_colorpicker3_text", this.labels.modal_colorpicker3_text);
- this.serverSettingsModalMarkup = this.serverSettingsModalMarkup.replace("REPLACE_modal_colorpicker4_text", this.labels.modal_colorpicker4_text);
- this.serverSettingsModalMarkup = this.serverSettingsModalMarkup.replace("REPLACE_btn_save_text", this.labels.btn_save_text);
- }
-
- onGuildContextMenu (instance, menu) {
- if (instance.props && instance.props.target && instance.props.guild && !menu.querySelector(".localserversettings-item")) {
- let serverContextEntry = BDFDB.htmlToElement(this.serverContextEntryMarkup);
- menu.appendChild(serverContextEntry);
- let settingsitem = serverContextEntry.querySelector(".localserversettings-item");
- settingsitem.addEventListener("mouseenter", () => {
- let serverContextSubMenu = BDFDB.htmlToElement(this.serverContextSubMenuMarkup);
- let serveritem = serverContextSubMenu.querySelector(".serversettings-item");
- serveritem.addEventListener("click", () => {
- instance._reactInternalFiber.return.memoizedProps.closeContextMenu();
- this.showServerSettings(instance.props.guild);
- });
- if (BDFDB.loadData(instance.props.guild.id, this, "servers")) {
- let resetitem = serverContextSubMenu.querySelector(".resetsettings-item");
- BDFDB.removeClass(resetitem, BDFDB.disCN.contextmenuitemdisabled);
- resetitem.addEventListener("click", () => {
- instance._reactInternalFiber.return.memoizedProps.closeContextMenu();
- BDFDB.removeData(instance.props.guild.id, this, "servers");
- BDFDB.WebModules.forceAllUpdates(this);
- });
- }
- BDFDB.appendSubMenu(settingsitem, serverContextSubMenu);
- });
- }
- }
-
- showServerSettings (info) {
- var {name,shortName,url,removeIcon,color1,color2,color3,color4} = BDFDB.loadData(info.id, this, "servers") || {};
-
- let serverSettingsModal = BDFDB.htmlToElement(this.serverSettingsModalMarkup);
- let servernameinput = serverSettingsModal.querySelector("#input-servername");
- let servershortnameinput = serverSettingsModal.querySelector("#input-servershortname");
- let serverurlinput = serverSettingsModal.querySelector("#input-serverurl");
- let removeiconinput = serverSettingsModal.querySelector("#input-removeicon");
-
- serverSettingsModal.querySelector(BDFDB.dotCN.modalguildname).innerText = info.name;
- servernameinput.value = name || "";
- servernameinput.setAttribute("placeholder", info.name);
- servershortnameinput.value = shortName || (info.icon ? "" : info.acronym);
- servershortnameinput.setAttribute("placeholder", info.acronym);
- serverurlinput.value = url || "";
- serverurlinput.setAttribute("placeholder", BDFDB.getGuildIcon(info.id) || "");
- BDFDB.toggleClass(serverurlinput, "valid", serverurlinput.value.length > 0);
- serverurlinput.disabled = removeIcon;
- removeiconinput.checked = removeIcon;
- BDFDB.setColorSwatches(serverSettingsModal, color1);
- BDFDB.setColorSwatches(serverSettingsModal, color2);
- BDFDB.setColorSwatches(serverSettingsModal, color3);
- BDFDB.setColorSwatches(serverSettingsModal, color4);
-
- BDFDB.appendModal(serverSettingsModal);
-
- removeiconinput.addEventListener("click", () => {
- serverurlinput.disabled = removeiconinput.checked;
- });
- serverurlinput.addEventListener("input", () => {
- this.checkUrl(serverurlinput);
- });
- serverurlinput.addEventListener("mouseenter", () => {
- BDFDB.addClass(serverurlinput, "hovering");
- this.createNoticeTooltip(serverurlinput);
- });
- serverurlinput.addEventListener("mouseleave", () => {
- BDFDB.removeClass(serverurlinput, "hovering");
- BDFDB.removeEles(BDFDB.dotCNS.tooltips + ".notice-tooltip");
- });
- BDFDB.addChildEventListener(serverSettingsModal, "click", ".btn-save", e => {
- e.preventDefault();
-
- name = servernameinput.value.trim();
- name = name ? name : null;
-
- shortName = servershortnameinput.value.trim();
- shortName = shortName && shortName != info.acronym ? shortName : null;
-
- removeIcon = removeiconinput.checked;
-
- url = !removeIcon && BDFDB.containsClass(serverurlinput, "valid") ? serverurlinput.value.trim() : null;
- url = url ? url : null;
-
- color1 = BDFDB.getSwatchColor(serverSettingsModal, 1);
- color2 = BDFDB.getSwatchColor(serverSettingsModal, 2);
- color3 = BDFDB.getSwatchColor(serverSettingsModal, 3);
- color4 = BDFDB.getSwatchColor(serverSettingsModal, 4);
-
- if (name == null && shortName == null && url == null && !removeIcon && color1 == null && color2 == null && color3 == null && color4 == null) {
- BDFDB.removeData(info.id, this, "servers");
- }
- else {
- BDFDB.saveData(info.id, {name,shortName,url,removeIcon,color1,color2,color3,color4}, this, "servers");
- }
- BDFDB.WebModules.forceAllUpdates(this);
- });
- servernameinput.focus();
- }
-
- checkUrl (input) {
- BDFDB.removeEles(BDFDB.dotCNS.tooltips + ".notice-tooltip");
- if (!input.value) {
- BDFDB.removeClass(input, "valid");
- BDFDB.removeClass(input, "invalid");
- }
- else {
- require("request")(input.value, (error, response, result) => {
- if (response && response.headers["content-type"] && response.headers["content-type"].indexOf("image") != -1) {
- BDFDB.addClass(input, "valid");
- BDFDB.removeClass(input, "invalid");
- }
- else {
- BDFDB.removeClass(input, "valid");
- BDFDB.addClass(input, "invalid");
- }
- if (BDFDB.containsClass(input, "hovering")) this.createNoticeTooltip(input);
- });
- }
- }
-
- createNoticeTooltip (input) {
- var disabled = input.disabled;
- var valid = BDFDB.containsClass(input, "valid");
- var invalid = BDFDB.containsClass(input, "invalid");
- if (disabled || valid || invalid) {
- BDFDB.createTooltip(disabled ? this.labels.modal_ignoreurl_text : valid ? this.labels.modal_validurl_text : this.labels.modal_invalidurl_text, input, {type:"right",selector:"notice-tooltip",color: disabled ? "black" : invalid ? "red" : "green"});
- }
- }
-
- processGuildIcon (instance, wrapper) {
- if (instance.props && instance.props.guild) {
- let icon = wrapper.classList && BDFDB.containsClass(wrapper, BDFDB.disCN.avataricon) ? wrapper : wrapper.querySelector(BDFDB.dotCN.avataricon);
- if (!icon) return;
- this.changeGuildIcon(instance.props.guild, icon);
- if (BDFDB.getParentEle(BDFDB.dotCN.guild, icon)) this.changeTooltip(instance.props.guild, wrapper, "right");
- else if (BDFDB.getParentEle(BDFDB.dotCN.friendscolumn, icon)) this.changeTooltip(instance.props.guild, icon.parentElement, "top");
- }
- }
-
- processGuildHeader (instance, wrapper) {
- if (instance.props && instance.props.guild) {
- this.changeGuildName(instance.props.guild, wrapper.querySelector(BDFDB.dotCN.guildheadername));
- }
- }
-
- processClickable (instance, wrapper) {
- if (!wrapper || !instance.props || !instance.props.className) return;
- else if (instance.props.tag == "div" && instance.props.className.indexOf(BDFDB.disCN.userprofilelistrow) > -1) {
- let guild = BDFDB.getReactValue(instance, "_reactInternalFiber.return.memoizedProps.guild");
- if (guild && BDFDB.getReactValue(instance, "_reactInternalFiber.return.type.displayName") == "GuildRow") {
- this.changeGuildName(guild, wrapper.querySelector(BDFDB.dotCN.userprofilelistname));
- }
- }
- else if (instance.props.tag == "div" && instance.props.className.indexOf(BDFDB.disCN.quickswitchresult) > -1) {
- let result = BDFDB.getReactValue(instance, "_reactInternalFiber.return.memoizedProps.result");
- if (result && result.type == "GUILD") {
- this.changeGuildName(result.record, wrapper.querySelector(BDFDB.dotCN.quickswitchresultmatch));
- }
- else if (result && result.type.indexOf("_CHANNEL") != -1 && result.record && result.record.guild_id) {
- this.changeGuildName(this.GuildUtils.getGuild(result.record.guild_id), wrapper.querySelector(BDFDB.dotCN.quickswitchresultmisccontainer));
- }
- }
- }
-
- changeGuildName (info, guildname) {
- if (!info || !guildname || !guildname.parentElement) return;
- if (guildname.EditServersChangeObserver && typeof guildname.EditServersChangeObserver.disconnect == "function") guildname.EditServersChangeObserver.disconnect();
- let data = BDFDB.loadData(info.id, this, "servers") || {};
- if (data.name || data.color2 || guildname.getAttribute("changed-by-editservers")) {
- guildname.style.setProperty("color", BDFDB.colorCONVERT(data.color2, "RGB"), "important");
- BDFDB.setInnerText(guildname, data.name || info.name);
- if (data.name || data.color2) {
- guildname.setAttribute("changed-by-editservers", true);
- guildname.EditServersChangeObserver = new MutationObserver((changes, _) => {
- guildname.EditServersChangeObserver.disconnect();
- this.changeName(info, guildname);
- });
- guildname.EditServersChangeObserver.observe(guildname, {attributes:true});
- }
- else guildname.removeAttribute("changed-by-editservers");
- }
- }
-
- changeGuildIcon (info, icon) {
- if (!info || !icon || !icon.parentElement) return;
- if (icon.EditServersChangeObserver && typeof icon.EditServersChangeObserver.disconnect == "function") icon.EditServersChangeObserver.disconnect();
- let data = BDFDB.loadData(info.id, this, "servers") || {};
- if (data.url || data.removeIcon || icon.getAttribute("changed-by-editservers")) {
- if (icon.tagName == "IMG") icon.setAttribute("src", data.removeIcon ? null : (data.url || BDFDB.getGuildIcon(info.id)));
- else {
- BDFDB.setInnerText(icon, data.url ? "" : (data.shortName || (info.icon && !data.removeIcon ? "" : info.acronym)));
- icon.style.setProperty("background-image", data.removeIcon || data.shortName ? null : `url(${data.url || BDFDB.getGuildIcon(info.id)})`);
- icon.style.setProperty("background-color", BDFDB.colorCONVERT(data.color1, "RGB"), "important");
- icon.style.setProperty("color", BDFDB.colorCONVERT(data.color2, "RGB", "important"));
- icon.style.setProperty("font-size", this.getFontSize(icon));
- let hasicon = icon.style.getPropertyValue("background-image");
- if (hasicon) BDFDB.removeClass(icon, this.getNoIconClasses(icon));
- else BDFDB.addClass(icon, this.getNoIconClasses(icon));
- if (data.url && !data.removeIcon) {
- icon.style.setProperty("background-position", "center");
- icon.style.setProperty("background-size", "cover");
- }
- }
- if (data.url || data.removeIcon) {
- icon.setAttribute("changed-by-editservers", true);
- icon.EditServersChangeObserver = new MutationObserver((changes, _) => {
- changes.forEach(
- (change, i) => {
- icon.EditServersChangeObserver.disconnect();
- this.changeGuildIcon(info, icon);
- }
- );
- });
- icon.EditServersChangeObserver.observe(icon, {attributes:true});
- }
- else icon.removeAttribute("changed-by-editservers");
- }
- }
-
- changeTooltip (info, wrapper, type) {
- if (!info || !wrapper || !wrapper.parentElement) return;
- let data = BDFDB.loadData(info.id, this, "servers") || {};
- wrapper.removeEventListener("mouseenter", wrapper.tooltipListenerEditServers);
- if (data.name || data.color3 || data.color4) {
- var bgColor = data.color3 ? BDFDB.colorCONVERT(data.color3, "RGB") : "";
- var fontColor = data.color4 ? BDFDB.colorCONVERT(data.color4, "RGB") : "";
- wrapper.tooltipListenerEditServers = () => {
- BDFDB.createTooltip(data.name || info.name, wrapper, {type,selector:"EditServers-tooltip",style:`color: ${fontColor} !important; background-color: ${bgColor} !important; border-color: ${bgColor} !important;`,css:`body ${BDFDB.dotCN.tooltip}:not(.EditServers-tooltip) {display: none !important;}`});
- };
- wrapper.addEventListener("mouseenter", wrapper.tooltipListenerEditServers);
- }
- }
-
- getFontSize (icon) {
- if (icon.style.getPropertyValue("background-image")) return null;
- else if (BDFDB.containsClass(icon, BDFDB.disCN.avatariconsizexlarge)) return "12px";
- else if (BDFDB.containsClass(icon, BDFDB.disCN.avatariconsizelarge)) return "10px";
- else if (BDFDB.containsClass(icon, BDFDB.disCN.avatariconsizemedium)) return "8px";
- else if (BDFDB.containsClass(icon, BDFDB.disCN.avatariconsizesmall)) return "4.8px";
- else if (BDFDB.containsClass(icon, BDFDB.disCN.avatariconsizemini)) return "4px";
- else return "10px";
- }
-
- getNoIconClasses (icon) {
- let noiconclasses = [BDFDB.disCN.avatarnoicon];
- if (BDFDB.containsClass(icon, BDFDB.disCN.userprofilelistavatar)) noiconclasses.push(BDFDB.disCN.userprofilelistguildavatarwithouticon);
- return noiconclasses;
- }
-
- getSettingsPanel () {
- if (!global.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
- var settingshtml = `
${this.name}
`;
- settingshtml += `
`;
- settingshtml += `
`;
-
- let settingspanel = BDFDB.htmlToElement(settingshtml);
-
- BDFDB.initElements(settingspanel, this);
-
- BDFDB.addEventListener(this, settingspanel, "click", ".reset-button", () => {
- BDFDB.openConfirmModal(this, "Are you sure you want to reset all servers?", () => {
- BDFDB.removeAllData(this, "servers");
- BDFDB.WebModules.forceAllUpdates(this);
- });
- });
- return settingspanel;
- }
-
- setLabelsByLanguage () {
- switch (BDFDB.getDiscordLanguage().id) {
- case "hr": //croatian
- return {
- context_localserversettings_text: "Lokalne postavke poslužitelja",
- submenu_serversettings_text: "Promijeni postavke",
- submenu_resetsettings_text: "Ponovno postavite poslužitelj",
- modal_header_text: "Lokalne postavke poslužitelja",
- modal_servername_text: "Naziv lokalnog poslužitelja",
- modal_servershortname_text: "Poslužitelj prečaca",
- modal_serverurl_text: "Ikona",
- modal_removeicon_text: "Ukloni ikonu",
- 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_ignoreurl_text: "URL ignorirati",
- modal_validurl_text: "Vrijedi URL",
- modal_invalidurl_text: "Nevažeći URL",
- btn_cancel_text: "Prekid",
- btn_save_text: "Uštedjeti"
- };
- 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_servername_text: "Lokalt servernavn",
- modal_servershortname_text: "Initialer",
- modal_serverurl_text: "Ikon",
- modal_removeicon_text: "Fjern ikon",
- 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_ignoreurl_text: "Ignorer URL",
- modal_validurl_text: "Gyldig URL",
- modal_invalidurl_text: "Ugyldig URL",
- btn_cancel_text: "Afbryde",
- btn_save_text: "Spare"
- };
- 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_servername_text: "Lokaler Servername",
- modal_servershortname_text: "Serverkürzel",
- modal_serverurl_text: "Icon",
- modal_removeicon_text: "Entferne Icon",
- 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_ignoreurl_text: "URL ignorieren",
- modal_validurl_text: "Gültige URL",
- modal_invalidurl_text: "Ungültige URL",
- btn_cancel_text: "Abbrechen",
- btn_save_text: "Speichern"
- };
- 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_servername_text: "Nombre local del servidor",
- modal_servershortname_text: "Iniciales",
- modal_serverurl_text: "Icono",
- modal_removeicon_text: "Eliminar icono",
- 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_ignoreurl_text: "Ignorar URL",
- modal_validurl_text: "URL válida",
- modal_invalidurl_text: "URL inválida",
- btn_cancel_text: "Cancelar",
- btn_save_text: "Guardar"
- };
- 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_servername_text: "Nom local du serveur",
- modal_servershortname_text: "Initiales",
- modal_serverurl_text: "Icône",
- modal_removeicon_text: "Supprimer l'icône",
- 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_ignoreurl_text: "Ignorer l'URL",
- modal_validurl_text: "URL valide",
- modal_invalidurl_text: "URL invalide",
- btn_cancel_text: "Abandonner",
- btn_save_text: "Enregistrer"
- };
- 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_servername_text: "Nome locale server",
- modal_servershortname_text: "Iniziali",
- modal_serverurl_text: "Icona",
- modal_removeicon_text: "Rimuova l'icona",
- 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_ignoreurl_text: "Ignora l'URL",
- modal_validurl_text: "URL valido",
- modal_invalidurl_text: "URL non valido",
- btn_cancel_text: "Cancellare",
- btn_save_text: "Salvare"
- };
- 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_servername_text: "Lokale servernaam",
- modal_servershortname_text: "Initialen",
- modal_serverurl_text: "Icoon",
- modal_removeicon_text: "Verwijder icoon",
- 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_ignoreurl_text: "URL negeren",
- modal_validurl_text: "Geldige URL",
- modal_invalidurl_text: "Ongeldige URL",
- btn_cancel_text: "Afbreken",
- btn_save_text: "Opslaan"
- };
- 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_servername_text: "Lokalt servernavn",
- modal_servershortname_text: "Initialer",
- modal_serverurl_text: "Ikon",
- modal_removeicon_text: "Fjern ikon",
- 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_ignoreurl_text: "Ignorer URL",
- modal_validurl_text: "Gyldig URL",
- modal_invalidurl_text: "Ugyldig URL",
- btn_cancel_text: "Avbryte",
- btn_save_text: "Lagre"
- };
- 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_servername_text: "Lokalna nazwa serwera",
- modal_servershortname_text: "Krótka nazwa",
- modal_serverurl_text: "Ikona",
- modal_removeicon_text: "Usuń ikonę",
- 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_ignoreurl_text: "Ignoruj URL",
- modal_validurl_text: "Prawidłowe URL",
- modal_invalidurl_text: "Nieprawidłowe URL",
- btn_cancel_text: "Anuluj",
- btn_save_text: "Zapisz"
- };
- 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_servername_text: "Nome local do servidor",
- modal_servershortname_text: "Iniciais",
- modal_serverurl_text: "Icone",
- modal_removeicon_text: "Remover ícone",
- 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_ignoreurl_text: "Ignorar URL",
- modal_validurl_text: "URL válido",
- modal_invalidurl_text: "URL inválida",
- btn_cancel_text: "Cancelar",
- btn_save_text: "Salvar"
- };
- 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_servername_text: "Paikallinen palvelimenimi",
- modal_servershortname_text: "Nimikirjaimet",
- modal_serverurl_text: "Ikonin",
- modal_removeicon_text: "Poista kuvake",
- 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_ignoreurl_text: "Ohita URL",
- modal_validurl_text: "Voimassa URL",
- modal_invalidurl_text: "Virheellinen URL",
- btn_cancel_text: "Peruuttaa",
- btn_save_text: "Tallentaa"
- };
- 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_servername_text: "Lokalt servernamn",
- modal_servershortname_text: "Initialer",
- modal_serverurl_text: "Ikon",
- modal_removeicon_text: "Ta bort ikonen",
- 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_ignoreurl_text: "Ignorera URL",
- modal_validurl_text: "Giltig URL",
- modal_invalidurl_text: "Ogiltig URL",
- btn_cancel_text: "Avbryta",
- btn_save_text: "Spara"
- };
- 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_servername_text: "Yerel Sunucu Adı",
- modal_servershortname_text: "Baş harfleri",
- modal_serverurl_text: "Simge",
- modal_removeicon_text: "Simge kaldır",
- 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_ignoreurl_text: "URL yoksay",
- modal_validurl_text: "Geçerli URL",
- modal_invalidurl_text: "Geçersiz URL",
- btn_cancel_text: "Iptal",
- btn_save_text: "Kayıt"
- };
- 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_servername_text: "Místní název serveru",
- modal_servershortname_text: "Iniciály",
- modal_serverurl_text: "Ikony",
- modal_removeicon_text: "Odstranit ikonu",
- 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_ignoreurl_text: "Ignorovat URL",
- modal_validurl_text: "Platná URL",
- modal_invalidurl_text: "Neplatná URL",
- btn_cancel_text: "Zrušení",
- btn_save_text: "Uložit"
- };
- case "bg": //bulgarian
- return {
- context_localserversettings_text: "Настройки за локални cървър",
- submenu_serversettings_text: "Промяна на настройките",
- submenu_resetsettings_text: "Възстановяване на cървър",
- modal_header_text: "Настройки за локални cървър",
- modal_servername_text: "Локално име на cървър",
- modal_servershortname_text: "Инициали",
- modal_serverurl_text: "Икона",
- modal_removeicon_text: "Премахване на иконата",
- modal_tabheader1_text: "Cървър",
- modal_tabheader2_text: "Цвят на иконата",
- modal_tabheader3_text: "Цвят на подсказка",
- modal_colorpicker1_text: "Цвят на иконата",
- modal_colorpicker2_text: "Цвят на шрифта",
- modal_colorpicker3_text: "Цвят на подсказка",
- modal_colorpicker4_text: "Цвят на шрифта",
- modal_ignoreurl_text: "Игнориране на URL",
- modal_validurl_text: "Валиден URL",
- modal_invalidurl_text: "Невалиден URL",
- btn_cancel_text: "Зъбести",
- btn_save_text: "Cпасяване"
- };
- case "ru": //russian
- return {
- context_localserversettings_text: "Настройки локального cервер",
- submenu_serversettings_text: "Изменить настройки",
- submenu_resetsettings_text: "Сбросить cервер",
- modal_header_text: "Настройки локального cервер",
- modal_servername_text: "Имя локального cервер",
- modal_servershortname_text: "Инициалы",
- modal_serverurl_text: "Значок",
- modal_removeicon_text: "Удалить значок",
- modal_tabheader1_text: "Cервер",
- modal_tabheader2_text: "Цвет значков",
- modal_tabheader3_text: "Цвет подсказка",
- modal_colorpicker1_text: "Цвет значков",
- modal_colorpicker2_text: "Цвет шрифта",
- modal_colorpicker3_text: "Цвет подсказка",
- modal_colorpicker4_text: "Цвет шрифта",
- modal_ignoreurl_text: "Игнорировать URL",
- modal_validurl_text: "Действительный URL",
- modal_invalidurl_text: "Неверная URL",
- btn_cancel_text: "Отмена",
- btn_save_text: "Cпасти"
- };
- case "uk": //ukrainian
- return {
- context_localserversettings_text: "Налаштування локального cервер",
- submenu_serversettings_text: "Змінити налаштування",
- submenu_resetsettings_text: "Скидання cервер",
- modal_header_text: "Налаштування локального cервер",
- modal_servername_text: "Локальне ім'я cервер",
- modal_servershortname_text: "Ініціали",
- modal_serverurl_text: "Іконка",
- modal_removeicon_text: "Видалити піктограму",
- modal_tabheader1_text: "Cервер",
- modal_tabheader2_text: "Колір ікони",
- modal_tabheader3_text: "Колір підказка",
- modal_colorpicker1_text: "Колір ікони",
- modal_colorpicker2_text: "Колір шрифту",
- modal_colorpicker3_text: "Колір підказка",
- modal_colorpicker4_text: "Колір шрифту",
- modal_ignoreurl_text: "Ігнорувати URL",
- modal_validurl_text: "Дійсна URL",
- modal_invalidurl_text: "Недійсна URL",
- btn_cancel_text: "Скасувати",
- btn_save_text: "Зберегти"
- };
- case "ja": //japanese
- return {
- context_localserversettings_text: "ローカルサーバー設定",
- submenu_serversettings_text: "設定を変更する",
- submenu_resetsettings_text: "サーバーをリセットする",
- modal_header_text: "ローカルサーバー設定",
- modal_servername_text: "ローカルサーバー名",
- modal_servershortname_text: "イニシャル",
- modal_serverurl_text: "アイコン",
- modal_removeicon_text: "アイコンを削除",
- modal_tabheader1_text: "サーバー",
- modal_tabheader2_text: "アイコンの色",
- modal_tabheader3_text: "ツールチップの色",
- modal_colorpicker1_text: "アイコンの色",
- modal_colorpicker2_text: "フォントの色",
- modal_colorpicker3_text: "ツールチップの色",
- modal_colorpicker4_text: "フォントの色",
- modal_ignoreurl_text: "URL を無視する",
- modal_validurl_text: "有効な URL",
- modal_invalidurl_text: "無効な URL",
- btn_cancel_text: "キャンセル",
- btn_save_text: "セーブ"
- };
- case "zh-TW": //chinese (traditional)
- return {
- context_localserversettings_text: "本地服務器設置",
- submenu_serversettings_text: "更改設置",
- submenu_resetsettings_text: "重置服務器",
- modal_header_text: "本地服務器設置",
- modal_servername_text: "服務器名稱",
- modal_servershortname_text: "聲母",
- modal_serverurl_text: "圖標",
- modal_removeicon_text: "刪除圖標",
- modal_tabheader1_text: "服務器",
- modal_tabheader2_text: "圖標顏色",
- modal_tabheader3_text: "工具提示顏色",
- modal_colorpicker1_text: "圖標顏色",
- modal_colorpicker2_text: "字體顏色",
- modal_colorpicker3_text: "工具提示顏色",
- modal_colorpicker4_text: "字體顏色",
- modal_ignoreurl_text: "忽略 URL",
- modal_validurl_text: "有效的 URL",
- modal_invalidurl_text: "無效的 URL",
- btn_cancel_text: "取消",
- btn_save_text: "保存"
- };
- case "ko": //korean
- return {
- context_localserversettings_text: "로컬 서버 설정",
- submenu_serversettings_text: "설정 변경",
- submenu_resetsettings_text: "서버 재설정",
- modal_header_text: "로컬 서버 설정",
- modal_servername_text: "로컬 서버 이름",
- modal_servershortname_text: "머리 글자",
- modal_serverurl_text: "상",
- modal_removeicon_text: "상 삭제",
- modal_tabheader1_text: "서버",
- modal_tabheader2_text: "상 색깔",
- modal_tabheader3_text: "툴팁 색깔",
- modal_colorpicker1_text: "상 색깔",
- modal_colorpicker2_text: "글꼴 색깔",
- modal_colorpicker3_text: "툴팁 색깔",
- modal_colorpicker4_text: "글꼴 색깔",
- modal_ignoreurl_text: "URL 무시",
- modal_validurl_text: "유효한 URL",
- modal_invalidurl_text: "잘못된 URL",
- btn_cancel_text: "취소",
- btn_save_text: "저장"
- };
- 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_servername_text: "Local Servername",
- modal_servershortname_text: "Initials",
- modal_serverurl_text: "Icon",
- modal_removeicon_text: "Remove Icon",
- 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_ignoreurl_text: "Ignore URL",
- modal_validurl_text: "Valid URL",
- modal_invalidurl_text: "Invalid URL",
- btn_cancel_text: "Cancel",
- btn_save_text: "Save"
- };
- }
- }
- }
-};
diff --git a/PluginsV2/EditUsers/README.md b/PluginsV2/EditUsers/README.md
deleted file mode 100644
index 2512ff553d..0000000000
--- a/PluginsV2/EditUsers/README.md
+++ /dev/null
@@ -1,5 +0,0 @@
-# These Plugins are meant only for BDv2, not BD nor BandagedBD. If you got either of those two go to [Plugins](https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/).
-
-## Edit Users - [Download Script](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/EditUsers/index.js) [Download Config](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/EditUsers/config.json)
-
-Allows you to change the icon, name, tag and color of users.
diff --git a/PluginsV2/EditUsers/config.json b/PluginsV2/EditUsers/config.json
deleted file mode 100644
index 81b79b0b9b..0000000000
--- a/PluginsV2/EditUsers/config.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "info": {
- "name": "EditUsers",
- "authors": [
- {
- "name": "DevilBro",
- "url": "https://www.paypal.me/MircoWittrien",
- "discord_id": "278543574059057154",
- "github_username": "mwittrien"
- }
- ],
- "version": 1.0,
- "description": "Allows you to change the icon, name, tag and color of users. Does not work in compact mode. \n\nMy Support Server: http://bit.ly/DevilBrosHaus or https://discordapp.com/invite/Jx3TjNS"
- }
-}
diff --git a/PluginsV2/EditUsers/index.js b/PluginsV2/EditUsers/index.js
deleted file mode 100644
index ad100c8ef5..0000000000
--- a/PluginsV2/EditUsers/index.js
+++ /dev/null
@@ -1,1509 +0,0 @@
-module.exports = (Plugin, Api, Vendor) => {
- if (!global.BDFDB || typeof BDFDB != "object") global.BDFDB = {myPlugins:{}, BDv2Api: Api};
-
- return class extends Plugin {
- initConstructor () {
- this.labels = {};
-
- this.patchModules = {
- "ChannelTextArea":"componentDidMount",
- "NameTag":"componentDidMount",
- "AuditLog":"componentDidMount",
- "TypingUsers":"componentDidUpdate",
- "MessageUsername":"componentDidMount",
- "DirectMessage":"componentDidMount",
- "CallAvatar":"componentDidMount",
- "PrivateChannel":["componentDidMount","componentDidUpdate"],
- "HeaderBar":["componentDidMount","componentDidUpdate"],
- "Clickable":"componentDidMount",
- "MessageContent":["componentDidMount","componentDidUpdate"]
- };
-
- this.avatarselector = BDFDB.dotCNC.avatarinner + BDFDB.dotCNC.avatarimage + BDFDB.dotCNC.callavatarwrapper + BDFDB.dotCNC.voiceavatarcontainer + "[class*='avatar-']";
-
- this.css = `
- ${BDFDB.dotCN.bottag} {
- top: -4px;
- position: relative;
- margin-left: 1ch;
- }
- ${BDFDB.dotCN.friendscolumn} ${BDFDB.dotCN.bottag},
- ${BDFDB.dotCN.memberusername} ~ ${BDFDB.dotCN.bottag} {
- top: 0px;
- }
- ${BDFDB.dotCN.messagegroupcompact} ${BDFDB.dotCN.bottag} {
- margin-right: 6px;
- }`;
-
- this.userContextEntryMarkup =
- ``;
-
- this.userContextSubMenuMarkup =
- ``;
-
- this.userSettingsModalMarkup =
- `
-
-
-
-
-
-
-
-
REPLACE_modal_tabheader1_text
-
REPLACE_modal_tabheader2_text
-
REPLACE_modal_tabheader3_text
-
-
-
-
-
-
-
- `;
-
- this.defaults = {
- settings: {
- changeInChatTextarea: {value:true, description:"Chat Textarea"},
- changeInChatWindow: {value:true, description:"Messages"},
- changeInMentions: {value:true, description:"Mentions"},
- changeInVoiceChat: {value:true, description:"Voice Channels"},
- changeInMemberList: {value:true, description:"Member List"},
- changeInRecentDms: {value:true, description:"Direct Message Notifications"},
- changeInDmsList: {value:true, description:"Direct Message List"},
- changeInDmHeader: {value:true, description:"Direct Message Header"},
- changeInDmCalls: {value:true, description:"Direct Message Calls"},
- changeInTyping: {value:true, description:"Typing List"},
- changeInFriendList: {value:true, description:"Friend List"},
- changeInActivity: {value:true, description:"Activity Page"},
- changeInUserPopout: {value:true, description:"User Popouts"},
- changeInUserProfil: {value:true, description:"User Profile Modal"},
- changeInAutoComplete: {value:true, description:"Autocomplete Menu"},
- changeInAuditLog: {value:true, description:"Audit Log"},
- changeInSearchPopout: {value:true, description:"Search Popout"},
- changeInUserAccount: {value:true, description:"Your Account Information"}
- }
- };
- }
-
- onStart () {
- if (global.BDFDB && global.BDFDB.myPlugins && typeof global.BDFDB.myPlugins == "object") global.BDFDB.myPlugins[this.name] = this;
- var libraryScript = document.querySelector('head script[src="https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js"]');
- if (!global.BDFDB || typeof BDFDB != "object" || performance.now() - BDFDB.creationTime > 600000) {
- if (libraryScript) libraryScript.remove();
- libraryScript = document.createElement("script");
- libraryScript.setAttribute("type", "text/javascript");
- libraryScript.setAttribute("src", "https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js");
- libraryScript.setAttribute("date", performance.now());
- libraryScript.addEventListener("load", () => {if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();});
- document.head.appendChild(libraryScript);
- }
- else if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();
- this.startTimeout = setTimeout(() => {this.initialize();}, 30000);
- }
-
- initialize () {
- if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
- if (this.started) return true;
- BDFDB.loadMessage(this);
-
- this.RelationshipUtils = BDFDB.WebModules.findByProperties("isBlocked", "isFriend");
- this.UserUtils = BDFDB.WebModules.findByProperties("getUsers","getUser");
- this.MemberUtils = BDFDB.WebModules.findByProperties("getMembers", "getMember");
- this.ChannelUtils = BDFDB.WebModules.findByProperties("getChannels","getChannel");
- this.LastGuildStore = BDFDB.WebModules.findByProperties("getLastSelectedGuildId");
- this.LastChannelStore = BDFDB.WebModules.findByProperties("getLastSelectedChannelId");
-
- BDFDB.WebModules.forceAllUpdates(this);
-
- return true;
- }
- else {
- console.error(`%c[${this.name}]%c`, 'color: #3a71c1; font-weight: 700;', '', 'Fatal Error: Could not load BD functions!');
- return false;
- }
- }
-
- onStop () {
- if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
- let data = BDFDB.loadAllData(this, "users");
- BDFDB.removeAllData(this, "users");
- BDFDB.WebModules.forceAllUpdates(this);
- BDFDB.saveAllData(data, this, "users");
-
- BDFDB.removeEles(".autocompleteEditUsers", ".autocompleteEditUsersRow");
-
- BDFDB.unloadMessage(this);
- return true;
- }
- else {
- return false;
- }
- }
-
-
- // begin of own functions
-
- changeLanguageStrings () {
- this.userContextEntryMarkup = this.userContextEntryMarkup.replace("REPLACE_context_localusersettings_text", this.labels.context_localusersettings_text);
-
- this.userContextSubMenuMarkup = this.userContextSubMenuMarkup.replace("REPLACE_submenu_usersettings_text", this.labels.submenu_usersettings_text);
- this.userContextSubMenuMarkup = this.userContextSubMenuMarkup.replace("REPLACE_submenu_resetsettings_text", this.labels.submenu_resetsettings_text);
-
- this.userSettingsModalMarkup = this.userSettingsModalMarkup.replace("REPLACE_modal_header_text", this.labels.modal_header_text);
- this.userSettingsModalMarkup = this.userSettingsModalMarkup.replace("REPLACE_modal_username_text", this.labels.modal_username_text);
- this.userSettingsModalMarkup = this.userSettingsModalMarkup.replace("REPLACE_modal_usertag_text", this.labels.modal_usertag_text);
- this.userSettingsModalMarkup = this.userSettingsModalMarkup.replace("REPLACE_modal_userurl_text", this.labels.modal_userurl_text);
- this.userSettingsModalMarkup = this.userSettingsModalMarkup.replace("REPLACE_modal_removeicon_text", this.labels.modal_removeicon_text);
- this.userSettingsModalMarkup = this.userSettingsModalMarkup.replace("REPLACE_modal_ignoretagcolor_text", this.labels.modal_ignoretagcolor_text);
- this.userSettingsModalMarkup = this.userSettingsModalMarkup.replace("REPLACE_modal_tabheader1_text", this.labels.modal_tabheader1_text);
- this.userSettingsModalMarkup = this.userSettingsModalMarkup.replace("REPLACE_modal_tabheader2_text", this.labels.modal_tabheader2_text);
- this.userSettingsModalMarkup = this.userSettingsModalMarkup.replace("REPLACE_modal_tabheader3_text", this.labels.modal_tabheader3_text);
- this.userSettingsModalMarkup = this.userSettingsModalMarkup.replace("REPLACE_modal_colorpicker1_text", this.labels.modal_colorpicker1_text);
- this.userSettingsModalMarkup = this.userSettingsModalMarkup.replace("REPLACE_modal_colorpicker2_text", this.labels.modal_colorpicker2_text);
- this.userSettingsModalMarkup = this.userSettingsModalMarkup.replace("REPLACE_modal_colorpicker3_text", this.labels.modal_colorpicker3_text);
- this.userSettingsModalMarkup = this.userSettingsModalMarkup.replace("REPLACE_modal_colorpicker4_text", this.labels.modal_colorpicker4_text);
- this.userSettingsModalMarkup = this.userSettingsModalMarkup.replace("REPLACE_btn_cancel_text", this.labels.btn_cancel_text);
- this.userSettingsModalMarkup = this.userSettingsModalMarkup.replace("REPLACE_btn_save_text", this.labels.btn_save_text);
- }
-
- onUserContextMenu (instance, menu) {
- if (instance.props && instance.props.user && !menu.querySelector(".localusersettings-item")) {
- let userContextEntry = BDFDB.htmlToElement(this.userContextEntryMarkup);
- menu.appendChild(userContextEntry);
- let settingsitem = userContextEntry.querySelector(".localusersettings-item");
- settingsitem.addEventListener("mouseenter", () => {
- let userContextSubMenu = BDFDB.htmlToElement(this.userContextSubMenuMarkup);
- let useritem = userContextSubMenu.querySelector(".usersettings-item");
- useritem.addEventListener("click", () => {
- instance._reactInternalFiber.return.memoizedProps.closeContextMenu();
- this.showUserSettings(instance.props.user);
- });
- if (BDFDB.loadData(instance.props.user.id, this, "users")) {
- let resetitem = userContextSubMenu.querySelector(".resetsettings-item");
- BDFDB.removeClass(resetitem, BDFDB.disCN.contextmenuitemdisabled);
- resetitem.addEventListener("click", () => {
- instance._reactInternalFiber.return.memoizedProps.closeContextMenu();
- BDFDB.removeData(instance.props.user.id, this, "users");
- BDFDB.WebModules.forceAllUpdates(this);
- });
- }
- BDFDB.appendSubMenu(settingsitem, userContextSubMenu);
- });
- }
- }
-
- showUserSettings (info) {
- var {name,tag,url,removeIcon,ignoreTagColor,color1,color2,color3,color4} = BDFDB.loadData(info.id, this, "users") || {};
-
- var member = this.MemberUtils.getMember(this.LastGuildStore.getGuildId(), info.id) || {};
-
- let userSettingsModal = BDFDB.htmlToElement(this.userSettingsModalMarkup);
- let usernameinput = userSettingsModal.querySelector("#input-username");
- let usertaginput = userSettingsModal.querySelector("#input-usertag");
- let userurlinput = userSettingsModal.querySelector("#input-userurl");
- let removeiconinput = userSettingsModal.querySelector("#input-removeicon");
- let ignoretagcolorinput = userSettingsModal.querySelector("#input-ignoretagcolor");
-
- userSettingsModal.querySelector(BDFDB.dotCN.modalguildname).innerText = member.nick || info.username;
- usernameinput.value = name || "";
- usernameinput.setAttribute("placeholder", member.nick || info.username);
- usertaginput.value = tag || "";
- userurlinput.value = url || "";
- userurlinput.setAttribute("placeholder", BDFDB.getUserAvatar(info.id) || "");
- BDFDB.toggleClass(userurlinput, "valid", userurlinput.value.length > 0);
- userurlinput.disabled = removeIcon;
- removeiconinput.checked = removeIcon;
- ignoretagcolorinput.checked = ignoreTagColor;
- BDFDB.setColorSwatches(userSettingsModal, color1);
- BDFDB.setColorSwatches(userSettingsModal, color2);
- BDFDB.setColorSwatches(userSettingsModal, color3);
- BDFDB.setColorSwatches(userSettingsModal, color4);
-
- let ignoredswatches = userSettingsModal.querySelectorAll(".swatches[swatchnr='3'], .swatches[swatchnr='4']");
-
- BDFDB.toggleClass(ignoredswatches, "disabled", ignoretagcolorinput.checked);
-
- BDFDB.appendModal(userSettingsModal);
-
- removeiconinput.addEventListener("click", () => {
- userurlinput.disabled = removeiconinput.checked;
- });
- ignoretagcolorinput.addEventListener("click", () => {
- BDFDB.toggleClass(ignoredswatches, "disabled", ignoretagcolorinput.checked);
- });
- userurlinput.addEventListener("input", () => {
- this.checkUrl(userurlinput);
- });
- userurlinput.addEventListener("mouseenter", () => {
- BDFDB.addClass(userurlinput, "hovering");
- this.createNoticeTooltip(userurlinput);
- });
- userurlinput.addEventListener("mouseleave", () => {
- BDFDB.removeClass(userurlinput, "hovering");
- BDFDB.removeEles(BDFDB.dotCNS.tooltips + ".notice-tooltip");
- });
- BDFDB.addChildEventListener(userSettingsModal, "click", ".btn-save", e => {
- e.preventDefault();
-
- name = usernameinput.value.trim();
- name = name ? name : null;
-
- tag = usertaginput.value.trim();
- tag = tag ? tag : null;
-
- removeIcon = removeiconinput.checked;
-
- ignoreTagColor = ignoretagcolorinput.checked;
-
- url = !removeIcon && BDFDB.containsClass(userurlinput, "valid") ? userurlinput.value.trim() : null;
- url = url ? url : null;
-
- color1 = BDFDB.getSwatchColor(userSettingsModal, 1);
- color2 = BDFDB.getSwatchColor(userSettingsModal, 2);
- color3 = BDFDB.getSwatchColor(userSettingsModal, 3);
- color4 = BDFDB.getSwatchColor(userSettingsModal, 4);
-
- if (name == null && tag == null && url == null && !removeIcon && !ignoreTagColor && color1 == null && color2 == null && color3 == null && color4 == null) {
- BDFDB.removeData(info.id, this, "users")
- }
- else {
- BDFDB.saveData(info.id, {name,tag,url,removeIcon,ignoreTagColor,color1,color2,color3,color4}, this, "users");
- }
- BDFDB.WebModules.forceAllUpdates(this);
- });
- usernameinput.focus();
- }
-
- checkUrl (input) {
- BDFDB.removeEles(BDFDB.dotCNS.tooltips + ".notice-tooltip");
- if (!input.value) {
- BDFDB.removeClass(input, "valid");
- BDFDB.removeClass(input, "invalid");
- }
- else {
- require("request")(input.value, (error, response, result) => {
- if (response && response.headers["content-type"] && response.headers["content-type"].indexOf("image") != -1) {
- BDFDB.addClass(input, "valid");
- BDFDB.removeClass(input, "invalid");
- }
- else {
- BDFDB.removeClass(input, "valid");
- BDFDB.addClass(input, "invalid");
- }
- if (BDFDB.containsClass(input, "hovering")) this.createNoticeTooltip(input);
- });
- }
- }
-
- createNoticeTooltip (input) {
- var disabled = input.disabled;
- var valid = BDFDB.containsClass(input, "valid");
- var invalid = BDFDB.containsClass(input, "invalid");
- if (disabled || valid || invalid) {
- BDFDB.createTooltip(disabled ? this.labels.modal_ignoreurl_text : valid ? this.labels.modal_validurl_text : this.labels.modal_invalidurl_text, input, {type:"right",selector:"notice-tooltip",color: disabled ? "black" : invalid ? "red" : "green"});
- }
- }
-
- processChannelTextArea (instance, wrapper) {
- let channel = BDFDB.getReactValue(instance, "props.channel");
- if (channel) {
- var textarea = wrapper.querySelector("textarea");
- if (!textarea) return;
- if (instance.props.type == "normal" && channel.type == 1) {
- let user = this.UserUtils.getUser(channel.recipients[0]);
- if (user) {
- let data = this.getUserData(user.id, wrapper);
- textarea.setAttribute("placeholder", BDFDB.LanguageStrings.TEXTAREA_PLACEHOLDER.replace("{{channel}}", "@" + (data.name || user.username)));
- }
- }
- if (BDFDB.getData("changeInAutoComplete", this, "settings")) {
- BDFDB.addEventListener(this, textarea, "keydown", e => {
- let autocompletemenu = textarea.parentElement.querySelector(BDFDB.dotCN.autocomplete);
- if (autocompletemenu && (e.which == 9 || e.which == 13)) {
- if (BDFDB.containsClass(autocompletemenu.querySelector(BDFDB.dotCN.autocompleteselected).parentElement, "autocompleteEditUsersRow")) {
- e.originalEvent.preventDefault();
- e.originalEvent.stopPropagation();
- this.swapWordWithMention(textarea);
- }
- }
- else if (autocompletemenu && (e.which == 38 || e.which == 40)) {
- let autocompleteitems = autocompletemenu.querySelectorAll(BDFDB.dotCN.autocompleteselectable + ":not(.autocompleteEditUsersSelector)");
- let selected = autocompletemenu.querySelector(BDFDB.dotCN.autocompleteselected);
- if (BDFDB.containsClass(selected, "autocompleteEditUsersSelector") || autocompleteitems[e.which == 38 ? 0 : (autocompleteitems.length-1)] == selected) {
- e.originalEvent.preventDefault();
- e.originalEvent.stopPropagation();
- let next = this.getNextSelection(autocompletemenu, null, e.which == 38 ? false : true);
- BDFDB.removeClass(selected, BDFDB.disCN.autocompleteselected);
- BDFDB.addClass(selected, BDFDB.disCN.autocompleteselector);
- BDFDB.addClass(next, BDFDB.disCN.autocompleteselected);
- }
- }
- else if (textarea.value && !e.shiftKey && e.which == 13 && !autocompletemenu && textarea.value.indexOf("s/") != 0) {
- this.format = true;
- textarea.dispatchEvent(new Event("input"));
- }
- else if (!e.ctrlKey && e.which != 16 && textarea.selectionStart == textarea.selectionEnd && textarea.selectionEnd == textarea.value.length) {
- clearTimeout(textarea.EditUsersAutocompleteTimeout);
- textarea.EditUsersAutocompleteTimeout = setTimeout(() => {this.addAutoCompleteMenu(textarea, channel);},100);
- }
-
- if (!e.ctrlKey && e.which != 38 && e.which != 40 && !(e.which == 39 && textarea.selectionStart == textarea.selectionEnd && textarea.selectionEnd == textarea.value.length)) BDFDB.removeEles(".autocompleteEditUsers", ".autocompleteEditUsersRow");
- });
- BDFDB.addEventListener(this, textarea, "click", e => {
- if (textarea.selectionStart == textarea.selectionEnd && textarea.selectionEnd == textarea.value.length) setImmediate(() => {this.addAutoCompleteMenu(textarea, channel);});
- });
- }
- }
- }
-
- processNameTag (instance, wrapper) {
- let username = wrapper.parentElement.querySelector("." + (BDFDB.containsClass(wrapper, BDFDB.disCN.userpopoutheadertagwithnickname) ? BDFDB.disCN.userpopoutheadernickname : instance.props.usernameClass).replace(/ /g, "."));
- this.changeName(instance.props.user, username);
- this.changeAvatar(instance.props.user, this.getAvatarDiv(wrapper));
- this.addTag(instance.props.user, username.parentElement, BDFDB.disCN.bottagnametag + (instance.props.botClass ? (" " + instance.props.botClass) : ""));
- }
-
- processMessageUsername (instance, wrapper) {
- let message = BDFDB.getReactValue(instance, "props.message");
- if (message) {
- let username = wrapper.querySelector(BDFDB.dotCN.messageusername);
- if (username) {
- let channel = this.ChannelUtils.getChannel(message.channel_id) || {};
- this.changeName(message.author, username, channel.guild_id);
- if (!BDFDB.containsClass(wrapper.parentElement, BDFDB.disCN.messageheadercompact)) {
- this.changeAvatar(message.author, this.getAvatarDiv(wrapper));
- }
- let messagegroup = BDFDB.getParentEle(BDFDB.dotCN.messagegroup, wrapper);
- this.addTag(message.author, wrapper, BDFDB.disCN.bottagmessage + " " + (BDFDB.containsClass(messagegroup, BDFDB.disCN.messagegroupcozy) ? BDFDB.disCN.bottagmessagecozy : BDFDB.disCN.bottagmessagecompact));
- }
- }
- }
-
- processAuditLog (instance, wrapper) {
- let log = BDFDB.getReactValue(instance, "props.log");
- if (log && log.user) {
- let hooks = wrapper.querySelectorAll(BDFDB.dotCN.auditloguserhook);
- let guild_id = BDFDB.getReactValue(instance, "_reactInternalFiber.return.memoizedProps.guildId");
- if (hooks.length > 0) this.changeName2(log.user, hooks[0].firstChild, guild_id);
- if (hooks.length > 1 && log.targetType == "USER") this.changeName2(log.target, hooks[1].firstChild, guild_id);
- }
- }
-
- processTypingUsers (instance, wrapper) {
- let users = !instance.state.typingUsers ? [] : Object.keys(instance.state.typingUsers).filter(id => id != BDFDB.myData.id).filter(id => !this.RelationshipUtils.isBlocked(id)).map(id => this.UserUtils.getUser(id)).filter(id => id != null);
- wrapper.querySelectorAll(BDFDB.dotCNS.typing + "strong").forEach((username, i) => {
- if (users[i] && username) this.changeName2(users[i], username);
- });
- }
-
- processDirectMessage (instance, wrapper) {
- let channel = BDFDB.getReactValue(instance, "props.channel");
- if (channel && channel.type == 1) {
- let user = this.UserUtils.getUser(channel.recipients[0]);
- if (user) {
- let avatar = this.getAvatarDiv(wrapper);
- if (avatar) {
- this.changeAvatar(user, avatar);
- this.changeTooltip(user, avatar, "right");
- }
- }
- }
- }
-
- processCallAvatar (instance, wrapper) {
- if (instance.props && instance.props.id) {
- let user = this.UserUtils.getUser(instance.props.id);
- if (!user) {
- let channel = this.ChannelUtils.getChannel(instance.props.id);
- if (channel && channel.type == 1) user = this.UserUtils.getUser(channel.recipients[0]);
- }
- if (user) {
- let avatar = wrapper.querySelector(BDFDB.dotCN.callavatar);
- this.changeName2(user, wrapper.parentElement.querySelector(BDFDB.dotCN.callmembers));
- this.changeAvatar(user, avatar);
- if (BDFDB.containsClass(avatar, BDFDB.disCN.callvideo)) this.changeTooltip(user, avatar, "left");
- }
- }
- }
-
- processPrivateChannel (instance, wrapper) {
- if (instance.props && instance.props.user) {
- let username = wrapper.querySelector(BDFDB.dotCN.dmchannelname);
- this.changePrivateChannel(instance.props.user, username.firstElementChild ? username.firstElementChild : username);
- this.changeAvatar(instance.props.user, this.getAvatarDiv(wrapper));
- }
- }
-
- processHeaderBar (instance, wrapper) {
- let channel_id = BDFDB.getReactValue(instance, "_reactInternalFiber.return.memoizedProps.channelId");
- if (channel_id) {
- let username = wrapper.querySelector(BDFDB.dotCN.channelheaderchannelname);
- if (username) {
- let channel = this.ChannelUtils.getChannel(channel_id);
- if (channel) {
- if (channel.type == 1) this.changeName(this.UserUtils.getUser(channel.recipients[0]), username);
- else {
- if (username.EditUsersChangeObserver && typeof username.EditUsersChangeObserver.disconnect == "function") username.EditUsersChangeObserver.disconnect();
- username.style.removeProperty("color");
- username.style.removeProperty("background");
- BDFDB.setInnerText(username, channel.name);
- }
- }
- }
- }
- }
-
- processClickable (instance, wrapper) {
- if (!wrapper || !instance.props || !instance.props.className) return;
- if (instance.props.tag == "a" && instance.props.className.indexOf(BDFDB.disCN.anchorunderlineonhover) > -1) {
- if (BDFDB.containsClass(wrapper.parentElement, BDFDB.disCN.messagesystemcontent) && wrapper.parentElement.querySelector("a") == wrapper) {
- let message = BDFDB.getKeyInformation({node:wrapper.parentElement, key:"message", up:true});
- if (message) this.changeName(message.author, wrapper);
- }
- }
- else if (instance.props.tag == "span" && instance.props.className.indexOf(BDFDB.disCN.mention) > -1) {
- let render = BDFDB.getReactValue(instance, "_reactInternalFiber.return.return.stateNode.props.render");
- if (typeof render == "function") this.changeMention(render().props.user, wrapper);
- }
- else if (instance.props.tag == "div" && instance.props.className.indexOf(BDFDB.disCN.voiceuser) > -1) {
- let user = BDFDB.getReactValue(instance, "_reactInternalFiber.return.memoizedProps.user");
- if (user) {
- this.changeVoiceUser(user, wrapper.querySelector(BDFDB.dotCN.voicename));
- this.changeAvatar(user, this.getAvatarDiv(wrapper));
- }
- }
- else if (instance.props.tag == "div" && instance.props.className.indexOf(BDFDB.disCN.quickswitchresult) > -1) {
- let result = BDFDB.getReactValue(instance, "_reactInternalFiber.return.memoizedProps.result");
- if (result && result.type == "USER") {
- this.changeName2(result.record, wrapper.querySelector(BDFDB.dotCN.quickswitchresultmatch));
- this.changeAvatar(result.record, this.getAvatarDiv(wrapper));
- }
- }
- else if (instance.props.tag == "div" && instance.props.className.indexOf(BDFDB.disCN.autocompleterow) > -1) {
- let user = BDFDB.getReactValue(instance, "_reactInternalFiber.return.memoizedProps.user");
- if (user) {
- this.changeName2(user, wrapper.querySelector(BDFDB.dotCN.marginleft8));
- this.changeAvatar(user, this.getAvatarDiv(wrapper));
- }
- }
- else if (instance.props.tag == "div" && instance.props.className.indexOf(BDFDB.disCN.searchpopoutoption) > -1) {
- let user = BDFDB.getReactValue(instance, "_reactInternalFiber.return.memoizedProps.user");
- let tokens = BDFDB.getReactValue(instance, "_reactInternalFiber.return.memoizedState.tokens");
- if (user && tokens && Array.isArray(tokens)) {
- for (let i in tokens) {
- let token = tokens[i];
- if (token.type == "ANSWER_USERNAME_FROM" && token._data && token._data.get("user")) {
- this.changeName3(token._data.get("user"), wrapper.children[i], true);
- this.changeAvatar(user, this.getAvatarDiv(wrapper));
- break;
- }
- }
- }
- else if (instance.props.className.indexOf(BDFDB.disCN.searchpopoutuser) > -1) {
- let result = BDFDB.getReactValue(instance, "_reactInternalFiber.return.memoizedProps.result");
- if (result && result.user) {
- this.changeName3(result.user, wrapper.querySelector(BDFDB.dotCN.searchpopoutdisplayednick), false);
- this.changeAvatar(result.user, wrapper.querySelector(BDFDB.dotCN.searchpopoutdisplayavatar));
- }
- }
- }
- }
-
- processMessageContent (instance, wrapper) {
- let message = BDFDB.getReactValue(instance, "props.message");
- if (message && message.author) {
- let markup = wrapper.querySelector(BDFDB.dotCN.messagemarkup);
- if (markup) {
- let channel = this.ChannelUtils.getChannel(message.channel_id) || {};
- let member = this.MemberUtils.getMember(channel.guild_id, message.author.id) || {};
- let data = this.getUserData(message.author.id, wrapper);
- markup.style.setProperty("color", settingsCookie["bda-gs-7"] ? BDFDB.colorCONVERT(data.color1 || member.colorString, "RGB") : null, "important");
- }
- }
- }
-
- changeName (info, username, guildid = this.LastGuildStore.getGuildId()) {
- if (!info || !username || !username.parentElement) return;
- if (username.EditUsersChangeObserver && typeof username.EditUsersChangeObserver.disconnect == "function") username.EditUsersChangeObserver.disconnect();
- let data = this.getUserData(info.id, username);
- if (data.name || data.color1 || data.color2 || username.getAttribute("changed-by-editusers")) {
- let member = this.MemberUtils.getMember(guildid, info.id) || {};
- let isBRCenabled = BDFDB.isPluginEnabled("BetterRoleColors");
- let usenick = !BDFDB.containsClass(username, BDFDB.disCN.userprofileusername) && !BDFDB.containsClass(username.parentElement, BDFDB.disCN.userprofilelistname, BDFDB.disCN.accountinfodetails, false) && member.nick;
- let usemembercolor = !BDFDB.containsClass(username.parentElement, BDFDB.disCN.userprofilelistname) && (BDFDB.containsClass(username, BDFDB.disCN.memberusername, BDFDB.disCN.messageusername, false) || isBRCenabled);
- username.style.setProperty("color", BDFDB.colorCONVERT(data.color1 || (usemembercolor ? member.colorString : null), "RGB"), "important");
- username.style.setProperty("background-color", BDFDB.colorCONVERT(data.color2, "RGB"), "important");
- BDFDB.setInnerText(username, data.name || (usenick ? member.nick : info.username));
- for (let tag of username.parentElement.querySelectorAll(BDFDB.dotCN.bottag)) {
- let invert = tag.className.indexOf(BDFDB.disCN.bottaginvert) > -1;
- let tagcolor = BDFDB.colorCONVERT(data.color1 || (isBRCenabled || BDFDB.containsClass(tag, "owner-tag-rolecolor") ? member.colorString : null), "RGB");
- tagcolor = BDFDB.colorISBRIGHT(tagcolor) ? BDFDB.colorCHANGE(tagcolor, -0.3) : tagcolor;
- tag.style.setProperty(invert ? "color" : "background-color", tagcolor, "important");
- }
- if (data.name || data.color1 || data.color2) {
- username.setAttribute("changed-by-editusers", true);
- username.EditUsersChangeObserver = new MutationObserver((changes, _) => {
- username.EditUsersChangeObserver.disconnect();
- this.changeName(info, username);
- });
- username.EditUsersChangeObserver.observe(username, {attributes:true});
- }
- else username.removeAttribute("changed-by-editusers");
- }
- }
-
- changeName2 (info, username, guildid = this.LastGuildStore.getGuildId()) {
- if (!info || !username || !username.parentElement) return;
- if (username.EditUsersChangeObserver && typeof username.EditUsersChangeObserver.disconnect == "function") username.EditUsersChangeObserver.disconnect();
- let data = this.getUserData(info.id, username);
- if (data.name || data.color1 || username.getAttribute("changed-by-editusers")) {
- let member = this.MemberUtils.getMember(guildid, info.id) || {};
- username.style.setProperty("color", BDFDB.colorCONVERT(data.color1 || (BDFDB.isPluginEnabled("BetterRoleColors") ? member.colorString : null), "RGB"), "important");
- BDFDB.setInnerText(username, data.name || member.nick || info.username);
- if (data.name || data.color1) {
- username.setAttribute("changed-by-editusers", true);
- username.EditUsersChangeObserver = new MutationObserver((changes, _) => {
- username.EditUsersChangeObserver.disconnect();
- this.changeName(info, username);
- });
- username.EditUsersChangeObserver.observe(username, {attributes:true});
- }
- else username.removeAttribute("changed-by-editusers");
- }
- }
-
- changeName3 (info, username, adddisc) {
- if (!info || !username || !username.parentElement) return;
- if (username.EditUsersChangeObserver && typeof username.EditUsersChangeObserver.disconnect == "function") username.EditUsersChangeObserver.disconnect();
- let data = this.getUserData(info.id, username);
- if (data.name || data.color1 || username.getAttribute("changed-by-editusers")) {
- let color1 = BDFDB.colorCONVERT(data.color1, "RGB");
- if (adddisc) {
- username.innerHTML = `
${BDFDB.encodeToHTML(data.name || info.username)} #${info.discriminator} `;
- }
- else {
- username.style.setProperty("color", color1, "important");
- BDFDB.setInnerText(username, data.name || info.username);
- }
- if (data.name || data.color1) {
- username.setAttribute("changed-by-editusers", true);
- username.EditUsersChangeObserver = new MutationObserver((changes, _) => {
- username.EditUsersChangeObserver.disconnect();
- this.changeName(info, username);
- });
- username.EditUsersChangeObserver.observe(username, {attributes:true});
- }
- else username.removeAttribute("changed-by-editusers");
- }
- }
-
- changeAvatar (info, avatar) {
- if (!info || !avatar || !avatar.parentElement) return;
- if (avatar.EditUsersChangeObserver && typeof avatar.EditUsersChangeObserver.disconnect == "function") avatar.EditUsersChangeObserver.disconnect();
- let data = this.getUserData(info.id, avatar);
- if (data.url || data.removeIcon || avatar.getAttribute("changed-by-editusers")) {
- if (avatar.tagName == "IMG") avatar.setAttribute("src", data.removeIcon ? null : (data.url || BDFDB.getUserAvatar(info.id)));
- else {
- let url = data.removeIcon ? null : ("url(" + (data.url || BDFDB.getUserAvatar(info.id)) + ")");
- if (url && BDFDB.containsClass(avatar, BDFDB.disCN.avatarmaskprofile) && url.search(/discordapp\.com\/avatars\/[0-9]*\/a_/) > -1) url = url.replace(".webp)", ".gif)");
- avatar.style.setProperty("background-image", url);
- if (data.url && !data.removeIcon) {
- avatar.style.setProperty("background-position", "center");
- avatar.style.setProperty("background-size", "cover");
- }
- }
- if (data.url || data.removeIcon) {
- avatar.setAttribute("changed-by-editusers", true);
- avatar.EditUsersChangeObserver = new MutationObserver((changes, _) => {
- changes.forEach(
- (change, i) => {
- avatar.EditUsersChangeObserver.disconnect();
- this.changeAvatar(info, avatar);
- }
- );
- });
- avatar.EditUsersChangeObserver.observe(avatar, {attributes:true});
- }
- else avatar.removeAttribute("changed-by-editusers");
- }
- }
-
- changeTooltip (info, wrapper, type) {
- if (!info || !wrapper || !wrapper.parentElement) return;
- let data = this.getUserData(info.id, wrapper);
- wrapper.removeEventListener("mouseenter", wrapper.tooltipListenerEditUsers);
- if (data.name) {
- wrapper.tooltipListenerEditUsers = () => {
- BDFDB.createTooltip(data.name, wrapper, {type,selector:"EditUsers-tooltip",css:`body ${BDFDB.dotCN.tooltip}:not(.EditUsers-tooltip) {display: none !important;}`});
- };
- wrapper.addEventListener("mouseenter", wrapper.tooltipListenerEditUsers);
- }
- }
-
- addTag (info, wrapper, selector = "") {
- if (!info || !wrapper || !wrapper.parentElement || BDFDB.containsClass(wrapper, BDFDB.disCN.accountinfodetails) || BDFDB.containsClass(wrapper, "discord-tag")) return;
- BDFDB.removeEles(wrapper.querySelectorAll(".EditUsers-tag"));
- let data = this.getUserData(info.id, wrapper);
- if (data.tag) {
- let member = data.ignoreTagColor ? (this.MemberUtils.getMember(this.LastGuildStore.getGuildId(), info.id) || {}) : {};
- let color3 = BDFDB.colorCONVERT(!data.ignoreTagColor ? data.color3 : member.colorString, "RGB");
- let color4 = !data.ignoreTagColor && data.color4 ? BDFDB.colorCONVERT(data.color4, "RGB") : (BDFDB.colorISBRIGHT(color3) ? "black" : "white");
- let tag = document.createElement("span");
- tag.className = "EditUsers-tag " + BDFDB.disCN.bottag + (selector ? (" " + selector) : "");
- tag.innerText = data.tag;
- tag.style.setProperty("background-color", color3, "important");
- tag.style.setProperty("color", color4, "important");
- wrapper.appendChild(tag);
- }
- }
-
- changePrivateChannel (info, username) {
- if (!info || !username || !username.parentElement) return;
- let dmchannel = BDFDB.getParentEle(BDFDB.dotCN.dmchannel, username);
- if (!dmchannel) return;
- if (username.EditUsersChangeObserver && typeof username.EditUsersChangeObserver.disconnect == "function") username.EditUsersChangeObserver.disconnect();
- dmchannel.removeEventListener("mouseenter", dmchannel.mouseenterListenerEditUsers);
- dmchannel.removeEventListener("mouseleave", dmchannel.mouseleaveListenerEditUsers);
- let data = this.getUserData(info.id, username);
- if (data.name || data.color1 || data.color2 || username.getAttribute("changed-by-editusers")) {
- let color1 = BDFDB.colorCONVERT(data.color1, "RGB");
- let color2 = BDFDB.colorCONVERT(data.color2, "RGB");
- BDFDB.setInnerText(username, data.name || info.username);
- if (username.EditUsersHovered || BDFDB.containsClass(dmchannel, BDFDB.disCN.dmchannelselected)) colorHover();
- else colorDefault();
-
- if (data.name || data.color1 || data.color2) {
- dmchannel.mouseenterListenerEditUsers = () => {
- username.EditUsersHovered = true;
- colorHover();
- };
- dmchannel.mouseleaveListenerEditUsers = () => {
- delete username.EditUsersHovered;
- colorDefault();
- };
- dmchannel.addEventListener("mouseenter", dmchannel.mouseenterListenerEditUsers);
- dmchannel.addEventListener("mouseleave", dmchannel.mouseleaveListenerEditUsers);
- username.setAttribute("changed-by-editusers", true);
- username.EditUsersChangeObserver = new MutationObserver((changes, _) => {
- username.EditUsersChangeObserver.disconnect();
- this.changePrivateChannel(info, username);
- });
- username.EditUsersChangeObserver.observe(username, {attributes:true});
- }
- else username.removeAttribute("changed-by-editusers");
- function colorDefault() {
- username.style.setProperty("color", color1 ? BDFDB.colorCHANGE(color1, -0.5) : null, "important");
- username.style.setProperty("background", color2 ? BDFDB.colorCHANGE(color2, -0.5) : null, "important");
- }
- function colorHover() {
- username.style.setProperty("color", color1, "important");
- username.style.setProperty("background", color2, "important");
- }
- }
- }
-
- changeMention (info, mention) {
- if (!info || !mention || !mention.parentElement) return;
- if (mention.EditUsersChangeObserver && typeof mention.EditUsersChangeObserver.disconnect == "function") mention.EditUsersChangeObserver.disconnect();
- mention.removeEventListener("mouseover", mention.mouseoverListenerEditUsers);
- mention.removeEventListener("mouseout", mention.mouseoutListenerEditUsers);
- let data = this.getUserData(info.id, mention);
- let member = this.MemberUtils.getMember(this.LastGuildStore.getGuildId(), info.id) || {};
- let color1 = BDFDB.colorCONVERT(data.color1 || (BDFDB.isPluginEnabled("BetterRoleColors") ? member.colorString : null), "RGBCOMP");
- let name = data.name ? data.name : (BDFDB.isPluginEnabled("RemoveNicknames") ? BDFDB.Plugins["removenicknames"].getNewName(info) : member.nick || info.username);
- BDFDB.setInnerText(mention, "@" + name);
- if (mention.EditUsersHovered) colorHover();
- else colorDefault();
- mention.mouseoverListenerEditUsers = () => {
- mention.EditUsersHovered = true;
- colorHover();
- };
- mention.mouseoutListenerEditUsers = () => {
- delete mention.EditUsersHovered;
- colorDefault();
- };
- mention.addEventListener("mouseover", mention.mouseoverListenerEditUsers);
- mention.addEventListener("mouseout", mention.mouseoutListenerEditUsers);
- mention.EditUsersChangeObserver = new MutationObserver((changes, _) => {
- mention.EditUsersChangeObserver.disconnect();
- this.changeMention(info, mention);
- });
- mention.EditUsersChangeObserver.observe(mention, {attributes:true});
- function colorDefault() {
- mention.style.setProperty("color", color1 ? "rgb(" + color1[0] + "," + color1[1] + "," + color1[2] + ")" : null, "important");
- mention.style.setProperty("background", color1 ? "rgba(" + color1[0] + "," + color1[1] + "," + color1[2] + ",.1)" : null, "important");
- }
- function colorHover() {
- mention.style.setProperty("color", color1 ? "#FFFFFF" : null, "important");
- mention.style.setProperty("background", color1 ? "rgba(" + color1[0] + "," + color1[1] + "," + color1[2] + ",.7)" : null, "important");
- }
- }
-
- changeVoiceUser (info, username) {
- if (!info || !username || !username.parentElement) return;
- if (username.EditUsersChangeObserver && typeof username.EditUsersChangeObserver.disconnect == "function") username.EditUsersChangeObserver.disconnect();
- let data = this.getUserData(info.id, username);
- if (data.name || data.color1 || username.getAttribute("changed-by-editusers")) {
- let member = this.MemberUtils.getMember(this.LastGuildStore.getGuildId(), info.id) || {};
- let color1 = BDFDB.colorCONVERT(data.color1 || (BDFDB.isPluginEnabled("BetterRoleColors") ? member.colorString : ""), "RGB");
- BDFDB.setInnerText(username, data.name || member.nick || info.username);
- username.style.setProperty("color", BDFDB.containsClass(username, BDFDB.disCN.voicenamedefault) ? BDFDB.colorCHANGE(color1, -50) : color1, "important");
- if (data.name || data.color1) {
- username.EditUsersChangeObserver = new MutationObserver((changes, _) => {
- username.EditUsersChangeObserver.disconnect();
- this.changeVoiceUser(info, username);
- });
- username.EditUsersChangeObserver.observe(username, {attributes:true});
- }
- else username.removeAttribute("changed-by-editusers");
- }
- }
-
- getAvatarDiv (wrapper) {
- var avatar = wrapper.querySelector(this.avatarselector);
- while (!avatar && wrapper.parentElement) {
- wrapper = wrapper.parentElement;
- avatar = wrapper.querySelector(this.avatarselector);
- }
- return avatar.firstElementChild || avatar;
- }
-
- getUserData (id, wrapper) {
- let data = BDFDB.loadData(id, this, "users");
- if (!data) return {};
- let allenabled = true, settings = BDFDB.getAllData(this, "settings");
- for (let i in settings) if (!settings[i]) allenabled = false;
- if (allenabled) return data;
- let key = null, ele = null;
- if (!BDFDB.containsClass(wrapper, BDFDB.disCN.mention) && BDFDB.getParentEle(BDFDB.dotCN.messagegroup, wrapper)) key = "changeInChatWindow";
- else if (BDFDB.containsClass(wrapper, BDFDB.disCN.mention)) key = "changeInMentions";
- else if (BDFDB.getParentEle(BDFDB.dotCN.textareawrapchat, wrapper)) key = "changeInChatTextarea";
- else if (BDFDB.getParentEle(BDFDB.dotCN.voiceuser, wrapper)) key = "changeInVoiceChat";
- else if (BDFDB.getParentEle(BDFDB.dotCN.members, wrapper)) key = "changeInMemberList";
- else if (BDFDB.getParentEle(BDFDB.dotCN.dms, wrapper)) key = "changeInRecentDms";
- else if (BDFDB.getParentEle(BDFDB.dotCN.dmchannels, wrapper)) key = "changeInDmsList";
- else if (BDFDB.getParentEle(BDFDB.dotCN.channelheaderheaderbar, wrapper)) key = "changeInDmHeader";
- else if (BDFDB.getParentEle(BDFDB.dotCN.callavatarwrapper, wrapper)) key = "changeInDmCalls";
- else if (BDFDB.getParentEle(BDFDB.dotCN.callincoming, wrapper) || BDFDB.getParentEle(BDFDB.dotCN.callcurentcontainer, wrapper)) key = "changeInDmCalls";
- else if (BDFDB.getParentEle(BDFDB.dotCN.typing, wrapper)) key = "changeInTyping";
- else if (BDFDB.getParentEle(BDFDB.dotCN.friends, wrapper) || BDFDB.getParentEle(BDFDB.dotCN.userprofilebody, wrapper)) key = "changeInFriendList";
- else if (BDFDB.getParentEle(BDFDB.dotCN.activityfeed, wrapper)) key = "changeInActivity";
- else if (BDFDB.getParentEle(BDFDB.dotCN.userpopout, wrapper)) key = "changeInUserPopout";
- else if (BDFDB.getParentEle(BDFDB.dotCN.userprofileheader, wrapper)) key = "changeInUserProfil";
- else if (BDFDB.getParentEle(BDFDB.dotCN.autocomplete, wrapper)) key = "changeInAutoComplete";
- else if (BDFDB.getParentEle(BDFDB.dotCN.auditlog, wrapper)) key = "changeInAuditLog";
- else if (BDFDB.getParentEle(BDFDB.dotCN.searchpopout, wrapper) || BDFDB.getParentEle(BDFDB.dotCN.searchpopoutdmaddpopout, wrapper)) key = "changeInSearchPopout";
- else if (BDFDB.getParentEle(BDFDB.dotCN.accountinfo, wrapper)) key = "changeInUserAccount";
-
- return !key || BDFDB.getData(key, this, "settings") ? data : {};
- }
-
- addAutoCompleteMenu (textarea, channel) {
- if (textarea.parentElement.querySelector(".autocompleteEditUsersRow")) return;
- let words = textarea.value.split(/\s/);
- let lastword = words[words.length-1].trim();
- if (lastword && lastword.length > 1 && lastword[0] == "@") {
- let users = BDFDB.loadAllData(this, "users");
- if (!users) return;
- let userarray = [];
- for (let id in users) if (users[id].name) {
- let user = this.UserUtils.getUser(id);
- let member = user ? this.MemberUtils.getMember(channel.guild_id, id) : null;
- if (user && member) userarray.push(Object.assign({lowercasename:users[id].name.toLowerCase(),user,member},users[id]));
- }
- userarray = BDFDB.sortArrayByKey(userarray.filter(n => n.lowercasename.indexOf(lastword.toLowerCase().slice(1)) != -1), "lowercasename");
- if (userarray.length) {
- let autocompletemenu = textarea.parentElement.querySelector(BDFDB.dotCNS.autocomplete + BDFDB.dotCN.autocompleteinner), amount = 15;
- if (!autocompletemenu) {
- autocompletemenu = BDFDB.htmlToElement(`
`);
- textarea.parentElement.appendChild(autocompletemenu);
- autocompletemenu = autocompletemenu.firstElementChild;
- }
- else {
- amount -= autocompletemenu.querySelectorAll(BDFDB.dotCN.autocompleteselectable).length;
- }
-
- BDFDB.addEventListener(this, autocompletemenu, "mouseenter", BDFDB.dotCN.autocompleteselectable, e => {
- var selected = autocompletemenu.querySelectorAll(BDFDB.dotCN.autocompleteselected);
- BDFDB.removeClass(selected, BDFDB.disCN.autocompleteselected);
- BDFDB.addClass(selected, BDFDB.disCN.autocompleteselector);
- BDFDB.addClass(e.currentTarget, BDFDB.disCN.autocompleteselected);
- });
-
- for (let data of userarray) {
- if (amount-- < 1) break;
- let autocompleterow = BDFDB.htmlToElement(`
`);
- autocompleterow.querySelector(BDFDB.dotCN.autocompleteselectable).addEventListener("click", () => {this.swapWordWithMention(textarea);});
- autocompletemenu.appendChild(autocompleterow);
- }
- if (!autocompletemenu.querySelector(BDFDB.dotCN.autocompleteselected)) {
- BDFDB.addClass(autocompletemenu.querySelector(".autocompleteEditUsersRow " + BDFDB.dotCN.autocompleteselectable), BDFDB.disCN.autocompleteselected);
- }
- }
- }
- }
-
- getNextSelection (menu, selected, forward) {
- selected = selected ? selected : menu.querySelector(BDFDB.dotCN.autocompleteselected).parentElement;
- let next, sibling = forward ? selected.nextElementSibling : selected.previousElementSibling;
- if (sibling) {
- next = sibling.querySelector(BDFDB.dotCN.autocompleteselectable);
- }
- else {
- let items = menu.querySelectorAll(BDFDB.dotCN.autocompleteselectable);
- next = forward ? items[0] : items[items.length-1];
- }
- return next ? next : this.getNextSelection(menu, sibling, forward);
- }
-
- swapWordWithMention (textarea) {
- let selected = textarea.parentElement.querySelector(".autocompleteEditUsersRow " + BDFDB.dotCN.autocompleteselected);
- let words = textarea.value.split(/\s/);
- let lastword = words[words.length-1].trim();
- if (selected && lastword) {
- let username = selected.querySelector(BDFDB.dotCN.autocompletedescriptionusername).textContent;
- let discriminator = selected.querySelector(BDFDB.dotCN.autocompletedescriptiondiscriminator).textContent;
- let userid = selected.getAttribute("userid");
- BDFDB.removeEles(".autocompleteEditUsers", ".autocompleteEditUsersRow");
- textarea.focus();
- textarea.selectionStart = textarea.value.length - lastword.length;
- textarea.selectionEnd = textarea.value.length;
- document.execCommand("insertText", false, (username && discriminator ? ("@" + username + discriminator) : `<@!${userid}>`) + " ");
- textarea.selectionStart = textarea.value.length;
- textarea.selectionEnd = textarea.value.length;
- }
- }
-
- getSettingsPanel () {
- if (!global.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
- var settings = BDFDB.getAllData(this, "settings");
- var settingshtml = `
${this.name}
`;
- settingshtml += `
Change User in: `;
- for (let key in settings) {
- settingshtml += `
`;
- }
- settingshtml += `
`;
- settingshtml += `
`;
- settingshtml += `
`;
-
- let settingspanel = BDFDB.htmlToElement(settingshtml);
-
- BDFDB.initElements(settingspanel, this);
-
- BDFDB.addEventListener(this, settingspanel, "click", ".reset-button", () => {
- BDFDB.openConfirmModal(this, "Are you sure you want to reset all users?", () => {
- BDFDB.removeAllData(this, "users");
- BDFDB.WebModules.forceAllUpdates(this);
- });
- });
- return settingspanel;
- }
-
- onSettingsClosed () {
- if (this.SettingsUpdated) {
- delete this.SettingsUpdated;
- BDFDB.WebModules.forceAllUpdates(this);
- }
- }
-
- setLabelsByLanguage () {
- switch (BDFDB.getDiscordLanguage().id) {
- case "hr": //croatian
- return {
- context_localusersettings_text: "Lokalne korisničke postavke",
- submenu_usersettings_text: "Promijeni postavke",
- submenu_resetsettings_text: "Poništi korisnika",
- modal_header_text: "Lokalne korisničke postavke",
- modal_username_text: "Lokalno korisničko ime",
- modal_usertag_text: "Oznaka",
- modal_userurl_text: "Ikona",
- modal_removeicon_text: "Ukloni ikonu",
- modal_tabheader1_text: "Korisnik",
- modal_tabheader2_text: "Boja naziva",
- modal_tabheader3_text: "Boja oznaka",
- modal_colorpicker1_text: "Boja naziva",
- modal_colorpicker2_text: "Boja pozadine",
- modal_colorpicker3_text: "Boja oznaka",
- modal_colorpicker4_text: "Boja fonta",
- modal_ignoreurl_text: "URL ignorirati",
- modal_ignoretagcolor_text: "Upotrijebite boju uloga",
- modal_validurl_text: "Vrijedi URL",
- modal_invalidurl_text: "Nevažeći URL",
- btn_cancel_text: "Prekid",
- btn_save_text: "Uštedjeti"
- };
- case "da": //danish
- return {
- context_localusersettings_text: "Lokal brugerindstillinger",
- submenu_usersettings_text: "Skift indstillinger",
- submenu_resetsettings_text: "Nulstil bruger",
- modal_header_text: "Lokal brugerindstillinger",
- modal_username_text: "Lokalt brugernavn",
- modal_usertag_text: "Initialer",
- modal_userurl_text: "Ikon",
- modal_removeicon_text: "Fjern ikon",
- modal_tabheader1_text: "Bruger",
- modal_tabheader2_text: "Navnefarve",
- modal_tabheader3_text: "Etiketfarve",
- modal_colorpicker1_text: "Navnefarve",
- modal_colorpicker2_text: "Baggrundsfarve",
- modal_colorpicker3_text: "Etiketfarve",
- modal_colorpicker4_text: "Skriftfarve",
- modal_ignoreurl_text: "Ignorer URL",
- modal_ignoretagcolor_text: "Brug rollefarve",
- modal_validurl_text: "Gyldig URL",
- modal_invalidurl_text: "Ugyldig URL",
- btn_cancel_text: "Afbryde",
- btn_save_text: "Spare"
- };
- case "de": //german
- return {
- context_localusersettings_text: "Lokale Benutzereinstellungen",
- submenu_usersettings_text: "Einstellungen ändern",
- submenu_resetsettings_text: "Benutzer zurücksetzen",
- modal_header_text: "Lokale Benutzereinstellungen",
- modal_username_text: "Lokaler Benutzername",
- modal_usertag_text: "Etikett",
- modal_userurl_text: "Icon",
- modal_removeicon_text: "Entferne Icon",
- modal_tabheader1_text: "Benutzer",
- modal_tabheader2_text: "Namensfarbe",
- modal_tabheader3_text: "Etikettfarbe",
- modal_colorpicker1_text: "Namensfarbe",
- modal_colorpicker2_text: "Hintergrundfarbe",
- modal_colorpicker3_text: "Etikettfarbe",
- modal_colorpicker4_text: "Schriftfarbe",
- modal_ignoreurl_text: "URL ignorieren",
- modal_ignoretagcolor_text: "Benutze Rollenfarbe",
- modal_validurl_text: "Gültige URL",
- modal_invalidurl_text: "Ungültige URL",
- btn_cancel_text: "Abbrechen",
- btn_save_text: "Speichern"
- };
- case "es": //spanish
- return {
- context_localusersettings_text: "Ajustes local de usuario",
- submenu_usersettings_text: "Cambiar ajustes",
- submenu_resetsettings_text: "Restablecer usuario",
- modal_header_text: "Ajustes local de usuario",
- modal_username_text: "Nombre local de usuario",
- modal_usertag_text: "Etiqueta",
- modal_userurl_text: "Icono",
- modal_removeicon_text: "Eliminar icono",
- modal_tabheader1_text: "Usuario",
- modal_tabheader2_text: "Color del nombre",
- modal_tabheader3_text: "Color de la etiqueta",
- modal_colorpicker1_text: "Color del nombre",
- modal_colorpicker2_text: "Color de fondo",
- modal_colorpicker3_text: "Color de la etiqueta",
- modal_colorpicker4_text: "Color de fuente",
- modal_ignoreurl_text: "Ignorar URL",
- modal_ignoretagcolor_text: "Usar color de rol",
- modal_validurl_text: "URL válida",
- modal_invalidurl_text: "URL inválida",
- btn_cancel_text: "Cancelar",
- btn_save_text: "Guardar"
- };
- case "fr": //french
- return {
- context_localusersettings_text: "Paramètres locale d'utilisateur",
- submenu_usersettings_text: "Modifier les paramètres",
- submenu_resetsettings_text: "Réinitialiser l'utilisateur",
- modal_header_text: "Paramètres locale d'utilisateur",
- modal_username_text: "Nom local d'utilisateur",
- modal_usertag_text: "Étiquette",
- modal_userurl_text: "Icône",
- modal_removeicon_text: "Supprimer l'icône",
- modal_tabheader1_text: "Serveur",
- modal_tabheader2_text: "Couleur du nom",
- modal_tabheader3_text: "Couleur de l'étiquette",
- modal_colorpicker1_text: "Couleur du nom",
- modal_colorpicker2_text: "Couleur de fond",
- modal_colorpicker3_text: "Couleur de l'étiquette",
- modal_colorpicker4_text: "Couleur de la police",
- modal_ignoreurl_text: "Ignorer l'URL",
- modal_ignoretagcolor_text: "Utiliser la couleur de rôle",
- modal_validurl_text: "URL valide",
- modal_invalidurl_text: "URL invalide",
- btn_cancel_text: "Abandonner",
- btn_save_text: "Enregistrer"
- };
- case "it": //italian
- return {
- context_localusersettings_text: "Impostazioni locale utente",
- submenu_usersettings_text: "Cambia impostazioni",
- submenu_resetsettings_text: "Ripristina utente",
- modal_header_text: "Impostazioni locale utente",
- modal_username_text: "Nome locale utente",
- modal_usertag_text: "Etichetta",
- modal_userurl_text: "Icona",
- modal_removeicon_text: "Rimuova l'icona",
- modal_tabheader1_text: "Utente",
- modal_tabheader2_text: "Colore del nome",
- modal_tabheader3_text: "Colore della etichetta",
- modal_colorpicker1_text: "Colore del nome",
- modal_colorpicker2_text: "Colore di sfondo",
- modal_colorpicker3_text: "Colore della etichetta",
- modal_colorpicker4_text: "Colore del carattere",
- modal_ignoreurl_text: "Ignora l'URL",
- modal_ignoretagcolor_text: "Usa il colore del ruolo",
- modal_validurl_text: "URL valido",
- modal_invalidurl_text: "URL non valido",
- btn_cancel_text: "Cancellare",
- btn_save_text: "Salvare"
- };
- case "nl": //dutch
- return {
- context_localusersettings_text: "Lokale gebruikerinstellingen",
- submenu_usersettings_text: "Verandere instellingen",
- submenu_resetsettings_text: "Reset gebruiker",
- modal_header_text: "Lokale gebruikerinstellingen",
- modal_username_text: "Lokale gebruikernaam",
- modal_usertag_text: "Etiket",
- modal_userurl_text: "Icoon",
- modal_removeicon_text: "Verwijder icoon",
- modal_tabheader1_text: "Gebruiker",
- modal_tabheader2_text: "Naamkleur",
- modal_tabheader3_text: "Etiketkleur",
- modal_colorpicker1_text: "Naamkleur",
- modal_colorpicker2_text: "Achtergrondkleur",
- modal_colorpicker3_text: "Etiketkleur",
- modal_colorpicker4_text: "Doopvontkleur",
- modal_ignoreurl_text: "URL negeren",
- modal_ignoretagcolor_text: "Gebruik rolkleur",
- modal_validurl_text: "Geldige URL",
- modal_invalidurl_text: "Ongeldige URL",
- btn_cancel_text: "Afbreken",
- btn_save_text: "Opslaan"
- };
- case "no": //norwegian
- return {
- context_localusersettings_text: "Lokal brukerinnstillinger",
- submenu_usersettings_text: "Endre innstillinger",
- submenu_resetsettings_text: "Tilbakestill bruker",
- modal_header_text: "Lokal brukerinnstillinger",
- modal_username_text: "Lokalt gebruikernavn",
- modal_usertag_text: "Stikkord",
- modal_userurl_text: "Ikon",
- modal_removeicon_text: "Fjern ikon",
- modal_tabheader1_text: "Bruker",
- modal_tabheader2_text: "Navnfarge",
- modal_tabheader3_text: "Stikkordfarge",
- modal_colorpicker1_text: "Navnfarge",
- modal_colorpicker2_text: "Bakgrunnfarge",
- modal_colorpicker3_text: "Stikkordfarge",
- modal_colorpicker4_text: "Skriftfarge",
- modal_ignoreurl_text: "Ignorer URL",
- modal_ignoretagcolor_text: "Bruk rollefarge",
- modal_validurl_text: "Gyldig URL",
- modal_invalidurl_text: "Ugyldig URL",
- btn_cancel_text: "Avbryte",
- btn_save_text: "Lagre"
- };
- case "pl": //polish
- return {
- context_localusersettings_text: "Lokalne ustawienia użytkownika",
- submenu_usersettings_text: "Zmień ustawienia",
- submenu_resetsettings_text: "Resetuj ustawienia",
- modal_header_text: "Lokalne ustawienia użytkownika",
- modal_username_text: "Lokalna nazwa użytkownika",
- modal_usertag_text: "Etykieta",
- modal_userurl_text: "Ikona",
- modal_removeicon_text: "Usuń ikonę",
- modal_tabheader1_text: "Użytkownik",
- modal_tabheader2_text: "Kolor nazwy",
- modal_tabheader3_text: "Kolor etykiety",
- modal_colorpicker1_text: "Kolor nazwy",
- modal_colorpicker2_text: "Kolor tła",
- modal_colorpicker3_text: "Kolor etykiety",
- modal_colorpicker4_text: "Kolor czcionki",
- modal_ignoreurl_text: "Ignoruj URL",
- modal_ignoretagcolor_text: "Użyj kolor roli",
- modal_validurl_text: "Prawidłowe URL",
- modal_invalidurl_text: "Nieprawidłowe URL",
- btn_cancel_text: "Anuluj",
- btn_save_text: "Zapisz"
- };
- case "pt-BR": //portuguese (brazil)
- return {
- context_localusersettings_text: "Configurações local do utilizador",
- submenu_usersettings_text: "Mudar configurações",
- submenu_resetsettings_text: "Redefinir utilizador",
- modal_header_text: "Configurações local do utilizador",
- modal_username_text: "Nome local do utilizador",
- modal_usertag_text: "Etiqueta",
- modal_userurl_text: "Icone",
- modal_removeicon_text: "Remover ícone",
- modal_tabheader1_text: "Utilizador",
- modal_tabheader2_text: "Cor do nome",
- modal_tabheader3_text: "Cor da etiqueta",
- modal_colorpicker1_text: "Cor do nome",
- modal_colorpicker2_text: "Cor do fundo",
- modal_colorpicker3_text: "Cor da etiqueta",
- modal_colorpicker4_text: "Cor da fonte",
- modal_ignoreurl_text: "Ignorar URL",
- modal_ignoretagcolor_text: "Use a cor do papel",
- modal_validurl_text: "URL válido",
- modal_invalidurl_text: "URL inválida",
- btn_cancel_text: "Cancelar",
- btn_save_text: "Salvar"
- };
- case "fi": //finnish
- return {
- context_localusersettings_text: "Paikallinen käyttäjä asetukset",
- submenu_usersettings_text: "Vaihda asetuksia",
- submenu_resetsettings_text: "Nollaa käyttäjä",
- modal_header_text: "Paikallinen käyttäjä asetukset",
- modal_username_text: "Paikallinen käyttäjätunnus",
- modal_usertag_text: "Merkki",
- modal_userurl_text: "Ikonin",
- modal_removeicon_text: "Poista kuvake",
- modal_tabheader1_text: "Käyttäjä",
- modal_tabheader2_text: "Nimiväri",
- modal_tabheader3_text: "Merkkiväri",
- modal_colorpicker1_text: "Nimiväri",
- modal_colorpicker2_text: "Taustaväri",
- modal_colorpicker3_text: "Merkkiväri",
- modal_colorpicker4_text: "Fontinväri",
- modal_ignoreurl_text: "Ohita URL",
- modal_ignoretagcolor_text: "Käytä rooliväriä",
- modal_validurl_text: "Voimassa URL",
- modal_invalidurl_text: "Virheellinen URL",
- btn_cancel_text: "Peruuttaa",
- btn_save_text: "Tallentaa"
- };
- case "sv": //swedish
- return {
- context_localusersettings_text: "Lokal användareinställningar",
- submenu_usersettings_text: "Ändra inställningar",
- submenu_resetsettings_text: "Återställ användare",
- modal_header_text: "Lokal användareinställningar",
- modal_username_text: "Lokalt användarenamn",
- modal_usertag_text: "Märka",
- modal_userurl_text: "Ikon",
- modal_removeicon_text: "Ta bort ikonen",
- modal_tabheader1_text: "Användare",
- modal_tabheader2_text: "Namnfärg",
- modal_tabheader3_text: "Märkafärg",
- modal_colorpicker1_text: "Namnfärg",
- modal_colorpicker2_text: "Bakgrundfärg",
- modal_colorpicker3_text: "Märkafärg",
- modal_colorpicker4_text: "Fontfärg",
- modal_ignoreurl_text: "Ignorera URL",
- modal_ignoretagcolor_text: "Använd rollfärg",
- modal_validurl_text: "Giltig URL",
- modal_invalidurl_text: "Ogiltig URL",
- btn_cancel_text: "Avbryta",
- btn_save_text: "Spara"
- };
- case "tr": //turkish
- return {
- context_localusersettings_text: "Yerel Kullanıcı Ayarları",
- submenu_usersettings_text: "Ayarları Değiştir",
- submenu_resetsettings_text: "Kullanıcı Sıfırla",
- modal_header_text: "Yerel Kullanıcı Ayarları",
- modal_username_text: "Yerel Kullanıcı Isim",
- modal_usertag_text: "Etiket",
- modal_userurl_text: "Simge",
- modal_removeicon_text: "Simge kaldır",
- modal_tabheader1_text: "Kullanıcı",
- modal_tabheader2_text: "Simge rengi",
- modal_tabheader3_text: "Isim rengi",
- modal_colorpicker1_text: "Simge rengi",
- modal_colorpicker2_text: "Arka fon rengi",
- modal_colorpicker3_text: "Etiket rengi",
- modal_colorpicker4_text: "Yazı rengi",
- modal_ignoreurl_text: "URL yoksay",
- modal_ignoretagcolor_text: "Rol rengini kullan",
- modal_validurl_text: "Geçerli URL",
- modal_invalidurl_text: "Geçersiz URL",
- btn_cancel_text: "Iptal",
- btn_save_text: "Kayıt"
- };
- case "cs": //czech
- return {
- context_localusersettings_text: "Místní nastavení uživatel",
- submenu_usersettings_text: "Změnit nastavení",
- submenu_resetsettings_text: "Obnovit uživatel",
- modal_header_text: "Místní nastavení uživatel",
- modal_username_text: "Místní název uživatel",
- modal_usertag_text: "Štítek",
- modal_userurl_text: "Ikony",
- modal_removeicon_text: "Odstranit ikonu",
- modal_tabheader1_text: "Uživatel",
- modal_tabheader2_text: "Barva název",
- modal_tabheader3_text: "Barva štítek",
- modal_colorpicker1_text: "Barva název",
- modal_colorpicker2_text: "Barva pozadí",
- modal_colorpicker3_text: "Barva štítek",
- modal_colorpicker4_text: "Barva fontu",
- modal_ignoreurl_text: "Ignorovat URL",
- modal_ignoretagcolor_text: "Použijte barva role",
- modal_validurl_text: "Platná URL",
- modal_invalidurl_text: "Neplatná URL",
- btn_cancel_text: "Zrušení",
- btn_save_text: "Uložit"
- };
- case "bg": //bulgarian
- return {
- context_localusersettings_text: "Настройки за локални потребител",
- submenu_usersettings_text: "Промяна на настройките",
- submenu_resetsettings_text: "Възстановяване на потребител",
- modal_header_text: "Настройки за локални потребител",
- modal_username_text: "Локално име на потребител",
- modal_usertag_text: "Cвободен край",
- modal_userurl_text: "Икона",
- modal_removeicon_text: "Премахване на иконата",
- modal_tabheader1_text: "Потребител",
- modal_tabheader2_text: "Цвят на име",
- modal_tabheader3_text: "Цвят на свободен край",
- modal_colorpicker1_text: "Цвят на име",
- modal_colorpicker2_text: "Цвят на заден план",
- modal_colorpicker3_text: "Цвят на свободен край",
- modal_colorpicker4_text: "Цвят на шрифта",
- modal_ignoreurl_text: "Игнориране на URL",
- modal_ignoretagcolor_text: "Използвайте цвят на ролите",
- modal_validurl_text: "Валиден URL",
- modal_invalidurl_text: "Невалиден URL",
- btn_cancel_text: "Зъбести",
- btn_save_text: "Cпасяване"
- };
- case "ru": //russian
- return {
- context_localusersettings_text: "Настройки локального пользователь",
- submenu_usersettings_text: "Изменить настройки",
- submenu_resetsettings_text: "Сбросить пользователь",
- modal_header_text: "Настройки локального пользователь",
- modal_username_text: "Имя локального пользователь",
- modal_usertag_text: "Tег",
- modal_userurl_text: "Значок",
- modal_removeicon_text: "Удалить значок",
- modal_tabheader1_text: "Пользователь",
- modal_tabheader2_text: "Цвет имя",
- modal_tabheader3_text: "Цвет тег",
- modal_colorpicker1_text: "Цвет имя",
- modal_colorpicker2_text: "Цвет задний план",
- modal_colorpicker3_text: "Цвет тег",
- modal_colorpicker4_text: "Цвет шрифта",
- modal_ignoreurl_text: "Игнорировать URL",
- modal_ignoretagcolor_text: "Использовать цвет ролей",
- modal_validurl_text: "Действительный URL",
- modal_invalidurl_text: "Неверная URL",
- btn_cancel_text: "Отмена",
- btn_save_text: "Cпасти"
- };
- case "uk": //ukrainian
- return {
- context_localusersettings_text: "Налаштування локального користувач",
- submenu_usersettings_text: "Змінити налаштування",
- submenu_resetsettings_text: "Скидання користувач",
- modal_header_text: "Налаштування локального користувач",
- modal_username_text: "Локальне ім'я користувач",
- modal_usertag_text: "Tег",
- modal_userurl_text: "Іконка",
- modal_removeicon_text: "Видалити піктограму",
- modal_tabheader1_text: "Користувач",
- modal_tabheader2_text: "Колір ім'я",
- modal_tabheader3_text: "Колір тег",
- modal_colorpicker1_text: "Колір ім'я",
- modal_colorpicker2_text: "Колір фон",
- modal_colorpicker3_text: "Колір тег",
- modal_colorpicker4_text: "Колір шрифту",
- modal_ignoreurl_text: "Ігнорувати URL",
- modal_ignoretagcolor_text: "Використовуйте рольовий колір",
- modal_validurl_text: "Дійсна URL",
- modal_invalidurl_text: "Недійсна URL",
- btn_cancel_text: "Скасувати",
- btn_save_text: "Зберегти"
- };
- case "ja": //japanese
- return {
- context_localusersettings_text: "ローカルユーザーー設定",
- submenu_usersettings_text: "設定を変更する",
- submenu_resetsettings_text: "ユーザーーをリセットする",
- modal_header_text: "ローカルユーザーー設定",
- modal_username_text: "ローカルユーザーー名",
- modal_usertag_text: "タグ",
- modal_userurl_text: "アイコン",
- modal_removeicon_text: "アイコンを削除",
- modal_tabheader1_text: "ユーザー",
- modal_tabheader2_text: "名の色",
- modal_tabheader3_text: "タグの色",
- modal_colorpicker1_text: "名の色",
- modal_colorpicker2_text: "バックグラウンドの色",
- modal_colorpicker3_text: "タグの色",
- modal_colorpicker4_text: "フォントの色",
- modal_ignoreurl_text: "URL を無視する",
- modal_ignoretagcolor_text: "ロールカラーを使用する",
- modal_validurl_text: "有効な URL",
- modal_invalidurl_text: "無効な URL",
- btn_cancel_text: "キャンセル",
- btn_save_text: "セーブ"
- };
- case "zh-TW": //chinese (traditional)
- return {
- context_localusersettings_text: "本地用戶設置",
- submenu_usersettings_text: "更改設置",
- submenu_resetsettings_text: "重置用戶",
- modal_header_text: "本地用戶設置",
- modal_username_text: "用戶名稱",
- modal_usertag_text: "標籤",
- modal_userurl_text: "圖標",
- modal_removeicon_text: "刪除圖標",
- modal_tabheader1_text: "用戶",
- modal_tabheader2_text: "名稱顏色",
- modal_tabheader3_text: "標籤顏色",
- modal_colorpicker1_text: "名稱顏色",
- modal_colorpicker2_text: "背景顏色",
- modal_colorpicker3_text: "標籤顏色",
- modal_colorpicker4_text: "字體顏色",
- modal_ignoreurl_text: "忽略 URL",
- modal_ignoretagcolor_text: "使用角色",
- modal_validurl_text: "有效的 URL",
- modal_invalidurl_text: "無效的 URL",
- btn_cancel_text: "取消",
- btn_save_text: "保存"
- };
- case "ko": //korean
- return {
- context_localusersettings_text: "로컬 사용자 설정",
- submenu_usersettings_text: "설정 변경",
- submenu_resetsettings_text: "사용자 재설정",
- modal_header_text: "로컬 사용자 설정",
- modal_username_text: "로컬 사용자 이름",
- modal_usertag_text: "꼬리표",
- modal_userurl_text: "상",
- modal_removeicon_text: "상 삭제",
- modal_tabheader1_text: "사용자",
- modal_tabheader2_text: "이름 색깔",
- modal_tabheader3_text: "꼬리표 색깔",
- modal_colorpicker1_text: "이름 색깔",
- modal_colorpicker2_text: "배경 색깔",
- modal_colorpicker3_text: "꼬리표 색깔",
- modal_colorpicker4_text: "글꼴 색깔",
- modal_ignoreurl_text: "URL 무시",
- modal_ignoretagcolor_text: "역할 색상 사용",
- modal_validurl_text: "유효한 URL",
- modal_invalidurl_text: "잘못된 URL",
- btn_cancel_text: "취소",
- btn_save_text: "저장"
- };
- default: //default: english
- return {
- context_localusersettings_text: "Local Usersettings",
- submenu_usersettings_text: "Change Settings",
- submenu_resetsettings_text: "Reset User",
- modal_header_text: "Local Usersettings",
- modal_username_text: "Local Username",
- modal_usertag_text: "Tag",
- modal_userurl_text: "Icon",
- modal_removeicon_text: "Remove Icon",
- modal_tabheader1_text: "User",
- modal_tabheader2_text: "Namecolor",
- modal_tabheader3_text: "Tagcolor",
- modal_colorpicker1_text: "Namecolor",
- modal_colorpicker2_text: "Backgroundcolor",
- modal_colorpicker3_text: "Tagcolor",
- modal_colorpicker4_text: "Fontcolor",
- modal_ignoreurl_text: "Ignore URL",
- modal_ignoretagcolor_text: "Use Rolecolor",
- modal_validurl_text: "Valid URL",
- modal_invalidurl_text: "Invalid URL",
- btn_cancel_text: "Cancel",
- btn_save_text: "Save"
- };
- }
- }
- }
-};
diff --git a/PluginsV2/EmojiStatistics/README.md b/PluginsV2/EmojiStatistics/README.md
deleted file mode 100644
index e9317c9eca..0000000000
--- a/PluginsV2/EmojiStatistics/README.md
+++ /dev/null
@@ -1,8 +0,0 @@
-# These Plugins are meant only for BDv2, not BD nor BandagedBD. If you got either of those two go to [Plugins](https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/).
-
-## Emoji Statistics - [Download Script](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/EmojiStatistics/index.js) [Download Config](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/EmojiStatistics/config.json)
-
-Adds several options to get more information about emojis and emojiservers.
-
-- You can enable/disable the option to get the name and server of an emoji when you hover over it inside the emojipicker.
-- You can enable/disable the option to add a button in the emojipicker to open an overview of your servers with some information.
diff --git a/PluginsV2/EmojiStatistics/config.json b/PluginsV2/EmojiStatistics/config.json
deleted file mode 100644
index 9cb9154d7e..0000000000
--- a/PluginsV2/EmojiStatistics/config.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "info": {
- "name": "EmojiStatistics",
- "authors": [
- {
- "name": "DevilBro",
- "url": "https://www.paypal.me/MircoWittrien",
- "discord_id": "278543574059057154",
- "github_username": "mwittrien"
- }
- ],
- "version": 1.0,
- "description": "Adds some helpful options to show you more information about emojis and emojiservers. \n\nMy Support Server: http://bit.ly/DevilBrosHaus or https://discordapp.com/invite/Jx3TjNS"
- }
-}
diff --git a/PluginsV2/EmojiStatistics/index.js b/PluginsV2/EmojiStatistics/index.js
deleted file mode 100644
index e447917d70..0000000000
--- a/PluginsV2/EmojiStatistics/index.js
+++ /dev/null
@@ -1,593 +0,0 @@
-module.exports = (Plugin, Api, Vendor) => {
- if (!global.BDFDB || typeof BDFDB != "object") global.BDFDB = {myPlugins:{}, BDv2Api: Api};
-
- return class extends Plugin {
- initConstructor () {
- this.labels = {};
-
- this.patchModules = {
- "EmojiPicker":"componentDidMount"
- };
-
- this.css = `
- .emojistatistics-tooltip,
- .emoji-tooltip {
- z-index: 2002;
- }
-
- .${this.name}-modal .titles {
- height: 20px;
- }
-
- .${this.name}-modal .emojiserver-entry {
- height: 50px;
- padding-top: 5px;
- padding-bottom: 5px;
- }
-
- .${this.name}-modal .emojiserver-entry .modal-emojiserver-icon {
- display: inline-block;
- }
-
- .${this.name}-modal .titles-entry label,
- .${this.name}-modal .emojiserver-entry label {
- color: #b9bbbe;
- display: inline-block;
- flex: 1;
- font-size: 12px;
- font-weight: 600;
- letter-spacing: .5px;
- margin-left: 10px;
- margin-top: 20px;
- overflow: hidden;
- vertical-align: top;
- text-transform: uppercase;
- }
-
- .${this.name}-modal .emojiserver-entry label {
- height: 12px;
- overflow: hidden;
- }
-
- .${this.name}-modal .titles-entry label {
- margin-top: 0px;
- }
- .${this.name}-modal .titles-entry .modal-titlesicon-label {
- margin-left: 0px;
- text-align: center;
- width: 50px;
- }
-
- .${this.name}-modal .titles-entry .modal-titlesname-label,
- .${this.name}-modal .emojiserver-entry .modal-emojiname-label {
- width: 300px;
- }
-
- .${this.name}-modal .titles-entry .modal-sorttitle-label {
- cursor: pointer;
- }
-
- .${this.name}-modal .titles-entry .modal-titlestotal-label,
- .${this.name}-modal .titles-entry .modal-titlesglobal-label,
- .${this.name}-modal .titles-entry .modal-titleslocal-label,
- .${this.name}-modal .titles-entry .modal-titlescopies-label,
- .${this.name}-modal .emojiserver-entry .modal-emojitotal-label,
- .${this.name}-modal .emojiserver-entry .modal-emojiglobal-label,
- .${this.name}-modal .emojiserver-entry .modal-emojilocal-label,
- .${this.name}-modal .emojiserver-entry .modal-emojicopies-label {
- text-align: center;
- width: 82px;
- }
-
- .emojistatistics-button {
- background-image: url("/assets/f24711dae4f6d6b28335e866a93e9d9b.png");
- background-position: -770px -374px;
- background-size: 924px 704px;
- cursor: pointer;
- height: 22px;
- margin-right: 10px;
- width: 22px;
- }`;
-
- this.emojiInformationModalMarkup =
- `
-
-
- `;
-
- this.emojiserverTitlesMarkup =
- `
- REPLACE_modal_titlesicon-label
- REPLACE_modal_titlesname_text
- REPLACE_modal_titlestotal_text
- REPLACE_modal_titlesglobal_text
- REPLACE_modal_titleslocal_text
- REPLACE_modal_titlescopies_text
-
`;
-
- this.emojiserverEntryMarkup =
- `
-
-
modal-emojiname-label
-
modal-emojitotal-label
-
modal-emojiglobal-label
-
modal-emojilocal-label
-
modal-emojicopies-label
-
`;
-
- this.defaults = {
- settings: {
- enableEmojiHovering: {value:true, description:"Show Information about Emojis on hover over an Emoji in the Emojipicker."},
- enableEmojiStatisticsButton: {value:true, description:"Add a Button in the Emojipicker to open the Statistics Overview."}
- },
- amounts: {
- hoverDelay: {value:1000, description:"Tooltip delay in millisec:"}
- }
- };
- }
-
- onStart () {
- if (global.BDFDB && global.BDFDB.myPlugins && typeof global.BDFDB.myPlugins == "object") global.BDFDB.myPlugins[this.name] = this;
- var libraryScript = document.querySelector('head script[src="https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js"]');
- if (!global.BDFDB || typeof BDFDB != "object" || performance.now() - BDFDB.creationTime > 600000) {
- if (libraryScript) libraryScript.remove();
- libraryScript = document.createElement("script");
- libraryScript.setAttribute("type", "text/javascript");
- libraryScript.setAttribute("src", "https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js");
- libraryScript.setAttribute("date", performance.now());
- libraryScript.addEventListener("load", () => {if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();});
- document.head.appendChild(libraryScript);
- }
- else if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();
- this.startTimeout = setTimeout(() => {this.initialize();}, 30000);
- }
-
- initialize () {
- if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
- if (this.started) return true;
- BDFDB.loadMessage(this);
-
- this.GuildEmojis = BDFDB.WebModules.findByProperties("getGuildEmoji", "getDisambiguatedEmojiContext");
-
- BDFDB.WebModules.forceAllUpdates(this);
-
- return true;
- }
- else {
- console.error(`%c[${this.name}]%c`, 'color: #3a71c1; font-weight: 700;', '', 'Fatal Error: Could not load BD functions!');
- return false;
- }
- }
-
- onStop () {
- if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
- BDFDB.removeEles(".emoji-tooltip",".emojistatistics-button");
- BDFDB.unloadMessage(this);
- return true;
- }
- else {
- return false;
- }
- }
-
-
- // begin of own functions
-
- changeLanguageStrings () {
- this.emojiInformationModalMarkup = this.emojiInformationModalMarkup.replace("REPLACE_modal_header_text", this.labels.modal_header_text);
- this.emojiInformationModalMarkup = this.emojiInformationModalMarkup.replace("REPLACE_btn_ok_text", this.labels.btn_ok_text);
- this.emojiInformationModalMarkup = this.emojiInformationModalMarkup.replace("REPLACE_btn_all_text", this.labels.btn_all_text);
-
- this.emojiserverTitlesMarkup = this.emojiserverTitlesMarkup.replace("REPLACE_modal_titlesicon-label", this.labels.modal_titlesicon_text);
- this.emojiserverTitlesMarkup = this.emojiserverTitlesMarkup.replace("REPLACE_modal_titlesname_text", this.labels.modal_titlesname_text);
- this.emojiserverTitlesMarkup = this.emojiserverTitlesMarkup.replace("REPLACE_modal_titlestotal_text", this.labels.modal_titlestotal_text);
- this.emojiserverTitlesMarkup = this.emojiserverTitlesMarkup.replace("REPLACE_modal_titlesglobal_text", this.labels.modal_titlesglobal_text);
- this.emojiserverTitlesMarkup = this.emojiserverTitlesMarkup.replace("REPLACE_modal_titleslocal_text", this.labels.modal_titleslocal_text);
- this.emojiserverTitlesMarkup = this.emojiserverTitlesMarkup.replace("REPLACE_modal_titlescopies_text", this.labels.modal_titlescopies_text);
- }
-
- processEmojiPicker (instance, wrapper) {
- if (!wrapper.querySelector(".emojistatistics-button")) {
- let emojipickerdiversityselector = document.querySelector(BDFDB.dotCN.emojipickerdiversityselector);
- if (!emojipickerdiversityselector) return;
- this.loadEmojiList();
- let settings = BDFDB.getAllData(this, "settings");
- if (settings.enableEmojiStatisticsButton) {
- let emojiStatisticsButton = BDFDB.htmlToElement(`
`);
- emojipickerdiversityselector.parentElement.insertBefore(emojiStatisticsButton, emojipickerdiversityselector);
- emojiStatisticsButton.addEventListener("click", () => {
- instance._reactInternalFiber.return.return.return.return.stateNode.close();
- this.showEmojiInformationModal();
- });
- emojiStatisticsButton.addEventListener("mouseenter", e => {
- BDFDB.createTooltip("Emoji Statistics", emojiStatisticsButton, {type:"top",selector:"emojistatistics-tooltip"});
- });
- }
- if (settings.enableEmojiHovering) {
- BDFDB.addEventListener(this, wrapper, "mouseenter", BDFDB.dotCN.emojipickeremojiitem, e => {
- let data = this.emojiToServerList[e.target.style.getPropertyValue("background-image").replace('url("',"").replace('")',"")];
- if (data) BDFDB.createTooltip(`${BDFDB.encodeToHTML(data.emoji)}\n${BDFDB.encodeToHTML(data.server)}`, e.target, {type:"right",selector:"emoji-tooltip",delay:BDFDB.getData("hoverDelay", this, "amounts")});
- });
- }
- }
- }
-
- loadEmojiList () {
- this.emojiReplicaList = {};
- this.emojiToServerList = {};
- for (let serverObj of BDFDB.readServerList()) {
- for (let emoji of this.GuildEmojis.getGuildEmoji(serverObj.id)) {
- this.emojiToServerList[emoji.url] = {emoji:emoji.allNamesString, server:serverObj.name};
- if (emoji.managed) this.emojiReplicaList[emoji.name] = this.emojiReplicaList[emoji.name] != undefined;
- }
- }
- }
-
- showEmojiInformationModal () {
- var emojiInformationModal = BDFDB.htmlToElement(this.emojiInformationModalMarkup);
-
- let titlescontainer = emojiInformationModal.querySelector(".titles");
- let entriescontainer = emojiInformationModal.querySelector(".entries");
-
- if (!titlescontainer || !entriescontainer) return;
-
- var titleEntry = BDFDB.htmlToElement(this.emojiserverTitlesMarkup);
- titlescontainer.appendChild(titleEntry);
- BDFDB.addChildEventListener(titleEntry, "click", ".modal-sorttitle-label ", e => {
- var oldTitle = e.currentTarget.innerText;
-
- var reverse = oldTitle.indexOf("▼") < 0 ? false : true;
-
- titleEntry.querySelector(".modal-titlesname-label").innerText = this.labels.modal_titlesname_text;
- titleEntry.querySelector(".modal-titlestotal-label").innerText = this.labels.modal_titlestotal_text;
- titleEntry.querySelector(".modal-titlesglobal-label").innerText = this.labels.modal_titlesglobal_text;
- titleEntry.querySelector(".modal-titleslocal-label").innerText = this.labels.modal_titleslocal_text;
- titleEntry.querySelector(".modal-titlescopies-label").innerText = this.labels.modal_titlescopies_text;
-
- var sortKey = "index";
- if (oldTitle.indexOf("▲") < 0) {
- sortKey = e.currentTarget.getAttribute("sortkey");
- var title = this.labels["modal_titles" + sortKey + "_text"];
- e.currentTarget.innerText = oldTitle.indexOf("▼") < 0 ? title + "▼" : title + "▲";
- }
-
- BDFDB.sortArrayByKey(entries, sortKey);
- if (reverse) entries.reverse();
-
- this.updateAllEntries(entriescontainer, entries);
- });
-
- var entries = [], index = 0;
- for (let info of BDFDB.readServerList()) {
- let amountGlobal = 0, amountLocal = 0, amountCopies = 0;
- for (let emoji of this.GuildEmojis.getGuildEmoji(info.id)) {
- if (emoji.managed) {
- amountGlobal++;
- if (this.emojiReplicaList[emoji.name]) amountCopies++;
- }
- else {
- amountLocal++;
- }
- }
- var emojiEntry = BDFDB.htmlToElement(this.emojiserverEntryMarkup);
- emojiEntry.querySelector(".modal-emojiserver-icon").innerHTML = this.createCopyOfServer(info).outerHTML;
- emojiEntry.querySelector(".modal-emojiname-label").innerText = info.name || "";
- emojiEntry.querySelector(".modal-emojitotal-label").innerText = amountGlobal + amountLocal;
- emojiEntry.querySelector(".modal-emojiglobal-label").innerText = amountGlobal;
- emojiEntry.querySelector(".modal-emojilocal-label").innerText = amountLocal;
- emojiEntry.querySelector(".modal-emojicopies-label").innerText = amountCopies;
- entries.push({div:emojiEntry, index:index++, name:info.name || "", total:amountGlobal+amountLocal, global:amountGlobal, local:amountLocal, copies:amountCopies});
- }
-
- BDFDB.appendModal(emojiInformationModal);
-
- this.updateAllEntries(entriescontainer, entries);
- }
-
- updateAllEntries (entriescontainer, entries) {
- BDFDB.removeEles(entriescontainer.childNodes);
- for (let entry of entries) {
- if (entriescontainer.childElementCount) entriescontainer.appendChild(BDFDB.htmlToElement(`
`));
- entriescontainer.appendChild(entry.div);
- }
- }
-
- createCopyOfServer (info) {
- let serverCopy = info.div.cloneNode(true);
- BDFDB.toggleEles(serverCopy, true);
- BDFDB.removeClass(serverCopy, BDFDB.disCN.guildunread, BDFDB.disCN.guildselected);
- return serverCopy;
- }
-
- getSettingsPanel () {
- if (!global.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
- var settings = BDFDB.getAllData(this, "settings");
- var amounts = BDFDB.getAllData(this, "amounts");
- var settingshtml = `
${this.name}
`;
- for (let key in settings) {
- settingshtml += `
`;
- }
- for (let key in amounts) {
- settingshtml += `
`;
- }
- settingshtml += `
`;
-
- let settingspanel = BDFDB.htmlToElement(settingshtml);
-
- BDFDB.initElements(settingspanel, this);
-
- BDFDB.addEventListener(this, settingspanel, "input", ".amountInput", e => {
- var input = parseInt(e.currentTarget.value);
- if (!isNaN(input) && input > -1) BDFDB.saveData(e.currentTarget.getAttribute("option"), input, this, "amounts");
- });
-
- return settingspanel;
- }
-
- setLabelsByLanguage () {
- switch (BDFDB.getDiscordLanguage().id) {
- case "hr": //croatian
- return {
- modal_header_text: "Statistike o emojima",
- modal_titlesicon_text: "Ikona",
- modal_titlesname_text: "Naziv poslužitelja",
- modal_titlestotal_text: "Cjelokupni:",
- modal_titlesglobal_text: "Globalno:",
- modal_titleslocal_text: "Kokalne:",
- modal_titlescopies_text: "Kopije:",
- btn_ok_text: "OK"
- };
- case "da": //danish
- return {
- modal_header_text: "Statistikker af emojis",
- modal_titlesicon_text: "Icon",
- modal_titlesname_text: "Servernavn",
- modal_titlestotal_text: "Total:",
- modal_titlesglobal_text: "Global:",
- modal_titleslocal_text: "Lokal:",
- modal_titlescopies_text: "Copies:",
- btn_ok_text: "OK"
- };
- case "de": //german
- return {
- modal_header_text: "Statistiken über Emojis",
- modal_titlesicon_text: "Icon",
- modal_titlesname_text: "Servername",
- modal_titlestotal_text: "Gesamt:",
- modal_titlesglobal_text: "Global:",
- modal_titleslocal_text: "Lokal:",
- modal_titlescopies_text: "Kopien:",
- btn_ok_text: "OK"
- };
- case "es": //spanish
- return {
- modal_header_text: "Estadísticas de emojis",
- modal_titlesicon_text: "Icono",
- modal_titlesname_text: "Nombre del servidor",
- modal_titlestotal_text: "Total:",
- modal_titlesglobal_text: "Global:",
- modal_titleslocal_text: "Local:",
- modal_titlescopies_text: "Copias:",
- btn_ok_text: "OK"
- };
- case "fr": //french
- return {
- modal_header_text: "Statistiques des emojis",
- modal_titlesicon_text: "Icône",
- modal_titlesname_text: "Nom du serveur",
- modal_titlestotal_text: "Total:",
- modal_titlesglobal_text: "Global:",
- modal_titleslocal_text: "Local:",
- modal_titlescopies_text: "Copies:",
- btn_ok_text: "OK"
- };
- case "it": //italian
- return {
- modal_header_text: "Statistiche di emojis",
- modal_titlesicon_text: "Icona",
- modal_titlesname_text: "Nome del server",
- modal_titlestotal_text: "Totale:",
- modal_titlesglobal_text: "Globale:",
- modal_titleslocal_text: "Locale:",
- modal_titlescopies_text: "Copie:",
- btn_ok_text: "OK"
- };
- case "nl": //dutch
- return {
- modal_header_text: "Statistieken van emojis",
- modal_titlesicon_text: "Icoon",
- modal_titlesname_text: "Servernaam",
- modal_titlestotal_text: "Totaal:",
- modal_titlesglobal_text: "Globaal:",
- modal_titleslocal_text: "Lokaal:",
- modal_titlescopies_text: "Kopieën:",
- btn_ok_text: "OK"
- };
- case "no": //norwegian
- return {
- modal_header_text: "Statistikk av emojis",
- modal_titlesicon_text: "Ikon",
- modal_titlesname_text: "Servernavn",
- modal_titlestotal_text: "Total:",
- modal_titlesglobal_text: "Global:",
- modal_titleslocal_text: "Lokal:",
- modal_titlescopies_text: "Kopier:",
- btn_ok_text: "OK"
- };
- case "pl": //polish
- return {
- modal_header_text: "Statystyki emoji",
- modal_titlesicon_text: "Ikona",
- modal_titlesname_text: "Nazwa",
- modal_titlestotal_text: "Całkowity:",
- modal_titlesglobal_text: "Światowy:",
- modal_titleslocal_text: "Lokalny:",
- modal_titlescopies_text: "Kopie:",
- btn_ok_text: "OK"
- };
- case "pt-BR": //portuguese (brazil)
- return {
- modal_header_text: "Estatísticas de emojis",
- modal_titlesicon_text: "Ícone",
- modal_titlesname_text: "Nome do servidor",
- modal_titlestotal_text: "Total:",
- modal_titlesglobal_text: "Global:",
- modal_titleslocal_text: "Local:",
- modal_titlescopies_text: "Cópias:",
- btn_ok_text: "OK"
- };
- case "fi": //finnish
- return {
- modal_header_text: "Tilastot emojista",
- modal_titlesicon_text: "Ikoni",
- modal_titlesname_text: "Palvelimen nimi",
- modal_titlestotal_text: "Koko:",
- modal_titlesglobal_text: "Globaali:",
- modal_titleslocal_text: "Paikallinen:",
- modal_titlescopies_text: "Kopiot:",
- btn_ok_text: "OK"
- };
- case "sv": //swedish
- return {
- modal_header_text: "Statistik för emojis",
- modal_titlesicon_text: "Ikon",
- modal_titlesname_text: "Servernamn",
- modal_titlestotal_text: "Total:",
- modal_titlesglobal_text: "Global:",
- modal_titleslocal_text: "Lokal:",
- modal_titlescopies_text: "Kopior:",
- btn_ok_text: "OK"
- };
- case "tr": //turkish
- return {
- modal_header_text: "Emojis istatistikleri",
- modal_titlesicon_text: "Icon",
- modal_titlesname_text: "Sunucuadı",
- modal_titlestotal_text: "Toplam:",
- modal_titlesglobal_text: "Global:",
- modal_titleslocal_text: "Yerel:",
- modal_titlescopies_text: "Kopya:",
- btn_ok_text: "Okey"
- };
- case "cs": //czech
- return {
- modal_header_text: "Statistiky emojis",
- modal_titlesicon_text: "Ikona",
- modal_titlesname_text: "Název serveru",
- modal_titlestotal_text: "Celkový:",
- modal_titlesglobal_text: "Globální:",
- modal_titleslocal_text: "Místní:",
- modal_titlescopies_text: "Kopie:",
- btn_ok_text: "OK"
- };
- case "bg": //bulgarian
- return {
- modal_header_text: "Статистика на емотис",
- modal_titlesicon_text: "Икона",
- modal_titlesname_text: "Име на сървъра",
- modal_titlestotal_text: "Oбщо:",
- modal_titlesglobal_text: "Cветовен:",
- modal_titleslocal_text: "Mестен:",
- modal_titlescopies_text: "Копия:",
- btn_ok_text: "Добре"
- };
- case "ru": //russian
- return {
- modal_header_text: "Статистика emojis",
- modal_titlesicon_text: "Значок",
- modal_titlesname_text: "Имя сервера",
- modal_titlestotal_text: "Всего:",
- modal_titlesglobal_text: "Mировой:",
- modal_titleslocal_text: "Местный:",
- modal_titlescopies_text: "Копии:",
- btn_ok_text: "ОК"
- };
- case "uk": //ukrainian
- return {
- modal_header_text: "Статистика емідій",
- modal_titlesicon_text: "Ікона",
- modal_titlesname_text: "Ім'я сервера",
- modal_titlestotal_text: "Всього:",
- modal_titlesglobal_text: "Cвітовий:",
- modal_titleslocal_text: "Місцевий:",
- modal_titlescopies_text: "Копії:",
- btn_ok_text: "Добре"
- };
- case "ja": //japanese
- return {
- modal_header_text: "エモジスの統計",
- modal_titlesicon_text: "アイコン",
- modal_titlesname_text: "サーバーの名前",
- modal_titlestotal_text: "合計:",
- modal_titlesglobal_text: "グローバル:",
- modal_titleslocal_text: "地元:",
- modal_titlescopies_text: "コピー:",
- btn_ok_text: "はい"
- };
- case "zh-TW": //chinese (traditional)
- return {
- modal_header_text: "表情統計",
- modal_titlesicon_text: "圖標",
- modal_titlesname_text: "服務器名稱",
- modal_titlestotal_text: "總:",
- modal_titlesglobal_text: "全球:",
- modal_titleslocal_text: "本地:",
- modal_titlescopies_text: "副本:",
- btn_ok_text: "好"
- };
- case "ko": //korean
- return {
- modal_header_text: "그림 이모티콘의 통계",
- modal_titlesicon_text: "상",
- modal_titlesname_text: "서버 이름",
- modal_titlestotal_text: "합계:",
- modal_titlesglobal_text: "글로벌:",
- modal_titleslocal_text: "지방의:",
- modal_titlescopies_text: "사본:",
- btn_ok_text: "승인"
- };
- default: //default: english
- return {
- modal_header_text: "Statistics of emojis",
- modal_titlesicon_text: "Icon",
- modal_titlesname_text: "Servername",
- modal_titlestotal_text: "Total:",
- modal_titlesglobal_text: "Global:",
- modal_titleslocal_text: "Local:",
- modal_titlescopies_text: "Copies:",
- btn_ok_text: "OK"
- };
- }
- }
- }
-};
diff --git a/PluginsV2/ForceImagePreviews/README.md b/PluginsV2/ForceImagePreviews/README.md
deleted file mode 100644
index ce0fc41f0a..0000000000
--- a/PluginsV2/ForceImagePreviews/README.md
+++ /dev/null
@@ -1,5 +0,0 @@
-# These Plugins are meant only for BDv2, not BD nor BandagedBD. If you got either of those two go to [Plugins](https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/).
-
-## Force Image Previews - [Download Script](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/ForceImagePreviews/index.js) [Download Config](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/ForceImagePreviews/config.json)
-
-Forces embedded Image Previews, if Discord doesn't do it itself.
diff --git a/PluginsV2/ForceImagePreviews/config.json b/PluginsV2/ForceImagePreviews/config.json
deleted file mode 100644
index c76b1ca989..0000000000
--- a/PluginsV2/ForceImagePreviews/config.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "info": {
- "name": "ForceImagePreviews",
- "authors": [
- {
- "name": "DevilBro",
- "url": "https://www.paypal.me/MircoWittrien",
- "discord_id": "278543574059057154",
- "github_username": "mwittrien"
- }
- ],
- "version": 1.0,
- "description": "Forces embedded Image Previews, if Discord doesn't do it itself. \n\nMy Support Server: http://bit.ly/DevilBrosHaus or https://discordapp.com/invite/Jx3TjNS"
- }
-}
diff --git a/PluginsV2/ForceImagePreviews/index.js b/PluginsV2/ForceImagePreviews/index.js
deleted file mode 100644
index 1c8e520995..0000000000
--- a/PluginsV2/ForceImagePreviews/index.js
+++ /dev/null
@@ -1,137 +0,0 @@
-module.exports = (Plugin, Api, Vendor) => {
- if (!global.BDFDB || typeof BDFDB != "object") global.BDFDB = {myPlugins:{}, BDv2Api: Api};
-
- return class extends Plugin {
- initConstructor () {
- this.patchModules = {
- "Message":"componentDidMount"
- };
- }
-
- onStart () {
- if (global.BDFDB && global.BDFDB.myPlugins && typeof global.BDFDB.myPlugins == "object") global.BDFDB.myPlugins[this.name] = this;
- var libraryScript = document.querySelector('head script[src="https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js"]');
- if (!global.BDFDB || typeof BDFDB != "object" || performance.now() - BDFDB.creationTime > 600000) {
- if (libraryScript) libraryScript.remove();
- libraryScript = document.createElement("script");
- libraryScript.setAttribute("type", "text/javascript");
- libraryScript.setAttribute("src", "https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js");
- libraryScript.setAttribute("date", performance.now());
- libraryScript.addEventListener("load", () => {if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();});
- document.head.appendChild(libraryScript);
- }
- else if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();
- this.startTimeout = setTimeout(() => {this.initialize();}, 30000);
- }
-
- initialize () {
- if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
- if (this.started) return true;
- BDFDB.loadMessage(this);
-
- BDFDB.WebModules.forceAllUpdates(this);
-
- return true;
- }
- else {
- console.error(`%c[${this.name}]%c`, 'color: #3a71c1; font-weight: 700;', '', 'Fatal Error: Could not load BD functions!');
- return false;
- }
- }
-
- onStop () {
- if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
- BDFDB.removeEles(".FIP-embed");
-
- BDFDB.unloadMessage(this);
- return true;
- }
- else {
- return false;
- }
- }
-
-
- // begin of own functions
-
- processMessage (instance, wrapper) {
- if (instance.props && instance.props.message) {
- let accessory = wrapper.querySelector(BDFDB.dotCN.messageaccessory);
- if (accessory) {
- let links = [];
- for (let word of instance.props.message.content.split(/\n|\s|\r|\t|\0/g)) {
- if (word.indexOf("https://") > -1 || word.indexOf("http://") > -1) {
- if (word.indexOf("<") == 0 && word.indexOf(">") == word.length-1) links.push({src:word.slice(1,-1),embedded:false});
- else if (!accessory.querySelector(`${BDFDB.dotCN.embedimage}[href="${this.parseSrc(word)}"]`) && !accessory.querySelector(`${BDFDB.dotCN.embedtitlelink}[href="${this.parseSrc(word)}"]`)) {
- links.push({src:word,embedded:false});
- }
- else links.push({src:word,embedded:true});
- }
- }
- if (links.length > 0) this.addItemToAccessory(null, links, accessory);
- }
- }
- }
-
- addItemToAccessory (previmage, links, accessory) {
- let item = links.shift();
- if (!item) return;
- else if (item.embedded) this.addItemToAccessory(item, links, accessory);
- else {
- let itemsrc = this.parseSrc(item.src);
- require("request")(itemsrc, (error, response, result) => {
- if (response && response.headers["content-type"] && response.headers["content-type"].indexOf("image") > -1) {
- let imagethrowaway = document.createElement("img");
- imagethrowaway.src = itemsrc;
- imagethrowaway.onload = () => {
- let width = imagethrowaway.naturalWidth > 400 ? 400 : imagethrowaway.naturalWidth;
- let height = Math.round(width*(imagethrowaway.naturalHeight/imagethrowaway.naturalWidth));
- if (height > 300) {
- width = Math.round(width*(300/height));
- height = 300;
- }
- let checkedsrc = itemsrc.indexOf("imgur.com/") > -1 ? ("imgur.com/" + itemsrc.split("/")[3].split(".")[0]) : itemsrc;
- if (!accessory.querySelector(`${BDFDB.dotCN.embedimage}[href*="${checkedsrc}"]`)) {
- let embed = BDFDB.htmlToElement(`
`);
- this.insertEmbed(embed, previmage, links, accessory);
- }
- this.addItemToAccessory(item, links, accessory);
- };
- }
- else if (response && response.headers["server"] && response.headers["server"].toLowerCase().indexOf("youtube") > -1 && result.indexOf("yt-user-info") > -1) {
- if (!accessory.querySelector(`${BDFDB.dotCN.embedtitlelink}[href="${itemsrc}"]`)) {
- result = result.replace(new RegExp("[\\r|\\n|\\t]|[\\s]{2,}", "g"), "");
- let width = 400;
- let height = Math.round(width*(result.split('
`);
- BDFDB.addChildEventListener(embed, "click", BDFDB.dotCN.iconplay, () => {
- let videowrapper = embed.querySelector(BDFDB.dotCN.embedvideo);
- BDFDB.removeEles(videowrapper.childNodes);
- videowrapper.appendChild(BDFDB.htmlToElement(`
`));
- });
- this.insertEmbed(embed, previmage, links, accessory);
- }
- this.addItemToAccessory(item, links, accessory);
- }
- else this.addItemToAccessory(item, links, accessory);
- });
- }
- }
-
- insertEmbed (embed, previmage, links, accessory) {
- let prev = accessory.querySelector(`${BDFDB.dotCNS.embed + BDFDB.dotCN.embedimage}[href="${previmage ? this.parseSrc(previmage.src) : void 0}"]`);
- let next = accessory.querySelector(`${BDFDB.dotCNS.embed + BDFDB.dotCN.embedimage}[href="${links[0] ? this.parseSrc(links[0].src) : void 0}"]`);
- prev = prev ? prev : accessory.querySelector(`${BDFDB.dotCNS.embed + BDFDB.dotCN.embedtitlelink}[href="${previmage ? this.parseSrc(previmage.src) : void 0}"]`);
- next = next ? next : accessory.querySelector(`${BDFDB.dotCNS.embed + BDFDB.dotCN.embedtitlelink}[href="${links[0] ? this.parseSrc(links[0].src) : void 0}"]`);
- let isempty = accessory.childElementCount == 0;
- if (BDFDB.containsClass(embed.firstElementChild, BDFDB.disCN.embedimage)) embed.style.setProperty("pointer-events", "none", "important");
- accessory.insertBefore(embed, prev ? prev.nextSibling : next);
- let scroller = document.querySelector(BDFDB.dotCNS.chat + BDFDB.dotCN.messages);
- if (scroller) scroller.scrollTop += (BDFDB.getRects(embed).height + (isempty ? 15 : 0));
- }
-
- parseSrc (src) {
- return src.replace(/"/g, "");
- }
- }
-};
diff --git a/PluginsV2/FriendNotifications/README.md b/PluginsV2/FriendNotifications/README.md
deleted file mode 100644
index aa167e3733..0000000000
--- a/PluginsV2/FriendNotifications/README.md
+++ /dev/null
@@ -1,5 +0,0 @@
-# These Plugins are meant only for BDv2, not BD nor BandagedBD. If you got either of those two go to [Plugins](https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/).
-
-## Friend Notifications - [Download Script](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/FriendNotifications/index.js) [Download Config](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/FriendNotifications/config.json)
-
-Notifies you when a friend either logs in or out. Click the Online Friend-Counter to display a timelog of the current session.
diff --git a/PluginsV2/FriendNotifications/config.json b/PluginsV2/FriendNotifications/config.json
deleted file mode 100644
index cc2264f8db..0000000000
--- a/PluginsV2/FriendNotifications/config.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "info": {
- "name": "FriendNotifications",
- "authors": [
- {
- "name": "DevilBro",
- "url": "https://www.paypal.me/MircoWittrien",
- "discord_id": "278543574059057154",
- "github_username": "mwittrien"
- }
- ],
- "version": 1.0,
- "description": "Notifies you when a friend either logs in or out. Click the Online Friend-Counter to display a timelog of the current session. \n\nMy Support Server: http://bit.ly/DevilBrosHaus or https://discordapp.com/invite/Jx3TjNS"
- }
-}
diff --git a/PluginsV2/FriendNotifications/index.js b/PluginsV2/FriendNotifications/index.js
deleted file mode 100644
index eab9dd8252..0000000000
--- a/PluginsV2/FriendNotifications/index.js
+++ /dev/null
@@ -1,349 +0,0 @@
-module.exports = (Plugin, Api, Vendor) => {
- if (!global.BDFDB || typeof BDFDB != "object") global.BDFDB = {myPlugins:{}, BDv2Api: Api};
-
- return class extends Plugin {
- initConstructor () {
- this.patchModules = {
- "FluxContainer(FriendsOnline)":["componentDidMount","componentDidUpdate"]
- };
-
- this.friendsOnlineList = {};
-
- this.timeLog = [];
-
- this.timeLogModalMarkup =
- `
-
-
- `;
-
- this.logEntryMarkup =
- `
`;
-
- this.css = `
- ${BDFDB.dotCN.guilds} > ${BDFDB.dotCN.friendsonline} {
- cursor: pointer;
- }
- .${this.name}-modal .log-time {
- width: 110px;
- }
- .${this.name}-modal .log-avatar {
- width: 35px;
- height: 35px;
- background-size: cover;
- background-position: center;
- border-radius: 50%;
- }
- .${this.name}-settings .avatar-list {
- display: flex;
- align-items: center;
- flex-wrap: wrap;
- }
- .${this.name}-settings .type-toast, .${this.name}-settings .type-desktop {
- border-radius: 3px;
- padding: 0 3px;
- }
- .${this.name}-settings .type-toast {
- background-color: #7289DA;
- }
- .${this.name}-settings .type-desktop {
- background-color: #43B581;
- }
- .${this.name}-settings .settings-avatar.desktop {
- border-color: #43B581;
- }
- .${this.name}-settings .settings-avatar {
- margin: 5px;
- width: 50px;
- height: 50px;
- background-size: cover;
- background-position: center;
- border: 5px solid #7289DA;
- border-radius: 50%;
- box-sizing: border-box;
- cursor: pointer;
- }
- .${this.name}-settings .settings-avatar.desktop {
- border-color: #43B581;
- }
- .${this.name}-settings .settings-avatar.disabled {
- border-color: #36393F;
- filter: grayscale(100%) brightness(50%);
- }`;
-
- this.defaults = {
- settings: {
- muteOnDND: {value:false, description:"Do not notify me when I am DnD:"},
- onlyOnOnline: {value:false, description:"Only notify me when a User logs in:"},
- openOnClick: {value:false, description:"Open the DM when you click a Notification:"}
- },
- notificationsounds: {
- toastonline: {value:{url:null,song:null,mute:false}},
- toastoffline: {value:{url:null,song:null,mute:false}},
- desktoponline: {value:{url:null,song:null,mute:false}},
- desktopoffline: {value:{url:null,song:null,mute:false}}
- }
- };
- }
-
- onStart () {
- if (global.BDFDB && global.BDFDB.myPlugins && typeof global.BDFDB.myPlugins == "object") global.BDFDB.myPlugins[this.name] = this;
- var libraryScript = document.querySelector('head script[src="https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js"]');
- if (!global.BDFDB || typeof BDFDB != "object" || performance.now() - BDFDB.creationTime > 600000) {
- if (libraryScript) libraryScript.remove();
- libraryScript = document.createElement("script");
- libraryScript.setAttribute("type", "text/javascript");
- libraryScript.setAttribute("src", "https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js");
- libraryScript.setAttribute("date", performance.now());
- libraryScript.addEventListener("load", () => {if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();});
- document.head.appendChild(libraryScript);
- }
- else if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();
- this.startTimeout = setTimeout(() => {this.initialize();}, 30000);
- }
-
- initialize () {
- if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
- if (this.started) return true;
- BDFDB.loadMessage(this);
-
- this.FriendUtils = BDFDB.WebModules.findByProperties("getFriendIDs", "getRelationships");
- this.ChannelUtils = BDFDB.WebModules.findByProperties("getDMFromUserId");
- this.ChannelSwitchUtils = BDFDB.WebModules.findByProperties("selectPrivateChannel");
- this.PrivateChannelUtils = BDFDB.WebModules.findByProperties("openPrivateChannel");
- this.UserMetaStore = BDFDB.WebModules.findByProperties("getStatus", "getOnlineFriendCount");
- this.UserUtils = BDFDB.WebModules.findByProperties("getUsers");
-
- for (let id of this.FriendUtils.getFriendIDs()) {
- this.friendsOnlineList[id] = this.UserMetaStore.getStatus(id) != "offline";
- }
-
- BDFDB.WebModules.forceAllUpdates(this);
-
- return true;
- }
- else {
- console.error(`%c[${this.name}]%c`, 'color: #3a71c1; font-weight: 700;', '', 'Fatal Error: Could not load BD functions!');
- return false;
- }
- }
-
- onStop () {
- if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
- BDFDB.unloadMessage(this);
- return true;
- }
- else {
- return false;
- }
- }
-
-
- // begin of own functions
-
- saveAudio (settingspanel, option) {
- let successSavedAudio = (parsedurl, parseddata) => {
- if (parsedurl && parseddata) BDFDB.showToast(`Sound was saved successfully.`, {type:"success"});
- let notificationsound = BDFDB.getData(option, this, "notificationsounds");
- notificationsound.url = parsedurl;
- notificationsound.song = parseddata;
- BDFDB.saveData(option, notificationsound, this, "notificationsounds");
- };
-
- let url = settingspanel.querySelector(`.songInput[option="${option}"]`).value;
- if (url.length == 0) {
- BDFDB.showToast(`Sound file was removed.`, {type:"warn"});
- successSavedAudio(url, url);
- }
- else if (url.indexOf("http") == 0) {
- require("request")(url, (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)) {
- successSavedAudio(url, url);
- return;
- }
- }
- BDFDB.showToast("Use a valid direct link to a video or audio source. They usually end on something like .mp3, .mp4 or .wav.", {type:"danger"});
- });
- }
- else {
- require("fs").readFile(url, (error, response) => {
- if (error) BDFDB.showToast("Could not fetch file. Please make sure the file exists.", {type:"danger"});
- else successSavedAudio(url, `data:audio/mpeg;base64,${response.toString("base64")}`);
- });
- }
- }
-
- processFluxContainerFriendsOnline (instance, wrapper) {
- BDFDB.addEventListener(this, wrapper, "mouseenter", () => {BDFDB.createTooltip("Timelog", wrapper, {type:"right"});});
- BDFDB.addEventListener(this, wrapper, "click", () => {this.showTimeLog();});
-
- let settings = BDFDB.getAllData(this, "settings");
- for (let id of this.FriendUtils.getFriendIDs()) {
- let online = this.UserMetaStore.getStatus(id) != "offline";
- let user = this.UserUtils.getUser(id);
- if (user && this.friendsOnlineList[id] != online && !BDFDB.loadData(id, this, "disabled")) {
- this.timeLog.push({user, online, time: new Date()});
- if (!(settings.onlyOnOnline && !online) && !(settings.muteOnDND && BDFDB.getUserStatus() == "dnd")) {
- let data = BDFDB.loadData(user.id, "EditUsers", "users") || {};
- let string = `${BDFDB.encodeToHTML(data.name ? data.name : user.username)} is ${online ? "online" : "offline"}.`;
- let avatar = data.removeIcon ? "" : (data.url ? data.url : BDFDB.getUserAvatar(user.id));
- let openChannel = () => {
- if (settings.openOnClick) {
- let DMid = this.ChannelUtils.getDMFromUserId(user.id)
- if (DMid) this.ChannelSwitchUtils.selectPrivateChannel(DMid);
- else this.PrivateChannelUtils.openPrivateChannel(BDFDB.myData.id, user.id);
- require("electron").remote.getCurrentWindow().maximize();
- }
- };
- if (!BDFDB.loadData(id, this, "desktop")) {
- let toast = BDFDB.showToast(`
`, {html:true, timeout:5000, type:(online ? "success" : null), icon:false, selector:`friendnotifications-${online ? "online" : "offline"}-toast`});
- toast.addEventListener("click", openChannel);
- let notificationsound = BDFDB.getData(online ? "toastonline" : "toastoffline", this, "notificationsounds");
- if (!notificationsound.mute && notificationsound.song) {
- let audio = new Audio();
- audio.src = notificationsound.song;
- audio.play();
- }
- }
- else {
- let notificationsound = BDFDB.getData(online ? "desktoponline" : "desktopoffline", this, "notificationsounds");
- BDFDB.showDesktopNotification(string, {icon:avatar, timeout:5000, click:openChannel, silent:notificationsound.mute, sound:notificationsound.song});
- }
- }
- }
- this.friendsOnlineList[id] = online;
- }
- }
-
- showTimeLog () {
- let timeLogModal = BDFDB.htmlToElement(this.timeLogModalMarkup);
- let container = timeLogModal.querySelector(".entries");
- if (!container) return;
- let logs = this.timeLog.slice(0).reverse();
- for (let log of logs) {
- if (container.childElementCount) container.appendChild(BDFDB.htmlToElement(`
`));
- let data = BDFDB.loadData(log.user.id, "EditUsers", "users") || {};
- let entry = BDFDB.htmlToElement(this.logEntryMarkup);
- entry.querySelector(".log-time").innerText = `[${log.time.toLocaleTimeString()}]`;
- entry.querySelector(".log-avatar").style.setProperty("background-image", `url(${data.removeIcon ? "" : (data.url ? data.url : BDFDB.getUserAvatar(log.user.id))})`);
- entry.querySelector(".log-description").innerText = `${data.name || log.user.username} is ${log.online ? "online" : "offline"}.`;
- container.appendChild(entry)
- }
- BDFDB.appendModal(timeLogModal);
- }
-
- getSettingsPanel () {
- if (!global.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
- let settings = BDFDB.getAllData(this, "settings");
- let notificationsounds = BDFDB.getAllData(this, "notificationsounds");
- let desktop = BDFDB.loadAllData(this, "desktop");
- let disabled = BDFDB.loadAllData(this, "disabled");
- let settingshtml = `
${this.name}
`;
- for (let key in settings) {
- settingshtml += `
`;
- }
- for (let key in notificationsounds) {
- if (key.indexOf("desktop") == -1 || "Notification" in window) settingshtml += `
`;
- }
- settingshtml += `
Click on a Icon to toggle Toast Notifications for that User: `;
- if ("Notification" in window) settingshtml += `
Rightclick on a Icon to toggle Desktop Notifications for that User: `;
- settingshtml += `
`;
- for (let id of this.FriendUtils.getFriendIDs()) {
- let user = this.UserUtils.getUser(id);
- if (user) {
- let data = BDFDB.loadData(user.id, "EditUsers", "users") || {};
- settingshtml += `
`;
- }
- }
- settingshtml += `
`;
- settingshtml += `
Batch set Users: Disable
Toast
${"Notification" in window ? `
Desktop
` : ``}
`;
- settingshtml += `
`;
-
- let settingspanel = BDFDB.htmlToElement(settingshtml);
-
- BDFDB.initElements(settingspanel, this);
-
- BDFDB.addEventListener(this, settingspanel, "click", ".btn-savesong", e => {this.saveAudio(settingspanel, e.currentTarget.getAttribute("option"));});
- BDFDB.addEventListener(this, settingspanel, "click", ".mute-checkbox", e => {
- let option = e.currentTarget.getAttribute("option");
- let notificationsound = BDFDB.getData(option, this, "notificationsounds");
- notificationsound.mute = e.currentTarget.checked;
- BDFDB.saveData(option, notificationsound, this, "notificationsounds");
- });
- BDFDB.addEventListener(this, settingspanel, "mouseenter", ".settings-avatar", e => {
- let user = this.UserUtils.getUser(e.currentTarget.getAttribute("user-id"));
- let data = BDFDB.loadData(user.id, "EditUsers", "users") || {};
- BDFDB.createTooltip(data.name ? data.name : user.username, e.currentTarget, {type:"top"});
- });
- BDFDB.addEventListener(this, settingspanel, "contextmenu", ".settings-avatar", e => {
- if (!("Notification" in window)) return;
- let desktopoff = !BDFDB.containsClass(e.currentTarget, "desktop");
- let id = e.currentTarget.getAttribute("user-id");
- BDFDB.removeClass(e.currentTarget, "disabled");
- BDFDB.toggleClass(e.currentTarget, "desktop", desktopoff);
- BDFDB.saveData(id, desktopoff, this, "desktop");
- BDFDB.removeData(id, this, "disabled");
- });
- BDFDB.addEventListener(this, settingspanel, "click", ".settings-avatar", e => {
- let disableoff = !BDFDB.containsClass(e.currentTarget, "disabled");
- let id = e.currentTarget.getAttribute("user-id");
- BDFDB.removeClass(e.currentTarget, "desktop");
- BDFDB.toggleClass(e.currentTarget, "disabled", disableoff);
- BDFDB.saveData(id, disableoff, this, "disabled");
- BDFDB.removeData(id, this, "desktop");
- });
- BDFDB.addEventListener(this, settingspanel, "click", ".disable-all, .toast-all, .desktop-all", e => {
- let disableon = e.currentTarget.getAttribute("do-disable");
- let desktopon = e.currentTarget.getAttribute("do-desktop");
- let disabledata = BDFDB.loadAllData(this, "disabled");
- let desktopdata = BDFDB.loadAllData(this, "desktop");
- settingspanel.querySelectorAll(".settings-avatar").forEach(avatar => {
- let id = avatar.getAttribute("user-id");
- BDFDB.toggleClass(avatar, "disabled", disableon);
- BDFDB.toggleClass(avatar, "desktop", desktopon);
- disableon ? disabledata[id] = true : delete disabledata[id];
- desktopon ? desktopdata[id] = true : delete desktopdata[id];
- });
- BDFDB.saveAllData(disabledata, this, "disabled");
- BDFDB.saveAllData(desktopdata, this, "desktop");
- });
-
- return settingspanel;
- }
- }
-};
diff --git a/PluginsV2/GoogleSearchReplace/README.md b/PluginsV2/GoogleSearchReplace/README.md
deleted file mode 100644
index f3a66108e8..0000000000
--- a/PluginsV2/GoogleSearchReplace/README.md
+++ /dev/null
@@ -1,5 +0,0 @@
-# These Plugins are meant only for BDv2, not BD nor BandagedBD. If you got either of those two go to [Plugins](https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/).
-
-## Google Search Replace - [Download Script](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/GoogleSearchReplace/index.js) [Download Config](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/GoogleSearchReplace/config.json)
-
-Replaces the default Google Text Search with a selection menu of several search engines.
diff --git a/PluginsV2/GoogleSearchReplace/config.json b/PluginsV2/GoogleSearchReplace/config.json
deleted file mode 100644
index 80eef79c15..0000000000
--- a/PluginsV2/GoogleSearchReplace/config.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "info": {
- "name": "GoogleSearchReplace",
- "authors": [
- {
- "name": "DevilBro",
- "url": "https://www.paypal.me/MircoWittrien",
- "discord_id": "278543574059057154",
- "github_username": "mwittrien"
- }
- ],
- "version": 1.0,
- "description": "Replaces the default Google Text Search with a selection menu of several search engines. \n\nMy Support Server: http://bit.ly/DevilBrosHaus or https://discordapp.com/invite/Jx3TjNS"
- }
-}
diff --git a/PluginsV2/GoogleSearchReplace/index.js b/PluginsV2/GoogleSearchReplace/index.js
deleted file mode 100644
index ba99085373..0000000000
--- a/PluginsV2/GoogleSearchReplace/index.js
+++ /dev/null
@@ -1,261 +0,0 @@
-module.exports = (Plugin, Api, Vendor) => {
- if (!global.BDFDB || typeof BDFDB != "object") global.BDFDB = {myPlugins:{}, BDv2Api: Api};
-
- return class extends Plugin {
- initConstructor () {
- this.labels = {};
-
- this.textUrlReplaceString = "DEVILBRO_BD_GOOGLESEARCHREPLACE_REPLACE_TEXTURL";
-
- this.defaults = {
- engines: {
- _all: {value:true, name:BDFDB.getLibraryStrings().btn_all_text, url:null},
- Ask: {value:true, name:"Ask", url:"https://ask.com/web?q=" + this.textUrlReplaceString},
- Bing: {value:true, name:"Bing", url:"https://www.bing.com/search?q=" + this.textUrlReplaceString},
- DogPile: {value:true, name:"DogPile", url:"http://www.dogpile.com/search/web?q=" + this.textUrlReplaceString},
- DuckDuckGo: {value:true, name:"DuckDuckGo", url:"https://duckduckgo.com/?q=" + this.textUrlReplaceString},
- Google: {value:true, name:"Google", url:"https://www.google.com/search?q=" + this.textUrlReplaceString},
- GoogleScholar: {value:true, name:"Google Scholar", url:"https://scholar.google.com/scholar?q=" + this.textUrlReplaceString},
- Quora: {value:true, name:"Quora", url:"https://www.quora.com/search?q=" + this.textUrlReplaceString},
- Qwant: {value:true, name:"Qwant", url:"https://www.qwant.com/?t=all&q=" + this.textUrlReplaceString},
- UrbanDictionary: {value:true, name:"Urban Dictionary", url:"https://www.urbandictionary.com/define.php?term=" + this.textUrlReplaceString},
- Searx: {value:true, name:"Searx", url:"https://searx.me/?q=" + this.textUrlReplaceString},
- WolframAlpha: {value:true, name:"Wolfram Alpha", url:"https://www.wolframalpha.com/input/?i=" + this.textUrlReplaceString},
- Yandex: {value:true, name:"Yandex", url:"https://yandex.com/search/?text=" + this.textUrlReplaceString},
- Yahoo: {value:true, name:"Yahoo", url:"https://search.yahoo.com/search?p=" + this.textUrlReplaceString},
- YouTube: {value:true, name:"YouTube", url:"https://www.youtube.com/results?q=" + this.textUrlReplaceString}
- }
- };
-
- this.messageContextEntryMarkup =
- ``;
-
- this.messageContextSubMenuMarkup =
- ``;
- }
-
- onStart () {
- if (global.BDFDB && global.BDFDB.myPlugins && typeof global.BDFDB.myPlugins == "object") global.BDFDB.myPlugins[this.name] = this;
- var libraryScript = document.querySelector('head script[src="https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js"]');
- if (!global.BDFDB || typeof BDFDB != "object" || performance.now() - BDFDB.creationTime > 600000) {
- if (libraryScript) libraryScript.remove();
- libraryScript = document.createElement("script");
- libraryScript.setAttribute("type", "text/javascript");
- libraryScript.setAttribute("src", "https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js");
- libraryScript.setAttribute("date", performance.now());
- libraryScript.addEventListener("load", () => {if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();});
- document.head.appendChild(libraryScript);
- }
- else if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();
- this.startTimeout = setTimeout(() => {this.initialize();}, 30000);
- }
-
- initialize () {
- if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
- if (this.started) return true;
- BDFDB.loadMessage(this);
-
- return true;
- }
- else {
- console.error(`%c[${this.name}]%c`, 'color: #3a71c1; font-weight: 700;', '', 'Fatal Error: Could not load BD functions!');
- return false;
- }
- }
-
- onStop () {
- if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
- BDFDB.unloadMessage(this);
- return true;
- }
- else {
- return false;
- }
- }
-
- // begin of own functions
-
- changeLanguageStrings () {
- this.messageContextEntryMarkup = this.messageContextEntryMarkup.replace("REPLACE_context_googlesearchreplace_text", this.labels.context_googlesearchreplace_text);
-
- this.messageContextSubMenuMarkup = this.messageContextSubMenuMarkup.replace("REPLACE_submenu_disabled_text", this.labels.submenu_disabled_text);
- }
-
- onNativeContextMenu (instance, menu) {
- if (instance.props && instance.props.type == "NATIVE_TEXT" && instance.props.value && !menu.querySelector(".reverseimagesearch-item")) {
- let searchentry = BDFDB.React.findDOMNodeSafe(BDFDB.getOwnerInstance({node:menu,props:["handleSearchWithGoogle"]}));
- if (searchentry) this.appendItem(instance, searchentry, instance.props.value);
- }
- }
-
- onMessageContextMenu (instance, menu) {
- if (instance.props && instance.props.message && instance.props.channel && instance.props.target && !menu.querySelector(".googlereplacesearch-item")) {
- let text = document.getSelection().toString();
- if (text) {
- let searchentry = BDFDB.React.findDOMNodeSafe(BDFDB.getOwnerInstance({node:menu,props:["handleSearchWithGoogle"]}));
- if (searchentry) this.appendItem(instance, searchentry, text);
- }
- }
- }
-
- appendItem (instance, target, text) {
- let messageContextEntry = BDFDB.htmlToElement(this.messageContextEntryMarkup);
- target.parentElement.insertBefore(messageContextEntry, target.nextElementSibling);
- messageContextEntry.addEventListener("mouseenter", () => {
- let messageContextSubMenu = BDFDB.htmlToElement(this.messageContextSubMenuMarkup);
- let engines = BDFDB.getAllData(this, "engines");
- for (let key in engines) if (!engines[key]) BDFDB.removeEles(messageContextSubMenu.querySelector("[engine='" + key + "']"));
- if (messageContextSubMenu.querySelector(".GRS-item")) BDFDB.removeEles(messageContextSubMenu.querySelector(".alldisabled-item"));
- BDFDB.addChildEventListener(messageContextSubMenu, "click", ".GRS-item", e => {
- instance._reactInternalFiber.return.memoizedProps.closeContextMenu();
- let engine = e.currentTarget.getAttribute("engine");
- if (engine == "_all") {
- for (let key in engines) if (key != "_all" && engines[key]) window.open(this.defaults.engines[key].url.replace(this.textUrlReplaceString, encodeURIComponent(text)), "_blank");
- }
- else window.open(this.defaults.engines[engine].url.replace(this.textUrlReplaceString, encodeURIComponent(text)), "_blank");
- });
- BDFDB.appendSubMenu(messageContextEntry, messageContextSubMenu);
- });
- BDFDB.toggleEles(target, false);
- }
-
- getSettingsPanel () {
- if (!global.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
- let engines = BDFDB.getAllData(this, "engines");
- let settingshtml = `
${this.name}
`;
- settingshtml += `
Search Engines: `;
- for (let key in engines) {
- settingshtml += `
`;
- }
- settingshtml += `
`;
- settingshtml += `
`;
-
- let settingspanel = BDFDB.htmlToElement(settingshtml);
-
- BDFDB.initElements(settingspanel, this);
-
- return settingspanel;
- }
-
- setLabelsByLanguage () {
- switch (BDFDB.getDiscordLanguage().id) {
- case "hr": //croatian
- return {
- context_googlesearchreplace_text: "Pretražujte s ...",
- submenu_disabled_text: "Svi su onemogućeni"
- };
- case "da": //danish
- return {
- context_googlesearchreplace_text: "Søg med ...",
- submenu_disabled_text: "Alle deaktiveret"
- };
- case "de": //german
- return {
- context_googlesearchreplace_text: "Suche mit ...",
- submenu_disabled_text: "Alle deaktiviert"
- };
- case "es": //spanish
- return {
- context_googlesearchreplace_text: "Buscar con ...",
- submenu_disabled_text: "Todo desactivado"
- };
- case "fr": //french
- return {
- context_googlesearchreplace_text: "Rechercher avec ...",
- submenu_disabled_text: "Tous désactivés"
- };
- case "it": //italian
- return {
- context_googlesearchreplace_text: "Cerca con ...",
- submenu_disabled_text: "Tutto disattivato"
- };
- case "nl": //dutch
- return {
- context_googlesearchreplace_text: "Zoeken met ...",
- submenu_disabled_text: "Alles gedeactiveerd"
- };
- case "no": //norwegian
- return {
- context_googlesearchreplace_text: "Søk med ...",
- submenu_disabled_text: "Alle deaktivert"
- };
- case "pl": //polish
- return {
- context_googlesearchreplace_text: "Szukaj za pomocą ...",
- submenu_disabled_text: "Wszystkie wyłączone"
- };
- case "pt-BR": //portuguese (brazil)
- return {
- context_googlesearchreplace_text: "Pesquisar com ...",
- submenu_disabled_text: "Todos desativados"
- };
- case "fi": //finnish
- return {
- context_googlesearchreplace_text: "Etsi ...",
- submenu_disabled_text: "Kaikki on poistettu käytöstä"
- };
- case "sv": //swedish
- return {
- context_googlesearchreplace_text: "Sök med ...",
- submenu_disabled_text: "Alla avaktiverade"
- };
- case "tr": //turkish
- return {
- context_googlesearchreplace_text: "Ile ara ...",
- submenu_disabled_text: "Hepsi deaktive"
- };
- case "cs": //czech
- return {
- context_googlesearchreplace_text: "Hledat s ...",
- submenu_disabled_text: "Všechny deaktivované"
- };
- case "bg": //bulgarian
- return {
- context_googlesearchreplace_text: "Търсене с ...",
- submenu_disabled_text: "Всички са деактивирани"
- };
- case "ru": //russian
- return {
- context_googlesearchreplace_text: "Поиск с ...",
- submenu_disabled_text: "Все деактивированные"
- };
- case "uk": //ukrainian
- return {
- context_googlesearchreplace_text: "Пошук з ...",
- submenu_disabled_text: "Всі вимкнені"
- };
- case "ja": //japanese
- return {
- context_googlesearchreplace_text: "で検索する ...",
- submenu_disabled_text: "すべて非アクティブ化"
- };
- case "zh-TW": //chinese (traditional)
- return {
- context_googlesearchreplace_text: "搜索 ...",
- submenu_disabled_text: "全部停用"
- };
- case "ko": //korean
- return {
- context_googlesearchreplace_text: "다음으로 검색 ...",
- submenu_disabled_text: "모두 비활성화 됨"
- };
- default: //default: english
- return {
- context_googlesearchreplace_text: "Search with ...",
- submenu_disabled_text: "All disabled"
- };
- }
- }
- }
-};
diff --git a/PluginsV2/GoogleTranslateOption/README.md b/PluginsV2/GoogleTranslateOption/README.md
deleted file mode 100644
index f744b29f74..0000000000
--- a/PluginsV2/GoogleTranslateOption/README.md
+++ /dev/null
@@ -1,5 +0,0 @@
-# These Plugins are meant only for BDv2, not BD nor BandagedBD. If you got either of those two go to [Plugins](https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/).
-
-## Google Translate Option - [Download Script](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/GoogleTranslateOption/index.js) [Download Config](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/GoogleTranslateOption/config.json)
-
-Adds a Google Translate option to your context menu, which shows a preview of the translated text and on click will open the selected text in Google Translate. Also adds a translation button to your textareas, which will automatically translate the text for you before it is being send.
diff --git a/PluginsV2/GoogleTranslateOption/config.json b/PluginsV2/GoogleTranslateOption/config.json
deleted file mode 100644
index 37b61d5b7c..0000000000
--- a/PluginsV2/GoogleTranslateOption/config.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "info": {
- "name": "GoogleTranslateOption",
- "authors": [
- {
- "name": "DevilBro",
- "url": "https://www.paypal.me/MircoWittrien",
- "discord_id": "278543574059057154",
- "github_username": "mwittrien"
- }
- ],
- "version": 1.0,
- "description": "Adds a Google Translate option to your context menu, which shows a preview of the translated text and on click will open the selected text in Google Translate. Also adds a translation button to your textareas, which will automatically translate the text for you before it is being send. DeepLApi written by square. Thanks ;) \n\nMy Support Server: http://bit.ly/DevilBrosHaus or https://discordapp.com/invite/Jx3TjNS"
- }
-}
diff --git a/PluginsV2/GoogleTranslateOption/index.js b/PluginsV2/GoogleTranslateOption/index.js
deleted file mode 100644
index 2b0c4fb601..0000000000
--- a/PluginsV2/GoogleTranslateOption/index.js
+++ /dev/null
@@ -1,1096 +0,0 @@
-module.exports = (Plugin, Api, Vendor) => {
- if (!global.BDFDB || typeof BDFDB != "object") global.BDFDB = {myPlugins:{}, BDv2Api: Api};
-
- return class extends Plugin {
- initConstructor () {
- this.labels = {};
-
- this.patchModules = {
- "ChannelTextArea":"componentDidMount",
- "Message":"componentDidMount",
- "MessageOptionPopout":"componentDidMount"
- };
-
- this.languages = {};
-
- this.doTranslate = false;
- this.translating = false;
-
- this.defaults = {
- settings: {
- addTranslateButton: {value:true, description:"Adds an translate button to the chatbar."},
- sendOriginalMessage: {value:false, description:"Send the original message together with the translation."}
- },
- translators: {
- useGoogle: {value:true, choice1:"DeepL", choice2:"Google", popout:true}
- },
- choices: {
- inputContext: {value:"auto", place:"Context", direction:"Input", popout:false, description:"Input Language in selected Messages:"},
- outputContext: {value:"$discord", place:"Context", direction:"Output", popout:false, description:"Output Language in selected Messages:"},
- inputMessage: {value:"auto", place:"Message", direction:"Input", popout:true, description:"Input Language in your Message:"},
- outputMessage: {value:"$discord", place:"Message", direction:"Output", popout:true, description:"Output Language in your Message:"}
- }
- };
-
- this.messageTranslateContextEntryMarkup =
- ``;
-
- this.messageUntranslateContextEntryMarkup =
- ``;
-
- this.messageSearchContextEntryMarkup =
- ``;
-
- this.popoutTranslateEntryMarkup =
- `
- REPLACE_popout_translateoption_text
- `;
-
- this.popoutUntranslateEntryMarkup =
- `
- REPLACE_popout_untranslateoption_text
- `;
-
- this.translateButtonMarkup =
- `
`;
-
- this.reverseButtonMarkup =
- `
-
- `;
-
- this.translatePopoutMarkup =
- `
-
-
-
Words starting with "!" will be ignored
-
- ${Object.keys(this.defaults.choices).map((key, i) =>
- `
-
${this.defaults.choices[key].description}
- ${this.defaults.choices[key].direction == "Output" ? this.reverseButtonMarkup.replace("REPLACETYPE",key) : ""}
-
-
`).join("")}
-
- ${Object.keys(this.defaults.translators).map((key, i) =>
- `
-
Translator:
-
${this.defaults.translators[key].choice1}
-
-
-
-
${this.defaults.translators[key].choice2}
-
`).join("")}
-
-
`;
-
- this.DeepLTranslateAPI = function () {
- var INPUT, OUTPUT, clearInput, current, domReady, enabled, executeScript, getLanguage, getOutput, langI, langO, setInput, setLanguage, timer, wc, webview;
- var _extends = Object.assign || function (target) {
- for (var i = 1; i < arguments.length; i++) {
- var source = arguments[i];for (var key in source) {
- if (Object.prototype.hasOwnProperty.call(source, key)) {
- target[key] = source[key];
- }
- }
- }return target;
- }
- class DeepLTranslateAPI {
- start() {
- enabled = true;
- webview = document.createElement("webview");
- webview.style.visibility = "hidden";
- webview.id = "wvDeepLTranslateAPI";
- webview.partition = "persist:DeepLTranslateAPI";
- webview.addEventListener("dom-ready", async function () {
- wc = webview.getWebContents();
- webview.setAudioMuted(true);
- domReady = await executeScript(function () {
- var tas = document.querySelectorAll("textarea");
- window["INPUT"] = tas[0];
- window["OUTPUT"] = tas[1];
- return Promise.resolve(true);
- });
- });
- webview.src = "https://www.deepl.com/translator";
- document.body.appendChild(webview);
- }
-
- stop() {
- enabled = domReady = false;
- // webview.terminate()
- webview.remove();
- if (timer) {
- cancelAnimationFrame(timer);
- }
- if (current != null) {
- current.reject(new Error("DeepLTranslateAPI was stopped."));
- }
- webview = wc = langI = langO = current = timer = null;
- }
-
- isReady() {
- return domReady;
- }
-
- translate(text) {
- return new Promise(function (resolve, reject) {
- if (langI === langO) {
- return resolve(text);
- }
- if (!enabled) {
- return reject(new Error("DeepLTranslateAPI is disabled!"));
- }
- if (!domReady) {
- return reject(new Error("DeepL didn't load (yet?)!"));
- }
- if (current != null) {
- current.reject(new Error("Can only translate so much."));
- }
- current = { resolve, reject };
- (async function () {
- var __unchanged__, valueNew, valueOld;
- valueOld = await getOutput();
- ({ __unchanged__ } = await setInput(text));
- if (true === __unchanged__) {
- valueOld = void 0;
- }
- if (timer) {
- return;
- }
- // todo: figgure out event based change on output
- while (enabled && valueOld === (valueNew = await getOutput())) {
- await new Promise(function (c) {
- return timer = requestAnimationFrame(c);
- });
- }
- current.resolve(valueNew);
- timer = current = null;
- })();
- });
- }
-
- setInputLanguage(lang) {
- return setLanguage(true, lang);
- }
-
- setOutputLanguage(lang) {
- return setLanguage(false, lang);
- }
-
- getInputLanguage(lang) {
- return getLanguage(true);
- }
-
- getOutputLanguage(lang) {
- return getLanguage(false);
- }
-
- clearInput() {
- return clearInput();
- }
-
- };
-
- webview = wc = current = timer = null;
-
- enabled = domReady = false;
-
- langI = langO = "auto";
-
- INPUT = "#_ta0#input#DeepLTranslateAPI#";
-
- OUTPUT = "#_ta1#output#DeepLTranslateAPI#";
-
- executeScript = function (replace, func) {
- var code, k, v;
- if (!func) {
- func = replace;
- replace = { INPUT, OUTPUT };
- } else {
- replace = _extends({ INPUT, OUTPUT }, replace);
- }
- code = "(" + func.toString() + ")()";
- for (k in replace) {
- v = replace[k];
- if ("string" === typeof v) {
- v = v.split("\n").join("\\n");
- v = v.replace(/[^\w\d\s]/g, "\\$&");
- }
- code = code.split(k).join(v);
- }
- return wc.executeJavaScript(code);
- };
-
- setInput = function (text) {
- return executeScript({ text }, function () {
- return Promise.resolve(window["INPUT"].value === "text" ? {
- __unchanged__: true
- } : (window["INPUT"].value = "text", window["INPUT"].dispatchEvent(new Event("change")), window["INPUT"].value));
- });
- };
-
- getOutput = function () {
- return executeScript(function () {
- return Promise.resolve(window["OUTPUT"].value);
- });
- };
-
- setLanguage = async function (inputOrOutput, lang) {
- if (!domReady) {
- throw new Error("DeepL didn't load (yet?)!");
- }
- lang = !lang || lang === "auto" ? lang : lang.toUpperCase();
- if (!(lang === "DE" || lang === "EN" || lang === "FR" || lang === "ES" || lang === "IT" || lang === "NL" || lang === "PL" || inputOrOutput && "auto" === lang)) {
- throw new Error(`${lang} is not a supported language!`);
- }
- if (inputOrOutput) {
- langI = lang;
- } else {
- if (langI === (langO = lang)) {
- return;
- }
- }
- await executeScript({
- inputOrOutput,
- __lang____: lang
- }, function () {
- document.querySelector(`.lmt__language_select--${inputOrOutput ? "source" : "target"} li[dl-value=__lang____]`).click();
- });
- };
-
- getLanguage = async function (inputOrOutput) {
- if (!domReady) {
- throw new Error("DeepL didn't load (yet?)!");
- }
- return await executeScript({ inputOrOutput }, function () {
- return Promise.resolve(document.querySelector(`.lmt__language_select--${inputOrOutput ? "source" : "target"}`).getAttribute("dl-value"));
- });
- };
-
- clearInput = async function () {
- if (!domReady) {
- throw new Error("DeepL didn't load (yet?)!");
- }
- await executeScript(function () {
- document.querySelector(".lmt__clear_text_button").click();
- });
- };
-
- return DeepLTranslateAPI;
- }.call(this);
-
- this.css = `
- ${BDFDB.dotCN.textareainner} ${BDFDB.dotCN.textareapickerbuttons} {
- height: auto;
- }
-
- ${BDFDB.dotCN.textareainner} .send-button {
- top: calc(50% - 15px);
- right: 9px;
- }
-
- ${BDFDB.dotCN.textareainner} .send-button,
- ${BDFDB.dotCN.textareainner} ${BDFDB.dotCN.button} {
- max-height: unset;
- }
-
- ${BDFDB.dotCN.textareabuttonwrapper}.popout-open ${BDFDB.dotCN.textareabutton}.translate-button {
- opacity: 1;
- }
-
- ${BDFDB.dotCN.textareabuttonwrapper + BDFDB.dotCNS.textareabuttonactive + BDFDB.dotCN.textareabutton}.translate-button {
- color: #F04747 !important;
- }
-
- ${BDFDB.dotCNS.textareabuttonwrapper + BDFDB.dotCN.textareabutton}.translate-button ${BDFDB.dotCN.textareaicon} {
- height: 24px;
- width: 24px;
- }
-
- ${BDFDB.dotCN.textareabuttonwrapper}.popout-open ${BDFDB.dotCN.textareabutton}.translate-button ${BDFDB.dotCN.textareaicon} {
- transform: none;
- }
-
- .reverse-button {
- margin-top: -5px;
- opacity: 0.2;
- transition: all 200ms ease;
- }
-
- ${BDFDB.dotCN.themedark} .reverse-button {
- fill: #fff;
- }
-
- ${BDFDB.dotCN.themelight} .reverse-button {
- fill: #4f545c;
- }
- .reverse-button:hover {
- cursor: pointer;
- opacity: 1;
- }
-
- ${BDFDB.dotCN.popout}.popout-googletranslate ${BDFDB.dotCN.popoutthemedpopout} {
- padding: 0 10px;
- width: 400px;
- }
-
- ${BDFDB.dotCN.selectmenuouter}.inChat {
- top: 0%;
- transform: translateY(-100%);
- border-radius: 4px 4px 0 0;
- margin-top: 1px;
- }`;
- }
-
-
- onStart () {
- if (global.BDFDB && global.BDFDB.myPlugins && typeof global.BDFDB.myPlugins == "object") global.BDFDB.myPlugins[this.name] = this;
- var libraryScript = document.querySelector('head script[src="https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js"]');
- if (!global.BDFDB || typeof BDFDB != "object" || performance.now() - BDFDB.creationTime > 600000) {
- if (libraryScript) libraryScript.remove();
- libraryScript = document.createElement("script");
- libraryScript.setAttribute("type", "text/javascript");
- libraryScript.setAttribute("src", "https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js");
- libraryScript.setAttribute("date", performance.now());
- libraryScript.addEventListener("load", () => {if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();});
- document.head.appendChild(libraryScript);
- }
- else if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();
- this.startTimeout = setTimeout(() => {this.initialize();}, 30000);
- }
-
- initialize () {
- if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
- if (this.started) return true;
- BDFDB.loadMessage(this);
-
- this.GuildUtils = BDFDB.WebModules.findByProperties("getGuilds","getGuild");
- this.ChannelUtils = BDFDB.WebModules.findByProperties("getChannels","getChannel");
- this.LastGuildStore = BDFDB.WebModules.findByProperties("getLastSelectedGuildId");
- this.LastChannelStore = BDFDB.WebModules.findByProperties("getLastSelectedChannelId");
-
- this.setLanguage();
-
- BDFDB.WebModules.forceAllUpdates(this);
-
- return true;
- }
- else {
- console.error(`%c[${this.name}]%c`, 'color: #3a71c1; font-weight: 700;', '', 'Fatal Error: Could not load BD functions!');
- return false;
- }
- }
-
- onStop () {
- if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
- this.stopDeepL();
-
- document.querySelectorAll(BDFDB.dotCN.message + ".translated").forEach(message => {
- this.resetMessage(message);
- });
-
- BDFDB.removeEles(".translate-button-wrapper", ".popout-googletranslate");
-
- BDFDB.unloadMessage(this);
- return true;
- }
- else {
- return false;
- }
- }
-
-
- // begin of own functions
-
- startDeepL () {
- this.stopDeepL();
- this.DeepLTranslate = new this.DeepLTranslateAPI();
- this.DeepLTranslate.start();
- }
-
- stopDeepL () {
- if (this.DeepLTranslate && typeof this.DeepLTranslate.stop === "function") this.DeepLTranslate.stop();
- this.DeepLTranslate = undefined;
- }
-
- changeLanguageStrings () {
- this.messageTranslateContextEntryMarkup = this.messageTranslateContextEntryMarkup.replace("REPLACE_context_messagetranslateoption_text", this.labels.context_messagetranslateoption_text);
- this.messageUntranslateContextEntryMarkup = this.messageUntranslateContextEntryMarkup.replace("REPLACE_context_messageuntranslateoption_text", this.labels.context_messageuntranslateoption_text);
- this.messageSearchContextEntryMarkup = this.messageSearchContextEntryMarkup.replace("REPLACE_context_googletranslateoption_text", this.labels.context_googletranslateoption_text);
-
- this.popoutTranslateEntryMarkup = this.popoutTranslateEntryMarkup.replace("REPLACE_popout_translateoption_text", this.labels.popout_translateoption_text);
- this.popoutUntranslateEntryMarkup = this.popoutUntranslateEntryMarkup.replace("REPLACE_popout_untranslateoption_text", this.labels.popout_untranslateoption_text);
- }
-
- onMessageContextMenu (instance, menu) {
- if (instance.props && instance.props.message && instance.props.channel && instance.props.target && !menu.querySelector(".googletranslateoption-item")) {
- let {messagediv, pos} = this.getMessageAndPos(instance.props.target);
- if (!messagediv || pos == -1) return;
- let pinentry = BDFDB.React.findDOMNodeSafe(BDFDB.getOwnerInstance({node:menu,name:"MessagePinItem"}));
- let messageTranslateContextEntry = BDFDB.htmlToElement(BDFDB.containsClass(messagediv, "translated") ? this.messageUntranslateContextEntryMarkup : this.messageTranslateContextEntryMarkup);
- if (pinentry) pinentry.parentElement.insertBefore(messageTranslateContextEntry, pinentry.nextElementSibling);
- else menu.insertBefore(messageTranslateContextEntry, menu.firstElementChild);
- let translateitem = messageTranslateContextEntry.querySelector(".googletranslateoption-item");
- translateitem.addEventListener("click", () => {
- instance._reactInternalFiber.return.memoizedProps.closeContextMenu();
- this.translateMessage(instance.props.message, instance.props.target, instance.props.channel);
- });
- if (BDFDB.isPluginEnabled("MessageUtilities")) {
- BDFDB.setContextHint(translateitem, BDFDB.Plugins["messageutilities"].getActiveShortcutString("__Translate_Message"));
- }
- let text = document.getSelection().toString();
- if (text) {
- let searchentry = BDFDB.React.findDOMNodeSafe(BDFDB.getOwnerInstance({node:menu,props:["handleSearchWithGoogle"]}));
- if (searchentry) {
- let messageSearchContextEntry = BDFDB.htmlToElement(this.messageSearchContextEntryMarkup);
- searchentry.parentElement.appendChild(messageSearchContextEntry);
- let searchitem = messageSearchContextEntry.querySelector(".googletranslateoption-search-item");
- searchitem.addEventListener("mouseenter", e => {
- this.translateText(text, "context", (translation, input, output) => {
- if (translation) {
- var openGoogleSearch = () => {
- instance._reactInternalFiber.return.memoizedProps.closeContextMenu();
- window.open(this.getGoogleTranslatePageURL(input.id, output.id, text), "_blank");
- };
- searchitem.removeEventListener("click", openGoogleSearch);
- searchitem.addEventListener("click", openGoogleSearch);
- let rects = BDFDB.getRects(searchitem);
- BDFDB.createTooltip(`From ${input.name}:\n${text}\n\nTo ${output.name}:\n${translation}`, searchitem, {type: "right",selector:"googletranslate-tooltip",style:`max-width: ${window.outerWidth - rects.left - rects.width}px !important;`});
- }
- });
- });
- }
- }
- }
- }
-
- setLanguage () {
- this.languages = Object.assign({},
- {"auto": {name:"Auto", id:"auto", integrated:false, dic:false, deepl:true}},
- BDFDB.languages,
- {"binary": {name:"Binary", id:"binary", integrated:false, dic:false, deepl:true}}
- );
- if (!BDFDB.getData("useGoogle", this, "translators")) {
- this.languages = BDFDB.filterObject(this.languages, (lang) => {return lang.deepl == true ? lang : null});
- this.startDeepL();
- }
- else this.stopDeepL();
- }
-
- getLanguageChoice (direction, place) {
- var type = typeof place === "undefined" ? direction : direction.toLowerCase() + place.charAt(0).toUpperCase() + place.slice(1).toLowerCase();
- var choice = BDFDB.getData(type, this, "choices");
- choice = this.languages[choice] ? choice : Object.keys(this.languages)[0];
- choice = type.indexOf("output") > -1 && choice == "auto" ? "en" : choice;
- return choice;
- }
-
- processChannelTextArea (instance, wrapper) {
- if (instance.props && instance.props.type && instance.props.type == "normal" && !instance.props.disabled && !wrapper.querySelector(".translate-button-wrapper") && BDFDB.getData("addTranslateButton", this, "settings")) {
- let textarea = wrapper.querySelector("textarea");
- if (textarea) {
- var buttoncontainer = wrapper.querySelector(BDFDB.dotCN.textareapickerbuttons);
- if (!buttoncontainer) return;
- var translateButton = BDFDB.htmlToElement(this.translateButtonMarkup);
- translateButton.addEventListener("click", () => {
- this.openTranslatePopout(translateButton);
- });
- translateButton.addEventListener("contextmenu", () => {
- this.translating = !this.translating;
- BDFDB.toggleClass(document.querySelectorAll(BDFDB.dotCNS.textareawrapchat + ".translate-button-wrapper"), BDFDB.disCN.textareabuttonactive, this.translating);
- });
- buttoncontainer.insertBefore(translateButton, buttoncontainer.firstElementChild);
- BDFDB.addClass(translateButton, instance.props.type);
- BDFDB.toggleClass(translateButton, BDFDB.disCN.textareabuttonactive, this.translating);
- BDFDB.addEventListener(this, textarea, "input", () => {
- if (this.doTranslate) {
- this.doTranslate = false;
- if (document.activeElement == textarea) {
- var text = textarea.value;
- textarea.focus();
- textarea.selectionStart = 0;
- textarea.selectionEnd = text.length;
- document.execCommand("insertText", false, "");
- this.translateText(text, "message", (translation, input, output) => {
- translation = !translation ? text : (BDFDB.getData("sendOriginalMessage", this, "settings") ? text + "\n\n" + translation : translation);
- textarea.focus();
- document.execCommand("insertText", false, translation + " ");
- BDFDB.triggerSend(textarea);
- });
- }
- }
- });
- BDFDB.addEventListener(this, textarea, "keydown", e => {
- if (textarea.value && this.translating && !e.shiftKey && e.which == 13 && !wrapper.querySelector(BDFDB.dotCN.autocomplete)) {
- this.doTranslate = true;
- textarea.dispatchEvent(new Event("input"));
- }
- });
- }
- }
- }
-
- processMessage (instance, wrapper) {
- if (instance.props && typeof instance.props.renderButtons == "function" && !wrapper.querySelector(BDFDB.dotCN.optionpopoutbutton)) {
- let buttonwrap = wrapper.querySelector(BDFDB.dotCN.messagebuttoncontainer);
- if (buttonwrap) {
- let optionPopoutButton = BDFDB.htmlToElement(`
`);
- optionPopoutButton.addEventListener("click", () => {BDFDB.createMessageOptionPopout(optionPopoutButton);});
- buttonwrap.appendChild(optionPopoutButton);
- }
- }
- }
-
- processMessageOptionPopout (instance, wrapper) {
- if (instance.props.message && instance.props.channel && instance._reactInternalFiber.memoizedProps.target && !wrapper.querySelector(".personalpin-itembtn")) {
- let {messagediv, pos} = this.getMessageAndPos(instance._reactInternalFiber.memoizedProps.target);
- if (!messagediv || pos == -1) return;
- let popoutTranslateEntry = BDFDB.htmlToElement(BDFDB.containsClass(messagediv, "translated") ? this.popoutUntranslateEntryMarkup : this.popoutTranslateEntryMarkup);
- wrapper.appendChild(popoutTranslateEntry);
- popoutTranslateEntry.addEventListener("click", () => {
- this.translateMessage(instance.props.message, instance._reactInternalFiber.memoizedProps.target, instance.props.channel);
- instance.props.onClose();
- });
- }
- }
-
- getMessageAndPos (target) {
- let messagediv = BDFDB.getParentEle(BDFDB.dotCN.message, target);
- let pos = messagediv ? Array.from(messagediv.parentElement.querySelectorAll(BDFDB.dotCN.message)).indexOf(messagediv) : -1;
- return {messagediv, pos};
- }
-
- translateMessage (message, target, channel) {
- if (!message || !target) return;
- let {messagediv, pos} = this.getMessageAndPos(target);
- if (!messagediv || pos == -1) return;
- channel = channel ? channel : this.ChannelUtils.getChannel(message.channel_id);
- if (!messagediv.querySelector(BDFDB.dotCN.messageedited + ".translated")) {
- var markup = messagediv.querySelector(BDFDB.dotCN.messagemarkup);
- var fakemarkup = markup.cloneNode(true);
- var oldhtml = markup.innerHTML;
- let compactheader = fakemarkup.querySelector(BDFDB.dotCN.messageheadercompact);
- if (compactheader) compactheader.remove();
- this.translateText(fakemarkup.innerHTML, "context", (translation, input, output) => {
- if (translation) {
- markup.GoogleTranslateOriginalHTML = oldhtml;
- markup.innerHTML = (compactheader ? "
" : "") + translation.replace(/\n/g, "DevilBroBDFDBPlacerHolderN").replace(/\s/g, " ").replace(/DevilBroBDFDBPlacerHolderN/g, "\n").replace(/ *([<>]) */g, "$1");
- let translatestamp = BDFDB.htmlToElement(`
(${this.labels.translated_watermark_text}) `);
- translatestamp.addEventListener("mouseenter", () => {
- BDFDB.createTooltip(`
From: ${input.name}
To: ${output.name}
`, translatestamp, {html:true, type:"top", selector:"translation-tooltip"});
- });
- markup.appendChild(translatestamp);
- BDFDB.addClass(messagediv, "translated");
- if (compactheader) markup.insertBefore(compactheader, markup.firstElementChild);
- }
- });
- }
- else this.resetMessage(messagediv);
- }
-
- resetMessage (messagediv) {
- BDFDB.removeEles(messagediv.querySelector(BDFDB.dotCN.messageedited + ".translated"));
- BDFDB.removeClass(messagediv, "translated");
- let markup = messagediv.querySelector(BDFDB.dotCN.messagemarkup);
- markup.innerHTML = markup.GoogleTranslateOriginalHTML;
- delete markup.GoogleTranslateOriginalHTML;
- }
-
- translateText (text, type, callback) {
- var finishTranslation = (translation, exceptions, input, output, toast) => {
- if (translation) translation = this.addExceptions(translation, exceptions);
- clearInterval(toast.interval);
- toast.close();
- callback(translation, input, output);
- };
- var [newtext, exceptions, translate] = this.removeExceptions(text.trim(), type);
- var input = Object.assign({}, this.languages[this.getLanguageChoice("input", type)]);
- var output = Object.assign({}, this.languages[this.getLanguageChoice("output", type)]);
- var translation = "";
- if (translate) {
- var toast = BDFDB.showToast("Translating. Please wait", {timeout:0});
- toast.interval = setInterval(() => {
- toast.textContent = toast.textContent.indexOf(".....") > -1 ? "Translating. Please wait" : toast.textContent + ".";
- },500);
- if (input.id == "binary" || output.id == "binary") {
- if (input.id == "binary" && output.id != "binary") translation = this.binary2string(newtext);
- else if (input.id != "binary" && output.id == "binary") translation = this.string2binary(newtext);
- else if (input.id == "binary" && output.id == "binary") translation = newtext;
- finishTranslation(translation, exceptions, input, output, toast);
- }
- else {
- if (BDFDB.getData("useGoogle", this, "translators")) {
- require("request")(this.getGoogleTranslateApiURL(input.id, output.id, newtext), (error, response, result) => {
- if (!error && result) {
- result = JSON.parse(result);
- result[0].forEach((array) => {translation += array[0];});
- if (this.languages[result[2]]) input.name = this.languages[result[2]].name;
- finishTranslation(translation, exceptions, input, output, toast);
- }
- });
- }
- else {
- this.DeepLTranslate.setInputLanguage(input.id);
- this.DeepLTranslate.setOutputLanguage(output.id);
- this.DeepLTranslate.translate(newtext).then((translation) => {
- if (newtext.lastIndexOf(".") != newtext.length-1 && translation.lastIndexOf(".") == translation.length-1) translation = translation.slice(0,-1);
- finishTranslation(translation, exceptions, input, output, toast);
- });
- }
- }
- }
- else {
- translation = text;
- finishTranslation(translation, exceptions, input, output, toast);
- }
- }
-
- addExceptions (string, exceptions) {
- for (let i in exceptions) string = string.replace("a" + i + "_______", exceptions[i].indexOf("!") == 0 ? exceptions[i].slice(1) : exceptions[i]);
- return string;
- }
-
- removeExceptions (string, type) {
- var exceptions = {}, newString = [], count = 0;
- if (type == "context") {
- let text = [], i = 0;
- string.split("").forEach(chara => {
- if (chara == "<" && text[i]) i++;
- text[i] = text[i] ? text[i] + chara : chara;
- if (chara == ">") i++;
- });
- for (let j in text) {
- if (text[j].indexOf("<") == 0) {
- newString.push("a" + count + "_______");
- exceptions[count] = text[j];
- count++;
- }
- else newString.push(text[j]);
- }
- }
- else {
- string.split(" ").forEach(word => {
- if (word.indexOf("<@!") == 0 || word.indexOf(":") == 0 || word.indexOf("@") == 0 || word.indexOf("#") == 0 || (word.indexOf("!") == 0 && word.length > 1)) {
- newString.push("a" + count + "_______");
- exceptions[count] = word;
- count++;
- }
- else newString.push(word);
- });
- }
- return [newString.join(" "), exceptions, newString.length-count != 0];
- }
-
- openTranslatePopout (button) {
- let container = document.querySelector(BDFDB.dotCN.popouts);
- if (!container || BDFDB.containsClass(button, "popout-open")) return;
- BDFDB.addClass(button, "popout-open");
- let translatepopout = BDFDB.htmlToElement(this.translatePopoutMarkup);
- container.appendChild(translatepopout);
- let buttonrects = BDFDB.getRects(button);
- translatepopout.style.setProperty("left", buttonrects.left + buttonrects.width + "px");
- translatepopout.style.setProperty("top", buttonrects.top - buttonrects.height/2 + "px")
-
- BDFDB.addChildEventListener(translatepopout, "click", BDFDB.dotCN.selectcontrol, e => {this.openDropdownMenu("inChat", e);});
- BDFDB.addChildEventListener(translatepopout, "click", ".reverse-button", e => {
- let place = e.currentTarget.getAttribute("type").replace("output","");
- let input = this.getLanguageChoice("output", place);
- let output = this.getLanguageChoice("input", place);
- output = output == "auto" ? "en" : output;
- let inputselect = translatepopout.querySelector(BDFDB.dotCN.select + "[type='input" + place + "']");
- let outputselect = translatepopout.querySelector(BDFDB.dotCN.select + "[type='output" + place + "']");
- inputselect.setAttribute("value", input);
- inputselect.querySelector(BDFDB.dotCN.title).innerText = this.languages[input].name;
- outputselect.setAttribute("value", output);
- outputselect.querySelector(BDFDB.dotCN.title).innerText = this.languages[output].name;
- BDFDB.saveData("input" + place, input, this, "choices");
- BDFDB.saveData("output" + place, output, this, "choices");
- });
-
- translatepopout.querySelectorAll(BDFDB.dotCN.select).forEach(selectWrap => {
- let language = this.getLanguageChoice(selectWrap.getAttribute("type"));
- selectWrap.setAttribute("value", language);
- selectWrap.querySelector(BDFDB.dotCN.title).innerText = this.languages[language].name;
- });
-
- var translatecheckbox = translatepopout.querySelector("#translating-checkbox");
- translatecheckbox.checked = this.translating;
- translatecheckbox.addEventListener("click", () => {
- BDFDB.toggleClass(button, BDFDB.disCN.textareabuttonactive, translatecheckbox.checked);
- this.translating = translatecheckbox.checked;
- });
-
- var translators = BDFDB.getAllData(this, "translators");
- translatepopout.querySelectorAll(".translators-switch").forEach(translatorcheckbox => {
- translatorcheckbox.checked = translators[translatorcheckbox.value.split(" ")[1]];
- translatorcheckbox.addEventListener("click", () => {
- document.removeEventListener("mousedown", removePopout);
- translatepopout.remove();
- BDFDB.removeClass(button, "popout-open");
- setImmediate(() => {this.openTranslatePopout(button);});
- });
- });
-
- var removePopout = e => {
- if (!translatepopout.contains(e.target)) {
- document.removeEventListener("mousedown", removePopout);
- translatepopout.remove();
- setTimeout(() => {BDFDB.removeClass(button, "popout-open");},300);
- }
- };
- document.addEventListener("mousedown", removePopout);
-
- BDFDB.initElements(translatepopout, this);
- }
-
- openDropdownMenu (selector, e) {
- let selectControl = e.currentTarget;
- let selectWrap = selectControl.parentElement;
- let plugincard = selector == "inSettings" ? BDFDB.getParentEle("li", selectWrap) : document.createElement("div");
-
- if (!plugincard || BDFDB.containsClass(selectWrap, BDFDB.disCN.selectisopen)) return;
-
- BDFDB.addClass(selectWrap, BDFDB.disCN.selectisopen);
- plugincard.style.setProperty("overflow", "visible", "important");
-
- var type = selectWrap.getAttribute("type");
- var selectMenu = this.createDropdownMenu(selectWrap.getAttribute("value"), type);
- BDFDB.addClass(selectMenu, selector);
- selectWrap.appendChild(selectMenu);
-
- BDFDB.addChildEventListener(selectMenu, "mousedown", BDFDB.dotCN.selectoption, e2 => {
- var language = e2.currentTarget.getAttribute("value");
- selectWrap.setAttribute("value", language);
- selectControl.querySelector(BDFDB.dotCN.title).innerText = this.languages[language].name;
- BDFDB.saveData(type, language, this, "choices");
- });
-
- var removeMenu = e2 => {
- if (e2.target.parentElement != selectMenu) {
- document.removeEventListener("mousedown", removeMenu);
- selectMenu.remove();
- plugincard.style.removeProperty("overflow");
- setTimeout(() => {BDFDB.removeClass(selectWrap, BDFDB.disCN.selectisopen);},100);
- }
- };
- document.addEventListener("mousedown", removeMenu);
- }
-
- createDropdownMenu (choice, type) {
- var menuhtml = ``;
- return BDFDB.htmlToElement(menuhtml);
- }
-
- string2binary (string) {
- var binary = "";
- for (var character of string) binary += parseInt(character.charCodeAt(0).toString(2)).toPrecision(8).split(".").reverse().join("").toString() + " ";
- return binary;
- }
-
- binary2string (binary) {
- var string = "";
- binary = binary.replace(new RegExp(" ", "g"), "");
- if (/^[0-1]*$/.test(binary)) {
- var eightdigits = "";
- var counter = 0;
- for (var digit of binary) {
- eightdigits += digit;
- counter++;
- if (counter > 7) {
- string += String.fromCharCode(parseInt(eightdigits,2).toString(10));
- eightdigits = "";
- counter = 0;
- }
- }
- }
- else {
- BDFDB.showToast("Invalid binary format. Only use 0s and 1s.", {type:"error"});
- }
- return string;
- }
-
- getGoogleTranslateApiURL (input, output, text) {
- return "https://translate.googleapis.com/translate_a/single?client=gtx&sl=" + input + "&tl=" + output + "&dt=t&ie=UTF-8&oe=UTF-8&q=" + encodeURIComponent(text);
- }
-
- getGoogleTranslatePageURL (input, output, text) {
- return "https://translate.google.com/#" + input + "/" + output + "/" + encodeURIComponent(text);
- }
-
- getSettingsPanel () {
- if (!global.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
- var choices = BDFDB.getAllData(this, "choices");
- var settings = BDFDB.getAllData(this, "settings");
- var translators = BDFDB.getAllData(this, "translators");
- var settingshtml = `
${this.name}
`;
- for (let key in choices) {
- let choice = this.getLanguageChoice(key);
- settingshtml += `
${this.defaults.choices[key].description} `
- }
- for (let key in settings) {
- settingshtml += `
`;
- }
- for (let key in translators) {
- settingshtml += `
`;
- }
- settingshtml += `
`;
-
- let settingspanel = BDFDB.htmlToElement(settingshtml);
-
- BDFDB.initElements(settingspanel, this);
-
- BDFDB.addEventListener(this, settingspanel, "click", BDFDB.dotCN.selectcontrol, e => {this.openDropdownMenu("inSettings", e);});
-
- return settingspanel;
- }
-
- onSettingsClosed () {
- if (this.SettingsUpdated) {
- delete this.SettingsUpdated;
- this.setLanguage();
- BDFDB.removeEles(".translate-button-wrapper");
- BDFDB.WebModules.forceAllUpdates(this, "ChannelTextArea");
- }
- }
-
- setLabelsByLanguage () {
- switch (BDFDB.getDiscordLanguage().id) {
- case "hr": //croatian
- return {
- context_messagetranslateoption_text: "Prijevod poruke",
- context_messageuntranslateoption_text: "Prijenos poruke",
- context_googletranslateoption_text: "Traži prijevod",
- popout_translateoption_text: "Prevesti",
- popout_untranslateoption_text: "Prevesti natrag",
- translated_watermark_text: "preveo"
- };
- case "da": //danish
- return {
- context_messagetranslateoption_text: "Oversæt Besked",
- context_messageuntranslateoption_text: "Oversæt Besked tilbage",
- context_googletranslateoption_text: "Søg oversættelse",
- popout_translateoption_text: "Oversætte",
- popout_untranslateoption_text: "Oversæt tilbage",
- translated_watermark_text: "oversat"
- };
- case "de": //german
- return {
- context_messagetranslateoption_text: "Nachricht übersetzen",
- context_messageuntranslateoption_text: "Nachricht unübersetzen",
- context_googletranslateoption_text: "Suche Übersetzung",
- popout_translateoption_text: "Übersetzen",
- popout_untranslateoption_text: "Unübersetzen",
- translated_watermark_text: "übersetzt"
- };
- case "es": //spanish
- return {
- context_messagetranslateoption_text: "Traducir mensaje",
- context_messageuntranslateoption_text: "Traducir mensaje de vuelta",
- context_googletranslateoption_text: "Buscar traducción",
- popout_translateoption_text: "Traducir",
- popout_untranslateoption_text: "Traducir de vuelta",
- translated_watermark_text: "traducido"
- };
- case "fr": //french
- return {
- context_messagetranslateoption_text: "Traduire le message",
- context_messageuntranslateoption_text: "Traduire le message en retour",
- context_googletranslateoption_text: "Rechercher une traduction",
- popout_translateoption_text: "Traduire",
- popout_untranslateoption_text: "Traduire en arrière",
- translated_watermark_text: "traduit"
- };
- case "it": //italian
- return {
- context_messagetranslateoption_text: "Tradurre il messaggio",
- context_messageuntranslateoption_text: "Tradurre il messaggio indietro",
- context_googletranslateoption_text: "Cerca la traduzione",
- popout_translateoption_text: "Traduci",
- popout_untranslateoption_text: "Traduci indietro",
- translated_watermark_text: "tradotto"
- };
- case "nl": //dutch
- return {
- context_messagetranslateoption_text: "Vertaal bericht",
- context_messageuntranslateoption_text: "Vertaal bericht terug",
- context_googletranslateoption_text: "Zoek vertaling",
- popout_translateoption_text: "Vertaal",
- popout_untranslateoption_text: "Vertaal terug",
- translated_watermark_text: "vertaalde"
- };
- case "no": //norwegian
- return {
- context_messagetranslateoption_text: "Oversett melding",
- context_messageuntranslateoption_text: "Oversett melding tilbake",
- context_googletranslateoption_text: "Søk oversettelse",
- popout_translateoption_text: "Oversett",
- popout_untranslateoption_text: "Oversett tilbake",
- translated_watermark_text: "oversatt"
- };
- case "pl": //polish
- return {
- context_messagetranslateoption_text: "Przetłumacz wiadomość",
- context_messageuntranslateoption_text: "Przetłumacz wiadomość z powrotem",
- context_googletranslateoption_text: "Wyszukaj tłumaczenie",
- popout_translateoption_text: "Przetłumacz",
- popout_untranslateoption_text: "Przetłumacz ponownie",
- translated_watermark_text: "przetłumaczony"
- };
- case "pt-BR": //portuguese (brazil)
- return {
- context_messagetranslateoption_text: "Traduzir mensagem",
- context_messageuntranslateoption_text: "Traduzir mensagem de volta",
- context_googletranslateoption_text: "Pesquisar tradução",
- popout_translateoption_text: "Traduzir",
- popout_untranslateoption_text: "Traduzir de volta",
- translated_watermark_text: "traduzido"
- };
- case "fi": //finnish
- return {
- context_messagetranslateoption_text: "Käännä viesti",
- context_messageuntranslateoption_text: "Käännä viesti takaisin",
- context_googletranslateoption_text: "Etsi käännös",
- popout_translateoption_text: "Kääntää",
- popout_untranslateoption_text: "Käännä takaisin",
- translated_watermark_text: "käännetty"
- };
- case "sv": //swedish
- return {
- context_messagetranslateoption_text: "Översätt meddelande",
- context_messageuntranslateoption_text: "Översätt meddelandet tillbaka",
- context_googletranslateoption_text: "Sök översättning",
- popout_translateoption_text: "Översätt",
- popout_untranslateoption_text: "Översätt tillbaka",
- translated_watermark_text: "översatt"
- };
- case "tr": //turkish
- return {
- context_messagetranslateoption_text: "Mesajı çevir",
- context_messageuntranslateoption_text: "İletiyi geri çevir",
- context_googletranslateoption_text: "Arama tercümesi",
- popout_translateoption_text: "Çevirmek",
- popout_untranslateoption_text: "Geri çevir",
- translated_watermark_text: "tercüme"
- };
- case "cs": //czech
- return {
- context_messagetranslateoption_text: "Přeposlat zprávu",
- context_messageuntranslateoption_text: "Přeposlat zprávu zpátky",
- context_googletranslateoption_text: "Hledat překlad",
- popout_translateoption_text: "Přeposlat",
- popout_untranslateoption_text: "Přeposlat zpět",
- translated_watermark_text: "přeloženo"
- };
- case "bg": //bulgarian
- return {
- context_messagetranslateoption_text: "Преведете на съобщението",
- context_messageuntranslateoption_text: "Преведете съобщението обратно",
- context_googletranslateoption_text: "Търсене на превод",
- popout_translateoption_text: "Превод",
- popout_untranslateoption_text: "Превод обратно",
- translated_watermark_text: "преведена"
- };
- case "ru": //russian
- return {
- context_messagetranslateoption_text: "Перевести сообщение",
- context_messageuntranslateoption_text: "Перевести сообщение обратно",
- context_googletranslateoption_text: "Поиск перевода",
- popout_translateoption_text: "Перевести",
- popout_untranslateoption_text: "Перевести обратно",
- translated_watermark_text: "переведенный"
- };
- case "uk": //ukrainian
- return {
- context_messagetranslateoption_text: "Перекласти повідомлення",
- context_messageuntranslateoption_text: "Перекласти повідомлення назад",
- context_googletranslateoption_text: "Пошук перекладу",
- popout_translateoption_text: "Перекласти",
- popout_untranslateoption_text: "Перекласти назад",
- translated_watermark_text: "перекладений"
- };
- case "ja": //japanese
- return {
- context_messagetranslateoption_text: "メッセージを翻訳する",
- context_messageuntranslateoption_text: "メッセージを翻訳する",
- context_googletranslateoption_text: "翻訳の検索",
- popout_translateoption_text: "翻訳",
- popout_untranslateoption_text: "翻訳する",
- translated_watermark_text: "翻訳された"
- };
- case "zh-TW": //chinese (traditional)
- return {
- context_messagetranslateoption_text: "翻譯消息",
- context_messageuntranslateoption_text: "翻譯消息",
- context_googletranslateoption_text: "搜索翻譯",
- popout_translateoption_text: "翻譯",
- popout_untranslateoption_text: "翻譯回來",
- translated_watermark_text: "翻譯"
- };
- case "ko": //korean
- return {
- context_messagetranslateoption_text: "메시지 번역",
- context_messageuntranslateoption_text: "메시지 번역 뒤로",
- context_googletranslateoption_text: "검색 번역",
- popout_translateoption_text: "다시",
- popout_untranslateoption_text: "다시 번역",
- translated_watermark_text: "번역 된"
- };
- default: //default: english
- return {
- context_messagetranslateoption_text: "Translate Message",
- context_messageuntranslateoption_text: "Untranslate Message",
- context_googletranslateoption_text: "Search translation",
- popout_translateoption_text: "Translate",
- popout_untranslateoption_text: "Untranslate",
- translated_watermark_text: "translated"
- };
- }
- }
- }
-};
diff --git a/PluginsV2/ImageGallery/README.md b/PluginsV2/ImageGallery/README.md
deleted file mode 100644
index 9b3059950a..0000000000
--- a/PluginsV2/ImageGallery/README.md
+++ /dev/null
@@ -1,5 +0,0 @@
-# These Plugins are meant only for BDv2, not BD nor BandagedBD. If you got either of those two go to [Plugins](https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/).
-
-## Image Gallery - [Download Script](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/ImageGallery/index.js) [Download Config](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/ImageGallery/config.json)
-
-Allows the user to browse through images sent inside the same message.
diff --git a/PluginsV2/ImageGallery/config.json b/PluginsV2/ImageGallery/config.json
deleted file mode 100644
index af80ad0f85..0000000000
--- a/PluginsV2/ImageGallery/config.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "info": {
- "name": "ImageGallery",
- "authors": [
- {
- "name": "DevilBro",
- "url": "https://www.paypal.me/MircoWittrien",
- "discord_id": "278543574059057154",
- "github_username": "mwittrien"
- }
- ],
- "version": 1.0,
- "description": "Allows the user to browse through images sent inside the same message. \n\nMy Support Server: http://bit.ly/DevilBrosHaus or https://discordapp.com/invite/Jx3TjNS"
- }
-}
diff --git a/PluginsV2/ImageGallery/index.js b/PluginsV2/ImageGallery/index.js
deleted file mode 100644
index ba18c612c4..0000000000
--- a/PluginsV2/ImageGallery/index.js
+++ /dev/null
@@ -1,206 +0,0 @@
-module.exports = (Plugin, Api, Vendor) => {
- if (!global.BDFDB || typeof BDFDB != "object") global.BDFDB = {myPlugins:{}, BDv2Api: Api};
-
- return class extends Plugin {
- initConstructor () {
- this.patchModules = {
- "ImageModal":["componentDidMount","componentWillUnmount"]
- }
- this.eventFired = false;
-
- this.imageMarkup = `
`;
-
- this.css = `
- .image-gallery ${BDFDB.dotCN.imagewrapper}.prev,
- .image-gallery ${BDFDB.dotCN.imagewrapper}.next {
- position: absolute;
- }
-
- .image-gallery ${BDFDB.dotCN.imagewrapper}.prev {
- right: 90%;
- }
-
- .image-gallery ${BDFDB.dotCN.imagewrapper}.next {
- left: 90%;
- }`;
- }
-
- onStart () {
- if (global.BDFDB && global.BDFDB.myPlugins && typeof global.BDFDB.myPlugins == "object") global.BDFDB.myPlugins[this.name] = this;
- var libraryScript = document.querySelector('head script[src="https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js"]');
- if (!global.BDFDB || typeof BDFDB != "object" || performance.now() - BDFDB.creationTime > 600000) {
- if (libraryScript) libraryScript.remove();
- libraryScript = document.createElement("script");
- libraryScript.setAttribute("type", "text/javascript");
- libraryScript.setAttribute("src", "https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js");
- libraryScript.setAttribute("date", performance.now());
- libraryScript.addEventListener("load", () => {if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();});
- document.head.appendChild(libraryScript);
- }
- else if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();
- this.startTimeout = setTimeout(() => {this.initialize();}, 30000);
- }
-
- initialize () {
- if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
- if (this.started) return true;
- BDFDB.loadMessage(this);
-
- BDFDB.WebModules.forceAllUpdates(this);
-
- return true;
- }
- else {
- console.error(`%c[${this.name}]%c`, 'color: #3a71c1; font-weight: 700;', '', 'Fatal Error: Could not load BD functions!');
- return false;
- }
- }
-
- onStop () {
- if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
- this.closemodal = true;
-
- BDFDB.WebModules.forceAllUpdates(this, "ImageModal");
-
- delete this.closemodal;
-
- document.removeEventListener("keydown", document.keydownImageGalleryListener);
- document.removeEventListener("keyup", document.keyupImageGalleryListener);
-
- BDFDB.unloadMessage(this);
- return true;
- }
- else {
- return false;
- }
- }
-
-
- // begin of own functions
-
- processImageModal (instance, wrapper, methodnames) {
- if (this.closemodal && instance.props && instance.props.onClose) instance.props.onClose();
- else if (methodnames.includes("componentDidMount")) {
- let modal = BDFDB.getParentEle(BDFDB.dotCN.modal, wrapper);
- if (!modal) return;
- let start = performance.now();
- let waitForImg = setInterval(() => {
- let img = modal.querySelector(BDFDB.dotCNS.imagewrapper + "img");
- if (img && img.src) {
- clearInterval(waitForImg);
- let message = this.getMessageGroupOfImage(img);
- if (message) {
- BDFDB.addClass(modal, "image-gallery");
- this.addImages(modal, message.querySelectorAll(BDFDB.dotCNS.imagewrapper + "img"), img);
- }
- }
- else if (performance.now() - start > 10000) {
- clearInterval(waitForImg);
- }
- }, 100);
- }
- else if (methodnames.includes("componentWillUnmount")) {
- document.removeEventListener("keydown", document.keydownImageGalleryListener);
- document.removeEventListener("keyup", document.keyupImageGalleryListener);
- }
- }
-
- getMessageGroupOfImage (thisimg) {
- if (thisimg && thisimg.src) {
- for (let group of document.querySelectorAll(BDFDB.dotCN.messagegroup)) {
- for (let img of group.querySelectorAll(BDFDB.dotCNS.imagewrapper + "img")) {
- if (img.src && this.getSrcOfImage(img) == this.getSrcOfImage(thisimg)) {
- return group;
- }
- }
- }
- }
- return null;
- }
-
- getSrcOfImage (img) {
- return (img.src || (img.querySelector("canvas") ? img.querySelector("canvas").src : "")).split("?width=")[0];
- }
-
- addImages (modal, imgs, img) {
- BDFDB.removeEles(modal.querySelector(`${BDFDB.dotCN.imagewrapper}.prev, ${BDFDB.dotCN.imagewrapper}.next`));
-
- let inner = modal.querySelector(BDFDB.dotCN.modalinner);
-
- if (!inner) return;
-
- var prevImg, nextImg, index;
- for (index = 0; index < imgs.length; index++) {
- if (this.getSrcOfImage(img) == this.getSrcOfImage(imgs[index])) {
- prevImg = imgs[index-1];
- img = imgs[index];
- nextImg = imgs[index+1];
- break;
- }
- }
-
- var imagesrc = this.getSrcOfImage(img);
- modal.querySelector(BDFDB.dotCN.downloadlink).setAttribute("href", imagesrc);
-
- var imagewrapper = modal.querySelector(BDFDB.dotCN.imagewrapper);
- BDFDB.addClass(imagewrapper, "current");
- var imagewrapperimage = imagewrapper.querySelector("img");
- imagewrapperimage.setAttribute("src", imagesrc);
-
- this.resizeImage(modal, img, imagewrapperimage);
-
- if (prevImg) inner.appendChild(this.createImage(modal, imgs, prevImg, "prev"));
- if (nextImg) inner.appendChild(this.createImage(modal, imgs, nextImg, "next"));
-
- document.removeEventListener("keydown", document.keydownImageGalleryListener);
- document.removeEventListener("keyup", document.keyupImageGalleryListener);
- document.keydownImageGalleryListener = e => {this.keyPressed({modal, imgs, prevImg, nextImg}, e);};
- document.keyupImageGalleryListener = e => {this.eventFired = false;};
- document.addEventListener("keydown", document.keydownImageGalleryListener);
- document.addEventListener("keyup", document.keyupImageGalleryListener);
- }
-
- createImage (modal, imgs, img, type) {
- var imagewrapper = BDFDB.htmlToElement(this.imageMarkup);
- BDFDB.addClass(imagewrapper, type);
- imagewrapper.addEventListener("click", () => {this.addImages(modal, imgs, img);});
- var imagewrapperimage = imagewrapper.querySelector("img");
- imagewrapperimage.setAttribute("src", this.getSrcOfImage(img));
- this.resizeImage(modal, img, imagewrapperimage);
- return imagewrapper;
- }
-
- resizeImage (container, src, img) {
- BDFDB.toggleEles(img, false);
- var temp = new Image();
- temp.src = src.src.split("?width=")[0];
- temp.onload = function () {
- var resizeX = (container.clientWidth/src.clientWidth) * 0.71;
- var resizeY = (container.clientHeight/src.clientHeight) * 0.57;
- var resize = resizeX < resizeY ? resizeX : resizeY;
- var newWidth = src.clientWidth * resize;
- var newHeight = src.clientHeight * resize;
- newWidth = temp.width > newWidth ? newWidth : temp.width;
- newHeight = temp.height > newHeight ? newHeight : temp.height;
-
- var wrapper = img.parentElement;
- if (!BDFDB.containsClass(wrapper, "current")) wrapper.style.setProperty("top", (container.clientHeight - newHeight) / 2 + "px");
- wrapper.style.setProperty("width", newWidth + "px");
- wrapper.style.setProperty("height", newHeight + "px");
-
- img.style.setProperty("width", newWidth + "px");
- img.style.setProperty("height", newHeight + "px");
-
- BDFDB.toggleEles(img, true);
- };
- }
-
- keyPressed ({modal, imgs, prevImg, nextImg}, e) {
- if (!this.eventFired) {
- this.eventFired = true;
- if (e.keyCode == 37 && prevImg) this.addImages(modal, imgs, prevImg);
- else if (e.keyCode == 39 && nextImg) this.addImages(modal, imgs, nextImg);
- }
- }
- }
-};
diff --git a/PluginsV2/MessageUtilities/README.md b/PluginsV2/MessageUtilities/README.md
deleted file mode 100644
index d85a8aaa77..0000000000
--- a/PluginsV2/MessageUtilities/README.md
+++ /dev/null
@@ -1,5 +0,0 @@
-# These Plugins are meant only for BDv2, not BD nor BandagedBD. If you got either of those two go to [Plugins](https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/).
-
-## MessageUtilities - [Download Script](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/MessageUtilities/index.js) [Download Config](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/MessageUtilities/config.json)
-
-Offers a number of useful message options. Remap the keybindings in the settings.
diff --git a/PluginsV2/MessageUtilities/config.json b/PluginsV2/MessageUtilities/config.json
deleted file mode 100644
index 7a8c99cf82..0000000000
--- a/PluginsV2/MessageUtilities/config.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "info": {
- "name": "MessageUtilities",
- "authors": [
- {
- "name": "DevilBro",
- "url": "https://www.paypal.me/MircoWittrien",
- "discord_id": "278543574059057154",
- "github_username": "mwittrien"
- }
- ],
- "version": 1.0,
- "description": "Offers a number of useful message options. Remap the keybindings in the settings. \n\nMy Support Server: http://bit.ly/DevilBrosHaus or https://discordapp.com/invite/Jx3TjNS"
- }
-}
diff --git a/PluginsV2/MessageUtilities/index.js b/PluginsV2/MessageUtilities/index.js
deleted file mode 100644
index 3be839c5ca..0000000000
--- a/PluginsV2/MessageUtilities/index.js
+++ /dev/null
@@ -1,377 +0,0 @@
-module.exports = (Plugin, Api, Vendor) => {
- if (!global.BDFDB || typeof BDFDB != "object") global.BDFDB = {myPlugins:{}, BDv2Api: Api};
-
- return class extends Plugin {
- initConstructor () {
- this.bindings = {};
-
- this.firedEvents = [];
-
- this.clickMap = ["CLICK" /*[0]*/, "DBLCLICK" /*[1]*/];
-
- this.keyboardMap = [
- "NONE" /*[0]*/, "" /*[1]*/, "" /*[2]*/, "CANCEL" /*[3]*/, "" /*[4]*/, "" /*[5]*/, "HELP" /*[6]*/, "" /*[7]*/, "BACK_SPACE" /*[8]*/, "TAB" /*[9]*/, "" /*[10]*/, "" /*[11]*/, "CLEAR" /*[12]*/, "ENTER" /*[13]*/, "ENTER_SPECIAL" /*[14]*/, "" /*[15]*/, "SHIFT" /*[16]*/, "CONTROL" /*[17]*/, "ALT" /*[18]*/, "PAUSE" /*[19]*/, "CAPS_LOCK" /*[20]*/, "KANA" /*[21]*/, "EISU" /*[22]*/, "JUNJA" /*[23]*/, "FINAL" /*[24]*/, "HANJA" /*[25]*/, "" /*[26]*/, "ESCAPE" /*[27]*/, "CONVERT" /*[28]*/, "NONCONVERT" /*[29]*/, "ACCEPT" /*[30]*/, "MODECHANGE" /*[31]*/, "SPACE" /*[32]*/, "PAGE_UP" /*[33]*/, "PAGE_DOWN" /*[34]*/, "END" /*[35]*/, "HOME" /*[36]*/, "LEFT" /*[37]*/, "UP" /*[38]*/, "RIGHT" /*[39]*/, "DOWN" /*[40]*/, "SELECT" /*[41]*/, "PRINT" /*[42]*/, "EXECUTE" /*[43]*/, "PRINTSCREEN" /*[44]*/, "INSERT" /*[45]*/, "DELETE" /*[46]*/, "" /*[47]*/,"0" /*[48]*/, "1" /*[49]*/, "2" /*[50]*/, "3" /*[51]*/, "4" /*[52]*/, "5" /*[53]*/, "6" /*[54]*/, "7" /*[55]*/, "8" /*[56]*/, "9" /*[57]*/, "COLON" /*[58]*/, "SEMICOLON" /*[59]*/, "LESS_THAN" /*[60]*/, "EQUALS" /*[61]*/, "GREATER_THAN" /*[62]*/, "QUESTION_MARK" /*[63]*/, "AT" /*[64]*/, "A" /*[65]*/, "B" /*[66]*/, "C" /*[67]*/, "D" /*[68]*/, "E" /*[69]*/, "F" /*[70]*/, "G" /*[71]*/, "H" /*[72]*/, "I" /*[73]*/, "J" /*[74]*/, "K" /*[75]*/, "L" /*[76]*/, "M" /*[77]*/, "N" /*[78]*/, "O" /*[79]*/, "P" /*[80]*/, "Q" /*[81]*/, "R" /*[82]*/, "S" /*[83]*/, "T" /*[84]*/, "U" /*[85]*/, "V" /*[86]*/, "W" /*[87]*/, "X" /*[88]*/, "Y" /*[89]*/, "Z" /*[90]*/, "OS_KEY" /*[91]*/, "" /*[92]*/, "CONTEXT_MENU" /*[93]*/, "" /*[94]*/, "SLEEP" /*[95]*/, "NUMPAD0" /*[96]*/, "NUMPAD1" /*[97]*/, "NUMPAD2" /*[98]*/, "NUMPAD3" /*[99]*/, "NUMPAD4" /*[100]*/, "NUMPAD5" /*[101]*/, "NUMPAD6" /*[102]*/, "NUMPAD7" /*[103]*/, "NUMPAD8" /*[104]*/, "NUMPAD9" /*[105]*/, "MULTIPLY" /*[106]*/, "ADD" /*[107]*/, "SEPARATOR" /*[108]*/, "SUBTRACT" /*[109]*/, "DECIMAL" /*[110]*/, "DIVIDE" /*[111]*/, "F1" /*[112]*/, "F2" /*[113]*/, "F3" /*[114]*/, "F4" /*[115]*/, "F5" /*[116]*/, "F6" /*[117]*/, "F7" /*[118]*/, "F8" /*[119]*/, "F9" /*[120]*/, "F10" /*[121]*/, "F11" /*[122]*/, "F12" /*[123]*/, "F13" /*[124]*/, "F14" /*[125]*/, "F15" /*[126]*/, "F16" /*[127]*/, "F17" /*[128]*/, "F18" /*[129]*/, "F19" /*[130]*/, "F20" /*[131]*/, "F21" /*[132]*/, "F22" /*[133]*/, "F23" /*[134]*/, "F24" /*[135]*/, "" /*[136]*/, "" /*[137]*/, "" /*[138]*/, "" /*[139]*/, "" /*[140]*/, "" /*[141]*/, "" /*[142]*/, "" /*[143]*/, "NUM_LOCK" /*[144]*/, "SCROLL_LOCK" /*[145]*/, "WIN_OEM_FJ_JISHO" /*[146]*/, "WIN_OEM_FJ_MASSHOU" /*[147]*/, "WIN_OEM_FJ_TOUROKU" /*[148]*/, "WIN_OEM_FJ_LOYA" /*[149]*/, "WIN_OEM_FJ_ROYA" /*[150]*/, "" /*[151]*/, "" /*[152]*/, "" /*[153]*/, "" /*[154]*/, "" /*[155]*/, "" /*[156]*/, "" /*[157]*/, "" /*[158]*/, "" /*[159]*/, "CIRCUMFLEX" /*[160]*/, "EXCLAMATION" /*[161]*/, "DOUBLE_QUOTE" /*[162]*/, "HASH" /*[163]*/, "DOLLAR" /*[164]*/, "PERCENT" /*[165]*/, "AMPERSAND" /*[166]*/, "UNDERSCORE" /*[167]*/, "OPEN_PAREN" /*[168]*/, "CLOSE_PAREN" /*[169]*/, "ASTERISK" /*[170]*/, "PLUS" /*[171]*/, "PIPE" /*[172]*/, "HYPHEN_MINUS" /*[173]*/, "OPEN_CURLY_BRACKET" /*[174]*/, "CLOSE_CURLY_BRACKET" /*[175]*/, "TILDE" /*[176]*/, "" /*[177]*/, "" /*[178]*/, "" /*[179]*/, "" /*[180]*/, "VOLUME_MUTE" /*[181]*/, "VOLUME_DOWN" /*[182]*/, "VOLUME_UP" /*[183]*/, "" /*[184]*/, "" /*[185]*/, "SEMICOLON" /*[186]*/, "EQUALS" /*[187]*/, "COMMA" /*[188]*/, "MINUS" /*[189]*/, "PERIOD" /*[190]*/, "SLASH" /*[191]*/, "BACK_QUOTE" /*[192]*/, "" /*[193]*/, "" /*[194]*/, "" /*[195]*/, "" /*[196]*/, "" /*[197]*/, "" /*[198]*/, "" /*[199]*/, "" /*[200]*/, "" /*[201]*/, "" /*[202]*/, "" /*[203]*/, "" /*[204]*/, "" /*[205]*/, "" /*[206]*/, "" /*[207]*/, "" /*[208]*/, "" /*[209]*/, "" /*[210]*/, "" /*[211]*/, "" /*[212]*/, "" /*[213]*/, "" /*[214]*/, "" /*[215]*/, "" /*[216]*/, "" /*[217]*/, "" /*[218]*/, "OPEN_BRACKET" /*[219]*/, "BACK_SLASH" /*[220]*/, "CLOSE_BRACKET" /*[221]*/, "QUOTE" /*[222]*/, "" /*[223]*/, "META" /*[224]*/, "ALTGR" /*[225]*/, "" /*[226]*/, "WIN_ICO_HELP" /*[227]*/, "WIN_ICO_00" /*[228]*/, "" /*[229]*/, "WIN_ICO_CLEAR" /*[230]*/, "" /*[231]*/,"" /*[232]*/, "WIN_OEM_RESET" /*[233]*/, "WIN_OEM_JUMP" /*[234]*/, "WIN_OEM_PA1" /*[235]*/, "WIN_OEM_PA2" /*[236]*/, "WIN_OEM_PA3" /*[237]*/, "WIN_OEM_WSCTRL" /*[238]*/,"WIN_OEM_CUSEL" /*[239]*/, "WIN_OEM_ATTN" /*[240]*/, "WIN_OEM_FINISH" /*[241]*/, "WIN_OEM_COPY" /*[242]*/, "WIN_OEM_AUTO" /*[243]*/, "WIN_OEM_ENLW" /*[244]*/, "WIN_OEM_BACKTAB" /*[245]*/, "ATTN" /*[246]*/, "CRSEL" /*[247]*/, "EXSEL" /*[248]*/, "EREOF" /*[249]*/, "PLAY" /*[250]*/, "ZOOM" /*[251]*/, "" /*[252]*/, "PA1" /*[253]*/, "WIN_OEM_CLEAR" /*[254]*/, "" /*[255]*/
- ];
-
- this.clicks = ["click"];
- this.keys = ["key1","key2"];
- this.defaults = {
- settings: {
- "clearOnEscape": {value:true, description:"Clear chat input when Escape is pressed:"},
- "Edit_Message": {value:true},
- "Delete_Message": {value:true},
- "Pin/Unpin_Message": {value:true},
- "React_to_Message": {value:true},
- "__Note_Message": {value:false},
- "__Translate_Message": {value:false},
- "__Quote_Message": {value:false},
- "__Citate_Message": {value:false}
- },
- bindings: {
- "Edit_Message": {name:"Edit Message", func:this.doEdit, value:{click:1, key1:0, key2:0}},
- "Delete_Message": {name:"Delete Message", func:this.doDelete, value:{click:0, key1:46, key2:0}},
- "Pin/Unpin_Message": {name:"Pin/Unpin Message", func:this.doPinUnPin, value:{click:0, key1:17, key2:0}},
- "React_to_Message": {name:"React to Message", func:this.doOpenReact, value:{click:0, key1:9, key2:0}},
- "__Note_Message": {name:"Note Message (Pesonal Pins)", func:this.doNote, value:{click:0, key1:16, key2:0}, plugin:"PersonalPins"},
- "__Translate_Message": {name:"Translate Message (Google Translate Option)", func:this.doTranslate, value:{click:0, key1:20, key2:0}, plugin:"GoogleTranslateOption"},
- "__Quote_Message": {name:"Quote Message (Quoter)", func:this.doQuote, value:{click:0, key1:113, key2:0}, plugin:"Quoter"},
- "__Citate_Message": {name:"Quote Message (Citador)", func:this.doCitate, value:{click:0, key1:114, key2:0}, plugin:"Citador"}
- }
- };
- }
-
- onStart () {
- if (global.BDFDB && global.BDFDB.myPlugins && typeof global.BDFDB.myPlugins == "object") global.BDFDB.myPlugins[this.name] = this;
- var libraryScript = document.querySelector('head script[src="https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js"]');
- if (!global.BDFDB || typeof BDFDB != "object" || performance.now() - BDFDB.creationTime > 600000) {
- if (libraryScript) libraryScript.remove();
- libraryScript = document.createElement("script");
- libraryScript.setAttribute("type", "text/javascript");
- libraryScript.setAttribute("src", "https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js");
- libraryScript.setAttribute("date", performance.now());
- libraryScript.addEventListener("load", () => {if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();});
- document.head.appendChild(libraryScript);
- }
- else if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();
- this.startTimeout = setTimeout(() => {this.initialize();}, 30000);
- }
-
- initialize () {
- if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
- if (this.started) return true;
- BDFDB.loadMessage(this);
-
- this.ChannelUtils = BDFDB.WebModules.findByProperties("getChannels","getChannel");
- this.MessageActions = BDFDB.WebModules.findByProperties("startEditMessage", "endEditMessage");
- this.PinActions = BDFDB.WebModules.findByProperties("pinMessage", "unpinMessage");
- this.CurrentUserPerms = BDFDB.WebModules.findByProperties("getChannelPermissions", "can");
- this.Permissions = BDFDB.WebModules.findByProperties("Permissions", "ActivityTypes").Permissions
-
- BDFDB.addEventListener(this, document, "click", BDFDB.dotCNC.message + BDFDB.dotCN.messagesystem, e => {
- this.onClick(e.currentTarget, 0, "onSglClick");
- })
- BDFDB.addEventListener(this, document, "dblclick", BDFDB.dotCNC.message + BDFDB.dotCN.messagesystem, e => {
- this.onClick(e.currentTarget, 1, "onDblClick");
- });
- BDFDB.addEventListener(this, document, "keydown", BDFDB.dotCN.textareawrapchat, e => {
- this.onKeyDown(e.currentTarget, e.which, "onKeyDown");
- });
-
- return true;
- }
- else {
- console.error(`%c[${this.name}]%c`, 'color: #3a71c1; font-weight: 700;', '', 'Fatal Error: Could not load BD functions!');
- return false;
- }
- }
-
- onStop () {
- if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
- BDFDB.unloadMessage(this);
- return true;
- }
- else {
- return false;
- }
- }
-
-
- //begin of own functions
-
- resetAll (settingspanel) {
- BDFDB.openConfirmModal(this, "Are you sure you want to delete all key bindings?", () => {
- BDFDB.removeAllData(this, "bindings");
- let bindings = BDFDB.getAllData(this, "bindings");
- settingspanel.querySelectorAll(BDFDB.dotCN.select).forEach((wrap) => {
- let action = wrap.getAttribute("type");
- let option = wrap.getAttribute("option");
- wrap.setAttribute("value", bindings[action][option]);
- wrap.querySelector(BDFDB.dotCN.title).innerText = this.clickMap[bindings[action][option]];
- });
- settingspanel.querySelectorAll(BDFDB.dotCN.hotkeycontainer).forEach((wrap) => {
- let action = wrap.getAttribute("type");
- let option = wrap.getAttribute("option");
- wrap.setAttribute("value", bindings[action][option]);
- wrap.querySelector("input").setAttribute("value", this.keyboardMap[bindings[action][option]]);
- });
- });
- }
-
- openDropdownMenu (e) {
- let selectControl = e.currentTarget;
- let selectWrap = selectControl.parentElement;
- let plugincard = BDFDB.getParentEle("li", selectWrap);
-
- if (!plugincard || BDFDB.containsClass(selectWrap, BDFDB.disCN.selectisopen)) return;
-
- BDFDB.addClass(selectWrap, BDFDB.disCN.selectisopen);
- plugincard.style.setProperty("overflow", "visible", "important");
-
- let action = selectWrap.getAttribute("type");
- let option = selectWrap.getAttribute("option");
- let value = selectWrap.getAttribute("value");
-
- let selectMenu = this.createDropdownMenu(action, value);
- selectWrap.appendChild(selectMenu);
-
- BDFDB.addChildEventListener(selectMenu, "mousedown", BDFDB.dotCN.selectoption, e2 => {
- let binding = BDFDB.getData(action, this, "bindings");
- let selection = e2.currentTarget.getAttribute("value");
- selectWrap.setAttribute("value", selection);
- selectControl.querySelector(BDFDB.dotCN.title).innerText = e2.currentTarget.textContent;
- binding[option] = parseInt(selection);
- BDFDB.saveData(action, binding, this, "bindings");
- });
-
- var removeMenu = e2 => {
- if (e2.target.parentElement != selectMenu) {
- document.removeEventListener("mousedown", removeMenu);
- selectMenu.remove();
- plugincard.style.removeProperty("overflow");
- setTimeout(() => {BDFDB.removeClass(selectWrap, BDFDB.disCN.selectisopen);},100);
- }
- };
- document.addEventListener("mousedown", removeMenu);
- }
-
- createDropdownMenu (action, value) {
- let menuhtml = ``;
- return BDFDB.htmlToElement(menuhtml);
- }
-
- startRecording (settingspanel, e) {
- let recorderWrap = e.currentTarget;
- if (BDFDB.containsClass(recorderWrap, BDFDB.disCN.hotkeyrecording)) return;
-
- let recorderInput = recorderWrap.querySelector("input");
- let recorderText = recorderWrap.querySelector(BDFDB.dotCN.hotkeytext);
- let action = recorderWrap.getAttribute("type");
- let option = recorderWrap.getAttribute("option");
-
- BDFDB.addClass(recorderWrap, BDFDB.disCN.hotkeyrecording);
- BDFDB.removeClass(recorderWrap, BDFDB.disCN.hotkeyhasvalue);
- recorderText.innerText = BDFDB.LanguageStrings.SHORTCUT_RECORDER_BUTTON_RECORDING;
-
-
- var saveRecording = e => {
- recorderWrap.setAttribute("value", e.which);
- recorderInput.setAttribute("value", this.keyboardMap[e.which]);
- };
-
- var stopRecording = e => {
- document.removeEventListener("mousedown", stopRecording);
- document.removeEventListener("keydown", saveRecording);
- let binding = BDFDB.getData(action, this, "bindings");
- binding[option] = parseInt(recorderWrap.getAttribute("value"));
- BDFDB.saveData(action, binding, this, "bindings");
- setTimeout(() => {
- BDFDB.removeClass(recorderWrap, BDFDB.disCN.hotkeyrecording);
- BDFDB.addClass(recorderWrap, BDFDB.disCN.hotkeyhasvalue);
- recorderText.innerText = BDFDB.LanguageStrings.SHORTCUT_RECORDER_BUTTON_EDIT;
- },100);
- };
-
- document.addEventListener("mousedown", stopRecording);
- document.addEventListener("keydown", saveRecording);
- }
-
- resetRecorder (settingspanel, e) {
- let resetButton = e.currentTarget;
- let recorderWrap = e.currentTarget.parentElement.parentElement.querySelector(BDFDB.dotCN.hotkeycontainer);
- let recorderInput = recorderWrap.querySelector("input");
- let action = recorderWrap.getAttribute("type");
- let option = recorderWrap.getAttribute("option");
- recorderWrap.setAttribute("value", 0);
- recorderInput.setAttribute("value", this.keyboardMap[0]);
- let binding = BDFDB.getData(action, this, "bindings");
- binding[option] = parseInt(recorderWrap.getAttribute("value"));
- BDFDB.saveData(action, binding, this, "bindings");
- }
-
- onClick (div, click, name) {
- if (!this.isEventFired(name)) {
- this.fireEvent(name);
- let settings = BDFDB.getAllData(this, "settings");
- let bindings = BDFDB.getAllData(this, "bindings");
- for (let action in bindings) {
- if (settings[action] && this.checkIfBindingIsValid(bindings[action], click)) {
- let {messagediv, pos, message} = this.getMessageData(div);
- if (messagediv && pos > -1 && message) this.defaults.bindings[action].func.bind(this)({messagediv, pos, message});
- break;
- }
- }
- this.cancelEvent(name);
- }
- }
-
- checkIfBindingIsValid (binding, doneclick) {
- let valid = true;
- for (let click of this.clicks) {
- if (binding[click] != doneclick) valid = false;
- }
- for (let key of this.keys) {
- if (!BDFDB.pressedKeys.includes(binding[key]) && binding[key] != 0) valid = false;
- }
- return valid;
- }
-
- doDelete ({messagediv, pos, message}) {
- let channel = this.ChannelUtils.getChannel(message.channel_id);
- if ((channel && this.CurrentUserPerms.can(this.Permissions.MANAGE_MESSAGES, channel)) || message.author.id == BDFDB.myData.id) {
- this.MessageActions.deleteMessage(message.channel_id, message.id);
- }
- }
-
- doEdit ({messagediv, pos, message}) {
- if (message.author.id == BDFDB.myData.id && !messagediv.querySelector("textarea")) {
- this.MessageActions.startEditMessage(message.channel_id, message.id, message.content);
- }
- }
-
- doOpenReact ({messagediv, pos, message}) {
- let reactButton = messagediv.querySelector(BDFDB.dotCN.emojipickerbutton);
- if (reactButton) reactButton.click();
- }
-
- doPinUnPin ({messagediv, pos, message}) {
- let channel = this.ChannelUtils.getChannel(message.channel_id);
- if (channel && this.CurrentUserPerms.can(this.Permissions.MANAGE_MESSAGES, channel)) {
- if (message.pinned) this.PinActions.unpinMessage(channel, message.id);
- else this.PinActions.pinMessage(channel, message.id);
- }
- }
-
- doNote ({messagediv, pos, message}) {
- if (BDFDB.isPluginEnabled(this.defaults.bindings.__Note_Message.plugin)) {
- let channel = this.ChannelUtils.getChannel(message.channel_id);
- if (channel) bdplugins[this.defaults.bindings.__Note_Message.plugin].plugin.addMessageToNotes(message, messagediv, channel);
- }
- }
-
- doTranslate ({messagediv, pos, message}) {
- if (BDFDB.isPluginEnabled(this.defaults.bindings.__Translate_Message.plugin)) {
- let channel = this.ChannelUtils.getChannel(message.channel_id);
- if (channel) bdplugins[this.defaults.bindings.__Translate_Message.plugin].plugin.translateMessage(message, messagediv, channel);
- }
- }
-
- doQuote ({messagediv, pos, message}) {
- if (BDFDB.isPluginEnabled(this.defaults.bindings.__Quote_Message.plugin)) {
- let quoteButton = messagediv.querySelector(".btn-quote");
- if (quoteButton) quoteButton.click();
- }
- }
-
- doCitate ({messagediv, pos, message}) {
- if (BDFDB.isPluginEnabled(this.defaults.bindings.__Citate_Message.plugin)) {
- let citarButton = messagediv.parentElement.querySelector(".citar-btn");
- if (citarButton) citarButton.click();
- }
- }
-
- onKeyDown (div, key, name) {
- if (!this.isEventFired(name)) {
- this.fireEvent(name);
- if (key == 27 && BDFDB.getData("clearOnEscape", this, "settings")) {
- let instance = BDFDB.getOwnerInstance({"node":div, "name":"ChannelTextAreaForm", "up":true});
- if (instance) {
- instance.setState({textValue:""});
- }
- }
- this.cancelEvent(name);
- }
- }
-
- getActiveShortcutString (action) {
- let str = "";
- if (BDFDB.getData(action, this, "settings")) {
- let binding = BDFDB.getData(action, this, "bindings");
- if (binding) for (let type in binding) {
- let typename = type.indexOf("click") == 0 ? this.clickMap[binding[type]] : this.keyboardMap[binding[type]];
- if (typename && typename != "NONE") str += typename + "+";
- }
- }
- return str ? str.slice(0,-1) : null;
- }
-
- getMessageData (target) {
- let messagediv = BDFDB.getParentEle(BDFDB.dotCN.message, target);
- let pos = messagediv ? Array.from(messagediv.parentElement.querySelectorAll(BDFDB.dotCN.message)).indexOf(messagediv) : -1;
- let instance = BDFDB.getReactInstance(messagediv);
- let message = instance && instance.return && instance.return.memoizedProps && instance.return.memoizedProps.message ? instance.return.memoizedProps.message : null;
- return {messagediv, pos, message};
- }
-
- fireEvent (name) {
- this.firedEvents.push(name);
- }
-
- isEventFired (name) {
- return this.firedEvents.includes(name);
- }
-
- cancelEvent (name) {
- BDFDB.removeFromArray(this.firedEvents, name);
- }
-
- getSettingsPanel () {
- if (!global.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
- let settings = BDFDB.getAllData(this, "settings");
- let bindings = BDFDB.getAllData(this, "bindings");
- let settingshtml = `
${this.name}
`;
- for (let key in settings) {
- if (this.defaults.settings[key].description) settingshtml += `
`;
- }
- for (let action in bindings) {
- if (!this.defaults.bindings[action].plugin || BDFDB.isPluginEnabled(this.defaults.bindings[action].plugin)) {
- settingshtml += `
`;
- for (let click of this.clicks) {
- settingshtml += `
${click}: ${this.clickMap[bindings[action][click]]}
`;
- }
- for (let key of this.keys) {
- settingshtml += `
`;
- }
- settingshtml += `
`;
- }
- }
- settingshtml += `
Reset all key bindings. Reset
`;
- settingshtml += `
`;
-
- let settingspanel = BDFDB.htmlToElement(settingshtml);
-
- BDFDB.initElements(settingspanel, this);
-
- BDFDB.addEventListener(this, settingspanel, "click", BDFDB.dotCN.selectcontrol, e => {this.openDropdownMenu(e);})
- BDFDB.addEventListener(this, settingspanel, "click", BDFDB.dotCN.hotkeycontainer, e => {this.startRecording(settingspanel, e);})
- BDFDB.addEventListener(this, settingspanel, "click", ".reset-recorder", e => {this.resetRecorder(settingspanel, e);})
- BDFDB.addEventListener(this, settingspanel, "click", ".reset-button", () => {this.resetAll(settingspanel);});
-
- return settingspanel;
- }
- }
-};
diff --git a/PluginsV2/MoveablePopups/README.md b/PluginsV2/MoveablePopups/README.md
deleted file mode 100644
index 689a8939dc..0000000000
--- a/PluginsV2/MoveablePopups/README.md
+++ /dev/null
@@ -1,5 +0,0 @@
-# These Plugins are meant only for BDv2, not BD nor BandagedBD. If you got either of those two go to [Plugins](https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/).
-
-## Moveable Popups - [Download Script](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/MoveablePopups/index.js) [Download Config](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/MoveablePopups/config.json)
-
-Adds the feature to move all popups and modals around like on a normal desktop. Ctrl + drag with your left mousebutton to drag element.
diff --git a/PluginsV2/MoveablePopups/config.json b/PluginsV2/MoveablePopups/config.json
deleted file mode 100644
index 5d74caeab6..0000000000
--- a/PluginsV2/MoveablePopups/config.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "info": {
- "name": "MoveablePopups",
- "authors": [
- {
- "name": "DevilBro",
- "url": "https://www.paypal.me/MircoWittrien",
- "discord_id": "278543574059057154",
- "github_username": "mwittrien"
- }
- ],
- "version": 1.0,
- "description": "Adds the feature to move all popups and modals around like on a normal desktop. Ctrl + drag with your left mousebutton to drag element. \n\nMy Support Server: http://bit.ly/DevilBrosHaus or https://discordapp.com/invite/Jx3TjNS"
- }
-}
diff --git a/PluginsV2/MoveablePopups/index.js b/PluginsV2/MoveablePopups/index.js
deleted file mode 100644
index 04ce7f479a..0000000000
--- a/PluginsV2/MoveablePopups/index.js
+++ /dev/null
@@ -1,124 +0,0 @@
-module.exports = (Plugin, Api, Vendor) => {
- if (!global.BDFDB || typeof BDFDB != "object") global.BDFDB = {myPlugins:{}, BDv2Api: Api};
-
- return class extends Plugin {
- onStart () {
- if (global.BDFDB && global.BDFDB.myPlugins && typeof global.BDFDB.myPlugins == "object") global.BDFDB.myPlugins[this.name] = this;
- var libraryScript = document.querySelector('head script[src="https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js"]');
- if (!global.BDFDB || typeof BDFDB != "object" || performance.now() - BDFDB.creationTime > 600000) {
- if (libraryScript) libraryScript.remove();
- libraryScript = document.createElement("script");
- libraryScript.setAttribute("type", "text/javascript");
- libraryScript.setAttribute("src", "https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js");
- libraryScript.setAttribute("date", performance.now());
- libraryScript.addEventListener("load", () => {if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();});
- document.head.appendChild(libraryScript);
- }
- else if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();
- this.startTimeout = setTimeout(() => {this.initialize();}, 30000);
- }
-
- initialize () {
- if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
- if (this.started) return true;
- BDFDB.loadMessage(this);
-
- var observer = null;
-
- observer = new MutationObserver((changes, _) => {
- changes.forEach(
- (change, i) => {
- if (change.addedNodes) {
- change.addedNodes.forEach((node) => {
- if (node && BDFDB.containsClass(node, BDFDB.disCN.popout)) {
- this.makeMoveable(node);
- }
- });
- }
- }
- );
- });
- BDFDB.addObserver(this, BDFDB.dotCN.popouts, {name:"popoutObserver",instance:observer}, {childList: true});
-
- observer = new MutationObserver((changes, _) => {
- changes.forEach(
- (change, i) => {
- if (change.addedNodes) {
- change.addedNodes.forEach((node) => {
- if (node && BDFDB.containsClass(node, BDFDB.disCN.modal) && !node.querySelector(BDFDB.dotCN.downloadlink)) {
- this.makeMoveable(node.querySelector(BDFDB.dotCN.modalinner));
- }
- else if (node.tagName && node.querySelector(BDFDB.dotCN.modal) && !node.querySelector(BDFDB.dotCN.downloadlink)) {
- this.makeMoveable(node.querySelector(BDFDB.dotCN.modalinner));
- }
- });
- }
- }
- );
- });
- BDFDB.addObserver(this, BDFDB.dotCN.app + " ~ [class^='theme-']:not([class*='popouts'])", {name:"modalObserver",instance:observer}, {childList: true});
-
- return true;
- }
- else {
- console.error(`%c[${this.name}]%c`, 'color: #3a71c1; font-weight: 700;', '', 'Fatal Error: Could not load BD functions!');
- return false;
- }
- }
-
-
- onStop () {
- if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
- BDFDB.unloadMessage(this);
- return true;
- }
- else {
- return false;
- }
- }
-
-
- // begin of own functions
-
- makeMoveable (div) {
- div.removeEventListener("click", div.clickMovablePopups);
- div.removeEventListener("mousedown", div.mousedownMovablePopups);
- div.clickMovablePopups = e => {
- if (this.dragging) {
- e.stopPropagation();
- e.preventDefault();
- }
- };
- div.mousedownMovablePopups = e => {
- if (!e.ctrlKey) return;
- div.style.setProperty("position", "fixed", "important");
- this.dragging = true;
- var rects = BDFDB.getRects(div);
- var transform = getComputedStyle(div,null).getPropertyValue("transform").replace(/[^0-9,-]/g,"").split(",");
- var left = rects.left - (transform.length > 4 ? parseFloat(transform[4]) : 0);
- var top = rects.top - (transform.length > 4 ? parseFloat(transform[5]) : 0);
- var oldX = e.pageX;
- var oldY = e.pageY;
- var mouseup = e2 => {
- BDFDB.removeLocalStyle("disableTextSelection");
- document.removeEventListener("mouseup", mouseup);
- document.removeEventListener("mousemove", mousemove);
- setTimeout(() => {this.dragging = false},1);
- };
- var mousemove = e2 => {
- left = left - (oldX - e2.pageX);
- top = top - (oldY - e2.pageY);
- oldX = e2.pageX;
- oldY = e2.pageY;
- div.style.setProperty("left", left + "px", "important");
- div.style.setProperty("top", top + "px", "important");
-
- };
- document.addEventListener("mouseup", mouseup);
- document.addEventListener("mousemove", mousemove);
- };
- div.addEventListener("click", div.clickMovablePopups);
- div.addEventListener("mousedown", div.mousedownMovablePopups);
- }
- }
-};
diff --git a/PluginsV2/NotificationSounds/README.md b/PluginsV2/NotificationSounds/README.md
deleted file mode 100644
index 9dc1ec0a93..0000000000
--- a/PluginsV2/NotificationSounds/README.md
+++ /dev/null
@@ -1,5 +0,0 @@
-# These Plugins are meant only for BDv2, not BD nor BandagedBD. If you got either of those two go to [Plugins](https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/).
-
-## Notification Sounds - [Download Script](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/NotificationSounds/index.js) [Download Config](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/NotificationSounds/config.json)
-
-Allows you to replace the native sounds of Discord with your own.
diff --git a/PluginsV2/NotificationSounds/config.json b/PluginsV2/NotificationSounds/config.json
deleted file mode 100644
index 54f83b2df3..0000000000
--- a/PluginsV2/NotificationSounds/config.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "info": {
- "name": "NotificationSounds",
- "authors": [
- {
- "name": "DevilBro",
- "url": "https://www.paypal.me/MircoWittrien",
- "discord_id": "278543574059057154",
- "github_username": "mwittrien"
- }
- ],
- "version": 1.0,
- "description": "Allows you to replace the native sounds of Discord with your own. \n\nMy Support Server: http://bit.ly/DevilBrosHaus or https://discordapp.com/invite/Jx3TjNS"
- }
-}
diff --git a/PluginsV2/NotificationSounds/index.js b/PluginsV2/NotificationSounds/index.js
deleted file mode 100644
index 5b824a6e8f..0000000000
--- a/PluginsV2/NotificationSounds/index.js
+++ /dev/null
@@ -1,472 +0,0 @@
-module.exports = (Plugin, Api, Vendor) => {
- if (!global.BDFDB || typeof BDFDB != "object") global.BDFDB = {myPlugins:{}, BDv2Api: Api};
-
- return class extends Plugin {
- initConstructor () {
- this.patchModules = {
- "IncomingCalls":"componentDidMount",
- "PrivateChannelCall":"componentDidMount"
- };
-
- this.types = {
- "message1": {implemented:true, name:"New Chatmessage", src:"/assets/dd920c06a01e5bb8b09678581e29d56f.mp3", mute:true},
- "dm": {implemented:true, name:"Direct Message", src:"/assets/84c9fa3d07da865278bd77c97d952db4.mp3", mute:true},
- "mentioned": {implemented:true, name:"Mention Ping", src:"/assets/a5f42064e8120e381528b14fd3188b72.mp3", mute:true},
- "deafen": {implemented:true, name:"Voicechat Deafen", src:"/assets/e4d539271704b87764dc465b1a061abd.mp3", mute:false},
- "mute": {implemented:true, name:"Voicechat Mute", src:"/assets/429d09ee3b86e81a75b5e06d3fb482be.mp3", mute:false},
- "disconnect": {implemented:true, name:"Voicechat Disconnect", src:"/assets/7e125dc075ec6e5ae796e4c3ab83abb3.mp3", mute:false},
- "undeafen": {implemented:true, name:"Voicechat Undeafen", src:"/assets/5a000a0d4dff083d12a1d4fc2c7cbf66.mp3", mute:false},
- "unmute": {implemented:true, name:"Voicechat Unmute", src:"/assets/43805b9dd757ac4f6b9b58c1a8ee5f0d.mp3", mute:false},
- "user_join": {implemented:true, name:"Voicechat User Joined", src:"/assets/5dd43c946894005258d85770f0d10cff.mp3", mute:false},
- "user_leave": {implemented:true, name:"Voicechat User Left", src:"/assets/4fcfeb2cba26459c4750e60f626cebdc.mp3", mute:false},
- "user_moved": {implemented:true, name:"Voicechat User Moved", src:"/assets/e81d11590762728c1b811eadfa5be766.mp3", mute:false},
- "ptt_start": {implemented:true, name:"Push2Talk Start", src:"/assets/8b63833c8d252fedba6b9c4f2517c705.mp3", mute:false},
- "ptt_stop": {implemented:true, name:"Push2Talk Stop", src:"/assets/74ab980d6890a0fa6aa0336182f9f620.mp3", mute:false},
- "call_calling": {implemented:true, name:"Outgoing Call", src:"/assets/c6e92752668dde4eee5923d70441579f.mp3", mute:false},
- "call_ringing": {implemented:true, name:"Incoming Call", src:"/assets/84a1b4e11d634dbfa1e5dd97a96de3ad.mp3", mute:true},
- "call_ringing_beat": {implemented:false, name:"Incoming Call Beat", src:"/assets/b9411af07f154a6fef543e7e442e4da9.mp3", mute:true},
- "ddr-down": {implemented:true, name:"HotKeys Window Down", src:"/assets/71f048f8aa7d4b24bf4268a87cbbb192.mp3", mute:true},
- "ddr-left": {implemented:true, name:"HotKeys Window Left", src:"/assets/1de04408e62b5d52ae3ebbb91e9e1978.mp3", mute:true},
- "ddr-right": {implemented:true, name:"HotKeys Window Right", src:"/assets/2c0433f93db8449e4a82b76dc520cb29.mp3", mute:true},
- "ddr-up": {implemented:true, name:"HotKeys Window Up", src:"/assets/68472713f7a62c7c37e0a6a5d5a1faeb.mp3", mute:true},
- "human_man": {implemented:false, name:"Human Man Voice", src:"/assets/a37dcd6272ae41cf49295d58c9806fe3.mp3", mute:true},
- "mention1": {implemented:false, name:"Mention Ping 1", src:"/assets/fa4d62c3cbc80733bf1f01b9c6f181de.mp3", mute:true},
- "mention2": {implemented:false, name:"Mention Ping 2", src:"/assets/a5f42064e8120e381528b14fd3188b72.mp3", mute:true},
- "mention3": {implemented:false, name:"Mention Ping 3", src:"/assets/84c9fa3d07da865278bd77c97d952db4.mp3", mute:true},
- "message2": {implemented:false, name:"New Chatmessage 2", src:"/assets/15fe810f6cfab609c7fcda61652b9b34.mp3", mute:true},
- "message3": {implemented:false, name:"New Chatmessage 3", src:"/assets/53ce6a92d3c233e8b4ac529d34d374e4.mp3", mute:true},
- "overlayunlock": {implemented:false, name:"Overlay Unlocked", src:"/assets/ad322ffe0a88436296158a80d5d11baa.mp3", mute:true},
- "reconnect": {implemented:false, name:"Voicechat Reconnect", src:"/assets/471cfd0005b112ff857705e894bf41a6.mp3", mute:true},
- "robot_man": {implemented:false, name:"Robot Man Voice", src:"/assets/66598bea6e59eb8acdf32cf2d9d75ba9.mp3", mute:true}
- };
-
- this.defaults = {
- "---": {
- "---": 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": {
- "HotKeys Window Down": "/assets/71f048f8aa7d4b24bf4268a87cbbb192.mp3",
- "HotKeys Window Left": "/assets/1de04408e62b5d52ae3ebbb91e9e1978.mp3",
- "HotKeys Window Right": "/assets/2c0433f93db8449e4a82b76dc520cb29.mp3",
- "HotKeys Window Up": "/assets/68472713f7a62c7c37e0a6a5d5a1faeb.mp3",
- "Human Man Voice": "/assets/a37dcd6272ae41cf49295d58c9806fe3.mp3",
- "Incoming Call": "/assets/84a1b4e11d634dbfa1e5dd97a96de3ad.mp3",
- "Incoming Call Beat": "/assets/b9411af07f154a6fef543e7e442e4da9.mp3",
- "Mention Ping 1": "/assets/fa4d62c3cbc80733bf1f01b9c6f181de.mp3",
- "Mention Ping 2": "/assets/a5f42064e8120e381528b14fd3188b72.mp3",
- "Mention Ping 3": "/assets/84c9fa3d07da865278bd77c97d952db4.mp3",
- "New Chatmessage 1": "/assets/dd920c06a01e5bb8b09678581e29d56f.mp3",
- "New Chatmessage 2": "/assets/15fe810f6cfab609c7fcda61652b9b34.mp3",
- "New Chatmessage 3": "/assets/53ce6a92d3c233e8b4ac529d34d374e4.mp3",
- "Outgoing Call": "/assets/c6e92752668dde4eee5923d70441579f.mp3",
- "Overlay Unlocked": "/assets/ad322ffe0a88436296158a80d5d11baa.mp3",
- "Push2Talk Start": "/assets/8b63833c8d252fedba6b9c4f2517c705.mp3",
- "Push2Talk Stop": "/assets/74ab980d6890a0fa6aa0336182f9f620.mp3",
- "Robot Man Voice": "/assets/66598bea6e59eb8acdf32cf2d9d75ba9.mp3",
- "Voicechat Deafen": "/assets/e4d539271704b87764dc465b1a061abd.mp3",
- "Voicechat Disconnect": "/assets/7e125dc075ec6e5ae796e4c3ab83abb3.mp3",
- "Voicechat Mute": "/assets/429d09ee3b86e81a75b5e06d3fb482be.mp3",
- "Voicechat Undeafen": "/assets/5a000a0d4dff083d12a1d4fc2c7cbf66.mp3",
- "Voicechat Unmute": "/assets/43805b9dd757ac4f6b9b58c1a8ee5f0d.mp3",
- "Voicechat User Joined": "/assets/5dd43c946894005258d85770f0d10cff.mp3",
- "Voicechat User Left": "/assets/4fcfeb2cba26459c4750e60f626cebdc.mp3",
- "Voicechat User Moved": "/assets/e81d11590762728c1b811eadfa5be766.mp3",
- "Voicechat Reconnect": "/assets/471cfd0005b112ff857705e894bf41a6.mp3"
- }
- };
-
- this.settingsaudio = new Audio();
-
- this.audios = {};
-
- this.choices = [];
-
- this.firedEvents = {};
- }
-
- onStart () {
- if (global.BDFDB && global.BDFDB.myPlugins && typeof global.BDFDB.myPlugins == "object") global.BDFDB.myPlugins[this.name] = this;
- var libraryScript = document.querySelector('head script[src="https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js"]');
- if (!global.BDFDB || typeof BDFDB != "object" || performance.now() - BDFDB.creationTime > 600000) {
- if (libraryScript) libraryScript.remove();
- libraryScript = document.createElement("script");
- libraryScript.setAttribute("type", "text/javascript");
- libraryScript.setAttribute("src", "https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js");
- libraryScript.setAttribute("date", performance.now());
- libraryScript.addEventListener("load", () => {if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();});
- document.head.appendChild(libraryScript);
- }
- else if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();
- this.startTimeout = setTimeout(() => {this.initialize();}, 30000);
- }
-
- initialize () {
- if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
- if (this.started) return true;
- BDFDB.loadMessage(this);
-
- this.ChannelSettingsUtils = BDFDB.WebModules.findByProperties("isGuildOrCategoryOrChannelMuted");
-
- BDFDB.WebModules.patch(BDFDB.WebModules.findByProperties("receiveMessage"), "receiveMessage", this, {before: e => {
- let message = e.methodArguments[1];
- let guildid = message.guild_id ? message.guild_id : null;
- if (!this.ChannelSettingsUtils.isGuildOrCategoryOrChannelMuted(guildid, message.channel_id) && message.author.id != BDFDB.myData.id) {
- if (!guildid) {
- this.fireEvent("dm");
- this.playAudio("dm");
- }
- else if (message.mentions) {
- for (let mention of message.mentions) if (mention.id == BDFDB.myData.id) {
- this.fireEvent("mentioned");
- this.playAudio("mentioned");
- break;
- }
- }
- }
- }});
-
- BDFDB.WebModules.patch(BDFDB.WebModules.findByProperties("playSound"), "playSound", this, {instead: e => {
- setImmediate(() => {
- var type = e.methodArguments[0];
- if (type == "message1") {
- if (this.firedEvents["dm"]) this.firedEvents["dm"] = false;
- else if (this.firedEvents["mentioned"]) this.firedEvents["mentioned"] = false;
- else this.playAudio(type);
- }
- else this.playAudio(type);
- });
- }});
-
- this.loadAudios();
- this.loadChoices();
-
- BDFDB.WebModules.forceAllUpdates(this);
-
- return true;
- }
- else {
- console.error(`%c[${this.name}]%c`, 'color: #3a71c1; font-weight: 700;', '', 'Fatal Error: Could not load BD functions!');
- return false;
- }
- }
-
-
- onStop () {
- if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
- BDFDB.unloadMessage(this);
- return true;
- }
- else {
- return false;
- }
- }
-
-
- // begin of own functions
-
- openDropdownMenu (settingspanel, e) {
- let selectControl = e.currentTarget;
- let selectWrap = selectControl.parentElement;
- let plugincard = BDFDB.getParentEle("li", selectWrap);
-
- if (!plugincard || BDFDB.containsClass(selectWrap, BDFDB.disCN.selectisopen)) return;
-
- BDFDB.addClass(selectWrap, BDFDB.disCN.selectisopen);
-
- var type = selectWrap.getAttribute("type");
- var option = selectWrap.getAttribute("option");
- var categorySelect = settingspanel.querySelector(`${BDFDB.dotCN.select}[type="${type}"][option="category"]`);
- var songSelect = settingspanel.querySelector(`${BDFDB.dotCN.select}[type="${type}"][option="song"]`);
-
- var category = categorySelect.getAttribute("value");
- var song = songSelect.getAttribute("value");
-
- var selectMenu = this.createDropdownMenu({type, option, category, song});
- selectWrap.appendChild(selectMenu);
-
- BDFDB.addChildEventListener(selectMenu, "mousedown", BDFDB.dotCN.selectoption, e2 => {
- var choice = BDFDB.loadData(type, this, "choices");
- var selection = e2.currentTarget.textContent;
- selectWrap.setAttribute("value", selection);
- selectControl.querySelector(BDFDB.dotCN.title).innerText = selection;
- choice[option] = selection;
- if (option == "category") {
- choice.song = Object.keys(this.audios[selection])[0];
- songSelect.outerHTML = `
`;
- }
- choice.src = this.audios[choice.category][choice.song];
- choice.src = choice.src ? choice.src : this.types[type].src;
- this.saveChoice(type, choice, true);
- });
-
- var removeMenu = e2 => {
- if (e2.target.parentElement != selectMenu) {
- document.removeEventListener("mousedown", removeMenu);
- selectMenu.remove();
- setTimeout(() => {BDFDB.removeClass(selectWrap, BDFDB.disCN.selectisopen);},100);
- }
- };
-
- document.addEventListener("mousedown", removeMenu);
- }
-
- createDropdownMenu ({type, option, category, song} = data) {
- var choice = BDFDB.loadData(type, this, "choices");
- var eles = option == "song" ? this.audios[category] : this.audios;
- var menuhtml = ``;
- return BDFDB.htmlToElement(menuhtml);
- }
-
- dragSlider (settingspanel, e) {
- var grabber = e.target;
- var track = grabber.parentNode;
- var slider = track.parentNode;
- var input = slider.querySelector(".volumeInput");
- var bar = slider.querySelector(BDFDB.dotCN.sliderbarfill);
-
- BDFDB.appendLocalStyle("disableTextSelection", `*{user-select: none !important;}`);
-
- var volume = 0;
- var sY = 0;
- var sHalfW = BDFDB.getRects(grabber).width/2;
- var sMinX = BDFDB.getRects(track).left;
- var sMaxX = sMinX + BDFDB.getRects(track).width;
- var mouseup = () => {
- document.removeEventListener("mouseup", mouseup);
- document.removeEventListener("mousemove", mousemove);
- BDFDB.removeLocalStyle("disableTextSelection");
- var type = slider.getAttribute("type");
- var choice = this.choices[type];
- choice.volume = volume;
- this.saveChoice(type, choice, true);
- };
- var mousemove = e2 => {
- sY = e2.clientX > sMaxX ? sMaxX - sHalfW : (e2.clientX < sMinX ? sMinX - sHalfW : e2.clientX - sHalfW);
- volume = BDFDB.mapRange([sMinX - sHalfW, sMaxX - sHalfW], [0, 100], sY);
- grabber.style.setProperty("left", volume + "%");
- bar.style.setProperty("width", volume + "%");
- input.value = volume;
- };
- document.addEventListener("mouseup", mouseup);
- document.addEventListener("mousemove", mousemove);
- }
-
- loadAudios () {
- this.audios = BDFDB.loadAllData(this, "audios");
- if (BDFDB.isObjectEmpty(this.audios)) this.audios = this.defaults;
- BDFDB.saveAllData(this.audios, this, "audios");
- }
-
- saveAudio (settingspanel) {
- var valid = true;
- var inputs = settingspanel.querySelectorAll(".songInput");
- inputs.forEach((input) => {
- if (!input.value || input.value.length == 0 || input.value.trim().length == 0) valid = false;
- });
- if (valid) {
- var successSavedAudio;
- var category = settingspanel.querySelector("#input-category").value;
- var song = settingspanel.querySelector("#input-song").value;
- var url = settingspanel.querySelector("#input-url").value;
- if (url.indexOf("http") == 0) {
- require("request")(url, (error, response, result) => {
- if (response) {
- var type = response.headers["content-type"];
- if (type && (type.indexOf("octet-stream") > -1 || type.indexOf("audio") > -1 || type.indexOf("video") > -1)) {
- successSavedAudio();
- return;
- }
- }
- BDFDB.showToast("Use a valid direct link to a video or audio source. They usually end on something like .mp3, .mp4 or .wav.", {type:"danger"});
- });
- }
- else {
- require("fs").readFile(url, (error, response) => {
- if (error) {
- BDFDB.showToast("Could not fetch file. Please make sure the file exists.", {type:"danger"});
- }
- else {
- url = `data:audio/mpeg;base64,${response.toString("base64")}`;
- successSavedAudio();
- }
- });
- }
-
- successSavedAudio = () => {
- BDFDB.showToast(`Song ${song} was added to category ${category}.`, {type:"success"});
- if (!this.audios[category]) this.audios[category] = {};
- this.audios[category][song] = url;
- BDFDB.saveAllData(this.audios, this, "audios");
- inputs.forEach((input) => {
- input.value = "";
- });
- };
- }
- else {
- BDFDB.showToast("Fill out all fields to add a new song.", {type:"danger"});
- }
- }
-
- loadChoices () {
- for (var type in this.types) {
- var choice = BDFDB.loadData(type, this, "choices");
- choice = choice ? choice : {};
-
- var songFound = false;
- for (var category in this.audios) {
- if (choice.category == category) {
- for (var song in this.audios[category]) {
- if (choice.song == song) {
- songFound = true;
- break;
- }
- }
- }
- }
- if (!songFound) choice = {category:"---",song:"---",volume:100,src:this.types[type].src,mute:this.types[type].mute};
- if (typeof choice.mute == "undefined") choice.mute = this.types[type].mute;
- this.saveChoice(type, choice, false);
- }
- }
-
- saveChoice (type, choice, play) {
- BDFDB.saveData(type, choice, this, "choices");
- this.choices[type] = choice;
- if (play) this.playAudio(type, this.settingsaudio);
- }
-
- playAudio (type, audio) {
- if (!audio) {
- if (this.dontPlayAudio(type)) return;
- audio = new Audio()
- }
- else audio.pause();
- audio.src = this.choices[type].src;
- audio.volume = this.choices[type].volume/100;
- audio.play();
- }
-
- dontPlayAudio (type) {
- let status = BDFDB.getUserStatus();
- return this.choices[type].mute && (status == "dnd" || status == "streaming");
- }
-
- fireEvent (type) {
- this.firedEvents[type] = true;
- setTimeout(() => {this.firedEvents[type] = false;},3000);
- }
-
- patchCallingSound (instance, instancetype, type) {
- let audio = new Audio();
- let play = () => {
- if (!audio.paused || this.dontPlayAudio(type)) return;
- audio.loop = true;
- audio.src = this.choices[type].src;
- audio.volume = this.choices[type].volume/100;
- audio.play();
- };
- let stop = () => {audio.pause();}
- instance.stopRinging();
- BDFDB.WebModules.patch(instance, "startRinging", this, {instead: play});
- BDFDB.WebModules.patch(instance, "stopRinging", this, {instead: stop});
- BDFDB.WebModules.patch(instance._reactInternalFiber.type.prototype, "startRinging", this, {instead: play});
- BDFDB.WebModules.patch(instance._reactInternalFiber.type.prototype, "stopRinging", this, {instead: stop});
- BDFDB.WebModules.unpatch(instance._reactInternalFiber.type.prototype, this.patchModules[instancetype], this);
- }
-
- processIncomingCalls (instance, wrapper) {
- this.patchCallingSound(instance, "IncomingCalls", "call_ringing");
- }
-
- processPrivateChannelCall (instance, wrapper) {
- console.log(wrapper);
- this.patchCallingSound(instance, "PrivateChannelCall", "call_calling");
- }
-
- getSettingsPanel () {
- if (!global.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
-
- var fields = ["category","song"];
-
- var settingshtml = `
${this.name}
`;
-
- settingshtml += `
Add New Song: `;
- settingshtml += `
`;
- settingshtml += `
`;
- settingshtml += `
`;
- settingshtml += `
`;
- settingshtml += `
`;
- settingshtml += `
`;
- settingshtml += `
`;
- settingshtml += `
`;
-
- for (var type in this.types) {
- var choice = BDFDB.loadData(type, this, "choices");
- settingshtml += `
`;
- for (var key of fields) {
- settingshtml += `
`;
- }
- settingshtml += `
`;
- settingshtml += `
`;
- }
- settingshtml += `
`;
- settingshtml += `
Remove all added songs. Reset
`;
- settingshtml += `
`;
-
- let settingspanel = BDFDB.htmlToElement(settingshtml);
-
- BDFDB.initElements(settingspanel, this);
-
- BDFDB.addEventListener(this, settingspanel, "click", BDFDB.dotCN.selectcontrol, e => {this.openDropdownMenu(settingspanel, e);});
- BDFDB.addEventListener(this, settingspanel, "click", ".btn-addsong", e => {this.saveAudio(settingspanel);});
- BDFDB.addEventListener(this, settingspanel, "keyup", ".songInput", e => {if (e.which == 13) this.saveAudio(settingspanel);});
- BDFDB.addEventListener(this, settingspanel, "click", ".reset-button", () => {
- BDFDB.openConfirmModal(this, "Are you sure you want to delete all added songs?", () => {
- BDFDB.removeAllData(this, "choices");
- BDFDB.removeAllData(this, "audios");
- this.loadAudios();
- this.loadChoices();
- settingspanel.querySelectorAll(BDFDB.dotCN.select).forEach(wrap => {
- wrap.setAttribute("value", "---");
- wrap.querySelector(BDFDB.dotCN.title).innerText = "---";
- });
- settingspanel.querySelectorAll(BDFDB.dotCN.slidergrabber).forEach(grabber => {
- grabber.style.left = "100%";
- });
- settingspanel.querySelectorAll(BDFDB.dotCN.sliderbarfill).forEach(bar => {
- bar.style.width = "100%";
- });
- settingspanel.querySelectorAll(".volumeInput").forEach(input => {
- input.value = 100;
- });
- });
- });
- BDFDB.addEventListener(this, settingspanel, "click", ".mute-checkbox", e => {
- var type = e.currentTarget.parentElement.getAttribute("type");
- var choice = BDFDB.loadData(type, this, "choices");
- choice.mute = e.currentTarget.checked;
- this.saveChoice(type, choice, false);
- });
- BDFDB.addEventListener(this, settingspanel, "click", "#input-unimplemented", e => {
- BDFDB.toggleEles(settingspanel.querySelectorAll(".unimplemented"), e.currentTarget.checked);
- });
- BDFDB.addEventListener(this, settingspanel, "mousedown", BDFDB.dotCN.slidergrabber, e => {this.dragSlider(settingspanel,e);});
-
- return settingspanel;
- }
- }
-};
diff --git a/PluginsV2/OldTitleBar/README.md b/PluginsV2/OldTitleBar/README.md
deleted file mode 100644
index 0b078d42c8..0000000000
--- a/PluginsV2/OldTitleBar/README.md
+++ /dev/null
@@ -1,5 +0,0 @@
-# These Plugins are meant only for BDv2, not BD nor BandagedBD. If you got either of those two go to [Plugins](https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/).
-
-## Old Title Bar - [Download Script](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/OldTitleBar/index.js) [Download Config](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/OldTitleBar/config.json)
-
-Reverts the title bar back to its former self.
diff --git a/PluginsV2/OldTitleBar/config.json b/PluginsV2/OldTitleBar/config.json
deleted file mode 100644
index f6c6554306..0000000000
--- a/PluginsV2/OldTitleBar/config.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "info": {
- "name": "OldTitleBar",
- "authors": [
- {
- "name": "DevilBro",
- "url": "https://www.paypal.me/MircoWittrien",
- "discord_id": "278543574059057154",
- "github_username": "mwittrien"
- }
- ],
- "version": 1.0,
- "description": "Reverts the title bar back to its former self. \n\nMy Support Server: http://bit.ly/DevilBrosHaus or https://discordapp.com/invite/Jx3TjNS"
- }
-}
diff --git a/PluginsV2/OldTitleBar/index.js b/PluginsV2/OldTitleBar/index.js
deleted file mode 100644
index 4db32a3825..0000000000
--- a/PluginsV2/OldTitleBar/index.js
+++ /dev/null
@@ -1,269 +0,0 @@
-module.exports = (Plugin, Api, Vendor) => {
- if (!global.BDFDB || typeof BDFDB != "object") global.BDFDB = {myPlugins:{}, BDv2Api: Api};
-
- return class extends Plugin {
- initConstructor () {
- this.patchModules = {
- "HeaderBar":["componentDidMount","componentDidUpdate"],
- "StandardSidebarView":["componentDidMount","componentWillUnmount"],
- "AuthWrapper":["componentDidMount","componentWillUnmount"]
- };
-
- this.patched = false;
-
- this.css = `
- body.hidden-by-OTB .bd-settings-button,
- body.hidden-by-OTB .bd-settings {
- top: 0 !important;
- }
-
- .hidden-by-OTB ${BDFDB.dotCN.titlebar},
- .hidden-by-OTB ${BDFDB.dotCN.titlebar} + ${BDFDB.dotCNS.app + BDFDB.dotCN.splashbackground}:before {
- display: none !important;
- }
-
- body:not(.settingsTitlebarOTB-added) ${BDFDB.dotCN.channelheaderheaderbardrag} {
- -webkit-app-region: drag !important;
- }
-
- ${BDFDB.dotCN.channelheaderheaderbardrag} *,
- ${BDFDB.dotCN.contextmenu} * {
- -webkit-app-region: no-drag !important;
- }
-
- .settingsTitlebarOTB {
- position: relative;
- z-index: 1000;
- text-align: right;
- padding: 10px;
- -webkit-app-region: drag;
- }`;
-
- this.dividerMarkup = ``;
-
- this.reloadButtonMarkup =
- ``;
-
- this.minButtonMarkup =
- ``;
-
- this.maxButtonMarkup =
- ``;
- this.maxButtonInnerMin = `
`;
- this.maxButtonInnerMax = `
`;
-
- this.closeButtonMarkup =
- ``;
-
- this.defaults = {
- settings: {
- displayNative: {value:!!document.querySelector(".platform-linux"), description:"Displays the native Title Bar."},
- addOldBar: {value:true, description:"Displays the Title Bar in the old fashion."},
- addToSettings: {value:true, description:"Adds a Title Bar to Settings Windows."},
- reloadButton: {value:false, description:"Adds a Reload Button to the Title Bar."}
- }
- };
- }
-
- onStart () {
- if (global.BDFDB && global.BDFDB.myPlugins && typeof global.BDFDB.myPlugins == "object") global.BDFDB.myPlugins[this.name] = this;
- var libraryScript = document.querySelector('head script[src="https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js"]');
- if (!global.BDFDB || typeof BDFDB != "object" || performance.now() - BDFDB.creationTime > 600000) {
- if (libraryScript) libraryScript.remove();
- libraryScript = document.createElement("script");
- libraryScript.setAttribute("type", "text/javascript");
- libraryScript.setAttribute("src", "https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js");
- libraryScript.setAttribute("date", performance.now());
- libraryScript.addEventListener("load", () => {if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();});
- document.head.appendChild(libraryScript);
- }
- else if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();
- this.startTimeout = setTimeout(() => {this.initialize();}, 30000);
- }
-
- initialize () {
- if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
- if (this.started) return true;
- BDFDB.loadMessage(this);
-
- BDFDB.addEventListener(this, window, "resize", e => {this.changeMaximizeButtons();});
-
- this.window = require("electron").remote.getCurrentWindow();
-
- this.patchMainScreen(BDFDB.getData("displayNative", this, "settings"));
-
- BDFDB.addClass([document.body,document.querySelector(BDFDB.dotCN.titlebar)], "hidden-by-OTB");
-
- BDFDB.WebModules.forceAllUpdates(this);
-
- return true;
- }
- else {
- console.error(`%c[${this.name}]%c`, 'color: #3a71c1; font-weight: 700;', '', 'Fatal Error: Could not load BD functions!');
- return false;
- }
- }
-
-
- onStop () {
- if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
- BDFDB.removeEles(".headerbarOTB", ".settingsTitlebarOTB");
-
- BDFDB.removeClasses("hidden-by-OTB", "settingsTitlebarOTB-added");
-
- BDFDB.unloadMessage(this);
- return true;
- }
- else {
- return false;
- }
- }
-
-
- // begin of own functions
-
- processHeaderBar (instance, wrapper) {
- this.addTitleBar();
- }
-
- processStandardSidebarView (instance, wrapper, methodnames) {
- this.processAuthWrapper(instance, wrapper, methodnames);
- }
-
- processAuthWrapper (instance, wrapper, methodnames) {
- if (methodnames.includes("componentDidMount")) {
- this.addSettingsTitleBar(wrapper);
- }
- else if (methodnames.includes("componentWillUnmount")) {
- BDFDB.removeEles(".settingsTitlebarOTB");
- BDFDB.removeClass(document.body, "settingsTitlebarOTB-added");
- this.addTitleBar();
- }
- }
-
- addTitleBar () {
- BDFDB.removeEles(".headerbarOTB");
- var settings = BDFDB.getAllData(this, "settings");
- if (BDFDB.getData("addOldBar", this, "settings")) {
- var headerbar = BDFDB.htmlToElement(``);
- this.createButtons(headerbar);
- let headerbaricon = document.querySelector(BDFDB.dotCNS.channelheaderheaderbardrag + BDFDB.dotCN.flex + " > " + BDFDB.dotCN.channelheadericonmargin);
- if (headerbaricon) headerbaricon.parentElement.appendChild(headerbar);
- this.changeMaximizeButtons();
- }
- }
-
- addSettingsTitleBar (settingspane) {
- BDFDB.removeEles(".settingsTitlebarOTB");
- if (BDFDB.getData("addToSettings", this, "settings")) {
- BDFDB.addClass(document.body, "settingsTitlebarOTB-added");
- var settingsbar = BDFDB.htmlToElement(`
`);
- this.createButtons(settingsbar);
- settingspane.parentElement.appendChild(settingsbar);
- this.changeMaximizeButtons();
- }
- }
-
- createButtons (bar) {
- var settings = BDFDB.containsClass(bar, "settingsTitlebarOTB");
- if (BDFDB.getData("reloadButton", this, "settings")) {
- if (!settings) bar.appendChild(BDFDB.htmlToElement(this.dividerMarkup));
- var reloadbutton = BDFDB.htmlToElement(this.reloadButtonMarkup);
- bar.appendChild(reloadbutton);
- var reloadbuttonicon = reloadbutton.querySelector(BDFDB.dotCN.channelheadericon);
- reloadbuttonicon.addEventListener("click", () => {this.window.reload();});
- reloadbuttonicon.addEventListener("mouseenter", e => {
- BDFDB.createTooltip("Reload", reloadbuttonicon, {type:"bottom",selector:"reload-button-tooltip"});
- });
- }
- if (!settings) bar.appendChild(BDFDB.htmlToElement(this.dividerMarkup));
- var minbutton = BDFDB.htmlToElement(this.minButtonMarkup);
- bar.appendChild(minbutton);
- minbutton.querySelector(BDFDB.dotCN.channelheadericon).addEventListener("click", () => {this.window.minimize();});
- var maxbutton = BDFDB.htmlToElement(this.maxButtonMarkup);
- bar.appendChild(maxbutton);
- maxbutton.querySelector(BDFDB.dotCN.channelheadericon).addEventListener("click", () => {
- if (this.window.isMaximized()) this.window.unmaximize();
- else this.window.maximize();
- this.changeMaximizeButtons();
- });
- var closebutton = BDFDB.htmlToElement(this.closeButtonMarkup);
- bar.appendChild(closebutton);
- closebutton.querySelector(BDFDB.dotCN.channelheadericon).addEventListener("click", () => {this.window.close();});
- }
-
- changeMaximizeButtons () {
- var innerHTML = this.window.isMaximized() ? this.maxButtonInnerMax : this.maxButtonInnerMin;
- document.querySelectorAll(".maxButtonOTB g").forEach(g => {g.innerHTML = innerHTML;});
- }
-
- patchMainScreen (enable) {
- if (BdApi.getWindowPreference("frame") != enable) {
- BdApi.setWindowPreference("frame", enable);
- return true;
- }
- return false;
- }
-
- getSettingsPanel () {
- if (!global.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
- var settings = BDFDB.getAllData(this, "settings");
- var settingshtml = `
${this.name}
`;
- for (let key in settings) {
- settingshtml += `
`;
- }
- settingshtml += `
`;
-
- let settingspanel = BDFDB.htmlToElement(settingshtml);
-
- BDFDB.initElements(settingspanel, this);
-
- BDFDB.addEventListener(this, settingspanel, "click", ".nativetitlebar-switch", e => {
- if (this.patchMainScreen(e.currentTarget.checked)) {
- this.patched = !this.patched;
- let notifybar = document.querySelector("#OldTitleBarNotifyBar");
- if (notifybar) notifybar.querySelector(BDFDB.dotCN.noticedismiss).click();
- if (this.patched) {
- notifybar = BDFDB.createNotificationsBar("Changed nativebar settings, relaunch to see changes:", {type:"danger",btn:"Relaunch",id:"OldTitleBarNotifyBar"});
- notifybar.querySelector(BDFDB.dotCN.noticebutton).addEventListener("click", () => {
- let app = require("electron").remote.app;
- app.relaunch();
- app.quit();
- });
- }
- }
- });
-
- return settingspanel;
- }
-
- onSettingsClosed () {
- if (this.SettingsUpdated) {
- delete this.SettingsUpdated;
- this.addTitleBar();
- }
- }
- }
-};
diff --git a/PluginsV2/PersonalPins/README.md b/PluginsV2/PersonalPins/README.md
deleted file mode 100644
index 3d0208703c..0000000000
--- a/PluginsV2/PersonalPins/README.md
+++ /dev/null
@@ -1,5 +0,0 @@
-# These Plugins are meant only for BDv2, not BD nor BandagedBD. If you got either of those two go to [Plugins](https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/).
-
-## Personal Pins - [Download Script](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/PersonalPins/index.js) [Download Config](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/PersonalPins/config.json)
-
-Allows you to pin messages in your own personal note books. Similar to pins you can check the notes of the current channel via the controlbar on the top.
diff --git a/PluginsV2/PersonalPins/config.json b/PluginsV2/PersonalPins/config.json
deleted file mode 100644
index f3accb8275..0000000000
--- a/PluginsV2/PersonalPins/config.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "info": {
- "name": "PersonalPins",
- "authors": [
- {
- "name": "DevilBro",
- "url": "https://www.paypal.me/MircoWittrien",
- "discord_id": "278543574059057154",
- "github_username": "mwittrien"
- }
- ],
- "version": 1.0,
- "description": "Similar to normal pins. Lets you save messages as notes for yourself. \n\nMy Support Server: http://bit.ly/DevilBrosHaus or https://discordapp.com/invite/Jx3TjNS"
- }
-}
diff --git a/PluginsV2/PersonalPins/index.js b/PluginsV2/PersonalPins/index.js
deleted file mode 100644
index 7d10fa50e4..0000000000
--- a/PluginsV2/PersonalPins/index.js
+++ /dev/null
@@ -1,925 +0,0 @@
-module.exports = (Plugin, Api, Vendor) => {
- if (!global.BDFDB || typeof BDFDB != "object") global.BDFDB = {myPlugins:{}, BDv2Api: Api};
-
- return class extends Plugin {
- initConstructor () {
- this.labels = {};
-
- this.patchModules = {
- "HeaderBar":["componentDidMount","componentDidUpdate"],
- "Message":"componentDidMount",
- "MessageOptionPopout":"componentDidMount"
- };
-
- this.notesButtonMarkup =
- ``;
-
- this.notesPopoutMarkup =
- `
`;
-
- this.sortPopoutMarkup =
- `
`;
-
- this.messagePinContextEntryMarkup =
- ``;
-
- this.messageUnpinContextEntryMarkup =
- ``;
-
- this.popoutPinEntryMarkup =
- `
- REPLACE_popout_pinoption_text
- `;
-
- this.popoutUnpinEntryMarkup =
- `
- REPLACE_popout_unpinoption_text
- `;
-
- this.messageDividerMarkup =
- `
-
-
-
`;
-
- this.messageMarkup =
- `
`;
- }
-
- onStart () {
- if (global.BDFDB && global.BDFDB.myPlugins && typeof global.BDFDB.myPlugins == "object") global.BDFDB.myPlugins[this.name] = this;
- var libraryScript = document.querySelector('head script[src="https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js"]');
- if (!global.BDFDB || typeof BDFDB != "object" || performance.now() - BDFDB.creationTime > 600000) {
- if (libraryScript) libraryScript.remove();
- libraryScript = document.createElement("script");
- libraryScript.setAttribute("type", "text/javascript");
- libraryScript.setAttribute("src", "https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js");
- libraryScript.setAttribute("date", performance.now());
- libraryScript.addEventListener("load", () => {if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();});
- document.head.appendChild(libraryScript);
- }
- else if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();
- this.startTimeout = setTimeout(() => {this.initialize();}, 30000);
- }
-
- initialize () {
- if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
- if (this.started) return true;
- BDFDB.loadMessage(this);
-
- this.SelectChannelUtils = BDFDB.WebModules.findByProperties("selectGuild","selectChannel");
- this.GuildUtils = BDFDB.WebModules.findByProperties("getGuilds","getGuild");
- this.ChannelUtils = BDFDB.WebModules.findByProperties("getChannels","getChannel");
- this.UserUtils = BDFDB.WebModules.findByProperties("getUsers","getUser");
- this.MemberUtils = BDFDB.WebModules.findByProperties("getMembers","getMember");
- this.LastGuildStore = BDFDB.WebModules.findByProperties("getLastSelectedGuildId");
- this.LastChannelStore = BDFDB.WebModules.findByProperties("getLastSelectedChannelId");
- this.HistoryUtils = BDFDB.WebModules.findByProperties("transitionTo", "replaceWith", "getHistory");
- this.MainDiscord = BDFDB.WebModules.findByProperties("ActionTypes");
-
- BDFDB.WebModules.forceAllUpdates(this);
-
- return true;
- }
- else {
- console.error(`%c[${this.name}]%c`, 'color: #3a71c1; font-weight: 700;', '', 'Fatal Error: Could not load BD functions!');
- return false;
- }
- }
-
-
- onStop () {
- if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
- BDFDB.removeEles(".popout-personalpins-notes", ".personalpins-sort-popout", ".notes-button");
-
- BDFDB.unloadMessage(this);
- return true;
- }
- else {
- return false;
- }
- }
-
-
- // begin of own functions
-
- changeLanguageStrings () {
- this.messagePinContextEntryMarkup = this.messagePinContextEntryMarkup.replace("REPLACE_context_pinoption_text", this.labels.context_pinoption_text);
- this.messageUnpinContextEntryMarkup = this.messageUnpinContextEntryMarkup.replace("REPLACE_context_unpinoption_text", this.labels.context_unpinoption_text);
-
- this.notesPopoutMarkup = this.notesPopoutMarkup.replace("REPLACE_popout_note_text", this.labels.popout_note_text);
- this.notesPopoutMarkup = this.notesPopoutMarkup.replace("REPLACE_popout_channel_text", this.labels.popout_channel_text);
- this.notesPopoutMarkup = this.notesPopoutMarkup.replace("REPLACE_popout_server_text", this.labels.popout_server_text);
- this.notesPopoutMarkup = this.notesPopoutMarkup.replace("REPLACE_popout_allservers_text", this.labels.popout_allservers_text);
- this.notesPopoutMarkup = this.notesPopoutMarkup.replace("REPLACE_popout_sort_text", this.labels.popout_sort_text);
- this.notesPopoutMarkup = this.notesPopoutMarkup.replace("REPLACE_popout_messagesort_text", this.labels.popout_messagesort_text);
-
- this.messageMarkup = this.messageMarkup.replace("REPLACE_popout_jump_text", this.labels.popout_jump_text);
- this.messageMarkup = this.messageMarkup.replace("REPLACE_popout_copy_text", this.labels.popout_copy_text);
-
- this.sortPopoutMarkup = this.sortPopoutMarkup.replace("REPLACE_popout_messagesort_text", this.labels.popout_messagesort_text);
- this.sortPopoutMarkup = this.sortPopoutMarkup.replace("REPLACE_popout_datesort_text", this.labels.popout_datesort_text);
-
- this.popoutPinEntryMarkup = this.popoutPinEntryMarkup.replace("REPLACE_popout_pinoption_text", this.labels.popout_pinoption_text);
- this.popoutUnpinEntryMarkup = this.popoutUnpinEntryMarkup.replace("REPLACE_popout_unpinoption_text", this.labels.context_unpinoption_text);
- }
-
- onMessageContextMenu (instance, menu) {
- if (instance.props && instance.props.message && instance.props.channel && instance.props.target && !menu.querySelector(".personalpins-item")) {
- let pinentry = BDFDB.React.findDOMNodeSafe(BDFDB.getOwnerInstance({node:menu,name:"MessagePinItem"}));
- let messagePinContextEntry = BDFDB.htmlToElement(this.getNoteData(instance.props.message, instance.props.target, instance.props.channel) ? this.messageUnpinContextEntryMarkup : this.messagePinContextEntryMarkup);
- if (pinentry) pinentry.parentElement.insertBefore(messagePinContextEntry, pinentry.nextElementSibling);
- else menu.insertBefore(messagePinContextEntry, menu.firstElementChild);
- let pinitem = messagePinContextEntry.querySelector(".personalpins-item");
- pinitem.addEventListener("click", () => {
- instance._reactInternalFiber.return.memoizedProps.closeContextMenu();
- this.addMessageToNotes(instance.props.message, instance.props.target, instance.props.channel);
- });
- if (BDFDB.isPluginEnabled("MessageUtilities")) {
- BDFDB.setContextHint(pinitem, BDFDB.Plugins["messageutilities"].getActiveShortcutString("__Note_Message"));
- }
- }
- }
-
- processHeaderBar (instance, wrapper) {
- BDFDB.removeEles(".notes-button");
- let search = wrapper.querySelector(BDFDB.dotCN.channelheadersearch);
- if (!search) return;
- let notesbutton = BDFDB.htmlToElement(this.notesButtonMarkup);
- search.parentElement.insertBefore(notesbutton, search);
- let icon = notesbutton.querySelector(BDFDB.dotCN.channelheadericon);
- icon.addEventListener("click", () => {
- this.openNotesPopout(icon);
- });
- icon.addEventListener("mouseenter", () => {
- BDFDB.createTooltip(this.labels.popout_note_text, icon, {type:"bottom",selector:"note-button-tooltip"});
- });
- }
-
- processMessage (instance, wrapper) {
- if (instance.props && typeof instance.props.renderButtons == "function" && !wrapper.querySelector(BDFDB.dotCN.optionpopoutbutton)) {
- let buttonwrap = wrapper.querySelector(BDFDB.dotCN.messagebuttoncontainer);
- if (buttonwrap) {
- let optionPopoutButton = BDFDB.htmlToElement(`
`);
- optionPopoutButton.addEventListener("click", () => {BDFDB.createMessageOptionPopout(optionPopoutButton);});
- buttonwrap.appendChild(optionPopoutButton);
- }
- }
- }
-
- processMessageOptionPopout (instance, wrapper) {
- if (instance.props.message && instance.props.channel && instance._reactInternalFiber.memoizedProps.target && !wrapper.querySelector(".personalpins-itembtn")) {
- let {messagediv, pos} = this.getMessageAndPos(instance._reactInternalFiber.memoizedProps.target);
- if (!messagediv || pos == -1) return;
- let popoutUnpinEntry = BDFDB.htmlToElement(this.getNoteData(instance.props.message, instance._reactInternalFiber.memoizedProps.target, instance.props.channel) ? this.popoutUnpinEntryMarkup : this.popoutPinEntryMarkup);
- wrapper.appendChild(popoutUnpinEntry);
- popoutUnpinEntry.addEventListener("click", () => {
- this.addMessageToNotes(instance.props.message, instance._reactInternalFiber.memoizedProps.target, instance.props.channel);
- instance.props.onClose();
- });
- }
- }
-
- openNotesPopout (button) {
- let container = document.querySelector(BDFDB.dotCN.popouts);
- if (!container || BDFDB.containsClass(button, "popout-open")) return;
- BDFDB.addClass(button, "popout-open");
- let notespopout = BDFDB.htmlToElement(this.notesPopoutMarkup);
- container.appendChild(notespopout);
- BDFDB.initElements(notespopout, this);
- let buttonrects = BDFDB.getRects(button);
- notespopout.style.setProperty("left", buttonrects.left + buttonrects.width/2 + "px");
- notespopout.style.setProperty("top", buttonrects.top + buttonrects.height + "px")
- notespopout.querySelectorAll(BDFDB.dotCN.tabbarheaderitem).forEach(tab => {tab.addEventListener("click", () => {
- this.addNotes(notespopout);
- });});
- notespopout.querySelector(BDFDB.dotCN.searchbarinput).addEventListener("keyup", () => {
- clearTimeout(notespopout.searchTimeout);
- notespopout.searchTimeout = setTimeout(() => {this.addNotes(notespopout);},1000);
- });
- notespopout.querySelector(BDFDB.dotCN.searchbarclear).addEventListener("click", e => {
- clearTimeout(notespopout.searchTimeout);
- notespopout.searchTimeout = setTimeout(() => {this.addNotes(notespopout);},1000);
- });
- notespopout.querySelector(BDFDB.dotCN.recentmentionsmentionfilter).addEventListener("click", e => {
- BDFDB.createSortPopout(e.currentTarget, this.sortPopoutMarkup, () => {this.addNotes(notespopout);});
- });
-
- var removePopout = e => {
- if (!notespopout.contains(e.target) && !BDFDB.getParentEle(".personalpins-sort-popout", e.target)) {
- document.removeEventListener("mousedown", removePopout);
- notespopout.remove();
- setTimeout(() => {BDFDB.removeClass(button, "popout-open");},300);
- }
- };
- document.addEventListener("mousedown", removePopout);
-
- this.addNotes(notespopout);
- }
-
- addNotes (notespopout) {
- BDFDB.removeEles(notespopout.querySelectorAll(BDFDB.dotCNC.messagegroupwrapper + BDFDB.dotCN.messagespopoutchannelseparator));
- let channel = BDFDB.getSelectedChannel();
- if (channel) {
- let guild_id = channel.guild_id ? channel.guild_id : "@me";
- let pins = BDFDB.loadAllData(this, "pins");
- if (!BDFDB.isObjectEmpty(pins)) {
- let container = notespopout.querySelector(BDFDB.dotCN.messagespopout);
- let placeholder = notespopout.querySelector(BDFDB.dotCN.messagespopoutemptyplaceholder);
- if (!container || !placeholder) return;
- placeholder.querySelector(BDFDB.dotCN.messagespopoutimage).style.setProperty("background-image", `url(${BDFDB.getDiscordTheme() == BDFDB.disCN.themelight ? "/assets/03c7541028afafafd1a9f6a81cb7f149.svg" : "/assets/6793e022dc1b065b21f12d6df02f91bd.svg"})`);
- let notes = {};
- switch (notespopout.querySelector(BDFDB.dotCN.tabbarheaderitem + BDFDB.dotCN.settingsitemselected).getAttribute("tab")) {
- case "channel":
- notes = pins[guild_id] && pins[guild_id][channel.id] ? pins[guild_id][channel.id] : {};
- break;
- case "server":
- if (pins[guild_id]) for (let channel in pins[guild_id]) notes = Object.assign(notes, pins[guild_id][channel]);
- break;
- case "allservers":
- for (let server in pins) if (pins[server]) for (let channel in pins[server]) notes = Object.assign(notes, pins[server][channel]);
- break;
- }
- let noteArray = [];
- for (let id in notes) {noteArray.push(notes[id]);}
- BDFDB.sortArrayByKey(noteArray, notespopout.querySelector(BDFDB.dotCN.recentmentionsmentionfiltervalue).getAttribute("option"));
- for (let noteData of noteArray) this.appendNote(container, noteData, placeholder);
- let searchstring = notespopout.querySelector(BDFDB.dotCN.searchbarinput).value.replace(/[<|>]/g, "");
- if (searchstring) for (let note of notespopout.querySelectorAll(BDFDB.dotCN.messagegroupwrapper)) {
- note.innerHTML = BDFDB.highlightText(note.innerHTML, searchstring);
- if (!note.querySelector(BDFDB.dotCN.highlight)) {
- note.previousSibling.remove();
- note.remove();
- }
- }
- BDFDB.toggleEles(placeholder, container.firstElementChild == placeholder);
- }
- }
- }
-
- appendNote (container, noteData, placeholder) {
- if (!container || !noteData) return;
- let server = this.GuildUtils.getGuild(noteData.guild_id) || {};
- let channel = this.ChannelUtils.getChannel(noteData.channel_id) || {};
- let user = this.UserUtils.getUser(noteData.author_id) || {};
- let member = this.MemberUtils.getMember(noteData.guild_id, noteData.author_id) || {};
- let date = new Date(noteData.timestamp);
- let message = BDFDB.htmlToElement(this.messageMarkup);
- let messagedivider = BDFDB.htmlToElement(this.messageDividerMarkup);
- container.insertBefore(message, container.firstChild);
- container.insertBefore(messagedivider, container.firstChild);
- let channelname = messagedivider.querySelector(BDFDB.dotCN.messagespopoutchannelname);
- channelname.innerText = (noteData.guild_id == "@me" ? " @" : " #") + (channel.name || noteData.channel_name);
- if (noteData.guild_id != "@me" && BDFDB.isPluginEnabled("EditChannels")) {
- BDFDB.Plugins["editchannels"].changeChannel2({id:noteData.channel_id,name:noteData.channel_name}, channelname);
- }
- else if (noteData.guild_id == "@me" && BDFDB.isPluginEnabled("EditUsers")) {
- let dmuser_id = channel && channel.type == 1 ? channel.recipients[0] : noteData.dmuser_id;
- if (dmuser_id) {
- BDFDB.Plugins["editusers"].changeName2({id:dmuser_id,username:noteData.channel_name}, channelname);
- if (channelname.innerText.indexOf("@") != 0) channelname.innerText = "@" + channelname.innerText;
- }
- }
- let guildname = messagedivider.querySelector(BDFDB.dotCN.messagespopoutguildname);
- guildname.innerText = server.name || noteData.guild_name;
- let avatar = message.querySelector(BDFDB.dotCN.avatarimage);
- avatar.style.setProperty("background-image", `url(${user.id ? BDFDB.getUserAvatar(user.id) : noteData.avatar})`);
- let username = message.querySelector(BDFDB.dotCN.messageusername);
- username.innerText = user.username || noteData.author_name;
- username.style.setProperty("color", member.colorString || noteData.color);
- if (BDFDB.isPluginEnabled("EditUsers")) {
- BDFDB.Plugins["editusers"].changeName({id:noteData.author_id,username:noteData.author_name}, username, noteData.guild_id);
- if (user.id) BDFDB.Plugins["editusers"].changeAvatar({id:noteData.author_id,username:noteData.author_name}, avatar);
- BDFDB.Plugins["editusers"].addTag({id:noteData.author_id,username:noteData.author_name}, username.parentElement, " " + BDFDB.disCN.bottagnametag);
- }
- let timestamp = message.querySelector(BDFDB.dotCN.messagetimestampcozy);
- timestamp.innerText = date.toLocaleString(BDFDB.getDiscordLanguage().id);
- timestamp.setAttribute("datetime", date);
- if (BDFDB.isPluginEnabled("CompleteTimestamps") && BDFDB.loadData("showInChat", "CompleteTimestamps", "settings")) {
- BDFDB.Plugins["completetimestamps"].changeTimestamp(timestamp);
- }
- message.querySelector(BDFDB.dotCN.messagemarkup).innerHTML = noteData.markup.replace(`
`,``);
- message.querySelector(BDFDB.dotCN.messageaccessory).innerHTML = noteData.accessory;
- if (noteData.accessory) {
- BDFDB.addChildEventListener(message, "click", BDFDB.dotCN.iconplay, e => {this.startYoutubeVideo(e.currentTarget);});
- let ytvideo = message.querySelector(BDFDB.dotCN.embed + " iframe[src*='https://www.youtube.com']");
- if (ytvideo) {
- let ytlink = ytvideo.parentElement.parentElement.querySelector(BDFDB.dotCN.embedtitle).href;
- let wrapper = ytvideo.parentElement;
- ytvideo.remove();
- require("request")(ytlink, (error, response, result) => {
- if (result) {
- wrapper.innerHTML = ``;
- wrapper.querySelector(BDFDB.dotCN.iconplay).addEventListener("click", e => {this.startYoutubeVideo(e.currentTarget);});
- }
- });
- }
- }
- messagedivider.querySelector(BDFDB.dotCN.messagespopoutchannelname).addEventListener("click", e => {
- if (!BDFDB.isObjectEmpty(channel)) {
- notespopout.remove();
- this.SelectChannelUtils.selectChannel(server.id, channel.id);
- }
- else BDFDB.shake();
- });
- message.querySelector(BDFDB.dotCN.messagespopoutclosebutton).addEventListener("click", e => {
- BDFDB.removeEles(messagedivider, message);
- this.removeNoteData(noteData);
- BDFDB.toggleEles(placeholder, container.firstElementChild == placeholder);
- });
- message.querySelector(BDFDB.dotCN.messagespopoutjumpbutton + ".jump").addEventListener("click", e => {
- this.HistoryUtils.transitionTo(this.MainDiscord.Routes.MESSAGE(noteData.guild_id, noteData.channel_id, noteData.id));
- });
- message.querySelector(BDFDB.dotCN.messagespopoutjumpbutton + ".copy").addEventListener("click", e => {
- let clipboard = require("electron").clipboard;
- if (noteData.content) clipboard.write({text: noteData.content});
- else {
- let image = message.querySelector(BDFDB.dotCNS.imagewrapper + "img");
- if (image) {
- // stolen from Image2Clipboard
- require("request")({url: image.src, encoding: null}, (error, response, buffer) => {
- if (buffer) {
- let platform = require("process").platform;
- if (platform === "win32" || platform === "darwin") {
- clipboard.write({image: require("electron").nativeImage.createFromBuffer(buffer)});
- }
- else {
- let file = require("path").join(require("process").env["HOME"], "personalpinstemp.png");
- require("fs").writeFileSync(file, buffer, {encoding: null});
- clipboard.write({image: file});
- require("fs").unlinkSync(file);
- }
- }
- });
- }
- }
- });
- }
-
- startYoutubeVideo (button) {
- let embedwrapper = BDFDB.getParentEle(BDFDB.dotCN.embedvideo, button);
- let ytlink = embedwrapper.parentElement.querySelector(BDFDB.dotCN.embedtitle).href;
- require("request")(ytlink, (error, response, result) => {
- if (result && response.headers && typeof response.headers.server == "string" && response.headers.server.toUpperCase() == "YOUTUBE FRONTEND PROXY") {
- while (embedwrapper.firstChild) embedwrapper.firstChild.remove();
- let width = 400;
- let height = Math.round(width*(result.split(' `));
- }
- });
- }
-
- addMessageToNotes (message, target, channel) {
- if (!message || !target) return;
- let {messagediv, pos} = this.getMessageAndPos(target);
- if (!messagediv || pos == -1) return;
- let pins = BDFDB.loadAllData(this, "pins");
- let guild = this.GuildUtils.getGuild(channel.guild_id) || {};
- let guild_id = guild.id ? guild.id : "@me";
- channel = channel ? channel : this.ChannelUtils.getChannel(message.channel_id);
- pins[guild_id] = pins[guild_id] || {}
- pins[guild_id][channel.id] = pins[guild_id][channel.id] || {}
- if (!pins[guild_id][channel.id][message.id + "_" + pos]) {
- let channelname = channel.name;
- if (!channelname && channel.recipients.length > 0) {
- for (let dmuser_id of channel.recipients) {
- channelname = channelname ? channelname + ", @" : channelname;
- channelname = channelname + this.UserUtils.getUser(dmuser_id).username;
- }
- }
- let markup = messagediv.querySelector(BDFDB.dotCN.messagemarkup).cloneNode(true);
- markup.querySelectorAll(BDFDB.dotCN.messageheadercompact).forEach(h2 => {h2.remove();});
- pins[guild_id][channel.id][message.id + "_" + pos] = BDFDB.sortObject({
- "guild_id": guild_id,
- "guild_name": guild.name ? guild.name : "Direct Messages",
- "channel_id": channel.id,
- "channel_name": channelname,
- "dmuser_id": channel.type == 1 ? channel.recipients[0] : null,
- "id": message.id,
- "pos": pos,
- "timestamp": message.timestamp._i.getTime(),
- "addedat": new Date().getTime(),
- "color": message.colorString,
- "author_id": message.author.id,
- "author_name": message.author.username,
- "avatar": BDFDB.getUserAvatar(message.author.id),
- "content": message.content,
- "markup": markup.innerHTML,
- "accessory": messagediv.querySelector(BDFDB.dotCN.messageaccessory).innerHTML
- });
- BDFDB.saveAllData(pins, this, "pins");
- BDFDB.showToast(this.labels.toast_noteadd_text, {type:"success"});
- }
- else this.removeNoteData(pins[guild_id][channel.id][message.id + "_" + pos]);
- }
-
- getNoteData (message, target, channel) {
- if (!message || !target) return;
- let {messagediv, pos} = this.getMessageAndPos(target);
- if (!messagediv || pos == -1) return;
- channel = channel ? channel : this.ChannelUtils.getChannel(message.channel_id);
- let pins = BDFDB.loadAllData(this, "pins");
- let guildid = channel.guild_id ? channel.guild_id : "@me";
- return pins[guildid] && pins[guildid][channel.id] && pins[guildid][channel.id][message.id + "_" + pos] ? pins[guildid][channel.id][message.id + "_" + pos] : null;
- }
-
- removeNoteData (noteData) {
- let pins = BDFDB.loadAllData(this, "pins");
- delete pins[noteData.guild_id][noteData.channel_id][noteData.id + "_" + noteData.pos];
- if (BDFDB.isObjectEmpty(pins[noteData.guild_id][noteData.channel_id])) {
- delete pins[noteData.guild_id][noteData.channel_id];
- if (BDFDB.isObjectEmpty(pins[noteData.guild_id])) delete pins[noteData.guild_id];
- }
- BDFDB.saveAllData(pins, this, "pins");
- BDFDB.showToast(this.labels.toast_noteremove_text, {type:"danger"});
- }
-
- getMessageAndPos (target) {
- let messagediv = BDFDB.getParentEle(BDFDB.dotCN.message, target);
- let pos = messagediv ? Array.from(messagediv.parentElement.querySelectorAll(BDFDB.dotCN.message)).indexOf(messagediv) : -1;
- return {messagediv, pos};
- }
-
- getSettingsPanel () {
- if (!global.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
- let settingshtml = `${this.name}
`;
- settingshtml += `
`;
- settingshtml += `
`;
-
- let settingspanel = BDFDB.htmlToElement(settingshtml);
-
- BDFDB.initElements(settingspanel, this);
-
- settingspanel.querySelector(".reset-button").addEventListener("click", () => {
- BDFDB.openConfirmModal(this, "Are you sure you want to delete all pinned notes?", () => {
- BDFDB.removeAllData(this, "pins");
- });
- });
- return settingspanel;
- }
-
- setLabelsByLanguage () {
- switch (BDFDB.getDiscordLanguage().id) {
- case "hr": //croatian
- return {
- popout_note_text: "Bilješke",
- popout_channel_text: "Kanal",
- popout_server_text: "Poslužavnik",
- popout_allservers_text: "Svi poslužitelji",
- popout_sort_text: "Poredaj po",
- popout_messagesort_text: "Vijesti-Datum",
- popout_datesort_text: "Bilješka-Datum",
- popout_jump_text: "Skok",
- popout_copy_text: "Kopija",
- context_pinoption_text: "Napominjemo poruku",
- context_unpinoption_text: "Uklonite bilješku",
- popout_pinoption_text: "Bilješka",
- toast_noteadd_text: "Poruka dodana u bilježnicu.",
- toast_noteremove_text: "Poruka uklonjena iz bilježnice."
- };
- case "da": //danish
- return {
- popout_note_text: "Noter",
- popout_channel_text: "Kanal",
- popout_server_text: "Server",
- popout_allservers_text: "Alle servere",
- popout_sort_text: "Sorter efter",
- popout_messagesort_text: "Meddelelse-Dato",
- popout_datesort_text: "Note-Dato",
- popout_jump_text: "Hop",
- popout_copy_text: "Kopi",
- context_pinoption_text: "Noter besked",
- context_unpinoption_text: "Fjern notatet",
- popout_pinoption_text: "Noter",
- toast_noteadd_text: "Meddelelse tilføjet til notesbog.",
- toast_noteremove_text: "Meddelelse fjernet fra notesbog."
- };
- case "de": //german
- return {
- popout_note_text: "Notizen",
- popout_channel_text: "Kanal",
- popout_server_text: "Server",
- popout_allservers_text: "Alle Server",
- popout_sort_text: "Sortieren nach",
- popout_messagesort_text: "Nachrichten-Datum",
- popout_datesort_text: "Notiz-Datum",
- popout_jump_text: "Springen",
- popout_copy_text: "Kopieren",
- context_pinoption_text: "Nachricht notieren",
- context_unpinoption_text: "Notiz entfernen",
- popout_pinoption_text: "Notieren",
- toast_noteadd_text: "Nachricht zum Notizbuch hinzugefügt.",
- toast_noteremove_text: "Nachricht aus dem Notizbuch entfernt."
- };
- case "es": //spanish
- return {
- popout_note_text: "Notas",
- popout_channel_text: "Canal",
- popout_server_text: "Servidor",
- popout_allservers_text: "Todos los servidores",
- popout_sort_text: "Ordenar por",
- popout_messagesort_text: "Mensaje-Fecha",
- popout_datesort_text: "Nota-Fecha",
- popout_jump_text: "Ir a",
- popout_copy_text: "Copiar",
- context_pinoption_text: "Anotar mensaje",
- context_unpinoption_text: "Quitar la nota",
- popout_pinoption_text: "Anotar",
- toast_noteadd_text: "Mensaje agregado al cuaderno.",
- toast_noteremove_text: "Mensaje eliminado del cuaderno."
- };
- case "fr": //french
- return {
- popout_note_text: "Notes",
- popout_channel_text: "Canal",
- popout_server_text: "Serveur",
- popout_allservers_text: "Tous les serveurs",
- popout_sort_text: "Trier par",
- popout_messagesort_text: "Message-Date",
- popout_datesort_text: "Note-Date",
- popout_jump_text: "Accéder",
- popout_copy_text: "Copier",
- context_pinoption_text: "Noter le message",
- context_unpinoption_text: "Enlevez la note",
- popout_pinoption_text: "Noter",
- toast_noteadd_text: "Message ajouté au bloc-notes.",
- toast_noteremove_text: "Message supprimé du bloc-notes."
- };
- case "it": //italian
- return {
- popout_note_text: "Note",
- popout_channel_text: "Canale",
- popout_server_text: "Server",
- popout_allservers_text: "Tutti i server",
- popout_sort_text: "Ordina per",
- popout_messagesort_text: "Messaggio-Data",
- popout_datesort_text: "Nota-Data",
- popout_jump_text: "Vai",
- popout_copy_text: "Copiare",
- context_pinoption_text: "Annotare il messaggio",
- context_unpinoption_text: "Rimuovi la nota",
- popout_pinoption_text: "Annotare",
- toast_noteadd_text: "Messaggio aggiunto al blocco note.",
- toast_noteremove_text: "Messaggio rimosso dal blocco note."
- };
- case "nl": //dutch
- return {
- popout_note_text: "Notities",
- popout_channel_text: "Kanaal",
- popout_server_text: "Server",
- popout_allservers_text: "Alle servers",
- popout_sort_text: "Sorteer op",
- popout_messagesort_text: "Bericht-Datum",
- popout_datesort_text: "Notitie-Datum",
- popout_jump_text: "Openen",
- popout_copy_text: "Kopiëren",
- context_pinoption_text: "Noteer bericht",
- context_unpinoption_text: "Verwijder de notitie",
- popout_pinoption_text: "Noteer",
- toast_noteadd_text: "Bericht toegevoegd aan notitieblok.",
- toast_noteremove_text: "Bericht verwijderd van notitieblok."
- };
- case "no": //norwegian
- return {
- popout_note_text: "Notatene",
- popout_channel_text: "Kanal",
- popout_server_text: "Server",
- popout_allservers_text: "Alle servere",
- popout_sort_text: "Sorter etter",
- popout_messagesort_text: "Melding-Dato",
- popout_datesort_text: "Merknad-Dato",
- popout_jump_text: "Hoppe",
- popout_copy_text: "Kopiere",
- context_pinoption_text: "Notat ned meldingen",
- context_unpinoption_text: "Fjern notatet",
- popout_pinoption_text: "Notere",
- toast_noteadd_text: "Melding lagt til i notisboken.",
- toast_noteremove_text: "Melding fjernet fra notatboken."
- };
- case "pl": //polish
- return {
- popout_note_text: "Notatki",
- popout_channel_text: "Kanał",
- popout_server_text: "Serwer",
- popout_allservers_text: "Wszystkie serwery",
- popout_sort_text: "Sortuj według",
- popout_messagesort_text: "Wiadomość-Data",
- popout_datesort_text: "Notatka-Data",
- popout_jump_text: "Skocz",
- popout_copy_text: "Kopiować",
- context_pinoption_text: "Notuj wiadomość",
- context_unpinoption_text: "Usuń notatkę",
- popout_pinoption_text: "Notuj",
- toast_noteadd_text: "Wiadomość została dodana do notatnika.",
- toast_noteremove_text: "Wiadomość została usunięta z notatnika."
- };
- case "pt-BR": //portuguese (brazil)
- return {
- popout_note_text: "Notas",
- popout_channel_text: "Canal",
- popout_server_text: "Servidor",
- popout_allservers_text: "Todos os servidores",
- popout_sort_text: "Ordenar por",
- popout_messagesort_text: "Mensagem-Data",
- popout_datesort_text: "Nota-Data",
- popout_jump_text: "Pular",
- popout_copy_text: "Copiar",
- context_pinoption_text: "Anote a mensagem",
- context_unpinoption_text: "Remova a nota",
- popout_pinoption_text: "Anotar",
- toast_noteadd_text: "Mensagem adicionada ao caderno.",
- toast_noteremove_text: "Mensagem removida do caderno."
- };
- case "fi": //finnish
- return {
- popout_note_text: "Muistiinpanot",
- popout_channel_text: "Kanava",
- popout_server_text: "Palvelin",
- popout_allservers_text: "Kaikki palvelimet",
- popout_sort_text: "Järjestä",
- popout_messagesort_text: "Viesti-Päivämäärä",
- popout_datesort_text: "Huomaa-Päivämäärä",
- popout_jump_text: "Siirry",
- popout_copy_text: "Kopioida",
- context_pinoption_text: "Huomaa viesti",
- context_unpinoption_text: "Poista muistiinpano",
- popout_pinoption_text: "Huomaa",
- toast_noteadd_text: "Viesti lisätty muistikirjaan.",
- toast_noteremove_text: "Viesti poistettiin muistikirjaan."
- };
- case "sv": //swedish
- return {
- popout_note_text: "Anteckningarna",
- popout_channel_text: "Kanal",
- popout_server_text: "Server",
- popout_allservers_text: "Alla servrar",
- popout_sort_text: "Sortera efter",
- popout_messagesort_text: "Meddelande-Datum",
- popout_datesort_text: "Anteckningen-Datum",
- popout_jump_text: "Hoppa",
- popout_copy_text: "Kopiera",
- context_pinoption_text: "Anteckna meddelande",
- context_unpinoption_text: "Ta bort noten",
- popout_pinoption_text: "Anteckna",
- toast_noteadd_text: "Meddelandet läggs till i anteckningsboken.",
- toast_noteremove_text: "Meddelande borttaget från anteckningsboken."
- };
- case "tr": //turkish
- return {
- popout_note_text: "Notlar",
- popout_channel_text: "Kanal",
- popout_server_text: "Sunucu",
- popout_allservers_text: "Tüm Sunucular",
- popout_sort_text: "Göre sırala",
- popout_messagesort_text: "Mesaj-Tarih",
- popout_datesort_text: "Not-Tarih",
- popout_jump_text: "Git",
- popout_copy_text: "Kopyalamak",
- context_pinoption_text: "Mesajı not alın",
- context_unpinoption_text: "Notu kaldırmak",
- popout_pinoption_text: "Not almak",
- toast_noteadd_text: "Mesaj not defteri'ya eklendi.",
- toast_noteremove_text: "Mesaj not defteri'dan kaldırıldı."
- };
- case "cs": //czech
- return {
- popout_note_text: "Poznámky",
- popout_channel_text: "Kanál",
- popout_server_text: "Server",
- popout_allservers_text: "Všechny servery",
- popout_sort_text: "Seřazeno podle",
- popout_messagesort_text: "Zpráva-datum",
- popout_datesort_text: "Poznámka-datum",
- popout_jump_text: "Skok",
- popout_copy_text: "Kopírovat",
- context_pinoption_text: "Poznámka dolů zprávu",
- context_unpinoption_text: "Odstraňte poznámku",
- popout_pinoption_text: "Poznámka dolů",
- toast_noteadd_text: "Zpráva byla přidána do notebooku.",
- toast_noteremove_text: "Zpráva byla odebrána z notebooku."
- };
- case "bg": //bulgarian
- return {
- popout_note_text: "бележките",
- popout_channel_text: "Канал",
- popout_server_text: "Сървър",
- popout_allservers_text: "Всички сървъри",
- popout_sort_text: "Сортиране по",
- popout_messagesort_text: "Съобщение-Дата",
- popout_datesort_text: "Забележка-Дата",
- popout_jump_text: "Направо",
- popout_copy_text: "Копирам",
- context_pinoption_text: "Oтбележете съобщението",
- context_unpinoption_text: "Премахнете бележката",
- popout_pinoption_text: "Oтбележете",
- toast_noteadd_text: "Съобщението бе добавено към бележника.",
- toast_noteremove_text: "Съобщението е премахнато от преносимия компютър."
- };
- case "ru": //russian
- return {
- popout_note_text: "Заметки",
- popout_channel_text: "Канал",
- popout_server_text: "Cервер",
- popout_allservers_text: "Все серверы",
- popout_sort_text: "Сортировать по",
- popout_messagesort_text: "Сообщение-дата",
- popout_datesort_text: "Заметки-Дата",
- popout_jump_text: "Перейти",
- popout_copy_text: "Копировать",
- context_pinoption_text: "Записывать вниз",
- context_unpinoption_text: "Удалить заметку",
- popout_pinoption_text: "Записывать",
- toast_noteadd_text: "Сообщение добавлено в блокнот.",
- toast_noteremove_text: "Сообщение удалено из записной книжки."
- };
- case "uk": //ukrainian
- return {
- popout_note_text: "Замітки",
- popout_channel_text: "Канал",
- popout_server_text: "Сервер",
- popout_allservers_text: "Всі сервери",
- popout_sort_text: "Сортувати за",
- popout_messagesort_text: "Повідомлення-дата",
- popout_datesort_text: "Примітка-дата",
- popout_jump_text: "Плиг",
- popout_copy_text: "Копіювати",
- context_pinoption_text: "Зверніть увагу на повідомлення",
- context_unpinoption_text: "Видаліть нотатку",
- popout_pinoption_text: "Занотуйте",
- toast_noteadd_text: "Повідомлення додається до ноутбука.",
- toast_noteremove_text: "Повідомлення видалено з ноутбука."
- };
- case "ja": //japanese
- return {
- popout_note_text: "ノート",
- popout_channel_text: "チャネル",
- popout_server_text: "サーバ",
- popout_allservers_text: "すべてのサーバー",
- popout_sort_text: "並び替え",
- popout_messagesort_text: "メッセージ-日付",
- popout_datesort_text: "注-日付",
- popout_jump_text: "ジャンプ",
- popout_copy_text: "写す",
- context_pinoption_text: "ノートダウンメッセージ",
- context_unpinoption_text: "メモを削除",
- popout_pinoption_text: "書き留める",
- toast_noteadd_text: "ノートブックにメッセージが追加されました.",
- toast_noteremove_text: "ノートブックからメッセージが削除されました."
- };
- case "zh-TW": //chinese (traditional)
- return {
- popout_note_text: "筆記",
- popout_channel_text: "渠道",
- popout_server_text: "服務器",
- popout_allservers_text: "所有服務器",
- popout_sort_text: "排序方式",
- popout_messagesort_text: "消息-日期",
- popout_datesort_text: "注-日期",
- popout_jump_text: "跳到",
- popout_copy_text: "複製",
- context_pinoption_text: "記下下來的消息",
- context_unpinoption_text: "刪除備註",
- popout_pinoption_text: "記下",
- toast_noteadd_text: "消息添加到筆記本.",
- toast_noteremove_text: "消息從筆記本中刪除."
- };
- case "ko": //korean
- return {
- popout_note_text: "노트",
- popout_channel_text: "채널",
- popout_server_text: "섬기는 사람",
- popout_allservers_text: "모든 서버",
- popout_sort_text: "정렬 기준",
- popout_messagesort_text: "메시지-날짜",
- popout_datesort_text: "주-날짜",
- popout_jump_text: "이동",
- popout_copy_text: "베끼다",
- context_pinoption_text: "메모 다운 메시지",
- context_unpinoption_text: "메모 삭제",
- popout_pinoption_text: "메모하다",
- toast_noteadd_text: "노트북에 메시지 추가됨.",
- toast_noteremove_text: "노트에서 메시지 삭제됨."
- };
- default: //default: english
- return {
- popout_note_text: "Notes",
- popout_channel_text: "Channel",
- popout_server_text: "Server",
- popout_allservers_text: "All Servers",
- popout_sort_text: "Sort by",
- popout_messagesort_text: "Message-Date",
- popout_datesort_text: "Note-Date",
- popout_jump_text: "Jump",
- popout_copy_text: "Copy",
- context_pinoption_text: "Note Message",
- context_unpinoption_text: "Remove Note",
- popout_pinoption_text: "Note",
- toast_noteadd_text: "Message added to notebook.",
- toast_noteremove_text: "Message removed from notebook."
- };
- }
- }
- }
-};
diff --git a/PluginsV2/PinDMs/README.md b/PluginsV2/PinDMs/README.md
deleted file mode 100644
index b87827a8d1..0000000000
--- a/PluginsV2/PinDMs/README.md
+++ /dev/null
@@ -1,5 +0,0 @@
-# These Plugins are meant only for BDv2, not BD nor BandagedBD. If you got either of those two go to [Plugins](https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/).
-
-## Pin DMs - [Download Script](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/PinDMs/index.js) [Download Config](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/PinDMs/config.json)
-
-Allows you to pin DMs, making them appear at the top of your DM-list.
diff --git a/PluginsV2/PinDMs/config.json b/PluginsV2/PinDMs/config.json
deleted file mode 100644
index 60f759feb9..0000000000
--- a/PluginsV2/PinDMs/config.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "info": {
- "name": "PinDMs",
- "authors": [
- {
- "name": "DevilBro",
- "url": "https://www.paypal.me/MircoWittrien",
- "discord_id": "278543574059057154",
- "github_username": "mwittrien"
- }
- ],
- "version": 1.0,
- "description": "Allows you to pin DMs, making them appear at the top of your DM-list. \n\nMy Support Server: http://bit.ly/DevilBrosHaus or https://discordapp.com/invite/Jx3TjNS"
- }
-}
diff --git a/PluginsV2/PinDMs/index.js b/PluginsV2/PinDMs/index.js
deleted file mode 100644
index bc46b34885..0000000000
--- a/PluginsV2/PinDMs/index.js
+++ /dev/null
@@ -1,736 +0,0 @@
-module.exports = (Plugin, Api, Vendor) => {
- if (!global.BDFDB || typeof BDFDB != "object") global.BDFDB = {myPlugins:{}, BDv2Api: Api};
-
- return class extends Plugin {
- initConstructor () {
- this.patchModules = {
- "Guilds":"componentDidMount",
- "DirectMessage":["componentDidMount","componentDidUpdate","componentWillUnmount"],
- "LazyScroller":"render"
- };
-
- this.dmContextEntryMarkup =
- ``;
-
- this.dmContextSubMenuMarkup =
- ``;
-
- this.dmPinContextMarkup =
- ``;
-
- this.dmUnpinContextMarkup =
- ``;
-
- this.recentDMMarkup =
- ``;
-
- this.css = `
- ${BDFDB.dotCN.guild}.pinned:after {
- background-position: 50%;
- background-repeat: no-repeat;
- background-size: 16px;
- border-radius: 12px;
- content: " ";
- height: 24px;
- overflow: hidden;
- pointer-events: none;
- position: absolute;
- right: -6px;
- top: -6px;
- width: 24px;
- background-image: url('data:image/svg+xml; utf8, ');
- }
- ${BDFDB.dotCNS.themelight + BDFDB.dotCN.guild}.pinned:after {
- background-color: #202225;
- }
- ${BDFDB.dotCNS.themedark + BDFDB.dotCN.guild}.pinned:after {
- background-color: #202225;
- }`;
- }
-
- onStart () {
- if (global.BDFDB && global.BDFDB.myPlugins && typeof global.BDFDB.myPlugins == "object") global.BDFDB.myPlugins[this.name] = this;
- var libraryScript = document.querySelector('head script[src="https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js"]');
- if (!global.BDFDB || typeof BDFDB != "object" || performance.now() - BDFDB.creationTime > 600000) {
- if (libraryScript) libraryScript.remove();
- libraryScript = document.createElement("script");
- libraryScript.setAttribute("type", "text/javascript");
- libraryScript.setAttribute("src", "https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js");
- libraryScript.setAttribute("date", performance.now());
- libraryScript.addEventListener("load", () => {if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();});
- document.head.appendChild(libraryScript);
- }
- else if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();
- this.startTimeout = setTimeout(() => {this.initialize();}, 30000);
- }
-
- initialize () {
- if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
- if (this.started) return true;
- BDFDB.loadMessage(this);
-
- this.UserUtils = BDFDB.WebModules.findByProperties("getUsers", "getUser");
- this.ChannelUtils = BDFDB.WebModules.findByProperties("getChannels", "getChannel");
- this.PrivateChannelUtils = BDFDB.WebModules.findByProperties("ensurePrivateChannel");
- this.ChannelSwitchUtils = BDFDB.WebModules.findByProperties("selectPrivateChannel");
- this.UnreadUtils = BDFDB.WebModules.findByProperties("getUnreadCount");
- this.DiscordConstants = BDFDB.WebModules.findByProperties("Permissions", "ActivityTypes", "StatusTypes");
- this.Animations = BDFDB.WebModules.findByProperties("spring");
-
- BDFDB.addEventListener(this, document, "click", BDFDB.dotCNS.dmchannels + BDFDB.dotCN.dmchannel, e => {
- let instance = BDFDB.getReactInstance(e.currentTarget);
- if (BDFDB.getReactValue(instance, "return.return.return.memoizedProps.ispin")) {
- let dmsscroller = document.querySelector(BDFDB.dotCNS.dmchannels + BDFDB.dotCN.scroller);
- if (dmsscroller) {
- this.oldScrollerPos = dmsscroller.scrollTop;
- setTimeout(() => {this.oldScrollerPos = null;},1000);
- }
- }
- });
- BDFDB.addEventListener(this, document, "click", BDFDB.dotCNS.dmchannels + BDFDB.dotCNS.dmchannel + BDFDB.dotCN.dmchannelclose, e => {
- let instance = BDFDB.getReactInstance(e.currentTarget);
- if (BDFDB.getReactValue(instance, "return.return.return.return.return.memoizedProps.ispin")) {
- e.originalEvent.stopPropagation();
- e.originalEvent.preventDefault();
- this.removePinnedDM(BDFDB.getReactValue(instance, "return.return.return.return.return.memoizedProps.channel.id"));
- }
- });
-
- this.forceAdding = true;
- BDFDB.WebModules.forceAllUpdates(this);
- delete this.forceAdding;
-
- return true;
- }
- else {
- console.error(`%c[${this.name}]%c`, 'color: #3a71c1; font-weight: 700;', '', 'Fatal Error: Could not load BD functions!');
- return false;
- }
- }
-
- onStop () {
- if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
- let dmsscrollerinstance = BDFDB.getReactInstance(document.querySelector(BDFDB.dotCNS.dmchannels + BDFDB.dotCN.scroller));
- if (dmsscrollerinstance) {
- let dms = dmsscrollerinstance.return.return.return.memoizedProps.children;
- let amount = 0;
- let insertpoint = null;
- for (let i in dms) {
- let ele = dms[i];
- if (ele && ele.pinned) {
- delete ele.pinned;
- if (ele.props.ispin) {
- if (ele.type == "header") insertpoint = i;
- amount++;
- }
- }
- }
- dms.splice(insertpoint, amount);
- this.forceUpdateScroller(dmsscrollerinstance.stateNode);
- }
-
- for (let info of BDFDB.readDmList()) {
- this.unhideNativeDM(info.id);
- if (info.div) info.div.removeEventListener("contextmenu", info.div.PinDMsContextMenuListener);
- }
- BDFDB.removeEles(BDFDB.dotCNS.dms + BDFDB.dotCN.guild + ".pinned");
-
- BDFDB.unloadMessage(this);
- return true;
- }
- else {
- return false;
- }
- }
-
-
- // begin of own functions
-
- changeLanguageStrings () {
- this.dmContextEntryMarkup = this.dmContextEntryMarkup.replace("REPLACE_context_pindm_text", this.labels.context_pindm_text);
-
- this.dmContextSubMenuMarkup = this.dmContextSubMenuMarkup.replace("REPLACE_context_pinchannel_text", this.labels.context_pinchannel_text);
- this.dmContextSubMenuMarkup = this.dmContextSubMenuMarkup.replace("REPLACE_context_unpinchannel_text", this.labels.context_unpinchannel_text);
- this.dmContextSubMenuMarkup = this.dmContextSubMenuMarkup.replace("REPLACE_context_pinguild_text", this.labels.context_pinguild_text);
- this.dmContextSubMenuMarkup = this.dmContextSubMenuMarkup.replace("REPLACE_context_unpinguild_text", this.labels.context_unpinguild_text);
-
- this.dmPinContextMarkup = this.dmPinContextMarkup.replace("REPLACE_context_pinguild_text", this.labels.context_pinguild_text);
-
- this.dmUnpinContextMarkup = this.dmUnpinContextMarkup.replace("REPLACE_context_unpinguild_text", this.labels.context_unpinguild_text);
- }
-
- onUserContextMenu (instance, menu) {
- if (instance.props && instance.props.user && !menu.querySelector(".pindms-item")) {
- let closeentry = BDFDB.React.findDOMNodeSafe(BDFDB.getOwnerInstance({node:menu,props:["handleClose"]}));
- if (closeentry) {
- let id = this.ChannelUtils.getDMFromUserId(instance.props.user.id);
- if (id) this.appendItem(instance, id, closeentry);
- else this.PrivateChannelUtils.ensurePrivateChannel(BDFDB.myData.id, instance.props.user.id).then(id => {this.appendItem(instance, id, closeentry);});
- }
- }
- }
-
- onGroupDMContextMenu (instance, menu) {
- if (instance.props && instance.props.channelId && !menu.querySelector(".pindms-item")) {
- let changeentry = BDFDB.React.findDOMNodeSafe(BDFDB.getOwnerInstance({node:menu,props:["handleChangeIcon"]}));
- if (changeentry) {
- this.appendItem(instance, instance.props.channelId, changeentry);
- }
- }
- }
-
- appendItem (instance, id, target) {
- let dmContextEntry = BDFDB.htmlToElement(this.dmContextEntryMarkup);
- target.parentElement.insertBefore(dmContextEntry, target);
- let pindmsitem = dmContextEntry.querySelector(".pindms-item");
- pindmsitem.addEventListener("mouseenter", () => {
- let dmContextSubMenu = BDFDB.htmlToElement(this.dmContextSubMenuMarkup);
- let pinchannelitem = dmContextSubMenu.querySelector(".pindm-channel-item");
- let unpinchannelitem = dmContextSubMenu.querySelector(".unpindm-channel-item");
- let pinguilditem = dmContextSubMenu.querySelector(".pindm-guild-item");
- let unpinguilditem = dmContextSubMenu.querySelector(".unpindm-guild-item");
- let pinnedDMs = BDFDB.loadAllData(this, "pinnedDMs");
- if (pinnedDMs[id] == undefined) {
- BDFDB.removeEles(unpinchannelitem);
- pinchannelitem.addEventListener("click", () => {
- instance._reactInternalFiber.return.memoizedProps.closeContextMenu();
- let dmsscrollerinstance = BDFDB.getReactInstance(document.querySelector(BDFDB.dotCNS.dmchannels + BDFDB.dotCN.scroller));
- if (dmsscrollerinstance) {
- let dms = dmsscrollerinstance.return.return.return.memoizedProps.children;
- let insertpoint = this.getInsertPoint(dms);
- this.addPinnedDM(id, dms, insertpoint);
- this.forceUpdateScroller(dmsscrollerinstance.stateNode);
- }
- pinnedDMs[id] = Object.keys(pinnedDMs).length;
- BDFDB.saveAllData(pinnedDMs, this, "pinnedDMs");
- });
- }
- else {
- BDFDB.removeEles(pinchannelitem);
- unpinchannelitem.addEventListener("click", () => {
- instance._reactInternalFiber.return.memoizedProps.closeContextMenu();
- this.removePinnedDM(id);
- });
- }
- let pinnedRecents = BDFDB.loadAllData(this, "pinnedRecents");
- if (pinnedRecents[id] == undefined) {
- BDFDB.removeEles(unpinguilditem);
- pinguilditem.addEventListener("click", () => {
- instance._reactInternalFiber.return.memoizedProps.closeContextMenu();
- this.addPinnedRecent(id);
- pinnedRecents[id] = Object.keys(pinnedRecents).length;
- BDFDB.saveAllData(pinnedRecents, this, "pinnedRecents");
- });
- }
- else {
- BDFDB.removeEles(pinguilditem);
- unpinguilditem.addEventListener("click", () => {
- instance._reactInternalFiber.return.memoizedProps.closeContextMenu();
- BDFDB.removeEles(document.querySelector(`${BDFDB.dotCNS.dms + BDFDB.dotCN.guild}.pinned[channelid="${id}"]`));
- this.unhideNativeDM(id);
- delete pinnedRecents[id];
- BDFDB.saveAllData(pinnedRecents, this, "pinnedRecents");
- });
- }
- BDFDB.appendSubMenu(pindmsitem, dmContextSubMenu);
- });
- }
-
- processGuilds (instance, wrapper) {
- let dms = wrapper.querySelector(BDFDB.dotCN.dms);
- if (dms) for (let id of this.sortAndUpdate("pinnedRecents")) this.addPinnedRecent(id);
- }
-
- processDirectMessage (instance, wrapper, methodnames) {
- if (instance.props && instance.props.channel) {
- if (methodnames.includes("componentDidMount")) {
- wrapper.removeEventListener("contextmenu", wrapper.PinDMsContextMenuListener);
- wrapper.PinDMsContextMenuListener = e => {
- let freshPinnedRecents = BDFDB.loadAllData(this, "pinnedRecents");
- if (freshPinnedRecents[instance.props.channel.id] == undefined) {
- let dmContext = BDFDB.htmlToElement(this.dmPinContextMarkup);
- dmContext.querySelector(".pindm-guild-item").addEventListener("click", () => {
- BDFDB.removeEles(dmContext);
- this.addPinnedRecent(instance.props.channel.id);
- freshPinnedRecents[instance.props.channel.id] = Object.keys(freshPinnedRecents).length;
- BDFDB.saveAllData(freshPinnedRecents, this, "pinnedRecents");
- });
- BDFDB.appendContextMenu(dmContext, e);
- }
- };
- wrapper.addEventListener("contextmenu", wrapper.PinDMsContextMenuListener);
- }
- let pinnedRecents = BDFDB.loadAllData(this, "pinnedRecents");
- if (pinnedRecents[instance.props.channel.id] != undefined) {
- if (methodnames.includes("componentDidMount")) this.hideNativeDM(instance.props.channel.id);
- this.updateUnreadCount(instance.props.channel.id);
- }
- }
- }
-
- processLazyScroller (instance, wrapper) {
- let privateChannelIds = BDFDB.getReactValue(instance, "_reactInternalFiber.return.memoizedProps.privateChannelIds");
- if (privateChannelIds) {
- if (this.forceAdding || !instance.props.PinDMsPatched) {
- instance.props.PinDMsPatched = true;
- let dms = instance.props.children;
- let sortedDMs = this.sortAndUpdate("pinnedDMs");
- if (sortedDMs.length > 0) {
- let insertpoint = this.getInsertPoint(dms);
- for (let pos in sortedDMs) this.addPinnedDM(sortedDMs[pos], dms, insertpoint);
- }
- this.forceUpdateScroller(instance.getScrollerNode());
- }
- if (this.oldScrollerPos != null) {
- instance.getScrollerNode().scrollTop = this.oldScrollerPos;
- }
- }
- }
-
- getInsertPoint (dms) {
- let insertpoint = null;
- for (let i in dms) {
- let ele = dms[i];
- if (ele && ele.type == "header") {
- insertpoint = parseInt(i);
- if (!ele.pinned && !ele.props.ispin) {
- ele.pinned = true;
- let headerpin = Object.assign({},ele);
- headerpin.key = "pin" + headerpin.key;
- headerpin.props = {children:this.labels.header_pinneddms_text,ispin:true};
- dms.splice(insertpoint, 0, headerpin);
- }
- insertpoint++;
- break;
- }
- }
- return insertpoint;
- }
-
- addPinnedDM (id, dms, insertpoint) {
- for (let ele of dms) if (ele && !ele.pinned && id == ele.key) {
- ele.pinned = true;
- let dmpin = Object.assign({ispin:true},ele);
- dmpin.key = "pin" + ele.key;
- dmpin.props = {channel:ele.props.channel,selected:ele.props.selected,ispin:true};
- dms.splice(insertpoint, 0, dmpin);
- }
- }
-
- removePinnedDM (id) {
- if (!id) return;
- BDFDB.removeData(id, this, "pinnedDMs");
- let dmsscrollerinstance = BDFDB.getReactInstance(document.querySelector(BDFDB.dotCNS.dmchannels + BDFDB.dotCN.scroller));
- if (dmsscrollerinstance) {
- let dms = dmsscrollerinstance.return.return.return.memoizedProps.children;
- let existingDMs = this.sortAndUpdate("pinnedDMs");
- let removepoint = null;
- for (let i in dms) {
- let ele = dms[i];
- if (ele && ele.pinned && (id == ele.key || ("pin" + id) == ele.key)) {
- delete ele.pinned;
- if (ele.props.ispin) removepoint = parseInt(i);
- }
- }
- if (removepoint) {
- let offset = existingDMs.length ? 0 : 1;
- if (offset) delete dms[removepoint + offset].pinned;
- dms.splice(removepoint-offset,1+offset);
- }
- this.forceUpdateScroller(dmsscrollerinstance.stateNode);
- }
- }
-
- sortAndUpdate (type) {
- let pinnedDMs = BDFDB.loadAllData(this, type);
- delete pinnedDMs[""];
- let sortedDMs = [], existingDMs = [], sortDM = (id) => {
- if (typeof sortedDMs[pinnedDMs[id]] == "undefined") sortedDMs[pinnedDMs[id]] = id;
- else sortDM(sortedDMs, pinnedDMs[id]+1, id);
- };
- for (let id in pinnedDMs) sortDM(id);
- sortedDMs = sortedDMs.filter(n => n);
- for (let pos in sortedDMs) {
- pinnedDMs[sortedDMs[pos]] = parseInt(pos);
- if (this.ChannelUtils.getChannel(sortedDMs[pos])) existingDMs.push(sortedDMs[pos]);
- }
- BDFDB.saveAllData(pinnedDMs, this, type);
- return existingDMs;
- }
-
- forceUpdateScroller (scroller) {
- if (this.updatingScroller) return;
- this.updatingScroller = true;
- var stateNode = BDFDB.getReactValue(scroller, "return.return.return.stateNode");
- if (stateNode) stateNode.updater.enqueueForceUpdate(stateNode);
- setTimeout(() => {delete this.updatingScroller;},1000);
- }
-
- addPinnedRecent (id) {
- let dms = document.querySelector(BDFDB.dotCN.dms);
- if (dms && !dms.querySelector(`${BDFDB.dotCN.guild}.pinned[channelid="${id}"]`)) {
- let info = this.ChannelUtils.getChannel(id);
- if (info) {
- let dmdiv = BDFDB.htmlToElement(this.recentDMMarkup);
- let user = info.type == 1 ? this.UserUtils.getUser(info.recipients[0]) : null;
- dmdiv.setAttribute("channelid", id);
- dms.insertBefore(dmdiv, dms.firstElementChild);
- let avatar = dmdiv.querySelector(BDFDB.dotCN.avatarinner);
- let dmname = info.name;
- if (!dmname && info.recipients.length > 0) {
- for (let dmuser_id of info.recipients) {
- dmname = dmname ? dmname + ", " : dmname;
- dmname = dmname + this.UserUtils.getUser(dmuser_id).username;
- }
- }
- let EditUsersData = user && BDFDB.isPluginEnabled("EditUsers") ? BDFDB.Plugins["editusers"].getUserData(user.id, dmdiv) : {};
- if (!EditUsersData.removeIcon) avatar.style.setProperty("background-image", `url(${EditUsersData.url || BDFDB.getChannelIcon(id)})`);
- avatar.setAttribute("channel", dmname);
- if (user) avatar.setAttribute("user", user.username);
- dmdiv.addEventListener("mouseenter", () => {
- let FreshEditUsersData = user && BDFDB.isPluginEnabled("EditUsers") ? BDFDB.Plugins["editusers"].getUserData(user.id, dmdiv) : {};
- BDFDB.createTooltip(FreshEditUsersData.name || dmname, dmdiv, {selector:(BDFDB.isObjectEmpty(FreshEditUsersData) ? "" : "EditUsers-tooltip"),type:"right"});
- });
- dmdiv.addEventListener("click", () => {
- this.ChannelSwitchUtils.selectPrivateChannel(id);
- });
- dmdiv.addEventListener("contextmenu", e => {
- let dmContext = BDFDB.htmlToElement(this.dmUnpinContextMarkup);
- dmContext.querySelector(".unpindm-guild-item").addEventListener("click", () => {
- BDFDB.removeEles(dmdiv, dmContext);
- this.unhideNativeDM(id);
- BDFDB.removeData(id, this, "pinnedRecents");
- });
- BDFDB.appendContextMenu(dmContext, e);
- });
- this.addHoverBehaviour(dmdiv);
- this.updateUnreadCount(id);
- this.hideNativeDM(id);
- }
- }
- }
-
- updateUnreadCount (id) {
- let dmdiv = document.querySelector(`${BDFDB.dotCNS.dms + BDFDB.dotCN.guild}.pinned[channelid="${id}"]`);
- if (Node.prototype.isPrototypeOf(dmdiv)) {
- let count = this.UnreadUtils.getUnreadCount(dmdiv.getAttribute("channelid"));
- let badge = dmdiv.querySelector(BDFDB.dotCN.badge);
- BDFDB.toggleEles(badge, count > 0);
- BDFDB.toggleClass(dmdiv, "has-new-messages", count > 0);
- badge.innerText = count;
- }
- }
-
- hideNativeDM (id) {
- let dmdiv = BDFDB.getDmDiv(id);
- if (Node.prototype.isPrototypeOf(dmdiv)) {
- BDFDB.toggleEles(dmdiv, false);
- BDFDB.addClass(dmdiv, "hidden-by-pin");
- }
- }
-
- unhideNativeDM (id) {
- let dmdiv = BDFDB.getDmDiv(id);
- if (Node.prototype.isPrototypeOf(dmdiv) && BDFDB.containsClass(dmdiv, "hidden-by-pin")) {
- BDFDB.toggleEles(dmdiv, true);
- BDFDB.removeClass(dmdiv, "hidden-by-pin");
- }
- }
-
- addHoverBehaviour (div) {
- /* based on stuff from Zerebos */
- let divinner = div.querySelector(BDFDB.dotCN.guildinner);
- let divicon = div.querySelector(BDFDB.dotCN.guildicon);
- let backgroundColor = new this.Animations.Value(0);
- backgroundColor
- .interpolate({
- inputRange: [0, 1],
- outputRange: [this.DiscordConstants.Colors.CHANNELS_GREY, this.DiscordConstants.Colors.BRAND_PURPLE]
- })
- .addListener((value) => {
- if (BDFDB.containsClass(divicon, BDFDB.disCN.avatarnoicon)) {
- let comp = BDFDB.colorCONVERT(value.value, "RGBCOMP");
- if (comp) divinner.style.setProperty("background-color", `rgb(${comp[0]}, ${comp[1]}, ${comp[2]})`);
- }
- });
-
- let borderRadius = new this.Animations.Value(0);
- borderRadius
- .interpolate({
- inputRange: [0, 1],
- outputRange: [25, 15]
- })
- .addListener((value) => {
- divinner.style.setProperty("border-radius", `${value.value}px`);
- });
-
- let animate = (v) => {
- this.Animations.parallel([
- this.Animations.timing(backgroundColor, {toValue: v, duration: 200}),
- this.Animations.spring(borderRadius, {toValue: v, friction: 3})
- ]).start();
- };
-
- div.addEventListener("mouseenter", () => {animate(1);})
- div.addEventListener("mouseleave", () => {if (!BDFDB.containsClass(div, BDFDB.disCN.guildselected)) animate(0);});
- }
-
- getSettingsPanel () {
- if (!global.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
- let settingshtml = `${this.name}
`;
- settingshtml += `
`;
- settingshtml += `
`;
-
- let settingspanel = BDFDB.htmlToElement(settingshtml);
-
- BDFDB.initElements(settingspanel, this);
-
- BDFDB.addEventListener(this, settingspanel, "click", ".reset-button", () => {
- BDFDB.openConfirmModal(this, "Are you sure you want to unpin all pinned DMs?", () => {
- BDFDB.removeAllData(this, "pinnedDMs");
- BDFDB.removeAllData(this, "pinnedRecents");
- });
- });
- return settingspanel;
- }
-
- setLabelsByLanguage () {
- switch (BDFDB.getDiscordLanguage().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_pinguild_text: "Priložite popisu poslužitelja",
- context_unpinguild_text: "Ukloni s popisa poslužitelja",
- header_pinneddms_text: "Prikvačene Izravne Poruke"
- };
- case "da": //danish
- return {
- context_pindm_text: "Fastgør PB",
- context_pinchannel_text: "Vedhæft til kanalliste",
- context_unpinchannel_text: "Fjern fra kanalliste",
- context_pinguild_text: "Vedhæft til serverliste",
- context_unpinguild_text: "Fjern fra serverliste",
- header_pinneddms_text: "Pinned Privat Beskeder"
- };
- case "de": //german
- return {
- context_pindm_text: "Direktnachricht anheften",
- context_pinchannel_text: "An Kanalliste anheften",
- context_unpinchannel_text: "Von Kanalliste loslösen",
- context_pinguild_text: "An Serverliste anheften",
- context_unpinguild_text: "Von Serverliste loslösen",
- header_pinneddms_text: "Gepinnte Direktnachrichten"
- };
- 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_pinguild_text: "Adjuntar a la lista de servidores",
- context_unpinguild_text: "Deshazte de la lista de servidores",
- header_pinneddms_text: "Mensajes Directos Fijados"
- };
- case "fr": //french
- return {
- context_pindm_text: "Épingler MP",
- context_pinchannel_text: "Épingler à la liste des chaînes",
- context_unpinchannel_text: "Détacher de la liste des chaînes",
- 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"
- };
- 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_pinguild_text: "Allega alla lista dei server",
- context_unpinguild_text: "Rimuovi dalla lista dei server",
- header_pinneddms_text: "Messaggi Diretti Aggiunti"
- };
- case "nl": //dutch
- return {
- context_pindm_text: "PB pinnen",
- context_pinchannel_text: "Pin naar de kanalenlijst",
- context_unpinchannel_text: "Losmaken van kanalenlijst",
- context_pinguild_text: "Pin naar de serverlijst",
- context_unpinguild_text: "Losmaken van serverlijst",
- header_pinneddms_text: "Vastgezette Persoonluke Berichten"
- };
- case "no": //norwegian
- return {
- context_pindm_text: "Fest DM",
- context_pinchannel_text: "Fest på kanalliste",
- context_unpinchannel_text: "Fjern fra kanalliste",
- context_pinguild_text: "Fest på serverliste",
- context_unpinguild_text: "Fjern fra serverlisten",
- header_pinneddms_text: "Pinned Direktemeldinger"
- };
- 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_pinguild_text: "Dołącz do listy serwerów",
- context_unpinguild_text: "Usuń z listy serwerów",
- header_pinneddms_text: "Prywatne Wiadomości Bezpośrednie"
- };
- 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_pinguild_text: "Anexar à lista de servidores",
- context_unpinguild_text: "Remover da lista de servidores",
- header_pinneddms_text: "Mensagens diretas fixadas"
- };
- case "fi": //finnish
- return {
- context_pindm_text: "Kiinnitä yksityisviestit",
- context_pinchannel_text: "Liitä kanavaluetteloon",
- context_unpinchannel_text: "Poista kanavaluettelosta",
- context_pinguild_text: "Liitä palvelinluetteloon",
- context_unpinguild_text: "Poista palvelinluettelosta",
- header_pinneddms_text: "Liitetyt yksityisviestit"
- };
- 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_pinguild_text: "Fäst till servernlista",
- context_unpinguild_text: "Ta bort från servernlista",
- header_pinneddms_text: "Inlagda Direktmeddelanden"
- };
- case "tr": //turkish
- return {
- context_pindm_text: "DM'yi Sabitle",
- context_pinchannel_text: "Kanal listesine ekle",
- context_unpinchannel_text: "Kanal listesinden kaldır",
- context_pinguild_text: "Sunucu listesine ekle",
- context_unpinguild_text: "Sunucu listesinden kaldır",
- header_pinneddms_text: "Direkt Mesajlar Sabitleyin"
- };
- 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_pinguild_text: "Připojit ke seznamu serverů",
- context_unpinguild_text: "Odstranit ze seznamu serverů",
- header_pinneddms_text: "Připojené Přímá Zpráva"
- };
- case "bg": //bulgarian
- return {
- context_pindm_text: "Закачени ДС",
- context_pinchannel_text: "Прикачете към списъка с канали",
- context_unpinchannel_text: "Премахване от списъка с канали",
- context_pinguild_text: "Прикачване към списъка със сървъри",
- context_unpinguild_text: "Премахване от списъка със сървъри",
- header_pinneddms_text: "Свързани директни съобщения"
- };
- case "ru": //russian
- return {
- context_pindm_text: "Закрепить ЛС",
- context_pinchannel_text: "Прикрепить к списку каналов",
- context_unpinchannel_text: "Удалить из списка каналов",
- context_pinguild_text: "Присоединить к списку серверов",
- context_unpinguild_text: "Удалить из списка серверов",
- header_pinneddms_text: "Прикрепленные Личные Сообщения"
- };
- case "uk": //ukrainian
- return {
- context_pindm_text: "Закріпити ОП",
- context_pinchannel_text: "Додайте до списку каналів",
- context_unpinchannel_text: "Видалити зі списку каналів",
- context_pinguild_text: "Додайте до списку серверів",
- context_unpinguild_text: "Видалити зі списку серверів",
- header_pinneddms_text: "Прикріплені oсобисті повідомлення"
- };
- case "ja": //japanese
- return {
- context_pindm_text: "DMピン",
- context_pinchannel_text: "チャンネルリストに添付",
- context_unpinchannel_text: "チャンネルリストから削除",
- context_pinguild_text: "サーバーリストに添付",
- context_unpinguild_text: "サーバーリストから削除",
- header_pinneddms_text: "固定された直接メッセージ"
- };
- case "zh-TW": //chinese (traditional)
- return {
- context_pindm_text: "引腳直接留言",
- context_pinchannel_text: "附加到頻道列表",
- context_unpinchannel_text: "從頻道列表中刪除",
- context_pinguild_text: "附加到服務器列表",
- context_unpinguild_text: "從服務器列表中刪除",
- header_pinneddms_text: "固定私人信息"
- };
- case "ko": //korean
- return {
- context_pindm_text: "비공개 메시지 고정",
- context_pinchannel_text: "채널 목록에 첨부",
- context_unpinchannel_text: "채널 목록에서 삭제",
- context_pinguild_text: "서버 목록에 첨부",
- context_unpinguild_text: "서버 목록에서 제거",
- header_pinneddms_text: "고정 된 비공개 메시지"
- };
- default: //default: english
- return {
- context_pindm_text: "Pin DM",
- context_pinchannel_text: "Pin to Channellist",
- context_unpinchannel_text: "Unpin from Channellist",
- context_pinguild_text: "Pin to Serverlist",
- context_unpinguild_text: "Unpin from Serverlist",
- header_pinneddms_text: "Pinned Direct Messages"
- };
- }
- }
- }
-};
diff --git a/PluginsV2/README.md b/PluginsV2/README.md
deleted file mode 100644
index 8c733abf1a..0000000000
--- a/PluginsV2/README.md
+++ /dev/null
@@ -1,41 +0,0 @@
-# These Plugins are meant only for BDv2, not BD nor BandagedBD. If you got either of those two go to [Plugins](https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/).
-
-## Plugins
- - [BadgesEverywhere](https://github.com/mwittrien/BetterDiscordAddons/tree/master/PluginsV2/BadgesEverywhere) - Displays Badges (Nitro, Hypesquad, etc...) in the chat/memberlist/userpopout. Thanks for Zerebos' help.
- - [Better Friend Count](https://github.com/mwittrien/BetterDiscordAddons/tree/master/PluginsV2/BetterFriendCount) - Shows the amount of total and online friends and blocked users in the friends tab.
- - [Better NSFW Tag](https://github.com/mwittrien/BetterDiscordAddons/tree/master/PluginsV2/BetterNsfwTag) - Adds a more noticeable tag to NSFW channels.
- - [Char Counter](https://github.com/mwittrien/BetterDiscordAddons/tree/master/PluginsV2/CharCounter) - Adds a character counter to the chat.
- - [Chat Aliases](https://github.com/mwittrien/BetterDiscordAddons/tree/master/PluginsV2/ChatAliases) - Allows the user to configure their own chat-aliases which will automatically be replaced before the message is being sent.
- - [Chat Filter](https://github.com/mwittrien/BetterDiscordAddons/tree/master/PluginsV2/ChatFilter) - Allows the user to censor words or block complete messages based on words in the chatwindow.
- - [Complete Timestamps](https://github.com/mwittrien/BetterDiscordAddons/tree/master/PluginsV2/CompleteTimestamps) - Replace all timestamps with complete timestamps.
- - [Creation Date](https://github.com/mwittrien/BetterDiscordAddons/tree/master/PluginsV2/CreationDate) - Displays the Creation Date of an Account in the UserPopout and UserModal.
- - [Display Servers As Channels](https://github.com/mwittrien/BetterDiscordAddons/tree/master/PluginsV2/DisplayServersAsChannels) - Display servers in a similar way as channels.
- - [Edit Channels](https://github.com/mwittrien/BetterDiscordAddons/tree/master/PluginsV2/EditChannels) - Allows the user to locally change the name and color of channels.
- - [Edit Servers](https://github.com/mwittrien/BetterDiscordAddons/tree/master/PluginsV2/EditServers) - Allows the user to locally change the name, initials, icon and color of servers.
- - [Edit Users](https://github.com/mwittrien/BetterDiscordAddons/tree/master/PluginsV2/EditUsers) - Allows you to change the icon, name, tag and color of users.
- - [Emoji Statistics](https://github.com/mwittrien/BetterDiscordAddons/tree/master/PluginsV2/EmojiStatistics) - Displays emojiinformation when hovering over an emoji in the emojipicker and adds a button to the emojipicker to open a statistics overview.
- - [Fix German Translation](https://github.com/mwittrien/BetterDiscordAddons/tree/master/PluginsV2/FixGermanTranslation) - Fixes some minor translation errors in the german version of Discord.
- - [Force Image Previews](https://github.com/mwittrien/BetterDiscordAddons/tree/master/PluginsV2/ForceImagePreviews) - Forces embedded Image Previews, if Discord doesn't do it itself.
- - [Friend Notifications](https://github.com/mwittrien/BetterDiscordAddons/tree/master/PluginsV2/FriendNotifications) - Notifies you when a friend either logs in or out. Click the Online Friend-Counter to display a timelog of the current session.
- - [Google Search Replace](https://github.com/mwittrien/BetterDiscordAddons/tree/master/PluginsV2/GoogleSearchReplace) - Replaces the default Google Text Search with a selection menu of several search engines.
- - [Google Translate Option](https://github.com/mwittrien/BetterDiscordAddons/tree/master/PluginsV2/GoogleTranslateOption) - Adds a Google Translate option to your context menu, which will open the selected text in Google Translate.
- - [Image Gallery](https://github.com/mwittrien/BetterDiscordAddons/tree/master/PluginsV2/ImageGallery) - Allows the user to browse through images sent inside the same message.
- - [Message Utilities](https://github.com/mwittrien/BetterDiscordAddons/tree/master/PluginsV2/MessageUtilities) - Offers a number of useful message options.
- - [Moveable Popups](https://github.com/mwittrien/BetterDiscordAddons/tree/master/PluginsV2/MoveablePopups) - Adds the feature to move all popups and modals around like on a normal desktop. Ctrl + drag with your left mousebutton to drag element.
- - [Notification Sounds](https://github.com/mwittrien/BetterDiscordAddons/tree/master/PluginsV2/NotificationSounds) - Allows you to replace the native sounds of Discord with your own.
- - [Old Title Bar](https://github.com/mwittrien/BetterDiscordAddons/tree/master/PluginsV2/OldTitleBar) - Reverts the title bar back to its former self.
- - [Personal Pins](https://github.com/mwittrien/BetterDiscordAddons/tree/master/PluginsV2/PersonalPins) - Similar to normal pins. Lets you save messages as notes for yourself.
- - [Pin DMs](https://github.com/mwittrien/BetterDiscordAddons/tree/master/PluginsV2/PinDMs) - Allows you to pin DMs, making them appear at the top of your DM-list.
- - [Read All Notifications Button](https://github.com/mwittrien/BetterDiscordAddons/tree/master/PluginsV2/ReadAllNotificationsButton) - Adds a little button at the top of your serverlist that enables you to clear all mentions and messagesnotifications at once.
- - [Remove Nicknames](https://github.com/mwittrien/BetterDiscordAddons/tree/master/PluginsV2/RemoveNicknames) - Replace all nicknames with the actual accountnames.
- - [Reverse Image Search](https://github.com/mwittrien/BetterDiscordAddons/tree/master/PluginsV2/ReverseImageSearch) - Adds the option to reverse image search images in discord via several engines.
- - [Send Large Messages](https://github.com/mwittrien/BetterDiscordAddons/tree/master/PluginsV2/SendLargeMessages) - Opens a popout when your message is too large, which allows you to automatically send the message in several smaller messages.
- - [Server Hider](https://github.com/mwittrien/BetterDiscordAddons/tree/master/PluginsV2/ServerHider) - Adds two options on your server context menu to hide servers in your server list.
- - [Server Folders](https://github.com/mwittrien/BetterDiscordAddons/tree/master/PluginsV2/ServerFolders) - Adds the option to create pseudo folders that, click the folder to hide/display all folders between two folders. Easily gets broken by moving server icons.
- - [Show Hidden Channels](https://github.com/mwittrien/BetterDiscordAddons/tree/master/PluginsV2/ShowHiddenChannels) - Displays all hidden channels that can't be accessed due to role restrictions in a new category.
- - [Show Image Details](https://github.com/mwittrien/BetterDiscordAddons/tree/master/PluginsV2/ShowImageDetails) - Display the name, size and dimensions of uploaded images (does not include embed images) in the chat as an header or as a tooltip.
- - [Spell Check](https://github.com/mwittrien/BetterDiscordAddons/tree/master/PluginsV2/SpellCheck) - Adds a spellcheck to all textareas.
- - [Stalker Notifications](https://github.com/mwittrien/BetterDiscordAddons/tree/master/PluginsV2/StalkerNotifications) - Lets you observe the status of people that aren't your friends.
- - [Steam Profile Link](https://github.com/mwittrien/BetterDiscordAddons/tree/master/PluginsV2/SteamProfileLink) - Opens a steam profile in steam instead of a browser when clicking the steamlink in a userprofile. With the help of square.
- - [Top Role Everywhere](https://github.com/mwittrien/BetterDiscordAddons/tree/master/PluginsV2/TopRoleEverywhere) - Adds the highest role of a user as a tag.
- - [Write UpperCase](https://github.com/mwittrien/BetterDiscordAddons/tree/master/PluginsV2/WriteUpperCase) - Changes the input in the textarea to uppercase.
\ No newline at end of file
diff --git a/PluginsV2/ReadAllNotificationsButton/README.md b/PluginsV2/ReadAllNotificationsButton/README.md
deleted file mode 100644
index 1807e70177..0000000000
--- a/PluginsV2/ReadAllNotificationsButton/README.md
+++ /dev/null
@@ -1,5 +0,0 @@
-# These Plugins are meant only for BDv2, not BD nor BandagedBD. If you got either of those two go to [Plugins](https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/).
-
-## Read All Notifications Button - [Download Script](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/ReadAllNotificationsButton/index.js) [Download Config](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/ReadAllNotificationsButton/config.json)
-
-Adds a little button at the top of your serverlist that enables you to clear all mentions and messagesnotifications at once.
diff --git a/PluginsV2/ReadAllNotificationsButton/config.json b/PluginsV2/ReadAllNotificationsButton/config.json
deleted file mode 100644
index afcd7209b8..0000000000
--- a/PluginsV2/ReadAllNotificationsButton/config.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "info": {
- "name": "ReadAllNotifications",
- "authors": [
- {
- "name": "DevilBro",
- "url": "https://www.paypal.me/MircoWittrien",
- "discord_id": "278543574059057154",
- "github_username": "mwittrien"
- }
- ],
- "version": 1.0,
- "description": "Adds a button to clear all notifications. \n\nMy Support Server: http://bit.ly/DevilBrosHaus or https://discordapp.com/invite/Jx3TjNS"
- }
-}
diff --git a/PluginsV2/ReadAllNotificationsButton/index.js b/PluginsV2/ReadAllNotificationsButton/index.js
deleted file mode 100644
index 8bc2e47e93..0000000000
--- a/PluginsV2/ReadAllNotificationsButton/index.js
+++ /dev/null
@@ -1,176 +0,0 @@
-module.exports = (Plugin, Api, Vendor) => {
- if (!global.BDFDB || typeof BDFDB != "object") global.BDFDB = {myPlugins:{}, BDv2Api: Api};
-
- return class extends Plugin {
- initConstructor () {
- this.patchModules = {
- "Guilds":"componentDidMount",
- "RecentMentions":"componentDidMount"
- };
-
- this.RANcontextMenuMarkup =
- ``;
-
- this.RANbuttonMarkup =
- ``;
-
- this.RAMbuttonMarkup =
- `
- Clear Mentions
- `;
-
- this.defaults = {
- settings: {
- includeGuilds: {value:true, description:"unread Servers"},
- includeMuted: {value:false, description:"muted unread Servers"},
- includeDMs: {value:false, description:"unread DMs"}
- }
- };
- }
-
- onStart () {
- if (global.BDFDB && global.BDFDB.myPlugins && typeof global.BDFDB.myPlugins == "object") global.BDFDB.myPlugins[this.name] = this;
- var libraryScript = document.querySelector('head script[src="https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js"]');
- if (!global.BDFDB || typeof BDFDB != "object" || performance.now() - BDFDB.creationTime > 600000) {
- if (libraryScript) libraryScript.remove();
- libraryScript = document.createElement("script");
- libraryScript.setAttribute("type", "text/javascript");
- libraryScript.setAttribute("src", "https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js");
- libraryScript.setAttribute("date", performance.now());
- libraryScript.addEventListener("load", () => {if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();});
- document.head.appendChild(libraryScript);
- }
- else if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();
- this.startTimeout = setTimeout(() => {this.initialize();}, 30000);
- }
-
- initialize () {
- if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
- if (this.started) return true;
- BDFDB.loadMessage(this);
-
- BDFDB.WebModules.forceAllUpdates(this);
-
- return true;
- }
- else {
- console.error(`%c[${this.name}]%c`, 'color: #3a71c1; font-weight: 700;', '', 'Fatal Error: Could not load BD functions!');
- return false;
- }
- }
-
- onStop () {
- if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
- BDFDB.removeEles(".RANbutton-frame", ".RAMbutton");
- BDFDB.removeClasses("RAN-added", "RAM-added");
-
- BDFDB.unloadMessage(this);
- return true;
- }
- else {
- return false;
- }
- }
-
-
- // begin of own functions
-
- processGuilds (instance, wrapper) {
- BDFDB.removeEles(".RANbutton-frame");
- let guildseparator = wrapper.querySelector(BDFDB.dotCN.guildseparator);
- if (guildseparator) {
- let ranbutton = BDFDB.htmlToElement(this.RANbuttonMarkup);
- guildseparator.parentElement.insertBefore(ranbutton, guildseparator);
- ranbutton.addEventListener("click", () => {
- let settings = BDFDB.getAllData(this, "settings");
- if (settings.includeGuilds) BDFDB.markGuildAsRead(settings.includeMuted ? BDFDB.readServerList() : BDFDB.readUnreadServerList());
- if (settings.includeDMs) BDFDB.markChannelAsRead(BDFDB.readDmList());
- });
- ranbutton.addEventListener("contextmenu", e => {
- let RANcontextMenu = BDFDB.htmlToElement(this.RANcontextMenuMarkup);
- RANcontextMenu.querySelector(".readguilds-item").addEventListener("click", () => {
- BDFDB.removeEles(RANcontextMenu);
- BDFDB.markGuildAsRead(BDFDB.readUnreadServerList());
- });
- RANcontextMenu.querySelector(".readmutedguilds-item").addEventListener("click", () => {
- BDFDB.removeEles(RANcontextMenu);
- BDFDB.markGuildAsRead(BDFDB.readServerList());
- });
- RANcontextMenu.querySelector(".readdms-item").addEventListener("click", () => {
- BDFDB.removeEles(RANcontextMenu);
- BDFDB.markChannelAsRead(BDFDB.readDmList());
- });
- BDFDB.appendContextMenu(RANcontextMenu, e);
- });
- BDFDB.addClass(wrapper, "RAN-added");
- }
- }
-
- processRecentMentions (instance, wrapper) {
- BDFDB.removeEles(".RAMbutton");
- if (instance.props && instance.props.popoutName == "RECENT_MENTIONS_POPOUT") {
- let recentmentionstitle = wrapper.querySelector(BDFDB.dotCN.recentmentionstitle);
- if (recentmentionstitle) {
- let ranbutton = BDFDB.htmlToElement(this.RAMbuttonMarkup);
- recentmentionstitle.appendChild(ranbutton);
- ranbutton.addEventListener("click", () => {this.clearMentions(instance, wrapper);});
- BDFDB.addClass(wrapper, "RAM-added");
- }
- }
- }
-
- clearMentions (instance, wrapper) {
- let closebuttons = wrapper.querySelectorAll(BDFDB.dotCN.messagespopoutclosebutton);
- for (let btn of wrapper.querySelectorAll(BDFDB.dotCN.messagespopoutclosebutton)) btn.click();
- if (closebuttons.length) {
- instance.loadMore();
- setTimeout(() => {this.clearMentions(instance, wrapper);},3000);
- }
- }
-
- getSettingsPanel () {
- if (!global.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
- var settings = BDFDB.getAllData(this, "settings");
- var settingshtml = `${this.name}
`;
- settingshtml += `
When left clicking the button mark following elements as unread: `;
- for (let key in settings) {
- settingshtml += `
`;
- }
- settingshtml += `
`;
- settingshtml += `
`;
-
- let settingspanel = BDFDB.htmlToElement(settingshtml);
-
- BDFDB.initElements(settingspanel, this);
-
- let mutedinput = settingspanel.querySelector(".settings-switch[value='settings includeMuted']").parentElement.parentElement;
- BDFDB.toggleEles(mutedinput, settings.includeGuilds);
- BDFDB.addEventListener(this, settingspanel, "click", ".settings-switch[value='settings includeGuilds']", e => {
- BDFDB.toggleEles(mutedinput, e.currentTarget.checked);
- });
-
- return settingspanel;
- }
- }
-};
diff --git a/PluginsV2/RemoveNicknames/README.md b/PluginsV2/RemoveNicknames/README.md
deleted file mode 100644
index c6eb3090c0..0000000000
--- a/PluginsV2/RemoveNicknames/README.md
+++ /dev/null
@@ -1,5 +0,0 @@
-# These Plugins are meant only for BDv2, not BD nor BandagedBD. If you got either of those two go to [Plugins](https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/).
-
-## Remove Nicknames - [Download Script](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/RemoveNicknames/index.js) [Download Config](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/RemoveNicknames/config.json)
-
-Replace all nicknames with the actual accountnames.
diff --git a/PluginsV2/RemoveNicknames/config.json b/PluginsV2/RemoveNicknames/config.json
deleted file mode 100644
index b4379b8c3d..0000000000
--- a/PluginsV2/RemoveNicknames/config.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "info": {
- "name": "RemoveNicknames",
- "authors": [
- {
- "name": "DevilBro",
- "url": "https://www.paypal.me/MircoWittrien",
- "discord_id": "278543574059057154",
- "github_username": "mwittrien"
- }
- ],
- "version": 1.0,
- "description": "CReplace all nicknames with the actual accountnames. \n\nMy Support Server: http://bit.ly/DevilBrosHaus or https://discordapp.com/invite/Jx3TjNS"
- }
-}
diff --git a/PluginsV2/RemoveNicknames/index.js b/PluginsV2/RemoveNicknames/index.js
deleted file mode 100644
index b8be017857..0000000000
--- a/PluginsV2/RemoveNicknames/index.js
+++ /dev/null
@@ -1,160 +0,0 @@
-module.exports = (Plugin, Api, Vendor) => {
- if (!global.BDFDB || typeof BDFDB != "object") global.BDFDB = {myPlugins:{}, BDv2Api: Api};
-
- return class extends Plugin {
- initConstructor () {
- this.patchModules = {
- "NameTag":"componentDidMount",
- "TypingUsers":"componentDidUpdate",
- "MessageUsername":"componentDidMount",
- "Clickable":"componentDidMount"
- };
-
- this.defaults = {
- settings: {
- replaceOwn: {value:false, description:"Replace your own name:"},
- addNickname: {value:false, description:"Add nickname as parentheses:"},
- swapPositions: {value:false, description:"Swap the position of username and nickname:"}
- }
- };
- }
-
- onStart () {
- if (global.BDFDB && global.BDFDB.myPlugins && typeof global.BDFDB.myPlugins == "object") global.BDFDB.myPlugins[this.name] = this;
- var libraryScript = document.querySelector('head script[src="https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js"]');
- if (!global.BDFDB || typeof BDFDB != "object" || performance.now() - BDFDB.creationTime > 600000) {
- if (libraryScript) libraryScript.remove();
- libraryScript = document.createElement("script");
- libraryScript.setAttribute("type", "text/javascript");
- libraryScript.setAttribute("src", "https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js");
- libraryScript.setAttribute("date", performance.now());
- libraryScript.addEventListener("load", () => {if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();});
- document.head.appendChild(libraryScript);
- }
- else if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();
- this.startTimeout = setTimeout(() => {this.initialize();}, 30000);
- }
-
- initialize () {
- if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
- if (this.started) return true;
- BDFDB.loadMessage(this);
-
- this.reseting = false;
-
- this.UserStore = BDFDB.WebModules.findByProperties("getUsers", "getUser");
- this.LastGuildStore = BDFDB.WebModules.findByProperties("getLastSelectedGuildId");
- this.LastChannelStore = BDFDB.WebModules.findByProperties("getLastSelectedChannelId");
- this.MemberStore = BDFDB.WebModules.findByProperties("getNicknames", "getNick");
-
- BDFDB.WebModules.forceAllUpdates(this);
-
- return true;
- }
- else {
- console.error(`%c[${this.name}]%c`, 'color: #3a71c1; font-weight: 700;', '', 'Fatal Error: Could not load BD functions!');
- return false;
- }
- }
-
-
- onStop () {
- if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
- this.reseting = true;
-
- BDFDB.WebModules.forceAllUpdates(this);
-
- BDFDB.unloadMessage(this);
- return true;
- }
- else {
- return false;
- }
- }
-
-
- // begin of own functions
-
- getNewName (info) {
- if (!info) return null;
- let EditUsersData = BDFDB.isPluginEnabled("EditUsers") ? BDFDB.loadData(info.id, "EditUsers", "users") : null;
- if (EditUsersData && EditUsersData.name) return EditUsersData.name;
- let settings = BDFDB.getAllData(this, "settings");
- let member = this.MemberStore.getMember(this.LastGuildStore.getGuildId(), info.id);
- if (!member || !member.nick || info.id == BDFDB.myData.id && !settings.replaceOwn) return info.username;
- if (this.reseting) return member.nick || info.username;
- return settings.addNickname ? (settings.swapPositions ? (member.nick + " (" + info.username + ")") : (info.username + " (" + member.nick + ")")) : info.username;
- }
-
- processNameTag (instance, wrapper) {
- let username = wrapper.parentElement.querySelector("." + (BDFDB.containsClass(wrapper, BDFDB.disCN.userpopoutheadertagwithnickname) ? BDFDB.disCN.userpopoutheadernickname : instance.props.usernameClass).replace(/ /g, "."));
- if (username) BDFDB.setInnerText(username, this.getNewName(instance.props.user));
- }
-
- processMessageUsername (instance, wrapper) {
- let message = BDFDB.getReactValue(instance, "props.message");
- if (message) {
- let username = wrapper.querySelector(BDFDB.dotCN.messageusername);
- if (username) BDFDB.setInnerText(username, this.getNewName(message.author));
- }
- }
-
- processTypingUsers (instance, wrapper) {
- let users = !instance.state.typingUsers ? [] : Object.keys(instance.state.typingUsers).filter(id => id != BDFDB.myData.id).filter(id => !this.RelationshipUtils.isBlocked(id)).map(id => this.UserUtils.getUser(id)).filter(id => id != null);
- wrapper.querySelectorAll("strong").forEach((username, i) => {
- if (users[i] && username) BDFDB.setInnerText(username, this.getNewName(users[i]));
- });
- }
-
- processClickable (instance, wrapper) {
- if (!wrapper || !instance.props || !instance.props.className) return;
- if (instance.props.tag == "a" && instance.props.className.indexOf(BDFDB.disCN.anchorunderlineonhover) > -1) {
- if (BDFDB.containsClass(wrapper.parentElement, BDFDB.disCN.messagesystemcontent)) {
- let message = BDFDB.getKeyInformation({node:wrapper.parentElement, key:"message", up:true});
- if (message) BDFDB.setInnerText(wrapper, this.getNewName(message.author));
- }
- }
- else if (instance.props.tag == "span" && instance.props.className.indexOf(BDFDB.disCN.mention) > -1) {
- let render = BDFDB.getReactValue(instance, "_reactInternalFiber.return.return.stateNode.props.render");
- if (typeof render == "function") BDFDB.setInnerText(wrapper, "@" + this.getNewName(render().props.user));
- }
- else if (instance.props.tag == "div" && instance.props.className.indexOf(BDFDB.disCN.voiceuser) > -1) {
- let user = BDFDB.getReactValue(instance, "_reactInternalFiber.return.memoizedProps.user");
- if (user) {
- let username = wrapper.querySelector(BDFDB.dotCN.voicename);
- if (username) BDFDB.setInnerText(username, this.getNewName(user));
- }
- }
- else if (instance.props.tag == "div" && instance.props.className.indexOf(BDFDB.disCN.autocompleterow) > -1) {
- let user = BDFDB.getReactValue(instance, "_reactInternalFiber.return.memoizedProps.user");
- if (user) {
- let username = wrapper.querySelector(BDFDB.dotCN.marginleft8);
- if (username) BDFDB.setInnerText(username, this.getNewName(user));
- }
- }
- }
-
- getSettingsPanel () {
- if (!global.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
- var settings = BDFDB.getAllData(this, "settings");
- var settingshtml = `${this.name}
`;
- for (let key in settings) {
- settingshtml += `
`;
- }
- settingshtml += `
`;
-
- let settingspanel = BDFDB.htmlToElement(settingshtml);
-
- BDFDB.initElements(settingspanel, this);
- ;
- return settingspanel;
- }
-
- onSettingsClosed () {
- if (this.SettingsUpdated) {
- delete this.SettingsUpdated;
- BDFDB.WebModules.forceAllUpdates(this);
- }
- }
- }
-};
diff --git a/PluginsV2/ReverseImageSearch/README.md b/PluginsV2/ReverseImageSearch/README.md
deleted file mode 100644
index 798dd2e8e4..0000000000
--- a/PluginsV2/ReverseImageSearch/README.md
+++ /dev/null
@@ -1,9 +0,0 @@
-# These Plugins are meant only for BDv2, not BD nor BandagedBD. If you got either of those two go to [Plugins](https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/).
-
-## Reverse Image Search - [Download Script](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/ReverseImageSearch/index.js) [Download Config](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/ReverseImageSearch/config.json)
-
-Adds the option to right click an image and use an engine to reverse image search it.
-Enable/Disable them in the settings.
-Current engines: Baidu, Bing, Google, Karma Decay (Reddit), Sogou, TinEye, Yandex
-
-If you want to add new search engines, simply add a new entry in the searchEngines array in the constructor. Make sure to get the right search url for the engine.
diff --git a/PluginsV2/ReverseImageSearch/config.json b/PluginsV2/ReverseImageSearch/config.json
deleted file mode 100644
index 4e91fdf6ca..0000000000
--- a/PluginsV2/ReverseImageSearch/config.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "info": {
- "name": "ReverseImageSearch",
- "authors": [
- {
- "name": "DevilBro",
- "url": "https://www.paypal.me/MircoWittrien",
- "discord_id": "278543574059057154",
- "github_username": "mwittrien"
- }
- ],
- "version": 1.0,
- "description": "Adds a reverse image search option to the context menu. \n\nMy Support Server: http://bit.ly/DevilBrosHaus or https://discordapp.com/invite/Jx3TjNS"
- }
-}
diff --git a/PluginsV2/ReverseImageSearch/index.js b/PluginsV2/ReverseImageSearch/index.js
deleted file mode 100644
index f49031e6d4..0000000000
--- a/PluginsV2/ReverseImageSearch/index.js
+++ /dev/null
@@ -1,233 +0,0 @@
-module.exports = (Plugin, Api, Vendor) => {
- if (!global.BDFDB || typeof BDFDB != "object") global.BDFDB = {myPlugins:{}, BDv2Api: Api};
-
- return class extends Plugin {
- initConstructor () {
- this.imgUrlReplaceString = "DEVILBRO_BD_REVERSEIMAGESEARCH_REPLACE_IMAGEURL";
-
- this.defaults = {
- engines: {
- _all: {value:true, name:BDFDB.getLibraryStrings().btn_all_text, url:null},
- Baidu: {value:true, name:"Baidu", url:"http://image.baidu.com/pcdutu?queryImageUrl=" + this.imgUrlReplaceString},
- Bing: {value:true, name:"Bing", url:"https://www.bing.com/images/search?q=imgurl:" + this.imgUrlReplaceString + "&view=detailv2&iss=sbi&FORM=IRSBIQ"},
- Google: {value:true, name:"Google", url:"https://images.google.com/searchbyimage?image_url=" + this.imgUrlReplaceString},
- IQDB: {value:true, name:"IQDB", url:"https://iqdb.org/?url=" + this.imgUrlReplaceString},
- Reddit: {value:true, name:"Reddit", url:"http://karmadecay.com/search?q=" + this.imgUrlReplaceString},
- SauceNAO: {value:true, name:"SauceNAO", url:"https://saucenao.com/search.php?db=999&url=" + this.imgUrlReplaceString},
- Sogou: {value:true, name:"Sogou", url:"http://pic.sogou.com/ris?flag=1&drag=0&query=" + this.imgUrlReplaceString + "&flag=1"},
- TinEye: {value:true, name:"TinEye", url:"https://tineye.com/search?url=" + this.imgUrlReplaceString},
- WhatAnime: {value:true, name:"WhatAnime", url:"https://trace.moe/?url=" + this.imgUrlReplaceString},
- Yandex: {value:true, name:"Yandex", url:"https://yandex.com/images/search?url=" + this.imgUrlReplaceString + "&rpt=imageview"}
- }
- };
-
- this.messageContextEntryMarkup =
- ``;
-
-
- this.messageContextSubMenuMarkup =
- ``;
- }
-
- onStart () {
- if (global.BDFDB && global.BDFDB.myPlugins && typeof global.BDFDB.myPlugins == "object") global.BDFDB.myPlugins[this.name] = this;
- var libraryScript = document.querySelector('head script[src="https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js"]');
- if (!global.BDFDB || typeof BDFDB != "object" || performance.now() - BDFDB.creationTime > 600000) {
- if (libraryScript) libraryScript.remove();
- libraryScript = document.createElement("script");
- libraryScript.setAttribute("type", "text/javascript");
- libraryScript.setAttribute("src", "https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js");
- libraryScript.setAttribute("date", performance.now());
- libraryScript.addEventListener("load", () => {if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();});
- document.head.appendChild(libraryScript);
- }
- else if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();
- this.startTimeout = setTimeout(() => {this.initialize();}, 30000);
- }
-
- initialize () {
- if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
- if (this.started) return true;
- BDFDB.loadMessage(this);
-
- return true;
- }
- else {
- console.error(`%c[${this.name}]%c`, 'color: #3a71c1; font-weight: 700;', '', 'Fatal Error: Could not load BD functions!');
- return false;
- }
- }
-
- onStop () {
- if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
- BDFDB.unloadMessage(this);
- return true;
- }
- else {
- return false;
- }
- }
-
-
- // begin of own functions
-
- changeLanguageStrings () {
- this.messageContextSubMenuMarkup = this.messageContextSubMenuMarkup.replace("REPLACE_submenu_disabled_text", this.labels.submenu_disabled_text);
- }
-
- onNativeContextMenu (instance, menu) {
- if (instance.props && instance.props.type == "NATIVE_IMAGE" && instance.props.href && !menu.querySelector(".reverseimagesearch-item")) {
- this.appendItem(instance, menu, instance.props.href);
- }
- }
-
- onMessageContextMenu (instance, menu) {
- if (instance.props && instance.props.message && instance.props.channel && instance.props.target && !menu.querySelector(".reverseimagesearch-item")) {
- if (instance.props.attachment) {
- this.appendItem(instance, menu, instance.props.attachment.url);
- }
- if (instance.props.target.tagName == "A") {
- BDFDB.toggleEles(menu, false);
- require("request")(instance.props.target.href, (error, response, result) => {
- if (response && response.headers["content-type"] && response.headers["content-type"].indexOf("image") != -1) {
- this.appendItem(instance, menu, instance.props.target.href);
- }
- BDFDB.toggleEles(menu, true);
- BDFDB.updateContextPosition(menu);
- });
- }
- }
- }
-
- appendItem (instance, menu, url) {
- if (instance && menu && url) {
- if (url.indexOf("discordapp.com/assets/") == -1) {
- if (url.indexOf("https://images-ext-1.discordapp.net/external/") > -1) {
- if (url.split("/https/").length != 1) url = "https://" + url.split("/https/")[url.split("/https/").length-1];
- else if (url.split("/http/").length != 1) url = "http://" + url.split("/http/")[url.split("/http/").length-1];
- }
- let messageContextEntry = BDFDB.htmlToElement(this.messageContextEntryMarkup);
- menu.appendChild(messageContextEntry);
- let searchitem = messageContextEntry.querySelector(".reverseimagesearch-item");
- searchitem.addEventListener("mouseenter", () => {
- let messageContextSubMenu = BDFDB.htmlToElement(this.messageContextSubMenuMarkup);
- let engines = BDFDB.getAllData(this, "engines");
- for (let key in engines) if (!engines[key]) BDFDB.removeEles(messageContextSubMenu.querySelector("[engine='" + key + "']"));
- if (messageContextSubMenu.querySelector(".RIS-item")) BDFDB.removeEles(messageContextSubMenu.querySelector(".alldisabled-item"));
- BDFDB.addChildEventListener(messageContextSubMenu, "click", ".RIS-item", e => {
- instance._reactInternalFiber.return.memoizedProps.closeContextMenu();
- let engine = e.currentTarget.getAttribute("engine");
- if (engine == "_all") {
- for (let key in engines) if (key != "_all" && engines[key]) window.open(this.defaults.engines[key].url.replace(this.imgUrlReplaceString, encodeURIComponent(url)), "_blank");
- }
- else window.open(this.defaults.engines[engine].url.replace(this.imgUrlReplaceString, encodeURIComponent(url)), "_blank");
- });
- BDFDB.appendSubMenu(searchitem, messageContextSubMenu);
- });
- }
- }
- }
-
- setLabelsByLanguage () {
- switch (BDFDB.getDiscordLanguage().id) {
- case "hr": //croatian
- return {
- submenu_disabled_text: "Svi su onemogućeni"
- };
- case "da": //danish
- return {
- submenu_disabled_text: "Alle deaktiveret"
- };
- case "de": //german
- return {
- submenu_disabled_text: "Alle deaktiviert"
- };
- case "es": //spanish
- return {
- submenu_disabled_text: "Todo desactivado"
- };
- case "fr": //french
- return {
- submenu_disabled_text: "Tous désactivés"
- };
- case "it": //italian
- return {
- submenu_disabled_text: "Tutto disattivato"
- };
- case "nl": //dutch
- return {
- submenu_disabled_text: "Alles gedeactiveerd"
- };
- case "no": //norwegian
- return {
- submenu_disabled_text: "Alle deaktivert"
- };
- case "pl": //polish
- return {
- submenu_disabled_text: "Wszystkie wyłączone"
- };
- case "pt-BR": //portuguese (brazil)
- return {
- submenu_disabled_text: "Todos desativados"
- };
- case "fi": //finnish
- return {
- submenu_disabled_text: "Kaikki on poistettu käytöstä"
- };
- case "sv": //swedish
- return {
- submenu_disabled_text: "Alla avaktiverade"
- };
- case "tr": //turkish
- return {
- submenu_disabled_text: "Hepsi deaktive"
- };
- case "cs": //czech
- return {
- submenu_disabled_text: "Všechny deaktivované"
- };
- case "bg": //bulgarian
- return {
- submenu_disabled_text: "Всички са деактивирани"
- };
- case "ru": //russian
- return {
- submenu_disabled_text: "Все деактивированные"
- };
- case "uk": //ukrainian
- return {
- submenu_disabled_text: "Всі вимкнені"
- };
- case "ja": //japanese
- return {
- submenu_disabled_text: "すべて非アクティブ化"
- };
- case "zh-TW": //chinese (traditional)
- return {
- submenu_disabled_text: "全部停用"
- };
- case "ko": //korean
- return {
- submenu_disabled_text: "모두 비활성화 됨"
- };
- default: //default: english
- return {
- submenu_disabled_text: "All disabled"
- };
- }
- }
- }
-};
diff --git a/PluginsV2/SendLargeMessages/README.md b/PluginsV2/SendLargeMessages/README.md
deleted file mode 100644
index f4cef33116..0000000000
--- a/PluginsV2/SendLargeMessages/README.md
+++ /dev/null
@@ -1,5 +0,0 @@
-# These Plugins are meant only for BDv2, not BD nor BandagedBD. If you got either of those two go to [Plugins](https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/).
-
-## Send Large Messages - [Download Script](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/SendLargeMessages/index.js) [Download Config](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/SendLargeMessages/config.json)
-
-Opens a popout when your message is too large, which allows you to automatically send the message in several smaller messages.
diff --git a/PluginsV2/SendLargeMessages/config.json b/PluginsV2/SendLargeMessages/config.json
deleted file mode 100644
index fe4545795c..0000000000
--- a/PluginsV2/SendLargeMessages/config.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "info": {
- "name": "SendLargeMessages",
- "authors": [
- {
- "name": "DevilBro",
- "url": "https://www.paypal.me/MircoWittrien",
- "discord_id": "278543574059057154",
- "github_username": "mwittrien"
- }
- ],
- "version": 1.0,
- "description": "Opens a popout when your message is too large, which allows you to automatically send the message in several smaller messages. \n\nMy Support Server: http://bit.ly/DevilBrosHaus or https://discordapp.com/invite/Jx3TjNS"
- }
-}
diff --git a/PluginsV2/SendLargeMessages/index.js b/PluginsV2/SendLargeMessages/index.js
deleted file mode 100644
index a74e70c2b8..0000000000
--- a/PluginsV2/SendLargeMessages/index.js
+++ /dev/null
@@ -1,446 +0,0 @@
-module.exports = (Plugin, Api, Vendor) => {
- if (!global.BDFDB || typeof BDFDB != "object") global.BDFDB = {myPlugins:{}, BDv2Api: Api};
-
- return class extends Plugin {
- initConstructor () {
- this.labels = {};
-
- this.patchModules = {
- "ChannelTextArea":"componentDidMount"
- };
-
- this.messageDelay = 1000; //changing at own risk, might result in bans or mutes
-
- this.css = `
- .${this.name}-modal textarea {
- rows: 0;
- cols: 0;
- height: 100vw;
- resize: none;
- }
- .${this.name}-modal #warning-message {
- color: red;
- }
-
- .${this.name}-modal #character-counter {
- float: right;
- color: white;
- opacity: .5;
- }`;
-
- this.sendMessageModalMarkup =
- `
-
-
- `;
- }
-
- onStart () {
- if (global.BDFDB && global.BDFDB.myPlugins && typeof global.BDFDB.myPlugins == "object") global.BDFDB.myPlugins[this.name] = this;
- var libraryScript = document.querySelector('head script[src="https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js"]');
- if (!global.BDFDB || typeof BDFDB != "object" || performance.now() - BDFDB.creationTime > 600000) {
- if (libraryScript) libraryScript.remove();
- libraryScript = document.createElement("script");
- libraryScript.setAttribute("type", "text/javascript");
- libraryScript.setAttribute("src", "https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js");
- libraryScript.setAttribute("date", performance.now());
- libraryScript.addEventListener("load", () => {if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();});
- document.head.appendChild(libraryScript);
- }
- else if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();
- this.startTimeout = setTimeout(() => {this.initialize();}, 30000);
- }
-
- initialize () {
- if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
- if (this.started) return true;
- BDFDB.loadMessage(this);
-
- this.clipboard = require("electron").clipboard;
-
- BDFDB.WebModules.forceAllUpdates(this);
-
- return true;
- }
- else {
- console.error(`%c[${this.name}]%c`, 'color: #3a71c1; font-weight: 700;', '', 'Fatal Error: Could not load BD functions!');
- return false;
- }
- }
-
-
- onStop () {
- if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
- BDFDB.unloadMessage(this);
- return true;
- }
- else {
- return false;
- }
- }
-
-
- // begin of own functions
-
- changeLanguageStrings () {
- this.sendMessageModalMarkup = this.sendMessageModalMarkup.replace("REPLACE_modal_header_text", this.labels.modal_header_text);
- this.sendMessageModalMarkup = this.sendMessageModalMarkup.replace("REPLACE_btn_cancel_text", this.labels.btn_cancel_text);
- this.sendMessageModalMarkup = this.sendMessageModalMarkup.replace("REPLACE_btn_send_text", this.labels.btn_send_text);
- }
-
- processChannelTextArea (instance, wrapper) {
- if (instance.props && instance.props.type && instance.props.type == "normal") {
- var textarea = wrapper.querySelector("textarea");
- if (!textarea) return;
- let modaltext, checkTextarea = () => {
- if (BDFDB.getParsedLength(textarea.value) > 1950) {
- textarea.selectionStart = 0;
- textarea.selectionEnd = textarea.value.length;
- document.execCommand("insertText", false, "");
- this.showSendModal(modaltext);
- }
- };
- BDFDB.addEventListener(this, textarea, "keyup", e => {
- clearTimeout(textarea.sendlargemessagestimeout);
- textarea.sendlargemessagestimeout = setTimeout(() => {
- modaltext = textarea.value;
- checkTextarea();
- },100);
- });
- BDFDB.addEventListener(this, textarea, "paste", e => {
- modaltext = textarea.value.slice(0, textarea.selectionStart) + this.clipboard.readText() + textarea.value.slice(textarea.selectionEnd);
- setImmediate(() => {checkTextarea(textarea);});
- });
- }
- }
-
- showSendModal (text) {
- let sendMessageModal = BDFDB.htmlToElement(this.sendMessageModalMarkup);
- let textinput = sendMessageModal.querySelector("#modal-inputtext");
- let warning = sendMessageModal.querySelector("#warning-message");
- let counter = sendMessageModal.querySelector("#character-counter");
-
- let updateCounter = () => {
- let parsedlength = BDFDB.getParsedLength(textinput.value);
- let messageAmount = Math.ceil(parsedlength/1900);
- warning.innerText = messageAmount > 15 ? this.labels.modal_messages_warning : "";
- counter.innerText = parsedlength + " (" + (textinput.selectionEnd - textinput.selectionStart) + ") => " + this.labels.modal_messages_translation + ": " + messageAmount;
- };
-
- BDFDB.appendModal(sendMessageModal);
-
- BDFDB.addChildEventListener(sendMessageModal, "click", ".btn-send", e => {
- e.preventDefault();
- let messages = this.formatText(textinput.value || "");
- messages.forEach((message,i) => {
- setTimeout(() => {
- this.sendMessage(message);
- if (i >= messages.length-1) BDFDB.showToast(this.labels.toast_allsent_text, {type:"success"});
- },this.messageDelay * i);
- });
- });
-
- textinput.value = text || "";
- textinput.addEventListener("keyup", () => {setTimeout(() => {updateCounter();},10);});
- textinput.addEventListener("click", () => {updateCounter();});
- textinput.addEventListener("mousedown", () => {
- var mouseup = () => {
- document.removeEventListener("mouseup", mouseup);
- document.removeEventListener("mousemove", mousemove);
- };
- var mousemove = () => {
- setTimeout(() => {updateCounter();},10);
- };
- document.addEventListener("mouseup", mouseup);
- document.addEventListener("mousemove", mousemove);
- });
- updateCounter();
- textinput.focus();
- }
-
- formatText (text) {
- text = text.replace(new RegExp("\t", 'g'), " ");
- let longwords = text.match(/[\S]{1800,}/gm);
- for (let i in longwords) {
- let longword = longwords[i];
- let count1 = 0;
- let shortwords = [];
- longword.split("").forEach((char) => {
- if (shortwords[count1] && BDFDB.getParsedLength(shortwords[count1]) >= 1800) count1++;
- shortwords[count1] = shortwords[count1] ? shortwords[count1] + char : char;
- });
- text = text.replace(longword, shortwords.join(" "));
- }
- let messages = [];
- let count2 = 0;
- text.split(" ").forEach((word) => {
- if (messages[count2] && BDFDB.getParsedLength(messages[count2] + "" + word) > 1900) 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;
- }
-
- 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;
- }
-
- sendMessage (text) {
- let textarea = document.querySelector(BDFDB.dotCNS.textareawrapchat + "textarea");
- if (textarea) {
- let instance = BDFDB.getOwnerInstance({"node":textarea.parentElement, "name":"ChannelTextAreaForm", "up":true});
- if (instance) {
- instance.setState({textValue:text});
- BDFDB.triggerSend(textarea);
- }
- }
- }
-
- setLabelsByLanguage () {
- switch (BDFDB.getDiscordLanguage().id) {
- case "hr": //croatian
- return {
- toast_allsent_text: "Sve veliku poslane.",
- modal_messages_translation: "Vijesti",
- modal_messages_warning: "Nemojte slati previše veliku!",
- modal_header_text: "Pošalji veliku poruku:",
- btn_cancel_text: "Prekid",
- btn_send_text: "Poslati"
- };
- case "da": //danish
- return {
- toast_allsent_text: "Alle beskeder sendes.",
- modal_messages_translation: "Beskeder",
- modal_messages_warning: "Send ikke for mange beskeder!",
- modal_header_text: "Send stor besked:",
- btn_cancel_text: "Afbryde",
- btn_send_text: "Sende"
- };
- case "de": //german
- return {
- toast_allsent_text: "Alle Nachrichten versendet.",
- modal_messages_translation: "Nachrichten",
- modal_messages_warning: "Schicke nicht zu viele Nachrichten!",
- modal_header_text: "Große Nachricht senden:",
- btn_cancel_text: "Abbrechen",
- btn_send_text: "Senden"
- };
- case "es": //spanish
- return {
- toast_allsent_text: "Todos los mensajes enviados.",
- modal_messages_translation: "Mensajes",
- modal_messages_warning: "¡No envíe demasiados mensajes!",
- modal_header_text: "Enviar mensaje grande:",
- btn_cancel_text: "Cancelar",
- btn_send_text: "Enviar"
- };
- case "fr": //french
- return {
- toast_allsent_text: "Tous les messages envoyés",
- modal_messages_translation: "Messages",
- modal_messages_warning: "N'envoyez pas trop de messages!",
- modal_header_text: "Envoyer un gros message:",
- btn_cancel_text: "Abandonner",
- btn_send_text: "Envoyer"
- };
- case "it": //italian
- return {
- toast_allsent_text: "Tutti i messaggi inviati.",
- modal_messages_translation: "Messaggi",
- modal_messages_warning: "Non inviare troppi messaggi!",
- modal_header_text: "Invia grande messaggio:",
- btn_cancel_text: "Cancellare",
- btn_send_text: "Inviare"
- };
- case "nl": //dutch
- return {
- toast_allsent_text: "Alle berichten verzonden.",
- modal_messages_translation: "Berichten",
- modal_messages_warning: "Stuur niet te veel berichten!",
- modal_header_text: "Stuur een groot bericht:",
- btn_cancel_text: "Afbreken",
- btn_send_text: "Sturen"
- };
- case "no": //norwegian
- return {
- toast_allsent_text: "Alle meldinger sendt.",
- modal_messages_translation: "Meldinger",
- modal_messages_warning: "Ikke send for mange meldinger!",
- modal_header_text: "Send stor melding:",
- btn_cancel_text: "Avbryte",
- btn_send_text: "Sende"
- };
- case "pl": //polish
- return {
- toast_allsent_text: "Wszystkie wiadomości zostały wysłane.",
- modal_messages_translation: "Wiadomości",
- modal_messages_warning: "Nie wysyłaj zbyt wielu wiadomości!",
- modal_header_text: "Wyślij dużą wiadomość:",
- btn_cancel_text: "Anuluj",
- btn_send_text: "Wyślij"
- };
- case "pt-BR": //portuguese (brazil)
- return {
- toast_allsent_text: "Todas as mensagens enviadas.",
- modal_messages_translation: "Mensagens",
- modal_messages_warning: "Não envie muitas mensagens!",
- modal_header_text: "Enviar mensagem grande:",
- btn_cancel_text: "Cancelar",
- btn_send_text: "Enviar"
- };
- case "fi": //finnish
- return {
- toast_allsent_text: "Kaikki lähetetyt viestit.",
- modal_messages_translation: "Viestien",
- modal_messages_warning: "Älä lähetä liian monta viestiä!",
- modal_header_text: "Lähetä suuri viesti:",
- btn_cancel_text: "Peruuttaa",
- btn_send_text: "Lähettää"
- };
- case "sv": //swedish
- return {
- toast_allsent_text: "Alla meddelanden skickade.",
- modal_messages_translation: "Meddelanden",
- modal_messages_warning: "Skicka inte för många meddelanden!",
- modal_header_text: "Skicka stort meddelande:",
- btn_cancel_text: "Avbryta",
- btn_send_text: "Skicka"
- };
- case "tr": //turkish
- return {
- toast_allsent_text: "Tüm mesajlar gönderildi.",
- modal_messages_translation: "Mesajları",
- modal_messages_warning: "Çok fazla mesaj göndermeyin!",
- modal_header_text: "Büyük mesaj gönder:",
- btn_cancel_text: "Iptal",
- btn_send_text: "Göndermek"
- };
- case "cs": //czech
- return {
- toast_allsent_text: "Všechny zprávy byly odeslány.",
- modal_messages_translation: "Zpráv",
- modal_messages_warning: "Neposílejte příliš mnoho zpráv!",
- modal_header_text: "Odeslat velkou zprávu:",
- btn_cancel_text: "Zrušení",
- btn_send_text: "Poslat"
- };
- case "bg": //bulgarian
- return {
- toast_allsent_text: "Всички изпратени съобщения.",
- modal_messages_translation: "Съобщения",
- modal_messages_warning: "Не изпращайте твърде много съобщения!",
- modal_header_text: "Изпратете голямо съобщение:",
- btn_cancel_text: "Зъбести",
- btn_send_text: "изпращам"
- };
- case "ru": //russian
- return {
- toast_allsent_text: "Все отправленные сообщения.",
- modal_messages_translation: "Сообщения",
- modal_messages_warning: "Не отправляйте слишком много сообщений!",
- modal_header_text: "Отправить сообщение:",
- btn_cancel_text: "Отмена",
- btn_send_text: "Послать"
- };
- case "uk": //ukrainian
- return {
- toast_allsent_text: "Всі повідомлення надіслано.",
- modal_messages_translation: "Повідомлення",
- modal_messages_warning: "Не надсилайте надто багато повідомлень!",
- modal_header_text: "Надіслати велике повідомлення:",
- btn_cancel_text: "Скасувати",
- btn_send_text: "Відправити"
- };
- case "ja": //japanese
- return {
- toast_allsent_text: "すべてのメッセージが送信されました。",
- modal_messages_translation: "メッセージ",
- modal_messages_warning: "あまりにも多くのメッセージを送信しないでください!",
- modal_header_text: "大きなメッセージを送信する:",
- btn_cancel_text: "キャンセル",
- btn_send_text: "送信"
- };
- case "zh-TW": //chinese (traditional)
- return {
- toast_allsent_text: "發送的所有消息。",
- modal_messages_translation: "消息",
- modal_messages_warning: "不要發送太多信息!",
- modal_header_text: "發送大信息:",
- btn_cancel_text: "取消",
- btn_send_text: "發送"
- };
- case "ko": //korean
- return {
- toast_allsent_text: "모든 메시지가 전송되었습니다.",
- modal_messages_translation: "메시지",
- modal_messages_warning: "너무 많은 메시지를 보내지 마십시오!",
- modal_header_text: "큰 메시지 보내기:",
- btn_cancel_text: "취소",
- btn_send_text: "보내다"
- };
- default: //default: english
- return {
- toast_allsent_text: "All messages sent.",
- modal_messages_translation: "Messages",
- modal_messages_warning: "Do not send too many messages!",
- modal_header_text: "Send large message:",
- btn_cancel_text: "Cancel",
- btn_send_text: "Send"
- };
- }
- }
- }
-};
diff --git a/PluginsV2/ServerFolders/README.md b/PluginsV2/ServerFolders/README.md
deleted file mode 100644
index 26976e379e..0000000000
--- a/PluginsV2/ServerFolders/README.md
+++ /dev/null
@@ -1,14 +0,0 @@
-# These Plugins are meant only for BDv2, not BD nor BandagedBD. If you got either of those two go to [Plugins](https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/).
-
-## Server Folders - [Download Script](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/ServerFolders/index.js) [Download Config](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/ServerFolders/config.json)
-
-Adds the feature to create folders to organize your servers.
-
-- Right click a server > 'Serverfolders' > 'Create Folder' to create a folder.
-- To add servers to a folder hold 'Ctrl' and drag the server onto the folder, this will add the server to the folderlist and hide it in the serverlist.
-- To open a folder click the folder. A folder can only be opened when it has at least one server in it.
-- To remove a server from a folder, open the folder and either right click the server > 'Serverfolders' > 'Remove Server from Folder' or hold 'Del' and click the server in the folderlist.
-- Right clicking a folder gives you the option to
- - Clear all notifications of the servers within the folder (greyed out if no notifications are present).
- - Open the settingspopout for the folder to change the icon, the name and/or the color of the folder.
- - Delete the folder.
diff --git a/PluginsV2/ServerFolders/config.json b/PluginsV2/ServerFolders/config.json
deleted file mode 100644
index 1ee56606ad..0000000000
--- a/PluginsV2/ServerFolders/config.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "info": {
- "name": "ServerFolders",
- "authors": [
- {
- "name": "DevilBro",
- "url": "https://www.paypal.me/MircoWittrien",
- "discord_id": "278543574059057154",
- "github_username": "mwittrien"
- }
- ],
- "version": 1.0,
- "description": "Adds the feature to create folders to organize your servers. Right click a server > 'Serverfolders' > 'Create Server' to create a server. To add servers to a folder hold 'Ctrl' and drag the server onto the folder, this will add the server to the folderlist and hide it in the serverlist. To open a folder click the folder. A folder can only be opened when it has at least one server in it. To remove a server from a folder, open the folder and either right click the server > 'Serverfolders' > 'Remove Server from Folder' or hold 'Del' and click the server in the folderlist. \n\nMy Support Server: http://bit.ly/DevilBrosHaus or https://discordapp.com/invite/Jx3TjNS"
- }
-}
diff --git a/PluginsV2/ServerFolders/index.js b/PluginsV2/ServerFolders/index.js
deleted file mode 100644
index 6f42cdda36..0000000000
--- a/PluginsV2/ServerFolders/index.js
+++ /dev/null
@@ -1,1825 +0,0 @@
-module.exports = (Plugin, Api, Vendor) => {
- if (!global.BDFDB || typeof BDFDB != "object") global.BDFDB = {myPlugins:{}, BDv2Api: Api};
-
- return class extends Plugin {
- initConstructor () {
- this.labels = {};
-
- this.patchModules = {
- "Guilds":"componentDidMount",
- "Guild":["componentDidMount","componentWillUnmount"]
- };
-
- this.css = `
- .${this.name}-modal .ui-icon-picker-icon {
- position: relative;
- width: 70px;
- height: 70px;
- border: 4px solid transparent;
- border-radius: 12px;
- margin: 0;
- }
- .${this.name}-modal .ui-icon-picker-icon .ui-picker-inner {
- margin: 5px 5px;
- width: 60px;
- height: 60px;
- background-repeat: no-repeat;
- background-clip: padding-box;
- background-position: 50%;
- background-size: cover;
- border-radius: 12px;
- }
- .${this.name}-modal .ui-icon-picker-icon.selected ${BDFDB.dotCN.hovercardbutton} {
- display: none !important;
- }
- .${this.name}-modal .ui-icon-picker-icon ${BDFDB.dotCN.hovercardbutton} {
- position: absolute;
- top: -10px;
- right: -10px;
- }
- .${this.name}-modal .ui-icon-picker-icon.preview.nopic .ui-picker-inner {
- background-image: url('data:image/svg+xml; utf8, ');
- }
- ${BDFDB.dotCN.guild}.folder ${BDFDB.dotCN.avataricon} {
- background-clip: padding-box !important;
- background-position: center !important;
- background-size: cover !important;
- }
- ${BDFDB.dotCN.guild}.folder ${BDFDB.dotCN.badge}.folder.count {
- background: #7289DA;
- top: -2px;
- left: -2px;
- right: unset;
- bottom: unset;
- }
- ${BDFDB.dotCN.guild}.serverfolders-dragpreview {
- pointer-events: none !important;
- position: absolute !important;
- opacity: 0.5 !important;
- z-index: 10000 !important;
- }
- ${BDFDB.dotCN.guild}.serverfolders-dragpreview,
- ${BDFDB.dotCN.guild}.serverfolders-dragpreview ${BDFDB.dotCN.guildinner},
- ${BDFDB.dotCN.guild}.serverfolders-dragpreview ${BDFDB.dotCN.guildinner} a,
- ${BDFDB.dotCN.guild}.serverfolders-dragpreview ${BDFDB.dotCNS.guildinner + BDFDB.dotCN.guildicon} {
- border-radius: 50% !important;
- width: 50px !important;
- height: 50px !important;
- }
- ${BDFDB.dotCN.guild}.serverfolders-dragpreview:before,
- ${BDFDB.dotCN.guild}.serverfolders-dragpreview:after,
- ${BDFDB.dotCN.guild}.serverfolders-dragpreview ${BDFDB.dotCN.badge} {
- display: none !important;
- }
- ${BDFDB.dotCN.guild}.serverfolders-dragpreview ${BDFDB.dotCN.avataricon} {
- background-color: transparent !important;
- overflow: hidden !important;
- }
- ${BDFDB.dotCN.guildswrapper}.foldercontent {
- transition: width .3s linear !important;
- }
- ${BDFDB.dotCN.guildswrapper}.foldercontent .folderseparator {
- margin-top: 10px;
- }
- ${BDFDB.dotCN.guildswrapper}.foldercontent.foldercontentclosed {
- width: 0px !important;
- }`;
-
- this.serverContextEntryMarkup =
- ``;
-
- this.serverContextSubMenuMarkup =
- ``;
-
- this.folderContextMarkup =
- ``;
-
- this.folderContentMarkup =
- ``;
-
- this.folderIconMarkup =
- ``;
-
- this.folderSettingsModalMarkup =
- `
-
-
-
-
-
-
-
-
REPLACE_modal_tabheader1_text
-
REPLACE_modal_tabheader2_text
-
REPLACE_modal_tabheader3_text
-
REPLACE_modal_tabheader4_text
-
-
-
-
-
-
-
- `;
- }
-
- onStart () {
- if (global.BDFDB && global.BDFDB.myPlugins && typeof global.BDFDB.myPlugins == "object") global.BDFDB.myPlugins[this.name] = this;
- var libraryScript = document.querySelector('head script[src="https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js"]');
- if (!global.BDFDB || typeof BDFDB != "object" || performance.now() - BDFDB.creationTime > 600000) {
- if (libraryScript) libraryScript.remove();
- libraryScript = document.createElement("script");
- libraryScript.setAttribute("type", "text/javascript");
- libraryScript.setAttribute("src", "https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js");
- libraryScript.setAttribute("date", performance.now());
- libraryScript.addEventListener("load", () => {if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();});
- document.head.appendChild(libraryScript);
- }
- else if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();
- this.startTimeout = setTimeout(() => {this.initialize();}, 30000);
- }
-
- initialize () {
- if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
- if (this.started) return true;
- BDFDB.loadMessage(this);
-
- if (BDFDB.isPluginEnabled("HideUtils") && !BDFDB.loadData("hideutils", this, "warnings")) BDFDB.openConfirmModal(this, this.name + " is not compartible with the plugin HideUtils by Arashiryuu. You might expierence bugs like Servers that should be hidden due to being part of a Folder still being visible in the Guildlist. To avoid this disable the Plugin HideUtils. Press the " + BDFDB.getLibraryStrings().btn_ok_text + "-Button to not show this Message again.", "Warning", () => {BDFDB.saveData("hideutils", true, this, "warnings")});
-
- this.GuildUtils = BDFDB.WebModules.findByProperties("getGuilds","getGuild");
- this.DiscordConstants = BDFDB.WebModules.findByProperties("Permissions", "ActivityTypes", "StatusTypes");
- this.Animations = BDFDB.WebModules.findByProperties("spring");
-
- BDFDB.WebModules.forceAllUpdates(this, "Guilds");
-
- return true;
- }
- else {
- console.error(`%c[${this.name}]%c`, 'color: #3a71c1; font-weight: 700;', '', 'Fatal Error: Could not load BD functions!');
- return false;
- }
- }
-
- onStop () {
- if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
- this.resetAllElements();
- BDFDB.removeEles(this.foldercontent, BDFDB.dotCN.guildswrapper + ".foldercontent", ".serverfolder-contextmenu");
- BDFDB.unloadMessage(this);
- return true;
- }
- else {
- return false;
- }
- }
-
- onSwitch() {
- if (typeof BDFDB === "object" && BDFDB.getData("forceOpenFolder", this, "settings")) {
- let serverObj = BDFDB.getSelectedServer();
- if (!serverObj) return;
- let folderdiv = this.getFolderOfServer(serverObj);
- if (!folderdiv || BDFDB.containsClass(folderdiv, "open")) return;
- this.openCloseFolder(folderdiv);
- }
- }
-
-
- // begin of own functions
-
- changeLanguageStrings () {
- this.serverContextEntryMarkup = this.serverContextEntryMarkup.replace("REPLACE_servercontext_serverfolders_text", this.labels.servercontext_serverfolders_text);
-
- this.serverContextSubMenuMarkup = this.serverContextSubMenuMarkup.replace("REPLACE_serversubmenu_createfolder_text", this.labels.serversubmenu_createfolder_text);
- this.serverContextSubMenuMarkup = this.serverContextSubMenuMarkup.replace("REPLACE_serversubmenu_removefromfolder_text", this.labels.serversubmenu_removefromfolder_text);
-
- this.folderContextMarkup = this.folderContextMarkup.replace("REPLACE_foldercontext_unreadfolder_text", this.labels.foldercontext_unreadfolder_text);
- this.folderContextMarkup = this.folderContextMarkup.replace("REPLACE_foldercontext_autounreadfolder_text", this.labels.foldercontext_autounreadfolder_text);
- this.folderContextMarkup = this.folderContextMarkup.replace("REPLACE_foldercontext_foldersettings_text", this.labels.foldercontext_foldersettings_text);
- this.folderContextMarkup = this.folderContextMarkup.replace("REPLACE_foldercontext_createfolder_text", this.labels.serversubmenu_createfolder_text);
- this.folderContextMarkup = this.folderContextMarkup.replace("REPLACE_foldercontext_removefolder_text", this.labels.foldercontext_removefolder_text);
-
- this.folderSettingsModalMarkup = this.folderSettingsModalMarkup.replace("REPLACE_modal_header_text", this.labels.modal_header_text);
- this.folderSettingsModalMarkup = this.folderSettingsModalMarkup.replace("REPLACE_modal_foldername_text", this.labels.modal_foldername_text);
- this.folderSettingsModalMarkup = this.folderSettingsModalMarkup.replace("REPLACE_modal_tabheader1_text", this.labels.modal_tabheader1_text);
- this.folderSettingsModalMarkup = this.folderSettingsModalMarkup.replace("REPLACE_modal_tabheader2_text", this.labels.modal_tabheader2_text);
- this.folderSettingsModalMarkup = this.folderSettingsModalMarkup.replace("REPLACE_modal_tabheader3_text", this.labels.modal_tabheader3_text);
- this.folderSettingsModalMarkup = this.folderSettingsModalMarkup.replace("REPLACE_modal_tabheader4_text", this.labels.modal_tabheader4_text);
- this.folderSettingsModalMarkup = this.folderSettingsModalMarkup.replace("REPLACE_modal_iconpicker_text", this.labels.modal_iconpicker_text);
- this.folderSettingsModalMarkup = this.folderSettingsModalMarkup.replace("REPLACE_modal_copytooltipcolor_text", this.labels.modal_copytooltipcolor_text);
- this.folderSettingsModalMarkup = this.folderSettingsModalMarkup.replace("REPLACE_modal_colorpicker1_text", this.labels.modal_colorpicker1_text);
- this.folderSettingsModalMarkup = this.folderSettingsModalMarkup.replace("REPLACE_modal_colorpicker2_text", this.labels.modal_colorpicker2_text);
- this.folderSettingsModalMarkup = this.folderSettingsModalMarkup.replace("REPLACE_modal_colorpicker3_text", this.labels.modal_colorpicker3_text);
- this.folderSettingsModalMarkup = this.folderSettingsModalMarkup.replace("REPLACE_modal_colorpicker4_text", this.labels.modal_colorpicker4_text);
- this.folderSettingsModalMarkup = this.folderSettingsModalMarkup.replace("REPLACE_modal_customopen_text", this.labels.modal_customopen_text);
- this.folderSettingsModalMarkup = this.folderSettingsModalMarkup.replace("REPLACE_modal_customclosed_text", this.labels.modal_customclosed_text);
- this.folderSettingsModalMarkup = this.folderSettingsModalMarkup.replace("REPLACE_modal_custompreview_text", this.labels.modal_custompreview_text);
- }
-
- onGuildContextMenu (instance, menu) {
- if (document.querySelector(".DevilBro-modal")) return;
- if (instance.props && instance.props.target && instance.props.guild && instance.props.type == "GUILD_ICON_BAR" && !menu.querySelector(".serverfolders-item")) {
- let serverContextEntry = BDFDB.htmlToElement(this.serverContextEntryMarkup);
- menu.appendChild(serverContextEntry);
- let folderitem = serverContextEntry.querySelector(".serverfolders-item");
- folderitem.addEventListener("mouseenter", () => {
- let serverContextSubMenu = BDFDB.htmlToElement(this.serverContextSubMenuMarkup);
- let createitem = serverContextSubMenu.querySelector(".createfolder-item");
- createitem.addEventListener("click", () => {
- instance._reactInternalFiber.return.memoizedProps.closeContextMenu();
- this.createNewFolder(instance.props.target);
- });
- let folderdiv = this.getFolderOfServer(instance.props.guild);
- if (folderdiv) {
- let removeitem = serverContextSubMenu.querySelector(".removefromfolder-item");
- BDFDB.removeClass(removeitem, BDFDB.disCN.contextmenuitemdisabled);
- removeitem.addEventListener("click", () => {
- instance._reactInternalFiber.return.memoizedProps.closeContextMenu();
- this.removeServerFromFolder(instance.props.guild, folderdiv);
- });
- }
- BDFDB.appendSubMenu(folderitem, serverContextSubMenu);
- });
- }
- }
-
- processGuilds (instance, wrapper) {
- setTimeout(() => {
- if (!wrapper.parentElement.querySelector(BDFDB.dotCN.guildswrapper + ".foldercontent")) {
- this.foldercontent = BDFDB.htmlToElement(this.folderContentMarkup);
- wrapper.parentElement.insertBefore(this.foldercontent, wrapper.nextElementSibling);
- this.foldercontentguilds = this.foldercontent.querySelector(BDFDB.dotCN.guilds);
- }
- let folders = BDFDB.loadAllData(this, "folders"), sortedFolders = [];
- for (let id in folders) sortedFolders[folders[id].position] = folders[id];
- for (let data of sortedFolders) if (data && !wrapper.querySelector(BDFDB.dotCN.guild + ".folder#" + data.folderID)) {
- let folderdiv = this.createFolderDiv(data);
- this.readIncludedServerList(folderdiv).forEach(guilddiv => {this.hideServer(guilddiv, folderdiv);});
- }
- BDFDB.WebModules.forceAllUpdates(this, "Guild");
- },5000);
- }
-
- processGuild (instance, wrapper, methodnames) {
- if (instance.props && instance.props.guild) {
- if (methodnames.includes("componentDidMount")) {
- let folderdiv = this.getFolderOfServer(instance.props.guild);
- if (folderdiv && !wrapper.getAttribute("folder")) {
- this.hideServer(wrapper, folderdiv);
- this.updateCopyInFolderContent(wrapper, folderdiv);
- this.updateFolderNotifications(folderdiv);
- }
- BDFDB.addEventListener(this, wrapper, "click", () => {
- if (BDFDB.getData("closeAllFolders", this, "settings")) document.querySelectorAll(".folder.open").forEach(openFolder => {this.openCloseFolder(openFolder);});
- });
- BDFDB.addEventListener(this, wrapper, "mousedown", e => {
- if (BDFDB.pressedKeys.includes(17)) {
- e.originalEvent.stopPropagation();
- e.originalEvent.preventDefault();
- let dragpreview = this.createDragPreview(wrapper, e);
- let updatePreview = e2 => {
- this.updateDragPreview(dragpreview, e2);
- };
- let droppedPreview = e2 => {
- let dropfolderdiv = BDFDB.getParentEle(BDFDB.dotCN.guild + ".folder", e2.target);
- if (dropfolderdiv) this.addServerToFolder(instance.props.guild, dropfolderdiv);
- document.removeEventListener("mousemove", updatePreview);
- document.removeEventListener("mouseup", droppedPreview);
- BDFDB.removeEles(dragpreview);
- };
- document.addEventListener("mousemove", updatePreview);
- document.addEventListener("mouseup", droppedPreview);
- }
- });
- }
- if (methodnames.includes("componentWillUnmount")) {
- let folderdiv = this.getFolderOfServer(instance.props.guild);
- if (folderdiv) {
- BDFDB.removeEles(this.foldercontent.querySelectorAll(`[guild="${instance.props.guild.id}"]`));
- this.updateFolderNotifications(folderdiv);
- }
- }
- }
- }
-
- showFolderSettings (folderdiv) {
- if (!folderdiv) return;
- let {folderID,folderName,position,iconID,icons,copyTooltipColor,color1,color2,color3,color4,servers} = BDFDB.loadData(folderdiv.id, this, "folders") || {};
- if (!folderID) return;
-
- let folderSettingsModal = BDFDB.htmlToElement(this.folderSettingsModalMarkup);
- let foldernameinput = folderSettingsModal.querySelector("#input-foldername");
- let copytooltipcolorinput = folderSettingsModal.querySelector("#input-copytooltipcolor");
-
- folderSettingsModal.querySelector(BDFDB.dotCN.modalguildname).innerText = folderName || "";
- foldernameinput.value = folderName || "";
- foldernameinput.setAttribute("placeholder", folderName || "");
- copytooltipcolorinput.checked = copyTooltipColor;
- this.setIcons(folderSettingsModal, iconID);
- BDFDB.setColorSwatches(folderSettingsModal, color1);
- BDFDB.setColorSwatches(folderSettingsModal, color2);
- BDFDB.setColorSwatches(folderSettingsModal, color3);
- BDFDB.setColorSwatches(folderSettingsModal, color4);
-
- BDFDB.appendModal(folderSettingsModal);
-
- BDFDB.addChildEventListener(folderSettingsModal, "change", "input[type='file'][option]", e => {
- let file = e.currentTarget.files[0];
- if (file) this.fetchCustomIcon(folderSettingsModal, e.currentTarget.getAttribute("option"));
- });
- BDFDB.addChildEventListener(folderSettingsModal, "keyup", "input[type='text'][option]", e => {
- if (e.which == 13) this.fetchCustomIcon(folderSettingsModal, e.currentTarget.getAttribute("option"));
- });
- BDFDB.addChildEventListener(folderSettingsModal, "click", ".btn-addcustom", () => {
- this.saveCustomIcon(folderSettingsModal);
- });
- BDFDB.addChildEventListener(folderSettingsModal, "click", ".btn-save", e => {
- e.preventDefault();
-
- folderName = foldernameinput.value.trim();
- folderName = folderName ? folderName : null;
-
- var oldIconID = iconID;
- var selectedIcon = folderSettingsModal.querySelector(".ui-icon-picker-icon.selected");
- iconID = selectedIcon.getAttribute("value");
-
- copyTooltipColor = copytooltipcolorinput.checked;
-
- var oldColor1 = color1;
- var oldColor2 = color2;
- color1 = BDFDB.getSwatchColor(folderSettingsModal, 1);
- color2 = BDFDB.getSwatchColor(folderSettingsModal, 2);
- color3 = BDFDB.getSwatchColor(folderSettingsModal, 3);
- color4 = BDFDB.getSwatchColor(folderSettingsModal, 4);
-
- if (iconID != oldIconID || !BDFDB.equals(color1, oldColor1) || !BDFDB.equals(color2, oldColor2)) {
- let folderIcons = this.loadAllIcons();
- let isOpen = BDFDB.containsClass(folderdiv, "open");
- if (!BDFDB.containsClass(selectedIcon, "custom")) {
- this.changeImgColor(color1, color2, folderIcons[iconID].openicon, (openicon) => {
- icons.openicon = openicon;
- this.changeImgColor(color1, color2, folderIcons[iconID].closedicon, (closedicon) => {
- icons.closedicon = closedicon;
- folderdiv.querySelector(BDFDB.dotCN.avataricon).style.setProperty("background-image", `url(${isOpen ? icons.openicon : icons.closedicon})`);
- BDFDB.saveData(folderID, {folderID,folderName,position,iconID,icons,copyTooltipColor,color1,color2,color3,color4,servers}, this, "folders");
- });
- });
- }
- else {
- icons.openicon = folderIcons[iconID].openicon;
- icons.closedicon = folderIcons[iconID].closedicon;
- folderdiv.querySelector(BDFDB.dotCN.avataricon).style.setProperty("background-image", `url(${isOpen ? icons.openicon : icons.closedicon})`);
- BDFDB.saveData(folderID, {folderID,folderName,position,iconID,icons,copyTooltipColor,color1,color2,color3,color4,servers}, this, "folders");
- }
- }
- else BDFDB.saveData(folderID, {folderID,folderName,position,iconID,icons,copyTooltipColor,color1,color2,color3,color4,servers}, this, "folders");
- });
- foldernameinput.focus();
- }
-
- changeImgColor (color1, color2, icon, callback) {
- color1 = BDFDB.colorCONVERT(color1, "RGBCOMP");
- color2 = BDFDB.colorCONVERT(color2, "RGBCOMP");
- if (!color1 || !color2 || !icon) return;
- let img = new Image();
- img.src = icon;
- img.onload = () => {
- if (icon.indexOf("data:image") == 0 && img.width < 200 && img.height < 200) {
- let can = document.createElement("canvas");
- can.width = img.width;
- can.height = img.height;
- let ctx = can.getContext("2d");
- ctx.drawImage(img, 0, 0);
- let imageData = ctx.getImageData(0, 0, img.width, img.height);
- let data = imageData.data;
- for (let i = 0; i < data.length; i += 4) {
- if (data[i] == 0 && data[i + 1] == 0 && data[i + 2] == 0) {
- data[i] = color1[0];
- data[i + 1] = color1[1];
- data[i + 2] = color1[2];
- }
- else if (data[i] == 255 && data[i + 1] == 255 && data[i + 2] == 255) {
- data[i] = color2[0];
- data[i + 1] = color2[1];
- data[i + 2] = color2[2];
- }
- ctx.putImageData(imageData, 0, 0);
- }
- callback(can.toDataURL("image/png"));
- }
- else {
- callback(img.src);
- }
- };
- }
-
- setIcons (modal, selection) {
- let wrapper = modal.querySelector(".icons");
- if (!wrapper) return;
- BDFDB.removeEles(wrapper.childNodes);
-
- let folderIcons = this.loadAllIcons();
-
- wrapper.appendChild(BDFDB.htmlToElement(`${Object.getOwnPropertyNames(folderIcons).map(id => `
${folderIcons[id].customID ? '
' : ''}
`).join("")}
`));
-
- setIcon(wrapper.querySelector(`.ui-icon-picker-icon[value="${folderIcons[selection] ? selection : 0}"]`), false, true);
-
- BDFDB.addChildEventListener(wrapper, "click", ".ui-icon-picker-icon", e => {
- if (BDFDB.containsClass(e.target, BDFDB.disCN.hovercardbutton)) return;
- setIcon(wrapper.querySelector(".ui-icon-picker-icon.selected"), false, false);
- setIcon(e.currentTarget, true, true);
- });
- BDFDB.addChildEventListener(wrapper, "click", BDFDB.dotCN.hovercardbutton, e => {
- if (BDFDB.containsClass(e.currentTarget.parentElement, "selected")) return;
- BDFDB.removeData(e.currentTarget.getAttribute("value"), this, "customicons");
- e.currentTarget.parentElement.remove();
- BDFDB.showToast(`Custom Icon was deleted.`, {type:"success"});
- });
- BDFDB.addChildEventListener(wrapper, "mouseenter", ".ui-icon-picker-icon", e => {
- setIcon(e.currentTarget, true);
- });
- BDFDB.addChildEventListener(wrapper, "mouseleave", ".ui-icon-picker-icon", e => {
- setIcon(e.currentTarget, false);
- });
-
- function setIcon (icon, hover, enable) {
- if (!icon) return;
- if (enable != undefined) BDFDB.toggleClass(icon, "selected", enable);
- if (hover) {
- icon.querySelector(".ui-picker-inner").style.setProperty("background-image", `url(${folderIcons[icon.getAttribute("value")].openicon})`);
- if (BDFDB.containsClass(icon, "selected")) icon.style.setProperty("background-color", "rgb(255,255,255,0.2)");
- else icon.style.setProperty("background-color", "rgb(255,255,255,0.1)");
- }
- else {
- icon.querySelector(".ui-picker-inner").style.setProperty("background-image", `url(${folderIcons[icon.getAttribute("value")].closedicon})`);
- if (BDFDB.containsClass(icon, "selected")) icon.style.setProperty("background-color", "rgb(255,255,255,0.2)");
- else icon.style.removeProperty("background-color");
- }
- }
- }
-
- loadAllIcons () {
- let icons = {};
- this.folderIcons.forEach((array,i) => {icons[i] = {"openicon":array.openicon,"closedicon":array.closedicon,"customID":null};});
- Object.assign(icons, BDFDB.loadAllData(this, "customicons"));
- return icons;
- }
-
- fetchCustomIcon (modal, type) {
- let successFetchIcon;
- let url = modal.querySelector("input[type='text'][option='" + type + "']").value;
- if (url.indexOf("http") == 0) {
- let request = require("request");
- request(url, (error, response, result) => {
- if (response) {
- let type = response.headers["content-type"];
- if (type && type.indexOf("image") > -1) {
- successFetchIcon();
- return;
- }
- }
- BDFDB.showToast("Use a valid direct link to an image source. They usually end on something like .png, .jpg or .gif.", {type:"danger"});
- });
- }
- else {
- let fs = require("fs")
- if (fs.existsSync(url)) {
- fs.readFile(url, (error, response) => {
- if (!error) {
- url = `data:image/png;base64,${response.toString("base64")}`;
- successFetchIcon();
- }
- });
- }
- else {
- BDFDB.showToast("Could not fetch file. Please make sure the file exists.", {type:"danger"});
- }
- }
-
- successFetchIcon = () => {
- let iconpreview = modal.querySelector(".ui-icon-picker-icon.preview." + type);
- let iconpreviewinner = iconpreview.querySelector(".ui-picker-inner");
- BDFDB.removeClass(iconpreview, "nopic");
- iconpreview.url = url;
- iconpreviewinner.style.setProperty("background-image", `url(${url})`);
-
- let iconpreviewopen = modal.querySelector(".ui-icon-picker-icon.preview.open");
- let iconpreviewclosed = modal.querySelector(".ui-icon-picker-icon.preview.closed");
- if (!BDFDB.containsClass(iconpreviewopen, "nopic") && !BDFDB.containsClass(iconpreviewclosed, "nopic")) {
- let iconpreviewswitching = modal.querySelector(".ui-icon-picker-icon.preview.switching");
-
- let iconpreviewopenimage = iconpreviewopen.querySelector(".ui-picker-inner").style.getPropertyValue("background-image");
- let iconpreviewclosedimage = iconpreviewclosed.querySelector(".ui-picker-inner").style.getPropertyValue("background-image");
- let iconpreviewswitchinginner = iconpreviewswitching.querySelector(".ui-picker-inner");
-
- BDFDB.removeClass(iconpreviewswitching, "nopic");
- iconpreviewswitchinginner.style.setProperty("background-image", iconpreviewopenimage);
- let switching = true;
- iconpreviewswitching.switchInterval = setInterval(() => {
- switching = !switching;
- iconpreviewswitchinginner.style.setProperty("background-image", switching ? iconpreviewopenimage : iconpreviewclosedimage);
- },1000);
- }
- };
- }
-
- saveCustomIcon (modal) {
- let iconpreviewopen = modal.querySelector(".ui-icon-picker-icon.preview.open");
- let iconpreviewclosed = modal.querySelector(".ui-icon-picker-icon.preview.closed");
- let iconpreviewswitching = modal.querySelector(".ui-icon-picker-icon.preview.switching");
- if (!BDFDB.containsClass(iconpreviewopen, "nopic") && !BDFDB.containsClass(iconpreviewclosed, "nopic") && !BDFDB.containsClass(iconpreviewswitching, "nopic")) {
- let customID = this.generateID("customicon");
- BDFDB.saveData(customID, {"openicon":iconpreviewopen.url,"closedicon":iconpreviewclosed.url,customID}, this, "customicons");
- modal.querySelectorAll("input[type='text'][option]").forEach((input) => {input.value = "";});
-
- let iconpreviewopeninner = iconpreviewopen.querySelector(".ui-picker-inner");
- let iconpreviewclosedinner = iconpreviewclosed.querySelector(".ui-picker-inner");
- let iconpreviewswitchinginner = iconpreviewswitching.querySelector(".ui-picker-inner");
-
- BDFDB.addClass(iconpreviewopen, "nopic");
- iconpreviewopeninner.style.removeProperty("background-image");
- BDFDB.addClass(iconpreviewclosed, "nopic");
- iconpreviewclosedinner.style.removeProperty("background-image");
- BDFDB.addClass(iconpreviewswitching, "nopic");
- iconpreviewswitchinginner.style.removeProperty("background-image");
- clearInterval(iconpreviewswitching.switchInterval);
- BDFDB.showToast(`Custom Icon was added to selection.`, {type:"success"});
- this.setIcons(modal, modal.querySelector(".ui-icon-picker-icon.selected").getAttribute("value"));
- }
- else {
- BDFDB.showToast(`Add an image for the open and the closed icon.`, {type:"danger"});
- }
- }
-
- resetAllElements () {
- this.toggleFolderContent(false);
- BDFDB.removeEles(BDFDB.dotCN.guild + ".folder", ".serverfolders-dragpreview");
- BDFDB.readServerList().forEach(info => {this.unhideServer(info.div);});
- }
-
- createNewFolder (ankerdiv) {
- if (!Node.prototype.isPrototypeOf(ankerdiv)) return;
- let guilddiv = BDFDB.getParentEle(BDFDB.dotCN.guild, ankerdiv);
- if (!guilddiv) return;
- let folderID = this.generateID("folder");
- let folderName = "";
- let position = Array.from(document.querySelectorAll(`div${BDFDB.dotCN.guildseparator}:not(.folderseparator) ~ div${BDFDB.dotCN.guild}`)).indexOf(guilddiv);
- let iconID = 0;
- let icons = Object.assign({},this.folderIcons[0]);
- let autounread = false;
- let color1 = ["0","0","0"];
- let color2 = ["255","255","255"];
- let color3 = null;
- let color4 = null;
- let servers = [];
-
- this.showFolderSettings(this.createFolderDiv({folderID,folderName,position,iconID,icons,autounread,color1,color2,color3,color4,servers}));
-
- this.updateFolderPositions();
- }
-
- createFolderDiv (data) {
- let folderdiv = BDFDB.htmlToElement(this.folderIconMarkup);
- let serversandfolders = document.querySelectorAll(`div${BDFDB.dotCN.guildseparator}:not(.folderseparator) ~ div${BDFDB.dotCN.guild}`);
- let insertnode = serversandfolders[data.position > serversandfolders.length - 1 ? serversandfolders.length - 1 : data.position];
- insertnode.parentElement.insertBefore(folderdiv, insertnode);
-
- folderdiv.id = data.folderID;
- BDFDB.addClass(folderdiv, "closed");
- folderdiv.querySelector(BDFDB.dotCN.avataricon).style.setProperty("background-image", `url(${data.icons.closedicon})`);
- folderdiv.addEventListener("click", () => {
- if (BDFDB.getData("closeOtherFolders", this, "settings")) {
- document.querySelectorAll(".folder.open").forEach(folder => {
- if (folder != folderdiv) this.openCloseFolder(folder);
- });
- }
- this.openCloseFolder(folderdiv);
- });
- folderdiv.addEventListener("mouseenter", () => {
- let newdata = BDFDB.loadData(folderdiv.id, this, "folders");
- if (!newdata || !newdata.folderName) return;
- let bgColor = BDFDB.colorCONVERT(newdata.color3, "RGB");
- let fontColor = BDFDB.colorCONVERT(newdata.color4, "RGB");
- BDFDB.createTooltip(newdata.folderName, folderdiv, {type:"right",selector:"guild-folder-tooltip",style:`color: ${fontColor} !important; background-color: ${bgColor} !important; border-color: ${bgColor} !important;`});
- });
- folderdiv.addEventListener("contextmenu", e => {
- let newdata = BDFDB.loadData(folderdiv.id, this, "folders");
- if (!newdata) return;
- let folderContext = BDFDB.htmlToElement(this.folderContextMarkup);
- let autounreadinput = folderContext.querySelector(".autounreadfolder-item input");
- autounreadinput.checked = newdata.autounread;
- folderContext.querySelector(".autounreadfolder-item").addEventListener("click", () => {
- autounreadinput.checked = !autounreadinput.checked;
- newdata.autounread = autounreadinput.checked;
- BDFDB.saveData(newdata.folderID, newdata, this, "folders");
- });
- folderContext.querySelector(".foldersettings-item").addEventListener("click", () => {
- folderContext.remove();
- this.showFolderSettings(folderdiv);
- });
- folderContext.querySelector(".createfolder-item").addEventListener("click", () => {
- folderContext.remove();
- this.createNewFolder(folderdiv);
- });
- folderContext.querySelector(".removefolder-item").addEventListener("click", () => {
- folderContext.remove();
- this.removeFolder(folderdiv);
- });
-
- let unreadServers = BDFDB.readUnreadServerList(this.readIncludedServerList(folderdiv));
- if (unreadServers.length > 0) {
- let unreaditem = folderContext.querySelector(".unreadfolder-item");
- BDFDB.removeClass(unreaditem, BDFDB.disCN.contextmenuitemdisabled);
- unreaditem.addEventListener("click", () => {
- folderContext.remove();
- BDFDB.markGuildAsRead(unreadServers);
- });
- }
- BDFDB.appendContextMenu(folderContext, e);
- });
- folderdiv.addEventListener("mousedown", e => {
- let x = e.pageX, y = e.pageY;
- let mousemove = e2 => {
- if (Math.sqrt((x - e2.pageX)**2) > 20 || Math.sqrt((y - e2.pageY)**2) > 20) {
- document.removeEventListener("mousemove", mousemove);
- document.removeEventListener("mouseup", mouseup);
- let guildswrap = document.querySelector(`${BDFDB.dotCN.guildswrapper}:not(.foldercontent) ${BDFDB.dotCN.guilds}`);
- if (!guildswrap) return;
- let hovele = null;
- let placeholder = BDFDB.htmlToElement(`
`);
- let dragpreview = this.createDragPreview(folderdiv, e);
- let dragging = e3 => {
- BDFDB.removeEles(placeholder);
- BDFDB.toggleEles(folderdiv, false);
- this.updateDragPreview(dragpreview, e3);
- hovele = BDFDB.getParentEle(BDFDB.dotCN.guild + ".folder", e3.target);
- if (hovele) guildswrap.insertBefore(placeholder, hovele.nextSibling);
- else {
- hovele = BDFDB.getParentEle(BDFDB.dotCN.guild, e3.target);
- if (hovele && BDFDB.getReactValue(hovele, "return.memoizedProps.guild") && guildswrap.contains(hovele)) {
- guildswrap.insertBefore(placeholder, hovele.nextSibling);
- }
- }
- };
- let releasing = e3 => {
- document.removeEventListener("mousemove", dragging);
- document.removeEventListener("mouseup", releasing);
- BDFDB.removeEles(placeholder, dragpreview);
- BDFDB.toggleEles(folderdiv, true);
- if (hovele) {
- guildswrap.insertBefore(folderdiv, hovele.nextSibling);
- this.updateFolderPositions(folderdiv);
- }
- };
- document.addEventListener("mousemove", dragging);
- document.addEventListener("mouseup", releasing);
- }
- };
- let mouseup = () => {
- document.removeEventListener("mousemove", mousemove);
- document.removeEventListener("mouseup", mouseup);
- };
- document.addEventListener("mousemove", mousemove);
- document.addEventListener("mouseup", mouseup);
- });
-
- this.addHoverBehaviour(folderdiv);
-
- BDFDB.saveData(data.folderID, data, this, "folders");
-
- this.updateFolderNotifications(folderdiv);
-
- return folderdiv;
- }
-
- generateID (prefix) {
- let data = BDFDB.loadAllData(this, prefix + "s");
- let id = prefix + "_" + Math.round(Math.random()*10000000000000000);
- return data[id] ? this.generateID(prefix) : id;
- }
-
- addServerToFolder (info, folderdiv) {
- if (!info || !folderdiv) return;
- let guilddiv = BDFDB.getServerDiv(info);
- let data = BDFDB.loadData(folderdiv.id, this, "folders");
- if (!guilddiv || !data || data.servers.includes(info.id)) return;
- data.servers.push(info.id);
- BDFDB.saveData(folderdiv.id, data, this, "folders");
- this.hideServer(guilddiv, folderdiv);
- this.updateCopyInFolderContent(guilddiv, folderdiv);
- this.updateFolderNotifications(folderdiv);
- BDFDB.showToast(this.labels.toast_addserver_text.replace("${servername}", info.name).replace("${foldername}", data.folderName ? " " + data.folderName : ""), {type:"success"});
- }
-
- removeServerFromFolder (info, folderdiv) {
- if (!info || !folderdiv) return;
- let data = BDFDB.loadData(folderdiv.id, this, "folders");
- if (!data) return;
- BDFDB.removeFromArray(data.servers, info.id);
- BDFDB.saveData(folderdiv.id, data, this, "folders");
- BDFDB.removeEles(this.foldercontent.querySelectorAll(`[guild="${info.id}"]`));
- this.unhideServer(BDFDB.getServerDiv(info));
- this.updateFolderNotifications(folderdiv);
- BDFDB.showToast(this.labels.toast_removeserver_text.replace("${servername}", info.name).replace("${foldername}", data.folderName ? " " + data.folderName : ""), {type:"danger"});
- }
-
- removeFolder (folderdiv) {
- if (!folderdiv) return;
- this.readIncludedServerList(folderdiv).forEach(guilddiv => {this.unhideServer(guilddiv);});
- BDFDB.removeData(folderdiv.id, this, "folders");
- this.closeFolderContent(folderdiv);
- folderdiv.remove();
- this.updateFolderPositions();
- }
-
- getFolderOfServer (idOrInfoOrEle) {
- if (!idOrInfoOrEle) return;
- let id = Node.prototype.isPrototypeOf(idOrInfoOrEle) ? BDFDB.getServerID(idOrInfoOrEle) : (typeof idOrInfoOrEle == "object" ? idOrInfoOrEle.id : idOrInfoOrEle);
- if (!id) return;
- let folders = BDFDB.loadAllData(this, "folders");
- for (let folderid in folders) for (let serverid of folders[folderid].servers) if (serverid == id) return document.querySelector("#" + folderid);
- return null;
- }
-
- hideServer (guilddiv, folderdiv) {
- if (!Node.prototype.isPrototypeOf(guilddiv) || !folderdiv) return;
- guilddiv.setAttribute("folder", folderdiv.id);
- BDFDB.toggleEles(guilddiv, false);
- if (guilddiv.ServerFoldersChangeObserver && typeof guilddiv.ServerFoldersChangeObserver.disconnect == "function") guilddiv.ServerFoldersChangeObserver.disconnect();
- guilddiv.ServerFoldersChangeObserver = new MutationObserver((changes, _) => {
- changes.forEach(
- (change, i) => {
- let updatefolder = false;
- if (change.type == "attributes" && change.attributeName == "class" && BDFDB.containsClass(change.target, BDFDB.disCN.guild)) updatefolder = true;
- if (change.type == "characterData" && change.target.parentElement && BDFDB.containsClass(change.target.parentElement, BDFDB.disCN.badge)) updatefolder = true;
- else if (change.addedNodes.length) change.addedNodes.forEach(node => {if (node.tagName && BDFDB.containsClass(node, BDFDB.disCN.badge)) updatefolder = true;});
- else if (change.removedNodes.length) change.removedNodes.forEach(node => {if (node.tagName && BDFDB.containsClass(node, BDFDB.disCN.badge)) updatefolder = true;});
- this.updateCopyInFolderContent(guilddiv, folderdiv);
- if (updatefolder) this.updateFolderNotifications(folderdiv);
- }
- );
- });
- guilddiv.ServerFoldersChangeObserver.observe(guilddiv, {attributes:true, childList:true, characterData: true, subtree:true});
- }
-
- unhideServer (guilddiv) {
- if (!Node.prototype.isPrototypeOf(guilddiv)) return;
- guilddiv.removeAttribute("folder");
- BDFDB.toggleEles(guilddiv, true);
- if (guilddiv.ServerFoldersChangeObserver && typeof guilddiv.ServerFoldersChangeObserver.disconnect == "function") guilddiv.ServerFoldersChangeObserver.disconnect();
- delete guilddiv.ServerFoldersChangeObserver;
- }
-
- toggleFolderContent (forceOpenClose) {
- if (!this.foldercontent) return;
- forceOpenClose = forceOpenClose === undefined ? BDFDB.containsClass(this.foldercontent, "foldercontentclosed") : forceOpenClose;
- BDFDB.toggleClass(this.foldercontent, "foldercontentopen", forceOpenClose);
- BDFDB.toggleClass(this.foldercontent, "foldercontentclosed", !forceOpenClose);
- }
-
- openCloseFolder (folderdiv) {
- if (!folderdiv) return;
- let data = BDFDB.loadData(folderdiv.id, this, "folders");
- if (!data) return;
- let isClosed = !BDFDB.containsClass(folderdiv, "open");
- if (isClosed) {
- let includedServers = this.readIncludedServerList(folderdiv);
- if (includedServers.length == 0) return;
- BDFDB.addClass(folderdiv, "open");
- BDFDB.removeClass(folderdiv, "closed");
-
- this.toggleFolderContent(true);
-
- let containsguilds = this.foldercontent.querySelectorAll(BDFDB.dotCN.guild).length;
- let settings = BDFDB.getAllData(this, "settings");
-
- setTimeout(() => {
- if (settings.addSeparators && containsguilds) this.foldercontentguilds.appendChild(BDFDB.htmlToElement(`
`));
- includedServers.forEach(guilddiv => {this.updateCopyInFolderContent(guilddiv, folderdiv);});
- }, settings.closeOtherFolders && containsguilds ? 300 : 0);
- }
- else this.closeFolderContent(folderdiv);
-
- folderdiv.querySelector(BDFDB.dotCN.avataricon).style.setProperty("background-image", `url(${isClosed ? data.icons.openicon : data.icons.closedicon})`);
- }
-
- closeFolderContent (folderdiv) {
- if (!folderdiv) return;
- BDFDB.removeClass(folderdiv, "open");
- BDFDB.addClass(folderdiv, "closed");
- let includedCopies = this.foldercontent.querySelectorAll(`[folder="${folderdiv.id}"]`);
- for (let copy of includedCopies) copy.removeAttribute("folder");
- if (!this.foldercontent.querySelector("[folder]")) {
- this.toggleFolderContent(false);
- setTimeout(() => {
- let settings = BDFDB.getAllData(this, "settings");
- if (settings.closeOtherFolders) BDFDB.removeEles(includedCopies);
- else if (!settings.closeOtherFolders && !document.querySelector(".folder.open")) BDFDB.removeEles(includedCopies);
- }, 300);
- }
- else BDFDB.removeEles(includedCopies);
-
- let firstchild = this.foldercontentguilds.firstElementChild;
- if (BDFDB.containsClass(firstchild, "folderseparator")) BDFDB.removeEles(firstchild);
- }
-
- updateCopyInFolderContent (guilddiv, folderdiv) {
- if (!guilddiv || !folderdiv) return;
- if (BDFDB.containsClass(folderdiv, "open")) {
- let info = this.GuildUtils.getGuild(BDFDB.getServerID(guilddiv));
- if (!info) return;
- let oldCopy = this.foldercontent.querySelector(`[guild="${info.id}"]`);
- if (oldCopy) {
- this.foldercontentguilds.insertBefore(this.createCopyOfServer(guilddiv, folderdiv), oldCopy);
- BDFDB.removeEles(oldCopy);
- }
- else {
- let sameFolderCopies = this.foldercontent.querySelectorAll(`[folder="${folderdiv.id}"]`);
- let insertNode = sameFolderCopies.length > 0 ? sameFolderCopies[sameFolderCopies.length-1].nextSibling : null;
- this.foldercontentguilds.insertBefore(this.createCopyOfServer(guilddiv, folderdiv), insertNode);
- }
- }
- }
-
- createCopyOfServer (guilddiv, folderdiv) {
- if (!guilddiv || !folderdiv) return;
- let info = this.GuildUtils.getGuild(BDFDB.getServerID(guilddiv));
- if (!info) return;
- let guildcopy = guilddiv.cloneNode(true);
- guildcopy.setAttribute("guild", info.id);
- BDFDB.addClass(guildcopy, "copy");
- BDFDB.toggleEles(guildcopy, true);
- guildcopy.addEventListener("mouseenter", () => {
- let folderData = BDFDB.loadData(folderdiv.id, this, "folders") || {};
- let EditServersData = BDFDB.isPluginEnabled("EditServers") ? (BDFDB.loadData(info.id, "EditServers", "servers") || {}) : {};
- let bgColor = BDFDB.colorCONVERT(EditServersData.color3 || (folderData.copyTooltipColor ? folderData.color3 : null), "RGB");
- let fontColor = BDFDB.colorCONVERT(EditServersData.color4 || (folderData.copyTooltipColor ? folderData.color4 : null), "RGB");
- BDFDB.createTooltip(EditServersData.name || info.name, guildcopy, {type:"right",selector:(!BDFDB.isObjectEmpty(EditServersData) ? "EditUsers-tooltip" : ""),style:`color: ${fontColor} !important; background-color: ${bgColor} !important; border-color: ${bgColor} !important;`});
- });
- guildcopy.addEventListener("click", e => {
- e.preventDefault();
- if (BDFDB.pressedKeys.includes(46)) this.removeServerFromFolder(info, folderdiv);
- else {
- let settings = BDFDB.getAllData(this, "settings");
- if (settings.closeAllFolders) document.querySelectorAll(".folder.open").forEach(openFolder => {this.openCloseFolder(openFolder);});
- else if (settings.closeTheFolder) this.openCloseFolder(folderdiv);
- guilddiv.querySelector("a").click();
- }
- });
- guildcopy.addEventListener("contextmenu", e => {
- BDFDB.openGuildContextMenu(guilddiv, e);
- });
- guildcopy.addEventListener("mousedown", e => {
- let x = e.pageX, y = e.pageY;
- let mousemove = e2 => {
- if (Math.sqrt((x - e2.pageX)**2) > 20 || Math.sqrt((y - e2.pageY)**2) > 20) {
- document.removeEventListener("mousemove", mousemove);
- document.removeEventListener("mouseup", mouseup);
- let hovcopy = null;
- let placeholder = BDFDB.htmlToElement(`
`);
- let dragpreview = this.createDragPreview(guilddiv, e);
-
- let dragging = e3 => {
- BDFDB.removeEles(placeholder);
- BDFDB.toggleEles(guildcopy, false);
- this.updateDragPreview(dragpreview, e3);
- if (this.foldercontent.contains(e3.target)) {
- hovcopy = BDFDB.containsClass(e3.target, "folderseparator") ? e3.target : BDFDB.getParentEle(BDFDB.dotCN.guild + ".copy", e3.target);
- if (hovcopy && hovcopy.getAttribute("folder") == folderdiv.id) this.foldercontentguilds.insertBefore(placeholder, hovcopy.nextSibling);
- else hovcopy = null;
- }
- };
- let releasing = e3 => {
- document.removeEventListener("mousemove", dragging);
- document.removeEventListener("mouseup", releasing);
- BDFDB.removeEles(placeholder, dragpreview);
- BDFDB.toggleEles(guildcopy, true);
- let dropfolderdiv = BDFDB.getParentEle(BDFDB.dotCN.guild + ".folder", e3.target);
- if (dropfolderdiv && dropfolderdiv != folderdiv) {
- this.removeServerFromFolder(info, folderdiv);
- this.addServerToFolder(info, dropfolderdiv);
- }
- else if (hovcopy) {
- this.foldercontentguilds.insertBefore(guildcopy, hovcopy.nextSibling);
- this.updateServerPositions(folderdiv);
- }
- };
- document.addEventListener("mousemove", dragging);
- document.addEventListener("mouseup", releasing);
- }
- };
- let mouseup = () => {
- document.removeEventListener("mousemove", mousemove);
- document.removeEventListener("mouseup", mouseup);
- };
- document.addEventListener("mousemove", mousemove);
- document.addEventListener("mouseup", mouseup);
- });
-
- let copyinner = guildcopy.querySelector(BDFDB.dotCN.guildinner);
- let isselected = BDFDB.containsClass(guildcopy, BDFDB.disCN.guildselected);
- let hasicon = !BDFDB.containsClass(guildcopy.querySelector(BDFDB.dotCN.guildicon), BDFDB.disCN.avatarnoicon);
- guildcopy.querySelector("a").setAttribute("draggable", false);
- copyinner.style.setProperty("border-radius", isselected ? "15px" : "25px");
- copyinner.style.setProperty("background-color", hasicon ? null : BDFDB.colorCONVERT(this.DiscordConstants.Colors[isselected ? "BRAND_PURPLE" : "CHANNELS_GREY"], "RGB"));
-
- this.addHoverBehaviour(guildcopy);
-
- return guildcopy;
- }
-
- createDragPreview (div, e) {
- if (!Node.prototype.isPrototypeOf(div)) return;
- let dragpreview = div.cloneNode(true);
- BDFDB.addClass(dragpreview, "serverfolders-dragpreview");
- BDFDB.toggleEles(dragpreview, false);
- dragpreview.style.setProperty("pointer-events", "none", "important");
- dragpreview.style.setProperty("left", e.clientX - 25 + "px", "important");
- dragpreview.style.setProperty("top", e.clientY - 25 + "px", "important");
- document.querySelector(BDFDB.dotCN.appmount).appendChild(dragpreview);
- return dragpreview;
- }
-
- updateDragPreview (dragpreview, e) {
- if (!Node.prototype.isPrototypeOf(dragpreview)) return;
- BDFDB.toggleEles(dragpreview, true);
- dragpreview.style.setProperty("left", e.clientX - 25 + "px", "important");
- dragpreview.style.setProperty("top", e.clientY - 25 + "px", "important");
- }
-
- updateFolderPositions () {
- let serverAndFolders = document.querySelectorAll(`div${BDFDB.dotCN.guildseparator}:not(.folderseparator) ~ div${BDFDB.dotCN.guild}`);
- for (let i = 0; i < serverAndFolders.length; i++) {
- let folderdiv = BDFDB.getParentEle(BDFDB.dotCN.guild + ".folder", serverAndFolders[i]);
- if (folderdiv) {
- let data = BDFDB.loadData(folderdiv.id, this, "folders");
- if (data) {
- data.position = i;
- BDFDB.saveData(folderdiv.id, data, this, "folders");
- }
- }
- }
- }
-
- updateServerPositions (folderdiv) {
- let data = BDFDB.loadData(folderdiv.id, this, "folders");
- if (data) {
- let servers = Array.from(this.foldercontent.querySelectorAll(`${BDFDB.dotCN.guild}.copy[folder="${folderdiv.id}"]`)).map(div => {return div.getAttribute("guild");});
- for (let serverid of servers) BDFDB.removeFromArray(data.servers, serverid);
- data.servers = BDFDB.removeCopiesFromArray(servers.concat(data.servers));
- BDFDB.saveData(folderdiv.id, data, this, "folders");
- }
- }
-
- updateFolderNotifications (folderdiv) {
- let data = BDFDB.loadData(folderdiv.id, this, "folders");
- var a = performance.now();
- if (!data) return;
- let includedServers = this.readIncludedServerList(folderdiv);
- let unreadServers = BDFDB.readUnreadServerList(includedServers);
- if (unreadServers.length > 0 && data.autounread) BDFDB.markGuildAsRead(unreadServers);
- else {
- let badgeAmount = 0;
- let audioEnabled = false;
- let videoEnabled = false;
-
- includedServers.forEach(div => {
- let badge = div.querySelector(BDFDB.dotCN.badge);
- if (badge) badgeAmount += parseInt(badge.innerText);
- if (BDFDB.containsClass(div, BDFDB.disCN.guildaudio)) audioEnabled = true;
- if (BDFDB.containsClass(div, BDFDB.disCN.guildvideo)) videoEnabled = true;
- });
-
- BDFDB.toggleClass(folderdiv, BDFDB.disCN.guildunread, unreadServers.length > 0);
- BDFDB.toggleClass(folderdiv, BDFDB.disCN.guildaudio, audioEnabled);
- BDFDB.toggleClass(folderdiv, BDFDB.disCN.guildvideo, videoEnabled);
- let notifications = folderdiv.querySelector(".folder" + BDFDB.dotCN.badge + ".notifications");
- notifications.innerText = badgeAmount;
- BDFDB.toggleEles(notifications, badgeAmount > 0);
- let amount = folderdiv.querySelector(".folder" + BDFDB.dotCN.badge + ".count");
- amount.innerText = includedServers.length;
- BDFDB.toggleEles(amount, includedServers.length > 0 && BDFDB.getData("showCountBadge", this, "settings"));
-
- if (BDFDB.containsClass(folderdiv, "open") && !document.querySelector(".foldercontent [folder='" + folderdiv.id + "']")) this.openCloseFolder(folderdiv);
- }
- }
-
- readIncludedServerList (folderdiv) {
- let data = BDFDB.loadData(folderdiv.id, this, "folders");
- let includedServers = [];
- if (data) for (let id of data.servers) {
- let div = BDFDB.getServerDiv(id);
- if (div && includedServers.indexOf(div) == -1) includedServers.push(div);
- }
- return includedServers;
- }
-
- addHoverBehaviour (div) {
- /* based on stuff from Zerebos */
- let divinner = div.querySelector(BDFDB.dotCN.guildinner);
- let divicon = div.querySelector(BDFDB.dotCN.guildicon);
- let backgroundColor = new this.Animations.Value(0);
- backgroundColor
- .interpolate({
- inputRange: [0, 1],
- outputRange: [this.DiscordConstants.Colors.CHANNELS_GREY, this.DiscordConstants.Colors.BRAND_PURPLE]
- })
- .addListener((value) => {
- if (BDFDB.containsClass(divicon, BDFDB.disCN.avatarnoicon)) {
- let comp = BDFDB.colorCONVERT(value.value, "RGBCOMP");
- if (comp) divinner.style.setProperty("background-color", `rgb(${comp[0]}, ${comp[1]}, ${comp[2]})`);
- }
- });
-
- let borderRadius = new this.Animations.Value(0);
- borderRadius
- .interpolate({
- inputRange: [0, 1],
- outputRange: [25, 15]
- })
- .addListener((value) => {
- divinner.style.setProperty("border-radius", `${value.value}px`);
- });
-
- let animate = (v) => {
- this.Animations.parallel([
- this.Animations.timing(backgroundColor, {toValue: v, duration: 200}),
- this.Animations.spring(borderRadius, {toValue: v, friction: 3})
- ]).start();
- };
-
- div.addEventListener("mouseenter", () => {animate(1);})
- div.addEventListener("mouseleave", () => {if (!BDFDB.containsClass(div, BDFDB.disCN.guildselected)) animate(0);});
- }
-
- getSettingsPanel () {
- if (!global.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
- let settings = BDFDB.getAllData(this, "settings");
- let settingshtml = `${this.name}
`;
- for (let key in settings) {
- settingshtml += `
`;
- }
- settingshtml += `
`;
- settingshtml += `
Remove all custom Icons. Remove
`;
- settingshtml += `
`;
-
- let settingspanel = BDFDB.htmlToElement(settingshtml);
-
- BDFDB.initElements(settingspanel, this);
-
- BDFDB.addEventListener(this, settingspanel, "click", ".reset-button", () => {
- BDFDB.openConfirmModal(this, "Are you sure you want to delete all folders?", () => {
- BDFDB.removeAllData(this, "folders");
- this.resetAllElements();
- });
- });
- BDFDB.addEventListener(this, settingspanel, "click", ".removecustom-button", () => {
- BDFDB.openConfirmModal(this, "Are you sure you want to remove all custom icons?", () => {
- BDFDB.removeAllData(this, "customicons");
- });
- });
- return settingspanel;
- }
-
- onSettingsClosed () {
- if (this.SettingsUpdated) {
- delete this.SettingsUpdated;
- this.foldercontent.querySelectorAll(BDFDB.dotCN.guild + ".folder").forEach(folderdiv => {this.updateFolderNotifications(folderdiv);});
- }
- }
-
- setLabelsByLanguage () {
- switch (BDFDB.getDiscordLanguage().id) {
- case "hr": //croatian
- return {
- toast_addserver_text: "${servername} je dodan u mapu${foldername}.",
- toast_removeserver_text: "${servername} je uklonjena iz mape${foldername}.",
- servercontext_serverfolders_text: "Poslužitelj mapu",
- serversubmenu_createfolder_text: "Izradi mapu",
- serversubmenu_removefromfolder_text: "Ukloni poslužitelj iz mape",
- foldercontext_unreadfolder_text: "Označi sve kao pročitano",
- foldercontext_autounreadfolder_text: "Auto: Označite kao pročitano",
- foldercontext_foldersettings_text: "Postavke map",
- foldercontext_removefolder_text: "Izbriši mapu",
- modal_header_text: "Postavke mapa",
- modal_foldername_text: "Naziv mape",
- modal_tabheader1_text: "Mape",
- modal_tabheader2_text: "Boja mape",
- modal_tabheader3_text: "Boja tooltip",
- modal_tabheader4_text: "Prilagođeni ikona",
- modal_iconpicker_text: "Odabir mape",
- modal_copytooltipcolor_text: "Koristite iste boje za poslužitelj u mapi",
- modal_colorpicker1_text: "Boja primarne mape",
- modal_colorpicker2_text: "Boja sekundarne mape",
- modal_colorpicker3_text: "Boja tooltip",
- modal_colorpicker4_text: "Boja fonta",
- modal_customopen_text: "Otvori ikona",
- modal_customclosed_text: "Zatvorena ikona",
- modal_custompreview_text: "Pregled ikona"
- };
- case "da": //danish
- return {
- toast_addserver_text: "${servername} er blevet tilføjet til mappe${foldername}.",
- toast_removeserver_text: "${servername} er blevet fjernet fra mappen${foldername}.",
- servercontext_serverfolders_text: "Servermapper",
- serversubmenu_createfolder_text: "Opret mappe",
- serversubmenu_removefromfolder_text: "Fjern server fra mappe",
- foldercontext_unreadfolder_text: "Markér alle som læst",
- foldercontext_autounreadfolder_text: "Auto: Markér som læst",
- foldercontext_foldersettings_text: "Mappeindstillinger",
- foldercontext_removefolder_text: "Slet mappe",
- modal_header_text: "Mappindstillinger",
- modal_foldername_text: "Mappenavn",
- modal_tabheader1_text: "Mappe",
- modal_tabheader2_text: "Mappefarve",
- modal_tabheader3_text: "Tooltipfarve",
- modal_tabheader4_text: "Brugerdefinerede ikoner",
- modal_iconpicker_text: "Mappevalg",
- modal_copytooltipcolor_text: "Brug de samme farver til server på mappen",
- modal_colorpicker1_text: "Primær mappefarve",
- modal_colorpicker2_text: "Sekundær mappefarve",
- modal_colorpicker3_text: "Tooltipfarve",
- modal_colorpicker4_text: "Skriftfarve",
- modal_customopen_text: "Åbn ikon",
- modal_customclosed_text: "Lukket ikon",
- modal_custompreview_text: "Ikon forhåndsvisning"
- };
- case "de": //german
- return {
- toast_addserver_text: "${servername} wurde dem Ordner${foldername} hinzugefügt.",
- toast_removeserver_text: "${servername} wurde aus dem Ordner${foldername} entfernt.",
- servercontext_serverfolders_text: "Serverordner",
- serversubmenu_createfolder_text: "Ordner erzeugen",
- serversubmenu_removefromfolder_text: "Server aus Ordner entfernen",
- foldercontext_unreadfolder_text: "Alle als gelesen markieren",
- foldercontext_autounreadfolder_text: "Auto: Als gelesen markieren",
- foldercontext_foldersettings_text: "Ordnereinstellungen",
- foldercontext_removefolder_text: "Ordner löschen",
- modal_header_text: "Ordnereinstellungen",
- modal_foldername_text: "Ordnername",
- modal_tabheader1_text: "Ordner",
- modal_tabheader2_text: "Ordnerfarbe",
- modal_tabheader3_text: "Tooltipfarbe",
- modal_tabheader4_text: "Eigene Icons",
- modal_iconpicker_text: "Ordnerauswahl",
- modal_copytooltipcolor_text: "Benutze dieselben Farben für alle Server des Ordners",
- modal_colorpicker1_text: "Primäre Ordnerfarbe",
- modal_colorpicker2_text: "Sekundäre Ordnerfarbe",
- modal_colorpicker3_text: "Tooltipfarbe",
- modal_colorpicker4_text: "Schriftfarbe",
- modal_customopen_text: "Geöffnetes Icon",
- modal_customclosed_text: "Geschlossenes Icon",
- modal_custompreview_text: "Iconvorschau"
- };
- case "es": //spanish
- return {
- toast_addserver_text: "${servername} ha sido agregado a la carpeta${foldername}.",
- toast_removeserver_text: "${servername} ha sido eliminado de la carpeta${foldername}.",
- servercontext_serverfolders_text: "Carpetas de servidor",
- serversubmenu_createfolder_text: "Crear carpeta",
- serversubmenu_removefromfolder_text: "Eliminar servidor de la carpeta",
- foldercontext_unreadfolder_text: "Marcar todo como leido",
- foldercontext_autounreadfolder_text: "Auto: Marcar como leído",
- foldercontext_foldersettings_text: "Ajustes de carpeta",
- foldercontext_removefolder_text: "Eliminar carpeta",
- modal_header_text: "Ajustes de carpeta",
- modal_foldername_text: "Nombre de la carpeta",
- modal_tabheader1_text: "Carpeta",
- modal_tabheader2_text: "Color de carpeta",
- modal_tabheader3_text: "Color de tooltip",
- modal_tabheader4_text: "Iconos personalizados",
- modal_iconpicker_text: "Selección de carpeta",
- modal_copytooltipcolor_text: "Usa los mismos colores para el servidor de la carpeta",
- modal_colorpicker1_text: "Color primaria de carpeta",
- modal_colorpicker2_text: "Color secundario de la carpeta",
- modal_colorpicker3_text: "Color de tooltip",
- modal_colorpicker4_text: "Color de fuente",
- modal_customopen_text: "Ícono abierto",
- modal_customclosed_text: "Icono cerrado",
- modal_custompreview_text: "Vista previa del icono"
- };
- case "fr": //french
- return {
- toast_addserver_text: "${servername} a été ajouté au dossier${foldername}.",
- toast_removeserver_text: "${servername} a été supprimé du dossier${foldername}.",
- servercontext_serverfolders_text: "Dossiers du serveur",
- serversubmenu_createfolder_text: "Créer le dossier",
- serversubmenu_removefromfolder_text: "Supprimer le serveur du dossier",
- foldercontext_unreadfolder_text: "Tout marquer comme lu",
- foldercontext_autounreadfolder_text: "Auto: Marquer comme lu",
- foldercontext_foldersettings_text: "Paramètres du dossier",
- foldercontext_removefolder_text: "Supprimer le dossier",
- modal_header_text: "Paramètres du dossier",
- modal_foldername_text: "Nom de dossier",
- modal_tabheader1_text: "Dossier",
- modal_tabheader2_text: "Couleur du dossier",
- modal_tabheader3_text: "Couleur de tooltip",
- modal_tabheader4_text: "Icônes personnalisées",
- modal_iconpicker_text: "Choix du dossier",
- modal_copytooltipcolor_text: "Utilisez les mêmes couleurs pour le serveur du dossier",
- modal_colorpicker1_text: "Couleur primaire du dossier",
- modal_colorpicker2_text: "Couleur secondaire du dossier",
- modal_colorpicker3_text: "Couleur de tooltip",
- modal_colorpicker4_text: "Couleur de la police",
- modal_customopen_text: "Icône ouverte",
- modal_customclosed_text: "Icône fermée",
- modal_custompreview_text: "Aperçu de l'icône"
- };
- case "it": //italian
- return {
- toast_addserver_text: "${servername} è stato aggiunto alla cartella${foldername}.",
- toast_removeserver_text: "${servername} è stato rimosso dalla cartella${foldername}.",
- servercontext_serverfolders_text: "Cartelle del server",
- serversubmenu_createfolder_text: "Creare una cartella",
- serversubmenu_removefromfolder_text: "Rimuovere il server dalla cartella",
- foldercontext_unreadfolder_text: "Segna tutti come letti",
- foldercontext_autounreadfolder_text: "Auto: Contrassegna come letto",
- foldercontext_foldersettings_text: "Impostazioni cartella",
- foldercontext_removefolder_text: "Elimina cartella",
- modal_header_text: "Impostazioni cartella",
- modal_foldername_text: "Nome della cartella",
- modal_tabheader1_text: "Cartella",
- modal_tabheader2_text: "Colore della cartella",
- modal_tabheader3_text: "Colore della tooltip",
- modal_tabheader4_text: "Icone personalizzate",
- modal_iconpicker_text: "Selezione della cartella",
- modal_copytooltipcolor_text: "Usa gli stessi colori per il server della cartella",
- modal_colorpicker1_text: "Colore primaria della cartella",
- modal_colorpicker2_text: "Colore secondaria della cartella",
- modal_colorpicker3_text: "Colore della tooltip",
- modal_colorpicker4_text: "Colore del carattere",
- modal_customopen_text: "Icona aperta",
- modal_customclosed_text: "Icona chiusa",
- modal_custompreview_text: "Icona anteprima"
- };
- case "nl": //dutch
- return {
- toast_addserver_text: "${servername} is toegevoegd aan de map${foldername}.",
- toast_removeserver_text: "${servername} is verwijderd uit de map${foldername}.",
- servercontext_serverfolders_text: "Servermappen",
- serversubmenu_createfolder_text: "Map aanmaken",
- serversubmenu_removefromfolder_text: "Server uit map verwijderen",
- foldercontext_unreadfolder_text: "Alles als gelezen markeren",
- foldercontext_autounreadfolder_text: "Auto: Markeren als gelezen",
- foldercontext_foldersettings_text: "Mapinstellingen",
- foldercontext_removefolder_text: "Verwijder map",
- modal_header_text: "Mapinstellingen",
- modal_foldername_text: "Mapnaam",
- modal_tabheader1_text: "Map",
- modal_tabheader2_text: "Mapkleur",
- modal_tabheader3_text: "Tooltipkleur",
- modal_tabheader4_text: "Aangepaste keuze",
- modal_iconpicker_text: "Map keuze",
- modal_copytooltipcolor_text: "Gebruik dezelfde kleuren voor de server van de map",
- modal_colorpicker1_text: "Primaire mapkleur",
- modal_colorpicker2_text: "Tweede mapkleur",
- modal_colorpicker3_text: "Tooltipkleur",
- modal_colorpicker4_text: "Doopvontkleur",
- modal_customopen_text: "Geopende keuze",
- modal_customclosed_text: "Gesloten keuze",
- modal_custompreview_text: "Voorbeeld van keuze"
- };
- case "no": //norwegian
- return {
- toast_addserver_text: "${servername} er lagt til i mappe${foldername}.",
- toast_removeserver_text: "${servername} er fjernet fra mappen${foldername}.",
- servercontext_serverfolders_text: "Servermapper",
- serversubmenu_createfolder_text: "Lag mappe",
- serversubmenu_removefromfolder_text: "Fjern server fra mappe",
- foldercontext_unreadfolder_text: "Marker alle som lest",
- foldercontext_autounreadfolder_text: "Auto: Merk som les",
- foldercontext_foldersettings_text: "Mappinnstillinger",
- foldercontext_removefolder_text: "Slett mappe",
- modal_header_text: "Mappinnstillinger",
- modal_foldername_text: "Mappenavn",
- modal_tabheader1_text: "Mappe",
- modal_tabheader2_text: "Mappefarge",
- modal_tabheader3_text: "Tooltipfarge",
- modal_tabheader4_text: "Tilpassede ikoner",
- modal_iconpicker_text: "Mappevalg",
- modal_copytooltipcolor_text: "Bruk de samme fargene til serveren til mappen",
- modal_colorpicker1_text: "Primær mappefarge",
- modal_colorpicker2_text: "Sekundær mappefarge",
- modal_colorpicker3_text: "Tooltipfarge",
- modal_colorpicker4_text: "Skriftfarge",
- modal_customopen_text: "Åpnet ikon",
- modal_customclosed_text: "Lukket ikon",
- modal_custompreview_text: "Ikon forhåndsvisning"
- };
- case "pl": //polish
- return {
- toast_addserver_text: "${servername} został dodany do folderu${foldername}.",
- toast_removeserver_text: "${servername} został usunięty z folderu${foldername}.",
- servercontext_serverfolders_text: "Foldery serwera",
- serversubmenu_createfolder_text: "Utwórz folder",
- serversubmenu_removefromfolder_text: "Usuń serwer z folderu",
- foldercontext_unreadfolder_text: "Oznacz wszystkie jako przeczytane",
- foldercontext_autounreadfolder_text: "Auto: Oznacz jako przeczytane",
- foldercontext_foldersettings_text: "Ustawienia folderu",
- foldercontext_removefolder_text: "Usuń folder",
- modal_header_text: "Ustawienia folderu",
- modal_foldername_text: "Nazwa folderu",
- modal_tabheader1_text: "Folder",
- modal_tabheader2_text: "Kolor folderu",
- modal_tabheader3_text: "Kolor podpowiedzi",
- modal_tabheader4_text: "Niestandardowe ikony",
- modal_iconpicker_text: "Wybór folderu",
- modal_copytooltipcolor_text: "Użyj tych samych kolorów dla serwera folderu",
- modal_colorpicker1_text: "Podstawowy kolor folderu",
- modal_colorpicker2_text: "Drugorzędny kolor folderu",
- modal_colorpicker3_text: "Kolor podpowiedzi",
- modal_colorpicker4_text: "Kolor czcionki",
- modal_customopen_text: "Otwarta ikona",
- modal_customclosed_text: "Zamknięta ikona",
- modal_custompreview_text: "Podgląd ikony"
- };
- case "pt-BR": //portuguese (brazil)
- return {
- toast_addserver_text: "${servername} foi adicionado à pasta${foldername}.",
- toast_removeserver_text: "${servername} foi removido da pasta${foldername}.",
- servercontext_serverfolders_text: "Pastas de servidores",
- serversubmenu_createfolder_text: "Criar pasta",
- serversubmenu_removefromfolder_text: "Remover servidor da pasta",
- foldercontext_unreadfolder_text: "Marcar tudo como lido",
- foldercontext_autounreadfolder_text: "Auto: Marcar como lido",
- foldercontext_foldersettings_text: "Configurações da pasta",
- foldercontext_removefolder_text: "Excluir pasta",
- modal_header_text: "Configurações da pasta",
- modal_foldername_text: "Nome da pasta",
- modal_tabheader1_text: "Pasta",
- modal_tabheader2_text: "Cor da pasta",
- modal_tabheader3_text: "Cor da tooltip",
- modal_tabheader4_text: "Ícones personalizados",
- modal_iconpicker_text: "Escolha da pasta",
- modal_copytooltipcolor_text: "Use as mesmas cores para o servidor da pasta",
- modal_colorpicker1_text: "Cor primária da pasta",
- modal_colorpicker2_text: "Cor secundária da pasta",
- modal_colorpicker3_text: "Cor da tooltip",
- modal_colorpicker4_text: "Cor da fonte",
- modal_customopen_text: "Ícone aberto",
- modal_customclosed_text: "Ícone fechado",
- modal_custompreview_text: "Pré-visualização de ícones"
- };
- case "fi": //finnish
- return {
- toast_addserver_text: "${servername} on lisätty kansioon${foldername}.",
- toast_removeserver_text: "${servername} on poistettu kansioon${foldername}.",
- servercontext_serverfolders_text: "Palvelinkansiot",
- serversubmenu_createfolder_text: "Luo kansio",
- serversubmenu_removefromfolder_text: "Poista palvelin kansioista",
- foldercontext_unreadfolder_text: "Merkitse kaikki luetuksi",
- foldercontext_autounreadfolder_text: "Auto: merkitse luettavaksi",
- foldercontext_foldersettings_text: "Kansion kansio",
- foldercontext_removefolder_text: "Poista kansio",
- modal_header_text: "Kansion kansio",
- modal_foldername_text: "Kansion nimi",
- modal_tabheader1_text: "Kansio",
- modal_tabheader2_text: "Kansionväri",
- modal_tabheader3_text: "Tooltipväri",
- modal_tabheader4_text: "Mukautetut kuvakkeet",
- modal_iconpicker_text: "Kansion valinta",
- modal_copytooltipcolor_text: "Käytä samoja värejä kansion palvelimelle",
- modal_colorpicker1_text: "Ensisijainen kansionväri",
- modal_colorpicker2_text: "Toissijainen kansionväri",
- modal_colorpicker3_text: "Tooltipväri",
- modal_colorpicker4_text: "Fontinväri",
- modal_customopen_text: "Avattu kuvake",
- modal_customclosed_text: "Suljettu kuvake",
- modal_custompreview_text: "Kuvakkeen esikatselu"
- };
- case "sv": //swedish
- return {
- toast_addserver_text: "${servername} har lagts till i mapp${foldername}.",
- toast_removeserver_text: "${servername} har tagits bort från mappen${foldername}.",
- servercontext_serverfolders_text: "Servermappar",
- serversubmenu_createfolder_text: "Skapa mapp",
- serversubmenu_removefromfolder_text: "Ta bort servern från mappen",
- foldercontext_unreadfolder_text: "Markera allt som läst",
- foldercontext_autounreadfolder_text: "Auto: Markera som Läs",
- foldercontext_foldersettings_text: "Mappinställningar",
- foldercontext_removefolder_text: "Ta bort mapp",
- modal_header_text: "Mappinställningar",
- modal_foldername_text: "Mappnamn",
- modal_tabheader1_text: "Mapp",
- modal_tabheader2_text: "Mappfärg",
- modal_tabheader3_text: "Tooltipfärg",
- modal_tabheader4_text: "Anpassade ikoner",
- modal_iconpicker_text: "Mappval",
- modal_copytooltipcolor_text: "Använd samma färger för mappen på mappen",
- modal_colorpicker1_text: "Primär mappfärg",
- modal_colorpicker2_text: "Sekundär mappfärg",
- modal_colorpicker3_text: "Tooltipfärg",
- modal_colorpicker4_text: "Fontfärg",
- modal_customopen_text: "Öppnad ikon",
- modal_customclosed_text: "Closed Icon",
- modal_custompreview_text: "Ikon förhandsvisning"
- };
- case "tr": //turkish
- return {
- toast_addserver_text: "${servername} klasörü${foldername} eklendi.",
- toast_removeserver_text: "${servername} klasörü${foldername} kaldırıldı",
- servercontext_serverfolders_text: "Sunucu klasörleri",
- serversubmenu_createfolder_text: "Klasör oluşturun",
- serversubmenu_removefromfolder_text: "Sunucuyu klasörden kaldır",
- foldercontext_unreadfolder_text: "Tümünü Oku olarak işaretle",
- foldercontext_autounreadfolder_text: "Oto: Okundu Olarak İşaretle",
- foldercontext_foldersettings_text: "Klasör Ayarları",
- foldercontext_removefolder_text: "Klasörü sil",
- modal_header_text: "Klasör Ayarları",
- modal_foldername_text: "Klasör adı",
- modal_tabheader1_text: "Klasör",
- modal_tabheader2_text: "Klasör rengi",
- modal_tabheader3_text: "Tooltip rengi",
- modal_tabheader4_text: "Özel simgeler",
- modal_iconpicker_text: "Klasör seçimi",
- modal_copytooltipcolor_text: "Klasörün sunucusu için aynı renkleri kullanın",
- modal_colorpicker1_text: "Birincil klasör rengi",
- modal_colorpicker2_text: "İkincil klasör rengi",
- modal_colorpicker3_text: "Tooltip rengi",
- modal_colorpicker4_text: "Yazı rengi",
- modal_customopen_text: "Açılmış simge",
- modal_customclosed_text: "Kapalı simge",
- modal_custompreview_text: "Simge önizleme"
- };
- case "cs": //czech
- return {
- toast_addserver_text: "${servername} byl přidán do složky${foldername}.",
- toast_removeserver_text: "${servername} byl odstraněn ze složky${foldername}.",
- servercontext_serverfolders_text: "Složky serveru",
- serversubmenu_createfolder_text: "Vytvořit složky",
- serversubmenu_removefromfolder_text: "Odstranit server ze složky",
- foldercontext_unreadfolder_text: "Označit vše jako přečtené",
- foldercontext_autounreadfolder_text: "Auto: Označit jako přečtené",
- foldercontext_foldersettings_text: "Nastavení složky",
- foldercontext_removefolder_text: "Smazat složky",
- modal_header_text: "Nastavení složky",
- modal_foldername_text: "Název složky",
- modal_tabheader1_text: "Složky",
- modal_tabheader2_text: "Barva složky",
- modal_tabheader3_text: "Barva tooltip",
- modal_tabheader4_text: "Vlastní ikony",
- modal_iconpicker_text: "Volba složky",
- modal_copytooltipcolor_text: "Použijte stejné barvy pro server složky",
- modal_colorpicker1_text: "Primární barva složky",
- modal_colorpicker2_text: "Sekundární barva složky",
- modal_colorpicker3_text: "Barva tooltip",
- modal_colorpicker4_text: "Barva fontu",
- modal_customopen_text: "Otevřená ikona",
- modal_customclosed_text: "Uzavřená ikona",
- modal_custompreview_text: "Náhled ikony"
- };
- case "bg": //bulgarian
- return {
- toast_addserver_text: "${servername} е добавен към папката${foldername}.",
- toast_removeserver_text: "${servername} е премахнат от папката${foldername}.",
- servercontext_serverfolders_text: "Сървърни папки",
- serversubmenu_createfolder_text: "Създай папка",
- serversubmenu_removefromfolder_text: "Премахване на сървър от папка",
- foldercontext_unreadfolder_text: "Маркирай всички като прочетени",
- foldercontext_autounreadfolder_text: "Авто: Маркиране като четене",
- foldercontext_foldersettings_text: "Настройки папка",
- foldercontext_removefolder_text: "Изтриване на папка",
- modal_header_text: "Настройки папка",
- modal_foldername_text: "Име на папка",
- modal_tabheader1_text: "Папка",
- modal_tabheader2_text: "Цвят на папка",
- modal_tabheader3_text: "Цвят на подсказка",
- modal_tabheader4_text: "Персонализирани икони",
- modal_iconpicker_text: "Избор на папки",
- modal_copytooltipcolor_text: "Използвайте същите цветове за сървъра на папката",
- modal_colorpicker1_text: "Цвят основнен на папка",
- modal_colorpicker2_text: "цвят вторичен на папка",
- modal_colorpicker3_text: "Цвят на подсказка",
- modal_colorpicker4_text: "Цвят на шрифта",
- modal_customopen_text: "Отворена икона",
- modal_customclosed_text: "Затворена икона",
- modal_custompreview_text: "Икона Преглед"
- };
- case "ru": //russian
- return {
- toast_addserver_text: "${servername} добавлен в папку${foldername}.",
- toast_removeserver_text: "${servername} был удален из папки${foldername}.",
- servercontext_serverfolders_text: "Папки сервера",
- serversubmenu_createfolder_text: "Создать папки",
- serversubmenu_removefromfolder_text: "Удаление сервера из папки",
- foldercontext_unreadfolder_text: "Отметить все как прочитанное",
- foldercontext_autounreadfolder_text: "Авто: Отметить как прочитанное",
- foldercontext_foldersettings_text: "Настройки папки",
- foldercontext_removefolder_text: "Удалить папки",
- modal_header_text: "Настройки папки",
- modal_foldername_text: "Имя папки",
- modal_tabheader1_text: "Папка",
- modal_tabheader2_text: "Цвет папки",
- modal_tabheader3_text: "Цвет подсказка",
- modal_tabheader4_text: "Пользовательские значки",
- modal_iconpicker_text: "Выбор папки",
- modal_copytooltipcolor_text: "Используйте те же цвета для сервера папки",
- modal_colorpicker1_text: "Цвет основной папки",
- modal_colorpicker2_text: "Цвет вторичной папки",
- modal_colorpicker3_text: "Цвет подсказка",
- modal_colorpicker4_text: "Цвет шрифта",
- modal_customopen_text: "Открытая иконка",
- modal_customclosed_text: "Закрытая иконка",
- modal_custompreview_text: "Иконка Просмотр"
- };
- case "uk": //ukrainian
- return {
- toast_addserver_text: "${servername} було додано до папки${foldername}.",
- toast_removeserver_text: "${servername} був вилучений з папки${foldername}.",
- servercontext_serverfolders_text: "Папки сервера",
- serversubmenu_createfolder_text: "Створити папки",
- serversubmenu_removefromfolder_text: "Видалити сервер із папки",
- foldercontext_unreadfolder_text: "Позначити як прочитане",
- foldercontext_autounreadfolder_text: "Авто: Позначити як прочитане",
- foldercontext_foldersettings_text: "Параметри папки",
- foldercontext_removefolder_text: "Видалити папки",
- modal_header_text: "Параметри папки",
- modal_foldername_text: "Ім'я папки",
- modal_tabheader1_text: "Папки",
- modal_tabheader2_text: "Колір папки",
- modal_tabheader3_text: "Колір підказка",
- modal_tabheader4_text: "Користувальницькі іконки",
- modal_iconpicker_text: "Вибір папки",
- modal_copytooltipcolor_text: "Використовуйте ті ж кольори для сервера папки",
- modal_colorpicker1_text: "Колір основної папки",
- modal_colorpicker2_text: "Колір вторинного папки",
- modal_colorpicker3_text: "Колір підказка",
- modal_colorpicker4_text: "Колір шрифту",
- modal_customopen_text: "Відкрита ікона",
- modal_customclosed_text: "Закрита ікона",
- modal_custompreview_text: "Піктограма попереднього перегляду"
- };
- case "ja": //japanese
- return {
- toast_addserver_text: "${servername} がフォルダ${foldername} に追加されました。",
- toast_removeserver_text: "${servername} がフォルダ${foldername} から削除されました。",
- servercontext_serverfolders_text: "サーバーフォルダ",
- serversubmenu_createfolder_text: "フォルダーを作る",
- serversubmenu_removefromfolder_text: "フォルダからサーバーを削除する",
- foldercontext_unreadfolder_text: "すべてを読むようにマークする",
- foldercontext_autounreadfolder_text: "自動: 読み取りとしてマークする",
- foldercontext_foldersettings_text: "フォルダ設定",
- foldercontext_removefolder_text: "フォルダを削除する",
- modal_header_text: "フォルダ設定",
- modal_foldername_text: "フォルダ名",
- modal_tabheader1_text: "フォルダ",
- modal_tabheader2_text: "フォルダの色",
- modal_tabheader3_text: "ツールチップの色",
- modal_tabheader4_text: "カスタムアイコン",
- modal_iconpicker_text: "フォルダの選択",
- modal_copytooltipcolor_text: "フォルダのサーバーに同じ色を使う",
- modal_colorpicker1_text: "プライマリフォルダの色",
- modal_colorpicker2_text: "セカンダリフォルダの色",
- modal_colorpicker3_text: "ツールチップの色",
- modal_colorpicker4_text: "フォントの色",
- modal_customopen_text: "開いたアイコン",
- modal_customclosed_text: "クローズドアイコン",
- modal_custompreview_text: "アイコンのプレビュー"
- };
- case "zh-TW": //chinese (traditional)
- return {
- toast_addserver_text: "${servername} 已被添加到文件夾${foldername}.",
- toast_removeserver_text: "${servername} 已從文件夾${foldername} 中刪除.",
- servercontext_serverfolders_text: "服務器文件夾",
- serversubmenu_createfolder_text: "創建文件夾",
- serversubmenu_removefromfolder_text: "從服務器中刪除服務器",
- foldercontext_unreadfolder_text: "標記為已讀",
- foldercontext_autounreadfolder_text: "自動: 標記為已讀",
- foldercontext_foldersettings_text: "文件夾設置",
- foldercontext_removefolder_text: "刪除文件夾",
- modal_header_text: "文件夾設置",
- modal_foldername_text: "文件夾名稱",
- modal_tabheader1_text: "夾",
- modal_tabheader2_text: "文件夾顏色",
- modal_tabheader3_text: "工具提示顏色",
- modal_tabheader4_text: "自定義圖標",
- modal_iconpicker_text: "文件夾選擇",
- modal_copytooltipcolor_text: "對文件夾的服務器使用相同的顏色",
- modal_colorpicker1_text: "主文件夾顏色",
- modal_colorpicker2_text: "輔助文件夾顏色",
- modal_colorpicker3_text: "工具提示顏色",
- modal_colorpicker4_text: "字體顏色",
- modal_customopen_text: "打開的圖標",
- modal_customclosed_text: "封閉的圖標",
- modal_custompreview_text: "圖標預覽"
- };
- case "ko": //korean
- return {
- toast_addserver_text: "${servername} 가 폴더${foldername} 에 추가되었습니다.",
- toast_removeserver_text: "${servername} 가 폴더${foldername} 에서 제거되었습니다.",
- servercontext_serverfolders_text: "서버 폴더",
- serversubmenu_createfolder_text: "폴더 만들기",
- serversubmenu_removefromfolder_text: "폴더에서 서버 제거",
- foldercontext_unreadfolder_text: "모두 읽은 상태로 표시",
- foldercontext_autounreadfolder_text: "자동: 읽은 상태로 표시",
- foldercontext_foldersettings_text: "폴더 설정",
- foldercontext_removefolder_text: "폴더 삭제",
- modal_header_text: "폴더 설정",
- modal_foldername_text: "폴더 이름",
- modal_tabheader1_text: "폴더",
- modal_tabheader2_text: "폴더 색",
- modal_tabheader3_text: "툴팁 색깔",
- modal_tabheader4_text: "사용자 정의 아이콘",
- modal_iconpicker_text: "폴더 선택",
- modal_copytooltipcolor_text: "폴더의 서버에 대해 동일한 색상을 사용하십시오.",
- modal_colorpicker1_text: "기본 폴더 색",
- modal_colorpicker2_text: "보조 폴더 색",
- modal_colorpicker3_text: "툴팁 색깔",
- modal_colorpicker4_text: "글꼴 색깔",
- modal_customopen_text: "열린 아이콘",
- modal_customclosed_text: "닫힌 아이콘",
- modal_custompreview_text: "아이콘 미리보기"
- };
- default: //default: english
- return {
- toast_addserver_text: "${servername} has been added to the folder${foldername}.",
- toast_removeserver_text: "${servername} has been removed from the folder${foldername}.",
- servercontext_serverfolders_text: "Serverfolders",
- serversubmenu_createfolder_text: "Create Folder",
- serversubmenu_removefromfolder_text: "Remove Server From Folder",
- foldercontext_unreadfolder_text: "Mark All As Read",
- foldercontext_autounreadfolder_text: "Auto: Mark As Read",
- foldercontext_foldersettings_text: "Foldersettings",
- foldercontext_removefolder_text: "Delete Folder",
- modal_header_text: "Foldersettings",
- modal_foldername_text: "Foldername",
- modal_tabheader1_text: "Folder",
- modal_tabheader2_text: "Foldercolor",
- modal_tabheader3_text: "Tooltipcolor",
- modal_tabheader4_text: "Custom Icons",
- modal_iconpicker_text: "Folderchoice",
- modal_copytooltipcolor_text: "Use same Colors for Servers of the Folder",
- modal_colorpicker1_text: "Primary Foldercolor",
- modal_colorpicker2_text: "Secondary Foldercolor",
- modal_colorpicker3_text: "Tooltipcolor",
- modal_colorpicker4_text: "Fontcolor",
- modal_customopen_text: "Open Icon",
- modal_customclosed_text: "Closed Icon",
- modal_custompreview_text: "Iconpreview"
- };
- }
- }
- }
-};
diff --git a/PluginsV2/ServerHider/README.md b/PluginsV2/ServerHider/README.md
deleted file mode 100644
index c79c830bc1..0000000000
--- a/PluginsV2/ServerHider/README.md
+++ /dev/null
@@ -1,8 +0,0 @@
-# These Plugins are meant only for BDv2, not BD nor BandagedBD. If you got either of those two go to [Plugins](https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/).
-
-## Server Hider - [Download Script](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/ServerHider/index.js) [Download Config](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/ServerHider/config.json)
-
-Adds two options on your server context menu.
-
-- You can hide the selected server.
-- You can open a popout, where you can swiftly hide servers and display them again.
diff --git a/PluginsV2/ServerHider/config.json b/PluginsV2/ServerHider/config.json
deleted file mode 100644
index 3ae087a4fc..0000000000
--- a/PluginsV2/ServerHider/config.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "info": {
- "name": "ServerHider",
- "authors": [
- {
- "name": "DevilBro",
- "url": "https://www.paypal.me/MircoWittrien",
- "discord_id": "278543574059057154",
- "github_username": "mwittrien"
- }
- ],
- "version": 1.0,
- "description": "Hide Servers in your Serverlist. \n\nMy Support Server: http://bit.ly/DevilBrosHaus or https://discordapp.com/invite/Jx3TjNS"
- }
-}
diff --git a/PluginsV2/ServerHider/index.js b/PluginsV2/ServerHider/index.js
deleted file mode 100644
index 734bf6504a..0000000000
--- a/PluginsV2/ServerHider/index.js
+++ /dev/null
@@ -1,463 +0,0 @@
-module.exports = (Plugin, Api, Vendor) => {
- if (!global.BDFDB || typeof BDFDB != "object") global.BDFDB = {myPlugins:{}, BDv2Api: Api};
-
- return class extends Plugin {
- initConstructor () {
- this.labels = {};
-
- this.patchModules = {
- "Guild":"componentDidMount"
- };
-
- this.serverHiderModalMarkup =
- `
-
-
- `;
-
- this.serverEntryMarkup =
- ``;
-
- this.serverContextEntryMarkup =
- ``;
-
- this.serverContextSubMenuMarkup =
- ``;
- }
-
- onStart () {
- if (global.BDFDB && global.BDFDB.myPlugins && typeof global.BDFDB.myPlugins == "object") global.BDFDB.myPlugins[this.name] = this;
- var libraryScript = document.querySelector('head script[src="https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js"]');
- if (!global.BDFDB || typeof BDFDB != "object" || performance.now() - BDFDB.creationTime > 600000) {
- if (libraryScript) libraryScript.remove();
- libraryScript = document.createElement("script");
- libraryScript.setAttribute("type", "text/javascript");
- libraryScript.setAttribute("src", "https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js");
- libraryScript.setAttribute("date", performance.now());
- libraryScript.addEventListener("load", () => {if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();});
- document.head.appendChild(libraryScript);
- }
- else if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();
- this.startTimeout = setTimeout(() => {this.initialize();}, 30000);
- }
-
- initialize () {
- if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
- if (this.started) return true;
- BDFDB.loadMessage(this);
-
- if (BDFDB.isPluginEnabled("HideUtils") && !BDFDB.loadData("hideutils", this, "warnings")) BDFDB.openConfirmModal(this, this.name + " is not compartible with the plugin HideUtils by Arashiryuu. You might expierence bugs like Servers that should be hidden by " + this.name + " still being visible in the Guildlist. To avoid this disable the Plugin HideUtils. Press the " + BDFDB.getLibraryStrings().btn_ok_text + "-Button to not show this Message again.", "Warning", () => {BDFDB.saveData("hideutils", true, this, "warnings")});
-
- BDFDB.WebModules.forceAllUpdates(this);
-
- return true;
- }
- else {
- console.error(`%c[${this.name}]%c`, 'color: #3a71c1; font-weight: 700;', '', 'Fatal Error: Could not load BD functions!');
- return false;
- }
- }
-
- onStop () {
- if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
- BDFDB.readServerList().forEach(info => {if (!info.div.getAttribute("folder")) BDFDB.toggleEles(info.div, true);});
-
- BDFDB.unloadMessage(this);
- return true;
- }
- else {
- return false;
- }
- }
-
-
- // begin of own functions
-
- changeLanguageStrings () {
- this.serverContextEntryMarkup = this.serverContextEntryMarkup.replace("REPLACE_context_serverhider_text", this.labels.context_serverhider_text);
-
- this.serverContextSubMenuMarkup = this.serverContextSubMenuMarkup.replace("REPLACE_submenu_hideserver_text", this.labels.submenu_hideserver_text);
- this.serverContextSubMenuMarkup = this.serverContextSubMenuMarkup.replace("REPLACE_submenu_openhidemenu_text", this.labels.submenu_openhidemenu_text);
-
- this.serverHiderModalMarkup = this.serverHiderModalMarkup.replace("REPLACE_modal_header_text", this.labels.modal_header_text);
- this.serverHiderModalMarkup = this.serverHiderModalMarkup.replace("REPLACE_btn_ok_text", this.labels.btn_ok_text);
- this.serverHiderModalMarkup = this.serverHiderModalMarkup.replace("REPLACE_btn_all_text", this.labels.btn_all_text);
-
- this.serverEntryMarkup = this.serverEntryMarkup.replace("REPLACE_btn_visible_text", this.labels.btn_visible_text);
- }
-
- onGuildContextMenu (instance, menu) {
- if (document.querySelector(".DevilBro-modal")) return;
- if (instance.props && instance.props.target && instance.props.type.indexOf("GUILD_ICON_") == 0 && !menu.querySelector(".serverhider-item")) {
- let serverContextEntry = BDFDB.htmlToElement(this.serverContextEntryMarkup);
- menu.appendChild(serverContextEntry);
- let hideritem = serverContextEntry.querySelector(".serverhider-item");
- hideritem.addEventListener("mouseenter", () => {
- let serverContextSubMenu = BDFDB.htmlToElement(this.serverContextSubMenuMarkup);
- let openitem = serverContextSubMenu.querySelector(".openhidemenu-item");
- openitem.addEventListener("click", () => {
- instance._reactInternalFiber.return.memoizedProps.closeContextMenu();
- this.showServerModal();
- });
- if (instance.props.guild && !instance.props.target.getAttribute("folder")) {
- let hideitem = serverContextSubMenu.querySelector(".hideserver-item");
- BDFDB.removeClass(hideitem, BDFDB.disCN.contextmenuitemdisabled);
- hideitem.addEventListener("click", () => {
- instance._reactInternalFiber.return.memoizedProps.closeContextMenu();
- this.toggleServer(instance.props.guild, instance.props.target, false);
- });
- }
- BDFDB.appendSubMenu(hideritem, serverContextSubMenu);
- });
- }
- }
-
- processGuild (instance, wrapper) {
- if (instance.props && instance.props.guild) {
- let hiddenservers = BDFDB.loadData("hiddenservers", this, "hiddenservers") || [];
- this.toggleServer(instance.props.guild, wrapper, !hiddenservers.includes(instance.props.guild.id));
- }
- }
-
- showServerModal () {
- let serverHiderModal = BDFDB.htmlToElement(this.serverHiderModalMarkup);
- let container = serverHiderModal.querySelector(".entries");
- if (!container) return;
-
- BDFDB.addChildEventListener(serverHiderModal, "click", ".btn-all", () => {
- let firstcheckbox = serverHiderModal.querySelector(".serverhiderCheckbox");
- firstcheckbox.click();
- serverHiderModal.querySelectorAll(".serverhiderCheckbox").forEach(checkbox => {
- if (checkbox != firstcheckbox && checkbox.checked != firstcheckbox.checked) checkbox.click();
- });
- });
-
- for (let info of BDFDB.readServerList()) {
- if (!info.div.getAttribute("folder")) {
- if (container.firstElementChild) container.appendChild(BDFDB.htmlToElement(`
`));
- let entry = BDFDB.htmlToElement(this.serverEntryMarkup);
- container.appendChild(entry);
- let name = entry.querySelector(".serverhiderName");
- name.innerText = info.name || "";
- name.parentElement.insertBefore(this.createCopyOfServer(info), name);
- let hidecheckbox = entry.querySelector(".serverhiderCheckbox");
- hidecheckbox.checked = !BDFDB.isEleHidden(info.div);
- hidecheckbox.addEventListener("click", e => {
- this.toggleServer(info, info.div, e.currentTarget.checked);
- });
- }
- }
- BDFDB.appendModal(serverHiderModal);
- }
-
- createCopyOfServer (info) {
- let serverCopy = info.div.cloneNode(true);
- BDFDB.toggleEles(serverCopy, true);
- BDFDB.removeClass(serverCopy, BDFDB.disCN.guildunread, BDFDB.disCN.guildselected);
- serverCopy.addEventListener("click", e => {
- e.preventDefault();
- info.div.querySelector("a").click();
- });
- serverCopy.addEventListener("contextmenu", e => {BDFDB.openGuildContextMenu(info.div, e);});
- return serverCopy;
- }
-
- toggleServer (info, target, visible) {
- if (!info || !target) return;
- let guilddiv = BDFDB.getParentEle(BDFDB.dotCN.guild, target);
- if (!guilddiv || guilddiv.getAttribute("folder")) return;
- BDFDB.toggleEles(guilddiv, visible);
- let hiddenservers = BDFDB.loadData("hiddenservers", this, "hiddenservers") || [];
- BDFDB.removeFromArray(hiddenservers, info.id);
- if (!visible) hiddenservers.push(info.id);
- BDFDB.saveData("hiddenservers", hiddenservers, this, "hiddenservers");
- }
-
- getSettingsPanel () {
- if (!global.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
- let settingshtml = `${this.name}
`;
- settingshtml += `
`;
- settingshtml += `
`;
-
- let settingspanel = BDFDB.htmlToElement(settingshtml);
-
- BDFDB.initElements(settingspanel, this);
-
- BDFDB.addEventListener(this, settingspanel, "click", ".reset-button", () => {
- BDFDB.openConfirmModal(this, "Are you sure you want to reset all servers?", () => {
- BDFDB.removeAllData(this, "servers");
- BDFDB.readServerList().forEach(info => {if (!info.div.getAttribute("folder")) BDFDB.toggleEles(info.div, false);});
- });
- });
- return settingspanel;
- }
-
- setLabelsByLanguage () {
- switch (BDFDB.getDiscordLanguage().id) {
- case "hr": //croatian
- return {
- modal_header_text: "Upravljanje popisom poslužitelja",
- modal_folderhide_text: "Nemoj prikazivati poslužitelje skrivene po narudžbi",
- btn_ok_text: "OK",
- btn_all_text: "Sve",
- context_serverhider_text: "Vidljivost poslužitelj",
- submenu_hideserver_text: "Sakrij poslužitelj",
- submenu_openhidemenu_text: "Upravljanje popisom poslužitelja"
- };
- case "da": //danish
- return {
- modal_header_text: "Styring af Serverliste",
- modal_folderhide_text: "Vis ingen servere, som er gemt af mapper",
- btn_ok_text: "OK",
- btn_all_text: "Alle",
- context_serverhider_text: "Server synlighed",
- submenu_hideserver_text: "Skjul Server",
- submenu_openhidemenu_text: "Styre Serverliste"
- };
- case "de": //german
- return {
- modal_header_text: "Verwaltung der Serverliste",
- modal_folderhide_text: "Zeige keine Server, die durch Order versteckt wurden",
- btn_ok_text: "OK",
- btn_all_text: "Alle",
- context_serverhider_text: "Serversichtbarkeit",
- submenu_hideserver_text: "Server verstecken",
- submenu_openhidemenu_text: "Serverliste verwalten"
- };
- case "es": //spanish
- return {
- modal_header_text: "Administración de lista de servidores",
- modal_folderhide_text: "No mostrar servidores, que están ocultos por las carpetas",
- btn_ok_text: "OK",
- btn_all_text: "Todo",
- context_serverhider_text: "Visibilidad del servidor",
- submenu_hideserver_text: "Ocultar servidor",
- submenu_openhidemenu_text: "Administrar lista de servidores"
- };
- case "fr": //french
- return {
- modal_header_text: "Gestion de la liste des serveurs",
- modal_folderhide_text: "Afficher aucun serveur, qui sont cachés par des dossiers",
- btn_ok_text: "OK",
- btn_all_text: "Tout",
- context_serverhider_text: "Visibilité du serveur",
- submenu_hideserver_text: "Cacher le serveur",
- submenu_openhidemenu_text: "Gérer la liste des serveurs"
- };
- case "it": //italian
- return {
- modal_header_text: "Gestione dell'elenco dei server",
- modal_folderhide_text: "Mostra nessun server nascosto nelle cartelle",
- btn_ok_text: "OK",
- btn_all_text: "Tutto",
- context_serverhider_text: "Visibilità del server",
- submenu_hideserver_text: "Nascondi il server",
- submenu_openhidemenu_text: "Gestione elenco dei server"
- };
- case "nl": //dutch
- return {
- modal_header_text: "Beheer van de Serverlijst",
- modal_folderhide_text: "Toon geen servers, die zijn verborgen door mappen",
- btn_ok_text: "OK",
- btn_all_text: "Alle",
- context_serverhider_text: "Server zichtbaarheid",
- submenu_hideserver_text: "Verberg server",
- submenu_openhidemenu_text: "Beheer serverlijst"
- };
- case "no": //norwegian
- return {
- modal_header_text: "Administrasjon av serverlisten",
- modal_folderhide_text: "Vis ingen servere, som er skjult av mapper",
- btn_ok_text: "OK",
- btn_all_text: "Alle",
- context_serverhider_text: "Server synlighet",
- submenu_hideserver_text: "Skjul server",
- submenu_openhidemenu_text: "Administrer serverliste"
- };
- case "pl": //polish
- return {
- modal_header_text: "Zarządzanie listą serwerów",
- modal_folderhide_text: "Nie pokazuj żadnych serwerów, które są ukryte w folderach",
- btn_ok_text: "OK",
- btn_all_text: "Wszystkie",
- context_serverhider_text: "Widoczność serwera",
- submenu_hideserver_text: "Ukryj serwer",
- submenu_openhidemenu_text: "Zarządzaj listą serwerów"
- };
- case "pt-BR": //portuguese (brazil)
- return {
- modal_header_text: "Gerenciamento da lista de servidores",
- modal_folderhide_text: "Não exiba servidores, que estão ocultos por pastas",
- btn_ok_text: "OK",
- btn_all_text: "Todo",
- context_serverhider_text: "Visibilidade do servidor",
- submenu_hideserver_text: "Ocultar servidor",
- submenu_openhidemenu_text: "Gerenciar lista de servidores"
- };
- case "fi": //finnish
- return {
- modal_header_text: "Palvelinluettelon hallinta",
- modal_folderhide_text: "Näytä mitään palvelimia, jotka ovat kansioiden piilossa",
- btn_ok_text: "OK",
- btn_all_text: "Kaikki",
- context_serverhider_text: "Palvelimen näkyvyys",
- submenu_hideserver_text: "Piilota palvelin",
- submenu_openhidemenu_text: "Hallinnoi palvelinluetteloa"
- };
- case "sv": //swedish
- return {
- modal_header_text: "Hantering av serverlistan",
- modal_folderhide_text: "Visa inga servrar, vilka är dolda av mappar",
- btn_ok_text: "OK",
- btn_all_text: "All",
- context_serverhider_text: "Server sikt",
- submenu_hideserver_text: "Dölj server",
- submenu_openhidemenu_text: "Hantera serverlistan"
- };
- case "tr": //turkish
- return {
- modal_header_text: "Sunucu Listesinin Yönetimi",
- modal_folderhide_text: "Klasörler tarafından gizlenen hiçbir sunucu gösterme",
- btn_ok_text: "Okey",
- btn_all_text: "Her",
- context_serverhider_text: "Sunucu görünürlüğü",
- submenu_hideserver_text: "Sunucuyu Gizle",
- submenu_openhidemenu_text: "Sunucu Listesini Yönet"
- };
- case "cs": //czech
- return {
- modal_header_text: "Správa seznamu serverů",
- modal_folderhide_text: "Zobrazit žádné servery, které jsou skryty podle složek",
- btn_ok_text: "OK",
- btn_all_text: "Vše",
- context_serverhider_text: "Viditelnost serveru",
- submenu_hideserver_text: "Skrýt server",
- submenu_openhidemenu_text: "Správa seznamu serverů"
- };
- case "bg": //bulgarian
- return {
- modal_header_text: "Управление на списъка със сървъри",
- modal_folderhide_text: "Показване на сървъри, които са скрити от папки",
- btn_ok_text: "Добре",
- btn_all_text: "Bсичко",
- context_serverhider_text: "Видимост на сървъра",
- submenu_hideserver_text: "Скриване на сървър",
- submenu_openhidemenu_text: "Управление на списъка със сървъри"
- };
- case "ru": //russian
- return {
- modal_header_text: "Управление списком серверов",
- modal_folderhide_text: "Показывать никакие серверы, скрытые папками",
- btn_ok_text: "ОК",
- btn_all_text: "Все",
- context_serverhider_text: "Видимость сервера",
- submenu_hideserver_text: "Скрыть сервер",
- submenu_openhidemenu_text: "Управление списком серверов"
- };
- case "uk": //ukrainian
- return {
- modal_header_text: "Управління списком серверів",
- modal_folderhide_text: "Не показувати жодних серверів, які приховуються папками",
- btn_ok_text: "Добре",
- btn_all_text: "Все",
- context_serverhider_text: "Видимість сервера",
- submenu_hideserver_text: "Сховати сервер",
- submenu_openhidemenu_text: "Управління списком серверів"
- };
- case "ja": //japanese
- return {
- modal_header_text: "サーバリストの管理",
- modal_folderhide_text: "フォルダに隠されているサーバーは表示しない",
- btn_ok_text: "はい",
- btn_all_text: "すべて",
- context_serverhider_text: "サーバーの可視性",
- submenu_hideserver_text: "サーバーを隠す",
- submenu_openhidemenu_text: "サーバーリストを管理する"
- };
- case "zh-TW": //chinese (traditional)
- return {
- modal_header_text: "管理服务器列表",
- modal_folderhide_text: "不顯示被文件夾隱藏的服務器",
- btn_ok_text: "好",
- btn_all_text: "所有",
- context_serverhider_text: "服務器可見性",
- submenu_hideserver_text: "隐藏服务器",
- submenu_openhidemenu_text: "管理服务器列表"
- };
- case "ko": //korean
- return {
- modal_header_text: "서버 목록 관리",
- modal_folderhide_text: "폴더별로 숨겨진 서버 표시 안 함",
- btn_ok_text: "승인",
- btn_all_text: "모든",
- context_serverhider_text: "서버 가시성",
- submenu_hideserver_text: "서버 숨기기",
- submenu_openhidemenu_text: "서버 목록 관리"
- };
- default: //default: english
- return {
- modal_header_text: "Managing Serverlist",
- modal_folderhide_text: "Show no servers, which are hidden by folders",
- btn_ok_text: "OK",
- btn_all_text: "All",
- context_serverhider_text: "Server Visibility",
- submenu_hideserver_text: "Hide Server",
- submenu_openhidemenu_text: "Manage Serverlist"
- };
- }
- }
- }
-};
diff --git a/PluginsV2/ShowHiddenChannels/README.md b/PluginsV2/ShowHiddenChannels/README.md
deleted file mode 100644
index 74e3dffb15..0000000000
--- a/PluginsV2/ShowHiddenChannels/README.md
+++ /dev/null
@@ -1,5 +0,0 @@
-# These Plugins are meant only for BDv2, not BD nor BandagedBD. If you got either of those two go to [Plugins](https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/).
-
-## Show Hidden Channels - [Download Script](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/ShowHiddenChannels/index.js) [Download Config](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/ShowHiddenChannels/config.json)
-
-Displays all hidden channels that can't be accessed due to role restrictions in a new category.
diff --git a/PluginsV2/ShowHiddenChannels/config.json b/PluginsV2/ShowHiddenChannels/config.json
deleted file mode 100644
index 88411f562a..0000000000
--- a/PluginsV2/ShowHiddenChannels/config.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "info": {
- "name": "ShowHiddenChannels",
- "authors": [
- {
- "name": "DevilBro",
- "url": "https://www.paypal.me/MircoWittrien",
- "discord_id": "278543574059057154",
- "github_username": "mwittrien"
- }
- ],
- "version": 1.0,
- "description": "Displays channels that are hidden from you by role restrictions. \n\nMy Support Server: http://bit.ly/DevilBrosHaus or https://discordapp.com/invite/Jx3TjNS"
- }
-}
diff --git a/PluginsV2/ShowHiddenChannels/index.js b/PluginsV2/ShowHiddenChannels/index.js
deleted file mode 100644
index 7f4d76f9d2..0000000000
--- a/PluginsV2/ShowHiddenChannels/index.js
+++ /dev/null
@@ -1,482 +0,0 @@
-module.exports = (Plugin, Api, Vendor) => {
- if (!global.BDFDB || typeof BDFDB != "object") global.BDFDB = {myPlugins:{}, BDv2Api: Api};
-
- return class extends Plugin {
- initConstructor () {
- this.patchModules = {
- "Channels":["componentDidMount","componentDidUpdate"],
- "ChannelItem":"componentDidMount",
- "ChannelCategoryItem":"componentDidMount"
- };
-
- this.categoryMarkup =
- ``;
-
- this.channelTextMarkup =
- ``;
-
- this.channelVoiceMarkup =
- ``;
-
- this.channelCategoryMarkup =
- ``;
-
- this.css = `
- .container-hidden .containerDefault-1ZnADq .iconTransition-2pOJ7l {
- position: static;
- }`;
-
- this.defaults = {
- settings: {
- showText: {value:true, description:"Show hidden Textchannels:"},
- showVoice: {value:true, description:"Show hidden Voicechannels:"},
- showCategory: {value:false, description:"Show hidden Categories:"},
- showAllowedRoles: {value:true, description:"Show allowed Roles on hover:"},
- showAllowedUsers: {value:true, description:"Show specifically allowed Users on hover:"},
- showOverWrittenRoles: {value:true, description:"Include overwritten Roles in allowed Roles:"},
- showDeniedRoles: {value:true, description:"Show denied Roles on hover:"},
- showDeniedUsers: {value:true, description:"Show denied Users on hover:"},
- showForNormal: {value:false, description:"Also show Roles/Users for allowed channels:"},
- showTopic: {value:false, description:"Show the topic of hidden channels:"}
- },
- amounts: {
- hoverDelay: {value:0, description:"Tooltip delay in millisec:"}
- }
- };
- }
-
- onStart () {
- if (global.BDFDB && global.BDFDB.myPlugins && typeof global.BDFDB.myPlugins == "object") global.BDFDB.myPlugins[this.name] = this;
- var libraryScript = document.querySelector('head script[src="https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js"]');
- if (!global.BDFDB || typeof BDFDB != "object" || performance.now() - BDFDB.creationTime > 600000) {
- if (libraryScript) libraryScript.remove();
- libraryScript = document.createElement("script");
- libraryScript.setAttribute("type", "text/javascript");
- libraryScript.setAttribute("src", "https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js");
- libraryScript.setAttribute("date", performance.now());
- libraryScript.addEventListener("load", () => {if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();});
- document.head.appendChild(libraryScript);
- }
- else if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();
- this.startTimeout = setTimeout(() => {this.initialize();}, 30000);
- }
-
- initialize () {
- if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
- if (this.started) return true;
- BDFDB.loadMessage(this);
-
- this.React = BDFDB.WebModules.findByProperties("createElement", "cloneElement");
- this.ChannelTypes = BDFDB.WebModules.findByProperties("ChannelTypes").ChannelTypes;
- this.UserStore = BDFDB.WebModules.findByProperties("getUsers", "getUser");
- this.MemberStore = BDFDB.WebModules.findByProperties("getMember", "getMembers");
- this.GuildStore = BDFDB.WebModules.findByProperties("getGuilds", "getGuild");
- this.ChannelStore = BDFDB.WebModules.findByProperties("getChannels", "getDMFromUserId");
- this.GuildChannels = BDFDB.WebModules.findByProperties("getChannels", "getDefaultChannel");
- this.Permissions = BDFDB.WebModules.findByProperties("Permissions", "ActivityTypes").Permissions;
-
- BDFDB.WebModules.forceAllUpdates(this, "Channels");
-
- return true;
- }
- else {
- console.error(`%c[${this.name}]%c`, 'color: #3a71c1; font-weight: 700;', '', 'Fatal Error: Could not load BD functions!');
- return false;
- }
- }
-
- onStop () {
- if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
- BDFDB.removeEles(".container-hidden");
- BDFDB.unloadMessage(this);
- return true;
- }
- else {
- return false;
- }
- }
-
-
- // begin of own functions
-
- processChannels (instance, wrapper, methodnames) {
- if (instance.props && instance.props.guild) {
- if (methodnames.includes("componentDidMount")) this.appendHiddenContainer(instance.props.guild);
- if (methodnames.includes("componentDidUpdate")) this.reappendHiddenContainer(instance.props.guild);
- }
- }
-
- processChannelItem (instance, wrapper) {
- if (instance.props && instance.props.channel) this.reappendHiddenContainer(this.GuildStore.getGuild(instance.props.channel.guild_id));
- }
-
- processChannelCategoryItem (instance, wrapper) {
- if (instance.props && instance.props.channel) this.reappendHiddenContainer(this.GuildStore.getGuild(instance.props.channel.guild_id));
- }
-
- appendHiddenContainer (guild) {
- BDFDB.removeEles(".container-hidden");
- if (!guild) return;
- this.currentGuild = guild.id;
- var allChannels = this.ChannelStore.getChannels();
- var shownChannels = this.GuildChannels.getChannels(guild.id);
- var hiddenChannels = {};
-
- for (let type in this.ChannelTypes) hiddenChannels[this.ChannelTypes[type]] = [];
-
- for (let channel_id in allChannels) {
- var channel = allChannels[channel_id];
- if (channel.guild_id == guild.id) {
- var isHidden = true;
- if (channel.type == this.ChannelTypes.GUILD_CATEGORY) {
- for (let type in this.ChannelTypes) if (shownChannels[this.ChannelTypes[type]]) for (let shownChannel of shownChannels[this.ChannelTypes[type]]) {
- if (!channel.id || shownChannel.channel.parent_id == channel.id) {
- isHidden = false;
- break;
- }
- }
- }
- else {
- for (let shownChannel of shownChannels[channel.type]) if (shownChannel.channel.id == channel.id) {
- isHidden = false;
- break;
- }
- }
- if (isHidden) hiddenChannels[channel.type].push(channel);
- }
- }
-
-
- var settings = BDFDB.getAllData(this, "settings");
- var count = 0;
- for (let type in this.ChannelTypes) {
- if (!settings.showText && type == "GUILD_TEXT" || !settings.showVoice && type == "GUILD_VOICE" || !settings.showCategory && type == "GUILD_CATEGORY") {
- hiddenChannels[this.ChannelTypes[type]] = [];
- }
- BDFDB.sortArrayByKey(hiddenChannels[this.ChannelTypes[type]], "name");
- count += hiddenChannels[this.ChannelTypes[type]].length;
- }
- hiddenChannels.count = count;
-
- if (count > 0) {
- var category = BDFDB.htmlToElement(this.categoryMarkup);
- var wrapper = category.querySelector(BDFDB.dotCN.cursorpointer);
- var svg = category.querySelector(BDFDB.dotCN.categoryicontransition);
- var name = category.querySelector(BDFDB.dotCN.categorycolortransition);
- var inner = category.querySelector(BDFDB.dotCN.categorycontainerdefault + " > " + BDFDB.dotCN.flex);
- category.setAttribute("guild", guild.id);
- inner.addEventListener("click", () => {
- BDFDB.toggleClass(wrapper, BDFDB.disCN.categorywrapperhovered, BDFDB.disCN.categorywrapperhoveredcollapsed);
- BDFDB.toggleClass(svg, BDFDB.disCN.categoryiconhovered, BDFDB.disCN.categoryiconhoveredcollapsed, BDFDB.disCN.directionright);
- BDFDB.toggleClass(name, BDFDB.disCN.categorynamehovered, BDFDB.disCN.categorynamehoveredcollapsed);
-
- var visible = BDFDB.containsClass(svg, BDFDB.disCN.directionright);
- BDFDB.toggleEles(category.querySelectorAll(BDFDB.dotCN.channelcontainerdefault), !visible);
- BDFDB.saveData(guild.id, !visible, this, "categorystatus");
- });
- var togglecontainer = () => {
- if (!BDFDB.containsClass(svg, BDFDB.disCN.directionright)) {
- BDFDB.toggleClass(wrapper, BDFDB.disCN.categorywrapperdefault, BDFDB.disCN.categorywrapperhovered);
- BDFDB.toggleClass(svg, BDFDB.disCN.categoryicondefault, BDFDB.disCN.categoryiconhovered);
- BDFDB.toggleClass(name, BDFDB.disCN.categorynamedefault,BDFDB.disCN.categorynamehovered);
- }
- else {
- BDFDB.toggleClass(wrapper, BDFDB.disCN.categorywrappercollapsed, BDFDB.disCN.categorywrapperhoveredcollapsed)
- BDFDB.toggleClass(svg, BDFDB.disCN.categoryiconcollapsed, BDFDB.disCN.categoryiconhoveredcollapsed);
- BDFDB.toggleClass(name, BDFDB.disCN.categorynamecollapsed, BDFDB.disCN.categorynamehoveredcollapsed)
- }
- };
- inner.addEventListener("mouseenter", togglecontainer);
- inner.addEventListener("mouseleave", togglecontainer);
-
- for (let hiddenChannel of hiddenChannels[0]) {
- let channel = BDFDB.htmlToElement(this.channelTextMarkup);
- let channelwrapper = channel.querySelector(BDFDB.dotCN.channelwrapper);
- let channelicon = channel.querySelector(BDFDB.dotCN.channelcontent);
- let channelsvg = channel.querySelector(BDFDB.dotCN.channelicon);
- let channelname = channel.querySelector(BDFDB.dotCN.channelname);
- this.setReactInstanceOfChannel(hiddenChannel, channel);
- channelname.innerText = hiddenChannel.name;
- BDFDB.addChildEventListener(channel, "mouseenter mouseleave", BDFDB.dotCN.channelwrapper, e => {
- BDFDB.toggleClass(channelwrapper, BDFDB.disCN.channelwrapperdefaulttext, BDFDB.disCN.channelwrapperhoveredtext);
- BDFDB.toggleClass(channelicon, BDFDB.disCN.channelcontentdefaulttext, BDFDB.disCN.channelcontenthoveredtext);
- BDFDB.toggleClass(channelsvg, BDFDB.disCN.channelcolordefaulttext, BDFDB.disCN.channelcolorhoveredtext);
- BDFDB.toggleClass(channelname, BDFDB.disCN.channelnamedefaulttext, BDFDB.disCN.channelnamehoveredtext);
- this.showAccessRoles(guild, hiddenChannel, e, false);
- });
- channel.addEventListener("click", () => {
- BDFDB.showToast(`You can not enter the hidden textchannel ${hiddenChannel.name}.`, {type:"error"});
- });
- channel.addEventListener("contextmenu", e => {
- this.createHiddenObjContextMenu(guild, hiddenChannel, "TEXT", e);
- });
- category.appendChild(channel);
- }
-
- for (let hiddenChannel of hiddenChannels[2]) {
- let channel = BDFDB.htmlToElement(this.channelVoiceMarkup);
- let channelwrapper = channel.querySelector(BDFDB.dotCN.channelwrapper);
- let channelicon = channel.querySelector(BDFDB.dotCN.channelcontent);
- let channelsvg = channel.querySelector(BDFDB.dotCN.channelicon);
- let channelname = channel.querySelector(BDFDB.dotCN.channelname);
- this.setReactInstanceOfChannel(hiddenChannel, channel);
- channelname.innerText = hiddenChannel.name;
- BDFDB.addChildEventListener(channel, "mouseenter mouseleave", BDFDB.dotCN.channelwrapper, e => {
- BDFDB.toggleClass(channelwrapper, BDFDB.disCN.channelwrapperdefaultvoice, BDFDB.disCN.channelwrapperhoveredvoice);
- BDFDB.toggleClass(channelicon, BDFDB.disCN.channelcontentdefaultvoice, BDFDB.disCN.channelcontenthoveredvoice);
- BDFDB.toggleClass(channelsvg, BDFDB.disCN.channelcolordefaultvoice, BDFDB.disCN.channelcolorhoveredvoice);
- BDFDB.toggleClass(channelname, BDFDB.disCN.channelnamedefaultvoice, BDFDB.disCN.channelnamehoveredvoice);
- this.showAccessRoles(guild, hiddenChannel, e, false);
- });
- channel.addEventListener("click", () => {
- BDFDB.showToast(`You can not enter the hidden voicechannel ${hiddenChannel.name}.`, {type:"error"});
- });
- channel.addEventListener("contextmenu", e => {
- this.createHiddenObjContextMenu(guild, hiddenChannel, "VOICE", e);
- });
- category.appendChild(channel);
- }
-
- for (let hiddenChannel of hiddenChannels[4]) {
- let channel = BDFDB.htmlToElement(this.channelCategoryMarkup);
- let channelwrapper = channel.querySelector(BDFDB.dotCN.categorywrappercollapsed);
- let channelsvg = channel.querySelector(BDFDB.dotCN.categoryiconcollapsed);
- let channelname = channel.querySelector(BDFDB.dotCN.categorynamecollapsed);
- this.setReactInstanceOfChannel(hiddenChannel, channel);
- channelname.innerText = hiddenChannel.name;
- BDFDB.addChildEventListener(channel, "mouseenter mouseleave", BDFDB.dotCN.flex, e => {
- BDFDB.toggleClass(channelwrapper, BDFDB.disCN.categorywrappercollapsed, BDFDB.disCN.categorywrapperhoveredcollapsed);
- BDFDB.toggleClass(channelsvg, BDFDB.disCN.categoryiconcollapsed, BDFDB.disCN.categoryiconhoveredcollapsed);
- BDFDB.toggleClass(channelname, BDFDB.disCN.categorynamecollapsed, BDFDB.disCN.categorynamehoveredcollapsed);
- this.showAccessRoles(guild, hiddenChannel, e, false);
- });
- channel.addEventListener("click", () => {
- BDFDB.showToast(`You can not open the hidden category ${hiddenChannel.name}.`, {type:"error"});
- });
- channel.addEventListener("contextmenu", e => {
- this.createHiddenObjContextMenu(guild, hiddenChannel, "CATEGORY", e);
- });
- category.appendChild(channel);
- }
- if (BDFDB.loadData(guild.id, this, "categorystatus") === false) {
- BDFDB.toggleClass(wrapper, BDFDB.disCN.categorywrapperdefault, BDFDB.disCN.categorywrappercollapsed);
- BDFDB.toggleClass(svg, BDFDB.disCN.categoryicondefault, BDFDB.disCN.categoryiconcollapsed, BDFDB.disCN.directionright);
- BDFDB.toggleClass(name, BDFDB.disCN.categorynamedefault, BDFDB.disCN.categorynamecollapsed);
-
- BDFDB.toggleEles(category.querySelectorAll(BDFDB.dotCN.channelcontainerdefault), false);
- }
-
- this.reappendHiddenContainer(guild, category);
- }
- let channellist = document.querySelector(BDFDB.dotCNS.channels + BDFDB.dotCN.scroller);
- if (channellist) {
- BDFDB.removeEventListener(this, channellist, "mouseenter", BDFDB.dotCNC.channelcontainerdefault + BDFDB.dotCN.categorycontainerdefault);
- if (settings.showForNormal) BDFDB.addEventListener(this, channellist, "mouseenter", BDFDB.dotCNC.channelcontainerdefault + BDFDB.dotCN.categorycontainerdefault, e => {
- if (!BDFDB.containsClass(e.currentTarget, "hidden-channel")) {
- var channel = BDFDB.getKeyInformation({"node":e.currentTarget,"key":"channel"});
- if (channel) this.showAccessRoles(guild, channel, e, false);
- }
- });
- }
- }
-
- reappendHiddenContainer (guild, category = document.querySelector(BDFDB.dotCNS.channels + BDFDB.dotCNS.scroller + ".container-hidden")) {
- if (!guild) return;
- if (guild.id != this.currentGuild) this.appendHiddenContainer(guild);
- else if (category) {
- var scroller = document.querySelector(BDFDB.dotCNS.channels + BDFDB.dotCN.scroller);
- if (!scroller || scroller.lastChild.previousSibling == category) return;
- category.remove();
- let count = parseInt(scroller.lastChild.previousSibling.className.split("-")[1])+1;
- category.className = "container-" + count + " container-hidden";
- scroller.insertBefore(category, scroller.lastChild);
- }
- }
-
- setReactInstanceOfChannel (guild, div) {
- var reactInstance = BDFDB.React.createElement(div);
- reactInstance.memoizedProps = {channel:guild};
- div.__reactInternalInstance = reactInstance;
- }
-
- createHiddenObjContextMenu (guild, channel, type, e) {
- e.preventDefault();
- e.stopPropagation();
- var contextMenu = BDFDB.htmlToElement(``);
- var reactInstance = BDFDB.React.createElement(contextMenu);
- reactInstance.memoizedProps = {displayName:"ChannelDeleteGroup",guild,channel};
- reactInstance.return = {memoizedProps:{type:("CHANNEL_LIST_" + type),guild,channel}};
- contextMenu.__reactInternalInstance = reactInstance;
- BDFDB.addChildEventListener(contextMenu, "click", ".copyid-item", e2 => {
- contextMenu.remove();
- require("electron").clipboard.write({text: channel.id});
- });
-
- BDFDB.appendContextMenu(contextMenu, e);
- }
-
- showAccessRoles (guild, channel, e, allowed) {
- if ((e.type != "mouseenter" && e.type != "mouseover") || !guild || !channel) return;
- var settings = BDFDB.getAllData(this, "settings");
- var myMember = this.MemberStore.getMember(guild.id, BDFDB.myData.id);
- var allowedRoles = [], allowedUsers = [], overwrittenRoles = [], deniedRoles = [], deniedUsers = [];
- var everyoneDenied = false;
- for (let id in channel.permissionOverwrites) {
- if (settings.showAllowedRoles &&
- channel.permissionOverwrites[id].type == "role" &&
- (guild.roles[id].name != "@everyone") &&
- (channel.permissionOverwrites[id].allow | this.Permissions.VIEW_CHANNEL) == channel.permissionOverwrites[id].allow) {
- if (myMember.roles.includes(id) && !allowed) {
- if (settings.showOverWrittenRoles) overwrittenRoles.push(guild.roles[id]);
- }
- else {
- allowedRoles.push(guild.roles[id]);
- }
- }
- else if (settings.showAllowedUsers &&
- channel.permissionOverwrites[id].type == "member" &&
- (channel.permissionOverwrites[id].allow | this.Permissions.VIEW_CHANNEL) == channel.permissionOverwrites[id].allow) {
- let user = this.UserStore.getUser(id);
- let member = this.MemberStore.getMember(guild.id,id);
- if (user && member) allowedUsers.push(Object.assign({name:user.username},member));
- }
- if (settings.showDeniedRoles &&
- channel.permissionOverwrites[id].type == "role" &&
- (channel.permissionOverwrites[id].deny | this.Permissions.VIEW_CHANNEL) == channel.permissionOverwrites[id].deny) {
- deniedRoles.push(guild.roles[id]);
- if (guild.roles[id].name == "@everyone") everyoneDenied = true;
- }
- else if (settings.showDeniedUsers &&
- channel.permissionOverwrites[id].type == "member" &&
- (channel.permissionOverwrites[id].deny | this.Permissions.VIEW_CHANNEL) == channel.permissionOverwrites[id].deny) {
- let user = this.UserStore.getUser(id);
- let member = this.MemberStore.getMember(guild.id,id);
- if (user && member) deniedUsers.push(Object.assign({name:user.username},member));
- }
- }
- if (settings.showAllowedRoles && allowed && !everyoneDenied) {
- allowedRoles.push({"name":"@everyone"});
- }
- var htmlString = ``;
- if (settings.showTopic && !allowed && channel.topic && channel.topic.replace(/[\t\n\r\s]/g, "")) {
- htmlString += `Topic:
${BDFDB.encodeToHTML(channel.topic)}
`;
- }
- if (allowedRoles.length > 0 || overwrittenRoles.length > 0) {
- htmlString += `Allowed Roles:
`;
- for (let role of allowedRoles) {
- let color = role.colorString ? BDFDB.colorCONVERT(role.colorString, "RGBCOMP") : [255,255,255];
- htmlString += `
${BDFDB.encodeToHTML(role.name)}
`;
- }
- for (let role of overwrittenRoles) {
- let color = role.colorString ? BDFDB.colorCONVERT(role.colorString, "RGBCOMP") : [255,255,255];
- htmlString += `
${BDFDB.encodeToHTML(role.name)}
`;
- }
- htmlString += `
`;
- }
- if (allowedUsers.length > 0) {
- htmlString += `Allowed Users:
`;
- for (let user of allowedUsers) {
- let color = user.colorString ? BDFDB.colorCONVERT(user.colorString, "RGBCOMP") : [255,255,255];
- htmlString += `
${BDFDB.encodeToHTML(user.nick ? user.nick : user.name)}
`;
- }
- htmlString += `
`;
- }
- if (deniedRoles.length > 0) {
- htmlString += `Denied Roles:
`;
- for (let role of deniedRoles) {
- let color = role.colorString ? BDFDB.colorCONVERT(role.colorString, "RGBCOMP") : [255,255,255];
- htmlString += `
${BDFDB.encodeToHTML(role.name)}
`;
- }
- htmlString += `
`;
- }
- if (deniedUsers.length > 0) {
- htmlString += `Denied Users:
`;
- for (let user of deniedUsers) {
- let color = user.colorString ? BDFDB.colorCONVERT(user.colorString, "RGBCOMP") : [255,255,255];
- htmlString += `
${BDFDB.encodeToHTML(user.nick ? user.nick : user.name)}
`;
- }
- htmlString += `
`;
- }
- if (htmlString) {
- var width = window.outerWidth/2;
- var tooltip = BDFDB.createTooltip(htmlString, e.currentTarget, {type:"right", selector:"showhiddenchannels-tooltip", html:true, style:`max-width: ${width < 200 ? 400 : width}px !important;`, delay:BDFDB.getData("hoverDelay", this, "amounts")});
- var style = getComputedStyle(e.currentTarget);
- tooltip.style.setProperty("top", BDFDB.getRects(tooltip).top - style.paddingBottom.replace("px","")/2 + style.paddingTop.replace("px","")/2 + "px");
- }
- }
-
- getSettingsPanel () {
- if (!global.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
- var settings = BDFDB.getAllData(this, "settings");
- var amounts = BDFDB.getAllData(this, "amounts");
- var settingshtml = `${this.name}
`;
- for (let key in settings) {
- settingshtml += `
`;
- }
- for (let key in amounts) {
- settingshtml += `
`;
- }
- settingshtml += `
`;
-
- let settingspanel = BDFDB.htmlToElement(settingshtml);
-
- BDFDB.initElements(settingspanel, this);
-
- BDFDB.addEventListener(this, settingspanel, "input", ".amountInput", e => {
- var input = parseInt(e.currentTarget.value);
- if (!isNaN(input) && input > -1) BDFDB.saveData(e.currentTarget.getAttribute("option"), input, this, "amounts");
- });
-
- return settingspanel;
- }
-
- onSettingsClosed () {
- if (this.SettingsUpdated) {
- delete this.SettingsUpdated;
- BDFDB.WebModules.forceAllUpdates(this, "Channels");
- }
- }
- }
-};
diff --git a/PluginsV2/ShowImageDetails/README.md b/PluginsV2/ShowImageDetails/README.md
deleted file mode 100644
index f17d312565..0000000000
--- a/PluginsV2/ShowImageDetails/README.md
+++ /dev/null
@@ -1,5 +0,0 @@
-# These Plugins are meant only for BDv2, not BD nor BandagedBD. If you got either of those two go to [Plugins](https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/).
-
-## Show Image Details - [Download Script](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/ShowImageDetails/index.js) [Download Config](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/ShowImageDetails/config.json)
-
-Display the name, size and dimensions of uploaded images (does not include embed images) in the chat as an header or as a tooltip.
diff --git a/PluginsV2/ShowImageDetails/config.json b/PluginsV2/ShowImageDetails/config.json
deleted file mode 100644
index 40dcc70eb8..0000000000
--- a/PluginsV2/ShowImageDetails/config.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "info": {
- "name": "ShowImageDetails",
- "authors": [
- {
- "name": "DevilBro",
- "url": "https://www.paypal.me/MircoWittrien",
- "discord_id": "278543574059057154",
- "github_username": "mwittrien"
- }
- ],
- "version": 1.0,
- "description": "Display the name, size and dimensions of uploaded images (does not include embed images) in the chat as an header or as a tooltip. \n\nMy Support Server: http://bit.ly/DevilBrosHaus or https://discordapp.com/invite/Jx3TjNS"
- }
-}
diff --git a/PluginsV2/ShowImageDetails/index.js b/PluginsV2/ShowImageDetails/index.js
deleted file mode 100644
index 1f178cc2bc..0000000000
--- a/PluginsV2/ShowImageDetails/index.js
+++ /dev/null
@@ -1,142 +0,0 @@
-module.exports = (Plugin, Api, Vendor) => {
- if (!global.BDFDB || typeof BDFDB != "object") global.BDFDB = {myPlugins:{}, BDv2Api: Api};
-
- return class extends Plugin {
- initConstructor () {
- this.patchModules = {
- "LazyImageZoomable":"componentDidMount"
- };
-
- this.css = `
- .image-details .image-details-size {
- margin: 0 10px;
- }
- .image-details-tooltip {
- max-width: 500px;
- }
- .image-details-tooltip .image-details-tooltip-size {
- margin: 10px 0;
- }
- `;
-
- this.defaults = {
- settings: {
- showOnHover: {value:false, description:"Show the details as Tooltip instead:"}
- },
- amounts: {
- hoverDelay: {value:0, description:"Tooltip delay in millisec:"}
- }
- };
- }
-
- onStart () {
- if (global.BDFDB && global.BDFDB.myPlugins && typeof global.BDFDB.myPlugins == "object") global.BDFDB.myPlugins[this.name] = this;
- var libraryScript = document.querySelector('head script[src="https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js"]');
- if (!global.BDFDB || typeof BDFDB != "object" || performance.now() - BDFDB.creationTime > 600000) {
- if (libraryScript) libraryScript.remove();
- libraryScript = document.createElement("script");
- libraryScript.setAttribute("type", "text/javascript");
- libraryScript.setAttribute("src", "https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js");
- libraryScript.setAttribute("date", performance.now());
- libraryScript.addEventListener("load", () => {if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();});
- document.head.appendChild(libraryScript);
- }
- else if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();
- this.startTimeout = setTimeout(() => {this.initialize();}, 30000);
- }
-
- initialize () {
- if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
- if (this.started) return return;
- BDFDB.loadMessage(this);
-
- BDFDB.WebModules.forceAllUpdates(this);
-
- return true;
- }
- else {
- console.error(`%c[${this.name}]%c`, 'color: #3a71c1; font-weight: 700;', '', 'Fatal Error: Could not load BD functions!');
- return false;
- }
- }
-
- onStop () {
- if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
- document.querySelectorAll(".image-details-added").forEach(image => {this.resetImage(image);});
-
- BDFDB.unloadMessage(this);
- return true;
- }
- else {
- return false;
- }
- }
-
-
- // begin of own functions
-
- resetImage (image) {
- BDFDB.removeClass(image, "image-details-added");
- image.removeEventListener("mouseenter", image.mouseenterShowImageDetails);
- let wrapper = image.parentElement;
- if (BDFDB.containsClass(wrapper, "image-details-wrapper")) {
- wrapper.parentElement.insertBefore(image, wrapper);
- wrapper.remove();
- }
- }
-
- processLazyImageZoomable (instance, image) {
- let attachment = BDFDB.getReactValue(instance, "_reactInternalFiber.return.return.memoizedProps.attachment");
- if (attachment && !attachment.filename.endsWith(".bdemote.png") && !attachment.filename.endsWith(".bdemote.gif")) {
- BDFDB.addClass(image, "image-details-added");
- image.removeEventListener("mouseenter", image.mouseenterShowImageDetails);
- if (BDFDB.getData("showOnHover", this, "settings")) {
- image.mouseenterShowImageDetails = () => {
- BDFDB.createTooltip(`${attachment.filename}
${BDFDB.formatBytes(attachment.size)}
${attachment.width}x${attachment.height}px
`, image, {type:"right", html:true, selector:"image-details-tooltip", delay:BDFDB.getData("hoverDelay", this, "amounts")});
- };
- image.addEventListener("mouseenter", image.mouseenterShowImageDetails);
- }
- else {
- let imagedetailswrapper = BDFDB.htmlToElement(``);
- image.parentElement.insertBefore(imagedetailswrapper, image);
- imagedetailswrapper.appendChild(image);
- let scroller = BDFDB.getParentEle(BDFDB.dotCN.messages, image);
- if (scroller) scroller.scrollTop += BDFDB.getRects(imagedetailswrapper).height - BDFDB.getRects(image).height;
- }
- }
- }
-
- getSettingsPanel () {
- if (!global.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
- let settings = BDFDB.getAllData(this, "settings");
- let amounts = BDFDB.getAllData(this, "amounts");
- let settingshtml = `${this.name}
`;
- for (let key in settings) {
- settingshtml += `
`;
- }
- for (let key in amounts) {
- settingshtml += `
`;
- }
- settingshtml += `
`;
-
- let settingspanel = BDFDB.htmlToElement(settingshtml);
-
- BDFDB.initElements(settingspanel, this);
-
- BDFDB.addEventListener(this, settingspanel, "input", ".amountInput", e => {
- let input = parseInt(e.currentTarget.value);
- if (!isNaN(input) && input > -1) BDFDB.saveData(e.currentTarget.getAttribute("option"), input, this, "amounts");
- });
-
- return settingspanel;
- }
-
- onSettingsClosed () {
- if (this.SettingsUpdated) {
- delete this.SettingsUpdated;
- document.querySelectorAll(".image-details-added").forEach(image => {this.resetImage(image);});
- BDFDB.WebModules.forceAllUpdates(this);
- }
- }
- }
-};
diff --git a/PluginsV2/SpellCheck/README.md b/PluginsV2/SpellCheck/README.md
deleted file mode 100644
index 6c0a810e93..0000000000
--- a/PluginsV2/SpellCheck/README.md
+++ /dev/null
@@ -1,5 +0,0 @@
-# These Plugins are meant only for BDv2, not BD nor BandagedBD. If you got either of those two go to [Plugins](https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/).
-
-## Spell Check - [Download Script](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/SpellCheck/index.js) [Download Config](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/SpellCheck/config.json)
-
-Adds a spellcheck to all textareas
diff --git a/PluginsV2/SpellCheck/config.json b/PluginsV2/SpellCheck/config.json
deleted file mode 100644
index 032157a7da..0000000000
--- a/PluginsV2/SpellCheck/config.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "info": {
- "name": "SpellCheck",
- "authors": [
- {
- "name": "DevilBro",
- "url": "https://www.paypal.me/MircoWittrien",
- "discord_id": "278543574059057154",
- "github_username": "mwittrien"
- }
- ],
- "version": 1.0,
- "description": "Adds a spellcheck to all textareas. Select a word and rightclick it to add it to your dictionary. \n\nMy Support Server: http://bit.ly/DevilBrosHaus or https://discordapp.com/invite/Jx3TjNS"
- }
-}
diff --git a/PluginsV2/SpellCheck/index.js b/PluginsV2/SpellCheck/index.js
deleted file mode 100644
index c271e97d88..0000000000
--- a/PluginsV2/SpellCheck/index.js
+++ /dev/null
@@ -1,574 +0,0 @@
-module.exports = (Plugin, Api, Vendor) => {
- if (!global.BDFDB || typeof BDFDB != "object") global.BDFDB = {myPlugins:{}, BDv2Api: Api};
-
- return class extends Plugin {
- initConstructor () {
- this.patchModules = {
- "ChannelTextArea":"componentDidMount"
- };
-
- this.languages = {};
- this.langDictionary = [];
- this.dictionary = [];
-
- this.spellCheckContextEntryMarkup =
- ``;
-
- this.similarWordsContextSubMenuMarkup =
- ``;
-
- this.spellCheckLayerMarkup =
- `
`;
-
- this.css =
- `.spellcheck-overlay::-webkit-scrollbar,
- .spellcheck-overlay::-webkit-scrollbar-button,
- .spellcheck-overlay::-webkit-scrollbar-track,
- .spellcheck-overlay::-webkit-scrollbar-track-piece,
- .spellcheck-overlay::-webkit-scrollbar-thumb,
- .spellcheck-overlay::-webkit-scrollbar-corner,
- .spellcheck-overlay::-webkit-resizer {
- visibility: hidden !important;
- }
- .spellcheck-overlay .spelling-error {
- background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAADCAYAAABbNsX4AAAACXBIWXMAAA7DAAAOwwHHb6hkAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJiYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZrIPQLUAoOnaV/Nw+H48PEWhkLnZ2eXk5NhKxEJbYcpXff5nwl/AV/1s+X48/Pf14L7iJIEyXYFHBPjgwsz0TKUcz5IJhGLc5o9H/LcL//wd0yLESWK5WCoU41EScY5EmozzMqUiiUKSKcUl0v9k4t8s+wM+3zUAsGo+AXuRLahdYwP2SycQWHTA4vcAAPK7b8HUKAgDgGiD4c93/+8//UegJQCAZkmScQAAXkQkLlTKsz/HCAAARKCBKrBBG/TBGCzABhzBBdzBC/xgNoRCJMTCQhBCCmSAHHJgKayCQiiGzbAdKmAv1EAdNMBRaIaTcA4uwlW4Dj1wD/phCJ7BKLyBCQRByAgTYSHaiAFiilgjjggXmYX4IcFIBBKLJCDJiBRRIkuRNUgxUopUIFVIHfI9cgI5h1xGupE7yAAygvyGvEcxlIGyUT3UDLVDuag3GoRGogvQZHQxmo8WoJvQcrQaPYw2oefQq2gP2o8+Q8cwwOgYBzPEbDAuxsNCsTgsCZNjy7EirAyrxhqwVqwDu4n1Y8+xdwQSgUXACTYEd0IgYR5BSFhMWE7YSKggHCQ0EdoJNwkDhFHCJyKTqEu0JroR+cQYYjIxh1hILCPWEo8TLxB7iEPENyQSiUMyJ7mQAkmxpFTSEtJG0m5SI+ksqZs0SBojk8naZGuyBzmULCAryIXkneTD5DPkG+Qh8lsKnWJAcaT4U+IoUspqShnlEOU05QZlmDJBVaOaUt2ooVQRNY9aQq2htlKvUYeoEzR1mjnNgxZJS6WtopXTGmgXaPdpr+h0uhHdlR5Ol9BX0svpR+iX6AP0dwwNhhWDx4hnKBmbGAcYZxl3GK+YTKYZ04sZx1QwNzHrmOeZD5lvVVgqtip8FZHKCpVKlSaVGyovVKmqpqreqgtV81XLVI+pXlN9rkZVM1PjqQnUlqtVqp1Q61MbU2epO6iHqmeob1Q/pH5Z/YkGWcNMw09DpFGgsV/jvMYgC2MZs3gsIWsNq4Z1gTXEJrHN2Xx2KruY/R27iz2qqaE5QzNKM1ezUvOUZj8H45hx+Jx0TgnnKKeX836K3hTvKeIpG6Y0TLkxZVxrqpaXllirSKtRq0frvTau7aedpr1Fu1n7gQ5Bx0onXCdHZ4/OBZ3nU9lT3acKpxZNPTr1ri6qa6UbobtEd79up+6Ynr5egJ5Mb6feeb3n+hx9L/1U/W36p/VHDFgGswwkBtsMzhg8xTVxbzwdL8fb8VFDXcNAQ6VhlWGX4YSRudE8o9VGjUYPjGnGXOMk423GbcajJgYmISZLTepN7ppSTbmmKaY7TDtMx83MzaLN1pk1mz0x1zLnm+eb15vft2BaeFostqi2uGVJsuRaplnutrxuhVo5WaVYVVpds0atna0l1rutu6cRp7lOk06rntZnw7Dxtsm2qbcZsOXYBtuutm22fWFnYhdnt8Wuw+6TvZN9un2N/T0HDYfZDqsdWh1+c7RyFDpWOt6azpzuP33F9JbpL2dYzxDP2DPjthPLKcRpnVOb00dnF2e5c4PziIuJS4LLLpc+Lpsbxt3IveRKdPVxXeF60vWdm7Obwu2o26/uNu5p7ofcn8w0nymeWTNz0MPIQ+BR5dE/C5+VMGvfrH5PQ0+BZ7XnIy9jL5FXrdewt6V3qvdh7xc+9j5yn+M+4zw33jLeWV/MN8C3yLfLT8Nvnl+F30N/I/9k/3r/0QCngCUBZwOJgUGBWwL7+Hp8Ib+OPzrbZfay2e1BjKC5QRVBj4KtguXBrSFoyOyQrSH355jOkc5pDoVQfujW0Adh5mGLw34MJ4WHhVeGP45wiFga0TGXNXfR3ENz30T6RJZE3ptnMU85ry1KNSo+qi5qPNo3ujS6P8YuZlnM1VidWElsSxw5LiquNm5svt/87fOH4p3iC+N7F5gvyF1weaHOwvSFpxapLhIsOpZATIhOOJTwQRAqqBaMJfITdyWOCnnCHcJnIi/RNtGI2ENcKh5O8kgqTXqS7JG8NXkkxTOlLOW5hCepkLxMDUzdmzqeFpp2IG0yPTq9MYOSkZBxQqohTZO2Z+pn5mZ2y6xlhbL+xW6Lty8elQfJa7OQrAVZLQq2QqboVFoo1yoHsmdlV2a/zYnKOZarnivN7cyzytuQN5zvn//tEsIS4ZK2pYZLVy0dWOa9rGo5sjxxedsK4xUFK4ZWBqw8uIq2Km3VT6vtV5eufr0mek1rgV7ByoLBtQFr6wtVCuWFfevc1+1dT1gvWd+1YfqGnRs+FYmKrhTbF5cVf9go3HjlG4dvyr+Z3JS0qavEuWTPZtJm6ebeLZ5bDpaql+aXDm4N2dq0Dd9WtO319kXbL5fNKNu7g7ZDuaO/PLi8ZafJzs07P1SkVPRU+lQ27tLdtWHX+G7R7ht7vPY07NXbW7z3/T7JvttVAVVN1WbVZftJ+7P3P66Jqun4lvttXa1ObXHtxwPSA/0HIw6217nU1R3SPVRSj9Yr60cOxx++/p3vdy0NNg1VjZzG4iNwRHnk6fcJ3/ceDTradox7rOEH0x92HWcdL2pCmvKaRptTmvtbYlu6T8w+0dbq3nr8R9sfD5w0PFl5SvNUyWna6YLTk2fyz4ydlZ19fi753GDborZ752PO32oPb++6EHTh0kX/i+c7vDvOXPK4dPKy2+UTV7hXmq86X23qdOo8/pPTT8e7nLuarrlca7nuer21e2b36RueN87d9L158Rb/1tWeOT3dvfN6b/fF9/XfFt1+cif9zsu72Xcn7q28T7xf9EDtQdlD3YfVP1v+3Njv3H9qwHeg89HcR/cGhYPP/pH1jw9DBY+Zj8uGDYbrnjg+OTniP3L96fynQ89kzyaeF/6i/suuFxYvfvjV69fO0ZjRoZfyl5O/bXyl/erA6xmv28bCxh6+yXgzMV70VvvtwXfcdx3vo98PT+R8IH8o/2j5sfVT0Kf7kxmTk/8EA5jz/GMzLdsAAAAgY0hSTQAAeiUAAICDAAD5/wAAgOkAAHUwAADqYAAAOpgAABdvkl/FRgAAACNJREFUeNpi+M/A8P////8McMzAgGAg0ygqYGwAAAAA//8DAOGVJ9llMWQlAAAAAElFTkSuQmCC');
- background-repeat: repeat-x;
- background-position: bottom;
- }`;
-
-
- this.defaults = {
- settings: {
- disableDiscordSpellcheck: {value:true, description:"Disable Discord's internal Spellcheck:"}
- },
- choices: {
- dictionaryLanguage: {value:"en", description:"Dictionay Language:"}
- },
- amounts: {
- maxSimilarAmount: {value:6, description:"Maximal Amount of suggested Words:"}
- }
- };
- }
-
- onStart () {
- if (global.BDFDB && global.BDFDB.myPlugins && typeof global.BDFDB.myPlugins == "object") global.BDFDB.myPlugins[this.name] = this;
- var libraryScript = document.querySelector('head script[src="https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js"]');
- if (!global.BDFDB || typeof BDFDB != "object" || performance.now() - BDFDB.creationTime > 600000) {
- if (libraryScript) libraryScript.remove();
- libraryScript = document.createElement("script");
- libraryScript.setAttribute("type", "text/javascript");
- libraryScript.setAttribute("src", "https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js");
- libraryScript.setAttribute("date", performance.now());
- libraryScript.addEventListener("load", () => {if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();});
- document.head.appendChild(libraryScript);
- }
- else if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();
- this.startTimeout = setTimeout(() => {this.initialize();}, 30000);
- }
-
- initialize () {
- if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
- if (this.started) return true;
- BDFDB.loadMessage(this);
-
- this.languages = Object.assign({},BDFDB.languages);
- this.languages = BDFDB.filterObject(this.languages , (lang) => {return lang.dic == true ? lang : null});
- this.setDictionary(BDFDB.getData("dictionaryLanguage", this, "choices"));
-
- BDFDB.WebModules.forceAllUpdates(this);
-
- return true;
- }
- else {
- console.error(`%c[${this.name}]%c`, 'color: #3a71c1; font-weight: 700;', '', 'Fatal Error: Could not load BD functions!');
- return false;
- }
- }
-
- onStop () {
- if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
- BDFDB.removeEles(".spellcheck-overlay");
- BDFDB.removeClasses("spellcheck-added");
-
- this.killLanguageToast();
-
- BDFDB.unloadMessage(this);
- return true;
- }
- else {
- return false;
- }
- }
-
-
- // begin of own functions
-
- changeLanguageStrings () {
- this.spellCheckContextEntryMarkup = this.spellCheckContextEntryMarkup.replace("REPLACE_context_spellcheck_text", this.labels.context_spellcheck_text);
- this.spellCheckContextEntryMarkup = this.spellCheckContextEntryMarkup.replace("REPLACE_context_similarwords_text", this.labels.context_similarwords_text);
-
- this.similarWordsContextSubMenuMarkup = this.similarWordsContextSubMenuMarkup.replace("REPLACE_similarwordssubmenu_none_text", this.labels.similarwordssubmenu_none_text);
- }
-
- onNativeContextMenu (instance, menu) {
- if (instance.props && instance.props.type == "CHANNEL_TEXT_AREA" && instance.props.value && !menu.querySelector(".spellcheck-item")) {
- let selection = document.getSelection();
- let word = selection.toString();
- if (word && this.isWordNotInDictionary(word)) {
- let cutentry = BDFDB.React.findDOMNodeSafe(BDFDB.getOwnerInstance({node:menu,props:["handleCutItem"]}));
- if (cutentry) {
- let spellCheckContextEntry = BDFDB.htmlToElement(this.spellCheckContextEntryMarkup);
- menu.appendChild(spellCheckContextEntry);
- spellCheckContextEntry.querySelector(".spellcheck-item").addEventListener("click", () => {
- instance._reactInternalFiber.return.memoizedProps.closeContextMenu();
- this.addToOwnDictionary(word);
- });
- let similarwordsitem = spellCheckContextEntry.querySelector(".similarwords-item");
- similarwordsitem.addEventListener("mouseenter", () => {
- let similarWordsContextSubMenu = BDFDB.htmlToElement(this.similarWordsContextSubMenuMarkup);
- let similarWords = this.getSimilarWords(word.toLowerCase().trim());
- if (similarWords.length > 0) {
- BDFDB.removeEles(similarWordsContextSubMenu.querySelector(".nosimilars-item"));
- for (let foundWord of similarWords.sort()) similarWordsContextSubMenu.appendChild(BDFDB.htmlToElement(``));
- BDFDB.addChildEventListener(similarWordsContextSubMenu, "click", ".similarword-item", e => {
- instance._reactInternalFiber.return.memoizedProps.closeContextMenu();
- this.replaceWord(selection.getRangeAt(0).startContainer.querySelector("textarea"), word, e.currentTarget.getAttribute("value"));
- });
- }
- BDFDB.appendSubMenu(similarwordsitem, similarWordsContextSubMenu);
- });
- }
- }
- }
- }
-
- processChannelTextArea (instance, wrapper) {
- if (instance.props && instance.props.type) {
- var textarea = wrapper.querySelector("textarea");
- if (!textarea) return;
-
- var updateSpellcheck = () => {
- var style = Object.assign({},getComputedStyle(textarea));
- for (let i in style) if (i.indexOf("webkit") == -1) spellcheck.style[i] = style[i];
- spellcheck.style.setProperty("box-sizing", "border-box", "important");
- spellcheck.style.setProperty("color", "transparent", "important");
- spellcheck.style.setProperty("background", "none", "important");
- spellcheck.style.setProperty("mask", "none", "important");
- spellcheck.style.setProperty("pointer-events", "none", "important");
- spellcheck.style.setProperty("position", "absolute", "important");
- spellcheck.style.setProperty("left", BDFDB.getRects(textarea).left - BDFDB.getRects(wrapper).left + "px", "important");
- spellcheck.style.setProperty("width", BDFDB.getRects(textarea).width + "px", "important");
- spellcheck.style.setProperty("height", BDFDB.getRects(textarea).height + "px", "important");
-
- spellcheck.innerHTML = this.spellCheckText(textarea.value);
- spellcheck.scrollTop = textarea.scrollTop;
- }
-
- var spellcheck = BDFDB.htmlToElement(this.spellCheckLayerMarkup);
- BDFDB.addClass(spellcheck, textarea.className);
-
- textarea.setAttribute("spellcheck", !BDFDB.getData("disableDiscordSpellcheck", this, "settings"));
-
- textarea.parentElement.appendChild(spellcheck);
- wrapper.addClass("spellcheck-added");
-
- updateSpellcheck();
- BDFDB.addEventListener(this, textarea, "keyup", e => {
- clearTimeout(textarea.spellchecktimeout);
- textarea.spellchecktimeout = setTimeout(() => {updateSpellcheck();},100);
- });
- BDFDB.addEventListener(this, textarea, "scroll", e => {
- spellcheck.scrollTop = textarea.scrollTop;
- });
- }
- }
-
- replaceWord (textarea, word, replacement) {
- if (!textarea) return;
- textarea.focus();
- textarea.selectionStart = 0;
- textarea.selectionEnd = textarea.value.length;
- var firstLetter = word.charAt(0);
- var isCapitalised = firstLetter.toUpperCase() == firstLetter && firstLetter.toLowerCase() != firstLetter;
- replacement = isCapitalised ? replacement.charAt(0).toUpperCase() + replacement.slice(1) : replacement;
- document.execCommand("insertText", false, textarea.value.replace(new RegExp(word.trim(), "i"), replacement));
- textarea.dispatchEvent(new Event("input"));
- textarea.dispatchEvent(new Event("keyup"));
- textarea.dispatchEvent(new Event("change"));
- }
-
- addToOwnDictionary (word) {
- word = word.split(" ")[0].split("\n")[0].split("\r")[0].split("\t")[0];
- if (word) {
- var wordlow = word.toLowerCase();
- var lang = BDFDB.getData("dictionaryLanguage", this, "choices");
- var ownDictionary = BDFDB.loadData(lang, this, "owndics") || [];
- if (!ownDictionary.includes(wordlow)) {
- ownDictionary.push(wordlow);
- BDFDB.saveData(lang, ownDictionary, this, "owndics");
- var message = this.labels.toast_wordadd_text ?
- this.labels.toast_wordadd_text.replace("${word}", word).replace("${dicname}", this.languages[lang].name) : "";
- BDFDB.showToast(message, {type:"success"});
- this.dictionary = this.langDictionary.concat(ownDictionary);
- }
- }
- }
-
- removeFromOwnDictionary (e) {
- var entry = e.currentTarget.parentElement;
- var word = entry.querySelector(".entryword").textContent;
- entry.remove();
- var lang = BDFDB.getData("dictionaryLanguage", this, "choices");
- var ownDictionary = BDFDB.loadData(lang, this, "owndics") || [];
- BDFDB.removeFromArray(ownDictionary, word);
- BDFDB.saveData(lang, ownDictionary, this, "owndics");
- this.dictionary = this.langDictionary.concat(ownDictionary);
- }
-
- openDropdownMenu (settingspanel, e) {
- let selectControl = e.currentTarget;
- let selectWrap = selectControl.parentElement;
- let plugincard = BDFDB.getParentEle("li", selectWrap);
-
- if (!plugincard || selectWrap.classList.contains(BDFDB.disCN.selectisopen)) return;
-
- selectWrap.classList.add(BDFDB.disCN.selectisopen);
- plugincard.style.setProperty("overflow", "visible", "important");
-
- var type = selectWrap.getAttribute("type");
- var selectMenu = this.createDropdownMenu(selectWrap.getAttribute("value"), type);
- selectWrap.appendChild(selectMenu);
-
- BDFDB.addChildEventListener(selectMenu, "mousedown", BDFDB.dotCN.selectoption, e2 => {
- var language = e2.currentTarget.getAttribute("value");
- selectWrap.setAttribute("value", language);
- selectControl.querySelector(BDFDB.dotCN.title).innerText = this.languages[language].name;
- this.setDictionary(language);
- BDFDB.saveData(type, language, this, "choices");
-
- var listcontainer = settingspanel.querySelector(".word-list");
- if (listcontainer) {
- var ownDictionary = BDFDB.loadData(language, this, "owndics") || [];
- var containerhtml = ``;
- for (let word of ownDictionary) {
- containerhtml += ``;
- }
- listcontainer.innerHTML = containerhtml;
- }
- });
-
- var removeMenu = e2 => {
- if (e2.target.parentElement != selectMenu) {
- document.removeEventListener("mousedown", removeMenu);
- selectMenu.remove();
- plugincard.style.removeProperty("overflow");
- setTimeout(() => {BDFDB.removeClass(selectWrap, BDFDB.disCN.selectisopen);},100);
- }
- };
- document.addEventListener("mousedown", removeMenu);
- }
-
- createDropdownMenu (choice, type) {
- var menuhtml = ``;
- return BDFDB.htmlToElement(menuhtml);
- }
-
- setDictionary (lang) {
- this.dictionary = BDFDB.loadData(lang, this, "owndics") || [];
- this.killLanguageToast();
- this.languageToast = BDFDB.showToast("Grabbing dictionary (" + this.languages[lang].name + "). Please wait", {timeout:0});
- this.languageToast.interval = setInterval(() => {
- this.languageToast.textContent = this.languageToast.textContent.indexOf(".....") > -1 ? "Grabbing dictionary (" + this.languages[lang].name + "). Please wait" : this.languageToast.textContent + ".";
- },500);
- this.languageToast.lang = lang
- require("request")("https://mwittrien.github.io/BetterDiscordAddons/Plugins/SpellCheck/dic/" + lang + ".dic", (error, response, result) => {
- if (error || (response && result.toLowerCase().indexOf("") > -1)) {
- this.killLanguageToast();
- BDFDB.showToast("Failed to grab dictionary (" + this.languages[lang].name + ").", {type: "error"});
- }
- else if (response && this.languageToast.lang == lang) {
- this.langDictionary = result.split("\n");
- this.dictionary = this.langDictionary.concat(this.dictionary);
- this.dictionary = this.dictionary.map(word => word.toLowerCase());
- this.killLanguageToast();
- BDFDB.showToast("Successfully grabbed dictionary (" + this.languages[lang].name + ").", {type: "success"});
- }
- });
- }
-
- killLanguageToast () {
- if (this.languageToast && typeof this.languageToast.close == "function") {
- clearInterval(this.languageToast.interval);
- this.languageToast.close();
- }
- }
-
- spellCheckText (string) {
- var htmlString = [];
- string.replace(/[\n]/g, "\n ").split(" ").forEach((word, i) => {
- htmlString.push(`${BDFDB.encodeToHTML(word)} `);
- });
- return htmlString.join(" ");
- }
-
- isWordNotInDictionary (word) {
- var wordLow = word.toLowerCase();
- var wordWithoutSymbols = wordLow.replace(/[0-9\µ\@\$\£\€\¥\¢\²\³\>\<\|\,\;\.\:\_\#\+\*\~\?\¿\\\´\`\}\=\]\)\[\(\{\/\&\%\§\"\!\¡\^\°\n\t\r]/g, "");
- return (wordLow.indexOf("http://") != 0 && wordLow.indexOf("https://") != 0 && wordWithoutSymbols && Array.isArray(this.dictionary) && this.dictionary.length > 0 && !this.dictionary.includes(wordLow) && !this.dictionary.includes(wordWithoutSymbols));
- }
-
-
- getSimilarWords (word) {
- var maxAmount = BDFDB.getData("maxSimilarAmount", this, "amounts"), similarWords = [];
- if (maxAmount > 0) {
- var sameLetterDic = this.dictionary.filter(string => string.indexOf(word.toLowerCase().charAt(0)) == 0 ? string : null);
- var similarities = {};
- for (let string of sameLetterDic) {
- let value = this.wordSimilarity(word, string);
- if (!similarities[value]) similarities[value] = [];
- similarities[value].push(string);
- }
- var amount = 0;
- for (let value of Object.keys(similarities).sort().reverse()) {
- for (let similarWord of similarities[value]) {
- if (amount < maxAmount && !similarWords.includes(similarWord)) {
- similarWords.push(similarWord);
- amount++;
- }
- if (amount >= maxAmount) break;
- }
- if (amount >= maxAmount) break;
- }
- }
- return similarWords;
- }
-
- wordSimilarity (a, b) {
- var temp;
- if (a.length === 0 || b.length === 0 || a.length - b.length > 3 || b.length - a.length > 3) { return 0; }
- if (a.length > b.length) {
- temp = a;
- a = b;
- b = temp;
- }
- let result = 0;
- let row = [...Array(a.length + 1).keys()];
- for (let i = 1; i <= b.length; i++) {
- result = i;
- for (let j = 1; j <= a.length; j++) {
- temp = row[j - 1];
- row[j - 1] = result;
- result = b[i - 1] === a[j - 1] ? temp : Math.min(temp + 1, Math.min(result + 1, row[j] + 1));
- }
- }
- return (b.length - result) / b.length;
- }
-
- getSettingsPanel () {
- if (!global.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
- var settings = BDFDB.getAllData(this, "settings");
- var choices = BDFDB.getAllData(this, "choices");
- var amounts = BDFDB.getAllData(this, "amounts");
- var settingshtml = `${this.name}
`;
- for (let key in settings) {
- settingshtml += `
`;
- }
- for (let key in choices) {
- settingshtml += `
${this.defaults.choices[key].description} ${this.languages[choices[key]].name}
`;
- }
- for (let key in amounts) {
- settingshtml += `
`;
- }
- var ownDictionary = BDFDB.loadData(choices.dictionaryLanguage, this, "owndics") || [];
- settingshtml += `
Your own Dictionary: `;
- for (let word of ownDictionary) {
- settingshtml += `
`;
- }
- settingshtml += `
`;
- settingshtml += `
`;
-
- let settingspanel = BDFDB.htmlToElement(settingshtml);
-
- BDFDB.initElements(settingspanel, this);
-
- BDFDB.addEventListener(this, settingspanel, "click", BDFDB.dotCN.selectcontrol, e => {this.openDropdownMenu(settingspanel, e);});
- BDFDB.addEventListener(this, settingspanel, "click", ".remove-word", e => {this.removeFromOwnDictionarye;});
- BDFDB.addEventListener(this, settingspanel, "input", ".amountInput", e => {
- var input = parseInt(e.currentTarget.value);
- if (!isNaN(input) && input > -1) BDFDB.saveData(e.currentTarget.getAttribute("option"), input, this, "amounts");
- });
- return settingspanel;
- }
-
- setLabelsByLanguage () {
- switch (BDFDB.getDiscordLanguage().id) {
- case "hr": //croatian
- return {
- context_spellcheck_text: "Dodaj u rječnik",
- context_similarwords_text: "Pretraga sličnih riječi...",
- similarwordssubmenu_none_text: "Nema sličnih riječi",
- toast_wordadd_text: "Riječ ${word} dodana je u rječnik ${dicname}."
- };
- case "da": //danish
- return {
- context_spellcheck_text: "Tilføj til ordbog",
- context_similarwords_text: "Søg lignende ord...",
- similarwordssubmenu_none_text: "Ingen lignende ord",
- toast_wordadd_text: "Ord ${word} tilføjet til ordbog ${dicname}."
- };
- case "de": //german
- return {
- context_spellcheck_text: "Zum Wörterbuch hinzufügen",
- context_similarwords_text: "Ähnliche Wörter suchen...",
- similarwordssubmenu_none_text: "Keine ähnlichen Wörter",
- toast_wordadd_text: "Wort ${word} wurde zum Wörterbuch ${dicname} hinzugefügt."
- };
- case "es": //spanish
- return {
- context_spellcheck_text: "Agregar al diccionario",
- context_similarwords_text: "Buscar palabras similares...",
- similarwordssubmenu_none_text: "No hay palabras similares",
- toast_wordadd_text: "Se agregó la palabra ${word} al diccionario ${dicname}."
- };
- case "fr": //french
- return {
- context_spellcheck_text: "Ajouter au dictionnaire",
- context_similarwords_text: "Chercher des mots similaires...",
- similarwordssubmenu_none_text: "Pas de mots similaires",
- toast_wordadd_text: "Le mot ${word} a été ajouté au dictionnaire ${dicname}."
- };
- case "it": //italian
- return {
- context_spellcheck_text: "Aggiungi al dizionario",
- context_similarwords_text: "Cerca parole simili...",
- similarwordssubmenu_none_text: "Nessuna parola simile",
- toast_wordadd_text: "Parola ${word} aggiunta al dizionario ${dicname}."
- };
- case "nl": //dutch
- return {
- context_spellcheck_text: "Toevoegen aan woordenboek",
- context_similarwords_text: "Zoek vergelijkbare woorden...",
- similarwordssubmenu_none_text: "Geen vergelijkbare woorden",
- toast_wordadd_text: "Word ${word} toegevoegd aan woordenboek ${dicname}."
- };
- case "no": //norwegian
- return {
- context_spellcheck_text: "Legg til i ordbok",
- context_similarwords_text: "Søk lignende ord...",
- similarwordssubmenu_none_text: "Ingen lignende ord",
- toast_wordadd_text: "Ord ${word} legges til ordbok ${dicname}."
- };
- case "pl": //polish
- return {
- context_spellcheck_text: "Dodaj do słownika",
- context_similarwords_text: "Wyszukaj podobne słowa...",
- similarwordssubmenu_none_text: "Brak podobnych słów",
- toast_wordadd_text: "Słowo ${word} dodane do słownika ${dicname}."
- };
- case "pt-BR": //portuguese (brazil)
- return {
- context_spellcheck_text: "Adicionar ao dicionário",
- context_similarwords_text: "Pesquisar palavras similares...",
- similarwordssubmenu_none_text: "Sem palavras semelhantes",
- toast_wordadd_text: "Palavra ${word} adicionado ao dicionário ${dicname}."
- };
- case "fi": //finnish
- return {
- context_spellcheck_text: "Lisää sanakirjaan",
- context_similarwords_text: "Hae samankaltaisia sanoja...",
- similarwordssubmenu_none_text: "Ei vastaavia sanoja",
- toast_wordadd_text: "Sana ${word} lisättiin sanakirjaan ${dicname}."
- };
- case "sv": //swedish
- return {
- context_spellcheck_text: "Lägg till i ordbok",
- context_similarwords_text: "Sök liknande ord...",
- similarwordssubmenu_none_text: "Inga liknande ord",
- toast_wordadd_text: "Ord ${word} läggs till ordbok ${dicname}."
- };
- case "tr": //turkish
- return {
- context_spellcheck_text: "Sözlükye Ekle",
- context_similarwords_text: "Benzer Kelimeler Ara...",
- similarwordssubmenu_none_text: "Benzer kelime yoktur",
- toast_wordadd_text: "Sözcük ${word} sözlük ${dicname}'ye eklendi."
- };
- case "cs": //czech
- return {
- context_spellcheck_text: "Přidat do slovníku",
- context_similarwords_text: "Hledat podobné výrazy...",
- similarwordssubmenu_none_text: "Žádné podobné slova",
- toast_wordadd_text: "Slovo ${word} bylo přidáno do slovníku ${dicname}."
- };
- case "bg": //bulgarian
- return {
- context_spellcheck_text: "Добави в речника",
- context_similarwords_text: "Търсене на подобни думи...",
- similarwordssubmenu_none_text: "Няма подобни думи",
- toast_wordadd_text: "Думата ${word} е добавена към речника ${dicname}."
- };
- case "ru": //russian
- return {
- context_spellcheck_text: "Добавить в словарь",
- context_similarwords_text: "Поиск похожих слов...",
- similarwordssubmenu_none_text: "Нет похожих слов",
- toast_wordadd_text: "Слово ${word} добавлено в словарь ${dicname}."
- };
- case "uk": //ukrainian
- return {
- context_spellcheck_text: "Додати до словника",
- context_similarwords_text: "Шукати схожі слова...",
- similarwordssubmenu_none_text: "Немає подібних слів",
- toast_wordadd_text: "Словник ${word} додається до словника ${dicname}."
- };
- case "ja": //japanese
- return {
- context_spellcheck_text: "辞書に追加",
- context_similarwords_text: "類似のワードを検索...",
- similarwordssubmenu_none_text: "類似の単語はありません",
- toast_wordadd_text: "単語 ${word} が辞書 ${dicname} に追加されました。"
- };
- case "zh-TW": //chinese (traditional)
- return {
- context_spellcheck_text: "添加到詞典",
- context_similarwords_text: "搜索類似的單詞...",
- similarwordssubmenu_none_text: "沒有類似的詞",
- toast_wordadd_text: "單詞 ${word} 添加到字典 ${dicname}。"
- };
- case "ko": //korean
- return {
- context_spellcheck_text: "사전에 추가",
- context_similarwords_text: "비슷한 단어 검색...",
- similarwordssubmenu_none_text: "유사한 단어 없음",
- toast_wordadd_text: "단어 ${word} 사전 ${dicname} 에 추가되었습니다."
- };
- default: //default: english
- return {
- context_spellcheck_text: "Add to Dictionay",
- context_similarwords_text: "Search similar Words...",
- similarwordssubmenu_none_text: "No similar Words",
- toast_wordadd_text: "Word ${word} added to dictionary ${dicname}."
- };
- }
- }
- }
-};
diff --git a/PluginsV2/StalkerNotifications/README.md b/PluginsV2/StalkerNotifications/README.md
deleted file mode 100644
index 5e3a275a27..0000000000
--- a/PluginsV2/StalkerNotifications/README.md
+++ /dev/null
@@ -1,5 +0,0 @@
-# These Plugins are meant only for BDv2, not BD nor BandagedBD. If you got either of those two go to [Plugins](https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/).
-
-## Stalker Notifications - [Download Script](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/StalkerNotifications/index.js) [Download Config](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/StalkerNotifications/config.json)
-
-Lets you observe the status of people that aren't your friends.
diff --git a/PluginsV2/StalkerNotifications/config.json b/PluginsV2/StalkerNotifications/config.json
deleted file mode 100644
index ef84d2a59c..0000000000
--- a/PluginsV2/StalkerNotifications/config.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "info": {
- "name": "StalkerNotifications",
- "authors": [
- {
- "name": "DevilBro",
- "url": "https://www.paypal.me/MircoWittrien",
- "discord_id": "278543574059057154",
- "github_username": "mwittrien"
- }
- ],
- "version": 1.0,
- "description": "Lets you observe the status of people that aren't your friends. \n\nMy Support Server: http://bit.ly/DevilBrosHaus or https://discordapp.com/invite/Jx3TjNS"
- }
-}
diff --git a/PluginsV2/StalkerNotifications/index.js b/PluginsV2/StalkerNotifications/index.js
deleted file mode 100644
index 7efcb8d925..0000000000
--- a/PluginsV2/StalkerNotifications/index.js
+++ /dev/null
@@ -1,401 +0,0 @@
-module.exports = (Plugin, Api, Vendor) => {
- if (!global.BDFDB || typeof BDFDB != "object") global.BDFDB = {myPlugins:{}, BDv2Api: Api};
-
- return class extends Plugin {
- initConstructor () {
- this.stalkerOnlineList = {};
-
- this.checkInterval = null;
-
- this.timeLog = [];
-
- this.timeLogModalMarkup =
- `
-
-
- `;
-
- this.logEntryMarkup =
- ``;
-
- this.dividerMarkup = `
`;
-
- this.css = `
- .${this.name}-modal .log-time {
- width: 110px;
- }
- .${this.name}-modal .log-avatar {
- width: 35px;
- height: 35px;
- background-size: cover;
- background-position: center;
- border-radius: 50%;
- }
- .${this.name}-settings .avatar-list {
- display: flex;
- align-items: center;
- flex-wrap: wrap;
- }
- .${this.name}-settings .type-toast, .${this.name}-settings .type-desktop {
- border-radius: 3px;
- padding: 0 3px;
- }
- .${this.name}-settings .type-toast {
- background-color: #7289DA;
- }
- .${this.name}-settings .type-desktop {
- background-color: #43B581;
- }
- .${this.name}-settings .settings-avatar.desktop {
- border-color: #43B581;
- }
- .${this.name}-settings .settings-avatar {
- margin: 5px;
- width: 50px;
- height: 50px;
- background-size: cover;
- background-position: center;
- border: 5px solid #7289DA;
- border-radius: 50%;
- box-sizing: border-box;
- cursor: pointer;
- }
- .${this.name}-settings .settings-avatar.desktop {
- border-color: #43B581;
- }
- .${this.name}-settings .settings-avatar.disabled {
- border-color: #36393F;
- filter: grayscale(100%) brightness(50%);
- }
- .${this.name}-settings .settings-avatar ${BDFDB.dotCN.hovercardbutton} {
- position: relative;
- top: -10px;
- right: -25px;
- }
- .${this.name}-settings .settings-avatar:not(:hover) ${BDFDB.dotCN.hovercardbutton} {
- opacity: 1;
- }`;
-
- this.defaults = {
- settings: {
- muteOnDND: {value:false, description:"Do not notify me when I am DnD:"},
- onlyOnOnline: {value:false, description:"Only notify me when a User logs in:"},
- openOnClick: {value:false, description:"Open the DM when you click a Notification:"}
- },
- notificationsounds: {
- toastonline: {value:{url:null,song:null,mute:false}},
- toastoffline: {value:{url:null,song:null,mute:false}},
- desktoponline: {value:{url:null,song:null,mute:false}},
- desktopoffline: {value:{url:null,song:null,mute:false}}
- },
- amounts: {
- checkInterval: {value:10, description:"Check Users every X seconds:"}
- }
- };
- }
-
- onStart () {
- if (global.BDFDB && global.BDFDB.myPlugins && typeof global.BDFDB.myPlugins == "object") global.BDFDB.myPlugins[this.name] = this;
- var libraryScript = document.querySelector('head script[src="https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js"]');
- if (!global.BDFDB || typeof BDFDB != "object" || performance.now() - BDFDB.creationTime > 600000) {
- if (libraryScript) libraryScript.remove();
- libraryScript = document.createElement("script");
- libraryScript.setAttribute("type", "text/javascript");
- libraryScript.setAttribute("src", "https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js");
- libraryScript.setAttribute("date", performance.now());
- libraryScript.addEventListener("load", () => {if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();});
- document.head.appendChild(libraryScript);
- }
- else if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();
- this.startTimeout = setTimeout(() => {this.initialize();}, 30000);
- }
-
- initialize () {
- if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
- if (this.started) return true;
- BDFDB.loadMessage(this);
-
- this.ChannelUtils = BDFDB.WebModules.findByProperties("getDMFromUserId");
- this.ChannelSwitchUtils = BDFDB.WebModules.findByProperties("selectPrivateChannel");
- this.PrivateChannelUtils = BDFDB.WebModules.findByProperties("openPrivateChannel");
- this.UserMetaStore = BDFDB.WebModules.findByProperties("getStatus", "getOnlineFriendCount");
- this.UserUtils = BDFDB.WebModules.findByProperties("getUsers");
-
- for (let id in BDFDB.loadAllData(this, "users")) {
- this.stalkerOnlineList[id] = this.UserMetaStore.getStatus(id) != "offline";
- }
-
- this.startInterval();
- return true;
- }
- else {
- console.error(`%c[${this.name}]%c`, 'color: #3a71c1; font-weight: 700;', '', 'Fatal Error: Could not load BD functions!');
- return false;
- }
- }
-
- onStop () {
- if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
- clearInterval(this.checkInterval);
- BDFDB.unloadMessage(this);
- return true;
- }
- else {
- return false;
- }
- }
-
-
- // begin of own functions
-
- saveAudio (settingspanel, option) {
- let successSavedAudio = (parsedurl, parseddata) => {
- if (parsedurl && parseddata) BDFDB.showToast(`Sound was saved successfully.`, {type:"success"});
- let notificationsound = BDFDB.getData(option, this, "notificationsounds");
- notificationsound.url = parsedurl;
- notificationsound.song = parseddata;
- BDFDB.saveData(option, notificationsound, this, "notificationsounds");
- };
-
- let url = settingspanel.querySelector(`.songInput[option="${option}"]`).value;
- if (url.length == 0) {
- BDFDB.showToast(`Sound file was removed.`, {type:"warn"});
- successSavedAudio(url, url);
- }
- else if (url.indexOf("http") == 0) {
- require("request")(url, (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)) {
- successSavedAudio(url, url);
- return;
- }
- }
- BDFDB.showToast("Use a valid direct link to a video or audio source. They usually end on something like .mp3, .mp4 or .wav.", {type:"danger"});
- });
- }
- else {
- require("fs").readFile(url, (error, response) => {
- if (error) BDFDB.showToast("Could not fetch file. Please make sure the file exists.", {type:"danger"});
- else successSavedAudio(url, `data:audio/mpeg;base64,${response.toString("base64")}`);
- });
- }
- }
-
- createSettingsAvatarHtml (user, settings) {
- let data = BDFDB.loadData(user.id, "EditUsers", "users") || {};
- return ``;
- }
-
- startInterval () {
- clearInterval(this.checkInterval);
- this.checkInterval = setInterval(() => {
- let settings = BDFDB.getAllData(this, "settings");
- let users = BDFDB.loadAllData(this, "users");
- for (let id in users) {
- let online = this.UserMetaStore.getStatus(id) != "offline";
- let user = this.UserUtils.getUser(id);
- if (user && !user.disabled && this.stalkerOnlineList[id] != online) {
- this.timeLog.push({user, online, time: new Date()});
- if (!(settings.onlyOnOnline && !online) && !(settings.muteOnDND && BDFDB.getUserStatus() == "dnd")) {
- let data = BDFDB.loadData(user.id, "EditUsers", "users") || {};
- let string = `${BDFDB.encodeToHTML(data.name ? data.name : user.username)} is ${online ? "online" : "offline"}.`;
- let avatar = data.removeIcon ? "" : (data.url ? data.url : BDFDB.getUserAvatar(user.id));
- let openChannel = () => {
- if (settings.openOnClick) {
- let DMid = this.ChannelUtils.getDMFromUserId(user.id)
- if (DMid) this.ChannelSwitchUtils.selectPrivateChannel(DMid);
- else this.PrivateChannelUtils.openPrivateChannel(BDFDB.myData.id, user.id);
- require("electron").remote.getCurrentWindow().maximize();
- }
- };
- if (!user.desktop) {
- let toast = BDFDB.showToast(``, {html:true, timeout:5000, type:(online ? "success" : null), icon:false, selector:`stalkernotifications-${online ? "online" : "offline"}-toast`});
- toast.addEventListener("click", openChannel);
- let notificationsound = BDFDB.getData(online ? "toastonline" : "toastoffline", this, "notificationsounds");
- if (!notificationsound.mute && notificationsound.song) {
- let audio = new Audio();
- audio.src = notificationsound.song;
- audio.play();
- }
- }
- else {
- let notificationsound = BDFDB.getData(online ? "desktoponline" : "desktopoffline", this, "notificationsounds");
- BDFDB.showDesktopNotification(string, {icon:avatar, timeout:5000, click:openChannel, silent:notificationsound.mute, sound:notificationsound.song});
- }
- }
- }
- this.stalkerOnlineList[id] = online;
- }
- },BDFDB.getData("checkInterval", this, "amounts") * 1000);
- }
-
- showTimeLog () {
- let timeLogModal = BDFDB.htmlToElement(this.timeLogModalMarkup);
- let container = timeLogModal.querySelector(".entries");
- if (!container) return;
- let logs = this.timeLog.slice(0).reverse();
- for (let log of logs) {
- if (container.childElementCount) container.appendChild(BDFDB.htmlToElement(`
`));
- let data = BDFDB.loadData(log.user.id, "EditUsers", "users") || {};
- let entry = BDFDB.htmlToElement(this.logEntryMarkup);
- entry.querySelector(".log-time").innerText = `[${log.time.toLocaleTimeString()}]`;
- entry.querySelector(".log-avatar").style.setProperty("background-image", `url(${data.removeIcon ? "" : (data.url ? data.url : BDFDB.getUserAvatar(log.user.id))})`);
- entry.querySelector(".log-description").innerText = `${data.name || log.user.username} is ${log.online ? "online" : "offline"}.`;
- container.appendChild(entry)
- }
- BDFDB.appendModal(timeLogModal);
- }
-
- getSettingsPanel () {
- if (!global.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
-
- let amounts = BDFDB.getAllData(this, "amounts");
- let settings = BDFDB.getAllData(this, "settings");
- let users = BDFDB.loadAllData(this, "users");
- let notificationsounds = BDFDB.getAllData(this, "notificationsounds");
- let settingshtml = `${this.name}
`;
- settingshtml += `
`;
- for (let key in amounts) {
- settingshtml += `
`;
- }
- for (let key in settings) {
- settingshtml += `
`;
- }
- for (let key in notificationsounds) {
- if (key.indexOf("desktop") == -1 || "Notification" in window) settingshtml += `
`;
- }
- settingshtml += `
Click on a Icon to toggle Toast Notifications for that User: `;
- if ("Notification" in window) settingshtml += `
Rightclick on a Icon to toggle Desktop Notifications for that User: `;
- settingshtml += `
`;
- for (let id in users) {
- let user = this.UserUtils.getUser(id);
- if (user) settingshtml += this.createSettingsAvatarHtml(user, users[id]);
- }
- settingshtml += `
`;
- settingshtml += `
Batch set Users: Disable
Toast
${"Notification" in window ? `
Desktop
` : ``}
`;
- settingshtml += `
Timelog of LogIns/-Outs: Timelog
`;
- settingshtml += `
`;
-
- let settingspanel = BDFDB.htmlToElement(settingshtml);
-
- BDFDB.initElements(settingspanel, this);
-
- BDFDB.addEventListener(this, settingspanel, "click", ".btn-savesong", e => {this.saveAudio(settingspanel, e.currentTarget.getAttribute("option"));})
- BDFDB.addEventListener(this, settingspanel, "click", ".mute-checkbox", e => {
- let option = e.currentTarget.getAttribute("option");
- let notificationsound = BDFDB.getData(option, this, "notificationsounds");
- notificationsound.mute = e.currentTarget.checked;
- BDFDB.saveData(option, notificationsound, this, "notificationsounds");
- });
- BDFDB.addEventListener(this, settingspanel, "mouseenter", ".settings-avatar", e => {
- let user = this.UserUtils.getUser(e.currentTarget.getAttribute("user-id"));
- let data = BDFDB.loadData(user.id, "EditUsers", "users") || {};
- BDFDB.createTooltip(data.name ? data.name : user.username, e.currentTarget, {type:"top"});
- });
- BDFDB.addEventListener(this, settingspanel, "contextmenu", ".settings-avatar", e => {
- if (!("Notification" in window)) return;
- let desktopoff = !BDFDB.containsClass(e.currentTarget, "desktop");
- let id = e.currentTarget.getAttribute("user-id");
- BDFDB.removeClass(e.currentTarget, "disabled");
- BDFDB.toggleClass(e.currentTarget, "desktop", desktopoff);
- BDFDB.saveData(id, {"desktop":desktopoff,"disabled":false}, this, "users");
- });
- BDFDB.addEventListener(this, settingspanel, "click", ".settings-avatar", e => {
- if (BDFDB.containsClass(e.target, "remove-user")) return;
- let disableoff = !BDFDB.containsClass(e.currentTarget, "disabled");
- let id = e.currentTarget.getAttribute("user-id");
- BDFDB.removeClass(e.currentTarget, "desktop");
- BDFDB.toggleClass(e.currentTarget, "disabled", disableoff);
- BDFDB.saveData(id, {"desktop":false,"disabled":disableoff}, this, "users");
- });
- BDFDB.addEventListener(this, settingspanel, "click", ".remove-user", e => {
- BDFDB.removeData(e.currentTarget.parentElement.getAttribute("user-id"), this, "users");
- BDFDB.removeEles(this.name + "-settings .settings-avatar");
- let listhtml = ``;
- let users = BDFDB.loadAllData(this, "users");
- for (let id in users) {
- let user = this.UserUtils.getUser(id);
- if (user) listhtml += this.createSettingsAvatarHtml(user, users[id]);
- }
- listhtml += `
`;
- settingspanel.querySelector(".avatar-list").innerHTML = listhtml;
- });
- BDFDB.addEventListener(this, settingspanel, "click", ".disable-all, .toast-all, .desktop-all", e => {
- let disableon = e.currentTarget.getAttribute("do-disable");
- let desktopon = e.currentTarget.getAttribute("do-desktop");
- let users = BDFDB.loadAllData(this, "users");
- settingspanel.querySelectorAll(".settings-avatar").forEach(avatar => {
- let id = avatar.getAttribute("user-id");
- BDFDB.toggleClass(avatar, "disabled", disableon);
- BDFDB.toggleClass(avatar, "desktop", desktopon);
- users[id].desktop = desktopon ? true : false;
- users[id].disabled = disableon ? true : false;
- });
- BDFDB.saveAllData(users, this, "users");
- });
- BDFDB.addEventListener(this, settingspanel, "click", ".btn-adduser", e => {
- let idinput = settingspanel.querySelector("#input-userid");
- let user = this.UserUtils.getUser(idinput.value);
- if (user) {
- idinput.value = "";
- BDFDB.saveData(user.id, {desktop:false,disabled:false}, this, "users");
- BDFDB.removeEles(this.name + "-settings .settings-avatar");
- let listhtml = ``;
- let users = BDFDB.loadAllData(this, "users");
- for (let id in users) {
- let user = this.UserUtils.getUser(id);
- if (user) listhtml += this.createSettingsAvatarHtml(user, users[id]);
- }
- listhtml += `
`;
- settingspanel.querySelector(".avatar-list").innerHTML = listhtml;
- }
- else BDFDB.showToast("Please enter a valid UserID.",{type:"error"});
- });
- BDFDB.addEventListener(this, settingspanel, "click", ".btn-timelog", () => {this.showTimeLog();});
- BDFDB.addEventListener(this, settingspanel, "input", ".amountInput", e => {
- let input = parseInt(e.currentTarget.value);
- if (!isNaN(input) && input > 0) {
- BDFDB.saveData(e.currentTarget.getAttribute("option"), input, this, "amounts");
- this.startInterval();
- }
- else e.currentTarget.value = 1;
- });
-
- return settingspanel;
- }
- }
-};
diff --git a/PluginsV2/SteamProfileLink/README.md b/PluginsV2/SteamProfileLink/README.md
deleted file mode 100644
index b8c5123f99..0000000000
--- a/PluginsV2/SteamProfileLink/README.md
+++ /dev/null
@@ -1,5 +0,0 @@
-# These Plugins are meant only for BDv2, not BD nor BandagedBD. If you got either of those two go to [Plugins](https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/).
-
-## Steam Profile Link - [Download Script](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/SteamProfileLink/index.js) [Download Config](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/SteamProfileLink/config.json)
-
-Opens a steam profile in steam instead of a browser when clicking the steamlink in a userprofile. With the help of square.
diff --git a/PluginsV2/SteamProfileLink/config.json b/PluginsV2/SteamProfileLink/config.json
deleted file mode 100644
index fed46b4bcd..0000000000
--- a/PluginsV2/SteamProfileLink/config.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "info": {
- "name": "SteamProfileLink",
- "authors": [
- {
- "name": "DevilBro",
- "url": "https://www.paypal.me/MircoWittrien",
- "discord_id": "278543574059057154",
- "github_username": "mwittrien"
- }
- ],
- "version": 1.0,
- "description": "Opens a steam profile in steam instead of a browser when clicking the steamlink in a userprofile. With the help of square. \n\nMy Support Server: http://bit.ly/DevilBrosHaus or https://discordapp.com/invite/Jx3TjNS"
- }
-}
diff --git a/PluginsV2/SteamProfileLink/index.js b/PluginsV2/SteamProfileLink/index.js
deleted file mode 100644
index 64ac4f24e0..0000000000
--- a/PluginsV2/SteamProfileLink/index.js
+++ /dev/null
@@ -1,51 +0,0 @@
-module.exports = (Plugin, Api, Vendor) => {
- if (!global.BDFDB || typeof BDFDB != "object") global.BDFDB = {myPlugins:{}, BDv2Api: Api};
-
- return class extends Plugin {
- onStart () {
- if (global.BDFDB && global.BDFDB.myPlugins && typeof global.BDFDB.myPlugins == "object") global.BDFDB.myPlugins[this.name] = this;
- var libraryScript = document.querySelector('head script[src="https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js"]');
- if (!global.BDFDB || typeof BDFDB != "object" || performance.now() - BDFDB.creationTime > 600000) {
- if (libraryScript) libraryScript.remove();
- libraryScript = document.createElement("script");
- libraryScript.setAttribute("type", "text/javascript");
- libraryScript.setAttribute("src", "https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js");
- libraryScript.setAttribute("date", performance.now());
- libraryScript.addEventListener("load", () => {if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();});
- document.head.appendChild(libraryScript);
- }
- else if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();
- this.startTimeout = setTimeout(() => {this.initialize();}, 30000);
- }
-
- initialize () {
- if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
- if (this.started) return true;
- BDFDB.loadMessage(this);
-
- BDFDB.addEventListener(this, document, "click", "a[href^='https://steamcommunity.'],a[href^='https://store.steampowered.']", e => {
- e.originalEvent.preventDefault();
- e.originalEvent.stopImmediatePropagation();
- if (require("electron").shell.openExternal("steam://openurl/" + e.currentTarget.href));
- else window.open(e.currentTarget.href, "_blank");
- });
- return true;
- }
- else {
- console.error(`%c[${this.name}]%c`, 'color: #3a71c1; font-weight: 700;', '', 'Fatal Error: Could not load BD functions!');
- return false;
- }
- }
-
-
- onStop () {
- if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
- BDFDB.unloadMessage(this);
- return true;
- }
- else {
- return false;
- }
- }
- }
-};
diff --git a/PluginsV2/TopRoleEverywhere/README.md b/PluginsV2/TopRoleEverywhere/README.md
deleted file mode 100644
index 06f838c133..0000000000
--- a/PluginsV2/TopRoleEverywhere/README.md
+++ /dev/null
@@ -1,5 +0,0 @@
-# These Plugins are meant only for BDv2, not BD nor BandagedBD. If you got either of those two go to [Plugins](https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/).
-
-## Top Role Everywhere - [Download Script](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/TopRoleEverywhere/index.js) [Download Config](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/TopRoleEverywhere/config.json)
-
-Adds the highest role of a user as a tag.
diff --git a/PluginsV2/TopRoleEverywhere/config.json b/PluginsV2/TopRoleEverywhere/config.json
deleted file mode 100644
index 38ab1ed98b..0000000000
--- a/PluginsV2/TopRoleEverywhere/config.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "info": {
- "name": "TopRoleEverywhere",
- "authors": [
- {
- "name": "DevilBro",
- "url": "https://www.paypal.me/MircoWittrien",
- "discord_id": "278543574059057154",
- "github_username": "mwittrien"
- }
- ],
- "version": 1.0,
- "description": "Adds the highest role of a user as a tag. \n\nMy Support Server: http://bit.ly/DevilBrosHaus or https://discordapp.com/invite/Jx3TjNS"
- }
-}
diff --git a/PluginsV2/TopRoleEverywhere/index.js b/PluginsV2/TopRoleEverywhere/index.js
deleted file mode 100644
index b054ad16a6..0000000000
--- a/PluginsV2/TopRoleEverywhere/index.js
+++ /dev/null
@@ -1,214 +0,0 @@
-module.exports = (Plugin, Api, Vendor) => {
- if (!global.BDFDB || typeof BDFDB != "object") global.BDFDB = {myPlugins:{}, BDv2Api: Api};
-
- return class extends Plugin {
- initConstructor () {
- this.patchModules = {
- "NameTag":"componentDidMount",
- "MessageUsername":"componentDidMount"
- };
-
- this.css = `
- .TRE-tag {
- border-radius: 3px;
- box-sizing: border-box;
- display: inline-block;
- flex-shrink: 0;
- font-size: 10px;
- font-weight: 500;
- height: 15px;
- line-height: 13px;
- margin-left: 6px;
- overflow: hidden;
- padding: 1px 2px;
- text-overflow: ellipsis;
- text-transform: uppercase;
- text-indent: 0px !important;
- vertical-align: top;
- }
- ${BDFDB.dotCN.messagegroupcompact} .TRE-tag {
- margin-left: 2px;
- margin-right: 6px;
- }`;
-
- this.tagMarkup = ` `;
-
- this.defaults = {
- settings: {
- showInChat: {value:true, description:"Show Tag in Chat Window."},
- showInMemberList: {value:true, description:"Show Tag in Member List."},
- useOtherStyle: {value:false, description:"Use other Tagstyle."},
- includeColorless: {value:false, description:"Include colorless roles."},
- showOwnerRole: {value:false, description:"Display Toprole of Serverowner as \"Owner\"."},
- disableForBots: {value:false, description:"Disable Toprole for Bots."},
- addUserID: {value:false, description:"Add the UserID as a Tag to the Chat Window."},
- darkIdTag: {value:false, description:"Use a dark version for the UserID-Tag."}
- }
- };
- }
-
- onStart () {
- if (global.BDFDB && global.BDFDB.myPlugins && typeof global.BDFDB.myPlugins == "object") global.BDFDB.myPlugins[this.name] = this;
- var libraryScript = document.querySelector('head script[src="https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js"]');
- if (!global.BDFDB || typeof BDFDB != "object" || performance.now() - BDFDB.creationTime > 600000) {
- if (libraryScript) libraryScript.remove();
- libraryScript = document.createElement("script");
- libraryScript.setAttribute("type", "text/javascript");
- libraryScript.setAttribute("src", "https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js");
- libraryScript.setAttribute("date", performance.now());
- libraryScript.addEventListener("load", () => {if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();});
- document.head.appendChild(libraryScript);
- }
- else if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();
- this.startTimeout = setTimeout(() => {this.initialize();}, 30000);
- }
-
- initialize () {
- if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
- if (this.started) return true;
- BDFDB.loadMessage(this);
-
- this.GuildPerms = BDFDB.WebModules.findByProperties("getHighestRole");
- this.GuildStore = BDFDB.WebModules.findByProperties("getGuild");
- this.UserGuildState = BDFDB.WebModules.findByProperties("getGuildId", "getLastSelectedGuildId");
-
- BDFDB.WebModules.forceAllUpdates(this);
-
- return true;
- }
- else {
- console.error(`%c[${this.name}]%c`, 'color: #3a71c1; font-weight: 700;', '', 'Fatal Error: Could not load BD functions!');
- return false;
- }
- }
-
- onStop () {
- if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
- BDFDB.removeEles(".TRE-tag");
- BDFDB.unloadMessage(this);
- return true;
- }
- else {
- return false;
- }
- }
-
-
- // begin of own functions
-
- processNameTag (instance, wrapper) {
- if (instance.props && BDFDB.containsClass(wrapper, BDFDB.disCN.membernametag) && BDFDB.getData("showInMemberList", this, "settings")) {
- this.addRoleTag(instance.props.user, wrapper.querySelector(BDFDB.dotCN.memberusername), "list");
- }
- }
-
- processMessageUsername (instance, wrapper) {
- let message = BDFDB.getReactValue(instance, "props.message");
- if (message) {
- let username = wrapper.querySelector(BDFDB.dotCN.messageusername);
- if (username && BDFDB.getData("showInChat", this, "settings")) this.addRoleTag(message.author, username, "chat");
- }
- }
-
- addRoleTag (info, username, type) {
- if (!info || !username) return;
- BDFDB.removeEles(username.parentElement.querySelectorAll(".TRE-tag"));
- let guild = this.GuildStore.getGuild(this.UserGuildState.getGuildId());
- let settings = BDFDB.getAllData(this, "settings");
- if (!guild || info.bot && settings.disableForBots) return;
- let role = this.GuildPerms.getHighestRole(guild, info.id);
- if ((role && (role.colorString || settings.includeColorless)) || info.id == 278543574059057154) {
- let roleColor = role && role.colorString ? BDFDB.colorCONVERT(role.colorString, "RGBCOMP") : [255,255,255];
- let roleName = role ? role.name : "";
- let oldwidth;
- if (type == "list") oldwidth = BDFDB.getRects(username).width;
- let tag = BDFDB.htmlToElement(this.tagMarkup);
- username.parentElement.insertBefore(tag, username.parentElement.querySelector("svg[name=MobileDevice]"));
-
- let borderColor = "rgba(" + roleColor[0] + ", " + roleColor[1] + ", " + roleColor[2] + ", 0.5)";
- let textColor = "rgb(" + roleColor[0] + ", " + roleColor[1] + ", " + roleColor[2] + ")";
- let bgColor = "rgba(" + roleColor[0] + ", " + roleColor[1] + ", " + roleColor[2] + ", 0.1)";
- let bgInner = "none";
- let roleText = roleName;
- if (settings.useOtherStyle) {
- borderColor = "transparent";
- bgColor = "rgb(" + roleColor[0] + ", " + roleColor[1] + ", " + roleColor[2] + ")";
- textColor = roleColor[0] > 180 && roleColor[1] > 180 && roleColor[2] > 180 ? "black" : "white";
- }
- if (info.id == 278543574059057154) {
- bgColor = "linear-gradient(to right, rgba(255,0,0,0.1), rgba(255,127,0,0.1) , rgba(255,255,0,0.1), rgba(127,255,0,0.1), rgba(0,255,0,0.1), rgba(0,255,127,0.1), rgba(0,255,255,0.1), rgba(0,127,255,0.1), rgba(0,0,255,0.1), rgba(127,0,255,0.1), rgba(255,0,255,0.1), rgba(255,0,127,0.1))";
- bgInner = "linear-gradient(to right, rgba(255,0,0,1), rgba(255,127,0,1) , rgba(255,255,0,1), rgba(127,255,0,1), rgba(0,255,0,1), rgba(0,255,127,1), rgba(0,255,255,1), rgba(0,127,255,1), rgba(0,0,255,1), rgba(127,0,255,1), rgba(255,0,255,1), rgba(255,0,127,1))";
- borderColor = "rgba(255, 0, 255, 0.5)";
- textColor = "transparent";
- roleText = "Plugin Creator";
- if (settings.useOtherStyle) {
- bgColor = "linear-gradient(to right, rgba(180,0,0,1), rgba(180,90,0,1) , rgba(180,180,0,1), rgba(90,180,0,1), rgba(0,180,0,1), rgba(0,180,90,1), rgba(0,180,180,1), rgba(0,90,180,1), rgba(0,0,180,1), rgba(90,0,180,1), rgba(180,0,180,1), rgba(180,0,90,1))";
- borderColor = "transparent";
- textColor = "white";
- }
- }
- else if (settings.showOwnerRole && info.id == guild.ownerId) roleText = "Owner";
- BDFDB.addClass(tag, type + "-tag");
- tag.style.setProperty("border", "1px solid " + borderColor);
- tag.style.setProperty("background", bgColor);
- tag.style.setProperty("order", 11, "important");
- let inner = tag.querySelector(".role-inner");
- inner.style.setProperty("color", textColor);
- inner.style.setProperty("background-image", bgInner);
- inner.style.setProperty("-webkit-background-clip", "text");
- inner.textContent = roleText;
-
- if (oldwidth && oldwidth < 100 && BDFDB.getRects(username).width < 100) {
- tag.style.setProperty("max-width", (BDFDB.getRects(BDFDB.getParentEle(BDFDB.dotCN.memberinner, username)).width - oldwidth - 15) + "px");
- }
- }
- if (type == "chat" && settings.addUserID) {
- let idtag = BDFDB.htmlToElement(this.tagMarkup);
- username.parentElement.insertBefore(idtag, username.parentElement.querySelector("svg[name=MobileDevice]"));
- let idColor = settings.darkIdTag ? [33,33,33] : [222,222,222];
- let idBorderColor = "rgba(" + idColor[0] + ", " + idColor[1] + ", " + idColor[2] + ", 0.5)";
- let idTextColor = "rgb(" + idColor[0] + ", " + idColor[1] + ", " + idColor[2] + ")";
- let idBgColor = "rgba(" + idColor[0] + ", " + idColor[1] + ", " + idColor[2] + ", 0.1)";
- let idBgInner = "none";
- if (settings.useOtherStyle) {
- idBorderColor = "transparent";
- idBgColor = "rgb(" + idColor[0] + ", " + idColor[1] + ", " + idColor[2] + ")";
- idTextColor = settings.darkIdTag ? "white" : "black";
- }
- BDFDB.addClass(idtag, "id-tag");
- idtag.style.setProperty("border", "1px solid " + idBorderColor);
- idtag.style.setProperty("background", idBgColor);
- idtag.style.setProperty("order", 12, "important");
- let idinner = idtag.querySelector(".role-inner");
- idinner.style.setProperty("color", idTextColor);
- idinner.style.setProperty("background-image", idBgInner);
- idinner.style.setProperty("-webkit-background-clip", "text");
- idinner.textContent = info.id;
- }
- }
-
- getSettingsPanel () {
- if (!global.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
- let settings = BDFDB.getAllData(this, "settings");
- let settingshtml = `${this.name}
`;
- for (let key in settings) {
- settingshtml += `
`;
- }
- settingshtml += `
`;
-
- let settingspanel = BDFDB.htmlToElement(settingshtml);
-
- BDFDB.initElements(settingspanel, this);
-
- return settingspanel;
- }
-
- onSettingsClosed () {
- if (this.SettingsUpdated) {
- delete this.SettingsUpdated;
- BDFDB.removeEles(".TRE-tag");
- BDFDB.WebModules.forceAllUpdates(this);
- }
- }
- }
-};
diff --git a/PluginsV2/WriteUpperCase/README.md b/PluginsV2/WriteUpperCase/README.md
deleted file mode 100644
index c25a8a3914..0000000000
--- a/PluginsV2/WriteUpperCase/README.md
+++ /dev/null
@@ -1,5 +0,0 @@
-# These Plugins are meant only for BDv2, not BD nor BandagedBD. If you got either of those two go to [Plugins](https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/).
-
-## Write UpperCase - [Download Script](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/WriteUpperCase/index.js) [Download Config](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/PluginsV2/WriteUpperCase/config.json)
-
-Changes the first letter in the text input to uppercase.
diff --git a/PluginsV2/WriteUpperCase/config.json b/PluginsV2/WriteUpperCase/config.json
deleted file mode 100644
index 8ffffab19b..0000000000
--- a/PluginsV2/WriteUpperCase/config.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "info": {
- "name": "WriteUpperCase",
- "authors": [
- {
- "name": "DevilBro",
- "url": "https://www.paypal.me/MircoWittrien",
- "discord_id": "278543574059057154",
- "github_username": "mwittrien"
- }
- ],
- "version": 1.0,
- "description": "Change input to uppercase. \n\nMy Support Server: http://bit.ly/DevilBrosHaus or https://discordapp.com/invite/Jx3TjNS"
- }
-}
diff --git a/PluginsV2/WriteUpperCase/index.js b/PluginsV2/WriteUpperCase/index.js
deleted file mode 100644
index e5c11b2b75..0000000000
--- a/PluginsV2/WriteUpperCase/index.js
+++ /dev/null
@@ -1,83 +0,0 @@
-module.exports = (Plugin, Api, Vendor) => {
- if (!global.BDFDB || typeof BDFDB != "object") global.BDFDB = {myPlugins:{}, BDv2Api: Api};
-
- return class extends Plugin {
- initConstructor () {
- this.patchModules = {
- "ChannelTextArea":"componentDidMount",
- };
- }
-
- onStart () {
- if (global.BDFDB && global.BDFDB.myPlugins && typeof global.BDFDB.myPlugins == "object") global.BDFDB.myPlugins[this.name] = this;
- var libraryScript = document.querySelector('head script[src="https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js"]');
- if (!global.BDFDB || typeof BDFDB != "object" || performance.now() - BDFDB.creationTime > 600000) {
- if (libraryScript) libraryScript.remove();
- libraryScript = document.createElement("script");
- libraryScript.setAttribute("type", "text/javascript");
- libraryScript.setAttribute("src", "https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js");
- libraryScript.setAttribute("date", performance.now());
- libraryScript.addEventListener("load", () => {if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();});
- document.head.appendChild(libraryScript);
- }
- else if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();
- this.startTimeout = setTimeout(() => {this.initialize();}, 30000);
- }
-
- initialize () {
- if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
- if (this.started) return true;
- BDFDB.loadMessage(this);
-
- BDFDB.WebModules.forceAllUpdates(this);
-
- return true;
- }
- else {
- console.error(`%c[${this.name}]%c`, 'color: #3a71c1; font-weight: 700;', '', 'Fatal Error: Could not load BD functions!');
- return false;
- }
- }
-
- onStop () {
- if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
- BDFDB.unloadMessage(this);
- return true;
- }
- else {
- return false;
- }
- }
-
-
- // begin of own functions
-
- processChannelTextArea (instance, wrapper) {
- if (instance.props && instance.props.type) {
- var textarea = wrapper.querySelector("textarea");
- if (!textarea) return;
- BDFDB.addEventListener(this, textarea, "keyup", () => {
- clearTimeout(textarea.WriteUpperCaseTimeout);
- textarea.WriteUpperCaseTimeout = setTimeout(() => {
- let string = textarea.value;
- if (string.length > 0) {
- let newstring = string;
- let first = string.charAt(0);
- let position = textarea.selectionStart;
- if (first === first.toUpperCase() && (string.toLowerCase().indexOf("http") == 0 || string.toLowerCase().indexOf("s/") == 0)) newstring = string.charAt(0).toLowerCase() + string.slice(1);
- else if (first === first.toLowerCase() && first !== first.toUpperCase() && string.toLowerCase().indexOf("http") != 0 && string.toLowerCase().indexOf("s/") != 0) newstring = string.charAt(0).toUpperCase() + string.slice(1);
- if (string != newstring) {
- textarea.focus();
- textarea.selectionStart = 0;
- textarea.selectionEnd = textarea.value.length;
- document.execCommand("insertText", false, newstring);
- textarea.selectionStart = position;
- textarea.selectionEnd = position;
- }
- }
- },1);
- });
- }
- }
- }
-};
diff --git a/ThemesV2/BasicBackground/README.md b/ThemesV2/BasicBackground/README.md
deleted file mode 100644
index add65b7947..0000000000
--- a/ThemesV2/BasicBackground/README.md
+++ /dev/null
@@ -1,5 +0,0 @@
-# These Themes are meant only for BDv2, not BD nor BandagedBD. If you got either of those two go to [Themes](https://github.com/mwittrien/BetterDiscordAddons/tree/master/Themes/)
-
-## Basic Background - [Download Style](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/ThemesV2/BasicBackground/index.css) [Download Config](https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/ThemesV2/BasicBackground/config.json)
-
-Allows you to use a background image in Discord without greatly altering the basic look of Discord.
diff --git a/ThemesV2/BasicBackground/background.jpg b/ThemesV2/BasicBackground/background.jpg
deleted file mode 100644
index 37b90cbb25..0000000000
Binary files a/ThemesV2/BasicBackground/background.jpg and /dev/null differ
diff --git a/ThemesV2/BasicBackground/config.json b/ThemesV2/BasicBackground/config.json
deleted file mode 100644
index 8bce020503..0000000000
--- a/ThemesV2/BasicBackground/config.json
+++ /dev/null
@@ -1,108 +0,0 @@
-{
- "info": {
- "name": "BasicBackground",
- "authors": [
- {
- "name": "DevilBro",
- "url": "https://www.paypal.me/MircoWittrien",
- "discord_id": "278543574059057154",
- "github_username": "mwittrien"
- }
- ],
- "version": 1.0,
- "description": "Allows you to use a background image in Discord without greatly altering the basic look of Discord. \n\nMy Support Server: http://bit.ly/DevilBrosHaus or https://discordapp.com/invite/Jx3TjNS.",
- "type": "sass"
- },
- "main": "index.scss",
- "defaultConfig": [
- {
- "category": "default",
- "settings": [
- {
- "id": "var-background",
- "type": "file",
- "value": [
- "background.jpg"
- ],
- "text": "Background image"
- },
- {
- "id": "var-accentcolor",
- "type": "colour",
- "value": "rgb(190, 78, 180)",
- "text": "Accent color"
- },
- {
- "id": "var-backdropcolor",
- "type": "colour",
- "value": "rgba(0, 0, 0, 0.4)",
- "text": "Backdrop color"
- },
- {
- "id": "var-transparency-color",
- "type": "colour",
- "value": "rgba(0, 0, 0, 0.15)",
- "text": "Transparency color"
- },
- {
- "id": "var-transparency-message",
- "type": "slider",
- "value": 0.5,
- "min": 0,
- "max": 1,
- "step": 0.05,
- "text": "Message transparency"
- },
- {
- "id": "var-transparency-memberlist",
- "type": "slider",
- "value": 0,
- "min": 0,
- "max": 1,
- "step": 0.05,
- "text": "Member list transparency"
- }
- ]
- }
- ],
- "configSchemes": [
- {
- "id": "default-scheme",
- "name": "Reset to default",
- "icon_url": "https://mwittrien.github.io/BetterDiscordAddons/ThemesV2/BasicBackground/background.jpg",
- "settings": [
- {
- "category": "default",
- "settings": [
- {
- "id": "var-background",
- "value": [
- "background.jpg"
- ]
- },
- {
- "id": "var-accentcolor",
- "value": "rgb(190, 78, 180)"
- },
- {
- "id": "var-backdropcolor",
- "value": "rgba(0, 0, 0, 0.4)"
- },
- {
- "id": "var-transparency-color",
- "value": "rgba(0, 0, 0, 0.15)"
- },
- {
- "id": "var-transparency-message",
- "value": 0.5
- },
- {
- "id": "var-transparency-memberlist",
- "value": 0
- }
- ]
- }
- ]
- }
- ]
-}
diff --git a/ThemesV2/BasicBackground/index.scss b/ThemesV2/BasicBackground/index.scss
deleted file mode 100644
index 84e8f807ea..0000000000
--- a/ThemesV2/BasicBackground/index.scss
+++ /dev/null
@@ -1,21 +0,0 @@
-@import url(https://mwittrien.github.io/BetterDiscordAddons/Themes/BasicBackground/BasicBackground.css);
-
-$var-accentcolor: rgb(190, 78, 180) !default;
-$var-backdropcolor: rgba(0, 0, 0, 0.4) !default;
-
-$var-transparency-color: rgba(0, 0, 0, 0.15) !default;
-$var-transparency-message: 0.5 !default;
-$var-transparency-memberlist: 0 !default;
-
-$var-background: (url: "https://mwittrien.github.io/BetterDiscordAddons/ThemesV2/BasicBackground/background.jpg") !default;
-
-
-:root {
- --transparencycolor: #{red($var-transparency-color)},#{green($var-transparency-color)},#{blue($var-transparency-color)};
- --transparencyalpha: opacity($var-transparency-color);
- --messagetransparency: $var-transparency-message;
- --memberlistransparency: $var-transparency-memberlist;
- --accentcolor: #{red($var-accentcolor)},#{green($var-accentcolor)},#{blue($var-accentcolor)};
- --background: url(map-get($var-background, url));
- --backdrop: $var-backdropcolor;
-}
\ No newline at end of file
diff --git a/ThemesV2/README.md b/ThemesV2/README.md
deleted file mode 100644
index 79cde5bf7d..0000000000
--- a/ThemesV2/README.md
+++ /dev/null
@@ -1,4 +0,0 @@
-# These Themes are meant only for BDv2, not BD nor BandagedBD. If you got either of those two go to [Themes](https://github.com/mwittrien/BetterDiscordAddons/tree/master/Themes/)
-
-## Themes
- - [Basic Background](https://github.com/mwittrien/BetterDiscordAddons/tree/master/ThemesV2/BasicBackground) - Allows you to use a background image in Discord without greatly altering the basic look of Discord.