From 62e877149598d9380f1b9e98148941ce402be880 Mon Sep 17 00:00:00 2001 From: Zack Rauen Date: Thu, 27 Jun 2019 01:44:50 -0400 Subject: [PATCH] plugin card partial rewrite --- css/main.css | 5 +- js/main.js | 4 +- src/ui/settings/plugincard.js | 143 +++++++++++++++++----------------- src/ui/settings/themecard.js | 4 +- 4 files changed, 79 insertions(+), 77 deletions(-) diff --git a/css/main.css b/css/main.css index 45fada6e..f29453c9 100644 --- a/css/main.css +++ b/css/main.css @@ -178,7 +178,10 @@ padding: 2px 10px; } - +.settings-open .bd-close { + cursor: pointer; + float: right; +} diff --git a/js/main.js b/js/main.js index bed2cefd..5a15ea3a 100644 --- a/js/main.js +++ b/js/main.js @@ -911,7 +911,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) * /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"default\", function() { return PluginCard; });\n/* harmony import */ var modules__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! modules */ \"./src/modules/modules.js\");\n/* harmony import */ var _icons_close__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../icons/close */ \"./src/ui/icons/close.jsx\");\n/* harmony import */ var _icons_reload__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../icons/reload */ \"./src/ui/icons/reload.jsx\");\n// import {SettingsCookie, PluginCookie, Plugins} from \"data\";\n\n\n\nclass PluginCard extends modules__WEBPACK_IMPORTED_MODULE_0__[\"React\"].Component {\n constructor(props) {\n super(props);\n this.onChange = this.onChange.bind(this);\n this.showSettings = this.showSettings.bind(this);\n this.state = {\n checked: this.props.enabled,\n //PluginManager.isEnabled(this.props.content.id),\n settingsOpen: false\n };\n this.hasSettings = typeof this.props.content.plugin.getSettingsPanel === \"function\";\n this.settingsPanel = \"\";\n this.panelRef = modules__WEBPACK_IMPORTED_MODULE_0__[\"React\"].createRef();\n this.reload = this.reload.bind(this); // this.onReload = this.onReload.bind(this);\n }\n\n reload() {\n if (!this.props.reload) return;\n this.props.content = this.props.reload(this.props.content.id);\n this.forceUpdate();\n }\n\n componentDidUpdate() {\n if (this.state.settingsOpen) {\n if (this.settingsPanel instanceof Node) {\n this.panelRef.current.appendChild(this.settingsPanel);\n } // if (!SettingsCookie[\"fork-ps-3\"]) return;\n\n\n const isHidden = (container, element) => {\n const cTop = container.scrollTop;\n const cBottom = cTop + container.clientHeight;\n const eTop = element.offsetTop;\n const eBottom = eTop + element.clientHeight;\n return eTop < cTop || eBottom > cBottom;\n };\n\n const panel = $(this.panelRef.current);\n const container = panel.parents(\".scroller-2FKFPG\");\n if (!isHidden(container[0], panel[0])) return;\n container.animate({\n scrollTop: panel.offset().top - container.offset().top + container.scrollTop() - 30\n }, 300);\n }\n }\n\n getString(value) {\n return typeof value == \"string\" ? value : value.toString();\n }\n\n buildTitle(name, version, author) {\n const title = modules__WEBPACK_IMPORTED_MODULE_0__[\"Strings\"].Addons.title.split(/({{[A-Za-z]+}})/);\n const nameIndex = title.findIndex(s => s == \"{{name}}\");\n if (nameIndex) title[nameIndex] = modules__WEBPACK_IMPORTED_MODULE_0__[\"React\"].createElement(\"span\", {\n className: \"bda-name\"\n }, name);\n const versionIndex = title.findIndex(s => s == \"{{version}}\");\n if (nameIndex) title[versionIndex] = modules__WEBPACK_IMPORTED_MODULE_0__[\"React\"].createElement(\"span\", {\n className: \"bda-version\"\n }, version);\n const authorIndex = title.findIndex(s => s == \"{{author}}\");\n if (nameIndex) title[authorIndex] = modules__WEBPACK_IMPORTED_MODULE_0__[\"React\"].createElement(\"span\", {\n className: \"bda-author\"\n }, author);\n return title.flat();\n }\n\n render() {\n const {\n content\n } = this.props;\n const name = this.getString(content.name);\n const author = this.getString(content.author);\n const description = this.getString(content.description);\n const version = this.getString(content.version);\n const website = content.website;\n const source = content.source;\n\n if (this.state.settingsOpen) {\n try {\n this.settingsPanel = content.plugin.getSettingsPanel();\n } catch (err) {\n modules__WEBPACK_IMPORTED_MODULE_0__[\"Logger\"].stacktrace(\"Plugin Settings\", \"Unable to get settings panel for \" + content.name + \".\", err);\n }\n\n const props = {\n id: `plugin-settings-${name}`,\n className: \"plugin-settings\",\n ref: this.panelRef\n };\n if (typeof this.settingsPanel == \"string\") props.dangerouslySetInnerHTML = this.settingsPanel;\n return modules__WEBPACK_IMPORTED_MODULE_0__[\"React\"].createElement(\"li\", {\n className: \"settings-open ui-switch-item\"\n }, modules__WEBPACK_IMPORTED_MODULE_0__[\"React\"].createElement(\"div\", {\n style: {\n \"float\": \"right\",\n \"cursor\": \"pointer\"\n },\n onClick: () => {\n this.panelRef.current.innerHTML = \"\";\n this.setState({\n settingsOpen: false\n });\n }\n }, modules__WEBPACK_IMPORTED_MODULE_0__[\"React\"].createElement(_icons_close__WEBPACK_IMPORTED_MODULE_1__[\"default\"], null)), modules__WEBPACK_IMPORTED_MODULE_0__[\"React\"].createElement(\"div\", props, this.settingsPanel instanceof modules__WEBPACK_IMPORTED_MODULE_0__[\"React\"].Component ? this.settingsPanel : null));\n }\n\n return modules__WEBPACK_IMPORTED_MODULE_0__[\"React\"].createElement(\"li\", {\n \"data-name\": name,\n \"data-version\": version,\n \"className\": \"settings-closed ui-switch-item\"\n }, modules__WEBPACK_IMPORTED_MODULE_0__[\"React\"].createElement(\"div\", {\n className: \"bda-header\"\n }, modules__WEBPACK_IMPORTED_MODULE_0__[\"React\"].createElement(\"span\", {\n className: \"bda-header-title\"\n }, this.buildTitle(name, version, author)), modules__WEBPACK_IMPORTED_MODULE_0__[\"React\"].createElement(\"div\", {\n className: \"bda-controls\"\n }, !modules__WEBPACK_IMPORTED_MODULE_0__[\"Settings\"].get(\"settings\", \"addons\", \"autoReload\") && modules__WEBPACK_IMPORTED_MODULE_0__[\"React\"].createElement(_icons_reload__WEBPACK_IMPORTED_MODULE_2__[\"default\"], {\n className: \"bd-reload bd-reload-card\",\n onClick: this.reload\n }), modules__WEBPACK_IMPORTED_MODULE_0__[\"React\"].createElement(\"label\", {\n className: \"ui-switch-wrapper ui-flex-child\",\n style: {\n flex: \"0 0 auto\"\n }\n }, modules__WEBPACK_IMPORTED_MODULE_0__[\"React\"].createElement(\"input\", {\n checked: this.state.checked,\n onChange: this.onChange,\n className: \"ui-switch-checkbox\",\n type: \"checkbox\"\n }), modules__WEBPACK_IMPORTED_MODULE_0__[\"React\"].createElement(\"div\", {\n className: this.state.checked ? \"ui-switch checked\" : \"ui-switch\"\n })))), modules__WEBPACK_IMPORTED_MODULE_0__[\"React\"].createElement(\"div\", {\n className: \"bda-description-wrap scroller-wrap fade\"\n }, modules__WEBPACK_IMPORTED_MODULE_0__[\"React\"].createElement(\"div\", {\n className: \"bda-description scroller\"\n }, description)), (website || source || this.hasSettings) && modules__WEBPACK_IMPORTED_MODULE_0__[\"React\"].createElement(\"div\", {\n className: \"bda-footer\"\n }, modules__WEBPACK_IMPORTED_MODULE_0__[\"React\"].createElement(\"span\", {\n className: \"bda-links\"\n }, website && modules__WEBPACK_IMPORTED_MODULE_0__[\"React\"].createElement(\"a\", {\n className: \"bda-link bda-link-website\",\n href: website,\n target: \"_blank\"\n }, modules__WEBPACK_IMPORTED_MODULE_0__[\"Strings\"].Addons.website), website && source && \" | \", source && modules__WEBPACK_IMPORTED_MODULE_0__[\"React\"].createElement(\"a\", {\n className: \"bda-link bda-link-source\",\n href: source,\n target: \"_blank\"\n }, modules__WEBPACK_IMPORTED_MODULE_0__[\"Strings\"].Addons.source)), this.hasSettings && modules__WEBPACK_IMPORTED_MODULE_0__[\"React\"].createElement(\"button\", {\n onClick: this.showSettings,\n className: \"bd-button bd-button-plugin-settings\",\n disabled: !this.state.checked\n }, modules__WEBPACK_IMPORTED_MODULE_0__[\"Strings\"].Addons.pluginSettings)));\n }\n\n onChange() {\n this.setState({\n checked: !this.state.checked\n });\n this.props.onChange && this.props.onChange(this.props.content.id);\n }\n\n showSettings() {\n if (!this.hasSettings) return;\n this.setState({\n settingsOpen: true\n });\n }\n\n}//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly9Db3JlLy4vc3JjL3VpL3NldHRpbmdzL3BsdWdpbmNhcmQuanM/NzczZCJdLCJuYW1lcyI6WyJQbHVnaW5DYXJkIiwiUmVhY3QiLCJDb21wb25lbnQiLCJjb25zdHJ1Y3RvciIsInByb3BzIiwib25DaGFuZ2UiLCJiaW5kIiwic2hvd1NldHRpbmdzIiwic3RhdGUiLCJjaGVja2VkIiwiZW5hYmxlZCIsInNldHRpbmdzT3BlbiIsImhhc1NldHRpbmdzIiwiY29udGVudCIsInBsdWdpbiIsImdldFNldHRpbmdzUGFuZWwiLCJzZXR0aW5nc1BhbmVsIiwicGFuZWxSZWYiLCJjcmVhdGVSZWYiLCJyZWxvYWQiLCJpZCIsImZvcmNlVXBkYXRlIiwiY29tcG9uZW50RGlkVXBkYXRlIiwiTm9kZSIsImN1cnJlbnQiLCJhcHBlbmRDaGlsZCIsImlzSGlkZGVuIiwiY29udGFpbmVyIiwiZWxlbWVudCIsImNUb3AiLCJzY3JvbGxUb3AiLCJjQm90dG9tIiwiY2xpZW50SGVpZ2h0IiwiZVRvcCIsIm9mZnNldFRvcCIsImVCb3R0b20iLCJwYW5lbCIsIiQiLCJwYXJlbnRzIiwiYW5pbWF0ZSIsIm9mZnNldCIsInRvcCIsImdldFN0cmluZyIsInZhbHVlIiwidG9TdHJpbmciLCJidWlsZFRpdGxlIiwibmFtZSIsInZlcnNpb24iLCJhdXRob3IiLCJ0aXRsZSIsIlN0cmluZ3MiLCJBZGRvbnMiLCJzcGxpdCIsIm5hbWVJbmRleCIsImZpbmRJbmRleCIsInMiLCJjcmVhdGVFbGVtZW50IiwiY2xhc3NOYW1lIiwidmVyc2lvbkluZGV4IiwiYXV0aG9ySW5kZXgiLCJmbGF0IiwicmVuZGVyIiwiZGVzY3JpcHRpb24iLCJ3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bnQpID0+IHtcclxuXHJcbiAgICAgICAgICAgICAgICBjb25zdCBjVG9wID0gY29udGFpbmVyLnNjcm9sbFRvcDtcclxuICAgICAgICAgICAgICAgIGNvbnN0IGNCb3R0b20gPSBjVG9wICsgY29udGFpbmVyLmNsaWVudEhlaWdodDtcclxuXHJcbiAgICAgICAgICAgICAgICBjb25zdCBlVG9wID0gZWxlbWVudC5vZmZzZXRUb3A7XHJcbiAgICAgICAgICAgICAgICBjb25zdCBlQm90dG9tID0gZVRvcCArIGVsZW1lbnQuY2xpZW50SGVpZ2h0O1xyXG5cclxuICAgICAgICAgICAgICAgIHJldHVybiAgKGVUb3AgPCBjVG9wIHx8IGVCb3R0b20gPiBjQm90dG9tKTtcclxuICAgICAgICAgICAgfTtcclxuXHJcbiAgICAgICAgICAgIGNvbnN0IHBhbmVsID0gJCh0aGlzLnBhbmVsUmVmLmN1cnJlbnQpO1xyXG4gICAgICAgICAgICBjb25zdCBjb250YWluZXIgPSBwYW5lbC5wYXJlbnRzKFwiLnNjcm9sbGVyLTJGS0ZQR1wiKTtcclxuICAgICAgICAgICAgaWYgKCFpc0hpZGRlbihjb250YWluZXJbMF0sIHBhbmVsWzBdKSkgcmV0dXJuO1xyXG4gICAgICAgICAgICBjb250YWluZXIuYW5pbWF0ZSh7XHJcbiAgICAgICAgICAgICAgICBzY3JvbGxUb3A6IHBhbmVsLm9mZnNldCgpLnRvcCAtIGNvbnRhaW5lci5vZmZzZXQoKS50b3AgKyBjb250YWluZXIuc2Nyb2xsVG9wKCkgLSAzMFxyXG4gICAgICAgICAgICB9LCAzMDApO1xyXG4gICAgICAgIH1cclxuICAgIH1cclxuXHJcbiAgICBnZXRTdHJpbmcodmFsdWUpIHtcclxuICAgICAgICByZXR1cm4gdHlwZW9mIHZhbHVlID09IFwic3RyaW5nXCIgPyB2YWx1ZSA6IHZhbHVlLnRvU3RyaW5nKCk7XHJcbiAgICB9XHJcblxyXG4gICAgYnVpbGRUaXRsZShuYW1lLCB2ZXJ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XRlbVwifSxcclxuICAgICAgICAgICAgICAgICAgICBSZWFjdC5jcmVhdGVFbGVtZW50KFwiZGl2XCIsIHtzdHlsZToge1wiZmxvYXRcIjogXCJyaWdodFwiLCBcImN1cnNvclwiOiBcInBvaW50ZXJcIn0sIG9uQ2xpY2s6ICgpID0+IHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMucGFuZWxSZWYuY3VycmVudC5pbm5lckhUTUwgPSBcIlwiO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5zZXRTdGF0ZSh7c2V0dGluZ3NPcGVuOiBmYWxzZX0pO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB9fSxcclxuICAgICAgICAgICAgICAgICAgICBSZWFjdC5jcmVhdGVFbGVtZW50KENsb3NlQnV0dG9uLCBudWxsKVxyXG4gICAgICAgICAgICAgICAgKSxcclxuICAgICAgICAgICAgICAgIFJlYWN0LmNyZWF0ZUVsZW1lbnQoXCJkaXZcIiwgcHJvcHMsIHRoaXMuc2V0dGluZ3NQYW5lbCBpbnN0YW5jZW9mIFJlYWN0LkNvbXBvbmVudCA/IHRoaXMuc2V0dGluZ3NQYW5lbCA6IG51bGwpLFxyXG4gICAgICAgICAgICAgICAgKTtcclxuICAgICAgICB9XHJcblxyXG4gICAgICAgIHJldHVybiBSZWFjdC5jcmVhdGVFbGVtZW50KFwibGlcIiwge1wiZGF0YS1uYW1lXCI6IG5hbWUsIFwiZGF0YS12ZXJzaW9uXCI6IHZlcnNpb24sIFwiY2xhc3NOYW1lXCI6IFwic2V0dGluZ3MtY2xvc2VkIHVpLXN3aXRjaC1pdGVtXCJ9LFxyXG4gICAgICAgICAgICBSZWFjdC5jcmVhdGVFbGVtZW50KFwiZGl2XCIsIHtjbGFzc05hbWU6IFwiYmRhLWhlYWRlclwifSxcclxuICAgICAgICAgICAgICAgICAgICBSZWFjdC5jcmVhdGVFbGVtZW50KFwic3BhblwiLCB7Y2xhc3NOYW1lOiBcImJk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mluZ3MuQWRkb25zLnNvdXJjZSlcclxuICAgICAgICAgICAgICAgICksXHJcbiAgICAgICAgICAgICAgICB0aGlzLmhhc1NldHRpbmdzICYmIFJlYWN0LmNyZWF0ZUVsZW1lbnQoXCJidXR0b25cIiwge29uQ2xpY2s6IHRoaXMuc2hvd1NldHRpbmdzLCBjbGFzc05hbWU6IFwiYmQtYnV0dG9uIGJkLWJ1dHRvbi1wbHVnaW4tc2V0dGluZ3NcIiwgZGlzYWJsZWQ6ICF0aGlzLnN0YXRlLmNoZWNrZWR9LCBTdHJpbmdzLkFkZG9ucy5wbHVnaW5TZXR0aW5ncylcclxuICAgICAgICAgICAgKVxyXG4gICAgICAgICk7XHJcbiAgICB9XHJcblxyXG4gICAgb25DaGFuZ2UoKSB7XHJcbiAgICAgICAgdGhpcy5zZXRTdGF0ZSh7Y2hlY2tlZDogIXRoaXMuc3RhdGUuY2hlY2tlZH0pO1xyXG4gICAgICAgIHRoaXMucHJvcHMub25DaGFuZ2UgJiYgdGhpcy5wcm9wcy5vbkNoYW5nZSh0aGlzLnByb3BzLmNvbnRlbnQuaWQpO1xyXG4gICAgfVxyXG5cclxuICAgIHNob3dTZXR0aW5ncygpIHtcclxuICAgICAgICBpZiAoIXRoaXMuaGFzU2V0dGluZ3MpIHJldHVybjtcclxuICAgICAgICB0aGlzLnNldFN0YXRlKHtzZXR0aW5nc09wZW46IHRydWV9KTtcclxuICAgIH1cclxufSJdLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///./src/ui/settings/plugincard.js\n"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"default\", function() { return PluginCard; });\n/* harmony import */ var modules__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! modules */ \"./src/modules/modules.js\");\n/* harmony import */ var _icons_close__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../icons/close */ \"./src/ui/icons/close.jsx\");\n/* harmony import */ var _icons_reload__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../icons/reload */ \"./src/ui/icons/reload.jsx\");\n\n\n\nclass PluginCard extends modules__WEBPACK_IMPORTED_MODULE_0__[\"React\"].Component {\n constructor(props) {\n super(props);\n this.onChange = this.onChange.bind(this);\n this.showSettings = this.showSettings.bind(this);\n this.state = {\n checked: this.props.enabled,\n settingsOpen: false\n };\n this.hasSettings = typeof this.props.content.plugin.getSettingsPanel === \"function\";\n this.settingsPanel = \"\";\n this.panelRef = modules__WEBPACK_IMPORTED_MODULE_0__[\"React\"].createRef();\n this.reload = this.reload.bind(this); // this.onReload = this.onReload.bind(this);\n\n this.closeSettings = this.closeSettings.bind(this);\n }\n\n reload() {\n if (!this.props.reload) return;\n this.props.content = this.props.reload(this.props.content.id);\n this.forceUpdate();\n }\n\n componentDidUpdate() {\n if (!this.state.settingsOpen) return;\n if (this.settingsPanel instanceof Node) this.panelRef.current.appendChild(this.settingsPanel); // if (!SettingsCookie[\"fork-ps-3\"]) return;\n\n const isHidden = (container, element) => {\n const cTop = container.scrollTop;\n const cBottom = cTop + container.clientHeight;\n const eTop = element.offsetTop;\n const eBottom = eTop + element.clientHeight;\n return eTop < cTop || eBottom > cBottom;\n };\n\n const panel = $(this.panelRef.current);\n const container = panel.parents(\".scroller-2FKFPG\");\n if (!isHidden(container[0], panel[0])) return;\n container.animate({\n scrollTop: panel.offset().top - container.offset().top + container.scrollTop() - 30\n }, 300);\n }\n\n getString(value) {\n return typeof value == \"string\" ? value : value.toString();\n }\n\n closeSettings() {\n this.panelRef.current.innerHTML = \"\";\n this.setState({\n settingsOpen: false\n });\n }\n\n buildTitle(name, version, author) {\n const title = modules__WEBPACK_IMPORTED_MODULE_0__[\"Strings\"].Addons.title.split(/({{[A-Za-z]+}})/);\n const nameIndex = title.findIndex(s => s == \"{{name}}\");\n if (nameIndex) title[nameIndex] = modules__WEBPACK_IMPORTED_MODULE_0__[\"React\"].createElement(\"span\", {\n className: \"bda-name\"\n }, name);\n const versionIndex = title.findIndex(s => s == \"{{version}}\");\n if (nameIndex) title[versionIndex] = modules__WEBPACK_IMPORTED_MODULE_0__[\"React\"].createElement(\"span\", {\n className: \"bda-version\"\n }, version);\n const authorIndex = title.findIndex(s => s == \"{{author}}\");\n if (nameIndex) title[authorIndex] = modules__WEBPACK_IMPORTED_MODULE_0__[\"React\"].createElement(\"span\", {\n className: \"bda-author\"\n }, author);\n return title.flat();\n }\n\n get settingsComponent() {\n const content = this.props.content;\n const name = this.getString(content.name);\n\n try {\n this.settingsPanel = content.plugin.getSettingsPanel();\n } catch (err) {\n modules__WEBPACK_IMPORTED_MODULE_0__[\"Logger\"].stacktrace(\"Plugin Settings\", \"Unable to get settings panel for \" + name + \".\", err);\n }\n\n const props = {\n id: `plugin-settings-${name}`,\n className: \"plugin-settings\",\n ref: this.panelRef\n };\n if (typeof settingsPanel == \"string\") props.dangerouslySetInnerHTML = this.settingsPanel;\n return modules__WEBPACK_IMPORTED_MODULE_0__[\"React\"].createElement(\"li\", {\n className: \"settings-open ui-switch-item\"\n }, modules__WEBPACK_IMPORTED_MODULE_0__[\"React\"].createElement(\"div\", {\n className: \"bd-close\",\n onClick: this.closeSettings\n }, modules__WEBPACK_IMPORTED_MODULE_0__[\"React\"].createElement(_icons_close__WEBPACK_IMPORTED_MODULE_1__[\"default\"], null)), modules__WEBPACK_IMPORTED_MODULE_0__[\"React\"].createElement(\"div\", props, this.settingsPanel instanceof modules__WEBPACK_IMPORTED_MODULE_0__[\"React\"].Component ? this.settingsPanel : null));\n }\n\n buildLink(which) {\n const url = this.props.content[which];\n if (!url) return null;\n return modules__WEBPACK_IMPORTED_MODULE_0__[\"React\"].createElement(\"a\", {\n className: \"bda-link bda-link-website\",\n href: url,\n target: \"_blank\",\n rel: \"noopener noreferrer\"\n }, modules__WEBPACK_IMPORTED_MODULE_0__[\"Strings\"].Addons[which]);\n }\n\n get footer() {\n const links = [\"website\", \"source\"];\n if (!links.some(l => this.props.content[l]) && !this.hasSettings) return null;\n const linkComponents = links.map(this.buildLink.bind(this)).filter(c => c);\n return modules__WEBPACK_IMPORTED_MODULE_0__[\"React\"].createElement(\"div\", {\n className: \"bda-footer\"\n }, modules__WEBPACK_IMPORTED_MODULE_0__[\"React\"].createElement(\"span\", {\n className: \"bda-links\"\n }, linkComponents.map((comp, i) => i < linkComponents.length - 1 ? [comp, \" | \"] : [comp]).flat()), this.hasSettings && modules__WEBPACK_IMPORTED_MODULE_0__[\"React\"].createElement(\"button\", {\n onClick: this.showSettings,\n className: \"bd-button bd-button-plugin-settings\",\n disabled: !this.state.checked\n }, modules__WEBPACK_IMPORTED_MODULE_0__[\"Strings\"].Addons.pluginSettings));\n }\n\n render() {\n if (this.state.settingsOpen) return this.settingsComponent;\n const {\n content\n } = this.props;\n const name = this.getString(content.name);\n const author = this.getString(content.author);\n const description = this.getString(content.description);\n const version = this.getString(content.version);\n return modules__WEBPACK_IMPORTED_MODULE_0__[\"React\"].createElement(\"li\", {\n dataName: name,\n dataVersion: version,\n className: \"settings-closed ui-switch-item\"\n }, modules__WEBPACK_IMPORTED_MODULE_0__[\"React\"].createElement(\"div\", {\n className: \"bda-header\"\n }, modules__WEBPACK_IMPORTED_MODULE_0__[\"React\"].createElement(\"span\", {\n className: \"bda-header-title\"\n }, this.buildTitle(name, version, author)), modules__WEBPACK_IMPORTED_MODULE_0__[\"React\"].createElement(\"div\", {\n className: \"bda-controls\"\n }, this.props.showReloadIcon && modules__WEBPACK_IMPORTED_MODULE_0__[\"React\"].createElement(_icons_reload__WEBPACK_IMPORTED_MODULE_2__[\"default\"], {\n className: \"bd-reload bd-reload-card\",\n onClick: this.reload\n }), modules__WEBPACK_IMPORTED_MODULE_0__[\"React\"].createElement(\"label\", {\n className: \"ui-switch-wrapper ui-flex-child\"\n }, modules__WEBPACK_IMPORTED_MODULE_0__[\"React\"].createElement(\"input\", {\n className: \"ui-switch-checkbox\",\n checked: this.state.checked,\n onChange: this.onChange,\n type: \"checkbox\"\n }), modules__WEBPACK_IMPORTED_MODULE_0__[\"React\"].createElement(\"div\", {\n className: this.state.checked ? \"ui-switch checked\" : \"ui-switch\"\n })))), modules__WEBPACK_IMPORTED_MODULE_0__[\"React\"].createElement(\"div\", {\n className: \"bda-description-wrap scroller-wrap fade\"\n }, modules__WEBPACK_IMPORTED_MODULE_0__[\"React\"].createElement(\"div\", {\n className: \"bda-description scroller\"\n }, description)), this.footer);\n }\n\n onChange() {\n this.setState({\n checked: !this.state.checked\n });\n this.props.onChange && this.props.onChange(this.props.content.id);\n }\n\n showSettings() {\n if (!this.hasSettings) return;\n this.setState({\n settingsOpen: true\n });\n }\n\n}//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly9Db3JlLy4vc3JjL3VpL3NldHRpbmdzL3BsdWdpbmNhcmQuanM/NzczZCJdLCJuYW1lcyI6WyJQbHVnaW5DYXJkIiwiUmVhY3QiLCJDb21wb25lbnQiLCJjb25zdHJ1Y3RvciIsInByb3BzIiwib25DaGFuZ2UiLCJiaW5kIiwic2hvd1NldHRpbmdzIiwic3RhdGUiLCJjaGVja2VkIiwiZW5hYmxlZCIsInNldHRpbmdzT3BlbiIsImhhc1NldHRpbmdzIiwiY29udGVudCIsInBsdWdpbiIsImdldFNldHRpbmdzUGFuZWwiLCJzZXR0aW5nc1BhbmVsIiwicGFuZWxSZWYiLCJjcmVhdGVSZWYiLCJyZWxvYWQiLCJjbG9zZVNldHRpbmdzIiwiaWQiLCJmb3JjZVVwZGF0ZSIsImNvbXBvbmVudERpZFVwZGF0ZSIsIk5vZGUiLCJjdXJyZW50IiwiYXBwZW5kQ2hpbGQiLCJpc0hpZGRlbiIsImNvbnRhaW5lciIsImVsZW1lbnQiLCJjVG9wIiwic2Nyb2xsVG9wIiwiY0JvdHRvbSIsImNsaWVudEhlaWdodCIsImVUb3AiLCJvZmZzZXRUb3AiLCJlQm90dG9tIi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ICAgY29uc3Qge2NvbnRlbnR9ID0gdGhpcy5wcm9wcztcclxuICAgICAgICBjb25zdCBuYW1lID0gdGhpcy5nZXRTdHJpbmcoY29udGVudC5uYW1lKTtcclxuICAgICAgICBjb25zdCBhdXRob3IgPSB0aGlzLmdldFN0cmluZyhjb250ZW50LmF1dGhvcik7XHJcbiAgICAgICAgY29uc3QgZGVzY3JpcHRpb24gPSB0aGlzLmdldFN0cmluZyhjb250ZW50LmRlc2NyaXB0aW9uKTtcclxuICAgICAgICBjb25zdCB2ZXJzaW9uID0gdGhpcy5nZXRTdHJpbmcoY29udGVudC52ZXJzaW9uKTtcclxuXHJcbiAgICAgICAgcmV0dXJuIDxsaSBkYXRhTmFtZT17bmFtZX0gZGF0YVZlcnNpb249e3ZlcnNpb259IGNsYXNzTmFtZT1cInNldHRpbmdzLWNsb3NlZCB1aS1zd2l0Y2gtaXRlbVwiPlxyXG4gICAgICAgICAgICAgICAgICAgIDxkaXYgY2xhc3NOYW1lPVwiYmRhLWhlYWRlclwiPlxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgPHNwYW4gY2xhc3NOYW1lPVwiYmRhLWhlYWRlci10aXRsZVwiPnt0aGlzLmJ1aWxkVGl0bGUobmFtZSwgdmVyc2lvbiwgYXV0aG9yKX08L3NwYW4+XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICA8ZGl2IGNsYXNzTmFtZT1cImJkYS1jb250cm9sc1wiPlxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHt0aGlzLnByb3BzLnNob3dSZWxvYWRJY29uICYmIDxSZWxvYWRJY29uIGNsYXNzTmFtZT1cImJkLXJlbG9hZCBiZC1yZWxvYWQtY2FyZFwiIG9uQ2xpY2s9e3RoaXMucmVsb2FkfSAvPn1cclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA8bGFiZWwgY2xhc3NOYW1lPVwidWktc3dpdGNoLXdyYXBwZXIgdWktZmxleC1jaGlsZFwiPlxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA8aW5wdXQgY2xhc3NOYW1lPVwidWktc3dpdGNoLWNoZWNrYm94XCIgY2hlY2tlZD17dGhpcy5zdGF0ZS5jaGVja2VkfSBvbkNoYW5nZT17dGhpcy5vbkNoYW5nZX0gdHlwZT1cImNoZWNrYm94XCIgLz5cclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPGRpdiBjbGFzc05hbWU9e3RoaXMuc3RhdGUuY2hlY2tlZCA/IFwidWktc3dpdGNoIGNoZWNrZWRcIiA6IFwidWktc3dpdGNoXCJ9IC8+XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPC9sYWJlbD5cclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIDwvZGl2PlxyXG4gICAgICAgICAgICAgICAgICAgIDwvZGl2PlxyXG4gICAgICAgICAgICAgICAgICAgIDxkaXYgY2xhc3NOYW1lPVwiYmRhLWRlc2NyaXB0aW9uLXdyYXAgc2Nyb2xsZXItd3JhcCBmYWRlXCI+PGRpdiBjbGFzc05hbWU9XCJiZGEtZGVzY3JpcHRpb24gc2Nyb2xsZXJcIj57ZGVzY3JpcHRpb259PC9kaXY+PC9kaXY+XHJcbiAgICAgICAgICAgICAgICAgICAge3RoaXMuZm9vdGVyfVxyXG4gICAgICAgICAgICAgICAgPC9saT47XHJcbiAgICB9XHJcblxyXG4gICAgb25DaGFuZ2UoKSB7XHJcbiAgICAgICAgdGhpcy5zZXRTdGF0ZSh7Y2hlY2tlZDogIXRoaXMuc3RhdGUuY2hlY2tlZH0pO1xyXG4gICAgICAgIHRoaXMucHJvcHMub25DaGFuZ2UgJiYgdGhpcy5wcm9wcy5vbkNoYW5nZSh0aGlzLnByb3BzLmNvbnRlbnQuaWQpO1xyXG4gICAgfVxyXG5cclxuICAgIHNob3dTZXR0aW5ncygpIHtcclxuICAgICAgICBpZiAoIXRoaXMuaGFzU2V0dGluZ3MpIHJldHVybjtcclxuICAgICAgICB0aGlzLnNldFN0YXRlKHtzZXR0aW5nc09wZW46IHRydWV9KTtcclxuICAgIH1cclxufSJdLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///./src/ui/settings/plugincard.js\n"); /***/ }), @@ -935,7 +935,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) * /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"default\", function() { return ThemeCard; });\n/* harmony import */ var modules__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! modules */ \"./src/modules/modules.js\");\n/* harmony import */ var _icons_reload__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../icons/reload */ \"./src/ui/icons/reload.jsx\");\n\n // import Toasts from \"../toasts\";\n\nclass ThemeCard extends modules__WEBPACK_IMPORTED_MODULE_0__[\"React\"].Component {\n constructor(props) {\n super(props);\n this.state = {\n checked: this.props.enabled,\n //ThemeManager.isEnabled(this.props.content.id),\n reloads: 0\n };\n this.onChange = this.onChange.bind(this);\n this.reload = this.reload.bind(this);\n }\n\n reload() {\n if (!this.props.reload) return;\n this.props.content = this.props.reload(this.props.content.id);\n this.forceUpdate();\n }\n\n buildTitle(name, version, author) {\n const title = modules__WEBPACK_IMPORTED_MODULE_0__[\"Strings\"].Addons.title.split(/({{[A-Za-z]+}})/);\n const nameIndex = title.findIndex(s => s == \"{{name}}\");\n if (nameIndex) title[nameIndex] = modules__WEBPACK_IMPORTED_MODULE_0__[\"React\"].createElement(\"span\", {\n className: \"bda-name\"\n }, name);\n const versionIndex = title.findIndex(s => s == \"{{version}}\");\n if (nameIndex) title[versionIndex] = modules__WEBPACK_IMPORTED_MODULE_0__[\"React\"].createElement(\"span\", {\n className: \"bda-version\"\n }, version);\n const authorIndex = title.findIndex(s => s == \"{{author}}\");\n if (nameIndex) title[authorIndex] = modules__WEBPACK_IMPORTED_MODULE_0__[\"React\"].createElement(\"span\", {\n className: \"bda-author\"\n }, author);\n return title.flat();\n }\n\n render() {\n const {\n content\n } = this.props;\n const name = content.name;\n const description = content.description;\n const version = content.version;\n const author = content.author;\n const website = content.website;\n const source = content.source;\n return modules__WEBPACK_IMPORTED_MODULE_0__[\"React\"].createElement(\"li\", {\n \"data-name\": name,\n \"data-version\": version,\n \"className\": \"settings-closed ui-switch-item\"\n }, modules__WEBPACK_IMPORTED_MODULE_0__[\"React\"].createElement(\"div\", {\n className: \"bda-header\"\n }, modules__WEBPACK_IMPORTED_MODULE_0__[\"React\"].createElement(\"span\", {\n className: \"bda-header-title\"\n }, this.buildTitle(name, version, author)), modules__WEBPACK_IMPORTED_MODULE_0__[\"React\"].createElement(\"div\", {\n className: \"bda-controls\"\n }, !modules__WEBPACK_IMPORTED_MODULE_0__[\"Settings\"].get(\"settings\", \"addons\", \"autoReload\") && modules__WEBPACK_IMPORTED_MODULE_0__[\"React\"].createElement(_icons_reload__WEBPACK_IMPORTED_MODULE_1__[\"default\"], {\n className: \"bd-reload bd-reload-card\",\n onClick: this.reload\n }), modules__WEBPACK_IMPORTED_MODULE_0__[\"React\"].createElement(\"label\", {\n className: \"ui-switch-wrapper ui-flex-child\",\n style: {\n flex: \"0 0 auto\"\n }\n }, modules__WEBPACK_IMPORTED_MODULE_0__[\"React\"].createElement(\"input\", {\n checked: this.state.checked,\n onChange: this.onChange,\n className: \"ui-switch-checkbox\",\n type: \"checkbox\"\n }), modules__WEBPACK_IMPORTED_MODULE_0__[\"React\"].createElement(\"div\", {\n className: this.state.checked ? \"ui-switch checked\" : \"ui-switch\"\n })))), modules__WEBPACK_IMPORTED_MODULE_0__[\"React\"].createElement(\"div\", {\n className: \"bda-description-wrap scroller-wrap fade\"\n }, modules__WEBPACK_IMPORTED_MODULE_0__[\"React\"].createElement(\"div\", {\n className: \"bda-description scroller\"\n }, description)), (website || source) && modules__WEBPACK_IMPORTED_MODULE_0__[\"React\"].createElement(\"div\", {\n className: \"bda-footer\"\n }, modules__WEBPACK_IMPORTED_MODULE_0__[\"React\"].createElement(\"span\", {\n className: \"bda-links\"\n }, website && modules__WEBPACK_IMPORTED_MODULE_0__[\"React\"].createElement(\"a\", {\n className: \"bda-link\",\n href: website,\n target: \"_blank\"\n }, \"Website\"), website && source && \" | \", source && modules__WEBPACK_IMPORTED_MODULE_0__[\"React\"].createElement(\"a\", {\n className: \"bda-link\",\n href: source,\n target: \"_blank\"\n }, \"Source\"))));\n }\n\n onChange() {\n this.setState({\n checked: !this.state.checked\n });\n this.props.onChange && this.props.onChange(this.props.content.id);\n }\n\n}//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly9Db3JlLy4vc3JjL3VpL3NldHRpbmdzL3RoZW1lY2FyZC5qcz9jMDVjIl0sIm5hbWVzIjpbIlRoZW1lQ2FyZCIsIlJlYWN0IiwiQ29tcG9uZW50IiwiY29uc3RydWN0b3IiLCJwcm9wcyIsInN0YXRlIiwiY2hlY2tlZCIsImVuYWJsZWQiLCJyZWxvYWRzIiwib25DaGFuZ2UiLCJiaW5kIiwicmVsb2FkIiwiY29udGVudCIsImlkIiwiZm9yY2VVcGRhdGUiLCJidWlsZFRpdGxlIiwibmFtZSIsInZlcnNpb24iLCJhdXRob3IiLCJ0aXRsZSIsIlN0cmluZ3MiLCJBZGRvbnMiLCJzcGxpdCIsIm5hbWVJbmRleCIsImZpbmRJbmRleCIsInMiLCJjcmVhdGVFbGVtZW50IiwiY2xhc3NOYW1lIiwidmVyc2lvbkluZGV4IiwiYXV0aG9ySW5kZXgiLCJmbGF0IiwicmVuZGVyIiwiZGVzY3JpcHRpb24iLCJ3ZWJzaXRlIiwic291cmNlIiwiU2V0dGluZ3MiLCJnZXQiLCJSZWxvYWRJY29uIiwib25DbGljayIsInN0eWxlIiwiZmxleCIsInR5cGUiLCJocmVmIiwidGFyZ2V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gICAgICApXHJcbiAgICAgICAgKTtcclxuICAgIH1cclxuXHJcbiAgICBvbkNoYW5nZSgpIHtcclxuICAgICAgICB0aGlzLnNldFN0YXRlKHtjaGVja2VkOiAhdGhpcy5zdGF0ZS5jaGVja2VkfSk7XHJcbiAgICAgICAgdGhpcy5wcm9wcy5vbkNoYW5nZSAmJiB0aGlzLnByb3BzLm9uQ2hhbmdlKHRoaXMucHJvcHMuY29udGVudC5pZCk7XHJcbiAgICB9XHJcbn0iXSwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///./src/ui/settings/themecard.js\n"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"default\", function() { return ThemeCard; });\n/* harmony import */ var modules__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! modules */ \"./src/modules/modules.js\");\n/* harmony import */ var _icons_reload__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../icons/reload */ \"./src/ui/icons/reload.jsx\");\n\n // import Toasts from \"../toasts\";\n\nclass ThemeCard extends modules__WEBPACK_IMPORTED_MODULE_0__[\"React\"].Component {\n constructor(props) {\n super(props);\n this.state = {\n checked: this.props.enabled,\n //ThemeManager.isEnabled(this.props.content.id),\n reloads: 0\n };\n this.onChange = this.onChange.bind(this);\n this.reload = this.reload.bind(this);\n }\n\n reload() {\n if (!this.props.reload) return;\n this.props.content = this.props.reload(this.props.content.id);\n this.forceUpdate();\n }\n\n buildTitle(name, version, author) {\n const title = modules__WEBPACK_IMPORTED_MODULE_0__[\"Strings\"].Addons.title.split(/({{[A-Za-z]+}})/);\n const nameIndex = title.findIndex(s => s == \"{{name}}\");\n if (nameIndex) title[nameIndex] = modules__WEBPACK_IMPORTED_MODULE_0__[\"React\"].createElement(\"span\", {\n className: \"bda-name\"\n }, name);\n const versionIndex = title.findIndex(s => s == \"{{version}}\");\n if (nameIndex) title[versionIndex] = modules__WEBPACK_IMPORTED_MODULE_0__[\"React\"].createElement(\"span\", {\n className: \"bda-version\"\n }, version);\n const authorIndex = title.findIndex(s => s == \"{{author}}\");\n if (nameIndex) title[authorIndex] = modules__WEBPACK_IMPORTED_MODULE_0__[\"React\"].createElement(\"span\", {\n className: \"bda-author\"\n }, author);\n return title.flat();\n }\n\n render() {\n const {\n content\n } = this.props;\n const name = content.name;\n const description = content.description;\n const version = content.version;\n const author = content.author;\n const website = content.website;\n const source = content.source;\n return modules__WEBPACK_IMPORTED_MODULE_0__[\"React\"].createElement(\"li\", {\n \"data-name\": name,\n \"data-version\": version,\n \"className\": \"settings-closed ui-switch-item\"\n }, modules__WEBPACK_IMPORTED_MODULE_0__[\"React\"].createElement(\"div\", {\n className: \"bda-header\"\n }, modules__WEBPACK_IMPORTED_MODULE_0__[\"React\"].createElement(\"span\", {\n className: \"bda-header-title\"\n }, this.buildTitle(name, version, author)), modules__WEBPACK_IMPORTED_MODULE_0__[\"React\"].createElement(\"div\", {\n className: \"bda-controls\"\n }, this.props.showReloadIcon && modules__WEBPACK_IMPORTED_MODULE_0__[\"React\"].createElement(_icons_reload__WEBPACK_IMPORTED_MODULE_1__[\"default\"], {\n className: \"bd-reload bd-reload-card\",\n onClick: this.reload\n }), modules__WEBPACK_IMPORTED_MODULE_0__[\"React\"].createElement(\"label\", {\n className: \"ui-switch-wrapper ui-flex-child\",\n style: {\n flex: \"0 0 auto\"\n }\n }, modules__WEBPACK_IMPORTED_MODULE_0__[\"React\"].createElement(\"input\", {\n checked: this.state.checked,\n onChange: this.onChange,\n className: \"ui-switch-checkbox\",\n type: \"checkbox\"\n }), modules__WEBPACK_IMPORTED_MODULE_0__[\"React\"].createElement(\"div\", {\n className: this.state.checked ? \"ui-switch checked\" : \"ui-switch\"\n })))), modules__WEBPACK_IMPORTED_MODULE_0__[\"React\"].createElement(\"div\", {\n className: \"bda-description-wrap scroller-wrap fade\"\n }, modules__WEBPACK_IMPORTED_MODULE_0__[\"React\"].createElement(\"div\", {\n className: \"bda-description scroller\"\n }, description)), (website || source) && modules__WEBPACK_IMPORTED_MODULE_0__[\"React\"].createElement(\"div\", {\n className: \"bda-footer\"\n }, modules__WEBPACK_IMPORTED_MODULE_0__[\"React\"].createElement(\"span\", {\n className: \"bda-links\"\n }, website && modules__WEBPACK_IMPORTED_MODULE_0__[\"React\"].createElement(\"a\", {\n className: \"bda-link\",\n href: website,\n target: \"_blank\"\n }, \"Website\"), website && source && \" | \", source && modules__WEBPACK_IMPORTED_MODULE_0__[\"React\"].createElement(\"a\", {\n className: \"bda-link\",\n href: source,\n target: \"_blank\"\n }, \"Source\"))));\n }\n\n onChange() {\n this.setState({\n checked: !this.state.checked\n });\n this.props.onChange && this.props.onChange(this.props.content.id);\n }\n\n}//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly9Db3JlLy4vc3JjL3VpL3NldHRpbmdzL3RoZW1lY2FyZC5qcz9jMDVjIl0sIm5hbWVzIjpbIlRoZW1lQ2FyZCIsIlJlYWN0IiwiQ29tcG9uZW50IiwiY29uc3RydWN0b3IiLCJwcm9wcyIsInN0YXRlIiwiY2hlY2tlZCIsImVuYWJsZWQiLCJyZWxvYWRzIiwib25DaGFuZ2UiLCJiaW5kIiwicmVsb2FkIiwiY29udGVudCIsImlkIiwiZm9yY2VVcGRhdGUiLCJidWlsZFRpdGxlIiwibmFtZSIsInZlcnNpb24iLCJhdXRob3IiLCJ0aXRsZSIsIlN0cmluZ3MiLCJBZGRvbnMiLCJzcGxpdCIsIm5hbWVJbmRleCIsImZpbmRJbmRleCIsInMiLCJjcmVhdGVFbGVtZW50IiwiY2xhc3NOYW1lIiwidmVyc2lvbkluZGV4IiwiYXV0aG9ySW5kZXgiLCJmbGF0IiwicmVuZGVyIiwiZGVzY3JpcHRpb24iLCJ3ZWJzaXRlIiwic291cmNlIiwic2hvd1JlbG9hZEljb24iLCJSZWxvYWRJY29uIiwib25DbGljayIsIn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AgICAgICAgICAgICAgICAgIClcclxuICAgICAgICAgICAgICAgICAgICApXHJcbiAgICAgICAgICAgICksXHJcbiAgICAgICAgICAgIFJlYWN0LmNyZWF0ZUVsZW1lbnQoXCJkaXZcIiwge2NsYXNzTmFtZTogXCJiZGEtZGVzY3JpcHRpb24td3JhcCBzY3JvbGxlci13cmFwIGZhZGVcIn0sXHJcbiAgICAgICAgICAgICAgICBSZWFjdC5jcmVhdGVFbGVtZW50KFwiZGl2XCIsIHtjbGFzc05hbWU6IFwiYmRhLWRlc2NyaXB0aW9uIHNjcm9sbGVyXCJ9LCBkZXNjcmlwdGlvbilcclxuICAgICAgICAgICAgKSxcclxuICAgICAgICAgICAgKHdlYnNpdGUgfHwgc291cmNlKSAmJiBSZWFjdC5jcmVhdGVFbGVtZW50KFwiZGl2XCIsIHtjbGFzc05hbWU6IFwiYmRhLWZvb3RlclwifSxcclxuICAgICAgICAgICAgICAgIFJlYWN0LmNyZWF0ZUVsZW1lbnQoXCJzcGFuXCIsIHtjbGFzc05hbWU6IFwiYmRhLWxpbmtzXCJ9LFxyXG4gICAgICAgICAgICAgICAgICAgIHdlYnNpdGUgJiYgUmVhY3QuY3JlYXRlRWxlbWVudChcImFcIiwge2NsYXNzTmFtZTogXCJiZGEtbGlua1wiLCBocmVmOiB3ZWJzaXRlLCB0YXJnZXQ6IFwiX2JsYW5rXCJ9LCBcIldlYnNpdGVcIiksXHJcbiAgICAgICAgICAgICAgICAgICAgd2Vic2l0ZSAmJiBzb3VyY2UgJiYgXCIgfCBcIixcclxuICAgICAgICAgICAgICAgICAgICBzb3VyY2UgJiYgUmVhY3QuY3JlYXRlRWxlbWVudChcImFcIiwge2NsYXNzTmFtZTogXCJiZGEtbGlua1wiLCBocmVmOiBzb3VyY2UsIHRhcmdldDogXCJfYmxhbmtcIn0sIFwiU291cmNlXCIpXHJcbiAgICAgICAgICAgICAgICApXHJcbiAgICAgICAgICAgIClcclxuICAgICAgICApO1xyXG4gICAgfVxyXG5cclxuICAgIG9uQ2hhbmdlKCkge1xyXG4gICAgICAgIHRoaXMuc2V0U3RhdGUoe2NoZWNrZWQ6ICF0aGlzLnN0YXRlLmNoZWNrZWR9KTtcclxuICAgICAgICB0aGlzLnByb3BzLm9uQ2hhbmdlICYmIHRoaXMucHJvcHMub25DaGFuZ2UodGhpcy5wcm9wcy5jb250ZW50LmlkKTtcclxuICAgIH1cclxufSJdLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///./src/ui/settings/themecard.js\n"); /***/ }), diff --git a/src/ui/settings/plugincard.js b/src/ui/settings/plugincard.js index 98081b61..2175c8bf 100644 --- a/src/ui/settings/plugincard.js +++ b/src/ui/settings/plugincard.js @@ -1,5 +1,4 @@ -// import {SettingsCookie, PluginCookie, Plugins} from "data"; -import {React, Logger, Settings, Strings} from "modules"; +import {React, Logger, Strings} from "modules"; import CloseButton from "../icons/close"; import ReloadIcon from "../icons/reload"; @@ -10,7 +9,7 @@ export default class PluginCard extends React.Component { this.onChange = this.onChange.bind(this); this.showSettings = this.showSettings.bind(this); this.state = { - checked: this.props.enabled,//PluginManager.isEnabled(this.props.content.id), + checked: this.props.enabled, settingsOpen: false }; this.hasSettings = typeof this.props.content.plugin.getSettingsPanel === "function"; @@ -19,6 +18,7 @@ export default class PluginCard extends React.Component { this.reload = this.reload.bind(this); // this.onReload = this.onReload.bind(this); + this.closeSettings = this.closeSettings.bind(this); } reload() { @@ -28,34 +28,31 @@ export default class PluginCard extends React.Component { } componentDidUpdate() { - if (this.state.settingsOpen) { - if (this.settingsPanel instanceof Node) { - this.panelRef.current.appendChild(this.settingsPanel); - } + if (!this.state.settingsOpen) return; + if (this.settingsPanel instanceof Node) this.panelRef.current.appendChild(this.settingsPanel); - // if (!SettingsCookie["fork-ps-3"]) return; - const isHidden = (container, element) => { + // if (!SettingsCookie["fork-ps-3"]) return; + const isHidden = (container, element) => { + const cTop = container.scrollTop; + const cBottom = cTop + container.clientHeight; + const eTop = element.offsetTop; + const eBottom = eTop + element.clientHeight; + return (eTop < cTop || eBottom > cBottom); + }; - const cTop = container.scrollTop; - const cBottom = cTop + container.clientHeight; - - const eTop = element.offsetTop; - const eBottom = eTop + element.clientHeight; - - return (eTop < cTop || eBottom > cBottom); - }; - - const panel = $(this.panelRef.current); - const container = panel.parents(".scroller-2FKFPG"); - if (!isHidden(container[0], panel[0])) return; - container.animate({ - scrollTop: panel.offset().top - container.offset().top + container.scrollTop() - 30 - }, 300); - } + const panel = $(this.panelRef.current); + const container = panel.parents(".scroller-2FKFPG"); + if (!isHidden(container[0], panel[0])) return; + container.animate({ + scrollTop: panel.offset().top - container.offset().top + container.scrollTop() - 30 + }, 300); } - getString(value) { - return typeof value == "string" ? value : value.toString(); + getString(value) {return typeof value == "string" ? value : value.toString();} + + closeSettings() { + this.panelRef.current.innerHTML = ""; + this.setState({settingsOpen: false}); } buildTitle(name, version, author) { @@ -69,58 +66,60 @@ export default class PluginCard extends React.Component { return title.flat(); } + get settingsComponent() { + const content = this.props.content; + const name = this.getString(content.name); + try { this.settingsPanel = content.plugin.getSettingsPanel(); } + catch (err) { Logger.stacktrace("Plugin Settings", "Unable to get settings panel for " + name + ".", err); } + + const props = {id: `plugin-settings-${name}`, className: "plugin-settings", ref: this.panelRef}; + if (typeof(settingsPanel) == "string") props.dangerouslySetInnerHTML = this.settingsPanel; + + return
  • +
    +
    {this.settingsPanel instanceof React.Component ? this.settingsPanel : null}
    +
  • ; + } + + buildLink(which) { + const url = this.props.content[which]; + if (!url) return null; + return {Strings.Addons[which]}; + } + + get footer() { + const links = ["website", "source"]; + if (!links.some(l => this.props.content[l]) && !this.hasSettings) return null; + const linkComponents = links.map(this.buildLink.bind(this)).filter(c => c); + return
    + {linkComponents.map((comp, i) => i < linkComponents.length - 1 ? [comp, " | "] : [comp]).flat()} + {this.hasSettings && } +
    ; + } + render() { + if (this.state.settingsOpen) return this.settingsComponent; + const {content} = this.props; const name = this.getString(content.name); const author = this.getString(content.author); const description = this.getString(content.description); const version = this.getString(content.version); - const website = content.website; - const source = content.source; - if (this.state.settingsOpen) { - try { this.settingsPanel = content.plugin.getSettingsPanel(); } - catch (err) { Logger.stacktrace("Plugin Settings", "Unable to get settings panel for " + content.name + ".", err); } - - const props = {id: `plugin-settings-${name}`, className: "plugin-settings", ref: this.panelRef}; - if (typeof(this.settingsPanel) == "string") props.dangerouslySetInnerHTML = this.settingsPanel; - - return React.createElement("li", {className: "settings-open ui-switch-item"}, - React.createElement("div", {style: {"float": "right", "cursor": "pointer"}, onClick: () => { - this.panelRef.current.innerHTML = ""; - this.setState({settingsOpen: false}); - }}, - React.createElement(CloseButton, null) - ), - React.createElement("div", props, this.settingsPanel instanceof React.Component ? this.settingsPanel : null), - ); - } - - return React.createElement("li", {"data-name": name, "data-version": version, "className": "settings-closed ui-switch-item"}, - React.createElement("div", {className: "bda-header"}, - React.createElement("span", {className: "bda-header-title"}, - this.buildTitle(name, version, author) - ), - React.createElement("div", {className: "bda-controls"}, - !Settings.get("settings", "addons", "autoReload") && React.createElement(ReloadIcon, {className: "bd-reload bd-reload-card", onClick: this.reload}), - React.createElement("label", {className: "ui-switch-wrapper ui-flex-child", style: {flex: "0 0 auto"}}, - React.createElement("input", {checked: this.state.checked, onChange: this.onChange, className: "ui-switch-checkbox", type: "checkbox"}), - React.createElement("div", {className: this.state.checked ? "ui-switch checked" : "ui-switch"}) - ) - ) - ), - React.createElement("div", {className: "bda-description-wrap scroller-wrap fade"}, - React.createElement("div", {className: "bda-description scroller"}, description) - ), - (website || source || this.hasSettings) && React.createElement("div", {className: "bda-footer"}, - React.createElement("span", {className: "bda-links"}, - website && React.createElement("a", {className: "bda-link bda-link-website", href: website, target: "_blank"}, Strings.Addons.website), - website && source && " | ", - source && React.createElement("a", {className: "bda-link bda-link-source", href: source, target: "_blank"}, Strings.Addons.source) - ), - this.hasSettings && React.createElement("button", {onClick: this.showSettings, className: "bd-button bd-button-plugin-settings", disabled: !this.state.checked}, Strings.Addons.pluginSettings) - ) - ); + return
  • +
    + {this.buildTitle(name, version, author)} +
    + {this.props.showReloadIcon && } +
    +
    {description}
    + {this.footer} +
  • ; } onChange() { diff --git a/src/ui/settings/themecard.js b/src/ui/settings/themecard.js index 743d30e7..43b4a020 100644 --- a/src/ui/settings/themecard.js +++ b/src/ui/settings/themecard.js @@ -1,4 +1,4 @@ -import {React, Settings, Strings} from "modules"; +import {React, Strings} from "modules"; import ReloadIcon from "../icons/reload"; // import Toasts from "../toasts"; @@ -46,7 +46,7 @@ export default class ThemeCard extends React.Component { this.buildTitle(name, version, author) ), React.createElement("div", {className: "bda-controls"}, - !Settings.get("settings", "addons", "autoReload") && React.createElement(ReloadIcon, {className: "bd-reload bd-reload-card", onClick: this.reload}), + this.props.showReloadIcon && React.createElement(ReloadIcon, {className: "bd-reload bd-reload-card", onClick: this.reload}), React.createElement("label", {className: "ui-switch-wrapper ui-flex-child", style: {flex: "0 0 auto"}}, React.createElement("input", {checked: this.state.checked, onChange: this.onChange, className: "ui-switch-checkbox", type: "checkbox"}), React.createElement("div", {className: this.state.checked ? "ui-switch checked" : "ui-switch"})