1
0
mirror of https://github.com/s00500/ESPUI.git synced 2025-07-04 16:30:17 +00:00

Merge branch 'master' of https://github.com/s00500/ESPUI into s00500-master

This commit is contained in:
Ian Gray
2022-05-29 10:13:37 +01:00
14 changed files with 76 additions and 15 deletions

8
data/js/controls.js vendored
View File

@ -212,7 +212,7 @@ function start() {
window.location.port != 443
) {
websock = new WebSocket(
"ws://" + window.location.hostname + ":" + window.location.port + "/ws"
"ws://" + window.location.hostname + ":" + window.location.port + "/ws"
);
} else {
websock = new WebSocket("ws://" + window.location.hostname + "/ws");
@ -532,6 +532,9 @@ function start() {
if(data.hasOwnProperty('elementStyle')) {
$("#text" + data.id).attr("style", data.elementStyle);
}
if(data.hasOwnProperty('inputType')) {
$("#text" + data.id).attr("type", data.inputType);
}
break;
case UPDATE_SELECT:
@ -769,6 +772,7 @@ var addToHTML = function(data) {
var elementHTML = function(data) {
var id = data.id
var elementStyle = data.hasOwnProperty('elementStyle') ? " style='" + data.elementStyle + "' " : "";
var inputType = data.hasOwnProperty('inputType') ? " type='" + data.inputType + "' " : "";
switch(data.type) {
case UI_LABEL:
return "<span id='l" + id + "' " + elementStyle +
@ -814,7 +818,7 @@ var elementHTML = function(data) {
return "<input style='color:black;' " + elementStyle + " id='num" + id +
"' type='number' value='" + data.value + "' onchange='numberchange(" + id + ")' />";
case UI_TEXT_INPUT:
return "<input style='color:black;' " + elementStyle + " id='text" + id +
return "<input " + inputType + "style='color:black;' " + elementStyle + " id='text" + id +
"' value='" + data.value + "' onchange='textchange(" + id + ")' />";
case UI_SELECT:
return "<select style='color:black;' " + elementStyle + " id='select" + id +