//META{"name":"BetterFormattingRedux","displayName":"BetterFormattingRedux","website":"https://github.com/rauenzi/BetterDiscordAddons/tree/master/Plugins/BetterFormattingRedux","source":"https://raw.githubusercontent.com/rauenzi/BetterDiscordAddons/master/Plugins/BetterFormattingRedux/BetterFormattingRedux.plugin.js"}*// var BetterFormattingRedux = (() => { const config = {"info":{"name":"BetterFormattingRedux","authors":[{"name":"Zerebos","discord_id":"249746236008169473","github_username":"rauenzi","twitter_username":"ZackRauen"}],"version":"2.3.1","description":"Enables different types of formatting in standard Discord chat. Support Server: bit.ly/ZeresServer","github":"https://github.com/rauenzi/BetterDiscordAddons/tree/master/Plugins/BetterFormattingRedux","github_raw":"https://raw.githubusercontent.com/rauenzi/BetterDiscordAddons/master/Plugins/BetterFormattingRedux/BetterFormattingRedux.plugin.js"},"defaultConfig":[{"type":"category","id":"toolbar","name":"Toolbar Buttons","collapsible":true,"shown":false,"settings":[{"type":"switch","id":"bold","name":"Bold","value":true},{"type":"switch","id":"italic","name":"Italic","value":true},{"type":"switch","id":"underline","name":"Underline","value":true},{"type":"switch","id":"strikethrough","name":"Strikethrough","value":true},{"type":"switch","id":"code","name":"Code","value":true},{"type":"switch","id":"codeblock","name":"Codeblock","value":true},{"type":"switch","id":"superscript","name":"Superscript","value":true},{"type":"switch","id":"smallcaps","name":"Smallcaps","value":true},{"type":"switch","id":"fullwidth","name":"Full Width","value":true},{"type":"switch","id":"upsidedown","name":"Upsidedown","value":true},{"type":"switch","id":"varied","name":"Varied Caps","value":true},{"type":"switch","id":"leet","name":"Leet (1337)","value":false},{"type":"switch","id":"thicc","name":"Extra Thicc","value":false}]},{"type":"category","id":"formats","name":"Active Formats","collapsible":true,"shown":false,"settings":[{"type":"switch","id":"superscript","name":"Superscript","value":true},{"type":"switch","id":"smallcaps","name":"Smallcaps","value":true},{"type":"switch","id":"fullwidth","name":"Full Width","value":true},{"type":"switch","id":"upsidedown","name":"Upsidedown","value":true},{"type":"switch","id":"varied","name":"Varied Caps","value":true},{"type":"switch","id":"leet","name":"Leet (1337)","value":false},{"type":"switch","id":"thicc","name":"Extra Thicc","value":false}]},{"type":"category","id":"wrappers","name":"Wrapper Options","collapsible":true,"shown":false,"settings":[{"type":"textbox","id":"superscript","name":"Superscript","note":"The wrapper for superscripted text","value":"^^"},{"type":"textbox","id":"smallcaps","name":"Smallcaps","note":"The wrapper to make Smallcaps.","value":"%%"},{"type":"textbox","id":"fullwidth","name":"Full Width","note":"The wrapper for E X P A N D E D T E X T.","value":"##"},{"type":"textbox","id":"upsidedown","name":"Upsidedown","note":"The wrapper to flip the text upsidedown.","value":"&&"},{"type":"textbox","id":"varied","name":"Varied Caps","note":"The wrapper to VaRy the capitalization.","value":"||"},{"type":"textbox","id":"leet","name":"Leet (1337)","note":"The wrapper to talk in 13375p34k.","value":"++"},{"type":"textbox","id":"thicc","name":"Extra Thicc","note":"The wrapper to get 乇乂下尺卂 下卄工匚匚.","value":"$$"}]},{"type":"category","id":"formatting","name":"Formatting Options","collapsible":true,"shown":false,"settings":[{"type":"dropdown","id":"fullWidthMap","name":"Fullwidth Style","note":"Which style of fullwidth formatting should be used.","value":true,"options":[{"label":"T H I S","value":false},{"label":"this","value":true}]},{"type":"switch","id":"reorderUpsidedown","name":"Reorder Upsidedown Text","note":"Having this enabled reorders the upside down text to make it in-order.","value":true},{"type":"switch","id":"fullwidth","name":"Start VaRiEd Caps With Capital","note":"Enabling this starts a varied text string with a capital.","value":true}]},{"type":"category","id":"plugin","name":"Functional Options","collapsible":true,"shown":false,"settings":[{"type":"dropdown","id":"hoverOpen","name":"Opening Toolbar","note":"Determines when to show the toolbar.","value":true,"options":[{"label":"Click","value":false},{"label":"Hover","value":true}]},{"type":"dropdown","id":"chainFormats","name":"Format Chaining","note":"Swaps priority of wrappers between inner first and outer first. Check the GitHub for more info.","value":true,"options":[{"label":"Inner","value":false},{"label":"Outer","value":true}]},{"type":"switch","id":"closeOnSend","name":"Close On Send","note":"This option will close the toolbar when a message is sent.","value":true}]},{"type":"category","id":"style","name":"Style Options","collapsible":true,"shown":false,"settings":[{"type":"dropdown","id":"icons","name":"Toolbar Style","note":"Switches between icons and text as the toolbar buttons.","value":true,"options":[{"label":"Text","value":false},{"label":"Icons","value":true}]},{"type":"dropdown","id":"rightSide","name":"Toolbar Location","note":"This option enables swapping toolbar location.","value":true,"options":[{"label":"Left","value":false},{"label":"Right","value":true}]},{"type":"slider","id":"toolbarOpacity","name":"Opacity","note":"This allows the toolbar to be partially seethrough.","value":1,"min":0,"max":1},{"type":"slider","id":"fontSize","name":"Font Size","note":"Adjusts the font size between 0 and 100%.","value":85,"min":0,"max":100}]}],"changelog":[{"title":"What's New?","items":["Move to local lib only."]}],"main":"index.js"}; return !global.ZeresPluginLibrary ? class { getName() {return config.info.name;} getAuthor() {return config.info.authors.map(a => a.name).join(", ");} getDescription() {return config.info.description;} getVersion() {return config.info.version;} load() {window.BdApi.alert("Library Missing",`The library plugin needed for ${config.info.name} is missing.

