diff --git a/Plugins/ThemeSettings/ThemeSettings.plugin.js b/Plugins/ThemeSettings/ThemeSettings.plugin.js index 2e96f10cdd..9047940a15 100644 --- a/Plugins/ThemeSettings/ThemeSettings.plugin.js +++ b/Plugins/ThemeSettings/ThemeSettings.plugin.js @@ -3,7 +3,7 @@ class ThemeSettings { initConstructor () { this.patchModules = { - "V2C_ThemeCard":"componentDidMount" + "V2C_ThemeCard":"componentDidMount" }; } @@ -11,7 +11,7 @@ class ThemeSettings { getDescription () {return "Allows you to change Theme Variables within BetterDiscord. Adds a Settings button (similar to Plugins) to customizable Themes in your Themes Page.";} - getVersion () {return "1.0.6";} + getVersion () {return "1.0.7";} getAuthor () {return "DevilBro";} @@ -88,7 +88,7 @@ class ThemeSettings { while (wrapper.childElementCount) wrapper.firstChild.remove(); while (children.length) wrapper.appendChild(children.shift()); }) - wrapper.appendChild(this.createThemeSettings(instance.props.theme, vars)); + this.createThemeSettings(wrapper, instance.props.theme, vars); }); } } @@ -107,20 +107,22 @@ class ThemeSettings { return []; } - createThemeSettings (theme, vars) { + createThemeSettings (wrapper, theme, vars) { if (!this.started || typeof BDFDB !== "object") return; var settingshtml = `
${BDFDB.encodeToHTML(theme.name)}

Update all variables

`; var settingspanel = $(settingshtml)[0]; var settingspanelinner = settingspanel.querySelector(".DevilBro-settings-inner"); + var maxwidth = wrapper.getBoundingClientRect().width - 80; + for (let varstr of vars) { varstr = varstr.split(":"); let varname = varstr.shift().trim(); varstr = varstr.join(":").split(/;|\/\*/); let varvalue = varstr.shift().trim(); let vardescription = varstr.join("").replace(/\*\/|\/\*/g, "").replace(/:/g, ": ").replace(/: \//g, ":/").replace(/--/g, " --").replace(/\( --/g, "(--").trim(); - $(`

${varname[0].toUpperCase() + varname.slice(1)}:

${vardescription ? '
' + BDFDB.encodeToHTML(vardescription) + '
' : ""}
`) + $(`

${varname[0].toUpperCase() + varname.slice(1)}:

${vardescription ? '
' + BDFDB.encodeToHTML(vardescription) + '
' : ""}
`) .appendTo(settingspanelinner) .find(BDFDB.dotCN.input) .val(varvalue) @@ -157,6 +159,7 @@ class ThemeSettings { } else BDFDB.showToast(`Could not find themefile: ${theme.filename}`, {type:"error"}); }); - return settingspanel; + + wrapper.appendChild(settingspanel); } } \ No newline at end of file