|
|
|
@ -1,4 +1,4 @@
|
|
|
|
|
var writePermission = true;
|
|
|
|
|
var writePermission = false;
|
|
|
|
|
var showParams = false;
|
|
|
|
|
var showConsole = false;
|
|
|
|
|
var prompt = false // True while a prompt is opened.
|
|
|
|
@ -505,369 +505,3 @@ function appendToGridElement(s, title, type, content) {
|
|
|
|
|
gridelements[s].innerHTML = "";
|
|
|
|
|
gridelements[s].appendChild(gridContainer);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
|
// %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
|
// %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
|
/* ---------------------------------------------------------------------------------- */
|
|
|
|
|
// obsolete...
|
|
|
|
|
|
|
|
|
|
// function createPushbutton_row(component) {
|
|
|
|
|
// // Creates row-element containing a push button
|
|
|
|
|
// var name = component.name;
|
|
|
|
|
// var command = component.command;
|
|
|
|
|
// var left = createTitle(component);
|
|
|
|
|
|
|
|
|
|
// left.id = component.name;
|
|
|
|
|
// left.name = component.title;
|
|
|
|
|
|
|
|
|
|
// var right = createInputElement(component);
|
|
|
|
|
// right.classList.add("push-button");
|
|
|
|
|
|
|
|
|
|
// row = appendToContent(left, right);
|
|
|
|
|
// right.onclick = function () {
|
|
|
|
|
// if (writePermission) {
|
|
|
|
|
// var row = left.parentNode;
|
|
|
|
|
// right.style.backgroundColor = "orangered";
|
|
|
|
|
// // Request for command
|
|
|
|
|
// sendCommand(s, command);
|
|
|
|
|
// } else {
|
|
|
|
|
// prompt = true;
|
|
|
|
|
// alertify.confirm("", "You are connected with <b>" + clientTitle
|
|
|
|
|
// + "</b>. <br>"
|
|
|
|
|
// + "Are you sure you want to modify things here?",
|
|
|
|
|
// function () {
|
|
|
|
|
// // User decided to proceed.
|
|
|
|
|
// writePermission = true;
|
|
|
|
|
// writePermissionTimeout = setTimeout(function () {
|
|
|
|
|
// writePermission = false;
|
|
|
|
|
// }, 3600000);
|
|
|
|
|
// var row = left.parentNode;
|
|
|
|
|
// row.style.backgroundColor = "orangered";
|
|
|
|
|
// // Request for command
|
|
|
|
|
// sendCommand(s, command);
|
|
|
|
|
// prompt = false;
|
|
|
|
|
// }, function () {
|
|
|
|
|
// // User decided to cancel
|
|
|
|
|
// prompt = false;
|
|
|
|
|
// });
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// row.classList.add("row");
|
|
|
|
|
// return row;
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// function create_input_row(component) {
|
|
|
|
|
// // Creates row-element containing input-item.
|
|
|
|
|
// var name = component.name;
|
|
|
|
|
// var command = component.command;
|
|
|
|
|
// var left = createTitle(component);
|
|
|
|
|
|
|
|
|
|
// var input = createInputElement(component, 'input', 'input-text');
|
|
|
|
|
// input.type = "text";
|
|
|
|
|
// input.style.width = "100px";
|
|
|
|
|
// input.addEventListener("focus", function(evt) {
|
|
|
|
|
// let elm = evt.target;
|
|
|
|
|
// setTimeout(function(){elm.setSelectionRange(0, elm.value.length);},0);
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
|
|
// input.onkeydown = function (e) {
|
|
|
|
|
// if (e.which === 27 || e.key == "Escape") {
|
|
|
|
|
// // User decided to cancel
|
|
|
|
|
// input.value = intput.oldValue;
|
|
|
|
|
// resizeTextfield(input);
|
|
|
|
|
// var row = left.parentNode;
|
|
|
|
|
// row.style.backgroundColor = "white";
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// input.onfocus = function () {
|
|
|
|
|
// input.oldValue = input.value;
|
|
|
|
|
|
|
|
|
|
// if (isTouchDevice)
|
|
|
|
|
// setTimeout(function () {
|
|
|
|
|
// posTextfield(s, left);
|
|
|
|
|
// }, 1);
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// input.onblur = function () {
|
|
|
|
|
// if (prompt) {
|
|
|
|
|
// return false;
|
|
|
|
|
// }
|
|
|
|
|
// var row = left.parentNode;
|
|
|
|
|
// var value = input.value;
|
|
|
|
|
// let oldValue = 'oldValue' in input ? input.oldValue : value;
|
|
|
|
|
// if (!('actualValue' in input)) input.actualValue = oldValue;
|
|
|
|
|
// actualValue = input.actualValue;
|
|
|
|
|
// if (value == actualValue || value == oldValue ||
|
|
|
|
|
// parseFloat(value) == parseFloat(actualValue) || parseFloat(value) == parseFloat(oldValue)) {
|
|
|
|
|
// input.value = actualValue;
|
|
|
|
|
// // nothing to do.
|
|
|
|
|
// row.style.backgroundColor = "white";
|
|
|
|
|
// return false;
|
|
|
|
|
// }
|
|
|
|
|
// // User changed value and moved focus to other object.
|
|
|
|
|
// alertify.confirm("", "You changed a field without pressing the return key.<br>"
|
|
|
|
|
// + "Hint: press ESC for leaving a field unchanged.<b>"
|
|
|
|
|
// + "You are connected with <b>" + clientTitle + "</b>.<br>"
|
|
|
|
|
// + "Are you sure you want to change the value of<br><b>"
|
|
|
|
|
// + name + "</b> from <b>" + actualValue
|
|
|
|
|
// + "</b> to <b>" + value + "</b>?", function () {
|
|
|
|
|
// // User decided to proceed.
|
|
|
|
|
// writePermission = true;
|
|
|
|
|
// writePermissionTimeout = setTimeout(function () {
|
|
|
|
|
// writePermission = false;
|
|
|
|
|
// }, 3600000);
|
|
|
|
|
// row.style.backgroundColor = "orangered";
|
|
|
|
|
// // Request for command
|
|
|
|
|
// sendCommand(s, command + " " + value);
|
|
|
|
|
// resizeTextfield(input);
|
|
|
|
|
// prompt = false;
|
|
|
|
|
// }, function () {
|
|
|
|
|
// // User decided to cancel
|
|
|
|
|
// input.value = input.actualValue;
|
|
|
|
|
// resizeTextfield(input);
|
|
|
|
|
// row.style.backgroundColor = "white";
|
|
|
|
|
// prompt = false;
|
|
|
|
|
// });
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// var form = document.createElement('form');
|
|
|
|
|
// form.onsubmit = function (e) {
|
|
|
|
|
// e.preventDefault();
|
|
|
|
|
// if (writePermission) {
|
|
|
|
|
// var row = left.parentNode;
|
|
|
|
|
// row.style.backgroundColor = "orangered";
|
|
|
|
|
// // Request for command
|
|
|
|
|
// input.actualValue = input.value;
|
|
|
|
|
// sendCommand(s, name + " " + input.value);
|
|
|
|
|
// input.blur();
|
|
|
|
|
// } else {
|
|
|
|
|
// var value = input.value
|
|
|
|
|
// prompt = true;
|
|
|
|
|
// alertify.confirm("", "You are connected with <b>" + clientTitle
|
|
|
|
|
// + "</b>. <br>"
|
|
|
|
|
// + "Are you sure you want to modify things here?",
|
|
|
|
|
// function () {
|
|
|
|
|
// // User decided to proceed.
|
|
|
|
|
// writePermission = true;
|
|
|
|
|
// writePermissionTimeout = setTimeout(function () {
|
|
|
|
|
// writePermission = false;
|
|
|
|
|
// }, 3600000);
|
|
|
|
|
// var row = left.parentNode;
|
|
|
|
|
// row.style.backgroundColor = "orangered";
|
|
|
|
|
// input.actualValue = value;
|
|
|
|
|
// // Request for command
|
|
|
|
|
// sendCommand(s, command + " " + value);
|
|
|
|
|
// resizeTextfield(input);
|
|
|
|
|
// prompt = false;
|
|
|
|
|
// }, function () {
|
|
|
|
|
// // User decided to cancel
|
|
|
|
|
// input.value = input.oldValue;
|
|
|
|
|
// resizeTextfield(input);
|
|
|
|
|
// prompt = false;
|
|
|
|
|
// });
|
|
|
|
|
// }
|
|
|
|
|
// };
|
|
|
|
|
// form.appendChild(input);
|
|
|
|
|
// var right = createInputElement(component);
|
|
|
|
|
// right.appendChild(form);
|
|
|
|
|
// return appendToContent(left, right);
|
|
|
|
|
|
|
|
|
|
// function posTextfield(s, left) {
|
|
|
|
|
// if (debug_group_daniel) {
|
|
|
|
|
// console.log("%cfunction: posTextfield", "color:white;background:salmon");
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// // var content = swiper[s].slides[swiper[s].activeIndex].childNodes[1];
|
|
|
|
|
// // var row = left.parentNode;
|
|
|
|
|
// // content.scrollTop = row.offsetTop - 30;
|
|
|
|
|
|
|
|
|
|
// // ---------------------> Not working anymore since swiper was removed!!!
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// function createCheckbox_row(component) {
|
|
|
|
|
// // Creates row-element containing checkbox-item
|
|
|
|
|
// var command = component.command;
|
|
|
|
|
// var left = createTitle(component);
|
|
|
|
|
// var input = createInputElement(component, 'input', 'parameter-checkbox');
|
|
|
|
|
// input.type = "checkbox";
|
|
|
|
|
// input.onkeyup = function (e) {
|
|
|
|
|
// if (e.keyCode === 32) {
|
|
|
|
|
// handleCheckbox();
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// var label = document.createElement('label');
|
|
|
|
|
// label.for = input;
|
|
|
|
|
// label.classList.add("parameter-label");
|
|
|
|
|
|
|
|
|
|
// label.onclick = function () {
|
|
|
|
|
// handleCheckbox();
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// function handleCheckbox() {
|
|
|
|
|
// if (writePermission) {
|
|
|
|
|
// var row = left.parentNode;
|
|
|
|
|
// row.style.backgroundColor = "orangered";
|
|
|
|
|
// if (input.checked) {
|
|
|
|
|
// var value = "0";
|
|
|
|
|
// input.checked = false;
|
|
|
|
|
// } else {
|
|
|
|
|
// var value = "1";
|
|
|
|
|
// input.checked = true;
|
|
|
|
|
// }
|
|
|
|
|
// // Request for command
|
|
|
|
|
// sendCommand(s, command + " " + value);
|
|
|
|
|
// } else {
|
|
|
|
|
// alertify.confirm("", "You are connected with <b>" + clientTitle
|
|
|
|
|
// + "</b>. <br>"
|
|
|
|
|
// + "Are you sure you want to modify things here?",
|
|
|
|
|
// function () {
|
|
|
|
|
// // User decided to proceed.
|
|
|
|
|
// writePermission = true;
|
|
|
|
|
// writePermissionTimeout = setTimeout(function () {
|
|
|
|
|
// writePermission = false;
|
|
|
|
|
// }, 3600000);
|
|
|
|
|
// var row = left.parentNode;
|
|
|
|
|
// row.style.backgroundColor = "orangered";
|
|
|
|
|
// if (input.checked) {
|
|
|
|
|
// var value = "0";
|
|
|
|
|
// input.checked = false;
|
|
|
|
|
// } else {
|
|
|
|
|
// var value = "1";
|
|
|
|
|
// input.checked = true;
|
|
|
|
|
// }
|
|
|
|
|
// // Request for command
|
|
|
|
|
// sendCommand(s, command + " " + value);
|
|
|
|
|
// }, function () {
|
|
|
|
|
// // User decided to cancel
|
|
|
|
|
// });
|
|
|
|
|
// }
|
|
|
|
|
// };
|
|
|
|
|
|
|
|
|
|
// var right = document.createElement('span');
|
|
|
|
|
// right.classList.add("col-right");
|
|
|
|
|
// right.appendChild(input);
|
|
|
|
|
// right.appendChild(label);
|
|
|
|
|
// return appendToContent(left, right);
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// function createEnum_row(component) {
|
|
|
|
|
// // Creates row-element containing dropdown-selection.
|
|
|
|
|
// var name = component.name;
|
|
|
|
|
// var command = component.command;
|
|
|
|
|
// var buttons = component.enum_names;
|
|
|
|
|
// var left = createTitle(component);
|
|
|
|
|
// var select = createInputElement(component, 'select', 'select-params');
|
|
|
|
|
// select.onfocus = function () {
|
|
|
|
|
// select.oldIndex = select.selectedIndex;
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// select.oninput = function () {
|
|
|
|
|
// if (writePermission && component.title != "device config") {
|
|
|
|
|
// var row = left.parentNode;
|
|
|
|
|
// row.style.backgroundColor = "orangered";
|
|
|
|
|
// // Request for command
|
|
|
|
|
// sendCommand(s, command + " " + this.value);
|
|
|
|
|
// } else {
|
|
|
|
|
// alertify.confirm("", "You are connected with <b>" + clientTitle
|
|
|
|
|
// + "</b>. <br>"
|
|
|
|
|
// + "Are you sure you want to modify things here?",
|
|
|
|
|
// function () {
|
|
|
|
|
// // User decided to proceed.
|
|
|
|
|
// writePermission = true;
|
|
|
|
|
// writePermissionTimeout = setTimeout(function () {
|
|
|
|
|
// writePermission = false;
|
|
|
|
|
// }, 3600000);
|
|
|
|
|
// var row = left.parentNode;
|
|
|
|
|
// row.style.backgroundColor = "orangered";
|
|
|
|
|
// // Request for command
|
|
|
|
|
// sendCommand(s, command + " " + select.value);
|
|
|
|
|
// }, function () {
|
|
|
|
|
// // User decided to cancel
|
|
|
|
|
// select.value = select.options[select.oldIndex].value
|
|
|
|
|
// });
|
|
|
|
|
// }
|
|
|
|
|
// };
|
|
|
|
|
|
|
|
|
|
// for (var i = 0; i < buttons.length; i++) {
|
|
|
|
|
// var option = document.createElement('option');
|
|
|
|
|
// option.type = "enum";
|
|
|
|
|
// option.classList.add("option-params");
|
|
|
|
|
// option.value = buttons[i].value;
|
|
|
|
|
// option.appendChild(document.createTextNode(buttons[i].title));
|
|
|
|
|
// select.add(option);
|
|
|
|
|
// }
|
|
|
|
|
// select.style.display = "none";
|
|
|
|
|
|
|
|
|
|
// var right = document.createElement('span');
|
|
|
|
|
// right.classList.add("col-right");
|
|
|
|
|
// right.appendChild(select);
|
|
|
|
|
// return appendToContent(left, right);
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// ...obsolete
|
|
|
|
|
/* ---------------------------------------------------------------------------------- */
|
|
|
|
|
// The following two functions seem unreachable
|
|
|
|
|
|
|
|
|
|
/* ########## Is this function used? How? Where? ########## */
|
|
|
|
|
// function create_group_row(component) {
|
|
|
|
|
// // Creates row-element containing link.
|
|
|
|
|
// var title = component.title;
|
|
|
|
|
// var row = document.createElement('row');
|
|
|
|
|
// row.id = component.name;
|
|
|
|
|
// row.name = title;
|
|
|
|
|
// row.classList.add("row");
|
|
|
|
|
// row.tabIndex = "0";
|
|
|
|
|
|
|
|
|
|
// console.log('createGroupRow');
|
|
|
|
|
|
|
|
|
|
// row.onclick = function () {
|
|
|
|
|
// var slideNames = getSlideNames();
|
|
|
|
|
// slideNames[0] = component.name;
|
|
|
|
|
// document.title = "SEA "+ clientTitle + " " + slideNames.join(" ");
|
|
|
|
|
// history.pushState({func: "gotoGroups", funarg: slideNames.join("%20")}, document.title, "#" + slideNames.join("%20"));
|
|
|
|
|
// getGroup(s, component.name);
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// if (title === "console" || title === "device config") {
|
|
|
|
|
// row.classList.add("row");
|
|
|
|
|
// row.innerHTML = "console";
|
|
|
|
|
// }
|
|
|
|
|
// row.innerHTML = title;
|
|
|
|
|
// return row;
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
/* ########## Is this function used? How? Where? ########## */
|
|
|
|
|
// function create_rdonly_row(component) {
|
|
|
|
|
// // Creates row-element containing link AND read-only-item.
|
|
|
|
|
// var link = component.link;
|
|
|
|
|
// if (!link) // simple rdonly
|
|
|
|
|
// return appendToContent(createTitle(component),
|
|
|
|
|
// createInputElement(component));
|
|
|
|
|
|
|
|
|
|
// // with link
|
|
|
|
|
// var left = document.createElement('a');
|
|
|
|
|
// left.innerHTML = component.title;
|
|
|
|
|
|
|
|
|
|
// console.log('ccc')
|
|
|
|
|
|
|
|
|
|
// left.id = component.name;
|
|
|
|
|
|
|
|
|
|
// row = appendToContent(left, createInputElement(component));
|
|
|
|
|
// row.onclick = function () {
|
|
|
|
|
// this.style.backgroundColor = "orangered";
|
|
|
|
|
// left.click();
|
|
|
|
|
// }
|
|
|
|
|
// if (link.charAt(0) == ':') {
|
|
|
|
|
// left.href = "http://" + location.hostname + link + "/";
|
|
|
|
|
// } else {
|
|
|
|
|
// left.href = link;
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// row.classList.add("row");
|
|
|
|
|
// return row;
|
|
|
|
|
// }
|
|
|
|
|