This commit is contained in:
Mirco Wittrien 2020-03-28 07:55:39 +01:00
parent 6a807073ce
commit 588df57e2e
40 changed files with 458 additions and 459 deletions

View File

@ -299,9 +299,9 @@
};
BDFDB.PluginUtils.createSettingsPanel = function (plugin, children) {
if (!BDFDB.ObjectUtils.is(plugin) || !children || (!BDFDB.ReactUtils.isValidElement(children) && !BDFDB.ArrayUtils.is(children)) || (BDFDB.ArrayUtils.is(children) && !children.length)) return;
let settingsPanel = BDFDB.DOMUtils.create(`<div class="${plugin.name}-settings ${BDFDB.disCN.settingspanel}"></div>`);
let settingsPanel = BDFDB.DOMUtils.create(`<div class="${plugin.name}-settings ${BDFDB.disCN.settingsPanel}"></div>`);
BDFDB.ReactUtils.render(BDFDB.ReactUtils.createElement(InternalComponents.LibraryComponents.SettingsPanel, {
key: `${plugin.name}-settingspanel`,
key: `${plugin.name}-settingsPanel`,
title: plugin.name,
children
}), settingsPanel);
@ -1137,7 +1137,7 @@
WebModulesData.SpecialFilter = {
V2C_ContentColumn: ins => ins && ins.return && ins.return.stateNode && ins.return.stateNode.props && typeof ins.return.stateNode.props.title == "string" && (ins.return.stateNode.props.title.toUpperCase().indexOf("PLUGINS") == 0 || ins.return.stateNode.props.title.toUpperCase().indexOf("THEMES") == 0) && ins.return.type,
V2C_PluginCard: ins => ins && ins.return && ins.return.stateNode && ins.return.stateNode.props && ins.return.stateNode.props.addon && ins.return.stateNode.props.addon.plugin && ins.return.type,
V2C_ThemeCard: ins => ins && ins.return && ins.return.stateNode && ins.return.stateNode.props && ins.return.stateNode.props.addon && ins.return.stateNode.props.addon.theme && ins.return.type
V2C_ThemeCard: ins => ins && ins.return && ins.return.stateNode && ins.return.stateNode.props && ins.return.stateNode.props.addon && ins.return.stateNode.props.addon.css && ins.return.type
};
WebModulesData.PatchFinder = {
Account: "accountinfo",
@ -5602,7 +5602,7 @@
settingsitemroleinner: ["ItemRole", "roleInner"],
settingsitemselected: ["Item", "selected"],
settingsitemthemed: ["Item", "themed"],
settingspanel: ["BDFDB", "settingsPanel"],
settingsPanel: ["BDFDB", "settingsPanel"],
settingspanelinner: ["BDFDB", "settingsPanelInner"],
settingspanellist: ["BDFDB", "settingsPanelList"],
settingspaneltitle: ["BDFDB", "settingsPanelTitle"],
@ -6364,7 +6364,7 @@
InternalComponents.LibraryComponents.AddonCard = BDFDB.ReactUtils.getValue(window.BDFDB, "LibraryComponents.AddonCard") || reactInitialized && class BDFDB_AddonCard extends LibraryModules.React.Component {
render() {
return !BDFDB.ObjectUtils.is(this.props.data) ? null : BDFDB.ReactUtils.createElement("li", {
return !BDFDB.ObjectUtils.is(this.props.data) ? null : BDFDB.ReactUtils.createElement("div", {
className: BDFDB.DOMUtils.formatClassName(BDFDB.disCN._repoentry, this.props.className, BDFDB.disCN._repocard, BDFDB.disCN._reposettingsclosed, BDFDB.disCN._repocheckboxitem),
children: [
BDFDB.ReactUtils.createElement("div", {
@ -9126,9 +9126,9 @@
children.push(wrapper.firstChild);
wrapper.firstChild.remove();
}
let closebutton = BDFDB.DOMUtils.create(`<div style="float: right; cursor: pointer;"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 12" style="width: 18px; height: 18px;"><g class="background" fill="none" fill-rule="evenodd"><path d="M0 0h12v12H0"></path><path class="fill" fill="#dcddde" d="M9.5 3.205L8.795 2.5 6 5.295 3.205 2.5l-.705.705L5.295 6 2.5 8.795l.705.705L6 6.705 8.795 9.5l.705-.705L6.705 6"></path></g></svg></div>`);
wrapper.appendChild(closebutton);
closebutton.addEventListener("click", _ => {
let closeButton = BDFDB.DOMUtils.create(`<div style="float: right; cursor: pointer;"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 12" style="width: 18px; height: 18px;"><g class="background" fill="none" fill-rule="evenodd"><path d="M0 0h12v12H0"></path><path class="fill" fill="#dcddde" d="M9.5 3.205L8.795 2.5 6 5.295 3.205 2.5l-.705.705L5.295 6 2.5 8.795l.705.705L6 6.705 8.795 9.5l.705-.705L6.705 6"></path></g></svg></div>`);
wrapper.appendChild(closeButton);
closeButton.addEventListener("click", _ => {
BDFDB.DOMUtils.removeClass(wrapper, BDFDB.disCN._reposettingsopen);
BDFDB.DOMUtils.addClass(wrapper, BDFDB.disCN._reposettingsclosed);
while (wrapper.childElementCount) wrapper.firstChild.remove();
@ -9142,16 +9142,16 @@
}
}
};
InternalBDFDB.processV2CPluginCard = function (e) {InternalBDFDB._processCard(e, e.instance.props.addon && e.instance.props.addon.plugin || e.instance.props.plugin);};
InternalBDFDB.processV2CThemeCard = function (e) {InternalBDFDB._processCard(e, e.instance.props.addon && e.instance.props.addon.theme || e.instance.props.theme);};
InternalBDFDB.processV2CPluginCard = function (e) {InternalBDFDB._processCard(e, e.instance.props.addon && e.instance.props.addon.plugin);};
InternalBDFDB.processV2CThemeCard = function (e) {InternalBDFDB._processCard(e, e.instance.props.addon);};
InternalBDFDB.createLibrarySettings = function () {
if (!window.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded) return;
let settings = BDFDB.DataUtils.get(BDFDB, "settings");
let settingspanel, settingsitems = [];
let settingsPanel, settingsItems = [];
let bdToastSetting = BDFDB.BDUtils.getSettings("fork-ps-2");
for (let key in settings) settingsitems.push(BDFDB.ReactUtils.createElement(InternalComponents.LibraryComponents.SettingsSaveItem, {
for (let key in settings) settingsItems.push(BDFDB.ReactUtils.createElement(InternalComponents.LibraryComponents.SettingsSaveItem, {
className: BDFDB.disCN.marginbottom8,
type: "Switch",
plugin: BDFDB,
@ -9163,7 +9163,7 @@
value: settings[key] || key == "showToasts" && bdToastSetting
}));
return settingspanel = BDFDB.PluginUtils.createSettingsPanel(BDFDB, settingsitems);
return settingsPanel = BDFDB.PluginUtils.createSettingsPanel(BDFDB, settingsItems);
};
let MessageHeaderExport = BDFDB.ModuleUtils.findByProperties("MessageTimestamp", false);

File diff suppressed because one or more lines are too long

View File

@ -143,9 +143,9 @@ var BadgesEverywhere = (_ => {
let settings = BDFDB.DataUtils.get(this, "settings");
let badges = BDFDB.DataUtils.get(this, "badges");
let indicators = BDFDB.DataUtils.get(this, "indicators");
let settingspanel, settingsitems = [], inneritems = [];
let settingsPanel, settingsItems = [], innerItems = [];
for (let key in settings) settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
for (let key in settings) settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
className: BDFDB.disCN.marginbottom8,
type: "Switch",
plugin: this,
@ -153,7 +153,7 @@ var BadgesEverywhere = (_ => {
label: this.defaults.settings[key].description,
value: settings[key]
}));
for (let flag in badges) inneritems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
for (let flag in badges) innerItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
className: BDFDB.disCN.marginbottom8,
type: "Switch",
plugin: this,
@ -162,7 +162,7 @@ var BadgesEverywhere = (_ => {
value: badges[flag],
labelchildren: this.createSettingsBadges(flag)
}));
for (let flag in indicators) inneritems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
for (let flag in indicators) innerItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
className: BDFDB.disCN.marginbottom8,
type: "Switch",
plugin: this,
@ -171,14 +171,14 @@ var BadgesEverywhere = (_ => {
value: indicators[flag],
labelchildren: this.createSettingsBadges(flag)
}));
settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsPanelInner, {
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsPanelInner, {
title: "Display Badges:",
first: settingsitems.length == 0,
first: settingsItems.length == 0,
last: true,
children: inneritems
children: innerItems
}));
return settingspanel = BDFDB.PluginUtils.createSettingsPanel(this, settingsitems);
return settingsPanel = BDFDB.PluginUtils.createSettingsPanel(this, settingsItems);
}
//legacy

View File

@ -35,9 +35,9 @@ var BetterSearchPage = (_ => {
getSettingsPanel () {
if (!window.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
let settings = BDFDB.DataUtils.get(this, "settings");
let settingspanel, settingsitems = [];
let settingsPanel, settingsItems = [];
for (let key in settings) settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
for (let key in settings) settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
className: BDFDB.disCN.marginbottom8,
type: "Switch",
plugin: this,
@ -46,7 +46,7 @@ var BetterSearchPage = (_ => {
value: settings[key]
}));
return settingspanel = BDFDB.PluginUtils.createSettingsPanel(this, settingsitems);
return settingsPanel = BDFDB.PluginUtils.createSettingsPanel(this, settingsItems);
}
//legacy

View File

@ -50,9 +50,9 @@ var ChatAliases = (_ => {
if (!window.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
let settings = BDFDB.DataUtils.get(this, "settings");
let amounts = BDFDB.DataUtils.get(this, "amounts");
let settingspanel, settingsitems = [], inneritems = [];
let settingsPanel, settingsItems = [], innerItems = [];
for (let key in settings) inneritems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
for (let key in settings) innerItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
className: BDFDB.disCN.marginbottom8,
type: "Switch",
plugin: this,
@ -60,7 +60,7 @@ var ChatAliases = (_ => {
label: this.defaults.settings[key].description,
value: settings[key]
}));
for (let key in amounts) inneritems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
for (let key in amounts) innerItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
className: BDFDB.disCN.marginbottom8,
type: "TextInput",
childProps: {
@ -74,13 +74,13 @@ var ChatAliases = (_ => {
max: this.defaults.amounts[key].max,
value: amounts[key]
}));
settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.CollapseContainer, {
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.CollapseContainer, {
title: "Settings",
collapseStates: collapseStates,
children: inneritems
children: innerItems
}));
let values = {wordvalue:"", replacevalue:""};
settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.CollapseContainer, {
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.CollapseContainer, {
title: "Add new Alias",
collapseStates: collapseStates,
dividertop: true,
@ -92,14 +92,14 @@ var ChatAliases = (_ => {
disabled: !Object.keys(values).every(valuename => values[valuename]),
children: BDFDB.LanguageUtils.LanguageStrings.ADD,
onClick: _ => {
this.saveWord(values.wordvalue, values.replacevalue, settingspanel.querySelector(".input-replacevalue input[type='file']"));
BDFDB.PluginUtils.refreshSettingsPanel(this, settingspanel, collapseStates);
this.saveWord(values.wordvalue, values.replacevalue, settingsPanel.querySelector(".input-replacevalue input[type='file']"));
BDFDB.PluginUtils.refreshSettingsPanel(this, settingsPanel, collapseStates);
}
}),
this.createInputs(values)
].flat(10).filter(n => n)
}));
if (!BDFDB.ObjectUtils.isEmpty(this.aliases)) settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.CollapseContainer, {
if (!BDFDB.ObjectUtils.isEmpty(this.aliases)) settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.CollapseContainer, {
title: "Added Aliases",
collapseStates: collapseStates,
dividertop: true,
@ -143,11 +143,11 @@ var ChatAliases = (_ => {
onRemove: (e, instance) => {
delete this.aliases[instance.props.cardId];
BDFDB.DataUtils.save(this.aliases, this, "words");
BDFDB.PluginUtils.refreshSettingsPanel(this, settingspanel, collapseStates);
BDFDB.PluginUtils.refreshSettingsPanel(this, settingsPanel, collapseStates);
}
})
}));
settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.CollapseContainer, {
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.CollapseContainer, {
title: "Remove All",
collapseStates: collapseStates,
dividertop: true,
@ -160,13 +160,13 @@ var ChatAliases = (_ => {
BDFDB.ModalUtils.confirm(this, "Are you sure you want to remove all added Aliases?", _ => {
this.aliases = {};
BDFDB.DataUtils.remove(this, "words");
BDFDB.PluginUtils.refreshSettingsPanel(this, settingspanel, collapseStates);
BDFDB.PluginUtils.refreshSettingsPanel(this, settingsPanel, collapseStates);
});
},
children: BDFDB.LanguageUtils.LanguageStrings.REMOVE
})
}));
settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.CollapseContainer, {
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.CollapseContainer, {
title: "Config Guide",
collapseStates: collapseStates,
dividertop: true,
@ -176,7 +176,7 @@ var ChatAliases = (_ => {
}))
}));
return settingspanel = BDFDB.PluginUtils.createSettingsPanel(this, settingsitems);
return settingsPanel = BDFDB.PluginUtils.createSettingsPanel(this, settingsItems);
}
//legacy

View File

@ -55,9 +55,9 @@ var ChatFilter = (_ => {
if (!window.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
let settings = BDFDB.DataUtils.get(this, "settings");
let replaces = BDFDB.DataUtils.get(this, "replaces");
let settingspanel, settingsitems = [];
let settingsPanel, settingsItems = [];
settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.CollapseContainer, {
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.CollapseContainer, {
title: "Settings",
collapseStates: collapseStates,
children: Object.keys(settings).map(key => BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
@ -78,7 +78,7 @@ var ChatFilter = (_ => {
})))
}));
let values = {wordvalue:"", replacevalue:"", choice:"blocked"};
settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.CollapseContainer, {
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.CollapseContainer, {
title: `Add new blocked/censored Word`,
collapseStates: collapseStates,
dividertop: true,
@ -91,13 +91,13 @@ var ChatFilter = (_ => {
children: BDFDB.LanguageUtils.LanguageStrings.ADD,
onClick: _ => {
this.saveWord(values);
BDFDB.PluginUtils.refreshSettingsPanel(this, settingspanel, collapseStates);
BDFDB.PluginUtils.refreshSettingsPanel(this, settingsPanel, collapseStates);
}
}),
this.createInputs(values)
].flat(10).filter(n => n)
}));
for (let rtype in replaces) if (!BDFDB.ObjectUtils.isEmpty(words[rtype])) settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.CollapseContainer, {
for (let rtype in replaces) if (!BDFDB.ObjectUtils.isEmpty(words[rtype])) settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.CollapseContainer, {
title: `Added ${rtype} Words`,
collapseStates: collapseStates,
dividertop: true,
@ -141,11 +141,11 @@ var ChatFilter = (_ => {
onRemove: (e, instance) => {
delete words[rtype][instance.props.cardId];
BDFDB.DataUtils.save(words, this, "words");
BDFDB.PluginUtils.refreshSettingsPanel(this, settingspanel, collapseStates);
BDFDB.PluginUtils.refreshSettingsPanel(this, settingsPanel, collapseStates);
}
})
}));
settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.CollapseContainer, {
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.CollapseContainer, {
title: "Remove All",
collapseStates: collapseStates,
dividertop: true,
@ -158,13 +158,13 @@ var ChatFilter = (_ => {
BDFDB.ModalUtils.confirm(this, `Are you sure you want to remove all ${rtype} Words?`, _ => {
words[rtype] = {};
BDFDB.DataUtils.remove(this, "words", rtype);
BDFDB.PluginUtils.refreshSettingsPanel(this, settingspanel, collapseStates);
BDFDB.PluginUtils.refreshSettingsPanel(this, settingsPanel, collapseStates);
});
},
children: BDFDB.LanguageUtils.LanguageStrings.REMOVE
}))
}));
settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.CollapseContainer, {
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.CollapseContainer, {
title: "Config Guide",
collapseStates: collapseStates,
dividertop: true,
@ -174,7 +174,7 @@ var ChatFilter = (_ => {
}))
}));
return settingspanel = BDFDB.PluginUtils.createSettingsPanel(this, settingsitems);
return settingsPanel = BDFDB.PluginUtils.createSettingsPanel(this, settingsItems);
}
//legacy

