2019-05-28 23:27:25 +02:00
|
|
|
import Config from "../../data/config";
|
|
|
|
|
|
|
|
import {BDV2, Utilities} from "modules";
|
|
|
|
import SideBar from "./sidebarmenu";
|
|
|
|
|
2019-05-28 20:19:48 +02:00
|
|
|
export default class V2_SettingsPanel_Sidebar {
|
|
|
|
|
|
|
|
constructor(onClick) {
|
|
|
|
this.onClick = onClick;
|
|
|
|
}
|
|
|
|
|
|
|
|
get items() {
|
2019-05-28 20:55:07 +02:00
|
|
|
return [{text: "Settings", id: "core"}, {text: "Emotes", id: "emotes"}, {text: "Plugins", id: "plugins"}, {text: "Themes", id: "themes"}, {text: "Custom CSS", id: "customcss"}];
|
2019-05-28 20:19:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
get component() {
|
|
|
|
return BDV2.react.createElement(
|
|
|
|
"span",
|
|
|
|
null,
|
2019-05-28 23:27:25 +02:00
|
|
|
BDV2.react.createElement(SideBar, {onClick: this.onClick, headerText: "Bandaged BD", items: this.items}),
|
2019-05-28 20:19:48 +02:00
|
|
|
BDV2.react.createElement(
|
|
|
|
"div",
|
|
|
|
{style: {fontSize: "12px", fontWeight: "600", color: "#72767d", padding: "2px 10px"}},
|
2019-05-28 23:27:25 +02:00
|
|
|
`BD v${Config.version} by `,
|
2019-05-28 20:19:48 +02:00
|
|
|
BDV2.react.createElement(
|
|
|
|
"a",
|
|
|
|
{href: "https://github.com/Jiiks/", target: "_blank"},
|
|
|
|
"Jiiks"
|
|
|
|
)
|
|
|
|
),
|
|
|
|
BDV2.react.createElement(
|
|
|
|
"div",
|
|
|
|
{style: {fontSize: "12px", fontWeight: "600", color: "#72767d", padding: "2px 10px"}},
|
2019-05-28 23:27:25 +02:00
|
|
|
`BBD v${Config.bbdVersion} by `,
|
2019-05-28 20:19:48 +02:00
|
|
|
BDV2.react.createElement(
|
|
|
|
"a",
|
|
|
|
{href: "https://github.com/rauenzi/", target: "_blank"},
|
|
|
|
"Zerebos"
|
|
|
|
)
|
|
|
|
)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
get root() {
|
|
|
|
let _root = $("#bd-settings-sidebar");
|
|
|
|
if (!_root.length) {
|
|
|
|
if (!this.injectRoot()) return null;
|
|
|
|
return this.root;
|
|
|
|
}
|
|
|
|
return _root[0];
|
|
|
|
}
|
|
|
|
|
|
|
|
injectRoot() {
|
|
|
|
let changeLog = $("[class*='side-'] > [class*='item-']:not([class*=Danger])").last();
|
|
|
|
if (!changeLog.length) return false;
|
|
|
|
$("<span/>", {id: "bd-settings-sidebar"}).insertBefore(changeLog.prev());
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
|
|
|
let root = this.root;
|
|
|
|
if (!root) {
|
|
|
|
console.log("FAILED TO LOCATE ROOT: [class*='side-'] > [class*='item-']:not([class*=Danger])");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
BDV2.reactDom.render(this.component, root);
|
2019-05-28 23:27:25 +02:00
|
|
|
Utilities.onRemoved(root, () => {
|
2019-05-28 20:19:48 +02:00
|
|
|
BDV2.reactDom.unmountComponentAtNode(root);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|