From 7c42218c6d28680fecf51221ec3a3b7fd3a75022 Mon Sep 17 00:00:00 2001 From: "H.Plato" Date: Fri, 11 Aug 2017 18:35:47 -0600 Subject: [PATCH] IA7 v1.5.670 - persistent banners --- web/ia7/house/main.shtml | 2 +- web/ia7/include/javascript.js | 23 +++++++++++++++++------ 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/web/ia7/house/main.shtml b/web/ia7/house/main.shtml index 50407540b..24a30014f 100644 --- a/web/ia7/house/main.shtml +++ b/web/ia7/house/main.shtml @@ -82,7 +82,7 @@

MisterHouse was created by Bruce Winter. Ron Klinkien developed the v2.3 web interface. Kevin Robert Keegan - designed the IA7 web prototype, updates by H.Plato. IA7 v1.5.650 Font Awesome by Dave Gandy - http://fontawesome.io

+ designed the IA7 web prototype, updates by H.Plato. IA7 v1.5.670 Font Awesome by Dave Gandy - http://fontawesome.io

diff --git a/web/ia7/include/javascript.js b/web/ia7/include/javascript.js index 998497c34..fa180351e 100644 --- a/web/ia7/include/javascript.js +++ b/web/ia7/include/javascript.js @@ -1,4 +1,4 @@ -// v1.5.650 +// v1.5.670 var entity_store = {}; //global storage of entities var json_store = {}; @@ -1459,13 +1459,21 @@ var get_notifications = function(time) { var text = String(json.data[i].text); var type = String(json.data[i].type); var color = String(json.data[i].color); - + var close = ""; + var alert_class = "alert-message"; + if (json.data[i].persistent !== undefined && json.data[i].persistent == "yes") { + close = ""; + alert_class = "alert-message-persist"; + } if ((type == "sound" ) || ((type == "speech") && (speech_sound == "yes"))) { - audio_play(document.getElementById('sound_element'),url) + if (url !== "undefined") { + console.log("in undefined url="+url); + audio_play(document.getElementById('sound_element'),url); + } } if (type == "banner" || ((type == "speech") && (speech_banner == "yes"))) { var alert_type = "info"; - if (color !== undefined) { + if (color !== "undefined") { if (color == "green") { alert_type = "success"; } else if (color == "red") { @@ -1478,8 +1486,11 @@ var get_notifications = function(time) { if ($(window).width() <= 768) { // override the responsive mobile top-buffer mobile = "mobile-alert"; } - $("#alert-area").append($("

Notification: " + text + "

")); - $(".alert-message").delay(4000).fadeOut("slow", function () { $(this).remove(); }); + + $("#alert-area").append($("
"+close+"

Notification: " + text + "

")); + if (json.data[i].persistent == undefined || (json.data[i].persistent !== undefined && json.data[i].persistent == "no")) { + $(".alert-message").delay(4000).fadeOut("slow", function () { $(this).remove(); }); + } } if (type == "alert") { jAlert(text,'MH Notifications');