progress
This commit is contained in:
parent
aa7a1a0966
commit
665872a38f
2467
js/main.js
2467
js/main.js
File diff suppressed because it is too large
Load Diff
|
@ -31,7 +31,7 @@ export default class V2C_CssEditorDetached extends BDV2.reactComponent {
|
|||
BDV2.editorDetached = false;
|
||||
this.editor.destroy();
|
||||
}
|
||||
|
||||
|
||||
updateLineCount() {
|
||||
let lineCount = this.refs.editor.value.split("\n").length;
|
||||
if (lineCount == this.props.lines) return;
|
||||
|
@ -68,10 +68,10 @@ export default class V2C_CssEditorDetached extends BDV2.reactComponent {
|
|||
}
|
||||
|
||||
injectRoot() {
|
||||
if (!$(".app").length) return false;
|
||||
if (!$(".app, .app-2rEoOp").length) return false;
|
||||
$("<div/>", {
|
||||
id: "bd-customcss-detach-container"
|
||||
}).insertAfter($(".app"));
|
||||
}).insertAfter($(".app, .app-2rEoOp"));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -159,7 +159,7 @@ export default class V2C_CssEditorDetached extends BDV2.reactComponent {
|
|||
if ($("#customcss").length == 0) {
|
||||
$("head").append("<style id=\"customcss\"></style>");
|
||||
}
|
||||
$("#customcss").html(this.editor.session.getValue()).detach().appendTo(document.head);
|
||||
$("#customcss").text(this.editor.session.getValue()).detach().appendTo(document.head);
|
||||
}
|
||||
|
||||
saveCss() {
|
||||
|
|
|
@ -65,7 +65,7 @@ export default class V2C_CssEditor extends BDV2.reactComponent {
|
|||
}
|
||||
return ccss;
|
||||
}
|
||||
|
||||
|
||||
updateLineCount() {
|
||||
let lineCount = this.refs.editor.value.split("\n").length;
|
||||
if (lineCount == this.props.lines) return;
|
||||
|
@ -140,6 +140,13 @@ export default class V2C_CssEditor extends BDV2.reactComponent {
|
|||
"span",
|
||||
{style: {fontSize: "10px", marginLeft: "5px"}},
|
||||
"Unsaved changes are lost on detach"
|
||||
),
|
||||
BDV2.react.createElement("div", {className: "help-text"},
|
||||
"Press ",
|
||||
BDV2.react.createElement("code", {className: "inline"}, "ctrl"),
|
||||
"+",
|
||||
BDV2.react.createElement("span", {className: "inline"}, ","),
|
||||
" with the editor focused to access the editor's settings."
|
||||
)
|
||||
)
|
||||
)
|
||||
|
@ -175,7 +182,7 @@ export default class V2C_CssEditor extends BDV2.reactComponent {
|
|||
if ($("#customcss").length == 0) {
|
||||
$("head").append("<style id=\"customcss\"></style>");
|
||||
}
|
||||
$("#customcss").html(this.editor.session.getValue()).detach().appendTo(document.head);
|
||||
$("#customcss").text(this.editor.session.getValue()).detach().appendTo(document.head);
|
||||
}
|
||||
|
||||
saveCss() {
|
||||
|
@ -205,10 +212,10 @@ export default class V2C_CssEditor extends BDV2.reactComponent {
|
|||
}
|
||||
|
||||
injectDetachedRoot() {
|
||||
if (!$(".app").length) return false;
|
||||
if (!$(".app, .app-2rEoOp").length) return false;
|
||||
$("<div/>", {
|
||||
id: "bd-customcss-detach-container"
|
||||
}).insertAfter($(".app"));
|
||||
}).insertAfter($(".app, .app-2rEoOp"));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,10 @@
|
|||
export default class V2Components {
|
||||
static get SettingsGroup() {
|
||||
return V2C_SettingsGroup;
|
||||
}
|
||||
static get SectionedSettingsPanel() {
|
||||
return V2C_SectionedSettingsPanel;
|
||||
}
|
||||
static get SettingsPanel() {
|
||||
return V2C_SettingsPanel;
|
||||
}
|
||||
|
@ -47,12 +53,71 @@ export default class V2Components {
|
|||
static get Layer() {
|
||||
return V2C_Layer;
|
||||
}
|
||||
static get SidebarView() {
|
||||
return V2C_SidebarView;
|
||||
}
|
||||
static get ServerCard() {
|
||||
return V2C_ServerCard;
|
||||
}
|
||||
|
||||
static TooltipWrap(Component, options) {
|
||||
|
||||
const {style = "black", side = "top", text = ""} = options;
|
||||
const id = BDV2.KeyGenerator();
|
||||
|
||||
return class extends BDV2.reactComponent {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.onMouseEnter = this.onMouseEnter.bind(this);
|
||||
this.onMouseLeave = this.onMouseLeave.bind(this);
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
this.node = BDV2.reactDom.findDOMNode(this);
|
||||
this.node.addEventListener("mouseenter", this.onMouseEnter);
|
||||
this.node.addEventListener("mouseleave", this.onMouseLeave);
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
this.node.removeEventListener("mouseenter", this.onMouseEnter);
|
||||
this.node.removeEventListener("mouseleave", this.onMouseLeave);
|
||||
}
|
||||
|
||||
onMouseEnter() {
|
||||
if (!BDV2.Tooltips) return;
|
||||
const {left, top, width, height} = this.node.getBoundingClientRect();
|
||||
BDV2.Tooltips.show(id, {
|
||||
position: side,
|
||||
text: text,
|
||||
color: style,
|
||||
targetWidth: width,
|
||||
targetHeight: height,
|
||||
windowWidth: Utils.screenWidth,
|
||||
windowHeight: Utils.screenHeight,
|
||||
x: left,
|
||||
y: top
|
||||
});
|
||||
|
||||
const observer = new MutationObserver((mutations) => {
|
||||
mutations.forEach((mutation) => {
|
||||
const nodes = Array.from(mutation.removedNodes);
|
||||
const directMatch = nodes.indexOf(this.node) > -1;
|
||||
const parentMatch = nodes.some(parent => parent.contains(this.node));
|
||||
if (directMatch || parentMatch) {
|
||||
this.onMouseLeave();
|
||||
observer.disconnect();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
observer.observe(document.body, {subtree: true, childList: true});
|
||||
}
|
||||
|
||||
onMouseLeave() {
|
||||
if (!BDV2.Tooltips) return;
|
||||
BDV2.Tooltips.hide(id);
|
||||
}
|
||||
|
||||
render() {
|
||||
return BDV2.react.createElement(Component, this.props);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
|
@ -13,7 +13,7 @@ export default class V2C_Layer extends BDV2.reactComponent {
|
|||
|
||||
$(`#${this.props.id}`).animate({opacity: 1}, {
|
||||
step: function(now) {
|
||||
$(this).css("transform", `scale(${1.1 - 0.1 * now}) translateZ(0px)`);
|
||||
$(this).css("transform", `scale(${1.1 - 0.1 * now}) translateZ(0px)`);
|
||||
},
|
||||
duration: 200,
|
||||
done: () => {$(`#${this.props.id}`).css("opacity", "").css("transform", "");}
|
||||
|
@ -24,26 +24,26 @@ export default class V2C_Layer extends BDV2.reactComponent {
|
|||
$(window).off(`keyup.${this.props.id}`);
|
||||
$(`#${this.props.id}`).animate({opacity: 0}, {
|
||||
step: function(now) {
|
||||
$(this).css("transform", `scale(${1.1 - 0.1 * now}) translateZ(0px)`);
|
||||
$(this).css("transform", `scale(${1.1 - 0.1 * now}) translateZ(0px)`);
|
||||
},
|
||||
duration: 200,
|
||||
done: () => {$(`#${this.props.rootId}`).remove();}
|
||||
});
|
||||
|
||||
|
||||
$("[class*=\"layer-\"]").removeClass("publicServersOpen").animate({opacity: 1}, {
|
||||
step: function(now) {
|
||||
$(this).css("transform", `scale(${0.07 * now + 0.93}) translateZ(0px)`);
|
||||
$(this).css("transform", `scale(${0.07 * now + 0.93}) translateZ(0px)`);
|
||||
},
|
||||
duration: 200,
|
||||
done: () => {$("[class*=\"layer-\"]").css("opacity", "").css("transform", "");}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
componentWillMount() {
|
||||
$("[class*=\"layer-\"]").addClass("publicServersOpen").animate({opacity: 0}, {
|
||||
step: function(now) {
|
||||
$(this).css("transform", `scale(${0.07 * now + 0.93}) translateZ(0px)`);
|
||||
$(this).css("transform", `scale(${0.07 * now + 0.93}) translateZ(0px)`);
|
||||
},
|
||||
duration: 200
|
||||
});
|
||||
|
|
|
@ -98,10 +98,9 @@ export default class V2C_PublicServers extends BDV2.reactComponent {
|
|||
$.ajax({
|
||||
method: "GET",
|
||||
url: `${this.joinEndPoint}/${serverCard.props.server.identifier}`,
|
||||
headers: {
|
||||
"Accept": "application/json;",
|
||||
headers: {
|
||||
"Accept": "application/json;",
|
||||
"Content-Type": "application/json;" ,
|
||||
"x-discord-id": this.state.connection.user.id,
|
||||
"x-discord-token": this.state.connection.user.accessToken
|
||||
},
|
||||
crossDomain: true,
|
||||
|
@ -121,10 +120,9 @@ export default class V2C_PublicServers extends BDV2.reactComponent {
|
|||
options.y = Math.round(window.screenY + window.innerHeight / 2 - options.height / 2);
|
||||
|
||||
self.joinWindow = new (window.require("electron").remote.BrowserWindow)(options);
|
||||
let sub = window.location.hostname.split(".")[0];
|
||||
let url = self.connectEndPoint + (sub === "canary" || sub === "ptb" ? `/${sub}` : "") + "?betterDiscord";
|
||||
const url = "https://auth.discordservers.com/connect?scopes=guilds.join&previousUrl=https://auth.discordservers.com/info";
|
||||
self.joinWindow.webContents.on("did-navigate", (event, url) => {
|
||||
if (url != "https://join.discordservers.com/session") return;
|
||||
if (url != "https://auth.discordservers.com/info") return;
|
||||
self.joinWindow.close();
|
||||
self.checkConnection();
|
||||
});
|
||||
|
@ -142,7 +140,10 @@ export default class V2C_PublicServers extends BDV2.reactComponent {
|
|||
minimizable: false,
|
||||
alwaysOnTop: true,
|
||||
frame: false,
|
||||
center: false
|
||||
center: false,
|
||||
webPreferences: {
|
||||
nodeIntegration: false
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -169,7 +170,7 @@ export default class V2C_PublicServers extends BDV2.reactComponent {
|
|||
}
|
||||
|
||||
get joinEndPoint() {
|
||||
return "https://join.discordservers.com";
|
||||
return "https://j.discordservers.com";
|
||||
}
|
||||
|
||||
get connectEndPoint() {
|
||||
|
@ -181,16 +182,17 @@ export default class V2C_PublicServers extends BDV2.reactComponent {
|
|||
try {
|
||||
$.ajax({
|
||||
method: "GET",
|
||||
url: `${self.joinEndPoint}/session`,
|
||||
headers: {
|
||||
"Accept": "application/json;",
|
||||
"Content-Type": "application/json;"
|
||||
url: `https://auth.discordservers.com/info`,
|
||||
headers: {
|
||||
"Accept": "application/json;",
|
||||
"Content-Type": "application/json;"
|
||||
},
|
||||
crossDomain: true,
|
||||
xhrFields: {
|
||||
withCredentials: true
|
||||
},
|
||||
success: data => {
|
||||
// Utils.log("PublicServer", "Got data: " + JSON.stringify(data));
|
||||
self.setState({
|
||||
selectedCategory: 0,
|
||||
connection: {
|
||||
|
@ -199,22 +201,18 @@ export default class V2C_PublicServers extends BDV2.reactComponent {
|
|||
}
|
||||
});
|
||||
self.search("", true);
|
||||
|
||||
|
||||
},
|
||||
error: jqXHR => {
|
||||
if (jqXHR.status === 403 || jqXHR.status === 404) {
|
||||
//Not connected
|
||||
self.setState({
|
||||
title: "Not connected to discordservers.com!",
|
||||
loading: true,
|
||||
selectedCategory: -1,
|
||||
connection: {
|
||||
state: 1,
|
||||
user: null
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
error: () => {
|
||||
self.setState({
|
||||
title: "Not connected to discordservers.com!",
|
||||
loading: true,
|
||||
selectedCategory: -1,
|
||||
connection: {
|
||||
state: 1,
|
||||
user: null
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -303,7 +301,7 @@ export default class V2C_PublicServers extends BDV2.reactComponent {
|
|||
}
|
||||
|
||||
get categoryButtons() {
|
||||
return ["All", "FPS Games", "MMO Games", "Strategy Games", "Sports Games", "Puzzle Games", "Retro Games", "Party Games", "Tabletop Games", "Sandbox Games", "Simulation Games", "Community", "Language", "Programming", "Other"];
|
||||
return ["All", "FPS Games", "MMO Games", "Strategy Games", "MOBA Games", "RPG Games", "Tabletop Games", "Sandbox Games", "Simulation Games", "Music", "Community", "Language", "Programming", "Other"];
|
||||
}
|
||||
|
||||
changeCategory(id) {
|
||||
|
@ -426,4 +424,4 @@ export default class V2C_PublicServers extends BDV2.reactComponent {
|
|||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ export default class V2_PublicServers {
|
|||
}
|
||||
|
||||
render() {
|
||||
// BdApi.alert("Broken", "Sorry but the Public Servers modules is currently broken, I recommend disabling this feature for now.");
|
||||
let root = this.root;
|
||||
if (!root) {
|
||||
console.log("FAILED TO LOCATE ROOT: .layers");
|
||||
|
@ -34,35 +35,22 @@ export default class V2_PublicServers {
|
|||
|
||||
get button() {
|
||||
let btn = $("<div/>", {
|
||||
"class": BDV2.guildClasses.guild,
|
||||
"class": BDV2.guildClasses.listItem,
|
||||
"id": "bd-pub-li",
|
||||
"css": {
|
||||
height: "20px",
|
||||
display: settingsCookie["bda-gs-1"] ? "" : "none"
|
||||
}
|
||||
"style": settingsCookie["bda-gs-1"] ? "" : "display: none;"
|
||||
}).append($("<div/>", {
|
||||
"class": BDV2.guildClasses.guildInner,
|
||||
"css": {
|
||||
"height": "20px",
|
||||
"border-radius": "4px"
|
||||
}
|
||||
}).append($("<a/>", {
|
||||
|
||||
}).append($("<div/>", {
|
||||
text: "public",
|
||||
id: "bd-pub-button",
|
||||
css: {
|
||||
"line-height": "20px",
|
||||
"font-size": "12px"
|
||||
},
|
||||
click: () => { this.render(); }
|
||||
}))));
|
||||
"class": "wrapper-25eVIn " + BDV2.guildClasses.circleButtonMask,
|
||||
"text": "public",
|
||||
"id": "bd-pub-button",
|
||||
"click": () => { this.render(); }
|
||||
}));
|
||||
|
||||
return btn;
|
||||
}
|
||||
|
||||
initialize() {
|
||||
let guilds = $(`.${BDV2.guildClasses.guilds.split(" ")[0]}>:first-child`);
|
||||
const wrapper = BDV2.guildClasses.wrapper.split(" ")[0];
|
||||
const guilds = $(`.${wrapper} .scroller-2FKFPG >:first-child`);
|
||||
guilds.after(this.button);
|
||||
}
|
||||
}
|
|
@ -17,11 +17,11 @@ export default class V2C_Checkbox extends BDV2.reactComponent {
|
|||
null,
|
||||
BDV2.react.createElement(
|
||||
"div",
|
||||
{className: "checkbox", onClick: this.onClick},
|
||||
{className: "checkbox checkbox-3kaeSU da-checkbox checkbox-3EVISJ da-checkbox", onClick: this.onClick},
|
||||
BDV2.react.createElement(
|
||||
"div",
|
||||
{className: "checkbox-inner"},
|
||||
BDV2.react.createElement("input", {checked: this.state.checked, onChange: () => {}, type: "checkbox"}),
|
||||
{className: "checkbox-inner checkboxInner-3yjcPe da-checkboxInner"},
|
||||
BDV2.react.createElement("input", {className: "checkboxElement-1qV33p da-checkboxElement", checked: this.state.checked, onChange: () => {}, type: "checkbox"}),
|
||||
BDV2.react.createElement("span", null)
|
||||
),
|
||||
BDV2.react.createElement(
|
||||
|
|
|
@ -39,7 +39,7 @@ export default class V2C_PluginCard extends BDV2.reactComponent {
|
|||
if (typeof this.settingsPanel === "object") {
|
||||
this.refs.settingspanel.appendChild(this.settingsPanel);
|
||||
}
|
||||
|
||||
|
||||
if (!settingsCookie["fork-ps-3"]) return;
|
||||
var isHidden = (container, element) => {
|
||||
|
||||
|
@ -51,7 +51,7 @@ export default class V2C_PluginCard extends BDV2.reactComponent {
|
|||
|
||||
return (eTop < cTop || eBottom > cBottom);
|
||||
};
|
||||
|
||||
|
||||
let self = $(BDV2.reactDom.findDOMNode(this));
|
||||
let container = self.parents(".scroller");
|
||||
if (!isHidden(container[0], self[0])) return;
|
||||
|
@ -60,7 +60,7 @@ export default class V2C_PluginCard extends BDV2.reactComponent {
|
|||
}, 300);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
reload() {
|
||||
const plugin = this.props.plugin.getName();
|
||||
pluginModule.reloadPlugin(plugin);
|
||||
|
@ -68,20 +68,24 @@ export default class V2C_PluginCard extends BDV2.reactComponent {
|
|||
this.onReload(this.props.plugin.getName());
|
||||
}
|
||||
|
||||
getString(value) {
|
||||
return typeof value == "string" ? value : value.toString();
|
||||
}
|
||||
|
||||
render() {
|
||||
let self = this;
|
||||
let {plugin} = this.props;
|
||||
let name = plugin.getName();
|
||||
let author = plugin.getAuthor();
|
||||
let description = plugin.getDescription();
|
||||
let version = plugin.getVersion();
|
||||
let name = this.getString(plugin.getName());
|
||||
let author = this.getString(plugin.getAuthor());
|
||||
let description = this.getString(plugin.getDescription());
|
||||
let version = this.getString(plugin.getVersion());
|
||||
let website = bdplugins[name].website;
|
||||
let source = bdplugins[name].source;
|
||||
|
||||
if (this.state.settings) {
|
||||
try { self.settingsPanel = plugin.getSettingsPanel(); }
|
||||
catch (err) { Utils.err("Plugins", "Unable to get settings panel for " + plugin.getName() + ".", err); }
|
||||
|
||||
|
||||
return BDV2.react.createElement("li", {className: "settings-open ui-switch-item"},
|
||||
BDV2.react.createElement("div", {style: {"float": "right", "cursor": "pointer"}, onClick: () => {
|
||||
this.refs.settingspanel.innerHTML = "";
|
||||
|
@ -130,7 +134,7 @@ export default class V2C_PluginCard extends BDV2.reactComponent {
|
|||
pluginModule.togglePlugin(this.props.plugin.getName());
|
||||
}
|
||||
|
||||
showSettings() {
|
||||
showSettings() {
|
||||
if (!this.hasSettings) return;
|
||||
this.setState({settings: true});
|
||||
}
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
export default class V2C_SectionedSettingsPanel extends BDV2.reactComponent {
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
}
|
||||
|
||||
render() {
|
||||
return BDV2.react.createElement(
|
||||
"div", {className: "contentColumn-2hrIYH contentColumnDefault-1VQkGM content-column default"},
|
||||
this.props.sections.map(section => {
|
||||
return BDV2.react.createElement(V2Components.SettingsGroup, Object.assign({}, section, this.props.onChange));
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
|
@ -32,11 +32,12 @@ export default class V2_SettingsPanel {
|
|||
}
|
||||
|
||||
get coreSettings() {
|
||||
return this.getSettings("core");
|
||||
}
|
||||
get forkSettings() {
|
||||
return this.getSettings("fork");
|
||||
const settings = this.getSettings("core");
|
||||
const categories = [...new Set(settings.map(s => s.category))];
|
||||
const sections = categories.map(c => {return {title: c, settings: settings.filter(s => s.category == c)};});
|
||||
return sections;
|
||||
}
|
||||
|
||||
get emoteSettings() {
|
||||
return this.getSettings("emote");
|
||||
}
|
||||
|
@ -59,9 +60,6 @@ export default class V2_SettingsPanel {
|
|||
case "core":
|
||||
self.renderCoreSettings();
|
||||
break;
|
||||
case "fork":
|
||||
self.renderForkSettings();
|
||||
break;
|
||||
case "emotes":
|
||||
self.renderEmoteSettings();
|
||||
break;
|
||||
|
@ -91,10 +89,10 @@ export default class V2_SettingsPanel {
|
|||
else $("#twitchcord-button-container").hide();
|
||||
}
|
||||
|
||||
if (id == "bda-gs-b") {
|
||||
if (enabled) $("body").addClass("bd-blue");
|
||||
else $("body").removeClass("bd-blue");
|
||||
}
|
||||
// if (id == "bda-gs-b") {
|
||||
// if (enabled) $("body").addClass("bd-blue");
|
||||
// else $("body").removeClass("bd-blue");
|
||||
// }
|
||||
|
||||
if (id == "bda-gs-2") {
|
||||
if (enabled) $("body").addClass("bd-minimal");
|
||||
|
@ -132,7 +130,7 @@ export default class V2_SettingsPanel {
|
|||
if (enabled) emoteModule.autoCapitalize();
|
||||
else emoteModule.disableAutoCapitalize();
|
||||
}
|
||||
|
||||
|
||||
if (id == "fork-ps-4") {
|
||||
if (enabled) ClassNormalizer.start();
|
||||
else ClassNormalizer.stop();
|
||||
|
@ -159,7 +157,7 @@ export default class V2_SettingsPanel {
|
|||
const current = BdApi.getWindowPreference("frame");
|
||||
if (current != _c["fork-wp-2"]) BdApi.setWindowPreference("frame", _c["fork-wp-2"]);
|
||||
}*/
|
||||
|
||||
|
||||
|
||||
if (id == "bda-gs-8") {
|
||||
if (enabled) dMode.enable(settingsCookie["fork-dm-1"]);
|
||||
|
@ -171,7 +169,7 @@ export default class V2_SettingsPanel {
|
|||
|
||||
initializeSettings() {
|
||||
if (settingsCookie["bda-es-0"]) $("#twitchcord-button-container").show();
|
||||
if (settingsCookie["bda-gs-b"]) $("body").addClass("bd-blue");
|
||||
// if (settingsCookie["bda-gs-b"]) $("body").addClass("bd-blue");
|
||||
if (settingsCookie["bda-gs-2"]) $("body").addClass("bd-minimal");
|
||||
if (settingsCookie["bda-gs-3"]) $("body").addClass("bd-minimal-chan");
|
||||
if (settingsCookie["bda-gs-1"]) $("#bd-pub-li").show();
|
||||
|
@ -203,27 +201,21 @@ export default class V2_SettingsPanel {
|
|||
}
|
||||
|
||||
get coreComponent() {
|
||||
return BDV2.react.createElement(V2Components.Scroller, {contentColumn: true, fade: true, dark: true, children: [BDV2.react.createElement(V2Components.SettingsPanel, {key: "cspanel", title: "Core Settings", onChange: this.onChange, settings: this.coreSettings}), BDV2.react.createElement(V2Components.Tools, {key: "tools"})]});
|
||||
}
|
||||
|
||||
get forkComponent() {
|
||||
return BDV2.react.createElement(V2Components.Scroller, {
|
||||
contentColumn: true,
|
||||
fade: true,
|
||||
dark: true,
|
||||
children: [
|
||||
BDV2.react.createElement(V2Components.SettingsPanel, {key: "fspanel", title: "BandagedBD Settings", onChange: this.onChange, settings: this.forkSettings, button: {
|
||||
title: "Clear Emote Cache",
|
||||
onClick: () => { emoteModule.clearEmoteData(); emoteModule.init(); quickEmoteMenu.init(); }
|
||||
}}),
|
||||
BDV2.react.createElement(V2Components.Tools, {key: "tools"})
|
||||
]
|
||||
}
|
||||
);
|
||||
return BDV2.react.createElement(V2Components.Scroller, {contentColumn: true, fade: true, dark: true, children: [
|
||||
BDV2.react.createElement(V2Components.SectionedSettingsPanel, {key: "cspanel", onChange: this.onChange, sections: this.coreSettings}),
|
||||
BDV2.react.createElement(V2Components.Tools, {key: "tools"})
|
||||
]});
|
||||
}
|
||||
|
||||
get emoteComponent() {
|
||||
return BDV2.react.createElement(V2Components.Scroller, {contentColumn: true, fade: true, dark: true, children: [BDV2.react.createElement(V2Components.SettingsPanel, {key: "espanel", title: "Emote Settings", onChange: this.onChange, settings: this.emoteSettings}), BDV2.react.createElement(V2Components.Tools, {key: "tools"})]});
|
||||
return BDV2.react.createElement(V2Components.Scroller, {
|
||||
contentColumn: true, fade: true, dark: true, children: [
|
||||
BDV2.react.createElement(V2Components.SettingsPanel, {key: "espanel", title: "Emote Settings", onChange: this.onChange, settings: this.emoteSettings, button: {
|
||||
title: "Clear Emote Cache",
|
||||
onClick: () => { emoteModule.clearEmoteData(); emoteModule.init(); quickEmoteMenu.init(); }
|
||||
}}),
|
||||
BDV2.react.createElement(V2Components.Tools, {key: "tools"})
|
||||
]});
|
||||
}
|
||||
|
||||
get customCssComponent() {
|
||||
|
@ -245,13 +237,13 @@ export default class V2_SettingsPanel {
|
|||
BDEvents.on(`${prefix}-loaded`, this.onChange);
|
||||
BDEvents.on(`${prefix}-unloaded`, this.onChange);
|
||||
}
|
||||
|
||||
|
||||
componentWillUnmount() {
|
||||
BDEvents.off(`${prefix}-reloaded`, this.onChange);
|
||||
BDEvents.off(`${prefix}-loaded`, this.onChange);
|
||||
BDEvents.off(`${prefix}-unloaded`, this.onChange);
|
||||
}
|
||||
|
||||
|
||||
onChange() {
|
||||
settingsList.sideBarOnClick(type);
|
||||
}
|
||||
|
@ -297,15 +289,6 @@ export default class V2_SettingsPanel {
|
|||
}
|
||||
BDV2.reactDom.render(this.coreComponent, root);
|
||||
}
|
||||
|
||||
renderForkSettings() {
|
||||
let root = this.root;
|
||||
if (!root) {
|
||||
console.log("FAILED TO LOCATE ROOT: .layer-3QrUeG .standardSidebarView-3F1I7i");
|
||||
return;
|
||||
}
|
||||
BDV2.reactDom.render(this.forkComponent, root);
|
||||
}
|
||||
|
||||
renderEmoteSettings() {
|
||||
let root = this.root;
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
export default class V2C_SettingsGroup extends BDV2.reactComponent {
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
}
|
||||
|
||||
render() {
|
||||
const {title, settings, button} = this.props;
|
||||
const buttonComponent = button ? BDV2.react.createElement("button", {key: "title-button", className: "bd-pfbtn", onClick: button.onClick}, button.title) : null;
|
||||
return [BDV2.react.createElement(V2Components.SettingsTitle, {text: title}),
|
||||
buttonComponent,
|
||||
settings.map(setting => {
|
||||
return BDV2.react.createElement(V2Components.Switch, {id: setting.id, key: setting.id, data: setting, checked: settingsCookie[setting.id], onChange: (id, checked) => {
|
||||
this.props.onChange(id, checked);
|
||||
}});
|
||||
})];
|
||||
}
|
||||
}
|
|
@ -5,7 +5,7 @@ export default class V2_SettingsPanel_Sidebar {
|
|||
}
|
||||
|
||||
get items() {
|
||||
return [{text: "Core", id: "core"}, {text: "Bandages", id: "fork"}, {text: "Emotes", id: "emotes"}, {text: "Custom CSS", id: "customcss"}, {text: "Plugins", id: "plugins"}, {text: "Themes", id: "themes"}];
|
||||
return [{text: "Settings", id: "core"}, {text: "Emotes", id: "emotes"}, {text: "Plugins", id: "plugins"}, {text: "Themes", id: "themes"}, {text: "Custom CSS", id: "customcss"}];
|
||||
}
|
||||
|
||||
get component() {
|
||||
|
|
|
@ -2,11 +2,11 @@ export default class V2C_SettingsTitle extends BDV2.reactComponent {
|
|||
constructor(props) {
|
||||
super(props);
|
||||
}
|
||||
|
||||
//h2-2gWE-o title-3sZWYQ size16-14cGz5 height20-mO2eIN weightSemiBold-NJexzi da-h2 da-title da-size16 da-height20 da-weightSemiBold defaultColor-1_ajX0 da-defaultColor marginTop60-3PGbtK da-marginTop60 marginBottom20-32qID7 da-marginBottom20
|
||||
render() {
|
||||
return BDV2.react.createElement(
|
||||
"h2",
|
||||
{className: "ui-form-title h2 margin-reset margin-bottom-20"},
|
||||
{className: "ui-form-title h2 margin-reset margin-bottom-20 marginTop60-3PGbtK da-marginTop6"},
|
||||
this.props.text
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue