Add QR code positioning support via qrOffset URL parameter

Add support for positioning the QR code element by introducing a new qrOffset URL parameter. The parameter controls the bottom and right positioning of the QR code with a default value of 20px if not specified. This allows for better control over the QR code placement in the layout.
This commit is contained in:
2025-06-10 10:23:49 +03:00
parent 0b3a21f00c
commit 96f1878ac0

View File

@@ -71,10 +71,13 @@
// Parse query parameters for QR code size // Parse query parameters for QR code size
const urlParams = new URLSearchParams(window.location.search); const urlParams = new URLSearchParams(window.location.search);
const qrSize = parseInt(urlParams.get('qrSize')) || 100; // Default to 100px if not specified const qrSize = parseInt(urlParams.get('qrSize')) || 100; // Default to 100px if not specified
const qrOffset = parseInt(urlParams.get('qrOffset')) || 20; // Default to 20px if not specified
const qrCodeElement = document.getElementById('qr-code'); const qrCodeElement = document.getElementById('qr-code');
qrCodeElement.style.width = `${qrSize}px`; qrCodeElement.style.width = `${qrSize}px`;
qrCodeElement.style.height = `${qrSize}px`; qrCodeElement.style.height = `${qrSize}px`;
qrCodeElement.style.bottom = `${qrOffset}px`;
qrCodeElement.style.right = `${qrOffset}px`;
} }
// Configure QR code on page load // Configure QR code on page load