From ec17c0b76e71ae5b5a2106ed4b8a86e81188afc5 Mon Sep 17 00:00:00 2001 From: Mirco Wittrien Date: Tue, 9 Jun 2020 10:26:04 +0200 Subject: [PATCH] stuff --- .../RemoveNicknames/RemoveNicknames.plugin.js | 19 +++-- Plugins/RepoControls/README.md | 12 --- Plugins/RepoControls/RepoControls.plugin.js | 74 ------------------- 3 files changed, 11 insertions(+), 94 deletions(-) delete mode 100644 Plugins/RepoControls/README.md delete mode 100644 Plugins/RepoControls/RepoControls.plugin.js diff --git a/Plugins/RemoveNicknames/RemoveNicknames.plugin.js b/Plugins/RemoveNicknames/RemoveNicknames.plugin.js index 03904564dc..750d9a8fa0 100644 --- a/Plugins/RemoveNicknames/RemoveNicknames.plugin.js +++ b/Plugins/RemoveNicknames/RemoveNicknames.plugin.js @@ -1,6 +1,8 @@ //META{"name":"RemoveNicknames","authorId":"278543574059057154","invite":"Jx3TjNS","donate":"https://www.paypal.me/MircoWittrien","patreon":"https://www.patreon.com/MircoWittrien","website":"https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/RemoveNicknames","source":"https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/Plugins/RemoveNicknames/RemoveNicknames.plugin.js"}*// var RemoveNicknames = (_ => { + var settings = {}; + return class RemoveNicknames { getName () {return "RemoveNicknames";} @@ -120,33 +122,33 @@ var RemoveNicknames = (_ => { onSettingsClosed (e) { if (this.SettingsUpdated) { delete this.SettingsUpdated; - BDFDB.ModuleUtils.forceAllUpdates(this); + this.forceUpdateAll(); } } processAutocompleteUserResult (e) { - if (e.instance.props.user && e.instance.props.nick && BDFDB.DataUtils.get(this, "settings", "changeInAutoComplete")) { + if (e.instance.props.user && e.instance.props.nick && settings.changeInAutoComplete) { let newName = this.getNewName(e.instance.props.user); if (newName) e.instance.props.nick = newName; } } processVoiceUser (e) { - if (e.instance.props.user && e.instance.props.nick && BDFDB.DataUtils.get(this, "settings", "changeInVoiceChat")) { + if (e.instance.props.user && e.instance.props.nick && settings.changeInVoiceChat) { let newName = this.getNewName(e.instance.props.user); if (newName) e.instance.props.nick = newName; } } processMemberListItem (e) { - if (e.instance.props.user && e.instance.props.nick && BDFDB.DataUtils.get(this, "settings", "changeInMemberList")) { + if (e.instance.props.user && e.instance.props.nick && settings.changeInMemberList) { let newName = this.getNewName(e.instance.props.user); if (newName) e.instance.props.nick = newName; } } processTypingUsers (e) { - if (BDFDB.ObjectUtils.is(e.instance.props.typingUsers) && Object.keys(e.instance.props.typingUsers).length && BDFDB.DataUtils.get(this, "settings", "changeInTyping")) { + if (BDFDB.ObjectUtils.is(e.instance.props.typingUsers) && Object.keys(e.instance.props.typingUsers).length && settings.changeInTyping) { let users = Object.keys(e.instance.props.typingUsers).filter(id => id != BDFDB.UserUtils.me.id).filter(id => !BDFDB.LibraryModules.FriendUtils.isBlocked(id)).map(id => BDFDB.LibraryModules.UserStore.getUser(id)).filter(user => user); if (users.length) { let [children, index] = BDFDB.ReactUtils.findChildren(e.returnvalue, {props: [["className", BDFDB.disCN.typingtext]]}); @@ -167,7 +169,7 @@ var RemoveNicknames = (_ => { } processMessageContent (e) { - if (BDFDB.ArrayUtils.is(e.instance.props.content) && BDFDB.DataUtils.get(this, "settings", "changeInMentions")) for (let ele of e.instance.props.content) { + if (BDFDB.ArrayUtils.is(e.instance.props.content) && settings.changeInMentions) for (let ele of e.instance.props.content) { if (BDFDB.ReactUtils.isValidElement(ele) && ele.type && (ele.type.displayName || "").toLowerCase().indexOf("popout") > -1 && typeof ele.props.render == "function") { if (BDFDB.ReactUtils.getValue(ele, "props.children.type.displayName") == "Mention") { let newName = this.getNewName(BDFDB.LibraryModules.UserStore.getUser(ele.props.render().props.userId)); @@ -175,7 +177,7 @@ var RemoveNicknames = (_ => { } } } - if (e.instance.props.message.type != BDFDB.DiscordConstants.MessageTypes.DEFAULT && e.instance.props.message.nick && BDFDB.DataUtils.get(this, "settings", "changeInChatWindow")) { + if (e.instance.props.message.type != BDFDB.DiscordConstants.MessageTypes.DEFAULT && e.instance.props.message.nick && settings.changeInChatWindow) { let newName = this.getNewName(e.instance.props.message.author); if (newName) { e.instance.props.message = new BDFDB.DiscordObjects.Message(Object.assign({}, e.instance.props.message, {nick: newName})); @@ -186,7 +188,6 @@ var RemoveNicknames = (_ => { getNewName (user, wrapper) { if (!user) return null; - let settings = BDFDB.DataUtils.get(this, "settings"); let member = BDFDB.LibraryModules.MemberStore.getMember(BDFDB.LibraryModules.LastGuildStore.getGuildId(), user.id) || {}; if (!member.nick || user.id == BDFDB.UserUtils.me.id && !settings.replaceOwn || user.bot && !settings.replaceBots) return null; let username = (BDFDB.BDUtils.isPluginEnabled("EditUsers") && BDFDB.DataUtils.load("EditUsers", "users", user.id) || {}).name || user.username; @@ -194,6 +195,8 @@ var RemoveNicknames = (_ => { } forceUpdateAll () { + settings = BDFDB.DataUtils.get(this, "settings"); + BDFDB.ModuleUtils.forceAllUpdates(this); BDFDB.MessageUtils.rerenderAll(); } diff --git a/Plugins/RepoControls/README.md b/Plugins/RepoControls/README.md deleted file mode 100644 index 7855a133a5..0000000000 --- a/Plugins/RepoControls/README.md +++ /dev/null @@ -1,12 +0,0 @@ -# Repo Controls - [![Downlad][download-badge]][download-link] [![Paypal][paypal-badge]][paypal-link] [![Patreon][patreon-badge]][patreon-link] - -[download-badge]: https://img.shields.io/badge/Download-Plugin-brightgreen.svg?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAQAAAAAYLlVAAAACXBIWXMAAA7EAAAOxAGVKw4bAAADGGlDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjaY2BgnuDo4uTKJMDAUFBUUuQe5BgZERmlwH6egY2BmYGBgYGBITG5uMAxIMCHgYGBIS8/L5UBFTAyMHy7xsDIwMDAcFnX0cXJlYE0wJpcUFTCwMBwgIGBwSgltTiZgYHhCwMDQ3p5SUEJAwNjDAMDg0hSdkEJAwNjAQMDg0h2SJAzAwNjCwMDE09JakUJAwMDg3N+QWVRZnpGiYKhp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I2D8EZyAEfangj2Fq0NrnBWry8YI5yb7rkRbBrDAK7X9NevlAYCL7Kns79iQKcunOU0+iO0fuSzV1QyUNjkU2b9wS66qm2nt8L3Q/oO7Gk3tWO2InzPtv3isU9RP9jqxmR8LMKsqdPVqFoC8qiDM/HiAcFUQZ34IYDr0VUGW+QEfK8BkVZBmfqkAWVWQZ37JAOA+n/nEtnh/wGd8JWP81Nt0P0r8Wu4ADvAHAOq2fsaP4N8BvFXi/ZoB3FYCcJMNKDbQw9Kc7YdoYfDzB+6xjUuM5mY+wsXYHvgeABIzsPkSOM/lAAAAAElFTkSuQmCC&style=flat -[download-link]: https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/Plugins/RepoControls/RepoControls.plugin.js - -[paypal-badge]: https://img.shields.io/badge/Paypal-Donate!-%23003087.svg?logo=paypal&style=flat -[paypal-link]: https://paypal.me/MircoWittrien - -[patreon-badge]: https://img.shields.io/badge/Patreon-Support!-%23F96854.svg?logo=patreon&style=flat -[patreon-link]: https://patreon.com/MircoWittrien - -Lets you sort and filter your list of downloaded Themes and Plugins. diff --git a/Plugins/RepoControls/RepoControls.plugin.js b/Plugins/RepoControls/RepoControls.plugin.js deleted file mode 100644 index 16c8b5da2f..0000000000 --- a/Plugins/RepoControls/RepoControls.plugin.js +++ /dev/null @@ -1,74 +0,0 @@ -//META{"name":"RepoControls","authorId":"278543574059057154","invite":"Jx3TjNS","donate":"https://www.paypal.me/MircoWittrien","patreon":"https://www.patreon.com/MircoWittrien","website":"https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/RepoControls","source":"https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/Plugins/RepoControls/RepoControls.plugin.js"}*// - -var RepoControls = (_ => { - let searchTimeout; - - return class RepoControls { - getName () {return "RepoControls";} - - getVersion () {return "1.3.9";} - - getAuthor () {return "DevilBro";} - - getDescription () {return "NO LONGER NEEDED";} - - // Legacy - load () {} - - start () { - if (!window.BDFDB) window.BDFDB = {myPlugins:{}}; - if (window.BDFDB && window.BDFDB.myPlugins && typeof window.BDFDB.myPlugins == "object") window.BDFDB.myPlugins[this.getName()] = this; - let libraryScript = document.querySelector("head script#BDFDBLibraryScript"); - if (!libraryScript || (performance.now() - libraryScript.getAttribute("date")) > 600000) { - if (libraryScript) libraryScript.remove(); - libraryScript = document.createElement("script"); - libraryScript.setAttribute("id", "BDFDBLibraryScript"); - libraryScript.setAttribute("type", "text/javascript"); - libraryScript.setAttribute("src", "https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.min.js"); - libraryScript.setAttribute("date", performance.now()); - libraryScript.addEventListener("load", _ => {this.initialize();}); - document.head.appendChild(libraryScript); - } - else if (window.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize(); - this.startTimeout = setTimeout(_ => { - try {return this.initialize();} - catch (err) {console.error(`%c[${this.getName()}]%c`, "color: #3a71c1; font-weight: 700;", "", "Fatal Error: Could not initiate plugin! " + err);} - }, 30000); - } - - initialize () { - if (window.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) { - if (this.started) return; - BDFDB.PluginUtils.init(this); - - BDFDB.ModalUtils.open(this, { - header: this.name, - subheader: "Delete?", - text: `This plugin is no longer needed, because BBD includes the features now natively, click "${BDFDB.LanguageUtils.LanguageStrings.DELETE}" to delete all remaining files created by this plugin.`, - buttons: [{ - color: "RED", - contents: BDFDB.LanguageUtils.LanguageStrings.DELETE, - close: true, - click: _ => { - BDFDB.LibraryRequires.fs.unlink(BDFDB.LibraryRequires.path.join(BDFDB.BDUtils.getPluginsFolder(), `${this.name}.config.json`), _ => {}); - BDFDB.LibraryRequires.fs.unlink(BDFDB.LibraryRequires.path.join(BDFDB.BDUtils.getPluginsFolder(), `${this.name}.plugin.js`), _ => {}); - } - }], - onClose: _ => { - BDFDB.BDUtils.disablePlugin(this.name); - } - }); - } - else console.error(`%c[${this.getName()}]%c`, "color: #3a71c1; font-weight: 700;", "", "Fatal Error: Could not load BD functions!"); - } - - - stop () { - if (window.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) { - this.stopping = true; - - BDFDB.PluginUtils.clear(this); - } - } - } -})(); \ No newline at end of file