-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
348 lines (298 loc) · 11.2 KB
/
index.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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="Scan Barcodes and get product Names">
<meta name="author" content="Eddie Hurtig">
<link rel="shortcut icon" href="assets/ico/favicon.ico">
<title>EdHurtig's JS UPC Barcode Scan App</title>
<!-- Bootstrap core CSS -->
<link href="assets/css/bootstrap.css" rel="stylesheet">
<!-- Custom styles for this template -->
<link href="assets/css/style.css" rel="stylesheet">
<link href="assets/css/font-awesome.min.css" rel="stylesheet">
<!-- Just for debugging purposes. Don't actually copy this line! -->
<!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<!-- Fixed navbar -->
<div class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="index.html">UPC LOOKUP.</a>
</div>
<div class="navbar-collapse collapse navbar-right">
<ul class="nav navbar-nav">
<li class="active"><a href="/">HOME</a></li>
<li><a href="https://github.com/EdHurtig/upc-barcode-lookup">GITHUB</a></li>
<li><a href="https://hurtigtechnologies.com/">EDHURTIG</a></li>
</ul>
</div><!--/.nav-collapse -->
</div>
</div>
<!-- *****************************************************************************************************************
HEADERWRAP
***************************************************************************************************************** -->
<div class="headerwrap">
<div class="container">
<div class="row">
<div class="col-lg-8 col-lg-offset-2">
<h3>Scan your product with your scanner</h3>
</div>
<div class="col-lg-8 col-lg-offset-2 himg">
<div class="form-group">
<div class="input-group">
<input type="text" class="form-control" id="upc" placeholder="Enter UPC">
<div class="upc-status input-group-addon">Init</div>
</div>
</div>
</div>
<div class="col-lg-8 col-lg-offset-2 himg" style="color:white;">
<div class="checkbox text-left">
<label>
<input type="checkbox" id="log_errors" checked="checked"> Log Errors
</label>
</div>
</div>
</div><!-- /row -->
</div> <!-- /container -->
</div><!-- /headerwrap -->
<!-- *****************************************************************************************************************
SERVICE LOGOS
***************************************************************************************************************** -->
<div id="service">
<div class="container">
<div class="row centered">
<div class="col-md-12">
<h1>Results</h1>
<p><a href="#">Download CSV</a> | <a href="/wp-json/posts/?type=upc-product&meta_key=session_id&meta_value=1">WP-JSON</a></p>
</div>
</div>
<div class="row centered">
<div class="col-md-12">
<table class="table table-striped">
<thead>
<tr>
<th>ISO 8601</th>
<th>Barcode</th>
<th>Name</th>
<th>description</th>
</tr>
</thead>
<tbody class="results-placeholder">
<td colspan="4" class="on-new-remove">No Products Scanned</td>
</tbody>
<tfoot>
<tr>
<th>ISO 8601</th>
<th>Barcode</th>
<th>Name</th>
<th>description</th>
</tr>
</tfoot>
</table>
</div>
</div>
</div>
</div>
<!-- *****************************************************************************************************************
FOOTER
***************************************************************************************************************** -->
<div id="footerwrap">
<div class="container">
<div class="row">
<div class="col-lg-4">
<h4>About</h4>
<div class="hline-w"></div>
<p>An open source project by Eddie Hurtig</p>
</div>
<div class="col-lg-4">
<h4>Social Links</h4>
<div class="hline-w"></div>
<p>
<a href="https://facebook.com/edhurtig"><i class="fa fa-facebook"></i></a>
<a href="https://twitter.com/edhurtig"><i class="fa fa-twitter"></i></a>
<a href="https://github.com/edhurtig"><i class="fa fa-github"></i></a>
</p>
</div>
<div class="col-lg-4">
<h4>Contact</h4>
<div class="hline-w"></div>
<p>
<a href="mailto:admin@hurtigtechnologies.com">admin@hurtigtechnologies.com</a>
</p>
</div>
</div>
</div>
</div>
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script src="assets/js/bootstrap.min.js"></script>
<script src="assets/js/retina-1.1.0.js"></script>
<script src="assets/js/jquery.hoverdir.js"></script>
<script src="assets/js/jquery.hoverex.min.js"></script>
<script src="assets/js/jquery.prettyPhoto.js"></script>
<script src="assets/js/jquery.isotope.min.js"></script>
<script src="assets/js/custom.js"></script>
<script>
// Portfolio
(function($) {
"use strict";
var $container = $('.portfolio'),
$items = $container.find('.portfolio-item'),
portfolioLayout = 'fitRows';
if( $container.hasClass('portfolio-centered') ) {
portfolioLayout = 'masonry';
}
$container.isotope({
filter: '*',
animationEngine: 'best-available',
layoutMode: portfolioLayout,
animationOptions: {
duration: 750,
easing: 'linear',
queue: false
},
masonry: {
}
}, refreshWaypoints());
function refreshWaypoints() {
setTimeout(function() {
}, 1000);
}
$('nav.portfolio-filter ul a').on('click', function() {
var selector = $(this).attr('data-filter');
$container.isotope({ filter: selector }, refreshWaypoints());
$('nav.portfolio-filter ul a').removeClass('active');
$(this).addClass('active');
return false;
});
function getColumnNumber() {
var winWidth = $(window).width(),
columnNumber = 1;
if (winWidth > 1200) {
columnNumber = 5;
} else if (winWidth > 950) {
columnNumber = 4;
} else if (winWidth > 600) {
columnNumber = 3;
} else if (winWidth > 400) {
columnNumber = 2;
} else if (winWidth > 250) {
columnNumber = 1;
}
return columnNumber;
}
function setColumns() {
var winWidth = $(window).width(),
columnNumber = getColumnNumber(),
itemWidth = Math.floor(winWidth / columnNumber);
$container.find('.portfolio-item').each(function() {
$(this).css( {
width : itemWidth + 'px'
});
});
}
function setPortfolio() {
setColumns();
$container.isotope('reLayout');
}
$container.imagesLoaded(function () {
setPortfolio();
});
$(window).on('resize', function () {
setPortfolio();
});
})(jQuery);
</script>
<script type="text/javascript">
jQuery(function ($) {
$('.upc-status').html('Ready');
$('#upc').focus();
function resetErrors() {
$('.headerwrap').removeClass('error');
$('.upc-status').html('Ready');
}
var log_errors = true;
$('#log_errors').change(function () {
log_errors = $(this).is(':checked');
})
$('#upc').keyup(function () {
var barcode = $(this).val();
// When the Barcode Textbox is filled with 12 chars (UPC always 12 chars)
if (barcode.length == 12) {
$('.upc-status').html('Checking');
$('.headerwrap').removeClass('error');
$.ajax({
url: 'http://www.outpan.com/api/get_product.php?barcode=' + barcode,
timeout: 2000, // Timeout 2 Seconds
dataType: "json",
complete: function(jqXHR, textStatus, errorThrown) {
var json;
try {
json = JSON.parse(jqXHR.responseText)
} catch (e) {
$('.upc-status').html('Server didn\'t send valid JSON ' + jqXHR.responseText);
return;
}
if (!json.error) {
$('.on-new-remove').remove();
$('.on-new-hide').hide();
$('.results-placeholder').append($('<tr/>').append($('<td/>').text(new Date().toISOString())).append($('<td/>').text(json.barcode)).append($('<td/>').text(json.name)).append($('<td/>').text(json.description)));
$('.upc-status').html('Ready');
} else {
$('.headerwrap').addClass('error');
setTimeout(function () {
resetErrors();
}, 5000);
$('.upc-status').html('Error: ' + json.error.message);
if (log_errors) {
$('.on-new-remove').remove();
$('.on-new-hide').hide();
$('.results-placeholder').append($('<tr/>').addClass('danger').append($('<td/>').text(new Date().toISOString())).append($('<td/>').text(barcode)).append($('<td/>').text('Error: ' + json.error.message)).append($('<td/>')));
}
}
$('#upc').val('');
}
});
}
});
})
</script>
<style>
@-webkit-keyframes error-reset {
0% {
background-color: #00b3fe;
}
48% {
background-color: #00b3fe;
}
52% {
background-color: #ff0000;
}
100% {
background-color: #ff0000;
}
}
div.error {
animation: error-reset 500ms infinite;
background-color: #ff0000;
}
</style>
</body>
</html>