add main ui module and id to dom
This commit is contained in:
parent
88ad25ecc7
commit
5791368a75
|
@ -8,12 +8,18 @@
|
||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { DOM } from './ui';
|
import { DOM, BdUI } from './ui';
|
||||||
import BdCss from './styles/index.scss';
|
import BdCss from './styles/index.scss';
|
||||||
|
import { Events } from './modules';
|
||||||
|
|
||||||
class BetterDiscord {
|
class BetterDiscord {
|
||||||
constructor() {
|
constructor() {
|
||||||
DOM.injectStyle(BdCss, 'bdmain');
|
DOM.injectStyle(BdCss, 'bdmain');
|
||||||
|
Events.on('global-ready', this.globalReady.bind(this));
|
||||||
|
}
|
||||||
|
|
||||||
|
globalReady() {
|
||||||
|
BdUI.injectUi();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
/**
|
||||||
|
* BetterDiscord Client UI Module
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import Dom from './dom';
|
||||||
|
import Vue from 'vue';
|
||||||
|
import { BdSettingsWrapper } from './components';
|
||||||
|
|
||||||
|
export default class {
|
||||||
|
static injectUi() {
|
||||||
|
|
||||||
|
Dom.createElement('div', null, 'bd-settings').appendTo(Dom.bdBody);
|
||||||
|
|
||||||
|
const vueInstance = new Vue({
|
||||||
|
el: '#bd-settings',
|
||||||
|
components: { BdSettingsWrapper },
|
||||||
|
template: '<BdSettingsWrapper/>'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
<template>
|
||||||
|
<div>Hi!</div>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
export default {}
|
||||||
|
</script>
|
|
@ -0,0 +1 @@
|
||||||
|
export { default as BdSettingsWrapper } from './BdSettingsWrapper.vue';
|
|
@ -9,9 +9,10 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class BdNode {
|
class BdNode {
|
||||||
constructor(tag, className) {
|
constructor(tag, className, id) {
|
||||||
this.element = document.createElement(tag);
|
this.element = document.createElement(tag);
|
||||||
if (className) this.element.className = className;
|
if (className) this.element.className = className;
|
||||||
|
if (id) this.element.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
appendTo(e) {
|
appendTo(e) {
|
||||||
|
@ -54,8 +55,8 @@ class DOM {
|
||||||
return document.querySelector(e);
|
return document.querySelector(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
static createElement(tag = 'div', className = null) {
|
static createElement(tag = 'div', className = null, id = null) {
|
||||||
return new BdNode(tag, className);
|
return new BdNode(tag, className, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
static deleteStyle(id) {
|
static deleteStyle(id) {
|
||||||
|
|
|
@ -1 +1,2 @@
|
||||||
export { default as DOM } from './dom';
|
export { default as DOM } from './dom';
|
||||||
|
export { default as BdUI } from './bdui';
|
Loading…
Reference in New Issue