View File

@ -55,9 +55,9 @@ var CompleteTimestamps = (_ => {
let settings = BDFDB.DataUtils.get(this, "settings");
let choices = BDFDB.DataUtils.get(this, "choices");
let formats = BDFDB.DataUtils.get(this, "formats");
let settingspanel, settingsitems = [], inneritems = [];
let settingsPanel, settingsItems = [], innerItems = [];
for (let key in settings) inneritems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
for (let key in settings) innerItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
className: BDFDB.disCN.marginbottom8,
type: "Switch",
plugin: this,
@ -69,15 +69,15 @@ var CompleteTimestamps = (_ => {
}
}));
settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.CollapseContainer, {
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.CollapseContainer, {
title: "Settings",
collapseStates: collapseStates,
children: inneritems
children: innerItems
}));
inneritems = [];
innerItems = [];
for (let key in choices) inneritems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
for (let key in choices) innerItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
className: BDFDB.disCN.marginbottom8,
type: "Select",
plugin: this,
@ -126,11 +126,11 @@ var CompleteTimestamps = (_ => {
}
}));
inneritems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormDivider, {
innerItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormDivider, {
className: BDFDB.disCN.marginbottom8
}));
for (let key in formats) inneritems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
for (let key in formats) innerItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
className: BDFDB.disCN.marginbottom8,
type: "TextInput",
plugin: this,
@ -143,14 +143,14 @@ var CompleteTimestamps = (_ => {
}
}));
settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.CollapseContainer, {
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.CollapseContainer, {
title: "Format",
collapseStates: collapseStates,
dividertop: true,
children: inneritems
children: innerItems
}));
settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.CollapseContainer, {
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.CollapseContainer, {
title: "Placeholder Guide",
collapseStates: collapseStates,
dividertop: true,
@ -174,7 +174,7 @@ var CompleteTimestamps = (_ => {
}))
}));
return settingspanel = BDFDB.PluginUtils.createSettingsPanel(this, settingsitems);
return settingsPanel = BDFDB.PluginUtils.createSettingsPanel(this, settingsItems);
}

View File

@ -71,9 +71,9 @@ class CreationDate {
let settings = BDFDB.DataUtils.get(this, "settings");
let choices = BDFDB.DataUtils.get(this, "choices");
let formats = BDFDB.DataUtils.get(this, "formats");
let settingspanel, settingsitems = [], inneritems = [];
let settingsPanel, settingsItems = [], innerItems = [];
for (let key in settings) settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
for (let key in settings) settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
className: BDFDB.disCN.marginbottom8,
type: "Switch",
plugin: this,
@ -85,11 +85,11 @@ class CreationDate {
}
}));
settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormDivider, {
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormDivider, {
className: BDFDB.disCN.marginbottom8
}));
for (let key in choices) settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
for (let key in choices) settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
className: BDFDB.disCN.marginbottom8,
type: "Select",
plugin: this,
@ -138,11 +138,11 @@ class CreationDate {
}
}));
settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormDivider, {
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormDivider, {
className: BDFDB.disCN.marginbottom8
}));
for (let key in formats) settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
for (let key in formats) settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
className: BDFDB.disCN.marginbottom8,
type: "TextInput",
plugin: this,
@ -155,7 +155,7 @@ class CreationDate {
}
}));
settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.CollapseContainer, {
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.CollapseContainer, {
title: "Placeholder Guide",
dividertop: true,
collapseStates: collapseStates,
@ -181,7 +181,7 @@ class CreationDate {
})
}));
return settingspanel = BDFDB.PluginUtils.createSettingsPanel(this, settingsitems);
return settingsPanel = BDFDB.PluginUtils.createSettingsPanel(this, settingsItems);
}
//legacy

View File

