-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathexample.html
More file actions
62 lines (59 loc) · 3.38 KB
/
example.html
File metadata and controls
62 lines (59 loc) · 3.38 KB
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
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="./index.js"></script>
</head>
<body>
<input type="text" id="parse">
<button onclick="parse_stripe()">Parse stripe</button>
<button onclick="parse_pdf417()">Parse pdf417</button>
<pre id="output"></pre>
<ul>
<li>ID: <span id="id"/></li>
<li>Name: <span id="name"/></li>
<li>Sex: <span id="sex"/></li>
<li>DOB: <span id="dob"/></li>
<li>Address: <span id="address"/></li>
<li>City: <span id="city"/></li>
<li>State: <span id="state"/></li>
<li>zip: <span id="zip"/></li>
</ul>
<hr/>
<h2>Sample data</h2>
<h4>Florida stripe</h4>
<pre>
%FLDELRAY DESERT^DOE$JOHN$^5929 N ROCK BLVD^ ?;6360101062271087008=2101198799080=?#! 44556 I 1600 ECCECC00000?
</pre>
<h4>Florida PDF417</h4>
<pre>
@ANSI 6360100102DL00390190ZF02290063DLDAADOE,JOHNDAG5929 N ROCK STDAIDELRAY SHOREDAJFLDAK44556- DAQJ621625830080DARI DAS DAT DBA20210108DBB19770204DBC1DBD20120612DBHN DAU600ZFZFAREPLACED: 00000000ZFB ZFCP771206120090ZFD ZFE07-01-11
</pre>
<script>
function parse_stripe() {
var output = stripe( $('#parse').val() );
$('#id').html(output.id());
$('#name').html(output.name().first + " " + ( output.name().middle || "" ) + " " + output.name().last);
$('#sex').html(output.sex());
$('#dob').html((output.birthday().getUTCMonth() + 1) + "-" + output.birthday().getUTCDate() + "-" + output.birthday().getUTCFullYear());
$('#address').html(output.address);
$('#city').html(output.city);
$('#state').html(output.state);
$('#zip').html(output.postal_code);
}
function parse_pdf417() {
var output = pdf417( $('#parse').val() );
var birthday = output.birthday.substring(0,2) == 19 || output.birthday.substring(0,2) == 20
? new Date(output.birthday.substring(0,4), output.birthday.substring(4,6), output.birthday.substring(6,8))
: new Date(output.birthday.substring(0,2), output.birthday.substring(2,4), output.birthday.substring(4,8));
$('#id').html(output.id);
$('#name').html(output.name.first + " " + ( output.name.middle || "" ) + " " + output.name.last);
$('#sex').html(output.sex);
$('#dob').html(`${birthday.getFullYear()}-${birthday.getMonth()}-${birthday.getDate()}`);
$('#address').html(output.address);
$('#city').html(output.city);
$('#state').html(output.state);
$('#zip').html(output.postal_code);
}
</script>
</body>
</html>