diff --git a/Library/_res/0BDFDB.data.json b/Library/_res/0BDFDB.data.json index d6ecb89543..9251a1e9c4 100644 --- a/Library/_res/0BDFDB.data.json +++ b/Library/_res/0BDFDB.data.json @@ -4,7 +4,8 @@ "BDFDB": "https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js", "CreationDate": "https://mwittrien.github.io/BetterDiscordAddons/_DEAD/CreationDate.plugin.js", "JoinedAtDate": "https://mwittrien.github.io/BetterDiscordAddons/_DEAD/JoinedAtDate.plugin.js", - "ShowHiddenChannels": "https://mwittrien.github.io/BetterDiscordAddons/_DEAD/ShowHiddenChannels.plugin.js" + "ShowHiddenChannels": "https://mwittrien.github.io/BetterDiscordAddons/_DEAD/ShowHiddenChannels.plugin.js", + "ThemeSettings": "https://mwittrien.github.io/BetterDiscordAddons/_DEAD/ThemeSettings.plugin.js" }, "LibraryRequires": ["electron", "fs", "path", "process", "request"], "DiscordObjects": { diff --git a/Plugins/README.md b/Plugins/README.md index 4490aac66e..d70340a7db 100644 --- a/Plugins/README.md +++ b/Plugins/README.md @@ -55,7 +55,6 @@ - [Spotify Controls](https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/SpotifyControls) - Adds a Control Panel while listening to Spotify on a connected Account - [Staff Tag](https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/StaffTag) - Adds a Crown/Tag to Server Owners (or Admins/Management) - [Theme Repo](https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/ThemeRepo) - Allows you to download all Themes from BD's Website within Discord - - [Theme Settings](https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/ThemeSettings) - Allows you to change Theme Variables within Discord - [Timed Light Dark Mode](https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/TimedLightDarkMode) - Adds a Time Slider to the Appearance Settings - [Top Role Everywhere](https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/TopRoleEverywhere) - Adds the highest Role of a User as a Tag - [Translator](https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/Translator) - Allows you to translate Messages and your outgoing Messages within Discord diff --git a/Plugins/ThemeSettings/README.md b/Plugins/ThemeSettings/README.md deleted file mode 100644 index cb3c981a76..0000000000 --- a/Plugins/ThemeSettings/README.md +++ /dev/null @@ -1,20 +0,0 @@ -# Theme Settings [![Download][download-badge]][download-link] [![Support][support-badge]][support-link] [![PayPal][paypal-badge]][paypal-link] [![Patreon][patreon-badge]][patreon-link] - -[download-badge]: https://img.shields.io/badge/Download-%233a71c1.svg?style=flat&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAgCAYAAAAIXrg4AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAd5gAAHeYBMKt3fAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAE9SURBVEiJ7ZQ7TsNAFEWv06IAShOkEDD5UNCwB8RCWEYWAqkIYiEgZQERoqLgFz4hUIaC+tCM4cmyk4mxCyRfaSRL8+49781YI3kKOASmwBtw4OvzFnDJry58fZUlGGvme70IQCaVgBLwXwBADegDp0AjaxjQAAbACVCzG+fmGRgDYYJ5ZGpGCfuh80Ya/EwgqWpqQ0lDoLVE5y1JQ+eNVLUFXfdSWr0A7UUTAG1XazUFuvEudoFJrPAd2EsDuMZeY56PyJM0aqohDljU0Lzz7KSMbMMmJB9px/fStoFH/PWMuS9fyBbw4Bnu/cclQe7nhD8BO5nCDaQJ3CWEj/8cbiAbwI0JvwU2cwk3kDpw7FY91/BShSoAmpKOJK3knP0l6SwAriXt5xwe6SoAPiWtFgSYVST1JM2KCJfU+wadgFl0/0HGbQAAAABJRU5ErkJggg== -[download-link]: https://mwittrien.github.io/downloader/?plugin=ThemeSettings - -[support-badge]: https://img.shields.io/badge/Support-%2343b581.svg?style=flat&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAC4UlEQVRYR8WXS4jNcRTHP195bEgWkoVsCAspNcVoLGblsaAoFCalBqU8BhuPPDZeQ5LBRmHBYsok7KYor5TyKDI2UiQLZWwojs6d351+85977+93J7q/uqt7Hp/fOed3zvmLzGNm44BWYAUwB5gafm7hc/i9AXqAXkk/c0wrJWRmU4BDwHpgQko+/N8PXAcOS/pSS6cqgJmNBfYBe4HxmY6LYj+AE8BxSb8q2agIEG7dDSwaoeOi2kNgVaVoDAMws7nAHWDaP3JeNvMRWC7pVWx3CEC4+bMM533AE+B5MDYfWADMTEA7RFMciUGAkPPeRNi9svcDnZL+xM7MbBSwCzgG+IupdjwdreWaiAEOAEdqKLrzZknlW1cUNTOPxqMExEFJR91ACSCE/n2i2vdIOpVTF2bWAZysIeuvY4anogxwAdhaQ8FzPjsOu5lNAjYFnSuSvpX1QzreJmqiS9I2hQ73NdFkrknaGDlw5x8iHW880wsQV4ENNS7lOpMdYClwNxHanZLORgBebKcLOrsldUYyO4AzCbvLHOAi0J4QbJd0OTJ+D1iSANgOnEvYveQA94HFCcHvgDv1M7GC80op6AK2JOw+cIB3GQ2kmh1/Oe6oWISjgdfArARAnwM4fb3D5jew0lu2JCs6MbOc8Lvaj5EC9EhygGHHzFqA2yFVqbZRAhhJCtok+TMbPGY2BmgDzie6YKxWSkFOERZvsk7SjehVbA4zwJeXek6pCHOeYdHoWkk3IwCHWVOP5yBbeoY5jahoO6cv5PCUGpGPzlQrLhpL9YUc5wOt2CXNLDWMKhn0ifYSWFieqjleI5mBYRQAvHhS4zi2/wJokdRvZk3A0zohho7jAJFaSGKADkmDw8jMfMtpriMCQxeSAOBreGolK/volrQ66Pm3wqc6umnllSxKRc5S6q34FvA4zPx5mbevvpRGb7pxa3kE4UXZmA+TCKJxn2ZxPhv2cVosqv/1ef4XvUY7+DQzteEAAAAASUVORK5CYII= -[support-link]: https://discord.com/invite/Jx3TjNS - -[paypal-badge]: https://img.shields.io/badge/PayPal-%23003087.svg?style=flat&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAgCAYAAAABtRhCAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAdhwAAHYcBj+XxZQAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAIZSURBVEiJvZa7a1RREIe/CRsIqBBQJEEUO5+YRgSx0JTBwkKwsBMU/4HY2dmKFmm1tRBREEGFYGMhvgolPlBsRBuJj5iIiRvzWWxuOF7v3r2Ld/ODhXNmhvnOzHnshZzU82rTamqqn9XX6jV1XB3K52wrtaHOV4S104J6Ue2vAtz2n7BUt9S+PCNv2FG5HZ11GDi1mkCA052AO2sG7s63tdcV9gON1BDZQA1gFlhTI3AmIgZTQ1rhlpphAFN5Qwqse/8A7uYNaX/r3j+Am9lAHQbmegmcjIhnyfwosLFXwEXgbM52BBhemdl6hOvSeEpSR9QldTYzDNUE+q2eyZer3lj2rwBHa4A9UA8UwE4kMS+yPexm/xZpPRDTwBvgCXA9Ip4XwEaBicT0MHNMlKz8ijrQxYKynMfVn7lcxzLnZAnwYJegEfV2QZ6P6kDW0rJX5lUHwAZgD7CP1l3b2yb0XETMow6WVDedS35Bfbf8+2LrqFfRVVt/DqDuLwm8nwM+qghIdcnk+6aP8hO60s7lFW4va2+iReAOcCgiTkZEM3M0OgBfJuNNwLqCmHvAY+AbMAO8BZ5GxNeihA2qH5iiuO/AWET8Ksnxl/o6ANMKizox1Q0sA65t45sDPiTzov0rvTJFagC7gM0FvoWIMJkXVdg1sLLUTwVHfqxXsPVt7tjWbnP98+3fRkXt/AG8Xy3gEnA5Ipa6Bf4BbzmPtw84RMAAAAAASUVORK5CYII= -[paypal-link]: https://paypal.me/MircoWittrien - -[patreon-badge]: https://img.shields.io/badge/Patreon-%23F96854.svg?style=flat&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAdhwAAHYcBj+XxZQAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAGBSURBVFiF7Za9ThtBFEbPBUpERWMwCorfJjY4aVLxBFHCKyCl4hWQUqVMBULmbfiRCNACqSJsDsXakjHGO8Y7ovFXrmbmO3NnZ74bqrzUeUR8HPP9mdQ60AZawCZQBwK4BC6ADnAUEZeTFhmnsxLjdfVAfXhl/rB66h/1QyUAalu9TzAe1Z26NROAutvf0VvVU7+/CUD9PKP5MMT2VADqhvqvAvOB7tQ1gIXXznpEP4HlxLEpWgH2AEInX0OLv/cUWKwQAKALbKZU4EsGc4AloJ0C8CmD+UDNFIBGRoBGCkAtI8B66i3IpccUgJuMANcpAKcZAc5SAE4yAnRSAA6BXgbzLnBUChARF8DvDAC/IuIqNYzqFYfRrVqDxDCKiL/AV6o5ikdgJyJuBrsrrcBQJX44W0/QVb+NLpoM0B/f6pdwWt2qL3NlWoD+nFV1X/2fYPxg0cCOfdJL+4ESkBqwDTQpQmuNoi2/onjAOsBxRFxPWmTqClSp9w6jOcAcYA7AE1OMk5ulhBZCAAAAAElFTkSuQmCC -[patreon-link]: https://patreon.com/MircoWittrien - -Allows you to change Theme Variables within Discord - - -![cover](https://mwittrien.github.io/BetterDiscordAddons/Plugins/ThemeSettings/_res/cover.png) - -![screenshot1](https://mwittrien.github.io/BetterDiscordAddons/Plugins/ThemeSettings/_res/screenshot1.png) \ No newline at end of file diff --git a/Plugins/ThemeSettings/ThemeSettings.plugin.js b/Plugins/ThemeSettings/ThemeSettings.plugin.js deleted file mode 100644 index 936fcfa6ba..0000000000 --- a/Plugins/ThemeSettings/ThemeSettings.plugin.js +++ /dev/null @@ -1,269 +0,0 @@ -/** - * @name ThemeSettings - * @author DevilBro - * @authorId 278543574059057154 - * @version 1.3.5 - * @description Allows you to change Theme Variables within Discord - * @invite Jx3TjNS - * @donate https://www.paypal.me/MircoWittrien - * @patreon https://www.patreon.com/MircoWittrien - * @website https://mwittrien.github.io/ - * @source https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/ThemeSettings/ - * @updateUrl https://mwittrien.github.io/BetterDiscordAddons/Plugins/ThemeSettings/ThemeSettings.plugin.js - */ - -module.exports = (_ => { - const changeLog = { - improved: { - "Changed Location": "Due to the new Plugin Guidelines, which forbid changes to BDs Plugin/Themes Pages, the option to change the variables for Themes are now inside the Plugin Settings of 'ThemeSettings'" - } - }; - - return !window.BDFDB_Global || (!window.BDFDB_Global.loaded && !window.BDFDB_Global.started) ? class { - constructor (meta) {for (let key in meta) this[key] = meta[key];} - getName () {return this.name;} - getAuthor () {return this.author;} - getVersion () {return this.version;} - getDescription () {return `The Library Plugin needed for ${this.name} is missing. Open the Plugin Settings to download it. \n\n${this.description}`;} - - downloadLibrary () { - require("request").get("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js", (e, r, b) => { - if (!e && b && r.statusCode == 200) require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => BdApi.showToast("Finished downloading BDFDB Library", {type: "success"})); - else BdApi.alert("Error", "Could not download BDFDB Library Plugin. Try again later or download it manually from GitHub: https://mwittrien.github.io/downloader/?library"); - }); - } - - load () { - if (!window.BDFDB_Global || !Array.isArray(window.BDFDB_Global.pluginQueue)) window.BDFDB_Global = Object.assign({}, window.BDFDB_Global, {pluginQueue: []}); - if (!window.BDFDB_Global.downloadModal) { - window.BDFDB_Global.downloadModal = true; - BdApi.showConfirmationModal("Library Missing", `The Library Plugin needed for ${this.name} is missing. Please click "Download Now" to install it.`, { - confirmText: "Download Now", - cancelText: "Cancel", - onCancel: _ => {delete window.BDFDB_Global.downloadModal;}, - onConfirm: _ => { - delete window.BDFDB_Global.downloadModal; - this.downloadLibrary(); - } - }); - } - if (!window.BDFDB_Global.pluginQueue.includes(this.name)) window.BDFDB_Global.pluginQueue.push(this.name); - } - start () {this.load();} - stop () {} - getSettingsPanel () { - let template = document.createElement("template"); - template.innerHTML = `
The Library Plugin needed for ${this.name} is missing.\nPlease click Download Now to install it.
`; - template.content.firstElementChild.querySelector("a").addEventListener("click", this.downloadLibrary); - return template.content.firstElementChild; - } - } : (([Plugin, BDFDB]) => { - var dir; - - return class ThemeSettings extends Plugin { - onLoad () { - dir = BDFDB.BDUtils.getThemesFolder(); - - this.css = ` - ${BDFDB.dotCN._themesettingsgrid} { - display: grid; - grid-template-columns: 50% auto; - } - ${BDFDB.dotCN._themesettingscard} { - display: flex; - align-items: center; - padding: 10px; - } - ${BDFDB.dotCN._themesettingscardname} { - flex: 1 1 auto; - margin-right: 10px; - } - `; - } - - onStart () {} - - onStop () {} - - getSettingsPanel () { - let themes = window.BdApi && BdApi.Themes && BdApi.Themes.getAll && BdApi.Themes.getAll().map(theme => { - let css = theme.css.replace(/\r/g, ""); - let imports = css.split("\n@import url(").splice(1).map(n => [n.split(");")[0], true]).concat(css.split("\n/* @import url(").splice(1).map(n => [n.split("); */")[0], false])); - let vars = css.split(":root"); - if (vars.length > 1) { - vars = vars[1].replace(/\t\(/g, " (").replace(/\t| {2,}/g, "").replace(/\/\*\n*((?!\/\*|\*\/).|\n)*\n+((?!\/\*|\*\/).|\n)*\n*\*\//g, "").replace(/\n\/\*.*?\*\//g, "").replace(/\n/g, ""); - vars = vars.split("{"); - vars.shift(); - vars = vars.join("{").replace(/\s*(:|;|--|\*)\s*/g, "$1"); - vars = vars.split("}")[0]; - vars = (vars.endsWith(";") ? vars.slice(0, -1) : vars).slice(2).split(/;--|\*\/--/); - } - else vars = []; - - if (imports.length || vars.length) return {data: theme, imports, vars}; - }).filter(n => n); - return themes && themes.length && BDFDB.ReactUtils.createElement("div", { - className: BDFDB.disCN._themesettingsgrid, - children: themes.map(theme => BDFDB.ReactUtils.createElement("div", { - className: BDFDB.disCN._themesettingscard, - children: [ - BDFDB.ReactUtils.createElement("div", { - className: BDFDB.disCN._themesettingscardname, - children: theme.data.name - }), - BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Button, { - size: BDFDB.LibraryComponents.Button.Sizes.SMALL, - children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Flex, { - align: BDFDB.LibraryComponents.Flex.Align.CENTER, - children: [ - BDFDB.ReactUtils.createElement("div", { - children: "Edit" - }), - BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SvgIcon, { - className: BDFDB.disCN.marginleft4, - name: BDFDB.LibraryComponents.SvgIcon.Names.PENCIL - }) - ] - }), - onClick: _ => { - let importInstances = {}, inputInstances = {}; - BDFDB.ModalUtils.open(this, { - header: `${theme.data.name} ${BDFDB.LanguageUtils.LanguageStrings.SETTINGS}`, - subHeader: "", - size: "MEDIUM", - children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsPanel, { - addon: theme.data, - children: _ => { - let settingsItems = []; - - let varInputs = []; - for (let i in theme.vars) { - let varStr = theme.vars[i].split(":"); - let varName = varStr.shift().trim(); - varStr = varStr.join(":").split(/;[^A-z0-9]|\/\*/); - let varValue = varStr.shift().trim(); - if (varValue) { - let childType = "text", childMode = ""; - let isColor = BDFDB.ColorUtils.getType(varValue); - let isComp = !isColor && /^[0-9 ]+,[0-9 ]+,[0-9 ]+$/g.test(varValue); - if (isColor || isComp) { - childType = "color"; - childMode = isComp && "comp"; - } - else { - let isUrlFile = /url\(.+\)/gi.test(varValue); - let isFile = !isUrlFile && /(http(s)?):\/\/[(www\.)?a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)/.test(varValue); - if (isFile || isUrlFile) { - childType = "file"; - childMode = isUrlFile && "url"; - } - } - let varDescription = varStr.join("").replace(/\*\/|\/\*/g, "").replace(/:/g, ": ").replace(/: \//g, ":/").replace(/--/g, " --").replace(/\( --/g, "(--").trim(); - varInputs.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsItem, { - type: "TextInput", - margin: 8, - childProps: { - type: childType, - mode: childMode, - filter: childType == "file" && "image", - ref: instance => {if (instance) inputInstances[i] = instance;} - }, - label: varName.split("-").map(BDFDB.StringUtils.upperCaseFirstChar).join(" "), - note: varDescription && varDescription.indexOf("*") == 0 ? varDescription.slice(1) : varDescription, - basis: "70%", - name: varName, - value: varValue, - oldValue: varValue, - defaultValue: varValue, - placeholder: varValue - })); - } - }; - - if (theme.imports.length) settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsPanelList, { - title: "Imports:", - dividerBottom: varInputs.length, - children: theme.imports.map((impo, i) => { - let name = impo[0].split("/").pop().replace(/"/g, ""); - return BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsItem, { - type: "Switch", - margin: 8, - childProps: {ref: instance => {if (instance) importInstances[i] = instance;}}, - label: name[0].toUpperCase() + name.slice(1), - note: impo[0].replace(/"/g, ""), - name: impo[0], - value: impo[1], - oldValue: impo[1].toString(), - defaultValue: impo[1].toString() - }); - }) - })); - if (varInputs.length) settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsPanelList, { - title: "Variables:", - children: varInputs - })); - - return settingsItems; - } - }), - buttons: [{ - contents: BDFDB.LanguageUtils.LanguageStrings.SAVE, - color: "BRAND", - onClick: _ => this.updateTheme(theme.data, {imports: importInstances, inputs: inputInstances}, false) - }, { - contents: BDFDB.LanguageUtils.LanguageStrings.RESET, - look: "LINK", - onClick: _ => this.updateTheme(theme.data, {imports: importInstances, inputs: inputInstances}, true) - }] - }); - } - }) - ] - })) - }); - } - - updateTheme (theme, instances, reset) { - let path = BDFDB.LibraryRequires.path.join(dir, theme.filename); - let css = BDFDB.LibraryRequires.fs.readFileSync(path).toString(); - if (css) { - let amount = 0; - for (let i in instances.imports) { - let input = instances.imports[i]; - let oldValue = input.props.oldValue; - let newValue = reset ? input.props.defaultValue : input.props.value; - if (newValue.toString() != oldValue.toString()) { - let trueValue = typeof newValue == "string" ? newValue == "true" : newValue; - let importUrl = input.props.name; - if (trueValue) css = css.replace(new RegExp(`\\n${BDFDB.StringUtils.regEscape("/* @import url(" + importUrl + "); */")}`, "g"), `\n@import url(${importUrl});`); - else css = css.replace(new RegExp(`\\n${BDFDB.StringUtils.regEscape("@import url(" + importUrl + ");")}`, "g"), `\n/* @import url(${importUrl}); */`); - input.props.value = trueValue; - input.props.oldValue = newValue; - amount++; - } - } - for (let i in instances.inputs) { - let input = instances.inputs[i]; - let oldValue = input.props.oldValue; - let newValue = reset ? input.props.defaultValue : input.props.value; - if (newValue && newValue.trim() && newValue != oldValue) { - let varName = input.props.name; - css = css.replace(new RegExp(`--${BDFDB.StringUtils.regEscape(varName)}(\\s*):(\\s*)${BDFDB.StringUtils.regEscape(oldValue)}`,"g"), `--${varName}$1: $2${newValue}`); - input.props.value = newValue; - input.props.oldValue = newValue; - input.props.placeholder = newValue; - amount++; - } - } - if (amount > 0) { - BDFDB.ReactUtils.forceUpdate(BDFDB.ObjectUtils.toArray(instances.imports), BDFDB.ObjectUtils.toArray(instances.inputs)); - BDFDB.LibraryRequires.fs.writeFileSync(path, css); - BDFDB.NotificationUtils.toast(`Updated ${amount} Variable${amount == 1 ? "" : "s"} in '${theme.filename}'`, {type: "success"}); - } - else BDFDB.NotificationUtils.toast(`There are no changed Variables to be updated in '${theme.filename}'`, {type: "warning"}); - } - else BDFDB.NotificationUtils.toast(`Could not find Theme File '${theme.filename}'`, {type: "danger"}); - } - }; - })(window.BDFDB_Global.PluginUtils.buildPlugin(changeLog)); -})(); \ No newline at end of file diff --git a/Plugins/ThemeSettings/_res/cover.png b/Plugins/ThemeSettings/_res/cover.png deleted file mode 100644 index cd508b55b1..0000000000 Binary files a/Plugins/ThemeSettings/_res/cover.png and /dev/null differ diff --git a/Plugins/ThemeSettings/_res/screenshot1.png b/Plugins/ThemeSettings/_res/screenshot1.png deleted file mode 100644 index f7845f9e2b..0000000000 Binary files a/Plugins/ThemeSettings/_res/screenshot1.png and /dev/null differ diff --git a/_DEAD/ThemeSettings.plugin.js b/_DEAD/ThemeSettings.plugin.js new file mode 100644 index 0000000000..923c739631 --- /dev/null +++ b/_DEAD/ThemeSettings.plugin.js @@ -0,0 +1,74 @@ +/** + * @name ThemeSettings + * @author DevilBro + * @authorId 278543574059057154 + * @version 9.9.9 + * @description PLUGIN WAS DISCONTINUED + */ + +module.exports = (_ => { + const changeLog = {}; + + return !window.BDFDB_Global || (!window.BDFDB_Global.loaded && !window.BDFDB_Global.started) ? class { + constructor (meta) {for (let key in meta) this[key] = meta[key];} + getName () {return this.name;} + getAuthor () {return this.author;} + getVersion () {return this.version;} + getDescription () {return `The Library Plugin needed for ${this.name} is missing. Open the Plugin Settings to download it. \n\n${this.description}`;} + + downloadLibrary () { + require("request").get("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js", (e, r, b) => { + if (!e && b && r.statusCode == 200) require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => BdApi.showToast("Finished downloading BDFDB Library", {type: "success"})); + else BdApi.alert("Error", "Could not download BDFDB Library Plugin. Try again later or download it manually from GitHub: https://mwittrien.github.io/downloader/?library"); + }); + } + + load () { + if (!window.BDFDB_Global || !Array.isArray(window.BDFDB_Global.pluginQueue)) window.BDFDB_Global = Object.assign({}, window.BDFDB_Global, {pluginQueue: []}); + if (!window.BDFDB_Global.downloadModal) { + window.BDFDB_Global.downloadModal = true; + BdApi.showConfirmationModal("Library Missing", `The Library Plugin needed for ${this.name} is missing. Please click "Download Now" to install it.`, { + confirmText: "Download Now", + cancelText: "Cancel", + onCancel: _ => {delete window.BDFDB_Global.downloadModal;}, + onConfirm: _ => { + delete window.BDFDB_Global.downloadModal; + this.downloadLibrary(); + } + }); + } + if (!window.BDFDB_Global.pluginQueue.includes(this.name)) window.BDFDB_Global.pluginQueue.push(this.name); + } + start () {this.load();} + stop () {} + getSettingsPanel () { + let template = document.createElement("template"); + template.innerHTML = `
The Library Plugin needed for ${this.name} is missing.\nPlease click Download Now to install it.
`; + template.content.firstElementChild.querySelector("a").addEventListener("click", this.downloadLibrary); + return template.content.firstElementChild; + } + } : (([Plugin, BDFDB]) => { + return class ThemeSettings extends Plugin { + onLoad () {} + + onStart () { + BDFDB.ModalUtils.open(this, { + header: "PLUGIN WAS DISCONTINUED", + children: [ + BDFDB.ReactUtils.createElement("span", {children: "BETTERDISCORD DEVS ARE WORKING ON A NATIVE IMPLEMENTATION OF SETTINGS FOR THEMES, THAT'S WHY I DECIDED TO ALREADY DROP THEMESETTINGS, HAVING TO FIX ONE LESS PLUGIN"}), + BDFDB.ReactUtils.createElement("strong", {children: "DELETE"}), + BDFDB.ReactUtils.createElement("span", {children: " TO REMOVE THIS EMPTY PLUGIN FILE."}) + ], + buttons: [ + {contents: "DELETE", close: true, color: "RED", onClick: _ => { + BDFDB.LibraryRequires.fs.unlink(BDFDB.LibraryRequires.path.join(BDFDB.BDUtils.getPluginsFolder(), "ThemeSettings.plugin.js"), error => {}); + BDFDB.LibraryRequires.fs.unlink(BDFDB.LibraryRequires.path.join(BDFDB.BDUtils.getPluginsFolder(), "ThemeSettings.config.json"), error => {}); + }} + ] + }); + } + + onStop () {} + }; + })(window.BDFDB_Global.PluginUtils.buildPlugin(changeLog)); +})();