fixed js barcode behaviour

This commit is contained in:
nek0 2015-07-21 19:18:00 +02:00
parent 79e4a5af73
commit 802f9d775f

View file

@ -4,6 +4,7 @@ var barcodeShown = false
function showBarcode(text) {
if (!barcodeShown) {
document.getElementById('barcode').classList.add('shown')
barcodeShown = true
}
document.getElementById('barcodeContent').textContent = text
}
@ -11,8 +12,9 @@ function showBarcode(text) {
function hideBarcode() {
if (barcodeShown) {
document.getElementById('barcode').classList.remove('shown')
barcodeShown = false
}
return document.getElementById('barcodeContent').textContent
return ""
}
function barcodeKeyPress(event) {
@ -30,7 +32,7 @@ function barcodeKeyPress(event) {
if ( focused == null || focused.tagName != "INPUT" ) {
if ( event.keyCode === 13 ) {
var input = document.getElementById('barcodeInput')
if (input) {
if (input && barcodeBuf.length > 0) {
input.setAttribute('value', barcodeBuf)
input.parentNode.submit()
return