show primitive alert on screen when panic button pressed
This commit is contained in:
parent
1f8bb79d43
commit
52406de2ba
@ -51,6 +51,18 @@ function parseAjaxPanic() {
|
||||
var panics = JSON.parse(this.responseText);
|
||||
for (var id in panics) {
|
||||
if (panics.hasOwnProperty(id)) {
|
||||
var panicitem = panics[id];
|
||||
if (markers.hasOwnProperty(id)) {
|
||||
if (typeof markers[id].getPopup() === "undefined") {
|
||||
markers[id].bindPopup("");
|
||||
}
|
||||
if (timeDiffRaw(panicitem["Triggerdtime"]) <= 10 && !markers[id].isPopupOpen()) {
|
||||
markers[id].setPopupContent("ALERT!");
|
||||
markers[id].openPopup();
|
||||
} else if (timeDiffRaw(panicitem["Triggerdtime"]) > 10 && markers[id].isPopupOpen()) {
|
||||
markers[id].closePopup();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -119,3 +119,7 @@ function timeDiffToText(time) {
|
||||
}
|
||||
return Math.floor(diff / (60 * 60 * 24)) + " d";
|
||||
}
|
||||
|
||||
function timeDiffRaw(time) {
|
||||
return (Date.now() - Date.parse(time)) / 1000;
|
||||
}
|
Loading…
Reference in New Issue
Block a user