BetterDiscordAddons/Plugins/BDFDB.min.js

1 line
411 KiB
JavaScript
Raw Normal View History

2019-10-23 22:00:08 +02: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']||{},'cleanUps':BDFDB&&BDFDB['cleanUps']||{},'BDv2Api':BDFDB&&BDFDB['BDv2Api']||undefined,'creationTime':performance['now'](),'pressedKeys':[],'mousePosition':{'pageX':0x0,'pageY':0x0},'name':'$BDFDB'};(c=>{var d=Math['round'](Math['random']()*0x2386f26fc10000),e={};BDFDB['id']=d;console['log']('%c[BDFDB]%c','color:\x20#3a71c1;\x20font-weight:\x20700;','','loading\x20library.');BDFDB['isLibraryOutdated']=function(){return performance['now']()-BDFDB['creationTime']>0x927c0;};BDFDB['PluginUtils']={};BDFDB['PluginUtils']['init']=function(f){f['name']=f['name']||(typeof f['getName']=='function'?f['getName']():null);f['version']=f['version']||(typeof f['getVersion']=='function'?f['getVersion']():null);f['author']=f['author']||(typeof f['getAuthor']=='function'?f['getAuthor']():null);f['description']=f['description']||(typeof f['getDescription']=='function'?f['getDescription']():null);e['clearStartTimeout'](f);var g=BDFDB['LanguageUtils']['LibraryStringsFormat']('toast_plugin_started','v'+f['version']);console['log']('%c['+f['name']+']%c','color:\x20#3a71c1;\x20font-weight:\x20700;','',g);if(!(window['settingsCookie']['fork-ps-2']&&window['settingsCookie']['fork-ps-2']===!![]))BDFDB['NotificationUtils']['toast'](f['name']+'\x20'+g,{'nopointer':!![],'selector':'plugin-started-toast'});var h=typeof f['getRawUrl']=='function'&&typeof f['getRawUrl']()=='string'?f['getRawUrl']():'https://mwittrien.github.io/BetterDiscordAddons/Plugins/'+f['name']+'/'+f['name']+'.plugin.js';BDFDB['PluginUtils']['checkUpdate'](f['name'],h);if(typeof f['initConstructor']==='function'){try{f['initConstructor']();}catch(i){console['error']('%c['+f['name']+']%c','color:\x20#3a71c1;\x20font-weight:\x20700;','','Fatal\x20Error:\x20Could\x20not\x20initiate\x20constructor!\x20'+i);}}if(typeof f['css']==='string')BDFDB['DOMUtils']['appendLocalStyle'](f['name'],f['css']);e['patchPlugin'](f);e['addOnSwitchListener'](f);e['addContextListeners'](f);BDFDB['PluginUtils']['translate'](f);BDFDB['PluginUtils']['checkChangeLog'](f);if(!window['PluginUpdates']||typeof window['PluginUpdates']!=='object')window['PluginUpdates']={'plugins':{}};window['PluginUpdates']['plugins'][h]={'name':f['name'],'raw':h,'version':f['version']};if(typeof window['PluginUpdates']['interval']==='undefined')window['PluginUpdates']['interval']=setInterval(c=>{BDFDB['PluginUtils']['checkAllUpdates']();},0x3e8*0x3c*0x3c*0x2);f['started']=!![];delete f['stopping'];for(let k in BDFDB['myPlugins'])if(!BDFDB['myPlugins'][k]['started']&&typeof BDFDB['myPlugins'][k]['initialize']=='function'){try{BDFDB['myPlugins'][k]['initialize']();}catch(l){console['error']('%c['+k+']%c','color:\x20#3a71c1;\x20font-weight:\x20700;','','Fatal\x20Error:\x20Could\x20not\x20initiate\x20plugin!\x20'+l);}};};BDFDB['PluginUtils']['clear']=function(m){e['clearStartTimeout'](m);delete BDFDB['myPlugins'][m['name']];var n=BDFDB['LanguageUtils']['LibraryStringsFormat']('toast_plugin_stopped','v'+m['version']);console['log']('%c['+m['name']+']%c','color:\x20#3a71c1;\x20font-weight:\x20700;','',n);if(!(window['settingsCookie']['fork-ps-2']&&window['settingsCookie']['fork-ps-2']===!![]))BDFDB['NotificationUtils']['toast'](m['name']+'\x20'+n,{'nopointer':!![],'selector':'plugin-stopped-toast'});var o=typeof m['getRawUrl']=='function'&&typeof m['getRawUrl']()=='string'?m['getRawUrl']():'https://mwittrien.github.io/BetterDiscordAddons/Plugins/'+m['name']+'/'+m['name']+'.plugin.js';if(typeof m['css']==='string')BDFDB['DOMUtils']['removeLocalStyle'](m['name']);BDFDB['ListenerUtils']['remove'](m);BDFDB['ObserverUtils']['disconnect'](m);e['removeOnSwitchListener'](m);for(let p of doc