From ca24267e3fabd2f2250133713516bf018f6150e0 Mon Sep 17 00:00:00 2001 From: Yarmo Mackenbach Date: Thu, 23 Jul 2020 10:36:42 +0200 Subject: [PATCH] Improve QR code display --- assets/img/qrcode.png | Bin 0 -> 445 bytes assets/img/qrcode_green.png | Bin 0 -> 456 bytes assets/scripts.js | 29 +++++++++++++++++------------ assets/styles.css | 13 +++++++++---- views/util/qr.php | 4 +++- 5 files changed, 29 insertions(+), 17 deletions(-) create mode 100644 assets/img/qrcode.png create mode 100644 assets/img/qrcode_green.png diff --git a/assets/img/qrcode.png b/assets/img/qrcode.png new file mode 100644 index 0000000000000000000000000000000000000000..f3ff58bb283f0854d4e27f84378e1760a534df8b GIT binary patch literal 445 zcmeAS@N?(olHy`uVBq!ia0vp^1|ZDA1|-9oezpTCmUKs7M+SzC{oH>NS%G|oWRD45dJguM!v-tY$DUh!@P+6=(yLU`z6LcLCBs@Y8vBJ&@uo z@Q5sCVBk9f!i-b3`J{n@vpiiKLo)8Yy>XhaL4n65Fze6%_+wM07iGG)-g+`mcge{U z&I?Q#PNbCc?)|POYGl0hfB4t!Gvm`)nNn^qmOXCy;_SnXccYcF{s#XPRB+h#K`P*T z?$yh`p1LCkWnl0p=WQyAhTQy=%(P0}8hQ;wZvr()f@}!RPb(=;EJ|f4 jFE7{2%*!rLPAo{(%P&fw{mw=TsEEPS)z4*}Q$iB}tG1PW literal 0 HcmV?d00001 diff --git a/assets/img/qrcode_green.png b/assets/img/qrcode_green.png new file mode 100644 index 0000000000000000000000000000000000000000..be487b64ae80162e949b84cab8f8b995f8e87b78 GIT binary patch literal 456 zcmeAS@N?(olHy`uVBq!ia0vp^1|ZDA1|-9oezpTCmUKs7M+SzC{oH>NS%G|oWRD45dJguM!v-tY$DUh!@P+6=(yLU`z6LcLCBs@Y8vBJ&@uo z@Q5sCVBk9f!i-b3`J{n@OFdm2Lo)8Yy>XVeL4l_&(LnDh$GJx~=N@tNEmhZZxg6Gd z>q+gp32O8Ia4cbAnD;66@E*VRr5Conxq0dT>R-;M*I#C4+|zrj@2kv|X9ail)(U3- zRrd15=9g`+J$fs3>E1?= ziamdy#diF62zkg{QZ1gP3Nj&jd%5B{Cl&^V7z;)tTd(#d3q?hM4puF3jVMV;EJ?LW zE=mPb3`Pb<2D%33x<9nO2Eg!|fd>LD3-z uvLQG>t)x7$D3zhSyj(9cFS|H7u^?41zbJk7I~ysWA_h-aKbLh*2~7Y^=9^Uj literal 0 HcmV?d00001 diff --git a/assets/scripts.js b/assets/scripts.js index 13e4aac..a2e5f3e 100644 --- a/assets/scripts.js +++ b/assets/scripts.js @@ -193,6 +193,8 @@ async function verifyProofs(opts) { async function displayProfile(opts) { let keyData, keyLink, feedback = "", notation, isVerified, verifications = []; + let icon_qr = ''; + try { keyData = await fetchKeys(opts); } catch (e) { @@ -267,15 +269,18 @@ async function displayProfile(opts) { } feedback += `
`; feedback += `
fingerprint
`; - feedback += ``; - feedback += `
`; - + feedback += `
${keyData.fingerprint}`; if (opts.mode == "hkp") { - feedback += `
`; - feedback += `
qrcode
`; - feedback += ``; - feedback += `
`; + feedback += `${icon_qr}`; } + feedback += `
`; + + // if (opts.mode == "hkp") { + // feedback += `
`; + // feedback += `
qrcode
`; + // feedback += ``; + // feedback += `
`; + // } if (keyData.notations.length > 0) { feedback += `
`; @@ -339,7 +344,7 @@ async function displayProfile(opts) { feedback += `unverified`; } if (verifications[i].isVerified && verifications[i].qr) { - feedback += `QR`; + feedback += `${icon_qr}`; } feedback += `
`; feedback += ``; @@ -1052,10 +1057,10 @@ if (elUtilQR) { const elInput = document.body.querySelector("#input"); - if (elInput.value) { - elInput.value = decodeURIComponent(elInput.value); - qrcode.makeCode(`${elInput.value}`); - document.body.querySelector("#qrcode--altLink").href = elInput.value; + if (elInput.innerText) { + elInput.innerText = decodeURIComponent(elInput.innerText); + qrcode.makeCode(`${elInput.innerText}`); + document.body.querySelector("#qrcode--altLink").href = elInput.innerText; } else { qrcode.clear(); } diff --git a/assets/styles.css b/assets/styles.css index ff645d3..082a825 100644 --- a/assets/styles.css +++ b/assets/styles.css @@ -166,8 +166,8 @@ input[type="submit"][disabled="true"] { select { margin: 0 0 16px 0; } -.green { - color: green; +.green, a.proofUrl.proofUrl--verified { + color: #499539; } .red { color: red; @@ -267,8 +267,13 @@ select { a.proofUrl { color: #777; } -a.proofUrl.proofUrl--verified, a.proofQR { - color: #499539; +a.proofQR { + line-height: 0; + background-color: #499539; + border-radius: 2px; +} +a.proofQR:hover { + background-color: #6abb5a; } #qrcode { diff --git a/views/util/qr.php b/views/util/qr.php index 4bf66eb..8b5a2af 100644 --- a/views/util/qr.php +++ b/views/util/qr.php @@ -3,7 +3,9 @@

QR Code

- + + + escape($input)?>
Press this link to directly open the URI