fixed js barcode behaviour
This commit is contained in:
parent
79e4a5af73
commit
802f9d775f
1 changed files with 4 additions and 2 deletions
|
@ -4,6 +4,7 @@ var barcodeShown = false
|
||||||
function showBarcode(text) {
|
function showBarcode(text) {
|
||||||
if (!barcodeShown) {
|
if (!barcodeShown) {
|
||||||
document.getElementById('barcode').classList.add('shown')
|
document.getElementById('barcode').classList.add('shown')
|
||||||
|
barcodeShown = true
|
||||||
}
|
}
|
||||||
document.getElementById('barcodeContent').textContent = text
|
document.getElementById('barcodeContent').textContent = text
|
||||||
}
|
}
|
||||||
|
@ -11,8 +12,9 @@ function showBarcode(text) {
|
||||||
function hideBarcode() {
|
function hideBarcode() {
|
||||||
if (barcodeShown) {
|
if (barcodeShown) {
|
||||||
document.getElementById('barcode').classList.remove('shown')
|
document.getElementById('barcode').classList.remove('shown')
|
||||||
|
barcodeShown = false
|
||||||
}
|
}
|
||||||
return document.getElementById('barcodeContent').textContent
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
function barcodeKeyPress(event) {
|
function barcodeKeyPress(event) {
|
||||||
|
@ -30,7 +32,7 @@ function barcodeKeyPress(event) {
|
||||||
if ( focused == null || focused.tagName != "INPUT" ) {
|
if ( focused == null || focused.tagName != "INPUT" ) {
|
||||||
if ( event.keyCode === 13 ) {
|
if ( event.keyCode === 13 ) {
|
||||||
var input = document.getElementById('barcodeInput')
|
var input = document.getElementById('barcodeInput')
|
||||||
if (input) {
|
if (input && barcodeBuf.length > 0) {
|
||||||
input.setAttribute('value', barcodeBuf)
|
input.setAttribute('value', barcodeBuf)
|
||||||
input.parentNode.submit()
|
input.parentNode.submit()
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in a new issue