@ -65,9 +65,9 @@ var CustomQuoter = (_ => {
if (!window.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
let settings = BDFDB.DataUtils.get(this, "settings");
let formats = BDFDB.DataUtils.get(this, "formats");
let settingspanel, settingsitems = [], inneritems = [];
let settingsPanel, settingsItems = [], innerItems = [];
for (let key in settings) inneritems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
for (let key in settings) innerItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
className: BDFDB.disCN.marginbottom8,
type: "Switch",
plugin: this,
@ -79,15 +79,15 @@ var CustomQuoter = (_ => {
}
}));
settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.CollapseContainer, {
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.CollapseContainer, {
title: "Settings",
collapseStates: collapseStates,
children: inneritems
children: innerItems
}));
inneritems = [];
innerItems = [];
for (let key in formats) inneritems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
for (let key in formats) innerItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
className: BDFDB.disCN.marginbottom8,
type: "TextInput",
plugin: this,
@ -99,25 +99,25 @@ var CustomQuoter = (_ => {
BDFDB.ReactUtils.forceUpdate(BDFDB.ReactUtils.findOwner(instance._reactInternalFiber.return, {key:"PREVIEW_MESSAGE"}));
}
}));
inneritems.push(BDFDB.ReactUtils.createElement("div", {
innerItems.push(BDFDB.ReactUtils.createElement("div", {
className: BDFDB.disCN.marginbottom8,
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsLabel, {
label: "Preview:"
})
}));
inneritems.push(BDFDB.ReactUtils.createElement(PreviewMessage, {
innerItems.push(BDFDB.ReactUtils.createElement(PreviewMessage, {
plugin: this,
key: "PREVIEW_MESSAGE",
}));
settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.CollapseContainer, {
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.CollapseContainer, {
title: "Format",
collapseStates: collapseStates,
dividertop: true,
children: inneritems
children: innerItems
}));
settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.CollapseContainer, {
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.CollapseContainer, {
title: "Placeholder Guide",
collapseStates: collapseStates,
dividertop: true,
@ -151,7 +151,7 @@ var CustomQuoter = (_ => {
}))
}));
return settingspanel = BDFDB.PluginUtils.createSettingsPanel(this, settingsitems);
return settingsPanel = BDFDB.PluginUtils.createSettingsPanel(this, settingsItems);
}

View File

@ -43,9 +43,9 @@ var DisplayServersAsChannels = (_ => {
getSettingsPanel () {
if (!window.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
let amounts = BDFDB.DataUtils.get(this, "amounts");
let settingspanel, settingsitems = [];
let settingsPanel, settingsItems = [];
for (let key in amounts) settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
for (let key in amounts) settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
className: BDFDB.disCN.marginbottom8,
type: "TextInput",
childProps: {
@ -60,7 +60,7 @@ var DisplayServersAsChannels = (_ => {
value: amounts[key]
}));
return settingspanel = BDFDB.PluginUtils.createSettingsPanel(this, settingsitems);
return settingsPanel = BDFDB.PluginUtils.createSettingsPanel(this, settingsItems);
}
//legacy

View File

@ -72,9 +72,9 @@ var EditChannels = (_ => {
getSettingsPanel () {
if (!window.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
let settings = BDFDB.DataUtils.get(this, "settings");
let settingspanel, settingsitems = [], inneritems = [];
let settingsPanel, settingsItems = [], innerItems = [];
for (let key in settings) (!this.defaults.settings[key].inner ? settingsitems : inneritems).push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
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,
@ -82,12 +82,12 @@ var EditChannels = (_ => {
label: this.defaults.settings[key].description,
value: settings[key]
}));
settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsPanelInner, {
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsPanelInner, {
title: "Change Channels in:",
first: settingsitems.length == 0,
children: inneritems
first: settingsItems.length == 0,
children: innerItems
}));
settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsItem, {
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsItem, {
type: "Button",
className: BDFDB.disCN.marginbottom8,
color: BDFDB.LibraryComponents.Button.Colors.RED,
@ -101,7 +101,7 @@ var EditChannels = (_ => {
children: BDFDB.LanguageUtils.LanguageStrings.RESET
}));
return settingspanel = BDFDB.PluginUtils.createSettingsPanel(this, settingsitems);
return settingsPanel = BDFDB.PluginUtils.createSettingsPanel(this, settingsItems);
}
//legacy

View File

@ -54,9 +54,9 @@ var EditServers = (_ => {
getSettingsPanel () {
if (!window.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
let settings = BDFDB.DataUtils.get(this, "settings");
let settingspanel, settingsitems = [], inneritems = [];
let settingsPanel, settingsItems = [], innerItems = [];
for (let key in settings) (!this.defaults.settings[key].inner ? settingsitems : inneritems).push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
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,
@ -64,12 +64,12 @@ var EditServers = (_ => {
label: this.defaults.settings[key].description,
value: settings[key]
}));
settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsPanelInner, {
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsPanelInner, {
title: "Change Servers in:",
first: settingsitems.length == 0,
children: inneritems
first: settingsItems.length == 0,
children: innerItems
}));
settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsItem, {
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsItem, {
type: "Button",
className: BDFDB.disCN.marginbottom8,
color: BDFDB.LibraryComponents.Button.Colors.RED,
@ -83,7 +83,7 @@ var EditServers = (_ => {
children: BDFDB.LanguageUtils.LanguageStrings.RESET
}));
return settingspanel = BDFDB.PluginUtils.createSettingsPanel(this, settingsitems);
return settingsPanel = BDFDB.PluginUtils.createSettingsPanel(this, settingsItems);
}
//legacy

View File

@ -126,9 +126,9 @@ var EditUsers = (_ => {
getSettingsPanel () {
if (!window.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
let settings = BDFDB.DataUtils.get(this, "settings");
let settingspanel, settingsitems = [], inneritems = [];
let settingsPanel, settingsItems = [], innerItems = [];
for (let key in settings) (!this.defaults.settings[key].inner ? settingsitems : inneritems).push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
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,
@ -136,12 +136,12 @@ var EditUsers = (_ => {
label: this.defaults.settings[key].description,
value: settings[key]
}));
settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsPanelInner, {
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsPanelInner, {
title: "Change Users in:",
first: settingsitems.length == 0,
children: inneritems
first: settingsItems.length == 0,
children: innerItems
}));
settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsItem, {
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsItem, {
type: "Button",
className: BDFDB.disCN.marginbottom8,
color: BDFDB.LibraryComponents.Button.Colors.RED,
@ -155,7 +155,7 @@ var EditUsers = (_ => {
children: BDFDB.LanguageUtils.LanguageStrings.RESET
}));
return settingspanel = BDFDB.PluginUtils.createSettingsPanel(this, settingsitems);
return settingsPanel = BDFDB.PluginUtils.createSettingsPanel(this, settingsItems);
}
//legacy

View File

@ -62,9 +62,9 @@ class EmojiStatistics {
getSettingsPanel () {
if (!window.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
let settings = BDFDB.DataUtils.get(this, "settings");
let settingspanel, settingsitems = [];
let settingsPanel, settingsItems = [];
for (let key in settings) settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
for (let key in settings) settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
className: BDFDB.disCN.marginbottom8,
type: "Switch",
plugin: this,
@ -73,7 +73,7 @@ class EmojiStatistics {
value: settings[key]
}));
return settingspanel = BDFDB.PluginUtils.createSettingsPanel(this, settingsitems);
return settingsPanel = BDFDB.PluginUtils.createSettingsPanel(this, settingsItems);
}
//legacy

View File

@ -133,7 +133,7 @@ var FriendNotifications = (_ => {
data.disabled = disableon;
BDFDB.DataUtils.save(data, this, type, userId);
this.SettingsUpdated = true;
BDFDB.PluginUtils.refreshSettingsPanel(this, settingspanel, collapseStates);
BDFDB.PluginUtils.refreshSettingsPanel(this, settingsPanel, collapseStates);
};
let changeAllConfigs = (type, config, enable) => {
let data = BDFDB.DataUtils.load(this, type);
@ -146,7 +146,7 @@ var FriendNotifications = (_ => {
for (let id in data) data[id][config] = enable;
BDFDB.DataUtils.save(data, this, type);
this.SettingsUpdated = true;
BDFDB.PluginUtils.refreshSettingsPanel(this, settingspanel, collapseStates);
BDFDB.PluginUtils.refreshSettingsPanel(this, settingsPanel, collapseStates);
};
let successSavedAudio = (type, parsedurl, parseddata) => {
if (parsedurl && parseddata) BDFDB.NotificationUtils.toast(`Sound was saved successfully.`, {type:"success"});
@ -220,7 +220,7 @@ var FriendNotifications = (_ => {
onRemove: (e, instance) => {
BDFDB.DataUtils.remove(this, type, instance.props.cardId);
this.SettingsUpdated = true;
BDFDB.PluginUtils.refreshSettingsPanel(this, settingspanel, collapseStates);
BDFDB.PluginUtils.refreshSettingsPanel(this, settingsPanel, collapseStates);
}
}));
return BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.CollapseContainer, {
@ -240,7 +240,7 @@ var FriendNotifications = (_ => {
let friendsData = BDFDB.DataUtils.load(this, "friends"), nonFriendsData = BDFDB.DataUtils.load(this, "nonfriends");
let friends = [], nonFriends = [];
let settingspanel, settingsitems = [], inneritems = [];
let settingsPanel, settingsItems = [], innerItems = [];
for (let id of friendIDs) {
let user = BDFDB.LibraryModules.UserStore.getUser(id);
@ -267,7 +267,7 @@ var FriendNotifications = (_ => {
BDFDB.DataUtils.save(friendsData, this, "friends");
BDFDB.DataUtils.save(nonFriendsData, this, "nonfriends");
for (let key in settings) inneritems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
for (let key in settings) innerItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
className: BDFDB.disCN.marginbottom8,
type: "Switch",
plugin: this,
@ -275,7 +275,7 @@ var FriendNotifications = (_ => {
label: this.defaults.settings[key].description,
value: settings[key]
}));
for (let key in amounts) if (key.indexOf("desktop") == -1 || "Notification" in window) inneritems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
for (let key in amounts) if (key.indexOf("desktop") == -1 || "Notification" in window) innerItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
className: BDFDB.disCN.marginbottom8,
type: "TextInput",
childProps: {
@ -289,14 +289,14 @@ var FriendNotifications = (_ => {
max: this.defaults.amounts[key].max,
value: amounts[key]
}));
settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.CollapseContainer, {
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.CollapseContainer, {
title: "Settings",
collapseStates: collapseStates,
children: inneritems
children: innerItems
}));
if (friends.length) settingsitems.push(createUserList(friends, "friends", "Friend-List"));
settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.CollapseContainer, {
if (friends.length) settingsItems.push(createUserList(friends, "friends", "Friend-List"));
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.CollapseContainer, {
title: "Add new Stranger",
collapseStates: collapseStates,
dividertop: true,
@ -313,7 +313,7 @@ var FriendNotifications = (_ => {
}),
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Button, {
onClick: _ => {
let userId = settingspanel.querySelector(`.input-newstranger ` + BDFDB.dotCN.input).value.trim();
let userId = settingsPanel.querySelector(`.input-newstranger ` + BDFDB.dotCN.input).value.trim();
if (friendIDs.includes(userId)) BDFDB.NotificationUtils.toast("User is already a friend of yours. Please use the 'Friend-List' area to configure him/her.", {type:"error"});
else if (Object.keys(nonFriends).includes(userId)) BDFDB.NotificationUtils.toast("User is already being observed as a 'Stranger'.", {type:"error"});
else {
@ -321,7 +321,7 @@ var FriendNotifications = (_ => {
if (user) {
BDFDB.DataUtils.save(this.createDefaultConfig(), this, "nonfriends", userId);
this.SettingsUpdated = true;
BDFDB.PluginUtils.refreshSettingsPanel(this, settingspanel, collapseStates);
BDFDB.PluginUtils.refreshSettingsPanel(this, settingsPanel, collapseStates);
}
else BDFDB.NotificationUtils.toast("Please enter a valid UserID of a user that has been loaded in your client.", {type:"error"});
}
@ -331,9 +331,9 @@ var FriendNotifications = (_ => {
]
})
}));
if (nonFriends.length) settingsitems.push(createUserList(nonFriends, "nonfriends", "Stranger-List"));
if (nonFriends.length) settingsItems.push(createUserList(nonFriends, "nonfriends", "Stranger-List"));
settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.CollapseContainer, {
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.CollapseContainer, {
title: "LogIn/-Out Timelog",
collapseStates: collapseStates,
dividertop: true,
@ -345,7 +345,7 @@ var FriendNotifications = (_ => {
children: "Timelog"
})
}));
settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.CollapseContainer, {
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.CollapseContainer, {
title: "Notification Messages",
collapseStates: collapseStates,
dividertop: true,
@ -378,7 +378,7 @@ var FriendNotifications = (_ => {
value: notificationstrings[key]
})))
}));
settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.CollapseContainer, {
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.CollapseContainer, {
title: "Notification Sounds",
collapseStates: collapseStates,
dividertop: true,
@ -423,7 +423,7 @@ var FriendNotifications = (_ => {
}),
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Button, {
onClick: _ => {
let source = settingspanel.querySelector(`.input-${key}src ` + BDFDB.dotCN.input).value.trim();
let source = settingsPanel.querySelector(`.input-${key}src ` + BDFDB.dotCN.input).value.trim();
if (!source.length) {
BDFDB.NotificationUtils.toast(`Sound file was removed.`, {type:"warn"});
successSavedAudio(key, source, source);
@ -450,7 +450,7 @@ var FriendNotifications = (_ => {
]).flat(10).filter(n => n)
}));
return settingspanel = BDFDB.PluginUtils.createSettingsPanel(this, settingsitems);
return settingsPanel = BDFDB.PluginUtils.createSettingsPanel(this, settingsItems);
}
//legacy

View File

@ -53,9 +53,9 @@ var GoogleSearchReplace = (_ => {
if (!window.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
let settings = BDFDB.DataUtils.get(this, "settings");
let engines = BDFDB.DataUtils.get(this, "engines");
let settingspanel, settingsitems = [], engineitems = [];
let settingsPanel, settingsItems = [], engineitems = [];
for (let key in settings) settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
for (let key in settings) settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
className: BDFDB.disCN.marginbottom8,
type: "Switch",
plugin: this,
@ -71,14 +71,14 @@ var GoogleSearchReplace = (_ => {
label: this.defaults.engines[key].name,
value: engines[key]
}));
settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsPanelInner, {
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsPanelInner, {
title: "Search Engines:",
first: settingsitems.length == 0,
first: settingsItems.length == 0,
last: true,
children: engineitems
}));
return settingspanel = BDFDB.PluginUtils.createSettingsPanel(this, settingsitems);
return settingsPanel = BDFDB.PluginUtils.createSettingsPanel(this, settingsItems);
}
//legacy

View File

@ -84,11 +84,11 @@ var GoogleTranslateOption = (_ => {
getSettingsPanel () {
if (!window.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
let settings = BDFDB.DataUtils.get(this, "settings");
let settingspanel, settingsitems = [];
let settingsPanel, settingsItems = [];
settingsitems = settingsitems.concat(this.createSelects(false));
settingsItems = settingsItems.concat(this.createSelects(false));
for (let key in settings) settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
for (let key in settings) settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
className: BDFDB.disCN.marginbottom8,
type: "Switch",
plugin: this,
@ -97,7 +97,7 @@ var GoogleTranslateOption = (_ => {
value: settings[key]
}));
return settingspanel = BDFDB.PluginUtils.createSettingsPanel(this, settingsitems);
return settingsPanel = BDFDB.PluginUtils.createSettingsPanel(this, settingsItems);
}
//legacy

View File

@ -86,9 +86,9 @@ var ImageGallery = (_ => {
getSettingsPanel () {
if (!window.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
let settings = BDFDB.DataUtils.get(this, "settings");
let settingspanel, settingsitems = [];
let settingsPanel, settingsItems = [];
for (let key in settings) settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
for (let key in settings) settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
className: BDFDB.disCN.marginbottom8,
type: "Switch",
plugin: this,
@ -97,7 +97,7 @@ var ImageGallery = (_ => {
value: settings[key]
}));
return settingspanel = BDFDB.PluginUtils.createSettingsPanel(this, settingsitems);
return settingsPanel = BDFDB.PluginUtils.createSettingsPanel(this, settingsItems);
}
//legacy

View File

@ -73,9 +73,9 @@ class JoinedAtDate {
let settings = BDFDB.DataUtils.get(this, "settings");
let choices = BDFDB.DataUtils.get(this, "choices");
let formats = BDFDB.DataUtils.get(this, "formats");
let settingspanel, settingsitems = [], inneritems = [];
let settingsPanel, settingsItems = [], innerItems = [];
for (let key in settings) settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
for (let key in settings) settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
className: BDFDB.disCN.marginbottom8,
type: "Switch",
plugin: this,
@ -87,11 +87,11 @@ class JoinedAtDate {
}
}));
settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormDivider, {
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormDivider, {
className: BDFDB.disCN.marginbottom8
}));
for (let key in choices) settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
for (let key in choices) settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
className: BDFDB.disCN.marginbottom8,
type: "Select",
plugin: this,
@ -140,11 +140,11 @@ class JoinedAtDate {
}
}));
settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormDivider, {
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormDivider, {
className: BDFDB.disCN.marginbottom8
}));
for (let key in formats) settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
for (let key in formats) settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
className: BDFDB.disCN.marginbottom8,
type: "TextInput",
plugin: this,
@ -157,7 +157,7 @@ class JoinedAtDate {
}
}));
settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.CollapseContainer, {
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.CollapseContainer, {
title: "Placeholder Guide",
dividertop: true,
collapseStates: collapseStates,
@ -183,7 +183,7 @@ class JoinedAtDate {
})
}));
return settingspanel = BDFDB.PluginUtils.createSettingsPanel(this, settingsitems);
return settingsPanel = BDFDB.PluginUtils.createSettingsPanel(this, settingsItems);
}
//legacy

View File

@ -74,9 +74,9 @@ class LastMessageDate {
let settings = BDFDB.DataUtils.get(this, "settings");
let choices = BDFDB.DataUtils.get(this, "choices");
let formats = BDFDB.DataUtils.get(this, "formats");
let settingspanel, settingsitems = [], inneritems = [];
let settingsPanel, settingsItems = [], innerItems = [];
for (let key in settings) settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
for (let key in settings) settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
className: BDFDB.disCN.marginbottom8,
type: "Switch",
plugin: this,
@ -88,11 +88,11 @@ class LastMessageDate {
}
}));
settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormDivider, {
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormDivider, {
className: BDFDB.disCN.marginbottom8
}));
for (let key in choices) settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
for (let key in choices) settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
className: BDFDB.disCN.marginbottom8,
type: "Select",
plugin: this,
@ -141,11 +141,11 @@ class LastMessageDate {
}
}));
settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormDivider, {
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormDivider, {
className: BDFDB.disCN.marginbottom8
}));
for (let key in formats) settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
for (let key in formats) settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
className: BDFDB.disCN.marginbottom8,
type: "TextInput",
plugin: this,
@ -158,7 +158,7 @@ class LastMessageDate {
}
}));
settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.CollapseContainer, {
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.CollapseContainer, {
title: "Placeholder Guide",
dividertop: true,
collapseStates: collapseStates,
@ -184,7 +184,7 @@ class LastMessageDate {
})
}));
return settingspanel = BDFDB.PluginUtils.createSettingsPanel(this, settingsitems);
return settingsPanel = BDFDB.PluginUtils.createSettingsPanel(this, settingsItems);
}
//legacy

