From 19af09c9a0055c3076cb6d5215feef65567aeefe Mon Sep 17 00:00:00 2001 From: Rhys Nute <nuterd@cardiff.ac.uk> Date: Sun, 3 Dec 2023 19:01:00 +0000 Subject: [PATCH] QR updates --- src/main/resources/static/qr-scanner.html | 7 +++---- src/main/resources/static/scripts/qr-script.js | 10 +++++----- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/main/resources/static/qr-scanner.html b/src/main/resources/static/qr-scanner.html index 8ff5ab8f..5e273537 100644 --- a/src/main/resources/static/qr-scanner.html +++ b/src/main/resources/static/qr-scanner.html @@ -4,10 +4,10 @@ <head> <meta charset="UTF-8"> <meta name="viewpoint" content="width-device-width, initial-scale=1.0"> - <link rel="stylesheet" href="qrstyle.css"> + <link rel="stylesheet" href="css/qrstyle.css"> + <script src="https://unpkg.com/html5-qrcode"> </script> + <script src="scripts/qr-script.js"></script> <title>QR Code</title> - <script th:src="@{https://unpkg.com/html5-qrcode}" type="text/javascript"></script> - <script th:src="@{scripts/qr-script.js}" class="domReady"></script> </head> <body> @@ -18,6 +18,5 @@ </div> </div> </div> - </body> </html> diff --git a/src/main/resources/static/scripts/qr-script.js b/src/main/resources/static/scripts/qr-script.js index 32404079..6eed85dd 100644 --- a/src/main/resources/static/scripts/qr-script.js +++ b/src/main/resources/static/scripts/qr-script.js @@ -14,13 +14,13 @@ function domReady(fn){ } domReady(function (){ //if QR code found - function onQRSuccess(decodeText, decodeResult){ + function onScanSuccess(decodeText, decodeResult){ alert("You have collected: " + decodeText, decodeResult); } -let htmlscanner = new Html5QrcodeScanner( + let htmlscanner = new Html5QrcodeScanner( "qr-code-reader", - { fps: 10, qrbos: 250} -) - htmlscanner.render(onQRSuccess); + { fps: 20, qrbos: 250} + ); + htmlscanner.render(onScanSuccess); }); -- GitLab