diff --git a/js/main.min.js b/js/main.min.js index fc67ecc2..92ce029d 100644 --- a/js/main.min.js +++ b/js/main.min.js @@ -1,55 +1 @@ -(function(){let e=window.require("fs"),t=window.require("process"),a=t.platform,n=("win32"===a?t.env.APPDATA:"darwin"===a?t.env.HOME+"/Library/Preferences":process.env.HOME+"/.config")+"/BetterDiscord/",o="localStorage.json",s={};if(e.existsSync(`${n}${o}`))try{s=JSON.parse(e.readFileSync(`${n}${o}`))}catch(e){console.log(e)}else if(e.existsSync(o))try{s=JSON.parse(e.readFileSync(o))}catch(e){console.log(e)}var r=s;r.setItem=function(e,t){r[e]=t,this.save()},r.getItem=function(e){return r[e]||null},r.save=function(){e.writeFileSync(`${n}${o}`,JSON.stringify(this),null,4)};var i=new Proxy(r,{set:function(e,t,a){r[t]=a,r.save()},get:function(e,t){return r[t]||null}});window.localStorage=i})(),(()=>{let e=document.createElement("div");e.className="bd-loaderv2",e.title="BandagedBD is loading...",document.body.appendChild(e)})();var DataStore=(()=>{const e=require("fs"),t=require("path"),a=DiscordNative.globals.releaseChannel;return new class{constructor(){this.data={settings:{stable:{},canary:{},ptb:{}}},this.pluginData={}}initialize(){try{e.existsSync(this.BDFile)||e.writeFileSync(this.BDFile,JSON.stringify(this.data,null,4));const t=require(this.BDFile);if(t.hasOwnProperty("settings")&&(this.data=t),!e.existsSync(this.settingsFile))return;let n=require(this.settingsFile);e.unlinkSync(this.settingsFile),n=n.hasOwnProperty("settings")?Object.assign({stable:{},canary:{},ptb:{}},{[a]:n}):Object.assign({stable:{},canary:{},ptb:{}},n),this.setBDData("settings",n)}catch(e){BdApi.alert("Corrupt Storage","The bd storage has somehow become corrupt. You may either try to salvage the file or delete it then reload.")}}get BDFile(){return this._BDFile||(this._BDFile=t.resolve(bdConfig.dataPath,"bdstorage.json"))}get settingsFile(){return this._settingsFile||(this._settingsFile=t.resolve(bdConfig.dataPath,"bdsettings.json"))}getPluginFile(e){return t.resolve(ContentManager.pluginsFolder,e+".config.json")}getSettingGroup(e){return this.data.settings[a][e]||null}setSettingGroup(t,n){this.data.settings[a][t]=n,e.writeFileSync(this.BDFile,JSON.stringify(this.data,null,4))}getBDData(e){return this.data[e]||""}setBDData(t,a){this.data[t]=a,e.writeFileSync(this.BDFile,JSON.stringify(this.data,null,4))}getPluginData(t,a){return void 0===this.pluginData[t]?e.existsSync(this.getPluginFile(t))?(this.pluginData[t]=JSON.parse(e.readFileSync(this.getPluginFile(t))),this.pluginData[t][a]||void 0):void 0:this.pluginData[t][a]||void 0}setPluginData(t,a,n){void 0===n||(this.pluginData[t]===void 0&&(this.pluginData[t]={}),this.pluginData[t][a]=n,e.writeFileSync(this.getPluginFile(t),JSON.stringify(this.pluginData[t],null,4)))}deletePluginData(t,a){this.pluginData[t]===void 0&&(this.pluginData[t]={}),delete this.pluginData[t][a],e.writeFileSync(this.getPluginFile(t),JSON.stringify(this.pluginData[t],null,4))}}})(),BDEvents=(()=>{const e=require("events");return new class extends e{dispatch(e,...t){this.emit(e,...t)}off(e,t){this.removeListener(e,t)}}})();window.bdStorage=class{static get(e){return Utils.warn("Deprecation Notice","Please use BdApi.getBDData(). bdStorage may be removed in future versions."),DataStore.getBDData(e)}static set(e,t){Utils.warn("Deprecation Notice","Please use BdApi.setBDData(). bdStorage may be removed in future versions."),DataStore.setBDData(e,t)}},window.bdPluginStorage=class{static get(e,t){return Utils.warn("Deprecation Notice",`${e}, please use BdApi.loadData() or BdApi.getData(). bdPluginStorage may be removed in future versions.`),DataStore.getPluginData(e,t)||null}static set(e,t,a){return Utils.warn("Deprecation Notice",`${e}, please use BdApi.saveData() or BdApi.setData(). bdPluginStorage may be removed in future versions.`),"undefined"==typeof a?Utils.warn("Deprecation Notice","Trying to set undefined value in plugin "+e):void DataStore.setPluginData(e,t,a)}static delete(e,t){Utils.warn("Deprecation Notice",`${e}, please use BdApi.deleteData(). bdPluginStorage may be removed in future versions.`),DataStore.deletePluginData(e,t)}};var settingsPanel,emoteModule,quickEmoteMenu,voiceMode,pluginModule,themeModule,dMode,publicServersModule,mainCore,minSupportedVersion="0.3.0",bbdVersion="0.2.17",settings={"Public Servers":{id:"bda-gs-1",info:"Display public servers button",implemented:!0,hidden:!1,cat:"core"},"Minimal Mode":{id:"bda-gs-2",info:"Hide elements and reduce the size of elements.",implemented:!0,hidden:!1,cat:"core"},"Voice Mode":{id:"bda-gs-4",info:"Only show voice chat",implemented:!0,hidden:!1,cat:"core"},"Hide Channels":{id:"bda-gs-3",info:"Hide channels in minimal mode",implemented:!0,hidden:!1,cat:"core"},"Dark Mode":{id:"bda-gs-5",info:"Make certain elements dark by default(wip)",implemented:!0,hidden:!1,cat:"core"},"Voice Disconnect":{id:"bda-dc-0",info:"Disconnect from voice server when closing Discord",implemented:!0,hidden:!1,cat:"core"},"Custom css live update":{id:"bda-css-0",info:"",implemented:!0,hidden:!0,cat:"core"},"Custom css auto udpate":{id:"bda-css-1",info:"",implemented:!0,hidden:!0,cat:"core"},"24 Hour Timestamps":{id:"bda-gs-6",info:"Replace 12hr timestamps with proper ones",implemented:!0,hidden:!1,cat:"core"},"Coloured Text":{id:"bda-gs-7",info:"Make text colour the same as role colour",implemented:!0,hidden:!1,cat:"core"},"BetterDiscord Blue":{id:"bda-gs-b",info:"Replace Discord blue with BD Blue",implemented:!1,hidden:!1,cat:"core"},"Developer Mode":{id:"bda-gs-8",info:"Developer Mode",implemented:!0,hidden:!1,cat:"core"},"Content Error Modal":{id:"fork-ps-1",info:"Shows a modal with plugin/theme errors",implemented:!0,hidden:!1,cat:"fork"},"Show Toasts":{id:"fork-ps-2",info:"Shows a small notification for important information",implemented:!0,hidden:!1,cat:"fork"},"Scroll To Settings":{id:"fork-ps-3",info:"Auto-scrolls to a plugin's settings when the button is clicked (only if out of view)",implemented:!0,hidden:!1,cat:"fork"},"Animate On Hover":{id:"fork-es-2",info:"Only animate the emote modifiers on hover",implemented:!0,hidden:!1,cat:"fork"},"Copy Selector":{id:"fork-dm-1",info:"Adds a \"Copy Selector\" option to context menus when developer mode is active",implemented:!0,hidden:!1,cat:"fork"},"Download Emotes":{id:"fork-es-3",info:"Download emotes when the cache is expired",implemented:!0,hidden:!1,cat:"fork"},"Normalize Classes":{id:"fork-ps-4",info:"Adds stable classes to elements to help themes. (e.g. adds .da-channels to .channels-Ie2l6A)",implemented:!0,hidden:!1,cat:"fork"},"Automatic Loading":{id:"fork-ps-5",info:"Automatically loads, reloads, and unloads plugins and themes",implemented:!0,hidden:!1,cat:"fork"},"Enable Transparency":{id:"fork-wp-1",info:"Enables the main window to be see-through (requires restart)",implemented:!0,hidden:!1,cat:"fork"},"Window Frame":{id:"fork-wp-2",info:"Adds the native os window frame to the main window",implemented:!1,hidden:!0,cat:"fork"},"Twitch Emotes":{id:"bda-es-7",info:"Show Twitch emotes",implemented:!0,hidden:!1,cat:"emote"},"FrankerFaceZ Emotes":{id:"bda-es-1",info:"Show FrankerFaceZ Emotes",implemented:!0,hidden:!1,cat:"emote"},"BetterTTV Emotes":{id:"bda-es-2",info:"Show BetterTTV Emotes",implemented:!0,hidden:!1,cat:"emote"},"Emote Menu":{id:"bda-es-0",info:"Show Twitch/Favourite emotes in emote menu",implemented:!0,hidden:!1,cat:"emote"},"Emoji Menu":{id:"bda-es-9",info:"Show Discord emoji menu",implemented:!0,hidden:!1,cat:"emote"},"Emote Auto Capitalization":{id:"bda-es-4",info:"Autocapitalize emote commands",implemented:!0,hidden:!1,cat:"emote"},"Show Names":{id:"bda-es-6",info:"Show emote names on hover",implemented:!0,hidden:!1,cat:"emote"},"Show emote modifiers":{id:"bda-es-8",info:"Enable emote mods (flip, spin, pulse, spin2, spin3, 1spin, 2spin, 3spin, tr, bl, br, shake, shake2, shake3, flap)",implemented:!0,hidden:!1,cat:"emote"}},defaultCookie={"bda-gs-1":!0,"bda-gs-2":!1,"bda-gs-3":!1,"bda-gs-4":!1,"bda-gs-5":!0,"bda-gs-6":!1,"bda-gs-7":!1,"bda-gs-8":!1,"bda-es-0":!0,"bda-es-1":!0,"bda-es-2":!0,"bda-es-4":!1,"bda-es-6":!0,"bda-es-7":!0,"bda-gs-b":!1,"bda-es-8":!0,"bda-dc-0":!1,"bda-css-0":!1,"bda-css-1":!1,"bda-es-9":!0,"fork-dm-1":!1,"fork-ps-1":!0,"fork-ps-2":!0,"fork-ps-3":!0,"fork-ps-4":!0,"fork-ps-5":!0,"fork-es-2":!1,"fork-es-3":!0,"fork-wp-1":!1,"fork-wp-2":!1},settingsCookie={},bdpluginErrors=[],bdthemeErrors=[],bdConfig=null;function Core(e){window.bdConfig=e}Core.prototype.init=async function(){if(bdConfig.version
Please download the latest version from GitHub");const e=bdConfig.updater?bdConfig.updater.LatestVersion:bdConfig.latestVersion;e>bdConfig.version&&this.alert("Update Available",` - An update for BandagedBD is available (${e})! Please Reinstall!

- Download Installer - `),Utils.log("Startup","Initializing Settings"),this.initSettings(),emoteModule=new EmoteModule,quickEmoteMenu=new QuickEmoteMenu,Utils.log("Startup","Initializing EmoteModule"),window.emotePromise=emoteModule.init().then(()=>{emoteModule.initialized=!0,Utils.log("Startup","Initializing QuickEmoteMenu"),quickEmoteMenu.init()}),publicServersModule=new V2_PublicServers,voiceMode=new VoiceMode,dMode=new devMode,this.injectExternals(),await this.checkForGuilds(),BDV2.initialize(),Utils.log("Startup","Updating Settings"),settingsPanel=new V2_SettingsPanel,settingsPanel.initializeSettings(),Utils.log("Startup","Loading Plugins"),pluginModule=new PluginModule,pluginModule.loadPlugins(),Utils.log("Startup","Loading Themes"),themeModule=new ThemeModule,themeModule.loadThemes(),$("#customcss").detach().appendTo(document.head),window.addEventListener("beforeunload",function(){settingsCookie["bda-dc-0"]&&document.querySelector(".btn.btn-disconnect").click()}),publicServersModule.initialize(),emoteModule.autoCapitalize(),Utils.log("Startup","Removing Loading Icon"),document.getElementsByClassName("bd-loaderv2")[0].remove(),Utils.log("Startup","Initializing Main Observer"),this.initObserver(),settingsCookie["fork-ps-1"]&&(Utils.log("Startup","Collecting Startup Errors"),this.showContentErrors({plugins:bdpluginErrors,themes:bdthemeErrors}))},Core.prototype.checkForGuilds=function(){return new Promise(e=>{const t=function(){const a=BDV2.guildClasses.wrapper.split(" ")[0],n=BDV2.guildClasses.listItem.split(" ")[0],o=BDV2.guildClasses.blobContainer.split(" ")[0];return 0").text(atob(DataStore.getBDData("bdcustomcss"))).appendTo(document.head),defaultCookie)null==settingsCookie[e]&&(settingsCookie[e]=defaultCookie[e],this.saveSettings())},Core.prototype.saveSettings=function(){DataStore.setSettingGroup("settings",settingsCookie)},Core.prototype.loadSettings=function(){settingsCookie=DataStore.getSettingGroup("settings")},Core.prototype.initObserver=function(){const e=new MutationObserver(e=>{for(let t,a=0,n=e.length;a{if(settingsCookie["bda-gs-6"]){const a=t.returnValue.match(e);return a&&4===a.length?"AM"===a[3]?t.returnValue=t.returnValue.replace(a[0],`${"12"===a[1]?"00":a[1].padStart(2,"0")}:${a[2]}`):t.returnValue=t.returnValue.replace(a[0],`${"12"===a[1]?"12":parseInt(a[1])+12}:${a[2]}`):void 0}},a=Utils.monkeyPatch(BDV2.TimeFormatter,"calendarFormat",{after:t}),n=Utils.monkeyPatch(BDV2.TimeFormatter,"dateFormat",{after:t});this.cancel24Hour=()=>{a(),n()}},Core.prototype.injectColoredText=function(){this.cancelColoredText||(this.cancelColoredText=Utils.monkeyPatch(BDV2.MessageContentComponent.prototype,"render",{after:e=>{settingsCookie["bda-gs-7"]&&Utils.monkeyPatch(e.returnValue.props,"children",{silent:!0,after:({returnValue:t})=>{const a=t.props.children[1],n=e.thisObject.props.message.colorString;return a&&n&&(a.props.style={color:n}),t}})}}))},Core.prototype.removeColoredText=function(){document.querySelectorAll(".markup-2BOw-j").forEach(e=>{e.style.setProperty("color","")})},Core.prototype.alert=function(e,t){let a=$(`
-
- -
`);a.find(".footer button").on("click",()=>{a.addClass("closing"),setTimeout(()=>{a.remove()},300)}),a.find(".bd-backdrop").on("click",()=>{a.addClass("closing"),setTimeout(()=>{a.remove()},300)}),a.appendTo("#app-mount")},Core.prototype.showContentErrors=function({plugins:e=[],themes:t=[]}){function a(e){let t=$(`
`);for(let a of e){let e=$(`
-
${a.name?a.name:a.file}
-
${a.message}
- -
`);t.append(e),a.error&&e.find("a").on("click",t=>{t.preventDefault(),Utils.err("ContentManager",`Error details for ${a.name?a.name:a.file}.`,a.error)})}return t}if(!e||!t)return;if(!e.length&&!t.length)return;let n=$(`
-
- -
`),o=[a(e),a(t)];n.find(".tab-bar-item").on("click",t=>{t.preventDefault(),n.find(".tab-bar-item").removeClass("selected"),$(t.target).addClass("selected"),n.find(".scroller").empty().append(o[$(t.target).index()])}),n.find(".footer button").on("click",()=>{n.addClass("closing"),setTimeout(()=>{n.remove()},300)}),n.find(".bd-backdrop").on("click",()=>{n.addClass("closing"),setTimeout(()=>{n.remove()},300)}),n.appendTo("#app-mount"),e.length?n.find(".tab-bar-item")[0].click():n.find(".tab-bar-item")[1].click()},Core.prototype.showToast=function(e,t={}){if(!bdConfig.deferLoaded)return;if(!document.querySelector(".bd-toasts")){let e=document.createElement("div");e.classList.add("bd-toasts");let t=document.querySelector(".chat-3bRxxu form, #friends, .noChannel-Z1DQK7, .activityFeed-28jde9");e.style.setProperty("left",t?t.getBoundingClientRect().left+"px":"0px"),e.style.setProperty("width",t?t.offsetWidth+"px":"100%"),e.style.setProperty("bottom",(document.querySelector(".chat-3bRxxu form")?document.querySelector(".chat-3bRxxu form").offsetHeight:80)+"px"),document.querySelector(".app, .app-2rEoOp").appendChild(e)}const{type:a="",icon:n=!0,timeout:o=3e3}=t;let s=document.createElement("div");s.classList.add("bd-toast"),a&&s.classList.add("toast-"+a),a&&n&&s.classList.add("icon"),s.innerText=e,document.querySelector(".bd-toasts").appendChild(s),setTimeout(()=>{s.classList.add("closing"),setTimeout(()=>{s.remove(),document.querySelectorAll(".bd-toasts .bd-toast").length||document.querySelector(".bd-toasts").remove()},300)},o)},window.emotesFfz={},window.emotesBTTV={},window.emotesBTTV2={},window.emotesTwitch={},window.subEmotesTwitch={},window.bdEmotes={TwitchGlobal:{},TwitchSubscriber:{},BTTV:{},FrankerFaceZ:{},BTTV2:{}},window.bdEmoteSettingIDs={TwitchGlobal:"bda-es-7",TwitchSubscriber:"bda-es-7",BTTV:"bda-es-2",FrankerFaceZ:"bda-es-1",BTTV2:"bda-es-2"};function EmoteModule(){Object.defineProperty(this,"categories",{get:function(){const e=[];for(const t in window.bdEmoteSettingIDs)settingsCookie[window.bdEmoteSettingIDs[t]]&&e.push(t);return e}})}EmoteModule.prototype.init=async function(){this.modifiers=["flip","spin","pulse","spin2","spin3","1spin","2spin","3spin","tr","bl","br","shake","shake2","shake3","flap"],this.overrides=["twitch","bttv","ffz"];let e={TwitchGlobal:{url:"https://twitchemotes.com/api_cache/v3/global.json",backup:`https://rauenzi.github.io/BetterDiscordApp/data/emotedata_twitch_global.json`,variable:"TwitchGlobal",oldVariable:"emotesTwitch",getEmoteURL:t=>`https://static-cdn.jtvnw.net/emoticons/v1/${t.id}/1.0`,getOldData:(e,t)=>({id:e.match(/\/([0-9]+)\//)[1],code:t,emoticon_set:0,description:null})},TwitchSubscriber:{url:`https://rauenzi.github.io/BetterDiscordApp/data/emotedata_twitch_subscriber.json`,variable:"TwitchSubscriber",oldVariable:"subEmotesTwitch",getEmoteURL:t=>`https://static-cdn.jtvnw.net/emoticons/v1/${t}/1.0`,getOldData:e=>e.match(/\/([0-9]+)\//)[1]},FrankerFaceZ:{url:`https://rauenzi.github.io/BetterDiscordApp/data/emotedata_ffz.json`,variable:"FrankerFaceZ",oldVariable:"emotesFfz",getEmoteURL:t=>`https://cdn.frankerfacez.com/emoticon/${t}/1`,getOldData:e=>e.match(/\/([0-9]+)\//)[1]},BTTV:{url:"https://api.betterttv.net/emotes",variable:"BTTV",oldVariable:"emotesBTTV",parser:t=>{let a={};for(let n,o=0,e=t.emotes.length;o`${t}`,getOldData:e=>e},BTTV2:{url:`https://rauenzi.github.io/BetterDiscordApp/data/emotedata_bttv.json`,variable:"BTTV2",oldVariable:"emotesBTTV2",getEmoteURL:t=>`https://cdn.betterttv.net/emote/${t}/1x`,getOldData:e=>e.match(/emote\/(.+)\//)[1]}};for(await this.getBlacklist(),await this.loadEmoteData(e);!BDV2.MessageContentComponent;)await new Promise(e=>setTimeout(e,100));this.cancelEmoteRender||(this.cancelEmoteRender=Utils.monkeyPatch(BDV2.MessageContentComponent.prototype,"render",{after:({returnValue:e})=>{Utils.monkeyPatch(e.props,"children",{silent:!0,after:({returnValue:e})=>{if(0!=this.categories.length){const t=e.props.children[1];if(t.props.children){const e=t.props.children[1];if(e&&e.length){for(let t=0;ti.length||bemotes.includes(i))continue;this.modifiers.includes(l)&&settingsCookie["bda-es-8"]||(l=""),this.overrides.includes(d)?l=d:d="";let c=this.categories[a];if("twitch"===d?window.bdEmotes.TwitchGlobal[i]?c="TwitchGlobal":window.bdEmotes.TwitchSubscriber[i]&&(c="TwitchSubscriber"):"bttv"===d?window.bdEmotes.BTTV[i]?c="BTTV":window.bdEmotes.BTTV2[i]&&(c="BTTV2"):"ffz"===d&&window.bdEmotes.FrankerFaceZ[i]&&(c="FrankerFaceZ"),!window.bdEmotes[c][i]||!settingsCookie[window.bdEmoteSettingIDs[c]])continue;const p=e[t].match(new RegExp(`([\\s]|^)${Utils.escape(l?i+":"+l:i)}([\\s]|$)`));if(!p)continue;const m=e[t].substring(0,p.index+p[1].length),u=e[t].substring(p.index+p[0].length-p[2].length);e[t]=m;const h=BDV2.react.createElement(BDEmote,{name:i,url:window.bdEmotes[c][i],modifier:l});e.splice(t+1,0,u),e.splice(t+1,0,h)}}const t=e.every(e=>"string"==typeof e&&""==e.replace(/\s*/,"")||!!(e.type&&"BDEmote"==e.type.name)||!!(e.props&&e.props.children&&e.props.children.props&&e.props.children.props.emojiName));if(t)for(let t of e)"object"==typeof t&&("BDEmote"==t.type.name?t.props.jumboable=!0:t.props&&t.props.children&&t.props.children.props&&t.props.children.props.emojiName&&(t.props.children.props.jumboable=!0))}}}}})}}))},EmoteModule.prototype.disable=function(){this.disableAutoCapitalize();this.cancelEmoteRender||(this.cancelEmoteRender(),this.cancelEmoteRender=null)},EmoteModule.prototype.clearEmoteData=async function(){let e=require("fs"),t=bdConfig.dataPath+"emote_data.json",a=e.existsSync(t);a&&e.unlinkSync(t),DataStore.setBDData("emoteCacheDate",new Date().toJSON()),window.bdEmotes={TwitchGlobal:{},TwitchSubscriber:{},BTTV:{},FrankerFaceZ:{},BTTV2:{}}},EmoteModule.prototype.goBack=async function(t){for(let a in t)for(let e in window.bdEmotes[t[a].variable])window[t[a].oldVariable][e]=t[a].getOldData(window.bdEmotes[t[a].variable][e],e)},EmoteModule.prototype.isCacheValid=function(){const e=DataStore.getBDData("emoteCacheDays")||DataStore.setBDData("emoteCacheDays",7)||7,t=new Date(DataStore.getBDData("emoteCacheDate")||null),a=new Date,n=Math.round(Math.abs((a.getTime()-t.getTime())/86400000));return!(n>e)||(DataStore.setBDData("emoteCacheDate",a.toJSON()),!1)},EmoteModule.prototype.loadEmoteData=async function(t){const a=require("fs"),n=bdConfig.dataPath+"emote_data.json",o=a.existsSync(n);if(o&&this.isCacheValid()){settingsCookie["fork-ps-2"]&&mainCore.showToast("Loading emotes from cache.",{type:"info"}),Utils.log("Emotes","Loading emotes from local cache.");const o=await new Promise(e=>{a.readFile(n,"utf8",(t,a)=>{Utils.log("Emotes","Emotes loaded from cache."),t&&(a={}),e(a)})});let s=Utils.testJSON(o);for(const a in s&&(window.bdEmotes=JSON.parse(o)),t)s=0setTimeout(e,1e3));let e=await this.downloadEmotes(t[a]);window.bdEmotes[t[a].variable]=e}settingsCookie["fork-ps-2"]&&mainCore.showToast("All emotes successfully downloaded.",{type:"success"});try{a.writeFileSync(n,JSON.stringify(window.bdEmotes),"utf8")}catch(e){Utils.err("Emotes","Could not save emote data.",e)}}},EmoteModule.prototype.downloadEmotes=function(e){let t=require("request"),a={url:e.url,timeout:e.timeout?e.timeout:5e3};return Utils.log("Emotes",`Downloading: ${e.variable} (${e.url})`),new Promise((n,o)=>{t(a,(t,a,s)=>{if(t)return Utils.err("Emotes","Could not download "+e.variable,t),e.backup?(e.url=e.backup,e.backup=null,e.backupParser&&(e.parser=e.backupParser),n(this.downloadEmotes(e))):o({});let r={};try{r=JSON.parse(s)}catch(t){return Utils.err("Emotes","Could not download "+e.variable,t),e.backup?(e.url=e.backup,e.backup=null,e.backupParser&&(e.parser=e.backupParser),n(this.downloadEmotes(e))):o({})}for(let n in"function"==typeof e.parser&&(r=e.parser(r)),r){if(4>n.length||bemotes.includes(n)){delete r[n];continue}r[n]=e.getEmoteURL(r[n])}n(r),Utils.log("Emotes","Downloaded: "+e.variable)})})},EmoteModule.prototype.getBlacklist=function(){return new Promise(e=>{$.getJSON(`https://rauenzi.github.io/BetterDiscordApp/data/emotefilter.json`,function(t){e(bemotes=t.blacklist)})})};var bemotes=[];EmoteModule.prototype.autoCapitalize=function(){!settingsCookie["bda-es-4"]||this.autoCapitalizeActive||($("body").on("keyup.bdac change.bdac paste.bdac",$(".channelTextArea-1LDbYG textarea:first"),()=>{var e=$(".channelTextArea-1LDbYG textarea:first").val();if(null!=e){var t=e.split(" ").pop();if(3",t+=" ",t+=" ",t+="
",this.qmeHeader=t;var a="";a+="
",a+="
",a+="
",a+="
";var n="";for(let e in window.bdEmotes.TwitchGlobal)window.bdEmotes.TwitchGlobal.hasOwnProperty(e)&&(n=window.bdEmotes.TwitchGlobal[e],a+="
",a+=" \"\"",a+=" ",a+="
");a+="
",a+="
",a+="
",a+="
",this.teContainer=a;var o="";for(let e in o+="
",o+="
",o+="
",o+="
",this.favoriteEmotes)n=this.favoriteEmotes[e],o+="
",o+=" \"\"",o+=" ",o+="
";o+="
",o+="
",o+="
",o+="
",this.faContainer=o},QuickEmoteMenu.prototype.favContext=function(t,e){t.stopPropagation();var a=$("
",{id:"removemenu","data-emoteid":$(e).prop("title"),text:"Remove",class:"bd-context-menu context-menu theme-dark"});return a.css({top:t.pageY-$("#bda-qem-favourite-container").offset().top,left:t.pageX-$("#bda-qem-favourite-container").offset().left}),$(e).parent().append(a),a.on("click",function(t){return t.preventDefault(),t.stopPropagation(),$(this).remove(),delete quickEmoteMenu.favoriteEmotes[$(this).data("emoteid")],quickEmoteMenu.updateFavorites(),!1}),!1},QuickEmoteMenu.prototype.switchHandler=function(t){this.switchQem($(t).attr("id"))},QuickEmoteMenu.prototype.switchQem=function(e){var t=$("#bda-qem-twitch"),a=$("#bda-qem-favourite"),n=$("#bda-qem-emojis");t.removeClass("active"),a.removeClass("active"),n.removeClass("active"),$(".emojiPicker-3m1S-j").hide(),$("#bda-qem-favourite-container").hide(),$("#bda-qem-twitch-container").hide();"bda-qem-twitch"===e?(t.addClass("active"),$("#bda-qem-twitch-container").show()):"bda-qem-favourite"===e?(a.addClass("active"),$("#bda-qem-favourite-container").show()):"bda-qem-emojis"===e?(n.addClass("active"),$(".emojiPicker-3m1S-j").show(),$(".emojiPicker-3m1S-j .search-bar-inner input, .emojiPicker-3m1S-j .search-bar-inner input").focus()):void 0;this.lastTab=e;var o=$(".emote-icon");o.off(),o.on("click",function(){var e=$(this).attr("title"),t=Utils.getTextArea();Utils.insertText(t[0]," "==t.val().slice(-1)?t.val()+e:t.val()+" "+e)})},QuickEmoteMenu.prototype.obsCallback=function(t){if(this.initialized){var a=$(t);settingsCookie["bda-es-9"]?a.removeClass("bda-qme-hidden"):a.addClass("bda-qme-hidden"),settingsCookie["bda-es-0"]&&(a.prepend(this.qmeHeader),a.append(this.teContainer),a.append(this.faContainer),null==this.lastTab&&(this.lastTab="bda-qem-emojis"),this.switchQem(this.lastTab))}},QuickEmoteMenu.prototype.favorite=function(e,t){this.favoriteEmotes.hasOwnProperty(e)||(this.favoriteEmotes[e]=t),this.updateFavorites()},QuickEmoteMenu.prototype.updateFavorites=function(){var e="";for(var t in e+="
",e+="
",e+="
",e+="
",this.favoriteEmotes){var a=this.favoriteEmotes[t];e+="
",e+=" \"\"",e+=" ",e+="
"}e+="
",e+="
",e+="
",e+="
",this.faContainer=e,$("#bda-qem-favourite-container").replaceWith(e),DataStore.setBDData("bdfavemotes",btoa(JSON.stringify(this.favoriteEmotes)))};var Utils=class{static get screenWidth(){return Math.max(document.documentElement.clientWidth,window.innerWidth||0)}static get screenHeight(){return Math.max(document.documentElement.clientHeight,window.innerHeight||0)}static stripBOM(e){return 65279===e.charCodeAt(0)&&(e=e.slice(1)),e}static getTextArea(){return $(".channelTextArea-1LDbYG textarea")}static insertText(e,t){e.focus(),e.selectionStart=0,e.selectionEnd=e.value.length,document.execCommand("insertText",!1,t)}static injectCss(e){$("",{type:"text/css",rel:"stylesheet",href:e}).appendTo($("head"))}static injectJs(e){return new Promise(t=>{$("