Barcode reader in JavaScript