View File

@ -57,9 +57,9 @@ var MessageUtilities = (_ => {
let settings = BDFDB.DataUtils.get(this, "settings");
let bindings = BDFDB.DataUtils.get(this, "bindings");
let toasts = BDFDB.DataUtils.get(this, "toasts");
let settingspanel, settingsitems = [];
let settingsPanel, settingsItems = [];
for (let key in settings) if (this.defaults.settings[key].description) settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
for (let key in settings) if (this.defaults.settings[key].description) settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
className: BDFDB.disCN.marginbottom8,
type: "Switch",
plugin: this,
@ -67,11 +67,11 @@ var MessageUtilities = (_ => {
label: this.defaults.settings[key].description,
value: settings[key]
}));
settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormDivider, {
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormDivider, {
className: BDFDB.disCN.marginbottom8
}));
for (let action in bindings) if (!this.defaults.bindings[action].plugin || BDFDB.BDUtils.isPluginEnabled(this.defaults.bindings[action].plugin)) {
settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Flex, {
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Flex, {
className: BDFDB.disCN.marginbottom8,
align: BDFDB.LibraryComponents.Flex.Align.CENTER,
direction: BDFDB.LibraryComponents.Flex.Direction.HORIZONTAL,
@ -90,7 +90,7 @@ var MessageUtilities = (_ => {
}) : null
].filter(n => n)
}));
settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
className: BDFDB.disCN.marginbottom8,
type: "Switch",
dividerbottom: true,
@ -121,7 +121,7 @@ var MessageUtilities = (_ => {
})
}));
}
settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsItem, {
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsItem, {
type: "Button",
className: BDFDB.disCN.marginbottom8,
color: BDFDB.LibraryComponents.Button.Colors.RED,
@ -129,14 +129,14 @@ var MessageUtilities = (_ => {
onClick: (e, instance) => {
BDFDB.ModalUtils.confirm(this, "Are you sure you want to reset all Key Bindings?", _ => {
BDFDB.DataUtils.remove(this, "bindings");
settingspanel.parentElement.appendChild(this.getSettingsPanel());
settingspanel.remove();
settingsPanel.parentElement.appendChild(this.getSettingsPanel());
settingsPanel.remove();
});
},
children: BDFDB.LanguageUtils.LanguageStrings.RESET
}));
return settingspanel = BDFDB.PluginUtils.createSettingsPanel(this, settingsitems);
return settingsPanel = BDFDB.PluginUtils.createSettingsPanel(this, settingsItems);
}
//legacy

View File

