2018-01-10 21:48:10 +01:00
|
|
|
/**
|
|
|
|
* BetterDiscord Client Core
|
|
|
|
* Copyright (c) 2015-present JsSucks - https://github.com/JsSucks
|
|
|
|
* All rights reserved.
|
|
|
|
* https://github.com/JsSucks - https://betterdiscord.net
|
|
|
|
*
|
|
|
|
* This source code is licensed under the MIT license found in the
|
|
|
|
* LICENSE file in the root directory of this source tree.
|
|
|
|
*/
|
|
|
|
|
|
|
|
'use strict';
|
|
|
|
|
2018-01-19 06:17:07 +01:00
|
|
|
const styles = require('./styles/index.scss');
|
2018-01-19 02:37:21 +01:00
|
|
|
const { Global, Logger, Utils, PluginManager, BDIpc, WebpackModules, SocketProxy, Events } = require('./modules');
|
|
|
|
//const { UI } = require('./modules/ui/index.jsx');
|
2018-01-11 00:46:05 +01:00
|
|
|
|
2018-01-10 21:48:10 +01:00
|
|
|
class BetterDiscord {
|
|
|
|
|
|
|
|
constructor() {
|
2018-01-15 06:09:28 +01:00
|
|
|
window.bdUtils = Utils;
|
2018-01-15 12:59:45 +01:00
|
|
|
window.wpm = WebpackModules;
|
2018-01-19 02:37:21 +01:00
|
|
|
Events.on('global-ready', e => {
|
2018-01-19 03:10:10 +01:00
|
|
|
const { UI } = require('./modules/ui/vueui.js');
|
2018-01-19 02:37:21 +01:00
|
|
|
this.ui = new UI();
|
2018-01-25 12:03:12 +01:00
|
|
|
this.init();
|
2018-01-19 02:37:21 +01:00
|
|
|
});
|
2018-01-19 06:17:07 +01:00
|
|
|
|
|
|
|
//Inject styles to head for now
|
|
|
|
const style = document.createElement('style');
|
|
|
|
style.id = 'bd-main';
|
|
|
|
style.type = 'text/css';
|
|
|
|
style.appendChild(document.createTextNode(styles));
|
|
|
|
document.head.appendChild(style);
|
2018-01-25 12:03:12 +01:00
|
|
|
|
|
|
|
this.init();
|
|
|
|
}
|
|
|
|
|
|
|
|
async init() {
|
|
|
|
try {
|
|
|
|
await PluginManager.loadAllPlugins();
|
|
|
|
} catch (err) {
|
|
|
|
}
|
|
|
|
|
|
|
|
Events.emit('ready');
|
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-11 00:46:05 +01:00
|
|
|
window.BetterDiscord = {
|
|
|
|
'vendor': {
|
|
|
|
jQuery: require('jquery'),
|
|
|
|
$: require('jquery'),
|
2018-01-21 13:52:02 +01:00
|
|
|
moment: WebpackModules.getModuleByName('Moment')
|
2018-01-11 00:46:05 +01:00
|
|
|
}
|
|
|
|
};
|
2018-01-11 00:07:35 +01:00
|
|
|
}
|