initial changes for builtins

This commit is contained in:
Zack Rauen 2019-05-30 11:44:05 -04:00
parent 47b3dbef68
commit dc7e6e8260
15 changed files with 352 additions and 224 deletions

View File

@ -1,5 +1,8 @@
{
"extends": ["eslint:recommended", "plugin:react/recommended"],
"extends": ["eslint:recommended", "plugin:react/recommended"],
"plugins": [
"react"
],
"env": {
"browser": true,
"node": true,

View File

@ -87,6 +87,52 @@ var Core =
/************************************************************************/
/******/ ({
/***/ "./src/builtins/voicemode.js":
/*!***********************************!*\
!*** ./src/builtins/voicemode.js ***!
\***********************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _structs_builtin__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../structs/builtin */ "./src/structs/builtin.js");
/* harmony default export */ __webpack_exports__["default"] = (new class VoiceMode extends _structs_builtin__WEBPACK_IMPORTED_MODULE_0__["default"] {
get name() {
return "VoiceMode";
}
get category() {
return "Modules";
}
get id() {
return "bda-gs-4";
}
enabled() {
$(".scroller.guild-channels ul").first().css("display", "none");
$(".scroller.guild-channels header").first().css("display", "none");
$(".app.flex-vertical, .app-2rEoOp").first().css("overflow", "hidden");
$(".chat-3bRxxu").first().css("visibility", "hidden").css("min-width", "0px");
$(".flex-vertical.channels-wrap").first().css("flex-grow", "100000");
$(".guild-header .btn.btn-hamburger").first().css("visibility", "hidden");
}
disabled() {
$(".scroller.guild-channels ul").first().css("display", "");
$(".scroller.guild-channels header").first().css("display", "");
$(".app.flex-vertical, .app-2rEoOp").first().css("overflow", "");
$(".chat-3bRxxu").first().css("visibility", "").css("min-width", "");
$(".flex-vertical.channels-wrap").first().css("flex-grow", "");
$(".guild-header .btn.btn-hamburger").first().css("visibility", "");
}
}());
/***/ }),
/***/ "./src/data/config.js":
/*!****************************!*\
!*** ./src/data/config.js ***!
@ -559,6 +605,8 @@ __webpack_require__.r(__webpack_exports__);
/* harmony import */ var _modules_pluginmanager__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./modules/pluginmanager */ "./src/modules/pluginmanager.js");
/* harmony import */ var _modules_thememanager__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./modules/thememanager */ "./src/modules/thememanager.js");
/* harmony import */ var _modules_oldstorage__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./modules/oldstorage */ "./src/modules/oldstorage.js");
/* harmony import */ var _modules_emitter__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./modules/emitter */ "./src/modules/emitter.js");
@ -585,6 +633,7 @@ window.bdplugins = data__WEBPACK_IMPORTED_MODULE_0__["Plugins"];
window.bdEmotes = data__WEBPACK_IMPORTED_MODULE_0__["Emotes"];
window.bemotes = data__WEBPACK_IMPORTED_MODULE_0__["EmoteBlacklist"];
window.bdPluginStorage = _modules_oldstorage__WEBPACK_IMPORTED_MODULE_6__["bdPluginStorage"];
window.BDEvents = _modules_emitter__WEBPACK_IMPORTED_MODULE_7__["default"];
class CoreWrapper {
constructor(config) {
_modules_core__WEBPACK_IMPORTED_MODULE_2__["default"].setConfig(config);
@ -703,11 +752,9 @@ __webpack_require__.r(__webpack_exports__);
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var data__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! data */ "./src/data/data.js");
/* harmony import */ var _webpackmodules__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./webpackmodules */ "./src/modules/webpackmodules.js");
/* harmony import */ var _pluginapi__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./pluginapi */ "./src/modules/pluginapi.js");
/* harmony import */ var _ui_icons_bdlogo__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../ui/icons/bdlogo */ "./src/ui/icons/bdlogo.js");
/* harmony import */ var _webpackmodules__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./webpackmodules */ "./src/modules/webpackmodules.js");
/* harmony import */ var _pluginapi__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./pluginapi */ "./src/modules/pluginapi.js");
/* harmony import */ var _ui_icons_bdlogo__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../ui/icons/bdlogo */ "./src/ui/icons/bdlogo.js");
@ -717,53 +764,53 @@ __webpack_require__.r(__webpack_exports__);
}
initialize() {
_pluginapi__WEBPACK_IMPORTED_MODULE_2__["default"].suppressErrors(this.patchSocial.bind(this), "BD Social Patch")();
_pluginapi__WEBPACK_IMPORTED_MODULE_2__["default"].suppressErrors(this.patchGuildPills.bind(this), "BD Guild Pills Patch")();
_pluginapi__WEBPACK_IMPORTED_MODULE_2__["default"].suppressErrors(this.patchGuildListItems.bind(this), "BD Guild List Items Patch")();
_pluginapi__WEBPACK_IMPORTED_MODULE_2__["default"].suppressErrors(this.patchGuildSeparator.bind(this), "BD Guild Separator Patch")();
_pluginapi__WEBPACK_IMPORTED_MODULE_1__["default"].suppressErrors(this.patchSocial.bind(this), "BD Social Patch")();
_pluginapi__WEBPACK_IMPORTED_MODULE_1__["default"].suppressErrors(this.patchGuildPills.bind(this), "BD Guild Pills Patch")();
_pluginapi__WEBPACK_IMPORTED_MODULE_1__["default"].suppressErrors(this.patchGuildListItems.bind(this), "BD Guild List Items Patch")();
_pluginapi__WEBPACK_IMPORTED_MODULE_1__["default"].suppressErrors(this.patchGuildSeparator.bind(this), "BD Guild Separator Patch")();
}
get messageClasses() {
return _webpackmodules__WEBPACK_IMPORTED_MODULE_1__["default"].getByProps("message", "containerCozy");
return _webpackmodules__WEBPACK_IMPORTED_MODULE_0__["default"].getByProps("message", "containerCozy");
}
get guildClasses() {
const guildsWrapper = _webpackmodules__WEBPACK_IMPORTED_MODULE_1__["default"].getByProps("wrapper", "unreadMentionsBar");
const guilds = _webpackmodules__WEBPACK_IMPORTED_MODULE_1__["default"].getByProps("guildsError", "selected");
const pill = _webpackmodules__WEBPACK_IMPORTED_MODULE_1__["default"].getByProps("blobContainer");
const guildsWrapper = _webpackmodules__WEBPACK_IMPORTED_MODULE_0__["default"].getByProps("wrapper", "unreadMentionsBar");
const guilds = _webpackmodules__WEBPACK_IMPORTED_MODULE_0__["default"].getByProps("guildsError", "selected");
const pill = _webpackmodules__WEBPACK_IMPORTED_MODULE_0__["default"].getByProps("blobContainer");
return Object.assign({}, guildsWrapper, guilds, pill);
}
get MessageContentComponent() {
return _webpackmodules__WEBPACK_IMPORTED_MODULE_1__["default"].getModule(m => m.defaultProps && m.defaultProps.hasOwnProperty("disableButtons"));
return _webpackmodules__WEBPACK_IMPORTED_MODULE_0__["default"].getModule(m => m.defaultProps && m.defaultProps.hasOwnProperty("disableButtons"));
}
get TimeFormatter() {
return _webpackmodules__WEBPACK_IMPORTED_MODULE_1__["default"].getByProps("dateFormat");
return _webpackmodules__WEBPACK_IMPORTED_MODULE_0__["default"].getByProps("dateFormat");
}
get TooltipWrapper() {
return _webpackmodules__WEBPACK_IMPORTED_MODULE_1__["default"].getByDisplayName("TooltipDeprecated");
return _webpackmodules__WEBPACK_IMPORTED_MODULE_0__["default"].getByDisplayName("TooltipDeprecated");
}
get NativeModule() {
return _webpackmodules__WEBPACK_IMPORTED_MODULE_1__["default"].getByProps("setBadge");
return _webpackmodules__WEBPACK_IMPORTED_MODULE_0__["default"].getByProps("setBadge");
}
get Tooltips() {
return _webpackmodules__WEBPACK_IMPORTED_MODULE_1__["default"].getModule(m => m.hide && m.show && !m.search && !m.submit && !m.search && !m.activateRagingDemon && !m.dismiss);
return _webpackmodules__WEBPACK_IMPORTED_MODULE_0__["default"].getModule(m => m.hide && m.show && !m.search && !m.submit && !m.search && !m.activateRagingDemon && !m.dismiss);
}
get KeyGenerator() {
return _webpackmodules__WEBPACK_IMPORTED_MODULE_1__["default"].getModule(m => m.toString && /"binary"/.test(m.toString()));
return _webpackmodules__WEBPACK_IMPORTED_MODULE_0__["default"].getModule(m => m.toString && /"binary"/.test(m.toString()));
}
patchSocial() {
if (this.socialPatch) return;
const TabBar = _pluginapi__WEBPACK_IMPORTED_MODULE_2__["default"].findModule(m => m.displayName == "TabBar");
const Anchor = _pluginapi__WEBPACK_IMPORTED_MODULE_2__["default"].findModule(m => m.displayName == "Anchor");
const TabBar = _pluginapi__WEBPACK_IMPORTED_MODULE_1__["default"].findModule(m => m.displayName == "TabBar");
const Anchor = _pluginapi__WEBPACK_IMPORTED_MODULE_1__["default"].findModule(m => m.displayName == "Anchor");
if (!TabBar || !Anchor) return;
this.socialPatch = _pluginapi__WEBPACK_IMPORTED_MODULE_2__["default"].monkeyPatch(TabBar.prototype, "render", {
this.socialPatch = _pluginapi__WEBPACK_IMPORTED_MODULE_1__["default"].monkeyPatch(TabBar.prototype, "render", {
after: data => {
const children = data.returnValue.props.children;
if (!children || !children.length) return;
@ -773,13 +820,13 @@ __webpack_require__.r(__webpack_exports__);
const newOne = function () {
const returnVal = original(...arguments);
returnVal.props.children.push(_pluginapi__WEBPACK_IMPORTED_MODULE_2__["default"].React.createElement(Anchor, {
returnVal.props.children.push(_pluginapi__WEBPACK_IMPORTED_MODULE_1__["default"].React.createElement(Anchor, {
className: "bd-social-link",
href: "https://github.com/rauenzi/BetterDiscordApp",
rel: "author",
title: "BandagedBD",
target: "_blank"
}, _pluginapi__WEBPACK_IMPORTED_MODULE_2__["default"].React.createElement(_ui_icons_bdlogo__WEBPACK_IMPORTED_MODULE_3__["default"], {
}, _pluginapi__WEBPACK_IMPORTED_MODULE_1__["default"].React.createElement(_ui_icons_bdlogo__WEBPACK_IMPORTED_MODULE_2__["default"], {
size: "16px",
className: "bd-social-logo"
})));
@ -795,10 +842,10 @@ __webpack_require__.r(__webpack_exports__);
if (this.guildListItemsPatch) return;
const listItemClass = this.guildClasses.listItem.split(" ")[0];
const blobClass = this.guildClasses.blobContainer.split(" ")[0];
const reactInstance = _pluginapi__WEBPACK_IMPORTED_MODULE_2__["default"].getInternalInstance(document.querySelector(`.${listItemClass} .${blobClass}`).parentElement);
const reactInstance = _pluginapi__WEBPACK_IMPORTED_MODULE_1__["default"].getInternalInstance(document.querySelector(`.${listItemClass} .${blobClass}`).parentElement);
const GuildComponent = reactInstance.return.type;
if (!GuildComponent) return;
this.guildListItemsPatch = _pluginapi__WEBPACK_IMPORTED_MODULE_2__["default"].monkeyPatch(GuildComponent.prototype, "render", {
this.guildListItemsPatch = _pluginapi__WEBPACK_IMPORTED_MODULE_1__["default"].monkeyPatch(GuildComponent.prototype, "render", {
after: data => {
const returnValue = data.returnValue;
const guildData = data.thisObject.props;
@ -816,9 +863,9 @@ __webpack_require__.r(__webpack_exports__);
patchGuildPills() {
if (this.guildPillPatch) return;
const guildPill = _pluginapi__WEBPACK_IMPORTED_MODULE_2__["default"].findModule(m => m.default && m.default.toString && m.default.toString().includes("translate3d"));
const guildPill = _pluginapi__WEBPACK_IMPORTED_MODULE_1__["default"].findModule(m => m.default && m.default.toString && m.default.toString().includes("translate3d"));
if (!guildPill) return;
this.guildPillPatch = _pluginapi__WEBPACK_IMPORTED_MODULE_2__["default"].monkeyPatch(guildPill, "default", {
this.guildPillPatch = _pluginapi__WEBPACK_IMPORTED_MODULE_1__["default"].monkeyPatch(guildPill, "default", {
after: data => {
const props = data.methodArguments[0];
if (props.unread) data.returnValue.props.className += " bd-unread";
@ -831,8 +878,8 @@ __webpack_require__.r(__webpack_exports__);
patchGuildSeparator() {
if (this.guildSeparatorPatch) return;
const Guilds = _pluginapi__WEBPACK_IMPORTED_MODULE_2__["default"].findModuleByDisplayName("Guilds");
const guildComponents = _pluginapi__WEBPACK_IMPORTED_MODULE_2__["default"].findModuleByProps("renderListItem");
const Guilds = _pluginapi__WEBPACK_IMPORTED_MODULE_1__["default"].findModuleByDisplayName("Guilds");
const guildComponents = _pluginapi__WEBPACK_IMPORTED_MODULE_1__["default"].findModuleByProps("renderListItem");
if (!guildComponents || !Guilds) return;
const GuildSeparator = function () {
@ -841,7 +888,7 @@ __webpack_require__.r(__webpack_exports__);
return returnValue;
};
this.guildSeparatorPatch = _pluginapi__WEBPACK_IMPORTED_MODULE_2__["default"].monkeyPatch(Guilds.prototype, "render", {
this.guildSeparatorPatch = _pluginapi__WEBPACK_IMPORTED_MODULE_1__["default"].monkeyPatch(Guilds.prototype, "render", {
after: data => {
data.returnValue.props.children[1].props.children[3].type = GuildSeparator;
}
@ -1291,6 +1338,7 @@ __webpack_require__.r(__webpack_exports__);
/* harmony import */ var _datastore__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./datastore */ "./src/modules/datastore.js");
/* harmony import */ var _publicservers__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./publicservers */ "./src/modules/publicservers.js");
/* harmony import */ var _settingspanel__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./settingspanel */ "./src/modules/settingspanel.js");
/* harmony import */ var _builtins_voicemode__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../builtins/voicemode */ "./src/builtins/voicemode.js");
@ -1304,6 +1352,7 @@ __webpack_require__.r(__webpack_exports__);
function Core() {}
Core.prototype.setConfig = function (config) {
@ -1338,6 +1387,7 @@ Core.prototype.init = async function () {
_bdv2__WEBPACK_IMPORTED_MODULE_0__["default"].initialize();
_utilities__WEBPACK_IMPORTED_MODULE_1__["default"].log("Startup", "Updating Settings");
_settingspanel__WEBPACK_IMPORTED_MODULE_9__["default"].initializeSettings();
_builtins_voicemode__WEBPACK_IMPORTED_MODULE_10__["default"].init();
_utilities__WEBPACK_IMPORTED_MODULE_1__["default"].log("Startup", "Loading Plugins");
const pluginErrors = _pluginmanager__WEBPACK_IMPORTED_MODULE_5__["default"].loadPlugins();
_utilities__WEBPACK_IMPORTED_MODULE_1__["default"].log("Startup", "Loading Themes");
@ -1884,10 +1934,6 @@ const EventEmitter = __webpack_require__(/*! events */ "events");
this.emit(eventName, ...args);
}
off(eventName, eventAction) {
this.removeListener(eventName, eventAction);
}
}());
/***/ }),
@ -2487,7 +2533,7 @@ EmoteModule.prototype.disableAutoCapitalize = function () {
/*!********************************!*\
!*** ./src/modules/modules.js ***!
\********************************/
/*! exports provided: React, ReactDOM, BDV2, BdApi, Core, ClassNormalizer, ContentManager, DataStore, DevMode, Emitter, EmoteMenu, EmoteModule, PluginManager, ThemeManager, VoiceMode, Utilities, WebpackModules, DiscordModules */
/*! exports provided: React, ReactDOM, BDV2, BdApi, Core, ClassNormalizer, ContentManager, DataStore, DevMode, Events, EmoteMenu, EmoteModule, PluginManager, ThemeManager, VoiceMode, Utilities, WebpackModules, DiscordModules */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@ -2524,7 +2570,7 @@ __webpack_require__.r(__webpack_exports__);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "DevMode", function() { return _devmode__WEBPACK_IMPORTED_MODULE_8__["default"]; });
/* harmony import */ var _emitter__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./emitter */ "./src/modules/emitter.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Emitter", function() { return _emitter__WEBPACK_IMPORTED_MODULE_9__["default"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Events", function() { return _emitter__WEBPACK_IMPORTED_MODULE_9__["default"]; });
/* harmony import */ var _emotemenu__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./emotemenu */ "./src/modules/emotemenu.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "EmoteMenu", function() { return _emotemenu__WEBPACK_IMPORTED_MODULE_10__["default"]; });
@ -3277,7 +3323,9 @@ __webpack_require__.r(__webpack_exports__);
/* harmony import */ var _voicemode__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./voicemode */ "./src/modules/voicemode.js");
/* harmony import */ var _emotes__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./emotes */ "./src/modules/emotes.js");
/* harmony import */ var _devmode__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./devmode */ "./src/modules/devmode.js");
/* harmony import */ var ui__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ui */ "./src/ui/ui.js");
/* harmony import */ var _emitter__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./emitter */ "./src/modules/emitter.js");
/* harmony import */ var ui__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ui */ "./src/ui/ui.js");
@ -3289,7 +3337,7 @@ __webpack_require__.r(__webpack_exports__);
/* harmony default export */ __webpack_exports__["default"] = (new class SettingsPanel {
constructor() {
this.renderer = new ui__WEBPACK_IMPORTED_MODULE_8__["SettingsPanel"]({
this.renderer = new ui__WEBPACK_IMPORTED_MODULE_9__["SettingsPanel"]({
onChange: this.updateSettings.bind(this)
});
}
@ -3299,6 +3347,7 @@ __webpack_require__.r(__webpack_exports__);
}
updateSettings(id, enabled) {
_emitter__WEBPACK_IMPORTED_MODULE_8__["default"].dispatch("setting-updated", "Modules", id, enabled);
data__WEBPACK_IMPORTED_MODULE_0__["SettingsCookie"][id] = enabled;
if (id == "bda-es-0") {
@ -3315,11 +3364,11 @@ __webpack_require__.r(__webpack_exports__);
if (id == "bda-gs-1") {
if (enabled) $("#bd-pub-li").show();else $("#bd-pub-li").hide();
}
} // if (id == "bda-gs-4") {
// if (enabled) VoiceMode.enable();
// else VoiceMode.disable();
// }
if (id == "bda-gs-4") {
if (enabled) _voicemode__WEBPACK_IMPORTED_MODULE_5__["default"].enable();else _voicemode__WEBPACK_IMPORTED_MODULE_5__["default"].disable();
}
if (id == "bda-gs-5") {
if (enabled) $("#app-mount").addClass("bda-dark");else $("#app-mount").removeClass("bda-dark");
@ -3371,8 +3420,8 @@ __webpack_require__.r(__webpack_exports__);
if (data__WEBPACK_IMPORTED_MODULE_0__["SettingsCookie"]["bda-gs-2"]) $("body").addClass("bd-minimal");
if (data__WEBPACK_IMPORTED_MODULE_0__["SettingsCookie"]["bda-gs-3"]) $("body").addClass("bd-minimal-chan");
if (data__WEBPACK_IMPORTED_MODULE_0__["SettingsCookie"]["bda-gs-1"]) $("#bd-pub-li").show();
if (data__WEBPACK_IMPORTED_MODULE_0__["SettingsCookie"]["bda-gs-4"]) _voicemode__WEBPACK_IMPORTED_MODULE_5__["default"].enable();
if (data__WEBPACK_IMPORTED_MODULE_0__["SettingsCookie"]["bda-gs-1"]) $("#bd-pub-li").show(); // if (SettingsCookie["bda-gs-4"]) VoiceMode.enable();
if (data__WEBPACK_IMPORTED_MODULE_0__["SettingsCookie"]["bda-gs-5"]) $("#app-mount").addClass("bda-dark");
if (data__WEBPACK_IMPORTED_MODULE_0__["SettingsCookie"]["bda-gs-6"]) _core__WEBPACK_IMPORTED_MODULE_4__["default"].inject24Hour();
if (data__WEBPACK_IMPORTED_MODULE_0__["SettingsCookie"]["bda-gs-7"]) _core__WEBPACK_IMPORTED_MODULE_4__["default"].injectColoredText();
@ -4514,6 +4563,76 @@ class WebpackModules {
/***/ }),
/***/ "./src/structs/builtin.js":
/*!********************************!*\
!*** ./src/structs/builtin.js ***!
\********************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return BuiltinModule; });
/* harmony import */ var data__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! data */ "./src/data/data.js");
/* harmony import */ var _modules_utilities__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../modules/utilities */ "./src/modules/utilities.js");
/* harmony import */ var _modules_emitter__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../modules/emitter */ "./src/modules/emitter.js");
class BuiltinModule {
get name() {
return "Unnamed Builtin";
}
get category() {
return "Modules";
}
get id() {
return "None";
}
async init() {
console.log("Init a builtin");
if (data__WEBPACK_IMPORTED_MODULE_0__["SettingsCookie"][this.id]) await this.enable();
_modules_emitter__WEBPACK_IMPORTED_MODULE_2__["default"].on("setting-updated", async (category, id, enabled) => {
console.log(category, id);
console.log(this.category, this.id);
if (category !== this.category || id !== this.id) return;
if (enabled) await this.enable();else await this.disable();
});
}
async enable() {
this.log("Enabled");
await this.enabled();
}
async disable() {
this.log("Disabled");
await this.disabled();
}
async enabled() {}
async disabled() {}
log(message) {
_modules_utilities__WEBPACK_IMPORTED_MODULE_1__["default"].log(this.name, message);
}
warn(message) {
_modules_utilities__WEBPACK_IMPORTED_MODULE_1__["default"].warn(this.name, message);
}
error(message) {
_modules_utilities__WEBPACK_IMPORTED_MODULE_1__["default"].err(this.name, message);
}
}
/***/ }),
/***/ "./src/ui/customcss/detached.js":
/*!**************************************!*\
!*** ./src/ui/customcss/detached.js ***!
@ -6403,7 +6522,9 @@ class V2C_SectionedSettingsPanel extends modules__WEBPACK_IMPORTED_MODULE_0__["R
return modules__WEBPACK_IMPORTED_MODULE_0__["React"].createElement("div", {
className: "contentColumn-2hrIYH contentColumnDefault-1VQkGM content-column default"
}, this.props.sections.map(section => {
return modules__WEBPACK_IMPORTED_MODULE_0__["React"].createElement(_settingsgroup__WEBPACK_IMPORTED_MODULE_1__["default"], Object.assign({}, section, this.props.onChange));
return modules__WEBPACK_IMPORTED_MODULE_0__["React"].createElement(_settingsgroup__WEBPACK_IMPORTED_MODULE_1__["default"], Object.assign({}, section, {
onChange: this.props.onChange
}));
}));
}
@ -6609,15 +6730,15 @@ class V2_SettingsPanel {
}
componentDidMount() {
modules__WEBPACK_IMPORTED_MODULE_1__["Emitter"].on(`${prefix}-reloaded`, this.onChange);
modules__WEBPACK_IMPORTED_MODULE_1__["Emitter"].on(`${prefix}-loaded`, this.onChange);
modules__WEBPACK_IMPORTED_MODULE_1__["Emitter"].on(`${prefix}-unloaded`, this.onChange);
modules__WEBPACK_IMPORTED_MODULE_1__["Events"].on(`${prefix}-reloaded`, this.onChange);
modules__WEBPACK_IMPORTED_MODULE_1__["Events"].on(`${prefix}-loaded`, this.onChange);
modules__WEBPACK_IMPORTED_MODULE_1__["Events"].on(`${prefix}-unloaded`, this.onChange);
}
componentWillUnmount() {
modules__WEBPACK_IMPORTED_MODULE_1__["Emitter"].off(`${prefix}-reloaded`, this.onChange);
modules__WEBPACK_IMPORTED_MODULE_1__["Emitter"].off(`${prefix}-loaded`, this.onChange);
modules__WEBPACK_IMPORTED_MODULE_1__["Emitter"].off(`${prefix}-unloaded`, this.onChange);
modules__WEBPACK_IMPORTED_MODULE_1__["Events"].off(`${prefix}-reloaded`, this.onChange);
modules__WEBPACK_IMPORTED_MODULE_1__["Events"].off(`${prefix}-loaded`, this.onChange);
modules__WEBPACK_IMPORTED_MODULE_1__["Events"].off(`${prefix}-unloaded`, this.onChange);
}
onChange() {

147
package-lock.json generated
View File

@ -1230,16 +1230,6 @@
"integrity": "sha1-p5SvDAWrF1KEbudTofIRoFugxE8=",
"dev": true
},
"array-includes": {
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.0.3.tgz",
"integrity": "sha1-GEtI9i2S10UrsxsyMWXH+L0CJm0=",
"dev": true,
"requires": {
"define-properties": "^1.1.2",
"es-abstract": "^1.7.0"
}
},
"array-initial": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/array-initial/-/array-initial-1.1.0.tgz",
@ -2510,15 +2500,6 @@
"randombytes": "^2.0.0"
}
},
"doctrine": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz",
"integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==",
"dev": true,
"requires": {
"esutils": "^2.0.2"
}
},
"domain-browser": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/domain-browser/-/domain-browser-1.2.0.tgz",
@ -2623,31 +2604,6 @@
"is-arrayish": "^0.2.1"
}
},
"es-abstract": {
"version": "1.13.0",
"resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.13.0.tgz",
"integrity": "sha512-vDZfg/ykNxQVwup/8E1BZhVzFfBxs9NqMzGcvIJrqg5k2/5Za2bWo40dK2J1pgLngZ7c+Shh8lwYtLGyrwPutg==",
"dev": true,
"requires": {
"es-to-primitive": "^1.2.0",
"function-bind": "^1.1.1",
"has": "^1.0.3",
"is-callable": "^1.1.4",
"is-regex": "^1.0.4",
"object-keys": "^1.0.12"
}
},
"es-to-primitive": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.0.tgz",
"integrity": "sha512-qZryBOJjV//LaxLTV6UC//WewneB3LcXOL9NP++ozKVXsIIIpm/2c13UDiD9Jp2eThsecw9m3jPqDwTyobcdbg==",
"dev": true,
"requires": {
"is-callable": "^1.1.4",
"is-date-object": "^1.0.1",
"is-symbol": "^1.0.2"
}
},
"es5-ext": {
"version": "0.10.49",
"resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.49.tgz",
@ -2698,32 +2654,6 @@
"integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=",
"dev": true
},
"eslint-plugin-react": {
"version": "7.13.0",
"resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.13.0.tgz",
"integrity": "sha512-uA5LrHylu8lW/eAH3bEQe9YdzpPaFd9yAJTwTi/i/BKTD7j6aQMKVAdGM/ML72zD6womuSK7EiGtMKuK06lWjQ==",
"dev": true,
"requires": {
"array-includes": "^3.0.3",
"doctrine": "^2.1.0",
"has": "^1.0.3",
"jsx-ast-utils": "^2.1.0",
"object.fromentries": "^2.0.0",
"prop-types": "^15.7.2",
"resolve": "^1.10.1"
},
"dependencies": {
"resolve": {
"version": "1.11.0",
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.11.0.tgz",
"integrity": "sha512-WL2pBDjqT6pGUNSUzMw00o4T7If+z4H2x3Gz893WoUQ5KW8Vr9txp00ykiP16VBaZF5+j/OcXJHZ9+PCvdiDKw==",
"dev": true,
"requires": {
"path-parse": "^1.0.6"
}
}
}
},
"eslint-scope": {
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-4.0.3.tgz",
@ -4012,15 +3942,6 @@
"glogg": "^1.0.0"
}
},
"has": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz",
"integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==",
"dev": true,
"requires": {
"function-bind": "^1.1.1"
}
},
"has-flag": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
@ -4245,12 +4166,6 @@
"integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==",
"dev": true
},
"is-callable": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.4.tgz",
"integrity": "sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA==",
"dev": true
},
"is-data-descriptor": {
"version": "0.1.4",
"resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz",
@ -4271,12 +4186,6 @@
}
}
},
"is-date-object": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.1.tgz",
"integrity": "sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY=",
"dev": true
},
"is-descriptor": {
"version": "0.1.6",
"resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz",
@ -4358,15 +4267,6 @@
"isobject": "^3.0.1"
}
},
"is-regex": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.4.tgz",
"integrity": "sha1-VRdIm1RwkbCTDglWVM7SXul+lJE=",
"dev": true,
"requires": {
"has": "^1.0.1"
}
},
"is-relative": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/is-relative/-/is-relative-1.0.0.tgz",
@ -4382,15 +4282,6 @@
"integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=",
"dev": true
},
"is-symbol": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.2.tgz",
"integrity": "sha512-HS8bZ9ox60yCJLH9snBpIwv9pYUAkcuLhSA1oero1UB5y9aiQpRA8y2ex945AOtCZL1lJDeIk3G5LthswI46Lw==",
"dev": true,
"requires": {
"has-symbols": "^1.0.0"
}
},
"is-unc-path": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/is-unc-path/-/is-unc-path-1.0.0.tgz",
@ -4487,15 +4378,6 @@
"minimist": "^1.2.0"
}
},
"jsx-ast-utils": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/jsx-ast-utils/-/jsx-ast-utils-2.1.0.tgz",
"integrity": "sha512-yDGDG2DS4JcqhA6blsuYbtsT09xL8AoLuUR2Gb5exrw7UEM19sBcOTq+YBBhrNbl0PUC4R4LnFu+dHg2HKeVvA==",
"dev": true,
"requires": {
"array-includes": "^3.0.3"
}
},
"just-debounce": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/just-debounce/-/just-debounce-1.0.0.tgz",
@ -5154,18 +5036,6 @@
"isobject": "^3.0.0"
}
},
"object.fromentries": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/object.fromentries/-/object.fromentries-2.0.0.tgz",
"integrity": "sha512-9iLiI6H083uiqUuvzyY6qrlmc/Gz8hLQFOcb/Ri/0xXFkSNS3ctV+CbE6yM2+AnkYfOB3dGjdzC0wrMLIhQICA==",
"dev": true,
"requires": {
"define-properties": "^1.1.2",
"es-abstract": "^1.11.0",
"function-bind": "^1.1.1",
"has": "^1.0.1"
}
},
"object.map": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/object.map/-/object.map-1.0.1.tgz",
@ -5511,17 +5381,6 @@
"integrity": "sha1-mEcocL8igTL8vdhoEputEsPAKeM=",
"dev": true
},
"prop-types": {
"version": "15.7.2",
"resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.7.2.tgz",
"integrity": "sha512-8QQikdH7//R2vurIJSutZ1smHYTcLpRWEOlHnzcWHmBYrOGUysKwSsrC89BCiFj3CbrfJ/nXFdJepOVrY1GCHQ==",
"dev": true,
"requires": {
"loose-envify": "^1.4.0",
"object-assign": "^4.1.1",
"react-is": "^16.8.1"
}
},
"prr": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/prr/-/prr-1.0.1.tgz",
@ -5612,12 +5471,6 @@
"safe-buffer": "^5.1.0"
}
},
"react-is": {
"version": "16.8.6",
"resolved": "https://registry.npmjs.org/react-is/-/react-is-16.8.6.tgz",
"integrity": "sha512-aUk3bHfZ2bRSVFFbbeVS4i+lNPZr3/WM5jT2J5omUVV1zzcs1nAaf3l51ctA5FFvCRbhrH0bdAsRRQddFJZPtA==",
"dev": true
},
"read-pkg": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-1.1.0.tgz",

View File

@ -30,7 +30,6 @@
"@babel/preset-react": "^7.0.0",
"@babel/register": "^7.0.0",
"babel-loader": "^8.0.6",
"eslint-plugin-react": "^7.13.0",
"gulp": "^4.0.0",
"gulp-babel-minify": "^0.5.0",
"gulp-csso": "^3.0.1",

25
src/builtins/voicemode.js Normal file
View File

@ -0,0 +1,25 @@
import Builtin from "../structs/builtin";
export default new class VoiceMode extends Builtin {
get name() {return "VoiceMode";}
get category() {return "Modules";}
get id() {return "bda-gs-4";}
enabled() {
$(".scroller.guild-channels ul").first().css("display", "none");
$(".scroller.guild-channels header").first().css("display", "none");
$(".app.flex-vertical, .app-2rEoOp").first().css("overflow", "hidden");
$(".chat-3bRxxu").first().css("visibility", "hidden").css("min-width", "0px");
$(".flex-vertical.channels-wrap").first().css("flex-grow", "100000");
$(".guild-header .btn.btn-hamburger").first().css("visibility", "hidden");
}
disabled() {
$(".scroller.guild-channels ul").first().css("display", "");
$(".scroller.guild-channels header").first().css("display", "");
$(".app.flex-vertical, .app-2rEoOp").first().css("overflow", "");
$(".chat-3bRxxu").first().css("visibility", "").css("min-width", "");
$(".flex-vertical.channels-wrap").first().css("flex-grow", "");
$(".guild-header .btn.btn-hamburger").first().css("visibility", "");
}
};

View File

@ -5,6 +5,7 @@ import BdApi from "./modules/pluginapi";
import PluginManager from "./modules/pluginmanager";
import ThemeManager from "./modules/thememanager";
import {bdPluginStorage} from "./modules/oldstorage";
import Events from "./modules/emitter";
// Perform some setup
proxyLocalStorage();
@ -26,6 +27,7 @@ window.bdplugins = Plugins;
window.bdEmotes = Emotes;
window.bemotes = EmoteBlacklist;
window.bdPluginStorage = bdPluginStorage;
window.BDEvents = Events;
export default class CoreWrapper {
constructor(config) {

View File

@ -1,5 +1,4 @@
import {SettingsInfo} from "data";
import WebpackModules, {DiscordModules} from "./webpackmodules";
import WebpackModules from "./webpackmodules";
import BdApi from "./pluginapi";
import BDLogo from "../ui/icons/bdlogo";

View File

@ -0,0 +1,88 @@
import {SettingsInfo} from "data";
import WebpackModules, {DiscordModules} from "./webpackmodules";
import Utilities from "./utilities";
import BDLogo from "../ui/icons/bdlogo";
const React = DiscordModules.React;
export default new class {
initialize() {
Utilities.suppressErrors(this.patchSocial.bind(this), "BD Social Patch")();
Utilities.suppressErrors(this.patchGuildPills.bind(this), "BD Guild Pills Patch")();
Utilities.suppressErrors(this.patchGuildListItems.bind(this), "BD Guild List Items Patch")();
Utilities.suppressErrors(this.patchGuildSeparator.bind(this), "BD Guild Separator Patch")();
}
patchSocial() {
if (this.socialPatch) return;
const TabBar = WebpackModules.getModule(m => m.displayName == "TabBar");
const Anchor = WebpackModules.getModule(m => m.displayName == "Anchor");
if (!TabBar || !Anchor) return;
this.socialPatch = Utilities.monkeyPatch(TabBar.prototype, "render", {after: (data) => {
const children = data.returnValue.props.children;
if (!children || !children.length) return;
if (children[children.length - 2].type.displayName !== "Separator") return;
if (!children[children.length - 1].type.toString().includes("socialLinks")) return;
const original = children[children.length - 1].type;
const newOne = function() {
const returnVal = original(...arguments);
returnVal.props.children.push(React.createElement(Anchor, {className: "bd-social-link", href: "https://github.com/rauenzi/BetterDiscordApp", rel: "author", title: "BandagedBD", target: "_blank"},
React.createElement(BDLogo, {size: "16px", className: "bd-social-logo"})
));
return returnVal;
};
children[children.length - 1].type = newOne;
}});
}
patchGuildListItems() {
if (this.guildListItemsPatch) return;
const listItemClass = this.guildClasses.listItem.split(" ")[0];
const blobClass = this.guildClasses.blobContainer.split(" ")[0];
const reactInstance = Utilities.getInternalInstance(document.querySelector(`.${listItemClass} .${blobClass}`).parentElement);
const GuildComponent = reactInstance.return.type;
if (!GuildComponent) return;
this.guildListItemsPatch = Utilities.monkeyPatch(GuildComponent.prototype, "render", {after: (data) => {
const returnValue = data.returnValue;
const guildData = data.thisObject.props;
returnValue.props.className += " bd-guild";
if (guildData.unread) returnValue.props.className += " bd-unread";
if (guildData.selected) returnValue.props.className += " bd-selected";
if (guildData.audio) returnValue.props.className += " bd-audio";
if (guildData.video) returnValue.props.className += " bd-video";
if (guildData.badge) returnValue.props.className += " bd-badge";
if (guildData.animatable) returnValue.props.className += " bd-animatable";
return returnValue;
}});
}
patchGuildPills() {
if (this.guildPillPatch) return;
const guildPill = WebpackModules.getModule(m => m.default && m.default.toString && m.default.toString().includes("translate3d"));
if (!guildPill) return;
this.guildPillPatch = Utilities.monkeyPatch(guildPill, "default", {after: (data) => {
const props = data.methodArguments[0];
if (props.unread) data.returnValue.props.className += " bd-unread";
if (props.selected) data.returnValue.props.className += " bd-selected";
if (props.hovered) data.returnValue.props.className += " bd-hovered";
return data.returnValue;
}});
}
patchGuildSeparator() {
if (this.guildSeparatorPatch) return;
const Guilds = WebpackModules.getByDisplayName("Guilds");
const guildComponents = WebpackModules.getByProps("renderListItem");
if (!guildComponents || !Guilds) return;
const GuildSeparator = function() {
const returnValue = guildComponents.Separator(...arguments);
returnValue.props.className += " bd-guild-separator";
return returnValue;
};
this.guildSeparatorPatch = Utilities.monkeyPatch(Guilds.prototype, "render", {after: (data) => {
data.returnValue.props.children[1].props.children[3].type = GuildSeparator;
}});
}
};

View File

@ -10,6 +10,7 @@ import ThemeManager from "./thememanager";
import DataStore from "./datastore";
import PublicServers from "./publicservers";
import SettingsPanel from "./settingspanel";
import VoiceMode from "../builtins/voicemode";
function Core() {
}
@ -47,6 +48,7 @@ Core.prototype.init = async function() {
BDV2.initialize();
Utilties.log("Startup", "Updating Settings");
SettingsPanel.initializeSettings();
VoiceMode.init();
Utilties.log("Startup", "Loading Plugins");
const pluginErrors = PluginManager.loadPlugins();

View File

@ -3,8 +3,4 @@ export default new class BDEvents extends EventEmitter {
dispatch(eventName, ...args) {
this.emit(eventName, ...args);
}
off(eventName, eventAction) {
this.removeListener(eventName, eventAction);
}
};

View File

@ -11,7 +11,7 @@ import ClassNormalizer from "./classnormalizer";
import ContentManager from "./contentmanager";
import DataStore from "./datastore";
import DevMode from "./devmode";
import Emitter from "./emitter";
import Events from "./emitter";
import EmoteMenu from "./emotemenu";
import EmoteModule from "./emotes";
import PluginManager from "./pluginmanager";
@ -23,7 +23,7 @@ export const React = DiscordModules.React;
export const ReactDOM = DiscordModules.ReactDOM;
export {BDV2, BdApi, Core, ClassNormalizer, ContentManager, DataStore, DevMode,
Emitter, EmoteMenu, EmoteModule, PluginManager, /*PublicServers,*/ ThemeManager,
Events, EmoteMenu, EmoteModule, PluginManager, /*PublicServers,*/ ThemeManager,
VoiceMode, Utilities, WebpackModules, DiscordModules};

View File

@ -3,9 +3,9 @@ import ClassNormalizer from "./classnormalizer";
import ContentManager from "./contentmanager";
import BdApi from "./pluginapi";
import Core from "./core";
import VoiceMode from "./voicemode";
import EmoteModule from "./emotes";
import DevMode from "./devmode";
import Events from "./emitter";
import {SettingsPanel as SettingsRenderer} from "ui";
@ -20,6 +20,7 @@ export default new class SettingsPanel {
}
updateSettings(id, enabled) {
Events.dispatch("setting-updated", "Modules", id, enabled);
SettingsCookie[id] = enabled;
if (id == "bda-es-0") {
@ -42,11 +43,6 @@ export default new class SettingsPanel {
else $("#bd-pub-li").hide();
}
if (id == "bda-gs-4") {
if (enabled) VoiceMode.enable();
else VoiceMode.disable();
}
if (id == "bda-gs-5") {
if (enabled) $("#app-mount").addClass("bda-dark");
else $("#app-mount").removeClass("bda-dark");
@ -106,7 +102,6 @@ export default new class SettingsPanel {
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();
if (SettingsCookie["bda-gs-4"]) VoiceMode.enable();
if (SettingsCookie["bda-gs-5"]) $("#app-mount").addClass("bda-dark");
if (SettingsCookie["bda-gs-6"]) Core.inject24Hour();
if (SettingsCookie["bda-gs-7"]) Core.injectColoredText();

45
src/structs/builtin.js Normal file
View File

@ -0,0 +1,45 @@
import {SettingsCookie} from "data";
import Utilities from "../modules/utilities";
import Events from "../modules/emitter";
export default class BuiltinModule {
get name() {return "Unnamed Builtin";}
get category() {return "Modules";}
get id() {return "None";}
async init() {
console.log("Init a builtin");
if (SettingsCookie[this.id]) await this.enable();
Events.on("setting-updated", async (category, id, enabled) => {
if (category !== this.category || id !== this.id) return;
if (enabled) await this.enable();
else await this.disable();
});
}
async enable() {
this.log("Enabled");
await this.enabled();
}
async disable() {
this.log("Disabled");
await this.disabled();
}
async enabled() {}
async disabled() {}
log(message) {
Utilities.log(this.name, message);
}
warn(message) {
Utilities.warn(this.name, message);
}
error(message) {
Utilities.err(this.name, message);
}
}

View File

@ -11,7 +11,7 @@ export default class V2C_SectionedSettingsPanel extends React.Component {
return React.createElement(
"div", {className: "contentColumn-2hrIYH contentColumnDefault-1VQkGM content-column default"},
this.props.sections.map(section => {
return React.createElement(SettingsGroup, Object.assign({}, section, this.props.onChange));
return React.createElement(SettingsGroup, Object.assign({}, section, {onChange: this.props.onChange}));
})
);
}

View File

@ -1,5 +1,5 @@
import {SettingsInfo, SettingsCookie, Plugins, Themes} from "data";
import {React, ReactDOM, Utilities, ContentManager, Emitter, EmoteModule, EmoteMenu, PluginManager, ThemeManager} from "modules";
import {React, ReactDOM, Utilities, ContentManager, Events, EmoteModule, EmoteMenu, PluginManager, ThemeManager} from "modules";
import Sidebar from "./sidebar";
import Scroller from "../scroller";
import List from "../list";
@ -131,15 +131,15 @@ export default class V2_SettingsPanel {
}
componentDidMount() {
Emitter.on(`${prefix}-reloaded`, this.onChange);
Emitter.on(`${prefix}-loaded`, this.onChange);
Emitter.on(`${prefix}-unloaded`, this.onChange);
Events.on(`${prefix}-reloaded`, this.onChange);
Events.on(`${prefix}-loaded`, this.onChange);
Events.on(`${prefix}-unloaded`, this.onChange);
}
componentWillUnmount() {
Emitter.off(`${prefix}-reloaded`, this.onChange);
Emitter.off(`${prefix}-loaded`, this.onChange);
Emitter.off(`${prefix}-unloaded`, this.onChange);
Events.off(`${prefix}-reloaded`, this.onChange);
Events.off(`${prefix}-loaded`, this.onChange);
Events.off(`${prefix}-unloaded`, this.onChange);
}
onChange() {