toastcolors
This commit is contained in:
parent
0a9bb5105f
commit
045609e788
File diff suppressed because one or more lines are too long
|
@ -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>`);
|
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);
|
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>`);
|
var toast = BDFDB.htmlToElement(`<div class="toast bd-toast">${html === true ? text : BDFDB.encodeToHTML(text)}</div>`);
|
||||||
if (type) {
|
if (type) {
|
||||||
BDFDB.addClass(toast, 'toast-' + type);
|
BDFDB.addClass(toast, 'toast-' + type);
|
||||||
if (icon) BDFDB.addClass(toast, 'icon');
|
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);
|
BDFDB.addClass(toast, selector);
|
||||||
toasts.appendChild(toast);
|
toasts.appendChild(toast);
|
||||||
toast.close = () => {
|
toast.close = () => {
|
||||||
|
@ -1736,6 +1740,7 @@ var BDFDB = {myPlugins: BDFDB && BDFDB.myPlugins ? BDFDB.myPlugins : {}, BDv2Api
|
||||||
status = typeof status == "string" ? status.toLowerCase() : null;
|
status = typeof status == "string" ? status.toLowerCase() : null;
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case 'online': return '#43b581';
|
case 'online': return '#43b581';
|
||||||
|
case 'mobile': return '#43b581';
|
||||||
case 'idle': return '#faa61a';
|
case 'idle': return '#faa61a';
|
||||||
case 'dnd': return '#f04747';
|
case 'dnd': return '#f04747';
|
||||||
case 'streaming': return '#593695';
|
case 'streaming': return '#593695';
|
||||||
|
|
Loading…
Reference in New Issue