forked from node-red/node-red-nodes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
random.html
55 lines (54 loc) · 2.44 KB
/
random.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<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>
<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>
</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%;">
</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%;">
</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%;">
</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}
},
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']});
}
});
</script>