BetterDiscordAddons/Plugins/BDFDB.min.js

1 line
501 KiB
JavaScript
Raw Normal View History

2020-03-08 15:49:06 +01:00
(a=>{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 b={'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 c=Math['round'](Math['random']()*0x2386f26fc10000),d={};b['InternalData']['loadid']=c;if(typeof Array['prototype']['flat']!='function')Array['prototype']['flat']=function(){return this;};d['defaults']={'settings':{'showToasts':{'value':!![],'description':'Show\x20Plugin\x20start\x20and\x20stop\x20Toasts'},'showSupportBadges':{'value':!![],'description':'Show\x20little\x20Badges\x20for\x20Users\x20who\x20support\x20my\x20Patreon'}}};b['LogUtils']={};b['LogUtils']['log']=function(y,z){console['log']('%c['+(typeof z=='string'&&z||'BDFDB')+']','color:\x20#3a71c1;\x20font-weight:\x20700;',(typeof y=='string'&&y||'')['trim']());};b['LogUtils']['warn']=function(y,z){console['warn']('%c['+(typeof z=='string'&&z||'BDFDB')+']','color:\x20#3a71c1;\x20font-weight:\x20700;',(typeof y=='string'&&y||'')['trim']());};b['LogUtils']['error']=function(y,z){console['error']('%c['+(typeof z=='string'&&z||'BDFDB')+']','color:\x20#3a71c1;\x20font-weight:\x20700;','Fatal\x20Error:\x20'+(typeof y=='string'&&y||'')['trim']());};b['LogUtils']['log']('Loading\x20library.');b['PluginUtils']={};b['PluginUtils']['init']=function(y){y['name']=y['name']||(typeof y['getName']=='function'?y['getName']():null);y['version']=y['version']||(typeof y['getVersion']=='function'?y['getVersion']():null);y['author']=y['author']||(typeof y['getAuthor']=='function'?y['getAuthor']():null);y['description']=y['description']||(typeof y['getDescription']=='function'?y['getDescription']():null);d['clearStartTimeout'](y);let z=b['LanguageUtils']['LibraryStringsFormat']('toast_plugin_started','v'+y['version']);b['LogUtils']['log'](z,y['name']);if(!b['BDUtils']['getSettings']('fork-ps-2')&&b['DataUtils']['get'](b,'settings','showToasts'))b['NotificationUtils']['toast'](y['name']+'\x20'+z,{'nopointer':!![],'selector':'plugin-started-toast'});let A=typeof y['getRawUrl']=='function'&&typeof y['getRawUrl']()=='string'?y['getRawUrl']():'https://mwittrien.github.io/BetterDiscordAddons/Plugins/'+y['name']+'/'+y['name']+'.plugin.js';b['PluginUtils']['checkUpdate'](y['name'],A);if(b['ObjectUtils']['is'](y['classes']))d['addPluginClasses'](y);if(typeof y['initConstructor']==='function')b['TimeUtils']['suppress'](y['initConstructor']['bind'](y),'Could\x20not\x20initiate\x20constructor!',y['name'])();if(typeof y['css']==='string')b['DOMUtils']['appendLocalStyle'](y['name'],y['css']);d['patchPlugin'](y);d['addSpecialListeners'](y);b['PluginUtils']['translate'](y);b['PluginUtils']['checkChangeLog'](y);if(!window['PluginUpdates']||typeof window['PluginUpdates']!=='object')window['PluginUpdates']={'plugins':{}};window['PluginUpdates']['plugins'][A]={'name':y