Created
April 12, 2023 19:04
-
-
Save Cheezmeister/d20f4b65d698f34a011af1697024b630 to your computer and use it in GitHub Desktop.
JS: QR Phone Numbers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
links = [ ... | |
document.querySelectorAll('a') | |
].filter(el => !!el.href?.match(/^tel:.*/)) | |
links.forEach(el => { | |
qrEl = document.createElement('a') | |
qrEl.innerText = 'QR' | |
qrEl.style = 'width: 16px; height: 16px; font-size: 8px; border-radius: 1px; border: 1px solid currentColor; background: cyan' | |
el.href = `https://duckduckgo.com/?q=!qr+${el.href}` | |
el.appendChild(qrEl) | |
}) | |
/* | |
javascript:links = [ ... document.querySelectorAll('a') ].filter(el => !!el.href?.match(/^tel:.*/)); links.forEach(el => { qrEl = document.createElement('a'); qrEl.innerText = 'QR'; qrEl.style = 'width: 16px; height: 16px; font-size: 8px; border-radius: 1px; border: 1px solid currentColor; background: cyan'; el.href = `https://duckduckgo.com/?q=!qr+${el.href}`; el.appendChild(qrEl); }); | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment