New editor test
This commit is contained in:
parent
73125f70ce
commit
215ffd7fc6
64
test.php
64
test.php
@ -33,11 +33,65 @@
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
|
||||
<script type="text/javascript">
|
||||
function foo(element){
|
||||
var id = element.attr("name").match(/\d+/)[0]
|
||||
$("[name='variable["+id+"][value]']").remove();
|
||||
$("[name='variable["+id+"][equaler]']").remove();
|
||||
|
||||
if (element.val() == "atDeviceValue") {
|
||||
var input = $("<input name=''/>");
|
||||
var arrVarOperator = [
|
||||
{val : '>', text: '>'},
|
||||
{val : '<', text: '<'},
|
||||
];
|
||||
|
||||
var varOperator = $('<select name="variable['+id+'][equaler]">');
|
||||
$(arrVarOperator).each(function() {
|
||||
varOperator.append($('<option>').attr('value',this.val).text(this.text));
|
||||
});
|
||||
element.parent().append(varOperator);
|
||||
|
||||
|
||||
var input = $("<input/>");
|
||||
input.attr("type","text");
|
||||
input.attr("name",element.attr("name"));
|
||||
input.attr("name","variable["+id+"][value]");
|
||||
element.parent().append(input);
|
||||
} else if (element.val() == "time") {
|
||||
var arrVarOperator = [
|
||||
{val : '>', text: '>'},
|
||||
{val : '<', text: '<'},
|
||||
];
|
||||
|
||||
var varOperator = $('<select name="variable['+id+'][equaler]">');
|
||||
$(arrVarOperator).each(function() {
|
||||
varOperator.append($('<option>').attr('value',this.val).text(this.text));
|
||||
});
|
||||
element.parent().append(varOperator);
|
||||
|
||||
var input = $("<input/>");
|
||||
input.attr("type","time");
|
||||
input.attr("name","variable["+id+"][value]");
|
||||
element.parent().append(input);
|
||||
}else {
|
||||
var arrVarOperator = [
|
||||
{val : '=', text: '=='},
|
||||
{val : '!=', text: '!='},
|
||||
];
|
||||
|
||||
var varOperator = $('<select name="variable['+id+'][equaler]">');
|
||||
$(arrVarOperator).each(function() {
|
||||
varOperator.append($('<option>').attr('value',this.val).text(this.text));
|
||||
});
|
||||
element.parent().append(varOperator);
|
||||
|
||||
var arrVarValue = [
|
||||
{val : 'true', text: 'True'},
|
||||
{val : 'false', text: 'False'},
|
||||
];
|
||||
|
||||
var varValue = $('<select name="variable['+id+'][value]">');
|
||||
$(arrVarValue).each(function() {
|
||||
varValue.append($('<option>').attr('value',this.val).text(this.text));
|
||||
});
|
||||
element.parent().append(varValue);
|
||||
}
|
||||
}
|
||||
$("#addButton,#restartAddButton").click( function (event) {
|
||||
@ -55,7 +109,7 @@ $("#addButton,#restartAddButton").click( function (event) {
|
||||
{val : 'someOneHome', text: 'Nekdo Doma'},
|
||||
];
|
||||
|
||||
var varSelect = $('<select name="variable['+numItems+'][]">');
|
||||
var varSelect = $('<select name="variable['+numItems+'][what]">');
|
||||
$(arrVarSelect).each(function() {
|
||||
varSelect.append($('<option>').attr('value',this.val).text(this.text));
|
||||
});
|
||||
@ -75,7 +129,7 @@ $("#addButton,#restartAddButton").click( function (event) {
|
||||
{val : '!=', text: '!='},
|
||||
];
|
||||
|
||||
var varOperator = $('<select name="variable['+numItems+'][]">');
|
||||
var varOperator = $('<select name="variable['+numItems+'][equaler]">');
|
||||
$(arrVarOperator).each(function() {
|
||||
varOperator.append($('<option>').attr('value',this.val).text(this.text));
|
||||
});
|
||||
@ -85,7 +139,7 @@ $("#addButton,#restartAddButton").click( function (event) {
|
||||
{val : 'false', text: 'False'},
|
||||
];
|
||||
|
||||
var varValue = $('<select name="variable['+numItems+'][]">');
|
||||
var varValue = $('<select name="variable['+numItems+'][value]">');
|
||||
$(arrVarValue).each(function() {
|
||||
varValue.append($('<option>').attr('value',this.val).text(this.text));
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user