Replaces static code which generates the timing control data editor by a dynamic block.
This commit is contained in:
parent
967a3071af
commit
a6ac0be517
2 changed files with 63 additions and 31 deletions
|
@ -407,18 +407,12 @@ tr.appendChild(tdHour);
|
|||
var tdMinute = createSelectCell(59, 0, 1);
|
||||
tdMinute.id = "minute" + i;
|
||||
tr.appendChild(tdMinute);
|
||||
var tdCh1 = createSelectCell(100, 0, 1);
|
||||
tdCh1.id = "ch1_" + i;
|
||||
tr.appendChild(tdCh1);
|
||||
var tdCh2 = createSelectCell(100, 0, 1);
|
||||
tdCh2.id = "ch2_" + i;
|
||||
tr.appendChild(tdCh2);
|
||||
var tdCh3 = createSelectCell(100, 0, 1);
|
||||
tdCh3.id = "ch3_" + i;
|
||||
tr.appendChild(tdCh3);
|
||||
var tdCh4 = createSelectCell(100, 0, 1);
|
||||
tdCh4.id = "ch4_" + i;
|
||||
tr.appendChild(tdCh4);
|
||||
for (var j = 1; j <=4; j++)
|
||||
{
|
||||
var tdCh = createSelectCell(100, 0, 1);
|
||||
tdCh.id = "ch" + j + "_" + i;
|
||||
tr.appendChild(tdCh);
|
||||
}
|
||||
table.appendChild(tr);
|
||||
}
|
||||
var container = document.getElementById("table-container");
|
||||
|
@ -426,6 +420,26 @@ container.innerHTML = "";
|
|||
container.classList.add("pure-form");
|
||||
container.appendChild(table);
|
||||
}
|
||||
function createSlider(id, max, value, step) {
|
||||
var input = document.createElement("input");
|
||||
input.type = "range";
|
||||
input.min = 0;
|
||||
input.max = max;
|
||||
input.step = step;
|
||||
input.value = value;
|
||||
input.classList.add("pure-slider-range");
|
||||
var div = document.createElement("div");
|
||||
div.classList.add("pure-control-group");
|
||||
div.appendChild(input);
|
||||
var label = document.createElement("label");
|
||||
label.innerHTML = id;
|
||||
label.classList.add("pure-slider-label");
|
||||
div.insertBefore(label, input);
|
||||
var td = document.createElement("td");
|
||||
td.id = id;
|
||||
td.appendChild(div);
|
||||
return td;
|
||||
}
|
||||
function createSelectCell(max, value, step) {
|
||||
var select = document.createElement("select");
|
||||
for (var i = 0; i <= max; i += step) {
|
||||
|
|
|
@ -483,25 +483,13 @@ function createTable() {
|
|||
tdMinute.id = "minute" + i;
|
||||
tr.appendChild(tdMinute);
|
||||
|
||||
// ch1
|
||||
var tdCh1 = createSelectCell(100, 0, 1);
|
||||
tdCh1.id = "ch1_" + i;
|
||||
tr.appendChild(tdCh1);
|
||||
|
||||
// ch2
|
||||
var tdCh2 = createSelectCell(100, 0, 1);
|
||||
tdCh2.id = "ch2_" + i;
|
||||
tr.appendChild(tdCh2);
|
||||
|
||||
// ch3
|
||||
var tdCh3 = createSelectCell(100, 0, 1);
|
||||
tdCh3.id = "ch3_" + i;
|
||||
tr.appendChild(tdCh3);
|
||||
|
||||
// ch4
|
||||
var tdCh4 = createSelectCell(100, 0, 1);
|
||||
tdCh4.id = "ch4_" + i;
|
||||
tr.appendChild(tdCh4);
|
||||
for (var j = 1; j <=4; j++)
|
||||
{
|
||||
// chj_i
|
||||
var tdCh = createSelectCell(100, 0, 1);
|
||||
tdCh.id = "ch" + j + "_" + i;
|
||||
tr.appendChild(tdCh);
|
||||
}
|
||||
|
||||
table.appendChild(tr);
|
||||
}
|
||||
|
@ -511,7 +499,37 @@ function createTable() {
|
|||
container.classList.add("pure-form");
|
||||
container.appendChild(table);
|
||||
}
|
||||
|
||||
function createSlider(id, max, value, step) {
|
||||
// Create a new input element of type range
|
||||
var input = document.createElement("input");
|
||||
input.type = "range";
|
||||
input.min = 0;
|
||||
input.max = max;
|
||||
input.step = step;
|
||||
input.value = value;
|
||||
input.classList.add("pure-slider-range");
|
||||
|
||||
// Create a new div element to contain the input element
|
||||
var div = document.createElement("div");
|
||||
div.classList.add("pure-control-group");
|
||||
div.appendChild(input);
|
||||
|
||||
// Create a new label element for the slider
|
||||
var label = document.createElement("label");
|
||||
label.innerHTML = id;
|
||||
label.classList.add("pure-slider-label");
|
||||
div.insertBefore(label, input);
|
||||
|
||||
// Create a new td element to contain the div element
|
||||
var td = document.createElement("td");
|
||||
td.id = id;
|
||||
td.appendChild(div);
|
||||
|
||||
// Return the td element
|
||||
return td;
|
||||
}
|
||||
|
||||
function createSelectCell(max, value, step) {
|
||||
// Erstelle ein neues select-Element
|
||||
var select = document.createElement("select");
|
||||
|
|
Loading…
Reference in a new issue