BetterDiscordAddons/Plugins/BDFDB.min.js

1 line
452 KiB
JavaScript
Raw Normal View History

2019-11-05 00:05:22 +01:00
if(window['BDFDB']&&BDFDB['ListenerUtils']&&typeof BDFDB['ListenerUtils']['remove']=='function')BDFDB['ListenerUtils']['remove'](BDFDB);if(window['BDFDB']&&BDFDB['ObserverUtils']&&typeof BDFDB['ObserverUtils']['disconnect']=='function')BDFDB['ObserverUtils']['disconnect'](BDFDB);if(window['BDFDB']&&BDFDB['ModuleUtils']&&typeof BDFDB['ModuleUtils']['unpatch']=='function')BDFDB['ModuleUtils']['unpatch'](BDFDB);var BDFDB={'myPlugins':BDFDB&&BDFDB['myPlugins']||{},'InternalData':BDFDB&&BDFDB['InternalData']||{'creationTime':performance['now'](),'patchedMessagePopouts':0x0,'pressedKeys':[],'mousePosition':{'pageX':0x0,'pageY':0x0}},'BDv2Api':BDFDB&&BDFDB['BDv2Api']||undefined,'pressedKeys':[],'mousePosition':{'pageX':0x0,'pageY':0x0},'name':'$BDFDB'};(c=>{var d=Math['round'](Math['random']()*0x2386f26fc10000),e={};BDFDB['id']=d;BDFDB['LogUtils']={};BDFDB['LogUtils']['log']=function(f,g){if(typeof f!='string')f='';if(typeof g!='string'||g=='$BDFDB')g='BDFDB';console['log']('%c['+g+']%c','color:\x20#3a71c1;\x20font-weight:\x20700;','',f['trim']());};BDFDB['LogUtils']['warn']=function(h,i){if(typeof h!='string')h='';if(typeof i!='string'||i=='$BDFDB')i='BDFDB';console['warn']('%c['+i+']%c','color:\x20#3a71c1;\x20font-weight:\x20700;','',h['trim']());};BDFDB['LogUtils']['error']=function(j,k){if(typeof j!='string')j='';if(typeof k!='string'||k=='$BDFDB')k='BDFDB';console['error']('%c['+k+']%c','color:\x20#3a71c1;\x20font-weight:\x20700;','','Fatal\x20Error:\x20'+j['trim']());};BDFDB['LogUtils']['log']('Loading\x20library.');BDFDB['PluginUtils']={};BDFDB['PluginUtils']['init']=function(l){l['name']=l['name']||(typeof l['getName']=='function'?l['getName']():null);l['version']=l['version']||(typeof l['getVersion']=='function'?l['getVersion']():null);l['author']=l['author']||(typeof l['getAuthor']=='function'?l['getAuthor']():null);l['description']=l['description']||(typeof l['getDescription']=='function'?l['getDescription']():null);e['clearStartTimeout'](l);var m=BDFDB['LanguageUtils']['LibraryStringsFormat']('toast_plugin_started','v'+l['version']);BDFDB['LogUtils']['log'](m,l['name']);if(!BDFDB['BDUtils']['getSettings']('fork-ps-2'))BDFDB['NotificationUtils']['toast'](l['name']+'\x20'+m,{'nopointer':!![],'selector':'plugin-started-toast'});var n=typeof l['getRawUrl']=='function'&&typeof l['getRawUrl']()=='string'?l['getRawUrl']():'https://mwittrien.github.io/BetterDiscordAddons/Plugins/'+l['name']+'/'+l['name']+'.plugin.js';BDFDB['PluginUtils']['checkUpdate'](l['name'],n);if(typeof l['initConstructor']==='function')BDFDB['TimeUtils']['suppress'](l['initConstructor']['bind'](l),'Could\x20not\x20initiate\x20constructor!',l['name'])();if(typeof l['css']==='string')BDFDB['DOMUtils']['appendLocalStyle'](l['name'],l['css']);if(typeof l['onMessageOptionPopout']=='function')BDFDB['InternalData']['patchedMessagePopouts']++;e['patchPlugin'](l);e['addOnSettingsClosedListener'](l);e['addOnSwitchListener'](l);e['addContextListeners'](l);BDFDB['PluginUtils']['translate'](l);BDFDB['PluginUtils']['checkChangeLog'](l);if(!window['PluginUpdates']||typeof window['PluginUpdates']!=='object')window['PluginUpdates']={'plugins':{}};window['PluginUpdates']['plugins'][n]={'name':l['name'],'raw':n,'version':l['version']};if(typeof window['PluginUpdates']['interval']==='undefined')window['PluginUpdates']['interval']=BDFDB['TimeUtils']['interval'](c=>{BDFDB['PluginUtils']['checkAllUpdates']();},0x3e8*0x3c*0x3c*0x2);l['started']=!![];delete l['stopping'];for(let p in BDFDB['myPlugins'])if(!BDFDB['myPlugins'][p]['started']&&typeof BDFDB['myPlugins'][p]['initialize']=='function')setImmediate(()=>{BDFDB['TimeUtils']['suppress'](BDFDB['myPlugins'][p]['initialize']['bind'](BDFDB['myPlugins'][p]),'Could\x20not\x20initiate\x20plugin!',p)();});};BDFDB['PluginUtils']['clear']=function(q){e['clearStartTimeout'](q);delete BDFDB['myPlugins'][q['name']];var r=BDFDB['LanguageUtils']['LibraryStringsFormat']('toast_plugin_stopped','v'+q['version']);BDFDB['LogUtils']['log'](r,q['name']);if(!BDFDB['BDUtils']['getSettings']('fork-ps-2'))BDFDB['NotificationUtils']['toast'](q['n