stuff
This commit is contained in:
parent
cfe613fe0e
commit
4eef6d4a1b
|
@ -6116,7 +6116,7 @@ var BDFDB = {myPlugins: BDFDB && BDFDB.myPlugins || {}, cleanUps: BDFDB && BDFDB
|
|||
}
|
||||
} : LibraryComponents.SettingsLabel;
|
||||
|
||||
LibraryComponents.SettingsSwitch = reactInitialized ? class BDFDB_SettingsSwitch extends LibraryModules.React.Component {
|
||||
LibraryComponents.SettingsSaveItem = reactInitialized ? class BDFDB_SettingsSaveItem extends LibraryModules.React.Component {
|
||||
saveSettings(value) {
|
||||
if (typeof this.props.onChange == "function") this.props.onChange(value, this);
|
||||
let keys = this.props.keys.filter(n => n);
|
||||
|
@ -6125,7 +6125,7 @@ var BDFDB = {myPlugins: BDFDB && BDFDB.myPlugins || {}, cleanUps: BDFDB && BDFDB
|
|||
var data = BDFDB.DataUtils.load(this.props.plugin, option);
|
||||
var newdata = "";
|
||||
for (let key of keys) newdata += `{"${key}":`;
|
||||
newdata += value + "}".repeat(keys.length);
|
||||
newdata += (value != null && value.value != null ? value.value : value) + "}".repeat(keys.length);
|
||||
newdata = JSON.parse(newdata);
|
||||
if (BDFDB.ObjectUtils.is(newdata)) BDFDB.ObjectUtils.deepAssign(data, newdata);
|
||||
else data = newdata;
|
||||
|
@ -6134,7 +6134,16 @@ var BDFDB = {myPlugins: BDFDB && BDFDB.myPlugins || {}, cleanUps: BDFDB && BDFDB
|
|||
}
|
||||
}
|
||||
render() {
|
||||
if (typeof this.props.type != "string" || !["SELECT", "SWITCH", "TEXTINPUT"].includes(this.props.type.toUpperCase())) return null;
|
||||
return BDFDB.ReactUtils.createElement(LibraryComponents.SettingsItem, Object.assign({keys:[]}, this.props, {
|
||||
onChange: this.saveSettings.bind(this)
|
||||
}));
|
||||
}
|
||||
} : LibraryComponents.SettingsSaveItem;
|
||||
|
||||
LibraryComponents.SettingsSwitch = reactInitialized ? class BDFDB_SettingsSwitch extends LibraryModules.React.Component { // REMOVE
|
||||
render() {
|
||||
return BDFDB.ReactUtils.createElement(LibraryComponents.SettingsSaveItem, Object.assign({keys:[]}, this.props, {
|
||||
type: "Switch",
|
||||
onChange: this.saveSettings.bind(this)
|
||||
}));
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -125,9 +125,9 @@ class BadgesEverywhere {
|
|||
getSettingsPanel () {
|
||||
if (!global.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
|
||||
let settings = BDFDB.DataUtils.get(this, "settings");
|
||||
var badges = BDFDB.DataUtils.get(this, "badges");
|
||||
var indicators = BDFDB.DataUtils.get(this, "indicators");
|
||||
var settingsitems = [], inneritems = [];
|
||||
let badges = BDFDB.DataUtils.get(this, "badges");
|
||||
let indicators = BDFDB.DataUtils.get(this, "indicators");
|
||||
let settingsitems = [], inneritems = [];
|
||||
|
||||
for (let key in settings) settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSwitch, {
|
||||
className: BDFDB.disCN.marginbottom8,
|
||||
|
|
|
@ -56,8 +56,9 @@ class EditChannels {
|
|||
let settings = BDFDB.DataUtils.get(this, "settings");
|
||||
var settingsitems = [], inneritems = [];
|
||||
|
||||
for (let key in settings) (!this.defaults.settings[key].inner ? settingsitems : inneritems).push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSwitch, {
|
||||
for (let key in settings) (!this.defaults.settings[key].inner ? settingsitems : inneritems).push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
|
||||
className: BDFDB.disCN.marginbottom8,
|
||||
type: "Switch",
|
||||
plugin: this,
|
||||
keys: ["settings", key],
|
||||
label: this.defaults.settings[key].description,
|
||||
|
|
|
@ -39,8 +39,9 @@ class EditServers {
|
|||
let settings = BDFDB.DataUtils.get(this, "settings");
|
||||
var settingsitems = [], inneritems = [];
|
||||
|
||||
for (let key in settings) (!this.defaults.settings[key].inner ? settingsitems : inneritems).push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSwitch, {
|
||||
for (let key in settings) (!this.defaults.settings[key].inner ? settingsitems : inneritems).push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
|
||||
className: BDFDB.disCN.marginbottom8,
|
||||
type: "Switch",
|
||||
plugin: this,
|
||||
keys: ["settings", key],
|
||||
label: this.defaults.settings[key].description,
|
||||
|
|
|
@ -102,8 +102,9 @@ class EditUsers {
|
|||
let settings = BDFDB.DataUtils.get(this, "settings");
|
||||
var settingsitems = [], inneritems = [];
|
||||
|
||||
for (let key in settings) (!this.defaults.settings[key].inner ? settingsitems : inneritems).push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSwitch, {
|
||||
for (let key in settings) (!this.defaults.settings[key].inner ? settingsitems : inneritems).push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
|
||||
className: BDFDB.disCN.marginbottom8,
|
||||
type: "Switch",
|
||||
plugin: this,
|
||||
keys: ["settings", key],
|
||||
label: this.defaults.settings[key].description,
|
||||
|
|
|
@ -94,8 +94,9 @@ class GoogleTranslateOption {
|
|||
|
||||
settingsitems = settingsitems.concat(this.createSelects(false));
|
||||
|
||||
for (let key in settings) settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSwitch, {
|
||||
for (let key in settings) settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
|
||||
className: BDFDB.disCN.marginbottom8,
|
||||
type: "Switch",
|
||||
plugin: this,
|
||||
keys: ["settings", key],
|
||||
label: this.defaults.settings[key].description,
|
||||
|
|
|
@ -61,8 +61,9 @@ class ReadAllNotificationsButton {
|
|||
let settings = BDFDB.DataUtils.get(this, "settings");
|
||||
var settingsitems = [], inneritems = [];
|
||||
|
||||
for (let key in settings) (!this.defaults.settings[key].inner ? settingsitems : inneritems).push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSwitch, {
|
||||
for (let key in settings) (!this.defaults.settings[key].inner ? settingsitems : inneritems).push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
|
||||
className: BDFDB.disCN.marginbottom8,
|
||||
type: "Switch",
|
||||
plugin: this,
|
||||
keys: ["settings", key],
|
||||
label: this.defaults.settings[key].description,
|
||||
|
|
Loading…
Reference in New Issue