mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-27 19:53:36 +00:00
Not display title and/or message if they are not provided (alert module)
This commit is contained in:
parent
479ceb14e4
commit
b44dcc9f30
@ -35,9 +35,17 @@ Module.register("alert",{
|
|||||||
},
|
},
|
||||||
show_notification: function(message) {
|
show_notification: function(message) {
|
||||||
if (this.config.effect == "slide") {this.config.effect = this.config.effect + "-" + this.config.position;}
|
if (this.config.effect == "slide") {this.config.effect = this.config.effect + "-" + this.config.position;}
|
||||||
message = "<span class='thin' style='line-height: 35px; font-size:24px' color='#4A4A4A'>" + message.title + "</span><br /><span class='light' style='font-size:28px;line-height: 30px;'>" + message.message + "</span>";
|
|
||||||
|
msg = "";
|
||||||
|
if (message.title) {
|
||||||
|
msg += "<span class='thin' style='line-height: 35px; font-size:24px' color='#4A4A4A'>" + message.title + "</span>";
|
||||||
|
}
|
||||||
|
if (message.message){
|
||||||
|
msg += "<br /><span class='light' style='font-size:28px;line-height: 30px;'>" + message.message + "</span>";
|
||||||
|
}
|
||||||
|
|
||||||
new NotificationFx({
|
new NotificationFx({
|
||||||
message: message,
|
message: msg,
|
||||||
layout: "growl",
|
layout: "growl",
|
||||||
effect: this.config.effect,
|
effect: this.config.effect,
|
||||||
ttl: this.config.display_time
|
ttl: this.config.display_time
|
||||||
@ -67,7 +75,15 @@ Module.register("alert",{
|
|||||||
this.hide_alert(sender);
|
this.hide_alert(sender);
|
||||||
}
|
}
|
||||||
|
|
||||||
message = "<span class='light' style='line-height: 35px; font-size:30px' color='#4A4A4A'>" + params.title + "</span><br /><span class='thin' style='font-size:22px;line-height: 30px;'>" + params.message + "</span>";
|
//Display title and message only if they are provided in notification parameters
|
||||||
|
message ="";
|
||||||
|
if (params.title) {
|
||||||
|
message += "<span class='light' style='line-height: 35px; font-size:30px' color='#4A4A4A'>" + params.title + "</span>"
|
||||||
|
}
|
||||||
|
if (params.message) {
|
||||||
|
message += "<br /><span class='thin' style='font-size:22px;line-height: 30px;'>" + params.message + "</span>";
|
||||||
|
}
|
||||||
|
|
||||||
//Store alert in this.alerts
|
//Store alert in this.alerts
|
||||||
this.alerts[sender.name] = new NotificationFx({
|
this.alerts[sender.name] = new NotificationFx({
|
||||||
message: image + message,
|
message: image + message,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user