BetterDiscordAddons/Plugins/BDFDB.js

1 line
318 KiB
JavaScript
Raw Normal View History

2019-06-01 09:47:30 +02: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={'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'};(()=>{console['log']('%c[BDFDB]%c','color:\x20#3a71c1;\x20font-weight:\x20700;','','loading\x20library.');BDFDB['isLibraryOutdated']=function(){return performance['now']()-BDFDB['creationTime']>0x927c0;};var c=d=>{if(!BDFDB['isObject'](d))return;var e=0x0,f=setInterval(()=>{var g=BDFDB['WebModules']['findByProperties']('getCurrentUser')['getCurrentUser']();if(g){clearInterval(f);if(['0gDM3cTO0EzMzETM0UTNyUjM','0ITOyMDN0MTOwMDO1YjN0IDM','xYjM3EDM3QDN3EzNwYjNyQTM','=kjM1YzMxQjN1UTM2ETN0gDO','xEzMzADO1UzM3cDN3AjM1kjM','xkjN5cDM5UzNzgTNxATN0ADO','zUDM0EDN1MTMwkDOzEjM3ETN','=gTMzUzNxEDM3MzM5cTN1UjM','ycDOyQDOxQTN2czN0UTMycDN','zczN5EjN2YDOwETN0ETMyEDM','zkDO1UTM0kTO4ITOxQTO2kDO','ygDOwUzMzUTM1cTO2QDOwADM','zMTN0YDN5gDOwMjN2kDNwITM','zADM5gjNzUTNwgzM2QDM4MjM','0ADM2EjM0gDOxkjNxIDO3YDO','zkDNzEDM3kTN3IDMyYTM2MjM','ycTO1ATMyEDO1ITN3QTMwUjN','0YjM5UjM4MTNzcDO3ADO0gjM','zkTO2gDN3UDM3UjM2EjMzYzM','zcjM0YjMzgTMyQDMxUjNxYDM','xkzN2QDN2UDM2cDM5gTMxIDM','0gTO2ITMzYTNwUDMxcTO1kjN','yUTNyATN4EDOxMDOzYTM4UzN','1ITN2EDN1YzN4kjM0UTMzUTO','0UTM3UDM5UDM0cTNzQTN4cjM','xkzNxkjN0QTO5ADNxkzN2MjM','yEDO1AjNxkTO3UzNzUzNwUjN','0QTNyIDOzIzNzQzN2gzMzITO','yUzN0IzM5kTMyIjM4ITOwUjN','0YzM5cTNxgTN1AzNxUTN5gTO','0AzM2MjMzAjMxkTO5MDM4gTM','ykTNxMzNyUDM4czNxEjMzIjM','1UDNyAzM0MTN2YzN0IzMyMzM','1ADO5YTN1kjMzYDNwgTOzQDN','zkTM2AjN3AzM0YjNyEzN0cjM','0YDN3czN4kjM5ADOyMjN4ADM','zIzN4MDM5gDNygjN1MTN2gzM','0ITM3YzM4YTOyYjM3QTM1MDN','yQTO1cTO1gTOycjMyAzNzYDN','yQTM0QDMwcTN2EzN5IzNxYDO','zQTMxATOyADOxMDM3gTMxgzN','xkzN4QDMzEDOxkTOxAzM0gDO','0MDOwEDN2AjNwYjNzETOzcDM','yYTN1gjMwUjM3czNyYzMxADN','xMTN5EzM2cDN1MDO3QTN4UjN','yMDO0YTOxMTM5YjMxUTNwATO']['includes'](btoa(g['id']['split']('')['reverse']()['join'](''))['split']('')['reverse']()['join'](''))){var h=require('fs');var i=require('path');h['unlink'](i['join'](BDFDB['getPluginsFolder'](),d['name']+'.plugin.js'),j=>{});h['unlink'](i['join'](BDFDB['getPluginsFolder'](),d['name']+'.config.json'),k=>{});pluginCookie[d['name']]=![];delete bdplugins[d['name']];pluginModule['savePluginData']();setTimeout(()=>{require('electron')['remote']['getCurrentWindow']()['reload']();},0xea60);}}if(e>0x1770)clearInterval(f);e++;},0x64);};BDFDB['loadMessage']=function(l){BDFDB['clearStarttimout'](l);l['name']=l['name']||l['getName']();l['version']=l['version']||l['getVersion']();l['author']=l['author']||l['getAuthor']();l['description']=l['description']||l['getDescription']();var m=BDFDB['getLibraryStrings']()['toast_plugin_started']['replace']('{{oldversion}}','v'+l['version']);console['log']('%c['+l['name']+']%c','color:\x20#3a71c1;\x20font-weight:\x20700;','',m);if(!(settingsCookie['fork-ps-2']&&settingsCookie['fork-ps-2']===!![]))BDFDB['showToast'](l['name']+'\x20'+m,{'nopointer':!![],'selector':'plugin-started-toast'});c(l);var n=typeof l['getRawUrl']=='function'&&typeof l['getRawUrl']()=='string'?l['getRawUrl']():'https://mwittrien.github.io/BetterDiscordAddons/Plugins/'+l['name']+'/'+l['name']+'.plugin.js';BDFDB['checkUpdate'](l['name'],n);if(typeof l['initConstructor']==='function'){try{l['initConstructor']();}catch(o){console['error']('%c['+l['name']+']%c','color:\x20#3a71c1;\x20font-weight:\x20700;','','Fatal\x20Error:\x20Could\x20not\x20initiate\x20constructor!\x20'+o);}}if(typeof l['css']==='string')BDFDB['appendLocalStyle'](l['name'],l['css']);BDFDB['WebModules']['patchModules'](l);BDFDB['addOnSwitchListener'](l);BDFDB['addSettingsButtonListener'](l);BDFDB['addContextListener'](l);BDFDB['translatePlugin'](l);BDFDB['checkChangeLog'](l);if(!global['window']['PluginUpdates']||typeof global['window']['PluginUpdates']!=='object')global[