diff --git a/js/main.js b/js/main.js index b6acb92a..dd5dcfa4 100644 --- a/js/main.js +++ b/js/main.js @@ -8,26 +8,23 @@ /* Localstorage fix */ (function() { - const localStorage = (() => { - const req = webpackJsonp.push([[], {__extra_id__: (module, exports, req) => module.exports = req}, [["__extra_id__"]]]); - delete req.m.__extra_id__; - delete req.c.__extra_id__; - const filter = theModule => theModule.remove && theModule.set && theModule.clear && theModule.get && !theModule.sort; - for (const i in req.c) { - if (!req.c.hasOwnProperty(i)) continue; - const m = req.c[i].exports; - if (m && m.__esModule && m.default && filter(m.default)) return m.default; - if (m && filter(m)) return m; + const contentWindowGetter = Object.getOwnPropertyDescriptor(HTMLIFrameElement.prototype, "contentWindow").get; + Object.defineProperty(HTMLIFrameElement.prototype, "contentWindow", { + get: function () { + const contentWindow = contentWindowGetter.call(this); + return new Proxy(contentWindow, { + get: function (obj, prop) { + if (prop === "localStorage") return null; + const val = obj[prop]; + if (typeof val === "function") return val.bind(obj); + return val; + } + }); } - return null; - })(); - - if (localStorage) { - const email_cache = localStorage.get("email_cache"); - localStorage.remove("email_cache"); - localStorage.remove("token"); - window.addEventListener("beforeunload", () => {localStorage.set("email_cache", email_cache);}); - } + }); + + // Prevent interception by patching of Function.prototype.call + Object.defineProperty(Function.prototype, "call", {value: Function.prototype.call, writable: false, configurable: false}); const oOpen = XMLHttpRequest.prototype.open; XMLHttpRequest.prototype.open = function() { diff --git a/js/main.min.js b/js/main.min.js index 0bc8bba3..e89abd36 100644 --- a/js/main.min.js +++ b/js/main.min.js @@ -1,4 +1,4 @@ -(function(){const e=(()=>{const e=webpackJsonp.push([[],{__extra_id__:(e,t,a)=>e.exports=a},[["__extra_id__"]]]);delete e.m.__extra_id__,delete e.c.__extra_id__;const t=e=>e.remove&&e.set&&e.clear&&e.get&&!e.sort;for(const a in e.c){if(!e.c.hasOwnProperty(a))continue;const n=e.c[a].exports;if(n&&n.__esModule&&n.default&&t(n.default))return n.default;if(n&&t(n))return n}return null})();if(e){const t=e.get("email_cache");e.remove("email_cache"),e.remove("token"),window.addEventListener("beforeunload",()=>{e.set("email_cache",t)})}const t=XMLHttpRequest.prototype.open;XMLHttpRequest.prototype.open=function(){const e=arguments[1];return e.toLowerCase().includes("api/webhooks")?null:Reflect.apply(t,this,arguments)}})(),(()=>{const 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.25",bbdChangelog={description:"Mostly behind the scenes changes again.",changes:[{title:"What's New?",items:["**Changes for plugin developers!** There are some new items in the `BdApi` that you may want to check out."]},{title:"Fixes",type:"fixed",items:["**Modal Footers** are no longer blank hopefully!"]},{title:"Minor Stuff",type:"improved",items:["**Injector Version** is now included in the version list to try and quell the confusion."]}]},settings={"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"},"BetterDiscord Blue":{id:"bda-gs-b",info:"Replace Discord blue with BD Blue",implemented:!1,hidden:!1,cat:"core"},"Public Servers":{id:"bda-gs-1",info:"Display public servers button",implemented:!0,hidden:!1,cat:"core",category:"modules"},"Minimal Mode":{id:"bda-gs-2",info:"Hide elements and reduce the size of elements.",implemented:!0,hidden:!1,cat:"core",category:"modules"},"Voice Mode":{id:"bda-gs-4",info:"Only show voice chat",implemented:!0,hidden:!1,cat:"core",category:"modules"},"Hide Channels":{id:"bda-gs-3",info:"Hide channels in minimal mode",implemented:!0,hidden:!1,cat:"core",category:"modules"},"Dark Mode":{id:"bda-gs-5",info:"Make certain elements dark by default(wip)",implemented:!0,hidden:!1,cat:"core",category:"modules"},"Voice Disconnect":{id:"bda-dc-0",info:"Disconnect from voice server when closing Discord",implemented:!0,hidden:!1,cat:"core",category:"modules"},"24 Hour Timestamps":{id:"bda-gs-6",info:"Replace 12hr timestamps with proper ones",implemented:!0,hidden:!1,cat:"core",category:"modules"},"Colored Text":{id:"bda-gs-7",info:"Make text color the same as role color",implemented:!0,hidden:!1,cat:"core",category:"modules"},"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:"core",category:"modules"},"Content Error Modal":{id:"fork-ps-1",info:"Shows a modal with plugin/theme errors",implemented:!0,hidden:!1,cat:"core",category:"content manager"},"Show Toasts":{id:"fork-ps-2",info:"Shows a small notification for important information",implemented:!0,hidden:!1,cat:"core",category:"content manager"},"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:"core",category:"content manager"},"Automatic Loading":{id:"fork-ps-5",info:"Automatically loads, reloads, and unloads plugins and themes",implemented:!0,hidden:!1,cat:"core",category:"content manager"},"BBD Beta":{id:"fork-beta",info:"Gives access to BBD beta. (Requires full restart after changing.)",implemented:!0,hidden:!1,cat:"core",category:"beta"},"Developer Mode":{id:"bda-gs-8",info:"Developer Mode",implemented:!0,hidden:!1,cat:"core",category:"developer settings"},"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:"core",category:"developer settings"},"Enable Transparency":{id:"fork-wp-1",info:"Enables the main window to be see-through (requires restart)",implemented:!0,hidden:!1,cat:"core",category:"window preferences"},"Window Frame":{id:"fork-wp-2",info:"Adds the native os window frame to the main window",implemented:!1,hidden:!0,cat:"core",category:"window preferences"},"Download Emotes":{id:"fork-es-3",info:"Download emotes when the cache is expired",implemented:!0,hidden:!1,cat:"emote"},"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"},"Animate On Hover":{id:"fork-es-2",info:"Only animate the emote modifiers on hover",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,"fork-beta":!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");if(window.ED)return void this.alert("Not Supported","BandagedBD does not work with EnhancedDiscord. Please uninstall one of them.");if(window.WebSocket&&window.WebSocket.name&&window.WebSocket.name.includes("Patched"))return void this.alert("Not Supported","BandagedBD does not work with Powercord. Please uninstall one of them.");const e=bdConfig.updater?bdConfig.updater.LatestVersion:bdConfig.latestVersion;e>bdConfig.version&&this.alert("Update Available",` +(function(){const e=Object.getOwnPropertyDescriptor(HTMLIFrameElement.prototype,"contentWindow").get;Object.defineProperty(HTMLIFrameElement.prototype,"contentWindow",{get:function(){const t=e.call(this);return new Proxy(t,{get:function(e,t){if("localStorage"===t)return null;const a=e[t];return"function"==typeof a?a.bind(e):a}})}}),Object.defineProperty(Function.prototype,"call",{value:Function.prototype.call,writable:!1,configurable:!1});const t=XMLHttpRequest.prototype.open;XMLHttpRequest.prototype.open=function(){const e=arguments[1];return e.toLowerCase().includes("api/webhooks")?null:Reflect.apply(t,this,arguments)}})(),(()=>{const 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.25",bbdChangelog={description:"Mostly behind the scenes changes again.",changes:[{title:"What's New?",items:["**Changes for plugin developers!** There are some new items in the `BdApi` that you may want to check out."]},{title:"Fixes",type:"fixed",items:["**Modal Footers** are no longer blank hopefully!"]},{title:"Minor Stuff",type:"improved",items:["**Injector Version** is now included in the version list to try and quell the confusion."]}]},settings={"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"},"BetterDiscord Blue":{id:"bda-gs-b",info:"Replace Discord blue with BD Blue",implemented:!1,hidden:!1,cat:"core"},"Public Servers":{id:"bda-gs-1",info:"Display public servers button",implemented:!0,hidden:!1,cat:"core",category:"modules"},"Minimal Mode":{id:"bda-gs-2",info:"Hide elements and reduce the size of elements.",implemented:!0,hidden:!1,cat:"core",category:"modules"},"Voice Mode":{id:"bda-gs-4",info:"Only show voice chat",implemented:!0,hidden:!1,cat:"core",category:"modules"},"Hide Channels":{id:"bda-gs-3",info:"Hide channels in minimal mode",implemented:!0,hidden:!1,cat:"core",category:"modules"},"Dark Mode":{id:"bda-gs-5",info:"Make certain elements dark by default(wip)",implemented:!0,hidden:!1,cat:"core",category:"modules"},"Voice Disconnect":{id:"bda-dc-0",info:"Disconnect from voice server when closing Discord",implemented:!0,hidden:!1,cat:"core",category:"modules"},"24 Hour Timestamps":{id:"bda-gs-6",info:"Replace 12hr timestamps with proper ones",implemented:!0,hidden:!1,cat:"core",category:"modules"},"Colored Text":{id:"bda-gs-7",info:"Make text color the same as role color",implemented:!0,hidden:!1,cat:"core",category:"modules"},"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:"core",category:"modules"},"Content Error Modal":{id:"fork-ps-1",info:"Shows a modal with plugin/theme errors",implemented:!0,hidden:!1,cat:"core",category:"content manager"},"Show Toasts":{id:"fork-ps-2",info:"Shows a small notification for important information",implemented:!0,hidden:!1,cat:"core",category:"content manager"},"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:"core",category:"content manager"},"Automatic Loading":{id:"fork-ps-5",info:"Automatically loads, reloads, and unloads plugins and themes",implemented:!0,hidden:!1,cat:"core",category:"content manager"},"BBD Beta":{id:"fork-beta",info:"Gives access to BBD beta. (Requires full restart after changing.)",implemented:!0,hidden:!1,cat:"core",category:"beta"},"Developer Mode":{id:"bda-gs-8",info:"Developer Mode",implemented:!0,hidden:!1,cat:"core",category:"developer settings"},"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:"core",category:"developer settings"},"Enable Transparency":{id:"fork-wp-1",info:"Enables the main window to be see-through (requires restart)",implemented:!0,hidden:!1,cat:"core",category:"window preferences"},"Window Frame":{id:"fork-wp-2",info:"Adds the native os window frame to the main window",implemented:!1,hidden:!0,cat:"core",category:"window preferences"},"Download Emotes":{id:"fork-es-3",info:"Download emotes when the cache is expired",implemented:!0,hidden:!1,cat:"emote"},"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"},"Animate On Hover":{id:"fork-es-2",info:"Only animate the emote modifiers on hover",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,"fork-beta":!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");if(window.ED)return void this.alert("Not Supported","BandagedBD does not work with EnhancedDiscord. Please uninstall one of them.");if(window.WebSocket&&window.WebSocket.name&&window.WebSocket.name.includes("Patched"))return void this.alert("Not Supported","BandagedBD does not work with Powercord. Please uninstall one of them.");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()}),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}));const t=DataStore.getBDData("version");bbdVersion>t&&(bbdChangelog&&this.showChangelogModal(bbdChangelog),DataStore.setBDData("version",bbdVersion))},Core.prototype.checkForGuilds=function(){let e=0;return new Promise(t=>{const a=function(){const n=BDV2.guildClasses.wrapper.split(" ")[0];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||!BDV2.MessageComponent||(this.cancelColoredText=Utils.monkeyPatch(BDV2.MessageComponent,"default",{before:e=>{const t=e.methodArguments[0];if(!t||!t.childrenMessageContent)return;const a=t.childrenMessageContent;if(!a.type||!a.type.type||"MessageContent"!=a.type.type.displayName)return;const n=a.type.type;n.__originalMethod||(a.type.type=function(e){const t=n(e),a=settingsCookie["bda-gs-7"]?e.message.colorString||"":"";return t.props.style={color:a},t},a.type.type.__originalMethod=n,Object.assign(a.type.type,n))}}))},Core.prototype.removeColoredText=function(){document.querySelectorAll(".markup-2BOw-j").forEach(e=>{e.style.setProperty("color","")})},Core.prototype.alert=function(e,t){let a=$(`