Added resource injection, fixed timestamps, ignores
This commit is contained in:
parent
376471cb2d
commit
1a7d84a14c
|
@ -12,4 +12,6 @@ node_modules
|
|||
/*.jiiks
|
||||
Installers/dotNet/bin/
|
||||
Installers/dotNet/packages/
|
||||
Installers/dotNet/dlls/
|
||||
Installers/dotNet/dlls/
|
||||
v2/dist/vendor/
|
||||
v2/lib/static.js
|
|
@ -29,9 +29,25 @@ const _defaults = {
|
|||
emotesEnabled: true
|
||||
};
|
||||
|
||||
const _resources = {
|
||||
"mainjs": {
|
||||
"path": "js",
|
||||
"filename": "main.js",
|
||||
"var": "window.BetterDiscord"
|
||||
},
|
||||
"jQuery": {
|
||||
"path": "vendor",
|
||||
"filename": "jquery-2.2.4.min.js",
|
||||
"var": "window.BD.$ = window.BD.jQuery"
|
||||
}
|
||||
};
|
||||
|
||||
var _self;
|
||||
|
||||
class Core {
|
||||
|
||||
constructor(args) {
|
||||
_self = this;
|
||||
this.continue = true;
|
||||
_logger.log(`v${this.__version} Loading - OS: ${_os.platform()}`);
|
||||
this.initConfig(args.cfg);
|
||||
|
@ -64,7 +80,10 @@ class Core {
|
|||
}
|
||||
|
||||
domReady() {
|
||||
|
||||
for(var key in _resources) {
|
||||
var resource = _resources[key];
|
||||
_utils.requireJs(`${_cfg.dataPath}/${resource.path}/${resource.filename}`, resource.var, _self.mainWindow);
|
||||
}
|
||||
}
|
||||
|
||||
exit(reason, severity) {
|
||||
|
|
|
@ -42,11 +42,16 @@ class Utils {
|
|||
});
|
||||
}
|
||||
|
||||
requireJs(file, varstring, _window) {
|
||||
_logger.log(`Injecting file: ${file}`);
|
||||
_window.webContents.executeJavaScript(`${varstring} = require("${file}");`);
|
||||
}
|
||||
|
||||
//Returns a datestring: [DD/MM/YYYY - HH:MM:SS]
|
||||
get dateString() {
|
||||
var d = new Date();
|
||||
|
||||
return `${("00" + (d.getDate() + 1)).slice(-2)}/` +
|
||||
return `${("00" + (d.getDate())).slice(-2)}/` +
|
||||
`${("00" + d.getMonth()).slice(-2)}/` +
|
||||
`${d.getFullYear()} - ` +
|
||||
`${("00" + d.getHours()).slice(-2)}:` +
|
||||
|
|
Loading…
Reference in New Issue