1
0
mirror of https://github.com/node-red/node-red-nodes.git synced 2023-10-10 13:36:58 +02:00
node-red-nodes/function/random/random.html

56 lines
2.4 KiB
HTML
Raw Permalink Normal View History

<script type="text/html" data-template-name="random">
<div class="form-row">
<label for="node-input-property"><i class="fa fa-ellipsis-h"></i> <span data-i18n="node-red:common.label.property"></span></label>
<input type="text" id="node-input-property" style="width:70%;"/>
</div>
2014-10-27 21:26:49 +01:00
<div class="form-row">
<label for="node-input-inte"><i class="fa fa-random"></i> <span data-i18n="random.label.generate"></label>
<select type="text" id="node-input-inte" style="width:70%;">
<option value="true" data-i18n="random.label.wholeNumber"></option>
<option value="false" data-i18n="random.label.realNumber"></option>
2014-10-27 21:26:49 +01:00
</select>
</div>
<div class="form-row">
<label for="node-input-low"><i class="fa fa-arrow-down"></i> <span data-i18n="random.label.from"></label>
<input type="text" id="node-input-low" data-i18n="[placeholder]random.label.lowestNumber" style="width:70%;">
2014-10-27 21:26:49 +01:00
</div>
<div class="form-row">
<label for="node-input-high"><i class="fa fa-arrow-up"></i> <span data-i18n="random.label.to"></label>
<input type="text" id="node-input-high" data-i18n="[placeholder]random.label.highestNumber" style="width:70%;">
2014-10-27 21:26:49 +01:00
</div>
<br/>
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> <span data-i18n="node-red:common.label.name"></label>
<input type="text" id="node-input-name" data-i18n="[placeholder]node-red:common.label.name" style="width:70%;">
2014-10-27 21:26:49 +01:00
</div>
</script>
<script type="text/javascript">
RED.nodes.registerType('random',{
category: 'function',
color:"#E2D96E",
defaults: {
name: {value:""},
low: {value: 1,validate:function(v) { return !isNaN(v) || v.length === 0;} },
high: {value: 10,validate:function(v) { return !isNaN(v) || v.length === 0;} },
inte: {value:"true"},
property: {value:"payload",required:true}
2014-10-27 21:26:49 +01:00
},
inputs:1,
outputs:1,
icon: "debug.png",
label: function() {
return this.name||"random";
},
labelStyle: function() {
return this.name?"node_label_italic":"";
},
oneditprepare: function() {
if (this.property === undefined) {
$("#node-input-property").val("payload");
}
$("#node-input-property").typedInput({default:'msg',types:['msg']});
2014-10-27 21:26:49 +01:00
}
});
</script>