@ -75,16 +75,13 @@
< div class = "s_content" >
< div class = "s_content" >
< fieldset >
< fieldset >
< legend class = "des" > Sunrise & Sunset< / legend >
< legend class = "des" > Sunrise & Sunset< / legend >
< input id = "clickMe" type = "button" value = "Get Location from Browser" onclick = "getLocation();" / > Info: work only in SSL.
< label for = "sunLat" > Latitude (decimal)< / label >
< p id = "demo" > < / p >
< input type = "text" class = "text" name = "sunLat" / >
< label for = "sunLon" > Longitude (decimal)< / label >
< input type = "text" class = "text" name = "sunLon" / >
< br >
< br >
< label for = "lat" > Latitude< / label >
< label for = "sunDisNightCom" > disable night communication< / label >
< input type = "text" class = "text" name = "lat" / >
< input type = "checkbox" class = "cb" name = "sunDisNightCom" / > < br / >
< label for = "lon" > Longitude< / label >
< input type = "text" class = "text" name = "lon" / >
< br >
< label for = "disnightcom" > disable night communication< / label >
< input type = "checkbox" class = "cb" name = "disnightcom" / > < br / >
< / fieldset >
< / fieldset >
< / div >
< / div >
@ -159,10 +156,9 @@
function setTime() {
function setTime() {
var date = new Date();
var date = new Date();
var offset = date.getTimezoneOffset() * -60;
var obj = new Object();
var obj = new Object();
obj.cmd = "set_time";
obj.cmd = "set_time";
obj.ts = parseInt(offset + ( date.getTime() / 1000) );
obj.ts = parseInt(date.getTime() / 1000);
getAjax("/api/setup", apiCb, "POST", JSON.stringify(obj));
getAjax("/api/setup", apiCb, "POST", JSON.stringify(obj));
}
}
@ -207,7 +203,7 @@
}
}
});
});
for(var i of [["Name", "name", "Name*", 32]]) { // so richtig?
for(var i of [["Name", "name", "Name*", 32]]) {
iv.appendChild(lbl(id + i[0], i[2]));
iv.appendChild(lbl(id + i[0], i[2]));
iv.appendChild(inp(id + i[0], obj[i[1]], i[3]));
iv.appendChild(inp(id + i[0], obj[i[1]], i[3]));
}
}
@ -254,10 +250,10 @@
document.getElementsByName(i[0])[0].value = obj[i[1]];
document.getElementsByName(i[0])[0].value = obj[i[1]];
}
}
function parseLatLong (obj) {
function parseSun (obj) {
for(var i of [["lat", "Latitude"], ["lon", "Longitude"]])
document.getElementsByName("sunDisNightCom")[0].checked = obj["disnightcom"] ? true : false;
document.getElementsByName(i[0])[0].value = obj[i[1]] ;
document.getElementsByName("sunLat")[0].value = parseFloat(obj["lat"]) ;
document.getElementById("disnightcom").innerHTML = obj["obj"]
document.getElementsByName("sunLon")[0].value = parseFloat(obj["lon"]);
}
}
function parsePinout(obj) {
function parsePinout(obj) {
@ -310,7 +306,7 @@
parseIv(root["inverter"]);
parseIv(root["inverter"]);
parseMqtt(root["mqtt"]);
parseMqtt(root["mqtt"]);
parseNtp(root["ntp"]);
parseNtp(root["ntp"]);
parseLatLong(root["LatiLong "]);
parseSun(root["sun "]);
parsePinout(root["pinout"]);
parsePinout(root["pinout"]);
parseRadio(root["radio"]);
parseRadio(root["radio"]);
parseSerial(root["serial"]);
parseSerial(root["serial"]);