v1.1
This commit is contained in:
parent
a08c4708e2
commit
4cb2bc7d29
@ -25,7 +25,7 @@
|
|||||||
const path = window.location.pathname;
|
const path = window.location.pathname;
|
||||||
const parts = path.split("/");
|
const parts = path.split("/");
|
||||||
const user = parts.pop();
|
const user = parts.pop();
|
||||||
let url = location.protocol + "//" + location.host + "/u/" + user;
|
let url = location.protocol + "//" + location.host + "/u/" + user.toLowerCase();
|
||||||
|
|
||||||
const qrcode = new QRCode(document.getElementById('qr'), {
|
const qrcode = new QRCode(document.getElementById('qr'), {
|
||||||
text: url,
|
text: url,
|
||||||
@ -39,7 +39,7 @@
|
|||||||
let qrLink = document.getElementById("qr-link");
|
let qrLink = document.getElementById("qr-link");
|
||||||
let qrImg = document.querySelector("#qr img");
|
let qrImg = document.querySelector("#qr img");
|
||||||
console.log(qrImg.src);
|
console.log(qrImg.src);
|
||||||
qrLink.setAttribute("download", "qrcode-" + user + ".png");
|
qrLink.setAttribute("download", "qrcode-" + user.toLowerCase() + ".png");
|
||||||
|
|
||||||
const delay = ms => new Promise(res => setTimeout(res, ms));
|
const delay = ms => new Promise(res => setTimeout(res, ms));
|
||||||
const setHref = async () => {
|
const setHref = async () => {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
const form = document.getElementById("reg-form"); // Replace #my-form with your form's ID
|
const form = document.getElementById("reg-form");
|
||||||
|
|
||||||
form.addEventListener("submit", async (event) => {
|
form.addEventListener("submit", async (event) => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
document.getElementById("submitBtn").addEventListener('click', function(e) {
|
let submitBtn = document.getElementById("submitBtn");
|
||||||
let code = document.getElementById("code").value;
|
submitBtn.addEventListener('click', function(e) {
|
||||||
console.log("Clicked: " + code);
|
let code = document.getElementById("code").value.replaceAll(" ", "");
|
||||||
|
|
||||||
const path = window.location.pathname;
|
const path = window.location.pathname;
|
||||||
const parts = path.split("/");
|
const parts = path.split("/");
|
||||||
const user = parts.pop();
|
const user = parts.pop().toLowerCase();
|
||||||
|
|
||||||
fetch("/api/verify/" + user, {
|
fetch("/api/verify/" + user, {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
@ -15,8 +15,9 @@ document.getElementById("submitBtn").addEventListener('click', function(e) {
|
|||||||
}).then(response => response.json())
|
}).then(response => response.json())
|
||||||
.then(data => {
|
.then(data => {
|
||||||
let statusText = document.getElementById("status");
|
let statusText = document.getElementById("status");
|
||||||
console.log(data);
|
|
||||||
statusText.classList.remove("hidden");
|
statusText.classList.remove("hidden");
|
||||||
|
console.log("Status Code: " + data.status);
|
||||||
|
console.log("Code Type: " + typeof data.status)
|
||||||
if (data.status === 404) {
|
if (data.status === 404) {
|
||||||
// Not found
|
// Not found
|
||||||
statusText.innerText = "User with that code not found";
|
statusText.innerText = "User with that code not found";
|
||||||
@ -29,4 +30,10 @@ document.getElementById("submitBtn").addEventListener('click', function(e) {
|
|||||||
statusText.innerText = "Error, please send this to Steven to be fixed. Error: " + data.error;
|
statusText.innerText = "Error, please send this to Steven to be fixed. Error: " + data.error;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
});
|
||||||
|
|
||||||
|
document.getElementById("code").addEventListener('keyup', function(e) {
|
||||||
|
if (e.key === "Enter") {
|
||||||
|
submitBtn.click();
|
||||||
|
}
|
||||||
|
});
|
Loading…
Reference in New Issue
Block a user