This commit is contained in:
Mirco Wittrien 2020-10-23 19:07:35 +02:00
parent 69a64b3063
commit 58bedcf7e2
2 changed files with 18 additions and 17 deletions

View File

@ -543,13 +543,15 @@ module.exports = (_ => {
});
}, 1000);
}
BDFDB.DOMUtils.removeLocalStyle(plugin.name);
BDFDB.ListenerUtils.remove(plugin);
BDFDB.StoreChangeUtils.remove(plugin);
BDFDB.ObserverUtils.disconnect(plugin);
BDFDB.PatchUtils.unpatch(plugin);
BDFDB.WindowUtils.closeAll(plugin);
BDFDB.WindowUtils.removeListener(plugin);
if (BDFDB.DOMUtils) BDFDB.DOMUtils.removeLocalStyle(plugin.name);
if (BDFDB.ListenerUtils) BDFDB.ListenerUtils.remove(plugin);
if (BDFDB.StoreChangeUtils) BDFDB.StoreChangeUtils.remove(plugin);
if (BDFDB.ObserverUtils) BDFDB.ObserverUtils.disconnect(plugin);
if (BDFDB.PatchUtils) BDFDB.PatchUtils.unpatch(plugin);
if (BDFDB.WindowUtils) {
BDFDB.WindowUtils.closeAll(plugin);
BDFDB.WindowUtils.removeListener(plugin);
}
}, "Failed to clean up plugin!", plugin.name)();
};
BDFDB.PluginUtils.checkUpdate = function (pluginName, url) {
@ -3098,14 +3100,13 @@ module.exports = (_ => {
function isRGB(comp) {return comp.slice(0, 3).every(rgb => rgb.toString().indexOf("%") == -1 && parseFloat(rgb) == parseInt(rgb));};
function isHSL(comp) {return comp.slice(1, 3).every(hsl => hsl.toString().indexOf("%") == hsl.length - 1);};
};
BDFDB.ColorUtils.createGradient = function (colorobj, direction = "to right") {
var sortedgradient = {};
var gradientstring = "linear-gradient(" + direction;
for (let pos of Object.keys(colorobj).sort()) {
let color = BDFDB.ColorUtils.convert(colorobj[pos], "RGBA");
gradientstring += color ? `, ${color} ${pos*100}%` : ''
BDFDB.ColorUtils.createGradient = function (colorObj, direction = "to right") {
let gradientString = "linear-gradient(" + direction;
for (let pos of Object.keys(colorObj).sort()) {
let color = BDFDB.ColorUtils.convert(colorObj[pos], "RGBA");
gradientString += color ? `, ${color} ${pos*100}%` : ''
}
return gradientstring += ")";
return gradientString += ")";
};
BDFDB.ColorUtils.getSwatchColor = function (container, number) {
if (!Node.prototype.isPrototypeOf(container)) return;

View File

@ -155,7 +155,7 @@ module.exports = (_ => {
for (let input of settingsPanel.querySelectorAll(".input-newquote " + 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 quote.", {type:"danger"});
let key = settingsPanel.querySelector(".input-name " + BDFDB.dotCN.input).value.trim();
let quote = settingsPanel.querySelector(".input-quote " + BDFDB.dotCN.input).value.trim();
if (formats[key]) return BDFDB.NotificationUtils.toast("A quote with the choosen name already exists. Please choose another name.", {type:"danger"});
if (formats[key]) return BDFDB.NotificationUtils.toast("A quote with the choosen name already exists, please choose another name", {type:"danger"});
else {
formats[key] = quote;
BDFDB.DataUtils.save(formats, this, "formats");
@ -256,7 +256,7 @@ module.exports = (_ => {
format = choice;
if (copy || !BDFDB.LibraryModules.QuoteUtils.canQuote(e.instance.props.message, e.instance.props.channel)) {
BDFDB.LibraryRequires.electron.clipboard.write({text:this.parseQuote(e.instance.props.message, e.instance.props.channel)});
BDFDB.NotificationUtils.toast("Quote has been copied to clipboard.", {type:"success"});
BDFDB.NotificationUtils.toast("Quote has been copied to clipboard", {type:"success"});
}
else BDFDB.LibraryModules.MessageManageUtils.quoteMessage(e.instance.props.channel, e.instance.props.message);
format = null;
@ -270,7 +270,7 @@ module.exports = (_ => {
item = BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
label: BDFDB.LanguageUtils.LanguageStrings.QUOTE,
id: "quote",
action: _ => {action(null, event.shiftKey);}
action: event => {action(null, event.shiftKey);}
});
let [unreadChildren, unreadIndex] = BDFDB.ContextMenuUtils.findItem(e.returnvalue, {id: "mark-unread"});
unreadChildren.splice(unreadIndex > -1 ? unreadIndex - 1 : unreadChildren.length, 0, item);