mirror of
https://github.com/Merricx/qrazybox.git
synced 2025-03-14 00:29:03 +01:00
Delete index2.html
This commit is contained in:
parent
a86429b673
commit
18f0d94443
1 changed files with 0 additions and 61 deletions
61
index2.html
61
index2.html
|
@ -1,61 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>QR Code Display</title>
|
|
||||||
<meta charset="utf-8" />
|
|
||||||
<style>
|
|
||||||
#links > a {
|
|
||||||
display: inline-block;
|
|
||||||
margin: 5px;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="links"></div>
|
|
||||||
<canvas id="canvas-1" width="800" height="800"></canvas>
|
|
||||||
<script src="js/table.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
let links = document.getElementById('links');
|
|
||||||
|
|
||||||
for(let i=0; i<20; i++) {
|
|
||||||
let link = document.createElement('a');
|
|
||||||
link.href = "#" + (i + 1);
|
|
||||||
link.text = i+1;
|
|
||||||
links.appendChild(link);
|
|
||||||
}
|
|
||||||
|
|
||||||
let canvas = document.getElementById("canvas-1");
|
|
||||||
let ctx = canvas.getContext("2d");
|
|
||||||
|
|
||||||
window.addEventListener("hashchange", refreshQR);
|
|
||||||
|
|
||||||
function refreshQR() {
|
|
||||||
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
||||||
let fragment = window.location.hash.substr(1);
|
|
||||||
let qrCodeVersion = 1;
|
|
||||||
if (fragment != "") {
|
|
||||||
qrCodeVersion = fragment * 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
let wsize = 10;
|
|
||||||
let hsize = 10;
|
|
||||||
let qrTemplate = qr_templates[qrCodeVersion - 1];
|
|
||||||
|
|
||||||
for (let i = 0; i < qrTemplate.length; i++) {
|
|
||||||
for (let j = 0; j < qrTemplate[0].length; j++) {
|
|
||||||
// Drawing (i, j)
|
|
||||||
let v = qrTemplate[i][j];
|
|
||||||
if (v == -1) {
|
|
||||||
v = 2;
|
|
||||||
}
|
|
||||||
let colorArr = ["white", "black", "grey", "red"];
|
|
||||||
let color = colorArr[v];
|
|
||||||
ctx.fillStyle = color;
|
|
||||||
ctx.fillRect(i * wsize, j * hsize, wsize, hsize);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
refreshQR();
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
Loading…
Add table
Reference in a new issue