diff --git a/client/src/modules/contentconfig.js b/client/src/modules/contentconfig.js
deleted file mode 100644
index b5c23cca..00000000
--- a/client/src/modules/contentconfig.js
+++ /dev/null
@@ -1,31 +0,0 @@
-/**
- * BetterDiscord Content Config Utility
- * Copyright (c) 2015-present Jiiks/JsSucks - https://github.com/Jiiks / https://github.com/JsSucks
- * All rights reserved.
- * https://betterdiscord.net
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
-*/
-
-
-export default class ContentConfig {
-
- constructor(data) {
- this.data = data;
- }
-
- map(cb) {
- return this.data.map(cb);
- }
-
- strip() {
- return this.map(cat => ({
- category: cat.category,
- settings: cat.settings.map(setting => ({
- id: setting.id, value: setting.value
- }))
- }));
- }
-
-}
diff --git a/client/src/modules/plugin.js b/client/src/modules/plugin.js
index 2f75189b..dd02e8f4 100644
--- a/client/src/modules/plugin.js
+++ b/client/src/modules/plugin.js
@@ -12,7 +12,6 @@ import { Utils, FileUtils } from 'common';
import { Modals } from 'ui';
import { EventEmitter } from 'events';
import PluginManager from './pluginmanager';
-import ContentConfig from './contentconfig';
import { SettingUpdatedEvent, SettingsUpdatedEvent } from 'structs';
class PluginEvents {
diff --git a/client/src/modules/theme.js b/client/src/modules/theme.js
index 0659416d..5b2eb083 100644
--- a/client/src/modules/theme.js
+++ b/client/src/modules/theme.js
@@ -13,7 +13,6 @@ import { EventEmitter } from 'events';
import { SettingUpdatedEvent, SettingsUpdatedEvent } from 'structs';
import { DOM, Modals } from 'ui';
import { Utils, FileUtils, ClientIPC, ClientLogger as Logger } from 'common';
-import ContentConfig from './contentconfig';
class ThemeEvents {
constructor(theme) {
diff --git a/client/src/structs/settings/types/array.js b/client/src/structs/settings/types/array.js
index a1c76994..1cd15377 100644
--- a/client/src/structs/settings/types/array.js
+++ b/client/src/structs/settings/types/array.js
@@ -97,7 +97,6 @@ export default class ArraySetting extends Setting {
setValue(value, emit_multi = true, emit = true) {
this.items = value;
- // this.__proto__.__proto__.apply(this, arguments);
}
updateValue(emit_multi = true, emit = true) {
@@ -114,7 +113,7 @@ export default class ArraySetting extends Setting {
for (let category of this.settings) {
for (let setting of category.settings) {
- if (setting.type === 'array' || setting.type === 'custom') setting.setContentPath(contentPath);
+ setting.setContentPath(contentPath);
}
}
}
diff --git a/client/src/ui/components/BdSettings.vue b/client/src/ui/components/BdSettings.vue
index 11a1d5fb..22aed78e 100644
--- a/client/src/ui/components/BdSettings.vue
+++ b/client/src/ui/components/BdSettings.vue
@@ -103,13 +103,11 @@
},
activeContent(s) {
const item = this.sidebarItems.find(item => item.contentid === s);
- if (!item) return false;
- return item.id === this.activeIndex;
+ return item && item.id === this.activeIndex;
},
animatingContent(s) {
const item = this.sidebarItems.find(item => item.contentid === s);
- if (!item) return false;
- return item.id === this.lastActiveIndex;
+ return item && item.id === this.lastActiveIndex;
},
changeSetting(set_id, category_id, setting_id, value) {
Settings.setSetting(set_id, category_id, setting_id, value);
diff --git a/client/src/ui/components/bd/modals/SettingsModal.vue b/client/src/ui/components/bd/modals/SettingsModal.vue
index 2c11c20f..a9b64520 100644
--- a/client/src/ui/components/bd/modals/SettingsModal.vue
+++ b/client/src/ui/components/bd/modals/SettingsModal.vue
@@ -28,7 +28,7 @@
import Vue from 'vue';
import { Modal } from '../../common';
import SettingsPanel from '../SettingsPanel.vue';
- import { Utils } from 'common';
+ import { Utils, ClientLogger as Logger } from 'common';
export default {
props: ['modal'],
@@ -50,41 +50,23 @@
}
},
methods: {
- // settingChange(category_id, setting_id, value) {
- // console.log(`Setting ${category_id}/${setting_id} to ${value}`, this.configCache);
- //
- // const category = this.configCache.find(c => c.category === category_id);
- // if (!category) return;
- //
- // const setting = category.settings.find(s => s.id === setting_id);
- // if (!setting) return;
- //
- // setting.value = value;
- //
- // // this.changed = this.checkForChanges();
- // this.$forceUpdate();
- // },
async saveSettings() {
if (this.saving) return;
this.saving = true;
try {
if (this.modal.saveSettings) await this.modal.saveSettings(this.settings);
- // this.cloneSettings();
+ else this.modal.settings.merge(this.settings);
} catch (err) {
// TODO Display error that settings failed to save
- console.log(err);
+ Logger.err('SettingsModal', ['Failed to save settings:', err]);
}
this.saving = false;
},
resetSettings() {
if (this.saving) return;
- // this.configCache = JSON.parse(JSON.stringify(this.modal.settings));
- // this.changed = false;
this.cloneSettings();
- this.$forceUpdate();
},
cloneSettings() {
- console.log('Cloning settings');
this.settings = this.modal.dont_clone ? this.modal.settings : this.modal.settings.clone();
}
},
@@ -98,16 +80,10 @@
};
this.modal.settings.on('settings-updated', this.cloneSettings);
+ this.cloneSettings();
},
destroyed() {
this.modal.settings.off('settings-updated', this.cloneSettings);
- },
- beforeMount() {
- // this.configCache = JSON.parse(JSON.stringify(this.modal.settings));
- // this.changed = this.checkForChanges();
- console.log(this);
- this.cloneSettings();
- // this.settings = this.modal.dont_clone ? this.modal.settings : this.modal.settings.clone();
}
}
diff --git a/client/src/ui/components/bd/setting/Array.vue b/client/src/ui/components/bd/setting/Array.vue
index a1e8e660..850a226f 100644
--- a/client/src/ui/components/bd/setting/Array.vue
+++ b/client/src/ui/components/bd/setting/Array.vue
@@ -47,26 +47,15 @@
components: {
MiSettings, MiOpenInNew, MiMinus
},
- watch: {
- setting(value) {
- // this.setting was changed
- }
- },
methods: {
addItem(openModal) {
if (this.setting.disabled || this.setting.max && this.setting.items.length >= this.setting.max) return;
- // const item = { settings: this.getItemSettings({}) };
const item = this.setting.addItem();
if (openModal) this.showModal(item, this.setting.items.length);
- // this.update();
- // this.$forceUpdate();
},
removeItem(item) {
if (this.setting.disabled || this.setting.min && this.setting.items.length <= this.setting.min) return;
- // this.setting.items = this.setting.items.filter(i => i !== item);
this.setting.removeItem(item);
- // this.update();
- this.$forceUpdate();
},
changeInItem(item, category_id, setting_id, value) {
console.log('Setting', item, category_id, setting_id, 'to', value);
@@ -79,7 +68,6 @@
setting.value = value;
setting.changed = !Utils.compare(setting.value, setting.old_value);
- // this.update();
},
showModal(item, index) {
Modals.settings(item, this.setting.headertext ? this.setting.headertext.replace(/%n/, index + 1) : this.setting.text + ` #${index + 1}`);
diff --git a/client/src/ui/components/bd/setting/Dropdown.vue b/client/src/ui/components/bd/setting/Dropdown.vue
index 365cc2f9..03b38946 100644
--- a/client/src/ui/components/bd/setting/Dropdown.vue
+++ b/client/src/ui/components/bd/setting/Dropdown.vue
@@ -15,7 +15,7 @@