diff --git a/src/js/elements/notifications.js b/src/js/elements/notifications.js index 3ce282794..54e222102 100644 --- a/src/js/elements/notifications.js +++ b/src/js/elements/notifications.js @@ -1,29 +1,36 @@ +import * as Misc from "./misc"; // const notificationHistory = []; let id = 0; class Notification { constructor( + type, message, level, duration, customTitle, customIcon, - clickCallback = () => {} + closeCallback = () => {} ) { + this.type = type; this.message = message; this.level = level; - if (duration == undefined) { - if (level === -1) { - this.duration = 0; - } else { - this.duration = 3000; - } + if (type === "banner") { + this.duration = duration; } else { - this.duration = duration * 1000; + if (duration == undefined) { + if (level === -1) { + this.duration = 0; + } else { + this.duration = 3000; + } + } else { + this.duration = duration * 1000; + } } this.customTitle = customTitle; this.customIcon = customIcon; this.id = id++; - this.clickCallback = clickCallback; + this.closeCallback = closeCallback; } //level //0 - notice @@ -48,88 +55,142 @@ class Notification { title = this.customTitle; } + if (this.type === "banner") { + icon = ``; + } + if (this.customIcon != undefined) { icon = ``; } - // moveCurrentToHistory(); - let oldHeight = $("#notificationCenter .history").height(); - $("#notificationCenter .history").prepend(` - -