This commit is contained in:
Mirco Wittrien 2020-07-17 11:30:02 +02:00
parent 99973b0b03
commit 415a8f88e7
6 changed files with 33 additions and 23 deletions

View File

@ -63,7 +63,7 @@
let loadMessage = BDFDB.LanguageUtils.LibraryStringsFormat("toast_plugin_started", "v" + plugin.version);
BDFDB.LogUtils.log(loadMessage, plugin.name);
if (!BDFDB.BDUtils.getSettings("fork-ps-2") && BDFDB.DataUtils.get(BDFDB, "settings", "showToasts")) BDFDB.NotificationUtils.toast(plugin.name + " " + loadMessage, {nopointer: true, selector: "plugin-started-toast"});
if (!BDFDB.BDUtils.getSettings(BDFDB.BDUtils.settingsIds.showToasts) && BDFDB.DataUtils.get(BDFDB, "settings", "showToasts")) BDFDB.NotificationUtils.toast(plugin.name + " " + loadMessage, {nopointer: true, selector: "plugin-started-toast"});
let url = typeof plugin.getRawUrl == "function" && typeof plugin.getRawUrl() == "string" ? plugin.getRawUrl() : `https://mwittrien.github.io/BetterDiscordAddons/Plugins/${plugin.name}/${plugin.name}.plugin.js`;
BDFDB.PluginUtils.checkUpdate(plugin.name, url);
@ -95,7 +95,7 @@
let unloadMessage = BDFDB.LanguageUtils.LibraryStringsFormat("toast_plugin_stopped", "v" + plugin.version);
BDFDB.LogUtils.log(unloadMessage, plugin.name);
if (!BDFDB.BDUtils.getSettings("fork-ps-2") && BDFDB.DataUtils.get(BDFDB, "settings", "showToasts")) BDFDB.NotificationUtils.toast(plugin.name + " " + unloadMessage, {nopointer: true, selector: "plugin-stopped-toast"});
if (!BDFDB.BDUtils.getSettings(BDFDB.BDUtils.settingsIds.showToasts) && BDFDB.DataUtils.get(BDFDB, "settings", "showToasts")) BDFDB.NotificationUtils.toast(plugin.name + " " + unloadMessage, {nopointer: true, selector: "plugin-stopped-toast"});
let url = typeof plugin.getRawUrl == "function" && typeof plugin.getRawUrl() == "string" ? plugin.getRawUrl() : `https://mwittrien.github.io/BetterDiscordAddons/Plugins/${plugin.name}/${plugin.name}.plugin.js`;
@ -183,7 +183,7 @@
if (!pluginName || !url) return;
let updateNotice = document.querySelector("#pluginNotice");
if (!updateNotice) {
updateNotice = BDFDB.NotificationUtils.notice(`The following plugins need to be updated:&nbsp;&nbsp;<strong id="outdatedPlugins"></strong>`, {html:true, id:"pluginNotice", type:"info", btn:!BDFDB.BDUtils.isAutoLoadEnabled() ? "Reload" : "", customicon:`<svg height="100%" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linecap:round;stroke-linejoin:round;" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg" xml:space="preserve" width="100%" version="1.1" viewBox="0 0 2000 2000"><metadata /><defs><filter id="shadow1"><feDropShadow dx="20" dy="0" stdDeviation="20" flood-color="rgba(0,0,0,0.35)"/></filter><filter id="shadow2"><feDropShadow dx="15" dy="0" stdDeviation="20" flood-color="rgba(255,255,255,0.15)"/></filter><filter id="shadow3"><feDropShadow dx="10" dy="0" stdDeviation="20" flood-color="rgba(0,0,0,0.35)"/></filter></defs><g><path style="filter: url(#shadow3)" d="M1195.44+135.442L1195.44+135.442L997.6+136.442C1024.2+149.742+1170.34+163.542+1193.64+179.742C1264.34+228.842+1319.74+291.242+1358.24+365.042C1398.14+441.642+1419.74+530.642+1422.54+629.642L1422.54+630.842L1422.54+632.042C1422.54+773.142+1422.54+1228.14+1422.54+1369.14L1422.54+1370.34L1422.54+1371.54C1419.84+1470.54+1398.24+1559.54+1358.24+1636.14C1319.74+1709.94+1264.44+1772.34+1193.64+1821.44C1171.04+1837.14+1025.7+1850.54+1000+1863.54L1193.54+1864.54C1539.74+1866.44+1864.54+1693.34+1864.54+1296.64L1864.54+716.942C1866.44+312.442+1541.64+135.442+1195.44+135.442Z" fill="#171717" opacity="1"/><path style="filter: url(#shadow2)" d="M1695.54+631.442C1685.84+278.042+1409.34+135.442+1052.94+135.442L361.74+136.442L803.74+490.442L1060.74+490.442C1335.24+490.442+1335.24+835.342+1060.74+835.342L1060.74+1164.84C1150.22+1164.84+1210.53+1201.48+1241.68+1250.87C1306.07+1353+1245.76+1509.64+1060.74+1509.64L361.74+1863.54L1052.94+1864.54C1409.24+1864.54+1685.74+1721.94+1695.54+1368.54C1695.54+1205.94+1651.04+1084.44+1572.64+999.942C1651.04+915.542+1695.54+794.042+1695.54+631.442Z" fill="#3E82E5" opacity="1"/><path style="filter: url(#shadow1)" d="M1469.25+631.442C1459.55+278.042+1183.05+135.442+826.65+135.442L135.45+135.442L135.45+1004C135.45+1004+135.427+1255.21+355.626+1255.21C575.825+1255.21+575.848+1004+575.848+1004L577.45+490.442L834.45+490.442C1108.95+490.442+1108.95+835.342+834.45+835.342L664.65+835.342L664.65+1164.84L834.45+1164.84C923.932+1164.84+984.244+1201.48+1015.39+1250.87C1079.78+1353+1019.47+1509.64+834.45+1509.64L135.45+1509.64L135.45+1864.54L826.65+1864.54C1182.95+1864.54+1459.45+1721.94+1469.25+1368.54C1469.25+1205.94+1424.75+1084.44+1346.35+999.942C1424.75+915.542+1469.25+794.042+1469.25+631.442Z" fill="#FFFFFF" opacity="1"/></g></svg>`});
updateNotice = BDFDB.NotificationUtils.notice(`The following plugins need to be updated:&nbsp;&nbsp;<strong id="outdatedPlugins"></strong>`, {html:true, id:"pluginNotice", type:"info", btn:!BDFDB.BDUtils.getSettings(BDFDB.BDUtils.settingsIds.automaticLoading) ? "Reload" : "", customicon:`<svg height="100%" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linecap:round;stroke-linejoin:round;" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg" xml:space="preserve" width="100%" version="1.1" viewBox="0 0 2000 2000"><metadata /><defs><filter id="shadow1"><feDropShadow dx="20" dy="0" stdDeviation="20" flood-color="rgba(0,0,0,0.35)"/></filter><filter id="shadow2"><feDropShadow dx="15" dy="0" stdDeviation="20" flood-color="rgba(255,255,255,0.15)"/></filter><filter id="shadow3"><feDropShadow dx="10" dy="0" stdDeviation="20" flood-color="rgba(0,0,0,0.35)"/></filter></defs><g><path style="filter: url(#shadow3)" d="M1195.44+135.442L1195.44+135.442L997.6+136.442C1024.2+149.742+1170.34+163.542+1193.64+179.742C1264.34+228.842+1319.74+291.242+1358.24+365.042C1398.14+441.642+1419.74+530.642+1422.54+629.642L1422.54+630.842L1422.54+632.042C1422.54+773.142+1422.54+1228.14+1422.54+1369.14L1422.54+1370.34L1422.54+1371.54C1419.84+1470.54+1398.24+1559.54+1358.24+1636.14C1319.74+1709.94+1264.44+1772.34+1193.64+1821.44C1171.04+1837.14+1025.7+1850.54+1000+1863.54L1193.54+1864.54C1539.74+1866.44+1864.54+1693.34+1864.54+1296.64L1864.54+716.942C1866.44+312.442+1541.64+135.442+1195.44+135.442Z" fill="#171717" opacity="1"/><path style="filter: url(#shadow2)" d="M1695.54+631.442C1685.84+278.042+1409.34+135.442+1052.94+135.442L361.74+136.442L803.74+490.442L1060.74+490.442C1335.24+490.442+1335.24+835.342+1060.74+835.342L1060.74+1164.84C1150.22+1164.84+1210.53+1201.48+1241.68+1250.87C1306.07+1353+1245.76+1509.64+1060.74+1509.64L361.74+1863.54L1052.94+1864.54C1409.24+1864.54+1685.74+1721.94+1695.54+1368.54C1695.54+1205.94+1651.04+1084.44+1572.64+999.942C1651.04+915.542+1695.54+794.042+1695.54+631.442Z" fill="#3E82E5" opacity="1"/><path style="filter: url(#shadow1)" d="M1469.25+631.442C1459.55+278.042+1183.05+135.442+826.65+135.442L135.45+135.442L135.45+1004C135.45+1004+135.427+1255.21+355.626+1255.21C575.825+1255.21+575.848+1004+575.848+1004L577.45+490.442L834.45+490.442C1108.95+490.442+1108.95+835.342+834.45+835.342L664.65+835.342L664.65+1164.84L834.45+1164.84C923.932+1164.84+984.244+1201.48+1015.39+1250.87C1079.78+1353+1019.47+1509.64+834.45+1509.64L135.45+1509.64L135.45+1864.54L826.65+1864.54C1182.95+1864.54+1459.45+1721.94+1469.25+1368.54C1469.25+1205.94+1424.75+1084.44+1346.35+999.942C1424.75+915.542+1469.25+794.042+1469.25+631.442Z" fill="#FFFFFF" opacity="1"/></g></svg>`});
updateNotice.style.setProperty("display", "block", "important");
updateNotice.style.setProperty("visibility", "visible", "important");
updateNotice.style.setProperty("opacity", "1", "important");
@ -369,7 +369,7 @@
let settings = BDFDB.DataUtils.get(BDFDB, "settings");
let settingsPanel, settingsItems = [];
let bdToastSetting = BDFDB.BDUtils.getSettings("fork-ps-2");
let bdToastSetting = BDFDB.BDUtils.getSettings(BDFDB.BDUtils.settingsIds.showToasts);
for (let key in settings) settingsItems.push(BDFDB.ReactUtils.createElement(InternalComponents.LibraryComponents.SettingsSaveItem, {
className: BDFDB.disCN.marginbottom8,
type: "Switch",
@ -3915,7 +3915,7 @@
}
};
BDFDB.BDUtils.isPluginEnabled = function (pluginName) {
if (BdApi.Plugins && typeof BdApi.Plugins.Plugins == "function") return BdApi.Plugins.isEnabled(pluginName);
if (BdApi.Plugins && typeof BdApi.Plugins.isEnabled == "function") return BdApi.Plugins.isEnabled(pluginName);
else if (typeof BdApi.isPluginEnabled == "function") return BdApi.isPluginEnabled(pluginName);
};
BDFDB.BDUtils.enablePlugin = function (pluginName) {
@ -3957,23 +3957,33 @@
return null;
};
BDFDB.BDUtils.toggleSettings = function (key, state) {
if (key) {
if (typeof key == "string") {
let path = key.split(".");
let currentState = BDFDB.BDUtils.getSettings(key);
if (state === true) {
if (currentState === false) BdApi.enableSetting(key);
if (currentState === false) BdApi.enableSetting(...path);
}
else if (state === false) {
if (currentState === true) BdApi.disableSetting(key);
if (currentState === true) BdApi.disableSetting(...path);
}
else if (currentState === true || currentState === false) BDFDB.BDUtils.toggleSettings(key, !currentState);
}
};
BDFDB.BDUtils.getSettings = function (key) {
if (key) return BdApi.isSettingEnabled(key);
if (typeof key == "string") return BdApi.isSettingEnabled(key.split("."));
else return BDFDB.ReactUtils.getValue(BdApi.getBDData("settings"), `${BDFDB.DiscordUtils.getBuilt()}.settings`);
};
BDFDB.BDUtils.isAutoLoadEnabled = function () {
return BDFDB.BDUtils.getSettings(BdApi.settings["Automatic Loading"].id) === true;
let oldSettings = !BDFDB.ArrayUtils.is(BdApi.settings);
BDFDB.BDUtils.settingsIds = oldSettings ? {
automaticLoading: "fork-ps-5",
coloredText: "bda-gs-7",
normalizedClasses: "fork-ps-4",
showToasts: BDFDB.BDUtils.settingsIds.showToasts
} : {
automaticLoading: "settings.addons.autoReload",
coloredText: "settings.appearance.coloredText",
normalizedClasses: "settings.general.classNormalizer",
showToasts: "settings.general.showToasts"
};
var DiscordClassModules = {};

File diff suppressed because one or more lines are too long

View File

@ -6,7 +6,7 @@ var EditUsers = (_ => {
return class EditUsers {
getName () {return "EditUsers";}
getVersion () {return "3.9.1";}
getVersion () {return "3.9.2";}
getAuthor () {return "DevilBro";}
@ -536,7 +536,7 @@ var EditUsers = (_ => {
let content = e.instance.props.childrenMessageContent;
if (content && content.type && content.type.type) {
let data = changedUsers[content.props.message.author.id];
let messageColor = data && (data.color5 || (BDFDB.BDUtils.getSettings("bda-gs-7") && data.color1));
let messageColor = data && (data.color5 || (BDFDB.BDUtils.getSettings(BDFDB.BDUtils.settingsIds.coloredText) && data.color1));
if (messageColor) {
let message = new BDFDB.DiscordObjects.Message(Object.assign({}, content.props.message, {author: this.getUserData(content.props.message.author.id)}));
if (data.name) message.nick = data.name;
@ -587,7 +587,7 @@ var EditUsers = (_ => {
}
else {
let data = changedUsers[e.instance.props.message.author.id];
let messageColor = data && (data.color5 || (BDFDB.BDUtils.getSettings("bda-gs-7") && data.color1));
let messageColor = data && (data.color5 || (BDFDB.BDUtils.getSettings(BDFDB.BDUtils.settingsIds.coloredText) && data.color1));
if (messageColor) e.returnvalue.props.style = Object.assign({}, e.returnvalue.props.style, {color: BDFDB.ColorUtils.convert(BDFDB.ObjectUtils.is(messageColor) ? messageColor[0] : messageColor, "RGBA")});
}
}

View File

@ -308,7 +308,7 @@ var PluginRepo = (_ => {
if (loading.is) BDFDB.NotificationUtils.toast(`Plugins are still being fetched. Try again in some seconds.`, {type:"danger"});
else {
let modalSettings = BDFDB.DataUtils.get(this, "modalSettings");
let searchTimeout, automaticLoading = BDFDB.BDUtils.isAutoLoadEnabled();
let searchTimeout, automaticLoading = BDFDB.BDUtils.getSettings(BDFDB.BDUtils.settingsIds.automaticLoading);
options = Object.assign(options, modalSettings);
options.updated = options.updated && !options.showOnlyOutdated;
options.outdated = options.updated || options.showOnlyOutdated;

View File

@ -369,7 +369,7 @@ var ThemeRepo = (_ => {
if (loading.is) BDFDB.NotificationUtils.toast(`Themes are still being fetched. Try again in some seconds.`, {type:"danger"});
else {
let modalSettings = BDFDB.DataUtils.get(this, "modalSettings");
let searchTimeout, automaticLoading = BDFDB.BDUtils.isAutoLoadEnabled();
let searchTimeout, automaticLoading = BDFDB.BDUtils.getSettings(BDFDB.BDUtils.settingsIds.automaticLoading);
options = Object.assign(options, modalSettings);
options.updated = options.updated && !options.showOnlyOutdated;
options.outdated = options.updated || options.showOnlyOutdated;
@ -516,7 +516,7 @@ var ThemeRepo = (_ => {
className: BDFDB.disCN.marginbottom20,
type: "Switch",
label: "Preview with normalized classes",
value: BDFDB.BDUtils.getSettings("fork-ps-4"),
value: BDFDB.BDUtils.getSettings(BDFDB.BDUtils.settingsIds.normalizedClasses),
onChange: (value, instance) => {
options.preview.executeJavaScriptSafe(`window.onmessage({
origin: "ThemeRepo",

View File

@ -1867,11 +1867,11 @@ img[src*="/assets/0f4d1ff76624bb45a3fee4189279ee92.svg"] + * + *:before {
background: var(--vaccentcolor-active);
}
.bd-server-card.bd-server-card-pinned:after {
background: rgb(var(--bd-blue));
background: var(--bd-blue);
}
.bd-modal-wrapper .footer button {
background: rgb(var(--bd-blue));
background: var(--bd-blue);
}
.bd-modal-wrapper .footer button:hover {
background: var(--vaccentcolor-hover);
@ -1881,7 +1881,7 @@ img[src*="/assets/0f4d1ff76624bb45a3fee4189279ee92.svg"] + * + *:before {
}
.bd-pfbtn {
background: rgb(var(--bd-blue));
background: var(--bd-blue);
}
.bd-pfbtn:hover {
background: var(--vaccentcolor-hover);
@ -1891,7 +1891,7 @@ img[src*="/assets/0f4d1ff76624bb45a3fee4189279ee92.svg"] + * + *:before {
}
.bd-button {
background: rgb(var(--bd-blue));
background: var(--bd-blue);
}
.bd-button:hover {
background: var(--vaccentcolor-hover);
@ -1905,7 +1905,7 @@ img[src*="/assets/0f4d1ff76624bb45a3fee4189279ee92.svg"] + * + *:before {
}
.bd-addon-list .bd-card-footer button {
background: rgb(var(--bd-blue));
background: var(--bd-blue);
}
.bd-addon-list .bd-card-footer button:hover {
background: var(--vaccentcolor-hover);