Added Font Awesome Support into alerts.

This commit is contained in:
Paul-Vincent Roll 2016-04-12 20:54:30 +02:00
parent d72d6d925e
commit ed3c0e42fb
No known key found for this signature in database
GPG Key ID: 79DBE8B2ADAFF747
2 changed files with 11 additions and 2 deletions

View File

@ -135,6 +135,13 @@ self.sendNotification("SHOW_ALERT", {});
<br><b>Default value:</b> <code>none</code>
</td>
</tr>
<tr>
<td><code>imageFA</code> (optional)</td>
<td>Font Awesome icon to show in the alert<br>
<br><b>Possible values:</b> See <a href="http://fontawesome.io/icons/" target="_blank">Font Awsome</a> website.
<br><b>Default value:</b> <code>none</code>
</td>
</tr>
<tr>
<td><code>imageHeight</code> (optional even with imageUrl set)</td>
<td>Height of the image<br>

View File

@ -41,11 +41,13 @@ Module.register("alert",{
//Set standard params if not provided by module
if (typeof params.timer === "undefined") { params.timer = null; }
if (typeof params.imageHeight === "undefined") { params.imageHeight = "80px"; }
if (typeof params.imageUrl === "undefined") {
if (typeof params.imageUrl === "undefined" && typeof params.imageFA === "undefined") {
params.imageUrl = null;
image = "";
} else {
} else if (typeof params.imageFA === "undefined"){
image = "<img src='" + (params.imageUrl).toString() + "' height=" + (params.imageHeight).toString() + " style='margin-bottom: 10px;'/><br />";
} else if (typeof params.imageUrl === "undefined"){
image = "<span class='" + "fa fa-" + params.imageFA + "' style='margin-bottom: 10px;color: #fff;font-size:" + (params.imageHeight).toString() + ";'/></span><br />";
}
//Create overlay
var overlay = document.createElement("div");