BetterDiscordAddons/Plugins/BDFDB.min.js

1 line
532 KiB
JavaScript
Raw Normal View History

2020-02-05 12:47:20 +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']['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'},'addSupportLinks':{'value':!![],'description':'Add\x20PayPal/Patreon\x20links\x20to\x20my\x20Plugin\x20Entries'}}};d['LogUtils']={};d['LogUtils']['log']=function(g,h){if(typeof g!='string')g='';if(typeof h!='string'||h=='$BDFDB')h='BDFDB';console['log']('%c['+h+']','color:\x20#3a71c1;\x20font-weight:\x20700;',g['trim']());};d['LogUtils']['warn']=function(i,j){if(typeof i!='string')i='';if(typeof j!='string'||j=='$BDFDB')j='BDFDB';console['warn']('%c['+j+']','color:\x20#3a71c1;\x20font-weight:\x20700;',i['trim']());};d['LogUtils']['error']=function(k,l){if(typeof k!='string')k='';if(typeof l!='string'||l=='$BDFDB')l='BDFDB';console['error']('%c['+l+']','color:\x20#3a71c1;\x20font-weight:\x20700;','Fatal\x20Error:\x20'+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);if(m['patchModules']){m['patchedModules']={'after':m['patchModules']};delete m['patchModules'];}m['patchedModules']=d['ObjectUtils']['filter'](m['patchedModules'],n=>f7['Patchtypes']['includes'](n),!![]);f['clearStartTimeout'](m);let o=d['LanguageUtils']['LibraryStringsFormat']('toast_plugin_started','v'+m['version']);d['LogUtils']['log'](o,m['name']);if(!d['BDUtils']['getSettings']('fork-ps-2')&&d['DataUtils']['get'](d,'settings','showToasts'))d['NotificationUtils']['toast'](m['name']+'\x20'+o,{'nopointer':!![],'selector':'plugin-started-toast'});let p=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'],p);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'][