From 161c973efe335fd8bf692939bfc9a3c14419b02d Mon Sep 17 00:00:00 2001 From: Austen Adler Date: Thu, 30 Aug 2018 19:15:18 -0400 Subject: [PATCH] Add javascript to show/hide the QR code --- static/css/linx.css | 1 + static/js/upload.js | 20 ++++++++++++++++++++ templates/index.html | 1 + 3 files changed, 22 insertions(+) diff --git a/static/css/linx.css b/static/css/linx.css index 6dce9c1..88a3826 100644 --- a/static/css/linx.css +++ b/static/css/linx.css @@ -284,6 +284,7 @@ body { color: #800000; } +/* Center the QR code */ .qrcode > canvas, .qrcode > img { margin: 0 auto; padding: 10px; diff --git a/static/js/upload.js b/static/js/upload.js index 5608619..fc21812 100644 --- a/static/js/upload.js +++ b/static/js/upload.js @@ -1,5 +1,19 @@ // @license magnet:?xt=urn:btih:1f739d935676111cfff4b4693e3816e664797050&dn=gpl-3.0.txt GPL-v3-or-Later +var qrCodeCheckbox = document.getElementById("qrcode-show"); +if (qrCodeCheckbox !== null) { + qrCodeCheckbox.addEventListener('change', function() { + var qrCodeCheckbox = document.getElementById("qrcode-show"); + if (qrCodeCheckbox == null) { + return; + } + var qrCodes = document.getElementsByClassName('qrcode'); + for(var i=0; i +