toastcolors

This commit is contained in:
Mirco Wittrien 2019-08-22 11:08:08 +02:00
parent 0a9bb5105f
commit 045609e788
2 changed files with 7 additions and 2 deletions

File diff suppressed because one or more lines are too long

View File

@ -410,12 +410,16 @@ var BDFDB = {myPlugins: BDFDB && BDFDB.myPlugins ? BDFDB.myPlugins : {}, BDv2Api
toasts = BDFDB.htmlToElement(`<div class="toasts bd-toasts" style="width:${width}px; left:${left}px; bottom:${bottom}px;"></div>`);
document.querySelector(BDFDB.dotCN.app).appendChild(toasts);
}
const {type = '', icon = true, timeout = 3000, html = false, selector = '', nopointer = false} = options;
const {type = '', icon = true, timeout = 3000, html = false, selector = '', nopointer = false, color = ''} = options;
var toast = BDFDB.htmlToElement(`<div class="toast bd-toast">${html === true ? text : BDFDB.encodeToHTML(text)}</div>`);
if (type) {
BDFDB.addClass(toast, 'toast-' + type);
if (icon) BDFDB.addClass(toast, 'icon');
}
else if (color) {
color = BDFDB.colorCONVERT(color, 'RGB');
if (color) toast.style.setProperty('background-color', color, 'important');
}
BDFDB.addClass(toast, selector);
toasts.appendChild(toast);
toast.close = () => {
@ -1736,6 +1740,7 @@ var BDFDB = {myPlugins: BDFDB && BDFDB.myPlugins ? BDFDB.myPlugins : {}, BDv2Api
status = typeof status == "string" ? status.toLowerCase() : null;
switch (status) {
case 'online': return '#43b581';
case 'mobile': return '#43b581';
case 'idle': return '#faa61a';
case 'dnd': return '#f04747';
case 'streaming': return '#593695';