BetterDiscordAddons/Plugins/BDFDB.js

1 line
388 KiB
JavaScript
Raw Normal View History

2019-10-18 10:33:34 +02:00
if(window['BDFDB']&&BDFDB['ListenerUtils']&&typeof BDFDB['ListenerUtils']['remove']=='function')BDFDB['ListenerUtils']['remove'](BDFDB);if(window['BDFDB']&&BDFDB['WebModules']&&typeof BDFDB['WebModules']['unpatchall']=='function')BDFDB['WebModules']['unpatchall'](BDFDB);if(window['BDFDB']&&BDFDB['ObserverUtils']&&typeof BDFDB['ObserverUtils']['killAll']=='function')BDFDB['ObserverUtils']['killAll'](BDFDB);var BDFDB={'myPlugins':BDFDB&&BDFDB['myPlugins']?BDFDB['myPlugins']:{},'BDv2Api':BDFDB&&BDFDB['BDv2Api']?BDFDB['BDv2Api']:undefined,'creationTime':performance['now'](),'cachedData':{},'pressedKeys':[],'mousePosition':{'pageX':0x0,'pageY':0x0},'name':'$BDFDB'};(()=>{var c=Math['round'](Math['random']()*0x2386f26fc10000);BDFDB['id']=c;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(d){BDFDB['PluginUtils']['clearStartTimeout'](d);d['name']=d['name']||(typeof d['getName']=='function'?d['getName']():null);d['version']=d['version']||(typeof d['getVersion']=='function'?d['getVersion']():null);d['author']=d['author']||(typeof d['getAuthor']=='function'?d['getAuthor']():null);d['description']=d['description']||(typeof d['getDescription']=='function'?d['getDescription']():null);var e=BDFDB['getLibraryStrings']()['toast_plugin_started']['replace']('{{oldversion}}','v'+d['version']);console['log']('%c['+d['name']+']%c','color:\x20#3a71c1;\x20font-weight:\x20700;','',e);if(!(window['settingsCookie']['fork-ps-2']&&window['settingsCookie']['fork-ps-2']===!![]))BDFDB['NotificationUtils']['toast'](d['name']+'\x20'+e,{'nopointer':!![],'selector':'plugin-started-toast'});var f=typeof d['getRawUrl']=='function'&&typeof d['getRawUrl']()=='string'?d['getRawUrl']():'https://mwittrien.github.io/BetterDiscordAddons/Plugins/'+d['name']+'/'+d['name']+'.plugin.js';BDFDB['PluginUtils']['checkUpdate'](d['name'],f);if(typeof d['initConstructor']==='function'){try{d['initConstructor']();}catch(g){console['error']('%c['+d['name']+']%c','color:\x20#3a71c1;\x20font-weight:\x20700;','','Fatal\x20Error:\x20Could\x20not\x20initiate\x20constructor!\x20'+g);}}if(typeof d['css']==='string')BDFDB['appendLocalStyle'](d['name'],d['css']);BDFDB['WebModules']['patchModules'](d);gZ(d);BDFDB['PluginUtils']['translate'](d);BDFDB['PluginUtils']['checkChangeLog'](d);if(!window['PluginUpdates']||typeof window['PluginUpdates']!=='object')window['PluginUpdates']={'plugins':{}};window['PluginUpdates']['plugins'][f]={'name':d['name'],'raw':f,'version':d['version']};if(typeof window['PluginUpdates']['interval']==='undefined')window['PluginUpdates']['interval']=setInterval(()=>{BDFDB['PluginUtils']['checkAllUpdates']();},0x3e8*0x3c*0x3c*0x2);d['started']=!![];for(let h in BDFDB['myPlugins'])if(!BDFDB['myPlugins'][h]['started']&&typeof BDFDB['myPlugins'][h]['initialize']=='function')BDFDB['myPlugins'][h]['initialize']();};BDFDB['PluginUtils']['clear']=function(i){BDFDB['PluginUtils']['clearStartTimeout'](i);delete BDFDB['myPlugins'][i['name']];var j=BDFDB['getLibraryStrings']()['toast_plugin_stopped']['replace']('{{oldversion}}','v'+i['version']);console['log']('%c['+i['name']+']%c','color:\x20#3a71c1;\x20font-weight:\x20700;','',j);if(!(window['settingsCookie']['fork-ps-2']&&window['settingsCookie']['fork-ps-2']===!![]))BDFDB['NotificationUtils']['toast'](i['name']+'\x20'+j,{'nopointer':!![],'selector':'plugin-stopped-toast'});var k=typeof i['getRawUrl']=='function'&&typeof i['getRawUrl']()=='string'?i['getRawUrl']():'https://mwittrien.github.io/BetterDiscordAddons/Plugins/'+i['name']+'/'+i['name']+'.plugin.js';if(typeof i['css']==='string')BDFDB['removeLocalStyle'](i['name']);BDFDB['WebModules']['unpatchall'](i);BDFDB['removeOnSwitchListener'](i);BDFDB['removeSettingsButtonListener'](i);BDFDB['ListenerUtils']['remove'](i);for(let l of document['querySelectorAll']('.'+i['name']+'-modal,\x20.'+i['name']['toLowerCase']()+'-modal,\x20.'+i['name']+'-settingsmodal,\x20.'+i