-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
89 lines (87 loc) · 3.31 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<html>
<head><title>Stock checking app and scanning app</title>
<link rel="stylesheet" type="text/css" href="style.css?ref=no-cache-5" />
<link rel="icon" type="image/svg+xml" href="/srm-icons/barcode.svg" />
<link rel="apple-touch-icon" size="180x180" type="image/png" href="/srm-icons/barcode_180.png" />
<link rel="apple-touch-icon" size="120x120" type="image/png" href="/srm-icons/barcode_120.png" />
<link rel="apple-touch-icon" size="152x152" type="image/png" href="/srm-icons/barcode_152.png" />
<link rel="apple-touch-icon" size="any" type="image/svg+xml" href="/srm-icons/barcode.svg" />
<script src="html5-qrcode.min.js" type="text/javascript"></script>
<script>
document.addEventListener("DOMContentLoaded", start)
document.addEventListener("DOMContentLoaded", initevents)
var htmlQrcodeScanner;
var qrbox_size=200;
function start(){
var resultContainer = document.getElementById('qr-reader-results');
var lastResult, countResults = 0;
function onScanSuccess(decodedText, decodedResult) {
if (decodedText !== lastResult) {
++countResults;
lastResult = decodedText;
// Handle on success condition with the decoded message.
window.location.replace(`details.php?id=${decodedText}`);
console.log(`Scan result ${decodedText}`, decodedResult);
}
}
html5QrcodeScanner = new Html5QrcodeScanner(
"qr-reader", { fps: 10, qrbox: qrbox_size, aspectRatio: 0.5,
videoConstraints: {
/*"zoom": {ideal: 0.5},*/
facingMode: {ideal: "environment"},
focusMode: "continuous",
height: {ideal: 1080}
/*"height": {"min": 1080}*/
}
});
html5QrcodeScanner.render(onScanSuccess);
}
async function stop(){
await html5QrcodeScanner.clear();
}
async function restart(){await stop();start();}
function initevents(){
document.getElementById("qrbox_l").addEventListener("click", function(){qrbox_size=300; restart()});
document.getElementById("qrbox_m").addEventListener("click", function(){qrbox_size=200; restart()});
document.getElementById("qrbox_s").addEventListener("click", function(){qrbox_size=150; restart()});
}
</script>
</head>
<body id="index-body">
<div id="everything">
<div id="qr-reader" style="width:50vw"></div>
<div id="qr-reader-results"></div><br />
<br />
<br />
<div class="centered-container">
<button id="qrbox_l">QRbox: large</button>
<button id="qrbox_m">QRbox: med</button>
<button id="qrbox_s">QRbox: small</button>
</div>
<br />
<div class="centered-container">
<a href="dumpanalytics.php" class="link-button"><span>Alternatively, view ALL</span></a>
</div>
<br />
<div class="centered-container">
<a href="quickload.php" class="link-button"><span>Quick (Fill)</span></a>
</div>
<br />
<div class="centered-container">
<a href="quickload_raw.php" class="link-button"><span>Quick</span></a>
</div>
<br />
<div class="centered-container">
<a href="rapidscan_raw.php" class="link-button"><span>Rapidscan</span></a>
</div>
<br />
<div class="centered-container">
<a href="rapidscan_manual.php" class="link-button"><span>Rapidscan (with text input)</span></a>
</div>
<br />
<div class="centered-container">
<a href="reports/beancounter.html" class="link-button"><span>Reports</span></a>
</div>
</div>
</body>
</html>