Refactoring of all JS finished.
This commit is contained in:
parent
b214aaecee
commit
f4efe2ab66
@ -4,6 +4,7 @@
|
||||
### New Features
|
||||
### Bugfixes
|
||||
### Changes
|
||||
* Refactoring of all JS
|
||||
|
||||
## 1.2.8
|
||||
### New Features
|
||||
|
@ -10,9 +10,9 @@
|
||||
<body>
|
||||
<div id="bigmap"></div>
|
||||
<div id="menucollumn">
|
||||
<span class="pos" onclick="showHidePanel('pannels_pos');"></span>
|
||||
<span class="admin" onclick="showHidePanel('pannels_admin');"></span>
|
||||
<span class="info" onclick="showHidePanel('pannels_version');"></span>
|
||||
<span class="pos" onclick="MenuObject.ShowHidePanel('pannels_pos');"></span>
|
||||
<span class="admin" onclick="MenuObject.ShowHidePanel('pannels_admin');"></span>
|
||||
<span class="info" onclick="MenuObject.ShowHidePanel('pannels_version');"></span>
|
||||
</div>
|
||||
<div id="pannels">
|
||||
<div id="pannels_pos"></div>
|
||||
|
@ -1,11 +1,11 @@
|
||||
var FunctionsObject = {
|
||||
_internalTimeOffset: 0,
|
||||
Start: function () {
|
||||
setInterval(this._Runner, 60000);
|
||||
this._Runner();
|
||||
setInterval(this._Runner60000, 60000);
|
||||
this._Runner60000();
|
||||
return this;
|
||||
},
|
||||
_Runner: function () {
|
||||
_Runner60000: function () {
|
||||
var timecorrection = new XMLHttpRequest();
|
||||
timecorrection.onreadystatechange = function () {
|
||||
if (timecorrection.readyState === 4 && timecorrection.status === 200) {
|
||||
|
@ -1,11 +1,14 @@
|
||||
var MapObject = {
|
||||
Map: {},
|
||||
_SpecialMarkers: new Array(),
|
||||
Start: function () {
|
||||
this.Map = L.map('bigmap').setView(["{%START_LOCATION%}"], 16);
|
||||
this._GetMapLayers();
|
||||
this._RunnerOnce();
|
||||
this._SetupMapZoomFontsize();
|
||||
this._SetupClickHandler();
|
||||
return this;
|
||||
},
|
||||
_GetMapLayers: function () {
|
||||
_RunnerOnce: function () {
|
||||
var layergetter = new XMLHttpRequest();
|
||||
layergetter.onreadystatechange = function () {
|
||||
if (layergetter.readyState === 4 && layergetter.status === 200) {
|
||||
@ -14,6 +17,15 @@
|
||||
};
|
||||
layergetter.open("GET", "/getlayer", true);
|
||||
layergetter.send();
|
||||
|
||||
var geogetter = new XMLHttpRequest();
|
||||
geogetter.onreadystatechange = function () {
|
||||
if (geogetter.readyState === 4 && geogetter.status === 200) {
|
||||
MapObject._ParseAJAXGeo(JSON.parse(geogetter.responseText));
|
||||
}
|
||||
};
|
||||
geogetter.open("GET", "/getgeo", true);
|
||||
geogetter.send();
|
||||
},
|
||||
_ParseAJAXLayers: function (maps) {
|
||||
var i = 0;
|
||||
@ -53,16 +65,8 @@
|
||||
}
|
||||
L.control.layers(baseMaps).addTo(this.Map);
|
||||
}
|
||||
}
|
||||
}.Start();
|
||||
|
||||
var SpecialMarkers = new Array();
|
||||
GetGeoLayer();
|
||||
function GetGeoLayer() {
|
||||
var geogetter = new XMLHttpRequest();
|
||||
geogetter.onreadystatechange = function () {
|
||||
if (geogetter.readyState === 4 && geogetter.status === 200) {
|
||||
var geo = JSON.parse(geogetter.responseText);
|
||||
},
|
||||
_ParseAJAXGeo: function (geo) {
|
||||
if (!(Object.keys(geo).length === 0 && geo.constructor === Object)) {
|
||||
L.geoJSON(geo, {
|
||||
style: function (features) {
|
||||
@ -76,7 +80,7 @@ function GetGeoLayer() {
|
||||
},
|
||||
onEachFeature: function (feature, layer) {
|
||||
if (feature.geometry.type === "Polygon" || feature.geometry.type === "Point" && feature.properties.hasOwnProperty("icon")) {
|
||||
var text = "<b>"+feature.properties.name+"</b>";
|
||||
var text = "<b>" + feature.properties.name + "</b>";
|
||||
if (feature.properties.hasOwnProperty("description")) {
|
||||
text = text + "<br>" + feature.properties.description;
|
||||
}
|
||||
@ -92,7 +96,7 @@ function GetGeoLayer() {
|
||||
iconSize: [8, 8]
|
||||
})
|
||||
});
|
||||
SpecialMarkers.push(snumbericon);
|
||||
MapObject._SpecialMarkers.push(snumbericon);
|
||||
return snumbericon;
|
||||
} else if (geoJsonPoint.properties.hasOwnProperty("description") && geoJsonPoint.properties["description"] === "coord" && !geoJsonPoint.properties.hasOwnProperty("icon")) {
|
||||
var coordicon = L.marker(latlng, {
|
||||
@ -101,24 +105,20 @@ function GetGeoLayer() {
|
||||
html: geoJsonPoint.properties["name"]
|
||||
})
|
||||
});
|
||||
SpecialMarkers.push(coordicon);
|
||||
MapObject._SpecialMarkers.push(coordicon);
|
||||
return coordicon;
|
||||
} else if (geoJsonPoint.properties.hasOwnProperty("icon")) {
|
||||
return L.marker(latlng, { icon: L.icon({ iconUrl: "css/icons/cctv.png", iconSize: [32, 32] }) });
|
||||
}
|
||||
}
|
||||
}).addTo(MapObject.Map);
|
||||
}).addTo(this.Map);
|
||||
}
|
||||
}
|
||||
};
|
||||
geogetter.open("GET", "/getgeo", true);
|
||||
geogetter.send();
|
||||
}
|
||||
|
||||
MapObject.Map.on('zoomend', function () {
|
||||
},
|
||||
_SetupMapZoomFontsize: function () {
|
||||
this.Map.on('zoomend', function () {
|
||||
var currentZoom = MapObject.Map.getZoom();
|
||||
if (currentZoom < 14) {
|
||||
SpecialMarkers.forEach(function (elem, index) {
|
||||
MapObject._SpecialMarkers.forEach(function (elem, index) {
|
||||
if (elem.feature.properties["description"] === "snumber") {
|
||||
elem._icon.style.fontSize = "0px";
|
||||
elem._icon.style.marginLeft = "0px";
|
||||
@ -129,7 +129,7 @@ MapObject.Map.on('zoomend', function () {
|
||||
}
|
||||
});
|
||||
} else if (currentZoom === 14) {
|
||||
SpecialMarkers.forEach(function (elem, index) {
|
||||
MapObject._SpecialMarkers.forEach(function (elem, index) {
|
||||
if (elem.feature.properties["description"] === "snumber") {
|
||||
elem._icon.style.fontSize = "0px";
|
||||
elem._icon.style.marginLeft = "0px";
|
||||
@ -140,7 +140,7 @@ MapObject.Map.on('zoomend', function () {
|
||||
}
|
||||
});
|
||||
} else if (currentZoom === 15) {
|
||||
SpecialMarkers.forEach(function (elem, index) {
|
||||
MapObject._SpecialMarkers.forEach(function (elem, index) {
|
||||
if (elem.feature.properties["description"] === "snumber") {
|
||||
elem._icon.style.fontSize = "0px";
|
||||
elem._icon.style.marginLeft = "0px";
|
||||
@ -151,7 +151,7 @@ MapObject.Map.on('zoomend', function () {
|
||||
}
|
||||
});
|
||||
} else if (currentZoom === 16) {
|
||||
SpecialMarkers.forEach(function (elem, index) {
|
||||
MapObject._SpecialMarkers.forEach(function (elem, index) {
|
||||
if (elem.feature.properties["description"] === "snumber") {
|
||||
elem._icon.style.fontSize = "5px";
|
||||
elem._icon.style.marginLeft = "-4px";
|
||||
@ -162,7 +162,7 @@ MapObject.Map.on('zoomend', function () {
|
||||
}
|
||||
});
|
||||
} else if (currentZoom === 17) {
|
||||
SpecialMarkers.forEach(function (elem, index) {
|
||||
MapObject._SpecialMarkers.forEach(function (elem, index) {
|
||||
if (elem.feature.properties["description"] === "snumber") {
|
||||
elem._icon.style.fontSize = "5px";
|
||||
elem._icon.style.marginLeft = "-4px";
|
||||
@ -173,7 +173,7 @@ MapObject.Map.on('zoomend', function () {
|
||||
}
|
||||
});
|
||||
} else if (currentZoom === 18) {
|
||||
SpecialMarkers.forEach(function (elem, index) {
|
||||
MapObject._SpecialMarkers.forEach(function (elem, index) {
|
||||
if (elem.feature.properties["description"] === "snumber") {
|
||||
elem._icon.style.fontSize = "8px";
|
||||
elem._icon.style.marginLeft = "-5px";
|
||||
@ -184,7 +184,7 @@ MapObject.Map.on('zoomend', function () {
|
||||
}
|
||||
});
|
||||
} else if (currentZoom === 19) {
|
||||
SpecialMarkers.forEach(function (elem, index) {
|
||||
MapObject._SpecialMarkers.forEach(function (elem, index) {
|
||||
if (elem.feature.properties["description"] === "snumber") {
|
||||
elem._icon.style.fontSize = "14px";
|
||||
elem._icon.style.marginLeft = "-8px";
|
||||
@ -195,10 +195,12 @@ MapObject.Map.on('zoomend', function () {
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
MapObject.Map.on("click", hidePanel);
|
||||
|
||||
function hidePanel(e) {
|
||||
showHidePanel(null);
|
||||
}
|
||||
});
|
||||
},
|
||||
_SetupClickHandler: function () {
|
||||
this.Map.on("click", this._HidePanel);
|
||||
},
|
||||
_HidePanel: function (e) {
|
||||
MenuObject.ShowHidePanel(null);
|
||||
}
|
||||
}.Start();
|
@ -3,10 +3,11 @@
|
||||
PanicData: {},
|
||||
LocationData: {},
|
||||
Start: function () {
|
||||
setInterval(this._Runner, 1000);
|
||||
setInterval(this._Runner1000, 1000);
|
||||
this._Runner1000();
|
||||
return this;
|
||||
},
|
||||
_Runner: function () {
|
||||
_Runner1000: function () {
|
||||
var loc = new XMLHttpRequest();
|
||||
loc.onreadystatechange = function () {
|
||||
if (loc.readyState === 4 && loc.status === 200) {
|
||||
@ -44,7 +45,7 @@
|
||||
});
|
||||
marker = L.marker([positionItem['Latitude'], positionItem['Longitude']], { 'title': positionItem['Name'], 'icon': myIcon });
|
||||
}
|
||||
this._Markers[key] = marker.addTo(MapObject.Map).on("click", showMarkerInfo, key);
|
||||
this._Markers[key] = marker.addTo(MapObject.Map).on("click", function () { MenuObject.statusToDevice = this; MenuObject.ShowHidePanel("pannels_info"); }, key);
|
||||
} else {
|
||||
this._Markers[key].setLatLng([positionItem['Latitude'], positionItem['Longitude']]);
|
||||
if (positionItem['Icon'] !== null) {
|
||||
@ -64,7 +65,7 @@
|
||||
} else {
|
||||
if (this._Markers[key]._icon.children.length === 1 && this._Markers[key]._icon.children[0].hasAttribute("src")) {
|
||||
this._Markers[key].removeFrom(MapObject.Map);
|
||||
this._Markers[key] = L.marker([positionItem['Latitude'], positionItem['Longitude']], { 'title': positionItem['Name'] }).addTo(MapObject.Map).on("click", showMarkerInfo, key);
|
||||
this._Markers[key] = L.marker([positionItem['Latitude'], positionItem['Longitude']], { 'title': positionItem['Name'] }).addTo(MapObject.Map).on("click", function () { MenuObject.statusToDevice = this; MenuObject.ShowHidePanel("pannels_info"); }, key);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -83,8 +84,8 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
updateStatus();
|
||||
update_pannels_info();
|
||||
MenuObject.UpdateStatus();
|
||||
MenuObject._Update_pannels_info();
|
||||
},
|
||||
_ParseAJAXPanic: function (serverPanic) {
|
||||
this.PanicData = serverPanic;
|
||||
@ -95,7 +96,7 @@
|
||||
var marker = this._Markers[id];
|
||||
if (FunctionsObject.TimeCalculation(alertItem["Recievedtime"], "diffraw") <= 10 && marker._icon.className.indexOf(" marker-alert") === -1) {
|
||||
marker._icon.className += " marker-alert";
|
||||
showMarkerInfoPerId(id);
|
||||
MenuObject.ShowMarkerInfoPerId(id);
|
||||
} else if (FunctionsObject.TimeCalculation(alertItem["Recievedtime"], "diffraw") > 10 && marker._icon.className.indexOf(" marker-alert") !== -1) {
|
||||
marker._icon.className = marker._icon.className.replace(" marker-alert", "");
|
||||
}
|
||||
|
@ -1,92 +1,50 @@
|
||||
var visiblePanel = null;
|
||||
function showHidePanel(name) {
|
||||
if (visiblePanel === null && name !== null) {
|
||||
var MenuObject = {
|
||||
statusToDevice: null,
|
||||
_visiblePanel: null,
|
||||
_overviewStatus: new Array(),
|
||||
Start: function () {
|
||||
return this;
|
||||
},
|
||||
ShowHidePanel: function (name) {
|
||||
if (this._visiblePanel === null && name !== null) {
|
||||
document.getElementById("pannels").style.display = "block";
|
||||
document.getElementById(name).style.display = "block";
|
||||
visiblePanel = name;
|
||||
if (typeof window["update_" + name] === "function") {
|
||||
window["update_" + name]();
|
||||
this._visiblePanel = name;
|
||||
if (typeof MenuObject["_Update_" + name] === "function") {
|
||||
MenuObject["_Update_" + name]();
|
||||
}
|
||||
} else if (visiblePanel === name && name !== "pannels_info" || name === null) {
|
||||
} else if (this._visiblePanel === name && name !== "pannels_info" || name === null) {
|
||||
document.getElementById("pannels").style.display = "none";
|
||||
if (visiblePanel !== null) {
|
||||
document.getElementById(visiblePanel).style.display = "none";
|
||||
if (this._visiblePanel !== null) {
|
||||
document.getElementById(this._visiblePanel).style.display = "none";
|
||||
}
|
||||
visiblePanel = null;
|
||||
this._visiblePanel = null;
|
||||
} else {
|
||||
document.getElementById(visiblePanel).style.display = "none";
|
||||
document.getElementById(this._visiblePanel).style.display = "none";
|
||||
document.getElementById(name).style.display = "block";
|
||||
visiblePanel = name;
|
||||
if (typeof window["update_" + name] === "function") {
|
||||
window["update_" + name]();
|
||||
this._visiblePanel = name;
|
||||
if (typeof MenuObject["_Update_" + name] === "function") {
|
||||
MenuObject["_Update_" + name]();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var statusToDevice = null;
|
||||
function showMarkerInfo(e) {
|
||||
statusToDevice = this;
|
||||
showHidePanel("pannels_info");
|
||||
}
|
||||
|
||||
function showMarkerInfoPerId(id) {
|
||||
statusToDevice = id;
|
||||
showHidePanel("pannels_info");
|
||||
}
|
||||
|
||||
function showMarkerInfoMenu() {
|
||||
statusToDevice = this.getAttribute("rel");
|
||||
showHidePanel("pannels_info");
|
||||
}
|
||||
|
||||
function update_pannels_info() {
|
||||
document.getElementById("pannels_info").innerHTML = "";
|
||||
if (MarkerObject.LocationData.hasOwnProperty(statusToDevice)) {
|
||||
var positionItem = MarkerObject.LocationData[statusToDevice];
|
||||
var html = "<div class=\"name\">Name: <span class=\"bold\">" + positionItem["Name"] + "</span></div>";
|
||||
html += "<div class=\"batt\"><span class=\"bold\">Batterie:</span> " + positionItem["Battery"] + "V <img src=\"icons/akku/" + positionItem["Batterysimple"] + "-4.png\"></div>";
|
||||
if (positionItem["Fix"]) {
|
||||
html += "<div class=\"gps\" style=\"color: green;\">GPS-Empfang</div>";
|
||||
} else {
|
||||
html += "<div class=\"gps\" style=\"color: red;\">kein GPS-Empfang</div>";
|
||||
}
|
||||
html += "<div class=\"coord\">" + positionItem["UTM"]["Base"] + " <span style=\"color: #b1a831;\">" + positionItem["UTM"]["FieldWidth"] + "</span><span style=\"color: #218c00;\">" + positionItem["UTM"]["Width"] + "</span> <span style=\"color: #b1a831;\">" + positionItem["UTM"]["FieldHeight"] + "</span><span style=\"color: #218c00;\">" + positionItem["UTM"]["Height"] + "</span></div>";
|
||||
html += "<div class=\"height\"><span class=\"bold\">Höhe:</span> " + positionItem["Height"].toFixed(1) + " m</div>";
|
||||
html += "<div class=\"hdop\"><span class=\"bold\">HDOP:</span> " + positionItem["Hdop"].toFixed(1) + "</div>";
|
||||
html += "<div class=\"lanlot\"><span class=\"bold\">Dezimal:</span> " + positionItem["Latitude"].toFixed(5) + ", " + positionItem["Longitude"].toFixed(5) + "</div>";
|
||||
html += "<div class=\"lastgps\"><span class=\"bold\">Letzter Wert:</span> Vor: " + FunctionsObject.TimeCalculation(positionItem["Lastgpspostime"], "difftext") + "</div>";
|
||||
html += "<div class=\"update\"><span class=\"bold\">Update:</span> " + FunctionsObject.TimeCalculation(positionItem["Recievedtime"], "str") + "<br><span class=\"bold\">Vor:</span> " + FunctionsObject.TimeCalculation(positionItem["Recievedtime"], "difftext") + "</div>";
|
||||
html += "<div><span class=\"bold\">RSSI:</span> " + positionItem["Rssi"] + ", <span class=\"bold\">SNR:</span> " + positionItem["Snr"] + "</div>";
|
||||
if (MarkerObject.PanicData.hasOwnProperty(statusToDevice)) {
|
||||
var panicData = MarkerObject.PanicData[statusToDevice];
|
||||
if (panicData["ButtonPressed"].length > 0) {
|
||||
html += "<div class='alerts'><span class=\"bold\">Alerts:</span>";
|
||||
for (var i = 0; i < panicData["ButtonPressed"].length; i++) {
|
||||
html += "<span class='panicitem'>" + FunctionsObject.TimeCalculation(panicData["ButtonPressed"][i], "str") + " (vor " + FunctionsObject.TimeCalculation(panicData["ButtonPressed"][i],"difftext")+")</span>";
|
||||
}
|
||||
html += "</div>";
|
||||
}
|
||||
}
|
||||
document.getElementById("pannels_info").innerHTML = html;
|
||||
}
|
||||
}
|
||||
|
||||
var overviewStatus = new Array();
|
||||
|
||||
function updateStatus() {
|
||||
},
|
||||
ShowMarkerInfoPerId: function (id) {
|
||||
this.statusToDevice = id;
|
||||
this.ShowHidePanel("pannels_info");
|
||||
},
|
||||
UpdateStatus: function () {
|
||||
for (var id in MarkerObject.LocationData) {
|
||||
if (MarkerObject.LocationData.hasOwnProperty(id)) {
|
||||
var positionItem = MarkerObject.LocationData[id];
|
||||
if (typeof overviewStatus[id] === "undefined") {
|
||||
overviewStatus[id] = createOverviewElement(positionItem, id);
|
||||
document.getElementById("pannels_pos").appendChild(overviewStatus[id]);
|
||||
if (typeof this._overviewStatus[id] === "undefined") {
|
||||
this._overviewStatus[id] = this._CreateOverviewElement(positionItem, id);
|
||||
document.getElementById("pannels_pos").appendChild(this._overviewStatus[id]);
|
||||
}
|
||||
updateOverviewElement(positionItem, id);
|
||||
this._UpdateOverviewElement(positionItem, id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function updateOverviewElement(positionItem, id) {
|
||||
},
|
||||
_UpdateOverviewElement: function (positionItem, id) {
|
||||
if (positionItem["Batterysimple"] === 0) {
|
||||
document.getElementById("overview-color-id-" + id).style.backgroundColor = "red";
|
||||
} else if (positionItem["Batterysimple"] === 1 || positionItem["Batterysimple"] === 2) {
|
||||
@ -118,12 +76,14 @@ function updateOverviewElement(positionItem, id) {
|
||||
document.getElementById("overview-icon-id-" + id).innerHTML = "<img src=\"" + positionItem['Icon'] + "&marker-bg=hidden" + "\" rel='svg'/>";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function createOverviewElement(positionItem, id) {
|
||||
},
|
||||
_CreateOverviewElement: function (positionItem, id) {
|
||||
var divItem = document.createElement("div");
|
||||
divItem.className = "item";
|
||||
divItem.onclick = showMarkerInfoMenu;
|
||||
divItem.onclick = function showMarkerInfoMenu() {
|
||||
MenuObject.statusToDevice = this.getAttribute("rel");
|
||||
MenuObject.ShowHidePanel("pannels_info");
|
||||
};
|
||||
divItem.setAttribute("rel", id);
|
||||
divItem.innerHTML = "<span class=\"color\" id=\"overview-color-id-" + id + "\"></span>";
|
||||
if (positionItem['Icon'] !== null) {
|
||||
@ -138,38 +98,70 @@ function createOverviewElement(positionItem, id) {
|
||||
divItem.innerHTML += "<div class=\"line2\" style=\"color: red;\" id=\"overview-gps-id-" + id + "\">kein GPS-Empfang</div>";
|
||||
divItem.innerHTML += "<div class=\"line3\" id=\"overview-update-id-" + id + "\">Letzte Werte: vor " + FunctionsObject.TimeCalculation(positionItem["Recievedtime"], "difftext") + "</div>";
|
||||
return divItem;
|
||||
}
|
||||
|
||||
|
||||
function update_pannels_admin() {
|
||||
var testadmin = new XMLHttpRequest();
|
||||
testadmin.onreadystatechange = parseAjaxPannelAdmin;
|
||||
testadmin.open("GET", "/admin", true);
|
||||
testadmin.send();
|
||||
}
|
||||
|
||||
function parseAjaxPannelAdmin() {
|
||||
if (this.readyState === 4 && this.status === 403) {
|
||||
var html = "<h3>Login to Adminpannel</h3><form onsubmit='submitloginform();return false;'>";
|
||||
},
|
||||
_ParseAJAXPannelAdmin: function (loggedin) {
|
||||
if (!loggedin) {
|
||||
var html = "<h3>Login to Adminpannel</h3><form onsubmit='MenuObject.SubmitLoginForm(); return false;'>";
|
||||
html += "<div><span class='label'>Username:</span><input id='pannels_admin_name'></div>";
|
||||
html += "<div><span class='label'>Passwort:</span><input type='password' id='pannels_admin_pass'></div>";
|
||||
html += "<div><span class='login'><input type='submit'></span></div></form>";
|
||||
document.getElementById("pannels_admin").innerHTML = html;
|
||||
} else if (this.readyState === 4 && this.status === 200) {
|
||||
} else {
|
||||
document.getElementById("pannels_admin").innerHTML = "<a href='/admin/' target='_blank'>Adminpannel</a>";
|
||||
}
|
||||
}
|
||||
|
||||
function submitloginform() {
|
||||
},
|
||||
SubmitLoginForm: function () {
|
||||
var adminlogin = new XMLHttpRequest();
|
||||
adminlogin.onreadystatechange = parseAjaxLogin;
|
||||
adminlogin.onreadystatechange = function () {
|
||||
if (adminlogin.readyState === 4 && adminlogin.status === 200) {
|
||||
MenuObject._Update_pannels_admin();
|
||||
}
|
||||
};
|
||||
adminlogin.open("POST", "/admin/login", true);
|
||||
adminlogin.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
|
||||
adminlogin.send("user=" + encodeURI(document.getElementById("pannels_admin_name").value) + "&pass=" + encodeURI(document.getElementById("pannels_admin_pass").value));
|
||||
}
|
||||
|
||||
function parseAjaxLogin() {
|
||||
if (this.readyState === 4 && this.status === 200) {
|
||||
update_pannels_admin();
|
||||
},
|
||||
_Update_pannels_info: function () {
|
||||
document.getElementById("pannels_info").innerHTML = "";
|
||||
if (MarkerObject.LocationData.hasOwnProperty(this.statusToDevice)) {
|
||||
var positionItem = MarkerObject.LocationData[this.statusToDevice];
|
||||
var html = "<div class=\"name\">Name: <span class=\"bold\">" + positionItem["Name"] + "</span></div>";
|
||||
html += "<div class=\"batt\"><span class=\"bold\">Batterie:</span> " + positionItem["Battery"] + "V <img src=\"icons/akku/" + positionItem["Batterysimple"] + "-4.png\"></div>";
|
||||
if (positionItem["Fix"]) {
|
||||
html += "<div class=\"gps\" style=\"color: green;\">GPS-Empfang</div>";
|
||||
} else {
|
||||
html += "<div class=\"gps\" style=\"color: red;\">kein GPS-Empfang</div>";
|
||||
}
|
||||
}
|
||||
html += "<div class=\"coord\">" + positionItem["UTM"]["Base"] + " <span style=\"color: #b1a831;\">" + positionItem["UTM"]["FieldWidth"] + "</span><span style=\"color: #218c00;\">" + positionItem["UTM"]["Width"] + "</span> <span style=\"color: #b1a831;\">" + positionItem["UTM"]["FieldHeight"] + "</span><span style=\"color: #218c00;\">" + positionItem["UTM"]["Height"] + "</span></div>";
|
||||
html += "<div class=\"height\"><span class=\"bold\">Höhe:</span> " + positionItem["Height"].toFixed(1) + " m</div>";
|
||||
html += "<div class=\"hdop\"><span class=\"bold\">HDOP:</span> " + positionItem["Hdop"].toFixed(1) + "</div>";
|
||||
html += "<div class=\"lanlot\"><span class=\"bold\">Dezimal:</span> " + positionItem["Latitude"].toFixed(5) + ", " + positionItem["Longitude"].toFixed(5) + "</div>";
|
||||
html += "<div class=\"lastgps\"><span class=\"bold\">Letzter Wert:</span> Vor: " + FunctionsObject.TimeCalculation(positionItem["Lastgpspostime"], "difftext") + "</div>";
|
||||
html += "<div class=\"update\"><span class=\"bold\">Update:</span> " + FunctionsObject.TimeCalculation(positionItem["Recievedtime"], "str") + "<br><span class=\"bold\">Vor:</span> " + FunctionsObject.TimeCalculation(positionItem["Recievedtime"], "difftext") + "</div>";
|
||||
html += "<div><span class=\"bold\">RSSI:</span> " + positionItem["Rssi"] + ", <span class=\"bold\">SNR:</span> " + positionItem["Snr"] + "</div>";
|
||||
if (MarkerObject.PanicData.hasOwnProperty(this.statusToDevice)) {
|
||||
var panicData = MarkerObject.PanicData[this.statusToDevice];
|
||||
if (panicData["ButtonPressed"].length > 0) {
|
||||
html += "<div class='alerts'><span class=\"bold\">Alerts:</span>";
|
||||
for (var i = 0; i < panicData["ButtonPressed"].length; i++) {
|
||||
html += "<span class='panicitem'>" + FunctionsObject.TimeCalculation(panicData["ButtonPressed"][i], "str") + " (vor " + FunctionsObject.TimeCalculation(panicData["ButtonPressed"][i], "difftext") + ")</span>";
|
||||
}
|
||||
html += "</div>";
|
||||
}
|
||||
}
|
||||
document.getElementById("pannels_info").innerHTML = html;
|
||||
}
|
||||
},
|
||||
_Update_pannels_admin: function () {
|
||||
var testadmin = new XMLHttpRequest();
|
||||
testadmin.onreadystatechange = function () {
|
||||
if (testadmin.readyState === 4 && testadmin.status === 403) {
|
||||
MenuObject._ParseAJAXPannelAdmin(false);
|
||||
} else if (testadmin.readyState === 4 && testadmin.status === 200) {
|
||||
MenuObject._ParseAJAXPannelAdmin(true);
|
||||
}
|
||||
};
|
||||
testadmin.open("GET", "/admin", true);
|
||||
testadmin.send();
|
||||
}
|
||||
}.Start();
|
@ -1,10 +1,10 @@
|
||||
var OverlayObject = {
|
||||
Start: function () {
|
||||
setInterval(this._Runner, 1000);
|
||||
this._Runner();
|
||||
setInterval(this._Runner1000, 1000);
|
||||
this._Runner1000();
|
||||
return this;
|
||||
},
|
||||
_Runner: function () {
|
||||
_Runner1000: function () {
|
||||
var ccount = new XMLHttpRequest();
|
||||
ccount.onreadystatechange = function () {
|
||||
if (ccount.readyState === 4 && ccount.status === 200) {
|
||||
|
Loading…
Reference in New Issue
Block a user