This commit is contained in:
Mirco Wittrien 2020-09-07 13:07:20 +02:00
parent 6a2d63907d
commit 22f31117f6
6 changed files with 9 additions and 40 deletions

View File

@ -337,6 +337,7 @@
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`,
plugin: plugin,
title: plugin.name,
controls: [
plugin.changelog && BDFDB.ReactUtils.createElement(InternalComponents.LibraryComponents.Clickable, {
@ -416,12 +417,6 @@
InternalBDFDB.addSpecialListeners = function (plugin) {
plugin = plugin == BDFDB && InternalBDFDB || plugin;
if (BDFDB.ObjectUtils.is(plugin)) {
if (typeof plugin.onSettingsClosed === "function") {
let SettingsLayer = BDFDB.ModuleUtils.findByName("StandardSidebarView");
if (SettingsLayer) BDFDB.ModuleUtils.patch(plugin, SettingsLayer.prototype, "componentWillUnmount", {after: e => {
plugin.onSettingsClosed();
}});
}
if (typeof plugin.onSwitch === "function") {
let spacer = document.querySelector(`${BDFDB.dotCN.guildswrapper} ~ * > ${BDFDB.dotCN.chatspacer}`);
if (spacer) {
@ -9030,6 +9025,9 @@
};
InternalComponents.LibraryComponents.SettingsPanel = InternalBDFDB.loadPatchedComp("SettingsPanel") || reactInitialized && class BDFDB_SettingsPanel extends LibraryModules.React.Component {
componentWillUnmount() {
if (BDFDB.ObjectUtils.is(this.props.plugin) && typeof this.props.plugin.onSettingsClosed == "function") this.props.plugin.onSettingsClosed();
}
render() {
let headerItems = [
this.props.title && BDFDB.ReactUtils.createElement(InternalComponents.LibraryComponents.FormComponents.FormTitle, {
@ -9105,7 +9103,7 @@
if (typeof this.props.onChange == "function") this.props.onChange(value, this);
}
render() {
if (typeof this.props.type != "string" || !["BUTTON", "SELECT", "SWITCH", "TEXTINPUT"].includes(this.props.type.toUpperCase())) return null;
if (typeof this.props.type != "string" || !["BUTTON", "SELECT", "SLIDER", "SWITCH", "TEXTINPUT"].includes(this.props.type.toUpperCase())) return null;
let childComponent = InternalComponents.LibraryComponents[this.props.type];
if (!childComponent) return null;
if (this.props.mini && childComponent.Sizes) this.props.size = childComponent.Sizes.MINI || childComponent.Sizes.MIN;
@ -9311,7 +9309,7 @@
if (typeof this.props.onChange == "function") this.props.onChange(value, this);
}
render() {
if (typeof this.props.type != "string" || !["SELECT", "SWITCH", "TEXTINPUT"].includes(this.props.type.toUpperCase())) return null;
if (typeof this.props.type != "string" || !["SELECT", "SLIDER", "SWITCH", "TEXTINPUT"].includes(this.props.type.toUpperCase())) return null;
return BDFDB.ReactUtils.createElement(InternalComponents.LibraryComponents.SettingsItem, BDFDB.ObjectUtils.exclude(Object.assign({}, this.props, {
onChange: this.saveSettings.bind(this)
}), "keys", "key", "plugin"));

File diff suppressed because one or more lines are too long

View File

@ -242,20 +242,6 @@ var CompleteTimestamps = (_ => {
}
}, BDFDB.LanguageUtils.languages);
// REMOVE 19.07.2020
let oldChoices = BDFDB.DataUtils.load(this, "choices");
if (oldChoices.creationDateLang) {
oldChoices.timestampLang = oldChoices.creationDateLang;
delete oldChoices.creationDateLang;
BDFDB.DataUtils.save(oldChoices, this, "choices");
}
let oldFormats = BDFDB.DataUtils.load(this, "formats");
if (oldFormats.ownformat) {
oldFormats.ownFormat = oldFormats.ownformat;
delete oldFormats.ownformat;
BDFDB.DataUtils.save(oldFormats, this, "formats");
}
this.forceUpdateAll();
}
else console.error(`%c[${this.getName()}]%c`, "color: #3a71c1; font-weight: 700;", "", "Fatal Error: Could not load BD functions!");
@ -267,6 +253,8 @@ var CompleteTimestamps = (_ => {
this.stopping = true;
this.forceUpdateAll();
BDFDB.DOMUtils.removeLocalStyle(this.name + "CompactCorrection");
BDFDB.PluginUtils.clear(this);
}

View File

@ -236,9 +236,6 @@ var CustomQuoter = (_ => {
if (this.started) return;
BDFDB.PluginUtils.init(this);
let customQuote = BDFDB.DataUtils.load(this, "formats", "customQuote"); // REMOVE 01.07.2020
if (typeof customQuote == "string") BDFDB.DataUtils.save(customQuote, this, "formats", "Standard");
BDFDB.ModuleUtils.patch(this, BDFDB.LibraryModules.QuoteUtils, "createQuotedText", {instead: e => {
return this.parseQuote(e.methodArguments[0], e.methodArguments[1]);
}});

View File

@ -522,13 +522,6 @@ var PluginRepo = (_ => {
if (window.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
if (this.started) return;
BDFDB.PluginUtils.init(this);
let oldfavorites = BDFDB.DataUtils.load(this, "favorites"); // REMOVE 26.07.2020
if (BDFDB.ObjectUtils.is(oldfavorites) && Object.keys(oldfavorites).length) {
let newfavorites = [];
for (let url in oldfavorites) if (oldfavorites[url]) newfavorites.push(url);
BDFDB.DataUtils.save(newfavorites, this, "favorites");
}
this.forceUpdateAll();

View File

@ -815,13 +815,6 @@ var ThemeRepo = (_ => {
if (window.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
if (this.started) return;
BDFDB.PluginUtils.init(this);
let oldfavorites = BDFDB.DataUtils.load(this, "favorites"); // REMOVE 26.07.2020
if (BDFDB.ObjectUtils.is(oldfavorites) && Object.keys(oldfavorites).length) {
let newfavorites = [];
for (let url in oldfavorites) if (oldfavorites[url]) newfavorites.push(url);
BDFDB.DataUtils.save(newfavorites, this, "favorites");
}
this.forceUpdateAll();