@ -95,9 +95,9 @@ var NotificationSounds = (_ => {
getSettingsPanel (collapseStates = {}) {
if (!window.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
let settingspanel = {node: null}, settingsitems = [];
let settingsPanel = {node: null}, settingsItems = [];
settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.CollapseContainer, {
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.CollapseContainer, {
title: "Add new Song",
collapseStates: collapseStates,
children: [
@ -146,20 +146,20 @@ var NotificationSounds = (_ => {
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Button, {
style: {marginBottom: 1},
onClick: _ => {
for (let input of settingspanel.node.querySelectorAll(".input-newsong " + BDFDB.dotCN.input)) if (!input.value || input.value.length == 0 || input.value.trim().length == 0) return BDFDB.NotificationUtils.toast("Fill out all fields to add a new song.", {type:"danger"});
let category = settingspanel.node.querySelector(".input-category " + BDFDB.dotCN.input).value.trim();
let song = settingspanel.node.querySelector(".input-song " + BDFDB.dotCN.input).value.trim();
let source = settingspanel.node.querySelector(".input-source " + BDFDB.dotCN.input).value.trim();
for (let input of settingsPanel.node.querySelectorAll(".input-newsong " + BDFDB.dotCN.input)) if (!input.value || input.value.length == 0 || input.value.trim().length == 0) return BDFDB.NotificationUtils.toast("Fill out all fields to add a new song.", {type:"danger"});
let category = settingsPanel.node.querySelector(".input-category " + BDFDB.dotCN.input).value.trim();
let song = settingsPanel.node.querySelector(".input-song " + BDFDB.dotCN.input).value.trim();
let source = settingsPanel.node.querySelector(".input-source " + BDFDB.dotCN.input).value.trim();
if (source.indexOf("http") == 0) BDFDB.LibraryRequires.request(source, (error, response, result) => {
if (response) {
let type = response.headers["content-type"];
if (type && (type.indexOf("octet-stream") > -1 || type.indexOf("audio") > -1 || type.indexOf("video") > -1)) return this.successSavedAudio(settingspanel.node, collapseStates, {category, song, source});
if (type && (type.indexOf("octet-stream") > -1 || type.indexOf("audio") > -1 || type.indexOf("video") > -1)) return this.successSavedAudio(settingsPanel.node, collapseStates, {category, song, source});
}
BDFDB.NotificationUtils.toast("Use a valid direct link to a video or audio source. They usually end on something like .mp3, .mp4 or .wav.", {type:"danger"});
});
else BDFDB.LibraryRequires.fs.readFile(source, (error, response) => {
if (error) BDFDB.NotificationUtils.toast("Could not fetch file. Please make sure the file exists.", {type:"danger"});
else return this.successSavedAudio(settingspanel.node, collapseStates, {category, song, source:`data:audio/mpeg;base64,${response.toString("base64")}`});
else return this.successSavedAudio(settingsPanel.node, collapseStates, {category, song, source:`data:audio/mpeg;base64,${response.toString("base64")}`});
});
},
children: BDFDB.LanguageUtils.LanguageStrings.SAVE
@ -168,19 +168,19 @@ var NotificationSounds = (_ => {
})
]
}));
settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.CollapseContainer, {
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.CollapseContainer, {
title: "Implemented Sounds",
collapseStates: collapseStates,
dividertop: true,
children: Object.keys(BDFDB.ObjectUtils.filter(types, typedata => typedata.implemented)).map(type => this.createSoundCard(type, settingspanel, collapseStates)).flat(10).filter(n => n)
children: Object.keys(BDFDB.ObjectUtils.filter(types, typedata => typedata.implemented)).map(type => this.createSoundCard(type, settingsPanel, collapseStates)).flat(10).filter(n => n)
}));
settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.CollapseContainer, {
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.CollapseContainer, {
title: "Unimplemented Sounds",
collapseStates: collapseStates,
dividertop: true,
children: Object.keys(BDFDB.ObjectUtils.filter(types, typedata => !typedata.implemented)).map(type => this.createSoundCard(type, settingspanel, collapseStates)).flat(10).filter(n => n)
children: Object.keys(BDFDB.ObjectUtils.filter(types, typedata => !typedata.implemented)).map(type => this.createSoundCard(type, settingsPanel, collapseStates)).flat(10).filter(n => n)
}));
settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.CollapseContainer, {
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.CollapseContainer, {
title: "Remove Songs",
collapseStates: collapseStates,
dividertop: true,
@ -195,17 +195,17 @@ var NotificationSounds = (_ => {
BDFDB.DataUtils.remove(this, "audios");
this.loadAudios();
this.loadChoices();
BDFDB.PluginUtils.refreshSettingsPanel(this, settingspanel.node, collapseStates);
BDFDB.PluginUtils.refreshSettingsPanel(this, settingsPanel.node, collapseStates);
});
},
children: BDFDB.LanguageUtils.LanguageStrings.DELETE
})
}));
return settingspanel.node = BDFDB.PluginUtils.createSettingsPanel(this, settingsitems);
return settingsPanel.node = BDFDB.PluginUtils.createSettingsPanel(this, settingsItems);
}
createSoundCard (type, settingspanel, collapseStates) {
createSoundCard (type, settingsPanel, collapseStates) {
return [
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Flex, {
className: BDFDB.disCN.marginbottom8,
@ -257,7 +257,7 @@ var NotificationSounds = (_ => {
choices[type].song = Object.keys(audios[category.value] || {})[0];
choices[type].src = audios[choices[type].category][choices[type].song] || types[type].src;
this.saveChoice(type, true);
BDFDB.PluginUtils.refreshSettingsPanel(this, settingspanel.node, collapseStates);
BDFDB.PluginUtils.refreshSettingsPanel(this, settingsPanel.node, collapseStates);
}
})
})
@ -276,7 +276,7 @@ var NotificationSounds = (_ => {
choices[type].song = song.value;
choices[type].src = audios[choices[type].category][choices[type].song] || types[type].src;
this.saveChoice(type, true);
BDFDB.PluginUtils.refreshSettingsPanel(this, settingspanel.node, collapseStates);
BDFDB.PluginUtils.refreshSettingsPanel(this, settingsPanel.node, collapseStates);
}
})
})
@ -456,12 +456,12 @@ var NotificationSounds = (_ => {
}
}
successSavedAudio (settingspanel, collapseStates, data) {
successSavedAudio (settingsPanel, collapseStates, data) {
BDFDB.NotificationUtils.toast(`Song ${data.song} was added to category ${data.category}.`, {type:"success"});
if (!audios[data.category]) audios[data.category] = {};
audios[data.category][data.song] = data.source;
BDFDB.DataUtils.save(audios, this, "audios");
BDFDB.PluginUtils.refreshSettingsPanel(this, settingspanel, collapseStates);
BDFDB.PluginUtils.refreshSettingsPanel(this, settingsPanel, collapseStates);
}

View File

@ -84,13 +84,13 @@ var OldTitleBar = (_ => {
getSettingsPanel () {
if (!window.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
let settings = BDFDB.DataUtils.get(this, "settings");
let settingspanel, settingsitems = [];
let settingsPanel, settingsItems = [];
let isLinux = !!document.querySelector(".platform-linux");
for (let key in settings) {
let isNativeTitlebarSetting = key == "displayNative";
settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
className: BDFDB.disCN.marginbottom8,
type: "Switch",
plugin: this,
@ -116,7 +116,7 @@ var OldTitleBar = (_ => {
}));
}
return settingspanel = BDFDB.PluginUtils.createSettingsPanel(this, settingsitems);
return settingsPanel = BDFDB.PluginUtils.createSettingsPanel(this, settingsItems);
}
//legacy

View File

@ -67,9 +67,9 @@ var OwnerTag = (_ => {
if (!window.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
let settings = BDFDB.DataUtils.get(this, "settings");
let inputs = BDFDB.DataUtils.get(this, "inputs");
let settingspanel, settingsitems = [], inneritems = [];
let settingsPanel, settingsItems = [], innerItems = [];
for (let key in inputs) settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
for (let key in inputs) settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
className: BDFDB.disCN.marginbottom8,
type: "TextInput",
plugin: this,
@ -78,10 +78,10 @@ var OwnerTag = (_ => {
basis: "50%",
value: inputs[key]
}));
settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormDivider, {
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormDivider, {
className: BDFDB.disCN.marginbottom8
}));
for (let key in settings) (!this.defaults.settings[key].inner ? settingsitems : inneritems).push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
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,
@ -89,14 +89,14 @@ var OwnerTag = (_ => {
label: this.defaults.settings[key].description,
value: settings[key]
}));
settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsPanelInner, {
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsPanelInner, {
title: "Add Owner Tag in:",
first: settingsitems.length == 0,
first: settingsItems.length == 0,
last: true,
children: inneritems
children: innerItems
}));
return settingspanel = BDFDB.PluginUtils.createSettingsPanel(this, settingsitems);
return settingsPanel = BDFDB.PluginUtils.createSettingsPanel(this, settingsItems);
}
//legacy

View File

@ -31,9 +31,9 @@ var PersonalPins = (_ => {
getSettingsPanel () {
if (!window.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
let settingspanel, settingsitems = [];
let settingsPanel, settingsItems = [];
settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsItem, {
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsItem, {
type: "Button",
className: BDFDB.disCN.marginbottom8,
color: BDFDB.LibraryComponents.Button.Colors.RED,
@ -46,7 +46,7 @@ var PersonalPins = (_ => {
children: BDFDB.LanguageUtils.LanguageStrings.DELETE
}));
return settingspanel = BDFDB.PluginUtils.createSettingsPanel(this, settingsitems);
return settingsPanel = BDFDB.PluginUtils.createSettingsPanel(this, settingsItems);
}
//legacy

View File

@ -108,9 +108,9 @@ var PinDMs = (_ => {
getSettingsPanel () {
if (!window.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
let settings = BDFDB.DataUtils.get(this, "settings");
let settingspanel, settingsitems = [], inneritems = [];
let settingsPanel, settingsItems = [], innerItems = [];
for (let key in settings) (!this.defaults.settings[key].inner ? settingsitems : inneritems).push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
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,
@ -118,12 +118,12 @@ var PinDMs = (_ => {
label: this.defaults.settings[key].description,
value: settings[key]
}));
settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsPanelInner, {
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsPanelInner, {
title: "Sort pinned DMs in the recent message order instead of the pinned at order in:",
first: settingsitems.length == 0,
children: inneritems
first: settingsItems.length == 0,
children: innerItems
}));
settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsItem, {
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsItem, {
type: "Button",
className: BDFDB.disCN.marginbottom8,
color: BDFDB.LibraryComponents.Button.Colors.RED,
@ -137,7 +137,7 @@ var PinDMs = (_ => {
children: BDFDB.LanguageUtils.LanguageStrings.UNPIN
}));
return settingspanel = BDFDB.PluginUtils.createSettingsPanel(this, settingsitems);
return settingsPanel = BDFDB.PluginUtils.createSettingsPanel(this, settingsItems);
}
//legacy

View File

@ -118,9 +118,9 @@ var PluginRepo = (_ => {
if (!window.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
let settings = BDFDB.DataUtils.get(this, "settings");
let customList = this.getCustomList(), customUrl = "";
let settingspanel, settingsitems = [];
let settingsPanel, settingsItems = [];
settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.CollapseContainer, {
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.CollapseContainer, {
title: "Settings",
collapseStates: collapseStates,
children: Object.keys(settings).map(key => BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
@ -132,7 +132,7 @@ var PluginRepo = (_ => {
value: settings[key]
}))
}));
settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.CollapseContainer, {
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.CollapseContainer, {
title: "Custom Plugins",
collapseStates: collapseStates,
dividertop: true,
@ -156,7 +156,7 @@ var PluginRepo = (_ => {
if (customUrl) {
customList.push(customUrl);
BDFDB.DataUtils.save(BDFDB.ArrayUtils.removeCopies(customList), this, "custom");
BDFDB.PluginUtils.refreshSettingsPanel(this, settingspanel, collapseStates);
BDFDB.PluginUtils.refreshSettingsPanel(this, settingsPanel, collapseStates);
}
},
children: BDFDB.LanguageUtils.LanguageStrings.ADD
@ -174,7 +174,7 @@ var PluginRepo = (_ => {
onRemove: _ => {
BDFDB.ArrayUtils.remove(customList, url, true);
BDFDB.DataUtils.save(customList, this, "custom");
BDFDB.PluginUtils.refreshSettingsPanel(this, settingspanel, collapseStates);
BDFDB.PluginUtils.refreshSettingsPanel(this, settingsPanel, collapseStates);
}
}))
}) : null,
@ -185,14 +185,14 @@ var PluginRepo = (_ => {
onClick: _ => {
BDFDB.ModalUtils.confirm(this, "Are you sure you want to remove all added Plugins from your own list", _ => {
BDFDB.DataUtils.save([], this, "custom");
BDFDB.PluginUtils.refreshSettingsPanel(this, settingspanel, collapseStates);
BDFDB.PluginUtils.refreshSettingsPanel(this, settingsPanel, collapseStates);
});
},
children: BDFDB.LanguageUtils.LanguageStrings.REMOVE
})
].flat(10).filter(n => n)
}));
settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.CollapseContainer, {
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.CollapseContainer, {
title: "Refetch All",
collapseStates: collapseStates,
dividertop: true,
@ -207,7 +207,7 @@ var PluginRepo = (_ => {
})
}));
return settingspanel = BDFDB.PluginUtils.createSettingsPanel(this, settingsitems);
return settingsPanel = BDFDB.PluginUtils.createSettingsPanel(this, settingsItems);
}
//legacy

View File

@ -51,9 +51,9 @@ var ReadAllNotificationsButton = (_ => {
getSettingsPanel (collapseStates = {}) {
if (!window.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
let settings = BDFDB.DataUtils.get(this, "settings");
let settingspanel, settingsitems = [];
let settingsPanel, settingsItems = [];
settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.CollapseContainer, {
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.CollapseContainer, {
title: "Settings",
collapseStates: collapseStates,
children: Object.keys(settings).filter(key => !this.defaults.settings[key].inner).map(key => BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
@ -78,7 +78,7 @@ var ReadAllNotificationsButton = (_ => {
}))
}));
settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.CollapseContainer, {
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.CollapseContainer, {
title: "Server Black List",
collapseStates: collapseStates,
children: [
@ -95,7 +95,7 @@ var ReadAllNotificationsButton = (_ => {
color: BDFDB.LibraryComponents.Button.Colors.GREEN,
label: "Enable for all Servers",
onClick: _ => {
this.batchSetGuilds(settingspanel, collapseStates, true);
this.batchSetGuilds(settingsPanel, collapseStates, true);
},
children: BDFDB.LanguageUtils.LanguageStrings.ENABLE
}),
@ -105,14 +105,14 @@ var ReadAllNotificationsButton = (_ => {
color: BDFDB.LibraryComponents.Button.Colors.PRIMARY,
label: "Disable for all Servers",
onClick: _ => {
this.batchSetGuilds(settingspanel, collapseStates, false);
this.batchSetGuilds(settingsPanel, collapseStates, false);
},
children: BDFDB.LanguageUtils.LanguageStrings.DISABLE
})
]
}));
return settingspanel = BDFDB.PluginUtils.createSettingsPanel(this, settingsitems);
return settingsPanel = BDFDB.PluginUtils.createSettingsPanel(this, settingsItems);
}
//legacy
@ -299,13 +299,13 @@ var ReadAllNotificationsButton = (_ => {
BDFDB.GuildUtils.markAsRead(guilds.filter(g => g && g.id && !blacklist.includes(g.id)));
}
batchSetGuilds (settingspanel, collapseStates, value) {
batchSetGuilds (settingsPanel, collapseStates, value) {
if (!value) {
for (let id of BDFDB.LibraryModules.FolderStore.getFlattenedGuildIds()) blacklist.push(id);
this.saveBlacklist(BDFDB.ArrayUtils.removeCopies(blacklist));
}
else this.saveBlacklist([]);
BDFDB.PluginUtils.refreshSettingsPanel(this, settingspanel, collapseStates);
BDFDB.PluginUtils.refreshSettingsPanel(this, settingsPanel, collapseStates);
}
saveBlacklist (savedBlacklist) {

View File

@ -48,9 +48,9 @@ var RemoveNicknames = (_ => {
getSettingsPanel () {
if (!window.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
let settings = BDFDB.DataUtils.get(this, "settings");
let settingspanel, settingsitems = [], inneritems = [];
let settingsPanel, settingsItems = [], innerItems = [];
for (let key in settings) (!this.defaults.settings[key].inner ? settingsitems : inneritems).push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
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,
@ -58,14 +58,14 @@ var RemoveNicknames = (_ => {
label: this.defaults.settings[key].description,
value: settings[key]
}));
settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsPanelInner, {
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsPanelInner, {
title: "Remove Nicknames in:",
first: settingsitems.length == 0,
first: settingsItems.length == 0,
last: true,
children: inneritems
children: innerItems
}));
return settingspanel = BDFDB.PluginUtils.createSettingsPanel(this, settingsitems);
return settingsPanel = BDFDB.PluginUtils.createSettingsPanel(this, settingsItems);
}
//legacy

View File

@ -46,9 +46,9 @@ var ReverseImageSearch = (_ => {
if (!window.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
let settings = BDFDB.DataUtils.get(this, "settings");
let engines = BDFDB.DataUtils.get(this, "engines");
let settingspanel, settingsitems = [], inneritems = [], engineitems = [];
let settingsPanel, settingsItems = [], innerItems = [], engineitems = [];
for (let key in settings) (!this.defaults.settings[key].inner ? settingsitems : inneritems).push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
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,
@ -64,20 +64,20 @@ var ReverseImageSearch = (_ => {
label: this.defaults.engines[key].name,
value: engines[key]
}));
settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsPanelInner, {
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsPanelInner, {
title: "Add extra ContextMenu Entry for:",
first: settingsitems.length == 0,
first: settingsItems.length == 0,
last: true,
children: inneritems
children: innerItems
}));
settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsPanelInner, {
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsPanelInner, {
title: "Search Engines:",
first: settingsitems.length == 0,
first: settingsItems.length == 0,
last: true,
children: engineitems
}));
return settingspanel = BDFDB.PluginUtils.createSettingsPanel(this, settingsitems);
return settingsPanel = BDFDB.PluginUtils.createSettingsPanel(this, settingsItems);
}
//legacy

View File

@ -380,9 +380,9 @@ var ServerFolders = (_ => {
getSettingsPanel () {
if (!window.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
let settings = BDFDB.DataUtils.get(this, "settings");
let settingspanel, settingsitems = [];
let settingsPanel, settingsItems = [];
for (let key in settings) settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
for (let key in settings) settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
className: BDFDB.disCN.marginbottom8,
type: "Switch",
plugin: this,
@ -390,7 +390,7 @@ var ServerFolders = (_ => {
label: this.defaults.settings[key].description,
value: settings[key]
}));
settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsItem, {
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsItem, {
type: "Button",
className: BDFDB.disCN.marginbottom8,
color: BDFDB.LibraryComponents.Button.Colors.RED,
@ -402,7 +402,7 @@ var ServerFolders = (_ => {
},
children: BDFDB.LanguageUtils.LanguageStrings.RESET
}));
settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsItem, {
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsItem, {
type: "Button",
className: BDFDB.disCN.marginbottom8,
color: BDFDB.LibraryComponents.Button.Colors.RED,
@ -415,7 +415,7 @@ var ServerFolders = (_ => {
children: BDFDB.LanguageUtils.LanguageStrings.REMOVE
}));
return settingspanel = BDFDB.PluginUtils.createSettingsPanel(this, settingsitems);
return settingsPanel = BDFDB.PluginUtils.createSettingsPanel(this, settingsItems);
}
//legacy

View File

@ -25,9 +25,9 @@ var ServerHider = (_ => {
getSettingsPanel () {
if (!window.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
let settingspanel, settingsitems = [];
let settingsPanel, settingsItems = [];
settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsItem, {
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsItem, {
type: "Button",
className: BDFDB.disCN.marginbottom8,
color: BDFDB.LibraryComponents.Button.Colors.RED,
@ -41,7 +41,7 @@ var ServerHider = (_ => {
children: BDFDB.LanguageUtils.LanguageStrings.RESET
}));
return settingspanel = BDFDB.PluginUtils.createSettingsPanel(this, settingsitems);
return settingsPanel = BDFDB.PluginUtils.createSettingsPanel(this, settingsItems);
}
//legacy

View File

@ -73,9 +73,9 @@ var ShowHiddenChannels = (_ => {
getSettingsPanel (collapseStates = {}) {
if (!window.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
let settings = BDFDB.DataUtils.get(this, "settings");
let settingspanel, settingsitems = [];
let settingsPanel, settingsItems = [];
settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.CollapseContainer, {
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.CollapseContainer, {
title: "Settings",
collapseStates: collapseStates,
children: Object.keys(settings).map(key => BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
@ -88,7 +88,7 @@ var ShowHiddenChannels = (_ => {
}))
}));
settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.CollapseContainer, {
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.CollapseContainer, {
title: "Server Black List",
collapseStates: collapseStates,
children: [
@ -105,7 +105,7 @@ var ShowHiddenChannels = (_ => {
color: BDFDB.LibraryComponents.Button.Colors.GREEN,
label: "Enable for all Servers",
onClick: _ => {
this.batchSetGuilds(settingspanel, collapseStates, true);
this.batchSetGuilds(settingsPanel, collapseStates, true);
},
children: BDFDB.LanguageUtils.LanguageStrings.ENABLE
}),
@ -115,14 +115,14 @@ var ShowHiddenChannels = (_ => {
color: BDFDB.LibraryComponents.Button.Colors.PRIMARY,
label: "Disable for all Servers",
onClick: _ => {
this.batchSetGuilds(settingspanel, collapseStates, false);
this.batchSetGuilds(settingsPanel, collapseStates, false);
},
children: BDFDB.LanguageUtils.LanguageStrings.DISABLE
})
]
}));
return settingspanel = BDFDB.PluginUtils.createSettingsPanel(this, settingsitems);
return settingsPanel = BDFDB.PluginUtils.createSettingsPanel(this, settingsItems);
}
//legacy
@ -378,13 +378,13 @@ var ShowHiddenChannels = (_ => {
return [hidden, amount];
}
batchSetGuilds (settingspanel, collapseStates, value) {
batchSetGuilds (settingsPanel, collapseStates, value) {
if (!value) {
for (let id of BDFDB.LibraryModules.FolderStore.getFlattenedGuildIds()) blacklist.push(id);
this.saveBlacklist(BDFDB.ArrayUtils.removeCopies(blacklist));
}
else this.saveBlacklist([]);
BDFDB.PluginUtils.refreshSettingsPanel(this, settingspanel, collapseStates);
BDFDB.PluginUtils.refreshSettingsPanel(this, settingsPanel, collapseStates);
}
saveBlacklist (savedBlacklist) {

View File

@ -92,9 +92,9 @@ var ShowImageDetails = (_ => {
if (!window.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
let settings = BDFDB.DataUtils.get(this, "settings");
let amounts = BDFDB.DataUtils.get(this, "amounts");
let settingspanel, settingsitems = [];
let settingsPanel, settingsItems = [];
for (let key in settings) settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
for (let key in settings) settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
className: BDFDB.disCN.marginbottom8,
type: "Switch",
plugin: this,
@ -103,11 +103,11 @@ var ShowImageDetails = (_ => {
value: settings[key]
}));
settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormDivider, {
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormDivider, {
className: BDFDB.disCN.marginbottom8
}));
for (let key in amounts) settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
for (let key in amounts) settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
className: BDFDB.disCN.marginbottom8,
type: "TextInput",
childProps: {
@ -122,7 +122,7 @@ var ShowImageDetails = (_ => {
value: amounts[key]
}));
return settingspanel = BDFDB.PluginUtils.createSettingsPanel(this, settingsitems);
return settingsPanel = BDFDB.PluginUtils.createSettingsPanel(this, settingsItems);
}
//legacy

View File

@ -48,9 +48,9 @@ var SpellCheck = (_ => {
let choices = BDFDB.DataUtils.get(this, "choices");
let amounts = BDFDB.DataUtils.get(this, "amounts");
let ownDictionary = BDFDB.DataUtils.load(this, "owndics", choices.dictionaryLanguage) || [];
let settingspanel, settingsitems = [];
let settingsPanel, settingsItems = [];
for (let key in choices) settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
for (let key in choices) settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
className: BDFDB.disCN.marginbottom8,
type: "Select",
plugin: this,
@ -62,11 +62,11 @@ var SpellCheck = (_ => {
searchable: true,
onChange: value => {
this.setDictionary(value);
BDFDB.PluginUtils.refreshSettingsPanel(this, settingspanel);
BDFDB.PluginUtils.refreshSettingsPanel(this, settingsPanel);
}
}));
for (let key in amounts) settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
for (let key in amounts) settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
className: BDFDB.disCN.marginbottom8,
type: "TextInput",
childProps: {
@ -81,9 +81,9 @@ var SpellCheck = (_ => {
value: amounts[key]
}));
if (ownDictionary.length) settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsPanelInner, {
if (ownDictionary.length) settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsPanelInner, {
title: "Your own Dictionary:",
first: settingsitems.length == 0,
first: settingsItems.length == 0,
last: true,
children: ownDictionary.map(word => BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Card, {
children: word.toLowerCase(),
@ -91,12 +91,12 @@ var SpellCheck = (_ => {
BDFDB.ArrayUtils.remove(ownDictionary, word);
BDFDB.DataUtils.save(ownDictionary, this, "owndics", choices.dictionaryLanguage);
dictionary = langDictionary.concat(ownDictionary);
BDFDB.PluginUtils.refreshSettingsPanel(this, settingspanel);
BDFDB.PluginUtils.refreshSettingsPanel(this, settingsPanel);
}
}))
}));
return settingspanel = BDFDB.PluginUtils.createSettingsPanel(this, settingsitems);
return settingsPanel = BDFDB.PluginUtils.createSettingsPanel(this, settingsItems);
}
//legacy

View File

@ -26,11 +26,11 @@ class SteamProfileLink {
getSettingsPanel () {
if (!window.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
let settings = BDFDB.DataUtils.get(this, "settings");
let settingspanel, settingsitems = [];
let settingsPanel, settingsItems = [];
settingsitems = settingsitems.concat(this.createSelects(false));
settingsItems = settingsItems.concat(this.createSelects(false));
for (let key in settings) settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
for (let key in settings) settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
className: BDFDB.disCN.marginbottom8,
type: "Switch",
plugin: this,
@ -39,7 +39,7 @@ class SteamProfileLink {
value: settings[key]
}));
return settingspanel = BDFDB.PluginUtils.createSettingsPanel(this, settingsitems);
return settingsPanel = BDFDB.PluginUtils.createSettingsPanel(this, settingsItems);
}
//legacy

View File

@ -190,9 +190,9 @@ var ThemeRepo = (_ => {
if (!window.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
let settings = BDFDB.DataUtils.get(this, "settings");
let customList = this.getCustomList(), customUrl = "";
let settingspanel, settingsitems = [];
let settingsPanel, settingsItems = [];
settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.CollapseContainer, {
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.CollapseContainer, {
title: "Settings",
collapseStates: collapseStates,
children: Object.keys(settings).map(key => BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
@ -204,7 +204,7 @@ var ThemeRepo = (_ => {
value: settings[key]
}))
}));
settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.CollapseContainer, {
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.CollapseContainer, {
title: "Custom Themes",
collapseStates: collapseStates,
dividertop: true,
@ -228,7 +228,7 @@ var ThemeRepo = (_ => {
if (customUrl) {
customList.push(customUrl);
BDFDB.DataUtils.save(BDFDB.ArrayUtils.removeCopies(customList), this, "custom");
BDFDB.PluginUtils.refreshSettingsPanel(this, settingspanel, collapseStates);
BDFDB.PluginUtils.refreshSettingsPanel(this, settingsPanel, collapseStates);
}
},
children: BDFDB.LanguageUtils.LanguageStrings.ADD
@ -246,7 +246,7 @@ var ThemeRepo = (_ => {
onRemove: _ => {
BDFDB.ArrayUtils.remove(customList, url, true);
BDFDB.DataUtils.save(customList, this, "custom");
BDFDB.PluginUtils.refreshSettingsPanel(this, settingspanel, collapseStates);
BDFDB.PluginUtils.refreshSettingsPanel(this, settingsPanel, collapseStates);
}
}))
}) : null,
@ -257,14 +257,14 @@ var ThemeRepo = (_ => {
onClick: _ => {
BDFDB.ModalUtils.confirm(this, "Are you sure you want to remove all added Themes from your own list", _ => {
BDFDB.DataUtils.save([], this, "custom");
BDFDB.PluginUtils.refreshSettingsPanel(this, settingspanel, collapseStates);
BDFDB.PluginUtils.refreshSettingsPanel(this, settingsPanel, collapseStates);
});
},
children: BDFDB.LanguageUtils.LanguageStrings.REMOVE
})
].flat(10).filter(n => n)
}));
settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.CollapseContainer, {
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.CollapseContainer, {
title: "Refetch All",
collapseStates: collapseStates,
dividertop: true,
@ -279,7 +279,7 @@ var ThemeRepo = (_ => {
})
}));
return settingspanel = BDFDB.PluginUtils.createSettingsPanel(this, settingsitems);
return settingsPanel = BDFDB.PluginUtils.createSettingsPanel(this, settingsItems);
}
//legacy

View File

@ -1,204 +1,203 @@
//META{"name":"ThemeSettings","authorId":"278543574059057154","invite":"Jx3TjNS","donate":"https://www.paypal.me/MircoWittrien","patreon":"https://www.patreon.com/MircoWittrien","website":"https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/ThemeSettings","source":"https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/Plugins/ThemeSettings/ThemeSettings.plugin.js"}*//
class ThemeSettings {
getName () {return "ThemeSettings";}
var ThemeSettings = (_ => {
return class ThemeSettings {
getName () {return "ThemeSettings";}
getVersion () {return "1.1.7";}
getVersion () {return "1.1.8";}
getAuthor () {return "DevilBro";}
getAuthor () {return "DevilBro";}
getDescription () {return "Allows you to change Theme Variables within BetterDiscord. Adds a Settings button (similar to Plugins) to customizable Themes in your Themes Page.";}
getDescription () {return "Allows you to change Theme Variables within BetterDiscord. Adds a Settings button (similar to Plugins) to customizable Themes in your Themes Page.";}
constructor () {
this.changelog = {
"improved":[["New Library Structure & React","Restructured my Library and switched to React rendering instead of DOM manipulation"]]
};
this.patchedModules = {
after: {
V2C_ThemeCard: "render"
constructor () {
this.patchedModules = {
after: {
V2C_ThemeCard: "render"
}
};
}
//legacy
load () {}
start () {
if (!window.BDFDB) window.BDFDB = {myPlugins:{}};
if (window.BDFDB && window.BDFDB.myPlugins && typeof window.BDFDB.myPlugins == "object") window.BDFDB.myPlugins[this.getName()] = this;
let libraryScript = document.querySelector("head script#BDFDBLibraryScript");
if (!libraryScript || (performance.now() - libraryScript.getAttribute("date")) > 600000) {
if (libraryScript) libraryScript.remove();
libraryScript = document.createElement("script");
libraryScript.setAttribute("id", "BDFDBLibraryScript");
libraryScript.setAttribute("type", "text/javascript");
libraryScript.setAttribute("src", "https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.min.js");
libraryScript.setAttribute("date", performance.now());
libraryScript.addEventListener("load", _ => {this.initialize();});
document.head.appendChild(libraryScript);
}
};
}
//legacy
load () {}
start () {
if (!window.BDFDB) window.BDFDB = {myPlugins:{}};
if (window.BDFDB && window.BDFDB.myPlugins && typeof window.BDFDB.myPlugins == "object") window.BDFDB.myPlugins[this.getName()] = this;
let libraryScript = document.querySelector("head script#BDFDBLibraryScript");
if (!libraryScript || (performance.now() - libraryScript.getAttribute("date")) > 600000) {
if (libraryScript) libraryScript.remove();
libraryScript = document.createElement("script");
libraryScript.setAttribute("id", "BDFDBLibraryScript");
libraryScript.setAttribute("type", "text/javascript");
libraryScript.setAttribute("src", "https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.min.js");
libraryScript.setAttribute("date", performance.now());
libraryScript.addEventListener("load", _ => {this.initialize();});
document.head.appendChild(libraryScript);
else if (window.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();
this.startTimeout = setTimeout(_ => {
try {return this.initialize();}
catch (err) {console.error(`%c[${this.getName()}]%c`, "color: #3a71c1; font-weight: 700;", "", "Fatal Error: Could not initiate plugin! " + err);}
}, 30000);
}
else if (window.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();
this.startTimeout = setTimeout(_ => {
try {return this.initialize();}
catch (err) {console.error(`%c[${this.getName()}]%c`, "color: #3a71c1; font-weight: 700;", "", "Fatal Error: Could not initiate plugin! " + err);}
}, 30000);
}
initialize () {
if (window.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
if (this.started) return;
BDFDB.PluginUtils.init(this);
this.dir = BDFDB.BDUtils.getThemesFolder();
initialize () {
if (window.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
if (this.started) return;
BDFDB.PluginUtils.init(this);
this.dir = BDFDB.BDUtils.getThemesFolder();
BDFDB.ModuleUtils.forceAllUpdates(this);
BDFDB.ModuleUtils.forceAllUpdates(this);
}
else console.error(`%c[${this.getName()}]%c`, "color: #3a71c1; font-weight: 700;", "", "Fatal Error: Could not load BD functions!");
}
else console.error(`%c[${this.getName()}]%c`, "color: #3a71c1; font-weight: 700;", "", "Fatal Error: Could not load BD functions!");
}
stop () {
if (window.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
this.stopping = true;
stop () {
if (window.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
this.stopping = true;
BDFDB.ModuleUtils.forceAllUpdates(this);
BDFDB.PluginUtils.clear(this);
BDFDB.ModuleUtils.forceAllUpdates(this);
BDFDB.PluginUtils.clear(this);
}
}
}
// begin of own functions
// begin of own functions
processV2CThemeCard (e) {
if (e.instance.props.theme && !e.instance.state.settings) {
let vars = this.getThemeVars(e.instance.props.theme.css);
if (vars.length) {
let [children, index] = BDFDB.ReactUtils.findChildren(e.returnvalue, {props: [["className", BDFDB.disCN._repofooter]]});
if (index == -1) {
let footer = BDFDB.ReactUtils.createElement("div", {className: BDFDB.disCN._repofooter, children: []});
e.returnvalue.props.children.push(footer);
children = footer.props.children;
}
else {
children[index].props.children = [children[index].props.children].flat();
children = children[index].props.children;
}
children.push(BDFDB.ReactUtils.createElement("button", {
className: BDFDB.disCNS._reposettingsbutton,
children: "Settings",
onClick: event => {
let wrapper = BDFDB.DOMUtils.getParent(BDFDB.dotCN._reposettingsclosed, event.currentTarget);
BDFDB.DOMUtils.addClass(wrapper, BDFDB.disCN._reposettingsopen);
BDFDB.DOMUtils.removeClass(wrapper, BDFDB.disCN._reposettingsclosed);
let children = [];
while (wrapper.childElementCount) {
children.push(wrapper.firstChild);
wrapper.firstChild.remove();
}
let closebutton = BDFDB.DOMUtils.create(`<div style="float: right; cursor: pointer;"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 12" style="width: 18px; height: 18px;"><g class="background" fill="none" fill-rule="evenodd"><path d="M0 0h12v12H0"></path><path class="fill" fill="#dcddde" d="M9.5 3.205L8.795 2.5 6 5.295 3.205 2.5l-.705.705L5.295 6 2.5 8.795l.705.705L6 6.705 8.795 9.5l.705-.705L6.705 6"></path></g></svg></div>`);
wrapper.appendChild(closebutton);
closebutton.addEventListener("click", _ => {
BDFDB.DOMUtils.removeClass(wrapper, BDFDB.disCN._reposettingsopen);
BDFDB.DOMUtils.addClass(wrapper, BDFDB.disCN._reposettingsclosed);
while (wrapper.childElementCount) wrapper.firstChild.remove();
while (children.length) wrapper.appendChild(children.shift());
})
this.createThemeSettings(wrapper, e.instance.props.theme, vars);
processV2CThemeCard (e) {
console.log(e);
if (e.instance.props.addon && !e.instance.state.settings) {
let vars = this.getThemeVars(e.instance.props.addon.css);
if (vars.length) {
let [children, index] = BDFDB.ReactUtils.findChildren(e.returnvalue, {props: [["className", BDFDB.disCN._repofooter]]});
if (index == -1) {
let footer = BDFDB.ReactUtils.createElement("div", {className: BDFDB.disCN._repofooter, children: []});
e.returnvalue.props.children.push(footer);
children = footer.props.children;
}
}));
else {
children[index].props.children = [children[index].props.children].flat();
children = children[index].props.children;
}
children.push(BDFDB.ReactUtils.createElement("button", {
className: BDFDB.disCNS._reposettingsbutton,
children: "Settings",
onClick: event => {
let wrapper = BDFDB.DOMUtils.getParent(BDFDB.dotCN._reposettingsclosed, event.currentTarget);
BDFDB.DOMUtils.addClass(wrapper, BDFDB.disCN._reposettingsopen);
BDFDB.DOMUtils.removeClass(wrapper, BDFDB.disCN._reposettingsclosed);
let children = [];
while (wrapper.childElementCount) {
children.push(wrapper.firstChild);
wrapper.firstChild.remove();
}
let closeButton = BDFDB.DOMUtils.create(`<div style="float: right; cursor: pointer;"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 12" style="width: 18px; height: 18px;"><g class="background" fill="none" fill-rule="evenodd"><path d="M0 0h12v12H0"></path><path class="fill" fill="#dcddde" d="M9.5 3.205L8.795 2.5 6 5.295 3.205 2.5l-.705.705L5.295 6 2.5 8.795l.705.705L6 6.705 8.795 9.5l.705-.705L6.705 6"></path></g></svg></div>`);
wrapper.appendChild(closeButton);
closeButton.addEventListener("click", _ => {
BDFDB.DOMUtils.removeClass(wrapper, BDFDB.disCN._reposettingsopen);
BDFDB.DOMUtils.addClass(wrapper, BDFDB.disCN._reposettingsclosed);
while (wrapper.childElementCount) wrapper.firstChild.remove();
while (children.length) wrapper.appendChild(children.shift());
});
this.createThemeSettings(wrapper, e.instance.props.addon, vars);
}
}));
}
}
}
}
getThemeVars (css) {
let vars = css.split(":root");
if (vars.length > 1) {
vars = vars[1].replace(/\t\(/g, " (").replace(/\r|\t| {2,}/g, "").replace(/\/\*\n*((?!\/\*|\*\/).|\n)*\n+((?!\/\*|\*\/).|\n)*\n*\*\//g, "").replace(/\n\/\*.*?\*\//g, "").replace(/\n/g, "");
vars = vars.split("{");
vars.shift();
vars = vars.join("{").replace(/\s*(:|;|--|\*)\s*/g, "$1");
vars = vars.split("}")[0];
return vars.slice(2).split(/;--|\*\/--/);
getThemeVars (css) {
let vars = css.split(":root");
if (vars.length > 1) {
vars = vars[1].replace(/\t\(/g, " (").replace(/\r|\t| {2,}/g, "").replace(/\/\*\n*((?!\/\*|\*\/).|\n)*\n+((?!\/\*|\*\/).|\n)*\n*\*\//g, "").replace(/\n\/\*.*?\*\//g, "").replace(/\n/g, "");
vars = vars.split("{");
vars.shift();
vars = vars.join("{").replace(/\s*(:|;|--|\*)\s*/g, "$1");
vars = vars.split("}")[0];
return vars.slice(2).split(/;--|\*\/--/);
}
return [];
}
return [];
}
createThemeSettings (wrapper, theme, vars) {
if (!window.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
let settingsitems = [];
settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsItem, {
type: "Button",
className: BDFDB.disCN.marginbottom8,
color: BDFDB.LibraryComponents.Button.Colors.GREEN,
label: "Update all variables",
onClick: _ => {
let path = BDFDB.LibraryRequires.path.join(this.dir, theme.filename);
let css = BDFDB.LibraryRequires.fs.readFileSync(path).toString();
if (css) {
let amount = 0;
for (let input of wrapper.querySelectorAll(BDFDB.dotCN.input)) {
let oldvalue = input.getAttribute("placeholder");
let newvalue = input.value;
if (newvalue && newvalue.trim() && newvalue != oldvalue) {
let varname = input.getAttribute("varname");
css = css.replace(new RegExp(`--${BDFDB.StringUtils.regEscape(varname)}(\\s*):(\\s*)${BDFDB.StringUtils.regEscape(oldvalue)}`,"g"),`--${varname}$1:$2${newvalue}`);
amount++;
createThemeSettings (wrapper, theme, vars) {
if (!window.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
let settingsItems = [];
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsItem, {
type: "Button",
className: BDFDB.disCN.marginbottom8,
color: BDFDB.LibraryComponents.Button.Colors.GREEN,
label: "Update all variables",
onClick: _ => {
let path = BDFDB.LibraryRequires.path.join(this.dir, theme.filename);
let css = BDFDB.LibraryRequires.fs.readFileSync(path).toString();
if (css) {
let amount = 0;
for (let input of wrapper.querySelectorAll(BDFDB.dotCN.input)) {
let oldvalue = input.getAttribute("placeholder");
let newvalue = input.value;
if (newvalue && newvalue.trim() && newvalue != oldvalue) {
let varName = input.getAttribute("varName");
css = css.replace(new RegExp(`--${BDFDB.StringUtils.regEscape(varName)}(\\s*):(\\s*)${BDFDB.StringUtils.regEscape(oldvalue)}`,"g"),`--${varName}$1:$2${newvalue}`);
amount++;
}
}
if (amount > 0) {
BDFDB.LibraryRequires.fs.writeFileSync(path, css);
BDFDB.NotificationUtils.toast(`Updated ${amount} variable${amount == 1 ? "" : "s"} in ${theme.filename}`, {type:"success"});
}
else BDFDB.NotificationUtils.toast(`There are no changed variables to be updated in ${theme.filename}`, {type:"warning"});
}
else BDFDB.NotificationUtils.toast(`Could not find themefile: ${theme.filename}`, {type:"error"});
},
children: "Update"
}));
for (let varStr of vars) {
varStr = varStr.split(":");
let varName = varStr.shift().trim();
varStr = varStr.join(":").split(/;[^A-z0-9]|\/\*/);
let varValue = varStr.shift().trim();
if (varValue) {
let childType = "text", childMode = "";
let isColor = BDFDB.ColorUtils.getType(varValue);
let isComp = !isColor && /[0-9 ]+,[0-9 ]+,[0-9 ]+/g.test(varValue);
if (isColor || isComp) {
childType = "color";
childMode = isComp && "comp";
}
else {
let isUrlFile = /url\(.+\)/gi.test(varValue);
let isFile = !isUrlFile && /(http(s)?):\/\/[(www\.)?a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)/.test(varValue);
if (isFile || isUrlFile) {
childType = "file";
childMode = isUrlFile && "url";
}
}
if (amount > 0) {
BDFDB.LibraryRequires.fs.writeFileSync(path, css);
BDFDB.NotificationUtils.toast(`Updated ${amount} variable${amount == 1 ? "" : "s"} in ${theme.filename}`, {type:"success"});
}
else BDFDB.NotificationUtils.toast(`There are no changed variables to be updated in ${theme.filename}`, {type:"warning"});
let varDescription = varStr.join("").replace(/\*\/|\/\*/g, "").replace(/:/g, ": ").replace(/: \//g, ":/").replace(/--/g, " --").replace(/\( --/g, "(--").trim();
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsItem, {
className: BDFDB.disCN.marginbottom20,
dividerbottom: vars[vars.length-1] != varStr,
type: "TextInput",
childProps: {
type: childType,
mode: childMode,
filter: childType == "file" && "image"
},
label: varName[0].toUpperCase() + varName.slice(1),
note: varDescription && varDescription.indexOf("*") == 0 ? varDescription.slice(1) : varDescription,
basis: "70%",
varName: varName,
value: varValue,
placeholder: varValue
}));
}
else BDFDB.NotificationUtils.toast(`Could not find themefile: ${theme.filename}`, {type:"error"});
},
children: "Update"
}));
for (let varstr of vars) {
varstr = varstr.split(":");
let varname = varstr.shift().trim();
varstr = varstr.join(":").split(/;[^A-z0-9]|\/\*/);
let varvalue = varstr.shift().trim();
if (varvalue) {
let childType = "text", childMode = "";
let iscolor = BDFDB.ColorUtils.getType(varvalue);
let iscomp = !iscolor && /[0-9 ]+,[0-9 ]+,[0-9 ]+/g.test(varvalue);
if (iscolor || iscomp) {
childType = "color";
childMode = iscomp && "comp";
}
else {
let isurlfile = /url\(.+\)/gi.test(varvalue);
let isfile = !isurlfile && /(http(s)?):\/\/[(www\.)?a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)/.test(varvalue);
if (isfile || isurlfile) {
childType = "file";
childMode = isurlfile && "url";
}
}
let vardescription = varstr.join("").replace(/\*\/|\/\*/g, "").replace(/:/g, ": ").replace(/: \//g, ":/").replace(/--/g, " --").replace(/\( --/g, "(--").trim();
settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsItem, {
className: BDFDB.disCN.marginbottom20,
dividerbottom: vars[vars.length-1] != varstr,
type: "TextInput",
childProps: {
type: childType,
mode: childMode,
filter: childType == "file" && "image"
},
label: varname[0].toUpperCase() + varname.slice(1),
note: vardescription && vardescription.indexOf("*") == 0 ? vardescription.slice(1) : vardescription,
basis: "70%",
varname: varname,
value: varvalue,
placeholder: varvalue
}));
}
wrapper.appendChild(BDFDB.PluginUtils.createSettingsPanel(theme, settingsItems));
}
wrapper.appendChild(BDFDB.PluginUtils.createSettingsPanel(theme, settingsitems));
}
}
})();

View File

@ -81,9 +81,9 @@ var TopRoleEverywhere = (_ => {
getSettingsPanel () {
if (!window.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
let settings = BDFDB.DataUtils.get(this, "settings");
let settingspanel, settingsitems = [], inneritems = [];
let settingsPanel, settingsItems = [], innerItems = [];
for (let key in settings) (!this.defaults.settings[key].inner ? settingsitems : inneritems).push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
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,
@ -92,14 +92,14 @@ var TopRoleEverywhere = (_ => {
value: settings[key]
}));
settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsPanelInner, {
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsPanelInner, {
title: "Add Role Tags in:",
first: settingsitems.length == 0,
first: settingsItems.length == 0,
last: true,
children: inneritems
children: innerItems
}));
return settingspanel = BDFDB.PluginUtils.createSettingsPanel(this, settingsitems);
return settingsPanel = BDFDB.PluginUtils.createSettingsPanel(this, settingsItems);
}
//legacy

View File

@ -24,9 +24,9 @@ class UserNotes {
getSettingsPanel () {
if (!window.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
let settingspanel, settingsitems = [];
let settingsPanel, settingsItems = [];
settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsItem, {
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsItem, {
type: "Button",
className: BDFDB.disCN.marginbottom8,
color: BDFDB.LibraryComponents.Button.Colors.RED,
@ -39,7 +39,7 @@ class UserNotes {
children: BDFDB.LanguageUtils.LanguageStrings.DELETE
}));
return settingspanel = BDFDB.PluginUtils.createSettingsPanel(this, settingsitems);
return settingsPanel = BDFDB.PluginUtils.createSettingsPanel(this, settingsItems);
}
//legacy