Click here to download the library!`);} start() {} stop() {} } : (([Plugin, Api]) => { const plugin = (Plugin, Api) => { const {DiscordSelectors, PluginUtilities, ContextMenu, Tooltip} = Api; return class BetterFormattingRedux extends Plugin { constructor() { super(); this.isOpen = false; this.replaceList = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}"; this.smallCapsList = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`ᴀʙᴄᴅᴇғɢʜɪᴊᴋʟᴍɴᴏᴘǫʀsᴛᴜᴠᴡxʏᴢ{|}"; this.superscriptList = " !\"#$%&'⁽⁾*⁺,⁻./⁰¹²³⁴⁵⁶⁷⁸⁹:;<⁼>?@ᴬᴮᶜᴰᴱᶠᴳᴴᴵᴶᴷᴸᴹᴺᴼᴾQᴿˢᵀᵁνᵂˣʸᶻ[\\]^_`ᵃᵇᶜᵈᵉᶠᵍʰᶦʲᵏˡᵐⁿᵒᵖᑫʳˢᵗᵘᵛʷˣʸᶻ{|}"; this.upsideDownList = " ¡\"#$%℘,)(*+'-˙/0ƖᄅƐㄣϛ9ㄥ86:;>=<¿@∀qƆpƎℲפHIſʞ˥WNOԀQɹS┴∩ΛMXλZ]\\[^‾,ɐqɔpǝɟƃɥᴉɾʞlɯuodbɹsʇnʌʍxʎz}|{"; this.fullwidthList = " !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}"; this.leetList = " !\"#$%&'()*+,-./0123456789:;<=>?@48CD3FG#IJK1MN0PQЯ57UVWXY2[\\]^_`48cd3fg#ijk1mn0pqЯ57uvwxy2{|}"; this.thiccList = " !\"#$%&'()*+,-./0123456789:;<=>?@卂乃匚刀乇下厶卄工丁长乚从ん口尸㔿尺丂丅凵リ山乂丫乙[\\]^_`卂乃匚刀乇下厶卄工丁长乚从ん口尸㔿尺丂丅凵リ山乂丫乙{|}"; this.toolbarString = `
`; this.discordWrappers = {bold: "**", italic: "*", underline: "__", strikethrough: "~~", code: "`", codeblock: "```"}; this.customWrappers = Object.keys(this.defaultSettings.wrappers); this.buttonOrder = Object.keys(this.defaultSettings.toolbar); this.toolbarData = (() => {return { bold: {type: "native-format", name: "Bold", displayName: "Bold", icon: ``}, italic: {type: "native-format", name: "Italic", displayName: "Italic", icon: ``}, underline: {type: "native-format", name: "Underline", displayName: "Underline", icon: ``}, strikethrough: {type: "native-format", name: "Strikethrough", displayName: "Strikethrough", icon: ``}, code: {type: "native-format", name: "Code", displayName: "Code", icon: ``}, codeblock: {type: "native-format", name: "Codeblock", displayName: "|Codeblock|", icon: ``}, superscript: {type: "bfr-format", name: "Superscript", displayName: "ˢᵘᵖᵉʳˢᶜʳᶦᵖᵗ", icon: ""}, smallcaps: {type: "bfr-format", name: "Smallcaps", displayName: "SᴍᴀʟʟCᴀᴘs", icon: ``}, fullwidth: {type: "bfr-format", name: "Fullwidth", displayName: "Fullwidth", icon: ""}, upsidedown: {type: "bfr-format", name: "Upsidedown", displayName: "uʍopǝpᴉsd∩", icon: ``}, varied: {type: "bfr-format", name: "Varied", displayName: "VaRiEd CaPs", icon: ``}, leet: {type: "bfr-format", name: "Leet", displayName: "1337", icon: ""}, thicc: {type: "bfr-format", name: "Extra Thicc", displayName: "乇乂下尺卂 下卄工匚匚", icon: `` }, zalgo: {type: "bfr-format", name: "Zalgo", displayName: "Z͞a̕l͘ǵo͠", icon: `` } };})(); this.allLanguages = (() => {return { C: {cpp: "C++", csharp: "C#", coffeescript: "CoffeeScript", css: "CSS"}, H: {html: "HTML/XML"}, J: {java: "Java", js: "JavaScript", json: "JSON"}, M: {markdown: "Markdown"}, P: {perl: "Perl", php: "PHP", py: "Python"}, R: {ruby: "Ruby"}, S: {sql: "SQL"}, V: {vbnet: "VB.NET", vhdl: "VHDL"} };})(); this.mainCSS = `.bf-toolbar { user-select: none; white-space: nowrap; font-size:85%; display:block; position: absolute; color: rgba(255, 255, 255, .5); width:auto!important; right:0; bottom:auto; border-radius:3px; height:27px!important; top:0px; transform:translate(0,-100%); opacity:1; overflow: hidden!important; pointer-events: none; padding:10px 30px 15px 5px; margin: 0 5px 0 0; } .bf-toolbar.bf-visible, .bf-toolbar.bf-hover:hover{ pointer-events: initial; } .bf-toolbar:before { content:""; display: block; width:100%; height:calc(100% - 15px); position: absolute; z-index: -1; background:#424549; pointer-events: initial; left:0px; top:5px; border-radius:3px; transform:translate(0,55px); transition:all 200ms ease; } .bf-toolbar.bf-visible:before, .bf-toolbar.bf-hover:hover:before { transform:translate(0,0px); transition:all 200ms cubic-bezier(0,0,0,1); } .bf-toolbar .format { display: inline; padding: 7px 5px; cursor: pointer; display : inline-flex; align-items : center; transform:translate(0,55px); transition:all 50ms,transform 200ms ease; position:relative; pointer-events: initial; border-radius:2px; max-height: 27px; box-sizing: border-box; vertical-align: middle; } .bf-toolbar .format img { opacity: 0.6; vertical-align: middle; max-height: inherit; } .bf-toolbar .format .format-border { border: 1px solid rgba(255, 255, 255, .5); border-radius: inherit; } .bf-toolbar .format:hover{ background:rgba(255,255,255,.1); color:rgba(255,255,255,.9); } .bf-toolbar .format:active{ background:rgba(0,0,0,.1)!important; transition:all 0ms,transform 200ms ease; } .bf-toolbar.bf-visible .format, .bf-toolbar.bf-hover:hover .format{ transform:translate(0,0); transition:all 50ms,transform 200ms cubic-bezier(0,0,0,1); } .bf-toolbar .format.disabled { display: none; } .bf-toolbar .format.ghost { color: transparent; background: rgba(0,0,0,.1); } .bf-toolbar .format.ghost img { opacity: 0; } .bf-toolbar .bf-arrow { content:""; display:block; background:url(data:image/svg+xml;base64,PHN2ZyBmaWxsPSIjRkZGRkZGIiBoZWlnaHQ9IjI0IiB2aWV3Qm94PSIwIDAgMjQgMjQiIHdpZHRoPSIyNCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4gICAgPHBhdGggZD0iTTcuNDEgMTUuNDFMMTIgMTAuODNsNC41OSA0LjU4TDE4IDE0bC02LTYtNiA2eiIvPiAgICA8cGF0aCBkPSJNMCAwaDI0djI0SDB6IiBmaWxsPSJub25lIi8+PC9zdmc+); height:30px; width:30px; right:5px; position: absolute; pointer-events: initial; bottom:0; background-repeat: no-repeat; background-position: 50%; transition:all 200ms ease; opacity: .3; cursor:pointer; } .bf-toolbar.bf-visible .bf-arrow, .bf-toolbar.bf-hover:hover .bf-arrow { transform:translate(0,-14px)rotate(-90deg); transition:all 200ms cubic-bezier(0,0,0,1); opacity: .9; } .message-group .bf-toolbar{ padding: 10px 5px 15px 5px; animation:slide-up 300ms cubic-bezier(0,0,0,1), opacity 300ms ease } .upload-modal .bf-toolbar { position: relative; transform: none; padding: 5px 0; margin-right: 0; border-radius: 2px; text-align: center; background: #424549; } .upload-modal .bf-toolbar::before { display: none; } .upload-modal .bf-toolbar .format:hover{ background:rgba(255,255,255,.1); } .upload-modal .bf-toolbar .format:active{ background:rgba(0,0,0,.1); } .upload-modal .bf-toolbar .format, .upload-modal .bf-toolbar:before, .message-group .bf-toolbar .format, .message-group .bf-toolbar:before{ transform:translate(0,0); } .upload-modal .bf-toolbar .bf-arrow, .message-group .bf-toolbar .bf-arrow{ display: none; } .bf-toolbar.bf-left { left: 0!important; right: auto!important; margin-right: 0!important; margin-left: 5px!important; padding: 10px 10px 15px 30px!important; } .bf-toolbar.bf-left .bf-arrow { left: 5px!important; right: auto!important; } .bf-toolbar.bf-left.bf-hover:hover .bf-arrow,.bf-toolbar.bf-left.bf-visible .bf-arrow { -webkit-transform: translate(0,-14px) rotate(90deg)!important; -ms-transform: translate(0,-14px) rotate(90deg)!important; transform: translate(0,-14px) rotate(90deg)!important; } .bf-languages { display: block; position: fixed !important; transform: scale(1,0); transform-origin: 100% 100%!important; background: #424549; border-radius: 3px; color: rgba(255,255,255,.5); padding: 3px; } .bf-languages.bf-visible { height: auto; transition: 200ms cubic-bezier(.2,0,0,1); transform: scale(1,1); transform-origin: 100% 100%!important; } .bf-languages div { display: block; cursor: pointer; padding: 5px 7px; border-radius: 2px; } .bf-languages div:hover { background: rgba(255,255,255,.1); color: rgba(255,255,255,.9); }`; } async onStart() { await PluginUtilities.addScript("sortableScript", "//rauenzi.github.io/BetterDiscordAddons/Plugins/Sortable.js"); PluginUtilities.addStyle(this.getName() + "-style", this.mainCSS); this.buttonOrder = PluginUtilities.loadData(this.getName(), "buttonOrder", this.buttonOrder); this.setupToolbar(); } onStop() { $("*").off("." + this.getName()); $(".bf-toolbar").remove(); PluginUtilities.removeScript("sortableScript"); PluginUtilities.removeStyle(this.getName() + "-style"); } observer(e) { if (!e.addedNodes.length || !(e.addedNodes[0] instanceof Element)) return; var elem = e.addedNodes[0]; var textarea = elem.querySelector(DiscordSelectors.Textarea.textArea); if (textarea) this.addToolbar($(textarea)); } updateStyle() { this.updateSide(); this.updateOpacity(); this.updateFontSize(); } updateSide() { if (this.settings.style.rightSide) { $(".bf-toolbar").removeClass("bf-left"); } else { $(".bf-toolbar").addClass("bf-left"); } } updateOpacity() { $(".bf-toolbar").css("opacity", this.settings.style.toolbarOpacity); } updateFontSize() { $(".bf-toolbar").css("font-size", this.settings.style.fontSize + "%"); } openClose() { this.isOpen = !this.isOpen; $(".bf-toolbar").toggleClass("bf-visible"); } escape(s) { return s.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&"); } doFormat(text, wrapper, offset) { // If this is not a wrapper, return original if (text.substring(offset, offset + wrapper.length) != wrapper) return text; var returnText = text, len = text.length; var begin = text.indexOf(wrapper, offset); if (text[begin - 1] == "\\") return text; // If the wrapper is escaped, remove the backslash and return the text var end = text.indexOf(wrapper, begin + wrapper.length); if (end != -1) end += wrapper.length - 1; // Making it to this point means that we have found a full wrapper // This block performs inner chaining if (this.settings.plugin.chainFormats) { for (var w = 0; w < this.customWrappers.length; w++) { var newText = this.doFormat(returnText, this.settings.wrappers[this.customWrappers[w]], begin + wrapper.length); if (returnText != newText) { returnText = newText; end = end - this.settings.wrappers[this.customWrappers[w]].length * 2; } } } returnText = returnText.replace(new RegExp(`([^]{${begin}})${this.escape(wrapper)}([^]*)${this.escape(wrapper)}([^]{${len - end - 1}})`), (match, before, middle, after) => { var letterNum = 0; middle = middle.replace(/./g, letter => { var index = this.replaceList.indexOf(letter); letterNum += 1; if (wrapper == this.settings.wrappers.fullwidth) { if (this.settings.formatting.fullWidthMap) return index != -1 ? this.fullwidthList[index] : letter; return index != -1 ? letterNum == middle.length ? letter.toUpperCase() : letter.toUpperCase() + " " : letter; } else if (wrapper == this.settings.wrappers.superscript) {return index != -1 ? this.superscriptList[index] : letter;} else if (wrapper == this.settings.wrappers.smallcaps) {return index != -1 ? this.smallCapsList[index] : letter;} else if (wrapper == this.settings.wrappers.upsidedown) {return index != -1 ? this.upsideDownList[index] : letter;} else if (wrapper == this.settings.wrappers.leet) {return index != -1 ? this.leetList[index] : letter;} else if (wrapper == this.settings.wrappers.thicc) {return index != -1 ? this.thiccList[index] : letter;} else if (wrapper == this.settings.wrappers.varied) { var compare = this.settings.formatting.startCaps ? 1 : 0; if (letter.toLowerCase() == letter.toUpperCase()) letterNum = letterNum - 1; return index != -1 ? letterNum % 2 == compare ? letter.toUpperCase() : letter.toLowerCase() : letter; } return letter; }); if (wrapper == this.settings.wrappers.upsidedown && this.settings.formatting.reorderUpsidedown) return before + middle.split("").reverse().join("") + after; return before + middle + after; }); return returnText; } format(e) { if (e.shiftKey || e.which != 13) return; var textarea = $(e.currentTarget); var text = textarea.val(); const textOriginal = textarea.val(); for (var i = 0; i < text.length; i++) { if (text[i] == "`") { var next = text.indexOf("`", i + 1); if (next != -1) i = next; } else if (text[i] == "@") { var match = /@.*#[0-9]*/.exec(text.substring(i)); if (match && match.index == 0) i += match[0].length - 1; } else { for (var w = 0; w < this.customWrappers.length; w++) { if (!this.settings.formats[this.customWrappers[w]]) continue; var newText = this.doFormat(text, this.settings.wrappers[this.customWrappers[w]], i); if (text != newText) { text = newText; i = i - this.settings.wrappers[this.customWrappers[w]].length * 2; } } } } if (this.settings.plugin.closeOnSend) $(".bf-toolbar").removeClass("bf-visible"); if (text == textOriginal) return; var txt = textarea[0]; txt.focus(); txt.selectionStart = 0; txt.selectionEnd = txt.value.length; document.execCommand("insertText", false, text); } wrapSelection(textarea, wrapper, language, rightWrapper) { var text = textarea.value; var start = textarea.selectionStart; var len = text.substring(textarea.selectionStart, textarea.selectionEnd).length; var lang = language ? language : ""; var newline = wrapper === "```" ? "\n" : ""; text = wrapper + lang + newline + text.substring(textarea.selectionStart, textarea.selectionEnd) + newline + (rightWrapper ? rightWrapper : wrapper); textarea.focus(); document.execCommand("insertText", false, text); textarea.selectionEnd = (textarea.selectionStart = start + wrapper.length + lang.length + newline.length) + len; } getContextMenu(textarea) { var items = []; for (var letter in this.allLanguages) { var subItems = []; for (var language in this.allLanguages[letter]) { ((language) => { subItems.push(new ContextMenu.TextItem(this.allLanguages[letter][language], {callback: () => {this.wrapSelection(textarea[0], "```", language);}})); })(language); } items.push(new ContextMenu.SubMenuItem(letter, new ContextMenu.Menu(true).addItems(...subItems))); } return new ContextMenu.Menu().addItems(...items); } buildToolbar(textarea) { var toolbar = $(this.toolbarString); if (typeof this.settings.toolbar.bold === "boolean") { this.settings.toolbar = this.defaultSettings.toolbar; this.saveSettings(); } if (window.BdApi.getPlugin("Zalgo")) { this.settings.toolbar.zalgo = true; if (!this.buttonOrder.includes("zalgo")) this.buttonOrder.push("zalgo"); } var sorted = Object.keys(this.settings.toolbar).sort((a,b) => {return this.buttonOrder.indexOf(a) - this.buttonOrder.indexOf(b);}); for (var i = 0; i < sorted.length; i++) { var button = $("
"); button.addClass("format"); button.addClass(this.toolbarData[sorted[i]].type); new Tooltip(button, this.toolbarData[sorted[i]].name); if (!this.settings.toolbar[sorted[i]]) button.addClass("disabled"); if (sorted[i] === "codeblock") { let contextMenu = this.getContextMenu(textarea); button.on("contextmenu", (e) => { contextMenu.show(e.clientX, e.clientY); }); } button.attr("data-name", sorted[i]); if (this.settings.style.icons) button.html(this.toolbarData[sorted[i]].icon); else button.html(this.toolbarData[sorted[i]].displayName); toolbar.append(button); } window.Sortable.create(toolbar[0], { draggable: ".format", // css-selector of elements, which can be sorted ghostClass: "ghost", onUpdate: () => { var buttons = toolbar.children(".format"); for (var i = 0; i < buttons.length; i++) { this.buttonOrder[i] = $(buttons[i]).data("name"); } PluginUtilities.saveData(this.getName(), "buttonOrder", this.buttonOrder); } }); if (!this.settings.style.icons) { toolbar.on("mousemove." + this.getName(), (e) => { var $this = $(e.currentTarget); var pos = e.pageX - $this.parent().offset().left; var diff = -$this.width(); $this.children().each((index, elem) => { diff += $(elem).outerWidth(); }); $this.scrollLeft(pos / $this.width() * diff); }); } return toolbar; } setupToolbar() { $(".bf-toolbar").remove(); $(`${DiscordSelectors.Textarea.channelTextArea} textarea`).each((index, elem) => { this.addToolbar($(elem)); }); } addToolbar(textarea) { var toolbarElement = this.buildToolbar(textarea); if (this.settings.plugin.hoverOpen == true) toolbarElement.addClass("bf-hover"); if (this.isOpen) toolbarElement.addClass("bf-visible"); textarea.on("keypress." + this.getName(), (e) => {this.format(e);}) .parent().after(toolbarElement) .siblings(".bf-toolbar") .on("click." + this.getName(), "div", e => { var button = $(e.currentTarget); if (button.hasClass("bf-arrow")) { if (!this.settings.plugin.hoverOpen) this.openClose(); } else { var wrapper = ""; if (button.hasClass("native-format")) wrapper = this.discordWrappers[button.data("name")]; else if (button.data("name") == "zalgo") return this.wrapSelection(textarea[0], "{{", null, "}}"); else wrapper = this.settings.wrappers[button.data("name")]; this.wrapSelection(textarea[0], wrapper); } }); this.updateStyle(); } getSettingsPanel() { const panel = this.buildSettingsPanel(); panel.addListener(this.updateSettings.bind(this)); return panel.getElement(); } updateSettings(group, id, value) { if (group == "toolbar") this.setupToolbar(); if (group == "plugin" && id == "hoverOpen") { if (value) $(".bf-toolbar").removeClass("bf-visible").addClass("bf-hover"); else $(".bf-toolbar").removeClass("bf-hover"); } if (group == "style") { if (id == "icons") this.setupToolbar(); if (id == "rightSide") this.updateSide(); if (id == "toolbarOpacity") this.updateOpacity(); if (id == "fontSize") this.updateFontSize(); } // var resetButton = $("