|
|
|
@ -71,7 +71,7 @@ function setupHTML5BarcodeScanner() {
|
|
|
|
|
$("#web-barcode-ui").removeClass("hidden");
|
|
|
|
|
// Stolen from https://zxing-js.github.io/library/examples/multi-camera/
|
|
|
|
|
const codeReader = new ZXing.BrowserMultiFormatReader();
|
|
|
|
|
console.log('ZXing code reader initialized');
|
|
|
|
|
console.log("Info", 'ZXing code reader initialized');
|
|
|
|
|
codeReader.getVideoInputDevices()
|
|
|
|
|
.then((videoInputDevices) => {
|
|
|
|
|
if (videoInputDevices.length == 0) {
|
|
|
|
@ -84,7 +84,6 @@ function setupHTML5BarcodeScanner() {
|
|
|
|
|
|
|
|
|
|
codeReader.decodeFromInputVideoDeviceContinuously(selectedDeviceId, 'barcode-viewer', (result, err) => {
|
|
|
|
|
if (result) {
|
|
|
|
|
console.log(result);
|
|
|
|
|
codeReader.reset();
|
|
|
|
|
$("#web-barcode-ui").addClass("hidden");
|
|
|
|
|
success(result.text);
|
|
|
|
@ -123,15 +122,15 @@ function initCordova() {
|
|
|
|
|
document.addEventListener("deviceready", function () {
|
|
|
|
|
if (localStorage.getItem("wakelock") == "true") {
|
|
|
|
|
window.powerManagement.acquire(function () {
|
|
|
|
|
console.log('Wakelock acquired');
|
|
|
|
|
console.log("Info", 'Wakelock acquired');
|
|
|
|
|
}, function () {
|
|
|
|
|
console.log('Failed to acquire wakelock');
|
|
|
|
|
console.log("Warn", 'Failed to acquire wakelock');
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
window.powerManagement.release(function () {
|
|
|
|
|
console.log('Wakelock released');
|
|
|
|
|
console.log("Info", 'Wakelock released');
|
|
|
|
|
}, function () {
|
|
|
|
|
console.log('Failed to release wakelock');
|
|
|
|
|
console.log("Warn", 'Failed to release wakelock');
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}, false);
|
|
|
|
|