add alert border and open device info

This commit is contained in:
Philip Schell 2019-03-29 13:46:41 +01:00
parent 52406de2ba
commit 4444b97d3b
3 changed files with 19 additions and 8 deletions

View File

@ -3,6 +3,13 @@
#bigmap { #bigmap {
height: 100%; height: 100%;
} }
#bigmap .marker-alert {
border: red 5px dashed;
top: -5px;
left: -5px;
border-radius: 5px;
box-shadow: rgba(0, 0, 0, 0.4) 10px 10px;
}
/* Optional: Makes the sample page fill the window. */ /* Optional: Makes the sample page fill the window. */
html, body { html, body {

View File

@ -53,14 +53,12 @@ function parseAjaxPanic() {
if (panics.hasOwnProperty(id)) { if (panics.hasOwnProperty(id)) {
var panicitem = panics[id]; var panicitem = panics[id];
if (markers.hasOwnProperty(id)) { if (markers.hasOwnProperty(id)) {
if (typeof markers[id].getPopup() === "undefined") { var marker = markers[id];
markers[id].bindPopup(""); if (timeDiffRaw(panicitem["Triggerdtime"]) <= 10 && marker._icon.className.indexOf(" marker-alert") === -1) {
} marker._icon.className += " marker-alert";
if (timeDiffRaw(panicitem["Triggerdtime"]) <= 10 && !markers[id].isPopupOpen()) { showMarkerInfoPerId(id);
markers[id].setPopupContent("ALERT!"); } else if (timeDiffRaw(panicitem["Triggerdtime"]) > 10 && marker._icon.className.indexOf(" marker-alert") !== -1) {
markers[id].openPopup(); marker._icon.className = marker._icon.className.replace(" marker-alert", "");
} else if (timeDiffRaw(panicitem["Triggerdtime"]) > 10 && markers[id].isPopupOpen()) {
markers[id].closePopup();
} }
} }
} }

View File

@ -24,6 +24,12 @@ function showMarkerInfo(e) {
updateDeviceStatus(); updateDeviceStatus();
} }
function showMarkerInfoPerId(id) {
showHidePanel("pannels_info");
statusToDevice = id;
updateDeviceStatus();
}
function showMarkerInfoMenu() { function showMarkerInfoMenu() {
showHidePanel("pannels_info"); showHidePanel("pannels_info");
statusToDevice = this.getAttribute("rel"); statusToDevice = this.getAttribute("rel");