1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

hide unused input field (#2823)

This commit is contained in:
Hiroyasu Nishiyama 2021-01-17 01:58:13 +09:00 committed by GitHub
parent 2b28ae3402
commit d8c8d7bc57
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -235,6 +235,7 @@
oneditprepare: function() { oneditprepare: function() {
var previous = null; var previous = null;
$("#node-input-out").on('focus', function () { previous = this.value; }).on("change", function() { $("#node-input-out").on('focus', function () { previous = this.value; }).on("change", function() {
$("#node-input-splitc").show();
if (previous === null) { previous = $("#node-input-out").val(); } if (previous === null) { previous = $("#node-input-out").val(); }
if ($("#node-input-out").val() == "char") { if ($("#node-input-out").val() == "char") {
if (previous != "char") { $("#node-input-splitc").val("\\n"); } if (previous != "char") { $("#node-input-splitc").val("\\n"); }
@ -247,6 +248,7 @@
else if ($("#node-input-out").val() == "immed") { else if ($("#node-input-out").val() == "immed") {
if (previous != "immed") { $("#node-input-splitc").val(" "); } if (previous != "immed") { $("#node-input-splitc").val(" "); }
$("#node-units").text(""); $("#node-units").text("");
$("#node-input-splitc").hide();
} }
else if ($("#node-input-out").val() == "count") { else if ($("#node-input-out").val() == "count") {
if (previous != "count") { $("#node-input-splitc").val("12"); } if (previous != "count") { $("#node-input-splitc").val("12"); }
@ -255,6 +257,7 @@
else { else {
if (previous != "sit") { $("#node-input-splitc").val(" "); } if (previous != "sit") { $("#node-input-splitc").val(" "); }
$("#node-units").text(""); $("#node-units").text("");
$("#node-input-splitc").hide();
} }
}); });
} }