Spaces:
Running

backend / app /static /js /stats-view-script.js
paisaly's picture
Upload 1776 files
25834e9 verified
Raw History Blame Contribute Delete
1.15 kB
var qrcode = document.getElementById("qrcode");
qrcode.onload = function () {
var qrcodeContainer = document.getElementById("qr-code-container");
qrcodeContainer.style.animation = "none";
qrcodeContainer.addEventListener("mouseenter", function () {
qrcodeContainer.style.cursor = "pointer";
var qrcodeOverlay = document.getElementById("qrcode-overlay");
qrcodeOverlay.style.display = "flex";
});
qrcodeContainer.addEventListener("mouseleave", function () {
const qrcodeOverlay = document.getElementById("qrcode-overlay");
qrcodeOverlay.style.display = "none";
});
qrcodeContainer.addEventListener("click", function () {
downloadQRCode();
});
};
function downloadQRCode() {
fetch(qrcode.src, { mode: "cors" })
.then(function (res) { return res.blob(); })
.then(function (blob) {
var link = document.createElement("a");
link.href = URL.createObjectURL(blob);
link.download = "qrcode.png";
link.click();
URL.revokeObjectURL(link.href);
});
}