BetterDiscordAddons/Plugins/BDFDB.js

1 line
216 KiB
JavaScript
Raw Normal View History

2019-01-17 18:11:24 +01:00
if(BDFDB&&typeof BDFDB['removeEventListener']=='function')BDFDB['removeEventListener'](BDFDB);if(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);var d=c['name']?c['name']:c['getName']();var e=c['version']?c['version']:c['getVersion']();if(!c['appReload']){if(typeof c['getDescription']==='function'){var f=c['getDescription']();if(f['indexOf']('http://bit.ly/DevilBrosHaus')==-0x1){c['getDescription']=function(){return f+'\x0a\x0aMy\x20Support\x20Server:\x20http://bit.ly/DevilBrosHaus\x20or\x20https://discordapp.com/invite/Jx3TjNS';};}}var g=BDFDB['getLibraryStrings']()['toast_plugin_started']['replace']('${oldVersion}','v'+e);console['log']('%c['+d+']%c','color:\x20#3a71c1;\x20font-weight:\x20700;','',g);if(!(settingsCookie['fork-ps-2']&&settingsCookie['fork-ps-2']===!![])){BDFDB['showToast'](d+'\x20'+g,{'selector':'plugin-started-toast'});}}BDFDB['initProcess'](c);var h=typeof c['getRawUrl']=='function'&&typeof c['getRawUrl']()=='string'?c['getRawUrl']():'https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/Plugins/'+d+'/'+d+'.plugin.js';BDFDB['checkUpdate'](d,h);if(typeof c['initConstructor']==='function')c['initConstructor']();if(typeof c['css']==='string')BDFDB['appendLocalStyle'](d,c['css']);BDFDB['WebModules']['patchModules'](c);BDFDB['addOnSwitchListener'](c);BDFDB['addContextListener'](c);BDFDB['addReloadListener'](c);BDFDB['addSettingsButtonListener'](c);BDFDB['translatePlugin'](c);BDFDB['$'](document)['off']('.'+d);BDFDB['$'](window)['off']('.'+d);BDFDB['$']('*')['off']('.'+d);if(!window['PluginUpdates']||typeof window['PluginUpdates']!=='object')window['PluginUpdates']={'plugins':{}};window['PluginUpdates']['plugins'][h]={'name':d,'raw':h,'version':e};if(typeof window['PluginUpdates']['interval']==='undefined')window['PluginUpdates']['interval']=setInterval(()=>{BDFDB['checkAllUpdates']();},0x6ddd00);delete c['appReload'];c['started']=!![];};BDFDB['unloadMessage']=function(i){BDFDB['clearStarttimout'](i);var j=i['name']?i['name']:i['getName']();var k=i['version']?i['version']:i['getVersion']();if(!i['appReload']){var l=BDFDB['getLibraryStrings']()['toast_plugin_stopped']['replace']('${oldVersion}','v'+k);console['log']('%c['+j+']%c','color:\x20#3a71c1;\x20font-weight:\x20700;','',l);if(!(settingsCookie['fork-ps-2']&&settingsCookie['fork-ps-2']===!![])){BDFDB['showToast'](j+'\x20'+l,{'selector':'plugin-stopped-toast'});}}if(typeof i['css']==='string')BDFDB['removeLocalStyle'](j);BDFDB['WebModules']['unpatchall'](i);BDFDB['removeOnSwitchListener'](i);BDFDB['removeReloadListener'](i);BDFDB['removeSettingsButtonListener'](i);BDFDB['removeEles']('.'+j+'-modal','.'+j['toLowerCase']()+'-modal','.'+j+'-settingsmodal','.'+j['toLowerCase']()+'-settingsmodal');BDFDB['$'](document)['off']('.'+j);BDFDB['$'](window)['off']('.'+j);BDFDB['$']('*')['off']('.'+j);if(!BDFDB['isObjectEmpty'](i['observers'])){for(let m in i['observers'])for(let n of i['observers'][m])n['disconnect']();delete i['observers'];}BDFDB['removeEventListener'](i);var o=typeof i['getRawUrl']=='function'&&typeof i['getRawUrl']()=='string'?i['getRawUrl']():'https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/Plugins/'+j+'/'+j+'.plugin.js';delete window['PluginUpdates']['plugins'][o];if(BDFDB['isObjectEmpty'](window['PluginUpdates']['plugins']))BDFDB['removeEles']('#bd-settingspane-container\x20.bd-updatebtn'+BDFDB['dotCN']['_repofolderbutton']);i['started']=![];};BDFDB['translatePlugin']=function(p){if(typeof p['setLabelsByLanguage']==='function'||typeof p['changeLanguageStrings']==='function'){var q=!p['appReload'];if(document['querySelector']('h