2018-01-10 21:48:10 +01:00
|
|
|
/**
|
|
|
|
* BetterDiscord Client Core
|
2018-01-29 19:15:58 +01:00
|
|
|
* Copyright (c) 2015-present Jiiks/JsSucks - https://github.com/Jiiks / https://github.com/JsSucks
|
2018-01-10 21:48:10 +01:00
|
|
|
* All rights reserved.
|
2018-01-29 19:15:58 +01:00
|
|
|
* https://betterdiscord.net
|
2018-01-10 21:48:10 +01:00
|
|
|
*
|
|
|
|
* This source code is licensed under the MIT license found in the
|
2018-01-27 15:40:35 +01:00
|
|
|
* LICENSE file in the root directory of this source tree.
|
2018-01-10 21:48:10 +01:00
|
|
|
*/
|
|
|
|
|
2018-01-30 14:20:24 +01:00
|
|
|
import { DOM, BdUI } from 'ui';
|
2018-01-29 18:34:31 +01:00
|
|
|
import BdCss from './styles/index.scss';
|
2018-01-30 16:59:27 +01:00
|
|
|
import { Events, CssEditor, Globals, PluginManager, ThemeManager } from 'modules';
|
2018-01-31 13:17:40 +01:00
|
|
|
import { ClientLogger as Logger } from 'common';
|
2018-01-11 00:46:05 +01:00
|
|
|
|
2018-01-10 21:48:10 +01:00
|
|
|
class BetterDiscord {
|
|
|
|
constructor() {
|
2018-01-30 23:21:06 +01:00
|
|
|
window.pom = PluginManager;
|
2018-01-29 18:34:31 +01:00
|
|
|
DOM.injectStyle(BdCss, 'bdmain');
|
2018-01-29 18:56:48 +01:00
|
|
|
Events.on('global-ready', this.globalReady.bind(this));
|
|
|
|
}
|
|
|
|
|
2018-01-30 16:59:27 +01:00
|
|
|
async init() {
|
|
|
|
await PluginManager.loadAllPlugins();
|
|
|
|
await ThemeManager.loadAllThemes();
|
|
|
|
Events.emit('ready');
|
|
|
|
}
|
|
|
|
|
2018-01-29 18:56:48 +01:00
|
|
|
globalReady() {
|
2018-01-29 19:00:31 +01:00
|
|
|
this.vueInstance = BdUI.injectUi();
|
2018-01-30 16:59:27 +01:00
|
|
|
(async () => {
|
|
|
|
this.init();
|
|
|
|
})();
|
2018-01-25 12:03:12 +01:00
|
|
|
}
|
2018-01-10 21:48:10 +01:00
|
|
|
}
|
|
|
|
|
2018-01-11 00:07:35 +01:00
|
|
|
if (window.BetterDiscord) {
|
2018-01-11 07:02:11 +01:00
|
|
|
Logger.log('main', 'Attempting to inject again?');
|
2018-01-11 00:07:35 +01:00
|
|
|
} else {
|
|
|
|
let bdInstance = new BetterDiscord();
|
2018-01-29 19:15:58 +01:00
|
|
|
}
|