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

Fix invalid html in TCP and HTML node edit templates

This commit is contained in:
Nick O'Leary 2016-07-26 16:19:27 +01:00
parent 45f8def1ed
commit 0136ebd2b4
2 changed files with 24 additions and 23 deletions

View File

@ -1,5 +1,5 @@
<!-- <!--
Copyright 2013 IBM Corp. Copyright 2013, 2016 IBM Corp.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -225,27 +225,6 @@
<label for="node-input-name"><i class="fa fa-tag"></i> <span data-i18n="common.label.name"></span></label> <label for="node-input-name"><i class="fa fa-tag"></i> <span data-i18n="common.label.name"></span></label>
<input type="text" id="node-input-name" data-i18n="[placeholder]common.label.name"> <input type="text" id="node-input-name" data-i18n="[placeholder]common.label.name">
</div> </div>
<script>
var previous = null;
$("#node-input-out").on('focus', function () { previous = this.value; }).change(function() {
if (previous == null) { previous = $("#node-input-out").val(); }
if ($("#node-input-out").val() == "char") {
if (previous != "char") $("#node-input-splitc").val("\\n");
$("#node-units").text("");
}
else if ($("#node-input-out").val() == "time") {
if (previous != "time") $("#node-input-splitc").val("0");
$("#node-units").text("ms");
}
else if ($("#node-input-out").val() == "count") {
if (previous != "count") $("#node-input-splitc").val("12");
$("#node-units").text("chars");
}
else {
if (previous != "sit") $("#node-input-splitc").val("0");
$("#node-units").text("");
}
});
</script> </script>
<script type="text/x-red" data-help-name="tcp request"> <script type="text/x-red" data-help-name="tcp request">
@ -276,6 +255,28 @@
}, },
labelStyle: function() { labelStyle: function() {
return this.name?"node_label_italic":""; return this.name?"node_label_italic":"";
},
oneditprepare: function() {
var previous = null;
$("#node-input-out").on('focus', function () { previous = this.value; }).change(function() {
if (previous == null) { previous = $("#node-input-out").val(); }
if ($("#node-input-out").val() == "char") {
if (previous != "char") $("#node-input-splitc").val("\\n");
$("#node-units").text("");
}
else if ($("#node-input-out").val() == "time") {
if (previous != "time") $("#node-input-splitc").val("0");
$("#node-units").text("ms");
}
else if ($("#node-input-out").val() == "count") {
if (previous != "count") $("#node-input-splitc").val("12");
$("#node-units").text("chars");
}
else {
if (previous != "sit") $("#node-input-splitc").val("0");
$("#node-units").text("");
}
});
} }
}); });
</script> </script>

View File

@ -46,7 +46,7 @@
<script type="text/x-red" data-help-name="html"> <script type="text/x-red" data-help-name="html">
<p>Extracts elements from an html document held in <code>msg.payload</code> using a selector.</p> <p>Extracts elements from an html document held in <code>msg.payload</code> using a selector.</p>
<p>If left blank the selector may be set dynamically by passing in <code>msg.select</code> along with the <code>msg.payload</code>. <p>If left blank the selector may be set dynamically by passing in <code>msg.select</code> along with the <code>msg.payload</code>.
<p>The selector uses <a href=="https://github.com/cheeriojs/cheerio/blob/master/Readme.md" target="_new">Cheerio</a> <p>The selector uses <a href="https://github.com/cheeriojs/cheerio/blob/master/Readme.md" target="_new">Cheerio</a>
which uses the <a href="https://github.com/fb55/CSSselect#user-content-supported-selectors" target="_new">CSS selector</a> syntax.</p> which uses the <a href="https://github.com/fb55/CSSselect#user-content-supported-selectors" target="_new">CSS selector</a> syntax.</p>
<p>The result can be either a single message with a payload containing an array of the matched elements, or multiple <p>The result can be either a single message with a payload containing an array of the matched elements, or multiple
messages that each contain a matched element.</p> messages that each contain a matched element.</p>