BetterDiscordAddons/Plugins/BDFDB.min.js

1 line
510 KiB
JavaScript
Raw Normal View History

2020-03-08 15:29:25 +01:00
(c=>{if(window['BDFDB']&&window['BDFDB']['ListenerUtils']&&typeof window['BDFDB']['ListenerUtils']['remove']=='function')window['BDFDB']['ListenerUtils']['remove'](window['BDFDB']);if(window['BDFDB']&&window['BDFDB']['StoreChangeUtils']&&typeof window['BDFDB']['StoreChangeUtils']['remove']=='function')window['BDFDB']['StoreChangeUtils']['remove'](window['BDFDB']);if(window['BDFDB']&&window['BDFDB']['ObserverUtils']&&typeof window['BDFDB']['ObserverUtils']['disconnect']=='function')window['BDFDB']['ObserverUtils']['disconnect'](window['BDFDB']);if(window['BDFDB']&&window['BDFDB']['ModuleUtils']&&typeof window['BDFDB']['ModuleUtils']['unpatch']=='function')window['BDFDB']['ModuleUtils']['unpatch'](window['BDFDB']);if(window['BDFDB']&&window['BDFDB']['WindowUtils']&&typeof window['BDFDB']['WindowUtils']['closeAll']=='function')window['BDFDB']['WindowUtils']['closeAll'](window['BDFDB']);if(window['BDFDB']&&window['BDFDB']['WindowUtils']&&typeof window['BDFDB']['WindowUtils']['removeListener']=='function')window['BDFDB']['WindowUtils']['removeListener'](window['BDFDB']);var d={'myPlugins':Object['assign']({},window['BDFDB']&&window['BDFDB']['myPlugins']),'InternalData':Object['assign']({'pressedKeys':[],'mousePosition':{'pageX':0x0,'pageY':0x0},'componentPatchQueries':{}},window['BDFDB']&&window['BDFDB']['InternalData'],{'creationTime':performance['now']()}),'BDv2Api':window['BDFDB']&&window['BDFDB']['BDv2Api']||undefined,'name':'BDFDB'};var e=Math['round'](Math['random']()*0x2386f26fc10000),f={};d['InternalData']['loadid']=e;if(typeof Array['prototype']['flat']!='function')Array['prototype']['flat']=function(){return this;};f['defaults']={'settings':{'showToasts':{'value':!![],'description':'Show\x20Plugin\x20start\x20and\x20stop\x20Toasts'},'showSupportBadges':{'value':!![],'description':'Show\x20little\x20Badges\x20for\x20Users\x20who\x20support\x20my\x20Patreon'}}};d['LogUtils']={};d['LogUtils']['log']=function(g,h){console['log']('%c['+(typeof h=='string'&&h||'BDFDB')+']','color:\x20#3a71c1;\x20font-weight:\x20700;',(typeof g=='string'&&g||'')['trim']());};d['LogUtils']['warn']=function(i,j){console['warn']('%c['+(typeof j=='string'&&j||'BDFDB')+']','color:\x20#3a71c1;\x20font-weight:\x20700;',(typeof i=='string'&&i||'')['trim']());};d['LogUtils']['error']=function(k,l){console['error']('%c['+(typeof l=='string'&&l||'BDFDB')+']','color:\x20#3a71c1;\x20font-weight:\x20700;','Fatal\x20Error:\x20'+(typeof k=='string'&&k||'')['trim']());};d['LogUtils']['log']('Loading\x20library.');d['PluginUtils']={};d['PluginUtils']['init']=function(m){m['name']=m['name']||(typeof m['getName']=='function'?m['getName']():null);m['version']=m['version']||(typeof m['getVersion']=='function'?m['getVersion']():null);m['author']=m['author']||(typeof m['getAuthor']=='function'?m['getAuthor']():null);m['description']=m['description']||(typeof m['getDescription']=='function'?m['getDescription']():null);f['clearStartTimeout'](m);let n=d['LanguageUtils']['LibraryStringsFormat']('toast_plugin_started','v'+m['version']);d['LogUtils']['log'](n,m['name']);if(!d['BDUtils']['getSettings']('fork-ps-2')&&d['DataUtils']['get'](d,'settings','showToasts'))d['NotificationUtils']['toast'](m['name']+'\x20'+n,{'nopointer':!![],'selector':'plugin-started-toast'});let o=typeof m['getRawUrl']=='function'&&typeof m['getRawUrl']()=='string'?m['getRawUrl']():'https://mwittrien.github.io/BetterDiscordAddons/Plugins/'+m['name']+'/'+m['name']+'.plugin.js';d['PluginUtils']['checkUpdate'](m['name'],o);if(d['ObjectUtils']['is'](m['classes']))f['addPluginClasses'](m);if(typeof m['initConstructor']==='function')d['TimeUtils']['suppress'](m['initConstructor']['bind'](m),'Could\x20not\x20initiate\x20constructor!',m['name'])();if(typeof m['css']==='string')d['DOMUtils']['appendLocalStyle'](m['name'],m['css']);f['patchPlugin'](m);f['addSpecialListeners'](m);d['PluginUtils']['translate'](m);d['PluginUtils']['checkChangeLog'](m);if(!window['PluginUpdates']||typeof window['PluginUpdates']!=='object')window['PluginUpdates']={'plugins':{}};window['PluginUpdates']['plugins'][o]={'name':m