BetterDiscordAddons/Plugins/BDFDB.js

1 line
178 KiB
JavaScript
Raw Normal View History

2018-12-13 16:48:35 +01:00
var BDFDB={'$':BDFDB&&BDFDB['$']?BDFDB['$']:global['$'],'BDv2Api':BDFDB&&BDFDB['BDv2Api']?BDFDB['BDv2Api']:undefined,'creationTime':performance['now'](),'myData':{},'cachedData':{},'pressedKeys':[],'mousePosition':{'x':0x0,'y':0x0}};(()=>{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']);c['patchCancels']=[];BDFDB['addOnSwitchListener'](c);BDFDB['addReloadListener'](c);BDFDB['addSettingsButtonListener'](c);BDFDB['translatePlugin'](c);BDFDB['$'](document)['off']('.'+d);BDFDB['$'](window)['off']('.'+d);BDFDB['$']('*')['off']('.'+d);if(typeof window['PluginUpdates']!=='object'||!window['PluginUpdates'])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);}var i=null;if(typeof window['PluginUpdates']['observer']==='undefined'&&(i=document['querySelector'](BDFDB['dotCN']['layers']))!=null){window['PluginUpdates']['observer']=new MutationObserver((j,k)=>{j['forEach']((l,m)=>{if(l['addedNodes']){l['addedNodes']['forEach'](n=>{setImmediate(()=>{if(n&&n['tagName']&&n['getAttribute']('layer-id')=='user-settings'){v(n);o['observe'](n,{'childList':!![],'subtree':!![]});}});});}});});window['PluginUpdates']['observer']['observe'](i,{'childList':!![]});var o=new MutationObserver((p,q)=>{p['forEach']((r,s)=>{if(r['addedNodes']){r['addedNodes']['forEach'](t=>{v(t);});}});});var u=document['querySelector'](BDFDB['dotCN']['layer']+'[layer-id=\x27user-settings\x27]');if(u){o['observe'](u,{'childList':!![],'subtree':!![]});v(u);}}delete c['appReload'];c['started']=!![];function v(w){if(w&&w['tagName']&&!w['querySelector']('.bd-pfbtn.bd-updatebtn')){var x=w['querySelector']('.bd-pfbtn');if(x){var y=x['parentElement'];if(y&&y['tagName']){var z=y['querySelector']('h2');if(z&&z['innerText']['toUpperCase']()==='PLUGINS'){y['insertBefore'](BDFDB['createUpdateButton'](),x['nextSibling']);}}}}}};BDFDB['unloadMessage']=function(A){BDFDB['clearStarttimout'](A);var B=A['name']?A['name']:A['getName']();var C=A['version']?A['version']:A['getVersion']();if(!A['appReload']){var D=BDFDB['getLibraryStrings']()['toast_plugin_stopped']['replace']('${oldVersion}','v'+C);console['log']('%c['+B+']%c','color:\x20#3a71c1;\x20font-weight:\x20700;','',D);if(!(settingsCookie['fork-ps-2']&&settingsCookie['fork-ps-2']===!![])){BDFDB['showToast'](B+'\x20'+D,{'selector':'plugin-stopped-toast'});}}if(typeof A['css']==='string')BDFDB['removeLocalStyle'](B);if(typeof A['patchCancels']==='object')for(let E of A['patchCancels'])E();BDFDB['removeOnSwitchListener'](A);BDFDB['removeReloadListener'](A);BDFDB['removeSettingsButtonListener'](A);BDFDB['$'](document)['off']('.'+B);BDFDB['$'](window)['off']('.'+B);BDFDB['$']('*')['off']('.'+B);if(!BDFDB['isObjectEmpty'](A['observers'])){for(var F in A['obs