() {
diff --git a/Lora-Map/resources/css/global.css b/Lora-Map/resources/css/global.css
index 889abbb..6015c47 100644
--- a/Lora-Map/resources/css/global.css
+++ b/Lora-Map/resources/css/global.css
@@ -65,6 +65,12 @@ object {
#menucollumn .info {
background-image: url("icons/information.png");
}
+#menucollumn .weather {
+ background-image: url("icons/storm-in.png");
+}
+#menucollumn .weather.ac {
+ background-image: url("icons/storm-ac.png");
+}
#pannels {
position: absolute;
@@ -87,7 +93,7 @@ object {
display: none;
}
#pannels #pannels_pos .item {
- margin: 4px;
+margin: 4px;
}
#pannels #pannels_pos .item .color {
float: left;
@@ -101,10 +107,10 @@ object {
margin-right: 5px;
}
#pannels #pannels_pos .item .icon img {
- height: 40px;
- width: 40px;
- margin-left: 3px;
-}
+ height: 40px;
+ width: 40px;
+ margin-left: 3px;
+ }
#pannels #pannels_pos .item .line1 .name {
font-weight: bold;
}
@@ -203,6 +209,44 @@ object {
margin-left: 70px;
}
+#pannels #pannels_weather {
+ margin: 5px;
+}
+#pannels #pannels_weather h1 {
+ margin: 0;
+ font-size: 20px;
+ text-align: center;
+}
+#pannels #pannels_weather .alertitem {
+ padding: 5px;
+}
+#pannels #pannels_weather .alertitem.minor {
+ background-color: #ffeb3b;
+}
+#pannels #pannels_weather .alertitem.moderate {
+ background-color: #fb8c00;
+}
+#pannels #pannels_weather .alertitem.severe {
+ background-color: #e53935;
+}
+#pannels #pannels_weather .alertitem.extreme {
+ background-color: #880e4f;
+}
+#pannels #pannels_weather .alertitem .head {
+ font-weight: bold;
+ display: block;
+ font-size: 14px;
+}
+#pannels #pannels_weather .alertitem .ort {
+ display: block;
+ text-align: right;
+ margin-bottom: 10px;
+}
+#pannels #pannels_weather .alertitem .text {
+ display: block;
+ margin-bottom: 10px;
+}
+
#overlays #cameracount {
position: absolute;
top: 10px;
diff --git a/Lora-Map/resources/css/icons/storm-ac.png b/Lora-Map/resources/css/icons/storm-ac.png
new file mode 100644
index 0000000..4cbbae6
Binary files /dev/null and b/Lora-Map/resources/css/icons/storm-ac.png differ
diff --git a/Lora-Map/resources/css/icons/storm-in.png b/Lora-Map/resources/css/icons/storm-in.png
new file mode 100644
index 0000000..ff8a59f
Binary files /dev/null and b/Lora-Map/resources/css/icons/storm-in.png differ
diff --git a/Lora-Map/resources/index.html b/Lora-Map/resources/index.html
index d4ca38a..f78e38b 100644
--- a/Lora-Map/resources/index.html
+++ b/Lora-Map/resources/index.html
@@ -11,6 +11,7 @@
@@ -19,6 +20,9 @@
+
+
Keine Gefahren
+
Teste Login...
diff --git a/Lora-Map/resources/js/functions.js b/Lora-Map/resources/js/functions.js
index 9d21f87..f4b2652 100644
--- a/Lora-Map/resources/js/functions.js
+++ b/Lora-Map/resources/js/functions.js
@@ -28,6 +28,7 @@
MarkerObject._ParseAJAXPanic(json["panic"]);
OverlayObject._ParseAJAXCount(json["cameracount"]);
OverlayObject._ParseAJAXDensity(json["crowdcount"]);
+ MenuObject._ParseAJAXWeatherAlerts(json["weatherwarnings"]);
}
};
get1000.open("GET", "/get1000", true);
@@ -52,21 +53,29 @@
}
},
TimeCalculation: function (timestr, type) {
- if (type === "diffraw" || type === "difftext") {
+ if (type === "diffraw" || type === "difftext" || type === "difftextn") {
var diff = Math.round((Date.now() - Date.parse(timestr) - this._internalTimeOffset) / 1000);
if (type === "diffraw") {
return diff;
}
+ if (type === "difftextn" && diff < 0) {
+ diff = diff * -1;
+ }
+ var isneg = false;
+ if (diff < 0) {
+ isneg = true;
+ diff = diff * -1;
+ }
if (diff < 60) {
- return diff + " s";
+ return (isneg ? "-" : "") + diff + " s";
}
if (diff < 60 * 60) {
- return Math.floor(diff / 60) + " m";
+ return (isneg ? "-" : "") + Math.floor(diff / 60) + " m";
}
if (diff < 60 * 60 * 24) {
- return Math.floor(diff / (60 * 60)) + " h";
+ return (isneg ? "-" : "") + Math.floor(diff / (60 * 60)) + " h";
}
- return Math.floor(diff / (60 * 60 * 24)) + " d";
+ return (isneg ? "-" : "") + Math.floor(diff / (60 * 60 * 24)) + " d";
} else if (type === "str") {
var date = new Date(Date.parse(timestr) + this._internalTimeOffset);
var str = date.toLocaleString();
diff --git a/Lora-Map/resources/js/menu.js b/Lora-Map/resources/js/menu.js
index 98bd21e..4140b23 100644
--- a/Lora-Map/resources/js/menu.js
+++ b/Lora-Map/resources/js/menu.js
@@ -163,5 +163,24 @@
};
testadmin.open("GET", "/admin", true);
testadmin.send();
+ },
+ _ParseAJAXWeatherAlerts: function (json) {
+ if (json.length > 0) {
+ var html = "";
+ for (var i = 0; i < json.length; i++) {
+ var walert = json[i];
+ html += "" +
+ "" + walert.Headline + "" +
+ "" + walert.Location + "" +
+ "" + walert.Body + (walert.Instructions != "" ? "
" + walert.Instructions : "") + "" +
+ "Von: vor " + FunctionsObject.TimeCalculation(walert.From, "difftext") + " Bis: in " + FunctionsObject.TimeCalculation(walert.To, "difftextn") + "" +
+ "
";
+ }
+ document.getElementById("pannels_weather").innerHTML = html;
+ document.getElementById("menucol_weather_icon").className = "weather ac";
+ } else {
+ document.getElementById("pannels_weather").innerHTML = "Keine Gefahren
";
+ document.getElementById("menucol_weather_icon").className = "weather";
+ }
}
}.Start();
\ No newline at end of file