This commit is contained in:
Steven Tracey 2025-07-10 15:47:18 -04:00
parent 356669fdfd
commit 94c7412081
4 changed files with 109 additions and 0 deletions

56
genqr.php Normal file
View File

@ -0,0 +1,56 @@
<!DOCTYPE html>
<html lang="en">
<?php include $_SERVER['DOCUMENT_ROOT']."/snippets/head.php" ?>
<body>
<?php include $_SERVER['DOCUMENT_ROOT']."/snippets/header.php" ?>
<div class="container">
<div class="content flex-vertical">
<div class="section-one">
<h1>QR Code</h1>
<a id="qr-link" href="">
<div id="qr"></div>
</a>
</div>
<div class="section-two">
<div id="loading"></div>
</div>
</div>
</div>
<?php include $_SERVER['DOCUMENT_ROOT']."/snippets/footer.php" ?>
<script src="/static/qrcode.min.js"></script>
<script>
const path = window.location.pathname;
const parts = path.split("/");
const user = parts.pop();
let url = location.protocol + "//" + location.host + "/u/" + user;
const qrcode = new QRCode(document.getElementById('qr'), {
text: url,
width: 1024,
height: 1024,
colorDark : '#000',
colorLight : '#fff',
correctLevel : QRCode.CorrectLevel.L
});
let qrLink = document.getElementById("qr-link");
let qrImg = document.querySelector("#qr img");
console.log(qrImg.src);
qrLink.setAttribute("download", "qrcode-" + user + ".png");
const delay = ms => new Promise(res => setTimeout(res, ms));
const setHref = async () => {
while (!qrLink.href.startsWith("data:")) {
await delay(100);
qrLink.setAttribute("href", qrImg.src);
console.log("Refreshing...");
}
document.getElementById("loading").remove();
};
setHref();
</script>
</body>
</html>

23
register.php Normal file
View File

@ -0,0 +1,23 @@
<!DOCTYPE html>
<html lang="en">
<?php include $_SERVER['DOCUMENT_ROOT']."/snippets/head.php" ?>
<body>
<?php include $_SERVER['DOCUMENT_ROOT']."/snippets/header.php" ?>
<div class="container">
<div class="content flex-vertical">
<div class="section-one">
<h1>Registration</h1>
</div>
<div class="section-two flex-vertical align-left">
<form> <!-- TODO Make these stack vertically -->
<label>Registration Code</label>
<label>Name</label>
</form>
</div>
</div>
</div>
<?php include $_SERVER['DOCUMENT_ROOT']."/snippets/footer.php" ?>
</body>
</html>

1
static/qrcode.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -244,4 +244,33 @@
#status {
margin-bottom: 0;
}
#qr-link {
display: inline-flex;
}
#qr {
display: flex;
justify-content: center;
}
#qr img {
width: auto;
height: 60vh;
}
#loading {
display: inline-block;
width: 50px;
height: 50px;
border: 3px solid var(--mid-light);
border-radius: 50%;
border-top-color: var(--mid-dark);
animation: spin 1s ease-in-out infinite;
-webkit-animation: spin 1s ease-in-out infinite;
}
@keyframes spin {
to { transform: rotate(360deg); }
}