-
Notifications
You must be signed in to change notification settings - Fork 17
/
xzingDecode.html
139 lines (135 loc) · 7.55 KB
/
xzingDecode.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
<script type="text/javascript">
(function () {
RED.nodes.registerType('Barcode Decoder', {
category: 'image tools',
paletteLabel: "Barcode Decoder",
//labelStyle: "node-label-white",
icon: "font-awesome/fa-barcode",
color: '#FFAAAA',//'#f24b69',
defaults: {
name: { value: "" },
data: { value: "payload", validate: RED.validators.typedInput("dataType") },
dataType: { value: "msg" },
tryharder: { value: false, validate: RED.validators.typedInput("tryharderType") },
tryharderType: { value: "bool" },
QR_CODE: { value: true },
DATA_MATRIX: { value: false },
PDF_417: { value: false },
EAN_8: { value: false },
EAN_13: { value: false },
CODE_39: { value: false },
CODE_128: { value: false },
ITF: { value: false },
RSS_14: { value: false },
},
inputs: 1,
outputs: 1,
label: function () {
return this.name || "Barcode Decoder";
},
oneditprepare: function () {
let node = this;
function setupTypedInput(varName, types, def) {
let varSel = '#node-input-' + varName;
let typeSel = varSel + 'Type';
let varVal = node[varName];
let typeVal = node[varName + 'Type'];
if (typeVal == null || typeVal === 'none') {
typeVal = def;
} else if (typeVal === 'string') {
typeVal = "str";
} else if (typeVal === 'number') {
typeVal = "num";
}
$(typeSel).val(typeVal);
$(varSel).typedInput({
default: def,
typeField: $(typeSel),
types: types
});
$(varSel).typedInput('type', typeVal);
}
setupTypedInput('data', ['msg', 'flow', 'global', 'bin', 'str'], 'str');
setupTypedInput('tryharder', ['bool', 'msg', 'flow', 'global'], 'bool');
},
oneditsave() {
}
});
})();
</script>
<script type="text/html" data-template-name="Barcode Decoder">
<link rel="stylesheet" href="image-tools/static/css/common.css" type="text/css"/>
<div class="form-row">
<label for="node-input-name"><i class="icon-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name">
</div>
<div class="form-row">
<label for="node-input-data"><i class="fa fa-file-image-o"></i><span data-i18n="xzingDecode.label.data"> image</span></label>
<input type="hidden" id="node-input-dataType">
<input style="width: 70%" type="text" id="node-input-data" placeholder="image.jpg">
</div>
<div class="form-row">
<label for="node-input-format"><i class="fa fa-barcode"></i><span data-i18n="xzingDecode.label.format"> format</span></label>
<div class="image-tools-checklist">
<input type="checkbox" id="node-input-DATA_MATRIX" title="DATA_MATRIX" data-value="DATA_MATRIX">
<label for="node-input-DATA_MATRIX" title="DATA_MATRIX">Datamatrix</label>
<input type="checkbox" id="node-input-QR_CODE" title="QR_CODE" data-value="QR_CODE">
<label for="node-input-QR_CODE" title="QR_CODE">QR</label>
<input type="checkbox" id="node-input-PDF_417" title="PDF_417" data-value="PDF_417">
<label for="node-input-PDF_417" title="PDF_417">PDF 417</label>
<input type="checkbox" id="node-input-EAN_8" title="EAN_8" data-value="EAN_8">
<label for="node-input-EAN_8" title="EAN_8">EAN 8</label>
<input type="checkbox" id="node-input-EAN_13" title="EAN_13" data-value="EAN_13">
<label for="node-input-EAN_13" title="EAN_13">EAN 13</label>
<input type="checkbox" id="node-input-CODE_39" title="CODE_39" data-value="CODE_39">
<label for="node-input-CODE_39" title="CODE_39">Code 39</label>
<input type="checkbox" id="node-input-CODE_128" title="CODE_128" data-value="CODE_128">
<label for="node-input-CODE_128" title="CODE_128">Code 128</label>
<input type="checkbox" id="node-input-ITF" title="ITF" data-value="ITF">
<label for="node-input-ITF" title="ITF">ITF</label>
<input type="checkbox" id="node-input-RSS_14" title="RSS_14" data-value="RSS_14">
<label for="node-input-RSS_14" title="RSS_14">RSS 14</label>
</div>
</div>
<div class="form-row">
<label for="node-input-tryharder"><i class="fa fa-cogs"></i><span data-i18n="xzingDecode.label.tryharder"> try harder</span></label>
<input type="hidden" id="node-input-tryharderType">
<input style="width: 70%" type="text" id="node-input-tryharder" >
</div>
</script>
<script type="text/html" data-help-name="Barcode Decoder">
<link rel="stylesheet" href="image-tools/static/css/common.css" type="text/css"/>
<p>A barcode decoder node built with zxing and Jimp</p>
<h3>Foreword</h3>
<dl class="message-properties">
Examples have been included to help you do some common tasks.
<a onclick="RED.actions.invoke('core:show-examples-import-dialog')" href="#">Click here</a> to import an example or click the hamburger menu <a class="button" href="#"><i class="fa fa-bars"></i></a> select <b>import</b> then <b>examples</b> or press <kbd>ctrl+i</kbd>
</dl>
<h3>Inputs</h3>
<dl class="message-properties">
<dt>image <span class="property-type">string | base64 | buffer | object</span></dt>
<dd> the image (Jimp image / buffer / base64 string / file name / URL) to be decoded. </dd>
<dt>format <span class="property-type">JSON</span></dt>
<dd>
The barcode formats to use can be overridden by sending an array of strings in <code>msg.barcodeFormats</code>.
Choosing the correct format can reduce processing time and improve accuracy.
<p style="padding-left: 2px">
<b>Overriding barcode formats by setting <code>msg.barcodeFormats</code>...</b><br>
Example to read QR only: <code>["QR_CODE"]</code><br>
Example to read Datamatrix only: <code>["DATA_MATRIX"]</code><br>
Example to read 3 different types of barcode: <code>["EAN_32", "RSS_14", "ITF"]</code><br>
<b>To see all currently supported types, import the example "Barcodes" or refer to <a target="_blank" href="https://github.com/zxing-js/library#supported-formats">supported-formats</a> </b>
</p>
</dd>
<dt>tryharder <span class="property-type">bool</span></dt>
<dd> if <code>true</code>, this flag instructs the decoder to try harder when looking for a barcode (slower).</dd>
</dl>
<h3>Output</h3>
<dl class="message-properties">
<dt>payload <span class="property-type">object</span></dt>
<dd>The results.</dd>
<dt>performance <span class="property-type">object</span></dt>
<dd>Performance measurements of the image loading and processing</dd>
<h4>Additional useful properties are available in the <code>msg</code> object. Use a debug node to inspect them</h4>
</dl>
</script>