BetterDiscordAddons/Plugins/BDFDB.min.js

1 line
501 KiB
JavaScript
Raw Normal View History

2020-03-08 14:05:54 +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(z,A){console['log']('%c['+(typeof A=='string'&&A||'BDFDB')+']','color:\x20#3a71c1;\x20font-weight:\x20700;',(typeof z=='string'&&z||'')['trim']());};b['LogUtils']['warn']=function(z,A){console['warn']('%c['+(typeof A=='string'&&A||'BDFDB')+']','color:\x20#3a71c1;\x20font-weight:\x20700;',(typeof z=='string'&&z||'')['trim']());};b['LogUtils']['error']=function(z,A){console['error']('%c['+(typeof A=='string'&&A||'BDFDB')+']','color:\x20#3a71c1;\x20font-weight:\x20700;','Fatal\x20Error:\x20'+(typeof z=='string'&&z||'')['trim']());};b['LogUtils']['log']('Loading\x20library.');b['PluginUtils']={};b['PluginUtils']['init']=function(z){z['name']=z['name']||(typeof z['getName']=='function'?z['getName']():null);z['version']=z['version']||(typeof z['getVersion']=='function'?z['getVersion']():null);z['author']=z['author']||(typeof z['getAuthor']=='function'?z['getAuthor']():null);z['description']=z['description']||(typeof z['getDescription']=='function'?z['getDescription']():null);d['clearStartTimeout'](z);let A=b['LanguageUtils']['LibraryStringsFormat']('toast_plugin_started','v'+z['version']);b['LogUtils']['log'](A,z['name']);if(!b['BDUtils']['getSettings']('fork-ps-2')&&b['DataUtils']['get'](b,'settings','showToasts'))b['NotificationUtils']['toast'](z['name']+'\x20'+A,{'nopointer':!![],'selector':'plugin-started-toast'});let B=typeof z['getRawUrl']=='function'&&typeof z['getRawUrl']()=='string'?z['getRawUrl']():'https://mwittrien.github.io/BetterDiscordAddons/Plugins/'+z['name']+'/'+z['name']+'.plugin.js';b['PluginUtils']['checkUpdate'](z['name'],B);if(b['ObjectUtils']['is'](z['classes']))d['addPluginClasses'](z);if(typeof z['initConstructor']==='function')b['TimeUtils']['suppress'](z['initConstructor']['bind'](z),'Could\x20not\x20initiate\x20constructor!',z['name'])();if(typeof z['css']==='string')b['DOMUtils']['appendLocalStyle'](z['name'],z['css']);d['patchPlugin'](z);d['addSpecialListeners'](z);b['PluginUtils']['translate'](z);b['PluginUtils']['checkChangeLog'](z);if(!window['PluginUpdates']||typeof window['PluginUpdates']!=='object')window['PluginUpdates']={'plugins':{}};window['PluginUpdates']['plugins'][B]={'name':z