From 54436256ea40c135b423986672791f9a85202c01 Mon Sep 17 00:00:00 2001 From: lim-kim930 <1625753207lim@gmail.com> Date: Fri, 15 Apr 2022 16:21:54 +0800 Subject: [PATCH 01/12] fix fullscreen code area bug --- 2.ui-tweaking/4.difference-video-size.html | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/2.ui-tweaking/4.difference-video-size.html b/2.ui-tweaking/4.difference-video-size.html index cd8c574d..8feb592a 100644 --- a/2.ui-tweaking/4.difference-video-size.html +++ b/2.ui-tweaking/4.difference-video-size.html @@ -61,14 +61,18 @@

Enlarge the Video Stream

backToNormal.addEventListener('click', () => { exitFullPage(); }); - fitPage.addEventListener('click', () => { + fitPage.addEventListener('click', async () => { + fitPage.hidden = true; UIElement.classList.add("fullscreen"); + await updateDisplayArea(); backToNormal.hidden = false; }); - function exitFullPage() { - UIElement.classList.remove("fullscreen"); + async function exitFullPage() { backToNormal.hidden = true; + UIElement.classList.remove("fullscreen"); + await updateDisplayArea(); + fitPage.hidden = false; } // decode video from camera async function showScanner() { @@ -77,7 +81,8 @@

Enlarge the Video Stream

await scanner.setUIElement(document.getElementById('div-ui-container')); scanner.onUniqueRead = (txt, result) => { document.getElementById('result').value = result.barcodeFormatString + ": " + txt; - exitFullPage(); + if(fitPage.hidden) + exitFullPage(); document.getElementById('result').focus(); setTimeout(() => { document.getElementById('result').blur(); @@ -92,6 +97,12 @@

Enlarge the Video Stream

throw ex; } } + async function updateDisplayArea() { + let scanner = await pScanner; + // trigger the resize event to adjust the positioning of the code area + const resizeEvent = new Event('resize'); + window.dispatchEvent(resizeEvent); + } - + + + + + + + diff --git a/3.settings/2.localizationModes-binarizationModes.html b/3.settings/2.localizationModes-binarizationModes.html index e4fe62fc..d8472668 100644 --- a/3.settings/2.localizationModes-binarizationModes.html +++ b/3.settings/2.localizationModes-binarizationModes.html @@ -12,7 +12,7 @@ library offline. Please see the guide on how to host the library: https://www.dynamsoft.com/barcode-reader/programming/javascript/user-guide/?ver=latest#host-the-library-yourself-recommended --> - + diff --git a/3.settings/3.blurred-small-barcodes.html b/3.settings/3.blurred-small-barcodes.html index f6983302..fedc34fd 100644 --- a/3.settings/3.blurred-small-barcodes.html +++ b/3.settings/3.blurred-small-barcodes.html @@ -12,7 +12,7 @@ library offline. Please see the guide on how to host the library: https://www.dynamsoft.com/barcode-reader/programming/javascript/user-guide/?ver=latest#host-the-library-yourself-recommended --> - + diff --git a/3.settings/4.deformed-incomplete-barcodes.html b/3.settings/4.deformed-incomplete-barcodes.html index 061f7bd5..58a29b18 100644 --- a/3.settings/4.deformed-incomplete-barcodes.html +++ b/3.settings/4.deformed-incomplete-barcodes.html @@ -12,7 +12,7 @@ library offline. Please see the guide on how to host the library: https://www.dynamsoft.com/barcode-reader/programming/javascript/user-guide/?ver=latest#host-the-library-yourself-recommended --> - + diff --git a/3.settings/5.regionOfInterest-regionPredetection.html b/3.settings/5.regionOfInterest-regionPredetection.html index 294c9e01..f1f022fa 100644 --- a/3.settings/5.regionOfInterest-regionPredetection.html +++ b/3.settings/5.regionOfInterest-regionPredetection.html @@ -12,7 +12,7 @@ library offline. Please see the guide on how to host the library: https://www.dynamsoft.com/barcode-reader/programming/javascript/user-guide/?ver=latest#host-the-library-yourself-recommended --> - + diff --git a/3.settings/initScanner.js b/3.settings/initScanner.js index ac3f1355..f55c14e6 100644 --- a/3.settings/initScanner.js +++ b/3.settings/initScanner.js @@ -20,7 +20,7 @@ window.onload = async function () { /** * You can visit https://www.dynamsoft.com/customer/license/trialLicense?utm_source=github&product=dbr&package=js to get your own trial license good for 30 days. * Note that if you downloaded this sample from Dynamsoft while logged in, the above license key may already be your own 30-day trial license. - * For more information, see https://www.dynamsoft.com/barcode-reader/programming/javascript/user-guide/?ver=9.0.0&utm_source=github#specify-the-license or contact support@dynamsoft.com. + * For more information, see https://www.dynamsoft.com/barcode-reader/programming/javascript/user-guide/?ver=9.0.1&utm_source=github#specify-the-license or contact support@dynamsoft.com. * LICENSE ALERT - THE END */ diff --git a/4.use-case/1.fill-a-form-with-barcode-reading.html b/4.use-case/1.fill-a-form-with-barcode-reading.html index 892359a4..b001153b 100644 --- a/4.use-case/1.fill-a-form-with-barcode-reading.html +++ b/4.use-case/1.fill-a-form-with-barcode-reading.html @@ -12,7 +12,7 @@ library offline. Please see the guide on how to host the library: https://www.dynamsoft.com/barcode-reader/programming/javascript/user-guide/?ver=latest#host-the-library-yourself-recommended --> - + @@ -34,7 +34,7 @@

Click each input box to fill in!

/** * You can visit https://www.dynamsoft.com/customer/license/trialLicense?utm_source=github&product=dbr&package=js to get your own trial license good for 30 days. * Note that if you downloaded this sample from Dynamsoft while logged in, the above license key may already be your own 30-day trial license. - * For more information, see https://www.dynamsoft.com/barcode-reader/programming/javascript/user-guide/?ver=9.0.0&utm_source=github#specify-the-license or contact support@dynamsoft.com. + * For more information, see https://www.dynamsoft.com/barcode-reader/programming/javascript/user-guide/?ver=9.0.1&utm_source=github#specify-the-license or contact support@dynamsoft.com. * LICENSE ALERT - THE END */ diff --git a/4.use-case/2.read-a-drivers-license.html b/4.use-case/2.read-a-drivers-license.html index b4661cb9..96e15bb6 100644 --- a/4.use-case/2.read-a-drivers-license.html +++ b/4.use-case/2.read-a-drivers-license.html @@ -35,7 +35,7 @@

Read A Driver's License Read A Driver's License { + console.log("Barcodes on one frame:"); + for (let result of results) { + console.log(result.barcodeFormatString + ": " + result.barcodeText); + } + }; + /** + * onUniqueRead is triggered only when a 'new' barcode is found. + * The amount of time that the library 'remembers' a barcode is defined by + * "duplicateForgetTime" in "ScanSettings". By default it is set to 3000 ms. + */ + scanner.onUniqueRead = (txt, result) => { + alert(txt); + console.log("Unique Code Found: ", result); + } + /** + * show() opens the camera and shows the video stream on the page. + * After that, the library starts to scan the frame images continuously. + */ + await scanner.show(); + } catch (ex) { + throw ex; + } + }; + + + + \ No newline at end of file From 0319e0c602fe98295cc9c407686cf4ae9d360037 Mon Sep 17 00:00:00 2001 From: Tom Kent Date: Tue, 19 Apr 2022 16:40:05 +0800 Subject: [PATCH 04/12] Delete 1.minimum-code.html --- 1.hello-world/1.minimum-code.html | 63 ------------------------------- 1 file changed, 63 deletions(-) delete mode 100644 1.hello-world/1.minimum-code.html diff --git a/1.hello-world/1.minimum-code.html b/1.hello-world/1.minimum-code.html deleted file mode 100644 index 641865ca..00000000 --- a/1.hello-world/1.minimum-code.html +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - - - - Dynamsoft Barcode Reader Sample - Hello World (Decoding via Camera) - - - - Loading... - - - - - \ No newline at end of file From d99ce5eafe99b980ce3410cac7c7818bb9aa32aa Mon Sep 17 00:00:00 2001 From: SHEN <62587615+shenwb123@users.noreply.github.com> Date: Thu, 21 Apr 2022 09:12:13 +0800 Subject: [PATCH 05/12] change the console. error output to alert --- 1.hello-world/1.hello-world.html | 5 +++-- 1.hello-world/10.read-video-pwa/helloworld-pwa.html | 4 ++-- 1.hello-world/11.read-video-requirejs.html | 6 +++--- 1.hello-world/12.read-video-es6.html | 6 +++--- 1.hello-world/2.read-an-image.html | 6 ++++-- 1.hello-world/3.read-video-angular/package.json | 2 +- .../src/app/barcode-scanner/barcode-scanner.component.ts | 2 +- 1.hello-world/3.read-video-angular/src/app/dbr.ts | 4 ++-- .../src/app/img-decode/img-decode.component.ts | 2 +- 1.hello-world/4.read-video-react/package.json | 2 +- .../src/components/ImgDecode/ImgDecode.js | 2 +- .../src/components/VideoDecode/VideoDecode.js | 2 +- 1.hello-world/4.read-video-react/src/dbr.js | 4 ++-- 1.hello-world/5.read-video-vue/package.json | 2 +- 1.hello-world/5.read-video-vue/src/components/ImgDecode.vue | 2 +- .../5.read-video-vue/src/components/VideoDecode.vue | 2 +- 1.hello-world/5.read-video-vue/src/dbr.js | 4 ++-- 1.hello-world/6.read-video-vue3/package.json | 2 +- .../6.read-video-vue3/src/components/HelloWorld.vue | 2 +- .../6.read-video-vue3/src/components/ImgDecode.vue | 2 +- .../6.read-video-vue3/src/components/VideoDecode.vue | 2 +- 1.hello-world/6.read-video-vue3/src/dbr.js | 4 ++-- 1.hello-world/7.read-video-nextjs/components/ImgDecode.js | 2 +- 1.hello-world/7.read-video-nextjs/components/VideoDecode.js | 2 +- 1.hello-world/7.read-video-nextjs/dbr.js | 4 ++-- 1.hello-world/7.read-video-nextjs/package.json | 2 +- 1.hello-world/8.read-video-nuxtjs/components/ImgDecode.vue | 4 ++-- .../8.read-video-nuxtjs/components/VideoDecode.vue | 2 +- 1.hello-world/8.read-video-nuxtjs/dbr.js | 4 ++-- 1.hello-world/8.read-video-nuxtjs/package.json | 2 +- 1.hello-world/9.read-video-electron/action.js | 2 +- 1.hello-world/9.read-video-electron/package.json | 2 +- 32 files changed, 49 insertions(+), 46 deletions(-) diff --git a/1.hello-world/1.hello-world.html b/1.hello-world/1.hello-world.html index dcd0e200..b77b3e59 100644 --- a/1.hello-world/1.hello-world.html +++ b/1.hello-world/1.hello-world.html @@ -11,7 +11,7 @@ Loading... - + + + + + + - \ No newline at end of file + From ae253929642d738b5507e4bca7663bcd21c2de4b Mon Sep 17 00:00:00 2001 From: Cube <877211593@qq.com> Date: Fri, 22 Apr 2022 13:51:34 +0800 Subject: [PATCH 08/12] Update 1.hello-world.html --- 1.hello-world/1.hello-world.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/1.hello-world/1.hello-world.html b/1.hello-world/1.hello-world.html index 80c1f07b..8d9b8c6a 100644 --- a/1.hello-world/1.hello-world.html +++ b/1.hello-world/1.hello-world.html @@ -26,7 +26,7 @@ * LICENSE ALERT - THE END */ - window.onload = async function() { + (async function() { try { const scanner = await Dynamsoft.DBR.BarcodeScanner.createInstance(); /** @@ -57,7 +57,7 @@ alert(ex); throw ex; } - }; + })(); From b9b5965fd0e84985793f05f834bc3e5f995c9ac2 Mon Sep 17 00:00:00 2001 From: Cube <877211593@qq.com> Date: Fri, 22 Apr 2022 13:52:25 +0800 Subject: [PATCH 09/12] Update 12.read-video-es6.html --- 1.hello-world/12.read-video-es6.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/1.hello-world/12.read-video-es6.html b/1.hello-world/12.read-video-es6.html index b35ac2ef..40a827c2 100644 --- a/1.hello-world/12.read-video-es6.html +++ b/1.hello-world/12.read-video-es6.html @@ -30,7 +30,7 @@

Hello World for ES6

BarcodeReader.engineResourcePath = "https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@9.0.1/dist/"; let pScanner = null; - window.onload = async () => { + (async () => { try { const scanner = await (pScanner = pScanner || BarcodeScanner.createInstance()); /* @@ -57,8 +57,8 @@

Hello World for ES6

alert(ex.message); throw ex; } - }; + })(); - \ No newline at end of file + From 83b21b2403e61c86f8b5bd57e18904ff4c0ec57b Mon Sep 17 00:00:00 2001 From: Cube <877211593@qq.com> Date: Fri, 22 Apr 2022 13:54:53 +0800 Subject: [PATCH 10/12] Update helloworld-pwa.html --- .../10.read-video-pwa/helloworld-pwa.html | 34 ++++++++++--------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/1.hello-world/10.read-video-pwa/helloworld-pwa.html b/1.hello-world/10.read-video-pwa/helloworld-pwa.html index 0187eeb2..72ac4ac9 100644 --- a/1.hello-world/10.read-video-pwa/helloworld-pwa.html +++ b/1.hello-world/10.read-video-pwa/helloworld-pwa.html @@ -30,7 +30,21 @@

Hello World for PWA

let pScanner = null; let latestResult = null; - window.onload = async function() { + + function startNotificationLoop() { + if (latestResult != null) { + const title = "New Barcode Found!"; + const notifBody = `Barcode Text: ${latestResult}.`; + const options = { + body: notifBody, + }; + new Notification(title, options); + latestResult = null; + } + setTimeout(startNotificationLoop, 100); + } + + (async function() { Notification.requestPermission().then((result) => { if (result === 'granted') { startNotificationLoop(); @@ -52,24 +66,12 @@

Hello World for PWA

alert(ex.message); throw ex; } - }; - - function startNotificationLoop() { - if (latestResult != null) { - const title = "New Barcode Found!"; - const notifBody = `Barcode Text: ${latestResult}.`; - const options = { - body: notifBody, - }; - new Notification(title, options); - latestResult = null; - } - setTimeout(startNotificationLoop, 100); - } + })(); + if ('serviceWorker' in navigator) { navigator.serviceWorker.register('./service-worker.js'); }; - \ No newline at end of file + From 07166b77fa5c108138d9c6749b63c3d767c3ecee Mon Sep 17 00:00:00 2001 From: Cube <877211593@qq.com> Date: Fri, 22 Apr 2022 13:56:17 +0800 Subject: [PATCH 11/12] Update 1.fill-a-form-with-barcode-reading.html --- 4.use-case/1.fill-a-form-with-barcode-reading.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/4.use-case/1.fill-a-form-with-barcode-reading.html b/4.use-case/1.fill-a-form-with-barcode-reading.html index b001153b..f113dbf7 100644 --- a/4.use-case/1.fill-a-form-with-barcode-reading.html +++ b/4.use-case/1.fill-a-form-with-barcode-reading.html @@ -40,7 +40,7 @@

Click each input box to fill in!

// scanner for decoding video let pScanner = null; - window.onload = async function() { + (async function() { let allInputs = document.getElementsByClassName('latest-result'); for (let input of allInputs) input.addEventListener('click', async function() { @@ -93,7 +93,7 @@

Click each input box to fill in!

} document.getElementById('inputs').hidden = false; document.getElementById('lib-load').hidden = true; - }; + })();