BetterDiscordAddons/Plugins/BDFDB.js

1 line
236 KiB
JavaScript
Raw Normal View History

2019-01-25 12:06:05 +01:00
if(global['BDFDB']&&typeof BDFDB['removeEventListener']=='function')BDFDB['removeEventListener'](BDFDB);if(global['BDFDB']&&BDFDB['WebModules']&&typeof BDFDB['WebModules']['unpatchall']=='function')BDFDB['WebModules']['unpatchall'](BDFDB);var BDFDB={'$':BDFDB&&BDFDB['$']?BDFDB['$']:global['$'],'BDv2Api':BDFDB&&BDFDB['BDv2Api']?BDFDB['BDv2Api']:undefined,'creationTime':performance['now'](),'cachedData':{},'pressedKeys':[],'mousePosition':{'pageX':0x0,'pageY':0x0},'name':'$BDFDB'};(()=>{BDFDB['isLibraryOutdated']=function(){return performance['now']()-BDFDB['creationTime']>0x927c0;};BDFDB['loadMessage']=function(c){BDFDB['clearStarttimout'](c);if(typeof c['getDescription']==='function'){var d=c['getDescription']();if(d['indexOf']('http://bit.ly/DevilBrosHaus')==-0x1)c['getDescription']=function(){return d+'\x0a\x0aMy\x20Support\x20Server:\x20http://bit.ly/DevilBrosHaus\x20or\x20https://discordapp.com/invite/Jx3TjNS';};}c['name']=c['name']||c['getName']();c['version']=c['version']||c['getVersion']();c['author']=c['author']||c['getAuthor']();c['description']=c['description']||c['getDescription']();var e=BDFDB['getLibraryStrings']()['toast_plugin_started']['replace']('{{oldversion}}','v'+c['version']);console['log']('%c['+c['name']+']%c','color:\x20#3a71c1;\x20font-weight:\x20700;','',e);if(!(settingsCookie['fork-ps-2']&&settingsCookie['fork-ps-2']===!![]))BDFDB['showToast'](c['name']+'\x20'+e,{'selector':'plugin-started-toast'});BDFDB['initProcess'](c);var f=typeof c['getRawUrl']=='function'&&typeof c['getRawUrl']()=='string'?c['getRawUrl']():'https://mwittrien.github.io/BetterDiscordAddons/Plugins/'+c['name']+'/'+c['name']+'.plugin.js';BDFDB['checkUpdate'](c['name'],f);if(typeof c['initConstructor']==='function')c['initConstructor']();if(typeof c['css']==='string')BDFDB['appendLocalStyle'](c['name'],c['css']);BDFDB['WebModules']['patchModules'](c);BDFDB['addOnSwitchListener'](c);BDFDB['addSettingsButtonListener'](c);BDFDB['addContextListener'](c);BDFDB['translatePlugin'](c);BDFDB['$'](document)['off']('.'+c['name']);BDFDB['$'](window)['off']('.'+c['name']);BDFDB['$']('*')['off']('.'+c['name']);if(!window['PluginUpdates']||typeof window['PluginUpdates']!=='object')window['PluginUpdates']={'plugins':{}};window['PluginUpdates']['plugins'][f]={'name':c['name'],'raw':f,'version':c['version']};if(typeof window['PluginUpdates']['interval']==='undefined')window['PluginUpdates']['interval']=setInterval(()=>{BDFDB['checkAllUpdates']();},0x3e8*0x3c*0x3c*0x2);c['started']=!![];};BDFDB['unloadMessage']=function(g){BDFDB['clearStarttimout'](g);g['name']=g['name']||g['getName']();g['version']=g['version']||g['getVersion']();g['author']=g['author']||g['getAuthor']();g['description']=g['description']||g['getDescription']();var h=BDFDB['getLibraryStrings']()['toast_plugin_stopped']['replace']('{{oldversion}}','v'+g['version']);console['log']('%c['+g['name']+']%c','color:\x20#3a71c1;\x20font-weight:\x20700;','',h);if(!(settingsCookie['fork-ps-2']&&settingsCookie['fork-ps-2']===!![]))BDFDB['showToast'](g['name']+'\x20'+h,{'selector':'plugin-stopped-toast'});var i=typeof g['getRawUrl']=='function'&&typeof g['getRawUrl']()=='string'?g['getRawUrl']():'https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/Plugins/'+g['name']+'/'+g['name']+'.plugin.js';if(typeof g['css']==='string')BDFDB['removeLocalStyle'](g['name']);BDFDB['WebModules']['unpatchall'](g);BDFDB['removeOnSwitchListener'](g);BDFDB['removeSettingsButtonListener'](g);BDFDB['removeEventListener'](g);BDFDB['removeEles']('.'+g['name']+'-modal,\x20.'+g['name']['toLowerCase']()+'-modal,\x20.'+g['name']+'-settingsmodal,\x20.'+g['name']['toLowerCase']()+'-settingsmodal');BDFDB['$'](document)['off']('.'+g['name']);BDFDB['$'](window)['off']('.'+g['name']);BDFDB['$']('*')['off']('.'+g['name']);if(!BDFDB['isObjectEmpty'](g['observers'])){for(let j in g['observers'])for(let k of g['observers'][j])k['disconnect']();delete g['observers'];}delete window['PluginUpdates']['plugins'][i];if(BDFDB['isObjectEmpty'](window['PluginUpdates']['plugins']))BDFDB['removeEles']('#bd-settingspane-c