-
Notifications
You must be signed in to change notification settings - Fork 2
/
barcode-scanner.html
54 lines (51 loc) · 2.52 KB
/
barcode-scanner.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
<!--
Copyright 2016 Steampunk Professor
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<script type="text/x-red" data-template-name="barcode-scanner">
<div class="form-row">
<label for="node-input-topic"><i class="fa fa-tasks"></i> Topic</label>
<input type="text" id="node-input-topic" placeholder="Topic">
</div>
<br/>
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name">
</div>
</script>
<!-- Next, some simple help text is provided for the node. -->
<script type="text/x-red" data-help-name="barcode-scanner">
<p>Simple barcode scanner input node. Sends a single message when it scans a barcode.</p>
<p>Outputs an object called <code>msg</code> containing <code>msg.topic</code> and
<code>msg.payload</code>. msg.payload is a String of characters corresponding to the barcode.</p>
</script>
<!-- Finally, the node type is registered along with all of its properties -->
<!-- The example below shows a small subset of the properties that can be set-->
<script type="text/javascript">
RED.nodes.registerType('barcode-scanner',{
category: 'input', // the palette category
defaults: { // defines the editable properties of the node
name: {value:"Barcode Scanner"}, // along with default values.
topic: {value:"barcode-scanner", required:true}
},
color: '#C0DEED',
inputs:0, // set the number of inputs - only 0 or 1
outputs:1, // set the number of outputs - 0 to n
// set the icon (held in icons dir below where you save the node)
icon: "icons/barcode.png", // saved in icons/myicon.png
label: function() { // sets the default label contents
return this.name||this.topic||"barcode-scanner";
},
labelStyle: function() { // sets the class to apply to the label
return this.name?"node_label_italic":"";
}
});
</script>