From 4163436bbc151e4e7d8542bfd5645ef66e9c5893 Mon Sep 17 00:00:00 2001 From: radl97 Date: Tue, 8 Jun 2021 16:16:45 +0200 Subject: [PATCH 1/4] append decoded code instead of overriding --- docs/index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/index.html b/docs/index.html index 23341e8c..9f909122 100644 --- a/docs/index.html +++ b/docs/index.html @@ -100,7 +100,7 @@

jsQR Demo

canvas.drawImage(video, 0, 0, canvasElement.width, canvasElement.height); var imageData = canvas.getImageData(0, 0, canvasElement.width, canvasElement.height); var code = jsQR(imageData.data, imageData.width, imageData.height, { - inversionAttempts: "dontInvert", + inversionAttempts: "attemptBoth", }); if (code) { drawLine(code.location.topLeftCorner, code.location.topRightCorner, "#FF3B58"); @@ -109,7 +109,7 @@

jsQR Demo

drawLine(code.location.bottomLeftCorner, code.location.topLeftCorner, "#FF3B58"); outputMessage.hidden = true; outputData.parentElement.hidden = false; - outputData.innerText = code.data; + outputData.innerText += code.data + "\n"; } else { outputMessage.hidden = false; outputData.parentElement.hidden = true; From 4f20f5e8aca63720a510effa27a363a29d520bcc Mon Sep 17 00:00:00 2001 From: radl97 Date: Tue, 8 Jun 2021 16:33:22 +0200 Subject: [PATCH 2/4] Fixup --- docs/index.html | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/docs/index.html b/docs/index.html index 9f909122..24b9d5f9 100644 --- a/docs/index.html +++ b/docs/index.html @@ -80,6 +80,8 @@

jsQR Demo

canvas.stroke(); } + var lastResult = null; + // Use facingMode: environment to attemt to get the front camera on phones navigator.mediaDevices.getUserMedia({ video: { facingMode: "environment" } }).then(function(stream) { video.srcObject = stream; @@ -102,17 +104,21 @@

jsQR Demo

var code = jsQR(imageData.data, imageData.width, imageData.height, { inversionAttempts: "attemptBoth", }); + outputMessage.hidden = true; + outputData.parentElement.hidden = false; + var result; if (code) { drawLine(code.location.topLeftCorner, code.location.topRightCorner, "#FF3B58"); drawLine(code.location.topRightCorner, code.location.bottomRightCorner, "#FF3B58"); drawLine(code.location.bottomRightCorner, code.location.bottomLeftCorner, "#FF3B58"); drawLine(code.location.bottomLeftCorner, code.location.topLeftCorner, "#FF3B58"); - outputMessage.hidden = true; - outputData.parentElement.hidden = false; - outputData.innerText += code.data + "\n"; + result = code.data; } else { - outputMessage.hidden = false; - outputData.parentElement.hidden = true; + result = "No code detected"; + } + if (result !== lastResult) { + outputData.innerText += result + "\n"; + lastResult = result; } } requestAnimationFrame(tick); From 4d777b52ad58625bcefb437f3e7b79914e00be2e Mon Sep 17 00:00:00 2001 From: radl97 Date: Tue, 8 Jun 2021 18:35:30 +0200 Subject: [PATCH 3/4] Revert unrelated change --- docs/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/index.html b/docs/index.html index 24b9d5f9..4b2491bd 100644 --- a/docs/index.html +++ b/docs/index.html @@ -102,7 +102,7 @@

jsQR Demo

canvas.drawImage(video, 0, 0, canvasElement.width, canvasElement.height); var imageData = canvas.getImageData(0, 0, canvasElement.width, canvasElement.height); var code = jsQR(imageData.data, imageData.width, imageData.height, { - inversionAttempts: "attemptBoth", + inversionAttempts: "dontInvert", }); outputMessage.hidden = true; outputData.parentElement.hidden = false; From 98996b1ced6368e31501a7c072c8624bbf898ea8 Mon Sep 17 00:00:00 2001 From: radl97 Date: Fri, 13 May 2022 20:46:31 +0200 Subject: [PATCH 4/4] Create alert1.js --- docs/alert1.js | 1 + 1 file changed, 1 insertion(+) create mode 100644 docs/alert1.js diff --git a/docs/alert1.js b/docs/alert1.js new file mode 100644 index 00000000..77ebc6cc --- /dev/null +++ b/docs/alert1.js @@ -0,0 +1 @@ +alert(1)