BetterDiscordAddons/Plugins/BDFDB.js

1 line
195 KiB
JavaScript
Raw Normal View History

2019-01-02 23:22:24 +01:00
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'](),'myData':{},'cachedData':{},'pressedKeys':[],'mousePosition':{'x':0x0,'y':0x0},'name':'$BDFDB'};(()=>{BDFDB['isLibraryOutdated']=function(){return performance['now']()-BDFDB['creationTime']>0x927c0;};BDFDB['loadMessage']=function(c){BDFDB['clearStarttimout'](c);let d=c['name']?c['name']:c['getName']();let e=c['version']?c['version']:c['getVersion']();if(!c['appReload']){if(typeof c['getDescription']==='function'){let 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';};}}let 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);let 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(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);}let 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':!![]});let o=new MutationObserver((p,q)=>{p['forEach']((r,s)=>{if(r['addedNodes']){r['addedNodes']['forEach'](t=>{v(t);});}});});let 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')){let x=w['querySelector']('.bd-pfbtn');if(x){let y=x['parentElement'];if(y&&y['tagName']){let z=y['querySelector']('h2');if(z&&z['innerText']['toUpperCase']()==='PLUGINS'){y['insertBefore'](BDFDB['createUpdateButton'](),x['nextSibling']);}}}}}};BDFDB['unloadMessage']=function(A){BDFDB['clearStarttimout'](A);let B=A['name']?A['name']:A['getName']();let C=A['version']?A['version']:A['getVersion']();if(!A['appReload']){let 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);BDFDB['WebModules']['unpatchall'](A);BDFDB['removeOnSwitchListener'](A);BDFDB['removeReloadListener'](A);BDFDB['removeSettingsButtonListener'](A);BDFDB['