From 687a912636c3b9cfc22862b04f57a1dd50109a7b Mon Sep 17 00:00:00 2001 From: Mirco Wittrien Date: Tue, 9 Mar 2021 15:47:58 +0100 Subject: [PATCH] stuff --- .../CopyRawMessage/CopyRawMessage.plugin.js | 45 ++----------------- Plugins/CustomQuoter/CustomQuoter.plugin.js | 6 +-- 2 files changed, 6 insertions(+), 45 deletions(-) diff --git a/Plugins/CopyRawMessage/CopyRawMessage.plugin.js b/Plugins/CopyRawMessage/CopyRawMessage.plugin.js index f61d6176cb..5d7358ef8a 100644 --- a/Plugins/CopyRawMessage/CopyRawMessage.plugin.js +++ b/Plugins/CopyRawMessage/CopyRawMessage.plugin.js @@ -65,55 +65,18 @@ module.exports = (_ => { return template.content.firstElementChild; } } : (([Plugin, BDFDB]) => { - var settings = {}; - return class CopyRawMessage extends Plugin { - onLoad () { - this.defaults = { - settings: { - copyOnlySelected: {value: true, description: "Only copy selected text of a message"} - } - }; - } + onLoad () {} - onStart () { - this.forceUpdateAll(); - } + onStart () {} - onStop () { - this.forceUpdateAll(); - } - - getSettingsPanel (collapseStates = {}) { - let settingsPanel, settingsItems = []; - - for (let key in settings) settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, { - type: "Switch", - plugin: this, - keys: ["settings", key], - label: this.defaults.settings[key].description, - value: settings[key] - })); - - return settingsPanel = BDFDB.PluginUtils.createSettingsPanel(this, settingsItems); - } - - onSettingsClosed () { - if (this.SettingsUpdated) { - delete this.SettingsUpdated; - this.forceUpdateAll(); - } - } - - forceUpdateAll () { - settings = BDFDB.DataUtils.get(this, "settings"); - } + onStop () {} onMessageContextMenu (e) { if (e.instance.props.message) { let content = e.instance.props.message.content; let messageString = [e.instance.props.message.content, BDFDB.ArrayUtils.is(e.instance.props.message.attachments) && e.instance.props.message.attachments.map(n => n.url)].flat(10).filter(n => n).join("\n"); - let selectedText = settings.copyOnlySelected && document.getSelection().toString().trim(); + let selectedText = document.getSelection().toString().trim(); if (selectedText) messageString = BDFDB.StringUtils.extractSelection(messageString, selectedText); let embed = BDFDB.DOMUtils.getParent(BDFDB.dotCN.embedwrapper, e.instance.props.target); let embedData = e.instance.props.message.embeds[embed ? Array.from(embed.parentElement.querySelectorAll(BDFDB.dotCN.embedwrapper)).indexOf(embed) : -1]; diff --git a/Plugins/CustomQuoter/CustomQuoter.plugin.js b/Plugins/CustomQuoter/CustomQuoter.plugin.js index 88db82a502..376c8c1c05 100644 --- a/Plugins/CustomQuoter/CustomQuoter.plugin.js +++ b/Plugins/CustomQuoter/CustomQuoter.plugin.js @@ -115,10 +115,8 @@ module.exports = (_ => { this.defaults = { general: { - quoteOnlySelected: {value: true, description: "Only insert selected Text in a Quoted Message"}, holdShiftToolbar: {value: false, description: "Need to hold Shift on a Message to show Quick Quote"}, alwaysCopy: {value: false, description: "Always copy Quote to Clipboard without holding Shift"}, - ignoreMentionInDM: {value: true, description: "Do not add a mention in Direct Messages"}, forceZeros: {value: false, description: "Force leading Zeros"} } }; @@ -401,7 +399,7 @@ module.exports = (_ => { } let content = message.content; - let selectedText = this.settings.general.quoteOnlySelected && document.getSelection().toString().trim(); + let selectedText = document.getSelection().toString().trim(); if (selectedText) content = BDFDB.StringUtils.extractSelection(content, selectedText); if (content) { content = content.replace(/(@everyone|@here)/g, "`$1`").replace(/``(@everyone|@here)``/g, "`$1`"); @@ -419,7 +417,7 @@ module.exports = (_ => { let quotedLines = unquotedLines.slice(unquotedLines.findIndex(line => line.trim().length > 0)).map(line => "> " + line + "\n").join(""); return BDFDB.StringUtils.insertNRST(quoteFormat) - .replace("$mention", this.settings.general.ignoreMentionInDM && channel.isDM() ? "" : `<@!${message.author.id}>`) + .replace("$mention", channel.isDM() ? "" : `<@!${message.author.id}>`) .replace("$link", ``) .replace("$authorName", member && member.nick || message.author.username || "") .replace("$authorAccount", `${message.author.username}#${message.author.discriminator}`)