Skip to content

Commit

Permalink
Update index.html
Browse files Browse the repository at this point in the history
  • Loading branch information
martinius96 authored Oct 29, 2023
1 parent 12d05e2 commit e721ba9
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions docs/AR/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,33 @@ <h1>QR Code Scanner</h1>
<canvas id="qr-canvas" style="display: none;"></canvas>
<div id="qr-result" style="margin-top: 20px;"></div>
<div id="table-data"></div>
<!-- Nový div pro zobrazení textu -->
<div id="text-overlay" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; display: none; align-items: center; justify-content: center; background-color: rgba(0, 0, 0, 0.7); z-index: 999;">
<h1 style="color: white; font-size: 48px;">HELLO WORLD</h1>
</div>

<script src="https://rawgit.com/schmich/instascan-builds/master/instascan.min.js"></script>
<script>
let scanner = new Instascan.Scanner({ video: document.getElementById('qr-video'), mirror: false });
let loadingQR = false;
let loadingTimeout;

// Funkce pro zobrazení textu na obrazovce
function showTextOverlay() {
const overlay = document.getElementById('text-overlay');
overlay.style.display = 'flex';
setTimeout(() => {
overlay.style.display = 'none';
}, 2000); // Skrytí textu po 2 sekundách
}

scanner.addListener('scan', function (content) {
if (content.startsWith("https://arduino.clanweb.eu/studna_s_prekladom/full_vypis.php")) {
document.getElementById('qr-result').textContent = content;
if (!loadingQR) {
loadingQR = true;
fetchAndDisplayQRContent(content);
showTextOverlay(); // Zobrazí text "HELLO WORLD"
}
} else {
document.getElementById('qr-result').textContent = "Invalid QR Code";
Expand Down

0 comments on commit e721ba9

Please sign in to comment.